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