@feedmepos/mf-inventory-portal 1.2.2-dev.1 → 1.2.2-dev.3

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.
Files changed (106) hide show
  1. package/dist/{App-C9XQOsrP.js → App-DAab61Y3.js} +1 -1
  2. package/dist/{ApprovalView-1GBi8VK8.js → ApprovalView-BDt_IdgV.js} +2 -2
  3. package/dist/{BindingsDialog-D1jgrgHp.js → BindingsDialog-FF8USPP4.js} +2 -2
  4. package/dist/{BindingsPicker-BWpkVmRH.js → BindingsPicker-KFcppldz.js} +1 -1
  5. package/dist/{BindingsTable-C3a5rQsU.js → BindingsTable-jwQ801Fk.js} +1 -1
  6. package/dist/{ClosingDraftView-M1VZ7Ubp.js → ClosingDraftView-CYPkcKxk.js} +2 -2
  7. package/dist/{ClosingTemplateView-ubVOShkx.js → ClosingTemplateView-1UuB2aef.js} +2 -2
  8. package/dist/{DeliveryOrderPrintPreview-D8k7olwU.js → DeliveryOrderPrintPreview-NnfinFpy.js} +1 -1
  9. package/dist/FmAdminBadge-wjcRz0_J.js +44 -0
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BzWLBxUC.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CUlu-YXe.js} +3 -3
  11. package/dist/{FmMultiselectDialog-DZlmvlH-.js → FmMultiselectDialog-Bum2P_DE.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-qJ57T17v.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CnIQI968.js} +1 -1
  13. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BmWJSWWs.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CqGPRyAt.js} +1 -1
  14. package/dist/{IngredientGroupView-Lc4juIpn.js → IngredientGroupView-C7Z3zbzK.js} +2 -2
  15. package/dist/{IngredientsView-B7ilCUo1.js → IngredientsView-C8vAKCQU.js} +4 -4
  16. package/dist/{IntegrationView-CBbQi9eX.js → IntegrationView-BB-_EU26.js} +1282 -1267
  17. package/dist/{InventoryBindingForm-BYDnLY-B.js → InventoryBindingForm-Rjs3yODh.js} +1 -1
  18. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-DB_91rQK.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D9vjJDxP.js} +3 -3
  19. package/dist/{InventoryBindingSummary-CLk6_myJ.js → InventoryBindingSummary-BNy7uiUu.js} +1 -1
  20. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-TERMQx9m.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BApjHkbC.js} +1 -1
  21. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DMS_1RZd.js → PremiumBadge.vue_vue_type_script_setup_true_lang-C7wG_6bX.js} +1 -1
  22. package/dist/{PublishView-BzYVIzVH.js → PublishView-Btmo1Exg.js} +8 -8
  23. package/dist/{PurchaseOrderPrintPreview-DkhYCWlU.js → PurchaseOrderPrintPreview-DahOAnSq.js} +1 -1
  24. package/dist/{ReceiveRequestView-DYfMcV1P.js → ReceiveRequestView-DpLlm9By.js} +8 -8
  25. package/dist/{RecipeView-0v-PiaZL.js → RecipeView-BS3oR694.js} +3 -3
  26. package/dist/{StockView-DmVv6yZd.js → StockView-A1vau_vI.js} +837 -838
  27. package/dist/{SupplierView-EFvZjuXh.js → SupplierView-A-m1kPUl.js} +3 -3
  28. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-BgOY6LqL.js +2494 -0
  29. package/dist/{TransferTemplateView-B6dh3lAb.js → TransferTemplateView-BZMpQ0E_.js} +6 -6
  30. package/dist/{UnitView-Dwg-DzVw.js → UnitView-Bn6Kx8tl.js} +3 -3
  31. package/dist/{WarehouseView-DL0AMn3R.js → WarehouseView-0nCmwtBo.js} +1 -1
  32. package/dist/api/food-market-hub.d.ts +1 -1
  33. package/dist/api/inventory.d.ts +18 -18
  34. package/dist/api/netsuite.d.ts +19 -18
  35. package/dist/app-FwO7QbKs.js +153774 -0
  36. package/dist/app.d.ts +8 -8
  37. package/dist/app.js +1 -1
  38. package/dist/components/FmAdminBadge.vue.d.ts +1 -4
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +7 -7
  40. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  41. package/dist/components/shell/inventory/binding-ui.vue.d.ts +4 -4
  42. package/dist/{decimal-eRlOd74V.js → decimal-CRt-kBvR.js} +1 -1
  43. package/dist/{format-unit-display-CYusbGmI.js → format-unit-display-C9RjXfAz.js} +2 -2
  44. package/dist/{index-BxmvJ-ui.js → index-B18gU7C5.js} +1 -1
  45. package/dist/{index-khYeCDt1.js → index-B8xXPx48.js} +1 -1
  46. package/dist/{stock-B0suhBSW.js → stock-CJ8thbAt.js} +1 -1
  47. package/dist/stores/integration/foodmarkethub.d.ts +1 -1
  48. package/dist/stores/integration/netsuite.d.ts +9 -9
  49. package/dist/stores/inventory.d.ts +37 -37
  50. package/dist/stores/supplier.d.ts +24 -24
  51. package/dist/stores/warehouse.d.ts +1 -2
  52. package/dist/style.css +1 -1
  53. package/dist/{supplier-JDcv1lRx.js → supplier-Ci3-VSI6.js} +1 -1
  54. package/dist/tsconfig.app.tsbuildinfo +1 -1
  55. package/dist/{use-ingredient-select-dialog-w6dHX9B4.js → use-ingredient-select-dialog-B4k3p-nd.js} +1 -1
  56. package/dist/{use-inventory-binding-dialog--7QT5_-Q.js → use-inventory-binding-dialog-B7HiDfIi.js} +1 -1
  57. package/dist/views/adjustment-template/wastage-template/actions.d.ts +12 -12
  58. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +2 -2
  59. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +1 -1
  60. package/dist/views/adjustment-template/wastage-template/table.d.ts +12 -12
  61. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +32 -32
  62. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +96 -96
  63. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +3 -3
  64. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +36 -36
  65. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +36 -36
  66. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  67. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +6 -6
  68. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +4 -4
  69. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +3 -3
  70. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +2 -2
  71. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +2 -2
  72. package/dist/views/integration/components/netsuite/InventoryTransfer.vue.d.ts +2 -2
  73. package/dist/views/integration/components/netsuite/InventoryTransferIngredientTable.vue.d.ts +10 -10
  74. package/dist/views/integration/components/netsuite/PurchaseOrder.vue.d.ts +2 -2
  75. package/dist/views/integration/components/netsuite/TransferOrder.vue.d.ts +2 -2
  76. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +6 -6
  77. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -2
  78. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +450 -94
  79. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +10 -10
  80. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +20 -20
  81. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +5 -5
  82. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +111 -22
  83. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +669 -135
  84. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +780 -157
  85. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  86. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +10 -10
  87. package/dist/views/stock/components/dialog/AmendAdjustmentForm.vue.d.ts +4 -4
  88. package/dist/views/supplier/components/SupplierForm.vue.d.ts +2 -2
  89. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +2 -2
  90. package/dist/views/supplier/composables/use-supplier-table.d.ts +1 -1
  91. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +12 -12
  92. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +8 -8
  93. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +10 -10
  94. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
  95. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +5 -5
  96. package/dist/views/transfer-template/composables/use-netsuite-custom-field.d.ts +15 -15
  97. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -72
  98. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -72
  99. package/dist/views/unit/components/unit-form/UnitForm.vue.d.ts +2 -2
  100. package/dist/views/unit/components/unit-summary/UnitSummary.vue.d.ts +2 -2
  101. package/dist/views/unit/composables/use-unit-table.d.ts +1 -1
  102. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +2 -4
  103. package/package.json +1 -1
  104. package/dist/FmAdminBadge-BFDkedmh.js +0 -34
  105. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B7Y2vAlL.js +0 -2336
  106. package/dist/app-D6kqZa_9.js +0 -130114
