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