@feedmepos/mf-inventory-portal 0.0.23-dev.16 → 0.0.23-dev.18

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 (53) hide show
  1. package/dist/{App-CqcF-fwV.js → App-Dfryh3pQ.js} +3 -3
  2. package/dist/{ApprovalView-vWXFA_eo.js → ApprovalView-CRrJeRCQ.js} +4 -4
  3. package/dist/{BindingsDialog-kvHNCEqw.js → BindingsDialog-Zh8FzTSI.js} +2 -2
  4. package/dist/{BindingsPicker-CCIp6NEE.js → BindingsPicker-BXChBNxv.js} +2 -2
  5. package/dist/{BindingsTable-DXGbeSVU.js → BindingsTable-BXB-X1N3.js} +4 -4
  6. package/dist/{ClosingDraftView-DdWSQS2H.js → ClosingDraftView-ZKdMqDrV.js} +7 -7
  7. package/dist/{ClosingTemplateView-DsCeYCJg.js → ClosingTemplateView-Bj6SiRlA.js} +10 -10
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DtofkHh5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CZ1NPD07.js} +4 -4
  9. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-dOwGhgfF.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B8RhFmN_.js} +2 -2
  10. package/dist/{FmMultiselectDialog-e6cut2s7.js → FmMultiselectDialog-DWMt9hvV.js} +3 -3
  11. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-B1Hy3B0-.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C--mzLIB.js} +2 -2
  12. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CPXMwwjj.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Be_B1iME.js} +1 -1
  13. package/dist/{IngredientGroupView-Ctu1rZDA.js → IngredientGroupView-DCOz2AOB.js} +5 -5
  14. package/dist/{IngredientsView-DeNnObTW.js → IngredientsView-D3ptwZy1.js} +9 -9
  15. package/dist/{IntegrationView-t7CRZcew.js → IntegrationView-BfoCYVHZ.js} +4 -4
  16. package/dist/{InventoryBindingForm-Cjeh1vj_.js → InventoryBindingForm-2Gs2vUtC.js} +1 -1
  17. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D5Db_2I_.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D9Of6ewh.js} +5 -5
  18. package/dist/{InventoryBindingSummary-DPo79YXT.js → InventoryBindingSummary-IUJt469w.js} +1 -1
  19. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DozwlCld.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BtdmfQRZ.js} +1 -1
  20. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BKfkxoTE.js → PremiumBadge.vue_vue_type_script_setup_true_lang-C97vZfAO.js} +2 -2
  21. package/dist/{PurchaseOrderPrintPreview-C-iEvLP1.js → PurchaseOrderPrintPreview-BRVCfgd3.js} +1 -1
  22. package/dist/{ReceiveRequestView-D4Cg8TF5.js → ReceiveRequestView-Brh9jtUz.js} +18 -18
  23. package/dist/{RecipeView-ZgONnIvE.js → RecipeView-Br8u4xZZ.js} +7 -7
  24. package/dist/{StockView-OG1jLUa8.js → StockView-B2vBQLJf.js} +13 -13
  25. package/dist/{SupplierView-DSW2dLQP.js → SupplierView-S_qigSL4.js} +10 -10
  26. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DfSqyy-R.js → TransferDetails.vue_vue_type_script_setup_true_lang--DGNx2VJ.js} +9 -9
  27. package/dist/TransferTemplateView-B0_EXehN.js +1275 -0
  28. package/dist/{UnitView-6RkEFIJD.js → UnitView-CR019bWO.js} +5 -5
  29. package/dist/{WarehouseView-Bbci5eAP.js → WarehouseView-BX7K073o.js} +4 -4
  30. package/dist/{app-Iv30TXsA.js → app-BY6TZxqB.js} +8 -8
  31. package/dist/app.js +1 -1
  32. package/dist/{date2-VM6HUtqx.js → date2-C385gf6_.js} +1 -1
  33. package/dist/{dayjs.min-CEM65hHn.js → dayjs.min-CuXsxyJ4.js} +1 -1
  34. package/dist/{decimal-gAHZETIz.js → decimal-DmIrlkyN.js} +1 -1
  35. package/dist/{defineDeepModel-DzTm7URG.js → defineDeepModel-CJEdL37p.js} +1 -1
  36. package/dist/{feature-DN8a_F-i.js → feature-DM4scjOG.js} +1 -1
  37. package/dist/{format-time-from-id-BfbdDiIE.js → format-time-from-id-DmDFxNOY.js} +1 -1
  38. package/dist/{format-unit-display-XHgGLeHY.js → format-unit-display-DnZmCO-i.js} +8 -8
  39. package/dist/{fuzzy-CIEPIox7.js → fuzzy-D2QbaWQl.js} +1 -1
  40. package/dist/{index-Q96zW8J0.js → index-BgM27D6z.js} +1 -1
  41. package/dist/{index-Dv-6Hm_z.js → index-CKCFZ2N2.js} +1 -1
  42. package/dist/{index-DQDMUxyC.js → index-UtLEzrzf.js} +1 -1
  43. package/dist/{netsuite-Bo49EaVh.js → netsuite-CxzWHfIf.js} +51 -48
  44. package/dist/{rules-C0FFlx9A.js → rules-WXcRCM31.js} +2 -2
  45. package/dist/{stock-CMKAuU84.js → stock-BVyJ8TZF.js} +2 -2
  46. package/dist/{supplier-CxAcIU6h.js → supplier-Cg0hV-1Z.js} +1 -1
  47. package/dist/tsconfig.app.tsbuildinfo +1 -1
  48. package/dist/{use-inventory-binding-dialog-GNLNP3f8.js → use-inventory-binding-dialog-C4A0C-q4.js} +2 -2
  49. package/dist/{use-template-enabled-locations-2-DzqBdV2b.js → use-template-enabled-locations-2-ClTvBbS6.js} +2 -2
  50. package/dist/{xlsx-BqvCK2Va.js → xlsx-jlUdZfql.js} +1 -1
  51. package/dist/{xlsx.util-CNeUTGll.js → xlsx.util-C4YF_j8p.js} +1 -1
  52. package/package.json +3 -3
  53. package/dist/TransferTemplateView-TixIybWf.js +0 -1275