@@ -1,2336 +0,0 @@
1
- import { a3 as vt, u as me, aS as x, aT as Pe, aA as M, c as Ie, b as Fe, ab as yt, ad as ht, ae as bt, aU as gt, e as tt, f as at, a0 as We, aV as _t, a8 as ot, T as it, j as fe, a6 as St, aW as lt, ai as qe, h as rt, i as te, D as oe, aX as ct, aY as ut, aZ as Ve, ay as st, aa as Ae, a4 as Ue, a5 as wt, a_ as Ce, Q as Rt } from "./app-D6kqZa_9.js";
2
- import { ref as G, computed as ee, h as C, defineComponent as he, reactive as Ot, onMounted as dt, resolveComponent as W, openBlock as g, createBlock as ie, withCtx as re, createElementVNode as o, createVNode as I, unref as w, createElementBlock as N, toDisplayString as k, createCommentVNode as U, Fragment as ae, renderList as ve, watch as Nt, isRef as xt, createTextVNode as $e, normalizeClass as De, resolveDynamicComponent as kt } from "vue";
3
- import { F as At } from "./decimal-eRlOd74V.js";
4
- import { useCoreStore as Ee, useI18n as ft } from "@feedmepos/mf-common";
5
- import { useDialog as Ye, useSnackbar as Le, components as je, FmButtonVariant as ne, useProxiedModel as Ct } from "@feedmepos/ui-library";
6
- import { F as Ne } from "./FmAdminBadge-BFDkedmh.js";
7
- import { b as $t, u as Dt, P as ye, f as qt } from "./format-unit-display-CYusbGmI.js";
8
- import { E as Tt } from "./empty-placeholder-wf6-BWE8.js";
9
- import { _ as Pt, F as It, a as Ft } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-qJ57T17v.js";
10
- import { u as Et, R as nt } from "./usePromise-CbVUCxhj.js";
11
- import { u as Lt } from "./index-BxmvJ-ui.js";
12
- const Be = vt((y, t) => {
13
- const a = me(), _ = Ee();
14
- return {
15
- async readRequests(l, e, c) {
16
- const i = l ?? a.currentLocationDBName, s = `${y.inventoryBackendUrl}/${i}/purchase-request`;
17
- return e && c ? await t.get(`${s}?startDate=${e}&endDate=${c}`) : await t.get(s);
18
- },
19
- async readRequestById(l, e) {
20
- const c = e ?? a.currentLocationDBName, i = `${y.inventoryBackendUrl}/${c}/purchase-request/${l}`;
21
- return await t.get(i);
22
- },
23
- async readRequestByIds(l, e) {
24
- const c = e ?? a.currentLocationDBName, i = `${y.inventoryBackendUrl}/${c}/purchase-request/find`;
25
- return await t.post(i, { requestIds: l });
26
- },
27
- async getPurchaseOrders({
28
- start: l,
29
- end: e
30
- }) {
31
- const c = a.currentLocationDBName, i = `${y.inventoryBackendUrl}/${c}/purchase-order`;
32
- return await t.get(`${i}?start=${l}&end=${e}`);
33
- },
34
- async getLatestPurchaseOrderRequest(l) {
35
- const e = a.currentLocationDBName, c = `${y.inventoryBackendUrl}/${e}/purchase-request/find-by-purchase-order-id`;
36
- return await t.get(`${c}/${l}`);
37
- },
38
- async getPurchaseOrderById(l) {
39
- const e = a.currentLocationDBName, c = `${y.inventoryBackendUrl}/${e}/purchase-order`;
40
- return await t.get(`${c}/${l}`);
41
- },
42
- /**
43
- * @deprecated Use `processPurchaseOrderV2` instead.
44
- */
45
- async processPurchaseOrder(l, e) {
46
- const c = a.currentLocationDBName, i = e || c, s = `${y.inventoryBackendUrl}/${i}/purchase-order/run-operation`;
47
- return await t.put(s, l);
48
- },
49
- async createPurchaseOrder(l) {
50
- const e = a.currentLocationDBName, c = `${y.inventoryBackendUrl}/${e}/purchase-order`;
51
- return await t.post(c, l);
52
- },
53
- async updatePurchaseOrder(l) {
54
- const e = a.currentLocationDBName, c = `${y.inventoryBackendUrl}/${e}/purchase-order`;
55
- return await t.put(c, l);
56
- },
57
- async importFromXilnex(l) {
58
- const e = a.currentLocationDBName, c = `${y.inventoryBackendUrl}/${e}/purchase-order/import-from-xilnex`;
59
- return await t.post(c, l);
60
- },
61
- async processPurchaseOrderV2(l, e) {
62
- const c = a.currentLocationDBName, i = e || c, s = `${y.inventoryBackendUrl}/${i}/v2/purchase-order/run-operation`;
63
- return await t.put(s, l);
64
- },
65
- async getWorkflowConfig() {
66
- var i;
67
- const e = `business_${(i = _.currentBusiness.value) == null ? void 0 : i._id}`, c = `${y.inventoryBackendUrl}/${e}/v2/purchase-order/workflow-config`;
68
- return await t.get(c);
69
- }
70
- };
71
- }), mt = {
72
- [x.enum.confirmDraft]: {
73
- primaryActions: {
74
- text: "Confirm draft",
75
- close: !0
76
- },
77
- title: "Confirm draft?",
78
- message: "Purchase order cannot be changed after confirm draft.",
79
- successMessage: "Purchase order draft has been confirmed"
80
- },
81
- [x.enum.cancelDraft]: {
82
- primaryActions: {
83
- text: "Cancel draft",
84
- close: !0,
85
- variant: "destructive"
86
- },
87
- title: "Cancel draft?",
88
- message: "Purchase order cannot be changed after cancelled draft.",
89
- successMessage: "Purchase order draft has been cancelled"
90
- },
91
- [x.enum.submitRequest]: {
92
- primaryActions: {
93
- text: "Submit request",
94
- close: !0
95
- },
96
- title: "Confirm draft?",
97
- message: "Purchase order cannot be changed after confirm draft.",
98
- successMessage: "Purchase order draft has been submitted"
99
- },
100
- [x.enum.completeReceive]: {
101
- primaryActions: {
102
- text: "Mark received",
103
- close: !0
104
- },
105
- title: "Mark as received",
106
- message: "Purchase order cannot be changed after it has complete receiving.",
107
- successMessage: "Purchase order has been marked as received"
108
- },
109
- [x.enum.approveRequest]: {
110
- primaryActions: {
111
- text: "Accept request",
112
- close: !0
113
- },
114
- title: "Accept request?",
115
- message: "Transfer out request will be accepted.",
116
- successMessage: "Transfer out request has been approved"
117
- },
118
- [x.enum.rejectRequest]: {
119
- primaryActions: {
120
- text: "Reject request",
121
- close: !0,
122
- variant: "destructive"
123
- },
124
- title: "Reject request?",
125
- message: "Purchase order will be rejected.",
126
- successMessage: "Purchase order has been rejected"
127
- },
128
- [x.enum.processRequest]: {
129
- primaryActions: {
130
- text: "Process request",
131
- close: !0,
132
- variant: "destructive"
133
- },
134
- title: "Process request?",
135
- message: "Purchase order will be processed.",
136
- successMessage: "Purchase order has been processed"
137
- }
138
- };
139
- function Te(y) {
140
- return Pe.generatedPOReceivedMap({
141
- purchaseOrder: y
142
- });
143
- }
144
- function Bt(y) {
145
- return Pe.validatePOItemReceivedStatus({
146
- dto: y
147
- });
148
- }
149
- function ze(y) {
150
- return Pe.validatePOReceivedStatus({
151
- receivedMap: y
152
- });
153
- }
154
- function Ge(y, t, a) {
155
- if (!M.safeParse(y).success)
156
- throw new Error(`Invalid purchase order status: ${y}`);
157
- const _ = M.parse(y);
158
- return Pe.orderStatusCombination({
159
- status: _,
160
- isPOPartialReceive: t,
161
- isPOOverReceive: a
162
- });
163
- }
164
- function pt() {
165
- const y = me(), t = Be(), a = Ie();
166
- async function _(e, c) {
167
- const i = y.currentLocationDBName;
168
- return e.doc.supplier.internal && e.operation === x.enum.confirmDraft && (e.operation = x.enum.submitRequest), await t.processPurchaseOrder(e, c || i);
169
- }
170
- async function l(e, c) {
171
- const i = y.currentLocationDBName;
172
- return await t.processPurchaseOrderV2(e, c || i);
173
- }
174
- return (e) => a.useOperatePurchaseOrderV2 ? l(e.operateV2, e.transferTo) : _(e.operate, e.transferTo);
175
- }
176
- var He = /* @__PURE__ */ ((y) => (y.RECEIVE_REQUEST = "receive/request", y.APPROVAL = "approval", y))(He || {});
177
- const Oe = G(), Me = G();
178
- function Ys(y, t) {
179
- const a = Ye(), _ = me(), l = Ie();
180
- Fe();
181
- const e = $t(), c = Dt(), i = G(!1), s = Le(), v = Be(), b = G(new Array()), m = G(
182
- t != null && t.startDate && (t != null && t.endDate) ? t : yt()
183
- ), p = ee(() => {
184
- const A = new Date(m.value.startDate), T = new Date(m.value.endDate);
185
- return {
186
- start: ht(A).toISOString(),
187
- end: bt(T).toISOString()
188
- };
189
- }), d = G(new Array()), n = gt(), u = G(null);
190
- async function S(A) {
191
- function T(r) {
192
- const f = {
193
- mode: tt.CREATE,
194
- modelValue: A || void 0,
195
- show: !0,
196
- "onUpdate:show"(O) {
197
- Oe.value.show = O;
198
- },
199
- templateId: r,
200
- lastClosingDate: u.value
201
- };
202
- Oe.value = f;
203
- }
204
- let Y;
205
- l.mustUsePoTemplate && !(A != null && A.template) ? a.open({
206
- title: "Create transfer",
207
- message: "",
208
- primaryActions: {
209
- text: "Select a template",
210
- close: !0
211
- },
212
- secondaryActions: {
213
- text: "Outlet to Outlet",
214
- variant: "secondary",
215
- close: !0
216
- }
217
- }).onPrimary(async () => {
218
- Y = await e.getTemplateId(), Y && T(Y);
219
- }).onSecondary(() => {
220
- T(void 0);
221
- }) : T(Y);
222
- }
223
- function R(A) {
224
- const T = {
225
- mode: tt.UPDATE,
226
- modelValue: at(A),
227
- show: !0,
228
- "onUpdate:show"(Y) {
229
- Oe.value.show = Y;
230
- },
231
- lastClosingDate: u.value
232
- };
233
- Oe.value = T;
234
- }
235
- async function D() {
236
- b.value = [], i.value = !0;
237
- try {
238
- b.value = await v.getPurchaseOrders(p.value).then((r) => r.sort((f, O) => O._id.localeCompare(f._id)));
239
- const A = await n.readCurrentLocationLastClosing(!0), T = A == null ? void 0 : A._id;
240
- T && (u.value = _t(T)), await l.awaitFeatureLoaded(() => l.mustUsePoTemplate) && await c.fetchTemplates();
241
- const Y = b.value.map((r) => {
242
- var f;
243
- return ((f = r.request) == null ? void 0 : f.id) ?? "";
244
- }).filter((r) => r);
245
- d.value = await v.readRequestByIds(Y);
246
- } catch {
247
- s.open({
248
- title: "Something went wrong",
249
- message: "Error at fetching purchase orders",
250
- type: "error"
251
- });
252
- } finally {
253
- i.value = !1;
254
- }
255
- }
256
- async function q() {
257
- d.value = [], i.value = !0;
258
- try {
259
- d.value = await v.readRequests(
260
- void 0,
261
- p.value.start,
262
- p.value.end
263
- ).then((A) => A.reverse());
264
- } catch {
265
- s.open({
266
- title: "Something went wrong",
267
- message: "Error at fetching purchase requests",
268
- type: "error"
269
- });
270
- } finally {
271
- i.value = !1;
272
- }
273
- }
274
- function P() {
275
- switch (y) {
276
- case "receive/request":
277
- return D();
278
- case "approval":
279
- return q();
280
- }
281
- }
282
- function E(A, T) {
283
- m.value = {
284
- startDate: A,
285
- endDate: T
286
- }, P();
287
- }
288
- _.watchLocation(async (A) => {
289
- if (!A) {
290
- b.value = [];
291
- return;
292
- }
293
- await P();
294
- });
295
- const z = G(), ce = G(Math.random().toString());
296
- async function le(A, T) {
297
- const Y = Math.random().toString();
298
- ce.value = Y, T ?? (T = d.value.computeFirst(
299
- (O) => O.purchaseOrderId === A._id ? O : null
300
- ) ?? void 0);
301
- const r = y === "receive/request" ? _.currentLocation : T == null ? void 0 : T.to, f = {
302
- poRequest: T,
303
- purchaseOrder: A,
304
- transferTo: r == null ? void 0 : r.name,
305
- transferToDbName: r == null ? void 0 : r.dbName,
306
- show: !0,
307
- canResubmit: !1,
308
- canApprove: y === "approval",
309
- "onUpdate:show"(O) {
310
- z.value.show = O;
311
- },
312
- scope: y,
313
- receivedMap: Te(A) ?? {}
314
- };
315
- z.value = f;
316
- }
317
- async function be(A, T, Y, r) {
318
- const f = pt();
319
- i.value = !0;
320
- try {
321
- await f({
322
- operate: {
323
- operation: T,
324
- doc: A,
325
- options: (
326
- // auto receive for supplier to warehouse
327
- (T === x.enum.confirmDraft || // auto receive for warehouse to warehouse
328
- T === x.enum.completeReceive) && l.autoReceiveWarehouse ? {
329
- autoReceive: !0
330
- } : void 0
331
- )
332
- },
333
- operateV2: {
334
- _id: A._id,
335
- _rev: A._rev ?? "",
336
- action: T,
337
- payloads: []
338
- },
339
- transferTo: r
340
- }), await new Promise((B) => setTimeout(B, 1e3));
341
- const $ = me().currentLocationDBName.startsWith("restaurant_");
342
- T === x.enum.confirmDraft && A.effectiveAt && $ ? s.open({
343
- title: "Success",
344
- message: `${Y}. The backdate will be reflected once your POS has received this change.`,
345
- type: "success"
346
- }) : s.open({
347
- title: "Success",
348
- message: Y,
349
- type: "success"
350
- });
351
- } catch (O) {
352
- s.open({
353
- title: "Something went wrong",
354
- message: "Please try again.",
355
- type: "error"
356
- }), console.error("Error when submitting PO operation", T, A, O);
357
- } finally {
358
- i.value = !1, P();
359
- }
360
- }
361
- async function xe(A, T, Y) {
362
- const r = mt[T];
363
- if (!r) {
364
- s.open({
365
- title: "Something went wrong",
366
- message: `Cannot process order: ${We(T)}`,
367
- type: "error"
368
- });
369
- return;
370
- }
371
- const { successMessage: f, ...O } = r;
372
- a.open({
373
- title: O.title,
374
- message: O.message,
375
- primaryActions: O.primaryActions
376
- }).onPrimary(() => {
377
- be(A, T, f, Y);
378
- });
379
- }
380
- async function ue() {
381
- a.open({
382
- title: "Upload Transfer",
383
- primaryActions: {
384
- text: "Xilnex transfer note",
385
- close: !0
386
- },
387
- secondaryActions: {
388
- text: "Cancel",
389
- close: !0
390
- }
391
- }).onPrimary(() => {
392
- const A = {
393
- show: !0,
394
- "onUpdate:show"(T) {
395
- Me.value.show = T;
396
- }
397
- };
398
- Me.value = A;
399
- });
400
- }
401
- return {
402
- purchaseOrders: b,
403
- purchaseRequests: d,
404
- updateDateRange: E,
405
- fetchData: P,
406
- loading: i,
407
- transferDialogProps: Oe,
408
- promptCreateTransferDialog: S,
409
- promptUpdateTransferDialog: R,
410
- transferDetailsProps: z,
411
- promptShowTransferDetails: le,
412
- submitAction: xe,
413
- xilnexImportDialogProps: Me,
414
- promptUploadTransferDialog: ue
415
- };
416
- }
417
- function Vt(y, t) {
418
- return t.reduce(
419
- (_, l) => {
420
- const e = l.received.find((c) => c.sku._id === y._id);
421
- return e && (_ = ot(_, e.amount)), _;
422
- },
423
- At.toPrecision(it(0), y.unit.precision)
424
- );
425
- }
426
- function Ut(y) {
427
- const { po: t, currentLocation: a, business: _, fulfilling: l, por: e } = y, { name: c, address: i, regNo: s } = a.doc.profile, v = {
428
- name: c,
429
- registrationNumber: s,
430
- line1: i == null ? void 0 : i.line1,
431
- line2: i == null ? void 0 : i.line2,
432
- postcode: i == null ? void 0 : i.postcode,
433
- city: i == null ? void 0 : i.city,
434
- state: i == null ? void 0 : i.state,
435
- country: i == null ? void 0 : i.country
436
- }, b = {
437
- name: t.supplier.name,
438
- phoneNumber: t.supplier.phoneNumber,
439
- registrationNumber: t.supplier.registrationNumber,
440
- line1: t.supplier.address.line1,
441
- line2: t.supplier.address.line2,
442
- postcode: t.supplier.address.postcode,
443
- city: t.supplier.address.city,
444
- state: t.supplier.address.state,
445
- country: t.supplier.address.country
446
- }, m = t.items.map((q) => {
447
- const { sku: P, measurement: E } = q, z = fe(
448
- Vt(q.sku, t.deliveryOrder || []),
449
- !1
450
- );
451
- return {
452
- code: P.code,
453
- description: P.name,
454
- quantity: fe(q.quantity, !1),
455
- unit: (E == null ? void 0 : E.abbrev) || P.unit.abbrev,
456
- received: z,
457
- cost: q.totalCost ? `${q.totalCost.currency} ${St.toFormatString({
458
- value: q.totalCost
459
- })}` : void 0
460
- };
461
- }), p = t.deliveryOrder.map((q) => ({
462
- createdAt: lt(new Date(q.createdAt)),
463
- ref: q.deliveryOrderNumber,
464
- remark: q.remark || "",
465
- items: q.received.map((P) => {
466
- var E;
467
- return {
468
- code: P.sku.code,
469
- description: P.sku.name,
470
- quantity: fe(P.amount),
471
- unit: ((E = P.measurement) == null ? void 0 : E.abbrev) || P.sku.unit.abbrev
472
- };
473
- })
474
- })), d = [
475
- // Production
476
- "67ca5d2c80bd0e001c5bf5bc",
477
- // Dev
478
- "6880b36a3054c5001db19218"
479
- ];
480
- let n = "Inventory Receive Note";
481
- if (t.supplier.internal ? (n = "Inventory Transfer Note", d.includes((_ == null ? void 0 : _._id) || "") && (n = "Stock Request")) : n = "Purchase Order", e) {
482
- const q = e.from.dbName;
483
- a.dbName === q || (n = "Inventory Receive Note");
484
- }
485
- const S = {
486
- title: n,
487
- businessName: _ == null ? void 0 : _.name,
488
- logo: _ == null ? void 0 : _.thumbnail,
489
- orderNumber: t.seqNumber.toString(),
490
- createdAt: qe(t._id),
491
- ref: t.ref || "",
492
- remark: t.remark || "",
493
- buyer: v,
494
- supplier: b,
495
- items: m,
496
- status: t.status,
497
- deliveryOrders: p
498
- }, R = new URL(window.location.href), D = l && (t.deliveryFullfillment || []).length > 0 ? "receive-request/delivery-print-preview" : "receive-request/print-preview";
499
- R.pathname = R.hostname.includes("portal.feedme") ? `/inventory/${D}` : `/${D}`, R.searchParams.append("data", JSON.stringify(S)), window.open(R.href, "_blank", "noreferrer");
500
- }
501
- const Se = {
502
- submitRequest: {
503
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
504
- color: "text-fm-color-typo-primary",
505
- value: x.enum.submitRequest
506
- },
507
- confirmDraft: {
508
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
509
- color: "text-fm-color-typo-primary",
510
- value: x.enum.confirmDraft
511
- },
512
- cancelDraft: {
513
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
514
- color: "text-fm-color-typo-error",
515
- value: x.enum.cancelDraft
516
- },
517
- approveRequest: {
518
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
519
- color: "text-fm-color-typo-primary",
520
- value: x.enum.approveRequest
521
- },
522
- rejectRequest: {
523
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
524
- color: "text-fm-color-typo-error",
525
- value: x.enum.rejectRequest
526
- },
527
- processRequest: {
528
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
529
- color: "text-fm-color-typo-primary",
530
- value: x.enum.processRequest
531
- },
532
- receiveStock: {
533
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
534
- color: "text-fm-color-typo-primary",
535
- value: x.enum.receiveStock
536
- },
537
- completeReceive: {
538
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
539
- color: "text-fm-color-typo-primary",
540
- value: x.enum.completeReceive
541
- },
542
- closeRequest: {
543
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
544
- color: "system-error-300",
545
- value: x.enum.closeRequest
546
- },
547
- approveDraft: {
548
- translationKey: "",
549
- color: "",
550
- value: void 0
551
- },
552
- rejectDraft: {
553
- translationKey: "",
554
- color: "",
555
- value: void 0
556
- },
557
- returnStock: {
558
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
559
- color: "text-fm-color-typo-primary",
560
- value: x.enum.returnStock
561
- }
562
- };
563
- function Qs(y, t) {
564
- const a = me(), _ = Fe(), l = Ee(), { t: e } = ft();
565
- function c(p) {
566
- switch (p.status) {
567
- case "DRAFT":
568
- return [
569
- oe[te.Update],
570
- oe[te.Details],
571
- p.supplier.internal === "restaurant" || p.supplier.internal === "warehouse" ? Se[x.enum.submitRequest] : Se[x.enum.confirmDraft],
572
- Se[x.enum.cancelDraft]
573
- ];
574
- case "RECEIVING":
575
- return [
576
- Se[x.enum.completeReceive],
577
- oe[te.Details],
578
- oe[te.Print]
579
- ];
580
- case "REQUESTING":
581
- return y === "receive/request" ? [oe[te.Details], oe[te.Print]] : [
582
- Se[x.enum.approveRequest],
583
- Se[x.enum.rejectRequest],
584
- oe[te.Details]
585
- // DefaultRowActions[RowActionEnum.Print]
586
- ];
587
- case "PROCESSING":
588
- return [oe[te.Details], oe[te.Print]];
589
- case "COMPLETE":
590
- case "CANCEL":
591
- default:
592
- return [oe[te.Details], oe[te.Print]];
593
- }
594
- }
595
- function i(p) {
596
- return Object.values(x.enum).includes(p);
597
- }
598
- async function s(p, d, n) {
599
- var S, R, D, q, P, E;
600
- const u = at(d);
601
- if (p === te.Print) {
602
- const z = (n == null ? void 0 : n.toInventoryLocation) ?? a.currentLocation;
603
- ((S = n == null ? void 0 : n.netSuite) != null && S.refNo || (R = u.netSuite) != null && R.refNo) && (u.ref = [((D = n == null ? void 0 : n.netSuite) == null ? void 0 : D.refNo) || ((q = u.netSuite) == null ? void 0 : q.refNo)].filter((ce) => ce).join(" ")), Ut({
604
- po: u,
605
- currentLocation: z,
606
- business: l.currentBusiness.value,
607
- fulfilling: y === "approval",
608
- por: n
609
- });
610
- return;
611
- }
612
- if (p === te.Details) {
613
- t.promptShowTransferDetails(u, n);
614
- return;
615
- }
616
- if (p === te.Update) {
617
- (P = t.promptUpdateTransferDialog) == null || P.call(t, u);
618
- return;
619
- }
620
- if (i(p)) {
621
- t.submitAction(d, p, (E = n == null ? void 0 : n.to) == null ? void 0 : E.dbName);
622
- return;
623
- }
624
- }
625
- function v() {
626
- var d;
627
- const p = [
628
- {
629
- accessorKey: "seqNumber",
630
- header: () => e("inventory.transfer.table.seqNo"),
631
- enableSorting: !0,
632
- size: 80,
633
- sortUndefined: "last"
634
- },
635
- {
636
- accessorKey: "_id",
637
- header: () => e("inventory.transfer.table.createdAt"),
638
- cell(n) {
639
- return qe(`${n.getValue()}`);
640
- },
641
- enableSorting: !0
642
- },
643
- {
644
- accessorKey: "supplier.name",
645
- header: () => e("inventory.transfer.table.transferFrom"),
646
- enableSorting: !0,
647
- size: 200
648
- },
649
- {
650
- accessorKey: "items.length",
651
- header: () => e("inventory.transfer.table.noOfItems"),
652
- cell: (n) => {
653
- var R;
654
- const u = n.row.original.version || "1", S = n.getValue();
655
- return C("div", { class: "flex items-center gap-2" }, [
656
- S,
657
- u !== "1" && ((R = l.sessionUser.value) != null && R.role.isAdmin) ? C(
658
- "div",
659
- {
660
- class: ["fm-status-badge", "fm-status-badge-draft"].join(" ")
661
- },
662
- `v${u}`
663
- ) : null
664
- ]);
665
- },
666
- enableSorting: !1,
667
- meta: {
668
- width: "10rem"
669
- }
670
- },
671
- {
672
- accessorKey: "ref",
673
- header: () => e("inventory.transfer.table.reference"),
674
- enableSorting: !1,
675
- size: "auto"
676
- },
677
- ...(d = l.sessionUser.value) != null && d.role.isAdmin ? [
678
- {
679
- id: "statusForAdmin",
680
- header: () => C(Ne, {}, () => `${e("inventory.transfer.table.status")}`),
681
- cell(n) {
682
- return n.row.original.status;
683
- },
684
- enableSorting: !0,
685
- size: 200
686
- }
687
- ] : [],
688
- {
689
- accessorKey: "status",
690
- header: () => e("inventory.transfer.table.status"),
691
- cell(n) {
692
- const u = n.getValue(), S = Te(n.row.original), { partial: R, over: D } = ze(S), q = Ge(u ?? "", R, D);
693
- let P = e(`inventory.transfer.status.${q}`), E = `${u ?? ""}`.toLocaleLowerCase("en-us");
694
- return q === M.enum.CLOSE && (P = `${e(`inventory.transfer.status.${M.enum.COMPLETE}`)}`), q === "PARTIAL_RECEIVED" && E === M.enum.PROCESSING.toLocaleLowerCase("en-us") && (E = M.enum.RECEIVING.toLocaleLowerCase("en-us")), C(
695
- "div",
696
- {
697
- class: "flex"
698
- },
699
- C(
700
- "div",
701
- {
702
- class: [
703
- "fm-status-badge",
704
- `fm-status-badge-${E}`,
705
- D && "fm-status-badge-error"
706
- ].filter(Boolean).join(" ")
707
- },
708
- `${P}`
709
- )
710
- );
711
- },
712
- enableSorting: !0,
713
- size: 200
714
- },
715
- {
716
- id: "action",
717
- cell(n) {
718
- const u = n.row.original, S = c(u);
719
- return rt(S, (R) => s(R, u));
720
- },
721
- enableSorting: !1,
722
- size: 40,
723
- meta: {
724
- cellClass: "",
725
- headerClass: ""
726
- }
727
- }
728
- ];
729
- if (_.isEnabled) {
730
- const n = [
731
- {
732
- id: "netsuiteTransferOrder",
733
- accessorFn: (u) => {
734
- var S;
735
- return (S = u.netSuite) != null && S.id ? `${u.netSuite.refNo} (${u.netSuite.id})` : "N/A";
736
- },
737
- header: () => "NetSuite Order (ID)",
738
- cell(u) {
739
- var R;
740
- const S = u.row.original;
741
- return (R = S.netSuite) != null && R.id ? `${S.netSuite.refNo} (${S.netSuite.id})` : "N/A";
742
- },
743
- enableSorting: !1,
744
- size: 200,
745
- meta: {
746
- cellClass: "",
747
- headerClass: ""
748
- }
749
- },
750
- {
751
- id: "netsuiteTransactionNumber",
752
- accessorFn: (u) => {
753
- var S, R;
754
- return ((R = (S = u.netSuite) == null ? void 0 : S.additionalInfo) == null ? void 0 : R.transactionnumber) ?? "N/A";
755
- },
756
- header: () => "NetSuite Transaction No.",
757
- cell(u) {
758
- var R, D;
759
- return ((D = (R = u.row.original.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : D.transactionnumber) ?? "N/A";
760
- },
761
- enableSorting: !1,
762
- size: 200,
763
- meta: {
764
- cellClass: "",
765
- headerClass: ""
766
- }
767
- }
768
- ];
769
- p.splice(p.length - 1, 0, ...n);
770
- }
771
- return p;
772
- }
773
- function b() {
774
- var d;
775
- const p = [
776
- {
777
- accessorKey: "purchaseOrder.seqNumber",
778
- header: () => e("inventory.transfer.table.seqNo"),
779
- enableSorting: !0,
780
- size: 80,
781
- sortUndefined: "last"
782
- },
783
- {
784
- accessorKey: "purchaseOrder._id",
785
- header: () => e("inventory.transfer.table.createdAt"),
786
- cell(n) {
787
- return qe(`${n.getValue()}`);
788
- },
789
- enableSorting: !0
790
- },
791
- {
792
- accessorKey: "to.name",
793
- header: () => e("inventory.transfer.table.transferTo"),
794
- enableSorting: !1,
795
- size: 200
796
- },
797
- {
798
- accessorKey: "purchaseOrder.items.length",
799
- header: () => e("inventory.transfer.table.noOfItems"),
800
- enableSorting: !1
801
- },
802
- {
803
- accessorKey: "purchaseOrder.ref",
804
- header: () => e("inventory.transfer.table.reference"),
805
- enableSorting: !1,
806
- size: "auto"
807
- },
808
- ...(d = l.sessionUser.value) != null && d.role.isAdmin ? [
809
- {
810
- id: "statusForAdmin",
811
- header: () => C(Ne, {}, () => `${e("inventory.transfer.table.status")}`),
812
- cell(n) {
813
- return n.row.original.status;
814
- },
815
- enableSorting: !0,
816
- size: 200
817
- }
818
- ] : [],
819
- {
820
- accessorKey: "purchaseOrder.status",
821
- header: () => e("inventory.transfer.table.status"),
822
- cell(n) {
823
- const u = n.row.original, S = n.getValue();
824
- if (!u.purchaseOrder)
825
- return C(je.FmChip, {
826
- label: "N/A",
827
- compact: !0
828
- });
829
- const R = Te(u.purchaseOrder), { partial: D, over: q } = ze(R), P = Ge(S ?? "", D, q);
830
- let E = e(`inventory.transfer.status.${P}`), z = `${S ?? ""}`.toLocaleLowerCase("en-us");
831
- return P === M.enum.CLOSE && (E = `${e(`inventory.transfer.status.${M.enum.COMPLETE}`)}`), P === "PARTIAL_RECEIVED" && z === M.enum.PROCESSING.toLocaleLowerCase("en-us") && (z = M.enum.RECEIVING.toLocaleLowerCase("en-us")), C(
832
- "div",
833
- {
834
- class: "flex"
835
- },
836
- C(
837
- "div",
838
- {
839
- class: [
840
- "fm-status-badge",
841
- `fm-status-badge-${z}`,
842
- q && "fm-status-badge-error"
843
- ].filter(Boolean).join(" ")
844
- },
845
- `${E}`
846
- )
847
- );
848
- },
849
- enableSorting: !0
850
- },
851
- {
852
- id: "action",
853
- cell(n) {
854
- const u = n.row.original, R = (u.purchaseOrder ? c(u.purchaseOrder) : []).map((D) => D.value === te.Print ? {
855
- ...D,
856
- translationKey: "inventory.transfer.receiveRequest.details.printDeliveryOrder"
857
- } : D);
858
- return rt(
859
- R,
860
- (D) => u.purchaseOrder ? s(D, u.purchaseOrder, u) : void 0
861
- );
862
- },
863
- enableSorting: !1,
864
- size: 40,
865
- meta: {
866
- cellClass: "",
867
- headerClass: ""
868
- }
869
- }
870
- ];
871
- if (_.isEnabled) {
872
- const n = [
873
- {
874
- id: "netsuiteTransferOrder",
875
- accessorFn: (u) => {
876
- var S;
877
- return (S = u.netSuite) != null && S.id ? `${u.netSuite.refNo} (${u.netSuite.id})` : "N/A";
878
- },
879
- header: () => "NetSuite Order (ID)",
880
- cell(u) {
881
- var R;
882
- const S = u.row.original;
883
- return (R = S.netSuite) != null && R.id ? `${S.netSuite.refNo} (${S.netSuite.id})` : "N/A";
884
- },
885
- enableSorting: !1,
886
- size: 200,
887
- meta: {
888
- cellClass: "",
889
- headerClass: ""
890
- }
891
- },
892
- {
893
- id: "netsuiteTransactionNumber",
894
- accessorFn: (u) => {
895
- var S, R;
896
- return ((R = (S = u.netSuite) == null ? void 0 : S.additionalInfo) == null ? void 0 : R.transactionnumber) ?? "N/A";
897
- },
898
- header: () => "NetSuite Transaction No.",
899
- cell(u) {
900
- var R, D;
901
- return ((D = (R = u.row.original.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : D.transactionnumber) ?? "N/A";
902
- },
903
- enableSorting: !1,
904
- size: 200,
905
- meta: {
906
- cellClass: "",
907
- headerClass: ""
908
- }
909
- }
910
- ];
911
- p.splice(p.length - 2, 0, ...n);
912
- }
913
- return p;
914
- }
915
- return {
916
- columnDefs: ee(() => y === "receive/request" ? v() : b())
917
- };
918
- }
919
- const Mt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Kt = { class: "flex flex-col gap-8" }, jt = { class: "flex w-full justify-end gap-16" }, zt = /* @__PURE__ */ he({
920
- __name: "FulfillmentForm",
921
- props: {
922
- purchaseOrder: {},
923
- confirm: { type: Function }
924
- },
925
- emits: ["update:show"],
926
- setup(y, { emit: t }) {
927
- const a = y, _ = Ot({
928
- id: "",
929
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
930
- items: []
931
- }), l = G(), e = t;
932
- dt(() => {
933
- a.purchaseOrder && (_.items = a.purchaseOrder.items.map((i) => ({
934
- id: i.id,
935
- sku: i.sku,
936
- measurement: i.measurement,
937
- amount: i.quantity ?? { amount: 1, precision: 0 }
938
- })));
939
- });
940
- const c = ee(() => _.items.length <= 10);
941
- return (i, s) => {
942
- const v = W("FmTable"), b = W("FmButton"), m = W("FmForm");
943
- return g(), ie(m, {
944
- ref_key: "formRef",
945
- ref: l,
946
- class: "bg-white flex flex-col gap-32 rounded-3xl p-24 w-[800px]",
947
- onValidationFailed: console.log,
948
- onValidationSuccess: s[1] || (s[1] = () => a.confirm(_))
949
- }, {
950
- default: re(() => [
951
- s[2] || (s[2] = o("div", { class: "fm-typo-en-title-sm-600" }, "Confirm the transfer amount", -1)),
952
- o("div", Mt, [
953
- o("div", Kt, [
954
- I(v, {
955
- "column-defs": [
956
- {
957
- header: "Code",
958
- cell: (p) => {
959
- const d = a.purchaseOrder.items.find((n) => n.id === p.row.original.id || n.sku._id === p.row.original.sku._id);
960
- return C(
961
- w(je).FmTooltip,
962
- {
963
- content: d.code,
964
- placement: "top",
965
- variant: "plain",
966
- zIndex: 50
967
- },
968
- C(
969
- "span",
970
- {
971
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
972
- },
973
- d.code
974
- )
975
- );
976
- }
977
- },
978
- {
979
- header: "Name",
980
- cell: (p) => {
981
- const d = a.purchaseOrder.items.find((n) => n.id === p.row.original.id || n.sku._id === p.row.original.sku._id);
982
- return C(
983
- w(je).FmTooltip,
984
- {
985
- content: d.name,
986
- placement: "top",
987
- variant: "plain",
988
- zIndex: 50
989
- },
990
- C(
991
- "span",
992
- {
993
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
994
- },
995
- d.name
996
- )
997
- );
998
- }
999
- },
1000
- {
1001
- header: "Amount",
1002
- cell: (p) => {
1003
- const d = p.row.original, n = a.purchaseOrder.items.find((S) => S.id === d.id || S.sku._id === d.sku._id), u = d.amount ?? {
1004
- amount: 1,
1005
- precision: 0
1006
- };
1007
- return C(Pt, {
1008
- style: {
1009
- flex: "1 1 0%"
1010
- },
1011
- modelValue: {
1012
- amount: u,
1013
- measurement: d.measurement ?? null
1014
- },
1015
- key: d.id ?? d.sku._id,
1016
- unit: d.sku.unit,
1017
- "onUpdate:modelValue": (S) => {
1018
- if (!S) return;
1019
- const R = _.items.find((D) => D.id === d.id || D.sku._id === d.sku._id);
1020
- R && (R.amount = S.amount);
1021
- },
1022
- disableUnit: !0,
1023
- rules: [
1024
- w(It)(
1025
- +w(fe)({ amount: 0, precision: 0 })
1026
- ),
1027
- w(Ft)(+w(fe)(n.quantity))
1028
- ],
1029
- applyDefaultRules: !0
1030
- });
1031
- }
1032
- }
1033
- ],
1034
- "row-data": _.items,
1035
- "hide-footer": c.value
1036
- }, null, 8, ["column-defs", "row-data", "hide-footer"])
1037
- ])
1038
- ]),
1039
- o("div", jt, [
1040
- I(b, {
1041
- class: "px-16",
1042
- label: "Confirm",
1043
- size: "md",
1044
- variant: "primary",
1045
- type: "submit"
1046
- }),
1047
- I(b, {
1048
- class: "px-16",
1049
- label: "Cancel",
1050
- size: "md",
1051
- variant: "secondary",
1052
- onClick: s[0] || (s[0] = () => e("update:show", !1))
1053
- })
1054
- ])
1055
- ]),
1056
- _: 1
1057
- }, 8, ["onValidationFailed"]);
1058
- };
1059
- }
1060
- }), Ke = {
1061
- submitRequest: {
1062
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
1063
- color: "primary",
1064
- buttonVariant: ne.Primary
1065
- },
1066
- confirmDraft: {
1067
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
1068
- color: "primary",
1069
- buttonVariant: ne.Primary
1070
- },
1071
- cancelDraft: {
1072
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
1073
- color: "system-error-300",
1074
- buttonVariant: ne.Destructive
1075
- },
1076
- approveDraft: {
1077
- translationKey: "inventory.transfer.receiveRequest.actions.approveDraft",
1078
- color: "primary",
1079
- buttonVariant: ne.Primary
1080
- },
1081
- rejectDraft: {
1082
- translationKey: "inventory.transfer.receiveRequest.actions.rejectDraft",
1083
- color: "system-error-300",
1084
- buttonVariant: ne.Destructive
1085
- },
1086
- approveRequest: {
1087
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
1088
- color: "primary",
1089
- buttonVariant: ne.Primary
1090
- },
1091
- processRequest: {
1092
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
1093
- color: "primary",
1094
- buttonVariant: ne.Primary
1095
- },
1096
- receiveStock: {
1097
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
1098
- color: "primary",
1099
- buttonVariant: ne.Primary,
1100
- available: !1
1101
- },
1102
- completeReceive: {
1103
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
1104
- color: "primary",
1105
- buttonVariant: ne.Plain
1106
- },
1107
- rejectRequest: {
1108
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
1109
- color: "system-error-300",
1110
- buttonVariant: ne.Destructive
1111
- },
1112
- closeRequest: {
1113
- translationKey: "inventory.transfer.receiveRequest.actions.closeRequest",
1114
- color: "system-error-300",
1115
- buttonVariant: ne.Destructive,
1116
- available: !1
1117
- },
1118
- returnStock: {
1119
- translationKey: "inventory.transfer.receiveRequest.actions.returnStock",
1120
- color: "primary",
1121
- buttonVariant: ne.Primary,
1122
- available: !1
1123
- }
1124
- };
1125
- function Gt() {
1126
- const y = Ie();
1127
- return {
1128
- ableToMarkReceived(t) {
1129
- if (!t || t.status !== M.enum.RECEIVING)
1130
- return !1;
1131
- const _ = me().currentLocationDBName;
1132
- return `${t.supplier.internal}_${t.supplier._id}` !== _;
1133
- },
1134
- ableToMarkApproved(t) {
1135
- return !(!t || (t == null ? void 0 : t.status) !== M.enum.REQUESTING);
1136
- },
1137
- ableToCreateFulfillment(t, a) {
1138
- var e, c;
1139
- if (!y.acceptRequireFulfillment || !t || !a || t.status !== M.enum.PROCESSING || !a.processedAt)
1140
- return !1;
1141
- const _ = (e = a == null ? void 0 : a.from) == null ? void 0 : e.dbName, l = (c = a == null ? void 0 : a.to) == null ? void 0 : c.dbName;
1142
- return !(_.startsWith("restaurant_") && l.startsWith("restaurant_"));
1143
- }
1144
- };
1145
- }
1146
- const Ht = { class: "flex flex-row-reverse" }, Wt = /* @__PURE__ */ he({
1147
- __name: "NetSuiteSync",
1148
- props: {
1149
- poRequest: {},
1150
- purchaseOrder: {},
1151
- isTransferBetweenOutlets: { type: Boolean },
1152
- scope: {}
1153
- },
1154
- setup(y) {
1155
- const t = y, a = Fe(), _ = Le(), l = Ye(), e = G(!1);
1156
- ee(() => {
1157
- var b, m, p, d;
1158
- let i = !0;
1159
- a.isEnabled || (i = !1);
1160
- const s = t.purchaseOrder, v = t.poRequest;
1161
- return s && ((b = s == null ? void 0 : s.supplier) != null && b.internal ? (!v && s.status == M.enum.DRAFT && (i = !1), v && !((m = v == null ? void 0 : v.netSuite) != null && m.id) && (i = !1), t.isTransferBetweenOutlets && (i = !1)) : ((s == null ? void 0 : s.status) !== M.enum.REQUESTING && s.supplier.internal && (i = !1), !v && !((p = s == null ? void 0 : s.netSuite) != null && p.id) && (i = !1), !v && ((d = s == null ? void 0 : s.netSuite) != null && d.id) && (s == null ? void 0 : s.status) == M.enum.REQUESTING && (i = !1))), i;
1162
- });
1163
- async function c() {
1164
- e.value || l.open({
1165
- title: "Sync with NetSuite",
1166
- contentComponent: C("div", [
1167
- C("p", "Are you sure you want to sync now?"),
1168
- C("br"),
1169
- C(
1170
- "p",
1171
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
1172
- "Please wait a moment before syncing manually to avoid unnecessary actions."
1173
- )
1174
- ]),
1175
- primaryActions: {
1176
- text: "Sync",
1177
- close: !0,
1178
- variant: "destructive"
1179
- },
1180
- secondaryActions: { text: "Not now", close: !0 }
1181
- }).onPrimary(async () => {
1182
- var i, s, v;
1183
- try {
1184
- e.value = !0;
1185
- const b = ((i = t.purchaseOrder) == null ? void 0 : i._id) || ((s = t.poRequest) == null ? void 0 : s.purchaseOrderId) || "", m = (v = t.poRequest) == null ? void 0 : v.to.dbName;
1186
- await a.syncPurchaseOrder(
1187
- b,
1188
- t.scope === "approval" ? m : void 0
1189
- ), _.open({
1190
- title: "Sync with NetSuite",
1191
- message: "Requested to sync with NetSuite. Please wait a moment.",
1192
- type: "success"
1193
- }), await new Promise((p) => setTimeout(p, 5e3)), e.value = !1;
1194
- } catch {
1195
- _.open({
1196
- title: "Error",
1197
- message: "Failed to sync with NetSuite",
1198
- type: "error"
1199
- }), e.value = !1;
1200
- }
1201
- });
1202
- }
1203
- return (i, s) => {
1204
- const v = W("FmButton");
1205
- return g(), N("div", Ht, [
1206
- I(v, {
1207
- "prepend-icon": "sync",
1208
- variant: "secondary",
1209
- label: "Sync",
1210
- loading: e.value,
1211
- onClick: c,
1212
- "text-color": "primary",
1213
- "bg-color": "transparent",
1214
- "border-color": "primary"
1215
- }, null, 8, ["loading"])
1216
- ]);
1217
- };
1218
- }
1219
- }), Yt = {
1220
- key: 0,
1221
- class: "flex flex-col gap-8"
1222
- }, Qt = { class: "flex flex-col gap-4" }, Xt = { class: "fm-typo-en-body-lg-600" }, Zt = {
1223
- key: 0,
1224
- class: "flex flex-col gap-4"
1225
- }, Jt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, er = { class: "fm-typo-en-body-lg-600" }, tr = { key: 0 }, rr = { key: 1 }, sr = {
1226
- key: 1,
1227
- class: "flex flex-col gap-4"
1228
- }, nr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ar = { class: "fm-typo-en-body-lg-600" }, or = { key: 0 }, ir = { key: 1 }, lr = {
1229
- key: 2,
1230
- class: "flex flex-col gap-4"
1231
- }, cr = { class: "fm-typo-en-body-lg-600" }, ur = {
1232
- key: 3,
1233
- class: "flex flex-col gap-4"
1234
- }, dr = { class: "fm-typo-en-body-lg-600" }, fr = /* @__PURE__ */ he({
1235
- __name: "NetSuiteInfo",
1236
- props: {
1237
- transferType: {},
1238
- transferToDbName: {},
1239
- poRequest: {},
1240
- purchaseOrder: {},
1241
- isTransferBetweenOutlets: { type: Boolean },
1242
- scope: {}
1243
- },
1244
- setup(y) {
1245
- const t = y, a = Fe(), _ = Be(), l = G(t.poRequest);
1246
- dt(async () => {
1247
- var s;
1248
- if (!t.poRequest && ((s = t.purchaseOrder) != null && s._id)) {
1249
- const v = await _.getLatestPurchaseOrderRequest(t.purchaseOrder._id);
1250
- l.value = v;
1251
- }
1252
- });
1253
- const e = ee(
1254
- () => {
1255
- var s, v, b, m, p, d;
1256
- return a.getSubsidiaryFullName(
1257
- ((b = (v = (s = t.purchaseOrder) == null ? void 0 : s.netSuite) == null ? void 0 : v.subsidiary) == null ? void 0 : b.id) || ((d = (p = (m = t.poRequest) == null ? void 0 : m.netSuite) == null ? void 0 : p.subsidiary) == null ? void 0 : d.id)
1258
- ).fullName;
1259
- }
1260
- ), c = ee(() => {
1261
- var s, v, b, m, p, d, n, u, S, R, D, q;
1262
- return (b = (v = (s = t.purchaseOrder) == null ? void 0 : s.netSuite) == null ? void 0 : v.additionalInfo) != null && b.transactionnumber ? (d = (p = (m = t.purchaseOrder) == null ? void 0 : m.netSuite) == null ? void 0 : p.additionalInfo) == null ? void 0 : d.transactionnumber : (S = (u = (n = l.value) == null ? void 0 : n.netSuite) == null ? void 0 : u.additionalInfo) != null && S.transactionnumber ? (q = (D = (R = l.value) == null ? void 0 : R.netSuite) == null ? void 0 : D.additionalInfo) == null ? void 0 : q.transactionnumber : null;
1263
- }), i = ee(() => {
1264
- var s, v, b, m, p, d;
1265
- return (v = (s = t.purchaseOrder) == null ? void 0 : s.deliveryFullfillment) != null && v.length && ((m = (b = t.purchaseOrder) == null ? void 0 : b.deliveryFullfillment) == null ? void 0 : m.length) > 0 ? (d = (p = t.purchaseOrder) == null ? void 0 : p.deliveryFullfillment) == null ? void 0 : d.map((n) => {
1266
- var u;
1267
- return (u = n.netSuite) == null ? void 0 : u.refNo;
1268
- }).join(", ") : "N/A";
1269
- });
1270
- return (s, v) => {
1271
- var b, m, p, d, n, u, S, R, D, q, P, E, z, ce, le, be;
1272
- return w(a).isEnabled ? (g(), N("div", Yt, [
1273
- o("div", Qt, [
1274
- v[0] || (v[0] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
1275
- o("div", Xt, k(e.value || "N/A"), 1)
1276
- ]),
1277
- !s.isTransferBetweenOutlets && s.scope === w(He).RECEIVE_REQUEST ? (g(), N("div", Zt, [
1278
- o("div", Jt, " NetSuite " + k((m = (b = s.purchaseOrder) == null ? void 0 : b.netSuite) != null && m.recordType ? w(ct)((d = (p = s.purchaseOrder) == null ? void 0 : p.netSuite) == null ? void 0 : d.recordType) : s.transferType === w(ye).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1279
- o("div", er, [
1280
- (u = (n = s.purchaseOrder) == null ? void 0 : n.netSuite) != null && u.id ? (g(), N("span", tr, k((R = (S = s.purchaseOrder) == null ? void 0 : S.netSuite) == null ? void 0 : R.refNo) + " (" + k((q = (D = s.purchaseOrder) == null ? void 0 : D.netSuite) == null ? void 0 : q.id) + ") ", 1)) : (g(), N("span", rr, "N/A"))
1281
- ])
1282
- ])) : U("", !0),
1283
- !s.isTransferBetweenOutlets && l.value || s.scope === w(He).APPROVAL ? (g(), N("div", sr, [
1284
- o("div", nr, " (Request) NetSuite " + k(s.transferType === w(ye).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
1285
- o("div", ar, [
1286
- (E = (P = l.value) == null ? void 0 : P.netSuite) != null && E.id ? (g(), N("span", or, k((ce = (z = l.value) == null ? void 0 : z.netSuite) == null ? void 0 : ce.refNo) + " (" + k((be = (le = l.value) == null ? void 0 : le.netSuite) == null ? void 0 : be.id) + ") ", 1)) : (g(), N("span", ir, "N/A"))
1287
- ])
1288
- ])) : U("", !0),
1289
- c.value ? (g(), N("div", lr, [
1290
- v[1] || (v[1] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
1291
- o("div", cr, k(c.value), 1)
1292
- ])) : U("", !0),
1293
- w(a).isEnabled && s.transferType === w(ye).TRANSFER && !s.isTransferBetweenOutlets ? (g(), N("div", ur, [
1294
- v[2] || (v[2] = o("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
1295
- o("div", dr, k(i.value), 1)
1296
- ])) : U("", !0)
1297
- ])) : U("", !0);
1298
- };
1299
- }
1300
- }), mr = { class: "flex flex-row-reverse" }, pr = /* @__PURE__ */ he({
1301
- __name: "NetSuiteLog",
1302
- props: {
1303
- netsuiteId: {},
1304
- purchaseOrderId: {}
1305
- },
1306
- setup(y) {
1307
- const t = Le(), a = ut();
1308
- async function _(l, e) {
1309
- const c = [];
1310
- if (l && c.push(`body.message:*${l}*`), e) {
1311
- const b = e.replace(/:/g, "\\:");
1312
- c.push(`${b}`);
1313
- }
1314
- if (c.length === 0) {
1315
- t.open({
1316
- message: "Cannot open logs without valid filters.",
1317
- type: "error"
1318
- });
1319
- return;
1320
- }
1321
- const s = `attributes.pod:netsuite* AND (${c.join(" OR ")})`, { url: v } = await a.getLogs(s);
1322
- t.open(
1323
- {
1324
- message: "Opening NetSuite logs...",
1325
- type: "info"
1326
- },
1327
- 800
1328
- ), await new Promise((b) => setTimeout(b, 800)), window.open(v, "_blank");
1329
- }
1330
- return (l, e) => {
1331
- const c = W("FmButton");
1332
- return g(), N("div", mr, [
1333
- I(c, {
1334
- "prepend-icon": "history",
1335
- variant: "secondary",
1336
- label: "Logs",
1337
- onClick: e[0] || (e[0] = (i) => _(l.netsuiteId, l.purchaseOrderId)),
1338
- "text-color": "primary",
1339
- "bg-color": "transparent",
1340
- "border-color": "primary"
1341
- })
1342
- ]);
1343
- };
1344
- }
1345
- }), vr = { class: "flex flex-row-reverse" }, yr = { key: 0 }, hr = {
1346
- key: 1,
1347
- class: "w-[480px]"
1348
- }, br = { class: "fm-typo-en-body-md-400" }, gr = { key: 0 }, _r = { key: 1 }, Sr = { key: 1 }, wr = /* @__PURE__ */ he({
1349
- __name: "NetSuiteLatestInfo",
1350
- props: {
1351
- netsuiteId: {},
1352
- purchaseOrderId: {}
1353
- },
1354
- setup(y) {
1355
- const t = y, a = ut(), _ = G(!1), l = me(), e = G(!0), c = G(!1), i = G(null);
1356
- async function s() {
1357
- if (!i.value) {
1358
- _.value = !0;
1359
- try {
1360
- e.value = !0;
1361
- const v = await a.getMoreInfo(
1362
- l.currentLocation.dbName,
1363
- t.purchaseOrderId
1364
- );
1365
- i.value = v, c.value = !1;
1366
- } catch {
1367
- c.value = !0;
1368
- } finally {
1369
- e.value = !1;
1370
- }
1371
- }
1372
- }
1373
- return (v, b) => {
1374
- const m = W("FmButton"), p = W("FmLabel"), d = W("FmDialog");
1375
- return g(), N("div", vr, [
1376
- I(d, {
1377
- modelValue: _.value,
1378
- "onUpdate:modelValue": b[2] || (b[2] = (n) => _.value = n),
1379
- overlay: !0
1380
- }, {
1381
- "dialog-button": re(() => [
1382
- I(m, {
1383
- "prepend-icon": "info",
1384
- variant: "secondary",
1385
- label: "Latest Info",
1386
- onClick: b[0] || (b[0] = (n) => s()),
1387
- "text-color": "primary",
1388
- "bg-color": "transparent",
1389
- "border-color": "primary"
1390
- })
1391
- ]),
1392
- "dialog-header": re(() => b[3] || (b[3] = [
1393
- o("div", null, "NetSuite latest info", -1)
1394
- ])),
1395
- "dialog-footer": re(() => [
1396
- I(m, {
1397
- class: "ml-auto sm:w-full xs:w-full",
1398
- label: "Close",
1399
- size: "md",
1400
- variant: "primary",
1401
- onClick: b[1] || (b[1] = (n) => _.value = !1)
1402
- })
1403
- ]),
1404
- default: re(() => [
1405
- e.value ? (g(), N("div", yr, "Loading...")) : (g(), N("div", hr, [
1406
- c.value ? (g(), N("p", Sr, "Something went wrong.")) : (g(!0), N(ae, { key: 0 }, ve(i.value, (n, u) => (g(), N("div", {
1407
- key: u,
1408
- class: "mb-2"
1409
- }, [
1410
- o("div", null, [
1411
- I(p, {
1412
- label: w(We)(u)
1413
- }, null, 8, ["label"]),
1414
- o("div", br, [
1415
- Array.isArray(n) ? (g(), N("span", gr, k(n.length > 0 ? n.join(", ") : "N/A"), 1)) : (g(), N("span", _r, k(n), 1))
1416
- ])
1417
- ])
1418
- ]))), 128))
1419
- ]))
1420
- ]),
1421
- _: 1
1422
- }, 8, ["modelValue"])
1423
- ]);
1424
- };
1425
- }
1426
- }), Rr = {
1427
- key: 0,
1428
- class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16 flex flex-col gap-8"
1429
- }, Or = { class: "flex gap-8 items-center" }, Nr = { class: "ml-auto" }, xr = { class: "flex gap-4" }, kr = /* @__PURE__ */ he({
1430
- __name: "NetSuitePanel",
1431
- props: {
1432
- poRequest: {},
1433
- purchaseOrder: {},
1434
- transferType: {},
1435
- transferToDbName: {},
1436
- scope: {}
1437
- },
1438
- setup(y) {
1439
- const t = y, a = Lt(), _ = Ee(), l = ee(() => {
1440
- var s, v, b, m, p, d, n;
1441
- const e = ((s = t.transferToDbName) == null ? void 0 : s.startsWith("restaurant")) && ((b = (v = t.purchaseOrder) == null ? void 0 : v.supplier) == null ? void 0 : b.internal) === "restaurant", c = t.transferType === ye.PURCHASE, i = t.transferType === ye.TRANSFER;
1442
- return c || i && !e || ((p = (m = t.purchaseOrder) == null ? void 0 : m.netSuite) == null ? void 0 : p.id) || ((n = (d = t.poRequest) == null ? void 0 : d.netSuite) == null ? void 0 : n.id);
1443
- });
1444
- return (e, c) => {
1445
- const i = W("FmMenuDivider");
1446
- return w(a).isNetSuiteEnabled && l.value ? (g(), N("div", Rr, [
1447
- o("div", Or, [
1448
- c[0] || (c[0] = o("span", { class: "flex-1 fm-typo-en-body-lg-600" }, "NetSuite Info", -1)),
1449
- o("div", Nr, [
1450
- o("div", xr, [
1451
- I(Ne, null, {
1452
- default: re(() => {
1453
- var s, v, b, m, p, d;
1454
- return [
1455
- (s = w(_).sessionUser.value) != null && s.role.isAdmin && ((b = (v = t.purchaseOrder) == null ? void 0 : v.netSuite) != null && b.id) ? (g(), ie(wr, {
1456
- key: 0,
1457
- "netsuite-id": (p = (m = e.purchaseOrder) == null ? void 0 : m.netSuite) == null ? void 0 : p.id,
1458
- "purchase-order-id": (d = e.purchaseOrder) == null ? void 0 : d._id
1459
- }, null, 8, ["netsuite-id", "purchase-order-id"])) : U("", !0)
1460
- ];
1461
- }),
1462
- _: 1
1463
- }),
1464
- I(Ne, null, {
1465
- default: re(() => {
1466
- var s, v, b, m;
1467
- return [
1468
- (s = w(_).sessionUser.value) != null && s.role.isAdmin ? (g(), ie(pr, {
1469
- key: 0,
1470
- "netsuite-id": (b = (v = e.purchaseOrder) == null ? void 0 : v.netSuite) == null ? void 0 : b.id,
1471
- "purchase-order-id": (m = e.purchaseOrder) == null ? void 0 : m._id
1472
- }, null, 8, ["netsuite-id", "purchase-order-id"])) : U("", !0)
1473
- ];
1474
- }),
1475
- _: 1
1476
- }),
1477
- I(Wt, {
1478
- "po-request": e.poRequest,
1479
- "purchase-order": e.purchaseOrder,
1480
- "is-transfer-between-outlets": !l.value,
1481
- scope: e.scope
1482
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets", "scope"])
1483
- ])
1484
- ])
1485
- ]),
1486
- I(i),
1487
- I(fr, {
1488
- "po-request": e.poRequest,
1489
- "purchase-order": e.purchaseOrder,
1490
- "transfer-type": e.transferType,
1491
- "transfer-to-db-name": e.transferToDbName,
1492
- "is-transfer-between-outlets": !l.value,
1493
- scope: e.scope
1494
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets", "scope"])
1495
- ])) : U("", !0);
1496
- };
1497
- }
1498
- }), Ar = { class: "flex flex-col gap-16 w-full h-full" }, Cr = { class: "flex justify-between" }, $r = { class: "fm-typo-en-body-lg-600" }, Dr = { class: "flex gap-2" }, qr = { key: 0 }, Tr = { class: "flex flex-col gap-8" }, Pr = { class: "flex flex-col gap-4" }, Ir = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fr = { class: "flex gap-1" }, Er = { class: "fm-typo-en-body-lg-600" }, Lr = {
1499
- key: 0,
1500
- class: "flex flex-col gap-4"
1501
- }, Br = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vr = { class: "fm-typo-en-body-lg-600" }, Ur = { class: "flex flex-col gap-4" }, Mr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Kr = { class: "fm-typo-en-body-lg-600" }, jr = {
1502
- key: 1,
1503
- class: "flex flex-col gap-4"
1504
- }, zr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gr = { class: "fm-typo-en-body-lg-600" }, Hr = {
1505
- key: 2,
1506
- class: "flex flex-col gap-4"
1507
- }, Wr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yr = { class: "fm-typo-en-body-lg-600" }, Qr = {
1508
- key: 3,
1509
- class: "flex flex-col gap-4"
1510
- }, Xr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zr = { class: "fm-typo-en-body-lg-600" }, Jr = {
1511
- key: 4,
1512
- class: "flex flex-col gap-4"
1513
- }, es = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ts = { class: "fm-typo-en-body-lg-600" }, rs = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, ss = { class: "flex flex-col gap-8" }, ns = { class: "flex gap-8 items-center" }, as = { class: "flex-1 fm-typo-en-body-lg-600" }, os = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, is = { class: "flex w-full gap-4" }, ls = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2 flex items-center gap-2" }, cs = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, us = ["innerHTML"], ds = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, fs = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, ms = {
1514
- key: 0,
1515
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1516
- }, ps = { class: "py-8" }, vs = { class: "flex justify-end gap-4 items-center" }, ys = { class: "fm-typo-en-body-lg-600" }, hs = {
1517
- key: 1,
1518
- class: "flex-1 xs:w-screen xs:max-w-full"
1519
- }, bs = {
1520
- key: 0,
1521
- class: "flex flex-col items-center gap-8 h-full"
1522
- }, gs = ["src"], _s = { class: "fm-typo-en-body-lg-600" }, Ss = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ws = {
1523
- key: 1,
1524
- class: "px-4 flex flex-col"
1525
- }, Rs = { class: "flex gap-12 content-stretch" }, Os = {
1526
- class: "flex flex-col w-24",
1527
- name: "circles"
1528
- }, Ns = { class: "flex-1 flex flex-col items-center" }, xs = { class: "flex-1 flex flex-col items-center" }, ks = {
1529
- class: "py-12 flex flex-col gap-4",
1530
- name: "received-at header"
1531
- }, As = { class: "fm-typo-en-body-lg-400" }, Cs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, $s = { class: "flex gap-12 content-stretch" }, Ds = {
1532
- class: "flex flex-col w-24",
1533
- name: "circles"
1534
- }, qs = { class: "flex-1 flex flex-col items-center" }, Ts = {
1535
- class: "py-12 flex flex-col gap-4 flex-1",
1536
- name: "delivery details"
1537
- }, Ps = { class: "flex flex-col gap-8" }, Is = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Fs = { class: "flex flex-col gap-4" }, Es = { class: "flex gap-8 xs:flex-col" }, Xs = /* @__PURE__ */ he({
1538
- __name: "TransferDetails",
1539
- props: {
1540
- poRequest: {},
1541
- purchaseOrder: {},
1542
- transferTo: {},
1543
- transferToDbName: {},
1544
- show: { type: Boolean },
1545
- canResubmit: { type: Boolean },
1546
- canApprove: { type: Boolean },
1547
- scope: {},
1548
- receivedMap: {}
1549
- },
1550
- emits: ["update:show", "submitted"],
1551
- setup(y, { emit: t }) {
1552
- const a = y, _ = t, l = Ye(), e = Le(), c = Ie(), i = me(), s = Ee(), v = ee(
1553
- () => {
1554
- var r, f;
1555
- return {
1556
- id: ((r = s.sessionUser.value) == null ? void 0 : r.id) ?? "",
1557
- name: ((f = s.sessionUser.value) == null ? void 0 : f.displayName) ?? ""
1558
- };
1559
- }
1560
- ), b = Gt(), { t: m } = ft(), p = ee(
1561
- () => {
1562
- var r, f, O, $;
1563
- return ((f = (r = a.purchaseOrder) == null ? void 0 : r.supplier) == null ? void 0 : f.internal) === "restaurant" || (($ = (O = a.purchaseOrder) == null ? void 0 : O.supplier) == null ? void 0 : $.internal) === "warehouse" ? ye.TRANSFER : ye.PURCHASE;
1564
- }
1565
- ), d = G(!1), n = G(""), u = G(!0), S = Be(), R = Et(S.getWorkflowConfig), D = pt(), q = ee(() => {
1566
- if (!a.purchaseOrder)
1567
- return [];
1568
- const r = R.result.value;
1569
- if (r.state === nt.loading)
1570
- return [];
1571
- const f = {
1572
- user: v.value,
1573
- executedAt: i.locations.computeFirst(
1574
- ($) => {
1575
- var B;
1576
- return $.dbName === ((B = i._currentLocation) == null ? void 0 : B.dbName) ? $ : null;
1577
- }
1578
- ),
1579
- purchaseOrderRequest: a.poRequest,
1580
- purchaseOrder: a.purchaseOrder
1581
- };
1582
- let O = [];
1583
- try {
1584
- r.state === nt.error ? (console.error("Error fetching workflow config:", r.error), O = Ve.getAvailableActions({
1585
- ...f,
1586
- orderConfig: Ve.getDefaultConfig()
1587
- }).actions.filter(
1588
- ($) => (
1589
- // TODO: create receiveStock & processRequest dialog
1590
- // to create their payload
1591
- $ !== x.enum.receiveStock && $ !== x.enum.processRequest && $ !== x.enum.closeRequest
1592
- )
1593
- )) : O = Ve.getAvailableActions({
1594
- ...f,
1595
- orderConfig: r.data
1596
- }).actions.filter(
1597
- ($) => $ !== x.enum.receiveStock && $ !== x.enum.processRequest && $ !== x.enum.closeRequest
1598
- );
1599
- } catch ($) {
1600
- console.error("Error getting available actions:", $);
1601
- }
1602
- return a.scope === "approval" && (O = O.filter(($) => $ !== x.enum.completeReceive)), O;
1603
- }), P = Ct(a, "show"), E = ee(() => [
1604
- {
1605
- label: m("inventory.transfer.receiveRequest.details.overview"),
1606
- value: "overview"
1607
- },
1608
- {
1609
- label: m("inventory.transfer.receiveRequest.details.deliveryHistory"),
1610
- value: "deliveryHistory"
1611
- }
1612
- ]), z = G(E.value[0]);
1613
- Nt(
1614
- () => a.show,
1615
- (r) => {
1616
- r && (z.value = E.value[0]);
1617
- }
1618
- );
1619
- async function ce(r, f, O, $, B) {
1620
- return new Promise((H, Q) => {
1621
- l.open({
1622
- closeButton: !1,
1623
- title: $.title,
1624
- message: $.message,
1625
- primaryActions: $.primaryActions,
1626
- secondaryActions: { text: "No", close: !1 }
1627
- }).onPrimary(async () => {
1628
- var V, X, Z, L;
1629
- const h = [];
1630
- O === x.enum.approveRequest ? (h.push({
1631
- action: "approveRequest",
1632
- payload: null
1633
- }), f.fulfillment && h.push({
1634
- action: "processRequest",
1635
- payload: {
1636
- fulfillmentId: "",
1637
- deliveryOrderNumber: "",
1638
- deliveryRemark: null,
1639
- items: f.fulfillment.items,
1640
- createdBy: v.value
1641
- }
1642
- })) : O === x.enum.processRequest ? f.fulfillment && h.push({
1643
- action: "processRequest",
1644
- payload: {
1645
- fulfillmentId: "",
1646
- deliveryOrderNumber: "",
1647
- deliveryRemark: null,
1648
- items: f.fulfillment.items,
1649
- createdBy: v.value
1650
- }
1651
- }) : O === x.enum.rejectRequest ? h.push({
1652
- action: "rejectRequest",
1653
- payload: null
1654
- }) : O === x.enum.closeRequest && h.push({
1655
- action: "closeRequest",
1656
- payload: null
1657
- });
1658
- try {
1659
- await D({
1660
- operate: {
1661
- operation: O,
1662
- doc: r,
1663
- options: f
1664
- },
1665
- operateV2: {
1666
- _id: ((V = a.purchaseOrder) == null ? void 0 : V._id) ?? "",
1667
- _rev: ((X = a.purchaseOrder) == null ? void 0 : X._rev) ?? "",
1668
- action: O,
1669
- payloads: h
1670
- // add payload if action is receiveStock or processRequest
1671
- },
1672
- transferTo: (L = (Z = a.poRequest) == null ? void 0 : Z.to) == null ? void 0 : L.dbName
1673
- }).delayed(1e3), H("submitted");
1674
- } catch (se) {
1675
- Q(se);
1676
- }
1677
- }).onSecondary(() => {
1678
- H("cancelled");
1679
- for (let h = 0; h < B + 2; h++)
1680
- l.close();
1681
- }).onClose(() => {
1682
- });
1683
- });
1684
- }
1685
- async function le(r) {
1686
- var B, H, Q, h;
1687
- if (r === x.enum.receiveStock)
1688
- return;
1689
- const f = mt[r];
1690
- if (!f) {
1691
- e.open({
1692
- title: "Something went wrong",
1693
- message: `Cannot process order: ${We(r)}`,
1694
- type: "error"
1695
- });
1696
- return;
1697
- }
1698
- const { successMessage: O, ...$ } = f;
1699
- if (a.purchaseOrder) {
1700
- n.value = `${r}`, d.value = !0, u.value = !1;
1701
- const V = {};
1702
- let X = 0;
1703
- if ((r === x.enum.confirmDraft || // auto receive for warehouse to warehouse
1704
- r === x.enum.completeReceive) && c.autoReceiveWarehouse)
1705
- V.autoReceive = !0;
1706
- else if ((r === x.enum.approveRequest || r === x.enum.processRequest) && c.acceptRequireFulfillment) {
1707
- const Z = (H = (B = a.poRequest) == null ? void 0 : B.from) == null ? void 0 : H.dbName, L = (h = (Q = a.poRequest) == null ? void 0 : Q.to) == null ? void 0 : h.dbName;
1708
- if (Z && L && (Z.startsWith("warehouse_") || L.startsWith("warehouse_"))) {
1709
- const se = await new Promise((K, de) => {
1710
- l.open({
1711
- closeButton: !1,
1712
- title: "Confirm transfer amount",
1713
- dialogComponent: zt,
1714
- dialogComponentProps: {
1715
- purchaseOrder: a.purchaseOrder,
1716
- confirm: K,
1717
- "onUpdate:show": (pe) => {
1718
- pe || (n.value = "", d.value = !1, u.value = !0, X++, l.close()), de("cancelled");
1719
- }
1720
- }
1721
- });
1722
- });
1723
- V.fulfillment = se;
1724
- }
1725
- }
1726
- try {
1727
- await ce(
1728
- a.purchaseOrder,
1729
- V,
1730
- r,
1731
- f,
1732
- X
1733
- ) === "submitted" && (e.open({
1734
- title: "Success",
1735
- message: O,
1736
- type: "success"
1737
- }), _("update:show", !1), _("submitted"));
1738
- } catch (Z) {
1739
- e.open({
1740
- title: "Something went wrong",
1741
- message: "Please try again.",
1742
- type: "error"
1743
- }), console.error("Error when submitting PO operation", r, a.purchaseOrder, Z);
1744
- } finally {
1745
- n.value = "", d.value = !1, u.value = !0;
1746
- }
1747
- }
1748
- }
1749
- const be = ee(() => {
1750
- var r, f;
1751
- return ((r = a.purchaseOrder) == null ? void 0 : r.status) === M.enum.RECEIVING || ((f = a.purchaseOrder) == null ? void 0 : f.status) === M.enum.COMPLETE;
1752
- }), xe = ee(() => {
1753
- const r = a.purchaseOrder;
1754
- if (!r) return { status: "", statusClass: "" };
1755
- const f = Te(r), { partial: O, over: $ } = ze(f), B = Ge(r.status, O, $);
1756
- let H = m(`inventory.transfer.status.${B}`), Q = `${r.status}`.toLocaleLowerCase("en-us");
1757
- return B === M.enum.CLOSE && (H = `${m(`inventory.transfer.status.${M.enum.COMPLETE}`)}`), B === "PARTIAL_RECEIVED" && Q === M.enum.PROCESSING.toLocaleLowerCase("en-us") && (Q = M.enum.RECEIVING.toLocaleLowerCase("en-us")), {
1758
- status: H,
1759
- statusClass: `fm-status-badge fm-status-badge-${Q}`
1760
- };
1761
- }), ue = ee(() => {
1762
- var H, Q;
1763
- const r = ((H = a.purchaseOrder) == null ? void 0 : H.deliveryOrder) ?? [], f = ((Q = a.purchaseOrder) == null ? void 0 : Q.deliveryFullfillment) ?? [], O = [
1764
- ...r.map((h) => ({
1765
- createdAt: h.createdAt,
1766
- type: "grn",
1767
- doc: h
1768
- })),
1769
- ...f.map((h) => ({
1770
- createdAt: h.createdAt,
1771
- type: "fulfillment",
1772
- doc: h
1773
- }))
1774
- ];
1775
- O.reverse().sort((h, V) => h.createdAt.localeCompare(V.createdAt));
1776
- function $(h) {
1777
- var Z, L, se, K, de, pe, we, Re, j;
1778
- const V = f.findIndex((F) => F.id === h.fullfillmentId), X = [
1779
- (L = (Z = f[V]) == null ? void 0 : Z.netSuite) != null && L.refNo ? {
1780
- label: "Fulfillment's ref no. (Netsuite)",
1781
- values: [(K = (se = f[V]) == null ? void 0 : se.netSuite) == null ? void 0 : K.refNo]
1782
- } : null,
1783
- (de = h == null ? void 0 : h.netSuite) != null && de.refNo ? {
1784
- label: "Netsuite ref no.",
1785
- values: [(pe = h == null ? void 0 : h.netSuite) == null ? void 0 : pe.refNo]
1786
- } : null,
1787
- (we = h == null ? void 0 : h.netSuite) != null && we.recordType ? {
1788
- label: "Netsuite Type",
1789
- values: [ct((Re = h == null ? void 0 : h.netSuite) == null ? void 0 : Re.recordType)]
1790
- } : null
1791
- ];
1792
- return {
1793
- header: "Received",
1794
- date: Ue(new Date(h.createdAt)),
1795
- info: [
1796
- {
1797
- label: "Adjustment date",
1798
- values: [
1799
- h.adjustment ? Ue(new Date(wt(h.adjustment))) : "-"
1800
- ]
1801
- },
1802
- {
1803
- label: "Received by",
1804
- values: [(j = h.createdBy) == null ? void 0 : j.name]
1805
- },
1806
- {
1807
- label: "Received items",
1808
- values: h.received.map((F) => {
1809
- var J;
1810
- return C("div", [
1811
- C(
1812
- "div",
1813
- {
1814
- class: "flex gap-4"
1815
- },
1816
- [
1817
- C(
1818
- "div",
1819
- {
1820
- class: "flex flex-col"
1821
- },
1822
- [
1823
- C(
1824
- "span",
1825
- {
1826
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1827
- },
1828
- `${F.sku.name}`
1829
- ),
1830
- C(
1831
- "span",
1832
- {
1833
- class: "fm-typo-en-body-md-400"
1834
- },
1835
- `${F.sku.code} `
1836
- )
1837
- ]
1838
- ),
1839
- C(
1840
- "div",
1841
- {
1842
- class: "ml-auto flex flex-col"
1843
- },
1844
- [
1845
- C(
1846
- "div",
1847
- {
1848
- class: "ml-auto flex gap-1"
1849
- },
1850
- [
1851
- C(
1852
- "span",
1853
- {
1854
- class: "fm-typo-en-body-lg-600 self-end"
1855
- },
1856
- fe(F.amount, !1)
1857
- ),
1858
- C(
1859
- "span",
1860
- {
1861
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1862
- },
1863
- ((J = F.measurement) == null ? void 0 : J.abbrev) ?? F.sku.unit.abbrev
1864
- )
1865
- ]
1866
- ),
1867
- C(
1868
- "div",
1869
- {
1870
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1871
- },
1872
- `${F.cost ? `(${Ae(F.cost)})` : ""}`
1873
- )
1874
- ]
1875
- )
1876
- ]
1877
- )
1878
- ]);
1879
- })
1880
- },
1881
- h.deliveryOrderNumber ? {
1882
- label: "Delivery order no.",
1883
- values: [h.deliveryOrderNumber]
1884
- } : null,
1885
- h.remark ? {
1886
- label: "Remark",
1887
- values: [h.remark]
1888
- } : null,
1889
- V > -1 ? {
1890
- label: "Fulfilment's sequence",
1891
- values: [`${V + 1}`]
1892
- } : null,
1893
- ...X
1894
- ].filter((F) => F)
1895
- };
1896
- }
1897
- function B(h) {
1898
- var X, Z;
1899
- const V = f.findIndex((L) => L.id === h.id);
1900
- return {
1901
- header: "Fulfillment",
1902
- date: Ue(new Date(h.createdAt)),
1903
- info: [
1904
- {
1905
- label: "Sequence",
1906
- values: [String(V + 1)]
1907
- },
1908
- {
1909
- label: "Receiveable items",
1910
- values: h.items.map((L) => {
1911
- var se;
1912
- return C("div", [
1913
- C(
1914
- "div",
1915
- {
1916
- class: "flex gap-4"
1917
- },
1918
- [
1919
- C(
1920
- "div",
1921
- {
1922
- class: "flex flex-col"
1923
- },
1924
- [
1925
- C(
1926
- "span",
1927
- {
1928
- class: "fm-typo-en-body-lg-800 basis-1/2 shrink-0 grow"
1929
- },
1930
- `${L.sku.name}`
1931
- ),
1932
- C(
1933
- "span",
1934
- {
1935
- class: "fm-typo-en-body-md-400"
1936
- },
1937
- `${L.sku.code} `
1938
- )
1939
- ]
1940
- ),
1941
- C(
1942
- "div",
1943
- {
1944
- class: "ml-auto flex flex-col"
1945
- },
1946
- [
1947
- C(
1948
- "div",
1949
- {
1950
- class: "ml-auto flex gap-1"
1951
- },
1952
- [
1953
- C(
1954
- "span",
1955
- {
1956
- class: "fm-typo-en-body-lg-600 self-end"
1957
- },
1958
- fe(L.amount, !1)
1959
- ),
1960
- C(
1961
- "span",
1962
- {
1963
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1964
- },
1965
- ((se = L.measurement) == null ? void 0 : se.abbrev) ?? L.sku.unit.abbrev
1966
- )
1967
- ]
1968
- ),
1969
- C(
1970
- "div",
1971
- {
1972
- class: "flex self-end fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1973
- },
1974
- `${L.cost ? `(${Ae(L.cost)})` : ""}`
1975
- )
1976
- ]
1977
- )
1978
- ]
1979
- )
1980
- ]);
1981
- })
1982
- },
1983
- (X = h.netSuite) != null && X.refNo ? {
1984
- label: "Ref no. (Netsuite)",
1985
- values: [(Z = h.netSuite) == null ? void 0 : Z.refNo]
1986
- } : null
1987
- ].filter((L) => L)
1988
- };
1989
- }
1990
- return O.map((h) => {
1991
- switch (h.type) {
1992
- case "grn":
1993
- return $(h.doc);
1994
- case "fulfillment":
1995
- return B(h.doc);
1996
- }
1997
- });
1998
- }), A = ee(() => {
1999
- var f;
2000
- const r = {
2001
- ...it(0),
2002
- currency: st()
2003
- };
2004
- return ((f = a.purchaseOrder) == null ? void 0 : f.items.reduce((O, $) => ({
2005
- ...ot(O, $.totalCost ?? r),
2006
- currency: st()
2007
- }), r)) ?? r;
2008
- });
2009
- function T(r) {
2010
- var H;
2011
- const O = (((H = a.purchaseOrder) == null ? void 0 : H.version) ?? Ce.enum[1]) === Ce.enum[2] ? r.id : r.sku._id, $ = a.receivedMap[O];
2012
- return `<span class="${Y(r)} fm-typo-en-body-lg-600">${Rt.toFormatString({ value: $.received })}</span>/${qt(r.quantity, r.sku.unit, r.measurement)}`;
2013
- }
2014
- function Y(r) {
2015
- var V;
2016
- const O = (((V = a.purchaseOrder) == null ? void 0 : V.version) ?? Ce.enum[1]) === Ce.enum[2] ? r.id : r.sku._id, $ = a.receivedMap[O], { isPartialReceive: B, isNoReceive: H, isOverReceive: Q, isFullReceive: h } = Bt($);
2017
- return H ? "text-fm-color-typo-tertiary" : B ? "text-fm-color-system-warning-300" : Q ? "text-fm-color-system-error-300" : h ? "text-fm-color-system-success-300" : "";
2018
- }
2019
- return (r, f) => {
2020
- var L, se;
2021
- const O = W("FmButtonGroup"), $ = W("FmChip"), B = W("FmMenuDivider"), H = W("FmCard"), Q = W("FmIcon"), h = W("FmTooltip"), V = W("FmSpacer"), X = W("FmButton"), Z = W("FmSideSheet");
2022
- return g(), ie(Z, {
2023
- header: w(m)("inventory.transfer.receiveRequest.details.title") + ((L = r.purchaseOrder) != null && L.seqNumber ? ` #${(se = r.purchaseOrder) == null ? void 0 : se.seqNumber}` : ""),
2024
- modelValue: w(P),
2025
- "onUpdate:modelValue": f[5] || (f[5] = (K) => xt(P) ? P.value = K : null),
2026
- "dismiss-away": u.value,
2027
- "close-button": "",
2028
- "max-width": 600
2029
- }, {
2030
- default: re(() => {
2031
- var K, de, pe, we, Re;
2032
- return [
2033
- o("div", Ar, [
2034
- o("div", null, [
2035
- I(O, {
2036
- items: E.value,
2037
- modelValue: z.value,
2038
- "onUpdate:modelValue": f[0] || (f[0] = (j) => z.value = j)
2039
- }, null, 8, ["items", "modelValue"])
2040
- ]),
2041
- z.value.value === "overview" ? (g(), N(ae, { key: 0 }, [
2042
- o("div", null, [
2043
- I(H, {
2044
- variant: "outlined",
2045
- class: "flex flex-col gap-8 px-12 py-16"
2046
- }, {
2047
- default: re(() => {
2048
- var j, F, J, ge, _e, ke, Qe, Xe, Ze, Je;
2049
- return [
2050
- o("div", Cr, [
2051
- o("div", $r, k(w(m)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
2052
- o("div", Dr, [
2053
- (j = w(s).sessionUser.value) != null && j.role.isAdmin ? (g(), N("div", qr, [
2054
- I(Ne, null, {
2055
- default: re(() => {
2056
- var et;
2057
- return [
2058
- $e(k((et = a.purchaseOrder) == null ? void 0 : et.status), 1)
2059
- ];
2060
- }),
2061
- _: 1
2062
- })
2063
- ])) : U("", !0),
2064
- I($, {
2065
- label: xe.value.status,
2066
- class: De(xe.value.statusClass),
2067
- compact: ""
2068
- }, null, 8, ["label", "class"])
2069
- ])
2070
- ]),
2071
- I(B),
2072
- o("div", Tr, [
2073
- o("div", Pr, [
2074
- o("div", Ir, [
2075
- o("div", Fr, k(w(m)("inventory.transfer.receiveRequest.details.createdAt")), 1)
2076
- ]),
2077
- o("div", Er, k(w(qe)(((F = r.purchaseOrder) == null ? void 0 : F._id) ?? "")), 1)
2078
- ]),
2079
- (J = r.purchaseOrder) != null && J.effectiveAt ? (g(), N("div", Lr, [
2080
- o("div", Br, k(w(m)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
2081
- o("div", Vr, k(w(lt)(new Date((ge = r.purchaseOrder) == null ? void 0 : ge.effectiveAt))), 1)
2082
- ])) : U("", !0),
2083
- o("div", Ur, [
2084
- o("div", Mr, k(w(m)("inventory.transfer.receiveRequest.details.type.title")), 1),
2085
- o("div", Kr, k(w(m)(
2086
- `inventory.transfer.receiveRequest.details.type.${p.value.toLocaleLowerCase("en-US")}`
2087
- )), 1)
2088
- ]),
2089
- (ke = (_e = r.purchaseOrder) == null ? void 0 : _e.supplier) != null && ke.name ? (g(), N("div", jr, [
2090
- o("div", zr, k(w(m)("inventory.transfer.receiveRequest.details.from")), 1),
2091
- o("div", Gr, k((Xe = (Qe = r.purchaseOrder) == null ? void 0 : Qe.supplier) == null ? void 0 : Xe.name), 1)
2092
- ])) : U("", !0),
2093
- r.transferTo ? (g(), N("div", Hr, [
2094
- o("div", Wr, k(w(m)("inventory.transfer.receiveRequest.details.to")), 1),
2095
- o("div", Yr, k(r.transferTo), 1)
2096
- ])) : U("", !0),
2097
- (Ze = r.purchaseOrder) != null && Ze.ref ? (g(), N("div", Qr, [
2098
- o("div", Xr, k(w(m)("inventory.transfer.receiveRequest.details.reference")), 1),
2099
- o("div", Zr, k(r.purchaseOrder.ref), 1)
2100
- ])) : U("", !0),
2101
- (Je = r.purchaseOrder) != null && Je.remark ? (g(), N("div", Jr, [
2102
- o("div", es, k(w(m)("inventory.transfer.receiveRequest.details.remark")), 1),
2103
- o("div", ts, k(r.purchaseOrder.remark), 1)
2104
- ])) : U("", !0)
2105
- ])
2106
- ];
2107
- }),
2108
- _: 1
2109
- })
2110
- ]),
2111
- I(kr, {
2112
- "po-request": r.poRequest,
2113
- purchaseOrder: r.purchaseOrder,
2114
- transferType: p.value,
2115
- transferToDbName: r.transferToDbName,
2116
- scope: r.scope
2117
- }, null, 8, ["po-request", "purchaseOrder", "transferType", "transferToDbName", "scope"]),
2118
- o("div", rs, [
2119
- o("div", ss, [
2120
- o("div", ns, [
2121
- o("span", as, [
2122
- $e(k(be.value ? w(m)("inventory.transfer.receiveRequest.details.receivedItems") : w(m)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
2123
- (de = (K = r.purchaseOrder) == null ? void 0 : K.netSuite) != null && de.missingItems && ((we = (pe = r.purchaseOrder) == null ? void 0 : pe.netSuite) == null ? void 0 : we.missingItems.length) > 0 ? (g(), ie(h, {
2124
- key: 0,
2125
- variant: "rich",
2126
- placement: "top",
2127
- "z-index": 51
2128
- }, {
2129
- content: re(() => {
2130
- var j, F;
2131
- return [
2132
- o("div", os, [
2133
- (g(!0), N(ae, null, ve((F = (j = r.purchaseOrder) == null ? void 0 : j.netSuite) == null ? void 0 : F.missingItems, (J, ge) => (g(), N("div", {
2134
- class: "flex justify-center align-middle",
2135
- key: ge
2136
- }, [
2137
- I(Q, {
2138
- name: "arrow_right",
2139
- size: "sm"
2140
- }),
2141
- $e(" " + k(`(${J.netSuiteId}) ${J.name}: ${J.reason}`), 1)
2142
- ]))), 128))
2143
- ])
2144
- ];
2145
- }),
2146
- default: re(() => [
2147
- I(Q, {
2148
- name: "error",
2149
- color: "#ff2c2c",
2150
- size: "sm"
2151
- })
2152
- ]),
2153
- _: 1
2154
- })) : U("", !0)
2155
- ])
2156
- ]),
2157
- I(B),
2158
- (g(!0), N(ae, null, ve(((Re = r.purchaseOrder) == null ? void 0 : Re.items) ?? [], (j) => {
2159
- var F;
2160
- return g(), N("div", {
2161
- key: j.code,
2162
- class: "flex flex-col"
2163
- }, [
2164
- o("div", is, [
2165
- o("div", ls, k(j.name), 1),
2166
- o("div", cs, [
2167
- o("span", {
2168
- innerHTML: T(j)
2169
- }, null, 8, us)
2170
- ])
2171
- ]),
2172
- o("div", ds, [
2173
- o("div", fs, k(j.code), 1),
2174
- (F = j.totalCost) != null && F.amount && w(c).enableTotalCost ? (g(), N("div", ms, " (" + k(w(Ae)(j.totalCost)) + ") ", 1)) : U("", !0)
2175
- ])
2176
- ]);
2177
- }), 128)),
2178
- +w(fe)(A.value) ? (g(), N(ae, { key: 0 }, [
2179
- o("div", ps, [
2180
- I(B)
2181
- ]),
2182
- o("div", vs, [
2183
- f[6] || (f[6] = o("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
2184
- o("div", ys, k(w(Ae)(A.value)), 1)
2185
- ])
2186
- ], 64)) : U("", !0)
2187
- ])
2188
- ])
2189
- ], 64)) : z.value.value === "deliveryHistory" ? (g(), N("div", hs, [
2190
- ue.value.length ? (g(), N("div", ws, [
2191
- (g(!0), N(ae, null, ve(ue.value, (j, F) => (g(), N(ae, { key: F }, [
2192
- o("div", Rs, [
2193
- o("div", Os, [
2194
- o("div", Ns, [
2195
- o("div", {
2196
- class: De([
2197
- {
2198
- "bg-fm-color-primary": F !== 0,
2199
- "bg-white": F === 0
2200
- },
2201
- "w-[2px] h-full"
2202
- ])
2203
- }, null, 2)
2204
- ]),
2205
- f[7] || (f[7] = o("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
2206
- o("div", xs, [
2207
- o("div", {
2208
- class: De([
2209
- {
2210
- "bg-fm-color-primary": F < ue.value.length - 1,
2211
- "bg-white": F >= ue.value.length - 1
2212
- },
2213
- "w-[2px] h-full"
2214
- ])
2215
- }, null, 2)
2216
- ])
2217
- ]),
2218
- o("div", ks, [
2219
- o("div", As, k(j.header), 1),
2220
- o("div", Cs, k(j.date), 1)
2221
- ])
2222
- ]),
2223
- o("div", $s, [
2224
- o("div", Ds, [
2225
- o("div", qs, [
2226
- o("div", {
2227
- class: De([
2228
- {
2229
- "bg-fm-color-primary": F < ue.value.length - 1,
2230
- "bg-white": F >= ue.value.length - 1
2231
- },
2232
- "w-[2px] h-full"
2233
- ])
2234
- }, null, 2)
2235
- ])
2236
- ]),
2237
- o("div", Ts, [
2238
- I(H, {
2239
- variant: "outlined",
2240
- class: "py-12 px-16"
2241
- }, {
2242
- default: re(() => [
2243
- o("div", Ps, [
2244
- (g(!0), N(ae, null, ve(j.info, (J, ge) => (g(), N("div", {
2245
- key: ge,
2246
- class: "flex flex-col gap-4"
2247
- }, [
2248
- o("div", Is, k(J == null ? void 0 : J.label), 1),
2249
- o("div", Fs, [
2250
- (g(!0), N(ae, null, ve(J == null ? void 0 : J.values, (_e, ke) => (g(), N("div", {
2251
- key: ke,
2252
- class: "fm-typo-en-body-lg-600"
2253
- }, [
2254
- typeof _e == "string" ? (g(), N(ae, { key: 0 }, [
2255
- $e(k(_e), 1)
2256
- ], 64)) : (g(), ie(kt(_e), { key: 1 }))
2257
- ]))), 128))
2258
- ])
2259
- ]))), 128))
2260
- ])
2261
- ]),
2262
- _: 2
2263
- }, 1024)
2264
- ])
2265
- ])
2266
- ], 64))), 128))
2267
- ])) : (g(), N("div", bs, [
2268
- I(V),
2269
- o("div", null, [
2270
- o("img", {
2271
- src: w(Tt),
2272
- alt: "List is empty"
2273
- }, null, 8, gs)
2274
- ]),
2275
- o("div", _s, k(w(m)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
2276
- o("div", Ss, k(w(m)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
2277
- I(V),
2278
- I(V)
2279
- ]))
2280
- ])) : U("", !0)
2281
- ])
2282
- ];
2283
- }),
2284
- "side-sheet-footer": re(() => [
2285
- o("div", Es, [
2286
- (g(!0), N(ae, null, ve(q.value, (K) => (g(), N(ae, null, [
2287
- w(Ke)[K].available != !1 ? (g(), ie(X, {
2288
- key: K,
2289
- label: w(m)(w(Ke)[K].translationKey),
2290
- onClick: (de) => le(K),
2291
- loading: n.value === K,
2292
- disabled: n.value !== K && d.value,
2293
- variant: w(Ke)[K].buttonVariant
2294
- }, null, 8, ["label", "onClick", "loading", "disabled", "variant"])) : U("", !0)
2295
- ], 64))), 256)),
2296
- w(b).ableToMarkReceived(r.purchaseOrder) && !q.value.includes("completeReceive") ? (g(), ie(X, {
2297
- key: 0,
2298
- label: w(m)("inventory.transfer.receiveRequest.actions.completeReceive"),
2299
- onClick: f[1] || (f[1] = (K) => le("completeReceive")),
2300
- loading: n.value === "completeReceive",
2301
- disabled: n.value !== "completeReceive" && d.value
2302
- }, null, 8, ["label", "loading", "disabled"])) : U("", !0),
2303
- w(b).ableToMarkApproved(r.purchaseOrder) && r.canApprove && !q.value.includes("approveRequest") ? (g(), ie(X, {
2304
- key: 1,
2305
- label: w(m)("inventory.transfer.approval.actions.approveRequest"),
2306
- onClick: f[2] || (f[2] = (K) => le("approveRequest")),
2307
- loading: n.value === "approveRequest",
2308
- disabled: n.value !== "approveRequest" && d.value
2309
- }, null, 8, ["label", "loading", "disabled"])) : U("", !0),
2310
- w(b).ableToCreateFulfillment(r.purchaseOrder, r.poRequest) && a.scope === "approval" ? (g(), ie(X, {
2311
- key: 2,
2312
- label: w(m)("inventory.transfer.receiveRequest.actions.processRequest"),
2313
- onClick: f[3] || (f[3] = (K) => le("processRequest")),
2314
- loading: n.value === "processRequest",
2315
- disabled: n.value !== "processRequest" && d.value
2316
- }, null, 8, ["label", "loading", "disabled"])) : U("", !0),
2317
- I(X, {
2318
- label: w(m)("common.close"),
2319
- variant: "tertiary",
2320
- onClick: f[4] || (f[4] = (K) => _("update:show", !1))
2321
- }, null, 8, ["label"])
2322
- ])
2323
- ]),
2324
- _: 1
2325
- }, 8, ["header", "modelValue", "dismiss-away"]);
2326
- };
2327
- }
2328
- });
2329
- export {
2330
- He as P,
2331
- Xs as _,
2332
- Ys as a,
2333
- Qs as b,
2334
- Vt as g,
2335
- Be as u
2336
- };