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

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