diff --git a/src/features/cart/lib/api.ts b/src/features/cart/lib/api.ts index 5f4b326..928f7da 100644 --- a/src/features/cart/lib/api.ts +++ b/src/features/cart/lib/api.ts @@ -58,7 +58,7 @@ export interface OrderCreateBody { person_code: string; currency_code: string; owner_person_code: string; - note: string; + note?: string; order_products: { inventory_kind: string; product_code: string; diff --git a/src/features/cart/lib/form.ts b/src/features/cart/lib/form.ts index 575791f..1d16ab3 100644 --- a/src/features/cart/lib/form.ts +++ b/src/features/cart/lib/form.ts @@ -5,7 +5,7 @@ export const orderForm = z.object({ lat: z.string().min(1, { message: 'Majburiy maydon' }), comment: z .string() - .min(1, "Eng kamida 1ta belgi bo'lishi kerak") + // .min(1, "Eng kamida 1ta belgi bo'lishi kerak") .max(300, 'Izoh 300 ta belgidan oshmasligi kerak'), city: z.string().optional(), }); diff --git a/src/features/cart/ui/OrderPage.tsx b/src/features/cart/ui/OrderPage.tsx index 5d5df38..ee04bf3 100644 --- a/src/features/cart/ui/OrderPage.tsx +++ b/src/features/cart/ui/OrderPage.tsx @@ -339,6 +339,7 @@ const OrderPage = () => { })); if (user) { const dealTime = formatDate.format(deliveryDate, 'DD.MM.YYYY'); + const note = value.comment.trim() ? value.comment : undefined; mutate({ order: [ { @@ -352,8 +353,8 @@ const OrderPage = () => { person_code: user?.username, currency_code: '860', owner_person_code: user?.username, - note: value.comment, order_products: order_products, + note: note, }, ], }); @@ -454,11 +455,6 @@ const OrderPage = () => { {t('Izoh 300 ta belgidan oshmasligi kerak')}

)} - {comment.length === 0 && ( -

- {t("Izoh kamida 1ta belgi bo'lishi kerak")} -

- )} ); }} diff --git a/src/features/profile/ui/RefreshOrder.tsx b/src/features/profile/ui/RefreshOrder.tsx index 7e76b92..a50e007 100644 --- a/src/features/profile/ui/RefreshOrder.tsx +++ b/src/features/profile/ui/RefreshOrder.tsx @@ -375,7 +375,7 @@ const RefreshOrder = () => { })); if (user) { const dealTime = formatDate.format(deliveryDate, 'DD.MM.YYYY'); - + const note = value.comment.trim() ? value.comment : undefined; mutate({ order: [ { @@ -389,7 +389,7 @@ const RefreshOrder = () => { person_code: user?.username, currency_code: '860', owner_person_code: user?.username, - note: value.comment, + note: note, order_products: order_products, }, ], @@ -522,11 +522,6 @@ const RefreshOrder = () => { {t('Izoh 300 ta belgidan oshmasligi kerak')}

)} - {comment.length === 0 && ( -

- {t("Izoh kamida 1ta belgi bo'lishi kerak")} -

- )} )} />