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

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