@feedmepos/mf-inventory-portal 0.0.25-dev.9 → 0.0.26-dev.1

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 (116) hide show
  1. package/dist/{App-9zSE_swt.js → App-CipfIdtR.js} +71 -72
  2. package/dist/ApprovalView-IC33yBg7.js +143 -0
  3. package/dist/{BindingsDialog-eGbOIQkw.js → BindingsDialog-EN6Kbnu7.js} +2 -2
  4. package/dist/{BindingsPicker-CVXrd29s.js → BindingsPicker-DQ_LEoqq.js} +3 -3
  5. package/dist/BindingsTable-DGXpAyM4.js +120 -0
  6. package/dist/ClosingDraftView-DR9xsW9I.js +1348 -0
  7. package/dist/ClosingTemplateView-CC1T7ovX.js +1804 -0
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C9un0wCK.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CovzlB-s.js} +43 -43
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BRSABJnM.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BxEtsFXp.js} +29 -29
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DeRvrF7O.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-B8H6vFJ5.js} +1 -1
  11. package/dist/{IngredientGroupView-ZWCOAljO.js → IngredientGroupView-DRPbXH8d.js} +24 -24
  12. package/dist/IngredientsView-DSHcH30X.js +1731 -0
  13. package/dist/{IntegrationView-DO3Ambro.js → IntegrationView-BgACk-jP.js} +605 -669
  14. package/dist/{InventoryBindingForm-BjtFP29c.js → InventoryBindingForm-Fs-CHoT-.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-CFMZ4VsK.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DVHQjAEC.js} +63 -63
  16. package/dist/{InventoryBindingSummary-C6DkVX-B.js → InventoryBindingSummary-CHWMtGtk.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-nb1t6u2V.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cu9V-8Cf.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BcMAXo4F.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CyVRCAqv.js} +12 -12
  19. package/dist/PublishView-CI7o5a0F.js +222 -0
  20. package/dist/{PurchaseOrderPrintPreview-_MCAsdw9.js → PurchaseOrderPrintPreview-CO4a811o.js} +1 -1
  21. package/dist/ReceiveRequestView-KH5wY5BA.js +2562 -0
  22. package/dist/{RecipeView-dmmjklwh.js → RecipeView-DxVbUxOG.js} +47 -47
  23. package/dist/StockView-CiHPAaYh.js +1840 -0
  24. package/dist/{SupplierView-CO5460uC.js → SupplierView-DPj87kld.js} +448 -461
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CfPPCFh8.js +1566 -0
  26. package/dist/TransferTemplateView-3W29v8hd.js +1420 -0
  27. package/dist/{UnitView-DbYzxCXF.js → UnitView-WCtNQFf8.js} +23 -23
  28. package/dist/{WarehouseView-BII4SEVC.js → WarehouseView-tgFFbQY7.js} +40 -40
  29. package/dist/api/bill.d.ts +12 -2
  30. package/dist/api/closing-draft.d.ts +1 -0
  31. package/dist/api/inventory.d.ts +8 -7
  32. package/dist/api/netsuite.d.ts +22 -5
  33. package/dist/api/purchase-order.d.ts +6 -1
  34. package/dist/api/stock.d.ts +1 -0
  35. package/dist/{app-IM1yJnE8.js → app-Ba80HxT3.js} +38448 -34777
  36. package/dist/app.d.ts +965 -120
  37. package/dist/app.js +1 -1
  38. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  39. package/dist/components/FmMultiselectDialog.d.ts +23 -0
  40. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +1 -1
  41. package/dist/components/shell/inventory/binding-ui.vue.d.ts +1 -1
  42. package/dist/{decimal-DQUpCN-B.js → decimal-DFqusYHB.js} +1 -1
  43. package/dist/{format-unit-display-COuIZISg.js → format-unit-display-Bsod5Ra6.js} +232 -238
  44. package/dist/helper/country.d.ts +1 -0
  45. package/dist/helper/fuzzy.d.ts +1 -1
  46. package/dist/helper/number.d.ts +1 -1
  47. package/dist/index-0ekVGPtB.js +12197 -0
  48. package/dist/index-ZAEVHtfa.js +84 -0
  49. package/dist/{stock-BJUTiXXk.js → stock-Cn6EQvTz.js} +29 -25
  50. package/dist/stores/feature.d.ts +11 -6
  51. package/dist/stores/helper/generate-backend-urls.d.ts +0 -1
  52. package/dist/stores/integration/index.d.ts +2 -0
  53. package/dist/stores/integration/netsuite.d.ts +22 -5
  54. package/dist/stores/inventory.d.ts +141 -8
  55. package/dist/stores/location.d.ts +0 -9
  56. package/dist/stores/stock.d.ts +5 -0
  57. package/dist/stores/warehouse.d.ts +4 -7
  58. package/dist/style.css +1 -1
  59. package/dist/{supplier-CM-qQVyI.js → supplier-P1gi71dg.js} +4 -4
  60. package/dist/tsconfig.app.tsbuildinfo +1 -1
  61. package/dist/{use-ingredient-select-dialog-Cn79xFNg.js → use-ingredient-select-dialog-BW5imbB5.js} +1 -1
  62. package/dist/{use-inventory-binding-dialog-zwOG19YV.js → use-inventory-binding-dialog-BYxb8nXg.js} +1 -1
  63. package/dist/views/adjustment-template/wastage-template/actions.d.ts +0 -24
  64. package/dist/views/adjustment-template/wastage-template/table.d.ts +0 -24
  65. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +92 -8
  66. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
  67. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +552 -48
  68. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +1 -1
  69. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
  70. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -36
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -36
  72. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +3 -3
  73. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  74. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  75. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -0
  76. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +4 -1
  77. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
  78. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  79. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +529 -489
  80. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +8 -4
  81. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +382 -2
  82. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +5 -2
  83. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +1238 -972
  84. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +1080 -1003
  85. package/dist/views/receive-request/import/XilnexImportDialog.vue.d.ts +22 -0
  86. package/dist/views/receive-request/import/XilnexImportForm.vue.d.ts +17 -0
  87. package/dist/views/receive-request/import/XilnexResult.vue.d.ts +17 -0
  88. package/dist/views/receive-request/import/export.d.ts +14 -0
  89. package/dist/views/receive-request/import/props.d.ts +7 -0
  90. package/dist/views/stock/components/StockRecordCard.vue.d.ts +6 -1
  91. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  92. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +220 -0
  93. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +0 -8
  94. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +0 -1
  95. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +7 -2
  96. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +530 -530
  97. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +530 -530
  98. package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +305 -0
  99. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  100. package/dist/vue-i18n-CjtRsQMl.js +2365 -0
  101. package/package.json +7 -7
  102. package/dist/ApprovalView-C2tg-wsm.js +0 -138
  103. package/dist/BindingsTable-CCsQEFnu.js +0 -145
  104. package/dist/ClosingDraftView-BI8b3CJ9.js +0 -1225
  105. package/dist/ClosingTemplateView-miJnC-ML.js +0 -1859
  106. package/dist/IngredientsView-5-pSX6y_.js +0 -1718
  107. package/dist/PublishView-DOMQdIJ7.js +0 -192
  108. package/dist/ReceiveRequestView-902hWGtz.js +0 -1877
  109. package/dist/StockView-C4lEYLXU.js +0 -7847
  110. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D6sZDCEY.js +0 -1328
  111. package/dist/TransferTemplateView-C9UwNTnY.js +0 -1371
  112. package/dist/components/FmAutocompleteTextField.vue.d.ts +0 -31
  113. package/dist/feature-DMBVVBsQ.js +0 -1005
  114. package/dist/index-CIrsMt6f.js +0 -35546
  115. package/dist/views/dev/components/AutocompleteTextField.vue.d.ts +0 -2
  116. package/dist/vue-i18n-CzPFJ9JY.js +0 -2365
