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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/{ApprovalView-xF73Z1jN.js → ApprovalView-DKqwRFlF.js} +25 -26
  2. package/dist/{BindingsDialog-CCSAxGT4.js → BindingsDialog-CtMSqEuE.js} +9 -9
  3. package/dist/{BindingsPicker-ErFH0uEQ.js → BindingsPicker-DCLNF1PL.js} +22 -22
  4. package/dist/{BindingsTable-D8ffJgIJ.js → BindingsTable-6ndQuHeA.js} +1 -1
  5. package/dist/ClosingTemplateView-BPrDQ_8-.js +1688 -0
  6. package/dist/FmDroppableField-DQFPEiJn.js +152 -0
  7. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BUGB0uk3.js +266 -0
  8. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CM93v-jp.js +359 -0
  9. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-SNp8etCc.js +51 -0
  10. package/dist/IngredientsView-B1jGkWYN.js +1611 -0
  11. package/dist/{IntegrationView-54yz2EqS.js → IntegrationView-Bu0waSjB.js} +71 -71
  12. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CKvKlCk-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-mZQlrYaY.js} +1 -1
  13. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-BEFmqnHk.js +116 -0
  14. package/dist/{PurchaseOrderPrintPreview-pcpWSfl4.js → PurchaseOrderPrintPreview-DTQViYuX.js} +7 -7
  15. package/dist/ReceiveRequestView-CNRixgQu.js +4069 -0
  16. package/dist/RecipeView-HStPC5pE.js +591 -0
  17. package/dist/Standalone.vue.d.ts +2 -0
  18. package/dist/StockView-JO3NtkX9.js +7762 -0
  19. package/dist/{SupplierView-TYCkPXan.js → SupplierView-gtaS4K3U.js} +111 -111
  20. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-dPt3qbcX.js +1146 -0
  21. package/dist/TransferTemplateView-C0pjLfbz.js +2054 -0
  22. package/dist/{UnitView-B9yE4-rc.js → UnitView-dbInWUk4.js} +18 -18
  23. package/dist/{WarehouseView-DUtVLTjb.js → WarehouseView-BlTBvLF0.js} +176 -177
  24. package/dist/api/bill.d.ts +84 -238
  25. package/dist/api/closing-template.d.ts +6 -4
  26. package/dist/api/inventory.d.ts +72 -85
  27. package/dist/api/netsuite.d.ts +47 -0
  28. package/dist/api/purchase-order-template.d.ts +4 -6
  29. package/dist/{app-w8TOQVZc.js → app-TB3IWuaU.js} +24520 -23671
  30. package/dist/app.d.ts +7 -0
  31. package/dist/app.js +3 -3
  32. package/dist/components/FmFilterableMenuOptions.vue.d.ts +54 -0
  33. package/dist/components/FmMinMaxInputRules.d.ts +2 -0
  34. package/dist/components/FmUnitInputRules.d.ts +2 -0
  35. package/dist/components/map/GoogleMap.vue.d.ts +4 -4
  36. package/dist/{decimal-C4q7UMfr.js → decimal-BRAYgPnN.js} +1 -1
  37. package/dist/defineDeepModel-DrEk5Fhq.js +13 -0
  38. package/dist/format-time-from-id-kpVYfVQb.js +15 -0
  39. package/dist/helper/rules.d.ts +7 -0
  40. package/dist/helper/rules.spec.d.ts +1 -0
  41. package/dist/helper/xlsx.util.d.ts +7 -0
  42. package/dist/purchase-order-transaction-type-ZMNa__2l.js +348 -0
  43. package/dist/stores/api.d.ts +1 -0
  44. package/dist/stores/feature.d.ts +0 -1
  45. package/dist/stores/helper/core-store-proxy.d.ts +3 -0
  46. package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
  47. package/dist/stores/inventory.d.ts +85 -0
  48. package/dist/stores/location.d.ts +508 -503
  49. package/dist/stores/netsuite.d.ts +69 -0
  50. package/dist/stores/route.d.ts +0 -5
  51. package/dist/stores/supplier.d.ts +120 -3
  52. package/dist/style.css +1 -1
  53. package/dist/supplier-CJcqHpaM.js +70 -0
  54. package/dist/tsconfig.app.tsbuildinfo +1 -1
  55. package/dist/use-template-enabled-locations-2-DyD24laW.js +85 -0
  56. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
  57. package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
  58. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +1093 -1026
  59. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +1098 -1037
  60. package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
  61. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +2 -2
  62. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  63. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +45 -0
  64. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +1944 -82
  65. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
  66. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +2351 -284
  67. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +2300 -233
  68. package/dist/views/recipe/composables/use-recipe-form.d.ts +2 -2
  69. package/dist/views/stock/components/StockRecordCard.vue.d.ts +42 -119
  70. package/dist/views/stock/composables/use-stock-action.d.ts +2 -2
  71. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +0 -2
  72. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +0 -1
  73. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
  74. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +71 -85
  75. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +39 -2
  76. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImport.vue.d.ts +2 -0
  77. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItem.vue.d.ts +12 -0
  78. package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +9 -0
  79. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1263 -1466
  80. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +1688 -897
  81. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +76 -0
  82. package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +1 -0
  83. package/dist/views/transfer-template/helpers/template-item.error.helper.d.ts +1 -0
  84. package/dist/views/unit/composables/use-unit-form.d.ts +2 -2
  85. package/dist/{xlsx-BggStaH1.js → xlsx-Dd5ckm6-.js} +1525 -1525
  86. package/dist/xlsx.util-qlqvEcJz.js +78 -0
  87. package/package.json +7 -5
  88. package/dist/ClosingTemplateView-DdZlX1ug.js +0 -1030
  89. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ZYtBNoaE.js +0 -372
  90. package/dist/IngredientsView-DnwwQJTN.js +0 -1758
  91. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-Bom_KvXW.js +0 -88
  92. package/dist/ReceiveRequestView-D5HXMY4Z.js +0 -215
  93. package/dist/RecipeView-BHkTgm5H.js +0 -581
  94. package/dist/StockView-iczCFYxn.js +0 -1892
  95. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-EN3JgHKF.js +0 -740
  96. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DC0Ss5hi.js +0 -1409
  97. package/dist/TransferTemplateView-Bbvpuys7.js +0 -1230
  98. package/dist/defineDeepModel-BOApqV24.js +0 -13
  99. package/dist/format-time-from-id-Cafjo8fn.js +0 -15
  100. package/dist/id-to-date-CtSHSVJF.js +0 -30
  101. package/dist/layout/layout-routes.d.ts +0 -6
  102. package/dist/purchase-order-transaction-type-CIC5h-6x.js +0 -712
  103. package/dist/supplier-CM-vZ4bQ.js +0 -69
  104. package/dist/use-template-enabled-locations-Bm00vEzC.js +0 -57
  105. package/dist/xlsx.util-CqlYZLKW.js +0 -109
  106. /package/dist/{layout/InventoryLayout.vue.d.ts → views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts} +0 -0
