@feedmepos/mf-inventory-portal 1.2.37-dev.6 → 1.2.38

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 (88) hide show
  1. package/dist/{App-DyOQ_Xw7.js → App-CONrAP7y.js} +3 -3
  2. package/dist/{ApprovalView-DFHDYNum.js → ApprovalView-Cn9_7xk9.js} +5 -5
  3. package/dist/{BindingsDialog-B96VG07s.js → BindingsDialog-L7mP6sx9.js} +8 -8
  4. package/dist/{BindingsPicker-CoVDTRO0.js → BindingsPicker-DZqBMDUg.js} +2 -2
  5. package/dist/{BindingsTable-CuWHxqPQ.js → BindingsTable-DHkFDwiH.js} +3 -3
  6. package/dist/{ClosingDraftView-BINAvQcF.js → ClosingDraftView-BtSmlj0J.js} +8 -8
  7. package/dist/{ClosingHistoryView-CfLTNGoT.js → ClosingHistoryView-j83Wuxis.js} +22 -22
  8. package/dist/{ClosingTemplateView-BcXdjqXm.js → ClosingTemplateView-ZubBNFCd.js} +14 -14
  9. package/dist/{DeliveryOrderPrintPreview-Nna0OSHA.js → DeliveryOrderPrintPreview-DfS2E2tl.js} +9 -9
  10. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DIQOehlo.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CoO6g5B9.js} +61 -60
  11. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CPeUdEDm.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DnMjbyPc.js} +2 -2
  12. package/dist/{FmMultiselectDialog-HYBXnDCU.js → FmMultiselectDialog-8_qMKCPt.js} +2 -2
  13. package/dist/{FmMultiselectDialog-B5KK1OWo.js → FmMultiselectDialog-vj94RVLU.js} +1 -1
  14. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BWC0hDbD.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Dihv3KTq.js} +3 -3
  15. package/dist/{ImportView-C9k44bAB.js → ImportView--0ZbHtb9.js} +6 -6
  16. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Cv4IIkAi.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bosdu_28.js} +1 -1
  17. package/dist/{IngredientGroupView-CAEAOvqh.js → IngredientGroupView-D937cHah.js} +5 -5
  18. package/dist/{IngredientsView-Bkri4LBD.js → IngredientsView-BNdvTpOT.js} +14 -14
  19. package/dist/{IntegrationView-kYveJ3xG.js → IntegrationView-Dm3Eur8-.js} +12 -12
  20. package/dist/{InventoryBindingForm-CPDdwuSS.js → InventoryBindingForm-rBhW4Snl.js} +1 -1
  21. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-IsUi_VNj.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-Cvpi7GQx.js} +14 -14
  22. package/dist/{InventoryBindingSummary-1q4t4xZu.js → InventoryBindingSummary-emUM5QuA.js} +1 -1
  23. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BCBhdfk-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DFW-jg1P.js} +1 -1
  24. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-xAhtpaev.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BOxIYl0Z.js} +2 -2
  25. package/dist/{PublishView-BofNsPUM.js → PublishView-CXRBcsxc.js} +3 -3
  26. package/dist/{PurchaseOrderPrintPreview-GwHl_m2O.js → PurchaseOrderPrintPreview-BvjDpyrq.js} +9 -9
  27. package/dist/ReceiveRequestView-TwL3yVCN.js +2821 -0
  28. package/dist/{RecipeView-bTDYHYsW.js → RecipeView-dggwqURE.js} +8 -8
  29. package/dist/{StockView-BcmJWszh.js → StockView-Cml9AuXX.js} +305 -300
  30. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CMSN_f71.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BTZa1E_o.js} +1 -1
  31. package/dist/{SupplierView-DmDPwcVZ.js → SupplierView-CnD2QpE7.js} +11 -11
  32. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CKcmdIYZ.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DIbaHfbR.js} +2 -2
  33. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CtXx2kvG.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DeD1jiXL.js} +1 -1
  34. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-JFJLlP7n.js → TransferDetails.vue_vue_type_script_setup_true_lang-Y0eaTjgd.js} +374 -374
  35. package/dist/{TransferTemplateView-p3IubYSO.js → TransferTemplateView-DytfORlu.js} +354 -354
  36. package/dist/{UnitView-WtDMm46P.js → UnitView-ZUo-3Em1.js} +6 -6
  37. package/dist/{WarehouseView-gt891WkQ.js → WarehouseView-DlZirt8V.js} +5 -5
  38. package/dist/{WastageTemplateView-DDP_q1kT.js → WastageTemplateView-5Qvs2GZC.js} +14 -14
  39. package/dist/{app-DtJUp8mQ.js → app-xCn1wZY9.js} +4579 -4525
  40. package/dist/app.js +1 -1
  41. package/dist/{closing-template-DeUVPGPl.js → closing-template-DS8zFVJt.js} +1 -1
  42. package/dist/{date2-iHubu_Hg.js → date2-hHwvNr68.js} +1 -1
  43. package/dist/{dayjs.min-C81IRMa0.js → dayjs.min-PqgQ_K75.js} +12 -12
  44. package/dist/{decimal-DsF5fiGB.js → decimal-DOCxaZjf.js} +2 -2
  45. package/dist/{defineDeepModel-cHTtk4kj.js → defineDeepModel-CTlh0zvq.js} +1 -1
  46. package/dist/{duplicate-template-BMkJlSqi.js → duplicate-template-F8fz-36_.js} +1 -1
  47. package/dist/feature-UnTx1VJG.js +20162 -0
  48. package/dist/{format-time-from-id-gYFZ4gB4.js → format-time-from-id-DTsuaGJG.js} +1 -1
  49. package/dist/{format-unit-display-CrSG6jqO.js → format-unit-display-DS3MzSfd.js} +246 -245
  50. package/dist/{import-export.helper-BBZAXSKi.js → import-export.helper-BAUfb01o.js} +5 -5
  51. package/dist/{index-B4IDpHl_.js → index-BX9ig-2t.js} +3 -3
  52. package/dist/{index-D13-YBWx.js → index-CYZHYBBP.js} +1 -1
  53. package/dist/{index-DjhdVR8R.js → index-D_kOnYds.js} +9 -9
  54. package/dist/{lodash-fqg0EBFT.js → lodash-Cqi23PoA.js} +1 -1
  55. package/dist/{netsuite-Ce50v6Hm.js → netsuite-Cg_AEH3H.js} +3 -3
  56. package/dist/{purchase-order-template-BxglsHjM.js → purchase-order-template-Dh3D_2Tz.js} +1 -1
  57. package/dist/{rules-BO1fKtW6.js → rules-C_FnXd1e.js} +3 -3
  58. package/dist/{stock-DWYWu2eO.js → stock-BPdGitCC.js} +3 -3
  59. package/dist/{stock-DyZlhWdA.js → stock-DJDm1iIR.js} +1 -1
  60. package/dist/supplier-BtZVHCAl.js +78 -0
  61. package/dist/tsconfig.app.tsbuildinfo +1 -1
  62. package/dist/{use-ingredient-select-dialog-BvSDIPIV.js → use-ingredient-select-dialog-n26Kr4C5.js} +2 -2
  63. package/dist/{use-inventory-binding-dialog-SizooUK2.js → use-inventory-binding-dialog-kkpC2Tzi.js} +2 -2
  64. package/dist/{use-template-enabled-locations-2-D6QsVX09.js → use-template-enabled-locations-2-4ou70XAL.js} +2 -2
  65. package/dist/views/receive-request/components/netsuite/NetSuitePanel.vue.d.ts +2 -3
  66. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -3
  67. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +2197 -490
  68. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +0 -1430
  69. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +0 -1
  70. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -3
  71. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
  72. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -6
  73. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
  74. package/dist/views/receive-request/constants/purchase-order-transaction-type.d.ts +4 -0
  75. package/dist/views/receive-request/helper/get-transfer-type.d.ts +2 -1
  76. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -3
  77. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +2 -3
  78. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +3 -4
  79. package/dist/{vue-i18n-DVkVzKDL.js → vue-i18n-A7TH-x17.js} +533 -533
  80. package/dist/{xlsx-B8-jQ9MR.js → xlsx-DRYtBAdX.js} +1 -1
  81. package/dist/{xlsx.util-BZCQyeND.js → xlsx.util-DGBUU4BN.js} +1 -1
  82. package/package.json +1 -1
  83. package/dist/ReceiveRequestView-DfzANuLj.js +0 -2863
  84. package/dist/feature-Dx_hCq6v.js +0 -25312
  85. package/dist/helper/reactivity.d.ts +0 -11
  86. package/dist/helper/reactivity.spec.d.ts +0 -1
  87. package/dist/supplier-BtC6VaAp.js +0 -78
  88. package/dist/views/receive-request/components/transfer-form/composables/use-purchase-order-form-controller.d.ts +0 -13974
