bug fix
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/shared/ui/select';
|
||||
import { Textarea } from '@/shared/ui/textarea';
|
||||
import { userStore } from '@/widgets/welcome/lib/hook';
|
||||
import { zodResolver } from '@hookform/resolvers/zod';
|
||||
import {
|
||||
Map,
|
||||
@@ -72,6 +73,7 @@ const deliveryTimeSlots = [
|
||||
|
||||
const OrderPage = () => {
|
||||
const t = useTranslations();
|
||||
const { user } = userStore();
|
||||
const form = useForm<z.infer<typeof orderForm>>({
|
||||
resolver: zodResolver(orderForm),
|
||||
defaultValues: {
|
||||
@@ -103,7 +105,7 @@ const OrderPage = () => {
|
||||
|
||||
queryClinet.refetchQueries({ queryKey: ['cart_items'] });
|
||||
} else {
|
||||
toast.error('Xatolik yuz berdi', {
|
||||
toast.error(t('Xatolik yuz berdi'), {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
@@ -235,7 +237,7 @@ const OrderPage = () => {
|
||||
|
||||
function onSubmit(value: z.infer<typeof orderForm>) {
|
||||
if (!cartItems || cartItems.length === 0) {
|
||||
toast.error("Savatcha bo'sh", {
|
||||
toast.error(t("Savatcha bo'sh"), {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
@@ -244,7 +246,7 @@ const OrderPage = () => {
|
||||
|
||||
// Yetkazib berish vaqtini tekshirish
|
||||
if (!deliveryDate) {
|
||||
toast.error('Yetkazib berish sanasini tanlang', {
|
||||
toast.error(t('Yetkazib berish sanasini tanlang'), {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
@@ -252,7 +254,7 @@ const OrderPage = () => {
|
||||
}
|
||||
|
||||
if (!selectedTimeSlot) {
|
||||
toast.error('Yetkazib berish vaqtini tanlang', {
|
||||
toast.error(t('Yetkazib berish vaqtini tanlang'), {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
@@ -276,25 +278,31 @@ const OrderPage = () => {
|
||||
product_price: item.product.prices![0].price,
|
||||
warehouse_code: 'wh1',
|
||||
}));
|
||||
|
||||
mutate({
|
||||
order: [
|
||||
{
|
||||
filial_code: 'dodge',
|
||||
delivery_date: formatDate.format(deliveryDate, 'DD.MM.YYYY'),
|
||||
room_code: '100',
|
||||
deal_time: formatDate.format(deliveryDate, 'DD.MM.YYYY'),
|
||||
robot_code: 'r2',
|
||||
status: 'B#N',
|
||||
sales_manager_code: '1',
|
||||
person_code: '12345678',
|
||||
currency_code: '860',
|
||||
owner_person_code: '1234567',
|
||||
note: value.comment,
|
||||
order_products: order_products,
|
||||
},
|
||||
],
|
||||
});
|
||||
if (user) {
|
||||
mutate({
|
||||
order: [
|
||||
{
|
||||
filial_code: 'dodge',
|
||||
delivery_date: formatDate.format(deliveryDate, 'DD.MM.YYYY'),
|
||||
room_code: '100',
|
||||
deal_time: formatDate.format(deliveryDate, 'DD.MM.YYYY'),
|
||||
robot_code: 'r2',
|
||||
status: 'B#N',
|
||||
sales_manager_code: '1',
|
||||
person_code: user?.person_id.toString(),
|
||||
currency_code: '860',
|
||||
owner_person_code: user?.person_id.toString(),
|
||||
note: value.comment,
|
||||
order_products: order_products,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else {
|
||||
toast.error(t('Xatolik yuz berdi'), {
|
||||
richColors: true,
|
||||
position: 'top-center',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (orderSuccess) {
|
||||
|
||||
Reference in New Issue
Block a user