@feedmepos/mf-inventory-portal 0.0.22-dev.5 → 0.0.22-dev.50

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 (144) hide show
  1. package/dist/ApprovalView-CyIOcyG5.js +140 -0
  2. package/dist/{BindingsDialog-DQJhC3Mo.js → BindingsDialog-BXePN5iL.js} +10 -10
  3. package/dist/{BindingsPicker-YfbPb_dG.js → BindingsPicker-Bd_qb0aO.js} +15 -15
  4. package/dist/{BindingsTable-D3MVcHXZ.js → BindingsTable-BV-nP9HU.js} +4 -4
  5. package/dist/ClosingTemplateView-CSvWLccZ.js +1829 -0
  6. package/dist/FmDroppableField-DwZ6ujPh.js +154 -0
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DpCoW_-F.js +266 -0
  8. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js +435 -0
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-C8k7pSPT.js +51 -0
  10. package/dist/IngredientGroupView-C0hPeD41.js +608 -0
  11. package/dist/IngredientsView-CpwVIGXd.js +1608 -0
  12. package/dist/IntegrationView-Bt8pGAHS.js +1225 -0
  13. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-wsBLYBpB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-yA-qJUUz.js} +1 -1
  14. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BqcqoKyN.js +116 -0
  15. package/dist/{PurchaseOrderPrintPreview-BcAmgmD8.js → PurchaseOrderPrintPreview-D3ugzCW_.js} +7 -7
  16. package/dist/ReceiveRequestView-D14YTEEe.js +4073 -0
  17. package/dist/RecipeView-D0WsMfKm.js +594 -0
  18. package/dist/Standalone.vue.d.ts +2 -0
  19. package/dist/StockView-sxI0L6MP.js +7770 -0
  20. package/dist/SupplierView-clAkARuW.js +1468 -0
  21. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-C9NU1m6S.js +1150 -0
  22. package/dist/TransferTemplateView-DpI6kVqX.js +1258 -0
  23. package/dist/{UnitView-B95q8Xrj.js → UnitView-CneJsDum.js} +18 -18
  24. package/dist/{WarehouseView-CHGXvyeS.js → WarehouseView-DYbFWTlh.js} +176 -177
  25. package/dist/api/bill.d.ts +84 -238
  26. package/dist/api/closing-template.d.ts +6 -4
  27. package/dist/api/inventory.d.ts +282 -91
  28. package/dist/api/netsuite.d.ts +71 -0
  29. package/dist/api/purchase-order-template.d.ts +4 -6
  30. package/dist/api/supplier.d.ts +1 -0
  31. package/dist/{app-CfXF4jdF.js → app-B4pi48sM.js} +26414 -24985
  32. package/dist/app.d.ts +88 -3
  33. package/dist/app.js +3 -3
  34. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  35. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  36. package/dist/components/FmMultiselectDialog.vue.d.ts +3 -9
  37. package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
  38. package/dist/components/FmUnitInputRules.d.ts +2 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
  40. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  41. package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
  42. package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
  43. package/dist/{decimal-BZ7tX47r.js → decimal-C8O2p3Sg.js} +1 -1
  44. package/dist/defineDeepModel-BXP1vLGf.js +13 -0
  45. package/dist/extensions/array.d.ts +1 -0
  46. package/dist/format-time-from-id-DgW7OJL_.js +15 -0
  47. package/dist/format-unit-display-BP4O0Pym.js +1195 -0
  48. package/dist/helper/rules.d.ts +7 -0
  49. package/dist/helper/rules.spec.d.ts +1 -0
  50. package/dist/helper/xlsx.util.d.ts +7 -0
  51. package/dist/router/name.d.ts +1 -0
  52. package/dist/stores/api.d.ts +1 -0
  53. package/dist/stores/feature.d.ts +0 -1
  54. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  55. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  56. package/dist/stores/integration/foodmarkethub.d.ts +391 -0
  57. package/dist/stores/integration/index.d.ts +7 -0
  58. package/dist/stores/integration/netsuite.d.ts +102 -0
  59. package/dist/stores/inventory.d.ts +294 -9
  60. package/dist/stores/location.d.ts +508 -503
  61. package/dist/stores/supplier.d.ts +124 -4
  62. package/dist/style.css +1 -1
  63. package/dist/supplier-D-8XhuF_.js +77 -0
  64. package/dist/tsconfig.app.tsbuildinfo +1 -1
  65. package/dist/use-template-enabled-locations-2-C2E4j3k-.js +85 -0
  66. package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
  67. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  68. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  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 +877 -1038
  71. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +882 -1049
  72. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  73. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
  74. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
  75. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
  76. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
  77. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
  78. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
  79. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
  80. package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
  81. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
  82. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
  83. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
  85. package/dist/views/integration/FoodMarketHub.vue.d.ts +2 -0
  86. package/dist/views/integration/NetSuite.vue.d.ts +2 -0
  87. package/dist/views/integration/components/ApplyProductDialog.vue.d.ts +7 -7
  88. package/dist/views/integration/components/ApplyProductDialogV4.vue.d.ts +7 -7
  89. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  90. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +49 -0
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1961 -87
  92. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  93. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
  94. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
  95. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2377 -292
  96. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2329 -244
  97. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
  98. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  99. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  100. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +32 -2
  101. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  102. package/dist/views/supplier/components/supplier-import/SupplierImport.vue.d.ts +2 -0
  103. package/dist/views/supplier/components/supplier-import/SupplierImportItem.vue.d.ts +12 -0
  104. package/dist/views/supplier/components/supplier-import/SupplierImportItemProps.d.ts +6 -0
  105. package/dist/views/supplier/composables/use-supplier-actions.d.ts +10 -0
  106. package/dist/views/supplier/helpers/import-export.helper.d.ts +50 -0
  107. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  108. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  109. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  110. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  111. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  112. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
  113. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  114. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  115. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  116. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1277 -1478
  117. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1697 -906
  118. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  119. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -247
  120. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  121. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  122. package/dist/{xlsx-BtP1Qjj6.js → xlsx-Dsy-fxZw.js} +1525 -1525
  123. package/dist/xlsx.util-CxGmvsp9.js +78 -0
  124. package/package.json +10 -7
  125. package/dist/ApprovalView-BdaNwUBc.js +0 -129
  126. package/dist/ClosingTemplateView-BpErgepi.js +0 -1030
  127. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D3B7kOlU.js +0 -372
  128. package/dist/IngredientsView-GqrkpCm5.js +0 -1758
  129. package/dist/IntegrationView-7c3MpUzS.js +0 -1141
  130. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BIwdObb1.js +0 -88
  131. package/dist/ReceiveRequestView-BAuXvzQW.js +0 -215
  132. package/dist/RecipeView-C6tZPQ-K.js +0 -581
  133. package/dist/StockView-4uXHYz4E.js +0 -1892
  134. package/dist/SupplierView-CuWvKCWY.js +0 -827
  135. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CTQ9HIqf.js +0 -740
  136. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang--6JoXOLD.js +0 -1409
  137. package/dist/TransferTemplateView-D1Lfi3aW.js +0 -1230
  138. package/dist/defineDeepModel-BKAs9qN6.js +0 -13
  139. package/dist/format-time-from-id-B7ZE4sdX.js +0 -15
  140. package/dist/id-to-date-D1lOqIir.js +0 -30
  141. package/dist/purchase-order-transaction-type-tZ7cj1dz.js +0 -702
  142. package/dist/supplier-BIDBk5S6.js +0 -69
  143. package/dist/use-template-enabled-locations-DlMnS9WJ.js +0 -57
  144. package/dist/xlsx.util-BKFiH-ig.js +0 -109
