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

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