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