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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/App.vue.d.ts +2 -0
  2. package/dist/{ApprovalView-D7WEr35k.js → ApprovalView-CCYykhrK.js} +14 -14
  3. package/dist/{BindingsDialog-C-3uO6pD.js → BindingsDialog-33VV_AST.js} +1 -1
  4. package/dist/{BindingsPicker-B3tGisCE.js → BindingsPicker-BKu4vN8J.js} +8 -8
  5. package/dist/{BindingsTable-CPtiH3vj.js → BindingsTable-Dd0h5gDf.js} +1 -1
  6. package/dist/ClosingTemplateView-BhevjTLl.js +1067 -0
  7. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ohHZLOuR.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-3gp56NNJ.js} +14 -16
  8. package/dist/{IngredientsView-D-EKGLq9.js → IngredientsView-DckIH9eR.js} +5 -6
  9. package/dist/{IntegrationView-BVAO_vch.js → IntegrationView-BqQ4jRIp.js} +2 -2
  10. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CJYmB7Ct.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Vi0q_bDz.js} +1 -1
  11. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BxkM-SOw.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BIL8LWRz.js} +1 -1
  12. package/dist/{PurchaseOrderPrintPreview-CP-mK62z.js → PurchaseOrderPrintPreview-Ct7daTTa.js} +1 -1
  13. package/dist/{ReceiveRequestView-x8WTvuDk.js → ReceiveRequestView-B4wHTogG.js} +25 -26
  14. package/dist/RecipeView-DuE4cXLz.js +590 -0
  15. package/dist/Standalone.vue.d.ts +2 -0
  16. package/dist/{StockView-SyWxT4Ee.js → StockView-Bn9v2Ix8.js} +602 -585
  17. package/dist/{SupplierView-a0HAZJau.js → SupplierView-C8rqHSOV.js} +37 -37
  18. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CStnY5Zh.js +851 -0
  19. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DRKiv_t8.js +1511 -0
  20. package/dist/TransferTemplateView-RM6Y-WL4.js +1209 -0
  21. package/dist/{UnitView-B3c7W5lw.js → UnitView-BXISVrop.js} +4 -4
  22. package/dist/{WarehouseView-DDV-yslF.js → WarehouseView-B055eB90.js} +18 -18
  23. package/dist/api/closing-template.d.ts +14 -0
  24. package/dist/api/inventory.d.ts +5 -7
  25. package/dist/api/netsuite.d.ts +46 -0
  26. package/dist/api/purchase-order-template.d.ts +0 -4
  27. package/dist/{app-DURkcZal.js → app-9algzyce.js} +16045 -15403
  28. package/dist/app.d.ts +6 -0
  29. package/dist/app.js +2 -2
  30. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  31. package/dist/components/FmUnitInputRules.d.ts +2 -0
  32. package/dist/{decimal-BGJlFDm8.js → decimal-CMuMGm4y.js} +1 -1
  33. package/dist/{defineDeepModel-pATZSiCT.js → defineDeepModel-CjPowyho.js} +1 -1
  34. package/dist/extensions/promises.d.ts +14 -0
  35. package/dist/{format-time-from-id-BCAuJEq2.js → format-time-from-id-DNKcbBFm.js} +1 -1
  36. package/dist/helper/date2.d.ts +1 -0
  37. package/dist/helper/rules.d.ts +7 -0
  38. package/dist/helper/rules.spec.d.ts +1 -0
  39. package/dist/{id-to-date-CVHmTOJk.js → id-to-date-C6W4aVdr.js} +1 -1
  40. package/dist/purchase-order-transaction-type-CscRvNAR.js +680 -0
  41. package/dist/stores/api.d.ts +1 -0
  42. package/dist/stores/feature.d.ts +0 -1
  43. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  44. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  45. package/dist/stores/inventory.d.ts +7 -0
  46. package/dist/stores/location.d.ts +24 -42
  47. package/dist/stores/netsuite.d.ts +56 -0
  48. package/dist/stores/route.d.ts +0 -5
  49. package/dist/stores/warehouse.d.ts +4 -7
  50. package/dist/style.css +1 -1
  51. package/dist/{supplier-DmBbGAwf.js → supplier-BiCX3dpL.js} +1 -1
  52. package/dist/tsconfig.app.tsbuildinfo +1 -1
  53. package/dist/use-template-enabled-locations-2-Dtg2qOTm.js +85 -0
  54. package/dist/views/closing-template/components/closing-template-publish/ClosingTemplatePublish.vue.d.ts +6 -0
  55. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +276 -84
  56. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +341 -85
  57. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  58. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +916 -0
  59. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  60. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +788 -152
  61. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +800 -164
  62. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  63. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -7
  64. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +2 -2
  65. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1285 -109
  66. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +399 -993
  67. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +345 -0
  68. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
  69. package/dist/{xlsx-1DLm6bBD.js → xlsx-fKJqx2Qc.js} +1 -1
  70. package/dist/{xlsx.util-DLtch7r5.js → xlsx.util-LOnzE3KS.js} +2 -2
  71. package/package.json +5 -5
  72. package/dist/ClosingTemplateView-Df0lgpjS.js +0 -928
  73. package/dist/RecipeView-BysIWI1W.js +0 -581
  74. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-ckp8gcT_.js +0 -740
  75. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BSvpuWY9.js +0 -1409
  76. package/dist/TransferTemplateView-BGi6zd6d.js +0 -1350
  77. package/dist/array-ClJzD_Lt.js +0 -30
  78. package/dist/layout/InventoryLayout.vue.d.ts +0 -2
  79. package/dist/layout/layout-routes.d.ts +0 -6
  80. package/dist/purchase-order-transaction-type-DvSpCSXr.js +0 -712
  81. package/dist/use-template-enabled-locations-BiuOdu1M.js +0 -57
