From 0a3e3bd316780adf8dc1909e711f21490e6d73b9 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Wed, 26 Nov 2025 09:58:28 +0330 Subject: [PATCH] remove advantages + disadvantages --- .../category/components/VariantModal.tsx | 2 +- .../products/components/CreateVariant.tsx | 22 +-- src/pages/products/components/Step2Form.tsx | 140 +++++++++--------- src/pages/products/types/Types.ts | 6 +- 4 files changed, 86 insertions(+), 84 deletions(-) diff --git a/src/pages/category/components/VariantModal.tsx b/src/pages/category/components/VariantModal.tsx index 3899df2..0fc3c8d 100644 --- a/src/pages/category/components/VariantModal.tsx +++ b/src/pages/category/components/VariantModal.tsx @@ -116,7 +116,7 @@ const VariantModal: FC = ({ title_header={getModalTitle()} width={500} > -
+
{renderFormContent()}
diff --git a/src/pages/products/components/CreateVariant.tsx b/src/pages/products/components/CreateVariant.tsx index 333f692..e27f0a9 100644 --- a/src/pages/products/components/CreateVariant.tsx +++ b/src/pages/products/components/CreateVariant.tsx @@ -48,9 +48,9 @@ const CreateVariant: FC = () => { sellerSpecialCode: Yup.string(), retail_price: Yup.number().required('قیمت فروش الزامی است').min(0, 'قیمت نمی‌تواند منفی باشد'), package_weight: Yup.number().required('وزن بسته الزامی است').min(0.1, 'وزن باید حداقل ۰.۱ کیلوگرم باشد'), - package_height: Yup.number().required('ارتفاع بسته الزامی است').min(1, 'ارتفاع باید حداقل ۱ سانتی‌متر باشد'), - package_length: Yup.number().required('طول بسته الزامی است').min(1, 'طول باید حداقل ۱ سانتی‌متر باشد'), - package_width: Yup.number().required('عرض بسته الزامی است').min(1, 'عرض باید حداقل ۱ سانتی‌متر باشد'), + // package_height: Yup.number().required('ارتفاع بسته الزامی است').min(1, 'ارتفاع باید حداقل ۱ سانتی‌متر باشد'), + // package_length: Yup.number().required('طول بسته الزامی است').min(1, 'طول باید حداقل ۱ سانتی‌متر باشد'), + // package_width: Yup.number().required('عرض بسته الزامی است').min(1, 'عرض باید حداقل ۱ سانتی‌متر باشد'), postingTime: Yup.number().required('زمان ارسال الزامی است').min(1, 'زمان ارسال باید حداقل ۱ روز باشد'), stock: Yup.number().required('موجودی انبار الزامی است').min(0, 'موجودی نمی‌تواند منفی باشد'), specialSale_order_limit: Yup.number().min(0, 'محدودیت فروش ویژه نمی‌تواند منفی باشد'), @@ -65,9 +65,9 @@ const CreateVariant: FC = () => { sellerSpecialCode: '' as string | undefined, retail_price: '', package_weight: '', - package_height: '', - package_length: '', - package_width: '', + // package_height: '', + // package_length: '', + // package_width: '', postingTime: '', stock: '', specialSale_order_limit: '', @@ -121,9 +121,9 @@ const CreateVariant: FC = () => { sellerSpecialCode: values.sellerSpecialCode, retail_price: parseFloat(values.retail_price), package_weight: parseFloat(values.package_weight), - package_height: parseFloat(values.package_height), - package_length: parseFloat(values.package_length), - package_width: parseFloat(values.package_width), + package_height: 10, // مقدار پیش‌فرض + package_length: 10, // مقدار پیش‌فرض + package_width: 10, // مقدار پیش‌فرض postingTime: parseInt(values.postingTime), stock: parseInt(values.stock) } @@ -318,7 +318,7 @@ const CreateVariant: FC = () => {
-
+ {/*
{({ field }: FormikFieldProps) => ( { )} -
+
*/}
diff --git a/src/pages/products/components/Step2Form.tsx b/src/pages/products/components/Step2Form.tsx index bf504fa..20ff63a 100644 --- a/src/pages/products/components/Step2Form.tsx +++ b/src/pages/products/components/Step2Form.tsx @@ -189,76 +189,76 @@ const TagInput: FC = ({ tags, onChange, placeholder }) => { }; // کامپوننت مدیریت لیست مزایا/معایب -interface ListInputProps { - items: string[]; - onChange: (items: string[]) => void; - placeholder?: string; - label: string; -} +// interface ListInputProps { +// items: string[]; +// onChange: (items: string[]) => void; +// placeholder?: string; +// label: string; +// } -const ListInput: FC = ({ items, onChange, placeholder, label }) => { - const [inputValue, setInputValue] = useState(''); +// const ListInput: FC = ({ items, onChange, placeholder, label }) => { +// const [inputValue, setInputValue] = useState(''); - const addItem = () => { - const newItem = inputValue.trim(); - if (newItem && !items.includes(newItem)) { - onChange([...items, newItem]); - setInputValue(''); - } - }; +// const addItem = () => { +// const newItem = inputValue.trim(); +// if (newItem && !items.includes(newItem)) { +// onChange([...items, newItem]); +// setInputValue(''); +// } +// }; - const removeItem = (itemToRemove: string) => { - onChange(items.filter(item => item !== itemToRemove)); - }; +// const removeItem = (itemToRemove: string) => { +// onChange(items.filter(item => item !== itemToRemove)); +// }; - const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { - e.preventDefault(); - addItem(); - } - }; +// const handleKeyDown = (e: React.KeyboardEvent) => { +// if (e.key === 'Enter') { +// e.preventDefault(); +// addItem(); +// } +// }; - return ( -
- -
- setInputValue(e.target.value)} - onKeyDown={handleKeyDown} - placeholder={placeholder} - className="flex-1" - /> - -
- {items.length > 0 && ( -
- {items.map((item, index) => ( -
- {item} - -
- ))} -
-
-
- )} -
- ); -}; +// return ( +//
+// +//
+// setInputValue(e.target.value)} +// onKeyDown={handleKeyDown} +// placeholder={placeholder} +// className="flex-1" +// /> +// +//
+// {items.length > 0 && ( +//
+// {items.map((item, index) => ( +//
+// {item} +// +//
+// ))} +//
+//
+//
+// )} +//
+// ); +// }; const Step2Form: FC = ({ onSubmit, loading, onPrevious, categoryId, initialData, specifications }) => { const [formData, setFormData] = useState>(() => ({ @@ -266,8 +266,10 @@ const Step2Form: FC = ({ onSubmit, loading, onPrevious, category description: initialData?.description || '', metaDescription: initialData?.metaDescription || '', tags: initialData?.tags || [], - advantages: initialData?.advantages || [], - disAdvantages: initialData?.disAdvantages || [] + // advantages: initialData?.advantages || [], + // disAdvantages: initialData?.disAdvantages || [] + advantages: [], + disAdvantages: [] })); const { data: categoryAttributesData } = useGetCategoryAttributes(categoryId || ''); @@ -403,7 +405,7 @@ const Step2Form: FC = ({ onSubmit, loading, onPrevious, category /> - setFormData(prev => ({ ...prev, advantages }))} @@ -415,7 +417,7 @@ const Step2Form: FC = ({ onSubmit, loading, onPrevious, category items={formData.disAdvantages} onChange={(disAdvantages) => setFormData(prev => ({ ...prev, disAdvantages }))} placeholder="عیبی را وارد کنید..." - /> + /> */}