@@ -0,0 +1,1275 @@
1
+ import { defineComponent as J, onMounted as ce, computed as D, ref as U, watch as pe, inject as Ze, resolveComponent as V, openBlock as R, createElementBlock as K, createElementVNode as t, createVNode as c, withCtx as q, renderSlot as Oe, withDirectives as Ve, normalizeClass as ie, vModelText as Ae, reactive as Je, h as Z, toDisplayString as O, unref as e, createBlock as W, mergeProps as Ue, isRef as Ee, createCommentVNode as Y, Fragment as qe, renderList as Xe, normalizeStyle as Ye, Teleport as et, normalizeProps as tt, guardReactiveProps as ot } from "vue";
2
+ import { u as st, _ as lt, a as nt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B8RhFmN_.js";
3
+ import { useI18n as X } from "@feedmepos/mf-common";
4
+ import { P as j, a as rt, f as at, t as it, b as Re, u as ut } from "./format-unit-display-DnZmCO-i.js";
5
+ import { R as De } from "./row-action.enum-7rGLGZ5v.js";
6
+ import { a as Ne, u as ze, A as ne } from "./app-BY6TZxqB.js";
7
+ import { components as re, useDialog as mt, useSnackbar as dt, useProxiedModel as je, useBreakpoints as ct } from "@feedmepos/ui-library";
8
+ import { storeToRefs as Pe } from "pinia";
9
+ import { F as ee } from "./form-mode.enum-BKiNVH6A.js";
10
+ import { u as ue, t as Le, I as pt, n as ft, o as yt, a as G, p as vt, R as me, g as ae, c as bt, A as de, M as xt, b as _t, j as ht } from "./rules-WXcRCM31.js";
11
+ import { d as He } from "./defineDeepModel-CJEdL37p.js";
12
+ import { _ as gt, b as Ft, F as Tt, a as wt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-C--mzLIB.js";
13
+ import { u as Qe } from "./feature-DM4scjOG.js";
14
+ import { u as Ke } from "./netsuite-CxzWHfIf.js";
15
+ import { c as kt, u as St, _ as Ct } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CZ1NPD07.js";
16
+ import { F as Be } from "./index-BgM27D6z.js";
17
+ import { u as Mt } from "./supplier-Cg0hV-1Z.js";
18
+ import { F as $t } from "./FmMultiselectDialog-DWMt9hvV.js";
19
+ import { F as Q, _ as Ge } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
20
+ import { u as It } from "./use-template-enabled-locations-2-ClTvBbS6.js";
21
+ import { f as Ot } from "./format-time-from-id-DmDFxNOY.js";
22
+ const Vt = { class: "flex flex-col" }, At = { class: "flex flex-col" }, Rt = { class: "flex-1" }, Dt = { class: "flex items-center" }, Pt = { class: "flex-1" }, Lt = { class: "flex-1" }, Bt = /* @__PURE__ */ J({
23
+ __name: "FmMinMaxInput",
24
+ props: {
25
+ rules: {},
26
+ label: {},
27
+ minPlaceholder: {},
28
+ maxPlaceholder: {},
29
+ modelValue: {},
30
+ precision: {},
31
+ minLength: {},
32
+ maxLength: {},
33
+ inputmode: {},
34
+ type: {},
35
+ readonly: { type: Boolean },
36
+ labelMark: {},
37
+ prependIcon: {},
38
+ appendIcon: {},
39
+ showValidBorder: { type: Boolean },
40
+ labelInfo: {},
41
+ showWordCount: { type: Boolean },
42
+ invalid: { type: Boolean },
43
+ autofocus: { type: Boolean },
44
+ formatter: { type: Function },
45
+ decimal: {},
46
+ datalist: {},
47
+ shiftDatalist: { type: Boolean },
48
+ datalistMaxHeight: {},
49
+ datalistMinHeight: {},
50
+ offsetDatalist: {},
51
+ datalistPlacement: {},
52
+ datalistZIndex: {},
53
+ datalistWidth: {},
54
+ disabled: { type: Boolean },
55
+ focused: { type: Boolean },
56
+ helperText: {},
57
+ helperState: {}
58
+ },
59
+ setup(y) {
60
+ const x = y, u = He("modelValue"), o = pt();
61
+ ce(() => {
62
+ const { min: p, max: a } = u ?? {};
63
+ if (!(!p || !a) && p.precision !== a.precision) {
64
+ const b = Math.max(p.precision, a.precision), r = ue(p, b), f = ue(a, b);
65
+ u.min = r, u.max = f;
66
+ }
67
+ });
68
+ const m = D(() => {
69
+ const { min: p, max: a } = u ?? {};
70
+ return Math.max((p == null ? void 0 : p.precision) ?? 0, (a == null ? void 0 : a.precision) ?? 0, x.precision ?? 0);
71
+ }), S = (p) => {
72
+ if (!p) return "";
73
+ const a = ft(p), b = m.value, r = ue(a, b);
74
+ return yt(
75
+ +G(r),
76
+ r.precision
77
+ );
78
+ }, i = U(S(u.min)), l = U(S(u.max));
79
+ pe([i, l], ([p, a]) => {
80
+ const b = u ?? {}, r = o(p), f = o(a), w = m.value;
81
+ if (p !== "" && r === !0) {
82
+ const s = Le(+p, w);
83
+ b.min = s;
84
+ } else
85
+ b.min = null;
86
+ if (a !== "" && f === !0) {
87
+ const s = Le(+a, w);
88
+ b.max = s;
89
+ } else
90
+ b.max = null;
91
+ u.min = b.min, u.max = b.max;
92
+ });
93
+ const d = Symbol.for("fm:form-state"), k = Ze(d, null), h = D(() => x.disabled ?? (k == null ? void 0 : k.getDisabled()) ?? !1), A = U(), T = U(), v = U(!1), g = U(!1), I = D(() => v.value || g.value), B = D(() => [...[
94
+ function() {
95
+ return typeof o(i.value) == "string" || typeof o(l.value) == "string" ? "Must be a number" : !0;
96
+ },
97
+ function(b) {
98
+ return !b || !b.min || !b.max ? !0 : +G(b.min) > +G(b.max) ? "Min must be less than or equal to max" : !0;
99
+ }
100
+ ], ...x.rules ?? []]);
101
+ return (p, a) => {
102
+ const b = V("FmLabel"), r = V("FmField"), f = V("FmFormGroup");
103
+ return R(), K("div", Vt, [
104
+ t("div", At, [
105
+ t("div", Rt, [
106
+ c(b, {
107
+ label: p.label,
108
+ disabled: p.disabled,
109
+ required: p.labelMark === "required",
110
+ optional: p.labelMark === "optional"
111
+ }, null, 8, ["label", "disabled", "required", "optional"])
112
+ ]),
113
+ c(r, { focused: I.value }, {
114
+ default: q(() => [
115
+ t("div", Dt, [
116
+ Oe(p.$slots, "prepend"),
117
+ a[6] || (a[6] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
118
+ t("div", Pt, [
119
+ Ve(t("input", {
120
+ type: "text",
121
+ ref_key: "minInputRef",
122
+ ref: A,
123
+ onFocus: a[0] || (a[0] = () => v.value = !0),
124
+ onBlur: a[1] || (a[1] = () => v.value = !1),
125
+ "onUpdate:modelValue": a[2] || (a[2] = (w) => i.value = w),
126
+ class: ie({
127
+ "fm-text-field--input fm-typo-en-body-lg-400": !0,
128
+ "text-fm-color-typo-primary": !h.value,
129
+ "text-fm-color-typo-disabled": h.value
130
+ })
131
+ }, null, 34), [
132
+ [Ae, i.value]
133
+ ])
134
+ ]),
135
+ a[7] || (a[7] = t("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
136
+ a[8] || (a[8] = t("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
137
+ t("div", Lt, [
138
+ Ve(t("input", {
139
+ type: "text",
140
+ ref_key: "maxInputRef",
141
+ ref: T,
142
+ onFocus: a[3] || (a[3] = () => g.value = !0),
143
+ onBlur: a[4] || (a[4] = () => g.value = !1),
144
+ "onUpdate:modelValue": a[5] || (a[5] = (w) => l.value = w),
145
+ class: ie({
146
+ "fm-text-field--input fm-typo-en-body-lg-400": !0,
147
+ "text-fm-color-typo-primary": !h.value,
148
+ "text-fm-color-typo-disabled": h.value
149
+ })
150
+ }, null, 34), [
151
+ [Ae, l.value]
152
+ ])
153
+ ]),
154
+ Oe(p.$slots, "append")
155
+ ])
156
+ ]),
157
+ _: 3
158
+ }, 8, ["focused"])
159
+ ]),
160
+ c(f, {
161
+ class: "flex-1",
162
+ "model-value": p.modelValue,
163
+ info: p.labelInfo,
164
+ rules: B.value,
165
+ "helper-text": p.helperText,
166
+ "helper-state": p.helperState
167
+ }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
168
+ ]);
169
+ };
170
+ }
171
+ });
172
+ function Ut({ min: y, max: x } = { min: !0, max: !0 }) {
173
+ return function(o) {
174
+ return !o || !o.min && y != !1 || !o.max && x != !1 ? "Required" : !0;
175
+ };
176
+ }
177
+ function Et(y, x) {
178
+ return function(o) {
179
+ return !o || !o.min || !o.max ? !0 : +G(o.min) < y ? `Must be between ${y} and ${x}` : +G(o.max) > x ? `Must be between ${y} and ${x}` : !0;
180
+ };
181
+ }
182
+ function qt(y) {
183
+ const x = vt(y), u = G(y);
184
+ return function(m) {
185
+ const S = !(m != null && m.min) || x(m.min) === !0, i = !(m != null && m.max) || x(m.max) === !0;
186
+ return !S && !i ? `Min & max must be a multiple of ${u}` : S ? i ? !0 : `Max must be a multiple of ${u}` : `Min must be a multiple of ${u}`;
187
+ };
188
+ }
189
+ var L = /* @__PURE__ */ ((y) => (y.Code = "Code", y.Name = "Name", y.DefaultAmount = "DefaultAmount", y.Limit = "Limit", y.MinimumAmount = "MinimumAmount", y.Step = "Step", y.Cost = "Cost", y.Delete = "Delete", y))(L || {});
190
+ function Nt(y) {
191
+ const { t: x } = X(), u = Ke(), o = Je({});
192
+ ce(() => {
193
+ for (const i of y.items) {
194
+ if (!i.totalCost)
195
+ continue;
196
+ const l = kt(i.sku, i.quantity, i.measurement, {
197
+ supplier: y.supplier
198
+ }), d = i.totalCost ?? Be.reset();
199
+ l ? o[i.sku._id] = l.amount !== d.amount || l.precision !== d.precision : o[i.sku._id] = !0;
200
+ }
201
+ });
202
+ const m = [
203
+ {
204
+ id: "Code",
205
+ header: () => x("inventory.transfer.form.items.table.Code"),
206
+ accessorKey: "code",
207
+ size: 96,
208
+ cell(i) {
209
+ const l = i.row.original;
210
+ return Z(re.FmTextField, {
211
+ modelValue: l.code,
212
+ "onUpdate:modelValue": (d) => {
213
+ y.updateItem({
214
+ ...l,
215
+ code: d
216
+ });
217
+ },
218
+ key: l.sku._id,
219
+ rules: [me()],
220
+ labelMark: "required"
221
+ });
222
+ },
223
+ enableSorting: !1
224
+ },
225
+ {
226
+ id: "Name",
227
+ header: () => x("inventory.transfer.form.items.table.Name"),
228
+ minSize: 300,
229
+ cell(i) {
230
+ const l = i.row.original;
231
+ return Z(re.FmTextField, {
232
+ modelValue: l.name,
233
+ "onUpdate:modelValue": (d) => {
234
+ y.updateItem({
235
+ ...l,
236
+ name: d
237
+ });
238
+ },
239
+ key: l.sku._id,
240
+ rules: [me()],
241
+ labelMark: "required"
242
+ });
243
+ },
244
+ enableSorting: !1
245
+ },
246
+ {
247
+ id: "DefaultAmount",
248
+ header: () => x("inventory.transfer.form.items.table.DefaultAmount"),
249
+ minSize: 200,
250
+ cell(i) {
251
+ var v;
252
+ const l = i.row.original, d = Ne(), k = d.skuById[l.sku._id], h = d.unitById[(v = k.unit) == null ? void 0 : v._id], A = h.measurements.find((g) => {
253
+ var I;
254
+ return ((I = l.measurement) == null ? void 0 : I.id) === g.id;
255
+ }), T = l.sku.unit._id !== k.unit._id || !h || l.measurement && !A;
256
+ return Z(gt, {
257
+ style: {
258
+ flex: "1 1 0%"
259
+ },
260
+ modelValue: {
261
+ amount: l.quantity ?? { amount: 1, precision: 0 },
262
+ // NOTE: leave this reading from row.sku.unit and row.measurement instead,
263
+ measurement: l.measurement ?? (l.sku.unit._id !== k.unit._id ? { ...l.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
264
+ },
265
+ disabled: y.disabled,
266
+ key: l.sku._id,
267
+ unit: h,
268
+ "onUpdate:modelValue": (g) => {
269
+ var B;
270
+ let I = l.code;
271
+ if (u.isEnabled) {
272
+ const p = u.getItemPKTCode(k, (B = g.measurement) == null ? void 0 : B.id);
273
+ p && (I = p);
274
+ }
275
+ y.updateItem({
276
+ ...l,
277
+ code: I,
278
+ sku: k,
279
+ quantity: g.amount,
280
+ measurement: g.measurement
281
+ });
282
+ },
283
+ rules: [
284
+ Ft(l.quantityStep),
285
+ Tt(
286
+ +G(
287
+ l.minimumQuantity ?? {
288
+ amount: 1,
289
+ // NOTE: leave this reading from row.sku.unit and row.measurement instead,
290
+ precision: ae(l.sku.unit, l.measurement)
291
+ }
292
+ )
293
+ ),
294
+ wt(
295
+ l.maximumQuantity ? +G(l.maximumQuantity) : 1 / 0
296
+ ),
297
+ function(I) {
298
+ return T ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
299
+ }
300
+ ],
301
+ applyDefaultRules: !0
302
+ });
303
+ },
304
+ enableSorting: !1
305
+ },
306
+ {
307
+ id: "Limit",
308
+ header: () => "Limit",
309
+ // TODO: i18n,
310
+ minSize: 280,
311
+ cell(i) {
312
+ const l = i.row.original;
313
+ return Z(Bt, {
314
+ style: {
315
+ flex: "1 1 0%"
316
+ },
317
+ modelValue: {
318
+ min: l.minimumQuantity,
319
+ max: l.maximumQuantity
320
+ },
321
+ disabled: y.disabled,
322
+ key: l.sku._id,
323
+ unit: l.sku.unit,
324
+ "onUpdate:modelValue": (d) => {
325
+ const k = { ...l };
326
+ d != null && d.min ? k.minimumQuantity = d.min : k.minimumQuantity = null, d != null && d.max ? k.maximumQuantity = d.max : k.maximumQuantity = null, y.updateItem(k);
327
+ },
328
+ rules: [
329
+ Ut({ max: !1 }),
330
+ qt(l.quantityStep),
331
+ Et(
332
+ +G({
333
+ amount: 1,
334
+ precision: ae(l.sku.unit, l.measurement)
335
+ }),
336
+ 1 / 0
337
+ )
338
+ ],
339
+ disableUnit: !0,
340
+ applyDefaultRules: !0
341
+ });
342
+ }
343
+ },
344
+ {
345
+ id: "Step",
346
+ header: () => x("inventory.transfer.form.items.table.Step"),
347
+ minSize: 100,
348
+ cell(i) {
349
+ const l = i.row.original;
350
+ return Z(re.FmTextField, {
351
+ modelValue: G(l.quantityStep ?? Be.reset(), !1),
352
+ key: l.sku._id,
353
+ "onUpdate:modelValue": (d) => {
354
+ y.updateItem({
355
+ ...l,
356
+ quantityStep: bt(+d)
357
+ });
358
+ },
359
+ rules: [
360
+ de({
361
+ amount: 1,
362
+ precision: ae(l.sku.unit, l.measurement)
363
+ }),
364
+ xt(l.sku.unit, l.measurement)
365
+ ]
366
+ });
367
+ },
368
+ enableSorting: !1
369
+ },
370
+ {
371
+ id: "Delete",
372
+ header: "",
373
+ cell(i) {
374
+ const l = i.row.original;
375
+ return Z(re.FmButton, {
376
+ class: "delete-button",
377
+ key: l.sku._id,
378
+ type: "button",
379
+ icon: "delete",
380
+ variant: "tertiary",
381
+ size: "md",
382
+ disabled: y.disabled,
383
+ onClick: () => {
384
+ y.deleteItem(l);
385
+ }
386
+ });
387
+ },
388
+ enableSorting: !1,
389
+ size: 40,
390
+ meta: {
391
+ cellClass: "",
392
+ headerClass: ""
393
+ }
394
+ }
395
+ ];
396
+ return {
397
+ columnDefs: D(() => Qe().enableTotalCost && y.transferType === j.PURCHASE ? m : m.filter((l) => l.id !== "Cost"))
398
+ };
399
+ }
400
+ const zt = { class: "flex flex-col gap-8 py-16" }, jt = { class: "flex items-center" }, Ht = { class: "flex-1 flex gap-1 items-center" }, Qt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Kt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Gt = { class: "flex gap-8 w-full" }, Wt = { class: "flex-1 flex flex-col gap-4" }, Zt = { class: "flex-1 flex flex-col gap-4" }, Jt = { class: "flex gap-8 w-full" }, Xt = { class: "flex-1 flex flex-col gap-4" }, Yt = { class: "flex-1 flex flex-col gap-4" }, eo = { class: "flex gap-8 w-full" }, to = { class: "flex-1 flex flex-col gap-4" }, oo = /* @__PURE__ */ J({
401
+ __name: "TransferTemplateItem",
402
+ props: {
403
+ cellByColId: {},
404
+ row: {}
405
+ },
406
+ setup(y) {
407
+ const { t: x } = X();
408
+ return (u, o) => {
409
+ var S, i, l, d, k, h, A, T, v, g, I, B, p, a, b, r, f, w, s, n, C, $, M, _, P, E, N, H, F, z;
410
+ const m = V("FmLabel");
411
+ return R(), K("div", zt, [
412
+ t("div", jt, [
413
+ t("div", Ht, [
414
+ t("span", Qt, " (" + O(u.row.original.sku.code) + ") ", 1),
415
+ t("span", Kt, O(u.row.original.sku.name), 1)
416
+ ]),
417
+ t("div", null, [
418
+ c(e(Q), {
419
+ render: (l = (i = (S = u.cellByColId.Delete) == null ? void 0 : S.column) == null ? void 0 : i.columnDef) == null ? void 0 : l.cell,
420
+ props: (k = (d = u.cellByColId.Delete) == null ? void 0 : d.getContext) == null ? void 0 : k.call(d)
421
+ }, null, 8, ["render", "props"])
422
+ ])
423
+ ]),
424
+ t("div", Gt, [
425
+ t("div", Wt, [
426
+ c(m, {
427
+ label: e(x)(`inventory.transfer.form.items.table.${e(L).Code}`)
428
+ }, null, 8, ["label"]),
429
+ c(e(Q), {
430
+ render: (T = (A = (h = u.cellByColId[e(L).Code]) == null ? void 0 : h.column) == null ? void 0 : A.columnDef) == null ? void 0 : T.cell,
431
+ props: (g = (v = u.cellByColId[e(L).Code]) == null ? void 0 : v.getContext) == null ? void 0 : g.call(v)
432
+ }, null, 8, ["render", "props"]),
433
+ o[0] || (o[0] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
434
+ ]),
435
+ t("div", Zt, [
436
+ c(m, {
437
+ label: e(x)(`inventory.transfer.form.items.table.${e(L).Name}`)
438
+ }, null, 8, ["label"]),
439
+ c(e(Q), {
440
+ render: (p = (B = (I = u.cellByColId[e(L).Name]) == null ? void 0 : I.column) == null ? void 0 : B.columnDef) == null ? void 0 : p.cell,
441
+ props: (b = (a = u.cellByColId[e(L).Name]) == null ? void 0 : a.getContext) == null ? void 0 : b.call(a)
442
+ }, null, 8, ["render", "props"]),
443
+ o[1] || (o[1] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
444
+ ])
445
+ ]),
446
+ t("div", Jt, [
447
+ t("div", Xt, [
448
+ c(m, {
449
+ label: e(x)(`inventory.transfer.form.items.table.${e(L).DefaultAmount}`)
450
+ }, null, 8, ["label"]),
451
+ c(e(Q), {
452
+ render: (w = (f = (r = u.cellByColId[e(L).DefaultAmount]) == null ? void 0 : r.column) == null ? void 0 : f.columnDef) == null ? void 0 : w.cell,
453
+ props: (n = (s = u.cellByColId[e(L).DefaultAmount]) == null ? void 0 : s.getContext) == null ? void 0 : n.call(s)
454
+ }, null, 8, ["render", "props"]),
455
+ o[2] || (o[2] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
456
+ ]),
457
+ t("div", Yt, [
458
+ c(m, {
459
+ label: e(x)(`inventory.transfer.form.items.table.${e(L).Step}`)
460
+ }, null, 8, ["label"]),
461
+ c(e(Q), {
462
+ render: (M = ($ = (C = u.cellByColId[e(L).Step]) == null ? void 0 : C.column) == null ? void 0 : $.columnDef) == null ? void 0 : M.cell,
463
+ props: (P = (_ = u.cellByColId[e(L).Step]) == null ? void 0 : _.getContext) == null ? void 0 : P.call(_)
464
+ }, null, 8, ["render", "props"]),
465
+ o[3] || (o[3] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
466
+ ])
467
+ ]),
468
+ t("div", eo, [
469
+ t("div", to, [
470
+ c(m, {
471
+ label: e(x)(`inventory.transfer.form.items.table.${e(L).Limit}`)
472
+ }, null, 8, ["label"]),
473
+ c(e(Q), {
474
+ render: (H = (N = (E = u.cellByColId[e(L).Limit]) == null ? void 0 : E.column) == null ? void 0 : N.columnDef) == null ? void 0 : H.cell,
475
+ props: (z = (F = u.cellByColId[e(L).Limit]) == null ? void 0 : F.getContext) == null ? void 0 : z.call(F)
476
+ }, null, 8, ["render", "props"]),
477
+ o[4] || (o[4] = t("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
478
+ ])
479
+ ])
480
+ ]);
481
+ };
482
+ }
483
+ }), so = { class: "flex flex-col gap-16" }, lo = { class: "flex flex-col gap-24" }, no = { class: "flex flex-col gap-16" }, ro = { class: "flex items-center" }, ao = { class: "flex flex-col" }, io = { class: "flex flex-col gap-16" }, uo = { class: "flex" }, mo = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, co = /* @__PURE__ */ J({
484
+ __name: "TransferTemplateForm",
485
+ props: {
486
+ modelValue: {},
487
+ disabled: { type: Boolean }
488
+ },
489
+ setup(y, { expose: x }) {
490
+ const u = y, o = He(), { t: m } = X(), S = ze(), i = Ne(), l = Mt(), d = Ke();
491
+ pe(
492
+ () => u.modelValue,
493
+ (s) => {
494
+ console.log("TransferTemplateForm.model", s);
495
+ }
496
+ ), S.watchLocation(async () => {
497
+ location && (o.purchaseOrder.supplier || (o.purchaseOrder.supplier = l.suppliers.find((s) => s) ?? o.purchaseOrder.supplier));
498
+ });
499
+ const k = mt(), h = St(
500
+ () => o.purchaseOrder,
501
+ (s) => {
502
+ o.purchaseOrder = {
503
+ ...o.purchaseOrder,
504
+ supplier: s.supplier ?? (o == null ? void 0 : o.purchaseOrder.supplier)
505
+ };
506
+ }
507
+ ), A = D({
508
+ get() {
509
+ var s, n;
510
+ return typeof ((n = (s = o.purchaseOrder) == null ? void 0 : s.supplier) == null ? void 0 : n.internal) == "string" ? j.TRANSFER : j.PURCHASE;
511
+ },
512
+ set(s) {
513
+ var C, $;
514
+ const n = typeof (($ = (C = o.purchaseOrder) == null ? void 0 : C.supplier) == null ? void 0 : $.internal) == "string" ? j.TRANSFER : j.PURCHASE;
515
+ s !== n && (o.purchaseOrder.supplier = s === j.PURCHASE ? h.locationOptionsTypePurchase.value[0] : h.locationOptionsTypeTransfer.value[0]);
516
+ }
517
+ }), T = D(() => h.transferLocationOptions.value), v = D({
518
+ get() {
519
+ var s;
520
+ return (s = o.purchaseOrder.supplier) == null ? void 0 : s._id;
521
+ },
522
+ set(s) {
523
+ h.transferLocationModel.value = s;
524
+ }
525
+ }), {
526
+ promptSelectLocations: g,
527
+ columnDefs: I,
528
+ rowData: B
529
+ } = It({
530
+ getLocations() {
531
+ return o.locations;
532
+ },
533
+ setLocations(s) {
534
+ o.locations = s;
535
+ }
536
+ });
537
+ function p() {
538
+ var s, n;
539
+ return (s = o.locations) != null && s.find((C) => {
540
+ var $, M;
541
+ return (($ = C.doc) == null ? void 0 : $._id) === ((M = o.purchaseOrder.supplier) == null ? void 0 : M._id);
542
+ }) ? `Location ${(n = o.purchaseOrder.supplier) == null ? void 0 : n.name} must be removed because template cannot be used to transfer to itself.` : !0;
543
+ }
544
+ const a = D({
545
+ get() {
546
+ return o.purchaseOrder.remark ?? void 0;
547
+ },
548
+ set(s) {
549
+ o.purchaseOrder.remark = s;
550
+ }
551
+ }), b = U();
552
+ x({
553
+ validateInputs: () => {
554
+ var s, n;
555
+ (n = (s = b.value) == null ? void 0 : s.validateInputs) == null || n.call(s);
556
+ },
557
+ resetInputsValidation: () => {
558
+ var s, n;
559
+ (n = (s = b.value) == null ? void 0 : s.resetInputsValidation) == null || n.call(s);
560
+ },
561
+ resetInputs: () => {
562
+ var s, n;
563
+ (n = (s = b.value) == null ? void 0 : s.resetInputs) == null || n.call(s);
564
+ }
565
+ });
566
+ const r = Nt({
567
+ updateItem: (s) => {
568
+ o.purchaseOrder.items = o.purchaseOrder.items.map((n) => n.sku._id !== s.sku._id ? n : s);
569
+ },
570
+ deleteItem: (s) => {
571
+ o.purchaseOrder.items = o.purchaseOrder.items.filter(
572
+ (n) => n.sku._id !== s.sku._id
573
+ );
574
+ },
575
+ get supplier() {
576
+ return o.purchaseOrder.supplier;
577
+ },
578
+ get items() {
579
+ return o.purchaseOrder.items;
580
+ },
581
+ get transferType() {
582
+ return j.PURCHASE;
583
+ },
584
+ get disabled() {
585
+ return u.disabled;
586
+ }
587
+ }), f = D(() => r.columnDefs.value);
588
+ function w() {
589
+ const s = i.skus.map((C) => ({
590
+ label: C.name,
591
+ sublabel: C.code,
592
+ value: C
593
+ })), n = s.filter((C) => {
594
+ var $;
595
+ return ($ = o.purchaseOrder.items) == null ? void 0 : $.find((M) => M.sku._id === C.value._id);
596
+ }).map((C) => C.value);
597
+ k.open({
598
+ title: m("inventory.transfer.form.items.selectItem"),
599
+ closeButton: !0,
600
+ contentComponent: $t,
601
+ contentComponentProps: {
602
+ modelValue: n,
603
+ items: s,
604
+ virtualScroll: !0
605
+ },
606
+ primaryActions: {
607
+ text: m("common.confirm"),
608
+ close: !0
609
+ },
610
+ secondaryActions: {
611
+ text: m("common.close"),
612
+ close: !0,
613
+ variant: "tertiary"
614
+ }
615
+ }).onPrimary((C) => {
616
+ const $ = o.purchaseOrder.items ?? [], M = C.map((_) => {
617
+ const P = $.find((F) => F.sku._id === _._id);
618
+ if (P)
619
+ return P;
620
+ let E = _.code;
621
+ if (d.isEnabled) {
622
+ const F = d.getItemPKTCode(_);
623
+ F && (E = F);
624
+ }
625
+ const N = { amount: 1, precision: ae(_.unit) };
626
+ return {
627
+ sku: _,
628
+ code: E,
629
+ name: _.name,
630
+ quantity: N,
631
+ minimumQuantity: N,
632
+ maximumQuantity: _t(N, {
633
+ amount: 100,
634
+ precision: 0
635
+ }),
636
+ quantityStep: N
637
+ };
638
+ });
639
+ M.sort((_, P) => _.sku.code.localeCompare(P.sku.code)), o.purchaseOrder.items = M;
640
+ });
641
+ }
642
+ return (s, n) => {
643
+ const C = V("FmTextField"), $ = V("FmSelect"), M = V("FmTextarea"), _ = V("FmButton"), P = V("FmTable"), E = V("FmFormGroup"), N = V("FmForm");
644
+ return R(), W(N, {
645
+ ref_key: "formRef",
646
+ ref: b,
647
+ class: "flex flex-col gap-32",
648
+ disabled: s.disabled
649
+ }, {
650
+ default: q(() => {
651
+ var H;
652
+ return [
653
+ t("div", so, [
654
+ t("div", lo, [
655
+ c(C, {
656
+ label: e(m)("inventory.transfer.form.name"),
657
+ "label-mark": "required",
658
+ modelValue: e(o).name,
659
+ "onUpdate:modelValue": n[0] || (n[0] = (F) => e(o).name = F),
660
+ rules: [e(me)()]
661
+ }, null, 8, ["label", "modelValue", "rules"]),
662
+ c($, {
663
+ label: e(m)("inventory.transfer.form.type.title"),
664
+ "model-value": A.value,
665
+ "onUpdate:modelValue": n[1] || (n[1] = (F) => A.value = F),
666
+ items: [
667
+ {
668
+ label: e(m)("inventory.transfer.form.type.purchase"),
669
+ value: e(j).PURCHASE,
670
+ disabled: !e(h).locationOptionsTypePurchase.value.length,
671
+ sublabel: e(h).locationOptionsTypePurchase.value.length ? void 0 : e(m)("inventory.transfer.form.noSupplierAvailable")
672
+ },
673
+ {
674
+ label: e(m)("inventory.transfer.form.type.transfer"),
675
+ value: e(j).TRANSFER,
676
+ disabled: !e(h).locationOptionsTypeTransfer.value.length,
677
+ sublabel: e(h).locationOptionsTypeTransfer.value.length ? void 0 : e(m)("inventory.transfer.form.noLocationAvailable")
678
+ }
679
+ ],
680
+ rules: [e(de)(1)(T.value)]
681
+ }, null, 8, ["label", "model-value", "items", "rules"]),
682
+ c($, {
683
+ label: A.value === e(j).PURCHASE ? e(m)("inventory.transfer.form.purchaseFrom") : e(m)("inventory.transfer.form.transferFrom"),
684
+ modelValue: v.value,
685
+ "onUpdate:modelValue": n[2] || (n[2] = (F) => v.value = F),
686
+ items: T.value
687
+ }, {
688
+ "menu-wrapper": q((F) => {
689
+ var z;
690
+ return [
691
+ c(Ct, Ue(F, {
692
+ items: T.value,
693
+ "model-value": (z = s.modelValue.purchaseOrder.supplier) == null ? void 0 : z._id
694
+ }), null, 16, ["items", "model-value"])
695
+ ];
696
+ }),
697
+ _: 1
698
+ }, 8, ["label", "modelValue", "items"]),
699
+ c(C, {
700
+ label: e(m)("inventory.transfer.form.reference"),
701
+ "label-mark": "optional",
702
+ modelValue: e(o).purchaseOrder.ref,
703
+ "onUpdate:modelValue": n[3] || (n[3] = (F) => e(o).purchaseOrder.ref = F)
704
+ }, null, 8, ["label", "modelValue"]),
705
+ c(M, {
706
+ label: e(m)("inventory.transfer.form.remark"),
707
+ "label-mark": "optional",
708
+ "max-length": 240,
709
+ modelValue: a.value,
710
+ "onUpdate:modelValue": n[4] || (n[4] = (F) => a.value = F),
711
+ class: ie({ "text-fm-color-typo-disabled": s.disabled })
712
+ }, null, 8, ["label", "modelValue", "class"])
713
+ ])
714
+ ]),
715
+ t("div", no, [
716
+ t("div", ro, [
717
+ n[6] || (n[6] = t("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
718
+ c(_, {
719
+ disabled: s.disabled,
720
+ label: "Select location",
721
+ "prepend-icon": "add",
722
+ variant: "plain",
723
+ class: "border-2 rounded-lg border-fm-color-primary",
724
+ onClick: e(g)
725
+ }, null, 8, ["disabled", "onClick"])
726
+ ]),
727
+ c(P, {
728
+ "column-defs": e(I),
729
+ "row-data": e(B),
730
+ "shrink-at": 9999,
731
+ onRowClick: e(g),
732
+ "hide-footer": ""
733
+ }, null, 8, ["column-defs", "row-data", "onRowClick"]),
734
+ t("div", ao, [
735
+ c(E, {
736
+ "model-value": [
737
+ (H = u.modelValue.purchaseOrder.supplier) == null ? void 0 : H._id,
738
+ ...u.modelValue.locations ?? []
739
+ ].join(","),
740
+ rules: [p]
741
+ }, null, 8, ["model-value", "rules"])
742
+ ])
743
+ ]),
744
+ t("div", io, [
745
+ t("div", uo, [
746
+ t("div", mo, O(e(m)("inventory.transfer.form.items.title")), 1),
747
+ c(_, {
748
+ disabled: s.disabled,
749
+ label: e(m)("inventory.transfer.form.items.addItem"),
750
+ "prepend-icon": "add",
751
+ variant: "plain",
752
+ class: "border-2 rounded-lg border-fm-color-primary",
753
+ onClick: n[5] || (n[5] = (F) => w()),
754
+ size: "md"
755
+ }, null, 8, ["disabled", "label"])
756
+ ]),
757
+ (R(), W(P, {
758
+ "column-defs": f.value,
759
+ "row-data": e(o).purchaseOrder.items,
760
+ key: e(o).purchaseOrder.items.map((F) => F.sku._id).join("."),
761
+ "hide-footer": "",
762
+ "page-size": e(o).purchaseOrder.items.length
763
+ }, {
764
+ "list-row": q((F) => [
765
+ (R(), W(Ge, {
766
+ row: F,
767
+ key: e(o).purchaseOrder.items.map((z) => z.sku._id).join(".")
768
+ }, {
769
+ default: q((z) => [
770
+ c(oo, {
771
+ row: F,
772
+ "cell-by-col-id": z
773
+ }, null, 8, ["row", "cell-by-col-id"])
774
+ ]),
775
+ _: 2
776
+ }, 1032, ["row"]))
777
+ ]),
778
+ _: 1
779
+ }, 8, ["column-defs", "row-data", "page-size"])),
780
+ c(E, {
781
+ "model-value": e(o).purchaseOrder.items.length,
782
+ rules: [e(de)(1)]
783
+ }, null, 8, ["model-value", "rules"])
784
+ ])
785
+ ];
786
+ }),
787
+ _: 1
788
+ }, 8, ["disabled"]);
789
+ };
790
+ }
791
+ }), po = { class: "flex items-center" }, fo = { class: "fm-typo-en-title-md-800" }, yo = { class: "flex gap-4" }, vo = /* @__PURE__ */ J({
792
+ __name: "TransferTemplateDialog",
793
+ props: {
794
+ mode: {},
795
+ modelValue: {},
796
+ show: { type: Boolean }
797
+ },
798
+ emits: ["update:show", "submitted"],
799
+ setup(y, { expose: x, emit: u }) {
800
+ var b;
801
+ const o = y, m = u, S = rt(), i = dt(), { t: l } = X(), d = je(o, "show");
802
+ function k() {
803
+ return {
804
+ _id: "",
805
+ name: "",
806
+ purchaseOrder: {
807
+ remark: void 0,
808
+ ref: void 0,
809
+ items: [],
810
+ supplier: {
811
+ _rev: void 0,
812
+ email: void 0,
813
+ internal: void 0,
814
+ contactName: void 0,
815
+ phoneNumber: void 0,
816
+ registrationNumber: void 0,
817
+ supplyItems: void 0,
818
+ _id: "",
819
+ name: "",
820
+ address: {
821
+ line2: void 0,
822
+ line1: "",
823
+ state: "",
824
+ city: "",
825
+ postcode: "",
826
+ country: ""
827
+ }
828
+ }
829
+ }
830
+ };
831
+ }
832
+ const h = U(o.modelValue ?? k()), A = U(((b = o.modelValue) == null ? void 0 : b._id) ?? `${Math.random()}`);
833
+ pe(
834
+ () => o.show,
835
+ (r) => {
836
+ var f;
837
+ r && (h.value = o.modelValue ?? k(), A.value = ((f = o.modelValue) == null ? void 0 : f._id) ?? `${Math.random()}`);
838
+ }
839
+ );
840
+ const T = U(!1), v = D(() => {
841
+ switch (o.mode) {
842
+ case ee.READ:
843
+ return "";
844
+ case ee.CREATE:
845
+ return l("inventory.transfer.template.create.title");
846
+ case ee.UPDATE:
847
+ return l("inventory.transfer.template.update.title");
848
+ }
849
+ return "";
850
+ }), g = U();
851
+ x({
852
+ validateInputs: () => {
853
+ var r, f;
854
+ (f = (r = g.value) == null ? void 0 : r.validateInputs) == null || f.call(r);
855
+ },
856
+ resetInputsValidation: () => {
857
+ var r, f;
858
+ (f = (r = g.value) == null ? void 0 : r.resetInputsValidation) == null || f.call(r);
859
+ },
860
+ resetInputs: () => {
861
+ var r, f;
862
+ (f = (r = g.value) == null ? void 0 : r.resetInputs) == null || f.call(r);
863
+ }
864
+ });
865
+ async function I() {
866
+ var f, w;
867
+ const r = h.value;
868
+ if (r) {
869
+ T.value = !0, (((f = r.purchaseOrder.supplier) == null ? void 0 : f.internal) === ne.enum.warehouse || ((w = r.purchaseOrder.supplier) == null ? void 0 : w.internal) === ne.enum.restaurant) && (r.purchaseOrder.items = r.purchaseOrder.items.map(
870
+ ({ totalCost: s, ...n }) => n
871
+ ));
872
+ try {
873
+ await S.createTemplate(r), await new Promise((s) => setTimeout(s, 1e3)), i.open({
874
+ title: l("inventory.transfer.template.create.success"),
875
+ message: l("inventory.transfer.template.create.successMessage"),
876
+ type: "success"
877
+ }), m("update:show", !1), m("submitted");
878
+ } catch (s) {
879
+ i.open({
880
+ title: l("inventory.transfer.template.create.error"),
881
+ message: l("inventory.transfer.template.create.errorMessage"),
882
+ type: "error"
883
+ }), console.error("Error in creating transfer template", s);
884
+ } finally {
885
+ T.value = !1;
886
+ }
887
+ }
888
+ }
889
+ async function B() {
890
+ var f, w;
891
+ const r = h.value;
892
+ if (r) {
893
+ T.value = !0, (((f = r.purchaseOrder.supplier) == null ? void 0 : f.internal) === ne.enum.warehouse || ((w = r.purchaseOrder.supplier) == null ? void 0 : w.internal) === ne.enum.restaurant) && (r.purchaseOrder.items = r.purchaseOrder.items.map(
894
+ ({ totalCost: s, ...n }) => n
895
+ ));
896
+ try {
897
+ await S.updateTemplate(r), await new Promise((s) => setTimeout(s, 1e3)), i.open({
898
+ title: l("inventory.transfer.template.update.success"),
899
+ message: l("inventory.transfer.template.update.successMessage"),
900
+ type: "success"
901
+ }), m("update:show", !1), m("submitted");
902
+ } catch (s) {
903
+ i.open({
904
+ title: l("inventory.transfer.template.update.error"),
905
+ message: l("inventory.transfer.template.update.errorMessage"),
906
+ type: "error"
907
+ }), console.error("Error in updating transfer template", s);
908
+ } finally {
909
+ T.value = !1;
910
+ }
911
+ }
912
+ }
913
+ function p() {
914
+ switch (o.mode) {
915
+ case ee.CREATE:
916
+ return I();
917
+ case ee.UPDATE:
918
+ return B();
919
+ }
920
+ }
921
+ function a() {
922
+ var r, f;
923
+ (f = (r = g.value) == null ? void 0 : r.validateInputs) == null || f.call(r);
924
+ }
925
+ return (r, f) => {
926
+ const w = V("FmButton"), s = V("FmSideSheet");
927
+ return R(), W(s, {
928
+ modelValue: e(d),
929
+ "onUpdate:modelValue": f[2] || (f[2] = (n) => Ee(d) ? d.value = n : null),
930
+ "dismiss-away": "",
931
+ "close-button": "",
932
+ "max-width": 1200
933
+ }, {
934
+ "side-sheet-header": q(() => [
935
+ t("div", po, [
936
+ t("div", fo, O(v.value), 1)
937
+ ])
938
+ ]),
939
+ default: q(() => [
940
+ (R(), W(co, {
941
+ class: "w-full",
942
+ ref_key: "formRef",
943
+ ref: g,
944
+ onValidationSuccess: p,
945
+ "model-value": h.value,
946
+ "onUpdate:modelValue": f[0] || (f[0] = (n) => h.value = n),
947
+ disabled: T.value,
948
+ key: A.value
949
+ }, null, 8, ["model-value", "disabled"]))
950
+ ]),
951
+ "side-sheet-footer": q(() => [
952
+ t("div", yo, [
953
+ c(w, {
954
+ loading: T.value,
955
+ label: e(l)("common.save"),
956
+ onClick: a
957
+ }, null, 8, ["loading", "label"]),
958
+ c(w, {
959
+ disabled: T.value,
960
+ variant: "tertiary",
961
+ label: e(l)("common.close"),
962
+ onClick: f[1] || (f[1] = (n) => m("update:show", !1))
963
+ }, null, 8, ["disabled", "label"])
964
+ ])
965
+ ]),
966
+ _: 1
967
+ }, 8, ["modelValue"]);
968
+ };
969
+ }
970
+ }), bo = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, xo = { class: "flex justify-between" }, _o = { class: "fm-typo-en-body-lg-600" }, ho = { class: "fm-status-badge fm-status-badge-info-secondary" }, go = { class: "flex flex-col gap-8" }, Fo = { class: "flex flex-col gap-4" }, To = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wo = { class: "flex gap-1" }, ko = { class: "fm-typo-en-body-lg-600" }, So = {
971
+ key: 0,
972
+ class: "flex flex-col gap-4"
973
+ }, Co = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Mo = { class: "fm-typo-en-body-lg-600" }, $o = {
974
+ key: 1,
975
+ class: "flex flex-col gap-4"
976
+ }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oo = { class: "fm-typo-en-body-lg-600" }, Vo = {
977
+ key: 2,
978
+ class: "flex flex-col gap-4"
979
+ }, Ao = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ro = { class: "fm-typo-en-body-lg-600" }, Do = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, Po = { class: "flex flex-col gap-8" }, Lo = { class: "fm-typo-en-body-lg-600" }, Bo = { class: "flex w-full gap-4" }, Uo = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, Eo = { class: "fm-typo-en-body-lg-600 shrink-0" }, qo = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, No = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, zo = {
980
+ key: 0,
981
+ class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
982
+ }, jo = {
983
+ key: 0,
984
+ class: "flex gap-4 items-center"
985
+ }, Ho = { class: "flex flex-col gap-12" }, Qo = { class: "flex flex-col gap-8" }, Ko = { class: "flex gap-8 xs:flex-col" }, Go = /* @__PURE__ */ J({
986
+ __name: "TransferTemplateDetails",
987
+ props: {
988
+ template: {},
989
+ show: { type: Boolean }
990
+ },
991
+ emits: ["update:show", "action:edit"],
992
+ setup(y, { emit: x }) {
993
+ const u = y, o = x, m = Qe(), { t: S } = X(), i = D(() => {
994
+ var T;
995
+ return (T = u.template) == null ? void 0 : T.purchaseOrder;
996
+ }), l = [
997
+ { accessorKey: "name", header: () => "Name" },
998
+ { accessorKey: "type", header: () => "Type" }
999
+ ], d = U(""), k = D(
1000
+ () => {
1001
+ var T, v, g, I;
1002
+ return ((v = (T = i.value) == null ? void 0 : T.supplier) == null ? void 0 : v.internal) === "restaurant" || ((I = (g = i.value) == null ? void 0 : g.supplier) == null ? void 0 : I.internal) === "warehouse" ? j.TRANSFER : j.PURCHASE;
1003
+ }
1004
+ ), h = U(!0), A = je(u, "show");
1005
+ return (T, v) => {
1006
+ var f;
1007
+ const g = V("FmMenuDivider"), I = V("FmCard"), B = V("FmIcon"), p = V("FmTextField"), a = V("FmTable"), b = V("FmButton"), r = V("FmSideSheet");
1008
+ return R(), W(r, {
1009
+ header: e(S)("inventory.transfer.template.details.view", { template: (f = T.template) == null ? void 0 : f.name }),
1010
+ modelValue: e(A),
1011
+ "onUpdate:modelValue": v[2] || (v[2] = (w) => Ee(A) ? A.value = w : null),
1012
+ "dismiss-away": h.value,
1013
+ "close-button": "",
1014
+ "max-width": 500
1015
+ }, {
1016
+ default: q(() => {
1017
+ var w, s;
1018
+ return [
1019
+ t("div", bo, [
1020
+ t("div", null, [
1021
+ c(I, {
1022
+ variant: "outlined",
1023
+ class: "flex flex-col gap-8 px-12 py-16"
1024
+ }, {
1025
+ default: q(() => {
1026
+ var n, C, $, M, _, P, E;
1027
+ return [
1028
+ t("div", xo, [
1029
+ t("div", _o, O(e(S)("inventory.transfer.template.details.templateSummary")), 1),
1030
+ t("div", ho, O(e(S)(
1031
+ `inventory.transfer.receiveRequest.details.type.${k.value.toLocaleLowerCase("en-US")}`
1032
+ )), 1)
1033
+ ]),
1034
+ c(g),
1035
+ t("div", go, [
1036
+ t("div", Fo, [
1037
+ t("div", To, [
1038
+ t("div", wo, O(e(S)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1039
+ ]),
1040
+ t("div", ko, O(e(Ot)(((n = T.template) == null ? void 0 : n._id) ?? "")), 1)
1041
+ ]),
1042
+ ($ = (C = i.value) == null ? void 0 : C.supplier) != null && $.name ? (R(), K("div", So, [
1043
+ t("div", Co, O(e(S)("inventory.transfer.receiveRequest.details.from")), 1),
1044
+ t("div", Mo, O((_ = (M = i.value) == null ? void 0 : M.supplier) == null ? void 0 : _.name), 1)
1045
+ ])) : Y("", !0),
1046
+ (P = i.value) != null && P.ref ? (R(), K("div", $o, [
1047
+ t("div", Io, O(e(S)("inventory.transfer.receiveRequest.details.reference")), 1),
1048
+ t("div", Oo, O(i.value.ref), 1)
1049
+ ])) : Y("", !0),
1050
+ (E = i.value) != null && E.remark ? (R(), K("div", Vo, [
1051
+ t("div", Ao, O(e(S)("inventory.transfer.receiveRequest.details.remark")), 1),
1052
+ t("div", Ro, O(i.value.remark), 1)
1053
+ ])) : Y("", !0)
1054
+ ])
1055
+ ];
1056
+ }),
1057
+ _: 1
1058
+ })
1059
+ ]),
1060
+ t("div", Do, [
1061
+ t("div", Po, [
1062
+ t("div", Lo, O(e(S)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1063
+ (R(!0), K(qe, null, Xe(((w = i.value) == null ? void 0 : w.items) ?? [], (n) => (R(), K("div", {
1064
+ key: n.code,
1065
+ class: "flex flex-col"
1066
+ }, [
1067
+ t("div", Bo, [
1068
+ t("div", Uo, O(n.name), 1),
1069
+ v[3] || (v[3] = t("div", { class: "flex-1 min-w-32" }, null, -1)),
1070
+ t("div", Eo, O(e(at)(n.quantity, n.sku.unit, n.measurement)), 1)
1071
+ ]),
1072
+ t("div", qo, [
1073
+ t("div", No, O(n.code), 1),
1074
+ n.totalCost && e(m).enableTotalCost ? (R(), K("div", zo, " (" + O(e(ht)(n.totalCost)) + ") ", 1)) : Y("", !0)
1075
+ ]),
1076
+ e(it)(n) ? (R(), K("div", jo, [
1077
+ c(B, {
1078
+ name: "error",
1079
+ color: "system-error-300",
1080
+ size: "sm"
1081
+ }),
1082
+ v[4] || (v[4] = t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400" }, " This item has invalid unit configuration. Apply update on this item. ", -1))
1083
+ ])) : Y("", !0)
1084
+ ]))), 128))
1085
+ ])
1086
+ ]),
1087
+ v[6] || (v[6] = t("div", null, null, -1)),
1088
+ v[7] || (v[7] = t("div", null, null, -1)),
1089
+ t("div", Ho, [
1090
+ v[5] || (v[5] = t("div", { class: "flex flex-col" }, [
1091
+ t("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1092
+ t("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
1093
+ ], -1)),
1094
+ t("div", Qo, [
1095
+ c(p, {
1096
+ modelValue: d.value,
1097
+ "onUpdate:modelValue": v[0] || (v[0] = (n) => d.value = n),
1098
+ placeholder: "Filter locations",
1099
+ "prepend-icon": "search"
1100
+ }, null, 8, ["modelValue"]),
1101
+ c(a, {
1102
+ "hide-footer": "",
1103
+ style: { height: "500px" },
1104
+ "column-defs": l,
1105
+ "search-value": d.value,
1106
+ "row-data": ((s = u.template) == null ? void 0 : s.locations) ?? [{ name: "All locations" }]
1107
+ }, null, 8, ["search-value", "row-data"])
1108
+ ])
1109
+ ])
1110
+ ])
1111
+ ];
1112
+ }),
1113
+ "side-sheet-footer": q(() => [
1114
+ t("div", Ko, [
1115
+ c(b, {
1116
+ label: e(S)("common.edit"),
1117
+ onClick: v[1] || (v[1] = (w) => o("action:edit")),
1118
+ variant: "tertiary"
1119
+ }, null, 8, ["label"])
1120
+ ])
1121
+ ]),
1122
+ _: 1
1123
+ }, 8, ["header", "modelValue", "dismiss-away"]);
1124
+ };
1125
+ }
1126
+ }), Wo = { class: "flex-1 flex flex-col gap-8" }, Zo = { class: "flex flex-col" }, Jo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Yo = { class: "fm-typo-en-body-lg-400" }, es = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, ts = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Ts = /* @__PURE__ */ J({
1127
+ __name: "TransferTemplateView",
1128
+ setup(y) {
1129
+ const { t: x } = X(), { createTemplate: u, viewTemplate: o, importTemplates: m, exportTemplates: S } = Re(), { templateDialogProps: i, templateDetailsProps: l } = Pe(Re()), d = ut(), { loading: k, templates: h } = Pe(d), A = U(!1), T = st(), v = ze(), { breakpoints: g } = ct();
1130
+ ce(d.fetchTemplates);
1131
+ const I = D(
1132
+ () => A.value || k.value || !v._currentLocation
1133
+ ), B = D(() => h.value), p = U(""), a = D(() => g.value.xs || g.value.sm), b = D(() => a.value ? 10 : 20);
1134
+ function r(s) {
1135
+ switch (s) {
1136
+ case De.Add:
1137
+ return u();
1138
+ case "refresh":
1139
+ return d.fetchTemplates();
1140
+ case "import":
1141
+ return m();
1142
+ case "export":
1143
+ return S();
1144
+ }
1145
+ }
1146
+ function f(s) {
1147
+ return s;
1148
+ }
1149
+ const w = D(() => [
1150
+ {
1151
+ label: x("inventory.closing.template.create.title"),
1152
+ value: De.Add,
1153
+ isPrimary: !0,
1154
+ prependIcon: "add"
1155
+ },
1156
+ {
1157
+ label: "Refresh",
1158
+ value: "refresh",
1159
+ isPrimary: !1
1160
+ },
1161
+ {
1162
+ label: "Import",
1163
+ value: "import",
1164
+ isPrimary: !1
1165
+ },
1166
+ {
1167
+ label: "Export",
1168
+ value: "export",
1169
+ isPrimary: !1
1170
+ }
1171
+ ]);
1172
+ return (s, n) => {
1173
+ const C = V("FmTable");
1174
+ return R(), K(qe, null, [
1175
+ c(lt, {
1176
+ title: e(x)("inventory.transfer.template.title2"),
1177
+ actions: w.value,
1178
+ "onClick:action": r
1179
+ }, {
1180
+ default: q(() => {
1181
+ var $;
1182
+ return [
1183
+ t("div", {
1184
+ class: ie([
1185
+ "flex flex-col gap-8 max-h-full",
1186
+ {
1187
+ "p-0": a.value,
1188
+ "px-24 ": !a.value
1189
+ }
1190
+ ])
1191
+ }, [
1192
+ c(nt, {
1193
+ searchable: "",
1194
+ search: p.value,
1195
+ "onUpdate:search": n[0] || (n[0] = (M) => p.value = M)
1196
+ }, null, 8, ["search"]),
1197
+ (R(), W(C, {
1198
+ style: Ye(e(T).tableHeight),
1199
+ "column-defs": e(d).columnDefs,
1200
+ "row-data": B.value,
1201
+ "search-value": p.value,
1202
+ loading: I.value,
1203
+ key: ($ = e(v)._currentLocation) == null ? void 0 : $.dbName,
1204
+ onRowClick: n[1] || (n[1] = (M) => e(o)(M.original)),
1205
+ "page-size": b.value
1206
+ }, {
1207
+ "list-row": q((M) => [
1208
+ c(Ge, {
1209
+ row: M,
1210
+ onRowClick: (_) => e(o)(_)
1211
+ }, {
1212
+ default: q((_) => {
1213
+ var P, E, N, H, F, z, fe, ye, te, ve, be, xe, _e, oe, he, ge, Fe, Te, we, ke, se, Se, Ce, Me, $e, le, Ie;
1214
+ return [
1215
+ t("div", Wo, [
1216
+ t("div", Zo, [
1217
+ t("div", Jo, [
1218
+ c(e(Q), {
1219
+ render: (N = (E = (P = _._id) == null ? void 0 : P.column) == null ? void 0 : E.columnDef) == null ? void 0 : N.cell,
1220
+ props: (F = (H = _._id) == null ? void 0 : H.getContext) == null ? void 0 : F.call(H)
1221
+ }, null, 8, ["render", "props"])
1222
+ ]),
1223
+ t("div", Xo, [
1224
+ c(e(Q), {
1225
+ render: (ye = (fe = (z = _.name) == null ? void 0 : z.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ye.cell,
1226
+ props: (ve = (te = _.name) == null ? void 0 : te.getContext) == null ? void 0 : ve.call(te)
1227
+ }, null, 8, ["render", "props"])
1228
+ ]),
1229
+ t("div", Yo, [
1230
+ c(e(Q), {
1231
+ render: (_e = (xe = (be = _.supplier) == null ? void 0 : be.column) == null ? void 0 : xe.columnDef) == null ? void 0 : _e.cell,
1232
+ props: (he = (oe = _.supplier) == null ? void 0 : oe.getContext) == null ? void 0 : he.call(oe)
1233
+ }, null, 8, ["render", "props"])
1234
+ ]),
1235
+ t("div", null, O((ge = M.original.locations) != null && ge.length ? `Enabled for ${(Fe = M.original.locations) == null ? void 0 : Fe.length} outlets` : "Enabled for all outlets"), 1),
1236
+ t("div", es, O(M.original.purchaseOrder.items.length ? M.original.purchaseOrder.items.map((We) => We.name).join(", ") : "No items"), 1),
1237
+ t("div", ts, [
1238
+ c(e(Q), {
1239
+ render: (ke = (we = (Te = _.ref) == null ? void 0 : Te.column) == null ? void 0 : we.columnDef) == null ? void 0 : ke.cell,
1240
+ props: (Se = (se = _.ref) == null ? void 0 : se.getContext) == null ? void 0 : Se.call(se)
1241
+ }, null, 8, ["render", "props"])
1242
+ ])
1243
+ ]),
1244
+ t("div", null, [
1245
+ c(e(Q), {
1246
+ render: ($e = (Me = (Ce = _.type) == null ? void 0 : Ce.column) == null ? void 0 : Me.columnDef) == null ? void 0 : $e.cell,
1247
+ props: (Ie = (le = _.type) == null ? void 0 : le.getContext) == null ? void 0 : Ie.call(le)
1248
+ }, null, 8, ["render", "props"])
1249
+ ])
1250
+ ])
1251
+ ];
1252
+ }),
1253
+ _: 2
1254
+ }, 1032, ["row", "onRowClick"])
1255
+ ]),
1256
+ _: 1
1257
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1258
+ ], 2)
1259
+ ];
1260
+ }),
1261
+ _: 1
1262
+ }, 8, ["title", "actions"]),
1263
+ (R(), W(et, { to: "body" }, [
1264
+ c(Go, tt(ot(e(l))), null, 16),
1265
+ c(vo, Ue(e(i), {
1266
+ onSubmitted: n[2] || (n[2] = ($) => e(d).fetchTemplates())
1267
+ }), null, 16)
1268
+ ]))
1269
+ ], 64);
1270
+ };
1271
+ }
1272
+ });
1273
+ export {
1274
+ Ts as default
1275
+ };