edit packet
This commit is contained in:
@@ -119,7 +119,7 @@ const DashboardCreateBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
box_size: '50x40x40',
|
box_size: '50x40x40',
|
||||||
status: 'READY_TO_INVOICE',
|
status: 'READY_TO_INVOICE',
|
||||||
cargoId: initialValues?.client_id,
|
cargoId: initialValues?.client_id,
|
||||||
// passportId: {value: initialValues?.passportId},
|
passportId: { value: initialValues?.passportId },
|
||||||
...(editMode
|
...(editMode
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
@@ -184,11 +184,11 @@ const DashboardCreateBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
dependencies: [cargoId],
|
dependencies: [cargoId],
|
||||||
placeholderData: [], // Kerak emas, chunki server PageAble qaytarmayapti
|
placeholderData: [], // Kerak emas, chunki server PageAble qaytarmayapti
|
||||||
onSuccess(data) {
|
onSuccess(data) {
|
||||||
// if (data?.data.data?.[0]?.id) {
|
if (data?.data.data?.[0]?.id) {
|
||||||
// setValue("passportId", initialValues?.passportId)
|
setValue("passportId", initialValues?.passportId)
|
||||||
// setValue('passport_id', data.data.data[0].id);
|
setValue('passport_id', data.data.data[0].id);
|
||||||
// setSelectedPassport(data.data.data[0]); // Birinchi elementni tanlash
|
setSelectedPassport(data.data.data[0]); // Birinchi elementni tanlash
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -258,10 +258,9 @@ const DashboardCreateBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
if (editMode) {
|
if (editMode) {
|
||||||
const updateBody: UpdateBoxBodyType = {
|
const updateBody: UpdateBoxBodyType = {
|
||||||
cargoId: values.client_id,
|
cargoId: values.client_id,
|
||||||
passportId: values.passportId.value,
|
passportId: values.passportId?.value || values.passport_id,
|
||||||
status: values.status,
|
status: values.status,
|
||||||
packetId: initialValues?.packetId,
|
packetId: initialValues?.packetId,
|
||||||
|
|
||||||
items: values.products_list.map((item: any) => {
|
items: values.products_list.map((item: any) => {
|
||||||
const _price = +item.price ? +item.price : 0;
|
const _price = +item.price ? +item.price : 0;
|
||||||
const _amount = +item.amount ? +item.amount : 0;
|
const _amount = +item.amount ? +item.amount : 0;
|
||||||
@@ -269,9 +268,7 @@ const DashboardCreateBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
// cargoId: item.cargoId,
|
|
||||||
trekId: item.trekId,
|
trekId: item.trekId,
|
||||||
// name: item.name + (item.nameRu ? ` / ${item.nameRu}` : ''),
|
|
||||||
name: item.name,
|
name: item.name,
|
||||||
nameRu: item?.nameRu,
|
nameRu: item?.nameRu,
|
||||||
weight: +item.weight,
|
weight: +item.weight,
|
||||||
@@ -555,7 +552,7 @@ const DashboardCreateBoxPage = ({ initialValues, partiesData }: Props) => {
|
|||||||
if (!Number.isNaN(p)) {
|
if (!Number.isNaN(p)) {
|
||||||
totalPrice = p;
|
totalPrice = p;
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) { }
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box key={product.key} mb={1.5}>
|
<Box key={product.key} mb={1.5}>
|
||||||
|
|||||||
Reference in New Issue
Block a user