@feedmepos/mf-inventory-portal 0.0.25-dev.30 → 0.0.25-dev.32

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 (63) hide show
  1. package/dist/{App-CbGTNGMK.js → App-5mHsEh9k.js} +2 -2
  2. package/dist/{ApprovalView-C9hrKiel.js → ApprovalView-8j418xsu.js} +13 -13
  3. package/dist/{BindingsDialog-DIxrUmBp.js → BindingsDialog-mI12JwDT.js} +2 -2
  4. package/dist/{BindingsPicker-DT2fCUQ7.js → BindingsPicker-BiWsFvJ9.js} +5 -5
  5. package/dist/{BindingsTable-rpRrfxfm.js → BindingsTable-D0gpm1wp.js} +5 -5
  6. package/dist/{ClosingDraftView-aETdobNv.js → ClosingDraftView-CDw4t1Ry.js} +2 -2
  7. package/dist/{ClosingTemplateView-Cl-7Agfl.js → ClosingTemplateView-BVT7uVSl.js} +2 -2
  8. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ugss5lqQ.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-5lfzdCEF.js} +3 -3
  9. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BZoFs1-5.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BiH1i5IX.js} +22 -22
  10. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-uRrJNVoO.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-BZ5jhZJ3.js} +1 -1
  11. package/dist/{IngredientGroupView-DCtkP28-.js → IngredientGroupView-CuOJ-lgG.js} +1 -1
  12. package/dist/{IngredientsView-C4jOCqij.js → IngredientsView-DQxuOeeA.js} +4 -4
  13. package/dist/{IntegrationView-DDAVjLV5.js → IntegrationView-dTWQ7Y0L.js} +1 -1
  14. package/dist/{InventoryBindingForm-CbM-0GcS.js → InventoryBindingForm-BqbgCls7.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-uGVP8nwi.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DNzrrq37.js} +3 -3
  16. package/dist/{InventoryBindingSummary-DOdGKen4.js → InventoryBindingSummary-D9JS8cpw.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CBu3pj-m.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-vCMIiBLz.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BPmKDzxI.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dseg75Hj.js} +3 -3
  19. package/dist/{PublishView-BE8Fo2Go.js → PublishView-Pioi-3PK.js} +13 -13
  20. package/dist/{PurchaseOrderPrintPreview-DBEfp8uZ.js → PurchaseOrderPrintPreview-C06cZQBi.js} +1 -1
  21. package/dist/ReceiveRequestView-0LIDAdE4.js +2654 -0
  22. package/dist/{RecipeView-DTFpgZwH.js → RecipeView-dvtN4dem.js} +3 -3
  23. package/dist/{StockView-CF7VlY8S.js → StockView-LWjH0TiO.js} +7 -7
  24. package/dist/{SupplierView-BZ4rA2D1.js → SupplierView-By5AlMwB.js} +4 -4
  25. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CidXuoBS.js → TransferDetails.vue_vue_type_script_setup_true_lang-BtdKFA4E.js} +423 -422
  26. package/dist/TransferTemplateView-GfTDTpDz.js +1524 -0
  27. package/dist/{UnitView-1lzQaH5U.js → UnitView-B_C9Hrmw.js} +3 -3
  28. package/dist/{WarehouseView-eRypQalS.js → WarehouseView-CGIrHlmN.js} +1 -1
  29. package/dist/api/netsuite.d.ts +4 -4
  30. package/dist/{app-d94DuF5R.js → app-PUG_dqk9.js} +6759 -6928
  31. package/dist/app.js +1 -1
  32. package/dist/components/FmMultiselectDialog.d.ts +6 -6
  33. package/dist/{decimal-BCeq_89w.js → decimal-BYRcDs02.js} +1 -1
  34. package/dist/{feature-BiSY0JBR.js → feature-CXJupSqw.js} +1 -1
  35. package/dist/{format-unit-display-x2P1kVbK.js → format-unit-display-uZsyeofT.js} +13 -13
  36. package/dist/{index-DnkQqb_5.js → index-BMnRochi.js} +2 -2
  37. package/dist/{stock-BHtAAvq5.js → stock-CvA-l-yz.js} +1 -1
  38. package/dist/stores/integration/netsuite.d.ts +4 -4
  39. package/dist/{supplier-BSiJWxYO.js → supplier-E13yRo0f.js} +1 -1
  40. package/dist/tsconfig.app.tsbuildinfo +1 -1
  41. package/dist/{use-ingredient-select-dialog-CvsCbtLc.js → use-ingredient-select-dialog-C57l6NFB.js} +1 -1
  42. package/dist/{use-inventory-binding-dialog-CmiGDFT9.js → use-inventory-binding-dialog-drEXHE4h.js} +1 -1
  43. package/dist/views/receive-request/components/transfer-details/TransferDetails.vue.d.ts +186 -200
  44. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -46
  45. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +8 -116
  46. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -23
  47. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +611 -653
  48. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +611 -653
  49. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -0
  50. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +2 -270
  51. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItemTable.vue.d.ts +4 -70
  52. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +5 -35
  53. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +24 -420
  54. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +24 -420
  55. package/dist/views/transfer-template/composables/useTransferTemplateHelper.d.ts +305 -0
  56. package/dist/{vue-i18n-DC5cHFol.js → vue-i18n-C1ehwhFs.js} +209 -209
  57. package/package.json +3 -3
  58. package/dist/ReceiveRequestView-BmrpIRSM.js +0 -2895
  59. package/dist/TransferTemplateView-C7bYJLit.js +0 -1660
  60. package/dist/views/receive-request/components/transfer-form/components/TransferSubItemTable.vue.d.ts +0 -72
  61. package/dist/views/receive-request/components/transfer-form/helpers/calculate-sub-item-total.helper.d.ts +0 -4
  62. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateSubItem.vue.d.ts +0 -74
  63. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateSubItemTable.vue.d.ts +0 -92
