fix build
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
import { type FC } from 'react'
|
||||
import type { FormikProps } from 'formik'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import type { CreateProductType } from '../types/Types'
|
||||
|
||||
type MealTimesSectionProps = {
|
||||
formik: FormikProps<CreateProductType>
|
||||
}
|
||||
|
||||
const MealTimesSection: FC<MealTimesSectionProps> = ({ formik }) => {
|
||||
const mealTypes = [
|
||||
{ value: 'breakfast', label: 'صبحانه' },
|
||||
{ value: 'lunch', label: 'ناهار' },
|
||||
{ value: 'dinner', label: 'شام' },
|
||||
{ value: 'snack', label: 'عصرانه' }
|
||||
] as const
|
||||
|
||||
const handleMealTypeChange = (mealType: string, checked: boolean) => {
|
||||
const currentMealTypes = formik.values.mealTypes || []
|
||||
if (checked) {
|
||||
if (!currentMealTypes.includes(mealType)) {
|
||||
formik.setFieldValue('mealTypes', [...currentMealTypes, mealType])
|
||||
}
|
||||
} else {
|
||||
formik.setFieldValue('mealTypes', currentMealTypes.filter(m => m !== mealType))
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='mt-6'>
|
||||
<div className='text-sm mb-3'>وعدههای کالایی</div>
|
||||
<div className='text-xs text-gray-500 mb-3 bg-gray-50 p-3 rounded-lg border border-gray-200'>
|
||||
<div>ساعات 6 تا 11 صبح :صبحانه</div>
|
||||
<div>11 تا 15 ناهار</div>
|
||||
<div>15 تا 19 عصرانه</div>
|
||||
<div>18 تا 24 شام</div>
|
||||
</div>
|
||||
<div className='flex gap-4 sm:gap-6 flex-wrap'>
|
||||
{mealTypes.map((mealType) => (
|
||||
<div key={mealType.value} className='flex items-center gap-2'>
|
||||
<Checkbox
|
||||
checked={(formik.values.mealTypes || []).includes(mealType.value)}
|
||||
onCheckedChange={(checked) => handleMealTypeChange(mealType.value, checked as boolean)}
|
||||
/>
|
||||
<label className='text-xs cursor-pointer'>{mealType.label}</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default MealTimesSection
|
||||
@@ -1,54 +0,0 @@
|
||||
import { type FC } from 'react'
|
||||
import type { FormikProps } from 'formik'
|
||||
import Input from '@/components/Input'
|
||||
import Button from '@/components/Button'
|
||||
import type { CreateProductType } from '../types/Types'
|
||||
|
||||
type ProductContentSectionProps = {
|
||||
formik: FormikProps<CreateProductType>
|
||||
}
|
||||
|
||||
const ProductContentSection: FC<ProductContentSectionProps> = ({ formik }) => {
|
||||
|
||||
return (
|
||||
<div className='mt-5'>
|
||||
<div className='text-sm mb-2'>محتوای کالا</div>
|
||||
<div className='space-y-2'>
|
||||
{formik.values.content.map((item, index) => (
|
||||
<div key={index} className='flex gap-2 items-center'>
|
||||
<Input
|
||||
placeholder='متن محتوا'
|
||||
value={item}
|
||||
onChange={(e) => {
|
||||
const newContent = [...formik.values.content]
|
||||
newContent[index] = e.target.value
|
||||
formik.setFieldValue('content', newContent)
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
type='button'
|
||||
className='px-3 bg-red-500 hover:bg-red-600 w-auto'
|
||||
onClick={() => {
|
||||
const newContent = formik.values.content.filter((_, i) => i !== index)
|
||||
formik.setFieldValue('content', newContent)
|
||||
}}
|
||||
>
|
||||
حذف
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
<Button
|
||||
type='button'
|
||||
className='w-full bg-gray-200 text-gray-700 hover:bg-gray-300'
|
||||
onClick={() => {
|
||||
formik.setFieldValue('content', [...formik.values.content, ''])
|
||||
}}
|
||||
>
|
||||
افزودن محتوا
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ProductContentSection
|
||||
@@ -1,34 +0,0 @@
|
||||
import { type FC } from 'react'
|
||||
import type { FormikProps } from 'formik'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import type { CreateProductType } from '../types/Types'
|
||||
|
||||
type ServiceOptionsSectionProps = {
|
||||
formik: FormikProps<CreateProductType>
|
||||
}
|
||||
|
||||
const ServiceOptionsSection: FC<ServiceOptionsSectionProps> = ({ formik }) => {
|
||||
return (
|
||||
<div className='mt-6'>
|
||||
<div className='text-sm mb-3'>گزینههای سرویس</div>
|
||||
<div className='flex gap-4 sm:gap-6 flex-wrap'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<Checkbox
|
||||
checked={formik.values.pickupServe}
|
||||
onCheckedChange={(checked) => formik.setFieldValue('pickupServe', checked)}
|
||||
/>
|
||||
<label className='text-xs cursor-pointer'> بیرونبر</label>
|
||||
</div>
|
||||
<div className='flex items-center gap-2'>
|
||||
<Checkbox
|
||||
checked={formik.values.inPlaceServe}
|
||||
onCheckedChange={(checked) => formik.setFieldValue('inPlaceServe', checked)}
|
||||
/>
|
||||
<label className='text-xs cursor-pointer'>سرو در محل</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ServiceOptionsSection
|
||||
@@ -1,50 +0,0 @@
|
||||
import { type FC } from 'react'
|
||||
import type { FormikProps } from 'formik'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
import type { CreateProductType } from '../types/Types'
|
||||
|
||||
type WeekDaysSectionProps = {
|
||||
formik: FormikProps<CreateProductType>
|
||||
}
|
||||
|
||||
const WeekDaysSection: FC<WeekDaysSectionProps> = ({ formik }) => {
|
||||
const weekDays = [
|
||||
{ value: 0, label: 'شنبه' },
|
||||
{ value: 1, label: 'یکشنبه' },
|
||||
{ value: 2, label: 'دوشنبه' },
|
||||
{ value: 3, label: 'سهشنبه' },
|
||||
{ value: 4, label: 'چهارشنبه' },
|
||||
{ value: 5, label: 'پنجشنبه' },
|
||||
{ value: 6, label: 'جمعه' }
|
||||
] as const
|
||||
|
||||
const handleDayChange = (dayValue: number, checked: boolean) => {
|
||||
const currentDays = formik.values.weekDays || []
|
||||
if (checked) {
|
||||
if (!currentDays.includes(dayValue)) {
|
||||
formik.setFieldValue('weekDays', [...currentDays, dayValue])
|
||||
}
|
||||
} else {
|
||||
formik.setFieldValue('weekDays', currentDays.filter(d => d !== dayValue))
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='mt-6'>
|
||||
<div className='text-sm mb-3'>روزهای هفته</div>
|
||||
<div className='flex gap-4 sm:gap-6 flex-wrap'>
|
||||
{weekDays.map((day) => (
|
||||
<div key={day.value} className='flex items-center gap-2'>
|
||||
<Checkbox
|
||||
checked={(formik.values.weekDays || []).includes(day.value)}
|
||||
onCheckedChange={(checked) => handleDayChange(day.value, checked as boolean)}
|
||||
/>
|
||||
<label className='text-xs cursor-pointer'>{day.label}</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default WeekDaysSection
|
||||
Reference in New Issue
Block a user