fix: item bundling replace when edit

pull/94/head
shancheas 2024-09-20 11:06:09 +07:00
parent e09c76309e
commit b34d54e7d0
1 changed files with 10 additions and 9 deletions

View File

@ -178,6 +178,16 @@ export function mappingRevertTransaction(data, type) {
const total_share_tenant =
share_margin > 0 ? (Number(share_margin) / 100) * total_price : 0;
item.item.bundling_items = item.item.bundling_items?.map((bundling) => {
if (bundling.item_id) return bundling;
return {
...bundling,
item_id: bundling.id,
item_name: bundling.name,
id: uuidv4(),
};
});
Object.assign(item, {
item_id: item.item.id,
item_name: item.item.name,
@ -192,15 +202,6 @@ export function mappingRevertTransaction(data, type) {
(bundling) => bundling.name,
),
breakdown_bundling: item.item.breakdown_bundling,
bundling_items: item.item.bundling_items?.map((bundling) => {
if (bundling.item_id) return bundling;
return {
...bundling,
item_id: bundling.id,
item_name: bundling.name,
id: uuidv4(),
};
}),
item_tenant_id: item.item.tenant?.id ?? null,
item_tenant_name: item.item.tenant?.id ?? null,