@@ -1,1328 +0,0 @@
1
- import { ref as V, computed as Y, h as oe, defineComponent as _e, unref as i, openBlock as g, createElementBlock as D, createElementVNode as e, toDisplayString as S, createCommentVNode as T, resolveComponent as J, createVNode as U, createBlock as W, isRef as Ge, withCtx as de, Fragment as ne, normalizeClass as ye, createTextVNode as Te, renderList as pe } from "vue";
2
- import { W as ze, u as be, aL as N, a5 as He, a7 as Ye, a8 as Qe, am as We, d as xe, e as Ie, av as M, T as Fe, aM as Je, Y as Se, K as he, i as fe, aN as Me, ac as ge, f as Pe, D as K, h as F, b as Be, a6 as Ze, as as Ce, a0 as $e, ai as Ee } from "./app-IM1yJnE8.js";
3
- import { useDialog as we, useSnackbar as Re, useProxiedModel as Xe } from "@feedmepos/ui-library";
4
- import { u as Ue } from "./feature-DMBVVBsQ.js";
5
- import { b as et, u as tt, f as Le, P as ie } from "./format-unit-display-COuIZISg.js";
6
- import { F as rt } from "./decimal-DQUpCN-B.js";
7
- import { useI18n as je } from "@feedmepos/mf-common";
8
- import { E as st } from "./empty-placeholder-wf6-BWE8.js";
9
- const Ke = ze((v, y) => {
10
- const b = be();
11
- return {
12
- async readRequests(r) {
13
- const O = r ?? b.currentLocationDBName, c = `${v.inventoryBackendUrl}/${O}/purchase-request`;
14
- return await y.get(c);
15
- },
16
- async getPurchaseOrders({
17
- start: r,
18
- end: O
19
- }) {
20
- const c = b.currentLocationDBName, R = `${v.inventoryBackendUrl}/${c}/purchase-order`;
21
- return await y.get(`${R}?start=${r}&end=${O}`);
22
- },
23
- async getPurchaseOrderById(r) {
24
- const O = b.currentLocationDBName, c = `${v.inventoryBackendUrl}/${O}/purchase-order`;
25
- return await y.get(`${c}/${r}`);
26
- },
27
- async processPurchaseOrder(r, O) {
28
- const c = b.currentLocationDBName, R = O || c, l = `${v.inventoryBackendUrl}/${R}/purchase-order/run-operation`;
29
- return await y.put(l, r);
30
- },
31
- async createPurchaseOrder(r) {
32
- const O = b.currentLocationDBName, c = `${v.inventoryBackendUrl}/${O}/purchase-order`;
33
- return await y.post(c, r);
34
- },
35
- async updatePurchaseOrder(r) {
36
- const O = b.currentLocationDBName, c = `${v.inventoryBackendUrl}/${O}/purchase-order`;
37
- return await y.put(c, r);
38
- }
39
- };
40
- }), Ve = {
41
- [N.enum.confirmDraft]: {
42
- primaryActions: {
43
- text: "Confirm draft",
44
- close: !0
45
- },
46
- title: "Confirm draft?",
47
- message: "Purchase order cannot be changed after confirm draft.",
48
- successMessage: "Purchase order draft has been confirmed"
49
- },
50
- [N.enum.cancelDraft]: {
51
- primaryActions: {
52
- text: "Cancel draft",
53
- close: !0,
54
- variant: "destructive"
55
- },
56
- title: "Cancel draft?",
57
- message: "Purchase order cannot be changed after cancelled draft.",
58
- successMessage: "Purchase order draft has been cancelled"
59
- },
60
- [N.enum.submitRequest]: {
61
- primaryActions: {
62
- text: "Submit request",
63
- close: !0
64
- },
65
- title: "Confirm draft?",
66
- message: "Purchase order cannot be changed after confirm draft.",
67
- successMessage: "Purchase order draft has been submitted"
68
- },
69
- [N.enum.completeReceive]: {
70
- primaryActions: {
71
- text: "Mark received",
72
- close: !0
73
- },
74
- title: "Mark as received",
75
- message: "Purchase order cannot be changed after it has complete receiving.",
76
- successMessage: "Purchase order has been marked as received"
77
- },
78
- [N.enum.approveRequest]: {
79
- primaryActions: {
80
- text: "Approve request",
81
- close: !0
82
- },
83
- title: "Approve request?",
84
- message: "Purchase order will be approved.",
85
- successMessage: "Purchase order has been approved"
86
- },
87
- [N.enum.rejectRequest]: {
88
- primaryActions: {
89
- text: "Reject request",
90
- close: !0,
91
- variant: "destructive"
92
- },
93
- title: "Reject request?",
94
- message: "Purchase order will be rejected.",
95
- successMessage: "Purchase order has been rejected"
96
- }
97
- }, ve = V();
98
- function $r(v, y) {
99
- const b = we(), r = be(), O = Ue(), c = et(), R = tt(), l = V(!1), h = Re(), o = Ke(), s = V(new Array()), u = V(
100
- y != null && y.startDate && (y != null && y.endDate) ? y : He()
101
- ), m = Y(() => {
102
- const p = new Date(u.value.startDate), d = new Date(u.value.endDate);
103
- return {
104
- start: Ye(p).toISOString(),
105
- end: Qe(d).toISOString()
106
- };
107
- }), f = V(new Array()), C = We(), H = V(null);
108
- async function te(p) {
109
- function d(n) {
110
- const _ = {
111
- mode: xe.CREATE,
112
- modelValue: p || void 0,
113
- show: !0,
114
- "onUpdate:show"(w) {
115
- ve.value.show = w;
116
- },
117
- templateId: n,
118
- lastClosingDate: H.value
119
- };
120
- ve.value = _;
121
- }
122
- let k;
123
- O.mustUsePoTemplate && !(p != null && p.template) ? b.open({
124
- title: "Create transfer",
125
- message: "",
126
- primaryActions: {
127
- text: "Select a template",
128
- close: !0
129
- },
130
- secondaryActions: {
131
- text: "Outlet to Outlet",
132
- variant: "secondary",
133
- close: !0
134
- }
135
- }).onPrimary(async () => {
136
- k = await c.getTemplateId(), k && d(k);
137
- }).onSecondary(() => {
138
- d(void 0);
139
- }) : d(k);
140
- }
141
- function ce(p) {
142
- const d = {
143
- mode: xe.UPDATE,
144
- modelValue: Ie(p),
145
- show: !0,
146
- "onUpdate:show"(k) {
147
- ve.value.show = k;
148
- },
149
- lastClosingDate: H.value
150
- };
151
- ve.value = d;
152
- }
153
- async function G() {
154
- s.value = [], l.value = !0;
155
- try {
156
- s.value = await o.getPurchaseOrders(m.value).then((k) => k.sort((n, _) => _._id.localeCompare(n._id)));
157
- const p = await C.readLastClosing(!0), d = p == null ? void 0 : p._id;
158
- d && (H.value = Je(d)), O.mustUsePoTemplate && await R.fetchTemplates();
159
- } catch {
160
- h.open({
161
- title: "Something went wrong",
162
- message: "Error at fetching purchase orders",
163
- type: "error"
164
- });
165
- } finally {
166
- l.value = !1;
167
- }
168
- }
169
- async function ue() {
170
- f.value = [], l.value = !0;
171
- try {
172
- f.value = await o.readRequests().then((p) => p.reverse());
173
- } catch {
174
- h.open({
175
- title: "Something went wrong",
176
- message: "Error at fetching purchase requests",
177
- type: "error"
178
- });
179
- } finally {
180
- l.value = !1;
181
- }
182
- }
183
- function Z() {
184
- switch (v) {
185
- case "receive/request":
186
- return G();
187
- case "approval":
188
- return ue();
189
- }
190
- }
191
- function re(p, d) {
192
- u.value = {
193
- startDate: p,
194
- endDate: d
195
- }, Z();
196
- }
197
- r.watchLocation(async (p) => {
198
- if (!p) {
199
- s.value = [];
200
- return;
201
- }
202
- await Z();
203
- });
204
- const X = V(), t = V(Math.random().toString());
205
- async function a(p, d) {
206
- var w, $;
207
- const k = Math.random().toString();
208
- t.value = k;
209
- const n = v === "receive/request" ? r.currentLocation : d == null ? void 0 : d.to, _ = {
210
- poRequest: d,
211
- purchaseOrder: p,
212
- transferTo: n == null ? void 0 : n.name,
213
- transferToDbName: n == null ? void 0 : n.dbName,
214
- show: !0,
215
- canResubmit: !1,
216
- canApprove: v === "approval",
217
- "onUpdate:show"(x) {
218
- X.value.show = x;
219
- }
220
- };
221
- if (X.value = _, !(d || p.status !== M.enum.REQUESTING)) {
222
- try {
223
- d = (await o.readRequests(
224
- `${p.supplier.internal}_${p.supplier._id}`
225
- )).find((L) => L.purchaseOrderId === p._id);
226
- } catch {
227
- console.error("Error at fetching po request to check");
228
- }
229
- k === t.value && (X.value.canResubmit = !d, X.value.transferTo = (w = d == null ? void 0 : d.to) == null ? void 0 : w.name, X.value.transferToDbName = ($ = d == null ? void 0 : d.to) == null ? void 0 : $.dbName);
230
- }
231
- }
232
- async function P(p, d, k, n) {
233
- l.value = !0;
234
- try {
235
- await o.processPurchaseOrder(
236
- {
237
- operation: d,
238
- doc: p,
239
- options: (
240
- // auto receive for supplier to warehouse
241
- (d === N.enum.confirmDraft || // auto receive for warehouse to warehouse
242
- d === N.enum.completeReceive) && O.autoReceiveWarehouse ? {
243
- autoReceive: !0
244
- } : void 0
245
- )
246
- },
247
- n
248
- ), await new Promise(($) => setTimeout($, 1e3));
249
- const w = be().currentLocationDBName.startsWith("restaurant_");
250
- d === N.enum.confirmDraft && p.effectiveAt && w ? h.open({
251
- title: "Success",
252
- message: `${k}. The backdate will be reflected once your POS has received this change.`,
253
- type: "success"
254
- }) : h.open({
255
- title: "Success",
256
- message: k,
257
- type: "success"
258
- });
259
- } catch (_) {
260
- h.open({
261
- title: "Something went wrong",
262
- message: "Please try again.",
263
- type: "error"
264
- }), console.error("Error when submitting PO operation", d, p, _);
265
- } finally {
266
- l.value = !1, Z();
267
- }
268
- }
269
- async function q(p, d, k) {
270
- const n = Ve[d];
271
- if (!n) {
272
- h.open({
273
- title: "Something went wrong",
274
- message: `Cannot process order: ${Fe(d)}`,
275
- type: "error"
276
- });
277
- return;
278
- }
279
- const { successMessage: _, ...w } = n;
280
- b.open({
281
- title: w.title,
282
- message: w.message,
283
- primaryActions: w.primaryActions
284
- }).onPrimary(() => {
285
- P(p, d, _, k);
286
- });
287
- }
288
- return {
289
- purchaseOrders: s,
290
- purchaseRequests: f,
291
- updateDateRange: re,
292
- fetchData: Z,
293
- loading: l,
294
- transferDialogProps: ve,
295
- promptCreateTransferDialog: te,
296
- promptUpdateTransferDialog: ce,
297
- transferDetailsProps: X,
298
- promptShowTransferDetails: a,
299
- submitAction: q
300
- };
301
- }
302
- function at(v, y) {
303
- return y.reduce(
304
- (r, O) => {
305
- const c = O.received.find((R) => R.sku._id === v._id);
306
- return c && (r = Se(r, c.amount)), r;
307
- },
308
- rt.toPrecision(he(0), v.unit.precision)
309
- );
310
- }
311
- function nt(v, y) {
312
- const { name: b, address: r, regNo: O } = y.doc.profile, c = {
313
- name: b,
314
- registrationNumber: O,
315
- line1: r == null ? void 0 : r.line1,
316
- line2: r == null ? void 0 : r.line2,
317
- postcode: r == null ? void 0 : r.postcode,
318
- city: r == null ? void 0 : r.city,
319
- state: r == null ? void 0 : r.state,
320
- country: r == null ? void 0 : r.country
321
- }, R = {
322
- name: v.supplier.name,
323
- registrationNumber: v.supplier.registrationNumber,
324
- line1: v.supplier.address.line1,
325
- line2: v.supplier.address.line2,
326
- postcode: v.supplier.address.postcode,
327
- city: v.supplier.address.city,
328
- state: v.supplier.address.state,
329
- country: v.supplier.address.country
330
- }, l = v.items.map((u) => {
331
- const { sku: m, measurement: f } = u, C = fe(
332
- at(u.sku, v.deliveryOrder || []),
333
- !1
334
- );
335
- return {
336
- code: m.code,
337
- description: m.name,
338
- quantity: Le(u.quantity, m.unit, u.measurement),
339
- unit: (f == null ? void 0 : f.abbrev) || m.unit.abbrev,
340
- received: C
341
- };
342
- }), h = v.deliveryOrder.map((u) => ({
343
- createdAt: Me(new Date(u.createdAt)),
344
- ref: u.deliveryOrderNumber,
345
- remark: u.remark || "",
346
- items: u.received.map((m) => {
347
- var f;
348
- return {
349
- code: m.sku.code,
350
- description: m.sku.name,
351
- quantity: fe(m.amount),
352
- unit: ((f = m.measurement) == null ? void 0 : f.abbrev) || m.sku.unit.abbrev
353
- };
354
- })
355
- })), o = {
356
- orderNumber: v.seqNumber.toString(),
357
- createdAt: ge(v._id),
358
- ref: v.ref || "",
359
- remark: v.remark || "",
360
- buyer: c,
361
- supplier: R,
362
- items: l,
363
- status: v.status,
364
- deliveryOrders: h
365
- }, s = new URL(window.location.href);
366
- s.pathname = s.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", s.searchParams.append("data", JSON.stringify(o)), window.open(s.href, "_blank", "noreferrer");
367
- }
368
- const me = {
369
- submitRequest: {
370
- translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
371
- color: "text-fm-color-typo-primary",
372
- value: N.enum.submitRequest
373
- },
374
- confirmDraft: {
375
- translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
376
- color: "text-fm-color-typo-primary",
377
- value: N.enum.confirmDraft
378
- },
379
- cancelDraft: {
380
- translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
381
- color: "text-fm-color-typo-error",
382
- value: N.enum.cancelDraft
383
- },
384
- approveRequest: {
385
- translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
386
- color: "text-fm-color-typo-primary",
387
- value: N.enum.approveRequest
388
- },
389
- rejectRequest: {
390
- translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
391
- color: "text-fm-color-typo-error",
392
- value: N.enum.rejectRequest
393
- },
394
- processRequest: {
395
- translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
396
- color: "text-fm-color-typo-primary",
397
- value: N.enum.processRequest
398
- },
399
- receiveStock: {
400
- translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
401
- color: "text-fm-color-typo-primary",
402
- value: N.enum.receiveStock
403
- },
404
- completeReceive: {
405
- translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
406
- color: "text-fm-color-typo-primary",
407
- value: N.enum.completeReceive
408
- }
409
- };
410
- function Er(v, y) {
411
- const b = be(), { t: r } = je();
412
- function O(s) {
413
- switch (s.status) {
414
- case "DRAFT":
415
- return [
416
- K[F.Update],
417
- K[F.Details],
418
- s.supplier.internal === "restaurant" || s.supplier.internal === "warehouse" ? me[N.enum.submitRequest] : me[N.enum.confirmDraft],
419
- me[N.enum.cancelDraft],
420
- K[F.Print]
421
- ];
422
- case "RECEIVING":
423
- return [
424
- me[N.enum.completeReceive],
425
- K[F.Details],
426
- K[F.Print]
427
- ];
428
- case "REQUESTING":
429
- return v === "receive/request" ? [K[F.Details], K[F.Print]] : [
430
- me[N.enum.approveRequest],
431
- me[N.enum.rejectRequest],
432
- K[F.Details],
433
- K[F.Print]
434
- ];
435
- case "PROCESSING":
436
- return [K[F.Details], K[F.Print]];
437
- case "COMPLETE":
438
- case "CANCEL":
439
- default:
440
- return [K[F.Details], K[F.Print]];
441
- }
442
- }
443
- function c(s) {
444
- return Object.values(N.enum).includes(s);
445
- }
446
- async function R(s, u, m) {
447
- var C, H;
448
- const f = Ie(u);
449
- if (s === F.Print) {
450
- nt(f, b.currentLocation);
451
- return;
452
- }
453
- if (s === F.Details) {
454
- y.promptShowTransferDetails(f, m);
455
- return;
456
- }
457
- if (s === F.Update) {
458
- (C = y.promptUpdateTransferDialog) == null || C.call(y, f);
459
- return;
460
- }
461
- if (c(s)) {
462
- y.submitAction(u, s, (H = m == null ? void 0 : m.to) == null ? void 0 : H.dbName);
463
- return;
464
- }
465
- }
466
- function l() {
467
- return [
468
- {
469
- accessorKey: "seqNumber",
470
- header: () => r("inventory.transfer.table.seqNo"),
471
- enableSorting: !0,
472
- size: 80,
473
- sortUndefined: "last"
474
- },
475
- {
476
- accessorKey: "_id",
477
- header: () => r("inventory.transfer.table.createdAt"),
478
- cell(s) {
479
- return ge(`${s.getValue()}`);
480
- },
481
- enableSorting: !0
482
- },
483
- {
484
- accessorKey: "supplier.name",
485
- header: () => r("inventory.transfer.table.transferFrom"),
486
- enableSorting: !0,
487
- size: 200
488
- },
489
- {
490
- accessorKey: "items.length",
491
- header: () => r("inventory.transfer.table.noOfItems"),
492
- enableSorting: !1,
493
- meta: {
494
- width: "10rem"
495
- }
496
- },
497
- {
498
- accessorKey: "ref",
499
- header: () => r("inventory.transfer.table.reference"),
500
- enableSorting: !1,
501
- size: "auto"
502
- },
503
- {
504
- accessorKey: "status",
505
- header: () => r("inventory.transfer.table.status"),
506
- cell(s) {
507
- const u = r(`inventory.transfer.status.${s.getValue() ?? ""}`), m = `${s.getValue() ?? ""}`.toLocaleLowerCase("en-us");
508
- return oe(
509
- "div",
510
- {
511
- class: "flex"
512
- },
513
- oe(
514
- "div",
515
- {
516
- class: `fm-status-badge fm-status-badge-${m}`
517
- },
518
- u
519
- )
520
- );
521
- },
522
- enableSorting: !0,
523
- size: 200
524
- },
525
- {
526
- id: "action",
527
- cell(s) {
528
- const u = s.row.original, m = O(u);
529
- return Pe(m, (f) => R(f, u));
530
- },
531
- enableSorting: !1,
532
- size: 40,
533
- meta: {
534
- cellClass: "",
535
- headerClass: ""
536
- }
537
- }
538
- ];
539
- }
540
- function h() {
541
- return [
542
- {
543
- accessorKey: "purchaseOrder.seqNumber",
544
- header: () => r("inventory.transfer.table.seqNo"),
545
- enableSorting: !0,
546
- size: 80,
547
- sortUndefined: "last"
548
- },
549
- {
550
- accessorKey: "purchaseOrder._id",
551
- header: () => r("inventory.transfer.table.createdAt"),
552
- cell(s) {
553
- return ge(`${s.getValue()}`);
554
- },
555
- enableSorting: !0
556
- },
557
- {
558
- accessorKey: "to.name",
559
- header: () => r("inventory.transfer.table.transferTo"),
560
- enableSorting: !1,
561
- size: 200
562
- },
563
- {
564
- accessorKey: "purchaseOrder.items.length",
565
- header: () => r("inventory.transfer.table.noOfItems"),
566
- enableSorting: !1
567
- },
568
- {
569
- accessorKey: "purchaseOrder.ref",
570
- header: () => r("inventory.transfer.table.reference"),
571
- enableSorting: !1,
572
- size: "auto"
573
- },
574
- {
575
- accessorKey: "purchaseOrder.status",
576
- header: () => r("inventory.transfer.table.status"),
577
- cell(s) {
578
- const u = r(`inventory.transfer.status.${s.getValue() ?? ""}`), m = `${s.getValue() ?? ""}`.toLocaleLowerCase("en-us");
579
- return oe(
580
- "div",
581
- {
582
- class: "flex"
583
- },
584
- oe(
585
- "div",
586
- {
587
- class: `fm-status-badge fm-status-badge-${m}`
588
- },
589
- u
590
- )
591
- );
592
- },
593
- enableSorting: !0
594
- },
595
- {
596
- id: "action",
597
- cell(s) {
598
- const u = s.row.original, m = u.purchaseOrder ? O(u.purchaseOrder) : [];
599
- return Pe(
600
- m,
601
- (f) => u.purchaseOrder ? R(f, u.purchaseOrder, u) : void 0
602
- );
603
- },
604
- enableSorting: !1,
605
- size: 40,
606
- meta: {
607
- cellClass: "",
608
- headerClass: ""
609
- }
610
- }
611
- ];
612
- }
613
- const o = Y(() => v === "receive/request" ? l() : h());
614
- return {
615
- get columnDefs() {
616
- return o.value;
617
- }
618
- };
619
- }
620
- const ot = {
621
- key: 0,
622
- class: "flex flex-col gap-8"
623
- }, lt = { class: "flex flex-col gap-4" }, it = { class: "fm-typo-en-body-lg-600" }, ct = {
624
- key: 0,
625
- class: "flex flex-col gap-4"
626
- }, ut = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, dt = { class: "fm-typo-en-body-lg-600" }, mt = {
627
- key: 1,
628
- class: "flex flex-col gap-4"
629
- }, ft = { class: "fm-typo-en-body-lg-600" }, pt = {
630
- key: 2,
631
- class: "flex flex-col gap-4"
632
- }, vt = { class: "fm-typo-en-body-lg-600" }, yt = /* @__PURE__ */ _e({
633
- __name: "NetSuiteInfo",
634
- props: {
635
- transferType: {},
636
- transferToDbName: {},
637
- poRequest: {},
638
- purchaseOrder: {},
639
- isTransferBetweenOutlets: { type: Boolean }
640
- },
641
- setup(v) {
642
- const y = v, b = Be(), r = Y(
643
- () => {
644
- var c, R, l, h, o, s;
645
- return b.getSubsidiaryFullName(
646
- ((l = (R = (c = y.purchaseOrder) == null ? void 0 : c.netSuite) == null ? void 0 : R.subsidiary) == null ? void 0 : l.id) || ((s = (o = (h = y.poRequest) == null ? void 0 : h.netSuite) == null ? void 0 : o.subsidiary) == null ? void 0 : s.id)
647
- ).fullName;
648
- }
649
- ), O = Y(() => {
650
- var c, R, l, h, o, s;
651
- return (R = (c = y.purchaseOrder) == null ? void 0 : c.deliveryFullfillment) != null && R.length && ((h = (l = y.purchaseOrder) == null ? void 0 : l.deliveryFullfillment) == null ? void 0 : h.length) > 0 ? (s = (o = y.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) == null ? void 0 : s.map((u) => {
652
- var m;
653
- return (m = u.netSuite) == null ? void 0 : m.refNo;
654
- }).join(", ") : "-";
655
- });
656
- return (c, R) => {
657
- var l, h, o, s, u, m, f, C, H, te, ce, G, ue, Z;
658
- return i(b).isEnabled ? (g(), D("div", ot, [
659
- e("div", lt, [
660
- R[0] || (R[0] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "NetSuite subsidiary", -1)),
661
- e("div", it, S(r.value || "-"), 1)
662
- ]),
663
- c.isTransferBetweenOutlets ? T("", !0) : (g(), D("div", ct, [
664
- e("div", ut, " NetSuite " + S(c.transferType === i(ie).PURCHASE ? "Purchase Order" : "Transfer Order") + " (ID) ", 1),
665
- e("div", dt, S(c.poRequest ? (h = (l = c.poRequest) == null ? void 0 : l.netSuite) == null ? void 0 : h.refNo : (s = (o = c.purchaseOrder) == null ? void 0 : o.netSuite) == null ? void 0 : s.refNo) + " (" + S(c.poRequest ? (m = (u = c.poRequest) == null ? void 0 : u.netSuite) == null ? void 0 : m.id : (C = (f = c.purchaseOrder) == null ? void 0 : f.netSuite) == null ? void 0 : C.id) + ") ", 1)
666
- ])),
667
- (ce = (te = (H = c.purchaseOrder) == null ? void 0 : H.netSuite) == null ? void 0 : te.additionalInfo) != null && ce.transactionnumber ? (g(), D("div", mt, [
668
- R[1] || (R[1] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transaction Number ", -1)),
669
- e("div", ft, S((Z = (ue = (G = c.purchaseOrder) == null ? void 0 : G.netSuite) == null ? void 0 : ue.additionalInfo) == null ? void 0 : Z.transactionnumber), 1)
670
- ])) : T("", !0),
671
- i(b).isEnabled && c.transferType === i(ie).TRANSFER && !c.isTransferBetweenOutlets ? (g(), D("div", pt, [
672
- R[2] || (R[2] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite fulfillment IDs ", -1)),
673
- e("div", vt, S(O.value), 1)
674
- ])) : T("", !0)
675
- ])) : T("", !0);
676
- };
677
- }
678
- }), ht = {
679
- key: 0,
680
- class: "flex flex-row-reverse"
681
- }, bt = /* @__PURE__ */ _e({
682
- __name: "NetSuiteSync",
683
- props: {
684
- poRequest: {},
685
- purchaseOrder: {},
686
- isTransferBetweenOutlets: { type: Boolean }
687
- },
688
- setup(v) {
689
- const y = v, b = Be(), r = Re(), O = we(), c = V(!1), R = Y(() => {
690
- var u, m, f, C;
691
- let h = !0;
692
- b.isEnabled || (h = !1);
693
- const o = y.purchaseOrder, s = y.poRequest;
694
- return o && ((u = o == null ? void 0 : o.supplier) != null && u.internal ? (!s && o.status == M.enum.DRAFT && (h = !1), s && !((m = s == null ? void 0 : s.netSuite) != null && m.id) && (h = !1), y.isTransferBetweenOutlets && (h = !1)) : ((o == null ? void 0 : o.status) !== M.enum.REQUESTING && o.supplier.internal && (h = !1), !s && !((f = o == null ? void 0 : o.netSuite) != null && f.id) && (h = !1), !s && ((C = o == null ? void 0 : o.netSuite) != null && C.id) && (o == null ? void 0 : o.status) == M.enum.REQUESTING && (h = !1))), h;
695
- });
696
- async function l() {
697
- c.value || O.open({
698
- title: "Sync with NetSuite",
699
- contentComponent: oe("div", [
700
- oe("p", "Are you sure you want to sync now?"),
701
- oe("br"),
702
- oe(
703
- "p",
704
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" },
705
- "Please wait a moment before syncing manually to avoid unnecessary actions."
706
- )
707
- ]),
708
- primaryActions: {
709
- text: "Sync",
710
- close: !0,
711
- variant: "destructive"
712
- },
713
- secondaryActions: { text: "Not now", close: !0 }
714
- }).onPrimary(async () => {
715
- var h;
716
- try {
717
- c.value = !0;
718
- const o = y.purchaseOrder, s = y.poRequest;
719
- let u = "purchaseOrder";
720
- if ((h = o == null ? void 0 : o.supplier) != null && h.internal && (u = "purchaseOrderRequest"), !(o != null && o._id)) {
721
- r.open({
722
- title: "Error",
723
- message: "Invalid sync ID",
724
- type: "error"
725
- });
726
- return;
727
- }
728
- await b.syncTransferOrder(u, o == null ? void 0 : o._id, s == null ? void 0 : s._id), r.open({
729
- title: "Sync with NetSuite",
730
- message: "Requested to sync with NetSuite. Please wait a moment.",
731
- type: "success"
732
- });
733
- } catch {
734
- r.open({
735
- title: "Error",
736
- message: "Failed to sync with NetSuite",
737
- type: "error"
738
- });
739
- }
740
- setTimeout(() => {
741
- c.value = !1;
742
- }, 5e3);
743
- });
744
- }
745
- return (h, o) => {
746
- const s = J("FmButton");
747
- return R.value ? (g(), D("div", ht, [
748
- U(s, {
749
- "prepend-icon": "sync",
750
- variant: "primary",
751
- label: "NetSuite",
752
- loading: c.value,
753
- onClick: l
754
- }, null, 8, ["loading"])
755
- ])) : T("", !0);
756
- };
757
- }
758
- }), gt = { class: "flex flex-col gap-16 w-full h-full" }, St = { class: "flex justify-between" }, _t = { class: "fm-typo-en-body-lg-600" }, wt = { class: "flex flex-col gap-8" }, Rt = { class: "flex flex-col gap-4" }, Ot = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dt = { class: "flex gap-1" }, Nt = { class: "fm-typo-en-body-lg-600" }, kt = {
759
- key: 0,
760
- class: "flex flex-col gap-4"
761
- }, At = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qt = { class: "fm-typo-en-body-lg-600" }, Tt = { class: "flex flex-col gap-4" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Pt = { class: "fm-typo-en-body-lg-600" }, Ct = {
762
- key: 1,
763
- class: "flex flex-col gap-4"
764
- }, $t = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-lg-600" }, It = {
765
- key: 2,
766
- class: "flex flex-col gap-4"
767
- }, Ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mt = { class: "fm-typo-en-body-lg-600" }, Bt = {
768
- key: 3,
769
- class: "flex flex-col gap-4"
770
- }, Ut = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lt = { class: "fm-typo-en-body-lg-600" }, jt = {
771
- key: 4,
772
- class: "flex flex-col gap-4"
773
- }, Kt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vt = { class: "fm-typo-en-body-lg-600" }, Gt = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, zt = { class: "flex flex-col gap-8" }, Ht = { class: "fm-typo-en-body-lg-600" }, Yt = { class: "flex gap-8" }, Qt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary flex flex-col gap-4" }, Wt = { class: "flex w-full gap-4" }, Jt = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Zt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, Xt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, er = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, tr = {
774
- key: 0,
775
- class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
776
- }, rr = { class: "py-8" }, sr = { class: "flex justify-end gap-4 items-center" }, ar = { class: "fm-typo-en-body-lg-600" }, nr = {
777
- key: 1,
778
- class: "flex-1 xs:w-screen xs:max-w-full"
779
- }, or = {
780
- key: 0,
781
- class: "flex flex-col items-center gap-8 h-full"
782
- }, lr = ["src"], ir = { class: "fm-typo-en-body-lg-600" }, cr = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, ur = {
783
- key: 1,
784
- class: "px-4 flex flex-col"
785
- }, dr = { class: "flex gap-12 content-stretch" }, mr = {
786
- class: "flex flex-col w-24",
787
- name: "circles"
788
- }, fr = { class: "flex-1 flex flex-col items-center" }, pr = { class: "flex-1 flex flex-col items-center" }, vr = {
789
- class: "py-12 flex flex-col gap-4",
790
- name: "received-at header"
791
- }, yr = { class: "fm-typo-en-body-lg-400" }, hr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, br = { class: "flex gap-12 content-stretch" }, gr = {
792
- class: "flex flex-col w-24",
793
- name: "circles"
794
- }, Sr = { class: "flex-1 flex flex-col items-center" }, _r = {
795
- class: "py-12 flex flex-col gap-4 flex-1",
796
- name: "delivery details"
797
- }, wr = { class: "flex flex-col gap-8" }, Rr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Or = { class: "flex flex-col gap-4" }, Dr = { class: "flex gap-8 xs:flex-col" }, Ir = /* @__PURE__ */ _e({
798
- __name: "TransferDetails",
799
- props: {
800
- poRequest: {},
801
- purchaseOrder: {},
802
- transferTo: {},
803
- transferToDbName: {},
804
- show: { type: Boolean },
805
- canResubmit: { type: Boolean },
806
- canApprove: { type: Boolean }
807
- },
808
- emits: ["update:show", "submitted"],
809
- setup(v, { emit: y }) {
810
- const b = v, r = y, O = we(), c = Re(), R = Ue(), { t: l } = je(), h = Y(
811
- () => {
812
- var t, a, P, q;
813
- return ((a = (t = b.purchaseOrder) == null ? void 0 : t.supplier) == null ? void 0 : a.internal) === "restaurant" || ((q = (P = b.purchaseOrder) == null ? void 0 : P.supplier) == null ? void 0 : q.internal) === "warehouse" ? ie.TRANSFER : ie.PURCHASE;
814
- }
815
- ), o = Y(() => {
816
- var t, a, P;
817
- return h.value === ie.TRANSFER && ((t = b.transferToDbName) == null ? void 0 : t.startsWith("restaurant")) && ((P = (a = b.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : P.internal) === "restaurant";
818
- }), s = [
819
- {
820
- label: l("inventory.transfer.receiveRequest.details.overview"),
821
- value: "overview"
822
- },
823
- {
824
- label: l("inventory.transfer.receiveRequest.details.deliveryHistory"),
825
- value: "deliveryHistory"
826
- }
827
- ], u = V(s[0]), m = V(!1), f = V(""), C = V(!0), H = Ke(), te = Xe(b, "show");
828
- async function ce(t, a, P) {
829
- f.value = a, m.value = !0, C.value = !1;
830
- try {
831
- await H.processPurchaseOrder(
832
- {
833
- operation: a,
834
- doc: t,
835
- options: (
836
- // auto receive for supplier to warehouse
837
- (a === N.enum.confirmDraft || // auto receive for warehouse to warehouse
838
- a === N.enum.completeReceive) && R.autoReceiveWarehouse ? {
839
- autoReceive: !0
840
- } : void 0
841
- )
842
- },
843
- b.transferToDbName
844
- ), await new Promise((q) => setTimeout(q, 1e3)), c.open({
845
- title: "Success",
846
- message: P,
847
- type: "success"
848
- }), r("update:show", !1), r("submitted");
849
- } catch (q) {
850
- c.open({
851
- title: "Something went wrong",
852
- message: "Please try again.",
853
- type: "error"
854
- }), console.error("Error when submitting PO operation", a, t, q);
855
- } finally {
856
- f.value = "", m.value = !1, C.value = !0;
857
- }
858
- }
859
- async function G(t) {
860
- const a = Ve[t];
861
- if (!a) {
862
- c.open({
863
- title: "Something went wrong",
864
- message: `Cannot process order: ${Fe(t)}`,
865
- type: "error"
866
- });
867
- return;
868
- }
869
- const { successMessage: P, ...q } = a;
870
- O.open({
871
- title: q.title,
872
- message: q.message,
873
- primaryActions: q.primaryActions
874
- }).onPrimary(() => {
875
- b.purchaseOrder && ce(b.purchaseOrder, t, P);
876
- });
877
- }
878
- const ue = Y(() => {
879
- var t, a;
880
- return ((t = b.purchaseOrder) == null ? void 0 : t.status) === M.enum.RECEIVING || ((a = b.purchaseOrder) == null ? void 0 : a.status) === M.enum.COMPLETE;
881
- }), Z = Y(() => {
882
- var d, k, n;
883
- const P = (((d = b.purchaseOrder) == null ? void 0 : d.deliveryOrder) ?? []).flatMap((_) => _.received ?? []).reduce(
884
- (_, w) => {
885
- const $ = _[w.sku._id] ?? [];
886
- return _[w.sku._id] = [...$, w], _;
887
- },
888
- {}
889
- ), q = Object.entries(P).reduce(
890
- (_, [w, $]) => {
891
- const x = $.reduce((L, j) => {
892
- const Q = Ze(
893
- L,
894
- Math.max(L.precision, j.amount.precision)
895
- );
896
- return Se(Q, j.amount);
897
- }, he(0));
898
- return _[w] = x, _;
899
- },
900
- {}
901
- ), p = ((k = b.purchaseOrder) == null ? void 0 : k.items) ?? [];
902
- for (const _ of p)
903
- q[n = _.sku._id] ?? (q[n] = he(0));
904
- return q;
905
- }), re = Y(() => {
906
- var d, k;
907
- const t = ((d = b.purchaseOrder) == null ? void 0 : d.deliveryOrder) ?? [], a = ((k = b.purchaseOrder) == null ? void 0 : k.deliveryFullfillment) ?? [], P = [
908
- ...t.map((n) => ({
909
- createdAt: n.createdAt,
910
- type: "grn",
911
- doc: n
912
- })),
913
- ...a.map((n) => ({
914
- createdAt: n.createdAt,
915
- type: "fulfillment",
916
- doc: n
917
- }))
918
- ];
919
- P.reverse().sort((n, _) => n.createdAt.localeCompare(_.createdAt));
920
- function q(n) {
921
- var w, $, x, L, j, Q, se;
922
- const _ = a.findIndex((B) => B.id === n.fullfillmentId);
923
- return {
924
- header: "Received",
925
- date: Ee(new Date(n.createdAt)),
926
- info: [
927
- {
928
- label: "Received by",
929
- values: [(w = n.createdBy) == null ? void 0 : w.name]
930
- },
931
- {
932
- label: "Received items",
933
- values: n.received.map((B) => {
934
- var ae;
935
- return `(${B.sku.code}) ${B.sku.name}: ${fe(B.amount, !1)} ${((ae = B.measurement) == null ? void 0 : ae.abbrev) ?? B.sku.unit.abbrev}`;
936
- })
937
- },
938
- n.deliveryOrderNumber ? {
939
- label: "Delivery order no.",
940
- values: [n.deliveryOrderNumber]
941
- } : null,
942
- n.remark ? {
943
- label: "Remark",
944
- values: [n.remark]
945
- } : null,
946
- _ > -1 ? {
947
- label: "Fulfilment's sequence",
948
- values: [`${_ + 1}`]
949
- } : null,
950
- (x = ($ = a[_]) == null ? void 0 : $.netSuite) != null && x.refNo ? {
951
- label: "Fulfillment's ref no. (Netsuite)",
952
- values: [(j = (L = a[_]) == null ? void 0 : L.netSuite) == null ? void 0 : j.refNo]
953
- } : null,
954
- (Q = n == null ? void 0 : n.netSuite) != null && Q.refNo ? {
955
- label: "Item receipt (Netsuite)",
956
- values: [(se = n == null ? void 0 : n.netSuite) == null ? void 0 : se.refNo]
957
- } : null
958
- ].filter((B) => B)
959
- };
960
- }
961
- function p(n) {
962
- var w, $;
963
- const _ = a.findIndex((x) => x.id === n.id);
964
- return {
965
- header: "Fulfillment",
966
- date: Ee(new Date(n.createdAt)),
967
- info: [
968
- {
969
- label: "Sequence",
970
- values: [String(_ + 1)]
971
- },
972
- {
973
- label: "Receiveable items",
974
- values: n.items.map((x) => {
975
- var L;
976
- return `(${x.sku.code}) ${x.sku.name}: ${fe(x.amount, !1)} ${((L = x.measurement) == null ? void 0 : L.abbrev) ?? x.sku.unit.abbrev}`;
977
- })
978
- },
979
- (w = n.netSuite) != null && w.refNo ? {
980
- label: "Ref no. (Netsuite)",
981
- values: [($ = n.netSuite) == null ? void 0 : $.refNo]
982
- } : null
983
- ].filter((x) => x)
984
- };
985
- }
986
- return P.map((n) => {
987
- switch (n.type) {
988
- case "grn":
989
- return q(n.doc);
990
- case "fulfillment":
991
- return p(n.doc);
992
- }
993
- });
994
- }), X = Y(() => {
995
- var a;
996
- const t = {
997
- ...he(0),
998
- currency: Ce()
999
- };
1000
- return ((a = b.purchaseOrder) == null ? void 0 : a.items.reduce((P, q) => ({
1001
- ...Se(P, q.totalCost ?? t),
1002
- currency: Ce()
1003
- }), t)) ?? t;
1004
- });
1005
- return (t, a) => {
1006
- var x, L;
1007
- const P = J("FmButtonGroup"), q = J("FmChip"), p = J("FmMenuDivider"), d = J("FmCard"), k = J("FmIcon"), n = J("FmTooltip"), _ = J("FmSpacer"), w = J("FmButton"), $ = J("FmSideSheet");
1008
- return g(), W($, {
1009
- header: i(l)("inventory.transfer.receiveRequest.details.title") + ((x = t.purchaseOrder) != null && x.seqNumber ? ` #${(L = t.purchaseOrder) == null ? void 0 : L.seqNumber}` : ""),
1010
- modelValue: i(te),
1011
- "onUpdate:modelValue": a[9] || (a[9] = (j) => Ge(te) ? te.value = j : null),
1012
- "dismiss-away": C.value,
1013
- "close-button": "",
1014
- "max-width": 600
1015
- }, {
1016
- default: de(() => {
1017
- var j, Q, se, B, ae;
1018
- return [
1019
- e("div", gt, [
1020
- U(bt, {
1021
- "po-request": t.poRequest,
1022
- "purchase-order": t.purchaseOrder,
1023
- "is-transfer-between-outlets": o.value
1024
- }, null, 8, ["po-request", "purchase-order", "is-transfer-between-outlets"]),
1025
- e("div", null, [
1026
- U(P, {
1027
- items: s,
1028
- modelValue: u.value,
1029
- "onUpdate:modelValue": a[0] || (a[0] = (A) => u.value = A)
1030
- }, null, 8, ["modelValue"])
1031
- ]),
1032
- u.value.value === "overview" ? (g(), D(ne, { key: 0 }, [
1033
- e("div", null, [
1034
- U(d, {
1035
- variant: "outlined",
1036
- class: "flex flex-col gap-8 px-12 py-16"
1037
- }, {
1038
- default: de(() => {
1039
- var A, E, I, ee, le, z, Oe, De, Ne, ke, Ae, qe;
1040
- return [
1041
- e("div", St, [
1042
- e("div", _t, S(i(l)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
1043
- e("div", null, [
1044
- U(q, {
1045
- label: i(l)(`inventory.transfer.status.${(A = t.purchaseOrder) == null ? void 0 : A.status}`),
1046
- class: ye(`fm-status-badge fm-status-badge-${(I = (E = t.purchaseOrder) == null ? void 0 : E.status) == null ? void 0 : I.toLocaleLowerCase("en-us")}`),
1047
- compact: ""
1048
- }, null, 8, ["label", "class"])
1049
- ])
1050
- ]),
1051
- U(p),
1052
- e("div", wt, [
1053
- e("div", Rt, [
1054
- e("div", Ot, [
1055
- e("div", Dt, S(i(l)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1056
- ]),
1057
- e("div", Nt, S(i(ge)(((ee = t.purchaseOrder) == null ? void 0 : ee._id) ?? "")), 1)
1058
- ]),
1059
- (le = t.purchaseOrder) != null && le.effectiveAt ? (g(), D("div", kt, [
1060
- e("div", At, S(i(l)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1061
- e("div", qt, S(i(Me)(new Date((z = t.purchaseOrder) == null ? void 0 : z.effectiveAt))), 1)
1062
- ])) : T("", !0),
1063
- e("div", Tt, [
1064
- e("div", xt, S(i(l)("inventory.transfer.receiveRequest.details.type.title")), 1),
1065
- e("div", Pt, S(i(l)(
1066
- `inventory.transfer.receiveRequest.details.type.${h.value.toLocaleLowerCase("en-US")}`
1067
- )), 1)
1068
- ]),
1069
- (De = (Oe = t.purchaseOrder) == null ? void 0 : Oe.supplier) != null && De.name ? (g(), D("div", Ct, [
1070
- e("div", $t, S(i(l)("inventory.transfer.receiveRequest.details.from")), 1),
1071
- e("div", Et, S((ke = (Ne = t.purchaseOrder) == null ? void 0 : Ne.supplier) == null ? void 0 : ke.name), 1)
1072
- ])) : T("", !0),
1073
- t.transferTo ? (g(), D("div", It, [
1074
- e("div", Ft, S(i(l)("inventory.transfer.receiveRequest.details.to")), 1),
1075
- e("div", Mt, S(t.transferTo), 1)
1076
- ])) : T("", !0),
1077
- U(yt, {
1078
- "po-request": t.poRequest,
1079
- "purchase-order": t.purchaseOrder,
1080
- "transfer-type": h.value,
1081
- "transfer-to-db-name": t.transferToDbName,
1082
- "is-transfer-between-outlets": o.value
1083
- }, null, 8, ["po-request", "purchase-order", "transfer-type", "transfer-to-db-name", "is-transfer-between-outlets"]),
1084
- (Ae = t.purchaseOrder) != null && Ae.ref ? (g(), D("div", Bt, [
1085
- e("div", Ut, S(i(l)("inventory.transfer.receiveRequest.details.reference")), 1),
1086
- e("div", Lt, S(t.purchaseOrder.ref), 1)
1087
- ])) : T("", !0),
1088
- (qe = t.purchaseOrder) != null && qe.remark ? (g(), D("div", jt, [
1089
- e("div", Kt, S(i(l)("inventory.transfer.receiveRequest.details.remark")), 1),
1090
- e("div", Vt, S(t.purchaseOrder.remark), 1)
1091
- ])) : T("", !0)
1092
- ])
1093
- ];
1094
- }),
1095
- _: 1
1096
- })
1097
- ]),
1098
- e("div", Gt, [
1099
- e("div", zt, [
1100
- e("div", Ht, [
1101
- e("div", Yt, [
1102
- Te(S(ue.value ? i(l)("inventory.transfer.receiveRequest.details.receivedItems") : i(l)("inventory.transfer.receiveRequest.details.requestedItems")) + " ", 1),
1103
- (Q = (j = t.purchaseOrder) == null ? void 0 : j.netSuite) != null && Q.missingItems && ((B = (se = t.purchaseOrder) == null ? void 0 : se.netSuite) == null ? void 0 : B.missingItems.length) > 0 ? (g(), W(n, {
1104
- key: 0,
1105
- variant: "rich",
1106
- placement: "top",
1107
- "z-index": 51
1108
- }, {
1109
- content: de(() => {
1110
- var A, E;
1111
- return [
1112
- e("div", Qt, [
1113
- (g(!0), D(ne, null, pe((E = (A = t.purchaseOrder) == null ? void 0 : A.netSuite) == null ? void 0 : E.missingItems, (I, ee) => (g(), D("div", {
1114
- class: "flex justify-center align-middle",
1115
- key: ee
1116
- }, [
1117
- U(k, {
1118
- name: "arrow_right",
1119
- size: "sm"
1120
- }),
1121
- Te(" " + S(`(${I.netSuiteId}) ${I.name}: ${I.reason}`), 1)
1122
- ]))), 128))
1123
- ])
1124
- ];
1125
- }),
1126
- default: de(() => [
1127
- U(k, {
1128
- name: "error",
1129
- color: "#ff2c2c",
1130
- size: "sm"
1131
- })
1132
- ]),
1133
- _: 1
1134
- })) : T("", !0)
1135
- ])
1136
- ]),
1137
- (g(!0), D(ne, null, pe(((ae = t.purchaseOrder) == null ? void 0 : ae.items) ?? [], (A) => (g(), D("div", {
1138
- key: A.code,
1139
- class: "flex flex-col"
1140
- }, [
1141
- e("div", Wt, [
1142
- e("div", Jt, S(A.name), 1),
1143
- e("div", Zt, S(i(fe)(Z.value[A.sku._id], !1)) + "/" + S(i(Le)(A.quantity, A.sku.unit, A.measurement)), 1)
1144
- ]),
1145
- e("div", Xt, [
1146
- e("div", er, S(A.code), 1),
1147
- A.totalCost && i(R).enableTotalCost ? (g(), D("div", tr, " (" + S(i($e)(A.totalCost)) + ") ", 1)) : T("", !0)
1148
- ])
1149
- ]))), 128)),
1150
- +i(fe)(X.value) ? (g(), D(ne, { key: 0 }, [
1151
- e("div", rr, [
1152
- U(p)
1153
- ]),
1154
- e("div", sr, [
1155
- a[10] || (a[10] = e("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, "Total:", -1)),
1156
- e("div", ar, S(i($e)(X.value)), 1)
1157
- ])
1158
- ], 64)) : T("", !0)
1159
- ])
1160
- ])
1161
- ], 64)) : T("", !0),
1162
- u.value.value === "deliveryHistory" ? (g(), D("div", nr, [
1163
- re.value.length ? (g(), D("div", ur, [
1164
- (g(!0), D(ne, null, pe(re.value, (A, E) => (g(), D(ne, { key: E }, [
1165
- e("div", dr, [
1166
- e("div", mr, [
1167
- e("div", fr, [
1168
- e("div", {
1169
- class: ye([
1170
- {
1171
- "bg-fm-color-primary": E !== 0,
1172
- "bg-white": E === 0
1173
- },
1174
- "w-[2px] h-full"
1175
- ])
1176
- }, null, 2)
1177
- ]),
1178
- a[11] || (a[11] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1179
- e("div", pr, [
1180
- e("div", {
1181
- class: ye([
1182
- {
1183
- "bg-fm-color-primary": E < re.value.length - 1,
1184
- "bg-white": E >= re.value.length - 1
1185
- },
1186
- "w-[2px] h-full"
1187
- ])
1188
- }, null, 2)
1189
- ])
1190
- ]),
1191
- e("div", vr, [
1192
- e("div", yr, S(A.header), 1),
1193
- e("div", hr, S(A.date), 1)
1194
- ])
1195
- ]),
1196
- e("div", br, [
1197
- e("div", gr, [
1198
- e("div", Sr, [
1199
- e("div", {
1200
- class: ye([
1201
- {
1202
- "bg-fm-color-primary": E < re.value.length - 1,
1203
- "bg-white": E >= re.value.length - 1
1204
- },
1205
- "w-[2px] h-full"
1206
- ])
1207
- }, null, 2)
1208
- ])
1209
- ]),
1210
- e("div", _r, [
1211
- U(d, {
1212
- variant: "outlined",
1213
- class: "py-12 px-16"
1214
- }, {
1215
- default: de(() => [
1216
- e("div", wr, [
1217
- (g(!0), D(ne, null, pe(A.info, (I, ee) => (g(), D("div", {
1218
- key: ee,
1219
- class: "flex flex-col gap-4"
1220
- }, [
1221
- e("div", Rr, S(I == null ? void 0 : I.label), 1),
1222
- e("div", Or, [
1223
- (g(!0), D(ne, null, pe(I == null ? void 0 : I.values, (le, z) => (g(), D("div", {
1224
- key: z,
1225
- class: "fm-typo-en-body-lg-600"
1226
- }, S(le), 1))), 128))
1227
- ])
1228
- ]))), 128))
1229
- ])
1230
- ]),
1231
- _: 2
1232
- }, 1024)
1233
- ])
1234
- ])
1235
- ], 64))), 128))
1236
- ])) : (g(), D("div", or, [
1237
- U(_),
1238
- e("div", null, [
1239
- e("img", {
1240
- src: i(st),
1241
- alt: "List is empty"
1242
- }, null, 8, lr)
1243
- ]),
1244
- e("div", ir, S(i(l)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1245
- e("div", cr, S(i(l)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1246
- U(_),
1247
- U(_)
1248
- ]))
1249
- ])) : T("", !0)
1250
- ])
1251
- ];
1252
- }),
1253
- "side-sheet-footer": de(() => {
1254
- var j, Q, se, B, ae, A, E, I, ee, le;
1255
- return [
1256
- e("div", Dr, [
1257
- ((j = t.purchaseOrder) == null ? void 0 : j.status) === i(M).enum.DRAFT && h.value === i(ie).PURCHASE ? (g(), W(w, {
1258
- key: 0,
1259
- label: i(l)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1260
- onClick: a[1] || (a[1] = (z) => G("confirmDraft")),
1261
- loading: f.value === "confirmDraft",
1262
- disabled: f.value !== "confirmDraft" && m.value
1263
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1264
- ((Q = t.purchaseOrder) == null ? void 0 : Q.status) === i(M).enum.DRAFT && h.value === i(ie).TRANSFER ? (g(), W(w, {
1265
- key: 1,
1266
- label: i(l)("inventory.transfer.receiveRequest.actions.submitRequest"),
1267
- onClick: a[2] || (a[2] = (z) => G("submitRequest")),
1268
- loading: f.value === "submitRequest",
1269
- disabled: f.value !== "submitRequest" && m.value
1270
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1271
- ((se = t.purchaseOrder) == null ? void 0 : se.status) === i(M).enum.DRAFT ? (g(), W(w, {
1272
- key: 2,
1273
- label: i(l)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1274
- onClick: a[3] || (a[3] = (z) => G("cancelDraft")),
1275
- loading: f.value === "cancelDraft",
1276
- disabled: f.value !== "cancelDraft" && m.value,
1277
- variant: "destructive"
1278
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1279
- ((B = t.purchaseOrder) == null ? void 0 : B.status) === i(M).enum.RECEIVING ? (g(), W(w, {
1280
- key: 3,
1281
- label: i(l)("inventory.transfer.receiveRequest.actions.completeReceive"),
1282
- onClick: a[4] || (a[4] = (z) => G("completeReceive")),
1283
- loading: f.value === "completeReceive",
1284
- disabled: f.value !== "completeReceive" && m.value
1285
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1286
- t.canResubmit ? (g(), W(w, {
1287
- key: 4,
1288
- label: i(l)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1289
- onClick: a[5] || (a[5] = (z) => G("submitRequest")),
1290
- loading: f.value === "submitRequest",
1291
- disabled: f.value !== "submitRequest" && m.value
1292
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1293
- (((ae = t.purchaseOrder) == null ? void 0 : ae.status) === i(M).enum.REQUESTING || ((A = t.purchaseOrder) == null ? void 0 : A.status) === i(M).enum.PROCESSING) && t.canApprove ? (g(), W(w, {
1294
- key: 5,
1295
- label: i(l)("inventory.transfer.approval.actions.approveRequest"),
1296
- onClick: a[6] || (a[6] = (z) => G("approveRequest")),
1297
- loading: f.value === "approveRequest",
1298
- disabled: f.value !== "approveRequest" && m.value
1299
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1300
- ((E = t.purchaseOrder) == null ? void 0 : E.status) === i(M).enum.REQUESTING && t.canApprove ? (g(), W(w, {
1301
- key: 6,
1302
- label: i(l)("inventory.transfer.approval.actions.rejectRequest"),
1303
- onClick: a[7] || (a[7] = (z) => G("rejectRequest")),
1304
- loading: f.value === "rejectRequest",
1305
- disabled: f.value !== "rejectRequest" && m.value,
1306
- variant: "destructive"
1307
- }, null, 8, ["label", "loading", "disabled"])) : T("", !0),
1308
- ((I = t.purchaseOrder) == null ? void 0 : I.status) !== i(M).enum.COMPLETE && ((ee = t.purchaseOrder) == null ? void 0 : ee.status) !== i(M).enum.CANCEL && (((le = t.purchaseOrder) == null ? void 0 : le.status) !== i(M).enum.REQUESTING || t.canApprove) ? (g(), W(w, {
1309
- key: 7,
1310
- label: i(l)("common.close"),
1311
- variant: "tertiary",
1312
- onClick: a[8] || (a[8] = (z) => r("update:show", !1))
1313
- }, null, 8, ["label"])) : T("", !0)
1314
- ])
1315
- ];
1316
- }),
1317
- _: 1
1318
- }, 8, ["header", "modelValue", "dismiss-away"]);
1319
- };
1320
- }
1321
- });
1322
- export {
1323
- Ir as _,
1324
- $r as a,
1325
- Er as b,
1326
- at as g,
1327
- Ke as u
1328
- };