@feedmepos/mf-inventory-portal 0.0.22-dev.2 → 0.0.22-dev.21

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