@feedmepos/mf-inventory-portal 0.0.25-dev.8 → 0.0.25-dev.9

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