@feedmepos/mf-inventory-portal 0.0.23-dev.3 → 0.0.23-dev.31

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