@feedmepos/mf-inventory-portal 0.0.23-dev.31 → 0.0.23-dev.4

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