@@ -1,1660 +0,0 @@
1
- import { defineComponent as ae, onMounted as Ie, computed as z, ref as H, watch as _e, inject as it, resolveComponent as O, openBlock as x, createElementBlock as $, createElementVNode as l, createVNode as d, withCtx as Q, renderSlot as Ue, withDirectives as Le, normalizeClass as ie, vModelText as qe, reactive as ut, h as le, useModel as mt, toDisplayString as U, unref as e, Fragment as se, createCommentVNode as ne, renderList as pe, createBlock as K, normalizeStyle as ze, mergeProps as je, isRef as Fe, createSlots as dt, Teleport as pt, normalizeProps as ct, guardReactiveProps as ft } from "vue";
2
- import { G as Ce, aC as we, t as Be, I as yt, aD as vt, aE as bt, i as G, aF as gt, a as He, b as Ke, Z as ke, l as Te, O as me, K as ye, A as xe, M as Ge, E as oe, u as We, af as ht, T as xt, ag as _t, B as Ze, J as wt, d as fe, ax as he, ac as kt, a0 as Tt, y as It, h as Ee, _ as Ft, z as Ct } from "./app-d94DuF5R.js";
3
- import { useI18n as ce } from "@feedmepos/mf-common";
4
- import { P as te, a as St, f as Vt, t as $t, b as Ne, u as Mt } from "./format-unit-display-x2P1kVbK.js";
5
- import { components as de, useSnackbar as Dt, useProxiedModel as Je, useBreakpoints as Ot } from "@feedmepos/ui-library";
6
- import { storeToRefs as Qe } from "pinia";
7
- import { _ as Xe, b as Ye, F as et, a as tt } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-BZoFs1-5.js";
8
- import { u as ot } from "./feature-BiSY0JBR.js";
9
- import { c as At, u as Rt, _ as Pt } from "./FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ugss5lqQ.js";
10
- import { u as Ut } from "./supplier-BSiJWxYO.js";
11
- import { u as Lt } from "./use-ingredient-select-dialog-CvsCbtLc.js";
12
- const qt = { class: "flex flex-col" }, Bt = { class: "flex flex-col" }, Et = { class: "flex-1" }, Nt = { class: "flex items-center" }, Qt = { class: "flex-1" }, zt = { class: "flex-1" }, lt = /* @__PURE__ */ ae({
13
- __name: "FmMinMaxInput",
14
- props: {
15
- rules: {},
16
- label: {},
17
- minPlaceholder: {},
18
- maxPlaceholder: {},
19
- modelValue: {},
20
- precision: {},
21
- minLength: {},
22
- maxLength: {},
23
- inputmode: {},
24
- type: {},
25
- readonly: { type: Boolean },
26
- labelMark: {},
27
- prependIcon: {},
28
- appendIcon: {},
29
- showValidBorder: { type: Boolean },
30
- labelInfo: {},
31
- showWordCount: { type: Boolean },
32
- invalid: { type: Boolean },
33
- autofocus: { type: Boolean },
34
- formatter: { type: Function },
35
- decimal: {},
36
- datalist: {},
37
- shiftDatalist: { type: Boolean },
38
- datalistMaxHeight: {},
39
- datalistMinHeight: {},
40
- offsetDatalist: {},
41
- datalistPlacement: {},
42
- datalistZIndex: {},
43
- datalistWidth: {},
44
- disabled: { type: Boolean },
45
- focused: { type: Boolean },
46
- helperText: {},
47
- helperState: {}
48
- },
49
- setup(f) {
50
- const I = f, g = Ce("modelValue"), o = yt();
51
- Ie(() => {
52
- const { min: c, max: r } = g ?? {};
53
- if (!(!c || !r) && c.precision !== r.precision) {
54
- const k = Math.max(c.precision, r.precision), i = we(c, k), _ = we(r, k);
55
- g.min = i, g.max = _;
56
- }
57
- });
58
- const b = z(() => {
59
- const { min: c, max: r } = g ?? {};
60
- return Math.max((c == null ? void 0 : c.precision) ?? 0, (r == null ? void 0 : r.precision) ?? 0, I.precision ?? 0);
61
- }), S = (c) => {
62
- if (!c) return "";
63
- const r = vt(c), k = b.value, i = we(r, k);
64
- return bt(
65
- +G(i),
66
- i.precision
67
- );
68
- }, p = H(S(g.min)), n = H(S(g.max));
69
- _e([p, n], ([c, r]) => {
70
- const k = g ?? {}, i = o(c), _ = o(r), P = b.value;
71
- if (c !== "" && i === !0) {
72
- const V = Be(+c, P);
73
- k.min = V;
74
- } else
75
- k.min = null;
76
- if (r !== "" && _ === !0) {
77
- const V = Be(+r, P);
78
- k.max = V;
79
- } else
80
- k.max = null;
81
- g.min = k.min, g.max = k.max;
82
- });
83
- const t = Symbol.for("fm:form-state"), a = it(t, null), u = z(() => I.disabled ?? (a == null ? void 0 : a.getDisabled()) ?? !1), h = H(), T = H(), y = H(!1), C = H(!1), w = z(() => y.value || C.value), v = z(() => [...[
84
- function() {
85
- return typeof o(p.value) == "string" || typeof o(n.value) == "string" ? "Must be a number" : !0;
86
- },
87
- function(k) {
88
- return !k || !k.min || !k.max ? !0 : +G(k.min) > +G(k.max) ? "Min must be less than or equal to max" : !0;
89
- }
90
- ], ...I.rules ?? []]);
91
- return (c, r) => {
92
- const k = O("FmLabel"), i = O("FmField"), _ = O("FmFormGroup");
93
- return x(), $("div", qt, [
94
- l("div", Bt, [
95
- l("div", Et, [
96
- d(k, {
97
- label: c.label,
98
- disabled: c.disabled,
99
- required: c.labelMark === "required",
100
- optional: c.labelMark === "optional"
101
- }, null, 8, ["label", "disabled", "required", "optional"])
102
- ]),
103
- d(i, { focused: w.value }, {
104
- default: Q(() => [
105
- l("div", Nt, [
106
- Ue(c.$slots, "prepend"),
107
- r[6] || (r[6] = l("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Min.", -1)),
108
- l("div", Qt, [
109
- Le(l("input", {
110
- type: "text",
111
- ref_key: "minInputRef",
112
- ref: h,
113
- onFocus: r[0] || (r[0] = () => y.value = !0),
114
- onBlur: r[1] || (r[1] = () => y.value = !1),
115
- "onUpdate:modelValue": r[2] || (r[2] = (P) => p.value = P),
116
- class: ie({
117
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
118
- "text-fm-color-typo-primary": !u.value,
119
- "text-fm-color-typo-disabled": u.value
120
- })
121
- }, null, 34), [
122
- [qe, p.value]
123
- ])
124
- ]),
125
- r[7] || (r[7] = l("div", { class: "block h-32 mx-4 w-[1px] bg-fm-color-neutral-gray-200" }, null, -1)),
126
- r[8] || (r[8] = l("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400 pr-4" }, "Max.", -1)),
127
- l("div", zt, [
128
- Le(l("input", {
129
- type: "text",
130
- ref_key: "maxInputRef",
131
- ref: T,
132
- onFocus: r[3] || (r[3] = () => C.value = !0),
133
- onBlur: r[4] || (r[4] = () => C.value = !1),
134
- "onUpdate:modelValue": r[5] || (r[5] = (P) => n.value = P),
135
- class: ie({
136
- "fm-text-field--input fm-typo-en-body-lg-400": !0,
137
- "text-fm-color-typo-primary": !u.value,
138
- "text-fm-color-typo-disabled": u.value
139
- })
140
- }, null, 34), [
141
- [qe, n.value]
142
- ])
143
- ]),
144
- Ue(c.$slots, "append")
145
- ])
146
- ]),
147
- _: 3
148
- }, 8, ["focused"])
149
- ]),
150
- d(_, {
151
- class: "flex-1",
152
- "model-value": c.modelValue,
153
- info: c.labelInfo,
154
- rules: v.value,
155
- "helper-text": c.helperText,
156
- "helper-state": c.helperState
157
- }, null, 8, ["model-value", "info", "rules", "helper-text", "helper-state"])
158
- ]);
159
- };
160
- }
161
- });
162
- function nt({ min: f, max: I } = { min: !0, max: !0 }) {
163
- return function(o) {
164
- return !o || !o.min && f != !1 || !o.max && I != !1 ? "Required" : !0;
165
- };
166
- }
167
- function st(f, I) {
168
- return function(o) {
169
- return !o || !o.min || !o.max ? !0 : +G(o.min) < f ? `Must be between ${f} and ${I}` : +G(o.max) > I ? `Must be between ${f} and ${I}` : !0;
170
- };
171
- }
172
- function at(f) {
173
- const I = gt(f), g = G(f);
174
- return function(b) {
175
- const S = !(b != null && b.min) || I(b.min) === !0, p = !(b != null && b.max) || I(b.max) === !0;
176
- return !S && !p ? `Min & max must be a multiple of ${g}` : S ? p ? !0 : `Max must be a multiple of ${g}` : `Min must be a multiple of ${g}`;
177
- };
178
- }
179
- var L = /* @__PURE__ */ ((f) => (f.Code = "Code", f.Name = "Name", f.DefaultAmount = "DefaultAmount", f.Limit = "Limit", f.Step = "Step", f.Cost = "Cost", f.Delete = "Delete", f))(L || {});
180
- function jt(f) {
181
- const { t: I } = ce(), g = He(), o = Ke(), b = ut({});
182
- Ie(() => {
183
- for (const n of f.items) {
184
- if (!n.totalCost)
185
- continue;
186
- const t = At(n.sku, n.quantity, n.measurement, {
187
- supplier: f.supplier
188
- }), a = n.totalCost ?? ke.reset();
189
- t ? b[n.sku._id] = t.amount !== a.amount || t.precision !== a.precision : b[n.sku._id] = !0;
190
- }
191
- });
192
- const S = [
193
- {
194
- id: "Code",
195
- header: () => I("inventory.transfer.form.items.table.Code"),
196
- accessorKey: "code",
197
- size: 180,
198
- cell(n) {
199
- var a;
200
- const t = n.row.original;
201
- return (a = t.subItems) != null && a.length ? le(
202
- "span",
203
- { class: "text-fm-color-typo-primary fm-typo-en-body-md-600 line-clamp-1" },
204
- t.sku.code
205
- ) : le(de.FmTextField, {
206
- modelValue: t.code,
207
- "onUpdate:modelValue": (u) => {
208
- f.updateItem({
209
- ...t,
210
- code: u
211
- });
212
- },
213
- key: t.sku._id,
214
- rules: [Te()],
215
- labelMark: "required"
216
- });
217
- },
218
- enableSorting: !1
219
- },
220
- {
221
- id: "Name",
222
- header: () => I("inventory.transfer.form.items.table.Name"),
223
- minSize: 300,
224
- cell(n) {
225
- var a;
226
- const t = n.row.original;
227
- return (a = t.subItems) != null && a.length ? le(
228
- "span",
229
- { class: "text-fm-color-typo-primary fm-typo-en-body-md-600 line-clamp-1" },
230
- t.sku.name
231
- ) : le(de.FmTextField, {
232
- modelValue: t.name,
233
- "onUpdate:modelValue": (u) => {
234
- f.updateItem({
235
- ...t,
236
- name: u
237
- });
238
- },
239
- key: t.sku._id,
240
- rules: [Te()],
241
- labelMark: "required"
242
- });
243
- },
244
- enableSorting: !1
245
- },
246
- {
247
- id: "DefaultAmount",
248
- header: () => I("inventory.transfer.form.items.table.DefaultAmount"),
249
- minSize: 200,
250
- cell(n) {
251
- var y, C;
252
- const t = n.row.original;
253
- if ((y = t.subItems) != null && y.length)
254
- return "";
255
- const a = g.skuById[t.sku._id], u = g.unitById[(C = a.unit) == null ? void 0 : C._id], h = u.measurements.find((w) => {
256
- var v;
257
- return ((v = t.measurement) == null ? void 0 : v.id) === w.id;
258
- }), T = t.sku.unit._id !== a.unit._id || !u || t.measurement && !h;
259
- return le(Xe, {
260
- style: {
261
- flex: "1 1 0%"
262
- },
263
- modelValue: {
264
- amount: t.quantity ?? { amount: 1, precision: 0 },
265
- // NOTE: leave this reading from row.sku.unit and row.measurement instead,
266
- measurement: t.measurement ?? (t.sku.unit._id !== a.unit._id ? { ...t.sku.unit, id: "", conversion: { amount: 1, precision: 0 } } : null)
267
- },
268
- disabled: f.disabled,
269
- key: t.sku._id,
270
- unit: u,
271
- "onUpdate:modelValue": (w) => {
272
- var c;
273
- let v = t.code;
274
- if (o.isEnabled) {
275
- const r = o.getItemPKTCode(a, (c = w.measurement) == null ? void 0 : c.id);
276
- r && (v = r);
277
- }
278
- f.updateItem({
279
- ...t,
280
- code: v,
281
- sku: a,
282
- quantity: w.amount,
283
- measurement: w.measurement
284
- });
285
- },
286
- rules: [
287
- Ye(t.quantityStep),
288
- ...+G(t.quantity) ? [
289
- et(
290
- +G(
291
- t.minimumQuantity ?? {
292
- amount: 1,
293
- // NOTE: leave this reading from row.sku.unit and row.measurement instead,
294
- precision: me(t.sku.unit, t.measurement)
295
- }
296
- )
297
- )
298
- ] : [],
299
- tt(
300
- t.maximumQuantity ? +G(t.maximumQuantity) : 1 / 0
301
- ),
302
- function(v) {
303
- return T ? "This item is no longer valid due to change in unit. Please reapply unit." : !0;
304
- }
305
- ],
306
- applyDefaultRules: !0
307
- });
308
- },
309
- enableSorting: !1
310
- },
311
- {
312
- id: "Limit",
313
- header: () => "Limit",
314
- // TODO: i18n,
315
- minSize: 280,
316
- cell(n) {
317
- var a;
318
- const t = n.row.original;
319
- return (a = t.subItems) != null && a.length ? "" : le(lt, {
320
- style: {
321
- flex: "1 1 0%"
322
- },
323
- modelValue: {
324
- min: t.minimumQuantity,
325
- max: t.maximumQuantity
326
- },
327
- disabled: f.disabled,
328
- key: t.sku._id,
329
- unit: t.sku.unit,
330
- "onUpdate:modelValue": (u) => {
331
- const h = { ...t };
332
- u != null && u.min ? h.minimumQuantity = u.min : h.minimumQuantity = null, u != null && u.max ? h.maximumQuantity = u.max : h.maximumQuantity = null, f.updateItem(h);
333
- },
334
- rules: [
335
- nt({ max: !1 }),
336
- at(t.quantityStep),
337
- st(
338
- +G({
339
- amount: 0,
340
- precision: me(t.sku.unit, t.measurement)
341
- }),
342
- 1 / 0
343
- )
344
- ],
345
- disableUnit: !0,
346
- applyDefaultRules: !0
347
- });
348
- }
349
- },
350
- {
351
- id: "Step",
352
- header: () => I("inventory.transfer.form.items.table.Step"),
353
- minSize: 100,
354
- cell(n) {
355
- var a;
356
- const t = n.row.original;
357
- return (a = t.subItems) != null && a.length ? "" : le(de.FmTextField, {
358
- modelValue: G(t.quantityStep ?? ke.reset(), !1),
359
- key: t.sku._id,
360
- "onUpdate:modelValue": (u) => {
361
- f.updateItem({
362
- ...t,
363
- quantityStep: ye(+u)
364
- });
365
- },
366
- rules: [
367
- xe({
368
- amount: 1,
369
- precision: me(t.sku.unit, t.measurement)
370
- }),
371
- Ge(t.sku.unit, t.measurement)
372
- ]
373
- });
374
- },
375
- enableSorting: !1
376
- },
377
- {
378
- id: "Delete",
379
- header: "",
380
- cell(n) {
381
- const t = n.row.original;
382
- return le("div", { class: "flex items-center" }, [
383
- le(
384
- de.FmTooltip,
385
- {
386
- zIndex: 50,
387
- placement: "left"
388
- },
389
- {
390
- default() {
391
- return le(de.FmButton, {
392
- key: t.sku._id,
393
- type: "button",
394
- icon: "add_circle",
395
- variant: "tertiary",
396
- size: "md",
397
- disabled: f.disabled,
398
- onClick: async () => {
399
- const a = t.subItems ?? [];
400
- a.push({
401
- id: crypto.randomUUID(),
402
- code: t.sku.code,
403
- name: t.sku.name,
404
- quantity: ye(1),
405
- quantityStep: ye(1),
406
- minimumQuantity: ye(1)
407
- }), f.updateItem({
408
- ...t,
409
- subItems: a.length ? a : null
410
- });
411
- }
412
- });
413
- },
414
- content() {
415
- return "Duplicate entry";
416
- }
417
- }
418
- ),
419
- le(de.FmButton, {
420
- class: "delete-button",
421
- key: t.sku._id,
422
- type: "button",
423
- icon: "delete",
424
- variant: "tertiary",
425
- size: "md",
426
- disabled: f.disabled,
427
- onClick: () => {
428
- f.deleteItem(t);
429
- }
430
- })
431
- ]);
432
- },
433
- enableSorting: !1,
434
- size: 40,
435
- meta: {
436
- cellClass: "",
437
- headerClass: ""
438
- }
439
- }
440
- ];
441
- return {
442
- columnDefs: z(() => ot().enableTotalCost && f.transferType === te.PURCHASE ? S : S.filter((t) => t.id !== "Cost"))
443
- };
444
- }
445
- const Ht = /* @__PURE__ */ ae({
446
- __name: "TransferTemplateSubItem",
447
- props: {
448
- modelValue: {},
449
- modelModifiers: {}
450
- },
451
- emits: ["update:modelValue"],
452
- setup(f) {
453
- return mt(f, "modelValue"), (I, g) => null;
454
- }
455
- }), Kt = { class: "flex flex-col gap-8 py-16" }, Gt = { class: "flex items-center" }, Wt = { class: "flex-1 flex gap-1 items-center" }, Zt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Jt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Xt = { class: "flex gap-8 w-full" }, Yt = { class: "flex-1 flex flex-col gap-4" }, eo = { class: "flex-1 flex flex-col gap-4" }, to = {
456
- key: 0,
457
- class: "flex gap-8 w-full"
458
- }, oo = { class: "flex-1 flex flex-col gap-4" }, lo = { class: "flex-1 flex flex-col gap-4" }, no = { class: "flex gap-8 w-full" }, so = { class: "flex-1 flex flex-col gap-4" }, ao = {
459
- key: 1,
460
- class: "flex flex-col gap-8 w-full"
461
- }, ro = /* @__PURE__ */ ae({
462
- __name: "TransferTemplateItem",
463
- props: {
464
- cellByColId: {},
465
- row: {}
466
- },
467
- emits: ["update:item"],
468
- setup(f, { emit: I }) {
469
- const { t: g } = ce(), o = f, b = I;
470
- function S(n) {
471
- return n;
472
- }
473
- function p(n) {
474
- const t = o.row.original, a = [...t.subItems ?? []], u = a.findIndex((h) => h.id === n.id);
475
- u > -1 ? a[u] = n : a.push(n), b("update:item", {
476
- ...t,
477
- subItems: a
478
- });
479
- }
480
- return (n, t) => {
481
- var u, h, T, y, C, w, v, c, r, k, i, _, P, V, A, Z, J, j, B, R, s, m, E, q, M, D, X, Y, ee, re, W, F, N;
482
- const a = O("FmLabel");
483
- return x(), $("div", Kt, [
484
- l("div", Gt, [
485
- l("div", Wt, [
486
- l("span", Zt, " (" + U(n.row.original.sku.code) + ") ", 1),
487
- l("span", Jt, U(n.row.original.sku.name), 1)
488
- ]),
489
- l("div", null, [
490
- d(e(oe), {
491
- render: (T = (h = (u = n.cellByColId.Delete) == null ? void 0 : u.column) == null ? void 0 : h.columnDef) == null ? void 0 : T.cell,
492
- props: (C = (y = n.cellByColId.Delete) == null ? void 0 : y.getContext) == null ? void 0 : C.call(y)
493
- }, null, 8, ["render", "props"])
494
- ])
495
- ]),
496
- (v = (w = n.row.original) == null ? void 0 : w.subItems) != null && v.length ? (x(), $("div", ao, [
497
- (x(!0), $(se, null, pe((N = n.row.original) == null ? void 0 : N.subItems, (ue) => (x(), K(Ht, {
498
- key: ue.id,
499
- "model-value": ue,
500
- "onUpdate:modelValue": t[0] || (t[0] = (ve) => p(ve))
501
- }, null, 8, ["model-value"]))), 128))
502
- ])) : (x(), $(se, { key: 0 }, [
503
- l("div", Xt, [
504
- l("div", Yt, [
505
- d(a, {
506
- label: e(g)(`inventory.transfer.form.items.table.${e(L).Code}`)
507
- }, null, 8, ["label"]),
508
- d(e(oe), {
509
- render: (k = (r = (c = n.cellByColId[e(L).Code]) == null ? void 0 : c.column) == null ? void 0 : r.columnDef) == null ? void 0 : k.cell,
510
- props: (_ = (i = n.cellByColId[e(L).Code]) == null ? void 0 : i.getContext) == null ? void 0 : _.call(i)
511
- }, null, 8, ["render", "props"]),
512
- t[1] || (t[1] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
513
- ]),
514
- l("div", eo, [
515
- d(a, {
516
- label: e(g)(`inventory.transfer.form.items.table.${e(L).Name}`)
517
- }, null, 8, ["label"]),
518
- d(e(oe), {
519
- render: (A = (V = (P = n.cellByColId[e(L).Name]) == null ? void 0 : P.column) == null ? void 0 : V.columnDef) == null ? void 0 : A.cell,
520
- props: (J = (Z = n.cellByColId[e(L).Name]) == null ? void 0 : Z.getContext) == null ? void 0 : J.call(Z)
521
- }, null, 8, ["render", "props"]),
522
- t[2] || (t[2] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
523
- ])
524
- ]),
525
- n.row.original ? (x(), $("div", to, [
526
- l("div", oo, [
527
- d(a, {
528
- label: e(g)(`inventory.transfer.form.items.table.${e(L).DefaultAmount}`)
529
- }, null, 8, ["label"]),
530
- d(e(oe), {
531
- render: (R = (B = (j = n.cellByColId[e(L).DefaultAmount]) == null ? void 0 : j.column) == null ? void 0 : B.columnDef) == null ? void 0 : R.cell,
532
- props: (m = (s = n.cellByColId[e(L).DefaultAmount]) == null ? void 0 : s.getContext) == null ? void 0 : m.call(s)
533
- }, null, 8, ["render", "props"]),
534
- t[3] || (t[3] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
535
- ]),
536
- l("div", lo, [
537
- d(a, {
538
- label: e(g)(`inventory.transfer.form.items.table.${e(L).Step}`)
539
- }, null, 8, ["label"]),
540
- d(e(oe), {
541
- render: (M = (q = (E = n.cellByColId[e(L).Step]) == null ? void 0 : E.column) == null ? void 0 : q.columnDef) == null ? void 0 : M.cell,
542
- props: (X = (D = n.cellByColId[e(L).Step]) == null ? void 0 : D.getContext) == null ? void 0 : X.call(D)
543
- }, null, 8, ["render", "props"]),
544
- t[4] || (t[4] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
545
- ])
546
- ])) : ne("", !0),
547
- l("div", no, [
548
- l("div", so, [
549
- d(a, {
550
- label: e(g)(`inventory.transfer.form.items.table.${e(L).Limit}`)
551
- }, null, 8, ["label"]),
552
- d(e(oe), {
553
- render: (re = (ee = (Y = n.cellByColId[e(L).Limit]) == null ? void 0 : Y.column) == null ? void 0 : ee.columnDef) == null ? void 0 : re.cell,
554
- props: (F = (W = n.cellByColId[e(L).Limit]) == null ? void 0 : W.getContext) == null ? void 0 : F.call(W)
555
- }, null, 8, ["render", "props"]),
556
- t[5] || (t[5] = l("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
557
- ])
558
- ])
559
- ], 64))
560
- ]);
561
- };
562
- }
563
- }), io = { class: "hover:bg-fm-color-opacity-sm" }, uo = { class: "flex items-center" }, mo = {
564
- key: 0,
565
- class: "flex h-full w-16"
566
- }, po = {
567
- key: 1,
568
- class: "flex-1"
569
- }, co = {
570
- key: 2,
571
- class: "flex-1"
572
- }, fo = {
573
- key: 6,
574
- class: "flex w-full justify-end"
575
- }, yo = /* @__PURE__ */ ae({
576
- __name: "TransferTemplateSubItemTable",
577
- props: {
578
- row: {},
579
- modelValue: {},
580
- disabled: { type: Boolean }
581
- },
582
- emits: ["delete:model-value"],
583
- setup(f, { emit: I }) {
584
- const g = f, o = Ce(), b = I, S = z({
585
- get() {
586
- return {
587
- min: g.modelValue.minimumQuantity,
588
- max: g.modelValue.maximumQuantity
589
- };
590
- },
591
- set(p) {
592
- const n = { ...g.modelValue };
593
- p != null && p.min ? n.minimumQuantity = p.min : n.minimumQuantity = null, p != null && p.max ? n.maximumQuantity = p.max : n.maximumQuantity = null, o.minimumQuantity = n.minimumQuantity, o.maximumQuantity = n.maximumQuantity;
594
- }
595
- });
596
- return (p, n) => {
597
- const t = O("FmIcon"), a = O("FmTextField"), u = O("FmButton");
598
- return x(), $("tr", io, [
599
- (x(!0), $(se, null, pe(p.row.getVisibleCells(), (h, T) => (x(), $("td", {
600
- key: h.id,
601
- class: ie([T === 0 ? "pr-16" : h.column.id === e(L).Delete ? "" : "px-16"])
602
- }, [
603
- l("div", uo, [
604
- T === 0 ? (x(), $("div", mo, [
605
- d(t, {
606
- name: "subdirectory_arrow_right",
607
- size: "sm"
608
- })
609
- ])) : ne("", !0),
610
- h.column.id === e(L).Code ? (x(), $("div", po, [
611
- d(a, {
612
- modelValue: e(o).code,
613
- "onUpdate:modelValue": n[0] || (n[0] = (y) => e(o).code = y)
614
- }, null, 8, ["modelValue"])
615
- ])) : h.column.id === e(L).Name ? (x(), $("div", co, [
616
- d(a, {
617
- modelValue: e(o).name,
618
- "onUpdate:modelValue": n[1] || (n[1] = (y) => e(o).name = y)
619
- }, null, 8, ["modelValue"])
620
- ])) : h.column.id === e(L).DefaultAmount ? (x(), K(Xe, {
621
- key: 3,
622
- "model-value": { amount: e(o).quantity, measurement: e(o).measurement },
623
- "onUpdate:modelValue": n[2] || (n[2] = (y) => (e(o).quantity = y.amount, e(o).measurement = y.measurement ?? null)),
624
- unit: p.row.original.sku.unit,
625
- rules: [
626
- e(Ye)(e(o).quantityStep),
627
- ...+e(G)(e(o).quantity) ? [
628
- e(et)(
629
- +e(G)(
630
- e(o).minimumQuantity ?? {
631
- amount: 1,
632
- precision: e(me)(p.row.original.sku.unit, e(o).measurement)
633
- }
634
- )
635
- )
636
- ] : [],
637
- e(tt)(
638
- e(o).maximumQuantity ? +e(G)(e(o).maximumQuantity) : 1 / 0
639
- )
640
- ],
641
- disabled: p.disabled
642
- }, null, 8, ["model-value", "unit", "rules", "disabled"])) : h.column.id === e(L).Limit ? (x(), K(lt, {
643
- key: 4,
644
- modelValue: S.value,
645
- "onUpdate:modelValue": n[3] || (n[3] = (y) => S.value = y),
646
- rules: [
647
- e(nt)({ max: !1 }),
648
- e(at)(p.modelValue.quantityStep),
649
- e(st)(
650
- +e(G)({
651
- amount: 0,
652
- precision: e(me)(p.row.original.sku.unit, p.row.original.measurement)
653
- }),
654
- 1 / 0
655
- )
656
- ],
657
- disabled: p.disabled
658
- }, null, 8, ["modelValue", "rules", "disabled"])) : h.column.id === e(L).Step ? (x(), K(a, {
659
- key: 5,
660
- "model-value": e(G)(e(o).quantityStep ?? e(ke).reset(), !1),
661
- "onUpdate:modelValue": n[4] || (n[4] = (y) => e(o).quantityStep = e(ye)(+y)),
662
- rules: [
663
- e(xe)({
664
- amount: 1,
665
- precision: e(me)(p.row.original.sku.unit, e(o).measurement)
666
- }),
667
- e(Ge)(p.row.original.sku.unit, e(o).measurement)
668
- ]
669
- }, null, 8, ["model-value", "rules"])) : h.column.id === e(L).Delete ? (x(), $("div", fo, [
670
- d(u, {
671
- key: "row.sku._id",
672
- type: "button",
673
- icon: "delete",
674
- variant: "tertiary",
675
- size: "md",
676
- onClick: n[5] || (n[5] = (y) => b("delete:model-value", p.modelValue))
677
- })
678
- ])) : ne("", !0)
679
- ])
680
- ], 2))), 128))
681
- ]);
682
- };
683
- }
684
- }), vo = { class: "hover:bg-fm-color-opacity-sm" }, bo = { class: "fm-typo-en-body-md-400 line-clamp-2 w-full" }, go = /* @__PURE__ */ ae({
685
- __name: "TransferTemplateItemTable",
686
- props: {
687
- row: {},
688
- disabled: { type: Boolean }
689
- },
690
- emits: ["update:item"],
691
- setup(f, { emit: I }) {
692
- const g = f, o = I;
693
- function b(t) {
694
- return t.column.columnDef.meta;
695
- }
696
- function S(t) {
697
- return t;
698
- }
699
- function p(t) {
700
- const a = g.row.original, u = [...a.subItems ?? []], h = u.findIndex((T) => T.id === t.id);
701
- h > -1 && (u[h] = t), o("update:item", {
702
- ...a,
703
- subItems: u
704
- });
705
- }
706
- function n(t) {
707
- const a = g.row.original, h = [...a.subItems ?? []].filter((T) => T.id !== t.id);
708
- o("update:item", {
709
- ...a,
710
- subItems: h.length ? h : null
711
- });
712
- }
713
- return (t, a) => {
714
- var u, h, T;
715
- return x(), $(se, null, [
716
- l("tr", vo, [
717
- (x(!0), $(se, null, pe(t.row.getVisibleCells(), (y) => {
718
- var C, w, v, c, r, k;
719
- return x(), $("td", {
720
- key: y.id,
721
- class: ie([
722
- "text-fm-color-typo-primary",
723
- (C = t.row.original.subItems) != null && C.length ? "" : "h-[60px]",
724
- ((w = b(y)) == null ? void 0 : w.cellClass) ?? "px-16"
725
- ]),
726
- style: ze({
727
- width: (v = b(y)) != null && v.width ? (c = b(y)) == null ? void 0 : c.width : y.column.getSize() !== 0 ? `${y.column.getSize()}px` : void 0,
728
- maxWidth: (r = b(y)) == null ? void 0 : r.maxWidth,
729
- textAlign: ((k = b(y)) == null ? void 0 : k.textAlign) ?? "left"
730
- })
731
- }, [
732
- l("span", bo, [
733
- d(e(oe), {
734
- props: y.getContext(),
735
- render: y.column.columnDef.cell
736
- }, null, 8, ["props", "render"])
737
- ])
738
- ], 6);
739
- }), 128))
740
- ]),
741
- (h = (u = t.row.original) == null ? void 0 : u.subItems) != null && h.length ? (x(!0), $(se, { key: 0 }, pe((T = t.row.original) == null ? void 0 : T.subItems, (y) => (x(), K(yo, {
742
- row: t.row,
743
- key: y.id,
744
- "model-value": y,
745
- "onUpdate:modelValue": p,
746
- "onDelete:modelValue": n,
747
- disabled: t.disabled
748
- }, null, 8, ["row", "model-value", "disabled"]))), 128)) : ne("", !0)
749
- ], 64);
750
- };
751
- }
752
- }), ho = { class: "flex flex-col gap-16" }, xo = { class: "flex flex-col gap-24" }, _o = { class: "flex flex-col gap-16" }, wo = { class: "flex items-center" }, ko = { class: "flex flex-col" }, To = { class: "flex flex-col gap-4" }, Io = {
753
- key: 0,
754
- class: "text-fm-color-typo-error fm-typo-en-body-sm-400"
755
- }, Fo = {
756
- key: 1,
757
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
758
- }, Co = { class: "flex flex-wrap gap-8 fm-typo-en-body-sm-600 text-fm-color-typo-primary" }, So = { class: "flex flex-col gap-16" }, Vo = { class: "flex" }, $o = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, Mo = /* @__PURE__ */ ae({
759
- __name: "TransferTemplateForm",
760
- props: {
761
- modelValue: {},
762
- disabled: { type: Boolean }
763
- },
764
- setup(f, { expose: I }) {
765
- const g = f, o = Ce(), { t: b } = ce(), S = We(), p = He(), n = Ut(), t = Ke();
766
- _e(
767
- () => g.modelValue,
768
- (s) => {
769
- console.log("TransferTemplateForm.model", s);
770
- }
771
- ), S.watchLocation(async () => {
772
- location && (o.purchaseOrder.supplier || (o.purchaseOrder.supplier = n.suppliers.find((s) => s) ?? o.purchaseOrder.supplier));
773
- });
774
- const a = Rt(
775
- () => o.purchaseOrder,
776
- (s) => {
777
- o.purchaseOrder = {
778
- ...o.purchaseOrder,
779
- supplier: s.supplier ?? (o == null ? void 0 : o.purchaseOrder.supplier)
780
- };
781
- }
782
- ), u = z({
783
- get() {
784
- var s, m;
785
- return typeof ((m = (s = o.purchaseOrder) == null ? void 0 : s.supplier) == null ? void 0 : m.internal) == "string" ? te.TRANSFER : te.PURCHASE;
786
- },
787
- set(s) {
788
- var E, q;
789
- const m = typeof ((q = (E = o.purchaseOrder) == null ? void 0 : E.supplier) == null ? void 0 : q.internal) == "string" ? te.TRANSFER : te.PURCHASE;
790
- s !== m && (o.purchaseOrder.supplier = s === te.PURCHASE ? a.locationOptionsTypePurchase.value[0] : a.locationOptionsTypeTransfer.value[0]);
791
- }
792
- }), h = z(() => a.transferLocationOptions.value), T = z({
793
- get() {
794
- var s;
795
- return (s = o.purchaseOrder.supplier) == null ? void 0 : s._id;
796
- },
797
- set(s) {
798
- a.transferLocationModel.value = s;
799
- }
800
- }), {
801
- promptSelectLocations: y,
802
- columnDefs: C,
803
- rowData: w,
804
- hasCustomTag: v,
805
- locationTagModel: c,
806
- locationTagAutocomplete: r,
807
- pushLocationTag: k,
808
- removeLocationTag: i,
809
- locationTagError: _
810
- } = ht({
811
- getLocations() {
812
- return o.locations;
813
- },
814
- setLocations(s) {
815
- o.locations = s;
816
- },
817
- getLocationTags() {
818
- return o.locationTags;
819
- },
820
- setLocationTags(s) {
821
- o.locationTags = s;
822
- }
823
- });
824
- function P() {
825
- var s, m;
826
- return (s = o.locations) != null && s.find((E) => {
827
- var q, M;
828
- return ((q = E.doc) == null ? void 0 : q._id) === ((M = o.purchaseOrder.supplier) == null ? void 0 : M._id);
829
- }) ? `Location ${(m = o.purchaseOrder.supplier) == null ? void 0 : m.name} must be removed because template cannot be used to transfer to itself.` : !0;
830
- }
831
- const V = z({
832
- get() {
833
- return o.purchaseOrder.remark ?? void 0;
834
- },
835
- set(s) {
836
- o.purchaseOrder.remark = s;
837
- }
838
- }), A = H();
839
- I({
840
- validateInputs: () => {
841
- var s, m;
842
- (m = (s = A.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
843
- },
844
- resetInputsValidation: () => {
845
- var s, m;
846
- (m = (s = A.value) == null ? void 0 : s.resetInputsValidation) == null || m.call(s);
847
- },
848
- resetInputs: () => {
849
- var s, m;
850
- (m = (s = A.value) == null ? void 0 : s.resetInputs) == null || m.call(s);
851
- }
852
- });
853
- const Z = z(() => ({
854
- updateItem: (s) => {
855
- o.purchaseOrder.items = o.purchaseOrder.items.map((m) => m.sku._id !== s.sku._id ? m : s);
856
- },
857
- deleteItem: (s) => {
858
- o.purchaseOrder.items = o.purchaseOrder.items.filter(
859
- (m) => m.sku._id !== s.sku._id
860
- );
861
- }
862
- })), J = jt({
863
- updateItem: Z.value.updateItem,
864
- deleteItem: Z.value.deleteItem,
865
- get supplier() {
866
- return o.purchaseOrder.supplier;
867
- },
868
- get items() {
869
- return o.purchaseOrder.items;
870
- },
871
- get transferType() {
872
- return te.PURCHASE;
873
- },
874
- get disabled() {
875
- return g.disabled;
876
- }
877
- }), j = z(() => J.columnDefs.value), { promptSelectIngredients: B } = Lt();
878
- async function R() {
879
- const m = p.skus.map((M) => ({
880
- label: M.name,
881
- sublabel: M.code,
882
- value: M
883
- })).filter((M) => {
884
- var D;
885
- return (D = o.purchaseOrder.items) == null ? void 0 : D.find((X) => X.sku._id === M.value._id);
886
- }).map((M) => M.value), E = o.purchaseOrder.items ?? [], q = await B(
887
- m.map((M) => M._id),
888
- (M) => {
889
- const D = p.skuById[M], X = E.find((W) => W.sku._id === D._id);
890
- if (X)
891
- return X;
892
- let Y = D.code;
893
- if (t.isEnabled) {
894
- const W = t.getItemPKTCode(D);
895
- W && (Y = W);
896
- }
897
- const ee = { amount: 1, precision: me(D.unit) };
898
- return {
899
- sku: D,
900
- code: Y,
901
- name: D.name,
902
- quantity: ee,
903
- minimumQuantity: ee,
904
- maximumQuantity: wt(ee, {
905
- amount: 100,
906
- precision: 0
907
- }),
908
- quantityStep: ee
909
- };
910
- }
911
- );
912
- q && (q.sort((M, D) => M.sku.code.localeCompare(D.sku.code)), o.purchaseOrder.items = q);
913
- }
914
- return (s, m) => {
915
- const E = O("FmTextField"), q = O("FmSelect"), M = O("FmTextarea"), D = O("FmButton"), X = O("FmTable"), Y = O("FmFormGroup"), ee = O("FmChip"), re = O("FmForm");
916
- return x(), K(re, {
917
- ref_key: "formRef",
918
- ref: A,
919
- class: "flex flex-col gap-32",
920
- disabled: s.disabled
921
- }, {
922
- default: Q(() => {
923
- var W;
924
- return [
925
- l("div", ho, [
926
- l("div", xo, [
927
- d(E, {
928
- label: e(b)("inventory.transfer.form.name"),
929
- "label-mark": "required",
930
- modelValue: e(o).name,
931
- "onUpdate:modelValue": m[0] || (m[0] = (F) => e(o).name = F),
932
- rules: [e(Te)()]
933
- }, null, 8, ["label", "modelValue", "rules"]),
934
- d(q, {
935
- label: e(b)("inventory.transfer.form.type.title"),
936
- "model-value": u.value,
937
- "onUpdate:modelValue": m[1] || (m[1] = (F) => u.value = F),
938
- items: [
939
- {
940
- label: e(b)("inventory.transfer.form.type.purchase"),
941
- value: e(te).PURCHASE,
942
- disabled: !e(a).locationOptionsTypePurchase.value.length,
943
- sublabel: e(a).locationOptionsTypePurchase.value.length ? void 0 : e(b)("inventory.transfer.form.noSupplierAvailable")
944
- },
945
- {
946
- label: e(b)("inventory.transfer.form.type.transfer"),
947
- value: e(te).TRANSFER,
948
- disabled: !e(a).locationOptionsTypeTransfer.value.length,
949
- sublabel: e(a).locationOptionsTypeTransfer.value.length ? void 0 : e(b)("inventory.transfer.form.noLocationAvailable")
950
- }
951
- ],
952
- rules: [e(xe)(1)(h.value)]
953
- }, {
954
- default: Q(() => [
955
- l("span", {
956
- class: ie([
957
- "line-clamp-1 fm-typo-en-body-lg-400",
958
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
959
- ])
960
- }, U(e(xt)(u.value)), 3)
961
- ]),
962
- _: 1
963
- }, 8, ["label", "model-value", "items", "rules"]),
964
- d(q, {
965
- label: u.value === e(te).PURCHASE ? e(b)("inventory.transfer.form.purchaseFrom") : e(b)("inventory.transfer.form.transferFrom"),
966
- modelValue: T.value,
967
- "onUpdate:modelValue": m[2] || (m[2] = (F) => T.value = F),
968
- items: h.value
969
- }, {
970
- "menu-wrapper": Q((F) => {
971
- var N;
972
- return [
973
- d(Pt, je(F, {
974
- items: h.value,
975
- "model-value": (N = s.modelValue.purchaseOrder.supplier) == null ? void 0 : N._id
976
- }), null, 16, ["items", "model-value"])
977
- ];
978
- }),
979
- default: Q(() => {
980
- var F;
981
- return [
982
- l("span", {
983
- class: ie([
984
- "line-clamp-1 fm-typo-en-body-lg-400",
985
- s.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary"
986
- ])
987
- }, U((F = h.value.find((N) => N.value === T.value)) == null ? void 0 : F.label), 3)
988
- ];
989
- }),
990
- _: 1
991
- }, 8, ["label", "modelValue", "items"]),
992
- d(E, {
993
- label: e(b)("inventory.transfer.form.reference"),
994
- "label-mark": "optional",
995
- modelValue: e(o).purchaseOrder.ref,
996
- "onUpdate:modelValue": m[3] || (m[3] = (F) => e(o).purchaseOrder.ref = F)
997
- }, null, 8, ["label", "modelValue"]),
998
- d(M, {
999
- label: e(b)("inventory.transfer.form.remark"),
1000
- "label-mark": "optional",
1001
- "max-length": 240,
1002
- modelValue: V.value,
1003
- "onUpdate:modelValue": m[4] || (m[4] = (F) => V.value = F),
1004
- class: ie({ "text-fm-color-typo-disabled": s.disabled })
1005
- }, null, 8, ["label", "modelValue", "class"])
1006
- ])
1007
- ]),
1008
- l("div", _o, [
1009
- l("div", wo, [
1010
- m[9] || (m[9] = l("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
1011
- d(D, {
1012
- disabled: s.disabled,
1013
- label: "Select location",
1014
- "prepend-icon": "add",
1015
- variant: "plain",
1016
- class: "border-2 rounded-lg border-fm-color-primary",
1017
- onClick: e(y)
1018
- }, null, 8, ["disabled", "onClick"])
1019
- ]),
1020
- d(X, {
1021
- "column-defs": e(C),
1022
- "row-data": e(w),
1023
- "shrink-at": 9999,
1024
- onRowClick: e(y),
1025
- "hide-footer": ""
1026
- }, null, 8, ["column-defs", "row-data", "onRowClick"]),
1027
- l("div", ko, [
1028
- d(Y, {
1029
- "model-value": [
1030
- (W = g.modelValue.purchaseOrder.supplier) == null ? void 0 : W._id,
1031
- ...g.modelValue.locations ?? []
1032
- ].join(","),
1033
- rules: [P]
1034
- }, null, 8, ["model-value", "rules"])
1035
- ]),
1036
- e(v) ? (x(), K(_t, {
1037
- key: 0,
1038
- label: "Location tag",
1039
- modelValue: e(c),
1040
- "onUpdate:modelValue": m[5] || (m[5] = (F) => Fe(c) ? c.value = F : null),
1041
- "onClick:menuItem": e(k),
1042
- options: e(r),
1043
- placeholder: "Search location tag"
1044
- }, dt({
1045
- "helper-text": Q(() => [
1046
- l("div", To, [
1047
- e(_) ? (x(), $("div", Io, U(e(_)), 1)) : (x(), $("div", Fo, " This will match all locations under these values. Tag is configured in the restaurant/warehouse settings. ")),
1048
- l("div", Co, [
1049
- (x(!0), $(se, null, pe(s.modelValue.locationTags, (F, N) => (x(), K(ee, {
1050
- key: N,
1051
- label: F,
1052
- removable: "",
1053
- onChipClosed: () => e(i)(F)
1054
- }, null, 8, ["label", "onChipClosed"]))), 128))
1055
- ])
1056
- ])
1057
- ]),
1058
- _: 2
1059
- }, [
1060
- e(c) ? {
1061
- name: "append",
1062
- fn: Q(() => [
1063
- l("div", null, [
1064
- d(D, {
1065
- variant: "tertiary",
1066
- label: "Add",
1067
- icon: "add",
1068
- onClick: e(k)
1069
- }, null, 8, ["onClick"])
1070
- ])
1071
- ]),
1072
- key: "0"
1073
- } : void 0
1074
- ]), 1032, ["modelValue", "onClick:menuItem", "options"])) : ne("", !0)
1075
- ]),
1076
- l("div", So, [
1077
- l("div", Vo, [
1078
- l("div", $o, U(e(b)("inventory.transfer.form.items.title")), 1),
1079
- d(D, {
1080
- disabled: s.disabled,
1081
- label: e(b)("inventory.transfer.form.items.addItem"),
1082
- "prepend-icon": "add",
1083
- variant: "plain",
1084
- class: "border-2 rounded-lg border-fm-color-primary",
1085
- onClick: m[6] || (m[6] = (F) => R()),
1086
- size: "md"
1087
- }, null, 8, ["disabled", "label"])
1088
- ]),
1089
- (x(), K(X, {
1090
- "column-defs": j.value,
1091
- "row-data": e(o).purchaseOrder.items,
1092
- key: e(o).purchaseOrder.items.map((F) => F.sku._id).join("."),
1093
- "hide-footer": "",
1094
- "page-size": e(o).purchaseOrder.items.length
1095
- }, {
1096
- "table-row": Q((F) => [
1097
- d(go, {
1098
- row: F,
1099
- "onUpdate:item": m[7] || (m[7] = (N) => Z.value.updateItem(N)),
1100
- disabled: s.disabled
1101
- }, null, 8, ["row", "disabled"])
1102
- ]),
1103
- "list-row": Q((F) => [
1104
- (x(), K(Ze, {
1105
- row: F,
1106
- key: e(o).purchaseOrder.items.map((N) => N.sku._id).join(".")
1107
- }, {
1108
- default: Q((N) => [
1109
- d(ro, {
1110
- row: F,
1111
- "cell-by-col-id": N,
1112
- "onUpdate:item": m[8] || (m[8] = (ue) => Z.value.updateItem(ue)),
1113
- disabled: s.disabled
1114
- }, null, 8, ["row", "cell-by-col-id", "disabled"])
1115
- ]),
1116
- _: 2
1117
- }, 1032, ["row"]))
1118
- ]),
1119
- _: 1
1120
- }, 8, ["column-defs", "row-data", "page-size"])),
1121
- d(Y, {
1122
- "model-value": e(o).purchaseOrder.items.length,
1123
- rules: [e(xe)(1)]
1124
- }, null, 8, ["model-value", "rules"])
1125
- ])
1126
- ];
1127
- }),
1128
- _: 1
1129
- }, 8, ["disabled"]);
1130
- };
1131
- }
1132
- }), Do = { class: "flex items-center" }, Oo = { class: "fm-typo-en-title-md-800" }, Ao = { class: "flex gap-4" }, Ro = /* @__PURE__ */ ae({
1133
- __name: "TransferTemplateDialog",
1134
- props: {
1135
- mode: {},
1136
- modelValue: {},
1137
- show: { type: Boolean }
1138
- },
1139
- emits: ["update:show", "submitted"],
1140
- setup(f, { expose: I, emit: g }) {
1141
- var k;
1142
- const o = f, b = g, S = St(), p = Dt(), { t: n } = ce(), t = Je(o, "show");
1143
- function a() {
1144
- return {
1145
- _id: "",
1146
- name: "",
1147
- purchaseOrder: {
1148
- remark: void 0,
1149
- ref: void 0,
1150
- items: [],
1151
- supplier: {
1152
- _rev: void 0,
1153
- email: void 0,
1154
- internal: void 0,
1155
- contactName: void 0,
1156
- phoneNumber: void 0,
1157
- registrationNumber: void 0,
1158
- supplyItems: void 0,
1159
- _id: "",
1160
- name: "",
1161
- address: {
1162
- line2: void 0,
1163
- line1: "",
1164
- state: "",
1165
- city: "",
1166
- postcode: "",
1167
- country: ""
1168
- }
1169
- }
1170
- }
1171
- };
1172
- }
1173
- const u = H(o.modelValue ?? a()), h = H(((k = o.modelValue) == null ? void 0 : k._id) ?? `${Math.random()}`);
1174
- _e(
1175
- () => o.show,
1176
- (i) => {
1177
- var _;
1178
- i && (u.value = o.modelValue ?? a(), h.value = ((_ = o.modelValue) == null ? void 0 : _._id) ?? `${Math.random()}`);
1179
- }
1180
- );
1181
- const T = H(!1), y = z(() => {
1182
- switch (o.mode) {
1183
- case fe.READ:
1184
- return "";
1185
- case fe.CREATE:
1186
- return n("inventory.transfer.template.create.title");
1187
- case fe.UPDATE:
1188
- return n("inventory.transfer.template.update.title");
1189
- }
1190
- return "";
1191
- }), C = H();
1192
- I({
1193
- validateInputs: () => {
1194
- var i, _;
1195
- (_ = (i = C.value) == null ? void 0 : i.validateInputs) == null || _.call(i);
1196
- },
1197
- resetInputsValidation: () => {
1198
- var i, _;
1199
- (_ = (i = C.value) == null ? void 0 : i.resetInputsValidation) == null || _.call(i);
1200
- },
1201
- resetInputs: () => {
1202
- var i, _;
1203
- (_ = (i = C.value) == null ? void 0 : i.resetInputs) == null || _.call(i);
1204
- }
1205
- });
1206
- async function w() {
1207
- var _, P;
1208
- const i = u.value;
1209
- if (i) {
1210
- T.value = !0, (((_ = i.purchaseOrder.supplier) == null ? void 0 : _.internal) === he.enum.warehouse || ((P = i.purchaseOrder.supplier) == null ? void 0 : P.internal) === he.enum.restaurant) && (i.purchaseOrder.items = i.purchaseOrder.items.map(
1211
- ({ totalCost: V, ...A }) => A
1212
- ));
1213
- try {
1214
- await S.createTemplate(i), await new Promise((V) => setTimeout(V, 1e3)), p.open({
1215
- title: n("inventory.transfer.template.create.success"),
1216
- message: n("inventory.transfer.template.create.successMessage"),
1217
- type: "success"
1218
- }), b("update:show", !1), b("submitted");
1219
- } catch (V) {
1220
- p.open({
1221
- title: n("inventory.transfer.template.create.error"),
1222
- message: n("inventory.transfer.template.create.errorMessage"),
1223
- type: "error"
1224
- }), console.error("Error in creating transfer template", V);
1225
- } finally {
1226
- T.value = !1;
1227
- }
1228
- }
1229
- }
1230
- async function v() {
1231
- var _, P;
1232
- const i = u.value;
1233
- if (i) {
1234
- T.value = !0, (((_ = i.purchaseOrder.supplier) == null ? void 0 : _.internal) === he.enum.warehouse || ((P = i.purchaseOrder.supplier) == null ? void 0 : P.internal) === he.enum.restaurant) && (i.purchaseOrder.items = i.purchaseOrder.items.map(
1235
- ({ totalCost: V, ...A }) => A
1236
- ));
1237
- try {
1238
- await S.updateTemplate(i), await new Promise((V) => setTimeout(V, 1e3)), p.open({
1239
- title: n("inventory.transfer.template.update.success"),
1240
- message: n("inventory.transfer.template.update.successMessage"),
1241
- type: "success"
1242
- }), b("update:show", !1), b("submitted");
1243
- } catch (V) {
1244
- p.open({
1245
- title: n("inventory.transfer.template.update.error"),
1246
- message: n("inventory.transfer.template.update.errorMessage"),
1247
- type: "error"
1248
- }), console.error("Error in updating transfer template", V);
1249
- } finally {
1250
- T.value = !1;
1251
- }
1252
- }
1253
- }
1254
- function c() {
1255
- switch (o.mode) {
1256
- case fe.CREATE:
1257
- return w();
1258
- case fe.UPDATE:
1259
- return v();
1260
- }
1261
- }
1262
- function r() {
1263
- var i, _;
1264
- (_ = (i = C.value) == null ? void 0 : i.validateInputs) == null || _.call(i);
1265
- }
1266
- return (i, _) => {
1267
- const P = O("FmButton"), V = O("FmSideSheet");
1268
- return x(), K(V, {
1269
- modelValue: e(t),
1270
- "onUpdate:modelValue": _[2] || (_[2] = (A) => Fe(t) ? t.value = A : null),
1271
- "dismiss-away": "",
1272
- "close-button": "",
1273
- "max-width": 1200
1274
- }, {
1275
- "side-sheet-header": Q(() => [
1276
- l("div", Do, [
1277
- l("div", Oo, U(y.value), 1)
1278
- ])
1279
- ]),
1280
- default: Q(() => [
1281
- (x(), K(Mo, {
1282
- class: "w-full",
1283
- ref_key: "formRef",
1284
- ref: C,
1285
- onValidationSuccess: c,
1286
- "model-value": u.value,
1287
- "onUpdate:modelValue": _[0] || (_[0] = (A) => u.value = A),
1288
- disabled: T.value,
1289
- key: h.value
1290
- }, null, 8, ["model-value", "disabled"]))
1291
- ]),
1292
- "side-sheet-footer": Q(() => [
1293
- l("div", Ao, [
1294
- d(P, {
1295
- loading: T.value,
1296
- label: e(n)("common.save"),
1297
- onClick: r
1298
- }, null, 8, ["loading", "label"]),
1299
- d(P, {
1300
- disabled: T.value,
1301
- variant: "tertiary",
1302
- label: e(n)("common.close"),
1303
- onClick: _[1] || (_[1] = (A) => b("update:show", !1))
1304
- }, null, 8, ["disabled", "label"])
1305
- ])
1306
- ]),
1307
- _: 1
1308
- }, 8, ["modelValue"]);
1309
- };
1310
- }
1311
- }), Po = { class: "flex flex-col gap-16 w-full h-full overflow-y-auto" }, Uo = { class: "flex justify-between" }, Lo = { class: "fm-typo-en-body-lg-600" }, qo = { class: "fm-status-badge fm-status-badge-info-secondary" }, Bo = { class: "flex flex-col gap-8" }, Eo = { class: "flex flex-col gap-4" }, No = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Qo = { class: "flex gap-1" }, zo = { class: "fm-typo-en-body-lg-600" }, jo = {
1312
- key: 0,
1313
- class: "flex flex-col gap-4"
1314
- }, Ho = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ko = { class: "fm-typo-en-body-lg-600" }, Go = {
1315
- key: 1,
1316
- class: "flex flex-col gap-4"
1317
- }, Wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Zo = { class: "fm-typo-en-body-lg-600" }, Jo = {
1318
- key: 2,
1319
- class: "flex flex-col gap-4"
1320
- }, Xo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yo = { class: "fm-typo-en-body-lg-600" }, el = { class: "border border-fm-color-neutral-gray-200 fm-corner-radius-lg p-16" }, tl = { class: "flex flex-col gap-8" }, ol = { class: "fm-typo-en-body-lg-600" }, ll = { class: "w-full" }, nl = { class: "flex flex-col py-8" }, sl = { class: "flex w-full gap-4" }, al = { class: "grow fm-typo-en-body-lg-400 line-clamp-2" }, rl = { class: "fm-typo-en-body-lg-600 shrink-0" }, il = { class: "flex w-full gap-4 fm-typo-en-body-sm-400" }, ul = { class: "grow fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, ml = {
1321
- key: 0,
1322
- class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1323
- }, dl = {
1324
- key: 0,
1325
- class: "flex gap-4 items-center"
1326
- }, pl = { class: "flex flex-col gap-12" }, cl = { class: "flex flex-row flex-wrap gap-8" }, fl = { class: "flex flex-col gap-8" }, yl = { class: "flex gap-8 xs:flex-col" }, vl = /* @__PURE__ */ ae({
1327
- __name: "TransferTemplateDetails",
1328
- props: {
1329
- template: {},
1330
- show: { type: Boolean }
1331
- },
1332
- emits: ["update:show", "action:edit"],
1333
- setup(f, { emit: I }) {
1334
- const g = f, o = I, b = ot(), { t: S } = ce(), p = z(() => {
1335
- var w;
1336
- return (w = g.template) == null ? void 0 : w.purchaseOrder;
1337
- }), n = H(""), t = [
1338
- { accessorKey: "name", header: () => "Name" },
1339
- { accessorKey: "type", header: () => "Type" }
1340
- ], a = H(""), u = z(
1341
- () => {
1342
- var w, v, c, r;
1343
- return ((v = (w = p.value) == null ? void 0 : w.supplier) == null ? void 0 : v.internal) === "restaurant" || ((r = (c = p.value) == null ? void 0 : c.supplier) == null ? void 0 : r.internal) === "warehouse" ? te.TRANSFER : te.PURCHASE;
1344
- }
1345
- ), h = H(!0), T = Je(g, "show"), y = H(!1);
1346
- _e(
1347
- () => g.show,
1348
- (w) => {
1349
- w && (y.value = !0, setTimeout(() => y.value = !1, 300));
1350
- }
1351
- );
1352
- function C(w) {
1353
- return w.original;
1354
- }
1355
- return (w, v) => {
1356
- var Z;
1357
- const c = O("FmMenuDivider"), r = O("FmCard"), k = O("FmTextField"), i = O("FmIcon"), _ = O("FmTable"), P = O("FmChip"), V = O("FmButton"), A = O("FmSideSheet");
1358
- return x(), K(A, {
1359
- header: e(S)("inventory.transfer.template.details.view", { template: (Z = w.template) == null ? void 0 : Z.name }),
1360
- modelValue: e(T),
1361
- "onUpdate:modelValue": v[3] || (v[3] = (J) => Fe(T) ? T.value = J : null),
1362
- "dismiss-away": h.value,
1363
- "close-button": "",
1364
- "max-width": 600
1365
- }, {
1366
- default: Q(() => {
1367
- var J, j, B;
1368
- return [
1369
- l("div", Po, [
1370
- l("div", null, [
1371
- d(r, {
1372
- variant: "outlined",
1373
- class: "flex flex-col gap-8 px-12 py-16"
1374
- }, {
1375
- default: Q(() => {
1376
- var R, s, m, E, q, M, D;
1377
- return [
1378
- l("div", Uo, [
1379
- l("div", Lo, U(e(S)("inventory.transfer.template.details.templateSummary")), 1),
1380
- l("div", qo, U(e(S)(
1381
- `inventory.transfer.receiveRequest.details.type.${u.value.toLocaleLowerCase("en-US")}`
1382
- )), 1)
1383
- ]),
1384
- d(c),
1385
- l("div", Bo, [
1386
- l("div", Eo, [
1387
- l("div", No, [
1388
- l("div", Qo, U(e(S)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1389
- ]),
1390
- l("div", zo, U(e(kt)(((R = w.template) == null ? void 0 : R._id) ?? "")), 1)
1391
- ]),
1392
- (m = (s = p.value) == null ? void 0 : s.supplier) != null && m.name ? (x(), $("div", jo, [
1393
- l("div", Ho, U(e(S)("inventory.transfer.receiveRequest.details.from")), 1),
1394
- l("div", Ko, U((q = (E = p.value) == null ? void 0 : E.supplier) == null ? void 0 : q.name), 1)
1395
- ])) : ne("", !0),
1396
- (M = p.value) != null && M.ref ? (x(), $("div", Go, [
1397
- l("div", Wo, U(e(S)("inventory.transfer.receiveRequest.details.reference")), 1),
1398
- l("div", Zo, U(p.value.ref), 1)
1399
- ])) : ne("", !0),
1400
- (D = p.value) != null && D.remark ? (x(), $("div", Jo, [
1401
- l("div", Xo, U(e(S)("inventory.transfer.receiveRequest.details.remark")), 1),
1402
- l("div", Yo, U(p.value.remark), 1)
1403
- ])) : ne("", !0)
1404
- ])
1405
- ];
1406
- }),
1407
- _: 1
1408
- })
1409
- ]),
1410
- l("div", el, [
1411
- l("div", tl, [
1412
- l("div", ol, U(e(S)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1413
- d(k, {
1414
- modelValue: n.value,
1415
- "onUpdate:modelValue": v[0] || (v[0] = (R) => n.value = R),
1416
- placeholder: "Filter items"
1417
- }, null, 8, ["modelValue"]),
1418
- l("div", ll, [
1419
- d(_, {
1420
- "shrink-at": -1,
1421
- "column-defs": [{ accessorKey: "code" }, { accessorKey: "name" }],
1422
- "row-data": ((J = w.template) == null ? void 0 : J.purchaseOrder.items) ?? [],
1423
- "search-value": n.value,
1424
- "force-mobile-footer": "",
1425
- "hide-header-row": "",
1426
- loading: y.value
1427
- }, {
1428
- "list-row": Q((R) => [
1429
- l("div", nl, [
1430
- l("div", sl, [
1431
- l("div", al, U(C(R).name), 1),
1432
- v[4] || (v[4] = l("div", { class: "flex-1 min-w-32" }, null, -1)),
1433
- l("div", rl, U(e(Vt)(
1434
- C(R).quantity,
1435
- C(R).sku.unit,
1436
- C(R).measurement
1437
- )), 1)
1438
- ]),
1439
- l("div", il, [
1440
- l("div", ul, U(C(R).code), 1),
1441
- C(R).totalCost && e(b).enableTotalCost ? (x(), $("div", ml, " (" + U(e(Tt)(C(R).totalCost)) + ") ", 1)) : ne("", !0)
1442
- ]),
1443
- e($t)(C(R)) ? (x(), $("div", dl, [
1444
- d(i, {
1445
- name: "error",
1446
- color: "system-error-300",
1447
- size: "sm"
1448
- }),
1449
- v[5] || (v[5] = l("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))
1450
- ])) : ne("", !0)
1451
- ])
1452
- ]),
1453
- _: 1
1454
- }, 8, ["row-data", "search-value", "loading"])
1455
- ])
1456
- ])
1457
- ]),
1458
- v[10] || (v[10] = l("div", null, null, -1)),
1459
- v[11] || (v[11] = l("div", null, null, -1)),
1460
- l("div", pl, [
1461
- (j = w.template) != null && j.locationTags ? (x(), $(se, { key: 0 }, [
1462
- v[6] || (v[6] = l("div", { class: "flex flex-col" }, [
1463
- l("div", { class: "fm-typo-en-body-lg-600" }, "Enabled location tags"),
1464
- l("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is enabled for the following location tags. ")
1465
- ], -1)),
1466
- l("div", cl, [
1467
- (x(!0), $(se, null, pe(w.template.locationTags, (R, s) => (x(), K(P, {
1468
- label: R,
1469
- key: s
1470
- }, null, 8, ["label"]))), 128))
1471
- ]),
1472
- v[7] || (v[7] = l("div", null, null, -1)),
1473
- v[8] || (v[8] = l("div", null, null, -1))
1474
- ], 64)) : ne("", !0),
1475
- v[9] || (v[9] = l("div", { class: "flex flex-col" }, [
1476
- l("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1477
- l("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " This template is only usable for the following locations. ")
1478
- ], -1)),
1479
- l("div", fl, [
1480
- d(k, {
1481
- modelValue: a.value,
1482
- "onUpdate:modelValue": v[1] || (v[1] = (R) => a.value = R),
1483
- placeholder: "Filter locations",
1484
- "prepend-icon": "search"
1485
- }, null, 8, ["modelValue"]),
1486
- d(_, {
1487
- "hide-footer": "",
1488
- style: { height: "500px" },
1489
- "column-defs": t,
1490
- "search-value": a.value,
1491
- "row-data": ((B = g.template) == null ? void 0 : B.locations) ?? [{ name: "All locations" }]
1492
- }, null, 8, ["search-value", "row-data"])
1493
- ])
1494
- ])
1495
- ])
1496
- ];
1497
- }),
1498
- "side-sheet-footer": Q(() => [
1499
- l("div", yl, [
1500
- d(V, {
1501
- label: e(S)("common.edit"),
1502
- onClick: v[2] || (v[2] = (J) => o("action:edit")),
1503
- variant: "tertiary"
1504
- }, null, 8, ["label"])
1505
- ])
1506
- ]),
1507
- _: 1
1508
- }, 8, ["header", "modelValue", "dismiss-away"]);
1509
- };
1510
- }
1511
- }), bl = { class: "flex-1 flex flex-col gap-8" }, gl = { class: "flex flex-col" }, hl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, _l = { class: "fm-typo-en-body-lg-400" }, wl = { class: "fm-typo-en-body-lg-400 line-clamp-1" }, kl = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Rl = /* @__PURE__ */ ae({
1512
- __name: "TransferTemplateView",
1513
- setup(f) {
1514
- const { t: I } = ce(), { createTemplate: g, viewTemplate: o, importTemplates: b, exportTemplates: S } = Ne(), { templateDialogProps: p, templateDetailsProps: n } = Qe(Ne()), t = Mt(), { loading: a, templates: u } = Qe(t), h = H(!1), T = It(), y = We(), { breakpoints: C } = Ot();
1515
- Ie(t.fetchTemplates);
1516
- const w = z(
1517
- () => h.value || a.value || !y._currentLocation
1518
- ), v = z(() => u.value), c = H(""), r = z(() => C.value.xs || C.value.sm), k = z(() => r.value ? 10 : 20);
1519
- function i(V) {
1520
- switch (V) {
1521
- case Ee.Add:
1522
- return g();
1523
- case "refresh":
1524
- return t.fetchTemplates();
1525
- case "import":
1526
- return b();
1527
- case "export":
1528
- return S();
1529
- }
1530
- }
1531
- function _(V) {
1532
- return V;
1533
- }
1534
- const P = z(() => [
1535
- {
1536
- label: I("inventory.closing.template.create.title"),
1537
- value: Ee.Add,
1538
- isPrimary: !0,
1539
- prependIcon: "add"
1540
- },
1541
- {
1542
- label: "Refresh",
1543
- value: "refresh",
1544
- isPrimary: !1
1545
- },
1546
- {
1547
- label: "Import",
1548
- value: "import",
1549
- isPrimary: !1
1550
- },
1551
- {
1552
- label: "Export",
1553
- value: "export",
1554
- isPrimary: !1
1555
- }
1556
- ]);
1557
- return (V, A) => {
1558
- const Z = O("FmTable");
1559
- return x(), $(se, null, [
1560
- d(Ft, {
1561
- title: e(I)("inventory.transfer.template.title2"),
1562
- actions: P.value,
1563
- "onClick:action": i
1564
- }, {
1565
- default: Q(() => {
1566
- var J;
1567
- return [
1568
- l("div", {
1569
- class: ie([
1570
- "flex flex-col gap-8 max-h-full",
1571
- {
1572
- "p-0": r.value,
1573
- "px-24 ": !r.value
1574
- }
1575
- ])
1576
- }, [
1577
- d(Ct, {
1578
- searchable: "",
1579
- search: c.value,
1580
- "onUpdate:search": A[0] || (A[0] = (j) => c.value = j)
1581
- }, null, 8, ["search"]),
1582
- (x(), K(Z, {
1583
- style: ze(e(T).tableHeight),
1584
- "column-defs": e(t).columnDefs,
1585
- "row-data": v.value,
1586
- "search-value": c.value,
1587
- loading: w.value,
1588
- key: (J = e(y)._currentLocation) == null ? void 0 : J.dbName,
1589
- onRowClick: A[1] || (A[1] = (j) => e(o)(j.original)),
1590
- "page-size": k.value
1591
- }, {
1592
- "list-row": Q((j) => [
1593
- d(Ze, {
1594
- row: j,
1595
- onRowClick: (B) => e(o)(B)
1596
- }, {
1597
- default: Q((B) => {
1598
- var R, s, m, E, q, M, D, X, Y, ee, re, W, F, N, ue, ve, Se, Ve, $e, Me, be, De, Oe, Ae, Re, ge, Pe;
1599
- return [
1600
- l("div", bl, [
1601
- l("div", gl, [
1602
- l("div", hl, [
1603
- d(e(oe), {
1604
- render: (m = (s = (R = B._id) == null ? void 0 : R.column) == null ? void 0 : s.columnDef) == null ? void 0 : m.cell,
1605
- props: (q = (E = B._id) == null ? void 0 : E.getContext) == null ? void 0 : q.call(E)
1606
- }, null, 8, ["render", "props"])
1607
- ]),
1608
- l("div", xl, [
1609
- d(e(oe), {
1610
- render: (X = (D = (M = B.name) == null ? void 0 : M.column) == null ? void 0 : D.columnDef) == null ? void 0 : X.cell,
1611
- props: (ee = (Y = B.name) == null ? void 0 : Y.getContext) == null ? void 0 : ee.call(Y)
1612
- }, null, 8, ["render", "props"])
1613
- ]),
1614
- l("div", _l, [
1615
- d(e(oe), {
1616
- render: (F = (W = (re = B.supplier) == null ? void 0 : re.column) == null ? void 0 : W.columnDef) == null ? void 0 : F.cell,
1617
- props: (ue = (N = B.supplier) == null ? void 0 : N.getContext) == null ? void 0 : ue.call(N)
1618
- }, null, 8, ["render", "props"])
1619
- ]),
1620
- l("div", null, U((ve = j.original.locations) != null && ve.length ? `Enabled for ${(Se = j.original.locations) == null ? void 0 : Se.length} outlets` : "Enabled for all outlets"), 1),
1621
- l("div", wl, U(j.original.purchaseOrder.items.length ? j.original.purchaseOrder.items.map((rt) => rt.name).join(", ") : "No items"), 1),
1622
- l("div", kl, [
1623
- d(e(oe), {
1624
- render: (Me = ($e = (Ve = B.ref) == null ? void 0 : Ve.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Me.cell,
1625
- props: (De = (be = B.ref) == null ? void 0 : be.getContext) == null ? void 0 : De.call(be)
1626
- }, null, 8, ["render", "props"])
1627
- ])
1628
- ]),
1629
- l("div", null, [
1630
- d(e(oe), {
1631
- render: (Re = (Ae = (Oe = B.type) == null ? void 0 : Oe.column) == null ? void 0 : Ae.columnDef) == null ? void 0 : Re.cell,
1632
- props: (Pe = (ge = B.type) == null ? void 0 : ge.getContext) == null ? void 0 : Pe.call(ge)
1633
- }, null, 8, ["render", "props"])
1634
- ])
1635
- ])
1636
- ];
1637
- }),
1638
- _: 2
1639
- }, 1032, ["row", "onRowClick"])
1640
- ]),
1641
- _: 1
1642
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1643
- ], 2)
1644
- ];
1645
- }),
1646
- _: 1
1647
- }, 8, ["title", "actions"]),
1648
- (x(), K(pt, { to: "body" }, [
1649
- d(vl, ct(ft(e(n))), null, 16),
1650
- d(Ro, je(e(p), {
1651
- onSubmitted: A[2] || (A[2] = (J) => e(t).fetchTemplates())
1652
- }), null, 16)
1653
- ]))
1654
- ], 64);
1655
- };
1656
- }
1657
- });
1658
- export {
1659
- Rl as default
1660
- };