@feedmepos/mf-inventory-portal 1.0.8 → 1.0.9-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-DeBNx7kq.js → App-DfxhucPn.js} +50 -49
- package/dist/{ApprovalView-CYgDG4X-.js → ApprovalView-BUYgTb8S.js} +24 -24
- package/dist/{BindingsDialog-Bojdsd9h.js → BindingsDialog-Cbs9aVch.js} +2 -2
- package/dist/{BindingsPicker-TkiARkrC.js → BindingsPicker-BH9bil6g.js} +3 -3
- package/dist/{BindingsTable-BWYaPoFt.js → BindingsTable-DBsS_9yb.js} +1 -1
- package/dist/ClosingDraftView-CcQssDLY.js +1415 -0
- package/dist/{ClosingTemplateView-CUjkAFjw.js → ClosingTemplateView-BHPqi-bL.js} +10 -10
- package/dist/{DeliveryOrderPrintPreview-BOEKl7zP.js → DeliveryOrderPrintPreview-DlTLtZ1f.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bve5cng3.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CtJSPDCo.js} +32 -32
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-1-G4gmCj.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B-erI7fq.js} +51 -51
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bl526zYj.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DT4nyE8i.js} +1 -1
- package/dist/{IngredientGroupView-stli1Xiv.js → IngredientGroupView-DE15kdqH.js} +11 -11
- package/dist/{IngredientsView-jmDSRSkr.js → IngredientsView-BCEznLxB.js} +15 -14
- package/dist/{IntegrationView-BQZtDqlR.js → IntegrationView-COSJuqnB.js} +146 -145
- package/dist/{InventoryBindingForm-hHgB20dI.js → InventoryBindingForm-B3C8gktf.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BK36mlQE.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Bn2X1jxB.js} +20 -20
- package/dist/{InventoryBindingSummary-JsAhd0Jm.js → InventoryBindingSummary-BF1OtGum.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C4A6bDPB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BMTXHa4I.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-C6bND0mn.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CZR7wF6-.js} +10 -10
- package/dist/{PublishView-BK7WwXeV.js → PublishView-Cp5tpVb0.js} +12 -12
- package/dist/{PurchaseOrderPrintPreview-CMnaZkzc.js → PurchaseOrderPrintPreview-DWOcxCH8.js} +4 -4
- package/dist/{ReceiveRequestView-Bb6RQyJ8.js → ReceiveRequestView-CRuhm8r1.js} +53 -52
- package/dist/{RecipeView-CZnElbJ8.js → RecipeView-BTS1LBKZ.js} +29 -29
- package/dist/{StockView-CDAHrTyi.js → StockView-CuK8s5rt.js} +73 -72
- package/dist/{SupplierView-WTgrwbJ_.js → SupplierView-Bwpe9RoM.js} +12 -11
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DDAZMTzq.js +1897 -0
- package/dist/{TransferTemplateView-26w6orAY.js → TransferTemplateView-BlluEiV-.js} +291 -290
- package/dist/{UnitView-DAl0OS01.js → UnitView-BWGQHOWP.js} +23 -23
- package/dist/{WarehouseView-Db2wXza_.js → WarehouseView-dOCu22dg.js} +26 -26
- package/dist/api/bill.d.ts +2 -2
- package/dist/api/food-market-hub.d.ts +1 -1
- package/dist/api/inventory.d.ts +44 -44
- package/dist/api/netsuite.d.ts +3 -3
- package/dist/api/purchase-order.d.ts +5 -1
- package/dist/api/stock.d.ts +1 -0
- package/dist/{app-Ch3IXeOL.js → app-BkIAyhP-.js} +16504 -16961
- package/dist/app.d.ts +7 -7
- package/dist/app.js +1 -1
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +8 -8
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +5 -5
- package/dist/composable/usePromise.d.ts +41 -0
- package/dist/{decimal-BFWsfQmw.js → decimal-BiC7uGww.js} +1 -1
- package/dist/feature-CCDDWpq8.js +17319 -0
- package/dist/{format-unit-display-CyBzA_Ye.js → format-unit-display-CLa0op_h.js} +60 -60
- package/dist/{index-CKB7R0y2.js → index-BbFvsU1Z.js} +7 -6
- package/dist/{index-CSjhH3PC.js → index-UgbyiGok.js} +1 -1
- package/dist/{stock-BjY9UvKO.js → stock-SxO4bxTm.js} +29 -25
- package/dist/stores/feature.d.ts +5 -20
- package/dist/stores/integration/foodmarkethub.d.ts +1 -1
- package/dist/stores/integration/netsuite.d.ts +7 -7
- package/dist/stores/inventory.d.ts +44 -44
- package/dist/stores/location.d.ts +137 -137
- package/dist/{supplier-8x-ZFcOk.js → supplier-BVdCk7nI.js} +4 -4
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CxZAaSGc.js → use-ingredient-select-dialog-CDeGXhur.js} +1 -1
- package/dist/{use-inventory-binding-dialog-Kmg24YiM.js → use-inventory-binding-dialog-CeRKqMy7.js} +1 -1
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +228 -228
- package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +2 -2
- package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +1 -1
- package/dist/views/adjustment-template/wastage-template/table.d.ts +234 -234
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +780 -74
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +424 -409
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +4 -4
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +252 -252
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +252 -252
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +12 -12
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +8 -8
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +3 -3
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +4 -4
- package/dist/views/integration/components/ApplyProduct.vue.d.ts +2 -2
- package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +2 -2
- package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +2 -2
- package/dist/views/integration/components/netsuite/AddLocationDialog.vue.d.ts +204 -204
- package/dist/views/integration/components/netsuite/LocationConfigurationDialog.vue.d.ts +2 -2
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +665 -637
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +22 -22
- package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +44 -44
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +11 -11
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +614 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1190 -1142
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1192 -1144
- package/dist/views/receive-request/constants/po-action-to-ui-style.d.ts +6 -0
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +14 -14
- package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +22 -22
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +17 -17
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +11 -11
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +805 -805
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +805 -805
- package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +33 -33
- package/dist/{vue-i18n-CXd9SF_G.js → vue-i18n-3Mh8tKq8.js} +341 -341
- package/package.json +3 -1
- package/dist/ClosingDraftView-C0ECZ9zi.js +0 -1394
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-mHNmxBuV.js +0 -1746
|
@@ -0,0 +1,1897 @@
|
|
|
1
|
+
import { X as it, u as ue, aH as N, b as Ue, a2 as ut, a4 as dt, a5 as mt, aI as ft, d as We, e as tt, V as rt, aJ as pt, Z as Fe, K as Oe, i as oe, aK as st, a9 as ke, f as Xe, h as K, D as Z, aq as se, a3 as yt, an as Je, a1 as xe, aL as vt, ae as Pe, ar as ht } from "./app-BkIAyhP-.js";
|
|
2
|
+
import { ref as V, computed as z, h as q, defineComponent as De, onMounted as at, unref as p, openBlock as w, createElementBlock as D, createElementVNode as s, toDisplayString as R, createCommentVNode as L, resolveComponent as H, createVNode as E, reactive as bt, createBlock as le, withCtx as ie, watch as gt, isRef as _t, Fragment as te, normalizeClass as Re, createTextVNode as $e, renderList as pe, resolveDynamicComponent as wt } from "vue";
|
|
3
|
+
import { F as St } from "./decimal-BiC7uGww.js";
|
|
4
|
+
import { b as xt, u as Rt, f as nt, P as ve } from "./format-unit-display-CLa0op_h.js";
|
|
5
|
+
import { useCoreStore as Le, useI18n as ot } from "@feedmepos/mf-common";
|
|
6
|
+
import { E as Ot } from "./empty-placeholder-wf6-BWE8.js";
|
|
7
|
+
import { useDialog as Ve, useSnackbar as Me, components as Ze, FmButtonVariant as re, useProxiedModel as kt } from "@feedmepos/ui-library";
|
|
8
|
+
import { u as je, F as Ce } from "./feature-CCDDWpq8.js";
|
|
9
|
+
import { u as Dt } from "./index-BbFvsU1Z.js";
|
|
10
|
+
import { _ as Nt, F as qt, a as At } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-B-erI7fq.js";
|
|
11
|
+
const Ne = it((t, l) => {
|
|
12
|
+
const n = ue(), h = Le();
|
|
13
|
+
return {
|
|
14
|
+
async readRequests(i, a = !1) {
|
|
15
|
+
const d = i ?? n.currentLocationDBName, y = `${t.inventoryBackendUrl}/${d}/purchase-request?${a ? "includeReturnRequest=true" : ""}`;
|
|
16
|
+
return await l.get(y);
|
|
17
|
+
},
|
|
18
|
+
async readRequestById(i, a) {
|
|
19
|
+
const d = a ?? n.currentLocationDBName, y = `${t.inventoryBackendUrl}/${d}/purchase-request/${i}`;
|
|
20
|
+
return await l.get(y);
|
|
21
|
+
},
|
|
22
|
+
async readRequestByIds(i, a) {
|
|
23
|
+
const d = a ?? n.currentLocationDBName, y = `${t.inventoryBackendUrl}/${d}/purchase-request/find`;
|
|
24
|
+
return await l.post(y, { requestIds: i });
|
|
25
|
+
},
|
|
26
|
+
async getPurchaseOrders({
|
|
27
|
+
start: i,
|
|
28
|
+
end: a
|
|
29
|
+
}) {
|
|
30
|
+
const d = n.currentLocationDBName, y = `${t.inventoryBackendUrl}/${d}/purchase-order`;
|
|
31
|
+
return await l.get(`${y}?start=${i}&end=${a}`);
|
|
32
|
+
},
|
|
33
|
+
async getLatestPurchaseOrderRequest(i) {
|
|
34
|
+
const a = n.currentLocationDBName, d = `${t.inventoryBackendUrl}/${a}/purchase-request/find-by-purchase-order-id`;
|
|
35
|
+
return await l.get(`${d}/${i}`);
|
|
36
|
+
},
|
|
37
|
+
async getPurchaseOrderById(i) {
|
|
38
|
+
const a = n.currentLocationDBName, d = `${t.inventoryBackendUrl}/${a}/purchase-order`;
|
|
39
|
+
return await l.get(`${d}/${i}`);
|
|
40
|
+
},
|
|
41
|
+
async processPurchaseOrder(i, a) {
|
|
42
|
+
const d = n.currentLocationDBName, y = a || d, o = `${t.inventoryBackendUrl}/${y}/purchase-order/run-operation`;
|
|
43
|
+
return await l.put(o, i);
|
|
44
|
+
},
|
|
45
|
+
async processPurchaseOrderV2(i, a) {
|
|
46
|
+
const d = n.currentLocationDBName, y = a || d, o = `${t.inventoryBackendUrl}/${y}/v2/purchase-order/run-operation`;
|
|
47
|
+
return await l.put(o, i);
|
|
48
|
+
},
|
|
49
|
+
async createPurchaseOrder(i) {
|
|
50
|
+
const a = n.currentLocationDBName, d = `${t.inventoryBackendUrl}/${a}/purchase-order`;
|
|
51
|
+
return await l.post(d, i);
|
|
52
|
+
},
|
|
53
|
+
async updatePurchaseOrder(i) {
|
|
54
|
+
const a = n.currentLocationDBName, d = `${t.inventoryBackendUrl}/${a}/purchase-order`;
|
|
55
|
+
return await l.put(d, i);
|
|
56
|
+
},
|
|
57
|
+
async importFromXilnex(i) {
|
|
58
|
+
const a = n.currentLocationDBName, d = `${t.inventoryBackendUrl}/${a}/purchase-order/import-from-xilnex`;
|
|
59
|
+
return await l.post(d, i);
|
|
60
|
+
},
|
|
61
|
+
async getWorkflowConfig() {
|
|
62
|
+
var y;
|
|
63
|
+
const a = `business_${(y = h.currentBusiness.value) == null ? void 0 : y._id}`, d = `${t.inventoryBackendUrl}/${a}/purchase-order/import-from-xilnex`;
|
|
64
|
+
return await l.get(d);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}), ct = {
|
|
68
|
+
[N.enum.confirmDraft]: {
|
|
69
|
+
primaryActions: {
|
|
70
|
+
text: "Confirm draft",
|
|
71
|
+
close: !0
|
|
72
|
+
},
|
|
73
|
+
title: "Confirm draft?",
|
|
74
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
75
|
+
successMessage: "Purchase order draft has been confirmed"
|
|
76
|
+
},
|
|
77
|
+
[N.enum.cancelDraft]: {
|
|
78
|
+
primaryActions: {
|
|
79
|
+
text: "Cancel draft",
|
|
80
|
+
close: !0,
|
|
81
|
+
variant: "destructive"
|
|
82
|
+
},
|
|
83
|
+
title: "Cancel draft?",
|
|
84
|
+
message: "Purchase order cannot be changed after cancelled draft.",
|
|
85
|
+
successMessage: "Purchase order draft has been cancelled"
|
|
86
|
+
},
|
|
87
|
+
[N.enum.submitRequest]: {
|
|
88
|
+
primaryActions: {
|
|
89
|
+
text: "Submit request",
|
|
90
|
+
close: !0
|
|
91
|
+
},
|
|
92
|
+
title: "Confirm draft?",
|
|
93
|
+
message: "Purchase order cannot be changed after confirm draft.",
|
|
94
|
+
successMessage: "Purchase order draft has been submitted"
|
|
95
|
+
},
|
|
96
|
+
[N.enum.completeReceive]: {
|
|
97
|
+
primaryActions: {
|
|
98
|
+
text: "Mark received",
|
|
99
|
+
close: !0
|
|
100
|
+
},
|
|
101
|
+
title: "Mark as received",
|
|
102
|
+
message: "Purchase order cannot be changed after it has complete receiving.",
|
|
103
|
+
successMessage: "Purchase order has been marked as received"
|
|
104
|
+
},
|
|
105
|
+
[N.enum.approveRequest]: {
|
|
106
|
+
primaryActions: {
|
|
107
|
+
text: "Accept request",
|
|
108
|
+
close: !0
|
|
109
|
+
},
|
|
110
|
+
title: "Accept request?",
|
|
111
|
+
message: "Transfer out request will be accepted.",
|
|
112
|
+
successMessage: "Transfer out request has been approved"
|
|
113
|
+
},
|
|
114
|
+
[N.enum.rejectRequest]: {
|
|
115
|
+
primaryActions: {
|
|
116
|
+
text: "Reject request",
|
|
117
|
+
close: !0,
|
|
118
|
+
variant: "destructive"
|
|
119
|
+
},
|
|
120
|
+
title: "Reject request?",
|
|
121
|
+
message: "Purchase order will be rejected.",
|
|
122
|
+
successMessage: "Purchase order has been rejected"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
function lt() {
|
|
126
|
+
const t = ue(), l = Ne(), n = je();
|
|
127
|
+
async function h(a, d) {
|
|
128
|
+
const y = t.currentLocationDBName;
|
|
129
|
+
return a.doc.supplier.internal && a.operation === N.enum.confirmDraft && (a.operation = N.enum.submitRequest), await l.processPurchaseOrder(a, d || y);
|
|
130
|
+
}
|
|
131
|
+
async function i(a, d) {
|
|
132
|
+
const y = t.currentLocationDBName;
|
|
133
|
+
return await l.processPurchaseOrderV2(a, d || y);
|
|
134
|
+
}
|
|
135
|
+
return (a) => n.useOperatePurchaseOrderV2 ? i(a.operateV2, a.transferTo) : h(a.operate, a.transferTo);
|
|
136
|
+
}
|
|
137
|
+
var Ee = /* @__PURE__ */ ((t) => (t.RECEIVE_REQUEST = "receive/request", t.APPROVAL = "approval", t))(Ee || {});
|
|
138
|
+
const we = V(), Ie = V();
|
|
139
|
+
function Rs(t, l) {
|
|
140
|
+
const n = Ve(), h = ue(), i = je(), a = Ue(), d = xt(), y = Rt(), o = V(!1), v = Me(), m = Ne(), f = V(new Array()), r = V(
|
|
141
|
+
l != null && l.startDate && (l != null && l.endDate) ? l : ut()
|
|
142
|
+
), b = z(() => {
|
|
143
|
+
const g = new Date(r.value.startDate), k = new Date(r.value.endDate);
|
|
144
|
+
return {
|
|
145
|
+
start: dt(g).toISOString(),
|
|
146
|
+
end: mt(k).toISOString()
|
|
147
|
+
};
|
|
148
|
+
}), x = V(new Array()), O = ft(), A = V(null);
|
|
149
|
+
async function I(g) {
|
|
150
|
+
function k(c) {
|
|
151
|
+
const _ = {
|
|
152
|
+
mode: We.CREATE,
|
|
153
|
+
modelValue: g || void 0,
|
|
154
|
+
show: !0,
|
|
155
|
+
"onUpdate:show"(S) {
|
|
156
|
+
we.value.show = S;
|
|
157
|
+
},
|
|
158
|
+
templateId: c,
|
|
159
|
+
lastClosingDate: A.value
|
|
160
|
+
};
|
|
161
|
+
we.value = _;
|
|
162
|
+
}
|
|
163
|
+
let e;
|
|
164
|
+
i.mustUsePoTemplate && !(g != null && g.template) ? n.open({
|
|
165
|
+
title: "Create transfer",
|
|
166
|
+
message: "",
|
|
167
|
+
primaryActions: {
|
|
168
|
+
text: "Select a template",
|
|
169
|
+
close: !0
|
|
170
|
+
},
|
|
171
|
+
secondaryActions: {
|
|
172
|
+
text: "Outlet to Outlet",
|
|
173
|
+
variant: "secondary",
|
|
174
|
+
close: !0
|
|
175
|
+
}
|
|
176
|
+
}).onPrimary(async () => {
|
|
177
|
+
e = await d.getTemplateId(), e && k(e);
|
|
178
|
+
}).onSecondary(() => {
|
|
179
|
+
k(void 0);
|
|
180
|
+
}) : k(e);
|
|
181
|
+
}
|
|
182
|
+
function Y(g) {
|
|
183
|
+
const k = {
|
|
184
|
+
mode: We.UPDATE,
|
|
185
|
+
modelValue: tt(g),
|
|
186
|
+
show: !0,
|
|
187
|
+
"onUpdate:show"(e) {
|
|
188
|
+
we.value.show = e;
|
|
189
|
+
},
|
|
190
|
+
lastClosingDate: A.value
|
|
191
|
+
};
|
|
192
|
+
we.value = k;
|
|
193
|
+
}
|
|
194
|
+
async function W() {
|
|
195
|
+
f.value = [], o.value = !0;
|
|
196
|
+
try {
|
|
197
|
+
f.value = await m.getPurchaseOrders(b.value).then((c) => c.sort((_, S) => S._id.localeCompare(_._id)));
|
|
198
|
+
const g = await O.readCurrentLocationLastClosing(!0), k = g == null ? void 0 : g._id;
|
|
199
|
+
k && (A.value = pt(k)), i.mustUsePoTemplate && await y.fetchTemplates();
|
|
200
|
+
const e = f.value.map((c) => {
|
|
201
|
+
var _;
|
|
202
|
+
return ((_ = c.request) == null ? void 0 : _.id) ?? "";
|
|
203
|
+
}).filter((c) => c);
|
|
204
|
+
x.value = await m.readRequestByIds(e);
|
|
205
|
+
} catch {
|
|
206
|
+
v.open({
|
|
207
|
+
title: "Something went wrong",
|
|
208
|
+
message: "Error at fetching purchase orders",
|
|
209
|
+
type: "error"
|
|
210
|
+
});
|
|
211
|
+
} finally {
|
|
212
|
+
o.value = !1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
async function de() {
|
|
216
|
+
x.value = [], o.value = !0;
|
|
217
|
+
try {
|
|
218
|
+
x.value = await m.readRequests(void 0, a.isEnabled).then((g) => g.reverse());
|
|
219
|
+
} catch {
|
|
220
|
+
v.open({
|
|
221
|
+
title: "Something went wrong",
|
|
222
|
+
message: "Error at fetching purchase requests",
|
|
223
|
+
type: "error"
|
|
224
|
+
});
|
|
225
|
+
} finally {
|
|
226
|
+
o.value = !1;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function X() {
|
|
230
|
+
switch (t) {
|
|
231
|
+
case "receive/request":
|
|
232
|
+
return W();
|
|
233
|
+
case "approval":
|
|
234
|
+
return de();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function ae(g, k) {
|
|
238
|
+
r.value = {
|
|
239
|
+
startDate: g,
|
|
240
|
+
endDate: k
|
|
241
|
+
}, X();
|
|
242
|
+
}
|
|
243
|
+
h.watchLocation(async (g) => {
|
|
244
|
+
if (!g) {
|
|
245
|
+
f.value = [];
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
await X();
|
|
249
|
+
});
|
|
250
|
+
const ee = V(), ce = V(Math.random().toString());
|
|
251
|
+
async function qe(g, k) {
|
|
252
|
+
const e = Math.random().toString();
|
|
253
|
+
ce.value = e, k ?? (k = x.value.computeFirst(
|
|
254
|
+
(S) => S.purchaseOrderId === g._id ? S : null
|
|
255
|
+
) ?? void 0);
|
|
256
|
+
const c = t === "receive/request" ? h.currentLocation : k == null ? void 0 : k.to, _ = {
|
|
257
|
+
poRequest: k,
|
|
258
|
+
purchaseOrder: g,
|
|
259
|
+
transferTo: c == null ? void 0 : c.name,
|
|
260
|
+
transferToDbName: c == null ? void 0 : c.dbName,
|
|
261
|
+
show: !0,
|
|
262
|
+
canResubmit: !1,
|
|
263
|
+
canApprove: t === "approval",
|
|
264
|
+
"onUpdate:show"(S) {
|
|
265
|
+
ee.value.show = S;
|
|
266
|
+
},
|
|
267
|
+
scope: t
|
|
268
|
+
};
|
|
269
|
+
ee.value = _;
|
|
270
|
+
}
|
|
271
|
+
async function he(g, k, e, c) {
|
|
272
|
+
const _ = lt();
|
|
273
|
+
o.value = !0;
|
|
274
|
+
try {
|
|
275
|
+
await _({
|
|
276
|
+
operate: {
|
|
277
|
+
operation: k,
|
|
278
|
+
doc: g,
|
|
279
|
+
options: (
|
|
280
|
+
// auto receive for supplier to warehouse
|
|
281
|
+
(k === N.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
282
|
+
k === N.enum.completeReceive) && i.autoReceiveWarehouse ? {
|
|
283
|
+
autoReceive: !0
|
|
284
|
+
} : void 0
|
|
285
|
+
)
|
|
286
|
+
},
|
|
287
|
+
operateV2: {
|
|
288
|
+
_id: g._id,
|
|
289
|
+
_rev: g._rev ?? "",
|
|
290
|
+
action: k
|
|
291
|
+
},
|
|
292
|
+
transferTo: c
|
|
293
|
+
}), await new Promise((B) => setTimeout(B, 1e3));
|
|
294
|
+
const j = ue().currentLocationDBName.startsWith("restaurant_");
|
|
295
|
+
k === N.enum.confirmDraft && g.effectiveAt && j ? v.open({
|
|
296
|
+
title: "Success",
|
|
297
|
+
message: `${e}. The backdate will be reflected once your POS has received this change.`,
|
|
298
|
+
type: "success"
|
|
299
|
+
}) : v.open({
|
|
300
|
+
title: "Success",
|
|
301
|
+
message: e,
|
|
302
|
+
type: "success"
|
|
303
|
+
});
|
|
304
|
+
} catch (S) {
|
|
305
|
+
v.open({
|
|
306
|
+
title: "Something went wrong",
|
|
307
|
+
message: "Please try again.",
|
|
308
|
+
type: "error"
|
|
309
|
+
}), console.error("Error when submitting PO operation", k, g, S);
|
|
310
|
+
} finally {
|
|
311
|
+
o.value = !1, X();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async function Ae(g, k, e) {
|
|
315
|
+
const c = ct[k];
|
|
316
|
+
if (!c) {
|
|
317
|
+
v.open({
|
|
318
|
+
title: "Something went wrong",
|
|
319
|
+
message: `Cannot process order: ${rt(k)}`,
|
|
320
|
+
type: "error"
|
|
321
|
+
});
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const { successMessage: _, ...S } = c;
|
|
325
|
+
n.open({
|
|
326
|
+
title: S.title,
|
|
327
|
+
message: S.message,
|
|
328
|
+
primaryActions: S.primaryActions
|
|
329
|
+
}).onPrimary(() => {
|
|
330
|
+
he(g, k, _, e);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
async function Te() {
|
|
334
|
+
n.open({
|
|
335
|
+
title: "Upload Transfer",
|
|
336
|
+
primaryActions: {
|
|
337
|
+
text: "Xilnex transfer note",
|
|
338
|
+
close: !0
|
|
339
|
+
},
|
|
340
|
+
secondaryActions: {
|
|
341
|
+
text: "Cancel",
|
|
342
|
+
close: !0
|
|
343
|
+
}
|
|
344
|
+
}).onPrimary(() => {
|
|
345
|
+
const g = {
|
|
346
|
+
show: !0,
|
|
347
|
+
"onUpdate:show"(k) {
|
|
348
|
+
Ie.value.show = k;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
Ie.value = g;
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
return {
|
|
355
|
+
purchaseOrders: f,
|
|
356
|
+
purchaseRequests: x,
|
|
357
|
+
updateDateRange: ae,
|
|
358
|
+
fetchData: X,
|
|
359
|
+
loading: o,
|
|
360
|
+
transferDialogProps: we,
|
|
361
|
+
promptCreateTransferDialog: I,
|
|
362
|
+
promptUpdateTransferDialog: Y,
|
|
363
|
+
transferDetailsProps: ee,
|
|
364
|
+
promptShowTransferDetails: qe,
|
|
365
|
+
submitAction: Ae,
|
|
366
|
+
xilnexImportDialogProps: Ie,
|
|
367
|
+
promptUploadTransferDialog: Te
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
function Tt(t, l) {
|
|
371
|
+
return l.reduce(
|
|
372
|
+
(h, i) => {
|
|
373
|
+
const a = i.received.find((d) => d.sku._id === t._id);
|
|
374
|
+
return a && (h = Fe(h, a.amount)), h;
|
|
375
|
+
},
|
|
376
|
+
St.toPrecision(Oe(0), t.unit.precision)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
function Pt(t, l, n, h) {
|
|
380
|
+
const { name: i, address: a, regNo: d } = l.doc.profile, y = {
|
|
381
|
+
name: i,
|
|
382
|
+
registrationNumber: d,
|
|
383
|
+
line1: a == null ? void 0 : a.line1,
|
|
384
|
+
line2: a == null ? void 0 : a.line2,
|
|
385
|
+
postcode: a == null ? void 0 : a.postcode,
|
|
386
|
+
city: a == null ? void 0 : a.city,
|
|
387
|
+
state: a == null ? void 0 : a.state,
|
|
388
|
+
country: a == null ? void 0 : a.country
|
|
389
|
+
}, o = {
|
|
390
|
+
name: t.supplier.name,
|
|
391
|
+
phoneNumber: t.supplier.phoneNumber,
|
|
392
|
+
registrationNumber: t.supplier.registrationNumber,
|
|
393
|
+
line1: t.supplier.address.line1,
|
|
394
|
+
line2: t.supplier.address.line2,
|
|
395
|
+
postcode: t.supplier.address.postcode,
|
|
396
|
+
city: t.supplier.address.city,
|
|
397
|
+
state: t.supplier.address.state,
|
|
398
|
+
country: t.supplier.address.country
|
|
399
|
+
}, v = t.items.map((x) => {
|
|
400
|
+
const { sku: O, measurement: A } = x, I = oe(
|
|
401
|
+
Tt(x.sku, t.deliveryOrder || []),
|
|
402
|
+
!1
|
|
403
|
+
);
|
|
404
|
+
return {
|
|
405
|
+
code: O.code,
|
|
406
|
+
description: O.name,
|
|
407
|
+
quantity: nt(x.quantity, O.unit, x.measurement),
|
|
408
|
+
unit: (A == null ? void 0 : A.abbrev) || O.unit.abbrev,
|
|
409
|
+
received: I
|
|
410
|
+
};
|
|
411
|
+
}), m = t.deliveryOrder.map((x) => ({
|
|
412
|
+
createdAt: st(new Date(x.createdAt)),
|
|
413
|
+
ref: x.deliveryOrderNumber,
|
|
414
|
+
remark: x.remark || "",
|
|
415
|
+
items: x.received.map((O) => {
|
|
416
|
+
var A;
|
|
417
|
+
return {
|
|
418
|
+
code: O.sku.code,
|
|
419
|
+
description: O.sku.name,
|
|
420
|
+
quantity: oe(O.amount),
|
|
421
|
+
unit: ((A = O.measurement) == null ? void 0 : A.abbrev) || O.sku.unit.abbrev
|
|
422
|
+
};
|
|
423
|
+
})
|
|
424
|
+
})), f = {
|
|
425
|
+
businessName: n == null ? void 0 : n.name,
|
|
426
|
+
logo: n == null ? void 0 : n.thumbnail,
|
|
427
|
+
orderNumber: t.seqNumber.toString(),
|
|
428
|
+
createdAt: ke(t._id),
|
|
429
|
+
ref: t.ref || "",
|
|
430
|
+
remark: t.remark || "",
|
|
431
|
+
buyer: y,
|
|
432
|
+
supplier: o,
|
|
433
|
+
items: v,
|
|
434
|
+
status: t.status,
|
|
435
|
+
deliveryOrders: m
|
|
436
|
+
}, r = new URL(window.location.href), b = h && (t.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
|
|
437
|
+
r.pathname = r.hostname.includes("portal.feedme") ? `/inventory/${b}` : `/${b}`, r.searchParams.append("data", JSON.stringify(f)), window.open(r.href, "_blank", "noreferrer");
|
|
438
|
+
}
|
|
439
|
+
const ye = {
|
|
440
|
+
submitRequest: {
|
|
441
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
442
|
+
color: "text-fm-color-typo-primary",
|
|
443
|
+
value: N.enum.submitRequest
|
|
444
|
+
},
|
|
445
|
+
confirmDraft: {
|
|
446
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
447
|
+
color: "text-fm-color-typo-primary",
|
|
448
|
+
value: N.enum.confirmDraft
|
|
449
|
+
},
|
|
450
|
+
cancelDraft: {
|
|
451
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
452
|
+
color: "text-fm-color-typo-error",
|
|
453
|
+
value: N.enum.cancelDraft
|
|
454
|
+
},
|
|
455
|
+
approveRequest: {
|
|
456
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
457
|
+
color: "text-fm-color-typo-primary",
|
|
458
|
+
value: N.enum.approveRequest
|
|
459
|
+
},
|
|
460
|
+
rejectRequest: {
|
|
461
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
462
|
+
color: "text-fm-color-typo-error",
|
|
463
|
+
value: N.enum.rejectRequest
|
|
464
|
+
},
|
|
465
|
+
processRequest: {
|
|
466
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
467
|
+
color: "text-fm-color-typo-primary",
|
|
468
|
+
value: N.enum.processRequest
|
|
469
|
+
},
|
|
470
|
+
receiveStock: {
|
|
471
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
472
|
+
color: "text-fm-color-typo-primary",
|
|
473
|
+
value: N.enum.receiveStock
|
|
474
|
+
},
|
|
475
|
+
completeReceive: {
|
|
476
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
477
|
+
color: "text-fm-color-typo-primary",
|
|
478
|
+
value: N.enum.completeReceive
|
|
479
|
+
},
|
|
480
|
+
approveDraft: {
|
|
481
|
+
label: void 0,
|
|
482
|
+
translationKey: "",
|
|
483
|
+
color: "",
|
|
484
|
+
value: void 0
|
|
485
|
+
},
|
|
486
|
+
rejectDraft: {
|
|
487
|
+
label: void 0,
|
|
488
|
+
translationKey: "",
|
|
489
|
+
color: "",
|
|
490
|
+
value: void 0
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
function Os(t, l) {
|
|
494
|
+
ue();
|
|
495
|
+
const n = Le(), { t: h } = ot();
|
|
496
|
+
function i(m) {
|
|
497
|
+
switch (m.status) {
|
|
498
|
+
case "DRAFT":
|
|
499
|
+
return [
|
|
500
|
+
Z[K.Update],
|
|
501
|
+
Z[K.Details],
|
|
502
|
+
m.supplier.internal === "restaurant" || m.supplier.internal === "warehouse" ? ye[N.enum.submitRequest] : ye[N.enum.confirmDraft],
|
|
503
|
+
ye[N.enum.cancelDraft]
|
|
504
|
+
];
|
|
505
|
+
case "RECEIVING":
|
|
506
|
+
return [
|
|
507
|
+
ye[N.enum.completeReceive],
|
|
508
|
+
Z[K.Details],
|
|
509
|
+
Z[K.Print]
|
|
510
|
+
];
|
|
511
|
+
case "REQUESTING":
|
|
512
|
+
return t === "receive/request" ? [Z[K.Details], Z[K.Print]] : [
|
|
513
|
+
ye[N.enum.approveRequest],
|
|
514
|
+
ye[N.enum.rejectRequest],
|
|
515
|
+
Z[K.Details]
|
|
516
|
+
// DefaultRowActions[RowActionEnum.Print]
|
|
517
|
+
];
|
|
518
|
+
case "PROCESSING":
|
|
519
|
+
return [Z[K.Details], Z[K.Print]];
|
|
520
|
+
case "COMPLETE":
|
|
521
|
+
case "CANCEL":
|
|
522
|
+
default:
|
|
523
|
+
return [Z[K.Details], Z[K.Print]];
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
function a(m) {
|
|
527
|
+
return Object.values(N.enum).includes(m);
|
|
528
|
+
}
|
|
529
|
+
async function d(m, f, r) {
|
|
530
|
+
var x, O, A, I;
|
|
531
|
+
const b = tt(f);
|
|
532
|
+
if (m === K.Print) {
|
|
533
|
+
const Y = (r == null ? void 0 : r.toInventoryLocation) ?? {
|
|
534
|
+
name: "",
|
|
535
|
+
type: "restaurant",
|
|
536
|
+
acceptRequest: !0,
|
|
537
|
+
dbName: "",
|
|
538
|
+
doc: {
|
|
539
|
+
_id: "",
|
|
540
|
+
businessId: "",
|
|
541
|
+
profile: {}
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
b.ref = [((x = r == null ? void 0 : r.netSuite) == null ? void 0 : x.refNo) || ((O = b.netSuite) == null ? void 0 : O.refNo)].filter((W) => W).join(" "), Pt(b, Y, n.currentBusiness.value, t === "approval");
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (m === K.Details) {
|
|
548
|
+
l.promptShowTransferDetails(b, r);
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
if (m === K.Update) {
|
|
552
|
+
(A = l.promptUpdateTransferDialog) == null || A.call(l, b);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (a(m)) {
|
|
556
|
+
l.submitAction(f, m, (I = r == null ? void 0 : r.to) == null ? void 0 : I.dbName);
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function y() {
|
|
561
|
+
return [
|
|
562
|
+
{
|
|
563
|
+
accessorKey: "seqNumber",
|
|
564
|
+
header: () => h("inventory.transfer.table.seqNo"),
|
|
565
|
+
enableSorting: !0,
|
|
566
|
+
size: 80,
|
|
567
|
+
sortUndefined: "last"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
accessorKey: "_id",
|
|
571
|
+
header: () => h("inventory.transfer.table.createdAt"),
|
|
572
|
+
cell(m) {
|
|
573
|
+
return ke(`${m.getValue()}`);
|
|
574
|
+
},
|
|
575
|
+
enableSorting: !0
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
accessorKey: "supplier.name",
|
|
579
|
+
header: () => h("inventory.transfer.table.transferFrom"),
|
|
580
|
+
enableSorting: !0,
|
|
581
|
+
size: 200
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
accessorKey: "items.length",
|
|
585
|
+
header: () => h("inventory.transfer.table.noOfItems"),
|
|
586
|
+
enableSorting: !1,
|
|
587
|
+
meta: {
|
|
588
|
+
width: "10rem"
|
|
589
|
+
}
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
accessorKey: "ref",
|
|
593
|
+
header: () => h("inventory.transfer.table.reference"),
|
|
594
|
+
enableSorting: !1,
|
|
595
|
+
size: "auto"
|
|
596
|
+
},
|
|
597
|
+
{
|
|
598
|
+
accessorKey: "status",
|
|
599
|
+
header: () => h("inventory.transfer.table.status"),
|
|
600
|
+
cell(m) {
|
|
601
|
+
const f = h(`inventory.transfer.status.${m.getValue() ?? ""}`), r = `${m.getValue() ?? ""}`.toLocaleLowerCase("en-us");
|
|
602
|
+
return q(
|
|
603
|
+
"div",
|
|
604
|
+
{
|
|
605
|
+
class: "flex"
|
|
606
|
+
},
|
|
607
|
+
q(
|
|
608
|
+
"div",
|
|
609
|
+
{
|
|
610
|
+
class: `fm-status-badge fm-status-badge-${r}`
|
|
611
|
+
},
|
|
612
|
+
f
|
|
613
|
+
)
|
|
614
|
+
);
|
|
615
|
+
},
|
|
616
|
+
enableSorting: !0,
|
|
617
|
+
size: 200
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
id: "action",
|
|
621
|
+
cell(m) {
|
|
622
|
+
const f = m.row.original, r = i(f);
|
|
623
|
+
return Xe(r, (b) => d(b, f));
|
|
624
|
+
},
|
|
625
|
+
enableSorting: !1,
|
|
626
|
+
size: 40,
|
|
627
|
+
meta: {
|
|
628
|
+
cellClass: "",
|
|
629
|
+
headerClass: ""
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
];
|
|
633
|
+
}
|
|
634
|
+
function o() {
|
|
635
|
+
return [
|
|
636
|
+
{
|
|
637
|
+
accessorKey: "purchaseOrder.seqNumber",
|
|
638
|
+
header: () => h("inventory.transfer.table.seqNo"),
|
|
639
|
+
enableSorting: !0,
|
|
640
|
+
size: 80,
|
|
641
|
+
sortUndefined: "last"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
accessorKey: "purchaseOrder._id",
|
|
645
|
+
header: () => h("inventory.transfer.table.createdAt"),
|
|
646
|
+
cell(m) {
|
|
647
|
+
return ke(`${m.getValue()}`);
|
|
648
|
+
},
|
|
649
|
+
enableSorting: !0
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
accessorKey: "to.name",
|
|
653
|
+
header: () => h("inventory.transfer.table.transferTo"),
|
|
654
|
+
enableSorting: !1,
|
|
655
|
+
size: 200
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
accessorKey: "purchaseOrder.items.length",
|
|
659
|
+
header: () => h("inventory.transfer.table.noOfItems"),
|
|
660
|
+
enableSorting: !1
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
accessorKey: "purchaseOrder.ref",
|
|
664
|
+
header: () => h("inventory.transfer.table.reference"),
|
|
665
|
+
enableSorting: !1,
|
|
666
|
+
size: "auto"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
accessorKey: "purchaseOrder.status",
|
|
670
|
+
header: () => h("inventory.transfer.table.status"),
|
|
671
|
+
cell(m) {
|
|
672
|
+
const f = h(`inventory.transfer.status.${m.getValue() ?? ""}`), r = `${m.getValue() ?? ""}`.toLocaleLowerCase("en-us");
|
|
673
|
+
return q(
|
|
674
|
+
"div",
|
|
675
|
+
{
|
|
676
|
+
class: "flex"
|
|
677
|
+
},
|
|
678
|
+
q(
|
|
679
|
+
"div",
|
|
680
|
+
{
|
|
681
|
+
class: `fm-status-badge fm-status-badge-${r}`
|
|
682
|
+
},
|
|
683
|
+
f
|
|
684
|
+
)
|
|
685
|
+
);
|
|
686
|
+
},
|
|
687
|
+
enableSorting: !0
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
id: "action",
|
|
691
|
+
cell(m) {
|
|
692
|
+
const f = m.row.original, b = (f.purchaseOrder ? i(f.purchaseOrder) : []).map((x) => x.value === K.Print ? {
|
|
693
|
+
...x,
|
|
694
|
+
translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
|
|
695
|
+
} : x);
|
|
696
|
+
return Xe(
|
|
697
|
+
b,
|
|
698
|
+
(x) => f.purchaseOrder ? d(x, f.purchaseOrder, f) : void 0
|
|
699
|
+
);
|
|
700
|
+
},
|
|
701
|
+
enableSorting: !1,
|
|
702
|
+
size: 40,
|
|
703
|
+
meta: {
|
|
704
|
+
cellClass: "",
|
|
705
|
+
headerClass: ""
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
];
|
|
709
|
+
}
|
|
710
|
+
const v = z(() => t === "receive/request" ? y() : o());
|
|
711
|
+
return {
|
|
712
|
+
get columnDefs() {
|
|
713
|
+
return v.value;
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
const $t = {
|
|
718
|
+
key: 0,
|
|
719
|
+
class: "flex flex-col gap-8"
|
|
720
|
+
}, Ct = { class: "flex flex-col gap-4" }, It = { class: "fm-typo-en-body-lg-600" }, Ft = {
|
|
721
|
+
key: 0,
|
|
722
|
+
class: "flex flex-col gap-4"
|
|
723
|
+
}, Et = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "fm-typo-en-body-lg-600" }, Ut = { key: 0 }, Lt = { key: 1 }, Vt = {
|
|
724
|
+
key: 1,
|
|
725
|
+
class: "flex flex-col gap-4"
|
|
726
|
+
}, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, jt = { class: "fm-typo-en-body-lg-600" }, Kt = { key: 0 }, zt = { key: 1 }, Gt = {
|
|
727
|
+
key: 2,
|
|
728
|
+
class: "flex flex-col gap-4"
|
|
729
|
+
}, Ht = { class: "fm-typo-en-body-lg-600" }, Qt = {
|
|
730
|
+
key: 3,
|
|
731
|
+
class: "flex flex-col gap-4"
|
|
732
|
+
}, Yt = { class: "fm-typo-en-body-lg-600" }, Wt = /* @__PURE__ */ De({
|
|
733
|
+
__name: "NetSuiteInfo",
|
|
734
|
+
props: {
|
|
735
|
+
transferType: {},
|
|
736
|
+
transferToDbName: {},
|
|
737
|
+
poRequest: {},
|
|
738
|
+
purchaseOrder: {},
|
|
739
|
+
isTransferBetweenOutlets: { type: Boolean },
|
|
740
|
+
scope: {}
|
|
741
|
+
},
|
|
742
|
+
setup(t) {
|
|
743
|
+
const l = t, n = Ue(), h = Ne(), i = V(l.poRequest);
|
|
744
|
+
at(async () => {
|
|
745
|
+
var o;
|
|
746
|
+
if (!l.poRequest && ((o = l.purchaseOrder) != null && o._id)) {
|
|
747
|
+
const v = await h.getLatestPurchaseOrderRequest(l.purchaseOrder._id);
|
|
748
|
+
i.value = v;
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
const a = z(
|
|
752
|
+
() => {
|
|
753
|
+
var o, v, m, f, r, b;
|
|
754
|
+
return n.getSubsidiaryFullName(
|
|
755
|
+
((m = (v = (o = l.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : v.subsidiary) == null ? void 0 : m.id) || ((b = (r = (f = l.poRequest) == null ? void 0 : f.netSuite) == null ? void 0 : r.subsidiary) == null ? void 0 : b.id)
|
|
756
|
+
).fullName;
|
|
757
|
+
}
|
|
758
|
+
), d = z(() => {
|
|
759
|
+
var o, v, m, f, r, b, x, O, A, I, Y, W;
|
|
760
|
+
return (m = (v = (o = l.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : v.additionalInfo) != null && m.transactionnumber ? (b = (r = (f = l.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : r.additionalInfo) == null ? void 0 : b.transactionnumber : (A = (O = (x = i.value) == null ? void 0 : x.netSuite) == null ? void 0 : O.additionalInfo) != null && A.transactionnumber ? (W = (Y = (I = i.value) == null ? void 0 : I.netSuite) == null ? void 0 : Y.additionalInfo) == null ? void 0 : W.transactionnumber : null;
|
|
761
|
+
}), y = z(() => {
|
|
762
|
+
var o, v, m, f, r, b;
|
|
763
|
+
return (v = (o = l.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) != null && v.length && ((f = (m = l.purchaseOrder) == null ? void 0 : m.deliveryFullfillment) == null ? void 0 : f.length) > 0 ? (b = (r = l.purchaseOrder) == null ? void 0 : r.deliveryFullfillment) == null ? void 0 : b.map((x) => {
|
|
764
|
+
var O;
|
|
765
|
+
return (O = x.netSuite) == null ? void 0 : O.refNo;
|
|
766
|
+
}).join(", ") : "N/A";
|
|
767
|
+
});
|
|
768
|
+
return (o, v) => {
|
|
769
|
+
var m, f, r, b, x, O, A, I, Y, W, de, X, ae, ee;
|
|
770
|
+
return p(n).isEnabled ? (w(), D("div", $t, [
|
|
771
|
+
s("div", Ct, [
|
|
772
|
+
v[0] || (v[0] = s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
|
|
773
|
+
s("div", It, R(a.value || "N/A"), 1)
|
|
774
|
+
]),
|
|
775
|
+
!o.isTransferBetweenOutlets && ((m = o.purchaseOrder) == null ? void 0 : m.status) !== p(se).Enum.REQUESTING && o.scope === p(Ee).RECEIVE_REQUEST ? (w(), D("div", Ft, [
|
|
776
|
+
s("div", Et, " NetSuite " + R(o.transferType === p(ve).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
777
|
+
s("div", Bt, [
|
|
778
|
+
(r = (f = o.purchaseOrder) == null ? void 0 : f.netSuite) != null && r.id ? (w(), D("span", Ut, R((x = (b = o.purchaseOrder) == null ? void 0 : b.netSuite) == null ? void 0 : x.refNo) + " (" + R((A = (O = o.purchaseOrder) == null ? void 0 : O.netSuite) == null ? void 0 : A.id) + ") ", 1)) : (w(), D("span", Lt, "N/A"))
|
|
779
|
+
])
|
|
780
|
+
])) : L("", !0),
|
|
781
|
+
!o.isTransferBetweenOutlets && i.value && ((I = o.purchaseOrder) == null ? void 0 : I.status) === p(se).Enum.REQUESTING || o.scope === p(Ee).APPROVAL ? (w(), D("div", Vt, [
|
|
782
|
+
s("div", Mt, " (Request) NetSuite " + R(o.transferType === p(ve).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
|
|
783
|
+
s("div", jt, [
|
|
784
|
+
(W = (Y = i.value) == null ? void 0 : Y.netSuite) != null && W.id ? (w(), D("span", Kt, R((X = (de = i.value) == null ? void 0 : de.netSuite) == null ? void 0 : X.refNo) + " (" + R((ee = (ae = i.value) == null ? void 0 : ae.netSuite) == null ? void 0 : ee.id) + ") ", 1)) : (w(), D("span", zt, "N/A"))
|
|
785
|
+
])
|
|
786
|
+
])) : L("", !0),
|
|
787
|
+
d.value ? (w(), D("div", Gt, [
|
|
788
|
+
v[1] || (v[1] = s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
|
|
789
|
+
s("div", Ht, R(d.value), 1)
|
|
790
|
+
])) : L("", !0),
|
|
791
|
+
p(n).isEnabled && o.transferType === p(ve).TRANSFER && !o.isTransferBetweenOutlets ? (w(), D("div", Qt, [
|
|
792
|
+
v[2] || (v[2] = s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
|
|
793
|
+
s("div", Yt, R(y.value), 1)
|
|
794
|
+
])) : L("", !0)
|
|
795
|
+
])) : L("", !0);
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
}), Xt = { class: "flex flex-row-reverse" }, Jt = /* @__PURE__ */ De({
|
|
799
|
+
__name: "NetSuiteSync",
|
|
800
|
+
props: {
|
|
801
|
+
poRequest: {},
|
|
802
|
+
purchaseOrder: {},
|
|
803
|
+
isTransferBetweenOutlets: { type: Boolean }
|
|
804
|
+
},
|
|
805
|
+
setup(t) {
|
|
806
|
+
const l = t, n = Ue(), h = Me(), i = Ve(), a = V(!1);
|
|
807
|
+
z(() => {
|
|
808
|
+
var m, f, r, b;
|
|
809
|
+
let y = !0;
|
|
810
|
+
n.isEnabled || (y = !1);
|
|
811
|
+
const o = l.purchaseOrder, v = l.poRequest;
|
|
812
|
+
return o && ((m = o == null ? void 0 : o.supplier) != null && m.internal ? (!v && o.status == se.enum.DRAFT && (y = !1), v && !((f = v == null ? void 0 : v.netSuite) != null && f.id) && (y = !1), l.isTransferBetweenOutlets && (y = !1)) : ((o == null ? void 0 : o.status) !== se.enum.REQUESTING && o.supplier.internal && (y = !1), !v && !((r = o == null ? void 0 : o.netSuite) != null && r.id) && (y = !1), !v && ((b = o == null ? void 0 : o.netSuite) != null && b.id) && (o == null ? void 0 : o.status) == se.enum.REQUESTING && (y = !1))), y;
|
|
813
|
+
});
|
|
814
|
+
async function d() {
|
|
815
|
+
a.value || i.open({
|
|
816
|
+
title: "Sync with NetSuite",
|
|
817
|
+
contentComponent: q("div", [
|
|
818
|
+
q("p", "Are you sure you want to sync now?"),
|
|
819
|
+
q("br"),
|
|
820
|
+
q(
|
|
821
|
+
"p",
|
|
822
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
|
|
823
|
+
"Please wait a moment before syncing manually to avoid unnecessary actions."
|
|
824
|
+
)
|
|
825
|
+
]),
|
|
826
|
+
primaryActions: {
|
|
827
|
+
text: "Sync",
|
|
828
|
+
close: !0,
|
|
829
|
+
variant: "destructive"
|
|
830
|
+
},
|
|
831
|
+
secondaryActions: { text: "Not now", close: !0 }
|
|
832
|
+
}).onPrimary(async () => {
|
|
833
|
+
var y, o;
|
|
834
|
+
try {
|
|
835
|
+
a.value = !0;
|
|
836
|
+
const v = ((y = l.purchaseOrder) == null ? void 0 : y._id) || ((o = l.poRequest) == null ? void 0 : o.purchaseOrderId) || "";
|
|
837
|
+
await n.syncPurchaseOrder(v), h.open({
|
|
838
|
+
title: "Sync with NetSuite",
|
|
839
|
+
message: "Requested to sync with NetSuite. Please wait a moment.",
|
|
840
|
+
type: "success"
|
|
841
|
+
});
|
|
842
|
+
} catch {
|
|
843
|
+
h.open({
|
|
844
|
+
title: "Error",
|
|
845
|
+
message: "Failed to sync with NetSuite",
|
|
846
|
+
type: "error"
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
setTimeout(() => {
|
|
850
|
+
a.value = !1;
|
|
851
|
+
}, 5e3);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
return (y, o) => {
|
|
855
|
+
const v = H("FmButton");
|
|
856
|
+
return w(), D("div", Xt, [
|
|
857
|
+
E(v, {
|
|
858
|
+
"prepend-icon": "sync",
|
|
859
|
+
variant: "secondary",
|
|
860
|
+
label: "Sync",
|
|
861
|
+
loading: a.value,
|
|
862
|
+
onClick: d,
|
|
863
|
+
"text-color": "primary",
|
|
864
|
+
"bg-color": "transparent",
|
|
865
|
+
"border-color": "primary"
|
|
866
|
+
}, null, 8, ["loading"])
|
|
867
|
+
]);
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
}), Zt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, er = { class: "flex flex-col gap-8" }, tr = { class: "flex w-full justify-end gap-16" }, rr = /* @__PURE__ */ De({
|
|
871
|
+
__name: "FulfillmentForm",
|
|
872
|
+
props: {
|
|
873
|
+
purchaseOrder: {},
|
|
874
|
+
confirm: { type: Function }
|
|
875
|
+
},
|
|
876
|
+
emits: ["update:show"],
|
|
877
|
+
setup(t, { emit: l }) {
|
|
878
|
+
const n = t, h = bt({
|
|
879
|
+
id: "",
|
|
880
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
881
|
+
items: []
|
|
882
|
+
}), i = V(), a = l;
|
|
883
|
+
return at(() => {
|
|
884
|
+
n.purchaseOrder && (console.log("props", n.purchaseOrder), h.items = n.purchaseOrder.items.map((d) => ({
|
|
885
|
+
id: d.id,
|
|
886
|
+
sku: d.sku,
|
|
887
|
+
measurement: d.measurement,
|
|
888
|
+
amount: d.quantity ?? { amount: 1, precision: 0 }
|
|
889
|
+
})));
|
|
890
|
+
}), (d, y) => {
|
|
891
|
+
const o = H("FmTable"), v = H("FmButton"), m = H("FmForm");
|
|
892
|
+
return w(), le(m, {
|
|
893
|
+
ref_key: "formRef",
|
|
894
|
+
ref: i,
|
|
895
|
+
class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
|
|
896
|
+
onValidationFailed: console.log,
|
|
897
|
+
onValidationSuccess: y[1] || (y[1] = () => n.confirm(h))
|
|
898
|
+
}, {
|
|
899
|
+
default: ie(() => [
|
|
900
|
+
y[2] || (y[2] = s("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
|
|
901
|
+
s("div", Zt, [
|
|
902
|
+
s("div", er, [
|
|
903
|
+
E(o, {
|
|
904
|
+
"column-defs": [
|
|
905
|
+
{
|
|
906
|
+
header: "Code",
|
|
907
|
+
cell: (f) => {
|
|
908
|
+
const r = n.purchaseOrder.items.find((b) => b.id === f.row.original.id || b.sku._id === f.row.original.sku._id);
|
|
909
|
+
return q(
|
|
910
|
+
p(Ze).FmTooltip,
|
|
911
|
+
{
|
|
912
|
+
content: r.code,
|
|
913
|
+
placement: "top",
|
|
914
|
+
variant: "plain",
|
|
915
|
+
zIndex: 50
|
|
916
|
+
},
|
|
917
|
+
q(
|
|
918
|
+
"span",
|
|
919
|
+
{
|
|
920
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
921
|
+
},
|
|
922
|
+
r.code
|
|
923
|
+
)
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
header: "Name",
|
|
929
|
+
cell: (f) => {
|
|
930
|
+
const r = n.purchaseOrder.items.find((b) => b.id === f.row.original.id || b.sku._id === f.row.original.sku._id);
|
|
931
|
+
return q(
|
|
932
|
+
p(Ze).FmTooltip,
|
|
933
|
+
{
|
|
934
|
+
content: r.name,
|
|
935
|
+
placement: "top",
|
|
936
|
+
variant: "plain",
|
|
937
|
+
zIndex: 50
|
|
938
|
+
},
|
|
939
|
+
q(
|
|
940
|
+
"span",
|
|
941
|
+
{
|
|
942
|
+
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
943
|
+
},
|
|
944
|
+
r.name
|
|
945
|
+
)
|
|
946
|
+
);
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
header: "Amount",
|
|
951
|
+
cell: (f) => {
|
|
952
|
+
const r = f.row.original, b = n.purchaseOrder.items.find((O) => O.id === r.id || O.sku._id === r.sku._id), x = r.amount ?? {
|
|
953
|
+
amount: 1,
|
|
954
|
+
precision: 0
|
|
955
|
+
};
|
|
956
|
+
return q(Nt, {
|
|
957
|
+
style: {
|
|
958
|
+
flex: "1 1 0%"
|
|
959
|
+
},
|
|
960
|
+
modelValue: {
|
|
961
|
+
amount: x,
|
|
962
|
+
measurement: r.measurement ?? null
|
|
963
|
+
},
|
|
964
|
+
key: r.id ?? r.sku._id,
|
|
965
|
+
unit: r.sku.unit,
|
|
966
|
+
"onUpdate:modelValue": (O) => {
|
|
967
|
+
if (!O) return;
|
|
968
|
+
const A = h.items.find((I) => I.id === r.id || I.sku._id === r.sku._id);
|
|
969
|
+
A && (A.amount = O.amount);
|
|
970
|
+
},
|
|
971
|
+
disableUnit: !0,
|
|
972
|
+
rules: [
|
|
973
|
+
p(qt)(
|
|
974
|
+
+p(oe)({ amount: 0, precision: 0 })
|
|
975
|
+
),
|
|
976
|
+
p(At)(+p(oe)(b.quantity))
|
|
977
|
+
],
|
|
978
|
+
applyDefaultRules: !0
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
],
|
|
983
|
+
"row-data": h.items,
|
|
984
|
+
"hide-footer": !0
|
|
985
|
+
}, null, 8, ["column-defs", "row-data"])
|
|
986
|
+
])
|
|
987
|
+
]),
|
|
988
|
+
s("div", tr, [
|
|
989
|
+
E(v, {
|
|
990
|
+
class: "px-16",
|
|
991
|
+
label: "Confirm",
|
|
992
|
+
size: "md",
|
|
993
|
+
variant: "primary",
|
|
994
|
+
type: "submit"
|
|
995
|
+
}),
|
|
996
|
+
E(v, {
|
|
997
|
+
class: "px-16",
|
|
998
|
+
label: "Cancel",
|
|
999
|
+
size: "md",
|
|
1000
|
+
variant: "secondary",
|
|
1001
|
+
onClick: y[0] || (y[0] = () => a("update:show", !1))
|
|
1002
|
+
})
|
|
1003
|
+
])
|
|
1004
|
+
]),
|
|
1005
|
+
_: 1
|
|
1006
|
+
}, 8, ["onValidationFailed"]);
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
var Be = /* @__PURE__ */ ((t) => (t.loading = "loading", t.error = "error", t.success = "success", t))(Be || {});
|
|
1011
|
+
function sr(t) {
|
|
1012
|
+
const l = V({
|
|
1013
|
+
state: "loading"
|
|
1014
|
+
/* loading */
|
|
1015
|
+
}), n = async (h) => {
|
|
1016
|
+
const i = h || t;
|
|
1017
|
+
if (!i) {
|
|
1018
|
+
l.value = { state: "error", error: new Error("No promise task provided") };
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
l.value = {
|
|
1022
|
+
state: "loading"
|
|
1023
|
+
/* loading */
|
|
1024
|
+
};
|
|
1025
|
+
try {
|
|
1026
|
+
const a = await i();
|
|
1027
|
+
l.value = { state: "success", data: a };
|
|
1028
|
+
} catch (a) {
|
|
1029
|
+
l.value = { state: "error", error: a };
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
return t && n(), { result: l, execute: n };
|
|
1033
|
+
}
|
|
1034
|
+
const et = {
|
|
1035
|
+
submitRequest: {
|
|
1036
|
+
translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
|
|
1037
|
+
color: "primary",
|
|
1038
|
+
buttonVariant: re.Primary
|
|
1039
|
+
},
|
|
1040
|
+
confirmDraft: {
|
|
1041
|
+
translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
|
|
1042
|
+
color: "primary",
|
|
1043
|
+
buttonVariant: re.Primary
|
|
1044
|
+
},
|
|
1045
|
+
cancelDraft: {
|
|
1046
|
+
translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
|
|
1047
|
+
color: "system-error-300",
|
|
1048
|
+
buttonVariant: re.Destructive
|
|
1049
|
+
},
|
|
1050
|
+
approveDraft: {
|
|
1051
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
|
|
1052
|
+
color: "primary",
|
|
1053
|
+
buttonVariant: re.Primary
|
|
1054
|
+
},
|
|
1055
|
+
rejectDraft: {
|
|
1056
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
|
|
1057
|
+
color: "system-error-300",
|
|
1058
|
+
buttonVariant: re.Destructive
|
|
1059
|
+
},
|
|
1060
|
+
approveRequest: {
|
|
1061
|
+
translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
|
|
1062
|
+
color: "primary",
|
|
1063
|
+
buttonVariant: re.Primary
|
|
1064
|
+
},
|
|
1065
|
+
processRequest: {
|
|
1066
|
+
translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
|
|
1067
|
+
color: "primary",
|
|
1068
|
+
buttonVariant: re.Primary
|
|
1069
|
+
},
|
|
1070
|
+
receiveStock: {
|
|
1071
|
+
translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
|
|
1072
|
+
color: "primary",
|
|
1073
|
+
buttonVariant: re.Primary
|
|
1074
|
+
},
|
|
1075
|
+
completeReceive: {
|
|
1076
|
+
translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
|
|
1077
|
+
color: "primary",
|
|
1078
|
+
buttonVariant: re.Plain
|
|
1079
|
+
},
|
|
1080
|
+
rejectRequest: {
|
|
1081
|
+
translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
|
|
1082
|
+
color: "system-error-300",
|
|
1083
|
+
buttonVariant: re.Destructive
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
function ar() {
|
|
1087
|
+
return {
|
|
1088
|
+
ableToMarkReceived(t) {
|
|
1089
|
+
if (!t || t.status !== se.enum.RECEIVING)
|
|
1090
|
+
return !1;
|
|
1091
|
+
const n = ue().currentLocationDBName;
|
|
1092
|
+
return `${t.supplier.internal}_${t.supplier._id}` !== n;
|
|
1093
|
+
},
|
|
1094
|
+
ableToMarkApproved(t) {
|
|
1095
|
+
return !(!t || (t == null ? void 0 : t.status) !== se.enum.REQUESTING && (t == null ? void 0 : t.status) !== se.enum.PROCESSING);
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
const nr = { class: "flex flex-col gap-16 w-full h-full" }, or = { class: "flex justify-between" }, cr = { class: "fm-typo-en-body-lg-600" }, lr = { class: "flex flex-col gap-8" }, ir = { class: "flex flex-col gap-4" }, ur = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dr = { class: "flex gap-1" }, mr = { class: "fm-typo-en-body-lg-600" }, fr = {
|
|
1100
|
+
key: 0,
|
|
1101
|
+
class: "flex flex-col gap-4"
|
|
1102
|
+
}, pr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yr = { class: "fm-typo-en-body-lg-600" }, vr = { class: "flex flex-col gap-4" }, hr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, br = { class: "fm-typo-en-body-lg-600" }, gr = {
|
|
1103
|
+
key: 1,
|
|
1104
|
+
class: "flex flex-col gap-4"
|
|
1105
|
+
}, _r = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wr = { class: "fm-typo-en-body-lg-600" }, Sr = {
|
|
1106
|
+
key: 2,
|
|
1107
|
+
class: "flex flex-col gap-4"
|
|
1108
|
+
}, xr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rr = { class: "fm-typo-en-body-lg-600" }, Or = {
|
|
1109
|
+
key: 3,
|
|
1110
|
+
class: "flex flex-col gap-4"
|
|
1111
|
+
}, kr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dr = { class: "fm-typo-en-body-lg-600" }, Nr = {
|
|
1112
|
+
key: 4,
|
|
1113
|
+
class: "flex flex-col gap-4"
|
|
1114
|
+
}, qr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ar = { class: "fm-typo-en-body-lg-600" }, Tr = {
|
|
1115
|
+
key: 0,
|
|
1116
|
+
class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
|
|
1117
|
+
}, Pr = { class: "flex gap-8 items-center" }, $r = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Cr = { class: "flex flex-col gap-8" }, Ir = { class: "flex gap-8 items-center" }, Fr = { class: "flex-1 fm-typo-en-body-lg-600" }, Er = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Br = { class: "flex w-full gap-4" }, Ur = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Lr = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Vr = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Mr = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, jr = {
|
|
1118
|
+
key: 0,
|
|
1119
|
+
class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1120
|
+
}, Kr = { class: "py-8" }, zr = { class: "flex justify-end gap-4 items-center" }, Gr = { class: "fm-typo-en-body-lg-600" }, Hr = {
|
|
1121
|
+
key: 1,
|
|
1122
|
+
class: "flex-1 xs:w-screen xs:max-w-full"
|
|
1123
|
+
}, Qr = {
|
|
1124
|
+
key: 0,
|
|
1125
|
+
class: "flex flex-col items-center gap-8 h-full"
|
|
1126
|
+
}, Yr = ["src"], Wr = { class: "fm-typo-en-body-lg-600" }, Xr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Jr = {
|
|
1127
|
+
key: 1,
|
|
1128
|
+
class: "px-4 flex flex-col"
|
|
1129
|
+
}, Zr = { class: "flex gap-12 content-stretch" }, es = {
|
|
1130
|
+
class: "flex flex-col w-24",
|
|
1131
|
+
name: "circles"
|
|
1132
|
+
}, ts = { class: "flex-1 flex flex-col items-center" }, rs = { class: "flex-1 flex flex-col items-center" }, ss = {
|
|
1133
|
+
class: "py-12 flex flex-col gap-4",
|
|
1134
|
+
name: "received-at header"
|
|
1135
|
+
}, as = { class: "fm-typo-en-body-lg-400" }, ns = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, os = { class: "flex gap-12 content-stretch" }, cs = {
|
|
1136
|
+
class: "flex flex-col w-24",
|
|
1137
|
+
name: "circles"
|
|
1138
|
+
}, ls = { class: "flex-1 flex flex-col items-center" }, is = {
|
|
1139
|
+
class: "py-12 flex flex-col gap-4 flex-1",
|
|
1140
|
+
name: "delivery details"
|
|
1141
|
+
}, us = { class: "flex flex-col gap-8" }, ds = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ms = { class: "flex flex-col gap-4" }, fs = { class: "flex gap-8 xs:flex-col" }, ks = /* @__PURE__ */ De({
|
|
1142
|
+
__name: "TransferDetails",
|
|
1143
|
+
props: {
|
|
1144
|
+
poRequest: {},
|
|
1145
|
+
purchaseOrder: {},
|
|
1146
|
+
transferTo: {},
|
|
1147
|
+
transferToDbName: {},
|
|
1148
|
+
show: { type: Boolean },
|
|
1149
|
+
canResubmit: { type: Boolean },
|
|
1150
|
+
canApprove: { type: Boolean },
|
|
1151
|
+
scope: {}
|
|
1152
|
+
},
|
|
1153
|
+
emits: ["update:show", "submitted"],
|
|
1154
|
+
setup(t, { emit: l }) {
|
|
1155
|
+
const n = t, h = l, i = Ve(), a = Me(), d = je(), y = Dt(), o = ue(), v = Le(), m = z(
|
|
1156
|
+
() => {
|
|
1157
|
+
var e, c;
|
|
1158
|
+
return {
|
|
1159
|
+
id: ((e = v.sessionUser.value) == null ? void 0 : e.id) ?? "",
|
|
1160
|
+
name: ((c = v.sessionUser.value) == null ? void 0 : c.displayName) ?? ""
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
), f = ar(), { t: r } = ot(), b = z(
|
|
1164
|
+
() => {
|
|
1165
|
+
var e, c, _, S;
|
|
1166
|
+
return ((c = (e = n.purchaseOrder) == null ? void 0 : e.supplier) == null ? void 0 : c.internal) === "restaurant" || ((S = (_ = n.purchaseOrder) == null ? void 0 : _.supplier) == null ? void 0 : S.internal) === "warehouse" ? ve.TRANSFER : ve.PURCHASE;
|
|
1167
|
+
}
|
|
1168
|
+
), x = z(() => {
|
|
1169
|
+
var e, c, _;
|
|
1170
|
+
return b.value === ve.TRANSFER && ((e = n.transferToDbName) == null ? void 0 : e.startsWith("restaurant")) && ((_ = (c = n.purchaseOrder) == null ? void 0 : c.supplier) == null ? void 0 : _.internal) === "restaurant";
|
|
1171
|
+
}), O = V(!1), A = V(""), I = V(!0), Y = Ne(), W = sr(Y.getWorkflowConfig), de = lt(), X = z(() => {
|
|
1172
|
+
if (!n.purchaseOrder)
|
|
1173
|
+
return [];
|
|
1174
|
+
const e = W.result.value;
|
|
1175
|
+
if (e.state === Be.loading)
|
|
1176
|
+
return [];
|
|
1177
|
+
const c = {
|
|
1178
|
+
user: m.value,
|
|
1179
|
+
executedAt: o.locations.computeFirst(
|
|
1180
|
+
(_) => {
|
|
1181
|
+
var S;
|
|
1182
|
+
return _.dbName === ((S = o._currentLocation) == null ? void 0 : S.dbName) ? _ : null;
|
|
1183
|
+
}
|
|
1184
|
+
),
|
|
1185
|
+
purchaseOrderRequest: n.poRequest,
|
|
1186
|
+
purchaseOrder: n.purchaseOrder
|
|
1187
|
+
};
|
|
1188
|
+
return e.state === Be.error ? (console.error("Error fetching workflow config:", e.error), Ce.getAvailableActions({
|
|
1189
|
+
...c,
|
|
1190
|
+
purchaseOrderConfig: Ce.getDefaultConfig()
|
|
1191
|
+
}).actions.filter(
|
|
1192
|
+
(_) => (
|
|
1193
|
+
// TODO: create receiveStock & processRequest dialog
|
|
1194
|
+
// to create their payload
|
|
1195
|
+
_ !== N.enum.receiveStock && _ !== N.enum.processRequest
|
|
1196
|
+
)
|
|
1197
|
+
)) : Ce.getAvailableActions({
|
|
1198
|
+
...c,
|
|
1199
|
+
purchaseOrderConfig: e.data
|
|
1200
|
+
}).actions.filter(
|
|
1201
|
+
(_) => _ !== N.enum.receiveStock && _ !== N.enum.processRequest
|
|
1202
|
+
);
|
|
1203
|
+
}), ae = kt(n, "show"), ee = z(() => [
|
|
1204
|
+
{
|
|
1205
|
+
label: r("inventory.transfer.receiveRequest.details.overview"),
|
|
1206
|
+
value: "overview"
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
label: r("inventory.transfer.receiveRequest.details.deliveryHistory"),
|
|
1210
|
+
value: "deliveryHistory"
|
|
1211
|
+
}
|
|
1212
|
+
]), ce = V(ee.value[0]);
|
|
1213
|
+
gt(
|
|
1214
|
+
() => n.show,
|
|
1215
|
+
(e) => {
|
|
1216
|
+
e && (ce.value = ee.value[0]);
|
|
1217
|
+
}
|
|
1218
|
+
);
|
|
1219
|
+
async function qe(e, c, _, S, j) {
|
|
1220
|
+
return new Promise((B, Q) => {
|
|
1221
|
+
i.open({
|
|
1222
|
+
closeButton: !1,
|
|
1223
|
+
title: S.title,
|
|
1224
|
+
message: S.message,
|
|
1225
|
+
primaryActions: S.primaryActions,
|
|
1226
|
+
secondaryActions: { text: "No", close: !1 }
|
|
1227
|
+
}).onPrimary(async () => {
|
|
1228
|
+
var u, T, U, G;
|
|
1229
|
+
try {
|
|
1230
|
+
await de({
|
|
1231
|
+
operate: {
|
|
1232
|
+
operation: _,
|
|
1233
|
+
doc: e,
|
|
1234
|
+
options: c
|
|
1235
|
+
},
|
|
1236
|
+
operateV2: {
|
|
1237
|
+
_id: ((u = n.purchaseOrder) == null ? void 0 : u._id) ?? "",
|
|
1238
|
+
_rev: ((T = n.purchaseOrder) == null ? void 0 : T._rev) ?? "",
|
|
1239
|
+
action: _
|
|
1240
|
+
// add payload if action is receiveStock or processRequest
|
|
1241
|
+
},
|
|
1242
|
+
transferTo: (G = (U = n.poRequest) == null ? void 0 : U.to) == null ? void 0 : G.dbName
|
|
1243
|
+
}).delayed(1e3), B("submitted");
|
|
1244
|
+
} catch (C) {
|
|
1245
|
+
Q(C);
|
|
1246
|
+
}
|
|
1247
|
+
}).onSecondary(() => {
|
|
1248
|
+
B("cancelled");
|
|
1249
|
+
for (let u = 0; u < j + 2; u++)
|
|
1250
|
+
i.close();
|
|
1251
|
+
}).onClose(() => {
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
async function he(e) {
|
|
1256
|
+
if (e === N.enum.receiveStock)
|
|
1257
|
+
return;
|
|
1258
|
+
const c = ct[e];
|
|
1259
|
+
if (!c) {
|
|
1260
|
+
a.open({
|
|
1261
|
+
title: "Something went wrong",
|
|
1262
|
+
message: `Cannot process order: ${rt(e)}`,
|
|
1263
|
+
type: "error"
|
|
1264
|
+
});
|
|
1265
|
+
return;
|
|
1266
|
+
}
|
|
1267
|
+
const { successMessage: _ } = c;
|
|
1268
|
+
if (n.purchaseOrder) {
|
|
1269
|
+
A.value = `${e}`, O.value = !0, I.value = !1;
|
|
1270
|
+
const S = {};
|
|
1271
|
+
let j = 0;
|
|
1272
|
+
if ((e === N.enum.confirmDraft || // auto receive for warehouse to warehouse
|
|
1273
|
+
e === N.enum.completeReceive) && d.autoReceiveWarehouse)
|
|
1274
|
+
S.autoReceive = !0;
|
|
1275
|
+
else if (e === N.enum.approveRequest && d.acceptRequireFulfillment) {
|
|
1276
|
+
const B = await new Promise((Q, u) => {
|
|
1277
|
+
i.open({
|
|
1278
|
+
closeButton: !1,
|
|
1279
|
+
title: "Confirm transfer amount",
|
|
1280
|
+
dialogComponent: rr,
|
|
1281
|
+
dialogComponentProps: {
|
|
1282
|
+
purchaseOrder: n.purchaseOrder,
|
|
1283
|
+
confirm: Q,
|
|
1284
|
+
"onUpdate:show": (T) => {
|
|
1285
|
+
T || (A.value = "", O.value = !1, I.value = !0, j++, i.close()), u("cancelled");
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
});
|
|
1290
|
+
S.fulfillment = B;
|
|
1291
|
+
}
|
|
1292
|
+
try {
|
|
1293
|
+
await qe(
|
|
1294
|
+
n.purchaseOrder,
|
|
1295
|
+
S,
|
|
1296
|
+
e,
|
|
1297
|
+
c,
|
|
1298
|
+
j
|
|
1299
|
+
) === "submitted" && (a.open({
|
|
1300
|
+
title: "Success",
|
|
1301
|
+
message: _,
|
|
1302
|
+
type: "success"
|
|
1303
|
+
}), h("update:show", !1), h("submitted"));
|
|
1304
|
+
} catch (B) {
|
|
1305
|
+
a.open({
|
|
1306
|
+
title: "Something went wrong",
|
|
1307
|
+
message: "Please try again.",
|
|
1308
|
+
type: "error"
|
|
1309
|
+
}), console.error("Error when submitting PO operation", e, n.purchaseOrder, B);
|
|
1310
|
+
} finally {
|
|
1311
|
+
A.value = "", O.value = !1, I.value = !0;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
const Ae = z(() => {
|
|
1316
|
+
var e, c;
|
|
1317
|
+
return ((e = n.purchaseOrder) == null ? void 0 : e.status) === se.enum.RECEIVING || ((c = n.purchaseOrder) == null ? void 0 : c.status) === se.enum.COMPLETE;
|
|
1318
|
+
}), Te = z(() => {
|
|
1319
|
+
var B, Q, u;
|
|
1320
|
+
const _ = (((B = n.purchaseOrder) == null ? void 0 : B.deliveryOrder) ?? []).flatMap((T) => T.received ?? []).reduce(
|
|
1321
|
+
(T, U) => {
|
|
1322
|
+
const G = T[U.sku._id] ?? [];
|
|
1323
|
+
return T[U.sku._id] = [...G, U], T;
|
|
1324
|
+
},
|
|
1325
|
+
{}
|
|
1326
|
+
), S = Object.entries(_).reduce(
|
|
1327
|
+
(T, [U, G]) => {
|
|
1328
|
+
const C = G.reduce((J, F) => {
|
|
1329
|
+
const ne = yt(
|
|
1330
|
+
J,
|
|
1331
|
+
Math.max(J.precision, F.amount.precision)
|
|
1332
|
+
);
|
|
1333
|
+
return Fe(ne, F.amount);
|
|
1334
|
+
}, Oe(0));
|
|
1335
|
+
return T[U] = C, T;
|
|
1336
|
+
},
|
|
1337
|
+
{}
|
|
1338
|
+
), j = ((Q = n.purchaseOrder) == null ? void 0 : Q.items) ?? [];
|
|
1339
|
+
for (const T of j)
|
|
1340
|
+
S[u = T.sku._id] ?? (S[u] = Oe(0));
|
|
1341
|
+
return S;
|
|
1342
|
+
}), g = z(() => {
|
|
1343
|
+
var B, Q;
|
|
1344
|
+
const e = ((B = n.purchaseOrder) == null ? void 0 : B.deliveryOrder) ?? [], c = ((Q = n.purchaseOrder) == null ? void 0 : Q.deliveryFullfillment) ?? [], _ = [
|
|
1345
|
+
...e.map((u) => ({
|
|
1346
|
+
createdAt: u.createdAt,
|
|
1347
|
+
type: "grn",
|
|
1348
|
+
doc: u
|
|
1349
|
+
})),
|
|
1350
|
+
...c.map((u) => ({
|
|
1351
|
+
createdAt: u.createdAt,
|
|
1352
|
+
type: "fulfillment",
|
|
1353
|
+
doc: u
|
|
1354
|
+
}))
|
|
1355
|
+
];
|
|
1356
|
+
_.reverse().sort((u, T) => u.createdAt.localeCompare(T.createdAt));
|
|
1357
|
+
function S(u) {
|
|
1358
|
+
var G, C, J, F, ne, be, ge, _e, $;
|
|
1359
|
+
const T = c.findIndex((P) => P.id === u.fullfillmentId), U = [
|
|
1360
|
+
(C = (G = c[T]) == null ? void 0 : G.netSuite) != null && C.refNo ? {
|
|
1361
|
+
label: "Fulfillment's ref no. (Netsuite)",
|
|
1362
|
+
values: [(F = (J = c[T]) == null ? void 0 : J.netSuite) == null ? void 0 : F.refNo]
|
|
1363
|
+
} : null,
|
|
1364
|
+
(ne = u == null ? void 0 : u.netSuite) != null && ne.refNo ? {
|
|
1365
|
+
label: "Netsuite ref no.",
|
|
1366
|
+
values: [(be = u == null ? void 0 : u.netSuite) == null ? void 0 : be.refNo]
|
|
1367
|
+
} : null,
|
|
1368
|
+
(ge = u == null ? void 0 : u.netSuite) != null && ge.recordType ? {
|
|
1369
|
+
label: "Netsuite Type",
|
|
1370
|
+
values: [vt((_e = u == null ? void 0 : u.netSuite) == null ? void 0 : _e.recordType)]
|
|
1371
|
+
} : null
|
|
1372
|
+
];
|
|
1373
|
+
return {
|
|
1374
|
+
header: "Received",
|
|
1375
|
+
date: Pe(new Date(u.createdAt)),
|
|
1376
|
+
info: [
|
|
1377
|
+
{
|
|
1378
|
+
label: "Adjustment date",
|
|
1379
|
+
values: [
|
|
1380
|
+
u.adjustment ? Pe(new Date(ht(u.adjustment))) : "-"
|
|
1381
|
+
]
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
label: "Received by",
|
|
1385
|
+
values: [($ = u.createdBy) == null ? void 0 : $.name]
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
label: "Received items",
|
|
1389
|
+
values: u.received.map((P) => {
|
|
1390
|
+
var M;
|
|
1391
|
+
return q("div", [
|
|
1392
|
+
q(
|
|
1393
|
+
"div",
|
|
1394
|
+
{
|
|
1395
|
+
class: "flex gap-4"
|
|
1396
|
+
},
|
|
1397
|
+
[
|
|
1398
|
+
q(
|
|
1399
|
+
"div",
|
|
1400
|
+
{
|
|
1401
|
+
class: "flex flex-col"
|
|
1402
|
+
},
|
|
1403
|
+
[
|
|
1404
|
+
q(
|
|
1405
|
+
"span",
|
|
1406
|
+
{
|
|
1407
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
1408
|
+
},
|
|
1409
|
+
`${P.sku.name}`
|
|
1410
|
+
),
|
|
1411
|
+
q(
|
|
1412
|
+
"span",
|
|
1413
|
+
{
|
|
1414
|
+
class: "fm-typo-en-body-md-400"
|
|
1415
|
+
},
|
|
1416
|
+
`${P.sku.code} `
|
|
1417
|
+
)
|
|
1418
|
+
]
|
|
1419
|
+
),
|
|
1420
|
+
q(
|
|
1421
|
+
"div",
|
|
1422
|
+
{
|
|
1423
|
+
class: "ml-auto flex flex-col"
|
|
1424
|
+
},
|
|
1425
|
+
[
|
|
1426
|
+
q(
|
|
1427
|
+
"div",
|
|
1428
|
+
{
|
|
1429
|
+
class: "ml-auto flex gap-1"
|
|
1430
|
+
},
|
|
1431
|
+
[
|
|
1432
|
+
q(
|
|
1433
|
+
"span",
|
|
1434
|
+
{
|
|
1435
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
1436
|
+
},
|
|
1437
|
+
oe(P.amount, !1)
|
|
1438
|
+
),
|
|
1439
|
+
q(
|
|
1440
|
+
"span",
|
|
1441
|
+
{
|
|
1442
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1443
|
+
},
|
|
1444
|
+
((M = P.measurement) == null ? void 0 : M.abbrev) ?? P.sku.unit.abbrev
|
|
1445
|
+
)
|
|
1446
|
+
]
|
|
1447
|
+
),
|
|
1448
|
+
q(
|
|
1449
|
+
"div",
|
|
1450
|
+
{
|
|
1451
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1452
|
+
},
|
|
1453
|
+
`${P.cost ? `(${xe(P.cost)})` : ""}`
|
|
1454
|
+
)
|
|
1455
|
+
]
|
|
1456
|
+
)
|
|
1457
|
+
]
|
|
1458
|
+
)
|
|
1459
|
+
]);
|
|
1460
|
+
})
|
|
1461
|
+
},
|
|
1462
|
+
u.deliveryOrderNumber ? {
|
|
1463
|
+
label: "Delivery order no.",
|
|
1464
|
+
values: [u.deliveryOrderNumber]
|
|
1465
|
+
} : null,
|
|
1466
|
+
u.remark ? {
|
|
1467
|
+
label: "Remark",
|
|
1468
|
+
values: [u.remark]
|
|
1469
|
+
} : null,
|
|
1470
|
+
T > -1 ? {
|
|
1471
|
+
label: "Fulfilment's sequence",
|
|
1472
|
+
values: [`${T + 1}`]
|
|
1473
|
+
} : null,
|
|
1474
|
+
...U
|
|
1475
|
+
].filter((P) => P)
|
|
1476
|
+
};
|
|
1477
|
+
}
|
|
1478
|
+
function j(u) {
|
|
1479
|
+
var U, G;
|
|
1480
|
+
const T = c.findIndex((C) => C.id === u.id);
|
|
1481
|
+
return {
|
|
1482
|
+
header: "Fulfillment",
|
|
1483
|
+
date: Pe(new Date(u.createdAt)),
|
|
1484
|
+
info: [
|
|
1485
|
+
{
|
|
1486
|
+
label: "Sequence",
|
|
1487
|
+
values: [String(T + 1)]
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
label: "Receiveable items",
|
|
1491
|
+
values: u.items.map((C) => {
|
|
1492
|
+
var J;
|
|
1493
|
+
return q("div", [
|
|
1494
|
+
q(
|
|
1495
|
+
"div",
|
|
1496
|
+
{
|
|
1497
|
+
class: "flex gap-4"
|
|
1498
|
+
},
|
|
1499
|
+
[
|
|
1500
|
+
q(
|
|
1501
|
+
"div",
|
|
1502
|
+
{
|
|
1503
|
+
class: "flex flex-col"
|
|
1504
|
+
},
|
|
1505
|
+
[
|
|
1506
|
+
q(
|
|
1507
|
+
"span",
|
|
1508
|
+
{
|
|
1509
|
+
class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
|
|
1510
|
+
},
|
|
1511
|
+
`${C.sku.name}`
|
|
1512
|
+
),
|
|
1513
|
+
q(
|
|
1514
|
+
"span",
|
|
1515
|
+
{
|
|
1516
|
+
class: "fm-typo-en-body-md-400"
|
|
1517
|
+
},
|
|
1518
|
+
`${C.sku.code} `
|
|
1519
|
+
)
|
|
1520
|
+
]
|
|
1521
|
+
),
|
|
1522
|
+
q(
|
|
1523
|
+
"div",
|
|
1524
|
+
{
|
|
1525
|
+
class: "ml-auto flex flex-col"
|
|
1526
|
+
},
|
|
1527
|
+
[
|
|
1528
|
+
q(
|
|
1529
|
+
"div",
|
|
1530
|
+
{
|
|
1531
|
+
class: "ml-auto flex gap-1"
|
|
1532
|
+
},
|
|
1533
|
+
[
|
|
1534
|
+
q(
|
|
1535
|
+
"span",
|
|
1536
|
+
{
|
|
1537
|
+
class: "fm-typo-en-body-lg-600 self-end"
|
|
1538
|
+
},
|
|
1539
|
+
oe(C.amount, !1)
|
|
1540
|
+
),
|
|
1541
|
+
q(
|
|
1542
|
+
"span",
|
|
1543
|
+
{
|
|
1544
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
|
|
1545
|
+
},
|
|
1546
|
+
((J = C.measurement) == null ? void 0 : J.abbrev) ?? C.sku.unit.abbrev
|
|
1547
|
+
)
|
|
1548
|
+
]
|
|
1549
|
+
),
|
|
1550
|
+
q(
|
|
1551
|
+
"div",
|
|
1552
|
+
{
|
|
1553
|
+
class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
1554
|
+
},
|
|
1555
|
+
`${C.cost ? `(${xe(C.cost)})` : ""}`
|
|
1556
|
+
)
|
|
1557
|
+
]
|
|
1558
|
+
)
|
|
1559
|
+
]
|
|
1560
|
+
)
|
|
1561
|
+
]);
|
|
1562
|
+
})
|
|
1563
|
+
},
|
|
1564
|
+
(U = u.netSuite) != null && U.refNo ? {
|
|
1565
|
+
label: "Ref no. (Netsuite)",
|
|
1566
|
+
values: [(G = u.netSuite) == null ? void 0 : G.refNo]
|
|
1567
|
+
} : null
|
|
1568
|
+
].filter((C) => C)
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
return _.map((u) => {
|
|
1572
|
+
switch (u.type) {
|
|
1573
|
+
case "grn":
|
|
1574
|
+
return S(u.doc);
|
|
1575
|
+
case "fulfillment":
|
|
1576
|
+
return j(u.doc);
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
}), k = z(() => {
|
|
1580
|
+
var c;
|
|
1581
|
+
const e = {
|
|
1582
|
+
...Oe(0),
|
|
1583
|
+
currency: Je()
|
|
1584
|
+
};
|
|
1585
|
+
return ((c = n.purchaseOrder) == null ? void 0 : c.items.reduce((_, S) => ({
|
|
1586
|
+
...Fe(_, S.totalCost ?? e),
|
|
1587
|
+
currency: Je()
|
|
1588
|
+
}), e)) ?? e;
|
|
1589
|
+
});
|
|
1590
|
+
return (e, c) => {
|
|
1591
|
+
var C, J;
|
|
1592
|
+
const _ = H("FmButtonGroup"), S = H("FmChip"), j = H("FmMenuDivider"), B = H("FmCard"), Q = H("FmIcon"), u = H("FmTooltip"), T = H("FmSpacer"), U = H("FmButton"), G = H("FmSideSheet");
|
|
1593
|
+
return w(), le(G, {
|
|
1594
|
+
header: p(r)("inventory.transfer.receiveRequest.details.title") + ((C = e.purchaseOrder) != null && C.seqNumber ? ` #${(J = e.purchaseOrder) == null ? void 0 : J.seqNumber}` : ""),
|
|
1595
|
+
modelValue: p(ae),
|
|
1596
|
+
"onUpdate:modelValue": c[4] || (c[4] = (F) => _t(ae) ? ae.value = F : null),
|
|
1597
|
+
"dismiss-away": I.value,
|
|
1598
|
+
"close-button": "",
|
|
1599
|
+
"max-width": 600
|
|
1600
|
+
}, {
|
|
1601
|
+
default: ie(() => {
|
|
1602
|
+
var F, ne, be, ge, _e;
|
|
1603
|
+
return [
|
|
1604
|
+
s("div", nr, [
|
|
1605
|
+
s("div", null, [
|
|
1606
|
+
E(_, {
|
|
1607
|
+
items: ee.value,
|
|
1608
|
+
modelValue: ce.value,
|
|
1609
|
+
"onUpdate:modelValue": c[0] || (c[0] = ($) => ce.value = $)
|
|
1610
|
+
}, null, 8, ["items", "modelValue"])
|
|
1611
|
+
]),
|
|
1612
|
+
ce.value.value === "overview" ? (w(), D(te, { key: 0 }, [
|
|
1613
|
+
s("div", null, [
|
|
1614
|
+
E(B, {
|
|
1615
|
+
variant: "outlined",
|
|
1616
|
+
class: "flex flex-col gap-8 px-12 py-16"
|
|
1617
|
+
}, {
|
|
1618
|
+
default: ie(() => {
|
|
1619
|
+
var $, P, M, me, fe, Se, Ke, ze, Ge, He, Qe, Ye;
|
|
1620
|
+
return [
|
|
1621
|
+
s("div", or, [
|
|
1622
|
+
s("div", cr, R(p(r)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
|
|
1623
|
+
s("div", null, [
|
|
1624
|
+
E(S, {
|
|
1625
|
+
label: p(r)(`inventory.transfer.status.${($ = e.purchaseOrder) == null ? void 0 : $.status}`),
|
|
1626
|
+
class: Re(`fm-status-badge fm-status-badge-${(M = (P = e.purchaseOrder) == null ? void 0 : P.status) == null ? void 0 : M.toLocaleLowerCase("en-us")}`),
|
|
1627
|
+
compact: ""
|
|
1628
|
+
}, null, 8, ["label", "class"])
|
|
1629
|
+
])
|
|
1630
|
+
]),
|
|
1631
|
+
E(j),
|
|
1632
|
+
s("div", lr, [
|
|
1633
|
+
s("div", ir, [
|
|
1634
|
+
s("div", ur, [
|
|
1635
|
+
s("div", dr, R(p(r)("inventory.transfer.receiveRequest.details.createdAt")), 1)
|
|
1636
|
+
]),
|
|
1637
|
+
s("div", mr, R(p(ke)(((me = e.purchaseOrder) == null ? void 0 : me._id) ?? "")), 1)
|
|
1638
|
+
]),
|
|
1639
|
+
(fe = e.purchaseOrder) != null && fe.effectiveAt ? (w(), D("div", fr, [
|
|
1640
|
+
s("div", pr, R(p(r)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
|
|
1641
|
+
s("div", yr, R(p(st)(new Date((Se = e.purchaseOrder) == null ? void 0 : Se.effectiveAt))), 1)
|
|
1642
|
+
])) : L("", !0),
|
|
1643
|
+
s("div", vr, [
|
|
1644
|
+
s("div", hr, R(p(r)("inventory.transfer.receiveRequest.details.type.title")), 1),
|
|
1645
|
+
s("div", br, R(p(r)(
|
|
1646
|
+
`inventory.transfer.receiveRequest.details.type.${b.value.toLocaleLowerCase("en-US")}`
|
|
1647
|
+
)), 1)
|
|
1648
|
+
]),
|
|
1649
|
+
(ze = (Ke = e.purchaseOrder) == null ? void 0 : Ke.supplier) != null && ze.name ? (w(), D("div", gr, [
|
|
1650
|
+
s("div", _r, R(p(r)("inventory.transfer.receiveRequest.details.from")), 1),
|
|
1651
|
+
s("div", wr, R((He = (Ge = e.purchaseOrder) == null ? void 0 : Ge.supplier) == null ? void 0 : He.name), 1)
|
|
1652
|
+
])) : L("", !0),
|
|
1653
|
+
e.transferTo ? (w(), D("div", Sr, [
|
|
1654
|
+
s("div", xr, R(p(r)("inventory.transfer.receiveRequest.details.to")), 1),
|
|
1655
|
+
s("div", Rr, R(e.transferTo), 1)
|
|
1656
|
+
])) : L("", !0),
|
|
1657
|
+
(Qe = e.purchaseOrder) != null && Qe.ref ? (w(), D("div", Or, [
|
|
1658
|
+
s("div", kr, R(p(r)("inventory.transfer.receiveRequest.details.reference")), 1),
|
|
1659
|
+
s("div", Dr, R(e.purchaseOrder.ref), 1)
|
|
1660
|
+
])) : L("", !0),
|
|
1661
|
+
(Ye = e.purchaseOrder) != null && Ye.remark ? (w(), D("div", Nr, [
|
|
1662
|
+
s("div", qr, R(p(r)("inventory.transfer.receiveRequest.details.remark")), 1),
|
|
1663
|
+
s("div", Ar, R(e.purchaseOrder.remark), 1)
|
|
1664
|
+
])) : L("", !0)
|
|
1665
|
+
])
|
|
1666
|
+
];
|
|
1667
|
+
}),
|
|
1668
|
+
_: 1
|
|
1669
|
+
})
|
|
1670
|
+
]),
|
|
1671
|
+
p(y).isNetSuiteEnabled && !x.value ? (w(), D("div", Tr, [
|
|
1672
|
+
s("div", Pr, [
|
|
1673
|
+
c[5] || (c[5] = s("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
|
|
1674
|
+
s("div", null, [
|
|
1675
|
+
E(Jt, {
|
|
1676
|
+
"po-request": e.poRequest,
|
|
1677
|
+
"purchase-order": e.purchaseOrder,
|
|
1678
|
+
"is-transfer-between-outlets": x.value
|
|
1679
|
+
}, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"])
|
|
1680
|
+
])
|
|
1681
|
+
]),
|
|
1682
|
+
E(j),
|
|
1683
|
+
E(Wt, {
|
|
1684
|
+
"po-request": e.poRequest,
|
|
1685
|
+
"purchase-order": e.purchaseOrder,
|
|
1686
|
+
"transfer-type": b.value,
|
|
1687
|
+
"transfer-to-db-name": e.transferToDbName,
|
|
1688
|
+
"is-transfer-between-outlets": x.value,
|
|
1689
|
+
scope: e.scope
|
|
1690
|
+
}, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
|
|
1691
|
+
])) : L("", !0),
|
|
1692
|
+
s("div", $r, [
|
|
1693
|
+
s("div", Cr, [
|
|
1694
|
+
s("div", Ir, [
|
|
1695
|
+
s("span", Fr, [
|
|
1696
|
+
$e(R(Ae.value ? p(r)("inventory.transfer.receiveRequest.details.receivedItems") : p(r)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
|
|
1697
|
+
(ne = (F = e.purchaseOrder) == null ? void 0 : F.netSuite) != null && ne.missingItems && ((ge = (be = e.purchaseOrder) == null ? void 0 : be.netSuite) == null ? void 0 : ge.missingItems.length) > 0 ? (w(), le(u, {
|
|
1698
|
+
key: 0,
|
|
1699
|
+
variant: "rich",
|
|
1700
|
+
placement: "top",
|
|
1701
|
+
"z-index": 51
|
|
1702
|
+
}, {
|
|
1703
|
+
content: ie(() => {
|
|
1704
|
+
var $, P;
|
|
1705
|
+
return [
|
|
1706
|
+
s("div", Er, [
|
|
1707
|
+
(w(!0), D(te, null, pe((P = ($ = e.purchaseOrder) == null ? void 0 : $.netSuite) == null ? void 0 : P.missingItems, (M, me) => (w(), D("div", {
|
|
1708
|
+
class: "flex justify-center align-middle",
|
|
1709
|
+
key: me
|
|
1710
|
+
}, [
|
|
1711
|
+
E(Q, {
|
|
1712
|
+
name: "arrow_right",
|
|
1713
|
+
size: "sm"
|
|
1714
|
+
}),
|
|
1715
|
+
$e(" " + R(`(${M.netSuiteId}) ${M.name}: ${M.reason}`), 1)
|
|
1716
|
+
]))), 128))
|
|
1717
|
+
])
|
|
1718
|
+
];
|
|
1719
|
+
}),
|
|
1720
|
+
default: ie(() => [
|
|
1721
|
+
E(Q, {
|
|
1722
|
+
name: "error",
|
|
1723
|
+
color: "#ff2c2c",
|
|
1724
|
+
size: "sm"
|
|
1725
|
+
})
|
|
1726
|
+
]),
|
|
1727
|
+
_: 1
|
|
1728
|
+
})) : L("", !0)
|
|
1729
|
+
])
|
|
1730
|
+
]),
|
|
1731
|
+
E(j),
|
|
1732
|
+
(w(!0), D(te, null, pe(((_e = e.purchaseOrder) == null ? void 0 : _e.items) ?? [], ($) => {
|
|
1733
|
+
var P;
|
|
1734
|
+
return w(), D("div", {
|
|
1735
|
+
key: $.code,
|
|
1736
|
+
class: "flex flex-col"
|
|
1737
|
+
}, [
|
|
1738
|
+
s("div", Br, [
|
|
1739
|
+
s("div", Ur, R($.name), 1),
|
|
1740
|
+
s("div", Lr, R(p(oe)(Te.value[$.sku._id], !1)) + "/" + R(p(nt)($.quantity, $.sku.unit, $.measurement)), 1)
|
|
1741
|
+
]),
|
|
1742
|
+
s("div", Vr, [
|
|
1743
|
+
s("div", Mr, R($.code), 1),
|
|
1744
|
+
(P = $.totalCost) != null && P.amount && p(d).enableTotalCost ? (w(), D("div", jr, " (" + R(p(xe)($.totalCost)) + ") ", 1)) : L("", !0)
|
|
1745
|
+
])
|
|
1746
|
+
]);
|
|
1747
|
+
}), 128)),
|
|
1748
|
+
+p(oe)(k.value) ? (w(), D(te, { key: 0 }, [
|
|
1749
|
+
s("div", Kr, [
|
|
1750
|
+
E(j)
|
|
1751
|
+
]),
|
|
1752
|
+
s("div", zr, [
|
|
1753
|
+
c[6] || (c[6] = s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
|
|
1754
|
+
s("div", Gr, R(p(xe)(k.value)), 1)
|
|
1755
|
+
])
|
|
1756
|
+
], 64)) : L("", !0)
|
|
1757
|
+
])
|
|
1758
|
+
])
|
|
1759
|
+
], 64)) : ce.value.value === "deliveryHistory" ? (w(), D("div", Hr, [
|
|
1760
|
+
g.value.length ? (w(), D("div", Jr, [
|
|
1761
|
+
(w(!0), D(te, null, pe(g.value, ($, P) => (w(), D(te, { key: P }, [
|
|
1762
|
+
s("div", Zr, [
|
|
1763
|
+
s("div", es, [
|
|
1764
|
+
s("div", ts, [
|
|
1765
|
+
s("div", {
|
|
1766
|
+
class: Re([
|
|
1767
|
+
{
|
|
1768
|
+
"bg-fm-color-primary": P !== 0,
|
|
1769
|
+
"bg-white": P === 0
|
|
1770
|
+
},
|
|
1771
|
+
"w-[2px] h-full"
|
|
1772
|
+
])
|
|
1773
|
+
}, null, 2)
|
|
1774
|
+
]),
|
|
1775
|
+
c[7] || (c[7] = s("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
|
|
1776
|
+
s("div", rs, [
|
|
1777
|
+
s("div", {
|
|
1778
|
+
class: Re([
|
|
1779
|
+
{
|
|
1780
|
+
"bg-fm-color-primary": P < g.value.length - 1,
|
|
1781
|
+
"bg-white": P >= g.value.length - 1
|
|
1782
|
+
},
|
|
1783
|
+
"w-[2px] h-full"
|
|
1784
|
+
])
|
|
1785
|
+
}, null, 2)
|
|
1786
|
+
])
|
|
1787
|
+
]),
|
|
1788
|
+
s("div", ss, [
|
|
1789
|
+
s("div", as, R($.header), 1),
|
|
1790
|
+
s("div", ns, R($.date), 1)
|
|
1791
|
+
])
|
|
1792
|
+
]),
|
|
1793
|
+
s("div", os, [
|
|
1794
|
+
s("div", cs, [
|
|
1795
|
+
s("div", ls, [
|
|
1796
|
+
s("div", {
|
|
1797
|
+
class: Re([
|
|
1798
|
+
{
|
|
1799
|
+
"bg-fm-color-primary": P < g.value.length - 1,
|
|
1800
|
+
"bg-white": P >= g.value.length - 1
|
|
1801
|
+
},
|
|
1802
|
+
"w-[2px] h-full"
|
|
1803
|
+
])
|
|
1804
|
+
}, null, 2)
|
|
1805
|
+
])
|
|
1806
|
+
]),
|
|
1807
|
+
s("div", is, [
|
|
1808
|
+
E(B, {
|
|
1809
|
+
variant: "outlined",
|
|
1810
|
+
class: "py-12 px-16"
|
|
1811
|
+
}, {
|
|
1812
|
+
default: ie(() => [
|
|
1813
|
+
s("div", us, [
|
|
1814
|
+
(w(!0), D(te, null, pe($.info, (M, me) => (w(), D("div", {
|
|
1815
|
+
key: me,
|
|
1816
|
+
class: "flex flex-col gap-4"
|
|
1817
|
+
}, [
|
|
1818
|
+
s("div", ds, R(M == null ? void 0 : M.label), 1),
|
|
1819
|
+
s("div", ms, [
|
|
1820
|
+
(w(!0), D(te, null, pe(M == null ? void 0 : M.values, (fe, Se) => (w(), D("div", {
|
|
1821
|
+
key: Se,
|
|
1822
|
+
class: "fm-typo-en-body-lg-600"
|
|
1823
|
+
}, [
|
|
1824
|
+
typeof fe == "string" ? (w(), D(te, { key: 0 }, [
|
|
1825
|
+
$e(R(fe), 1)
|
|
1826
|
+
], 64)) : (w(), le(wt(fe), { key: 1 }))
|
|
1827
|
+
]))), 128))
|
|
1828
|
+
])
|
|
1829
|
+
]))), 128))
|
|
1830
|
+
])
|
|
1831
|
+
]),
|
|
1832
|
+
_: 2
|
|
1833
|
+
}, 1024)
|
|
1834
|
+
])
|
|
1835
|
+
])
|
|
1836
|
+
], 64))), 128))
|
|
1837
|
+
])) : (w(), D("div", Qr, [
|
|
1838
|
+
E(T),
|
|
1839
|
+
s("div", null, [
|
|
1840
|
+
s("img", {
|
|
1841
|
+
src: p(Ot),
|
|
1842
|
+
alt: "List is empty"
|
|
1843
|
+
}, null, 8, Yr)
|
|
1844
|
+
]),
|
|
1845
|
+
s("div", Wr, R(p(r)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
|
|
1846
|
+
s("div", Xr, R(p(r)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
|
|
1847
|
+
E(T),
|
|
1848
|
+
E(T)
|
|
1849
|
+
]))
|
|
1850
|
+
])) : L("", !0)
|
|
1851
|
+
])
|
|
1852
|
+
];
|
|
1853
|
+
}),
|
|
1854
|
+
"side-sheet-footer": ie(() => [
|
|
1855
|
+
s("div", fs, [
|
|
1856
|
+
(w(!0), D(te, null, pe(X.value, (F) => (w(), le(U, {
|
|
1857
|
+
key: F,
|
|
1858
|
+
label: p(r)(p(et)[F].translationKey),
|
|
1859
|
+
onClick: (ne) => he(F),
|
|
1860
|
+
loading: A.value === F,
|
|
1861
|
+
disabled: A.value !== F && O.value,
|
|
1862
|
+
variant: p(et)[F].buttonVariant
|
|
1863
|
+
}, null, 8, ["label", "onClick", "loading", "disabled", "variant"]))), 128)),
|
|
1864
|
+
p(f).ableToMarkReceived(e.purchaseOrder) && !X.value.includes("completeReceive") ? (w(), le(U, {
|
|
1865
|
+
key: 0,
|
|
1866
|
+
label: p(r)("inventory.transfer.receiveRequest.actions.completeReceive"),
|
|
1867
|
+
onClick: c[1] || (c[1] = (F) => he("completeReceive")),
|
|
1868
|
+
loading: A.value === "completeReceive",
|
|
1869
|
+
disabled: A.value !== "completeReceive" && O.value
|
|
1870
|
+
}, null, 8, ["label", "loading", "disabled"])) : L("", !0),
|
|
1871
|
+
p(f).ableToMarkApproved(e.purchaseOrder) && e.canApprove && !X.value.includes("approveRequest") ? (w(), le(U, {
|
|
1872
|
+
key: 1,
|
|
1873
|
+
label: p(r)("inventory.transfer.approval.actions.approveRequest"),
|
|
1874
|
+
onClick: c[2] || (c[2] = (F) => he("approveRequest")),
|
|
1875
|
+
loading: A.value === "approveRequest",
|
|
1876
|
+
disabled: A.value !== "approveRequest" && O.value
|
|
1877
|
+
}, null, 8, ["label", "loading", "disabled"])) : L("", !0),
|
|
1878
|
+
E(U, {
|
|
1879
|
+
label: p(r)("common.close"),
|
|
1880
|
+
variant: "tertiary",
|
|
1881
|
+
onClick: c[3] || (c[3] = (F) => h("update:show", !1))
|
|
1882
|
+
}, null, 8, ["label"])
|
|
1883
|
+
])
|
|
1884
|
+
]),
|
|
1885
|
+
_: 1
|
|
1886
|
+
}, 8, ["header", "modelValue", "dismiss-away"]);
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
export {
|
|
1891
|
+
Ee as P,
|
|
1892
|
+
ks as _,
|
|
1893
|
+
Rs as a,
|
|
1894
|
+
Os as b,
|
|
1895
|
+
Tt as g,
|
|
1896
|
+
Ne as u
|
|
1897
|
+
};
|