changes
This commit is contained in:
@@ -567,7 +567,7 @@ async function update() {
|
||||
customerData.update_time = new Date();
|
||||
|
||||
let res = isNewCustomer.value
|
||||
? await $insertapi("customer", customerData, undefined, false)
|
||||
? await $insertapi("customer", { data: customerData, notify: false })
|
||||
: await $patchapi("customer", customerData, undefined, false);
|
||||
if (!res || res === "error") return;
|
||||
|
||||
@@ -579,7 +579,7 @@ async function update() {
|
||||
indPayload.customer = customerId;
|
||||
if (individualData.value.id)
|
||||
await $patchapi("individual", { ...indPayload, id: individualData.value.id }, undefined, false);
|
||||
else await $insertapi("individual", indPayload, undefined, false);
|
||||
else await $insertapi("individual", { data: indPayload, notify: false });
|
||||
} else if (isOrganization.value) {
|
||||
let orgPayload = $resetNull({ ...organizationData.value });
|
||||
orgPayload.customer = customerId;
|
||||
@@ -587,7 +587,7 @@ async function update() {
|
||||
if (organizationData.value.id) {
|
||||
orgRes = await $patchapi("organization", { ...orgPayload, id: organizationData.value.id }, undefined, false);
|
||||
} else {
|
||||
orgRes = await $insertapi("organization", orgPayload, undefined, false);
|
||||
orgRes = await $insertapi("organization", { data: orgPayload, notify: false });
|
||||
}
|
||||
if (orgRes && orgRes.id) {
|
||||
organizationId = orgRes.id;
|
||||
@@ -622,7 +622,7 @@ async function update() {
|
||||
validLocalPeople.forEach((lp) => {
|
||||
if (!lp.id) {
|
||||
const payload = { ...lp, ...commonPayload };
|
||||
$insertapi(apiName, payload);
|
||||
$insertapi(apiName, { data: payload });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -638,12 +638,10 @@ async function update() {
|
||||
|
||||
// Ảnh
|
||||
if (record.value.image && record.value.image.length > 0) {
|
||||
await $insertapi(
|
||||
"customerfile",
|
||||
record.value.image.map((v) => ({ ref: customerId, file: v })),
|
||||
undefined,
|
||||
false,
|
||||
);
|
||||
await $insertapi("customerfile", {
|
||||
data: record.value.image.map((v) => ({ ref: customerId, file: v })),
|
||||
notify: false,
|
||||
});
|
||||
}
|
||||
|
||||
const completeData = await $getdata("customer", { id: customerId }, undefined, true);
|
||||
|
||||
Reference in New Issue
Block a user