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