@@ -0,0 +1,1150 @@
1
+ import { ref as L, computed as J, h as ce, defineComponent as Ue, resolveComponent as X, openBlock as h, createBlock as z, unref as l, isRef as Le, withCtx as ie, createElementVNode as e, createVNode as W, createElementBlock as x, Fragment as ee, toDisplayString as b, normalizeClass as ue, createCommentVNode as N, renderList as de } from "vue";
2
+ import { i as je } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BpzreBHD.js";
3
+ import { o as Be, i as fe, ap as R, O as Ke, P as Ve, aq as Ge, c as Ae, ab as M, x as qe, b as Pe, B as Ne, m as be, a as le, ar as Ce, W as He, N as ze, G as Ye, Y as De } from "./app-B4pi48sM.js";
4
+ import { F as ke, D as C, R as A } from "./row-action.enum-PMKMRrZR.js";
5
+ import { useDialog as Te, useSnackbar as Ee, useProxiedModel as Qe } from "@feedmepos/ui-library";
6
+ import { p as We, f as pe } from "./format-time-from-id-DgW7OJL_.js";
7
+ import { b as Je, u as Xe, f as $e, P as me } from "./format-unit-display-BP4O0Pym.js";
8
+ import { c as xe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
+ import { F as Ze } from "./decimal-C8O2p3Sg.js";
10
+ import { useI18n as Fe } from "@feedmepos/mf-common";
11
+ import { E as et } from "./empty-placeholder-wf6-BWE8.js";
12
+ const Ie = Be((u, w) => {
13
+ const p = fe();
14
+ return {
15
+ async readRequests(s) {
16
+ const S = s ?? p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-request`;
17
+ return await w.get(O);
18
+ },
19
+ async getPurchaseOrders({
20
+ start: s,
21
+ end: S
22
+ }) {
23
+ const O = p.currentLocationDBName, T = `${u.inventoryBackendUrl}/${O}/purchase-order`;
24
+ return await w.get(`${T}?start=${s}&end=${S}`);
25
+ },
26
+ async getPurchaseOrderById(s) {
27
+ const S = p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-order`;
28
+ return await w.get(`${O}/${s}`);
29
+ },
30
+ async processPurchaseOrder(s, S) {
31
+ const O = p.currentLocationDBName, T = S || O, F = `${u.inventoryBackendUrl}/${T}/purchase-order/run-operation`;
32
+ return await w.put(F, s);
33
+ },
34
+ async createPurchaseOrder(s) {
35
+ const S = p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-order`;
36
+ return await w.post(O, s);
37
+ },
38
+ async updatePurchaseOrder(s) {
39
+ const S = p.currentLocationDBName, O = `${u.inventoryBackendUrl}/${S}/purchase-order`;
40
+ return await w.put(O, s);
41
+ }
42
+ };
43
+ }), Me = {
44
+ [R.enum.confirmDraft]: {
45
+ primaryActions: {
46
+ text: "Confirm draft",
47
+ close: !0
48
+ },
49
+ title: "Confirm draft?",
50
+ message: "Purchase order cannot be changed after confirm draft.",
51
+ successMessage: "Purchase order draft has been confirmed"
52
+ },
53
+ [R.enum.cancelDraft]: {
54
+ primaryActions: {
55
+ text: "Cancel draft",
56
+ close: !0,
57
+ variant: "destructive"
58
+ },
59
+ title: "Cancel draft?",
60
+ message: "Purchase order cannot be changed after cancelled draft.",
61
+ successMessage: "Purchase order draft has been cancelled"
62
+ },
63
+ [R.enum.submitRequest]: {
64
+ primaryActions: {
65
+ text: "Submit request",
66
+ close: !0
67
+ },
68
+ title: "Confirm draft?",
69
+ message: "Purchase order cannot be changed after confirm draft.",
70
+ successMessage: "Purchase order draft has been submitted"
71
+ },
72
+ [R.enum.completeReceive]: {
73
+ primaryActions: {
74
+ text: "Mark received",
75
+ close: !0
76
+ },
77
+ title: "Mark as received",
78
+ message: "Purchase order cannot be changed after it has complete receiving.",
79
+ successMessage: "Purchase order has been marked as received"
80
+ },
81
+ [R.enum.approveRequest]: {
82
+ primaryActions: {
83
+ text: "Approve request",
84
+ close: !0
85
+ },
86
+ title: "Approve request?",
87
+ message: "Purchase order will be approved.",
88
+ successMessage: "Purchase order has been approved"
89
+ },
90
+ [R.enum.rejectRequest]: {
91
+ primaryActions: {
92
+ text: "Reject request",
93
+ close: !0,
94
+ variant: "destructive"
95
+ },
96
+ title: "Reject request?",
97
+ message: "Purchase order will be rejected.",
98
+ successMessage: "Purchase order has been rejected"
99
+ }
100
+ }, oe = L();
101
+ function Rr(u, w) {
102
+ const p = Te(), s = fe(), S = Pe(), O = Je(), T = Xe(), F = L(!1), i = Ee(), U = Ie(), c = L(new Array()), d = L(
103
+ w != null && w.startDate && (w != null && w.endDate) ? w : je()
104
+ ), m = J(() => {
105
+ const t = new Date(d.value.startDate), o = new Date(d.value.endDate);
106
+ return {
107
+ start: Ke(t).toISOString(),
108
+ end: Ve(o).toISOString()
109
+ };
110
+ }), f = L(new Array()), j = Ge(), Y = L(null);
111
+ async function re(t) {
112
+ let o;
113
+ if (S.mustUsePoTemplate && !(t != null && t.template) && (o = await O.getTemplateId(), !o))
114
+ return;
115
+ const g = {
116
+ mode: ke.CREATE,
117
+ modelValue: t || void 0,
118
+ show: !0,
119
+ "onUpdate:show"(_) {
120
+ oe.value.show = _;
121
+ },
122
+ templateId: o,
123
+ lastClosingDate: Y.value
124
+ };
125
+ oe.value = g;
126
+ }
127
+ function ve(t) {
128
+ const o = {
129
+ mode: ke.UPDATE,
130
+ modelValue: Ae(t),
131
+ show: !0,
132
+ "onUpdate:show"(g) {
133
+ oe.value.show = g;
134
+ },
135
+ lastClosingDate: Y.value
136
+ };
137
+ oe.value = o;
138
+ }
139
+ async function G() {
140
+ c.value = [], F.value = !0;
141
+ try {
142
+ c.value = await U.getPurchaseOrders(m.value).then((g) => g.sort((_, n) => n._id.localeCompare(_._id)));
143
+ const t = await j.readLastClosing(!0), o = t == null ? void 0 : t._id;
144
+ o && (Y.value = We(o)), S.mustUsePoTemplate && await T.fetchTemplates();
145
+ } catch {
146
+ i.open({
147
+ title: "Something went wrong",
148
+ message: "Error at fetching purchase orders",
149
+ type: "error"
150
+ });
151
+ } finally {
152
+ F.value = !1;
153
+ }
154
+ }
155
+ async function ye() {
156
+ f.value = [], F.value = !0;
157
+ try {
158
+ f.value = await U.readRequests().then((t) => t.reverse());
159
+ } catch {
160
+ i.open({
161
+ title: "Something went wrong",
162
+ message: "Error at fetching purchase requests",
163
+ type: "error"
164
+ });
165
+ } finally {
166
+ F.value = !1;
167
+ }
168
+ }
169
+ function Z() {
170
+ switch (u) {
171
+ case "receive/request":
172
+ return G();
173
+ case "approval":
174
+ return ye();
175
+ }
176
+ }
177
+ function he(t, o) {
178
+ d.value = {
179
+ startDate: t,
180
+ endDate: o
181
+ }, Z();
182
+ }
183
+ s.watchLocation(async (t) => {
184
+ if (!t) {
185
+ c.value = [];
186
+ return;
187
+ }
188
+ await Z();
189
+ });
190
+ const Q = L(), H = L(Math.random().toString());
191
+ async function a(t, o) {
192
+ var v, q;
193
+ const g = Math.random().toString();
194
+ H.value = g;
195
+ const _ = u === "receive/request" ? s.currentLocation : o == null ? void 0 : o.to, n = {
196
+ poRequest: o,
197
+ purchaseOrder: t,
198
+ transferTo: _ == null ? void 0 : _.name,
199
+ transferToDbName: _ == null ? void 0 : _.dbName,
200
+ show: !0,
201
+ canResubmit: !1,
202
+ canApprove: u === "approval",
203
+ "onUpdate:show"(I) {
204
+ Q.value.show = I;
205
+ }
206
+ };
207
+ if (Q.value = n, !(o || t.status !== M.enum.REQUESTING)) {
208
+ try {
209
+ o = (await U.readRequests(
210
+ `${t.supplier.internal}_${t.supplier._id}`
211
+ )).find((D) => D.purchaseOrderId === t._id);
212
+ } catch {
213
+ console.error("Error at fetching po request to check");
214
+ }
215
+ g === H.value && (Q.value.canResubmit = !o, Q.value.transferTo = (v = o == null ? void 0 : o.to) == null ? void 0 : v.name, Q.value.transferToDbName = (q = o == null ? void 0 : o.to) == null ? void 0 : q.dbName);
216
+ }
217
+ }
218
+ async function r(t, o, g, _) {
219
+ F.value = !0;
220
+ try {
221
+ await U.processPurchaseOrder(
222
+ {
223
+ operation: o,
224
+ doc: t,
225
+ options: (
226
+ // auto receive for supplier to warehouse
227
+ (o === R.enum.confirmDraft || // auto receive for warehouse to warehouse
228
+ o === R.enum.completeReceive) && S.autoReceiveWarehouse ? {
229
+ autoReceive: !0
230
+ } : void 0
231
+ )
232
+ },
233
+ _
234
+ ), await new Promise((q) => setTimeout(q, 1e3));
235
+ const v = fe().currentLocationDBName.startsWith("restaurant_");
236
+ o === R.enum.confirmDraft && t.effectiveAt && v ? i.open({
237
+ title: "Success",
238
+ message: `${g}. The backdate will be reflected once your POS has received this change.`,
239
+ type: "success"
240
+ }) : i.open({
241
+ title: "Success",
242
+ message: g,
243
+ type: "success"
244
+ });
245
+ } catch (n) {
246
+ i.open({
247
+ title: "Something went wrong",
248
+ message: "Please try again.",
249
+ type: "error"
250
+ }), console.error("Error when submitting PO operation", o, t, n);
251
+ } finally {
252
+ F.value = !1, Z();
253
+ }
254
+ }
255
+ async function k(t, o, g) {
256
+ const _ = Me[o];
257
+ if (!_) {
258
+ i.open({
259
+ title: "Something went wrong",
260
+ message: `Cannot process order: ${qe(o)}`,
261
+ type: "error"
262
+ });
263
+ return;
264
+ }
265
+ const { successMessage: n, ...v } = _;
266
+ p.open({
267
+ title: v.title,
268
+ message: v.message,
269
+ primaryActions: v.primaryActions
270
+ }).onPrimary(() => {
271
+ r(t, o, n, g);
272
+ });
273
+ }
274
+ return {
275
+ purchaseOrders: c,
276
+ purchaseRequests: f,
277
+ updateDateRange: he,
278
+ fetchData: Z,
279
+ loading: F,
280
+ transferDialogProps: oe,
281
+ promptCreateTransferDialog: re,
282
+ promptUpdateTransferDialog: ve,
283
+ transferDetailsProps: Q,
284
+ promptShowTransferDetails: a,
285
+ submitAction: k
286
+ };
287
+ }
288
+ function tt(u, w) {
289
+ return w.reduce(
290
+ (s, S) => {
291
+ const O = S.received.find((T) => T.sku._id === u._id);
292
+ return O && (s = Ne(s, O.amount)), s;
293
+ },
294
+ Ze.toPrecision(be(0), u.unit.precision)
295
+ );
296
+ }
297
+ function rt(u, w) {
298
+ const { name: p, address: s, regNo: S } = w.doc.profile, O = {
299
+ name: p,
300
+ registrationNumber: S,
301
+ line1: s == null ? void 0 : s.line1,
302
+ line2: s == null ? void 0 : s.line2,
303
+ postcode: s == null ? void 0 : s.postcode,
304
+ city: s == null ? void 0 : s.city,
305
+ state: s == null ? void 0 : s.state,
306
+ country: s == null ? void 0 : s.country
307
+ }, T = {
308
+ name: u.supplier.name,
309
+ registrationNumber: u.supplier.registrationNumber,
310
+ line1: u.supplier.address.line1,
311
+ line2: u.supplier.address.line2,
312
+ postcode: u.supplier.address.postcode,
313
+ city: u.supplier.address.city,
314
+ state: u.supplier.address.state,
315
+ country: u.supplier.address.country
316
+ }, F = u.items.map((d) => {
317
+ const { sku: m, measurement: f } = d, j = le(
318
+ tt(d.sku, u.deliveryOrder || []),
319
+ !1
320
+ );
321
+ return {
322
+ code: m.code,
323
+ description: m.name,
324
+ quantity: $e(d.quantity, m.unit, d.measurement),
325
+ unit: (f == null ? void 0 : f.abbrev) || m.unit.abbrev,
326
+ received: j
327
+ };
328
+ }), i = u.deliveryOrder.map((d) => ({
329
+ createdAt: Ce(new Date(d.createdAt)),
330
+ ref: d.deliveryOrderNumber,
331
+ remark: d.remark || "",
332
+ items: d.received.map((m) => {
333
+ var f;
334
+ return {
335
+ code: m.sku.code,
336
+ description: m.sku.name,
337
+ quantity: le(m.amount),
338
+ unit: ((f = m.measurement) == null ? void 0 : f.abbrev) || m.sku.unit.abbrev
339
+ };
340
+ })
341
+ })), U = {
342
+ orderNumber: u.seqNumber.toString(),
343
+ createdAt: pe(u._id),
344
+ ref: u.ref || "",
345
+ remark: u.remark || "",
346
+ buyer: O,
347
+ supplier: T,
348
+ items: F,
349
+ status: u.status,
350
+ deliveryOrders: i
351
+ }, c = new URL(window.location.href);
352
+ c.pathname = c.hostname.includes("inventory.feedme") ? "/receive-request/print-preview" : "/inventory/receive-request/print-preview", c.searchParams.append("data", JSON.stringify(U)), window.open(c.href, "_blank", "noreferrer");
353
+ }
354
+ const te = {
355
+ submitRequest: {
356
+ translationKey: "inventory.transfer.receiveRequest.actions.submitRequest",
357
+ color: "text-fm-color-typo-primary",
358
+ value: R.enum.submitRequest
359
+ },
360
+ confirmDraft: {
361
+ translationKey: "inventory.transfer.receiveRequest.actions.confirmDraft",
362
+ color: "text-fm-color-typo-primary",
363
+ value: R.enum.confirmDraft
364
+ },
365
+ cancelDraft: {
366
+ translationKey: "inventory.transfer.receiveRequest.actions.cancelDraft",
367
+ color: "text-fm-color-typo-error",
368
+ value: R.enum.cancelDraft
369
+ },
370
+ approveRequest: {
371
+ translationKey: "inventory.transfer.receiveRequest.actions.approveRequest",
372
+ color: "text-fm-color-typo-primary",
373
+ value: R.enum.approveRequest
374
+ },
375
+ rejectRequest: {
376
+ translationKey: "inventory.transfer.receiveRequest.actions.rejectRequest",
377
+ color: "text-fm-color-typo-error",
378
+ value: R.enum.rejectRequest
379
+ },
380
+ processRequest: {
381
+ translationKey: "inventory.transfer.receiveRequest.actions.processRequest",
382
+ color: "text-fm-color-typo-primary",
383
+ value: R.enum.processRequest
384
+ },
385
+ receiveStock: {
386
+ translationKey: "inventory.transfer.receiveRequest.actions.receiveStock",
387
+ color: "text-fm-color-typo-primary",
388
+ value: R.enum.receiveStock
389
+ },
390
+ completeReceive: {
391
+ translationKey: "inventory.transfer.receiveRequest.actions.completeReceive",
392
+ color: "text-fm-color-typo-primary",
393
+ value: R.enum.completeReceive
394
+ }
395
+ };
396
+ function Sr(u, w) {
397
+ const p = fe(), { t: s } = Fe();
398
+ function S(c) {
399
+ switch (c.status) {
400
+ case "DRAFT":
401
+ return [
402
+ c.supplier.internal === "restaurant" || c.supplier.internal === "warehouse" ? te[R.enum.submitRequest] : te[R.enum.confirmDraft],
403
+ te[R.enum.cancelDraft],
404
+ C[A.Update],
405
+ C[A.Details],
406
+ C[A.Print]
407
+ ];
408
+ case "RECEIVING":
409
+ return [
410
+ te[R.enum.completeReceive],
411
+ C[A.Update],
412
+ C[A.Details],
413
+ C[A.Print]
414
+ ];
415
+ case "REQUESTING":
416
+ return u === "receive/request" ? [
417
+ C[A.Update],
418
+ C[A.Details],
419
+ C[A.Print]
420
+ ] : [
421
+ te[R.enum.approveRequest],
422
+ te[R.enum.rejectRequest],
423
+ C[A.Details],
424
+ C[A.Print]
425
+ ];
426
+ case "PROCESSING":
427
+ return [C[A.Details], C[A.Print]];
428
+ case "COMPLETE":
429
+ return [
430
+ C[A.Update],
431
+ C[A.Details],
432
+ C[A.Print]
433
+ ];
434
+ case "CANCEL":
435
+ default:
436
+ return [C[A.Details], C[A.Print]];
437
+ }
438
+ }
439
+ function O(c) {
440
+ return Object.values(R.enum).includes(c);
441
+ }
442
+ async function T(c, d, m) {
443
+ var j, Y;
444
+ const f = Ae(d);
445
+ if (c === A.Print) {
446
+ rt(f, p.currentLocation);
447
+ return;
448
+ }
449
+ if (c === A.Details) {
450
+ w.promptShowTransferDetails(f, m);
451
+ return;
452
+ }
453
+ if (c === A.Update) {
454
+ (j = w.promptUpdateTransferDialog) == null || j.call(w, f);
455
+ return;
456
+ }
457
+ if (O(c)) {
458
+ w.submitAction(d, c, (Y = m == null ? void 0 : m.to) == null ? void 0 : Y.dbName);
459
+ return;
460
+ }
461
+ }
462
+ function F() {
463
+ return [
464
+ {
465
+ accessorKey: "seqNumber",
466
+ header: () => s("inventory.transfer.table.seqNo"),
467
+ enableSorting: !0,
468
+ size: 80,
469
+ sortUndefined: "last"
470
+ },
471
+ {
472
+ accessorKey: "_id",
473
+ header: () => s("inventory.transfer.table.createdAt"),
474
+ cell(c) {
475
+ return pe(`${c.getValue()}`);
476
+ },
477
+ enableSorting: !0
478
+ },
479
+ {
480
+ accessorKey: "supplier.name",
481
+ header: () => s("inventory.transfer.table.transferFrom"),
482
+ enableSorting: !0,
483
+ size: 200
484
+ },
485
+ {
486
+ accessorKey: "items.length",
487
+ header: () => s("inventory.transfer.table.noOfItems"),
488
+ enableSorting: !1,
489
+ meta: {
490
+ width: "10rem"
491
+ }
492
+ },
493
+ {
494
+ accessorKey: "ref",
495
+ header: () => s("inventory.transfer.table.reference"),
496
+ enableSorting: !1,
497
+ size: "auto"
498
+ },
499
+ {
500
+ accessorKey: "status",
501
+ header: () => s("inventory.transfer.table.status"),
502
+ cell(c) {
503
+ const d = s(`inventory.transfer.status.${c.getValue() ?? ""}`), m = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
504
+ return ce(
505
+ "div",
506
+ {
507
+ class: "flex"
508
+ },
509
+ ce(
510
+ "div",
511
+ {
512
+ class: `fm-status-badge fm-status-badge-${m}`
513
+ },
514
+ d
515
+ )
516
+ );
517
+ },
518
+ enableSorting: !0,
519
+ size: 200
520
+ },
521
+ {
522
+ id: "action",
523
+ cell(c) {
524
+ const d = c.row.original, m = S(d);
525
+ return xe(m, (f) => T(f, d));
526
+ },
527
+ enableSorting: !1,
528
+ size: 40,
529
+ meta: {
530
+ cellClass: "",
531
+ headerClass: ""
532
+ }
533
+ }
534
+ ];
535
+ }
536
+ function i() {
537
+ return [
538
+ {
539
+ accessorKey: "purchaseOrder.seqNumber",
540
+ header: () => s("inventory.transfer.table.seqNo"),
541
+ enableSorting: !0,
542
+ size: 80,
543
+ sortUndefined: "last"
544
+ },
545
+ {
546
+ accessorKey: "purchaseOrder._id",
547
+ header: () => s("inventory.transfer.table.createdAt"),
548
+ cell(c) {
549
+ return pe(`${c.getValue()}`);
550
+ },
551
+ enableSorting: !0
552
+ },
553
+ {
554
+ accessorKey: "to.name",
555
+ header: () => s("inventory.transfer.table.transferTo"),
556
+ enableSorting: !1,
557
+ size: 200
558
+ },
559
+ {
560
+ accessorKey: "purchaseOrder.items.length",
561
+ header: () => s("inventory.transfer.table.noOfItems"),
562
+ enableSorting: !1
563
+ },
564
+ {
565
+ accessorKey: "purchaseOrder.ref",
566
+ header: () => s("inventory.transfer.table.reference"),
567
+ enableSorting: !1,
568
+ size: "auto"
569
+ },
570
+ {
571
+ accessorKey: "purchaseOrder.status",
572
+ header: () => s("inventory.transfer.table.status"),
573
+ cell(c) {
574
+ const d = s(`inventory.transfer.status.${c.getValue() ?? ""}`), m = `${c.getValue() ?? ""}`.toLocaleLowerCase("en-us");
575
+ return ce(
576
+ "div",
577
+ {
578
+ class: "flex"
579
+ },
580
+ ce(
581
+ "div",
582
+ {
583
+ class: `fm-status-badge fm-status-badge-${m}`
584
+ },
585
+ d
586
+ )
587
+ );
588
+ },
589
+ enableSorting: !0
590
+ },
591
+ {
592
+ id: "action",
593
+ cell(c) {
594
+ const d = c.row.original, m = d.purchaseOrder ? S(d.purchaseOrder) : [];
595
+ return xe(
596
+ m,
597
+ (f) => d.purchaseOrder ? T(f, d.purchaseOrder, d) : void 0
598
+ );
599
+ },
600
+ enableSorting: !1,
601
+ size: 40,
602
+ meta: {
603
+ cellClass: "",
604
+ headerClass: ""
605
+ }
606
+ }
607
+ ];
608
+ }
609
+ const U = J(() => u === "receive/request" ? F() : i());
610
+ return {
611
+ get columnDefs() {
612
+ return U.value;
613
+ }
614
+ };
615
+ }
616
+ const st = { class: "flex flex-col gap-16 w-full h-full" }, at = { class: "flex justify-between" }, nt = { class: "fm-typo-en-body-lg-600" }, ot = { class: "flex flex-col gap-8" }, lt = { class: "flex flex-col gap-4" }, ct = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, it = { class: "flex gap-1" }, ut = { class: "fm-typo-en-body-lg-600" }, dt = {
617
+ key: 0,
618
+ class: "flex flex-col gap-4"
619
+ }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ft = { class: "fm-typo-en-body-lg-600" }, pt = { class: "flex flex-col gap-4" }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yt = { class: "fm-typo-en-body-lg-600" }, ht = {
620
+ key: 1,
621
+ class: "flex flex-col gap-4"
622
+ }, bt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "fm-typo-en-body-lg-600" }, _t = {
623
+ key: 2,
624
+ class: "flex flex-col gap-4"
625
+ }, wt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rt = { class: "fm-typo-en-body-lg-600" }, St = {
626
+ key: 3,
627
+ class: "flex flex-col gap-4"
628
+ }, Ot = { class: "fm-typo-en-body-lg-600" }, Dt = {
629
+ key: 4,
630
+ class: "flex flex-col gap-4"
631
+ }, kt = { class: "fm-typo-en-body-lg-600" }, xt = {
632
+ key: 5,
633
+ class: "flex flex-col gap-4"
634
+ }, At = { class: "fm-typo-en-body-lg-600" }, qt = {
635
+ key: 6,
636
+ class: "flex flex-col gap-4"
637
+ }, Pt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Nt = { class: "fm-typo-en-body-lg-600" }, Ct = {
638
+ key: 7,
639
+ class: "flex flex-col gap-4"
640
+ }, Tt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-lg-600" }, $t = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Ft = { class: "flex flex-col gap-8" }, It = { class: "fm-typo-en-body-lg-600" }, Mt = { class: "flex w-full gap-4" }, Ut = { class: "basis-1/2 shrink-0 grow fm-typo-en-body-lg-400 line-clamp-2" }, Lt = { class: "fm-typo-en-body-lg-600 line-clamp-2" }, jt = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, Bt = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-1" }, Kt = {
641
+ key: 0,
642
+ class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
643
+ }, Vt = {
644
+ key: 1,
645
+ class: "flex-1 xs:w-screen xs:max-w-full"
646
+ }, Gt = {
647
+ key: 0,
648
+ class: "flex flex-col items-center gap-8 h-full"
649
+ }, Ht = ["src"], zt = { class: "fm-typo-en-body-lg-600" }, Yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary px-16" }, Qt = {
650
+ key: 1,
651
+ class: "px-4 flex flex-col"
652
+ }, Wt = { class: "flex gap-12 content-stretch" }, Jt = {
653
+ class: "flex flex-col w-24",
654
+ name: "circles"
655
+ }, Xt = { class: "flex-1 flex flex-col items-center" }, Zt = { class: "flex-1 flex flex-col items-center" }, er = {
656
+ class: "py-12 flex flex-col gap-4",
657
+ name: "received-at header"
658
+ }, tr = { class: "fm-typo-en-body-lg-400" }, rr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, sr = { class: "flex gap-12 content-stretch" }, ar = {
659
+ class: "flex flex-col w-24",
660
+ name: "circles"
661
+ }, nr = { class: "flex-1 flex flex-col items-center" }, or = {
662
+ class: "py-12 flex flex-col gap-4 flex-1",
663
+ name: "delivery details"
664
+ }, lr = { class: "flex flex-col gap-8" }, cr = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ir = { class: "flex flex-col gap-4" }, ur = { class: "flex gap-8 xs:flex-col" }, Or = /* @__PURE__ */ Ue({
665
+ __name: "TransferDetails",
666
+ props: {
667
+ poRequest: {},
668
+ purchaseOrder: {},
669
+ transferTo: {},
670
+ transferToDbName: {},
671
+ show: { type: Boolean },
672
+ canResubmit: { type: Boolean },
673
+ canApprove: { type: Boolean }
674
+ },
675
+ emits: ["update:show", "submitted"],
676
+ setup(u, { emit: w }) {
677
+ const p = u, s = w, S = Te(), O = Ee(), T = He(), F = Pe(), { t: i } = Fe(), U = J(
678
+ () => {
679
+ var a, r, k, t;
680
+ return ((r = (a = p.purchaseOrder) == null ? void 0 : a.supplier) == null ? void 0 : r.internal) === "restaurant" || ((t = (k = p.purchaseOrder) == null ? void 0 : k.supplier) == null ? void 0 : t.internal) === "warehouse" ? me.TRANSFER : me.PURCHASE;
681
+ }
682
+ ), c = [
683
+ {
684
+ label: i("inventory.transfer.receiveRequest.details.overview"),
685
+ value: "overview"
686
+ },
687
+ {
688
+ label: i("inventory.transfer.receiveRequest.details.deliveryHistory"),
689
+ value: "deliveryHistory"
690
+ }
691
+ ], d = L(c[0]), m = L(!1), f = L(""), j = L(!0), Y = Ie(), re = Qe(p, "show");
692
+ async function ve(a, r, k) {
693
+ f.value = r, m.value = !0, j.value = !1;
694
+ try {
695
+ await Y.processPurchaseOrder(
696
+ {
697
+ operation: r,
698
+ doc: a,
699
+ options: (
700
+ // auto receive for supplier to warehouse
701
+ (r === R.enum.confirmDraft || // auto receive for warehouse to warehouse
702
+ r === R.enum.completeReceive) && F.autoReceiveWarehouse ? {
703
+ autoReceive: !0
704
+ } : void 0
705
+ )
706
+ },
707
+ p.transferToDbName
708
+ ), await new Promise((t) => setTimeout(t, 1e3)), O.open({
709
+ title: "Success",
710
+ message: k,
711
+ type: "success"
712
+ }), s("update:show", !1), s("submitted");
713
+ } catch (t) {
714
+ O.open({
715
+ title: "Something went wrong",
716
+ message: "Please try again.",
717
+ type: "error"
718
+ }), console.error("Error when submitting PO operation", r, a, t);
719
+ } finally {
720
+ f.value = "", m.value = !1, j.value = !0;
721
+ }
722
+ }
723
+ async function G(a) {
724
+ const r = Me[a];
725
+ if (!r) {
726
+ O.open({
727
+ title: "Something went wrong",
728
+ message: `Cannot process order: ${qe(a)}`,
729
+ type: "error"
730
+ });
731
+ return;
732
+ }
733
+ const { successMessage: k, ...t } = r;
734
+ S.open({
735
+ title: t.title,
736
+ message: t.message,
737
+ primaryActions: t.primaryActions
738
+ }).onPrimary(() => {
739
+ p.purchaseOrder && ve(p.purchaseOrder, a, k);
740
+ });
741
+ }
742
+ const ye = J(() => {
743
+ var a, r;
744
+ return ((a = p.purchaseOrder) == null ? void 0 : a.status) === M.enum.RECEIVING || ((r = p.purchaseOrder) == null ? void 0 : r.status) === M.enum.COMPLETE;
745
+ }), Z = J(
746
+ () => {
747
+ var a, r, k, t, o, g;
748
+ return T.getLocationSubsidiary(
749
+ ((k = (r = (a = p.purchaseOrder) == null ? void 0 : a.netSuite) == null ? void 0 : r.subsidiary) == null ? void 0 : k.id) || ((g = (o = (t = p.poRequest) == null ? void 0 : t.netSuite) == null ? void 0 : o.subsidiary) == null ? void 0 : g.id)
750
+ ).fullName;
751
+ }
752
+ ), he = J(() => {
753
+ var a, r, k, t, o, g;
754
+ return (r = (a = p.purchaseOrder) == null ? void 0 : a.deliveryFullfillment) != null && r.length && ((t = (k = p.purchaseOrder) == null ? void 0 : k.deliveryFullfillment) == null ? void 0 : t.length) > 0 ? (g = (o = p.purchaseOrder) == null ? void 0 : o.deliveryFullfillment) == null ? void 0 : g.map((_) => {
755
+ var n;
756
+ return (n = _.netSuite) == null ? void 0 : n.refNo;
757
+ }).join(", ") : "-";
758
+ }), Q = J(() => {
759
+ var g, _, n;
760
+ const k = (((g = p.purchaseOrder) == null ? void 0 : g.deliveryOrder) ?? []).flatMap((v) => v.received ?? []).reduce(
761
+ (v, q) => {
762
+ const I = v[q.sku._id] ?? [];
763
+ return v[q.sku._id] = [...I, q], v;
764
+ },
765
+ {}
766
+ ), t = Object.entries(k).reduce(
767
+ (v, [q, I]) => {
768
+ const D = I.reduce((y, P) => {
769
+ const E = ze(
770
+ y,
771
+ Math.max(y.precision, P.amount.precision)
772
+ );
773
+ return Ne(E, P.amount);
774
+ }, be(0));
775
+ return v[q] = D, v;
776
+ },
777
+ {}
778
+ ), o = ((_ = p.purchaseOrder) == null ? void 0 : _.items) ?? [];
779
+ for (const v of o)
780
+ t[n = v.sku._id] ?? (t[n] = be(0));
781
+ return t;
782
+ }), H = J(() => {
783
+ var g, _;
784
+ const a = ((g = p.purchaseOrder) == null ? void 0 : g.deliveryOrder) ?? [], r = ((_ = p.purchaseOrder) == null ? void 0 : _.deliveryFullfillment) ?? [], k = [
785
+ ...a.map((n) => ({
786
+ createdAt: n.createdAt,
787
+ type: "grn",
788
+ doc: n
789
+ })),
790
+ ...r.map((n) => ({
791
+ createdAt: n.createdAt,
792
+ type: "fulfillment",
793
+ doc: n
794
+ }))
795
+ ];
796
+ k.reverse().sort((n, v) => n.createdAt.localeCompare(v.createdAt));
797
+ function t(n) {
798
+ var q, I, D, y, P, E, B;
799
+ const v = r.findIndex(($) => $.id === n.fullfillmentId);
800
+ return {
801
+ header: "Received",
802
+ date: De(new Date(n.createdAt)),
803
+ info: [
804
+ {
805
+ label: "Received by",
806
+ values: [(q = n.createdBy) == null ? void 0 : q.name]
807
+ },
808
+ {
809
+ label: "Received items",
810
+ values: n.received.map(($) => {
811
+ var K;
812
+ return `(${$.sku.code}) ${$.sku.name}: ${le($.amount, !1)} ${((K = $.measurement) == null ? void 0 : K.abbrev) ?? $.sku.unit.abbrev}`;
813
+ })
814
+ },
815
+ n.deliveryOrderNumber ? {
816
+ label: "Delivery order no.",
817
+ values: [n.deliveryOrderNumber]
818
+ } : null,
819
+ n.remark ? {
820
+ label: "Remark",
821
+ values: [n.remark]
822
+ } : null,
823
+ v > -1 ? {
824
+ label: "Fulfilment's sequence",
825
+ values: [`${v + 1}`]
826
+ } : null,
827
+ (D = (I = r[v]) == null ? void 0 : I.netSuite) != null && D.refNo ? {
828
+ label: "Fulfillment's ref no. (Netsuite)",
829
+ values: [(P = (y = r[v]) == null ? void 0 : y.netSuite) == null ? void 0 : P.refNo]
830
+ } : null,
831
+ (E = n == null ? void 0 : n.netSuite) != null && E.refNo ? {
832
+ label: "Item receipt (Netsuite)",
833
+ values: [(B = n == null ? void 0 : n.netSuite) == null ? void 0 : B.refNo]
834
+ } : null
835
+ ].filter(($) => $)
836
+ };
837
+ }
838
+ function o(n) {
839
+ var q, I;
840
+ const v = r.findIndex((D) => D.id === n.id);
841
+ return {
842
+ header: "Fulfillment",
843
+ date: De(new Date(n.createdAt)),
844
+ info: [
845
+ {
846
+ label: "Sequence",
847
+ values: [String(v + 1)]
848
+ },
849
+ {
850
+ label: "Receiveable items",
851
+ values: n.items.map((D) => {
852
+ var y;
853
+ return `(${D.sku.code}) ${D.sku.name}: ${le(D.amount, !1)} ${((y = D.measurement) == null ? void 0 : y.abbrev) ?? D.sku.unit.abbrev}`;
854
+ })
855
+ },
856
+ (q = n.netSuite) != null && q.refNo ? {
857
+ label: "Ref no. (Netsuite)",
858
+ values: [(I = n.netSuite) == null ? void 0 : I.refNo]
859
+ } : null
860
+ ].filter((D) => D)
861
+ };
862
+ }
863
+ return k.map((n) => {
864
+ switch (n.type) {
865
+ case "grn":
866
+ return t(n.doc);
867
+ case "fulfillment":
868
+ return o(n.doc);
869
+ }
870
+ });
871
+ });
872
+ return (a, r) => {
873
+ var q, I;
874
+ const k = X("FmButtonGroup"), t = X("FmChip"), o = X("FmMenuDivider"), g = X("FmCard"), _ = X("FmSpacer"), n = X("FmButton"), v = X("FmSideSheet");
875
+ return h(), z(v, {
876
+ header: l(i)("inventory.transfer.receiveRequest.details.title") + ((q = a.purchaseOrder) != null && q.seqNumber ? ` #${(I = a.purchaseOrder) == null ? void 0 : I.seqNumber}` : ""),
877
+ modelValue: l(re),
878
+ "onUpdate:modelValue": r[9] || (r[9] = (D) => Le(re) ? re.value = D : null),
879
+ "dismiss-away": j.value,
880
+ "close-button": "",
881
+ "max-width": 500
882
+ }, {
883
+ default: ie(() => {
884
+ var D;
885
+ return [
886
+ e("div", st, [
887
+ e("div", null, [
888
+ W(k, {
889
+ items: c,
890
+ modelValue: d.value,
891
+ "onUpdate:modelValue": r[0] || (r[0] = (y) => d.value = y)
892
+ }, null, 8, ["modelValue"])
893
+ ]),
894
+ d.value.value === "overview" ? (h(), x(ee, { key: 0 }, [
895
+ e("div", null, [
896
+ W(g, {
897
+ variant: "outlined",
898
+ class: "flex flex-col gap-8 px-12 py-16"
899
+ }, {
900
+ default: ie(() => {
901
+ var y, P, E, B, $, K, se, ae, ne, V, ge, _e, we, Re, Se, Oe;
902
+ return [
903
+ e("div", at, [
904
+ e("div", nt, b(l(i)("inventory.transfer.receiveRequest.details.requestSummary")), 1),
905
+ e("div", null, [
906
+ W(t, {
907
+ label: l(i)(`inventory.transfer.status.${(y = a.purchaseOrder) == null ? void 0 : y.status}`),
908
+ class: ue(`fm-status-badge fm-status-badge-${(E = (P = a.purchaseOrder) == null ? void 0 : P.status) == null ? void 0 : E.toLocaleLowerCase("en-us")}`),
909
+ compact: ""
910
+ }, null, 8, ["label", "class"])
911
+ ])
912
+ ]),
913
+ W(o),
914
+ e("div", ot, [
915
+ e("div", lt, [
916
+ e("div", ct, [
917
+ e("div", it, b(l(i)("inventory.transfer.receiveRequest.details.createdAt")), 1)
918
+ ]),
919
+ e("div", ut, b(l(pe)(((B = a.purchaseOrder) == null ? void 0 : B._id) ?? "")), 1)
920
+ ]),
921
+ ($ = a.purchaseOrder) != null && $.effectiveAt ? (h(), x("div", dt, [
922
+ e("div", mt, b(l(i)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
923
+ e("div", ft, b(l(Ce)(new Date((K = a.purchaseOrder) == null ? void 0 : K.effectiveAt))), 1)
924
+ ])) : N("", !0),
925
+ e("div", pt, [
926
+ e("div", vt, b(l(i)("inventory.transfer.receiveRequest.details.type.title")), 1),
927
+ e("div", yt, b(l(i)(
928
+ `inventory.transfer.receiveRequest.details.type.${U.value.toLocaleLowerCase("en-US")}`
929
+ )), 1)
930
+ ]),
931
+ (ae = (se = a.purchaseOrder) == null ? void 0 : se.supplier) != null && ae.name ? (h(), x("div", ht, [
932
+ e("div", bt, b(l(i)("inventory.transfer.receiveRequest.details.from")), 1),
933
+ e("div", gt, b((V = (ne = a.purchaseOrder) == null ? void 0 : ne.supplier) == null ? void 0 : V.name), 1)
934
+ ])) : N("", !0),
935
+ a.transferTo ? (h(), x("div", _t, [
936
+ e("div", wt, b(l(i)("inventory.transfer.receiveRequest.details.to")), 1),
937
+ e("div", Rt, b(a.transferTo), 1)
938
+ ])) : N("", !0),
939
+ l(T).isEnabled ? (h(), x("div", St, [
940
+ r[10] || (r[10] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Subsidiary ", -1)),
941
+ e("div", Ot, b(Z.value || "-"), 1)
942
+ ])) : N("", !0),
943
+ l(T).isEnabled ? (h(), x("div", Dt, [
944
+ r[11] || (r[11] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Transfer Order ", -1)),
945
+ e("div", kt, b(((_e = (ge = a.purchaseOrder) == null ? void 0 : ge.netSuite) == null ? void 0 : _e.id) || ((Re = (we = a.poRequest) == null ? void 0 : we.netSuite) == null ? void 0 : Re.id) || "-"), 1)
946
+ ])) : N("", !0),
947
+ l(T).isEnabled ? (h(), x("div", xt, [
948
+ r[12] || (r[12] = e("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " NetSuite Fulfilment IDs ", -1)),
949
+ e("div", At, b(he.value), 1)
950
+ ])) : N("", !0),
951
+ (Se = a.purchaseOrder) != null && Se.ref ? (h(), x("div", qt, [
952
+ e("div", Pt, b(l(i)("inventory.transfer.receiveRequest.details.reference")), 1),
953
+ e("div", Nt, b(a.purchaseOrder.ref), 1)
954
+ ])) : N("", !0),
955
+ (Oe = a.purchaseOrder) != null && Oe.remark ? (h(), x("div", Ct, [
956
+ e("div", Tt, b(l(i)("inventory.transfer.receiveRequest.details.remark")), 1),
957
+ e("div", Et, b(a.purchaseOrder.remark), 1)
958
+ ])) : N("", !0)
959
+ ])
960
+ ];
961
+ }),
962
+ _: 1
963
+ })
964
+ ]),
965
+ e("div", $t, [
966
+ e("div", Ft, [
967
+ e("div", It, b(ye.value ? l(i)("inventory.transfer.receiveRequest.details.receivedItems") : l(i)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
968
+ (h(!0), x(ee, null, de(((D = a.purchaseOrder) == null ? void 0 : D.items) ?? [], (y) => (h(), x("div", {
969
+ key: y.code,
970
+ class: "flex flex-col"
971
+ }, [
972
+ e("div", Mt, [
973
+ e("div", Ut, b(y.name), 1),
974
+ e("div", Lt, b(l(le)(Q.value[y.sku._id], !1)) + "/" + b(l($e)(y.quantity, y.sku.unit, y.measurement)), 1)
975
+ ]),
976
+ e("div", jt, [
977
+ e("div", Bt, b(y.code), 1),
978
+ y.totalCost && l(F).enableTotalCost ? (h(), x("div", Kt, " (" + b(l(Ye)(y.totalCost)) + ") ", 1)) : N("", !0)
979
+ ])
980
+ ]))), 128))
981
+ ])
982
+ ])
983
+ ], 64)) : N("", !0),
984
+ d.value.value === "deliveryHistory" ? (h(), x("div", Vt, [
985
+ H.value.length ? (h(), x("div", Qt, [
986
+ (h(!0), x(ee, null, de(H.value, (y, P) => (h(), x(ee, { key: P }, [
987
+ e("div", Wt, [
988
+ e("div", Jt, [
989
+ e("div", Xt, [
990
+ e("div", {
991
+ class: ue([
992
+ {
993
+ "bg-fm-color-primary": P !== 0,
994
+ "bg-white": P === 0
995
+ },
996
+ "w-[2px] h-full"
997
+ ])
998
+ }, null, 2)
999
+ ]),
1000
+ r[13] || (r[13] = e("div", { class: "h-24 w-24 bg-fm-color-primary rounded-full" }, null, -1)),
1001
+ e("div", Zt, [
1002
+ e("div", {
1003
+ class: ue([
1004
+ {
1005
+ "bg-fm-color-primary": P < H.value.length - 1,
1006
+ "bg-white": P >= H.value.length - 1
1007
+ },
1008
+ "w-[2px] h-full"
1009
+ ])
1010
+ }, null, 2)
1011
+ ])
1012
+ ]),
1013
+ e("div", er, [
1014
+ e("div", tr, b(y.header), 1),
1015
+ e("div", rr, b(y.date), 1)
1016
+ ])
1017
+ ]),
1018
+ e("div", sr, [
1019
+ e("div", ar, [
1020
+ e("div", nr, [
1021
+ e("div", {
1022
+ class: ue([
1023
+ {
1024
+ "bg-fm-color-primary": P < H.value.length - 1,
1025
+ "bg-white": P >= H.value.length - 1
1026
+ },
1027
+ "w-[2px] h-full"
1028
+ ])
1029
+ }, null, 2)
1030
+ ])
1031
+ ]),
1032
+ e("div", or, [
1033
+ W(g, {
1034
+ variant: "outlined",
1035
+ class: "py-12 px-16"
1036
+ }, {
1037
+ default: ie(() => [
1038
+ e("div", lr, [
1039
+ (h(!0), x(ee, null, de(y.info, (E, B) => (h(), x("div", {
1040
+ key: B,
1041
+ class: "flex flex-col gap-4"
1042
+ }, [
1043
+ e("div", cr, b(E == null ? void 0 : E.label), 1),
1044
+ e("div", ir, [
1045
+ (h(!0), x(ee, null, de(E == null ? void 0 : E.values, ($, K) => (h(), x("div", {
1046
+ key: K,
1047
+ class: "fm-typo-en-body-lg-600"
1048
+ }, b($), 1))), 128))
1049
+ ])
1050
+ ]))), 128))
1051
+ ])
1052
+ ]),
1053
+ _: 2
1054
+ }, 1024)
1055
+ ])
1056
+ ])
1057
+ ], 64))), 128))
1058
+ ])) : (h(), x("div", Gt, [
1059
+ W(_),
1060
+ e("div", null, [
1061
+ e("img", {
1062
+ src: l(et),
1063
+ alt: "List is empty"
1064
+ }, null, 8, Ht)
1065
+ ]),
1066
+ e("div", zt, b(l(i)("inventory.transfer.receiveRequest.details.noRecordsFound")), 1),
1067
+ e("div", Yt, b(l(i)("inventory.transfer.receiveRequest.details.trackDeliveryMessage")), 1),
1068
+ W(_),
1069
+ W(_)
1070
+ ]))
1071
+ ])) : N("", !0)
1072
+ ])
1073
+ ];
1074
+ }),
1075
+ "side-sheet-footer": ie(() => {
1076
+ var D, y, P, E, B, $, K, se, ae, ne;
1077
+ return [
1078
+ e("div", ur, [
1079
+ ((D = a.purchaseOrder) == null ? void 0 : D.status) === l(M).enum.DRAFT && U.value === l(me).PURCHASE ? (h(), z(n, {
1080
+ key: 0,
1081
+ label: l(i)("inventory.transfer.receiveRequest.actions.confirmDraft"),
1082
+ onClick: r[1] || (r[1] = (V) => G("confirmDraft")),
1083
+ loading: f.value === "confirmDraft",
1084
+ disabled: f.value !== "confirmDraft" && m.value
1085
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1086
+ ((y = a.purchaseOrder) == null ? void 0 : y.status) === l(M).enum.DRAFT && U.value === l(me).TRANSFER ? (h(), z(n, {
1087
+ key: 1,
1088
+ label: l(i)("inventory.transfer.receiveRequest.actions.submitRequest"),
1089
+ onClick: r[2] || (r[2] = (V) => G("submitRequest")),
1090
+ loading: f.value === "submitRequest",
1091
+ disabled: f.value !== "submitRequest" && m.value
1092
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1093
+ ((P = a.purchaseOrder) == null ? void 0 : P.status) === l(M).enum.DRAFT ? (h(), z(n, {
1094
+ key: 2,
1095
+ label: l(i)("inventory.transfer.receiveRequest.actions.cancelDraft"),
1096
+ onClick: r[3] || (r[3] = (V) => G("cancelDraft")),
1097
+ loading: f.value === "cancelDraft",
1098
+ disabled: f.value !== "cancelDraft" && m.value,
1099
+ variant: "destructive"
1100
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1101
+ ((E = a.purchaseOrder) == null ? void 0 : E.status) === l(M).enum.RECEIVING ? (h(), z(n, {
1102
+ key: 3,
1103
+ label: l(i)("inventory.transfer.receiveRequest.actions.completeReceive"),
1104
+ onClick: r[4] || (r[4] = (V) => G("completeReceive")),
1105
+ loading: f.value === "completeReceive",
1106
+ disabled: f.value !== "completeReceive" && m.value
1107
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1108
+ a.canResubmit ? (h(), z(n, {
1109
+ key: 4,
1110
+ label: l(i)("inventory.transfer.receiveRequest.actions.resubmitRequest"),
1111
+ onClick: r[5] || (r[5] = (V) => G("submitRequest")),
1112
+ loading: f.value === "submitRequest",
1113
+ disabled: f.value !== "submitRequest" && m.value
1114
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1115
+ (((B = a.purchaseOrder) == null ? void 0 : B.status) === l(M).enum.REQUESTING || (($ = a.purchaseOrder) == null ? void 0 : $.status) === l(M).enum.PROCESSING) && a.canApprove ? (h(), z(n, {
1116
+ key: 5,
1117
+ label: l(i)("inventory.transfer.approval.actions.approveRequest"),
1118
+ onClick: r[6] || (r[6] = (V) => G("approveRequest")),
1119
+ loading: f.value === "approveRequest",
1120
+ disabled: f.value !== "approveRequest" && m.value
1121
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1122
+ ((K = a.purchaseOrder) == null ? void 0 : K.status) === l(M).enum.REQUESTING && a.canApprove ? (h(), z(n, {
1123
+ key: 6,
1124
+ label: l(i)("inventory.transfer.approval.actions.rejectRequest"),
1125
+ onClick: r[7] || (r[7] = (V) => G("rejectRequest")),
1126
+ loading: f.value === "rejectRequest",
1127
+ disabled: f.value !== "rejectRequest" && m.value,
1128
+ variant: "destructive"
1129
+ }, null, 8, ["label", "loading", "disabled"])) : N("", !0),
1130
+ ((se = a.purchaseOrder) == null ? void 0 : se.status) !== l(M).enum.COMPLETE && ((ae = a.purchaseOrder) == null ? void 0 : ae.status) !== l(M).enum.CANCEL && (((ne = a.purchaseOrder) == null ? void 0 : ne.status) !== l(M).enum.REQUESTING || a.canApprove) ? (h(), z(n, {
1131
+ key: 7,
1132
+ label: l(i)("common.close"),
1133
+ variant: "tertiary",
1134
+ onClick: r[8] || (r[8] = (V) => s("update:show", !1))
1135
+ }, null, 8, ["label"])) : N("", !0)
1136
+ ])
1137
+ ];
1138
+ }),
1139
+ _: 1
1140
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1141
+ };
1142
+ }
1143
+ });
1144
+ export {
1145
+ Or as _,
1146
+ Rr as a,
1147
+ Sr as b,
1148
+ tt as g,
1149
+ Ie as u
1150
+ };