@feedmepos/mf-inventory-portal 0.0.22-dev.7 → 0.0.22-dev.9

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