@feedmepos/mf-inventory-portal 0.0.22-dev.1 → 0.0.22-dev.10

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 (76) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/{ApprovalView-CtH8I01g.js → ApprovalView-FwJEAzkU.js} +19 -19
  3. package/dist/{BindingsDialog-DFrk_fyd.js → BindingsDialog-DFLnNDpl.js} +1 -1
  4. package/dist/{BindingsPicker-400gISaV.js → BindingsPicker-Dsd2wQUR.js} +19 -19
  5. package/dist/{BindingsTable-CnFKI6iP.js → BindingsTable-CTvUEEjT.js} +1 -1
  6. package/dist/ClosingTemplateView-CPbDZmei.js +1066 -0
  7. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B9RU_arW.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-MW-Ni07p.js} +13 -15
  8. package/dist/{IngredientsView-CRTAgKJz.js → IngredientsView-C07TvvCQ.js} +5 -6
  9. package/dist/{IntegrationView-CNFTKqjk.js → IntegrationView-BAnrTgio.js} +2 -2
  10. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-VkiVLx1K.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-YAjDfJ_v.js} +1 -1
  11. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DkZrgqyr.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CvzA5XrI.js} +1 -1
  12. package/dist/{PurchaseOrderPrintPreview-CJli-_Vn.js → PurchaseOrderPrintPreview-FiOxyAL2.js} +1 -1
  13. package/dist/{ReceiveRequestView-DV_GDzJG.js → ReceiveRequestView-BTZ_99LY.js} +15 -16
  14. package/dist/{RecipeView-CTm_7oNG.js → RecipeView-BTRlXuIp.js} +3 -3
  15. package/dist/{StockView-DtHT2ulM.js → StockView-B50nZjP-.js} +8 -9
  16. package/dist/{SupplierView-B9A5R2Vm.js → SupplierView-CYEdoZ7g.js} +37 -37
  17. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CMMMgbwA.js +762 -0
  18. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BKmp6Emq.js +1505 -0
  19. package/dist/TransferTemplateView-DJYoQWDE.js +1277 -0
  20. package/dist/{UnitView-BL-jtVuZ.js → UnitView-Cg9lop9G.js} +4 -4
  21. package/dist/WarehouseView-DQKq_W8l.js +1017 -0
  22. package/dist/api/closing-template.d.ts +14 -0
  23. package/dist/api/inventory.d.ts +5 -7
  24. package/dist/api/netsuite.d.ts +46 -0
  25. package/dist/api/purchase-order-template.d.ts +0 -4
  26. package/dist/{app-C-z1MfF6.js → app-CRbOk4dN.js} +15759 -15399
  27. package/dist/app.d.ts +6 -0
  28. package/dist/app.js +2 -2
  29. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  30. package/dist/components/VirtualScroll.vue.d.ts +47 -0
  31. package/dist/{decimal-DZz-_lgE.js → decimal-BrFW4i9P.js} +1 -1
  32. package/dist/{defineDeepModel-7VQajdPt.js → defineDeepModel-Dihj57Tu.js} +4 -4
  33. package/dist/extensions/promises.d.ts +14 -0
  34. package/dist/{format-time-from-id-9XFszs1J.js → format-time-from-id-CAMmsTAi.js} +1 -1
  35. package/dist/helper/date2.d.ts +1 -0
  36. package/dist/{id-to-date-Bkue77uI.js → id-to-date-CLOPCZAL.js} +1 -1
  37. package/dist/purchase-order-transaction-type-C6B_s24N.js +676 -0
  38. package/dist/stores/api.d.ts +1 -0
  39. package/dist/stores/feature.d.ts +0 -1
  40. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  41. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  42. package/dist/stores/inventory.d.ts +7 -0
  43. package/dist/stores/location.d.ts +24 -42
  44. package/dist/stores/netsuite.d.ts +56 -0
  45. package/dist/stores/route.d.ts +0 -5
  46. package/dist/stores/warehouse.d.ts +4 -7
  47. package/dist/style.css +1 -1
  48. package/dist/{supplier-C6YWXF2Y.js → supplier-CQ57ob8j.js} +1 -1
  49. package/dist/tsconfig.app.tsbuildinfo +1 -1
  50. package/dist/use-template-enabled-locations-2-D5I1uMwS.js +85 -0
  51. package/dist/views/closing-template/components/closing-template-publish/ClosingTemplatePublish.vue.d.ts +6 -0
  52. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +276 -84
  53. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +341 -85
  54. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +14 -0
  55. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +42 -0
  56. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +42 -0
  57. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  58. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -7
  59. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +2 -2
  60. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +132 -84
  61. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +44 -1014
  62. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +251 -0
  63. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  64. package/dist/{xlsx-Dl6dAHFx.js → xlsx-WWSZpgZu.js} +1 -1
  65. package/dist/{xlsx.util-C1tUhDb8.js → xlsx.util-DjCdSP8D.js} +2 -2
  66. package/package.json +5 -5
  67. package/dist/ClosingTemplateView--8m8cua_.js +0 -919
  68. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-mUNCQTNw.js +0 -740
  69. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BwkUuXqj.js +0 -1428
  70. package/dist/TransferTemplateView-DnyenkGu.js +0 -1349
  71. package/dist/WarehouseView-BkUv1792.js +0 -1056
  72. package/dist/array-ClJzD_Lt.js +0 -30
  73. package/dist/layout/InventoryLayout.vue.d.ts +0 -2
  74. package/dist/layout/layout-routes.d.ts +0 -6
  75. package/dist/purchase-order-transaction-type-DHzMBgFs.js +0 -712
  76. package/dist/use-template-enabled-locations-CFCfbaOd.js +0 -57
