@feedmepos/mf-inventory-portal 0.0.22-dev.4 → 0.0.22-dev.40

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