@@ -1,1350 +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-ohHZLOuR.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-DvSpCSXr.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-DURkcZal.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-pATZSiCT.js";
10
- import { c as He, _ as Tt } from "./TransferDialog.vue_vue_type_script_setup_true_lang-BSvpuWY9.js";
11
- import { useRouter as Ct } from "vue-router";
12
- import { u as $t } from "./supplier-DmBbGAwf.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-BxkM-SOw.js";
15
- import { u as Ye } from "./use-template-enabled-locations-BiuOdu1M.js";
16
- import { f as Mt } from "./format-time-from-id-BCAuJEq2.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
- virtualScroll: !0
676
- },
677
- primaryActions: {
678
- text: _("common.confirm"),
679
- close: !0
680
- },
681
- secondaryActions: {
682
- text: _("common.close"),
683
- close: !0,
684
- variant: "tertiary"
685
- }
686
- }).onPrimary((r) => {
687
- const m = l.purchaseOrder.items ?? [], i = r.map((b) => {
688
- const A = m.find((B) => B.sku._id === b._id);
689
- if (A)
690
- return A;
691
- const $ = { amount: 1, precision: de(b.unit) }, k = {
692
- sku: b,
693
- code: b.code,
694
- name: b.name,
695
- quantity: $,
696
- minimumQuantity: $,
697
- maximumQuantity: $,
698
- quantityStep: $
699
- };
700
- return k.totalCost = He(
701
- k.sku,
702
- k.quantity,
703
- k.measurement,
704
- {
705
- supplier: l.purchaseOrder.supplier
706
- }
707
- ), k;
708
- });
709
- i.sort((b, A) => b.sku.code.localeCompare(A.sku.code)), l.purchaseOrder.items = i;
710
- });
711
- }
712
- return (o, t) => {
713
- 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");
714
- return w(), N(j, {
715
- ref_key: "formRef",
716
- ref: g,
717
- class: "flex flex-col gap-32",
718
- disabled: o.disabled
719
- }, {
720
- default: D(() => [
721
- s("div", to, [
722
- F.value ? (w(), P("div", oo, [
723
- u(r, {
724
- label: "Business template",
725
- compact: ""
726
- })
727
- ])) : H("", !0),
728
- s("div", so, [
729
- u(m, {
730
- label: e(_)("inventory.transfer.form.name"),
731
- "label-mark": "required",
732
- modelValue: e(l).name,
733
- "onUpdate:modelValue": t[0] || (t[0] = (x) => e(l).name = x),
734
- rules: [e(be)()]
735
- }, null, 8, ["label", "modelValue", "rules"]),
736
- u(m, {
737
- label: e(_)("inventory.transfer.form.reference"),
738
- "label-mark": "optional",
739
- modelValue: e(l).purchaseOrder.ref,
740
- "onUpdate:modelValue": t[1] || (t[1] = (x) => e(l).purchaseOrder.ref = x)
741
- }, null, 8, ["label", "modelValue"]),
742
- u(i, {
743
- label: e(_)("inventory.transfer.form.remark"),
744
- "label-mark": "optional",
745
- "max-length": 240,
746
- modelValue: v.value,
747
- "onUpdate:modelValue": t[2] || (t[2] = (x) => v.value = x),
748
- class: me({ "text-fm-color-typo-disabled": o.disabled })
749
- }, null, 8, ["label", "modelValue", "class"])
750
- ])
751
- ]),
752
- e(c).businessLevel ? (w(), P("div", no, [
753
- u(b, {
754
- modelValue: e(M),
755
- "onUpdate:modelValue": t[3] || (t[3] = (x) => xe(M) ? M.value = x : null),
756
- label: "Locations rule",
757
- sublabel: "Enable template for specific locations only",
758
- "label-placement": "right"
759
- }, null, 8, ["modelValue"]),
760
- e(M) ? (w(), N(B, {
761
- key: 0,
762
- modelValue: e(S),
763
- rules: [e(Ne)(1)],
764
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
765
- }, {
766
- default: D(() => [
767
- u(k, null, {
768
- default: D(() => [
769
- (w(!0), P(ce, null, ve(e(S), (x) => (w(), N($, {
770
- key: x.doc._id,
771
- label: x.name,
772
- sublabel: x.type,
773
- disabled: o.disabled
774
- }, {
775
- append: D(() => [
776
- u(A, {
777
- "prepend-icon": "delete",
778
- variant: "tertiary",
779
- disabled: o.disabled,
780
- onClick: (Q) => e(h)(x.doc._id)
781
- }, null, 8, ["disabled", "onClick"])
782
- ]),
783
- _: 2
784
- }, 1032, ["label", "sublabel", "disabled"]))), 128))
785
- ]),
786
- _: 1
787
- })
788
- ]),
789
- _: 1
790
- }, 8, ["modelValue", "rules"])) : H("", !0),
791
- e(M) ? (w(), P("div", lo, [
792
- u(A, {
793
- disabled: o.disabled,
794
- label: e(_)("inventory.transfer.form.items.addItem"),
795
- "prepend-icon": "add",
796
- variant: "plain",
797
- class: "border-2 rounded-lg border-fm-color-primary",
798
- onClick: e(I)
799
- }, null, 8, ["disabled", "label", "onClick"])
800
- ])) : H("", !0)
801
- ])) : H("", !0),
802
- s("div", ao, [
803
- s("div", ro, [
804
- s("div", io, T(e(_)("inventory.transfer.form.items.title")), 1),
805
- u(A, {
806
- disabled: o.disabled,
807
- label: e(_)("inventory.transfer.form.items.addItem"),
808
- "prepend-icon": "add",
809
- variant: "plain",
810
- class: "border-2 rounded-lg border-fm-color-primary",
811
- onClick: t[4] || (t[4] = (x) => p()),
812
- size: "md"
813
- }, null, 8, ["disabled", "label"])
814
- ]),
815
- (w(), N(z, {
816
- "column-defs": q.value,
817
- "row-data": e(l).purchaseOrder.items,
818
- key: e(l).purchaseOrder.items.map((x) => x.sku._id).join("."),
819
- "hide-footer": ""
820
- }, {
821
- "list-row": D((x) => [
822
- (w(), N(Ge, {
823
- row: x,
824
- key: e(l).purchaseOrder.items.map((Q) => Q.sku._id).join(".")
825
- }, {
826
- default: D((Q) => [
827
- u(eo, {
828
- row: x,
829
- "cell-by-col-id": Q
830
- }, null, 8, ["row", "cell-by-col-id"])
831
- ]),
832
- _: 2
833
- }, 1032, ["row"]))
834
- ]),
835
- _: 1
836
- }, 8, ["column-defs", "row-data"]))
837
- ])
838
- ]),
839
- _: 1
840
- }, 8, ["disabled"]);
841
- };
842
- }
843
- }), mo = { class: "flex items-center" }, co = { class: "fm-typo-en-title-md-800" }, po = { class: "flex gap-4" }, fo = /* @__PURE__ */ J({
844
- __name: "TransferTemplateDialog",
845
- props: {
846
- mode: {},
847
- modelValue: {},
848
- show: { type: Boolean }
849
- },
850
- emits: ["update:show", "submitted"],
851
- setup(f, { expose: y, emit: d }) {
852
- var o;
853
- const l = f, _ = d, c = at(), n = wt(), { t: a } = X(), F = je(l, "show");
854
- function L() {
855
- return {
856
- _id: "",
857
- name: "",
858
- purchaseOrder: {
859
- remark: void 0,
860
- ref: void 0,
861
- stockSnapshotId: void 0,
862
- effectiveAt: void 0,
863
- items: [],
864
- supplier: {
865
- _rev: void 0,
866
- email: void 0,
867
- internal: void 0,
868
- contactName: void 0,
869
- phoneNumber: void 0,
870
- registrationNumber: void 0,
871
- supplyItems: void 0,
872
- _id: "",
873
- name: "",
874
- address: {
875
- line2: void 0,
876
- line1: "",
877
- state: "",
878
- city: "",
879
- postcode: "",
880
- country: ""
881
- }
882
- }
883
- }
884
- };
885
- }
886
- const S = U(l.modelValue ?? L()), M = U(((o = l.modelValue) == null ? void 0 : o._id) ?? `${Math.random()}`);
887
- fe(
888
- () => l.show,
889
- (t) => {
890
- var r;
891
- t && (S.value = l.modelValue ?? L(), M.value = ((r = l.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
892
- }
893
- );
894
- const I = U(!1), h = O(() => {
895
- switch (l.mode) {
896
- case ne.READ:
897
- return "";
898
- case ne.CREATE:
899
- return a("inventory.transfer.template.create.title");
900
- case ne.UPDATE:
901
- return a("inventory.transfer.template.update.title");
902
- }
903
- return "";
904
- }), v = U();
905
- y({
906
- validateInputs: () => {
907
- var t, r;
908
- (r = (t = v.value) == null ? void 0 : t.validateInputs) == null || r.call(t);
909
- },
910
- resetInputsValidation: () => {
911
- var t, r;
912
- (r = (t = v.value) == null ? void 0 : t.resetInputsValidation) == null || r.call(t);
913
- },
914
- resetInputs: () => {
915
- var t, r;
916
- (r = (t = v.value) == null ? void 0 : t.resetInputs) == null || r.call(t);
917
- }
918
- });
919
- async function g() {
920
- var r, m;
921
- const t = S.value;
922
- if (t) {
923
- 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(
924
- ({ totalCost: i, ...b }) => b
925
- ));
926
- try {
927
- await c.createTemplate(t), await new Promise((i) => setTimeout(i, 1e3)), n.open({
928
- title: a("inventory.transfer.template.create.success"),
929
- message: a("inventory.transfer.template.create.successMessage"),
930
- type: "success"
931
- }), _("update:show", !1), _("submitted");
932
- } catch (i) {
933
- n.open({
934
- title: a("inventory.transfer.template.create.error"),
935
- message: a("inventory.transfer.template.create.errorMessage"),
936
- type: "error"
937
- }), console.error("Error in creating transfer template", i);
938
- } finally {
939
- I.value = !1;
940
- }
941
- }
942
- }
943
- async function R() {
944
- var r, m;
945
- const t = S.value;
946
- if (t) {
947
- 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(
948
- ({ totalCost: i, ...b }) => b
949
- ));
950
- try {
951
- await c.updateTemplate(t), await new Promise((i) => setTimeout(i, 1e3)), n.open({
952
- title: a("inventory.transfer.template.update.success"),
953
- message: a("inventory.transfer.template.update.successMessage"),
954
- type: "success"
955
- }), _("update:show", !1), _("submitted");
956
- } catch (i) {
957
- n.open({
958
- title: a("inventory.transfer.template.update.error"),
959
- message: a("inventory.transfer.template.update.errorMessage"),
960
- type: "error"
961
- }), console.error("Error in updating transfer template", i);
962
- } finally {
963
- I.value = !1;
964
- }
965
- }
966
- }
967
- function q() {
968
- switch (l.mode) {
969
- case ne.CREATE:
970
- return g();
971
- case ne.UPDATE:
972
- return R();
973
- }
974
- }
975
- function p() {
976
- var t, r;
977
- (r = (t = v.value) == null ? void 0 : t.validateInputs) == null || r.call(t);
978
- }
979
- return (t, r) => {
980
- const m = C("FmButton"), i = C("FmSideSheet");
981
- return w(), N(i, {
982
- modelValue: e(F),
983
- "onUpdate:modelValue": r[2] || (r[2] = (b) => xe(F) ? F.value = b : null),
984
- "dismiss-away": "",
985
- "close-button": "",
986
- "max-width": 1200
987
- }, {
988
- "side-sheet-header": D(() => [
989
- s("div", mo, [
990
- s("div", co, T(h.value), 1)
991
- ])
992
- ]),
993
- default: D(() => [
994
- (w(), N(uo, {
995
- class: "w-full",
996
- ref_key: "formRef",
997
- ref: v,
998
- onValidationSuccess: q,
999
- "model-value": S.value,
1000
- "onUpdate:modelValue": r[0] || (r[0] = (b) => S.value = b),
1001
- disabled: I.value,
1002
- key: M.value
1003
- }, null, 8, ["model-value", "disabled"]))
1004
- ]),
1005
- "side-sheet-footer": D(() => [
1006
- s("div", po, [
1007
- u(m, {
1008
- loading: I.value,
1009
- label: e(a)("common.save"),
1010
- onClick: p
1011
- }, null, 8, ["loading", "label"]),
1012
- u(m, {
1013
- disabled: I.value,
1014
- variant: "tertiary",
1015
- label: e(a)("common.close"),
1016
- onClick: r[1] || (r[1] = (b) => _("update:show", !1))
1017
- }, null, 8, ["disabled", "label"])
1018
- ])
1019
- ]),
1020
- _: 1
1021
- }, 8, ["modelValue"]);
1022
- };
1023
- }
1024
- }), 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 = {
1025
- key: 0,
1026
- class: "flex flex-col gap-4"
1027
- }, 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 = {
1028
- key: 1,
1029
- class: "flex flex-col gap-4"
1030
- }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Do = { class: "fm-typo-en-body-lg-600" }, Lo = {
1031
- key: 2,
1032
- class: "flex flex-col gap-4"
1033
- }, Vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ro = { class: "fm-typo-en-body-lg-600" }, Ao = {
1034
- key: 3,
1035
- class: "flex flex-col gap-4"
1036
- }, 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 = {
1037
- key: 0,
1038
- class: "shrink-0 fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
1039
- }, Go = { class: "flex gap-8 xs:flex-col" }, Yo = /* @__PURE__ */ J({
1040
- __name: "TransferTemplateDetails",
1041
- props: {
1042
- template: {},
1043
- show: { type: Boolean }
1044
- },
1045
- emits: ["update:show", "action:use", "action:edit"],
1046
- setup(f, { emit: y }) {
1047
- const d = f, l = y, _ = he(), c = ge(), { t: n } = X(), a = O(() => {
1048
- var h;
1049
- return (h = d.template) == null ? void 0 : h.purchaseOrder;
1050
- }), { enabledLocations: F } = Ye({
1051
- getLocations() {
1052
- var h;
1053
- return (h = d.template) == null ? void 0 : h.locations;
1054
- },
1055
- setLocations() {
1056
- }
1057
- }), L = O(() => {
1058
- if (!c.businessLevel)
1059
- return [c.currentLocation];
1060
- const h = Array.isArray(F.value) ? F.value : c.locations, v = /* @__PURE__ */ new Set([...h.map((g) => g.doc._id)]);
1061
- return c.locations.filter((g) => v.has(g.doc._id));
1062
- }), S = O(
1063
- () => {
1064
- var h, v, g, R;
1065
- 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;
1066
- }
1067
- ), M = U(!0), I = je(d, "show");
1068
- return (h, v) => {
1069
- var r;
1070
- const g = C("FmMenuDivider"), R = C("FmCard"), q = C("FmButton"), p = C("FmListItem"), o = C("FmList"), t = C("FmSideSheet");
1071
- return w(), N(t, {
1072
- header: e(n)("inventory.transfer.template.details.view", { template: (r = h.template) == null ? void 0 : r.name }),
1073
- modelValue: e(I),
1074
- "onUpdate:modelValue": v[1] || (v[1] = (m) => xe(I) ? I.value = m : null),
1075
- "dismiss-away": M.value,
1076
- "close-button": "",
1077
- "max-width": 500
1078
- }, {
1079
- default: D(() => {
1080
- var m;
1081
- return [
1082
- s("div", yo, [
1083
- s("div", null, [
1084
- u(R, {
1085
- variant: "outlined",
1086
- class: "flex flex-col gap-8 px-12 py-16"
1087
- }, {
1088
- default: D(() => {
1089
- var i, b, A, $, k, B, z, j, x;
1090
- return [
1091
- s("div", vo, [
1092
- s("div", bo, T(e(n)("inventory.transfer.template.details.templateSummary")), 1)
1093
- ]),
1094
- u(g),
1095
- s("div", _o, [
1096
- s("div", xo, [
1097
- s("div", ho, [
1098
- s("div", go, T(e(n)("inventory.transfer.receiveRequest.details.createdAt")), 1)
1099
- ]),
1100
- s("div", ko, T(e(Mt)(((i = h.template) == null ? void 0 : i._id) ?? "")), 1)
1101
- ]),
1102
- (b = a.value) != null && b.effectiveAt ? (w(), P("div", wo, [
1103
- s("div", Fo, T(e(n)("inventory.transfer.receiveRequest.details.backdatedTo")), 1),
1104
- s("div", To, T(e(xt)(new Date((A = a.value) == null ? void 0 : A.effectiveAt))), 1)
1105
- ])) : H("", !0),
1106
- s("div", Co, [
1107
- s("div", $o, T(e(n)("inventory.transfer.receiveRequest.details.type.title")), 1),
1108
- s("div", So, T(e(n)(
1109
- `inventory.transfer.receiveRequest.details.type.${S.value.toLocaleLowerCase("en-US")}`
1110
- )), 1)
1111
- ]),
1112
- (k = ($ = a.value) == null ? void 0 : $.supplier) != null && k.name ? (w(), P("div", Mo, [
1113
- s("div", Io, T(e(n)("inventory.transfer.receiveRequest.details.from")), 1),
1114
- s("div", Do, T((z = (B = a.value) == null ? void 0 : B.supplier) == null ? void 0 : z.name), 1)
1115
- ])) : H("", !0),
1116
- (j = a.value) != null && j.ref ? (w(), P("div", Lo, [
1117
- s("div", Vo, T(e(n)("inventory.transfer.receiveRequest.details.reference")), 1),
1118
- s("div", Ro, T(a.value.ref), 1)
1119
- ])) : H("", !0),
1120
- (x = a.value) != null && x.remark ? (w(), P("div", Ao, [
1121
- s("div", Oo, T(e(n)("inventory.transfer.receiveRequest.details.remark")), 1),
1122
- s("div", Po, T(a.value.remark), 1)
1123
- ])) : H("", !0)
1124
- ])
1125
- ];
1126
- }),
1127
- _: 1
1128
- })
1129
- ]),
1130
- s("div", Bo, [
1131
- s("div", qo, [
1132
- s("div", Uo, T(e(n)("inventory.transfer.receiveRequest.details.requestedItems")), 1),
1133
- (w(!0), P(ce, null, ve(((m = a.value) == null ? void 0 : m.items) ?? [], (i) => (w(), P("div", {
1134
- key: i.code,
1135
- class: "flex flex-col"
1136
- }, [
1137
- s("div", Eo, [
1138
- s("div", No, T(i.name), 1),
1139
- v[2] || (v[2] = s("div", { class: "flex-1 min-w-32" }, null, -1)),
1140
- s("div", zo, T(e(rt)(i.quantity, i.sku.unit, i.measurement)), 1)
1141
- ]),
1142
- s("div", jo, [
1143
- s("div", Qo, T(i.code), 1),
1144
- i.totalCost && e(_).enableTotalCost ? (w(), P("div", Ho, " (" + T(e(ht)(i.totalCost)) + ") ", 1)) : H("", !0)
1145
- ])
1146
- ]))), 128))
1147
- ])
1148
- ]),
1149
- s("div", null, [
1150
- u(R, {
1151
- variant: "outlined",
1152
- class: "flex flex-col"
1153
- }, {
1154
- default: D(() => [
1155
- v[3] || (v[3] = s("div", { class: "flex flex-col p-16" }, [
1156
- s("div", { class: "fm-typo-en-body-lg-600" }, "Enabled locations"),
1157
- s("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Click to use template on the location ")
1158
- ], -1)),
1159
- u(o, null, {
1160
- default: D(() => [
1161
- (w(!0), P(ce, null, ve(L.value, (i) => (w(), N(p, {
1162
- key: i.doc._id,
1163
- label: i.name,
1164
- sublabel: i.type,
1165
- onClick: (b) => l("action:use", i.doc._id)
1166
- }, {
1167
- append: D(() => [
1168
- u(q, {
1169
- "prepend-icon": "chevron_right",
1170
- variant: "tertiary"
1171
- })
1172
- ]),
1173
- _: 2
1174
- }, 1032, ["label", "sublabel", "onClick"]))), 128))
1175
- ]),
1176
- _: 1
1177
- })
1178
- ]),
1179
- _: 1
1180
- })
1181
- ])
1182
- ])
1183
- ];
1184
- }),
1185
- "side-sheet-footer": D(() => [
1186
- s("div", Go, [
1187
- u(q, {
1188
- label: e(n)("common.edit"),
1189
- onClick: v[0] || (v[0] = (m) => l("action:edit")),
1190
- variant: "tertiary"
1191
- }, null, 8, ["label"])
1192
- ])
1193
- ]),
1194
- _: 1
1195
- }, 8, ["header", "modelValue", "dismiss-away"]);
1196
- };
1197
- }
1198
- }), 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({
1199
- __name: "TransferTemplateView",
1200
- setup(f) {
1201
- const { t: y } = X(), { createTemplate: d, viewTemplate: l } = Be(), { templateDialogProps: _, transferFormDialogProps: c, templateDetailsProps: n } = Ft(
1202
- Be()
1203
- ), a = it(), F = st(), L = ge(), S = he(), { breakpoints: M } = ze();
1204
- L.watchLocation(a.fetchTemplates), _e(() => {
1205
- S.mustManageBusinessOnlyPoTemplate && (L.businessLevel = !0);
1206
- }), fe(
1207
- () => {
1208
- var m;
1209
- return (m = c.value) == null ? void 0 : m.show;
1210
- },
1211
- (m) => {
1212
- m === !1 && S.mustManageBusinessOnlyPoTemplate && (L.businessLevel = !0);
1213
- }
1214
- ), Je(() => {
1215
- L.businessLevel = !1;
1216
- });
1217
- const I = O(() => L.businessLevel), h = O(
1218
- () => a.loading.value || !L._currentLocation
1219
- ), v = O(
1220
- () => I.value ? a.businessTemplates.value : a.locationTemplates.value
1221
- ), g = U(""), R = O(() => M.value.xs || M.value.sm), q = O(() => R.value ? 10 : 20);
1222
- function p(m) {
1223
- switch (m) {
1224
- case qe.Add:
1225
- return d();
1226
- }
1227
- }
1228
- const o = Ct();
1229
- function t() {
1230
- o.push({ name: gt.RECEIVE_REQUEST });
1231
- }
1232
- function r(m) {
1233
- return m;
1234
- }
1235
- return (m, i) => {
1236
- const b = C("FmTable");
1237
- return w(), P(ce, null, [
1238
- u(nt, {
1239
- title: e(y)("inventory.transfer.template.title2"),
1240
- actions: [
1241
- {
1242
- label: e(y)("inventory.transfer.template.create.title"),
1243
- value: e(qe).Add,
1244
- isPrimary: !0,
1245
- prependIcon: "add"
1246
- }
1247
- ],
1248
- "onClick:action": p,
1249
- "using-business-helper-text": "You are managing business-level template list. These templates will be made visible to all locations."
1250
- }, {
1251
- default: D(() => {
1252
- var A;
1253
- return [
1254
- s("div", {
1255
- class: me([
1256
- "flex flex-col gap-8 max-h-full",
1257
- {
1258
- "p-0": R.value,
1259
- "px-24 ": !R.value
1260
- }
1261
- ])
1262
- }, [
1263
- u(lt, {
1264
- searchable: "",
1265
- "change-location": !e(S).mustManageBusinessOnlyPoTemplate,
1266
- search: g.value,
1267
- "onUpdate:search": i[0] || (i[0] = ($) => g.value = $),
1268
- actions: [{ icon: "refresh", onClick: e(a).fetchTemplates }],
1269
- "show-business": ""
1270
- }, null, 8, ["change-location", "search", "actions"]),
1271
- (w(), N(b, {
1272
- style: Xe(e(F).tableHeight),
1273
- "column-defs": e(a).columnDefs,
1274
- "row-data": v.value,
1275
- "search-value": g.value,
1276
- loading: h.value,
1277
- key: (A = e(L)._currentLocation) == null ? void 0 : A.dbName,
1278
- onRowClick: i[1] || (i[1] = ($) => e(l)($.original)),
1279
- "page-size": q.value
1280
- }, {
1281
- "list-row": D(($) => [
1282
- u(Ge, {
1283
- row: $,
1284
- onRowClick: (k) => e(l)(k)
1285
- }, {
1286
- default: D((k) => {
1287
- 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;
1288
- return [
1289
- s("div", Wo, [
1290
- s("div", Ko, [
1291
- s("div", Zo, [
1292
- u(e(E), {
1293
- render: (j = (z = (B = k._id) == null ? void 0 : B.column) == null ? void 0 : z.columnDef) == null ? void 0 : j.cell,
1294
- props: (Q = (x = k._id) == null ? void 0 : x.getContext) == null ? void 0 : Q.call(x)
1295
- }, null, 8, ["render", "props"])
1296
- ]),
1297
- s("div", Jo, [
1298
- u(e(E), {
1299
- render: (te = (ee = (Y = k.name) == null ? void 0 : Y.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
1300
- props: (oe = (W = k.name) == null ? void 0 : W.getContext) == null ? void 0 : oe.call(W)
1301
- }, null, 8, ["render", "props"])
1302
- ]),
1303
- s("div", Xo, [
1304
- u(e(E), {
1305
- render: (ke = (se = (K = k.supplier) == null ? void 0 : K.column) == null ? void 0 : se.columnDef) == null ? void 0 : ke.cell,
1306
- props: (we = (le = k.supplier) == null ? void 0 : le.getContext) == null ? void 0 : we.call(le)
1307
- }, null, 8, ["render", "props"])
1308
- ]),
1309
- 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),
1310
- s("div", es, T($.original.purchaseOrder.items.length ? $.original.purchaseOrder.items.map((We) => We.name).join(", ") : "No items"), 1),
1311
- s("div", ts, [
1312
- u(e(E), {
1313
- render: (Se = ($e = (Ce = k.ref) == null ? void 0 : Ce.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Se.cell,
1314
- props: (Me = (ae = k.ref) == null ? void 0 : ae.getContext) == null ? void 0 : Me.call(ae)
1315
- }, null, 8, ["render", "props"])
1316
- ])
1317
- ]),
1318
- s("div", null, [
1319
- u(e(E), {
1320
- render: (Le = (De = (Ie = k.type) == null ? void 0 : Ie.column) == null ? void 0 : De.columnDef) == null ? void 0 : Le.cell,
1321
- props: (Ve = (re = k.type) == null ? void 0 : re.getContext) == null ? void 0 : Ve.call(re)
1322
- }, null, 8, ["render", "props"])
1323
- ])
1324
- ])
1325
- ];
1326
- }),
1327
- _: 2
1328
- }, 1032, ["row", "onRowClick"])
1329
- ]),
1330
- _: 1
1331
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1332
- ], 2)
1333
- ];
1334
- }),
1335
- _: 1
1336
- }, 8, ["title", "actions"]),
1337
- (w(), N(et, { to: "body" }, [
1338
- u(Tt, Pe(e(c), { onSubmitted: t }), null, 16),
1339
- u(Yo, tt(ot(e(n))), null, 16),
1340
- u(fo, Pe(e(_), {
1341
- onSubmitted: i[2] || (i[2] = (A) => e(a).fetchTemplates())
1342
- }), null, 16)
1343
- ]))
1344
- ], 64);
1345
- };
1346
- }
1347
- });
1348
- export {
1349
- _s as default
1350
- };