@@ -1,1349 +0,0 @@
1
- import { defineComponent as J, onMounted as _e, computed as O, ref as U, watch as fe, inject as Ke, 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 Ze, 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 Je, normalizeStyle as Xe, Teleport as et, mergeProps as Pe, normalizeProps as tt, guardReactiveProps as ot } from "vue";
2
- import { u as st, _ as nt, a as lt } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-B9RU_arW.js";
3
- import { useI18n as X } from "@feedmepos/mf-common";
4
- import { P as pe, a as at, f as rt, b as Be, c as it } from "./purchase-order-transaction-type-DHzMBgFs.js";
5
- import { F as ne, R as qe } from "./row-action.enum-PMKMRrZR.js";
6
- import { $ as ye, t as Ue, I as ut, a0 as dt, a1 as mt, a as G, D as Ee, R as be, a2 as ct, a3 as pt, r as de, a4 as ft, l as yt, A as Ne, M as vt, b as he, u as bt, j as ge, y as _t, a5 as ie, a6 as xt, G as ht, a7 as gt } from "./app-C-z1MfF6.js";
7
- import { useBreakpoints as ze, components as ue, useDialog as kt, useSnackbar as wt, useProxiedModel as je } from "@feedmepos/ui-library";
8
- import { storeToRefs as Ft } from "pinia";
9
- import { d as Qe } from "./defineDeepModel-7VQajdPt.js";
10
- import { c as He, _ as Tt } from "./TransferDialog.vue_vue_type_script_setup_true_lang-BwkUuXqj.js";
11
- import { useRouter as Ct } from "vue-router";
12
- import { u as $t } from "./supplier-C6YWXF2Y.js";
13
- import { F as E, _ as Ge } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
14
- import { _ as St } from "./PremiumBadge.vue_vue_type_script_setup_true_lang-DkZrgqyr.js";
15
- import { u as Ye } from "./use-template-enabled-locations-CFCfbaOd.js";
16
- import { f as Mt } from "./format-time-from-id-9XFszs1J.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 = Qe("modelValue"), l = ut();
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 = dt(p), t = _.value, r = ye(o, t);
71
- return mt(
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 = Ke(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 = Ze({});
182
- ze(), _e(() => {
183
- for (const c of f.items) {
184
- if (!c.totalCost)
185
- continue;
186
- const n = He(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(ct, {
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
- pt(
262
- +G(
263
- n.minimumQuantity ?? {
264
- amount: 1,
265
- precision: de(n.sku.unit, n.measurement)
266
- }
267
- )
268
- ),
269
- ft(
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: yt(+a)
328
- });
329
- },
330
- rules: [
331
- Ne({
332
- amount: 1,
333
- precision: de(n.sku.unit, n.measurement)
334
- }),
335
- vt(n.sku.unit, n.measurement)
336
- ]
337
- });
338
- },
339
- enableSorting: !1
340
- },
341
- // {
342
- // id: ItemColumn.Cost,
343
- // header: getTotalCostHeader,
344
- // size: 180,
345
- // cell(cellProps) {
346
- // const row = cellProps.row.original
347
- // const showAutoCalculate = canAutoCalculate(row.sku)
348
- // const isMobile = breakpoints.value.xs || breakpoints.value.sm
349
- // if (!manualTotalCost[row.sku._id] && showAutoCalculate) {
350
- // return h(
351
- // 'div',
352
- // {
353
- // class: 'flex gap-4 fm-typo-en-body-md-400 items-center',
354
- // key: row.sku._id
355
- // },
356
- // [
357
- // h(components.FmButton, {
358
- // prependIcon: 'edit',
359
- // variant: FmButtonVariant.Tertiary,
360
- // onClick() {
361
- // controller.updateItem({
362
- // ...row,
363
- // totalCost: calculateDefaultCost(row.sku, row.quantity, row.measurement, {
364
- // supplier: controller.supplier
365
- // })
366
- // })
367
- // manualTotalCost[row.sku._id] = true
368
- // },
369
- // disabled: controller.disabled
370
- // }),
371
- // h(
372
- // 'div',
373
- // {
374
- // class: 'flex flex-col'
375
- // },
376
- // [
377
- // h(
378
- // 'span',
379
- // {
380
- // class: [controller.disabled ? 'text-fm-color-typo-disabled' : '']
381
- // },
382
- // isMobile
383
- // ? adjustmentCurrencyFormat(
384
- // calculateDefaultCost(row.sku, row.quantity, row.measurement, {
385
- // supplier: controller.supplier
386
- // })
387
- // )
388
- // : adjustmentAmountFormat(
389
- // calculateDefaultCost(row.sku, row.quantity, row.measurement, {
390
- // supplier: controller.supplier
391
- // })
392
- // )
393
- // ),
394
- // h(
395
- // 'span',
396
- // {
397
- // class: [
398
- // 'fm-typo-en-body-sm-400',
399
- // controller.disabled
400
- // ? 'text-fm-color-typo-disabled'
401
- // : 'text-fm-color-neutral-gray-400'
402
- // ]
403
- // },
404
- // t('inventory.transfer.form.items.autoCalculated')
405
- // )
406
- // ]
407
- // )
408
- // ]
409
- // )
410
- // }
411
- // return h(
412
- // components.FmTextField,
413
- // {
414
- // modelValue: adjustmentAmountFormat(row.totalCost ?? { amount: 0, precision: 0 }),
415
- // key: row.sku._id,
416
- // 'onUpdate:modelValue': (value: string) => {
417
- // controller.updateItem({
418
- // ...row,
419
- // totalCost: {
420
- // ...toAdjustmentAmount(+value),
421
- // currency: getCurrency()
422
- // }
423
- // })
424
- // },
425
- // rules: [AtLeast(0), MaximumPrecision(2)]
426
- // },
427
- // {
428
- // prepend() {
429
- // if (!isMobile) return null
430
- // return h(
431
- // 'div',
432
- // {
433
- // class: [
434
- // 'text-fm-typo-en-body-lg-400',
435
- // controller.disabled ? 'text-fm-color-typo-disabled' : ''
436
- // ]
437
- // },
438
- // getFormattedCurrency()
439
- // )
440
- // },
441
- // append() {
442
- // if (!showAutoCalculate) return null
443
- // return h(components.FmButton, {
444
- // prependIcon: 'close',
445
- // variant: 'tertiary',
446
- // onClick() {
447
- // controller.updateItem({
448
- // ...row,
449
- // totalCost: null
450
- // })
451
- // manualTotalCost[row.sku._id] = false
452
- // },
453
- // disabled: controller.disabled
454
- // })
455
- // }
456
- // }
457
- // )
458
- // },
459
- // enableSorting: false
460
- // },
461
- {
462
- id: "Delete",
463
- header: "",
464
- cell(c) {
465
- const n = c.row.original;
466
- return Z(ue.FmButton, {
467
- class: "delete-button",
468
- key: n.sku._id,
469
- type: "button",
470
- icon: "delete",
471
- variant: "tertiary",
472
- size: "md",
473
- disabled: f.disabled,
474
- onClick: () => {
475
- f.deleteItem(n);
476
- }
477
- });
478
- },
479
- enableSorting: !1,
480
- size: 40,
481
- meta: {
482
- cellClass: "",
483
- headerClass: ""
484
- }
485
- }
486
- ];
487
- return {
488
- columnDefs: O(() => he().enableTotalCost && f.transferType === pe.PURCHASE ? l : l.filter((n) => n.id !== "Cost"))
489
- };
490
- }
491
- 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({
492
- __name: "TransferTemplateItem",
493
- props: {
494
- cellByColId: {},
495
- row: {}
496
- },
497
- setup(f) {
498
- const { t: y } = X();
499
- return (d, l) => {
500
- 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;
501
- const _ = C("FmLabel");
502
- return w(), P("div", Ut, [
503
- s("div", Et, [
504
- s("div", Nt, [
505
- s("span", zt, " (" + T(d.row.original.sku.code) + ") ", 1),
506
- s("span", jt, T(d.row.original.sku.name), 1)
507
- ]),
508
- s("div", null, [
509
- u(e(E), {
510
- render: (a = (n = (c = d.cellByColId.Delete) == null ? void 0 : c.column) == null ? void 0 : n.columnDef) == null ? void 0 : a.cell,
511
- props: (L = (F = d.cellByColId.Delete) == null ? void 0 : F.getContext) == null ? void 0 : L.call(F)
512
- }, null, 8, ["render", "props"])
513
- ])
514
- ]),
515
- s("div", Qt, [
516
- s("div", Ht, [
517
- u(_, {
518
- label: e(y)(`inventory.transfer.form.items.table.${e(V).Code}`)
519
- }, null, 8, ["label"]),
520
- u(e(E), {
521
- render: (I = (M = (S = d.cellByColId[e(V).Code]) == null ? void 0 : S.column) == null ? void 0 : M.columnDef) == null ? void 0 : I.cell,
522
- props: (v = (h = d.cellByColId[e(V).Code]) == null ? void 0 : h.getContext) == null ? void 0 : v.call(h)
523
- }, null, 8, ["render", "props"]),
524
- l[0] || (l[0] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
525
- ]),
526
- s("div", Gt, [
527
- u(_, {
528
- label: e(y)(`inventory.transfer.form.items.table.${e(V).Name}`)
529
- }, null, 8, ["label"]),
530
- u(e(E), {
531
- render: (q = (R = (g = d.cellByColId[e(V).Name]) == null ? void 0 : g.column) == null ? void 0 : R.columnDef) == null ? void 0 : q.cell,
532
- props: (o = (p = d.cellByColId[e(V).Name]) == null ? void 0 : p.getContext) == null ? void 0 : o.call(p)
533
- }, null, 8, ["render", "props"]),
534
- l[1] || (l[1] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
535
- ])
536
- ]),
537
- s("div", Yt, [
538
- s("div", Wt, [
539
- u(_, {
540
- label: e(y)(`inventory.transfer.form.items.table.${e(V).Limit}`)
541
- }, null, 8, ["label"]),
542
- u(e(E), {
543
- render: (m = (r = (t = d.cellByColId[e(V).Limit]) == null ? void 0 : t.column) == null ? void 0 : r.columnDef) == null ? void 0 : m.cell,
544
- props: (b = (i = d.cellByColId[e(V).Limit]) == null ? void 0 : i.getContext) == null ? void 0 : b.call(i)
545
- }, null, 8, ["render", "props"]),
546
- l[2] || (l[2] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
547
- ]),
548
- s("div", Kt, [
549
- u(_, {
550
- label: e(y)(`inventory.transfer.form.items.table.${e(V).Step}`)
551
- }, null, 8, ["label"]),
552
- u(e(E), {
553
- render: (k = ($ = (A = d.cellByColId[e(V).Step]) == null ? void 0 : A.column) == null ? void 0 : $.columnDef) == null ? void 0 : k.cell,
554
- props: (z = (B = d.cellByColId[e(V).Step]) == null ? void 0 : B.getContext) == null ? void 0 : z.call(B)
555
- }, null, 8, ["render", "props"]),
556
- l[3] || (l[3] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
557
- ])
558
- ]),
559
- s("div", Zt, [
560
- s("div", Jt, [
561
- u(_, {
562
- label: e(y)(`inventory.transfer.form.items.table.${e(V).DefaultAmount}`)
563
- }, null, 8, ["label"]),
564
- u(e(E), {
565
- render: (Q = (x = (j = d.cellByColId[e(V).DefaultAmount]) == null ? void 0 : j.column) == null ? void 0 : x.columnDef) == null ? void 0 : Q.cell,
566
- props: (ee = (Y = d.cellByColId[e(V).DefaultAmount]) == null ? void 0 : Y.getContext) == null ? void 0 : ee.call(Y)
567
- }, null, 8, ["render", "props"]),
568
- l[4] || (l[4] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
569
- ]),
570
- s("div", Xt, [
571
- u(St, { "z-index": 50 }, {
572
- default: D(() => [
573
- u(_, {
574
- label: e(y)(`inventory.transfer.form.items.table.${e(V).Cost}2`)
575
- }, null, 8, ["label"])
576
- ]),
577
- _: 1
578
- }),
579
- u(e(E), {
580
- render: (oe = (W = (te = d.cellByColId[e(V).Cost]) == null ? void 0 : te.column) == null ? void 0 : W.columnDef) == null ? void 0 : oe.cell,
581
- props: (se = (K = d.cellByColId[e(V).Cost]) == null ? void 0 : K.getContext) == null ? void 0 : se.call(K)
582
- }, null, 8, ["render", "props"]),
583
- l[5] || (l[5] = s("div", { class: "fm-typo-en-body-md-600 text-fm-color-primary" }, null, -1))
584
- ])
585
- ])
586
- ]);
587
- };
588
- }
589
- }), to = { class: "flex flex-col gap-16" }, oo = { key: 0 }, so = { class: "flex flex-col gap-24" }, no = {
590
- key: 0,
591
- class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col gap-16"
592
- }, 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({
593
- __name: "TransferTemplateForm",
594
- props: {
595
- modelValue: {},
596
- disabled: { type: Boolean }
597
- },
598
- setup(f, { expose: y }) {
599
- const d = f, l = Qe(), { t: _ } = X(), c = ge(), n = bt(), a = $t(), F = O(() => c.businessLevel);
600
- fe(
601
- () => d.modelValue,
602
- (o) => {
603
- console.log("TransferTemplateForm.model", o);
604
- }
605
- ), c.watchLocation(async () => {
606
- location && (l.purchaseOrder.supplier || (l.purchaseOrder.supplier = a.suppliers.find((o) => o) ?? l.purchaseOrder.supplier));
607
- });
608
- const L = kt(), { enabledLocations: S, enabledLocationsSwitch: M, promptSelectLocations: I, removeLocation: h } = Ye({
609
- getLocations() {
610
- return l.locations;
611
- },
612
- setLocations(o) {
613
- l.locations = o;
614
- }
615
- }), v = O({
616
- get() {
617
- return l.purchaseOrder.remark ?? void 0;
618
- },
619
- set(o) {
620
- l.purchaseOrder.remark = o;
621
- }
622
- }), g = U();
623
- y({
624
- validateInputs: () => {
625
- var o, t;
626
- (t = (o = g.value) == null ? void 0 : o.validateInputs) == null || t.call(o);
627
- },
628
- resetInputsValidation: () => {
629
- var o, t;
630
- (t = (o = g.value) == null ? void 0 : o.resetInputsValidation) == null || t.call(o);
631
- },
632
- resetInputs: () => {
633
- var o, t;
634
- (t = (o = g.value) == null ? void 0 : o.resetInputs) == null || t.call(o);
635
- }
636
- });
637
- const R = qt({
638
- updateItem: (o) => {
639
- l.purchaseOrder.items = l.purchaseOrder.items.map((t) => t.sku._id !== o.sku._id ? t : o);
640
- },
641
- deleteItem: (o) => {
642
- l.purchaseOrder.items = l.purchaseOrder.items.filter(
643
- (t) => t.sku._id !== o.sku._id
644
- );
645
- },
646
- get supplier() {
647
- return l.purchaseOrder.supplier;
648
- },
649
- get items() {
650
- return l.purchaseOrder.items;
651
- },
652
- get transferType() {
653
- return pe.PURCHASE;
654
- },
655
- get disabled() {
656
- return d.disabled;
657
- }
658
- }), q = O(() => R.columnDefs.value);
659
- function p() {
660
- const o = n.skus.map((r) => ({
661
- label: r.name,
662
- sublabel: r.code,
663
- value: r
664
- })), t = o.filter((r) => {
665
- var m;
666
- return (m = l.purchaseOrder.items) == null ? void 0 : m.find((i) => i.sku._id === r.value._id);
667
- }).map((r) => r.value);
668
- L.open({
669
- title: _("inventory.transfer.form.items.selectItem"),
670
- closeButton: !0,
671
- contentComponent: _t,
672
- contentComponentProps: {
673
- modelValue: t,
674
- items: o
675
- },
676
- primaryActions: {
677
- text: _("common.confirm"),
678
- close: !0
679
- },
680
- secondaryActions: {
681
- text: _("common.close"),
682
- close: !0,
683
- variant: "tertiary"
684
- }
685
- }).onPrimary((r) => {
686
- const m = l.purchaseOrder.items ?? [], i = r.map((b) => {
687
- const A = m.find((B) => B.sku._id === b._id);
688
- if (A)
689
- return A;
690
- const $ = { amount: 1, precision: de(b.unit) }, k = {
691
- sku: b,
692
- code: b.code,
693
- name: b.name,
694
- quantity: $,
695
- minimumQuantity: $,
696
- maximumQuantity: $,
697
- quantityStep: $
698
- };
699
- return k.totalCost = He(
700
- k.sku,
701
- k.quantity,
702
- k.measurement,
703
- {
704
- supplier: l.purchaseOrder.supplier
705
- }
706
- ), k;
707
- });
708
- i.sort((b, A) => b.sku.code.localeCompare(A.sku.code)), l.purchaseOrder.items = i;
709
- });
710
- }
711
- return (o, t) => {
712
- 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");
713
- return w(), N(j, {
714
- ref_key: "formRef",
715
- ref: g,
716
- class: "flex flex-col gap-32",
717
- disabled: o.disabled
718
- }, {
719
- default: D(() => [
720
- s("div", to, [
721
- F.value ? (w(), P("div", oo, [
722
- u(r, {
723
- label: "Business template",
724
- compact: ""
725
- })
726
- ])) : H("", !0),
727
- s("div", so, [
728
- u(m, {
729
- label: e(_)("inventory.transfer.form.name"),
730
- "label-mark": "required",
731
- modelValue: e(l).name,
732
- "onUpdate:modelValue": t[0] || (t[0] = (x) => e(l).name = x),
733
- rules: [e(be)()]
734
- }, null, 8, ["label", "modelValue", "rules"]),
735
- u(m, {
736
- label: e(_)("inventory.transfer.form.reference"),
737
- "label-mark": "optional",
738
- modelValue: e(l).purchaseOrder.ref,
739
- "onUpdate:modelValue": t[1] || (t[1] = (x) => e(l).purchaseOrder.ref = x)
740
- }, null, 8, ["label", "modelValue"]),
741
- u(i, {
742
- label: e(_)("inventory.transfer.form.remark"),
743
- "label-mark": "optional",
744
- "max-length": 240,
745
- modelValue: v.value,
746
- "onUpdate:modelValue": t[2] || (t[2] = (x) => v.value = x),
747
- class: me({ "text-fm-color-typo-disabled": o.disabled })
748
- }, null, 8, ["label", "modelValue", "class"])
749
- ])
750
- ]),
751
- e(c).businessLevel ? (w(), P("div", no, [
752
- u(b, {
753
- modelValue: e(M),
754
- "onUpdate:modelValue": t[3] || (t[3] = (x) => xe(M) ? M.value = x : null),
755
- label: "Locations rule",
756
- sublabel: "Enable template for specific locations only",
757
- "label-placement": "right"
758
- }, null, 8, ["modelValue"]),
759
- e(M) ? (w(), N(B, {
760
- key: 0,
761
- modelValue: e(S),
762
- rules: [e(Ne)(1)],
763
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
764
- }, {
765
- default: D(() => [
766
- u(k, null, {
767
- default: D(() => [
768
- (w(!0), P(ce, null, ve(e(S), (x) => (w(), N($, {
769
- key: x.doc._id,
770
- label: x.name,
771
- sublabel: x.type,
772
- disabled: o.disabled
773
- }, {
774
- append: D(() => [
775
- u(A, {
776
- "prepend-icon": "delete",
777
- variant: "tertiary",
778
- disabled: o.disabled,
779
- onClick: (Q) => e(h)(x.doc._id)
780
- }, null, 8, ["disabled", "onClick"])
781
- ]),
782
- _: 2
783
- }, 1032, ["label", "sublabel", "disabled"]))), 128))
784
- ]),
785
- _: 1
786
- })
787
- ]),
788
- _: 1
789
- }, 8, ["modelValue", "rules"])) : H("", !0),
790
- e(M) ? (w(), P("div", lo, [
791
- u(A, {
792
- disabled: o.disabled,
793
- label: e(_)("inventory.transfer.form.items.addItem"),
794
- "prepend-icon": "add",
795
- variant: "plain",
796
- class: "border-2 rounded-lg border-fm-color-primary",
797
- onClick: e(I)
798
- }, null, 8, ["disabled", "label", "onClick"])
799
- ])) : H("", !0)
800
- ])) : H("", !0),
801
- s("div", ao, [
802
- s("div", ro, [
803
- s("div", io, T(e(_)("inventory.transfer.form.items.title")), 1),
804
- u(A, {
805
- disabled: o.disabled,
806
- label: e(_)("inventory.transfer.form.items.addItem"),
807
- "prepend-icon": "add",
808
- variant: "plain",
809
- class: "border-2 rounded-lg border-fm-color-primary",
810
- onClick: t[4] || (t[4] = (x) => p()),
811
- size: "md"
812
- }, null, 8, ["disabled", "label"])
813
- ]),
814
- (w(), N(z, {
815
- "column-defs": q.value,
816
- "row-data": e(l).purchaseOrder.items,
817
- key: e(l).purchaseOrder.items.map((x) => x.sku._id).join("."),
818
- "hide-footer": ""
819
- }, {
820
- "list-row": D((x) => [
821
- (w(), N(Ge, {
822
- row: x,
823
- key: e(l).purchaseOrder.items.map((Q) => Q.sku._id).join(".")
824
- }, {
825
- default: D((Q) => [
826
- u(eo, {
827
- row: x,
828
- "cell-by-col-id": Q
829
- }, null, 8, ["row", "cell-by-col-id"])
830
- ]),
831
- _: 2
832
- }, 1032, ["row"]))
833
- ]),
834
- _: 1
835
- }, 8, ["column-defs", "row-data"]))
836
- ])
837
- ]),
838
- _: 1
839
- }, 8, ["disabled"]);
840
- };
841
- }
842
- }), mo = { class: "flex items-center" }, co = { class: "fm-typo-en-title-md-800" }, po = { class: "flex gap-4" }, fo = /* @__PURE__ */ J({
843
- __name: "TransferTemplateDialog",
844
- props: {
845
- mode: {},
846
- modelValue: {},
847
- show: { type: Boolean }
848
- },
849
- emits: ["update:show", "submitted"],
850
- setup(f, { expose: y, emit: d }) {
851
- var o;
852
- const l = f, _ = d, c = at(), n = wt(), { t: a } = X(), F = je(l, "show");
853
- function L() {
854
- return {
855
- _id: "",
856
- name: "",
857
- purchaseOrder: {
858
- remark: void 0,
859
- ref: void 0,
860
- stockSnapshotId: void 0,
861
- effectiveAt: void 0,
862
- items: [],
863
- supplier: {
864
- _rev: void 0,
865
- email: void 0,
866
- internal: void 0,
867
- contactName: void 0,
868
- phoneNumber: void 0,
869
- registrationNumber: void 0,
870
- supplyItems: void 0,
871
- _id: "",
872
- name: "",
873
- address: {
874
- line2: void 0,
875
- line1: "",
876
- state: "",
877
- city: "",
878
- postcode: "",
879
- country: ""
880
- }
881
- }
882
- }
883
- };
884
- }
885
- const S = U(l.modelValue ?? L()), M = U(((o = l.modelValue) == null ? void 0 : o._id) ?? `${Math.random()}`);
886
- fe(
887
- () => l.show,
888
- (t) => {
889
- var r;
890
- t && (S.value = l.modelValue ?? L(), M.value = ((r = l.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
891
- }
892
- );
893
- const I = U(!1), h = O(() => {
894
- switch (l.mode) {
895
- case ne.READ:
896
- return "";
897
- case ne.CREATE:
898
- return a("inventory.transfer.template.create.title");
899
- case ne.UPDATE:
900
- return a("inventory.transfer.template.update.title");
901
- }
902
- return "";
903
- }), v = U();
904
- y({
905
- validateInputs: () => {
906
- var t, r;
907
- (r = (t = v.value) == null ? void 0 : t.validateInputs) == null || r.call(t);
908
- },
909
- resetInputsValidation: () => {
910
- var t, r;
911
- (r = (t = v.value) == null ? void 0 : t.resetInputsValidation) == null || r.call(t);
912
- },
913
- resetInputs: () => {
914
- var t, r;
915
- (r = (t = v.value) == null ? void 0 : t.resetInputs) == null || r.call(t);
916
- }
917
- });
918
- async function g() {
919
- var r, m;
920
- const t = S.value;
921
- if (t) {
922
- 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(
923
- ({ totalCost: i, ...b }) => b
924
- ));
925
- try {
926
- await c.createTemplate(t), await new Promise((i) => setTimeout(i, 1e3)), n.open({
927
- title: a("inventory.transfer.template.create.success"),
928
- message: a("inventory.transfer.template.create.successMessage"),
929
- type: "success"
930
- }), _("update:show", !1), _("submitted");
931
- } catch (i) {
932
- n.open({
933
- title: a("inventory.transfer.template.create.error"),
934
- message: a("inventory.transfer.template.create.errorMessage"),
935
- type: "error"
936
- }), console.error("Error in creating transfer template", i);
937
- } finally {
938
- I.value = !1;
939
- }
940
- }
941
- }
942
- async function R() {
943
- var r, m;
944
- const t = S.value;
945
- if (t) {
946
- 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(
947
- ({ totalCost: i, ...b }) => b
948
- ));
949
- try {
950
- await c.updateTemplate(t), await new Promise((i) => setTimeout(i, 1e3)), n.open({
951
- title: a("inventory.transfer.template.update.success"),
952
- message: a("inventory.transfer.template.update.successMessage"),
953
- type: "success"
954
- }), _("update:show", !1), _("submitted");
955
- } catch (i) {
956
- n.open({
957
- title: a("inventory.transfer.template.update.error"),
958
- message: a("inventory.transfer.template.update.errorMessage"),
959
- type: "error"
960
- }), console.error("Error in updating transfer template", i);
961
- } finally {
962
- I.value = !1;
963
- }
964
- }
965
- }
966
- function q() {
967
- switch (l.mode) {
968
- case ne.CREATE:
969
- return g();
970
- case ne.UPDATE:
971
- return R();
972
- }
973
- }
974
- function p() {
975
- var t, r;
976
- (r = (t = v.value) == null ? void 0 : t.validateInputs) == null || r.call(t);
977
- }
978
- return (t, r) => {
979
- const m = C("FmButton"), i = C("FmSideSheet");
980
- return w(), N(i, {
981
- modelValue: e(F),
982
- "onUpdate:modelValue": r[2] || (r[2] = (b) => xe(F) ? F.value = b : null),
983
- "dismiss-away": "",
984
- "close-button": "",
985
- "max-width": 1200
986
- }, {
987
- "side-sheet-header": D(() => [
988
- s("div", mo, [
989
- s("div", co, T(h.value), 1)
990
- ])
991
- ]),
992
- default: D(() => [
993
- (w(), N(uo, {
994
- class: "w-full",
995
- ref_key: "formRef",
996
- ref: v,
997
- onValidationSuccess: q,
998
- "model-value": S.value,
999
- "onUpdate:modelValue": r[0] || (r[0] = (b) => S.value = b),
1000
- disabled: I.value,
1001
- key: M.value
1002
- }, null, 8, ["model-value", "disabled"]))
1003
- ]),
1004
- "side-sheet-footer": D(() => [
1005
- s("div", po, [
1006
- u(m, {
1007
- loading: I.value,
1008
- label: e(a)("common.save"),
1009
- onClick: p
1010
- }, null, 8, ["loading", "label"]),
1011
- u(m, {
1012
- disabled: I.value,
1013
- variant: "tertiary",
1014
- label: e(a)("common.close"),
1015
- onClick: r[1] || (r[1] = (b) => _("update:show", !1))
1016
- }, null, 8, ["disabled", "label"])
1017
- ])
1018
- ]),
1019
- _: 1
1020
- }, 8, ["modelValue"]);
1021
- };
1022
- }
1023
- }), 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 = {
1024
- key: 0,
1025
- class: "flex flex-col gap-4"
1026
- }, 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 = {
1027
- key: 1,
1028
- class: "flex flex-col gap-4"
1029
- }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Do = { class: "fm-typo-en-body-lg-600" }, Lo = {
1030
- key: 2,
1031
- class: "flex flex-col gap-4"
1032
- }, Vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ro = { class: "fm-typo-en-body-lg-600" }, Ao = {
1033
- key: 3,
1034
- class: "flex flex-col gap-4"
1035
- }, 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 = {
1036
- key: 0,
1037
- class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1038
- }, Go = { class: "flex gap-8 xs:flex-col" }, Yo = /* @__PURE__ */ J({
1039
- __name: "TransferTemplateDetails",
1040
- props: {
1041
- template: {},
1042
- show: { type: Boolean }
1043
- },
1044
- emits: ["update:show", "action:use", "action:edit"],
1045
- setup(f, { emit: y }) {
1046
- const d = f, l = y, _ = he(), c = ge(), { t: n } = X(), a = O(() => {
1047
- var h;
1048
- return (h = d.template) == null ? void 0 : h.purchaseOrder;
1049
- }), { enabledLocations: F } = Ye({
1050
- getLocations() {
1051
- var h;
1052
- return (h = d.template) == null ? void 0 : h.locations;
1053
- },
1054
- setLocations() {
1055
- }
1056
- }), L = O(() => {
1057
- if (!c.businessLevel)
1058
- return [c.currentLocation];
1059
- const h = Array.isArray(F.value) ? F.value : c.locations, v = /* @__PURE__ */ new Set([...h.map((g) => g.doc._id)]);
1060
- return c.locations.filter((g) => v.has(g.doc._id));
1061
- }), S = O(
1062
- () => {
1063
- var h, v, g, R;
1064
- 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;
1065
- }
1066
- ), M = U(!0), I = je(d, "show");
1067
- return (h, v) => {
1068
- var r;
1069
- const g = C("FmMenuDivider"), R = C("FmCard"), q = C("FmButton"), p = C("FmListItem"), o = C("FmList"), t = C("FmSideSheet");
1070
- return w(), N(t, {
1071
- header: e(n)("inventory.transfer.template.details.view", { template: (r = h.template) == null ? void 0 : r.name }),
1072
- modelValue: e(I),
1073
- "onUpdate:modelValue": v[1] || (v[1] = (m) => xe(I) ? I.value = m : null),
1074
- "dismiss-away": M.value,
1075
- "close-button": "",
1076
- "max-width": 500
1077
- }, {
1078
- default: D(() => {
1079
- var m;
1080
- return [
1081
- s("div", yo, [
1082
- s("div", null, [
1083
- u(R, {
1084
- variant: "outlined",
1085
- class: "flex flex-col gap-8 px-12 py-16"
1086
- }, {
1087
- default: D(() => {
1088
- var i, b, A, $, k, B, z, j, x;
1089
- return [
1090
- s("div", vo, [
1091
- s("div", bo, T(e(n)("inventory.transfer.template.details.templateSummary")), 1)
1092
- ]),
1093
- u(g),
1094
- s("div", _o, [
1095
- s("div", xo, [
1096
- s("div", ho, [
1097
- s("div", go, T(e(n)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1098
- ]),
1099
- s("div", ko, T(e(Mt)(((i = h.template) == null ? void 0 : i._id) ?? "")), 1)
1100
- ]),
1101
- (b = a.value) != null && b.effectiveAt ? (w(), P("div", wo, [
1102
- s("div", Fo, T(e(n)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1103
- s("div", To, T(e(xt)(new Date((A = a.value) == null ? void 0 : A.effectiveAt))), 1)
1104
- ])) : H("", !0),
1105
- s("div", Co, [
1106
- s("div", $o, T(e(n)("inventory.transfer.receiveRequest.details.type.title")), 1),
1107
- s("div", So, T(e(n)(
1108
- `inventory.transfer.receiveRequest.details.type.${S.value.toLocaleLowerCase("en-US")}`
1109
- )), 1)
1110
- ]),
1111
- (k = ($ = a.value) == null ? void 0 : $.supplier) != null && k.name ? (w(), P("div", Mo, [
1112
- s("div", Io, T(e(n)("inventory.transfer.receiveRequest.details.from")), 1),
1113
- s("div", Do, T((z = (B = a.value) == null ? void 0 : B.supplier) == null ? void 0 : z.name), 1)
1114
- ])) : H("", !0),
1115
- (j = a.value) != null && j.ref ? (w(), P("div", Lo, [
1116
- s("div", Vo, T(e(n)("inventory.transfer.receiveRequest.details.reference")), 1),
1117
- s("div", Ro, T(a.value.ref), 1)
1118
- ])) : H("", !0),
1119
- (x = a.value) != null && x.remark ? (w(), P("div", Ao, [
1120
- s("div", Oo, T(e(n)("inventory.transfer.receiveRequest.details.remark")), 1),
1121
- s("div", Po, T(a.value.remark), 1)
1122
- ])) : H("", !0)
1123
- ])
1124
- ];
1125
- }),
1126
- _: 1
1127
- })
1128
- ]),
1129
- s("div", Bo, [
1130
- s("div", qo, [
1131
- s("div", Uo, T(e(n)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1132
- (w(!0), P(ce, null, ve(((m = a.value) == null ? void 0 : m.items) ?? [], (i) => (w(), P("div", {
1133
- key: i.code,
1134
- class: "flex flex-col"
1135
- }, [
1136
- s("div", Eo, [
1137
- s("div", No, T(i.name), 1),
1138
- v[2] || (v[2] = s("div", { class: "flex-1 min-w-32" }, null, -1)),
1139
- s("div", zo, T(e(rt)(i.quantity, i.sku.unit, i.measurement)), 1)
1140
- ]),
1141
- s("div", jo, [
1142
- s("div", Qo, T(i.code), 1),
1143
- i.totalCost && e(_).enableTotalCost ? (w(), P("div", Ho, " (" + T(e(ht)(i.totalCost)) + ") ", 1)) : H("", !0)
1144
- ])
1145
- ]))), 128))
1146
- ])
1147
- ]),
1148
- s("div", null, [
1149
- u(R, {
1150
- variant: "outlined",
1151
- class: "flex flex-col"
1152
- }, {
1153
- default: D(() => [
1154
- v[3] || (v[3] = s("div", { class: "flex flex-col p-16" }, [
1155
- s("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1156
- s("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Click to use template on the location ")
1157
- ], -1)),
1158
- u(o, null, {
1159
- default: D(() => [
1160
- (w(!0), P(ce, null, ve(L.value, (i) => (w(), N(p, {
1161
- key: i.doc._id,
1162
- label: i.name,
1163
- sublabel: i.type,
1164
- onClick: (b) => l("action:use", i.doc._id)
1165
- }, {
1166
- append: D(() => [
1167
- u(q, {
1168
- "prepend-icon": "chevron_right",
1169
- variant: "tertiary"
1170
- })
1171
- ]),
1172
- _: 2
1173
- }, 1032, ["label", "sublabel", "onClick"]))), 128))
1174
- ]),
1175
- _: 1
1176
- })
1177
- ]),
1178
- _: 1
1179
- })
1180
- ])
1181
- ])
1182
- ];
1183
- }),
1184
- "side-sheet-footer": D(() => [
1185
- s("div", Go, [
1186
- u(q, {
1187
- label: e(n)("common.edit"),
1188
- onClick: v[0] || (v[0] = (m) => l("action:edit")),
1189
- variant: "tertiary"
1190
- }, null, 8, ["label"])
1191
- ])
1192
- ]),
1193
- _: 1
1194
- }, 8, ["header", "modelValue", "dismiss-away"]);
1195
- };
1196
- }
1197
- }), 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({
1198
- __name: "TransferTemplateView",
1199
- setup(f) {
1200
- const { t: y } = X(), { createTemplate: d, viewTemplate: l } = Be(), { templateDialogProps: _, transferFormDialogProps: c, templateDetailsProps: n } = Ft(
1201
- Be()
1202
- ), a = it(), F = st(), L = ge(), S = he(), { breakpoints: M } = ze();
1203
- L.watchLocation(a.fetchTemplates), _e(() => {
1204
- S.mustManageBusinessOnlyPoTemplate && (L.businessLevel = !0);
1205
- }), fe(
1206
- () => {
1207
- var m;
1208
- return (m = c.value) == null ? void 0 : m.show;
1209
- },
1210
- (m) => {
1211
- m === !1 && S.mustManageBusinessOnlyPoTemplate && (L.businessLevel = !0);
1212
- }
1213
- ), Je(() => {
1214
- L.businessLevel = !1;
1215
- });
1216
- const I = O(() => L.businessLevel), h = O(
1217
- () => a.loading.value || !L._currentLocation
1218
- ), v = O(
1219
- () => I.value ? a.businessTemplates.value : a.locationTemplates.value
1220
- ), g = U(""), R = O(() => M.value.xs || M.value.sm), q = O(() => R.value ? 10 : 20);
1221
- function p(m) {
1222
- switch (m) {
1223
- case qe.Add:
1224
- return d();
1225
- }
1226
- }
1227
- const o = Ct();
1228
- function t() {
1229
- o.push({ name: gt.RECEIVE_REQUEST });
1230
- }
1231
- function r(m) {
1232
- return m;
1233
- }
1234
- return (m, i) => {
1235
- const b = C("FmTable");
1236
- return w(), P(ce, null, [
1237
- u(nt, {
1238
- title: e(y)("inventory.transfer.template.title2"),
1239
- actions: [
1240
- {
1241
- label: e(y)("inventory.transfer.template.create.title"),
1242
- value: e(qe).Add,
1243
- isPrimary: !0,
1244
- prependIcon: "add"
1245
- }
1246
- ],
1247
- "onClick:action": p,
1248
- "using-business-helper-text": "You are managing business-level template list. These templates will be made visible to all locations."
1249
- }, {
1250
- default: D(() => {
1251
- var A;
1252
- return [
1253
- s("div", {
1254
- class: me([
1255
- "flex flex-col gap-8 max-h-full",
1256
- {
1257
- "p-0": R.value,
1258
- "px-24 ": !R.value
1259
- }
1260
- ])
1261
- }, [
1262
- u(lt, {
1263
- searchable: "",
1264
- "change-location": !e(S).mustManageBusinessOnlyPoTemplate,
1265
- search: g.value,
1266
- "onUpdate:search": i[0] || (i[0] = ($) => g.value = $),
1267
- actions: [{ icon: "refresh", onClick: e(a).fetchTemplates }],
1268
- "show-business": ""
1269
- }, null, 8, ["change-location", "search", "actions"]),
1270
- (w(), N(b, {
1271
- style: Xe(e(F).tableHeight),
1272
- "column-defs": e(a).columnDefs,
1273
- "row-data": v.value,
1274
- "search-value": g.value,
1275
- loading: h.value,
1276
- key: (A = e(L)._currentLocation) == null ? void 0 : A.dbName,
1277
- onRowClick: i[1] || (i[1] = ($) => e(l)($.original)),
1278
- "page-size": q.value
1279
- }, {
1280
- "list-row": D(($) => [
1281
- u(Ge, {
1282
- row: $,
1283
- onRowClick: (k) => e(l)(k)
1284
- }, {
1285
- default: D((k) => {
1286
- 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;
1287
- return [
1288
- s("div", Wo, [
1289
- s("div", Ko, [
1290
- s("div", Zo, [
1291
- u(e(E), {
1292
- render: (j = (z = (B = k._id) == null ? void 0 : B.column) == null ? void 0 : z.columnDef) == null ? void 0 : j.cell,
1293
- props: (Q = (x = k._id) == null ? void 0 : x.getContext) == null ? void 0 : Q.call(x)
1294
- }, null, 8, ["render", "props"])
1295
- ]),
1296
- s("div", Jo, [
1297
- u(e(E), {
1298
- render: (te = (ee = (Y = k.name) == null ? void 0 : Y.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
1299
- props: (oe = (W = k.name) == null ? void 0 : W.getContext) == null ? void 0 : oe.call(W)
1300
- }, null, 8, ["render", "props"])
1301
- ]),
1302
- s("div", Xo, [
1303
- u(e(E), {
1304
- render: (ke = (se = (K = k.supplier) == null ? void 0 : K.column) == null ? void 0 : se.columnDef) == null ? void 0 : ke.cell,
1305
- props: (we = (le = k.supplier) == null ? void 0 : le.getContext) == null ? void 0 : we.call(le)
1306
- }, null, 8, ["render", "props"])
1307
- ]),
1308
- 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),
1309
- s("div", es, T($.original.purchaseOrder.items.length ? $.original.purchaseOrder.items.map((We) => We.name).join(", ") : "No items"), 1),
1310
- s("div", ts, [
1311
- u(e(E), {
1312
- render: (Se = ($e = (Ce = k.ref) == null ? void 0 : Ce.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Se.cell,
1313
- props: (Me = (ae = k.ref) == null ? void 0 : ae.getContext) == null ? void 0 : Me.call(ae)
1314
- }, null, 8, ["render", "props"])
1315
- ])
1316
- ]),
1317
- s("div", null, [
1318
- u(e(E), {
1319
- render: (Le = (De = (Ie = k.type) == null ? void 0 : Ie.column) == null ? void 0 : De.columnDef) == null ? void 0 : Le.cell,
1320
- props: (Ve = (re = k.type) == null ? void 0 : re.getContext) == null ? void 0 : Ve.call(re)
1321
- }, null, 8, ["render", "props"])
1322
- ])
1323
- ])
1324
- ];
1325
- }),
1326
- _: 2
1327
- }, 1032, ["row", "onRowClick"])
1328
- ]),
1329
- _: 1
1330
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1331
- ], 2)
1332
- ];
1333
- }),
1334
- _: 1
1335
- }, 8, ["title", "actions"]),
1336
- (w(), N(et, { to: "body" }, [
1337
- u(Tt, Pe(e(c), { onSubmitted: t }), null, 16),
1338
- u(Yo, tt(ot(e(n))), null, 16),
1339
- u(fo, Pe(e(_), {
1340
- onSubmitted: i[2] || (i[2] = (A) => e(a).fetchTemplates())
1341
- }), null, 16)
1342
- ]))
1343
- ], 64);
1344
- };
1345
- }
1346
- });
1347
- export {
1348
- _s as default
1349
- };