@@ -1,2863 +0,0 @@
1
- import { reactive as Dt, onMounted as tt, watch as fe, computed as N, h as j, defineComponent as de, openBlock as x, createElementBlock as T, Fragment as le, renderList as he, createElementVNode as l, toDisplayString as E, unref as t, resolveComponent as V, createVNode as f, withCtx as O, createCommentVNode as Q, ref as M, createBlock as se, normalizeClass as K, normalizeStyle as Tt, createTextVNode as Ae, toRaw as qt, shallowRef as Mt, onUnmounted as Nt, mergeProps as it, isRef as we, createSlots as Ut, Teleport as zt, normalizeProps as Bt, guardReactiveProps as Lt } from "vue";
2
- import { s as ut, t as me, I as Ht, f as Vt, L as jt, A as Qt, u as st, a as ot, M as Yt, O as Kt, v as Xt, m as Je } from "./app-DtJUp8mQ.js";
3
- import { i as xt, _ as Zt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CPeUdEDm.js";
4
- import { u as Wt, P as rt, a as Gt, _ as Jt, g as es } from "./TransferDetails.vue_vue_type_script_setup_true_lang-JFJLlP7n.js";
5
- import { R as Be, a as Se, e as et, d as ts, A as Le, M as ss, B as os } from "./rules-BO1fKtW6.js";
6
- import { _ as Pt, u as as, i as ns, e as ls } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-xAhtpaev.js";
7
- import { d as Ct } from "./dayjs.min-C81IRMa0.js";
8
- import { u as rs } from "./useTabStorage-BkIVScW_.js";
9
- import { u as is, _ as us } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
10
- import { useBreakpoints as dt, components as ye, FmButtonVariant as ds, useSnackbar as Oe, useDialog as cs, useProxiedModel as Rt } from "@feedmepos/ui-library";
11
- import { F as ze } from "./form-mode.enum-BKiNVH6A.js";
12
- import { d as wt } from "./index-B4IDpHl_.js";
13
- import { _ as ms, a as ps, b as fs, F as vs } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BWC0hDbD.js";
14
- import { u as at, c as ys, P as bs } from "./feature-Dx_hCq6v.js";
15
- import { u as He } from "./netsuite-Ce50v6Hm.js";
16
- import { c as Pe, u as gs, _ as _s } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DIQOehlo.js";
17
- import { useI18n as be } from "@feedmepos/mf-common";
18
- import { a as hs } from "./FmMultiselectDialog-HYBXnDCU.js";
19
- import { F as pe, _ as At } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
20
- import { u as ct } from "./supplier-BtC6VaAp.js";
21
- import { d as mt, e as ks, g as xs, b as Cs } from "./date2-iHubu_Hg.js";
22
- import { _ as ws } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
23
- import { a as Ot } from "./format-unit-display-CrSG6jqO.js";
24
- import { u as pt } from "./SystemTrailDialog.vue_vue_type_script_setup_true_lang-CKcmdIYZ.js";
25
- import { u as Ss } from "./vue-i18n-DVkVzKDL.js";
26
- import { s as Fs, r as Is } from "./xlsx.util-BZCQyeND.js";
27
- import { F as $s } from "./FmDroppableField-J0xUsOTV.js";
28
- import { d as Ds } from "./defineDeepModel-cHTtk4kj.js";
29
- import { N as Ts, H as Vs } from "./app-uBuHtW8m.js";
30
- var te = /* @__PURE__ */ ((d) => (d.Code = "Code", d.Name = "Name", d.TemplateName = "TemplateName", d.Amount = "Amount", d.Cost = "Cost", d.TotalCost = "TotalCost", d.Delete = "Delete", d))(te || {});
31
- const Ps = () => (be(), j(
32
- Pt,
33
- {
34
- zIndex: 50,
35
- class: "whitespace-nowrap"
36
- },
37
- `Total (${Vt()})`
38
- ));
39
- function Rs(d) {
40
- const { t: v } = be(), n = Dt({}), { breakpoints: u } = dt(), g = at(), a = He();
41
- tt(() => {
42
- for (const p of d.items) {
43
- if (!p.totalCost)
44
- continue;
45
- const { cost: e } = Pe(
46
- p.sku,
47
- p.quantity,
48
- p.measurement,
49
- {
50
- supplier: d.supplier
51
- }
52
- ), i = p.totalCost ?? ut.reset();
53
- e ? n[p.sku._id] = e.amount !== i.amount || e.precision !== i.precision : n[p.sku._id] = !0;
54
- }
55
- }), fe(
56
- () => {
57
- var p;
58
- return (p = d.supplier) == null ? void 0 : p._id;
59
- },
60
- () => {
61
- const p = d.supplier;
62
- for (const e of d.items) {
63
- if (!e.totalCost || n[e.sku._id] || !k(e.sku))
64
- continue;
65
- const { cost: i } = Pe(
66
- e.sku,
67
- e.quantity,
68
- e.measurement,
69
- {
70
- supplier: p
71
- }
72
- );
73
- d.updateItem({ ...e, totalCost: i });
74
- }
75
- }
76
- );
77
- function k(p) {
78
- var i, b, o, r, m, h, w;
79
- return !!(((b = (i = p.defaultCost) == null ? void 0 : i.costPerUnit) == null ? void 0 : b.amount) ?? ((w = (h = (m = (r = (o = d.supplier) == null ? void 0 : o.supplyItems) == null ? void 0 : r.find((c) => c.skuId === p._id)) == null ? void 0 : m.defaultCost) == null ? void 0 : h.costPerUnit) == null ? void 0 : w.amount));
80
- }
81
- const C = [
82
- {
83
- id: "Code",
84
- header: () => v("inventory.transfer.form.items.table.Code"),
85
- accessorKey: "code",
86
- size: 200,
87
- cell(p) {
88
- const e = p.row.original;
89
- return a.isEnabled ? j(
90
- ye.FmTooltip,
91
- {
92
- content: e.code,
93
- placement: "top",
94
- variant: "plain",
95
- zIndex: 50
96
- },
97
- j(
98
- "span",
99
- {
100
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
101
- },
102
- e.code
103
- )
104
- ) : j(ye.FmTextField, {
105
- modelValue: e.code,
106
- "onUpdate:modelValue": (i) => {
107
- d.updateItem({
108
- ...e,
109
- code: i
110
- });
111
- },
112
- key: e.sku._id,
113
- rules: [Be()],
114
- labelMark: "required"
115
- });
116
- },
117
- enableSorting: !1
118
- },
119
- {
120
- id: "Name",
121
- header: () => v("inventory.transfer.form.items.table.Name"),
122
- minSize: 300,
123
- cell(p) {
124
- const e = p.row.original;
125
- return a.isEnabled ? j(
126
- ye.FmTooltip,
127
- {
128
- content: e.name,
129
- placement: "top",
130
- variant: "plain",
131
- zIndex: 50
132
- },
133
- j(
134
- "span",
135
- {
136
- class: "flex-auto line-clamp-2 text-ellipsis break-all"
137
- },
138
- e.name
139
- )
140
- ) : j(ye.FmTextField, {
141
- modelValue: e.name,
142
- "onUpdate:modelValue": (i) => {
143
- d.updateItem({
144
- ...e,
145
- name: i
146
- });
147
- },
148
- key: e.sku._id,
149
- rules: [Be()],
150
- labelMark: "required"
151
- });
152
- },
153
- enableSorting: !1
154
- },
155
- {
156
- id: "TemplateName",
157
- header: () => v("inventory.transfer.form.items.table.Name"),
158
- minSize: 300,
159
- enableSorting: !1,
160
- cell(p) {
161
- const e = p.row.original, i = e.code, b = e.name;
162
- return j(
163
- ye.FmTooltip,
164
- { zIndex: 50 },
165
- {
166
- default() {
167
- return j("div", { class: "flex flex-col w-full" }, [
168
- j(
169
- "div",
170
- { class: "line-clamp-1 fm-typo-en-body-lg-400 text-fm-color-typo-primary" },
171
- b
172
- ),
173
- j(
174
- "div",
175
- {
176
- class: "line-clamp-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
177
- },
178
- i
179
- )
180
- ]);
181
- },
182
- content() {
183
- return b;
184
- }
185
- }
186
- );
187
- }
188
- },
189
- {
190
- id: "Amount",
191
- header: () => v("inventory.transfer.form.items.table.Amount"),
192
- minSize: 200,
193
- cell(p) {
194
- var r, m, h, w, c;
195
- const e = p.row.original, i = (r = d.forecastAmounts) == null ? void 0 : r.find((y) => y.skuId === e.sku._id), b = i ? i.helperState === "error" ? `Predicted: ${i.amount} (out of range)` : `Predicted: ${i.amount}` : void 0, o = (w = (h = (m = d.template) == null ? void 0 : m.purchaseOrder) == null ? void 0 : h.items) == null ? void 0 : w.find(
196
- (y) => y.sku._id === e.sku._id
197
- );
198
- return j(ms, {
199
- style: {
200
- flex: "1 1 0%"
201
- },
202
- modelValue: {
203
- amount: e.quantity ?? { amount: 1, precision: 0 },
204
- measurement: e.measurement ?? null
205
- },
206
- key: e.sku._id,
207
- unit: e.sku.unit,
208
- helperText: b,
209
- helperState: i == null ? void 0 : i.helperState,
210
- "onUpdate:modelValue": (y) => {
211
- if (!y) return;
212
- const I = {
213
- ...e,
214
- quantity: y.amount,
215
- measurement: y.measurement
216
- };
217
- if (g.enableTotalCost) {
218
- const { cost: z } = Pe(
219
- I.sku,
220
- I.quantity,
221
- I.measurement,
222
- {
223
- supplier: d.supplier,
224
- // NOTE: set undefined here if `manualTotalCost[updatedRow.sku._id] = false`, so that the function
225
- // will return the auto calculated default cost instead of the manual total cost
226
- manualTotalCost: n[I.sku._id] ? I.totalCost : void 0
227
- }
228
- );
229
- I.totalCost = z;
230
- }
231
- d.updateItem(I);
232
- },
233
- stepper: o == null ? void 0 : o.quantityStep,
234
- disableUnit: !!o,
235
- disabled: d.disabled,
236
- rules: [
237
- ps(
238
- +Se(
239
- ((c = e.quantity) == null ? void 0 : c.amount) === 0 ? { amount: 0, precision: 0 } : (o == null ? void 0 : o.minimumQuantity) ?? { amount: 0, precision: 0 }
240
- )
241
- ),
242
- fs(
243
- o != null && o.maximumQuantity ? +Se(o == null ? void 0 : o.maximumQuantity) : 1 / 0
244
- ),
245
- ...o != null && o.quantityStep ? [vs(o.quantityStep)] : []
246
- ],
247
- applyDefaultRules: !0
248
- });
249
- },
250
- enableSorting: !1
251
- },
252
- {
253
- id: "Cost",
254
- header: Ps,
255
- size: 180,
256
- cell(p) {
257
- const e = p.row.original, i = k(e.sku), b = u.value.xs || u.value.sm;
258
- if (!n[e.sku._id] && i) {
259
- const { cost: o, supplierOverrideCost: r } = Pe(
260
- e.sku,
261
- e.quantity,
262
- e.measurement,
263
- {
264
- supplier: d.supplier
265
- }
266
- );
267
- return j(
268
- "div",
269
- {
270
- class: [
271
- "flex gap-4 fm-typo-en-body-md-400 items-center",
272
- d.disabled ? "text-fm-color-typo-disabled" : ""
273
- ],
274
- key: e.sku._id
275
- },
276
- [
277
- j(ye.FmButton, {
278
- prependIcon: "edit",
279
- variant: ds.Tertiary,
280
- disabled: d.disabled,
281
- onClick() {
282
- d.updateItem({
283
- ...e,
284
- totalCost: o
285
- }), n[e.sku._id] = !0;
286
- }
287
- }),
288
- j(
289
- "div",
290
- {
291
- class: "flex flex-col"
292
- },
293
- [
294
- j(
295
- "span",
296
- b ? et(o) : Se(o)
297
- ),
298
- j(
299
- "span",
300
- {
301
- class: [
302
- "fm-typo-en-body-sm-400",
303
- d.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
304
- ]
305
- },
306
- v("inventory.transfer.form.items.autoCalculated")
307
- ),
308
- r ? j(
309
- "span",
310
- {
311
- class: [
312
- "fm-typo-en-body-sm-400",
313
- d.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-neutral-gray-400"
314
- ]
315
- },
316
- [
317
- et(r.costPerUnit),
318
- "/",
319
- r.measurement ? j(
320
- "span",
321
- { class: "text-blue-500 font-semibold" },
322
- r.measurement.abbrev
323
- ) : j("span", { class: "text-green-500 font-bold" }, e.sku.unit.abbrev)
324
- // base unit style
325
- ]
326
- ) : null
327
- ]
328
- )
329
- ]
330
- );
331
- }
332
- return j(
333
- ye.FmTextField,
334
- {
335
- modelValue: Se(e.totalCost ?? { amount: 0, precision: 0 }),
336
- key: e.sku._id,
337
- "onUpdate:modelValue": (o) => {
338
- d.updateItem({
339
- ...e,
340
- totalCost: {
341
- ...ts(+o),
342
- currency: Ht()
343
- }
344
- });
345
- },
346
- rules: [Le(0), ss(2)]
347
- },
348
- {
349
- prepend() {
350
- return b ? j(
351
- "div",
352
- {
353
- class: [
354
- "text-fm-typo-en-body-lg-400",
355
- d.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
356
- ]
357
- },
358
- Vt()
359
- ) : null;
360
- },
361
- append() {
362
- return i ? j(ye.FmButton, {
363
- prependIcon: "close",
364
- variant: "tertiary",
365
- disabled: d.disabled,
366
- onClick() {
367
- const { cost: o } = Pe(
368
- e.sku,
369
- e.quantity,
370
- e.measurement,
371
- {
372
- supplier: d.supplier
373
- }
374
- );
375
- d.updateItem({
376
- ...e,
377
- // NOTE: different from PO template, if a default cost is reenabled,
378
- // the total cost will automatically assigned
379
- totalCost: o
380
- }), n[e.sku._id] = !1;
381
- }
382
- }) : null;
383
- }
384
- }
385
- );
386
- },
387
- enableSorting: !1
388
- },
389
- {
390
- id: "Delete",
391
- header: "",
392
- cell(p) {
393
- const e = p.row.original;
394
- return j("div", { class: "flex justify-end" }, [
395
- j(ye.FmButton, {
396
- key: e.sku._id,
397
- class: "delete-button",
398
- type: "button",
399
- icon: "delete",
400
- variant: "tertiary",
401
- size: "md",
402
- disabled: d.disabled,
403
- onClick: () => {
404
- d.deleteItem(e);
405
- }
406
- })
407
- ]);
408
- },
409
- enableSorting: !1,
410
- size: 40,
411
- meta: {
412
- cellClass: "",
413
- headerClass: ""
414
- }
415
- }
416
- ];
417
- return {
418
- columnDefs: N(() => g.enableTotalCost && d.transferType === me.enum.purchase ? C : C.filter(
419
- (p) => p.id !== "Cost"
420
- /* Cost */
421
- ))
422
- };
423
- }
424
- const As = { class: "flex flex-col gap-8 px-16 xs:px-4 sm:px-4 py-4 items-center" }, Os = { class: "fm-typo-en-body-lg-600 xs:fm-typo-en-body-md-600 mr-auto xs:w-full" }, Es = { class: "w-[450px] xs:w-full flex" }, qs = { class: "fm-typo-en-body-md-400 whitespace-nowrap" }, Ms = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Et = /* @__PURE__ */ de({
425
- __name: "SupplierPriceHistory",
426
- props: {
427
- prices: {}
428
- },
429
- setup(d) {
430
- const v = ct();
431
- function n(u) {
432
- return v.suppliers.find((g) => g._id === u);
433
- }
434
- return (u, g) => (x(), T("div", As, [
435
- (x(!0), T(le, null, he(Object.keys(u.prices), (a) => {
436
- var k;
437
- return x(), T("div", {
438
- key: a,
439
- class: "flex items-center gap-12 xs:gap-4 xs:flex-wrap w-full"
440
- }, [
441
- l("div", Os, E((k = n(a)) == null ? void 0 : k.name), 1),
442
- l("div", Es, [
443
- (x(!0), T(le, null, he(u.prices[a].slice(0, 3), (C) => {
444
- var $;
445
- return x(), T("div", {
446
- key: C.date,
447
- class: "flex flex-col w-[150px] xs:flex-1 text-ellipsis cursor-pointer"
448
- }, [
449
- l("div", qs, [
450
- l("span", null, E(C.totalCost ? t(et)(C.totalCost) : "No data"), 1),
451
- g[0] || (g[0] = l("span", { class: "text-fm-color-typo-secondary" }, "/", -1)),
452
- l("span", null, E(t(Se)(C.totalUnit, !1)), 1),
453
- l("span", null, E((($ = C.measurement) == null ? void 0 : $.abbrev) ?? C.unit.abbrev), 1)
454
- ]),
455
- l("div", Ms, [
456
- l("span", null, "(#" + E(C.seqNumber) + ")", 1),
457
- g[1] || (g[1] = l("span", null, E(" "), -1)),
458
- l("span", null, E(t(mt)(new Date(C.date))), 1)
459
- ])
460
- ]);
461
- }), 128))
462
- ])
463
- ]);
464
- }), 128))
465
- ]));
466
- }
467
- }), Ns = { class: "flex flex-col gap-8 py-16" }, Us = { class: "flex items-center" }, zs = { class: "flex-1 flex gap-1 items-center" }, Bs = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Ls = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Hs = { class: "flex gap-8 w-full" }, js = { class: "flex-1 flex flex-col gap-4" }, Qs = { class: "flex-1 flex flex-col gap-4" }, Ys = { class: "flex gap-8 w-full" }, Ks = { class: "flex-1 flex flex-col gap-4" }, Xs = {
468
- key: 0,
469
- class: "flex-1 flex flex-col gap-4"
470
- }, Zs = /* @__PURE__ */ de({
471
- __name: "TransferItem",
472
- props: {
473
- cellByColId: {},
474
- comparePriceBySku: {},
475
- showComparePrice: { type: Boolean },
476
- row: {}
477
- },
478
- setup(d) {
479
- const { t: v } = be();
480
- return (n, u) => {
481
- var k, C, $, p, e, i, b, o, r, m, h, w, c, y, I, z, B, X, oe, U, P, R, D, q, L, Z, S;
482
- const g = V("FmLabel"), a = V("FmSpacer");
483
- return x(), T("div", Ns, [
484
- l("div", Us, [
485
- l("div", zs, [
486
- l("span", Bs, " (" + E(n.row.original.sku.code) + ") ", 1),
487
- l("span", Ls, E(n.row.original.sku.name), 1)
488
- ]),
489
- l("div", null, [
490
- f(t(pe), {
491
- render: ($ = (C = (k = n.cellByColId.Delete) == null ? void 0 : k.column) == null ? void 0 : C.columnDef) == null ? void 0 : $.cell,
492
- props: (e = (p = n.cellByColId.Delete) == null ? void 0 : p.getContext) == null ? void 0 : e.call(p)
493
- }, null, 8, ["render", "props"])
494
- ])
495
- ]),
496
- l("div", Hs, [
497
- l("div", js, [
498
- f(g, {
499
- label: t(v)(`inventory.transfer.form.items.table.${t(te).Code}`)
500
- }, null, 8, ["label"]),
501
- f(t(pe), {
502
- render: (o = (b = (i = n.cellByColId[t(te).Code]) == null ? void 0 : i.column) == null ? void 0 : b.columnDef) == null ? void 0 : o.cell,
503
- props: (m = (r = n.cellByColId[t(te).Code]) == null ? void 0 : r.getContext) == null ? void 0 : m.call(r)
504
- }, null, 8, ["render", "props"]),
505
- u[0] || (u[0] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
506
- ]),
507
- l("div", Qs, [
508
- f(g, {
509
- label: t(v)(`inventory.transfer.form.items.table.${t(te).Name}`)
510
- }, null, 8, ["label"]),
511
- f(t(pe), {
512
- render: (c = (w = (h = n.cellByColId[t(te).Name]) == null ? void 0 : h.column) == null ? void 0 : w.columnDef) == null ? void 0 : c.cell,
513
- props: (I = (y = n.cellByColId[t(te).Name]) == null ? void 0 : y.getContext) == null ? void 0 : I.call(y)
514
- }, null, 8, ["render", "props"]),
515
- u[1] || (u[1] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
516
- ])
517
- ]),
518
- l("div", Ys, [
519
- l("div", Ks, [
520
- f(g, {
521
- label: t(v)(`inventory.transfer.form.items.table.${t(te).Amount}`)
522
- }, null, 8, ["label"]),
523
- f(t(pe), {
524
- render: (X = (B = (z = n.cellByColId[t(te).Amount]) == null ? void 0 : z.column) == null ? void 0 : B.columnDef) == null ? void 0 : X.cell,
525
- props: (U = (oe = n.cellByColId[t(te).Amount]) == null ? void 0 : oe.getContext) == null ? void 0 : U.call(oe)
526
- }, null, 8, ["render", "props"]),
527
- u[2] || (u[2] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
528
- ]),
529
- n.cellByColId[t(te).Cost] ? (x(), T("div", Xs, [
530
- f(Pt, { "z-index": 50 }, {
531
- default: O(() => [
532
- f(g, {
533
- label: t(v)(`inventory.transfer.form.items.table.${t(te).Cost}2`)
534
- }, null, 8, ["label"])
535
- ]),
536
- _: 1
537
- }),
538
- f(t(pe), {
539
- render: (D = (R = (P = n.cellByColId[t(te).Cost]) == null ? void 0 : P.column) == null ? void 0 : R.columnDef) == null ? void 0 : D.cell,
540
- props: (L = (q = n.cellByColId[t(te).Cost]) == null ? void 0 : q.getContext) == null ? void 0 : L.call(q)
541
- }, null, 8, ["render", "props"]),
542
- u[3] || (u[3] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
543
- ])) : Q("", !0)
544
- ]),
545
- n.showComparePrice && Object.keys(n.comparePriceBySku[(Z = n.row.original.sku) == null ? void 0 : Z._id] ?? {}).length > 0 ? (x(), T(le, { key: 0 }, [
546
- f(a, { class: "h-8" }),
547
- f(Et, {
548
- prices: n.comparePriceBySku[(S = n.row.original.sku) == null ? void 0 : S._id]
549
- }, null, 8, ["prices"])
550
- ], 64)) : Q("", !0)
551
- ]);
552
- };
553
- }
554
- });
555
- function Ws(d) {
556
- const v = N({
557
- get() {
558
- const a = d.getEffectiveAt();
559
- return a ? new Date(a) : null;
560
- },
561
- set(a) {
562
- d.setEffectiveAt((a == null ? void 0 : a.toISOString()) ?? null);
563
- }
564
- }), n = N({
565
- get() {
566
- return !!v.value;
567
- },
568
- set(a) {
569
- a ? v.value = /* @__PURE__ */ new Date() : v.value = null;
570
- }
571
- }), u = N({
572
- get() {
573
- return v.value === null ? "" : mt(v.value);
574
- },
575
- set(a) {
576
- a ? v.value = /* @__PURE__ */ new Date(`${a} ${g.value}`) : v.value = null;
577
- }
578
- }), g = N({
579
- get() {
580
- return v.value === null ? "" : ks(v.value);
581
- },
582
- set(a) {
583
- a ? v.value = /* @__PURE__ */ new Date(`${u.value} ${a}`) : v.value = null;
584
- }
585
- });
586
- return {
587
- backdatePo: v,
588
- backdateSwitch: n,
589
- backdateModel: u,
590
- backdateTimeModel: g
591
- };
592
- }
593
- const Gs = {
594
- width: "24",
595
- height: "24",
596
- viewBox: "0 0 24 24",
597
- fill: "none",
598
- xmlns: "http://www.w3.org/2000/svg"
599
- }, Js = ["fill"], eo = ["fill"], to = ["stroke"], so = ["stroke"], oo = /* @__PURE__ */ de({
600
- __name: "SparkIcon",
601
- props: {
602
- size: {
603
- type: Number,
604
- default: 24
605
- },
606
- color: {
607
- type: String,
608
- default: "#c7c7cc"
609
- }
610
- },
611
- setup(d) {
612
- return (v, n) => (x(), T("svg", Gs, [
613
- l("path", {
614
- d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
615
- fill: d.color
616
- }, null, 8, Js),
617
- l("path", {
618
- d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
619
- fill: d.color
620
- }, null, 8, eo),
621
- l("path", {
622
- d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
623
- stroke: d.color,
624
- "stroke-width": "1.5",
625
- "stroke-linecap": "round",
626
- "stroke-linejoin": "round"
627
- }, null, 8, to),
628
- l("path", {
629
- d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
630
- stroke: d.color,
631
- "stroke-width": "1.5",
632
- "stroke-linecap": "round",
633
- "stroke-linejoin": "round"
634
- }, null, 8, so)
635
- ]));
636
- }
637
- }), ao = { class: "flex gap-8 items-center" }, no = { class: "fm-typo-en-body-lg-600 line-clamp-1" }, lo = { class: "w-[343px] px-24 py-16 rounded-lg shadow-light-300 flex flex-col gap-[20px]" }, ro = { class: "flex items-center w-full" }, io = { class: "flex-1" }, uo = { class: "fm-typo-en-title-sm-800" }, co = { class: "flex items-start gap-8" }, mo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, po = { class: "flex gap-1" }, fo = /* @__PURE__ */ de({
638
- __name: "ForecastStock",
639
- props: {
640
- templateId: {},
641
- disabled: { type: Boolean },
642
- poItems: {},
643
- templateItems: {}
644
- },
645
- emits: ["update:poItems", "update:forecastAmounts"],
646
- setup(d, { emit: v }) {
647
- const n = d, u = v, g = M(!1), a = M(7), k = as(), C = Oe(), { t: $ } = be();
648
- function p(o, r, m) {
649
- return r != null && o < r && (o = r), m != null && o > m && (o = m), o;
650
- }
651
- function e(o) {
652
- if (!((o == null ? void 0 : o.amount) == null || (o == null ? void 0 : o.precision) == null))
653
- return o.amount / Math.pow(10, o.precision);
654
- }
655
- function i({
656
- sku: o,
657
- code: r,
658
- name: m,
659
- baseAmount: h,
660
- measurement: w,
661
- min: c,
662
- max: y
663
- }) {
664
- if (w) {
665
- const I = w.conversion.amount;
666
- let z = Math.ceil(h / I);
667
- return z = p(z, c, y), {
668
- sku: o,
669
- code: r,
670
- name: m,
671
- quantity: { amount: z, precision: 0 },
672
- measurement: w
673
- };
674
- } else {
675
- const I = Math.ceil(p(h, c, y));
676
- return {
677
- sku: o,
678
- code: r,
679
- name: m,
680
- quantity: { amount: I, precision: 0 },
681
- measurement: null
682
- };
683
- }
684
- }
685
- async function b() {
686
- if (a.value < 1) return;
687
- g.value = !1, await k.readPurchaseOrder(a.value, n.templateId);
688
- const o = k.purchaseOrderForecast.skus;
689
- if (o.length === 0) {
690
- C.open({
691
- message: $("inventory.transfer.form.items.forecastStock.notAvailable"),
692
- type: "info"
693
- });
694
- return;
695
- }
696
- const r = n.templateItems.reduce((h, w) => {
697
- var z;
698
- const c = (z = n.poItems) == null ? void 0 : z.find((B) => B.sku._id === w.sku._id), y = o.find((B) => B.id === w.sku._id);
699
- if (!y)
700
- return c && h.push(c), h;
701
- if (!n.templateId && y.amount <= 0) return h;
702
- const I = y.amount ?? e(c == null ? void 0 : c.quantity) ?? 0;
703
- return h.push(
704
- i({
705
- sku: w.sku,
706
- code: w.code,
707
- name: w.name,
708
- baseAmount: I,
709
- measurement: w.measurement || null,
710
- min: e(w.minimumQuantity),
711
- max: e(w.maximumQuantity)
712
- })
713
- ), h;
714
- }, []), m = o.map((h) => {
715
- const w = n.templateItems.find((X) => X.sku._id === h.id);
716
- let c = h.amount, y = 0;
717
- if (w != null && w.measurement) {
718
- const X = e(w.measurement.conversion) ?? 1;
719
- c = Math.ceil(h.amount / X);
720
- } else
721
- c = Math.ceil(h.amount);
722
- const I = e(w == null ? void 0 : w.minimumQuantity) ?? 0, z = e(w == null ? void 0 : w.maximumQuantity) ?? 1 / 0, B = c < I || c > z ? "error" : "success";
723
- return { skuId: h.id, amount: c, precision: y, helperState: B };
724
- });
725
- u("update:poItems", r), u("update:forecastAmounts", m);
726
- }
727
- return (o, r) => {
728
- const m = V("FmButton"), h = V("FmIcon"), w = V("FmStepperField"), c = V("FmPopover");
729
- return x(), se(c, {
730
- disabled: o.disabled,
731
- class: "flex",
732
- "show-popover": g.value,
733
- onPopoverChanged: r[3] || (r[3] = (y) => g.value = y)
734
- }, {
735
- "popover-button": O(() => [
736
- f(m, {
737
- label: "unused",
738
- variant: "secondary",
739
- "text-color": o.disabled ? "disabled" : "primary",
740
- "bg-color": "transparent",
741
- "border-color": o.disabled ? "disabled" : "primary",
742
- disabled: o.disabled
743
- }, {
744
- default: O(() => [
745
- l("div", ao, [
746
- f(oo, {
747
- size: 24,
748
- color: o.disabled ? "#c7c7cc" : "#ff7823"
749
- }, null, 8, ["color"]),
750
- l("div", no, E(t($)("inventory.transfer.form.items.forecastStock.title")), 1)
751
- ])
752
- ]),
753
- _: 1
754
- }, 8, ["text-color", "border-color", "disabled"])
755
- ]),
756
- default: O(() => [
757
- l("div", lo, [
758
- l("div", ro, [
759
- l("div", io, [
760
- f(ws, { "z-index": 99 }, {
761
- default: O(() => [
762
- l("p", uo, E(t($)("inventory.transfer.form.items.forecastStock.title")), 1)
763
- ]),
764
- _: 1
765
- })
766
- ]),
767
- f(m, {
768
- icon: "close",
769
- size: "md",
770
- variant: "tertiary",
771
- onClick: r[0] || (r[0] = (y) => g.value = !1)
772
- })
773
- ]),
774
- f(w, {
775
- modelValue: a.value,
776
- "onUpdate:modelValue": r[1] || (r[1] = (y) => a.value = y),
777
- label: t($)("inventory.transfer.form.items.forecastStock.days"),
778
- rules: [t(Le)(1)]
779
- }, {
780
- "helper-text": O(() => [
781
- l("div", co, [
782
- f(h, {
783
- name: "warning",
784
- size: "sm",
785
- class: "text-fm-color-system-warning-300"
786
- }),
787
- l("div", mo, E(t($)("inventory.transfer.form.items.forecastStock.replace")), 1)
788
- ])
789
- ]),
790
- _: 1
791
- }, 8, ["modelValue", "label", "rules"]),
792
- l("div", po, [
793
- r[4] || (r[4] = l("div", { class: "grow" }, null, -1)),
794
- f(m, {
795
- label: t($)("common.cancel"),
796
- variant: "tertiary",
797
- onClick: r[2] || (r[2] = (y) => g.value = !1)
798
- }, null, 8, ["label"]),
799
- f(m, {
800
- label: t($)("inventory.transfer.form.items.forecastStock.generate"),
801
- onClick: b
802
- }, null, 8, ["label"])
803
- ])
804
- ])
805
- ]),
806
- _: 1
807
- }, 8, ["disabled", "show-popover"]);
808
- };
809
- }
810
- });
811
- function vo() {
812
- const d = Oe(), v = pt(), n = M(!1);
813
- fe(n, (k) => {
814
- k && (g.value = !0, u().finally(() => {
815
- g.value = !1;
816
- }));
817
- });
818
- async function u() {
819
- try {
820
- const { startDate: k, endDate: C } = xs(6), e = (await v.getPurchaseOrders({ start: k, end: C })).filter(
821
- (i) => {
822
- var b, o;
823
- return i.status === jt.enum.COMPLETE && ((b = i.supplier) == null ? void 0 : b.internal) !== "warehouse" && ((o = i.supplier) == null ? void 0 : o.internal) !== "restaurant";
824
- }
825
- ).reduce((i, b) => {
826
- const o = new Date(Qt(b._id)), r = b.supplier._id;
827
- for (const m of b.items) {
828
- if (!m.totalCost) continue;
829
- const h = i[m.sku._id] ?? {}, w = h[r] ?? [];
830
- w.push({
831
- date: o.toISOString(),
832
- totalUnit: m.quantity,
833
- totalCost: m.totalCost,
834
- unit: m.sku.unit,
835
- measurement: m.measurement,
836
- seqNumber: b.seqNumber
837
- }), h[r] = w, i[m.sku._id] = h;
838
- }
839
- return i;
840
- }, {});
841
- a.value = e;
842
- } catch {
843
- d.open({
844
- title: "Something went wrong",
845
- message: "Cannot retrieve supplier purchase history. Please try again."
846
- }), n.value = !1;
847
- }
848
- }
849
- const g = M(!1), a = M({});
850
- return {
851
- comparePricesToggle: n,
852
- comparePriceFetching: g,
853
- comparePriceBySku: a
854
- };
855
- }
856
- const yo = { class: "fm-typo-body-md-400 line-clamp-2 w-full" }, bo = { key: 0 }, go = ["colspan"], _o = /* @__PURE__ */ de({
857
- __name: "TransferItemTable",
858
- props: {
859
- templateItem: {},
860
- row: {},
861
- comparePriceBySku: {},
862
- showComparePrice: { type: Boolean },
863
- disabled: { type: Boolean }
864
- },
865
- emits: ["update:item"],
866
- setup(d) {
867
- function v(n) {
868
- return n.column.columnDef.meta;
869
- }
870
- return (n, u) => {
871
- var g, a;
872
- return x(), T(le, null, [
873
- l("tr", {
874
- class: K(["border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm", {
875
- "bg-fm-color-neutral-gray-100": n.row.getIsSelected()
876
- }])
877
- }, [
878
- (x(!0), T(le, null, he(n.row.getVisibleCells(), (k) => {
879
- var C, $, p, e;
880
- return x(), T("td", {
881
- key: k.id,
882
- class: K(["h-[56px] text-fm-color-typo-primary", ((C = v(k)) == null ? void 0 : C.cellClass) ?? "px-16"]),
883
- style: Tt({
884
- width: ($ = v(k)) == null ? void 0 : $.width,
885
- maxWidth: (p = v(k)) == null ? void 0 : p.maxWidth,
886
- textAlign: ((e = v(k)) == null ? void 0 : e.textAlign) ?? "left"
887
- })
888
- }, [
889
- l("span", yo, [
890
- f(t(pe), {
891
- render: k.column.columnDef.cell,
892
- props: k.getContext()
893
- }, null, 8, ["render", "props"])
894
- ])
895
- ], 6);
896
- }), 128))
897
- ], 2),
898
- n.showComparePrice && Object.keys(n.comparePriceBySku[(g = n.row.original.sku) == null ? void 0 : g._id] ?? {}).length > 0 ? (x(), T("tr", bo, [
899
- l("td", {
900
- colspan: n.row.getVisibleCells().length
901
- }, [
902
- f(Et, {
903
- prices: n.comparePriceBySku[(a = n.row.original.sku) == null ? void 0 : a._id]
904
- }, null, 8, ["prices"])
905
- ], 8, go)
906
- ])) : Q("", !0)
907
- ], 64);
908
- };
909
- }
910
- }), ho = {
911
- key: 0,
912
- class: "flex flex-col gap-8"
913
- }, ko = { class: "flex flex-col gap-4" }, xo = { class: "flex items-center gap-4" }, Co = {
914
- key: 0,
915
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-error"
916
- }, wo = /* @__PURE__ */ de({
917
- __name: "NetSuiteField",
918
- props: {
919
- required: { type: Boolean },
920
- disabled: { type: Boolean },
921
- supplier: {},
922
- setting: {},
923
- items: {},
924
- onChange: { type: Function }
925
- },
926
- emits: ["netsuite:ready"],
927
- setup(d, { emit: v }) {
928
- const n = He(), u = d, g = v, { t: a } = Ss(), k = M(!1), C = M();
929
- tt(() => {
930
- var i, b, o, r;
931
- let e = {
932
- id: "",
933
- subsidiary: { id: "", name: "" },
934
- errors: []
935
- };
936
- if (!n.isEnabled || !u.required) {
937
- g("netsuite:ready", e);
938
- return;
939
- }
940
- try {
941
- const m = n.currentLocationSubsidiary();
942
- u.setting ? e = {
943
- ...u.setting,
944
- subsidiary: {
945
- id: m.id || "",
946
- name: m.name
947
- }
948
- } : e = {
949
- ...e,
950
- subsidiary: {
951
- id: m.id || "",
952
- name: m.name
953
- }
954
- };
955
- const h = n.getAvailableItems(m.id), w = u.items.filter((c) => {
956
- if (c.measurement != null) {
957
- const y = n.getAvailableMeasurements(
958
- c.sku._id,
959
- m.id
960
- );
961
- return h.includes(c.sku._id) && y.includes(c.measurement.id);
962
- }
963
- return h.includes(c.sku._id);
964
- }).map((c) => c.sku._id);
965
- u.onChange(
966
- u.items.filter((c) => w.includes(c.sku._id)),
967
- e
968
- );
969
- } finally {
970
- u.supplier.internal ? C.value = n.getNetSuiteLocation(
971
- `${u.supplier.internal}_${u.supplier._id}`
972
- ) : C.value = n.getNetSuiteVendor(u.supplier._id);
973
- const m = u.supplier.internal ? n.getLocationSubsidiary((i = C.value) == null ? void 0 : i.netSuiteId).id : (b = C.value) == null ? void 0 : b.subsidiaryId, h = u.supplier.internal ? (o = n.currentLocationSubsidiary()) == null ? void 0 : o.id : (r = n.currentVendorSubsidiary(u.supplier._id)) == null ? void 0 : r.id;
974
- !n.isEnabled || m && n.isEnabled && m == h ? g("netsuite:ready", e) : k.value = !0;
975
- }
976
- });
977
- const $ = N(
978
- () => u.supplier.internal ? n.currentLocationSubsidiary() : n.currentVendorSubsidiary(u.supplier._id)
979
- ), p = N(() => {
980
- var e, i;
981
- return C.value == null ? `Cannot find the NetSuite location for "${u.supplier.name}"` : `The subsidiary of the request
982
- location is ${(i = n.getLocationSubsidiary((e = C.value) == null ? void 0 : e.netSuiteId)) == null ? void 0 : i.fullName}`;
983
- });
984
- return (e, i) => {
985
- const b = V("FmLabel"), o = V("FmIcon"), r = V("FmField"), m = V("FmTooltip");
986
- return t(n).isEnabled && u.required ? (x(), T("div", ho, [
987
- f(b, {
988
- label: `NetSuite ${t(a)("inventory.transfer.form.netsuite.subsidiary")}`
989
- }, null, 8, ["label"]),
990
- l("div", ko, [
991
- f(m, {
992
- "z-index": 51,
993
- placement: "left",
994
- disabled: e.disabled
995
- }, {
996
- content: O(() => i[0] || (i[0] = [
997
- Ae("This field is locked and based on the location of the request.")
998
- ])),
999
- default: O(() => [
1000
- f(r, null, {
1001
- default: O(() => {
1002
- var h;
1003
- return [
1004
- l("div", xo, [
1005
- f(o, {
1006
- name: "lock_outline",
1007
- size: "sm",
1008
- color: e.disabled ? "neutral-gray-200" : "neutral-gray-400"
1009
- }, null, 8, ["color"]),
1010
- l("div", {
1011
- class: K([e.disabled ? "text-fm-color-typo-disabled" : ""])
1012
- }, E((h = $.value) == null ? void 0 : h.fullName), 3)
1013
- ])
1014
- ];
1015
- }),
1016
- _: 1
1017
- })
1018
- ]),
1019
- _: 1
1020
- }, 8, ["disabled"]),
1021
- k.value ? (x(), T("div", Co, E(p.value), 1)) : Q("", !0)
1022
- ])
1023
- ])) : Q("", !0);
1024
- };
1025
- }
1026
- });
1027
- function Re(d) {
1028
- const v = qt(d);
1029
- if (Array.isArray(v))
1030
- return v.map(Re);
1031
- if (v !== null && typeof v == "object") {
1032
- const n = {};
1033
- for (const u in v)
1034
- Object.prototype.hasOwnProperty.call(v, u) && (n[u] = Re(v[u]));
1035
- return n;
1036
- }
1037
- return v;
1038
- }
1039
- function St(d) {
1040
- return {
1041
- dbName: d.dbName,
1042
- type: d.type,
1043
- name: d.name,
1044
- acceptRequest: d.acceptRequest ?? !1,
1045
- doc: d.doc
1046
- };
1047
- }
1048
- function Ft(d, v, n) {
1049
- const u = Re(d.suppliers ?? []), g = Re(v.allLocations ?? []).map(St), a = v._currentLocation ? St(Re(v._currentLocation)) : null, k = n.inventory ? [Re(n.inventory)] : [];
1050
- return {
1051
- suppliers: u,
1052
- locations: g,
1053
- currentLocation: a,
1054
- inventoryDoc: k
1055
- };
1056
- }
1057
- function So(d) {
1058
- const v = ct(), n = st(), u = ot(), g = Ft(v, n, u), a = Mt(ys({ env: g })), k = M(a.value.state()), C = (e) => {
1059
- k.value = e, d != null && d.onStateChange && d.onStateChange(Fo(a.value.toPurchaseOrder()));
1060
- };
1061
- a.value.addListener(C);
1062
- function $() {
1063
- const e = Ft(v, n, u);
1064
- a.value.updateFullEnv(e), k.value = a.value.state();
1065
- }
1066
- fe(
1067
- [
1068
- () => v.suppliers,
1069
- () => n.allLocations,
1070
- () => n._currentLocation,
1071
- () => u.inventory
1072
- ],
1073
- () => {
1074
- $();
1075
- },
1076
- { deep: !0 }
1077
- ), Nt(() => {
1078
- a.value.removeListener(C);
1079
- });
1080
- function p(e) {
1081
- var i;
1082
- at().mustUsePoTemplate || a.value.init(), e != null && e.template && ((i = e.templateDoc) != null && i.purchaseOrder) ? (e.items = e.templateDoc.purchaseOrder.items, a.value.initFromTemplate(e)) : a.value.initOutletToOutlet();
1083
- }
1084
- return {
1085
- controller: a,
1086
- state: k,
1087
- init: p
1088
- };
1089
- }
1090
- function Fo(d) {
1091
- const v = {};
1092
- for (const n in d)
1093
- d[n] !== null && d[n] !== void 0 && (v[n] = d[n]);
1094
- return v;
1095
- }
1096
- const Io = { class: "flex flex-col gap-4" }, $o = { class: "flex items-center gap-8 overflow-x-auto pb-12" }, Do = { class: "flex flex-col gap-16" }, To = { class: "flex flex-col gap-24" }, Vo = { class: "flex flex-col gap-8" }, Po = { class: "flex flex-col gap-4" }, Ro = { class: "flex items-center gap-4" }, Ao = { class: "flex flex-col gap-8" }, Oo = { class: "flex flex-col gap-4" }, Eo = { class: "flex items-center gap-4" }, qo = {
1097
- key: 3,
1098
- class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col"
1099
- }, Mo = {
1100
- key: 0,
1101
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
1102
- }, No = { class: "flex-1" }, Uo = { class: "flex-1" }, zo = {
1103
- key: 1,
1104
- class: "flex items-center gap-4"
1105
- }, Bo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary translate-y-[1px]" }, Lo = { class: "flex flex-col gap-16" }, Ho = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, jo = { class: "flex gap-8" }, Qo = { key: 0 }, Yo = /* @__PURE__ */ de({
1106
- __name: "TransferForm",
1107
- props: {
1108
- modelValue: {},
1109
- request: {},
1110
- disabled: { type: Boolean },
1111
- suppliers: {},
1112
- skus: {},
1113
- lastClosingDate: {}
1114
- },
1115
- emits: ["validation-success", "form:ready", "update:modelValue"],
1116
- setup(d, { expose: v, emit: n }) {
1117
- const u = d, g = n, { t: a } = be(), k = st(), C = ot(), $ = He(), p = at(), e = Ot(), { breakpoints: i } = dt(), b = N(() => i.value.xs || i.value.sm), o = So({
1118
- onStateChange: (s) => g("update:modelValue", s)
1119
- });
1120
- o.init(u.modelValue);
1121
- const { controller: r, state: m } = o, h = Dt({
1122
- value: !1
1123
- }), w = M(!1), c = M(0), y = M([]), I = N(
1124
- () => {
1125
- var s;
1126
- return ((s = u.modelValue) == null ? void 0 : s.templateDoc) ?? e.templates.find((_) => {
1127
- var G;
1128
- return _._id === ((G = u.modelValue) == null ? void 0 : G.template);
1129
- });
1130
- }
1131
- ), z = N(() => m.value.status === "DRAFT" || !m.value.rev), B = N(
1132
- () => {
1133
- var s;
1134
- return ((s = m.value.items) == null ? void 0 : s.map((_) => _.item)) || [];
1135
- }
1136
- );
1137
- tt(() => {
1138
- w.value = !0;
1139
- }), fe([w, h], ([s, _], [G, De]) => {
1140
- _.value && De.value && g("form:ready");
1141
- });
1142
- const X = N(
1143
- () => k.currentLocation.type === Yt.restaurant
1144
- ), oe = cs(), U = gs(
1145
- () => m.value,
1146
- (s) => {
1147
- r.value.setSupplier(s.supplier);
1148
- },
1149
- !0,
1150
- !0
1151
- ), P = N({
1152
- get() {
1153
- var s;
1154
- return typeof ((s = m.value.supplier) == null ? void 0 : s.internal) == "string" ? me.enum.transfer : me.enum.purchase;
1155
- },
1156
- set(s) {
1157
- r.value.selectType(s);
1158
- }
1159
- }), R = N(() => {
1160
- let s = U.transferLocationOptions.value;
1161
- return p.mustUsePoTemplate && !m.value.template && (s = s.filter((_) => {
1162
- var G;
1163
- return (G = _.sublabel) == null ? void 0 : G.startsWith("restaurant");
1164
- })), s;
1165
- }), D = N({
1166
- get() {
1167
- var s;
1168
- return (s = m.value.supplier) == null ? void 0 : s._id;
1169
- },
1170
- set(s) {
1171
- U.transferLocationModel.value = s;
1172
- }
1173
- }), q = M(m.value.remark ?? ""), L = M(m.value.ref ?? ""), Z = wt((s) => {
1174
- r.value.addRemark(s);
1175
- }, 300), S = wt((s) => {
1176
- r.value.addReference(s);
1177
- }, 300), F = N({
1178
- get() {
1179
- return q.value;
1180
- },
1181
- set(s) {
1182
- q.value = s ?? "", Z(s ?? "");
1183
- }
1184
- }), Y = N({
1185
- get() {
1186
- return L.value;
1187
- },
1188
- set(s) {
1189
- L.value = s ?? "", S(s ?? "");
1190
- }
1191
- });
1192
- fe(
1193
- () => m.value.remark,
1194
- (s) => {
1195
- s !== q.value && (q.value = s ?? "");
1196
- }
1197
- ), fe(
1198
- () => m.value.ref,
1199
- (s) => {
1200
- s !== L.value && (L.value = s ?? "");
1201
- }
1202
- );
1203
- const { backdatePo: J, backdateSwitch: re, backdateModel: W, backdateTimeModel: Fe } = Ws({
1204
- getEffectiveAt() {
1205
- return m.value.effectiveAt;
1206
- },
1207
- setEffectiveAt(s) {
1208
- r.value.setEffectiveAt(s);
1209
- }
1210
- }), { comparePricesToggle: ge, comparePriceFetching: ke, comparePriceBySku: Ee } = vo(), xe = M();
1211
- v({
1212
- validateInputs: () => {
1213
- var s, _;
1214
- (_ = (s = xe.value) == null ? void 0 : s.validateInputs) == null || _.call(s);
1215
- },
1216
- resetInputsValidation: () => {
1217
- var s, _;
1218
- (_ = (s = xe.value) == null ? void 0 : s.resetInputsValidation) == null || _.call(s);
1219
- },
1220
- resetInputs: () => {
1221
- var s, _;
1222
- (_ = (s = xe.value) == null ? void 0 : s.resetInputs) == null || _.call(s);
1223
- }
1224
- });
1225
- const Ie = N(() => ({
1226
- updateItem: (s) => {
1227
- const _ = Kt.parse(s), G = r.value.toFdtoPOItem(_);
1228
- r.value.updateSkuInfo(G);
1229
- },
1230
- deleteItem: (s) => {
1231
- r.value.removeSku(s.sku);
1232
- }
1233
- })), je = Rs({
1234
- updateItem: (s) => Ie.value.updateItem(s),
1235
- deleteItem: (s) => Ie.value.deleteItem(s),
1236
- get supplier() {
1237
- return m.value.supplier;
1238
- },
1239
- get items() {
1240
- return B.value;
1241
- },
1242
- get transferType() {
1243
- return P.value;
1244
- },
1245
- get template() {
1246
- return I.value;
1247
- },
1248
- get disabled() {
1249
- return u.disabled;
1250
- },
1251
- get forecastAmounts() {
1252
- return y.value;
1253
- }
1254
- }), $e = N(() => je.columnDefs.value);
1255
- function Qe() {
1256
- var Me, Ze, We, Ne, Ge;
1257
- const s = (We = (Ze = (Me = I.value) == null ? void 0 : Me.purchaseOrder) == null ? void 0 : Ze.items) == null ? void 0 : We.groupBy((H) => H.sku._id), _ = $.isEnabled ? $.getAvailableItems((Ge = (Ne = m.value.netSuite) == null ? void 0 : Ne.subsidiary) == null ? void 0 : Ge.id) : [], G = s != null && s.size ? C.skus.filter((H) => s.has(H._id)) : C.skus, De = $.isEnabled ? G.filter((H) => {
1258
- var ie, ae, ue, ce;
1259
- const ee = (ae = (ie = I.value) == null ? void 0 : ie.purchaseOrder) == null ? void 0 : ae.items.find(
1260
- (ve) => ve.sku._id === H._id
1261
- );
1262
- if (ee != null && ee.measurement != null) {
1263
- const ve = $.getAvailableMeasurements(
1264
- ee.sku._id,
1265
- (ce = (ue = m.value.netSuite) == null ? void 0 : ue.subsidiary) == null ? void 0 : ce.id
1266
- );
1267
- return _.includes(ee.sku._id) && ve.includes(ee.measurement.id);
1268
- }
1269
- return _.includes(H._id);
1270
- }).map((H) => H._id) : G.map((H) => H._id), Te = G.map(
1271
- (H) => {
1272
- var ee, ie, ae, ue;
1273
- return {
1274
- label: ((ie = (ee = s == null ? void 0 : s.get(H._id)) == null ? void 0 : ee[0]) == null ? void 0 : ie.name) ?? H.name,
1275
- sublabel: ((ue = (ae = s == null ? void 0 : s.get(H._id)) == null ? void 0 : ae[0]) == null ? void 0 : ue.code) ?? H.code,
1276
- value: H,
1277
- disabled: !!(!De.includes(H._id) || H.isInactive),
1278
- tags: H.isInactive ? ["Inactive"] : ["Active"]
1279
- };
1280
- }
1281
- ), Ke = Te.filter((H) => {
1282
- var ee;
1283
- return (ee = B.value) == null ? void 0 : ee.find((ie) => ie.sku._id === H.value._id);
1284
- }).map((H) => H.value), Xe = [
1285
- {
1286
- type: "string",
1287
- key: "tags",
1288
- entity: "item",
1289
- values: ["Inactive", "Active"]
1290
- }
1291
- ];
1292
- oe.open({
1293
- title: a("inventory.transfer.form.items.selectItem"),
1294
- closeButton: !0,
1295
- contentComponent: hs,
1296
- contentComponentProps: {
1297
- modelValue: Ke,
1298
- items: Te,
1299
- virtualScroll: !0,
1300
- filterAttributes: Xe
1301
- },
1302
- primaryActions: {
1303
- text: a("common.confirm"),
1304
- close: !0
1305
- },
1306
- secondaryActions: {
1307
- text: a("common.close"),
1308
- close: !0,
1309
- variant: "tertiary"
1310
- }
1311
- }).onPrimary((H) => {
1312
- const ee = B.value ?? [], ie = H.map((ae) => {
1313
- var ve, Ve;
1314
- const ue = ee.find((_e) => _e.sku._id === ae._id);
1315
- if (ue)
1316
- return ue;
1317
- const ce = ((Ve = (ve = I.value) == null ? void 0 : ve.purchaseOrder.items) == null ? void 0 : Ve.find(
1318
- (_e) => _e.sku._id === ae._id
1319
- )) ?? {
1320
- sku: ae,
1321
- code: ae.code,
1322
- name: ae.name,
1323
- quantity: {
1324
- amount: 1,
1325
- precision: 0
1326
- }
1327
- };
1328
- if (P.value == me.enum.purchase) {
1329
- const { cost: _e } = Pe(
1330
- ce.sku,
1331
- ce.quantity,
1332
- ce.measurement,
1333
- {
1334
- supplier: m.value.supplier
1335
- }
1336
- );
1337
- ce.totalCost = _e;
1338
- }
1339
- return ce;
1340
- });
1341
- ie.sort((ae, ue) => ae.sku.code.localeCompare(ue.sku.code)), r.value.updateItems(ie);
1342
- });
1343
- }
1344
- function nt(s) {
1345
- return s;
1346
- }
1347
- const Ye = N(() => {
1348
- var s;
1349
- return I.value ? ((s = I.value) == null ? void 0 : s.purchaseOrder.items) || [] : C.skus.map((_) => ({
1350
- quantity: {
1351
- amount: 0,
1352
- precision: 0
1353
- },
1354
- name: _.name,
1355
- code: _.code,
1356
- sku: _,
1357
- quantityStep: {
1358
- amount: 0,
1359
- precision: 0
1360
- },
1361
- measurement: _.trackingMeasurement ? _.unit.measurements.find((G) => G.id === _.trackingMeasurement) : null
1362
- }));
1363
- }), qe = N(() => {
1364
- const s = [];
1365
- return (!p.mustUsePoTemplate || p.mustUsePoTemplate && m.value.template) && s.push({
1366
- label: a("inventory.transfer.form.type.purchase"),
1367
- value: me.enum.purchase
1368
- }), s.push({
1369
- label: a("inventory.transfer.form.type.transfer"),
1370
- value: me.enum.transfer
1371
- }), s;
1372
- }), Ce = N(() => {
1373
- var s;
1374
- return (s = u.modelValue) == null ? void 0 : s.items.every((_) => _.quantity.amount <= 0);
1375
- });
1376
- return (s, _) => {
1377
- var ce, ve;
1378
- const G = V("FmChip"), De = V("FmLabel"), Te = V("FmIcon"), Ke = V("FmField"), Xe = V("FmTooltip"), Me = V("FmSelect"), Ze = V("FmTextField"), We = V("FmTextarea"), Ne = V("FmSwitch"), Ge = V("FmDatePicker"), H = V("FmTimePicker"), ee = V("FmFormGroup"), ie = V("FmButton"), ae = V("FmTable"), ue = V("FmForm");
1379
- return x(), T("div", Io, [
1380
- l("div", $o, [
1381
- (ce = u.modelValue) != null && ce.template ? (x(), se(G, {
1382
- key: 0,
1383
- variant: s.disabled ? "warning" : void 0,
1384
- label: `${t(a)("inventory.transfer.template.title")}: ${((ve = I.value) == null ? void 0 : ve.name) ?? t(a)("inventory.transfer.form.loading")}`,
1385
- icon: "summarize",
1386
- compact: ""
1387
- }, null, 8, ["variant", "label"])) : Q("", !0),
1388
- f(G, {
1389
- label: t(k).currentLocation.name,
1390
- icon: "storefront",
1391
- compact: ""
1392
- }, null, 8, ["label"]),
1393
- s.lastClosingDate ? (x(), se(G, {
1394
- key: 1,
1395
- label: `${t(a)("inventory.transfer.form.lastClosing")}: ${t(mt)(s.lastClosingDate)} ${t(Cs)(s.lastClosingDate)}`,
1396
- icon: "calendar_month",
1397
- compact: ""
1398
- }, null, 8, ["label"])) : Q("", !0)
1399
- ]),
1400
- f(ue, {
1401
- ref_key: "formRef",
1402
- ref: xe,
1403
- class: "flex flex-col gap-32",
1404
- disabled: s.disabled,
1405
- onValidationFailed: console.log,
1406
- onValidationSuccess: _[14] || (_[14] = (Ve) => g("validation-success"))
1407
- }, {
1408
- default: O(() => {
1409
- var Ve, _e, ft, vt, yt, bt, gt, _t;
1410
- return [
1411
- l("div", Do, [
1412
- l("div", To, [
1413
- (Ve = u.modelValue) != null && Ve.template ? (x(), T(le, { key: 0 }, [
1414
- l("div", Vo, [
1415
- f(De, {
1416
- label: t(a)("inventory.transfer.form.type.title")
1417
- }, null, 8, ["label"]),
1418
- l("div", Po, [
1419
- f(Xe, {
1420
- "z-index": 51,
1421
- placement: "left",
1422
- disabled: s.disabled
1423
- }, {
1424
- content: O(() => _[15] || (_[15] = [
1425
- Ae("This field is locked from template.")
1426
- ])),
1427
- default: O(() => [
1428
- f(Ke, null, {
1429
- default: O(() => [
1430
- l("div", Ro, [
1431
- f(Te, {
1432
- name: "lock_outline",
1433
- size: "sm",
1434
- color: s.disabled ? "neutral-gray-200" : "neutral-gray-400"
1435
- }, null, 8, ["color"]),
1436
- l("div", {
1437
- class: K({ "text-fm-color-typo-disabled": s.disabled })
1438
- }, E(t(a)(`inventory.transfer.form.type.${P.value.toLocaleLowerCase("en-us")}`)), 3)
1439
- ])
1440
- ]),
1441
- _: 1
1442
- })
1443
- ]),
1444
- _: 1
1445
- }, 8, ["disabled"]),
1446
- l("div", {
1447
- class: K([
1448
- "fm-typo-en-body-sm-400",
1449
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
1450
- ])
1451
- }, null, 2)
1452
- ])
1453
- ]),
1454
- l("div", Ao, [
1455
- f(De, {
1456
- label: P.value === t(me).enum.purchase ? t(a)("inventory.transfer.form.purchaseFrom") : t(a)("inventory.transfer.form.transferFrom")
1457
- }, null, 8, ["label"]),
1458
- l("div", Oo, [
1459
- f(Xe, {
1460
- "z-index": 51,
1461
- placement: "left",
1462
- disabled: s.disabled
1463
- }, {
1464
- content: O(() => _[16] || (_[16] = [
1465
- Ae("This field is locked from template.")
1466
- ])),
1467
- default: O(() => [
1468
- f(Ke, null, {
1469
- default: O(() => {
1470
- var A;
1471
- return [
1472
- l("div", Eo, [
1473
- f(Te, {
1474
- name: "lock_outline",
1475
- size: "sm",
1476
- color: s.disabled ? "neutral-gray-200" : "neutral-gray-400"
1477
- }, null, 8, ["color"]),
1478
- l("div", {
1479
- class: K({ "text-fm-color-typo-disabled": s.disabled })
1480
- }, E((A = R.value.find((ne) => ne.value === D.value)) == null ? void 0 : A.label), 3)
1481
- ])
1482
- ];
1483
- }),
1484
- _: 1
1485
- })
1486
- ]),
1487
- _: 1
1488
- }, 8, ["disabled"])
1489
- ])
1490
- ])
1491
- ], 64)) : (x(), T(le, { key: 1 }, [
1492
- f(Me, {
1493
- label: t(a)("inventory.transfer.form.type.title"),
1494
- "label-mark": "required",
1495
- modelValue: P.value,
1496
- "onUpdate:modelValue": _[0] || (_[0] = (A) => P.value = A),
1497
- items: qe.value,
1498
- rules: [t(Le)(1)(qe.value)]
1499
- }, {
1500
- default: O(() => [
1501
- l("span", {
1502
- class: K([
1503
- "line-clamp-1 fm-typo-en-body-lg-400",
1504
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
1505
- ])
1506
- }, E(t(Xt)(P.value)), 3)
1507
- ]),
1508
- _: 1
1509
- }, 8, ["label", "modelValue", "items", "rules"]),
1510
- f(Me, {
1511
- label: P.value === t(me).enum.purchase ? t(a)("inventory.transfer.form.purchaseFrom") : t(a)("inventory.transfer.form.transferFrom"),
1512
- "label-mark": "required",
1513
- modelValue: D.value,
1514
- "onUpdate:modelValue": _[1] || (_[1] = (A) => D.value = A),
1515
- items: R.value,
1516
- rules: [t(Le)(1)(R.value)]
1517
- }, {
1518
- "menu-wrapper": O((A) => {
1519
- var ne, Ue;
1520
- return [
1521
- f(_s, it(A, {
1522
- items: R.value,
1523
- "model-value": (Ue = (ne = s.modelValue) == null ? void 0 : ne.supplier) == null ? void 0 : Ue._id
1524
- }), null, 16, ["items", "model-value"])
1525
- ];
1526
- }),
1527
- default: O(() => {
1528
- var A;
1529
- return [
1530
- l("span", {
1531
- class: K([
1532
- "line-clamp-1 fm-typo-en-body-lg-400",
1533
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
1534
- ])
1535
- }, E((A = R.value.find((ne) => ne.value === D.value)) == null ? void 0 : A.label), 3)
1536
- ];
1537
- }),
1538
- _: 1
1539
- }, 8, ["label", "modelValue", "items", "rules"])
1540
- ], 64)),
1541
- f(Ze, {
1542
- label: t(a)("inventory.transfer.form.reference"),
1543
- "label-mark": "optional",
1544
- modelValue: Y.value,
1545
- "onUpdate:modelValue": _[2] || (_[2] = (A) => Y.value = A)
1546
- }, null, 8, ["label", "modelValue"]),
1547
- f(We, {
1548
- label: t(a)("inventory.transfer.form.remark"),
1549
- "label-mark": "optional",
1550
- "max-length": 240,
1551
- modelValue: F.value,
1552
- "onUpdate:modelValue": _[3] || (_[3] = (A) => F.value = A),
1553
- class: K([s.disabled ? "text-fm-color-typo-disabled " : ""])
1554
- }, null, 8, ["label", "modelValue", "class"]),
1555
- w.value ? (x(), se(wo, {
1556
- key: 2,
1557
- required: t(m).template != null,
1558
- disabled: s.disabled,
1559
- supplier: t(m).supplier,
1560
- setting: t(m).netSuite,
1561
- items: B.value,
1562
- onChange: (A, ne) => {
1563
- t(r).updateItems(A), t(r).setNetSuiteSetting(ne);
1564
- },
1565
- "onNetsuite:ready": _[4] || (_[4] = (A) => {
1566
- h.value = !0;
1567
- })
1568
- }, null, 8, ["required", "disabled", "supplier", "setting", "items", "onChange"])) : Q("", !0),
1569
- t(p).enableBackdatePo ? (x(), T("div", qo, [
1570
- l("div", {
1571
- class: K([
1572
- "flex",
1573
- {
1574
- "flex-col": b.value
1575
- }
1576
- ])
1577
- }, [
1578
- f(Ne, {
1579
- modelValue: t(re),
1580
- "onUpdate:modelValue": _[5] || (_[5] = (A) => we(re) ? re.value = A : null),
1581
- label: t(a)("inventory.transfer.form.backdate.title"),
1582
- sublabel: t(a)("inventory.transfer.form.backdate.subtitle"),
1583
- "label-placement": "right",
1584
- disabled: X.value && !s.lastClosingDate || s.disabled
1585
- }, null, 8, ["modelValue", "label", "sublabel", "disabled"]),
1586
- l("div", {
1587
- class: K({ hidden: b.value, "w-16": !b.value })
1588
- }, null, 2),
1589
- t(re) ? (x(), T("div", Mo, [
1590
- l("div", No, [
1591
- f(Ge, {
1592
- modelValue: t(W),
1593
- "onUpdate:modelValue": _[6] || (_[6] = (A) => we(W) ? W.value = A : null)
1594
- }, null, 8, ["modelValue"])
1595
- ]),
1596
- l("div", Uo, [
1597
- f(H, {
1598
- modelValue: t(Fe),
1599
- "onUpdate:modelValue": _[7] || (_[7] = (A) => we(Fe) ? Fe.value = A : null)
1600
- }, null, 8, ["modelValue"])
1601
- ])
1602
- ])) : Q("", !0)
1603
- ], 2),
1604
- t(J) ? (x(), se(ee, {
1605
- key: 0,
1606
- modelValue: t(J),
1607
- "onUpdate:modelValue": _[8] || (_[8] = (A) => we(J) ? J.value = A : null),
1608
- rules: [t(os)(new Date(s.lastClosingDate), /* @__PURE__ */ new Date())]
1609
- }, null, 8, ["modelValue", "rules"])) : Q("", !0),
1610
- X.value && !s.lastClosingDate ? (x(), T("div", zo, [
1611
- f(Te, {
1612
- name: "error",
1613
- size: "sm",
1614
- class: "text-fm-color-typo-warning"
1615
- }),
1616
- l("span", Bo, E(t(a)("inventory.transfer.form.backdate.error")), 1)
1617
- ])) : Q("", !0)
1618
- ])) : Q("", !0)
1619
- ])
1620
- ]),
1621
- l("div", Lo, [
1622
- f(ee, {
1623
- "model-value": B.value,
1624
- rules: [t(Le)(1)]
1625
- }, null, 8, ["model-value", "rules"]),
1626
- l("div", {
1627
- class: K([
1628
- "flex gap-16",
1629
- {
1630
- "flex-col items-start": b.value,
1631
- "items-center": !b.value
1632
- }
1633
- ])
1634
- }, [
1635
- l("div", Ho, E(t(a)("inventory.transfer.form.items.title")), 1),
1636
- l("div", jo, [
1637
- f(ie, {
1638
- disabled: s.disabled,
1639
- label: t(a)("inventory.transfer.form.items.addItem"),
1640
- "prepend-icon": "add",
1641
- variant: "secondary",
1642
- "text-color": "primary",
1643
- "bg-color": "transparent",
1644
- "border-color": "primary",
1645
- onClick: _[9] || (_[9] = (A) => Qe()),
1646
- size: "md"
1647
- }, null, 8, ["disabled", "label"]),
1648
- f(fo, {
1649
- "template-id": t(m).template || void 0,
1650
- "template-items": Ye.value,
1651
- "po-items": B.value,
1652
- "onUpdate:forecastAmounts": _[10] || (_[10] = (A) => {
1653
- y.value = A;
1654
- }),
1655
- "onUpdate:poItems": _[11] || (_[11] = (A) => {
1656
- t(r).updateItems(A), c.value++;
1657
- })
1658
- }, null, 8, ["template-id", "template-items", "po-items"])
1659
- ])
1660
- ], 2),
1661
- P.value === t(me).enum.purchase && z.value && t(p).enableTotalCost && ((_e = s.modelValue) != null && _e.items.length) ? (x(), T("div", Qo, [
1662
- f(Ne, {
1663
- label: t(ke) ? t(a)("inventory.transfer.form.items.fetchingData") : t(a)("inventory.transfer.form.items.comparePriceHistory"),
1664
- "prepend-icon": "compare_arrows",
1665
- "label-placement": "right",
1666
- "model-value": t(ge),
1667
- "onUpdate:modelValue": _[12] || (_[12] = (A) => we(ge) ? ge.value = A : null),
1668
- disabled: t(ke) || s.disabled
1669
- }, null, 8, ["label", "model-value", "disabled"])
1670
- ])) : Q("", !0),
1671
- f(ee, {
1672
- "model-value": Ce.value,
1673
- rules: [() => Ce.value ? "Must have at least one non-zero item" : !0]
1674
- }, null, 8, ["model-value", "rules"]),
1675
- (x(), se(ae, {
1676
- "column-defs": $e.value,
1677
- "column-visibility": {
1678
- [t(te).Code]: !(((ft = s.modelValue) == null ? void 0 : ft.template) ?? ((vt = s.modelValue) == null ? void 0 : vt.templateDoc)),
1679
- [t(te).Name]: !(((yt = s.modelValue) == null ? void 0 : yt.template) ?? ((bt = s.modelValue) == null ? void 0 : bt.templateDoc)),
1680
- [t(te).TemplateName]: !!(((gt = s.modelValue) == null ? void 0 : gt.template) ?? ((_t = s.modelValue) == null ? void 0 : _t.templateDoc))
1681
- },
1682
- "row-data": B.value,
1683
- key: c.value,
1684
- "hide-footer": "",
1685
- "page-size": B.value.length
1686
- }, {
1687
- "table-row": O((A) => {
1688
- var ne, Ue, ht, kt;
1689
- return [
1690
- f(_o, {
1691
- "compare-price-by-sku": t(Ee),
1692
- "show-compare-price": P.value === t(me).enum.purchase && t(ge),
1693
- row: A,
1694
- "template-item": (kt = (ht = (Ue = (ne = s.modelValue) == null ? void 0 : ne.templateDoc) == null ? void 0 : Ue.purchaseOrder) == null ? void 0 : ht.items) == null ? void 0 : kt.find(
1695
- (lt) => lt.sku._id === A.original.sku._id
1696
- ),
1697
- "onUpdate:item": _[13] || (_[13] = (lt) => Ie.value.updateItem(lt)),
1698
- disabled: s.disabled
1699
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "template-item", "disabled"])
1700
- ];
1701
- }),
1702
- "list-row": O((A) => [
1703
- (x(), se(At, {
1704
- row: A,
1705
- key: B.value.map((ne) => ne.sku._id).join(".")
1706
- }, {
1707
- default: O((ne) => [
1708
- f(Zs, {
1709
- "compare-price-by-sku": t(Ee),
1710
- "show-compare-price": P.value === t(me).enum.purchase && t(ge),
1711
- row: A,
1712
- "cell-by-col-id": ne
1713
- }, null, 8, ["compare-price-by-sku", "show-compare-price", "row", "cell-by-col-id"])
1714
- ]),
1715
- _: 2
1716
- }, 1032, ["row"]))
1717
- ]),
1718
- _: 1
1719
- }, 8, ["column-defs", "column-visibility", "row-data", "page-size"]))
1720
- ])
1721
- ];
1722
- }),
1723
- _: 1
1724
- }, 8, ["disabled", "onValidationFailed"])
1725
- ]);
1726
- };
1727
- }
1728
- }), Ko = { class: "flex items-center" }, Xo = { class: "fm-typo-en-title-md-800" }, Zo = { class: "flex gap-4" }, Wo = { class: "fm-typo-en-title-md-600" }, Go = { class: "flex flex-col gap-16" }, Jo = { class: "fm-typo-en-body-md-400" }, ea = { class: "max-h-[300px] overflow-y-auto" }, ta = { class: "list-disc pl-16" }, sa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, oa = { class: "flex w-full gap-8 justify-end" }, aa = /* @__PURE__ */ de({
1729
- __name: "TransferDialog",
1730
- props: {
1731
- mode: {},
1732
- modelValue: {},
1733
- templateId: {},
1734
- show: { type: Boolean },
1735
- lastClosingDate: {}
1736
- },
1737
- emits: ["update:show", "submitted"],
1738
- setup(d, { expose: v, emit: n }) {
1739
- var Z;
1740
- const u = d, g = n, a = pt(), k = Ot(), C = Oe(), $ = ct(), p = ot(), e = st(), { t: i } = be(), b = M(!1), o = M(!1), r = M(!1), m = M(!1), h = N(() => {
1741
- var S;
1742
- return ((S = I.value.items) == null ? void 0 : S.filter((F) => F.quantity.amount === 0)) ?? [];
1743
- });
1744
- async function w(S) {
1745
- if (S) {
1746
- o.value = !1;
1747
- try {
1748
- await $.readSuppliers(), o.value = !0;
1749
- } catch {
1750
- C.open({
1751
- title: i("inventory.transfer.form.unableToFetchListOfSuppliers.title"),
1752
- message: i("inventory.transfer.form.unableToFetchListOfSuppliers.message"),
1753
- type: "error"
1754
- });
1755
- }
1756
- }
1757
- }
1758
- e.watchLocation(w);
1759
- function c() {
1760
- return {
1761
- remark: void 0,
1762
- ref: void 0,
1763
- stockSnapshotId: void 0,
1764
- effectiveAt: void 0,
1765
- items: [],
1766
- supplier: {
1767
- _rev: void 0,
1768
- email: void 0,
1769
- internal: void 0,
1770
- contactName: void 0,
1771
- phoneNumber: void 0,
1772
- registrationNumber: void 0,
1773
- supplyItems: void 0,
1774
- _id: "",
1775
- name: "",
1776
- address: {
1777
- line2: void 0,
1778
- line1: "",
1779
- state: "",
1780
- city: "",
1781
- postcode: "",
1782
- country: ""
1783
- }
1784
- },
1785
- status: "DRAFT",
1786
- _id: "",
1787
- seqNumber: 0,
1788
- deliveryOrder: [],
1789
- template: u.templateId,
1790
- templateDoc: k.templates.find((F) => F._id === u.templateId)
1791
- };
1792
- }
1793
- const y = Rt(u, "show"), I = M(u.modelValue ?? c()), z = M(((Z = u.modelValue) == null ? void 0 : Z._id) ?? `${Math.random()}`);
1794
- fe(
1795
- () => u.show,
1796
- (S) => {
1797
- var F;
1798
- S && (r.value = !1, I.value = u.modelValue ?? c(), z.value = ((F = u.modelValue) == null ? void 0 : F._id) ?? `${Math.random()}`);
1799
- }
1800
- );
1801
- const B = N(() => !o.value || !r.value), X = N(() => {
1802
- switch (u.mode) {
1803
- case ze.READ:
1804
- return "View transfer";
1805
- case ze.CREATE:
1806
- return i("inventory.transfer.receiveRequest.create.title");
1807
- case ze.UPDATE:
1808
- return i("inventory.transfer.receiveRequest.update.title");
1809
- }
1810
- return "";
1811
- }), oe = M();
1812
- v({
1813
- validateInputs: () => {
1814
- var S, F;
1815
- (F = (S = oe.value) == null ? void 0 : S.validateInputs) == null || F.call(S);
1816
- },
1817
- resetInputsValidation: () => {
1818
- var S, F;
1819
- (F = (S = oe.value) == null ? void 0 : S.resetInputsValidation) == null || F.call(S);
1820
- },
1821
- resetInputs: () => {
1822
- var S, F;
1823
- (F = (S = oe.value) == null ? void 0 : S.resetInputs) == null || F.call(S);
1824
- }
1825
- });
1826
- async function U() {
1827
- const S = I.value;
1828
- if (b.value = !0, S.items = S.items.filter((F) => F.quantity.amount > 0), !S.items.length) {
1829
- C.open({
1830
- title: "Cannot create order",
1831
- message: "There are no items with non-zero amount in your request.",
1832
- type: "error"
1833
- });
1834
- return;
1835
- }
1836
- (S.supplier.internal === "warehouse" || S.supplier.internal === "restaurant") && (S.items = S.items.map(({ totalCost: F, ...Y }) => Y));
1837
- try {
1838
- await a.createPurchaseOrder(S), await new Promise((F) => setTimeout(F, 1e3)), C.open({
1839
- title: i("inventory.transfer.receiveRequest.create.success"),
1840
- message: i("inventory.transfer.receiveRequest.create.successMessage"),
1841
- type: "success"
1842
- }), g("update:show", !1), g("submitted");
1843
- } catch (F) {
1844
- C.open({
1845
- title: i("inventory.transfer.receiveRequest.create.error.title"),
1846
- message: i("inventory.transfer.receiveRequest.create.error.message"),
1847
- type: "error"
1848
- }), console.error("Error in creating purchase order", F);
1849
- } finally {
1850
- b.value = !1;
1851
- }
1852
- }
1853
- async function P() {
1854
- const S = I.value;
1855
- if (b.value = !0, S.items = S.items.filter((F) => F.quantity.amount > 0), !S.items.length) {
1856
- C.open({
1857
- title: "Cannot create order",
1858
- message: "There are no items with non-zero amount in your request.",
1859
- type: "error"
1860
- });
1861
- return;
1862
- }
1863
- (S.supplier.internal === "warehouse" || S.supplier.internal === "restaurant") && (S.items = S.items.map(({ totalCost: F, ...Y }) => Y));
1864
- try {
1865
- await a.updatePurchaseOrder(S), await new Promise((F) => setTimeout(F, 1e3)), C.open({
1866
- title: i("inventory.transfer.receiveRequest.update.success"),
1867
- message: i("inventory.transfer.receiveRequest.update.successMessage"),
1868
- type: "success"
1869
- }), g("update:show", !1), g("submitted");
1870
- } catch (F) {
1871
- C.open({
1872
- title: i("inventory.transfer.receiveRequest.update.error.title"),
1873
- message: i("inventory.transfer.receiveRequest.update.error.message"),
1874
- type: "error"
1875
- }), console.error("Error in updating purchase order", F);
1876
- } finally {
1877
- b.value = !1;
1878
- }
1879
- }
1880
- function R() {
1881
- switch (u.mode) {
1882
- case ze.CREATE:
1883
- return U();
1884
- case ze.UPDATE:
1885
- return P();
1886
- }
1887
- }
1888
- function D() {
1889
- var S;
1890
- I.value.items = ((S = I.value.items) == null ? void 0 : S.filter((F) => F.quantity.amount > 0)) ?? [], m.value = !1, q();
1891
- }
1892
- function q() {
1893
- var Y, J;
1894
- const S = bs.validatePurchaseOrderItems({
1895
- skusById: p.skuById ?? {},
1896
- items: I.value.items ?? []
1897
- }), F = Object.values(S).flat();
1898
- if (F.length > 0) {
1899
- const re = F[0];
1900
- C.open({
1901
- title: `[Row ${re.index + 1}] "${re.poItem.sku.name}"`,
1902
- message: `${re.message}`,
1903
- type: "error"
1904
- });
1905
- return;
1906
- }
1907
- (J = (Y = oe.value) == null ? void 0 : Y.validateInputs) == null || J.call(Y);
1908
- }
1909
- function L() {
1910
- if (h.value.length > 0) {
1911
- m.value = !0;
1912
- return;
1913
- }
1914
- q();
1915
- }
1916
- return (S, F) => {
1917
- const Y = V("FmButton"), J = V("FmSideSheet"), re = V("FmDialog");
1918
- return x(), T(le, null, [
1919
- f(J, {
1920
- modelValue: t(y),
1921
- "onUpdate:modelValue": F[3] || (F[3] = (W) => we(y) ? y.value = W : null),
1922
- "dismiss-away": "",
1923
- "close-button": "",
1924
- "max-width": 900
1925
- }, {
1926
- "side-sheet-header": O(() => [
1927
- l("div", Ko, [
1928
- l("div", Xo, E(X.value), 1)
1929
- ])
1930
- ]),
1931
- default: O(() => [
1932
- (x(), se(Yo, {
1933
- class: "w-full",
1934
- ref_key: "formRef",
1935
- ref: oe,
1936
- "onForm:ready": F[0] || (F[0] = () => r.value = !0),
1937
- onValidationSuccess: R,
1938
- modelValue: I.value,
1939
- "onUpdate:modelValue": F[1] || (F[1] = (W) => I.value = W),
1940
- disabled: b.value || B.value,
1941
- suppliers: t($).suppliers,
1942
- skus: t(p).skus,
1943
- key: z.value,
1944
- "last-closing-date": S.lastClosingDate
1945
- }, null, 8, ["modelValue", "disabled", "suppliers", "skus", "last-closing-date"]))
1946
- ]),
1947
- "side-sheet-footer": O(() => [
1948
- l("div", Zo, [
1949
- f(Y, {
1950
- loading: b.value,
1951
- disabled: B.value,
1952
- label: t(i)("common.save"),
1953
- onClick: L
1954
- }, null, 8, ["loading", "disabled", "label"]),
1955
- f(Y, {
1956
- disabled: B.value,
1957
- variant: "tertiary",
1958
- label: t(i)("common.close"),
1959
- onClick: F[2] || (F[2] = (W) => g("update:show", !1))
1960
- }, null, 8, ["disabled", "label"])
1961
- ])
1962
- ]),
1963
- _: 1
1964
- }, 8, ["modelValue"]),
1965
- f(re, {
1966
- modelValue: m.value,
1967
- "onUpdate:modelValue": F[5] || (F[5] = (W) => m.value = W),
1968
- overlay: !0
1969
- }, {
1970
- "dialog-header": O(() => [
1971
- l("div", Wo, E(t(i)("inventory.transfer.template.zeroQuantity.title")), 1)
1972
- ]),
1973
- "dialog-footer": O(() => [
1974
- l("div", oa, [
1975
- f(Y, {
1976
- label: t(i)("common.cancel"),
1977
- variant: "tertiary",
1978
- onClick: F[4] || (F[4] = (W) => m.value = !1)
1979
- }, null, 8, ["label"]),
1980
- f(Y, {
1981
- label: t(i)("inventory.transfer.template.zeroQuantity.removeAll"),
1982
- variant: "primary",
1983
- "prepend-icon": "delete",
1984
- onClick: D
1985
- }, null, 8, ["label"])
1986
- ])
1987
- ]),
1988
- default: O(() => [
1989
- l("div", Go, [
1990
- l("div", Jo, E(t(i)("inventory.transfer.template.zeroQuantity.message", { count: h.value.length })), 1),
1991
- l("div", ea, [
1992
- l("ul", ta, [
1993
- (x(!0), T(le, null, he(h.value, (W) => (x(), T("li", {
1994
- key: W.sku._id,
1995
- class: "fm-typo-en-body-md-400"
1996
- }, E(W.sku.name) + " (" + E(W.sku.code) + ") ", 1))), 128))
1997
- ])
1998
- ]),
1999
- l("div", sa, E(t(i)("inventory.transfer.template.zeroQuantity.prompt")), 1)
2000
- ])
2001
- ]),
2002
- _: 1
2003
- }, 8, ["modelValue"])
2004
- ], 64);
2005
- };
2006
- }
2007
- });
2008
- function na(d) {
2009
- const [v, n, u, ...g] = Fs(d), a = u.map((p) => p.toLowerCase().trim().replace(/ /g, "_")), C = ["item_name", "transfer_quantity(uom)", "uom", "scanned_code"].filter((p) => !a.includes(p));
2010
- if (C.length)
2011
- throw new Error(
2012
- `Missing headers (${C.join()}). Excel file does not come from the template.`
2013
- );
2014
- return g.map((p, e) => {
2015
- const i = {};
2016
- for (const b in a) {
2017
- const o = a[b];
2018
- Object.assign(i, { [o]: p[b] });
2019
- }
2020
- return {
2021
- index: e,
2022
- data: i
2023
- };
2024
- });
2025
- }
2026
- function la(d) {
2027
- const v = d.SheetNames;
2028
- try {
2029
- return v.reduce(
2030
- (u, g) => {
2031
- const a = new Array(), k = d.Sheets[g], C = ot(), $ = na(k), p = [];
2032
- for (const { index: i, data: b } of $) {
2033
- b.scanned_code === "" && a.push(`Row ${i + 1}: Scanned code is empty`), b.item_name === "" && a.push(`Row ${i + 1}: Item name is empty`), b.uom === "" && a.push(`Row ${i + 1}: UOM is empty`), b["transfer_quantity(uom)"] === "" && a.push(`Row ${i + 1}: Transfer quantity is empty`);
2034
- const o = C.skus.find((h) => h.code === b.scanned_code);
2035
- if (!o) {
2036
- a.push(`Row ${i + 1}: SKU not found`);
2037
- continue;
2038
- }
2039
- const r = o.unit.abbrev === b.uom;
2040
- let m = null;
2041
- if (!r) {
2042
- const h = o.unit.measurements.find((w) => w.abbrev === b.uom);
2043
- if (!h) {
2044
- a.push(`Row ${i + 1}: Measurement not found`);
2045
- continue;
2046
- }
2047
- m = h;
2048
- }
2049
- p.push({
2050
- sku: o,
2051
- code: b.scanned_code,
2052
- name: b.item_name,
2053
- quantity: ut.fromNumber(Number(b["transfer_quantity(uom)"])),
2054
- measurement: m
2055
- });
2056
- }
2057
- const e = {
2058
- type: "create",
2059
- poItems: p,
2060
- excelSheetName: g,
2061
- errors: a
2062
- };
2063
- return u.importCreateResult.push(e), u;
2064
- },
2065
- {
2066
- invalidExcel: !1,
2067
- importCreateResult: new Array()
2068
- }
2069
- );
2070
- } catch (n) {
2071
- return {
2072
- invalidExcel: !0,
2073
- invalidExcelMessage: (n == null ? void 0 : n.message) ?? "Invalid excel",
2074
- importCreateResult: []
2075
- };
2076
- }
2077
- }
2078
- const ra = { class: "flex flex-col flex-1" }, ia = { class: "flex flex-col" }, ua = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, da = {
2079
- key: 0,
2080
- class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
2081
- }, ca = { key: 0 }, ma = {
2082
- class: /* @__PURE__ */ K(["fm-typo-en-body-lg-600"])
2083
- }, pa = { class: "flex-1" }, fa = { class: "flex-auto line-clamp-2 text-ellipsis break-all fm-typo-en-body-sm-400" }, va = { class: "flex-auto line-clamp-2 text-ellipsis break-all" }, ya = { class: "text-fm-color-typo-primary" }, ba = { class: "ml-auto" }, ga = { key: 0 }, _a = /* @__PURE__ */ de({
2084
- __name: "XilnexResult",
2085
- props: {
2086
- type: {},
2087
- name: {},
2088
- items: {},
2089
- errors: {}
2090
- },
2091
- setup(d) {
2092
- const v = d, { t: n } = be(), u = M(!1), g = () => {
2093
- v.errors.length && (u.value = !u.value);
2094
- };
2095
- return (a, k) => {
2096
- var p;
2097
- const C = V("FmIcon"), $ = V("FmTooltip");
2098
- return x(), T("div", ra, [
2099
- l("div", {
2100
- onClick: g,
2101
- class: K({
2102
- "cursor-pointer": a.errors.length
2103
- })
2104
- }, [
2105
- l("div", ia, [
2106
- l("div", ua, [
2107
- l("div", {
2108
- class: K({
2109
- "text-fm-color-system-error-300": a.errors.length
2110
- })
2111
- }, [
2112
- Ae(E(a.name) + " ", 1),
2113
- a.type === "create" ? (x(), T("span", da, "(" + E(t(n)("inventory.closing.template.import.new")) + ")", 1)) : Q("", !0)
2114
- ], 2),
2115
- a.errors.length ? (x(), T("div", ca, [
2116
- f(C, {
2117
- name: "error",
2118
- size: "sm",
2119
- color: "system-error-300"
2120
- })
2121
- ])) : Q("", !0)
2122
- ]),
2123
- k[0] || (k[0] = l("hr", { class: "my-2" }, null, -1)),
2124
- l("div", ma, [
2125
- (p = a.items) != null && p.length ? (x(!0), T(le, { key: 0 }, he(a.items, (e, i) => (x(), T("div", {
2126
- key: i,
2127
- class: "flex gap-4 mt-2 items-center"
2128
- }, [
2129
- l("div", pa, [
2130
- f($, {
2131
- content: e.code,
2132
- placement: "top",
2133
- "z-index": 51
2134
- }, {
2135
- default: O(() => [
2136
- l("span", fa, E(e.code), 1)
2137
- ]),
2138
- _: 2
2139
- }, 1032, ["content"]),
2140
- f($, {
2141
- content: e.name,
2142
- placement: "top",
2143
- "z-index": 51
2144
- }, {
2145
- default: O(() => [
2146
- l("span", va, E(e.name), 1)
2147
- ]),
2148
- _: 2
2149
- }, 1032, ["content"])
2150
- ]),
2151
- l("div", null, [
2152
- l("span", ya, E(t(ut).toFormatString({
2153
- value: e.quantity
2154
- })), 1),
2155
- Ae(" " + E(e.measurement ? e.measurement.abbrev : e.sku.unit.abbrev), 1)
2156
- ])
2157
- ]))), 128)) : Q("", !0)
2158
- ])
2159
- ]),
2160
- l("div", ba, [
2161
- a.errors.length ? (x(), se(C, {
2162
- key: 0,
2163
- name: u.value ? "keyboard_arrow_up" : "keyboard_arrow_down",
2164
- size: "md"
2165
- }, null, 8, ["name"])) : Q("", !0)
2166
- ])
2167
- ], 2),
2168
- u.value ? (x(), T("div", {
2169
- key: 0,
2170
- class: K(["flex flex-col gap-4 pl-8 fm-typo-en-body-sm-400", {
2171
- "text-fm-color-typo-secondary": !a.errors.length,
2172
- "text-fm-color-system-error-300": a.errors.length
2173
- }])
2174
- }, [
2175
- a.errors.length ? (x(), T("div", ga, [
2176
- l("ol", null, [
2177
- (x(!0), T(le, null, he(a.errors, (e, i) => (x(), T("li", { key: i }, E(e), 1))), 128))
2178
- ])
2179
- ])) : Q("", !0)
2180
- ], 2)) : Q("", !0)
2181
- ]);
2182
- };
2183
- }
2184
- }), ha = { class: "flex flex-col gap-24" }, ka = {
2185
- key: 0,
2186
- class: "flex items-center gap-8"
2187
- }, xa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ca = { class: "flex flex-col gap-8" }, wa = { class: "line-clamp-2 text-ellipsis break-all" }, Sa = {
2188
- key: 2,
2189
- class: "shrink-0"
2190
- }, Fa = {
2191
- key: 0,
2192
- class: "flex flex-col"
2193
- }, Ia = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, $a = {
2194
- key: 0,
2195
- class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
2196
- }, Da = { class: "fm-typo-en-body-lg-600" }, It = "Transfer note", Ta = /* @__PURE__ */ de({
2197
- __name: "XilnexImportForm",
2198
- setup(d, { expose: v }) {
2199
- const n = M(null), u = Oe(), g = M(!1), a = M(!1), k = Ds(), C = M(!1), $ = He();
2200
- M([]);
2201
- const p = N({
2202
- get() {
2203
- var c;
2204
- return ((c = k.supplier) == null ? void 0 : c.name) ?? "";
2205
- },
2206
- set(c) {
2207
- c && (k.supplier = {
2208
- name: c,
2209
- registrationNumber: "",
2210
- _id: "xilnex",
2211
- internal: "restaurant",
2212
- address: {
2213
- line1: "",
2214
- line2: "",
2215
- city: "",
2216
- state: "",
2217
- country: "",
2218
- postcode: ""
2219
- }
2220
- });
2221
- }
2222
- });
2223
- tt(async () => {
2224
- const c = await $.getNetSuiteLocations();
2225
- console.log(c), C.value = !0;
2226
- });
2227
- const e = N({
2228
- get() {
2229
- return "";
2230
- },
2231
- set(c) {
2232
- if (c) {
2233
- const y = k.effectiveAt ? new Date(k.effectiveAt) : /* @__PURE__ */ new Date(), [I, z, B] = c.split("-");
2234
- y.setFullYear(parseInt(I)), y.setMonth(parseInt(z) - 1), y.setDate(parseInt(B)), k.effectiveAt = y.toISOString();
2235
- }
2236
- }
2237
- }), i = N({
2238
- get() {
2239
- return null;
2240
- },
2241
- set(c) {
2242
- if (c) {
2243
- const y = k.effectiveAt ? new Date(k.effectiveAt) : /* @__PURE__ */ new Date(), [I, z] = c.split(":");
2244
- y.setMinutes(parseInt(I)), y.setSeconds(parseInt(z)), k.effectiveAt = y.toISOString();
2245
- }
2246
- }
2247
- }), b = M(new Array()), o = M([]), r = N(
2248
- () => !!b.value.length || o.value.some((c) => c.errors.length)
2249
- ), m = M();
2250
- v({
2251
- validateInputs: () => {
2252
- var c, y;
2253
- (y = (c = m.value) == null ? void 0 : c.validateInputs) == null || y.call(c);
2254
- },
2255
- resetInputsValidation: () => {
2256
- var c, y;
2257
- (y = (c = m.value) == null ? void 0 : c.resetInputsValidation) == null || y.call(c);
2258
- },
2259
- resetInputs: () => {
2260
- var c, y;
2261
- (y = (c = m.value) == null ? void 0 : c.resetInputs) == null || y.call(c);
2262
- }
2263
- });
2264
- const { t: h } = be();
2265
- async function w(c) {
2266
- b.value = [], o.value = [];
2267
- try {
2268
- g.value = !0;
2269
- const [y] = await Promise.all([
2270
- Is(c),
2271
- // fake buffer
2272
- new Promise((z) => setTimeout(z, 1e3))
2273
- ]), I = la(y);
2274
- if (I.invalidExcel) {
2275
- b.value.push(
2276
- I.invalidExcelMessage ?? h("inventory.ingredient.import.fileError.invalidExcel")
2277
- );
2278
- return;
2279
- }
2280
- if (o.value = I.importCreateResult, !o.value.length) {
2281
- b.value.push(h("inventory.ingredient.import.fileError.noData"));
2282
- return;
2283
- }
2284
- k.items = o.value.map((z) => z.poItems).flat();
2285
- } catch (y) {
2286
- u.open({
2287
- title: h("inventory.ingredient.import.fileError.unableToRead"),
2288
- message: y == null ? void 0 : y.message,
2289
- type: "error"
2290
- }), console.error("Error in reading file", y);
2291
- } finally {
2292
- b.value.length && u.open({
2293
- title: h("inventory.ingredient.import.fileError.invalidExcel"),
2294
- type: "error"
2295
- }), g.value = !1;
2296
- }
2297
- }
2298
- return fe(n, (c) => {
2299
- c && w(c);
2300
- }), (c, y) => {
2301
- const I = V("FmSelect"), z = V("FmDatePicker"), B = V("FmTimePicker"), X = V("FmCircularProgress"), oe = V("FmLabel"), U = V("FmIcon"), P = V("FmButton"), R = V("FmForm");
2302
- return x(), se(R, {
2303
- ref_key: "formRef",
2304
- ref: m
2305
- }, {
2306
- default: O(() => [
2307
- l("div", ha, [
2308
- f(I, {
2309
- modelValue: p.value,
2310
- "onUpdate:modelValue": y[0] || (y[0] = (D) => p.value = D),
2311
- label: "Transfer from",
2312
- searchable: "",
2313
- searchTarget: "label",
2314
- items: [
2315
- { label: "Object", value: null },
2316
- { label: "Array", value: ["array", "1"] },
2317
- { label: "Number", value: 3 },
2318
- { label: "String", value: "4" },
2319
- { label: "1", value: "5" },
2320
- { label: "2", value: "6" }
2321
- ],
2322
- "helper-text": "Helper",
2323
- rules: [t(Be)()]
2324
- }, null, 8, ["modelValue", "rules"]),
2325
- f(z, {
2326
- modelValue: e.value,
2327
- "onUpdate:modelValue": y[1] || (y[1] = (D) => e.value = D),
2328
- label: "Transfer date",
2329
- rules: [t(Be)()]
2330
- }, null, 8, ["modelValue", "rules"]),
2331
- f(B, {
2332
- modelValue: i.value,
2333
- "onUpdate:modelValue": y[2] || (y[2] = (D) => i.value = D),
2334
- label: "Transfer time",
2335
- rules: [t(Be)()]
2336
- }, null, 8, ["modelValue", "rules"]),
2337
- a.value ? (x(), T("div", ka, [
2338
- l("div", null, [
2339
- f(X, {
2340
- size: "md",
2341
- color: "neutral-gray-200"
2342
- })
2343
- ]),
2344
- l("div", xa, E(t(h)("inventory.formField.loading")), 1)
2345
- ])) : (x(), T(le, { key: 1 }, [
2346
- f($s, {
2347
- "max-file-size": 5,
2348
- class: K({
2349
- "w-full": !0,
2350
- "h-[200px]": !n.value
2351
- }),
2352
- accept: ".xlsx,.xls",
2353
- label: It,
2354
- onFileUpload: y[3] || (y[3] = (D) => n.value = D),
2355
- "button-label": t(h)("inventory.ingredient.import.selectFile")
2356
- }, Ut({ _: 2 }, [
2357
- n.value ? {
2358
- name: "default",
2359
- fn: O(({ openFileDialog: D }) => [
2360
- f(oe, null, {
2361
- default: O(() => [
2362
- Ae(E(It))
2363
- ]),
2364
- _: 1
2365
- }),
2366
- l("div", Ca, [
2367
- l("div", {
2368
- class: K([
2369
- "fm-corner-radius-md p-16 flex items-center gap-16",
2370
- {
2371
- "border border-fm-color-neutral-gray-100": g.value,
2372
- "border border-fm-color-neutral-gray-200": !g.value && !r.value,
2373
- "border border-fm-color-system-error-200": r.value
2374
- }
2375
- ])
2376
- }, [
2377
- g.value ? (x(), se(X, {
2378
- key: 0,
2379
- size: "md",
2380
- color: "neutral-gray-200"
2381
- })) : (x(), se(U, {
2382
- key: 1,
2383
- name: r.value ? "error" : "attach_file",
2384
- outline: "",
2385
- color: r.value ? "system-error-300" : void 0
2386
- }, null, 8, ["name", "color"])),
2387
- l("div", {
2388
- class: K([
2389
- "fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
2390
- {
2391
- "text-fm-color-typo-disabled": g.value,
2392
- "text-fm-color-typo-primary": !g.value
2393
- }
2394
- ])
2395
- }, [
2396
- l("div", wa, E(n.value.name), 1)
2397
- ], 2),
2398
- g.value ? Q("", !0) : (x(), T("div", Sa, [
2399
- f(P, {
2400
- label: t(h)("inventory.ingredient.import.replaceFile"),
2401
- variant: r.value ? "destructive" : "secondary",
2402
- "prepend-icon": r.value ? void 0 : "autorenew",
2403
- onClick: D
2404
- }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
2405
- ]))
2406
- ], 2),
2407
- b.value.length ? (x(), T("div", Fa, [
2408
- (x(!0), T(le, null, he(b.value, (q, L) => (x(), T("div", {
2409
- key: L,
2410
- class: "flex gap-8 items-center"
2411
- }, [
2412
- f(U, {
2413
- name: "error",
2414
- size: "sm",
2415
- color: "system-error-300"
2416
- }),
2417
- l("div", Ia, E(q), 1)
2418
- ]))), 128))
2419
- ])) : Q("", !0)
2420
- ])
2421
- ]),
2422
- key: "0"
2423
- } : void 0
2424
- ]), 1032, ["class", "button-label"]),
2425
- n.value ? (x(), T("div", $a, [
2426
- l("div", Da, E(t(h)("inventory.ingredient.import.summary")), 1),
2427
- (x(!0), T(le, null, he(o.value, (D, q) => (x(), se(_a, {
2428
- key: q,
2429
- name: `Transfer Note ${q + 1}`,
2430
- items: D.poItems,
2431
- errors: D.errors,
2432
- type: "create"
2433
- }, null, 8, ["name", "items", "errors"]))), 128))
2434
- ])) : Q("", !0)
2435
- ], 64))
2436
- ])
2437
- ]),
2438
- _: 1
2439
- }, 512);
2440
- };
2441
- }
2442
- }), Va = { class: "w-[480px]" }, Pa = /* @__PURE__ */ de({
2443
- __name: "XilnexImportDialog",
2444
- props: {
2445
- show: { type: Boolean }
2446
- },
2447
- emits: ["update:show", "submitted"],
2448
- setup(d, { expose: v, emit: n }) {
2449
- const u = n, a = Rt(d, "show"), k = Oe(), C = pt(), $ = M(!1), p = M(), e = M();
2450
- v({
2451
- validateInputs: () => {
2452
- var o, r;
2453
- (r = (o = p.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
2454
- },
2455
- resetInputsValidation: () => {
2456
- var o, r;
2457
- (r = (o = p.value) == null ? void 0 : o.resetInputsValidation) == null || r.call(o);
2458
- },
2459
- resetInputs: () => {
2460
- var o, r;
2461
- (r = (o = p.value) == null ? void 0 : o.resetInputs) == null || r.call(o);
2462
- }
2463
- });
2464
- function i() {
2465
- var o, r;
2466
- (r = (o = p.value) == null ? void 0 : o.validateInputs) == null || r.call(o);
2467
- }
2468
- async function b() {
2469
- var r, m, h, w, c;
2470
- if (!((m = (r = e.value) == null ? void 0 : r.supplier) != null && m.name)) {
2471
- k.open({
2472
- title: "Upload failed",
2473
- message: "Location is required",
2474
- type: "error"
2475
- });
2476
- return;
2477
- }
2478
- if (!((h = e.value) != null && h.items) || ((c = (w = e.value) == null ? void 0 : w.items) == null ? void 0 : c.length) === 0) {
2479
- k.open({
2480
- title: "Upload failed",
2481
- message: "No data to upload",
2482
- type: "error"
2483
- });
2484
- return;
2485
- }
2486
- const o = e.value.effectiveAt ? new Date(e.value.effectiveAt) : null;
2487
- if (!o) {
2488
- k.open({
2489
- title: "Invalid date",
2490
- message: "Transfer date is required",
2491
- type: "error"
2492
- });
2493
- return;
2494
- }
2495
- if (o.getTime() > (/* @__PURE__ */ new Date()).getTime()) {
2496
- k.open({
2497
- title: "Invalid date",
2498
- message: "Transfer date cannot be in the future",
2499
- type: "error"
2500
- });
2501
- return;
2502
- }
2503
- $.value = !0;
2504
- try {
2505
- await C.importFromXilnex(e.value), u("update:show", !1);
2506
- } catch (y) {
2507
- await new Promise((I) => setTimeout(I, 1e3)), k.open({
2508
- title: "Upload failed",
2509
- message: y == null ? void 0 : y.message,
2510
- type: "error"
2511
- });
2512
- } finally {
2513
- $.value = !1;
2514
- }
2515
- }
2516
- return (o, r) => {
2517
- const m = V("FmSpacer"), h = V("FmButton"), w = V("FmDialog");
2518
- return x(), se(w, {
2519
- modelValue: t(a),
2520
- "onUpdate:modelValue": r[2] || (r[2] = (c) => we(a) ? a.value = c : null),
2521
- overlay: !0,
2522
- "close-button": !1
2523
- }, {
2524
- "dialog-header": O(() => r[3] || (r[3] = [
2525
- l("div", null, "Xilnex transfer order", -1)
2526
- ])),
2527
- "dialog-footer": O(() => [
2528
- f(m, { class: "sm:hidden xs:hidden" }),
2529
- f(h, {
2530
- disabled: $.value,
2531
- class: "sm:w-full xs:w-full",
2532
- label: "Cancel",
2533
- size: "md",
2534
- variant: "tertiary",
2535
- onClick: r[1] || (r[1] = (c) => u("update:show", !1))
2536
- }, null, 8, ["disabled"]),
2537
- f(h, {
2538
- disabled: $.value,
2539
- loading: $.value,
2540
- class: "sm:w-full xs:w-full",
2541
- label: "Upload",
2542
- size: "md",
2543
- variant: "primary",
2544
- onClick: i
2545
- }, null, 8, ["disabled", "loading"])
2546
- ]),
2547
- default: O(() => [
2548
- l("div", Va, [
2549
- f(Ta, {
2550
- ref_key: "formRef",
2551
- ref: p,
2552
- onValidationSuccess: b,
2553
- modelValue: e.value,
2554
- "onUpdate:modelValue": r[0] || (r[0] = (c) => e.value = c)
2555
- }, null, 8, ["modelValue"])
2556
- ])
2557
- ]),
2558
- _: 1
2559
- }, 8, ["modelValue"]);
2560
- };
2561
- }
2562
- }), Ra = { class: "flex flex-col py-8" }, Aa = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oa = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary line-clamp-1" }, Ea = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1" }, qa = {
2563
- key: 0,
2564
- class: "fm-typo-en-body-md-400 text-fm-color-typo-primary line-clamp-1"
2565
- }, Ma = { class: "pt-8" }, $t = "ReceiveRequestViewSearchCriteria", vn = /* @__PURE__ */ de({
2566
- __name: "ReceiveRequestView",
2567
- setup(d) {
2568
- const { t: v } = be(), n = Oe();
2569
- Je.object({
2570
- name: Je.string().optional().nullable(),
2571
- startDate: Je.string().optional().nullable(),
2572
- endDate: Je.string().optional().nullable()
2573
- });
2574
- const u = N(
2575
- () => !b._currentLocation || e.loading.value
2576
- ), g = rs(), a = at(), k = He();
2577
- function C() {
2578
- const U = {
2579
- name: "",
2580
- ...xt()
2581
- }, P = g.getItem($t);
2582
- if (!P)
2583
- return U;
2584
- try {
2585
- return JSON.parse(P);
2586
- } catch {
2587
- return U;
2588
- }
2589
- }
2590
- function $() {
2591
- g.setItem($t, JSON.stringify(p.value));
2592
- }
2593
- const p = M(C()), e = Wt(
2594
- rt.RECEIVE_REQUEST,
2595
- p.value
2596
- ), { columnDefs: i } = Gt(
2597
- rt.RECEIVE_REQUEST,
2598
- e,
2599
- e.shipments
2600
- ), b = st();
2601
- async function o() {
2602
- const U = `inventory-record_${Ct(p.value.startDate).format("DD-MM-YYYY_HH-mm")}-${Ct(p.value.endDate).format("DD-MM-YYYY_HH-mm")}.xlsx`, P = e.purchaseOrders.value.flatMap(
2603
- (D) => D.items.map((q) => {
2604
- var J;
2605
- const L = new Date(ns(D._id) ?? ""), Z = D.effectiveAt ? new Date(D.effectiveAt) : void 0, S = Se(
2606
- es(q.sku, D.deliveryOrder || [])
2607
- ), F = Se(q.quantity), Y = ((J = q == null ? void 0 : q.measurement) == null ? void 0 : J.abbrev) || q.sku.unit.abbrev;
2608
- return {
2609
- "SKU code": q.code,
2610
- "SKU name": q.name,
2611
- "PO #": D.seqNumber,
2612
- "Effective at": Z,
2613
- Date: L,
2614
- Status: D.status,
2615
- Reference: D.ref ?? "",
2616
- "Received quantity": S,
2617
- "Ordered quantity": F,
2618
- Unit: Y,
2619
- "Total cost": q.totalCost ? et(q.totalCost) : null
2620
- };
2621
- })
2622
- ), R = [
2623
- "SKU code",
2624
- "SKU name",
2625
- "PO #",
2626
- "Date",
2627
- "Status",
2628
- "Reference",
2629
- "Received quantity",
2630
- "Ordered quantity",
2631
- "Unit"
2632
- ];
2633
- a.enableBackdatePo && R.insert("Effective at", 4), a.enableTotalCost && R.push("Total cost"), await ls(
2634
- [
2635
- {
2636
- name: "purchases",
2637
- data: P,
2638
- columns: R
2639
- }
2640
- ],
2641
- U
2642
- ), n.open({
2643
- title: v("inventory.transfer.receiveRequest.export.success"),
2644
- message: v("inventory.transfer.receiveRequest.export.message", [U]),
2645
- type: "success"
2646
- });
2647
- }
2648
- const r = M(xt()), m = M("");
2649
- fe([() => r.value], ([U]) => {
2650
- !U.startDate || !U.endDate || (p.value.startDate = U.startDate, p.value.endDate = U.endDate, e.updateDateRange(
2651
- p.value.startDate,
2652
- p.value.endDate
2653
- ), $());
2654
- }), fe([() => m.value], () => {
2655
- $();
2656
- });
2657
- function h(U) {
2658
- if (U === "create") {
2659
- if (u.value) {
2660
- n.open({
2661
- title: "Loading data...",
2662
- message: "Please wait.",
2663
- type: "info"
2664
- });
2665
- return;
2666
- }
2667
- return e.promptCreateTransferDialog();
2668
- }
2669
- if (U === "upload" && a.enableXilnexTransferNote)
2670
- return e.promptUploadTransferDialog();
2671
- if (U === "refresh")
2672
- return e.fetchData();
2673
- if (U === "export")
2674
- return o();
2675
- }
2676
- const { breakpoints: w } = dt(), c = N(() => w.value.xs || w.value.sm), y = N(() => c.value ? 10 : 20), I = is(), z = N(() => [
2677
- {
2678
- label: v("inventory.transfer.receiveRequest.actions.create"),
2679
- value: "create",
2680
- isPrimary: !0,
2681
- prependIcon: "add"
2682
- },
2683
- ...a.enableXilnexTransferNote ? [
2684
- {
2685
- label: v("inventory.common.upload"),
2686
- value: "upload"
2687
- }
2688
- ] : [],
2689
- {
2690
- label: v("inventory.common.refresh"),
2691
- value: "refresh"
2692
- },
2693
- {
2694
- label: v("inventory.common.export"),
2695
- value: "export"
2696
- }
2697
- ]), B = N(() => {
2698
- const U = [
2699
- {
2700
- type: "string",
2701
- key: "status",
2702
- entity: "purchaseOrder",
2703
- values: Array.from(
2704
- new Set(e.purchaseOrders.value.map((R) => R.status))
2705
- )
2706
- }
2707
- ], P = [
2708
- {
2709
- type: "string",
2710
- key: "netsuiteTransactionNumber",
2711
- entity: "purchaseOrder",
2712
- values: e.purchaseOrders.value.map((R) => {
2713
- var D, q;
2714
- return (q = (D = R.netSuite) == null ? void 0 : D.additionalInfo) == null ? void 0 : q.transactionnumber;
2715
- }).filter((R) => R != null)
2716
- },
2717
- {
2718
- type: "string",
2719
- key: "netsuiteOrderNo",
2720
- entity: "purchaseOrder",
2721
- values: e.purchaseOrders.value.map((R) => {
2722
- var D;
2723
- return (D = R.netSuite) == null ? void 0 : D.refNo;
2724
- }).filter((R) => R != null)
2725
- },
2726
- {
2727
- type: "string",
2728
- key: "netsuiteOrderId",
2729
- entity: "purchaseOrder",
2730
- values: e.purchaseOrders.value.map((R) => {
2731
- var D;
2732
- return (D = R.netSuite) == null ? void 0 : D.id;
2733
- }).filter((R) => R != null)
2734
- }
2735
- ];
2736
- return [...U, ...k.isEnabled ? P : []];
2737
- }), X = M(null), oe = N(() => {
2738
- if (!X.value)
2739
- return e.purchaseOrders.value;
2740
- const U = Ts.build(X.value);
2741
- return e.purchaseOrders.value.filter((P) => {
2742
- var R, D, q, L;
2743
- return Vs(
2744
- {
2745
- netsuiteTransactionNumber: (D = (R = P.netSuite) == null ? void 0 : R.additionalInfo) == null ? void 0 : D.transactionnumber,
2746
- netsuiteOrderNo: (q = P.netSuite) == null ? void 0 : q.refNo,
2747
- netsuiteOrderId: (L = P.netSuite) == null ? void 0 : L.id,
2748
- status: P.status
2749
- },
2750
- U
2751
- );
2752
- });
2753
- });
2754
- return (U, P) => {
2755
- const R = V("FmTable");
2756
- return x(), se(us, {
2757
- title: t(v)("inventory.transfer.receiveRequest.title2"),
2758
- actions: z.value,
2759
- "onClick:action": h
2760
- }, {
2761
- default: O(() => {
2762
- var D, q;
2763
- return [
2764
- l("div", {
2765
- class: K([
2766
- "flex flex-col gap-8 max-h-full",
2767
- {
2768
- "p-0": c.value,
2769
- "px-24 ": !c.value
2770
- }
2771
- ])
2772
- }, [
2773
- f(Zt, {
2774
- "date-range-query": "",
2775
- "date-range": r.value,
2776
- "onUpdate:dateRange": P[0] || (P[0] = (L) => r.value = L),
2777
- searchable: "",
2778
- "change-location": "",
2779
- search: m.value,
2780
- "onUpdate:search": P[1] || (P[1] = (L) => m.value = L),
2781
- filterable: "",
2782
- "filter-attributes": B.value,
2783
- filter: X.value,
2784
- "onUpdate:filter": P[2] || (P[2] = (L) => X.value = L)
2785
- }, null, 8, ["date-range", "search", "filter-attributes", "filter"]),
2786
- (x(), se(R, {
2787
- style: Tt(t(I).tableHeight),
2788
- "column-defs": t(i),
2789
- "row-data": oe.value,
2790
- "search-value": m.value,
2791
- loading: u.value,
2792
- onRowClick: P[3] || (P[3] = (L) => t(e).promptShowTransferDetails(L.original)),
2793
- key: (D = t(b)._currentLocation) == null ? void 0 : D.dbName,
2794
- "page-size": y.value
2795
- }, {
2796
- "list-row": O((L) => [
2797
- f(At, {
2798
- row: L,
2799
- onRowClick: t(e).promptShowTransferDetails
2800
- }, {
2801
- default: O((Z) => {
2802
- var S, F, Y, J, re, W, Fe, ge, ke, Ee, xe, Ie, je, $e, Qe, nt, Ye, qe, Ce, s;
2803
- return [
2804
- l("div", Ra, [
2805
- l("div", Aa, [
2806
- f(t(pe), {
2807
- render: (Y = (F = (S = Z._id) == null ? void 0 : S.column) == null ? void 0 : F.columnDef) == null ? void 0 : Y.cell,
2808
- props: (re = (J = Z._id) == null ? void 0 : J.getContext) == null ? void 0 : re.call(J)
2809
- }, null, 8, ["render", "props"])
2810
- ]),
2811
- l("div", Oa, [
2812
- f(t(pe), {
2813
- render: (ge = (Fe = (W = Z.supplier_name) == null ? void 0 : W.column) == null ? void 0 : Fe.columnDef) == null ? void 0 : ge.cell,
2814
- props: (Ee = (ke = Z.supplier_name) == null ? void 0 : ke.getContext) == null ? void 0 : Ee.call(ke)
2815
- }, null, 8, ["render", "props"])
2816
- ]),
2817
- l("div", Ea, E(L.original.items.map((_) => `${_.name}`).join(", ")), 1),
2818
- L.original.ref ? (x(), T("div", qa, [
2819
- f(t(pe), {
2820
- render: (je = (Ie = (xe = Z.ref) == null ? void 0 : xe.column) == null ? void 0 : Ie.columnDef) == null ? void 0 : je.cell,
2821
- props: (Qe = ($e = Z.ref) == null ? void 0 : $e.getContext) == null ? void 0 : Qe.call($e)
2822
- }, null, 8, ["render", "props"])
2823
- ])) : Q("", !0),
2824
- l("div", Ma, [
2825
- f(t(pe), {
2826
- render: (qe = (Ye = (nt = Z.status) == null ? void 0 : nt.column) == null ? void 0 : Ye.columnDef) == null ? void 0 : qe.cell,
2827
- props: (s = (Ce = Z.status) == null ? void 0 : Ce.getContext) == null ? void 0 : s.call(Ce)
2828
- }, null, 8, ["render", "props"])
2829
- ])
2830
- ])
2831
- ];
2832
- }),
2833
- _: 2
2834
- }, 1032, ["row", "onRowClick"])
2835
- ]),
2836
- _: 1
2837
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
2838
- ], 2),
2839
- (x(), se(zt, { to: "body" }, [
2840
- f(aa, it(t(e).transferDialogProps.value, {
2841
- onSubmitted: t(e).fetchData
2842
- }), null, 16, ["onSubmitted"]),
2843
- f(Jt, it({
2844
- scope: t(rt).RECEIVE_REQUEST
2845
- }, {
2846
- ...t(e).transferDetailsProps.value,
2847
- receivedMap: ((q = t(e).transferDetailsProps.value) == null ? void 0 : q.receivedMap) ?? {},
2848
- shipments: t(e).shipments.value ?? []
2849
- }, {
2850
- onSubmitted: t(e).fetchData
2851
- }), null, 16, ["scope", "onSubmitted"]),
2852
- f(Pa, Bt(Lt(t(e).xilnexImportDialogProps.value)), null, 16)
2853
- ]))
2854
- ];
2855
- }),
2856
- _: 1
2857
- }, 8, ["title", "actions"]);
2858
- };
2859
- }
2860
- });
2861
- export {
2862
- vn as default
2863
- };