@@ -1,1030 +0,0 @@
1
- import { ref as V, h as U, computed as A, defineComponent as K, openBlock as x, createElementBlock as P, createElementVNode as g, toDisplayString as I, createVNode as _, unref as i, Fragment as X, renderList as xe, resolveComponent as F, createBlock as E, withCtx as M, isRef as ke, createCommentVNode as ve, watch as Pe, createTextVNode as ye, normalizeClass as Me, normalizeStyle as Ae, Teleport as Ve, normalizeProps as Ie, guardReactiveProps as Ue, mergeProps as Ee } from "vue";
2
- import { u as Re, _ as Ne, a as Le } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ZYtBNoaE.js";
3
- import { useCoreStore as Be, useI18n as O } from "@feedmepos/mf-common";
4
- import { useDialog as Z, useSnackbar as ee, FmButtonVariant as he, components as j, useProxiedModel as ze, useBreakpoints as Ye } from "@feedmepos/ui-library";
5
- import { defineStore as Te, storeToRefs as je } from "pinia";
6
- import { F as L, D as _e, R as B } from "./row-action.enum-PMKMRrZR.js";
7
- import { n as Ke, c as $e, j as Ce, u as He, R as Je, A as qe, y as Ge, i as Oe, Q as we } from "./app-w8TOQVZc.js";
8
- import { c as Qe, F as z, _ as De } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
9
- import { f as We } from "./format-time-from-id-Cafjo8fn.js";
10
- import "vue-router";
11
- import { d as Xe } from "./defineDeepModel-BOApqV24.js";
12
- import { u as Ze } from "./use-template-enabled-locations-Bm00vEzC.js";
13
- const Q = Ke((p, b) => {
14
- function v() {
15
- var t;
16
- return `business_${((t = Be().currentBusiness.value) == null ? void 0 : t._id) ?? ""}`;
17
- }
18
- return {
19
- async getRecentPublishingJob() {
20
- const e = v(), s = `${p.inventoryBackendUrl}/${e}/closing-template/publish/recent`;
21
- return b.get(s);
22
- },
23
- async startNewPublish() {
24
- const e = v(), s = `${p.inventoryBackendUrl}/${e}/closing-template/publish`;
25
- return b.post(s);
26
- },
27
- async getTemplate(e) {
28
- const s = v(), t = `${p.inventoryBackendUrl}/${s}/closing-template/${e}`;
29
- return b.get(t);
30
- },
31
- async readTemplates() {
32
- const e = v(), s = `${p.inventoryBackendUrl}/${e}/closing-template`;
33
- return b.get(s);
34
- },
35
- async createTemplate(e) {
36
- const s = v(), t = `${p.inventoryBackendUrl}/${s}/closing-template`;
37
- return b.post(t, e);
38
- },
39
- async updateTemplate(e) {
40
- const s = v(), t = `${p.inventoryBackendUrl}/${s}/closing-template`;
41
- return b.put(t, e);
42
- },
43
- async deleteTemplate(e) {
44
- const s = v(), t = `${p.inventoryBackendUrl}/${s}/closing-template`;
45
- return b.delete(t, { _id: e._id, _rev: e._rev });
46
- }
47
- };
48
- }), W = Te("closingTemplateActions", () => {
49
- const p = Z(), b = ee(), v = Q(), e = V({});
50
- function s() {
51
- e.value = {
52
- mode: L.CREATE,
53
- show: !0,
54
- "onUpdate:show"(c) {
55
- e.value.show = c;
56
- }
57
- };
58
- }
59
- function t(c) {
60
- e.value = {
61
- mode: L.UPDATE,
62
- modelValue: c,
63
- show: !0,
64
- "onUpdate:show"(f) {
65
- e.value.show = f;
66
- }
67
- };
68
- }
69
- function y(c, f, h) {
70
- p.open({
71
- title: `Confirm deleting template ${c.name}?`,
72
- message: "Deleted template can no longer be retrieved",
73
- primaryActions: {
74
- text: "Delete",
75
- variant: he.Destructive,
76
- close: !0
77
- },
78
- secondaryActions: {
79
- text: "Cancel",
80
- variant: he.Plain,
81
- close: !0
82
- }
83
- }).onPrimary(async () => {
84
- b.open({
85
- title: `Deleting ${c.name}`,
86
- type: "info"
87
- });
88
- try {
89
- f.value = !0;
90
- const [d] = await Promise.allSettled([
91
- v.deleteTemplate(c),
92
- new Promise((w) => setTimeout(w, 1e3))
93
- ]);
94
- if (d.status === "rejected") throw d.reason;
95
- b.open({
96
- title: `Deleted ${c.name}`,
97
- type: "success"
98
- });
99
- } catch (d) {
100
- b.open({
101
- title: `Unable to delete ${c.name}`,
102
- message: `See error from server: ${d}`,
103
- type: "error"
104
- }), console.error("error on deleting closing template", d);
105
- } finally {
106
- f.value = !1, h();
107
- }
108
- });
109
- }
110
- const o = V({});
111
- function n(c) {
112
- o.value = {
113
- template: c,
114
- show: !0,
115
- "onUpdate:show"(f) {
116
- o.value.show = f;
117
- },
118
- "onAction:edit"() {
119
- o.value.show = !1, t($e(c));
120
- }
121
- };
122
- }
123
- return {
124
- createTemplate: s,
125
- viewTemplate: n,
126
- updateTemplate: t,
127
- deleteTemplate: y,
128
- templateDialogProps: e,
129
- templateDetailsProps: o
130
- };
131
- }), Se = Te(
132
- "closingTable",
133
- function() {
134
- const { t: b } = O(), { viewTemplate: v, updateTemplate: e, deleteTemplate: s } = W(), t = V({}), y = V(new Array()), o = V(!1), n = Ce(), c = Q();
135
- async function f() {
136
- if (y.value = [], !!n._currentLocation) {
137
- o.value = !0;
138
- try {
139
- const [m, l] = await Promise.all([
140
- c.readTemplates(),
141
- c.getRecentPublishingJob()
142
- ]).delayed(1e3);
143
- y.value = m, t.value = l;
144
- } catch (m) {
145
- console.log("Something went wrong when fetching templates:", m);
146
- } finally {
147
- o.value = !1;
148
- }
149
- }
150
- }
151
- async function h(m) {
152
- if (!y.value.find((l) => l._id) && n._currentLocation) {
153
- o.value = !0;
154
- try {
155
- const [l] = await Promise.all([
156
- c.getTemplate(m),
157
- new Promise((u) => setTimeout(u, 1e3))
158
- ]);
159
- y.value = [l];
160
- } catch (l) {
161
- console.log("Something went wrong when fetching templates:", l);
162
- } finally {
163
- o.value = !1;
164
- }
165
- }
166
- }
167
- function d(m, l) {
168
- switch (l = $e(l), m) {
169
- case B.Details:
170
- return v(l);
171
- case B.Edit:
172
- return e(l);
173
- case B.Delete:
174
- return s(l, o, f);
175
- }
176
- }
177
- return {
178
- columnDefs: [
179
- {
180
- id: "_id",
181
- accessorKey: "_id",
182
- header: () => b("inventory.closing.table.createdAt"),
183
- cell(m) {
184
- return We(`${m.getValue()}`);
185
- },
186
- enableSorting: !0
187
- },
188
- {
189
- id: "name",
190
- accessorKey: "name",
191
- header: () => b("inventory.closing.table.name"),
192
- enableSorting: !0,
193
- size: 200
194
- },
195
- {
196
- id: "noOfItems",
197
- accessorKey: "items.length",
198
- header: () => b("inventory.closing.table.noOfItems"),
199
- enableSorting: !1,
200
- meta: {
201
- width: "10rem",
202
- textAlign: "right"
203
- }
204
- },
205
- {
206
- id: "enabledLocations",
207
- accessorKey: "locations.length",
208
- header: () => "Enabled outlets",
209
- cell(m) {
210
- var u;
211
- const l = (u = m.row.original.locations) == null ? void 0 : u.length;
212
- return l ? `${l}` : "All";
213
- },
214
- enableSorting: !1,
215
- meta: {
216
- width: "10rem",
217
- textAlign: "right"
218
- }
219
- },
220
- {
221
- id: "ref",
222
- accessorKey: "ref",
223
- header: () => b("inventory.closing.table.reference"),
224
- enableSorting: !1,
225
- size: "auto"
226
- },
227
- {
228
- id: "status",
229
- header: () => "Status",
230
- enableSorting: !1,
231
- cell(m) {
232
- var D;
233
- const l = m.row.original, u = l._rev, k = (D = t.value.publishedRevs) == null ? void 0 : D[l._id];
234
- return u === k ? U(
235
- j.FmChip,
236
- {
237
- class: "fm-chip-success-secondary",
238
- compact: !0
239
- },
240
- "Published"
241
- ) : U(
242
- j.FmChip,
243
- {
244
- class: "fm-chip-info-secondary",
245
- compact: !0
246
- },
247
- "Unpublished"
248
- );
249
- }
250
- },
251
- {
252
- id: "action",
253
- cell(m) {
254
- const l = m.row.original, u = [
255
- _e[B.Edit],
256
- _e[B.Delete]
257
- ];
258
- return Qe(u, (k) => d(k, l));
259
- },
260
- enableSorting: !1,
261
- size: 40,
262
- meta: {
263
- cellClass: "",
264
- headerClass: ""
265
- }
266
- }
267
- ],
268
- recentPublish: t,
269
- templates: y,
270
- loading: o,
271
- fetchTemplates: f,
272
- loadTemplate: h
273
- };
274
- }
275
- );
276
- var Y = /* @__PURE__ */ ((p) => (p.Name = "Name", p.Unit = "Unit", p.Delete = "Delete", p))(Y || {});
277
- function et(p) {
278
- return {
279
- columnDefs: A(() => {
280
- const v = p.items.map((s) => s.sku.unit.measurements.length).reduce((s, t) => s + t, -1);
281
- return [
282
- {
283
- id: "Name",
284
- header: () => "Name",
285
- enableSorting: !1,
286
- size: 400,
287
- cell(s) {
288
- const t = s.row.original;
289
- return U(
290
- "div",
291
- {
292
- class: "flex flex-col"
293
- },
294
- [
295
- U(
296
- "span",
297
- { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1" },
298
- t.sku.name
299
- ),
300
- U(
301
- "span",
302
- { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
303
- t.sku.code
304
- )
305
- ]
306
- );
307
- }
308
- },
309
- {
310
- id: "Unit",
311
- header: () => "Enable unit",
312
- enableSorting: !1,
313
- size: "auto",
314
- cell(s) {
315
- var y, o;
316
- const t = s.row.original;
317
- return U(j.FmCheckbox, {
318
- label: t.sku.unit.abbrev,
319
- value: t.sku.unit._id,
320
- modelValue: !((y = t.disabledMeasurements) != null && y.includes(t.sku.unit._id)),
321
- disabled: p.disabled || !((o = t.disabledMeasurements) != null && o.includes(t.sku.unit._id)) && t.sku.unit.measurements.every((n) => {
322
- var c;
323
- return (c = t.disabledMeasurements) == null ? void 0 : c.includes(n.id);
324
- }),
325
- "onUpdate:modelValue"(n) {
326
- var c;
327
- if (n)
328
- p.updateItem({
329
- ...t,
330
- disabledMeasurements: (c = t.disabledMeasurements) == null ? void 0 : c.filter(
331
- (f) => f !== t.sku.unit._id
332
- )
333
- });
334
- else {
335
- const f = t.disabledMeasurements ?? [];
336
- p.updateItem({
337
- ...t,
338
- disabledMeasurements: [...f, t.sku.unit._id]
339
- });
340
- }
341
- }
342
- });
343
- }
344
- },
345
- ...Array.from({ length: Math.max(v, 0) }).map(
346
- (s, t) => ({
347
- id: `measurement${t}`,
348
- header: () => "",
349
- enableSorting: !1,
350
- size: "auto",
351
- cell(y) {
352
- var c, f, h;
353
- const o = y.row.original, n = o.sku.unit.measurements[t];
354
- return n ? U(j.FmCheckbox, {
355
- label: n.abbrev,
356
- value: n.id,
357
- modelValue: !((c = o.disabledMeasurements) != null && c.includes(n.id)),
358
- disabled: p.disabled || !((f = o.disabledMeasurements) != null && f.includes(n.id)) && ((h = o.disabledMeasurements) == null ? void 0 : h.includes(o.sku.unit._id)) && o.sku.unit.measurements.filter((d) => d.id != n.id).every((d) => {
359
- var w;
360
- return (w = o.disabledMeasurements) == null ? void 0 : w.includes(d.id);
361
- }),
362
- "onUpdate:modelValue"(d) {
363
- var w;
364
- if (d)
365
- p.updateItem({
366
- ...o,
367
- disabledMeasurements: (w = o.disabledMeasurements) == null ? void 0 : w.filter(
368
- (m) => m !== n.id
369
- )
370
- });
371
- else {
372
- const m = o.disabledMeasurements ?? [];
373
- p.updateItem({
374
- ...o,
375
- disabledMeasurements: [...m, n.id]
376
- });
377
- }
378
- }
379
- }) : null;
380
- }
381
- })
382
- ),
383
- {
384
- id: "Delete",
385
- header: "",
386
- cell(s) {
387
- const t = s.row.original;
388
- return U(
389
- "div",
390
- { class: "w-full flex justify-end" },
391
- U(j.FmButton, {
392
- class: "delete-button",
393
- key: t.sku._id,
394
- type: "button",
395
- icon: "delete",
396
- variant: "tertiary",
397
- size: "md",
398
- disabled: p.disabled,
399
- onClick: () => {
400
- p.deleteItem(t);
401
- }
402
- })
403
- );
404
- },
405
- enableSorting: !1,
406
- size: 40,
407
- meta: {
408
- cellClass: "",
409
- headerClass: ""
410
- }
411
- }
412
- ];
413
- })
414
- };
415
- }
416
- const tt = { class: "flex flex-col gap-16 py-12" }, lt = { class: "flex" }, st = { class: "flex-1 flex flex-col" }, ot = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, nt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, at = { class: "flex flex-col gap-4" }, it = /* @__PURE__ */ K({
417
- __name: "ClosingTemplateItem",
418
- props: {
419
- cellByColId: {},
420
- row: {}
421
- },
422
- setup(p) {
423
- const b = p, v = A(() => b.row), e = A(
424
- () => v.value.getVisibleCells().filter((s) => s.column.id !== Y.Name && s.column.id !== Y.Delete)
425
- );
426
- return (s, t) => {
427
- var y, o, n, c, f;
428
- return x(), P("div", tt, [
429
- g("div", lt, [
430
- g("div", st, [
431
- g("div", ot, I(v.value.original.sku.name), 1),
432
- g("div", nt, I(v.value.original.sku.code), 1)
433
- ]),
434
- g("div", null, [
435
- _(i(z), {
436
- render: (n = (o = (y = s.cellByColId[i(Y).Delete]) == null ? void 0 : y.column) == null ? void 0 : o.columnDef) == null ? void 0 : n.cell,
437
- props: (f = (c = s.cellByColId[i(Y).Delete]) == null ? void 0 : c.getContext) == null ? void 0 : f.call(c)
438
- }, null, 8, ["render", "props"])
439
- ])
440
- ]),
441
- g("div", at, [
442
- t[0] || (t[0] = g("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, "Enabled units", -1)),
443
- (x(!0), P(X, null, xe(e.value, (h) => {
444
- var d, w, m;
445
- return x(), P("div", {
446
- key: h.id
447
- }, [
448
- _(i(z), {
449
- render: (w = (d = h.column) == null ? void 0 : d.columnDef) == null ? void 0 : w.cell,
450
- props: (m = h.getContext) == null ? void 0 : m.call(h)
451
- }, null, 8, ["render", "props"])
452
- ]);
453
- }), 128))
454
- ])
455
- ]);
456
- };
457
- }
458
- }), rt = { class: "flex flex-col gap-16" }, ct = { class: "flex flex-col gap-24" }, ut = { class: "p-16 border border-fm-color-neutral-gray-300 fm-corner-radius-md flex flex-col gap-16" }, dt = { key: 1 }, mt = { class: "flex flex-col gap-16" }, pt = { class: "flex items-center" }, ft = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, gt = /* @__PURE__ */ K({
459
- __name: "ClosingTemplateForm",
460
- props: {
461
- modelValue: {},
462
- disabled: { type: Boolean }
463
- },
464
- setup(p, { expose: b }) {
465
- const v = p, e = Xe(), { t: s } = O(), t = He(), y = Z(), { enabledLocations: o, enabledLocationsSwitch: n, promptSelectLocations: c, removeLocation: f } = Ze({
466
- getLocations() {
467
- return e.locations;
468
- },
469
- setLocations(l) {
470
- e.locations = l;
471
- }
472
- }), h = V();
473
- b({
474
- validateInputs: () => {
475
- var l, u;
476
- (u = (l = h.value) == null ? void 0 : l.validateInputs) == null || u.call(l);
477
- },
478
- resetInputsValidation: () => {
479
- var l, u;
480
- (u = (l = h.value) == null ? void 0 : l.resetInputsValidation) == null || u.call(l);
481
- },
482
- resetInputs: () => {
483
- var l, u;
484
- (u = (l = h.value) == null ? void 0 : l.resetInputs) == null || u.call(l);
485
- }
486
- });
487
- const d = et({
488
- updateItem: (l) => {
489
- e.items = e.items.map((u) => u.sku._id !== l.sku._id ? u : l);
490
- },
491
- deleteItem: (l) => {
492
- e.items = e.items.filter((u) => u.sku._id !== l.sku._id);
493
- },
494
- get items() {
495
- return e.items;
496
- },
497
- get disabled() {
498
- return v.disabled;
499
- }
500
- }), w = A(() => d.columnDefs.value);
501
- function m() {
502
- const l = t.skus.map((k) => ({
503
- label: k.name,
504
- sublabel: k.code,
505
- value: k
506
- })), u = l.filter((k) => {
507
- var D;
508
- return (D = e.items) == null ? void 0 : D.find((S) => S.sku._id === k.value._id);
509
- }).map((k) => k.value);
510
- y.open({
511
- title: s("inventory.closing.form.items.selectItem"),
512
- closeButton: !0,
513
- contentComponent: Ge,
514
- contentComponentProps: {
515
- modelValue: u,
516
- items: l,
517
- virtualScroll: !0
518
- },
519
- primaryActions: {
520
- text: s("common.confirm"),
521
- close: !0
522
- },
523
- secondaryActions: {
524
- text: s("common.close"),
525
- close: !0,
526
- variant: "tertiary"
527
- }
528
- }).onPrimary((k) => {
529
- const D = e.items ?? [], S = k.map((a) => {
530
- const r = D.find(($) => $.sku._id === a._id);
531
- return r || {
532
- sku: a
533
- };
534
- });
535
- S.sort((a, r) => a.sku.code.localeCompare(r.sku.code)), e.items = S;
536
- });
537
- }
538
- return (l, u) => {
539
- const k = F("FmTextField"), D = F("FmSwitch"), S = F("FmButton"), a = F("FmListItem"), r = F("FmList"), R = F("FmFormGroup"), $ = F("FmTable"), C = F("FmForm");
540
- return x(), E(C, {
541
- ref_key: "formRef",
542
- ref: h,
543
- class: "flex flex-col gap-32",
544
- disabled: l.disabled
545
- }, {
546
- default: M(() => [
547
- g("div", rt, [
548
- g("div", ct, [
549
- _(k, {
550
- label: i(s)("inventory.closing.form.name"),
551
- "label-mark": "required",
552
- modelValue: i(e).name,
553
- "onUpdate:modelValue": u[0] || (u[0] = (T) => i(e).name = T),
554
- rules: [i(Je)()]
555
- }, null, 8, ["label", "modelValue", "rules"]),
556
- _(k, {
557
- label: i(s)("inventory.closing.form.reference"),
558
- "label-mark": "optional",
559
- modelValue: i(e).ref,
560
- "onUpdate:modelValue": u[1] || (u[1] = (T) => i(e).ref = T)
561
- }, null, 8, ["label", "modelValue"])
562
- ])
563
- ]),
564
- g("div", ut, [
565
- _(D, {
566
- modelValue: i(n),
567
- "onUpdate:modelValue": u[2] || (u[2] = (T) => ke(n) ? n.value = T : null),
568
- label: "Locations rule",
569
- sublabel: "Enable template for specific locations only",
570
- "label-placement": "right"
571
- }, null, 8, ["modelValue"]),
572
- i(n) ? (x(), E(R, {
573
- key: 0,
574
- modelValue: i(o),
575
- rules: [i(qe)(1)],
576
- class: "flex-1 flex gap-8 h-48 xs:flex-col xs:pt-16 sm:flex-col sm:pt-16"
577
- }, {
578
- default: M(() => [
579
- _(r, null, {
580
- default: M(() => [
581
- (x(!0), P(X, null, xe(i(o), (T) => (x(), E(a, {
582
- key: T.doc._id,
583
- label: T.name,
584
- sublabel: T.type,
585
- disabled: l.disabled
586
- }, {
587
- append: M(() => [
588
- _(S, {
589
- "prepend-icon": "delete",
590
- variant: "tertiary",
591
- disabled: l.disabled,
592
- onClick: (N) => i(f)(T.doc._id)
593
- }, null, 8, ["disabled", "onClick"])
594
- ]),
595
- _: 2
596
- }, 1032, ["label", "sublabel", "disabled"]))), 128))
597
- ]),
598
- _: 1
599
- })
600
- ]),
601
- _: 1
602
- }, 8, ["modelValue", "rules"])) : ve("", !0),
603
- i(n) ? (x(), P("div", dt, [
604
- _(S, {
605
- disabled: l.disabled,
606
- label: i(s)("inventory.closing.form.items.addItem"),
607
- "prepend-icon": "add",
608
- variant: "plain",
609
- class: "border-2 rounded-lg border-fm-color-primary",
610
- onClick: i(c)
611
- }, null, 8, ["disabled", "label", "onClick"])
612
- ])) : ve("", !0)
613
- ]),
614
- g("div", mt, [
615
- g("div", pt, [
616
- g("div", ft, I(i(s)("inventory.closing.form.items.title")), 1),
617
- _(S, {
618
- disabled: l.disabled,
619
- label: i(s)("inventory.closing.form.items.addItem"),
620
- "prepend-icon": "add",
621
- variant: "plain",
622
- class: "border-2 rounded-lg border-fm-color-primary",
623
- onClick: u[3] || (u[3] = (T) => m()),
624
- size: "md"
625
- }, null, 8, ["disabled", "label"])
626
- ]),
627
- (x(), E($, {
628
- "column-defs": w.value,
629
- "row-data": i(e).items,
630
- key: i(e).items.map((T) => T.sku._id).join("."),
631
- "hide-footer": ""
632
- }, {
633
- "list-row": M((T) => [
634
- (x(), E(De, {
635
- row: T,
636
- key: i(e).items.map((N) => N.sku._id).join(".")
637
- }, {
638
- default: M((N) => [
639
- _(it, {
640
- row: T,
641
- "cell-by-col-id": N
642
- }, null, 8, ["row", "cell-by-col-id"])
643
- ]),
644
- _: 2
645
- }, 1032, ["row"]))
646
- ]),
647
- _: 1
648
- }, 8, ["column-defs", "row-data"]))
649
- ])
650
- ]),
651
- _: 1
652
- }, 8, ["disabled"]);
653
- };
654
- }
655
- }), bt = { class: "flex items-center" }, vt = { class: "fm-typo-en-title-md-800" }, yt = { class: "flex gap-4" }, ht = /* @__PURE__ */ K({
656
- __name: "ClosingTemplateDialog",
657
- props: {
658
- mode: {},
659
- modelValue: {},
660
- show: { type: Boolean }
661
- },
662
- emits: ["update:show", "submitted"],
663
- setup(p, { expose: b, emit: v }) {
664
- var S;
665
- const e = p, s = v, t = Q(), y = ee(), { t: o } = O(), n = ze(e, "show");
666
- function c() {
667
- return {
668
- _id: "",
669
- name: "",
670
- items: []
671
- };
672
- }
673
- const f = V(e.modelValue ?? c()), h = V(((S = e.modelValue) == null ? void 0 : S._id) ?? `${Math.random()}`);
674
- Pe(
675
- () => e.show,
676
- (a) => {
677
- var r;
678
- a && (f.value = e.modelValue ?? c(), h.value = ((r = e.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
679
- }
680
- );
681
- const d = V(!1), w = A(() => {
682
- switch (e.mode) {
683
- case L.READ:
684
- return "";
685
- case L.CREATE:
686
- return o("inventory.closing.template.create.title");
687
- case L.UPDATE:
688
- return o("inventory.closing.template.update.title");
689
- }
690
- return "";
691
- }), m = V();
692
- b({
693
- validateInputs: () => {
694
- var a, r;
695
- (r = (a = m.value) == null ? void 0 : a.validateInputs) == null || r.call(a);
696
- },
697
- resetInputsValidation: () => {
698
- var a, r;
699
- (r = (a = m.value) == null ? void 0 : a.resetInputsValidation) == null || r.call(a);
700
- },
701
- resetInputs: () => {
702
- var a, r;
703
- (r = (a = m.value) == null ? void 0 : a.resetInputs) == null || r.call(a);
704
- }
705
- });
706
- async function l() {
707
- const a = f.value;
708
- if (a) {
709
- d.value = !0;
710
- try {
711
- await t.createTemplate(a), await new Promise((r) => setTimeout(r, 1e3)), y.open({
712
- title: o("inventory.closing.template.create.success"),
713
- message: o("inventory.closing.template.create.successMessage"),
714
- type: "success"
715
- }), s("update:show", !1), s("submitted");
716
- } catch (r) {
717
- y.open({
718
- title: o("inventory.closing.template.create.error"),
719
- message: o("inventory.closing.template.create.errorMessage"),
720
- type: "error"
721
- }), console.error("Error in creating closing template", r);
722
- } finally {
723
- d.value = !1;
724
- }
725
- }
726
- }
727
- async function u() {
728
- const a = f.value;
729
- if (a) {
730
- d.value = !0;
731
- try {
732
- await t.updateTemplate(a), await new Promise((r) => setTimeout(r, 1e3)), y.open({
733
- title: o("inventory.closing.template.update.success"),
734
- message: o("inventory.closing.template.update.successMessage"),
735
- type: "success"
736
- }), s("update:show", !1), s("submitted");
737
- } catch (r) {
738
- y.open({
739
- title: o("inventory.closing.template.update.error"),
740
- message: o("inventory.closing.template.update.errorMessage"),
741
- type: "error"
742
- }), console.error("Error in updating closing template", r);
743
- } finally {
744
- d.value = !1;
745
- }
746
- }
747
- }
748
- function k() {
749
- switch (e.mode) {
750
- case L.CREATE:
751
- return l();
752
- case L.UPDATE:
753
- return u();
754
- }
755
- }
756
- function D() {
757
- var a, r;
758
- (r = (a = m.value) == null ? void 0 : a.validateInputs) == null || r.call(a);
759
- }
760
- return (a, r) => {
761
- const R = F("FmButton"), $ = F("FmSideSheet");
762
- return x(), E($, {
763
- modelValue: i(n),
764
- "onUpdate:modelValue": r[2] || (r[2] = (C) => ke(n) ? n.value = C : null),
765
- "dismiss-away": "",
766
- "close-button": "",
767
- "max-width": 800
768
- }, {
769
- "side-sheet-header": M(() => [
770
- g("div", bt, [
771
- g("div", vt, I(w.value), 1)
772
- ])
773
- ]),
774
- default: M(() => [
775
- (x(), E(gt, {
776
- class: "w-full",
777
- ref_key: "formRef",
778
- ref: m,
779
- onValidationSuccess: k,
780
- "model-value": f.value,
781
- "onUpdate:modelValue": r[0] || (r[0] = (C) => f.value = C),
782
- disabled: d.value,
783
- key: h.value
784
- }, null, 8, ["model-value", "disabled"]))
785
- ]),
786
- "side-sheet-footer": M(() => [
787
- g("div", yt, [
788
- _(R, {
789
- loading: d.value,
790
- label: i(o)("common.save"),
791
- onClick: D
792
- }, null, 8, ["loading", "label"]),
793
- _(R, {
794
- disabled: d.value,
795
- variant: "tertiary",
796
- label: i(o)("common.close"),
797
- onClick: r[1] || (r[1] = (C) => s("update:show", !1))
798
- }, null, 8, ["disabled", "label"])
799
- ])
800
- ]),
801
- _: 1
802
- }, 8, ["modelValue"]);
803
- };
804
- }
805
- }), _t = {};
806
- function wt(p, b) {
807
- return x(), P("div");
808
- }
809
- const xt = /* @__PURE__ */ Oe(_t, [["render", wt]]), kt = { class: "flex flex-col gap-40" }, Tt = { key: 0 }, $t = {
810
- key: 1,
811
- class: "flex gap-8 items-center"
812
- }, Ct = {
813
- key: 2,
814
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
815
- }, Dt = {
816
- key: 3,
817
- class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
818
- }, St = { key: 4 }, Ft = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, Pt = /* @__PURE__ */ K({
819
- __name: "ClosingTemplatePublish",
820
- emits: ["close"],
821
- setup(p, { emit: b }) {
822
- const v = V(!1), e = ee(), s = Q(), t = Se(), y = b;
823
- async function o() {
824
- v.value = !0;
825
- try {
826
- await s.startNewPublish().delayed(1e3), e.open({
827
- title: "Success",
828
- message: "You may refresh after a while to review publish status",
829
- type: "success"
830
- }), f();
831
- } catch (h) {
832
- e.open({
833
- title: "Something went wrong",
834
- message: "Please try again",
835
- type: "error"
836
- }), console.error("error on creating publish task", h);
837
- } finally {
838
- v.value = !1;
839
- }
840
- }
841
- const n = A(() => t.recentPublish.recentJob), c = A(
842
- () => t.templates.length && (!n.value || n.value.outlets.length === n.value.completed.length)
843
- );
844
- function f() {
845
- y("close");
846
- }
847
- return (h, d) => {
848
- const w = F("FmCircularProgress"), m = F("FmButton");
849
- return x(), P("div", kt, [
850
- i(t).templates.length ? v.value ? (x(), P("div", $t, [
851
- g("div", null, [
852
- _(w, {
853
- size: "md",
854
- color: "neutral-gray-300"
855
- })
856
- ]),
857
- d[0] || (d[0] = g("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, [
858
- g("span", null, "Sending a task to publish templates to all outlets...")
859
- ], -1))
860
- ])) : n.value ? n.value.outlets.length === n.value.completed.length ? (x(), P("div", Dt, [
861
- g("p", null, [
862
- ye(" Your recent publishing task at " + I(i(we)(new Date(n.value.createdAt))) + " has ", 1),
863
- d[1] || (d[1] = g("span", { class: "fm-typo-en-body-lg-600" }, "completed", -1)),
864
- ye(" at " + I(i(we)(new Date(n.value.updatedAt))) + ". ", 1)
865
- ]),
866
- d[2] || (d[2] = g("p", null, "Do you want to publish to all outlets?", -1))
867
- ])) : (x(), P("div", St, " Your recent publishing task is still pending (" + I(n.value.completed.length) + " / " + I(n.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)) : (x(), P("div", Ct, " You have no recent publish activity. Do you want to publish to all outlets? ")) : (x(), P("div", Tt, "You have no template to publish.")),
868
- g("div", Ft, [
869
- _(m, {
870
- disabled: !c.value,
871
- loading: v.value,
872
- label: "Publish to all outlets",
873
- onClick: o
874
- }, null, 8, ["disabled", "loading"]),
875
- _(m, {
876
- variant: "tertiary",
877
- label: "Close",
878
- onClick: f
879
- })
880
- ])
881
- ]);
882
- };
883
- }
884
- }), Mt = { class: "flex-1 flex flex-col gap-8" }, At = { class: "flex flex-col" }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, It = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ut = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Et = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Ot = /* @__PURE__ */ K({
885
- __name: "ClosingTemplateView",
886
- setup(p) {
887
- const { t: b } = O(), { createTemplate: v, updateTemplate: e } = W(), { templateDialogProps: s, templateDetailsProps: t } = je(W()), y = Ce(), o = Z(), n = Se(), c = Re(), { breakpoints: f } = Ye();
888
- y.watchLocation(n.fetchTemplates);
889
- const h = A(() => n.loading), d = V(""), w = A(() => f.value.xs || f.value.sm), m = A(() => w.value ? 10 : 20);
890
- function l(a) {
891
- switch (a) {
892
- case B.Add:
893
- return v();
894
- case "publish":
895
- return u();
896
- }
897
- }
898
- function u() {
899
- o.open({
900
- title: "Publish closing templates",
901
- contentComponent: Pt,
902
- contentComponentProps: {
903
- onClose() {
904
- o.close();
905
- }
906
- }
907
- });
908
- }
909
- function k(a) {
910
- return a;
911
- }
912
- const D = A(() => {
913
- const a = [
914
- {
915
- label: b("inventory.closing.template.create.title"),
916
- value: B.Add,
917
- isPrimary: !0,
918
- prependIcon: "add"
919
- }
920
- ];
921
- return w.value ? a : [
922
- ...a,
923
- {
924
- label: "Publish",
925
- value: "publish",
926
- isPrimary: !1
927
- }
928
- ];
929
- }), S = A(() => {
930
- const a = [{ icon: "refresh", onClick: n.fetchTemplates }];
931
- return w.value ? [{ icon: "publish", onClick: u }, ...a] : a;
932
- });
933
- return (a, r) => {
934
- const R = F("FmTable");
935
- return x(), P(X, null, [
936
- _(Ne, {
937
- title: i(b)("inventory.closing.template.title"),
938
- actions: D.value,
939
- "onClick:action": l
940
- }, {
941
- default: M(() => [
942
- g("div", {
943
- class: Me([
944
- "flex flex-col gap-8 max-h-full",
945
- {
946
- "p-0": w.value,
947
- "px-24 ": !w.value
948
- }
949
- ])
950
- }, [
951
- _(Le, {
952
- searchable: "",
953
- search: d.value,
954
- "onUpdate:search": r[0] || (r[0] = ($) => d.value = $),
955
- actions: S.value
956
- }, null, 8, ["search", "actions"]),
957
- _(R, {
958
- style: Ae(i(c).tableHeight),
959
- "column-defs": i(n).columnDefs,
960
- "row-data": i(n).templates,
961
- "search-value": d.value,
962
- loading: h.value,
963
- onRowClick: r[1] || (r[1] = ($) => i(e)($.original)),
964
- "page-size": m.value
965
- }, {
966
- "list-row": M(($) => [
967
- _(De, {
968
- row: $,
969
- onRowClick: (C) => i(e)(C)
970
- }, {
971
- default: M((C) => {
972
- var T, N, te, H, le, se, oe, ne, J, ae, ie, re, ce, ue, de, q, me, pe, fe, ge, G, be;
973
- return [
974
- g("div", Mt, [
975
- g("div", At, [
976
- g("div", Vt, [
977
- _(i(z), {
978
- render: (te = (N = (T = C._id) == null ? void 0 : T.column) == null ? void 0 : N.columnDef) == null ? void 0 : te.cell,
979
- props: (le = (H = C._id) == null ? void 0 : H.getContext) == null ? void 0 : le.call(H)
980
- }, null, 8, ["render", "props"])
981
- ]),
982
- g("div", It, [
983
- _(i(z), {
984
- render: (ne = (oe = (se = C.name) == null ? void 0 : se.column) == null ? void 0 : oe.columnDef) == null ? void 0 : ne.cell,
985
- props: (ae = (J = C.name) == null ? void 0 : J.getContext) == null ? void 0 : ae.call(J)
986
- }, null, 8, ["render", "props"])
987
- ]),
988
- g("div", null, I((ie = $.original.locations) != null && ie.length ? `Enabled for ${(re = $.original.locations) == null ? void 0 : re.length} outlets` : "Enabled for all outlets"), 1),
989
- g("div", Ut, I([
990
- ...$.original.items.slice(0, 3).map((Fe) => Fe.sku.name),
991
- ...$.original.items.length >= 3 ? [`and ${$.original.items.length - 3} more items`] : []
992
- ].join(", ")), 1),
993
- g("div", Et, [
994
- _(i(z), {
995
- render: (de = (ue = (ce = C.ref) == null ? void 0 : ce.column) == null ? void 0 : ue.columnDef) == null ? void 0 : de.cell,
996
- props: (me = (q = C.ref) == null ? void 0 : q.getContext) == null ? void 0 : me.call(q)
997
- }, null, 8, ["render", "props"])
998
- ])
999
- ]),
1000
- g("div", null, [
1001
- _(i(z), {
1002
- render: (ge = (fe = (pe = C.status) == null ? void 0 : pe.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ge.cell,
1003
- props: (be = (G = C.status) == null ? void 0 : G.getContext) == null ? void 0 : be.call(G)
1004
- }, null, 8, ["render", "props"])
1005
- ])
1006
- ])
1007
- ];
1008
- }),
1009
- _: 2
1010
- }, 1032, ["row", "onRowClick"])
1011
- ]),
1012
- _: 1
1013
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
1014
- ], 2)
1015
- ]),
1016
- _: 1
1017
- }, 8, ["title", "actions"]),
1018
- (x(), E(Ve, { to: "body" }, [
1019
- _(xt, Ie(Ue(i(t))), null, 16),
1020
- _(ht, Ee(i(s), {
1021
- onSubmitted: r[2] || (r[2] = ($) => i(n).fetchTemplates())
1022
- }), null, 16)
1023
- ]))
1024
- ], 64);
1025
- };
1026
- }
1027
- });
1028
- export {
1029
- Ot as default
1030
- };