@feedmepos/mf-inventory-portal 0.0.22-dev.45 → 0.0.22-dev.47
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.
- package/dist/{ApprovalView-D802I6qa.js → ApprovalView-DvaKP7j9.js} +3 -3
- package/dist/{BindingsDialog-BY4eeO80.js → BindingsDialog-DuJMVo61.js} +4 -4
- package/dist/{BindingsPicker-BS3Gx-vu.js → BindingsPicker-BoYwB6U_.js} +11 -11
- package/dist/{BindingsTable-B0Ubv4If.js → BindingsTable-CWpUfeKm.js} +4 -4
- package/dist/ClosingTemplateView-Cn96MJVP.js +1812 -0
- package/dist/{FmDroppableField-42Sf5Kw4.js → FmDroppableField-Dlrwk4gA.js} +13 -13
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C6aC-NQY.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CCGydCsm.js} +3 -3
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BNzxPsXv.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DVMieqhn.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DDjgq37P.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CTK65n8v.js} +7 -7
- package/dist/IngredientGroupView-VNG5Q8ou.js +608 -0
- package/dist/{IngredientsView-BIravTM5.js → IngredientsView-C_rbIOCU.js} +5 -5
- package/dist/{IntegrationView-ClkjyBMU.js → IntegrationView-OKyiv2vc.js} +2 -2
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CbHnBl9-.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-bEu-8q1N.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DPdSdnYc.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CDM7DSyn.js} +2 -2
- package/dist/{PurchaseOrderPrintPreview-DK3cdRy_.js → PurchaseOrderPrintPreview-BSyXdhQo.js} +3 -3
- package/dist/{ReceiveRequestView-BEJENItS.js → ReceiveRequestView-C4t8Kkn6.js} +10 -10
- package/dist/{RecipeView-CKkVM0RF.js → RecipeView-BnmwgxnO.js} +22 -22
- package/dist/{StockView-Cuf2TpKY.js → StockView-wKpLuCbC.js} +5 -5
- package/dist/{SupplierView-BeYelTFE.js → SupplierView-CZ23V9tf.js} +781 -2324
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CmasVafU.js → TransferDetails.vue_vue_type_script_setup_true_lang-Cxm7P4nU.js} +53 -53
- package/dist/{TransferTemplateView-C2mT9X3X.js → TransferTemplateView-DAqSN1NH.js} +8 -8
- package/dist/{UnitView-Bjt1e1Ny.js → UnitView-UhJoXWMf.js} +4 -4
- package/dist/{WarehouseView-BiBEPMuq.js → WarehouseView-C-DGIBdE.js} +14 -14
- package/dist/api/inventory.d.ts +210 -6
- package/dist/{app-Be_W1QTm.js → app-pFcheyXr.js} +26797 -26576
- package/dist/app.d.ts +3 -0
- package/dist/app.js +1 -1
- package/dist/components/FmMultiselectDialogProps.d.ts +0 -2
- package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +5 -5
- package/dist/components/shell/inventory/binding-dialog.vue.d.ts +2 -2
- package/dist/components/shell/inventory/binding-ui.vue.d.ts +2 -2
- package/dist/{decimal-CN1x5KmH.js → decimal-CY3TbMUy.js} +1 -1
- package/dist/{defineDeepModel-DZtwdE6s.js → defineDeepModel-CWIF7Cxg.js} +1 -1
- package/dist/extensions/array.d.ts +1 -0
- package/dist/{format-time-from-id-Xl-UgWBG.js → format-time-from-id-CSntAOsD.js} +1 -1
- package/dist/{format-unit-display-CGWN9PmG.js → format-unit-display-BHIBhwk3.js} +49 -49
- package/dist/router/name.d.ts +1 -0
- package/dist/stores/inventory.d.ts +217 -10
- package/dist/stores/netsuite.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-DYWP_v1f.js → supplier-142vtn2Q.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-template-enabled-locations-2-UESI1K-k.js → use-template-enabled-locations-2-DUR98xi2.js} +1 -1
- package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +12 -12
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +12 -12
- package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +3 -0
- package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +31 -0
- package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +12 -0
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +20 -0
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +12 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +24 -0
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +215 -0
- package/dist/views/ingredients/components/convert/ConvertForm.vue.d.ts +2 -2
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +2 -2
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +5 -5
- package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -1
- package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +2 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +23 -17
- package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +2 -2
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +33 -24
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +33 -24
- package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -2
- package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
- package/dist/views/supplier/helpers/import-export.helper.d.ts +1 -1
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +1 -1
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -12
- package/dist/{xlsx-db3pdB_Q.js → xlsx-ChOXd9sY.js} +1 -1
- package/dist/{xlsx.util-G4B1eDpi.js → xlsx.util-BYVL7Paj.js} +1 -1
- package/package.json +2 -2
- package/dist/ClosingTemplateView-yEkqNfX2.js +0 -1768
|
@@ -1,1768 +0,0 @@
|
|
|
1
|
-
import { ref as M, h as S, defineComponent as H, resolveComponent as R, openBlock as w, createElementBlock as C, createElementVNode as h, normalizeClass as O, createTextVNode as Re, toDisplayString as $, unref as p, createCommentVNode as K, createVNode as k, withCtx as F, Fragment as z, renderList as G, computed as A, watch as Fe, createSlots as je, createBlock as U, isRef as Oe, normalizeStyle as Ye, Teleport as Ke, normalizeProps as Ge, guardReactiveProps as Je, mergeProps as We } from "vue";
|
|
2
|
-
import { u as qe, _ as Xe, a as Qe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BNzxPsXv.js";
|
|
3
|
-
import { useCoreStore as le, useI18n as N } from "@feedmepos/mf-common";
|
|
4
|
-
import { useDialogChild as Ze, useSnackbar as Q, useDialog as ae, FmButtonVariant as Me, components as B, useProxiedModel as et, useBreakpoints as tt } from "@feedmepos/ui-library";
|
|
5
|
-
import { defineStore as Pe, storeToRefs as Ae } from "pinia";
|
|
6
|
-
import { D as Se, R as V, F as L } from "./row-action.enum-PMKMRrZR.js";
|
|
7
|
-
import { n as nt, i as re, c as Ee, f as ot, u as ie, h as st, R as lt, A as at, y as rt, W as it, X as ne } from "./app-Be_W1QTm.js";
|
|
8
|
-
import { a as oe, b as Ue, d as Ve, s as Ne, r as ct } from "./xlsx.util-G4B1eDpi.js";
|
|
9
|
-
import { F as mt } from "./FmDroppableField-42Sf5Kw4.js";
|
|
10
|
-
import { c as ut, F as j, _ as Be } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
11
|
-
import { f as dt } from "./format-time-from-id-Xl-UgWBG.js";
|
|
12
|
-
import "vue-router";
|
|
13
|
-
import { d as pt } from "./defineDeepModel-DZtwdE6s.js";
|
|
14
|
-
import { u as ft } from "./use-template-enabled-locations-2-UESI1K-k.js";
|
|
15
|
-
const Z = nt((r, s) => {
|
|
16
|
-
function o() {
|
|
17
|
-
var e;
|
|
18
|
-
return `business_${((e = le().currentBusiness.value) == null ? void 0 : e._id) ?? ""}`;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
async getRecentPublishingJob() {
|
|
22
|
-
const n = o(), t = `${r.inventoryBackendUrl}/${n}/closing-template/publish/recent`;
|
|
23
|
-
return s.get(t);
|
|
24
|
-
},
|
|
25
|
-
async startNewPublish() {
|
|
26
|
-
const n = o(), t = `${r.inventoryBackendUrl}/${n}/closing-template/publish`;
|
|
27
|
-
return s.post(t);
|
|
28
|
-
},
|
|
29
|
-
async getTemplate(n) {
|
|
30
|
-
const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template/${n}`;
|
|
31
|
-
return s.get(e);
|
|
32
|
-
},
|
|
33
|
-
async readTemplates() {
|
|
34
|
-
const n = o(), t = `${r.inventoryBackendUrl}/${n}/closing-template`;
|
|
35
|
-
return s.get(t);
|
|
36
|
-
},
|
|
37
|
-
async createTemplate(n) {
|
|
38
|
-
const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template`;
|
|
39
|
-
return s.post(e, n);
|
|
40
|
-
},
|
|
41
|
-
async updateTemplate(n) {
|
|
42
|
-
const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template`;
|
|
43
|
-
return s.put(e, n);
|
|
44
|
-
},
|
|
45
|
-
async deleteTemplate(n) {
|
|
46
|
-
const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template`;
|
|
47
|
-
return s.delete(e, { _id: n._id, _rev: n._rev });
|
|
48
|
-
},
|
|
49
|
-
async importTemplates(n) {
|
|
50
|
-
const t = o(), e = `${r.inventoryBackendUrl}/${t}/closing-template/import`;
|
|
51
|
-
return s.post(e, n);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}), ee = Pe(
|
|
55
|
-
"closingTable",
|
|
56
|
-
function() {
|
|
57
|
-
const { t: s } = N(), o = se(), n = M({}), t = M(new Array()), e = M(!1), f = re(), i = Z();
|
|
58
|
-
async function m() {
|
|
59
|
-
if (t.value = [], !!f._currentLocation) {
|
|
60
|
-
e.value = !0;
|
|
61
|
-
try {
|
|
62
|
-
const [_, y] = await Promise.all([
|
|
63
|
-
i.readTemplates(),
|
|
64
|
-
i.getRecentPublishingJob()
|
|
65
|
-
]).delayed(1e3);
|
|
66
|
-
t.value = _, n.value = y;
|
|
67
|
-
} catch (_) {
|
|
68
|
-
console.log("Something went wrong when fetching templates:", _);
|
|
69
|
-
} finally {
|
|
70
|
-
e.value = !1;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async function c(_) {
|
|
75
|
-
if (!t.value.find((y) => y._id) && f._currentLocation) {
|
|
76
|
-
e.value = !0;
|
|
77
|
-
try {
|
|
78
|
-
const [y] = await Promise.all([
|
|
79
|
-
i.getTemplate(_),
|
|
80
|
-
new Promise((a) => setTimeout(a, 1e3))
|
|
81
|
-
]);
|
|
82
|
-
t.value = [y];
|
|
83
|
-
} catch (y) {
|
|
84
|
-
console.log("Something went wrong when fetching templates:", y);
|
|
85
|
-
} finally {
|
|
86
|
-
e.value = !1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function u(_, y) {
|
|
91
|
-
switch (y = Ee(y), _) {
|
|
92
|
-
case V.Details:
|
|
93
|
-
return o.viewTemplate(y);
|
|
94
|
-
case V.Edit:
|
|
95
|
-
return o.updateTemplate(y);
|
|
96
|
-
case V.Delete:
|
|
97
|
-
return o.deleteTemplate(y, e, m);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return {
|
|
101
|
-
columnDefs: [
|
|
102
|
-
{
|
|
103
|
-
id: "_id",
|
|
104
|
-
accessorKey: "_id",
|
|
105
|
-
header: () => s("inventory.closing.table.createdAt"),
|
|
106
|
-
cell(_) {
|
|
107
|
-
return dt(`${_.getValue()}`);
|
|
108
|
-
},
|
|
109
|
-
enableSorting: !0
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: "name",
|
|
113
|
-
accessorKey: "name",
|
|
114
|
-
header: () => s("inventory.closing.table.name"),
|
|
115
|
-
enableSorting: !0,
|
|
116
|
-
size: 200
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
id: "noOfItems",
|
|
120
|
-
accessorKey: "items.length",
|
|
121
|
-
header: () => s("inventory.closing.table.noOfItems"),
|
|
122
|
-
enableSorting: !1,
|
|
123
|
-
meta: {
|
|
124
|
-
width: "10rem",
|
|
125
|
-
textAlign: "right"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: "enabledLocations",
|
|
130
|
-
accessorKey: "locations.length",
|
|
131
|
-
header: () => s("inventory.closing.table.enabledOutlets"),
|
|
132
|
-
cell(_) {
|
|
133
|
-
var a;
|
|
134
|
-
const y = (a = _.row.original.locations) == null ? void 0 : a.length;
|
|
135
|
-
return y ? `${y}` : "All";
|
|
136
|
-
},
|
|
137
|
-
enableSorting: !1,
|
|
138
|
-
meta: {
|
|
139
|
-
width: "10rem",
|
|
140
|
-
textAlign: "right"
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
id: "ref",
|
|
145
|
-
accessorKey: "ref",
|
|
146
|
-
header: () => s("inventory.closing.table.reference"),
|
|
147
|
-
enableSorting: !1,
|
|
148
|
-
size: "auto"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
id: "status",
|
|
152
|
-
header: () => s("inventory.closing.table.status"),
|
|
153
|
-
enableSorting: !1,
|
|
154
|
-
cell(_) {
|
|
155
|
-
var T;
|
|
156
|
-
const y = _.row.original, a = y._rev, l = (T = n.value.publishedRevs) == null ? void 0 : T[y._id], v = a === l;
|
|
157
|
-
return S(
|
|
158
|
-
"div",
|
|
159
|
-
{
|
|
160
|
-
class: "flex"
|
|
161
|
-
},
|
|
162
|
-
S(
|
|
163
|
-
"div",
|
|
164
|
-
{
|
|
165
|
-
class: [
|
|
166
|
-
"fm-status-badge",
|
|
167
|
-
v ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
v ? "Published" : "Unpublished"
|
|
171
|
-
)
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
id: "action",
|
|
177
|
-
cell(_) {
|
|
178
|
-
const y = _.row.original, a = [
|
|
179
|
-
Se[V.Edit],
|
|
180
|
-
Se[V.Delete]
|
|
181
|
-
];
|
|
182
|
-
return ut(a, (l) => u(l, y));
|
|
183
|
-
},
|
|
184
|
-
enableSorting: !1,
|
|
185
|
-
size: 40,
|
|
186
|
-
meta: {
|
|
187
|
-
cellClass: "",
|
|
188
|
-
headerClass: ""
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
],
|
|
192
|
-
recentPublish: n,
|
|
193
|
-
templates: t,
|
|
194
|
-
loading: e,
|
|
195
|
-
fetchTemplates: m,
|
|
196
|
-
loadTemplate: c
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
var ce = /* @__PURE__ */ ((r) => (r.Ingredients = "Ingredients", r))(ce || {});
|
|
201
|
-
function Le(r) {
|
|
202
|
-
const s = r.sku, o = new Set(r.disabledMeasurements);
|
|
203
|
-
return [
|
|
204
|
-
{
|
|
205
|
-
code: s.code,
|
|
206
|
-
name: s.name,
|
|
207
|
-
unit: s.unit.abbrev,
|
|
208
|
-
enabled: !o.has(s.unit._id)
|
|
209
|
-
},
|
|
210
|
-
...s.unit.measurements.map((e) => ({
|
|
211
|
-
unit: e.abbrev,
|
|
212
|
-
enabled: !o.has(e.id)
|
|
213
|
-
}))
|
|
214
|
-
];
|
|
215
|
-
}
|
|
216
|
-
function ze() {
|
|
217
|
-
return [
|
|
218
|
-
{
|
|
219
|
-
id: "code",
|
|
220
|
-
name: "Code"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
id: "name",
|
|
224
|
-
name: "Name"
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
id: "unit",
|
|
228
|
-
name: "Unit"
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
id: "enabled",
|
|
232
|
-
name: "Enabled"
|
|
233
|
-
}
|
|
234
|
-
];
|
|
235
|
-
}
|
|
236
|
-
function gt(r) {
|
|
237
|
-
var i;
|
|
238
|
-
const o = le().currentBusiness.value, t = (i = r.map((m) => {
|
|
239
|
-
var a;
|
|
240
|
-
const c = m.items.flatMap(Le), u = ze(), g = [
|
|
241
|
-
["Template ID", m._id],
|
|
242
|
-
["Template name", m.name],
|
|
243
|
-
["Business name", o == null ? void 0 : o.name],
|
|
244
|
-
["Business ID", o == null ? void 0 : o._id],
|
|
245
|
-
["Menu version", o == null ? void 0 : o.menuVersion],
|
|
246
|
-
[
|
|
247
|
-
"Locations",
|
|
248
|
-
...(a = m.locations) != null && a.length ? [m.locations.map((l) => `${l.name} (${l.dbName})`)] : ["All"]
|
|
249
|
-
],
|
|
250
|
-
["Reference", m.ref ?? ""],
|
|
251
|
-
[],
|
|
252
|
-
u.map((l) => l.name),
|
|
253
|
-
...c.map((l) => u.map((v) => l[v.id]))
|
|
254
|
-
], _ = u.map((l) => `system:${l.id}`), y = oe(g, _);
|
|
255
|
-
return { name: m.name, sheet: y };
|
|
256
|
-
}).reduce(
|
|
257
|
-
(m, c) => {
|
|
258
|
-
var g;
|
|
259
|
-
const u = c.name.slice(0, 12);
|
|
260
|
-
return (g = m.sheetOccurence)[u] ?? (g[u] = 0), m.sheetOccurence[u] += 1, m.sheets[`${u} (${m.sheetOccurence[u]})`] = c.sheet, m;
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
sheets: {},
|
|
264
|
-
sheetOccurence: {}
|
|
265
|
-
}
|
|
266
|
-
)) == null ? void 0 : i.sheets, e = `${o == null ? void 0 : o.name} closing templates (${ot(/* @__PURE__ */ new Date())}).xlsx`, f = Ue(t);
|
|
267
|
-
return Ve(f, e), e;
|
|
268
|
-
}
|
|
269
|
-
function vt() {
|
|
270
|
-
const r = le(), s = ie(), o = Le({
|
|
271
|
-
sku: {
|
|
272
|
-
unit: {
|
|
273
|
-
_id: "",
|
|
274
|
-
name: "Unit",
|
|
275
|
-
abbrev: "Unit",
|
|
276
|
-
precision: 0,
|
|
277
|
-
measurements: []
|
|
278
|
-
},
|
|
279
|
-
code: "ING001",
|
|
280
|
-
_id: "",
|
|
281
|
-
name: "Sugar"
|
|
282
|
-
}
|
|
283
|
-
})[0], n = r.currentBusiness.value, t = ze(), e = [
|
|
284
|
-
["Template ID (leave empty to create new)", ""],
|
|
285
|
-
["Template Name", "New template"],
|
|
286
|
-
["Business name", n == null ? void 0 : n.name],
|
|
287
|
-
["Business ID", n == null ? void 0 : n._id],
|
|
288
|
-
["Menu version", n == null ? void 0 : n.menuVersion],
|
|
289
|
-
[
|
|
290
|
-
"Location codes (leave empty to enable all)",
|
|
291
|
-
"Example outlet (restaurant_xxx)",
|
|
292
|
-
"Example outlet 2 (restaurant_xxx)"
|
|
293
|
-
],
|
|
294
|
-
["Reference:"],
|
|
295
|
-
[],
|
|
296
|
-
t.map((g) => g.name),
|
|
297
|
-
t.map((g) => o[g.id])
|
|
298
|
-
], f = t.map((g) => `system:${g.id}`), i = oe(e, f), m = oe(
|
|
299
|
-
s.skus.flatMap((g) => [[g.code, g.name, g.unit.abbrev], ...g.unit.measurements.map((y) => ["", "", y.abbrev])]),
|
|
300
|
-
["Code", "Name", "Units", "Enabled (true/false)"]
|
|
301
|
-
), c = Ue({
|
|
302
|
-
Template: i,
|
|
303
|
-
Ingredients: m
|
|
304
|
-
}), u = `${n == null ? void 0 : n.name} transfer templates import.xlsx`;
|
|
305
|
-
return Ve(c, u), u;
|
|
306
|
-
}
|
|
307
|
-
function yt(r) {
|
|
308
|
-
if (!r.length || `${r[0]}`.toLocaleLowerCase() === "all")
|
|
309
|
-
return [];
|
|
310
|
-
const s = /(.*) \(((warehouse_|restaurant_).{24,})\)/, n = re().locationByDbName;
|
|
311
|
-
return r.map((t) => {
|
|
312
|
-
const e = new Array(), f = t.trim(), i = s.exec(f);
|
|
313
|
-
if (!i)
|
|
314
|
-
return e.push(`Enabled location value of ${f} cannot be read.`), {
|
|
315
|
-
errors: e
|
|
316
|
-
};
|
|
317
|
-
const m = i[1], c = i[2], u = n[c];
|
|
318
|
-
return u ? (m !== u.name && e.push(
|
|
319
|
-
`Location id ${c} has non-matching name. Found ${m} but expected ${u.name}`
|
|
320
|
-
), {
|
|
321
|
-
errors: e,
|
|
322
|
-
location: u
|
|
323
|
-
}) : (e.push(`Location (${m}) of id ${c} is not found.`), {
|
|
324
|
-
errors: e
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
function ht(r) {
|
|
329
|
-
const [
|
|
330
|
-
s,
|
|
331
|
-
o,
|
|
332
|
-
n,
|
|
333
|
-
t,
|
|
334
|
-
e,
|
|
335
|
-
f,
|
|
336
|
-
i,
|
|
337
|
-
m
|
|
338
|
-
] = Ne(r);
|
|
339
|
-
return {
|
|
340
|
-
id: `${o[1] ?? ""}`.trim(),
|
|
341
|
-
name: `${n[1] ?? ""}`.trim(),
|
|
342
|
-
locations: i.slice(1).map((c) => `${c}`.trim()).filter((c) => c),
|
|
343
|
-
reference: `${m[1] ?? ""}`.trim()
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
function bt(r) {
|
|
347
|
-
const [
|
|
348
|
-
s,
|
|
349
|
-
o,
|
|
350
|
-
n,
|
|
351
|
-
t,
|
|
352
|
-
e,
|
|
353
|
-
f,
|
|
354
|
-
i,
|
|
355
|
-
m,
|
|
356
|
-
c,
|
|
357
|
-
u,
|
|
358
|
-
...g
|
|
359
|
-
] = Ne(r);
|
|
360
|
-
if (!s || !s.length || s.some((v) => v.length && !v.startsWith("system:")))
|
|
361
|
-
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
362
|
-
const _ = s.map((v) => v.split(":")[1]), a = ["code", "name", "unit", "enabled"].filter((v) => !_.includes(v));
|
|
363
|
-
if (a.length)
|
|
364
|
-
throw new Error(
|
|
365
|
-
`Missing meta headers (${a.join()}). Excel file does not come from the template.`
|
|
366
|
-
);
|
|
367
|
-
return g.map((v, T) => {
|
|
368
|
-
const d = {};
|
|
369
|
-
for (const D in _) {
|
|
370
|
-
const b = _[D];
|
|
371
|
-
Object.assign(d, { [b]: v[D] });
|
|
372
|
-
}
|
|
373
|
-
return {
|
|
374
|
-
index: T,
|
|
375
|
-
data: d
|
|
376
|
-
};
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
function _t(r) {
|
|
380
|
-
return r.reduce(
|
|
381
|
-
(s, o) => {
|
|
382
|
-
var e;
|
|
383
|
-
const n = o.data, t = o.index;
|
|
384
|
-
return n.unit && (n.code ? s.result.push({ parent: o, children: [] }) : s.result.length ? (e = s.result.at(-1)) == null || e.children.push(o) : s.errors.push(`Cannot find parent for row ${t + 9}`)), s;
|
|
385
|
-
},
|
|
386
|
-
{ result: new Array(), errors: new Array() }
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
function xt(r) {
|
|
390
|
-
const s = r.parent.data, o = new Array(), t = ie().skuByCode[s.code ?? ""];
|
|
391
|
-
if (!t)
|
|
392
|
-
return o.push(`Cannot find ingredient of code ${s.code} ${s.name}`), { errors: o };
|
|
393
|
-
const e = {
|
|
394
|
-
sku: t
|
|
395
|
-
};
|
|
396
|
-
s.unit !== t.unit.abbrev ? o.push(
|
|
397
|
-
`Expected base unit ${t.unit.abbrev} for (${s.code}) ${s.name} but got ${s.unit} instead.`
|
|
398
|
-
) : (!s.enabled || `${s.enabled}`.toLocaleLowerCase() === "false") && (e.disabledMeasurements ?? (e.disabledMeasurements = []), e.disabledMeasurements.push(t.unit._id));
|
|
399
|
-
for (const i of r.children) {
|
|
400
|
-
const m = i.data, c = t.unit.measurements.find((u) => u.abbrev === m.unit);
|
|
401
|
-
if (!c) {
|
|
402
|
-
o.push(
|
|
403
|
-
`Cannot find measurement unit of ${m.unit} for (${s.code}) ${s.name}.`
|
|
404
|
-
);
|
|
405
|
-
continue;
|
|
406
|
-
}
|
|
407
|
-
(!m.enabled || `${m.enabled}`.toLocaleLowerCase() === "false") && (e.disabledMeasurements ?? (e.disabledMeasurements = []), e.disabledMeasurements.push(c.id));
|
|
408
|
-
}
|
|
409
|
-
const f = new Set(e.disabledMeasurements);
|
|
410
|
-
return f.has(t.unit._id) && e.sku.unit.measurements.every((i) => f.has(i.id)) && o.push(`Ingredient ${t.code} - ${t.name} must have at least one unit enabled.`), { errors: o, templateItem: e };
|
|
411
|
-
}
|
|
412
|
-
function wt(r) {
|
|
413
|
-
const s = r.SheetNames.filter(
|
|
414
|
-
(e) => !Object.values(ce).map(String).includes(e)
|
|
415
|
-
), n = ee().templates, t = st(n, "_id");
|
|
416
|
-
try {
|
|
417
|
-
return s.reduce(
|
|
418
|
-
(e, f) => {
|
|
419
|
-
const i = new Array(), m = r.Sheets[f], c = ht(m), u = yt(c.locations), g = u.filter((d) => d.location).map((d) => d.location);
|
|
420
|
-
i.push(...u.flatMap((d) => d.errors));
|
|
421
|
-
const _ = bt(m).filter(
|
|
422
|
-
(d) => d.data.code || d.data.unit
|
|
423
|
-
), y = _t(_);
|
|
424
|
-
i.push(...y.errors);
|
|
425
|
-
const a = y.result.map(
|
|
426
|
-
(d) => xt(d)
|
|
427
|
-
);
|
|
428
|
-
i.push(...a.flatMap((d) => d.errors));
|
|
429
|
-
const l = a.filter((d) => d.templateItem).map((d) => d.templateItem);
|
|
430
|
-
if (c.id) {
|
|
431
|
-
const d = t[c.id];
|
|
432
|
-
if (!d) {
|
|
433
|
-
const b = {
|
|
434
|
-
_id: c.id,
|
|
435
|
-
_rev: "",
|
|
436
|
-
name: c.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
437
|
-
items: []
|
|
438
|
-
};
|
|
439
|
-
return i.push(`Template ID ${c.id} is not found.`), e.importUpdateResult.push({
|
|
440
|
-
type: "update",
|
|
441
|
-
original: b,
|
|
442
|
-
template: b,
|
|
443
|
-
excelSheetName: f,
|
|
444
|
-
errors: i
|
|
445
|
-
}), e;
|
|
446
|
-
}
|
|
447
|
-
const D = {
|
|
448
|
-
type: "update",
|
|
449
|
-
original: d,
|
|
450
|
-
template: {
|
|
451
|
-
...d,
|
|
452
|
-
name: c.name,
|
|
453
|
-
locations: g.length ? g : null,
|
|
454
|
-
ref: c.reference,
|
|
455
|
-
items: l
|
|
456
|
-
},
|
|
457
|
-
excelSheetName: f,
|
|
458
|
-
errors: i
|
|
459
|
-
};
|
|
460
|
-
return e.importUpdateResult.push(D), e;
|
|
461
|
-
}
|
|
462
|
-
const T = {
|
|
463
|
-
type: "create",
|
|
464
|
-
template: {
|
|
465
|
-
name: c.id,
|
|
466
|
-
locations: g,
|
|
467
|
-
ref: c.reference,
|
|
468
|
-
items: l
|
|
469
|
-
},
|
|
470
|
-
excelSheetName: f,
|
|
471
|
-
errors: i
|
|
472
|
-
};
|
|
473
|
-
return e.importCreateResult.push(T), e;
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
invalidExcel: !1,
|
|
477
|
-
importCreateResult: new Array(),
|
|
478
|
-
importUpdateResult: new Array()
|
|
479
|
-
}
|
|
480
|
-
);
|
|
481
|
-
} catch (e) {
|
|
482
|
-
return {
|
|
483
|
-
invalidExcel: !0,
|
|
484
|
-
invalidExcelMessage: (e == null ? void 0 : e.message) ?? "Invalid excel",
|
|
485
|
-
importCreateResult: [],
|
|
486
|
-
importUpdateResult: []
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
const kt = { class: "flex items-center gap-12 pl-8" }, Tt = { class: "flex flex-col" }, $t = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Ct = {
|
|
491
|
-
key: 0,
|
|
492
|
-
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
493
|
-
}, Dt = { key: 0 }, Ie = /* @__PURE__ */ H({
|
|
494
|
-
__name: "ClosingTemplateImportItem",
|
|
495
|
-
props: {
|
|
496
|
-
type: {},
|
|
497
|
-
name: {},
|
|
498
|
-
locations: {},
|
|
499
|
-
items: {},
|
|
500
|
-
errors: {}
|
|
501
|
-
},
|
|
502
|
-
setup(r) {
|
|
503
|
-
const { t: s } = N();
|
|
504
|
-
return (o, n) => {
|
|
505
|
-
var f, i, m;
|
|
506
|
-
const t = R("FmIcon"), e = R("FmTooltip");
|
|
507
|
-
return w(), C("div", kt, [
|
|
508
|
-
n[0] || (n[0] = h("div", null, "•", -1)),
|
|
509
|
-
h("div", Tt, [
|
|
510
|
-
h("div", $t, [
|
|
511
|
-
h("div", {
|
|
512
|
-
class: O({
|
|
513
|
-
"text-fm-color-system-error-300": o.errors.length
|
|
514
|
-
})
|
|
515
|
-
}, [
|
|
516
|
-
Re($(o.name) + " ", 1),
|
|
517
|
-
o.type === "create" ? (w(), C("span", Ct, "(" + $(p(s)("inventory.closing.template.import.new")) + ")", 1)) : K("", !0)
|
|
518
|
-
], 2),
|
|
519
|
-
o.errors.length ? (w(), C("div", Dt, [
|
|
520
|
-
k(e, { "z-index": 50 }, {
|
|
521
|
-
content: F(() => [
|
|
522
|
-
h("ol", null, [
|
|
523
|
-
(w(!0), C(z, null, G(o.errors, (c, u) => (w(), C("li", { key: u }, $(c), 1))), 128))
|
|
524
|
-
])
|
|
525
|
-
]),
|
|
526
|
-
default: F(() => [
|
|
527
|
-
k(t, {
|
|
528
|
-
name: "error",
|
|
529
|
-
size: "sm",
|
|
530
|
-
color: "system-error-300"
|
|
531
|
-
})
|
|
532
|
-
]),
|
|
533
|
-
_: 1
|
|
534
|
-
})
|
|
535
|
-
])) : K("", !0)
|
|
536
|
-
]),
|
|
537
|
-
h("div", {
|
|
538
|
-
class: O([
|
|
539
|
-
"fm-typo-en-body-sm-400",
|
|
540
|
-
{
|
|
541
|
-
"text-fm-color-system-error-200": o.errors.length,
|
|
542
|
-
"text-fm-color-typo-secondary": !o.errors.length
|
|
543
|
-
}
|
|
544
|
-
])
|
|
545
|
-
}, $((f = o.locations) != null && f.length ? p(s)("inventory.closing.template.import.nLocations", { count: (i = o.locations) == null ? void 0 : i.length }) : p(s)("inventory.closing.template.import.allLocations")) + ", " + $(p(s)("inventory.closing.template.import.nItems", { count: (m = o.items) == null ? void 0 : m.length })), 3)
|
|
546
|
-
])
|
|
547
|
-
]);
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
}), Mt = { class: "flex flex-col gap-24" }, St = { class: "fm-typo-en-body-md-400" }, It = {
|
|
551
|
-
key: 0,
|
|
552
|
-
class: "flex items-center gap-8"
|
|
553
|
-
}, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ft = { class: "flex flex-col gap-8" }, Pt = { class: "line-clamp-2 text-ellipsis break-all" }, At = {
|
|
554
|
-
key: 2,
|
|
555
|
-
class: "shrink-0"
|
|
556
|
-
}, Et = {
|
|
557
|
-
key: 0,
|
|
558
|
-
class: "flex flex-col"
|
|
559
|
-
}, Ut = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Vt = {
|
|
560
|
-
key: 0,
|
|
561
|
-
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
562
|
-
}, Nt = { class: "fm-typo-en-body-lg-600" }, Bt = /* @__PURE__ */ H({
|
|
563
|
-
__name: "ClosingTemplateImport",
|
|
564
|
-
setup(r) {
|
|
565
|
-
const s = M(null), o = Ze(), n = Q(), t = M(!1), e = M(!1), f = M(new Array()), i = M([]), m = M([]), c = A(
|
|
566
|
-
() => !!f.value.length || i.value.some((y) => y.errors.length) || m.value.some((y) => y.errors.length)
|
|
567
|
-
), u = A(
|
|
568
|
-
() => !!i.value.length || !!m.value.length
|
|
569
|
-
), { t: g } = N();
|
|
570
|
-
async function _(y) {
|
|
571
|
-
f.value = [], i.value = [], m.value = [];
|
|
572
|
-
try {
|
|
573
|
-
t.value = !0;
|
|
574
|
-
const [a] = await Promise.all([
|
|
575
|
-
ct(y),
|
|
576
|
-
// fake buffer
|
|
577
|
-
new Promise((d) => setTimeout(d, 1e3))
|
|
578
|
-
]);
|
|
579
|
-
if (!a.SheetNames.filter(
|
|
580
|
-
(d) => !Object.values(ce).map(String).includes(d)
|
|
581
|
-
).find((d) => d)) {
|
|
582
|
-
f.value.push(g("inventory.ingredient.import.fileError.noSheet"));
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
const T = wt(a);
|
|
586
|
-
if (T.invalidExcel) {
|
|
587
|
-
f.value.push(
|
|
588
|
-
T.invalidExcelMessage ?? g("inventory.ingredient.import.fileError.invalidExcel")
|
|
589
|
-
);
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
if (i.value = T.importCreateResult, m.value = T.importUpdateResult, !i.value.length && !m.value.length) {
|
|
593
|
-
f.value.push(g("inventory.ingredient.import.fileError.noData"));
|
|
594
|
-
return;
|
|
595
|
-
}
|
|
596
|
-
o.emitData(T);
|
|
597
|
-
} catch (a) {
|
|
598
|
-
n.open({
|
|
599
|
-
title: g("inventory.ingredient.import.fileError.unableToRead"),
|
|
600
|
-
message: a == null ? void 0 : a.message,
|
|
601
|
-
type: "error"
|
|
602
|
-
}), console.error("Error in reading file", a);
|
|
603
|
-
} finally {
|
|
604
|
-
f.value.length && n.open({
|
|
605
|
-
title: g("inventory.ingredient.import.fileError.invalidExcel"),
|
|
606
|
-
type: "error"
|
|
607
|
-
}), t.value = !1;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
return Fe(s, (y) => {
|
|
611
|
-
y && _(y);
|
|
612
|
-
}), (y, a) => {
|
|
613
|
-
const l = R("FmCircularProgress"), v = R("FmIcon"), T = R("FmButton");
|
|
614
|
-
return w(), C("div", Mt, [
|
|
615
|
-
h("div", St, $(p(g)("inventory.closing.template.import.message")), 1),
|
|
616
|
-
e.value ? (w(), C("div", It, [
|
|
617
|
-
h("div", null, [
|
|
618
|
-
k(l, {
|
|
619
|
-
size: "md",
|
|
620
|
-
color: "neutral-gray-200"
|
|
621
|
-
})
|
|
622
|
-
]),
|
|
623
|
-
h("div", Rt, $(p(g)("inventory.formField.loading")), 1)
|
|
624
|
-
])) : (w(), C(z, { key: 1 }, [
|
|
625
|
-
k(mt, {
|
|
626
|
-
class: O({
|
|
627
|
-
"w-full": !0,
|
|
628
|
-
"h-[200px]": !s.value
|
|
629
|
-
}),
|
|
630
|
-
accept: ".xlsx",
|
|
631
|
-
onFileUpload: a[0] || (a[0] = (d) => s.value = d),
|
|
632
|
-
label: p(g)("inventory.ingredient.import.uploadTemplate"),
|
|
633
|
-
"button-label": p(g)("inventory.ingredient.import.selectFile")
|
|
634
|
-
}, je({ _: 2 }, [
|
|
635
|
-
s.value ? {
|
|
636
|
-
name: "default",
|
|
637
|
-
fn: F(({ openFileDialog: d }) => [
|
|
638
|
-
h("div", Ft, [
|
|
639
|
-
h("div", {
|
|
640
|
-
class: O([
|
|
641
|
-
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
642
|
-
{
|
|
643
|
-
"border border-fm-color-neutral-gray-100": t.value,
|
|
644
|
-
"border border-fm-color-neutral-gray-200": !t.value && !c.value,
|
|
645
|
-
"border border-fm-color-system-error-200": c.value
|
|
646
|
-
}
|
|
647
|
-
])
|
|
648
|
-
}, [
|
|
649
|
-
t.value ? (w(), U(l, {
|
|
650
|
-
key: 0,
|
|
651
|
-
size: "md",
|
|
652
|
-
color: "neutral-gray-200"
|
|
653
|
-
})) : (w(), U(v, {
|
|
654
|
-
key: 1,
|
|
655
|
-
name: c.value ? "error" : "attach_file",
|
|
656
|
-
outline: "",
|
|
657
|
-
color: c.value ? "system-error-300" : void 0
|
|
658
|
-
}, null, 8, ["name", "color"])),
|
|
659
|
-
h("div", {
|
|
660
|
-
class: O([
|
|
661
|
-
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
662
|
-
{
|
|
663
|
-
"text-fm-color-typo-disabled": t.value,
|
|
664
|
-
"text-fm-color-typo-primary": !t.value
|
|
665
|
-
}
|
|
666
|
-
])
|
|
667
|
-
}, [
|
|
668
|
-
h("div", Pt, $(s.value.name), 1)
|
|
669
|
-
], 2),
|
|
670
|
-
t.value ? K("", !0) : (w(), C("div", At, [
|
|
671
|
-
k(T, {
|
|
672
|
-
label: p(g)("inventory.ingredient.import.replaceFile"),
|
|
673
|
-
variant: c.value ? "destructive" : "secondary",
|
|
674
|
-
"prepend-icon": c.value ? void 0 : "autorenew",
|
|
675
|
-
onClick: d
|
|
676
|
-
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
677
|
-
]))
|
|
678
|
-
], 2),
|
|
679
|
-
f.value.length ? (w(), C("div", Et, [
|
|
680
|
-
(w(!0), C(z, null, G(f.value, (D, b) => (w(), C("div", {
|
|
681
|
-
key: b,
|
|
682
|
-
class: "flex gap-8 items-center"
|
|
683
|
-
}, [
|
|
684
|
-
k(v, {
|
|
685
|
-
name: "error",
|
|
686
|
-
size: "sm",
|
|
687
|
-
color: "system-error-300"
|
|
688
|
-
}),
|
|
689
|
-
h("div", Ut, $(D), 1)
|
|
690
|
-
]))), 128))
|
|
691
|
-
])) : K("", !0)
|
|
692
|
-
])
|
|
693
|
-
]),
|
|
694
|
-
key: "0"
|
|
695
|
-
} : void 0
|
|
696
|
-
]), 1032, ["class", "label", "button-label"]),
|
|
697
|
-
u.value ? (w(), C("div", Vt, [
|
|
698
|
-
h("div", Nt, $(p(g)("inventory.ingredient.import.summary")), 1),
|
|
699
|
-
(w(!0), C(z, null, G(i.value, (d, D) => (w(), U(Ie, {
|
|
700
|
-
key: D,
|
|
701
|
-
name: d.template.name,
|
|
702
|
-
locations: d.template.locations,
|
|
703
|
-
items: d.template.items,
|
|
704
|
-
errors: d.errors,
|
|
705
|
-
type: "create"
|
|
706
|
-
}, null, 8, ["name", "locations", "items", "errors"]))), 128)),
|
|
707
|
-
(w(!0), C(z, null, G(m.value, (d) => (w(), U(Ie, {
|
|
708
|
-
key: d.template._id,
|
|
709
|
-
name: d.template.name,
|
|
710
|
-
locations: d.template.locations,
|
|
711
|
-
items: d.template.items,
|
|
712
|
-
errors: d.errors,
|
|
713
|
-
type: "update"
|
|
714
|
-
}, null, 8, ["name", "locations", "items", "errors"]))), 128))
|
|
715
|
-
])) : K("", !0)
|
|
716
|
-
], 64))
|
|
717
|
-
]);
|
|
718
|
-
};
|
|
719
|
-
}
|
|
720
|
-
}), se = Pe("closingTemplateActions", () => {
|
|
721
|
-
const { t: r } = N(), s = ae(), o = Q(), n = Z(), t = ee(), { loading: e } = Ae(t), f = M({});
|
|
722
|
-
function i() {
|
|
723
|
-
f.value = {
|
|
724
|
-
mode: L.CREATE,
|
|
725
|
-
show: !0,
|
|
726
|
-
"onUpdate:show"(l) {
|
|
727
|
-
f.value.show = l;
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
function m(l) {
|
|
732
|
-
f.value = {
|
|
733
|
-
mode: L.UPDATE,
|
|
734
|
-
modelValue: l,
|
|
735
|
-
show: !0,
|
|
736
|
-
"onUpdate:show"(v) {
|
|
737
|
-
f.value.show = v;
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
function c(l, v, T) {
|
|
742
|
-
s.open({
|
|
743
|
-
title: `Confirm deleting template ${l.name}?`,
|
|
744
|
-
message: "Deleted template can no longer be retrieved",
|
|
745
|
-
primaryActions: {
|
|
746
|
-
text: "Delete",
|
|
747
|
-
variant: Me.Destructive,
|
|
748
|
-
close: !0
|
|
749
|
-
},
|
|
750
|
-
secondaryActions: {
|
|
751
|
-
text: "Cancel",
|
|
752
|
-
variant: Me.Plain,
|
|
753
|
-
close: !0
|
|
754
|
-
}
|
|
755
|
-
}).onPrimary(async () => {
|
|
756
|
-
o.open({
|
|
757
|
-
title: `Deleting ${l.name}`,
|
|
758
|
-
type: "info"
|
|
759
|
-
});
|
|
760
|
-
try {
|
|
761
|
-
v.value = !0;
|
|
762
|
-
const [d] = await Promise.allSettled([
|
|
763
|
-
n.deleteTemplate(l),
|
|
764
|
-
new Promise((D) => setTimeout(D, 1e3))
|
|
765
|
-
]);
|
|
766
|
-
if (d.status === "rejected") throw d.reason;
|
|
767
|
-
o.open({
|
|
768
|
-
title: `Deleted ${l.name}`,
|
|
769
|
-
type: "success"
|
|
770
|
-
});
|
|
771
|
-
} catch (d) {
|
|
772
|
-
o.open({
|
|
773
|
-
title: `Unable to delete ${l.name}`,
|
|
774
|
-
message: `See error from server: ${d}`,
|
|
775
|
-
type: "error"
|
|
776
|
-
}), console.error("error on deleting closing template", d);
|
|
777
|
-
} finally {
|
|
778
|
-
v.value = !1, T();
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
const u = M({});
|
|
783
|
-
function g(l) {
|
|
784
|
-
u.value = {
|
|
785
|
-
template: l,
|
|
786
|
-
show: !0,
|
|
787
|
-
"onUpdate:show"(v) {
|
|
788
|
-
u.value.show = v;
|
|
789
|
-
},
|
|
790
|
-
"onAction:edit"() {
|
|
791
|
-
u.value.show = !1, m(Ee(l));
|
|
792
|
-
}
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
function _() {
|
|
796
|
-
if (!t.templates.length) {
|
|
797
|
-
o.open({
|
|
798
|
-
title: "No data to export",
|
|
799
|
-
type: "error"
|
|
800
|
-
});
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
const l = gt(t.templates);
|
|
804
|
-
o.open({
|
|
805
|
-
title: r("inventory.ingredient.export.success"),
|
|
806
|
-
message: r("inventory.ingredient.export.filename", [l]),
|
|
807
|
-
type: "success"
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
function y() {
|
|
811
|
-
t.loading || s.open({
|
|
812
|
-
title: r("inventory.ingredient.import.title"),
|
|
813
|
-
contentComponent: Bt,
|
|
814
|
-
overlay: !0,
|
|
815
|
-
closeButton: !0,
|
|
816
|
-
primaryActions: {
|
|
817
|
-
text: r("common.import"),
|
|
818
|
-
close: !1
|
|
819
|
-
},
|
|
820
|
-
secondaryActions: {
|
|
821
|
-
text: r("common.close"),
|
|
822
|
-
close: !0
|
|
823
|
-
},
|
|
824
|
-
tertiaryActions: {
|
|
825
|
-
text: r("inventory.ingredient.import.actions.downloadTemplate"),
|
|
826
|
-
close: !1,
|
|
827
|
-
variant: "plain"
|
|
828
|
-
}
|
|
829
|
-
}).onPrimary((l) => {
|
|
830
|
-
if (!l) {
|
|
831
|
-
o.open({
|
|
832
|
-
title: r("inventory.ingredient.import.error.noData"),
|
|
833
|
-
type: "error"
|
|
834
|
-
});
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
if (!l.importCreateResult.length && !l.importUpdateResult.length) {
|
|
838
|
-
o.open({
|
|
839
|
-
title: r("inventory.ingredient.import.error.invalidContent"),
|
|
840
|
-
message: r("inventory.ingredient.import.error.noImportData"),
|
|
841
|
-
type: "error"
|
|
842
|
-
});
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
if (l.importCreateResult.some((v) => v.errors.length) || l.importUpdateResult.some((v) => v.errors.length)) {
|
|
846
|
-
o.open({
|
|
847
|
-
title: r("inventory.ingredient.import.error.invalidContent"),
|
|
848
|
-
message: r("inventory.ingredient.import.error.hasErrors"),
|
|
849
|
-
type: "error"
|
|
850
|
-
});
|
|
851
|
-
return;
|
|
852
|
-
}
|
|
853
|
-
s.close(), a(l);
|
|
854
|
-
}).onTertiary(vt);
|
|
855
|
-
}
|
|
856
|
-
async function a(l) {
|
|
857
|
-
e.value = !0;
|
|
858
|
-
try {
|
|
859
|
-
const v = [
|
|
860
|
-
...l.importCreateResult.map(
|
|
861
|
-
(b) => b.template
|
|
862
|
-
),
|
|
863
|
-
...l.importUpdateResult.map(
|
|
864
|
-
(b) => b.template
|
|
865
|
-
)
|
|
866
|
-
], T = 100;
|
|
867
|
-
let d = 0;
|
|
868
|
-
const D = () => {
|
|
869
|
-
d += T, o.open({
|
|
870
|
-
title: r("inventory.ingredient.import.progress", [
|
|
871
|
-
Math.min(d, v.length),
|
|
872
|
-
v.length
|
|
873
|
-
])
|
|
874
|
-
});
|
|
875
|
-
};
|
|
876
|
-
for (const b of v.chunk(100))
|
|
877
|
-
D(), await n.importTemplates(b);
|
|
878
|
-
o.open({
|
|
879
|
-
title: r("inventory.ingredient.import.success"),
|
|
880
|
-
type: "success"
|
|
881
|
-
});
|
|
882
|
-
} catch (v) {
|
|
883
|
-
o.open({
|
|
884
|
-
title: r("inventory.ingredient.import.error.failed"),
|
|
885
|
-
message: r("inventory.ingredient.import.error.systemMessage", [v == null ? void 0 : v.message]),
|
|
886
|
-
type: "error"
|
|
887
|
-
}), console.error("Error in importing skus", l, v);
|
|
888
|
-
} finally {
|
|
889
|
-
e.value = !1, t.fetchTemplates();
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
return {
|
|
893
|
-
createTemplate: i,
|
|
894
|
-
viewTemplate: g,
|
|
895
|
-
updateTemplate: m,
|
|
896
|
-
deleteTemplate: c,
|
|
897
|
-
exportTemplates: _,
|
|
898
|
-
importTemplates: y,
|
|
899
|
-
templateDialogProps: f,
|
|
900
|
-
templateDetailsProps: u
|
|
901
|
-
};
|
|
902
|
-
});
|
|
903
|
-
var Y = /* @__PURE__ */ ((r) => (r.Name = "Name", r.Unit = "Unit", r.Delete = "Delete", r))(Y || {});
|
|
904
|
-
function Lt(r) {
|
|
905
|
-
return {
|
|
906
|
-
columnDefs: A(() => {
|
|
907
|
-
const o = r.items.map((t) => t.sku.unit.measurements.length).reduce((t, e) => Math.max(t, e), 0);
|
|
908
|
-
return [
|
|
909
|
-
{
|
|
910
|
-
id: "Name",
|
|
911
|
-
header: () => "Name",
|
|
912
|
-
enableSorting: !1,
|
|
913
|
-
size: 400,
|
|
914
|
-
cell(t) {
|
|
915
|
-
const e = t.row.original;
|
|
916
|
-
return S(
|
|
917
|
-
"div",
|
|
918
|
-
{
|
|
919
|
-
class: "flex flex-col"
|
|
920
|
-
},
|
|
921
|
-
[
|
|
922
|
-
S(
|
|
923
|
-
"span",
|
|
924
|
-
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1" },
|
|
925
|
-
e.sku.name
|
|
926
|
-
),
|
|
927
|
-
S(
|
|
928
|
-
"span",
|
|
929
|
-
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
|
|
930
|
-
e.sku.code
|
|
931
|
-
)
|
|
932
|
-
]
|
|
933
|
-
);
|
|
934
|
-
}
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
id: "Unit",
|
|
938
|
-
header: () => "Enable unit",
|
|
939
|
-
enableSorting: !1,
|
|
940
|
-
size: "auto",
|
|
941
|
-
cell(t) {
|
|
942
|
-
var f, i, m;
|
|
943
|
-
const e = t.row.original;
|
|
944
|
-
return S(
|
|
945
|
-
B.FmFormGroup,
|
|
946
|
-
{
|
|
947
|
-
value: e.sku.unit._id,
|
|
948
|
-
modelValue: !((f = e.disabledMeasurements) != null && f.includes(e.sku.unit._id))
|
|
949
|
-
},
|
|
950
|
-
S(
|
|
951
|
-
"div",
|
|
952
|
-
{
|
|
953
|
-
class: "flex items-center gap-4"
|
|
954
|
-
},
|
|
955
|
-
[
|
|
956
|
-
S(B.FmCheckbox, {
|
|
957
|
-
value: e.sku.unit._id,
|
|
958
|
-
modelValue: !((i = e.disabledMeasurements) != null && i.includes(e.sku.unit._id)),
|
|
959
|
-
disabled: r.disabled || !((m = e.disabledMeasurements) != null && m.includes(e.sku.unit._id)) && e.sku.unit.measurements.every(
|
|
960
|
-
(c) => {
|
|
961
|
-
var u;
|
|
962
|
-
return (u = e.disabledMeasurements) == null ? void 0 : u.includes(c.id);
|
|
963
|
-
}
|
|
964
|
-
),
|
|
965
|
-
"onUpdate:modelValue"(c) {
|
|
966
|
-
var u;
|
|
967
|
-
if (c)
|
|
968
|
-
r.updateItem({
|
|
969
|
-
...e,
|
|
970
|
-
disabledMeasurements: (u = e.disabledMeasurements) == null ? void 0 : u.filter(
|
|
971
|
-
(g) => g !== e.sku.unit._id
|
|
972
|
-
)
|
|
973
|
-
});
|
|
974
|
-
else {
|
|
975
|
-
const g = e.disabledMeasurements ?? [];
|
|
976
|
-
r.updateItem({
|
|
977
|
-
...e,
|
|
978
|
-
disabledMeasurements: [...g, e.sku.unit._id]
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
}),
|
|
983
|
-
S(
|
|
984
|
-
B.FmTooltip,
|
|
985
|
-
{ zIndex: 51 },
|
|
986
|
-
{
|
|
987
|
-
content() {
|
|
988
|
-
return e.sku.unit.abbrev;
|
|
989
|
-
},
|
|
990
|
-
default() {
|
|
991
|
-
return S(
|
|
992
|
-
"div",
|
|
993
|
-
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
994
|
-
e.sku.unit.abbrev
|
|
995
|
-
);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
)
|
|
999
|
-
]
|
|
1000
|
-
)
|
|
1001
|
-
);
|
|
1002
|
-
}
|
|
1003
|
-
},
|
|
1004
|
-
...Array.from({ length: Math.max(o, 0) }).map(
|
|
1005
|
-
(t, e) => ({
|
|
1006
|
-
id: `measurement${e}`,
|
|
1007
|
-
header: () => "",
|
|
1008
|
-
enableSorting: !1,
|
|
1009
|
-
size: "auto",
|
|
1010
|
-
cell(f) {
|
|
1011
|
-
var c, u, g, _;
|
|
1012
|
-
const i = f.row.original, m = i.sku.unit.measurements[e];
|
|
1013
|
-
return m ? S(
|
|
1014
|
-
B.FmFormGroup,
|
|
1015
|
-
{
|
|
1016
|
-
modelValue: !((c = i.disabledMeasurements) != null && c.includes(m.id)),
|
|
1017
|
-
value: m.id
|
|
1018
|
-
},
|
|
1019
|
-
S(
|
|
1020
|
-
"div",
|
|
1021
|
-
{
|
|
1022
|
-
class: "flex items-center gap-4"
|
|
1023
|
-
},
|
|
1024
|
-
[
|
|
1025
|
-
S(B.FmCheckbox, {
|
|
1026
|
-
value: m.id,
|
|
1027
|
-
modelValue: !((u = i.disabledMeasurements) != null && u.includes(m.id)),
|
|
1028
|
-
disabled: r.disabled || !((g = i.disabledMeasurements) != null && g.includes(m.id)) && ((_ = i.disabledMeasurements) == null ? void 0 : _.includes(i.sku.unit._id)) && i.sku.unit.measurements.filter((y) => y.id != m.id).every((y) => {
|
|
1029
|
-
var a;
|
|
1030
|
-
return (a = i.disabledMeasurements) == null ? void 0 : a.includes(y.id);
|
|
1031
|
-
}),
|
|
1032
|
-
"onUpdate:modelValue"(y) {
|
|
1033
|
-
var a;
|
|
1034
|
-
if (y)
|
|
1035
|
-
r.updateItem({
|
|
1036
|
-
...i,
|
|
1037
|
-
disabledMeasurements: (a = i.disabledMeasurements) == null ? void 0 : a.filter(
|
|
1038
|
-
(l) => l !== m.id
|
|
1039
|
-
)
|
|
1040
|
-
});
|
|
1041
|
-
else {
|
|
1042
|
-
const l = i.disabledMeasurements ?? [];
|
|
1043
|
-
r.updateItem({
|
|
1044
|
-
...i,
|
|
1045
|
-
disabledMeasurements: [...l, m.id]
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
}),
|
|
1050
|
-
S(
|
|
1051
|
-
B.FmTooltip,
|
|
1052
|
-
{ zIndex: 51 },
|
|
1053
|
-
{
|
|
1054
|
-
content() {
|
|
1055
|
-
return m.abbrev;
|
|
1056
|
-
},
|
|
1057
|
-
default() {
|
|
1058
|
-
return S(
|
|
1059
|
-
"div",
|
|
1060
|
-
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
1061
|
-
m.abbrev
|
|
1062
|
-
);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
)
|
|
1066
|
-
]
|
|
1067
|
-
)
|
|
1068
|
-
) : null;
|
|
1069
|
-
}
|
|
1070
|
-
})
|
|
1071
|
-
),
|
|
1072
|
-
{
|
|
1073
|
-
id: "Delete",
|
|
1074
|
-
header: "",
|
|
1075
|
-
cell(t) {
|
|
1076
|
-
const e = t.row.original;
|
|
1077
|
-
return S(
|
|
1078
|
-
"div",
|
|
1079
|
-
{ class: "w-full flex justify-end" },
|
|
1080
|
-
S(B.FmButton, {
|
|
1081
|
-
class: "delete-button",
|
|
1082
|
-
key: e.sku._id,
|
|
1083
|
-
type: "button",
|
|
1084
|
-
icon: "delete",
|
|
1085
|
-
variant: "tertiary",
|
|
1086
|
-
size: "md",
|
|
1087
|
-
disabled: r.disabled,
|
|
1088
|
-
onClick: () => {
|
|
1089
|
-
r.deleteItem(e);
|
|
1090
|
-
}
|
|
1091
|
-
})
|
|
1092
|
-
);
|
|
1093
|
-
},
|
|
1094
|
-
enableSorting: !1,
|
|
1095
|
-
size: 40,
|
|
1096
|
-
meta: {
|
|
1097
|
-
cellClass: "",
|
|
1098
|
-
headerClass: ""
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
];
|
|
1102
|
-
})
|
|
1103
|
-
};
|
|
1104
|
-
}
|
|
1105
|
-
const zt = { class: "flex flex-col gap-16 py-12" }, Ht = { class: "flex" }, jt = { class: "flex-1 flex flex-col" }, Ot = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, Yt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Kt = { class: "flex flex-col gap-4" }, Gt = /* @__PURE__ */ H({
|
|
1106
|
-
__name: "ClosingTemplateItem",
|
|
1107
|
-
props: {
|
|
1108
|
-
cellByColId: {},
|
|
1109
|
-
row: {}
|
|
1110
|
-
},
|
|
1111
|
-
setup(r) {
|
|
1112
|
-
const s = r, o = A(() => s.row), n = A(
|
|
1113
|
-
() => o.value.getVisibleCells().filter((t) => t.column.id !== Y.Name && t.column.id !== Y.Delete)
|
|
1114
|
-
);
|
|
1115
|
-
return (t, e) => {
|
|
1116
|
-
var f, i, m, c, u;
|
|
1117
|
-
return w(), C("div", zt, [
|
|
1118
|
-
h("div", Ht, [
|
|
1119
|
-
h("div", jt, [
|
|
1120
|
-
h("div", Ot, $(o.value.original.sku.name), 1),
|
|
1121
|
-
h("div", Yt, $(o.value.original.sku.code), 1)
|
|
1122
|
-
]),
|
|
1123
|
-
h("div", null, [
|
|
1124
|
-
k(p(j), {
|
|
1125
|
-
render: (m = (i = (f = t.cellByColId[p(Y).Delete]) == null ? void 0 : f.column) == null ? void 0 : i.columnDef) == null ? void 0 : m.cell,
|
|
1126
|
-
props: (u = (c = t.cellByColId[p(Y).Delete]) == null ? void 0 : c.getContext) == null ? void 0 : u.call(c)
|
|
1127
|
-
}, null, 8, ["render", "props"])
|
|
1128
|
-
])
|
|
1129
|
-
]),
|
|
1130
|
-
h("div", Kt, [
|
|
1131
|
-
e[0] || (e[0] = h("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, null, -1)),
|
|
1132
|
-
(w(!0), C(z, null, G(n.value, (g) => {
|
|
1133
|
-
var _, y, a;
|
|
1134
|
-
return w(), C("div", {
|
|
1135
|
-
key: g.id
|
|
1136
|
-
}, [
|
|
1137
|
-
k(p(j), {
|
|
1138
|
-
render: (y = (_ = g.column) == null ? void 0 : _.columnDef) == null ? void 0 : y.cell,
|
|
1139
|
-
props: (a = g.getContext) == null ? void 0 : a.call(g)
|
|
1140
|
-
}, null, 8, ["render", "props"])
|
|
1141
|
-
]);
|
|
1142
|
-
}), 128))
|
|
1143
|
-
])
|
|
1144
|
-
]);
|
|
1145
|
-
};
|
|
1146
|
-
}
|
|
1147
|
-
}), Jt = { class: "flex flex-col gap-16" }, Wt = { class: "flex flex-col gap-24" }, qt = { class: "flex flex-col gap-16" }, Xt = { class: "flex items-center" }, Qt = { class: "flex-1 fm-typo-en-title-sm-600" }, Zt = { class: "flex flex-col gap-16" }, en = { class: "flex items-center" }, tn = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, nn = /* @__PURE__ */ H({
|
|
1148
|
-
__name: "ClosingTemplateForm",
|
|
1149
|
-
props: {
|
|
1150
|
-
modelValue: {},
|
|
1151
|
-
disabled: { type: Boolean }
|
|
1152
|
-
},
|
|
1153
|
-
setup(r, { expose: s }) {
|
|
1154
|
-
const o = r, n = pt(), { t } = N(), e = ie(), f = ae(), {
|
|
1155
|
-
promptSelectLocations: i,
|
|
1156
|
-
columnDefs: m,
|
|
1157
|
-
rowData: c
|
|
1158
|
-
} = ft({
|
|
1159
|
-
getLocations() {
|
|
1160
|
-
return n.locations;
|
|
1161
|
-
},
|
|
1162
|
-
setLocations(a) {
|
|
1163
|
-
n.locations = a;
|
|
1164
|
-
}
|
|
1165
|
-
}), u = M();
|
|
1166
|
-
s({
|
|
1167
|
-
validateInputs: () => {
|
|
1168
|
-
var a, l;
|
|
1169
|
-
(l = (a = u.value) == null ? void 0 : a.validateInputs) == null || l.call(a);
|
|
1170
|
-
},
|
|
1171
|
-
resetInputsValidation: () => {
|
|
1172
|
-
var a, l;
|
|
1173
|
-
(l = (a = u.value) == null ? void 0 : a.resetInputsValidation) == null || l.call(a);
|
|
1174
|
-
},
|
|
1175
|
-
resetInputs: () => {
|
|
1176
|
-
var a, l;
|
|
1177
|
-
(l = (a = u.value) == null ? void 0 : a.resetInputs) == null || l.call(a);
|
|
1178
|
-
}
|
|
1179
|
-
});
|
|
1180
|
-
const g = Lt({
|
|
1181
|
-
updateItem: (a) => {
|
|
1182
|
-
n.items = n.items.map((l) => l.sku._id !== a.sku._id ? l : a);
|
|
1183
|
-
},
|
|
1184
|
-
deleteItem: (a) => {
|
|
1185
|
-
n.items = n.items.filter((l) => l.sku._id !== a.sku._id);
|
|
1186
|
-
},
|
|
1187
|
-
get items() {
|
|
1188
|
-
return n.items;
|
|
1189
|
-
},
|
|
1190
|
-
get disabled() {
|
|
1191
|
-
return o.disabled;
|
|
1192
|
-
}
|
|
1193
|
-
}), _ = A(() => g.columnDefs.value);
|
|
1194
|
-
function y() {
|
|
1195
|
-
const a = e.skus.map((v) => ({
|
|
1196
|
-
label: v.name,
|
|
1197
|
-
sublabel: v.code,
|
|
1198
|
-
value: v
|
|
1199
|
-
})), l = a.filter((v) => {
|
|
1200
|
-
var T;
|
|
1201
|
-
return (T = n.items) == null ? void 0 : T.find((d) => d.sku._id === v.value._id);
|
|
1202
|
-
}).map((v) => v.value);
|
|
1203
|
-
f.open({
|
|
1204
|
-
title: t("inventory.closing.form.items.selectItem"),
|
|
1205
|
-
closeButton: !0,
|
|
1206
|
-
contentComponent: rt,
|
|
1207
|
-
contentComponentProps: {
|
|
1208
|
-
modelValue: l,
|
|
1209
|
-
items: a,
|
|
1210
|
-
virtualScroll: !0
|
|
1211
|
-
},
|
|
1212
|
-
primaryActions: {
|
|
1213
|
-
text: t("common.confirm"),
|
|
1214
|
-
close: !0
|
|
1215
|
-
},
|
|
1216
|
-
secondaryActions: {
|
|
1217
|
-
text: t("common.close"),
|
|
1218
|
-
close: !0,
|
|
1219
|
-
variant: "tertiary"
|
|
1220
|
-
}
|
|
1221
|
-
}).onPrimary((v) => {
|
|
1222
|
-
const T = n.items ?? [], d = v.map((D) => {
|
|
1223
|
-
const b = T.find((P) => P.sku._id === D._id);
|
|
1224
|
-
return b || {
|
|
1225
|
-
sku: D
|
|
1226
|
-
};
|
|
1227
|
-
});
|
|
1228
|
-
d.sort((D, b) => D.sku.code.localeCompare(b.sku.code)), n.items = d;
|
|
1229
|
-
});
|
|
1230
|
-
}
|
|
1231
|
-
return (a, l) => {
|
|
1232
|
-
const v = R("FmTextField"), T = R("FmButton"), d = R("FmTable"), D = R("FmFormGroup"), b = R("FmForm");
|
|
1233
|
-
return w(), U(b, {
|
|
1234
|
-
ref_key: "formRef",
|
|
1235
|
-
ref: u,
|
|
1236
|
-
class: "flex flex-col gap-32",
|
|
1237
|
-
disabled: a.disabled
|
|
1238
|
-
}, {
|
|
1239
|
-
default: F(() => [
|
|
1240
|
-
h("div", Jt, [
|
|
1241
|
-
h("div", Wt, [
|
|
1242
|
-
k(v, {
|
|
1243
|
-
label: p(t)("inventory.closing.form.name"),
|
|
1244
|
-
"label-mark": "required",
|
|
1245
|
-
modelValue: p(n).name,
|
|
1246
|
-
"onUpdate:modelValue": l[0] || (l[0] = (x) => p(n).name = x),
|
|
1247
|
-
rules: [p(lt)()]
|
|
1248
|
-
}, null, 8, ["label", "modelValue", "rules"]),
|
|
1249
|
-
k(v, {
|
|
1250
|
-
label: p(t)("inventory.closing.form.reference"),
|
|
1251
|
-
"label-mark": "optional",
|
|
1252
|
-
modelValue: p(n).ref,
|
|
1253
|
-
"onUpdate:modelValue": l[1] || (l[1] = (x) => p(n).ref = x)
|
|
1254
|
-
}, null, 8, ["label", "modelValue"])
|
|
1255
|
-
])
|
|
1256
|
-
]),
|
|
1257
|
-
h("div", qt, [
|
|
1258
|
-
h("div", Xt, [
|
|
1259
|
-
h("div", Qt, $(p(t)("inventory.closing.form.locations")), 1),
|
|
1260
|
-
k(T, {
|
|
1261
|
-
disabled: a.disabled,
|
|
1262
|
-
label: p(t)("inventory.closing.form.selectLocation"),
|
|
1263
|
-
"prepend-icon": "add",
|
|
1264
|
-
variant: "plain",
|
|
1265
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
1266
|
-
onClick: p(i)
|
|
1267
|
-
}, null, 8, ["disabled", "label", "onClick"])
|
|
1268
|
-
]),
|
|
1269
|
-
k(d, {
|
|
1270
|
-
"column-defs": p(m),
|
|
1271
|
-
"row-data": p(c),
|
|
1272
|
-
"shrink-at": 9999,
|
|
1273
|
-
onRowClick: p(i),
|
|
1274
|
-
"hide-footer": ""
|
|
1275
|
-
}, null, 8, ["column-defs", "row-data", "onRowClick"])
|
|
1276
|
-
]),
|
|
1277
|
-
h("div", Zt, [
|
|
1278
|
-
h("div", en, [
|
|
1279
|
-
h("div", tn, $(p(t)("inventory.closing.form.items.title")), 1),
|
|
1280
|
-
k(T, {
|
|
1281
|
-
disabled: a.disabled,
|
|
1282
|
-
label: p(t)("inventory.closing.form.items.addItem"),
|
|
1283
|
-
"prepend-icon": "add",
|
|
1284
|
-
variant: "plain",
|
|
1285
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
1286
|
-
onClick: l[2] || (l[2] = (x) => y()),
|
|
1287
|
-
size: "md"
|
|
1288
|
-
}, null, 8, ["disabled", "label"])
|
|
1289
|
-
]),
|
|
1290
|
-
(w(), U(d, {
|
|
1291
|
-
"column-defs": _.value,
|
|
1292
|
-
"row-data": p(n).items,
|
|
1293
|
-
key: p(n).items.map((x) => x.sku._id).join("."),
|
|
1294
|
-
"hide-footer": "",
|
|
1295
|
-
"page-size": p(n).items.length
|
|
1296
|
-
}, {
|
|
1297
|
-
"list-row": F((x) => [
|
|
1298
|
-
(w(), U(Be, {
|
|
1299
|
-
row: x,
|
|
1300
|
-
key: p(n).items.map((P) => P.sku._id).join(".")
|
|
1301
|
-
}, {
|
|
1302
|
-
default: F((P) => [
|
|
1303
|
-
k(Gt, {
|
|
1304
|
-
row: x,
|
|
1305
|
-
"cell-by-col-id": P
|
|
1306
|
-
}, null, 8, ["row", "cell-by-col-id"])
|
|
1307
|
-
]),
|
|
1308
|
-
_: 2
|
|
1309
|
-
}, 1032, ["row"]))
|
|
1310
|
-
]),
|
|
1311
|
-
_: 1
|
|
1312
|
-
}, 8, ["column-defs", "row-data", "page-size"])),
|
|
1313
|
-
k(D, {
|
|
1314
|
-
"model-value": p(n).items.length,
|
|
1315
|
-
rules: [p(at)(1)]
|
|
1316
|
-
}, null, 8, ["model-value", "rules"])
|
|
1317
|
-
])
|
|
1318
|
-
]),
|
|
1319
|
-
_: 1
|
|
1320
|
-
}, 8, ["disabled"]);
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
}), on = { class: "flex items-center" }, sn = { class: "fm-typo-en-title-md-600" }, ln = { class: "flex gap-4" }, an = /* @__PURE__ */ H({
|
|
1324
|
-
__name: "ClosingTemplateDialog",
|
|
1325
|
-
props: {
|
|
1326
|
-
mode: {},
|
|
1327
|
-
modelValue: {},
|
|
1328
|
-
show: { type: Boolean }
|
|
1329
|
-
},
|
|
1330
|
-
emits: ["update:show", "submitted"],
|
|
1331
|
-
setup(r, { expose: s, emit: o }) {
|
|
1332
|
-
var D;
|
|
1333
|
-
const n = r, t = o, e = Z(), f = Q(), { t: i } = N(), m = et(n, "show");
|
|
1334
|
-
function c() {
|
|
1335
|
-
return {
|
|
1336
|
-
_id: "",
|
|
1337
|
-
name: "",
|
|
1338
|
-
items: []
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
|
-
const u = M(n.modelValue ?? c()), g = M(((D = n.modelValue) == null ? void 0 : D._id) ?? `${Math.random()}`);
|
|
1342
|
-
Fe(
|
|
1343
|
-
() => n.show,
|
|
1344
|
-
(b) => {
|
|
1345
|
-
var x;
|
|
1346
|
-
b && (u.value = n.modelValue ?? c(), g.value = ((x = n.modelValue) == null ? void 0 : x._id) ?? `${Math.random()}`);
|
|
1347
|
-
}
|
|
1348
|
-
);
|
|
1349
|
-
const _ = M(!1), y = A(() => {
|
|
1350
|
-
switch (n.mode) {
|
|
1351
|
-
case L.READ:
|
|
1352
|
-
return "";
|
|
1353
|
-
case L.CREATE:
|
|
1354
|
-
return i("inventory.closing.template.create.title");
|
|
1355
|
-
case L.UPDATE:
|
|
1356
|
-
return i("inventory.closing.template.update.title");
|
|
1357
|
-
}
|
|
1358
|
-
return "";
|
|
1359
|
-
}), a = M();
|
|
1360
|
-
s({
|
|
1361
|
-
validateInputs: () => {
|
|
1362
|
-
var b, x;
|
|
1363
|
-
(x = (b = a.value) == null ? void 0 : b.validateInputs) == null || x.call(b);
|
|
1364
|
-
},
|
|
1365
|
-
resetInputsValidation: () => {
|
|
1366
|
-
var b, x;
|
|
1367
|
-
(x = (b = a.value) == null ? void 0 : b.resetInputsValidation) == null || x.call(b);
|
|
1368
|
-
},
|
|
1369
|
-
resetInputs: () => {
|
|
1370
|
-
var b, x;
|
|
1371
|
-
(x = (b = a.value) == null ? void 0 : b.resetInputs) == null || x.call(b);
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
async function l() {
|
|
1375
|
-
const b = u.value;
|
|
1376
|
-
if (b) {
|
|
1377
|
-
_.value = !0;
|
|
1378
|
-
try {
|
|
1379
|
-
await e.createTemplate(b), await new Promise((x) => setTimeout(x, 1e3)), f.open({
|
|
1380
|
-
title: i("inventory.closing.template.create.success"),
|
|
1381
|
-
message: i("inventory.closing.template.create.successMessage"),
|
|
1382
|
-
type: "success"
|
|
1383
|
-
}), t("update:show", !1), t("submitted");
|
|
1384
|
-
} catch (x) {
|
|
1385
|
-
f.open({
|
|
1386
|
-
title: i("inventory.closing.template.create.error"),
|
|
1387
|
-
message: i("inventory.closing.template.create.errorMessage"),
|
|
1388
|
-
type: "error"
|
|
1389
|
-
}), console.error("Error in creating closing template", x);
|
|
1390
|
-
} finally {
|
|
1391
|
-
_.value = !1;
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
async function v() {
|
|
1396
|
-
const b = u.value;
|
|
1397
|
-
if (b) {
|
|
1398
|
-
_.value = !0;
|
|
1399
|
-
try {
|
|
1400
|
-
await e.updateTemplate({
|
|
1401
|
-
...b,
|
|
1402
|
-
_rev: b._rev ?? ""
|
|
1403
|
-
}), await new Promise((x) => setTimeout(x, 1e3)), f.open({
|
|
1404
|
-
title: i("inventory.closing.template.update.success"),
|
|
1405
|
-
message: i("inventory.closing.template.update.successMessage"),
|
|
1406
|
-
type: "success"
|
|
1407
|
-
}), t("update:show", !1), t("submitted");
|
|
1408
|
-
} catch (x) {
|
|
1409
|
-
f.open({
|
|
1410
|
-
title: i("inventory.closing.template.update.error"),
|
|
1411
|
-
message: i("inventory.closing.template.update.errorMessage"),
|
|
1412
|
-
type: "error"
|
|
1413
|
-
}), console.error("Error in updating closing template", x);
|
|
1414
|
-
} finally {
|
|
1415
|
-
_.value = !1;
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
function T() {
|
|
1420
|
-
switch (n.mode) {
|
|
1421
|
-
case L.CREATE:
|
|
1422
|
-
return l();
|
|
1423
|
-
case L.UPDATE:
|
|
1424
|
-
return v();
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
function d() {
|
|
1428
|
-
var b, x;
|
|
1429
|
-
(x = (b = a.value) == null ? void 0 : b.validateInputs) == null || x.call(b);
|
|
1430
|
-
}
|
|
1431
|
-
return (b, x) => {
|
|
1432
|
-
const P = R("FmButton"), te = R("FmSideSheet");
|
|
1433
|
-
return w(), U(te, {
|
|
1434
|
-
modelValue: p(m),
|
|
1435
|
-
"onUpdate:modelValue": x[2] || (x[2] = (I) => Oe(m) ? m.value = I : null),
|
|
1436
|
-
"dismiss-away": "",
|
|
1437
|
-
"close-button": "",
|
|
1438
|
-
"max-width": 800
|
|
1439
|
-
}, {
|
|
1440
|
-
"side-sheet-header": F(() => [
|
|
1441
|
-
h("div", on, [
|
|
1442
|
-
h("div", sn, $(y.value), 1)
|
|
1443
|
-
])
|
|
1444
|
-
]),
|
|
1445
|
-
default: F(() => [
|
|
1446
|
-
(w(), U(nn, {
|
|
1447
|
-
class: "w-full",
|
|
1448
|
-
ref_key: "formRef",
|
|
1449
|
-
ref: a,
|
|
1450
|
-
onValidationSuccess: T,
|
|
1451
|
-
"model-value": u.value,
|
|
1452
|
-
"onUpdate:modelValue": x[0] || (x[0] = (I) => u.value = I),
|
|
1453
|
-
disabled: _.value,
|
|
1454
|
-
key: g.value
|
|
1455
|
-
}, null, 8, ["model-value", "disabled"]))
|
|
1456
|
-
]),
|
|
1457
|
-
"side-sheet-footer": F(() => [
|
|
1458
|
-
h("div", ln, [
|
|
1459
|
-
k(P, {
|
|
1460
|
-
loading: _.value,
|
|
1461
|
-
label: p(i)("common.save"),
|
|
1462
|
-
onClick: d
|
|
1463
|
-
}, null, 8, ["loading", "label"]),
|
|
1464
|
-
k(P, {
|
|
1465
|
-
disabled: _.value,
|
|
1466
|
-
variant: "tertiary",
|
|
1467
|
-
label: p(i)("common.close"),
|
|
1468
|
-
onClick: x[1] || (x[1] = (I) => t("update:show", !1))
|
|
1469
|
-
}, null, 8, ["disabled", "label"])
|
|
1470
|
-
])
|
|
1471
|
-
]),
|
|
1472
|
-
_: 1
|
|
1473
|
-
}, 8, ["modelValue"]);
|
|
1474
|
-
};
|
|
1475
|
-
}
|
|
1476
|
-
}), rn = {};
|
|
1477
|
-
function cn(r, s) {
|
|
1478
|
-
return w(), C("div");
|
|
1479
|
-
}
|
|
1480
|
-
const mn = /* @__PURE__ */ it(rn, [["render", cn]]), un = { class: "flex flex-col gap-40" }, dn = { key: 0 }, pn = {
|
|
1481
|
-
key: 1,
|
|
1482
|
-
class: "flex gap-8 items-center"
|
|
1483
|
-
}, fn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, gn = {
|
|
1484
|
-
key: 2,
|
|
1485
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
|
|
1486
|
-
}, vn = {
|
|
1487
|
-
key: 3,
|
|
1488
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
|
|
1489
|
-
}, yn = { class: "fm-typo-en-body-md-600" }, hn = { class: "fm-typo-en-body-md-600" }, bn = { key: 4 }, _n = { class: "fm-typo-en-body-md-600" }, xn = { class: "fm-typo-en-body-md-600" }, wn = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, kn = /* @__PURE__ */ H({
|
|
1490
|
-
__name: "ClosingTemplatePublish",
|
|
1491
|
-
emits: ["close"],
|
|
1492
|
-
setup(r, { emit: s }) {
|
|
1493
|
-
const o = M(!1), n = Q(), t = Z(), e = ee(), { t: f } = N(), i = s;
|
|
1494
|
-
async function m() {
|
|
1495
|
-
o.value = !0;
|
|
1496
|
-
try {
|
|
1497
|
-
await t.startNewPublish().delayed(1e3), n.open({
|
|
1498
|
-
title: "Success",
|
|
1499
|
-
message: "You may refresh after a while to review publish status",
|
|
1500
|
-
type: "success"
|
|
1501
|
-
}), g();
|
|
1502
|
-
} catch (_) {
|
|
1503
|
-
n.open({
|
|
1504
|
-
title: "Something went wrong",
|
|
1505
|
-
message: "Please try again",
|
|
1506
|
-
type: "error"
|
|
1507
|
-
}), console.error("error on creating publish task", _);
|
|
1508
|
-
} finally {
|
|
1509
|
-
o.value = !1;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
const c = A(() => e.recentPublish.recentJob), u = A(
|
|
1513
|
-
() => e.templates.length && (!c.value || c.value.outlets.length === c.value.completed.length)
|
|
1514
|
-
);
|
|
1515
|
-
function g() {
|
|
1516
|
-
i("close");
|
|
1517
|
-
}
|
|
1518
|
-
return (_, y) => {
|
|
1519
|
-
const a = R("FmCircularProgress"), l = R("i18n-t"), v = R("FmButton");
|
|
1520
|
-
return w(), C("div", un, [
|
|
1521
|
-
p(e).templates.length ? o.value ? (w(), C("div", pn, [
|
|
1522
|
-
h("div", null, [
|
|
1523
|
-
k(a, {
|
|
1524
|
-
size: "md",
|
|
1525
|
-
color: "neutral-gray-300"
|
|
1526
|
-
})
|
|
1527
|
-
]),
|
|
1528
|
-
h("div", fn, [
|
|
1529
|
-
h("span", null, $(p(f)("inventory.closing.template.publish.publishing")), 1)
|
|
1530
|
-
])
|
|
1531
|
-
])) : c.value ? c.value.outlets.length === c.value.completed.length ? (w(), C("div", vn, [
|
|
1532
|
-
k(l, {
|
|
1533
|
-
keypath: "inventory.closing.template.publish.recentlyPublishedAt",
|
|
1534
|
-
tag: "p"
|
|
1535
|
-
}, {
|
|
1536
|
-
started: F(() => [
|
|
1537
|
-
h("span", yn, $(p(ne)(new Date(c.value.createdAt))), 1)
|
|
1538
|
-
]),
|
|
1539
|
-
finished: F(() => [
|
|
1540
|
-
h("span", hn, $(p(ne)(new Date(c.value.updatedAt))), 1)
|
|
1541
|
-
]),
|
|
1542
|
-
_: 1
|
|
1543
|
-
}),
|
|
1544
|
-
h("p", null, $(p(f)("inventory.closing.template.publish.message")), 1)
|
|
1545
|
-
])) : (w(), C("div", bn, [
|
|
1546
|
-
k(l, {
|
|
1547
|
-
keypath: "inventory.closing.template.publish.stillPublishing",
|
|
1548
|
-
tag: "p"
|
|
1549
|
-
}, {
|
|
1550
|
-
started: F(() => [
|
|
1551
|
-
h("span", _n, $(p(ne)(new Date(c.value.createdAt))), 1)
|
|
1552
|
-
]),
|
|
1553
|
-
progress: F(() => [
|
|
1554
|
-
h("span", xn, " (" + $(c.value.completed.length) + "/" + $(c.value.outlets.length) + " completed) ", 1)
|
|
1555
|
-
]),
|
|
1556
|
-
_: 1
|
|
1557
|
-
}),
|
|
1558
|
-
Re(" Your recent publishing task is still pending (" + $(c.value.completed.length) + " / " + $(c.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
|
|
1559
|
-
])) : (w(), C("div", gn, [
|
|
1560
|
-
h("p", null, $(p(f)("inventory.closing.template.publish.noRecentActivity")), 1),
|
|
1561
|
-
h("p", null, $(p(f)("inventory.closing.template.publish.message")), 1)
|
|
1562
|
-
])) : (w(), C("div", dn, [
|
|
1563
|
-
h("p", null, $(p(f)("inventory.closing.template.publish.nothingToPublish")), 1)
|
|
1564
|
-
])),
|
|
1565
|
-
h("div", wn, [
|
|
1566
|
-
k(v, {
|
|
1567
|
-
disabled: !u.value,
|
|
1568
|
-
loading: o.value,
|
|
1569
|
-
label: "Publish to all outlets",
|
|
1570
|
-
onClick: m
|
|
1571
|
-
}, null, 8, ["disabled", "loading"]),
|
|
1572
|
-
k(v, {
|
|
1573
|
-
variant: "tertiary",
|
|
1574
|
-
label: "Close",
|
|
1575
|
-
onClick: g
|
|
1576
|
-
})
|
|
1577
|
-
])
|
|
1578
|
-
]);
|
|
1579
|
-
};
|
|
1580
|
-
}
|
|
1581
|
-
}), Tn = { class: "flex-1 flex flex-col gap-8" }, $n = { class: "flex flex-col" }, Cn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Mn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Sn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, On = /* @__PURE__ */ H({
|
|
1582
|
-
__name: "ClosingTemplateView",
|
|
1583
|
-
setup(r) {
|
|
1584
|
-
const { t: s } = N(), { createTemplate: o, updateTemplate: n, exportTemplates: t, importTemplates: e } = se(), { templateDialogProps: f, templateDetailsProps: i } = Ae(se()), m = re(), c = ae(), u = ee(), g = qe(), { breakpoints: _ } = tt();
|
|
1585
|
-
m.watchLocation(u.fetchTemplates);
|
|
1586
|
-
const y = A(() => u.loading), a = M(""), l = A(() => _.value.xs || _.value.sm), v = A(() => l.value ? 10 : 20);
|
|
1587
|
-
function T(x) {
|
|
1588
|
-
switch (x) {
|
|
1589
|
-
case V.Add:
|
|
1590
|
-
return o();
|
|
1591
|
-
case "publish":
|
|
1592
|
-
return d();
|
|
1593
|
-
case "import":
|
|
1594
|
-
return e();
|
|
1595
|
-
case "export":
|
|
1596
|
-
return t();
|
|
1597
|
-
case "refresh":
|
|
1598
|
-
return u.fetchTemplates();
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
function d() {
|
|
1602
|
-
c.open({
|
|
1603
|
-
title: "Publish closing templates",
|
|
1604
|
-
contentComponent: kn,
|
|
1605
|
-
contentComponentProps: {
|
|
1606
|
-
onClose() {
|
|
1607
|
-
c.close();
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
}
|
|
1612
|
-
function D(x) {
|
|
1613
|
-
return x;
|
|
1614
|
-
}
|
|
1615
|
-
const b = A(() => l.value ? [
|
|
1616
|
-
{
|
|
1617
|
-
label: s("inventory.closing.template.create.title"),
|
|
1618
|
-
value: V.Add,
|
|
1619
|
-
isPrimary: !0,
|
|
1620
|
-
prependIcon: "add"
|
|
1621
|
-
},
|
|
1622
|
-
{
|
|
1623
|
-
label: "Refresh",
|
|
1624
|
-
value: "refresh",
|
|
1625
|
-
isPrimary: !1
|
|
1626
|
-
},
|
|
1627
|
-
{
|
|
1628
|
-
label: "Publish",
|
|
1629
|
-
value: "publish",
|
|
1630
|
-
isPrimary: !1
|
|
1631
|
-
},
|
|
1632
|
-
{
|
|
1633
|
-
label: "Import",
|
|
1634
|
-
value: "import",
|
|
1635
|
-
isPrimary: !1
|
|
1636
|
-
},
|
|
1637
|
-
{
|
|
1638
|
-
label: "Export",
|
|
1639
|
-
value: "export",
|
|
1640
|
-
isPrimary: !1
|
|
1641
|
-
}
|
|
1642
|
-
] : [
|
|
1643
|
-
{
|
|
1644
|
-
label: s("inventory.closing.template.create.title"),
|
|
1645
|
-
value: V.Add,
|
|
1646
|
-
isPrimary: !0,
|
|
1647
|
-
prependIcon: "add"
|
|
1648
|
-
},
|
|
1649
|
-
{
|
|
1650
|
-
label: "Publish",
|
|
1651
|
-
value: "publish",
|
|
1652
|
-
isPrimary: !1
|
|
1653
|
-
},
|
|
1654
|
-
{
|
|
1655
|
-
label: "Import",
|
|
1656
|
-
value: "import",
|
|
1657
|
-
isPrimary: !1
|
|
1658
|
-
},
|
|
1659
|
-
{
|
|
1660
|
-
label: "Refresh",
|
|
1661
|
-
value: "refresh",
|
|
1662
|
-
isPrimary: !1
|
|
1663
|
-
},
|
|
1664
|
-
{
|
|
1665
|
-
label: "Export",
|
|
1666
|
-
value: "export",
|
|
1667
|
-
isPrimary: !1
|
|
1668
|
-
}
|
|
1669
|
-
]);
|
|
1670
|
-
return (x, P) => {
|
|
1671
|
-
const te = R("FmTable");
|
|
1672
|
-
return w(), C(z, null, [
|
|
1673
|
-
k(Xe, {
|
|
1674
|
-
title: p(s)("inventory.closing.template.title"),
|
|
1675
|
-
actions: b.value,
|
|
1676
|
-
"onClick:action": T
|
|
1677
|
-
}, {
|
|
1678
|
-
default: F(() => [
|
|
1679
|
-
h("div", {
|
|
1680
|
-
class: O([
|
|
1681
|
-
"flex flex-col gap-8 max-h-full",
|
|
1682
|
-
{
|
|
1683
|
-
"p-0": l.value,
|
|
1684
|
-
"px-24 ": !l.value
|
|
1685
|
-
}
|
|
1686
|
-
])
|
|
1687
|
-
}, [
|
|
1688
|
-
k(Qe, {
|
|
1689
|
-
searchable: "",
|
|
1690
|
-
search: a.value,
|
|
1691
|
-
"onUpdate:search": P[0] || (P[0] = (I) => a.value = I)
|
|
1692
|
-
}, null, 8, ["search"]),
|
|
1693
|
-
k(te, {
|
|
1694
|
-
style: Ye(p(g).tableHeight),
|
|
1695
|
-
"column-defs": p(u).columnDefs,
|
|
1696
|
-
"row-data": p(u).templates,
|
|
1697
|
-
"search-value": a.value,
|
|
1698
|
-
loading: y.value,
|
|
1699
|
-
onRowClick: P[1] || (P[1] = (I) => p(n)(I.original)),
|
|
1700
|
-
"page-size": v.value
|
|
1701
|
-
}, {
|
|
1702
|
-
"list-row": F((I) => [
|
|
1703
|
-
k(Be, {
|
|
1704
|
-
row: I,
|
|
1705
|
-
onRowClick: (E) => p(n)(E)
|
|
1706
|
-
}, {
|
|
1707
|
-
default: F((E) => {
|
|
1708
|
-
var me, ue, de, J, pe, fe, ge, ve, W, ye, he, be, _e, xe, we, q, ke, Te, $e, Ce, X, De;
|
|
1709
|
-
return [
|
|
1710
|
-
h("div", Tn, [
|
|
1711
|
-
h("div", $n, [
|
|
1712
|
-
h("div", Cn, [
|
|
1713
|
-
k(p(j), {
|
|
1714
|
-
render: (de = (ue = (me = E._id) == null ? void 0 : me.column) == null ? void 0 : ue.columnDef) == null ? void 0 : de.cell,
|
|
1715
|
-
props: (pe = (J = E._id) == null ? void 0 : J.getContext) == null ? void 0 : pe.call(J)
|
|
1716
|
-
}, null, 8, ["render", "props"])
|
|
1717
|
-
]),
|
|
1718
|
-
h("div", Dn, [
|
|
1719
|
-
k(p(j), {
|
|
1720
|
-
render: (ve = (ge = (fe = E.name) == null ? void 0 : fe.column) == null ? void 0 : ge.columnDef) == null ? void 0 : ve.cell,
|
|
1721
|
-
props: (ye = (W = E.name) == null ? void 0 : W.getContext) == null ? void 0 : ye.call(W)
|
|
1722
|
-
}, null, 8, ["render", "props"])
|
|
1723
|
-
]),
|
|
1724
|
-
h("div", null, $((he = I.original.locations) != null && he.length ? p(s)("inventory.closing.table.enabledForN", {
|
|
1725
|
-
count: ((be = I.original.locations) == null ? void 0 : be.length) ?? 0
|
|
1726
|
-
}) : p(s)("inventory.closing.table.enabledForAll")), 1),
|
|
1727
|
-
h("div", Mn, $([
|
|
1728
|
-
...I.original.items.slice(0, 3).map((He) => He.sku.name),
|
|
1729
|
-
...I.original.items.length >= 3 ? [`and ${I.original.items.length - 3} more items`] : []
|
|
1730
|
-
].join(", ")), 1),
|
|
1731
|
-
h("div", Sn, [
|
|
1732
|
-
k(p(j), {
|
|
1733
|
-
render: (we = (xe = (_e = E.ref) == null ? void 0 : _e.column) == null ? void 0 : xe.columnDef) == null ? void 0 : we.cell,
|
|
1734
|
-
props: (ke = (q = E.ref) == null ? void 0 : q.getContext) == null ? void 0 : ke.call(q)
|
|
1735
|
-
}, null, 8, ["render", "props"])
|
|
1736
|
-
])
|
|
1737
|
-
]),
|
|
1738
|
-
h("div", null, [
|
|
1739
|
-
k(p(j), {
|
|
1740
|
-
render: (Ce = ($e = (Te = E.status) == null ? void 0 : Te.column) == null ? void 0 : $e.columnDef) == null ? void 0 : Ce.cell,
|
|
1741
|
-
props: (De = (X = E.status) == null ? void 0 : X.getContext) == null ? void 0 : De.call(X)
|
|
1742
|
-
}, null, 8, ["render", "props"])
|
|
1743
|
-
])
|
|
1744
|
-
])
|
|
1745
|
-
];
|
|
1746
|
-
}),
|
|
1747
|
-
_: 2
|
|
1748
|
-
}, 1032, ["row", "onRowClick"])
|
|
1749
|
-
]),
|
|
1750
|
-
_: 1
|
|
1751
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1752
|
-
], 2)
|
|
1753
|
-
]),
|
|
1754
|
-
_: 1
|
|
1755
|
-
}, 8, ["title", "actions"]),
|
|
1756
|
-
(w(), U(Ke, { to: "body" }, [
|
|
1757
|
-
k(mn, Ge(Je(p(i))), null, 16),
|
|
1758
|
-
k(an, We(p(f), {
|
|
1759
|
-
onSubmitted: P[2] || (P[2] = (I) => p(u).fetchTemplates())
|
|
1760
|
-
}), null, 16)
|
|
1761
|
-
]))
|
|
1762
|
-
], 64);
|
|
1763
|
-
};
|
|
1764
|
-
}
|
|
1765
|
-
});
|
|
1766
|
-
export {
|
|
1767
|
-
On as default
|
|
1768
|
-
};
|