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

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