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

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