@feedmepos/mf-inventory-portal 1.1.2 → 1.1.3-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-BhEtjLqO.js → App-cNDvnIR8.js} +1 -1
- package/dist/ApprovalView-DCZBiIEO.js +219 -0
- package/dist/{BindingsDialog-CX3Hu_r6.js → BindingsDialog-D76F8fvx.js} +4 -4
- package/dist/{BindingsPicker-BbinQ8Hl.js → BindingsPicker-CdpKkspS.js} +1 -1
- package/dist/{BindingsTable-DxlSz6Ev.js → BindingsTable-YQvN_pYF.js} +4 -4
- package/dist/ClosingDraftView-CCb0FAzW.js +1676 -0
- package/dist/{ClosingTemplateView-CB9_JOl4.js → ClosingTemplateView-9UUUma7y.js} +487 -473
- package/dist/{DeliveryOrderPrintPreview-BlE3fIAT.js → DeliveryOrderPrintPreview-kIAwU5VW.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DxKFFyWs.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-DR-pjb50.js} +3 -3
- package/dist/{FmMultiselectDialog-DcviKwNR.js → FmMultiselectDialog-C3i332De.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CepHeClt.js → FmUnitInput.vue_vue_type_script_setup_true_lang-C4wdN-If.js} +1 -1
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Dg8VdQzg.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-B5d73yc2.js} +1 -1
- package/dist/{IngredientGroupView-EE8lN8JL.js → IngredientGroupView-BvDH-C9a.js} +2 -2
- package/dist/{IngredientsView-BkDpHVvn.js → IngredientsView-CC4_GIOh.js} +4 -4
- package/dist/{IntegrationView-Bj7sb1gO.js → IntegrationView-3W5NZOEc.js} +1170 -1141
- package/dist/{InventoryBindingForm-BkazprFH.js → InventoryBindingForm-kKVvfrW2.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BbQqYyzL.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BxiQ_Bol.js} +3 -3
- package/dist/{InventoryBindingSummary-D0XiOdR4.js → InventoryBindingSummary-TwWRus0N.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Pf8BPDZw.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C0CFfJnS.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D2Tx3xSj.js → PremiumBadge.vue_vue_type_script_setup_true_lang-DlCQdwHY.js} +1 -1
- package/dist/{PublishView-BUIcrw8m.js → PublishView-cRnx8uFn.js} +18 -18
- package/dist/{PurchaseOrderPrintPreview-lO7Bilm5.js → PurchaseOrderPrintPreview-DeKzCEvp.js} +1 -1
- package/dist/{ReceiveRequestView-BZV-8Ib3.js → ReceiveRequestView-DtaA_-ux.js} +697 -694
- package/dist/{RecipeView-2Tm12Zuk.js → RecipeView-CJpKAuD-.js} +3 -3
- package/dist/{StockView-DaWS_HQl.js → StockView-ddbQuRf-.js} +6 -6
- package/dist/{SupplierView-nfxqynuY.js → SupplierView-CUU8z105.js} +648 -646
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-D5_7PNKj.js +2275 -0
- package/dist/{TransferTemplateView-CGjfCELA.js → TransferTemplateView-B43Gg1Aj.js} +6 -6
- package/dist/{UnitView-Cm5WuuEN.js → UnitView-DQLfzNGX.js} +3 -3
- package/dist/{WarehouseView-BSLX0g3B.js → WarehouseView-CoNcLEuO.js} +1 -1
- package/dist/api/duplicate-template.d.ts +3 -3
- package/dist/api/netsuite.d.ts +1 -0
- package/dist/{app-CnDLBWW7.js → app-BQG51ddI.js} +23771 -23461
- package/dist/app.d.ts +9 -0
- package/dist/app.js +5 -5
- package/dist/{decimal-DmezA5YT.js → decimal-B6rJ9w4Z.js} +1 -1
- package/dist/{format-unit-display-Bcq6wldv.js → format-unit-display-CfRJYIG_.js} +216 -202
- package/dist/{index-C476dvi7.js → index-B6hmI-pG.js} +2686 -2650
- package/dist/{index-R97nRHsF.js → index-CqybPlVV.js} +1 -1
- package/dist/{stock-Dd0YSjSF.js → stock-B9dC-FDe.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-C4s3SHui.js → supplier-C-gaLIFh.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DaXBOLhz.js → use-ingredient-select-dialog-DV9ryvA0.js} +1 -1
- package/dist/{use-inventory-binding-dialog-CsFwoUbg.js → use-inventory-binding-dialog-BSQQ21da.js} +1 -1
- package/dist/views/closing-draft/components/closing-draft-action/RefreshBalanceAction.vue.d.ts +19 -0
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +4 -1
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +8 -0
- package/dist/views/receive-request/composables/fn.d.ts +8 -0
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +626 -0
- package/dist/{vue-i18n-CdkMdZ30.js → vue-i18n-h2uQnw9N.js} +278 -278
- package/package.json +4 -4
- package/dist/ApprovalView-BHIVSsbz.js +0 -213
- package/dist/ClosingDraftView-B5gQ2k-T.js +0 -1520
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-g74nRiM0.js +0 -2213
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { a3 as qe, u as re, af as Qe, D as oe, i as V, h as Xe, f as Ae, ag as le, s as Ze, ah as Ee, v as Ue, a as ie, b as et, w as tt, x as Ve, y as nt, z as ot, ai as st, e as
|
|
3
|
-
import { useCoreStore as ce, useI18n as
|
|
4
|
-
import { useDialogChild as pt, useSnackbar as ee, useDialog as me, FmButtonVariant as Z, components as
|
|
1
|
+
import { ref as F, h as M, defineComponent as L, resolveComponent as R, openBlock as T, createElementBlock as I, createElementVNode as w, normalizeClass as Y, createTextVNode as Fe, toDisplayString as C, unref as h, createCommentVNode as G, createVNode as $, withCtx as A, Fragment as j, renderList as J, computed as E, watch as Pe, createSlots as Re, createBlock as N, isRef as Oe, normalizeStyle as Ye, Teleport as Ke, normalizeProps as Ge, guardReactiveProps as Je, mergeProps as We } from "vue";
|
|
2
|
+
import { a3 as qe, u as re, af as Qe, D as oe, i as V, h as Xe, f as Ae, ag as le, s as Ze, ah as Ee, v as Ue, a as ie, b as et, w as tt, x as Ve, y as nt, z as ot, ai as st, e as H, G as O, K as lt, aj as at, m as rt, E as Ne, A as it, ak as ct, al as se, B as mt, _ as ut, C as dt } from "./app-BQG51ddI.js";
|
|
3
|
+
import { useCoreStore as ce, useI18n as z } from "@feedmepos/mf-common";
|
|
4
|
+
import { useDialogChild as pt, useSnackbar as ee, useDialog as me, FmButtonVariant as Z, components as B, useProxiedModel as ft, useBreakpoints as vt } from "@feedmepos/ui-library";
|
|
5
5
|
import { defineStore as Be, storeToRefs as Le } from "pinia";
|
|
6
|
-
import { u as gt } from "./use-ingredient-select-dialog-
|
|
6
|
+
import { u as gt } from "./use-ingredient-select-dialog-DV9ryvA0.js";
|
|
7
7
|
const te = qe((r, o) => {
|
|
8
8
|
function n() {
|
|
9
9
|
var e;
|
|
@@ -46,29 +46,29 @@ const te = qe((r, o) => {
|
|
|
46
46
|
}), ne = Be(
|
|
47
47
|
"closingTemplateTable",
|
|
48
48
|
function() {
|
|
49
|
-
const { t: o } =
|
|
50
|
-
async function
|
|
49
|
+
const { t: o } = z(), n = ae(), l = F({}), t = F(new Array()), e = F(!1), b = re(), m = te();
|
|
50
|
+
async function f() {
|
|
51
51
|
if (t.value = [], !!b._currentLocation) {
|
|
52
52
|
e.value = !0;
|
|
53
53
|
try {
|
|
54
|
-
const [
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const [v, _] = await Promise.all([
|
|
55
|
+
m.readTemplates(),
|
|
56
|
+
m.getRecentPublishingJob()
|
|
57
57
|
]).delayed(1e3);
|
|
58
|
-
t.value =
|
|
59
|
-
} catch (
|
|
60
|
-
console.log("Something went wrong when fetching templates:",
|
|
58
|
+
t.value = v, l.value = _;
|
|
59
|
+
} catch (v) {
|
|
60
|
+
console.log("Something went wrong when fetching templates:", v);
|
|
61
61
|
} finally {
|
|
62
62
|
e.value = !1;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
async function a(
|
|
66
|
+
async function a(v) {
|
|
67
67
|
if (!t.value.find((_) => _._id) && b._currentLocation) {
|
|
68
68
|
e.value = !0;
|
|
69
69
|
try {
|
|
70
70
|
const [_] = await Promise.all([
|
|
71
|
-
|
|
71
|
+
m.getTemplate(v),
|
|
72
72
|
new Promise((c) => setTimeout(c, 1e3))
|
|
73
73
|
]);
|
|
74
74
|
t.value = [_];
|
|
@@ -79,16 +79,16 @@ const te = qe((r, o) => {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
function
|
|
83
|
-
switch (_ = Ae(_),
|
|
82
|
+
function u(v, _) {
|
|
83
|
+
switch (_ = Ae(_), v) {
|
|
84
84
|
case V.Details:
|
|
85
85
|
return n.viewTemplate(_);
|
|
86
86
|
case V.Edit:
|
|
87
87
|
return n.updateTemplate(_);
|
|
88
88
|
case V.Delete:
|
|
89
|
-
return n.deleteTemplate(_, e,
|
|
89
|
+
return n.deleteTemplate(_, e, f);
|
|
90
90
|
case V.Duplicate:
|
|
91
|
-
return n.duplicateTemplate(_, e,
|
|
91
|
+
return n.duplicateTemplate(_, e, f);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
return {
|
|
@@ -97,8 +97,8 @@ const te = qe((r, o) => {
|
|
|
97
97
|
id: "_id",
|
|
98
98
|
accessorKey: "_id",
|
|
99
99
|
header: () => o("inventory.closing.table.createdAt"),
|
|
100
|
-
cell(
|
|
101
|
-
return Qe(`${
|
|
100
|
+
cell(v) {
|
|
101
|
+
return Qe(`${v.getValue()}`);
|
|
102
102
|
},
|
|
103
103
|
enableSorting: !0
|
|
104
104
|
},
|
|
@@ -123,9 +123,9 @@ const te = qe((r, o) => {
|
|
|
123
123
|
id: "enabledLocations",
|
|
124
124
|
accessorKey: "locations.length",
|
|
125
125
|
header: () => o("inventory.closing.table.enabledOutlets"),
|
|
126
|
-
cell(
|
|
126
|
+
cell(v) {
|
|
127
127
|
var c;
|
|
128
|
-
const _ = (c =
|
|
128
|
+
const _ = (c = v.row.original.locations) == null ? void 0 : c.length;
|
|
129
129
|
return _ ? `${_}` : "All";
|
|
130
130
|
},
|
|
131
131
|
enableSorting: !1,
|
|
@@ -145,36 +145,36 @@ const te = qe((r, o) => {
|
|
|
145
145
|
id: "status",
|
|
146
146
|
header: () => o("inventory.closing.table.status"),
|
|
147
147
|
enableSorting: !1,
|
|
148
|
-
cell(
|
|
149
|
-
var
|
|
150
|
-
const _ =
|
|
151
|
-
return
|
|
148
|
+
cell(v) {
|
|
149
|
+
var g;
|
|
150
|
+
const _ = v.row.original, c = _._rev, i = (g = l.value.publishedRevs) == null ? void 0 : g[_._id], p = c === i;
|
|
151
|
+
return M(
|
|
152
152
|
"div",
|
|
153
153
|
{
|
|
154
154
|
class: "flex"
|
|
155
155
|
},
|
|
156
|
-
|
|
156
|
+
M(
|
|
157
157
|
"div",
|
|
158
158
|
{
|
|
159
159
|
class: [
|
|
160
160
|
"fm-status-badge",
|
|
161
|
-
|
|
161
|
+
p ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
|
|
162
162
|
]
|
|
163
163
|
},
|
|
164
|
-
|
|
164
|
+
p ? "Published" : "Unpublished"
|
|
165
165
|
)
|
|
166
166
|
);
|
|
167
167
|
}
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
id: "action",
|
|
171
|
-
cell(
|
|
172
|
-
const _ =
|
|
171
|
+
cell(v) {
|
|
172
|
+
const _ = v.row.original, c = [
|
|
173
173
|
oe[V.Edit],
|
|
174
174
|
oe[V.Duplicate],
|
|
175
175
|
oe[V.Delete]
|
|
176
176
|
];
|
|
177
|
-
return Xe(c, (i) =>
|
|
177
|
+
return Xe(c, (i) => u(i, _));
|
|
178
178
|
},
|
|
179
179
|
enableSorting: !1,
|
|
180
180
|
size: 40,
|
|
@@ -187,7 +187,7 @@ const te = qe((r, o) => {
|
|
|
187
187
|
recentPublish: l,
|
|
188
188
|
templates: t,
|
|
189
189
|
loading: e,
|
|
190
|
-
fetchTemplates:
|
|
190
|
+
fetchTemplates: f,
|
|
191
191
|
loadTemplate: a
|
|
192
192
|
};
|
|
193
193
|
}
|
|
@@ -229,36 +229,36 @@ function He() {
|
|
|
229
229
|
];
|
|
230
230
|
}
|
|
231
231
|
function yt(r) {
|
|
232
|
-
var
|
|
233
|
-
const n = ce().currentBusiness.value, t = (
|
|
232
|
+
var m;
|
|
233
|
+
const n = ce().currentBusiness.value, t = (m = r.map((f) => {
|
|
234
234
|
var c;
|
|
235
|
-
const a =
|
|
236
|
-
["Template ID",
|
|
237
|
-
["Template name",
|
|
235
|
+
const a = f.items.flatMap(ze), u = He(), d = [
|
|
236
|
+
["Template ID", f._id],
|
|
237
|
+
["Template name", f.name],
|
|
238
238
|
["Business name", n == null ? void 0 : n.name],
|
|
239
239
|
["Business ID", n == null ? void 0 : n._id],
|
|
240
240
|
["Menu version", n == null ? void 0 : n.menuVersion],
|
|
241
241
|
[
|
|
242
242
|
"Locations",
|
|
243
|
-
...(c =
|
|
243
|
+
...(c = f.locations) != null && c.length ? f.locations.map((i) => `${i.name} (${i.dbName})`) : ["All"]
|
|
244
244
|
],
|
|
245
|
-
["Reference",
|
|
245
|
+
["Reference", f.ref ?? ""],
|
|
246
246
|
[],
|
|
247
|
-
|
|
248
|
-
...a.map((i) =>
|
|
249
|
-
],
|
|
250
|
-
return { name:
|
|
247
|
+
u.map((i) => i.name),
|
|
248
|
+
...a.map((i) => u.map((p) => i[p.id]))
|
|
249
|
+
], v = u.map((i) => `system:${i.id}`), _ = le(d, v);
|
|
250
|
+
return { name: f.name, sheet: _ };
|
|
251
251
|
}).reduce(
|
|
252
|
-
(
|
|
253
|
-
var
|
|
254
|
-
const
|
|
255
|
-
return (
|
|
252
|
+
(f, a) => {
|
|
253
|
+
var d;
|
|
254
|
+
const u = a.name.slice(0, 12);
|
|
255
|
+
return (d = f.sheetOccurence)[u] ?? (d[u] = 0), f.sheetOccurence[u] += 1, f.sheets[`${u} (${f.sheetOccurence[u]})`] = a.sheet, f;
|
|
256
256
|
},
|
|
257
257
|
{
|
|
258
258
|
sheets: {},
|
|
259
259
|
sheetOccurence: {}
|
|
260
260
|
}
|
|
261
|
-
)) == null ? void 0 :
|
|
261
|
+
)) == null ? void 0 : m.sheets, e = `${n == null ? void 0 : n.name} closing templates (${Ze(/* @__PURE__ */ new Date())}).xlsx`, b = Ee(t);
|
|
262
262
|
return Ue(b, e), e;
|
|
263
263
|
}
|
|
264
264
|
function ht() {
|
|
@@ -290,17 +290,17 @@ function ht() {
|
|
|
290
290
|
[],
|
|
291
291
|
e.map((c) => c.name),
|
|
292
292
|
e.map((c) => l[c.id])
|
|
293
|
-
],
|
|
293
|
+
], m = e.map((c) => `system:${c.id}`), f = le(b, m), a = n.isEnabled ? n.state.setting.childItems ?? [] : [], u = a.reduce(
|
|
294
294
|
(c, i) => {
|
|
295
|
-
var
|
|
296
|
-
const
|
|
295
|
+
var y, x;
|
|
296
|
+
const p = (y = n.netSuiteItemIdToSkuId.get(i.parentNetSuiteId)) == null ? void 0 : y[0], g = (x = n.netSuiteMeasurementIdToMeasurementId.get(
|
|
297
297
|
i.unitOfMeasureId
|
|
298
|
-
)) == null ? void 0 :
|
|
298
|
+
)) == null ? void 0 : x[0];
|
|
299
299
|
if (!i.externalId)
|
|
300
300
|
return c;
|
|
301
|
-
if (!
|
|
301
|
+
if (!p)
|
|
302
302
|
return console.error(`Item ${i.externalId} cannot be mapped to parent FdoInventorySku.`, i), c;
|
|
303
|
-
const s = o.skuById[
|
|
303
|
+
const s = o.skuById[p], k = s.unit.measurements.find((S) => S.id === g);
|
|
304
304
|
return k ? (c[i.externalId] = {
|
|
305
305
|
sku: s,
|
|
306
306
|
measurement: k
|
|
@@ -310,22 +310,22 @@ function ht() {
|
|
|
310
310
|
), c);
|
|
311
311
|
},
|
|
312
312
|
{}
|
|
313
|
-
),
|
|
313
|
+
), d = le(
|
|
314
314
|
[
|
|
315
315
|
...o.skus.flatMap((c) => [
|
|
316
316
|
[c.code, c.name, c.unit.abbrev, !0],
|
|
317
|
-
...c.unit.measurements.map((
|
|
317
|
+
...c.unit.measurements.map((p) => [
|
|
318
318
|
"",
|
|
319
319
|
"",
|
|
320
|
-
|
|
321
|
-
!
|
|
320
|
+
p.abbrev,
|
|
321
|
+
!p.abbrev.toLocaleLowerCase("en-us").includes("inactive")
|
|
322
322
|
])
|
|
323
323
|
]),
|
|
324
|
-
...Object.entries(
|
|
324
|
+
...Object.entries(u).map(([c, { sku: i, measurement: p }]) => [
|
|
325
325
|
i.code,
|
|
326
326
|
i.name,
|
|
327
|
-
|
|
328
|
-
!
|
|
327
|
+
p.abbrev,
|
|
328
|
+
!p.abbrev.toLocaleLowerCase("en-us").includes("inactive"),
|
|
329
329
|
c
|
|
330
330
|
])
|
|
331
331
|
],
|
|
@@ -336,29 +336,29 @@ function ht() {
|
|
|
336
336
|
"Enabled (true/false)",
|
|
337
337
|
...a.length ? ["Netsuite Parent"] : []
|
|
338
338
|
]
|
|
339
|
-
),
|
|
340
|
-
Template:
|
|
341
|
-
Ingredients:
|
|
339
|
+
), v = Ee({
|
|
340
|
+
Template: f,
|
|
341
|
+
Ingredients: d
|
|
342
342
|
}), _ = `${t == null ? void 0 : t.name} transfer templates import.xlsx`;
|
|
343
|
-
return Ue(
|
|
343
|
+
return Ue(v, _), _;
|
|
344
344
|
}
|
|
345
345
|
function bt(r) {
|
|
346
346
|
if (!r.length || `${r[0]}`.toLocaleLowerCase() === "all")
|
|
347
347
|
return [];
|
|
348
348
|
const o = /(.*) \(((warehouse_|restaurant_).{24,})\)/, l = re().locationByDbName;
|
|
349
349
|
return r.map((t) => {
|
|
350
|
-
const e = new Array(), b = t.trim(),
|
|
351
|
-
if (!
|
|
350
|
+
const e = new Array(), b = t.trim(), m = o.exec(b);
|
|
351
|
+
if (!m)
|
|
352
352
|
return e.push(`Enabled location value of ${b} cannot be read.`), {
|
|
353
353
|
errors: e
|
|
354
354
|
};
|
|
355
|
-
const
|
|
356
|
-
return
|
|
357
|
-
`Location id ${a} has non-matching name. Found ${
|
|
355
|
+
const f = m[1], a = m[2], u = l[a];
|
|
356
|
+
return u ? (f !== u.name && e.push(
|
|
357
|
+
`Location id ${a} has non-matching name. Found ${f} but expected ${u.name}`
|
|
358
358
|
), {
|
|
359
359
|
errors: e,
|
|
360
|
-
location:
|
|
361
|
-
}) : (e.push(`Location (${
|
|
360
|
+
location: u
|
|
361
|
+
}) : (e.push(`Location (${f}) of id ${a} is not found.`), {
|
|
362
362
|
errors: e
|
|
363
363
|
});
|
|
364
364
|
});
|
|
@@ -371,14 +371,14 @@ function _t(r) {
|
|
|
371
371
|
t,
|
|
372
372
|
e,
|
|
373
373
|
b,
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
m,
|
|
375
|
+
f
|
|
376
376
|
] = Ve(r);
|
|
377
377
|
return {
|
|
378
378
|
id: `${n[1] ?? ""}`.trim(),
|
|
379
379
|
name: `${l[1] ?? ""}`.trim(),
|
|
380
|
-
locations:
|
|
381
|
-
reference: `${
|
|
380
|
+
locations: m.slice(1).map((a) => `${a}`.trim()).filter((a) => a),
|
|
381
|
+
reference: `${f[1] ?? ""}`.trim()
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
384
|
function xt(r) {
|
|
@@ -389,27 +389,27 @@ function xt(r) {
|
|
|
389
389
|
t,
|
|
390
390
|
e,
|
|
391
391
|
b,
|
|
392
|
-
|
|
393
|
-
|
|
392
|
+
m,
|
|
393
|
+
f,
|
|
394
394
|
a,
|
|
395
|
-
|
|
396
|
-
...
|
|
395
|
+
u,
|
|
396
|
+
...d
|
|
397
397
|
] = Ve(r);
|
|
398
|
-
if (!o || !o.length || o.some((
|
|
398
|
+
if (!o || !o.length || o.some((p) => p.length && !p.startsWith("system:")))
|
|
399
399
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
400
|
-
const
|
|
400
|
+
const v = o.map((p) => p.split(":")[1]), c = ["code", "name", "unit", "enabled"].filter((p) => !v.includes(p));
|
|
401
401
|
if (c.length)
|
|
402
402
|
throw new Error(
|
|
403
403
|
`Missing meta headers (${c.join()}). Excel file does not come from the template.`
|
|
404
404
|
);
|
|
405
|
-
return
|
|
405
|
+
return d.map((p, g) => {
|
|
406
406
|
const s = {};
|
|
407
|
-
for (const k in
|
|
408
|
-
const
|
|
409
|
-
Object.assign(s, { [
|
|
407
|
+
for (const k in v) {
|
|
408
|
+
const y = v[k];
|
|
409
|
+
Object.assign(s, { [y]: p[k] });
|
|
410
410
|
}
|
|
411
411
|
return {
|
|
412
|
-
index:
|
|
412
|
+
index: g,
|
|
413
413
|
data: s
|
|
414
414
|
};
|
|
415
415
|
});
|
|
@@ -430,21 +430,21 @@ function kt(r) {
|
|
|
430
430
|
return n.push(`Cannot find ingredient of code ${o.code} ${o.name}`), { errors: n };
|
|
431
431
|
const e = {
|
|
432
432
|
sku: t
|
|
433
|
-
}, b = /* @__PURE__ */ new Set([t.unit._id, ...t.unit.measurements.map((
|
|
434
|
-
o.unit !== t.unit.abbrev && !
|
|
433
|
+
}, b = /* @__PURE__ */ new Set([t.unit._id, ...t.unit.measurements.map((f) => f.id)]), m = t.unit.measurements.find((f) => f.abbrev === o.unit);
|
|
434
|
+
o.unit !== t.unit.abbrev && !m ? n.push(
|
|
435
435
|
`Cannot find measurement unit of ${o.unit} for (${o.code}) ${o.name}.`
|
|
436
436
|
) : (o.enabled === !0 || `${o.enabled}`.toLocaleLowerCase() === "true") && b.delete(t.unit._id);
|
|
437
|
-
for (const
|
|
438
|
-
const a =
|
|
439
|
-
if (!
|
|
437
|
+
for (const f of r.children) {
|
|
438
|
+
const a = f.data, u = a.unit === t.unit.abbrev ? t.unit : void 0, d = t.unit.measurements.find((v) => v.abbrev === a.unit);
|
|
439
|
+
if (!d && !u) {
|
|
440
440
|
n.push(
|
|
441
441
|
`Cannot find measurement unit of ${a.unit} for (${o.code}) ${o.name}.`
|
|
442
442
|
);
|
|
443
443
|
continue;
|
|
444
444
|
}
|
|
445
|
-
(a.enabled === !0 || `${a.enabled}`.toLocaleLowerCase() === "true") && b.delete((
|
|
445
|
+
(a.enabled === !0 || `${a.enabled}`.toLocaleLowerCase() === "true") && b.delete((d == null ? void 0 : d.id) ?? (u == null ? void 0 : u._id) ?? "");
|
|
446
446
|
}
|
|
447
|
-
return b.has(t.unit._id) && e.sku.unit.measurements.every((
|
|
447
|
+
return b.has(t.unit._id) && e.sku.unit.measurements.every((f) => b.has(f.id)) && n.push(`Ingredient ${t.code} - ${t.name} must have at least one unit enabled.`), e.disabledMeasurements = [...b], { errors: n, templateItem: e };
|
|
448
448
|
}
|
|
449
449
|
function Tt(r) {
|
|
450
450
|
const o = r.SheetNames.filter(
|
|
@@ -453,32 +453,32 @@ function Tt(r) {
|
|
|
453
453
|
try {
|
|
454
454
|
return o.reduce(
|
|
455
455
|
(e, b) => {
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
const
|
|
456
|
+
const m = new Array(), f = r.Sheets[b], a = _t(f), u = bt(a.locations), d = u.filter((s) => s.location).map((s) => s.location);
|
|
457
|
+
m.push(...u.flatMap((s) => s.errors));
|
|
458
|
+
const v = xt(f).filter(
|
|
459
459
|
(s) => s.data.code || s.data.unit
|
|
460
|
-
), _ = wt(
|
|
461
|
-
|
|
460
|
+
), _ = wt(v);
|
|
461
|
+
m.push(..._.errors);
|
|
462
462
|
const c = _.result.map(
|
|
463
463
|
(s) => kt(s)
|
|
464
464
|
);
|
|
465
|
-
|
|
465
|
+
m.push(...c.flatMap((s) => s.errors));
|
|
466
466
|
const i = c.filter((s) => s.templateItem).map((s) => s.templateItem);
|
|
467
467
|
if (a.id) {
|
|
468
468
|
const s = t[a.id];
|
|
469
469
|
if (!s) {
|
|
470
|
-
const
|
|
470
|
+
const y = {
|
|
471
471
|
_id: a.id,
|
|
472
472
|
_rev: "",
|
|
473
473
|
name: a.name || `(unnamed from sheet ${b || "<unnamed sheet>"})`,
|
|
474
474
|
items: []
|
|
475
475
|
};
|
|
476
|
-
return
|
|
476
|
+
return m.push(`Template ID ${a.id} is not found.`), e.importUpdateResult.push({
|
|
477
477
|
type: "update",
|
|
478
|
-
original:
|
|
479
|
-
template:
|
|
478
|
+
original: y,
|
|
479
|
+
template: y,
|
|
480
480
|
excelSheetName: b,
|
|
481
|
-
errors:
|
|
481
|
+
errors: m
|
|
482
482
|
}), e;
|
|
483
483
|
}
|
|
484
484
|
const k = {
|
|
@@ -487,27 +487,27 @@ function Tt(r) {
|
|
|
487
487
|
template: {
|
|
488
488
|
...s,
|
|
489
489
|
name: a.name,
|
|
490
|
-
locations:
|
|
490
|
+
locations: d.length ? d : null,
|
|
491
491
|
ref: a.reference,
|
|
492
492
|
items: i
|
|
493
493
|
},
|
|
494
494
|
excelSheetName: b,
|
|
495
|
-
errors:
|
|
495
|
+
errors: m
|
|
496
496
|
};
|
|
497
497
|
return e.importUpdateResult.push(k), e;
|
|
498
498
|
}
|
|
499
|
-
const
|
|
499
|
+
const g = {
|
|
500
500
|
type: "create",
|
|
501
501
|
template: {
|
|
502
502
|
name: a.name,
|
|
503
|
-
locations:
|
|
503
|
+
locations: d.length ? d : null,
|
|
504
504
|
ref: a.reference,
|
|
505
505
|
items: i
|
|
506
506
|
},
|
|
507
507
|
excelSheetName: b,
|
|
508
|
-
errors:
|
|
508
|
+
errors: m
|
|
509
509
|
};
|
|
510
|
-
return e.importCreateResult.push(
|
|
510
|
+
return e.importCreateResult.push(g), e;
|
|
511
511
|
},
|
|
512
512
|
{
|
|
513
513
|
invalidExcel: !1,
|
|
@@ -527,7 +527,7 @@ function Tt(r) {
|
|
|
527
527
|
const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-col" }, It = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, St = {
|
|
528
528
|
key: 0,
|
|
529
529
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
530
|
-
}, Dt = { key: 0 }, Me = /* @__PURE__ */
|
|
530
|
+
}, Dt = { key: 0 }, Me = /* @__PURE__ */ L({
|
|
531
531
|
__name: "ClosingTemplateImportItem",
|
|
532
532
|
props: {
|
|
533
533
|
type: {},
|
|
@@ -537,15 +537,15 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
537
537
|
errors: {}
|
|
538
538
|
},
|
|
539
539
|
setup(r) {
|
|
540
|
-
const { t: o } =
|
|
540
|
+
const { t: o } = z();
|
|
541
541
|
return (n, l) => {
|
|
542
|
-
var b,
|
|
542
|
+
var b, m, f;
|
|
543
543
|
const t = R("FmIcon"), e = R("FmTooltip");
|
|
544
544
|
return T(), I("div", $t, [
|
|
545
|
-
l[0] || (l[0] =
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
545
|
+
l[0] || (l[0] = w("div", null, "•", -1)),
|
|
546
|
+
w("div", Ct, [
|
|
547
|
+
w("div", It, [
|
|
548
|
+
w("div", {
|
|
549
549
|
class: Y({
|
|
550
550
|
"text-fm-color-system-error-300": n.errors.length
|
|
551
551
|
})
|
|
@@ -556,8 +556,8 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
556
556
|
n.errors.length ? (T(), I("div", Dt, [
|
|
557
557
|
$(e, { "z-index": 50 }, {
|
|
558
558
|
content: A(() => [
|
|
559
|
-
|
|
560
|
-
(T(!0), I(
|
|
559
|
+
w("ol", null, [
|
|
560
|
+
(T(!0), I(j, null, J(n.errors, (a, u) => (T(), I("li", { key: u }, C(a), 1))), 128))
|
|
561
561
|
])
|
|
562
562
|
]),
|
|
563
563
|
default: A(() => [
|
|
@@ -571,7 +571,7 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
571
571
|
})
|
|
572
572
|
])) : G("", !0)
|
|
573
573
|
]),
|
|
574
|
-
|
|
574
|
+
w("div", {
|
|
575
575
|
class: Y([
|
|
576
576
|
"fm-typo-en-body-sm-400",
|
|
577
577
|
{
|
|
@@ -579,7 +579,7 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
579
579
|
"text-fm-color-typo-secondary": !n.errors.length
|
|
580
580
|
}
|
|
581
581
|
])
|
|
582
|
-
}, C((b = n.locations) != null && b.length ? h(o)("inventory.closing.template.import.nLocations", { count: (
|
|
582
|
+
}, C((b = n.locations) != null && b.length ? h(o)("inventory.closing.template.import.nLocations", { count: (m = n.locations) == null ? void 0 : m.length }) : h(o)("inventory.closing.template.import.allLocations")) + ", " + C(h(o)("inventory.closing.template.import.nItems", { count: (f = n.items) == null ? void 0 : f.length })), 3)
|
|
583
583
|
])
|
|
584
584
|
]);
|
|
585
585
|
};
|
|
@@ -596,16 +596,16 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
596
596
|
}, Nt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, Bt = {
|
|
597
597
|
key: 0,
|
|
598
598
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
599
|
-
}, Lt = { class: "fm-typo-en-body-lg-600" }, zt = /* @__PURE__ */
|
|
599
|
+
}, Lt = { class: "fm-typo-en-body-lg-600" }, zt = /* @__PURE__ */ L({
|
|
600
600
|
__name: "ClosingTemplateImport",
|
|
601
601
|
setup(r) {
|
|
602
|
-
const o =
|
|
603
|
-
() => !!b.value.length ||
|
|
604
|
-
),
|
|
605
|
-
() => !!
|
|
606
|
-
), { t:
|
|
607
|
-
async function
|
|
608
|
-
b.value = [],
|
|
602
|
+
const o = F(null), n = pt(), l = ee(), t = F(!1), e = F(!1), b = F(new Array()), m = F([]), f = F([]), a = E(
|
|
603
|
+
() => !!b.value.length || m.value.some((_) => _.errors.length) || f.value.some((_) => _.errors.length)
|
|
604
|
+
), u = E(
|
|
605
|
+
() => !!m.value.length || !!f.value.length
|
|
606
|
+
), { t: d } = z();
|
|
607
|
+
async function v(_) {
|
|
608
|
+
b.value = [], m.value = [], f.value = [];
|
|
609
609
|
try {
|
|
610
610
|
t.value = !0;
|
|
611
611
|
const [c] = await Promise.all([
|
|
@@ -616,49 +616,49 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
616
616
|
if (!c.SheetNames.filter(
|
|
617
617
|
(s) => !Object.values(ue).map(String).includes(s)
|
|
618
618
|
).find((s) => s)) {
|
|
619
|
-
b.value.push(
|
|
619
|
+
b.value.push(d("inventory.ingredient.import.fileError.noSheet"));
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
|
-
const
|
|
623
|
-
if (
|
|
622
|
+
const g = Tt(c);
|
|
623
|
+
if (g.invalidExcel) {
|
|
624
624
|
b.value.push(
|
|
625
|
-
|
|
625
|
+
g.invalidExcelMessage ?? d("inventory.ingredient.import.fileError.invalidExcel")
|
|
626
626
|
);
|
|
627
627
|
return;
|
|
628
628
|
}
|
|
629
|
-
if (
|
|
630
|
-
b.value.push(
|
|
629
|
+
if (m.value = g.importCreateResult, f.value = g.importUpdateResult, !m.value.length && !f.value.length) {
|
|
630
|
+
b.value.push(d("inventory.ingredient.import.fileError.noData"));
|
|
631
631
|
return;
|
|
632
632
|
}
|
|
633
|
-
n.emitData(
|
|
633
|
+
n.emitData(g);
|
|
634
634
|
} catch (c) {
|
|
635
635
|
l.open({
|
|
636
|
-
title:
|
|
636
|
+
title: d("inventory.ingredient.import.fileError.unableToRead"),
|
|
637
637
|
message: c == null ? void 0 : c.message,
|
|
638
638
|
type: "error"
|
|
639
639
|
}), console.error("Error in reading file", c);
|
|
640
640
|
} finally {
|
|
641
641
|
b.value.length && l.open({
|
|
642
|
-
title:
|
|
642
|
+
title: d("inventory.ingredient.import.fileError.invalidExcel"),
|
|
643
643
|
type: "error"
|
|
644
644
|
}), t.value = !1;
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
return Pe(o, (_) => {
|
|
648
|
-
_ &&
|
|
648
|
+
_ && v(_);
|
|
649
649
|
}), (_, c) => {
|
|
650
|
-
const i = R("FmCircularProgress"),
|
|
650
|
+
const i = R("FmCircularProgress"), p = R("FmIcon"), g = R("FmButton");
|
|
651
651
|
return T(), I("div", Mt, [
|
|
652
|
-
|
|
652
|
+
w("div", Ft, C(h(d)("inventory.closing.template.import.message")), 1),
|
|
653
653
|
e.value ? (T(), I("div", Pt, [
|
|
654
|
-
|
|
654
|
+
w("div", null, [
|
|
655
655
|
$(i, {
|
|
656
656
|
size: "md",
|
|
657
657
|
color: "neutral-gray-200"
|
|
658
658
|
})
|
|
659
659
|
]),
|
|
660
|
-
|
|
661
|
-
])) : (T(), I(
|
|
660
|
+
w("div", Rt, C(h(d)("inventory.formField.loading")), 1)
|
|
661
|
+
])) : (T(), I(j, { key: 1 }, [
|
|
662
662
|
$(nt, {
|
|
663
663
|
class: Y({
|
|
664
664
|
"w-full": !0,
|
|
@@ -666,14 +666,14 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
666
666
|
}),
|
|
667
667
|
accept: ".xlsx",
|
|
668
668
|
onFileUpload: c[0] || (c[0] = (s) => o.value = s),
|
|
669
|
-
label: h(
|
|
670
|
-
"button-label": h(
|
|
669
|
+
label: h(d)("inventory.ingredient.import.uploadTemplate"),
|
|
670
|
+
"button-label": h(d)("inventory.ingredient.import.selectFile")
|
|
671
671
|
}, Re({ _: 2 }, [
|
|
672
672
|
o.value ? {
|
|
673
673
|
name: "default",
|
|
674
674
|
fn: A(({ openFileDialog: s }) => [
|
|
675
|
-
|
|
676
|
-
|
|
675
|
+
w("div", At, [
|
|
676
|
+
w("div", {
|
|
677
677
|
class: Y([
|
|
678
678
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
679
679
|
{
|
|
@@ -687,13 +687,13 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
687
687
|
key: 0,
|
|
688
688
|
size: "md",
|
|
689
689
|
color: "neutral-gray-200"
|
|
690
|
-
})) : (T(), N(
|
|
690
|
+
})) : (T(), N(p, {
|
|
691
691
|
key: 1,
|
|
692
692
|
name: a.value ? "error" : "attach_file",
|
|
693
693
|
outline: "",
|
|
694
694
|
color: a.value ? "system-error-300" : void 0
|
|
695
695
|
}, null, 8, ["name", "color"])),
|
|
696
|
-
|
|
696
|
+
w("div", {
|
|
697
697
|
class: Y([
|
|
698
698
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
699
699
|
{
|
|
@@ -702,11 +702,11 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
702
702
|
}
|
|
703
703
|
])
|
|
704
704
|
}, [
|
|
705
|
-
|
|
705
|
+
w("div", Et, C(o.value.name), 1)
|
|
706
706
|
], 2),
|
|
707
707
|
t.value ? G("", !0) : (T(), I("div", Ut, [
|
|
708
|
-
$(
|
|
709
|
-
label: h(
|
|
708
|
+
$(g, {
|
|
709
|
+
label: h(d)("inventory.ingredient.import.replaceFile"),
|
|
710
710
|
variant: a.value ? "destructive" : "secondary",
|
|
711
711
|
"prepend-icon": a.value ? void 0 : "autorenew",
|
|
712
712
|
onClick: s
|
|
@@ -714,16 +714,16 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
714
714
|
]))
|
|
715
715
|
], 2),
|
|
716
716
|
b.value.length ? (T(), I("div", Vt, [
|
|
717
|
-
(T(!0), I(
|
|
718
|
-
key:
|
|
717
|
+
(T(!0), I(j, null, J(b.value, (k, y) => (T(), I("div", {
|
|
718
|
+
key: y,
|
|
719
719
|
class: "flex gap-8 items-center"
|
|
720
720
|
}, [
|
|
721
|
-
$(
|
|
721
|
+
$(p, {
|
|
722
722
|
name: "error",
|
|
723
723
|
size: "sm",
|
|
724
724
|
color: "system-error-300"
|
|
725
725
|
}),
|
|
726
|
-
|
|
726
|
+
w("div", Nt, C(k), 1)
|
|
727
727
|
]))), 128))
|
|
728
728
|
])) : G("", !0)
|
|
729
729
|
])
|
|
@@ -731,9 +731,9 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
731
731
|
key: "0"
|
|
732
732
|
} : void 0
|
|
733
733
|
]), 1032, ["class", "label", "button-label"]),
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
(T(!0), I(
|
|
734
|
+
u.value ? (T(), I("div", Bt, [
|
|
735
|
+
w("div", Lt, C(h(d)("inventory.ingredient.import.summary")), 1),
|
|
736
|
+
(T(!0), I(j, null, J(m.value, (s, k) => (T(), N(Me, {
|
|
737
737
|
key: k,
|
|
738
738
|
name: s.template.name,
|
|
739
739
|
locations: s.template.locations,
|
|
@@ -741,7 +741,7 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
741
741
|
errors: s.errors,
|
|
742
742
|
type: "create"
|
|
743
743
|
}, null, 8, ["name", "locations", "items", "errors"]))), 128)),
|
|
744
|
-
(T(!0), I(
|
|
744
|
+
(T(!0), I(j, null, J(f.value, (s) => (T(), N(Me, {
|
|
745
745
|
key: s.template._id,
|
|
746
746
|
name: s.template.name,
|
|
747
747
|
locations: s.template.locations,
|
|
@@ -755,29 +755,29 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
755
755
|
};
|
|
756
756
|
}
|
|
757
757
|
}), ae = Be("closingTemplateActions", () => {
|
|
758
|
-
const { t: r } =
|
|
759
|
-
function
|
|
760
|
-
|
|
761
|
-
mode:
|
|
758
|
+
const { t: r } = z(), o = me(), n = ee(), l = te(), t = st(), e = ne(), { loading: b } = Le(e), m = F({});
|
|
759
|
+
function f() {
|
|
760
|
+
m.value = {
|
|
761
|
+
mode: H.CREATE,
|
|
762
762
|
show: !0,
|
|
763
|
-
"onUpdate:show"(
|
|
764
|
-
|
|
763
|
+
"onUpdate:show"(g) {
|
|
764
|
+
m.value.show = g;
|
|
765
765
|
}
|
|
766
766
|
};
|
|
767
767
|
}
|
|
768
|
-
function a(
|
|
769
|
-
|
|
770
|
-
mode:
|
|
771
|
-
modelValue:
|
|
768
|
+
function a(g) {
|
|
769
|
+
m.value = {
|
|
770
|
+
mode: H.UPDATE,
|
|
771
|
+
modelValue: g,
|
|
772
772
|
show: !0,
|
|
773
773
|
"onUpdate:show"(s) {
|
|
774
|
-
|
|
774
|
+
m.value.show = s;
|
|
775
775
|
}
|
|
776
776
|
};
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function u(g, s, k) {
|
|
779
779
|
o.open({
|
|
780
|
-
title: `Confirm deleting template ${
|
|
780
|
+
title: `Confirm deleting template ${g.name}?`,
|
|
781
781
|
message: "Deleted template can no longer be retrieved",
|
|
782
782
|
primaryActions: {
|
|
783
783
|
text: "Delete",
|
|
@@ -791,34 +791,35 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
791
791
|
}
|
|
792
792
|
}).onPrimary(async () => {
|
|
793
793
|
n.open({
|
|
794
|
-
title: `Deleting ${
|
|
794
|
+
title: `Deleting ${g.name}`,
|
|
795
795
|
type: "info"
|
|
796
796
|
});
|
|
797
797
|
try {
|
|
798
798
|
s.value = !0;
|
|
799
|
-
const [
|
|
800
|
-
l.deleteTemplate(
|
|
801
|
-
new Promise((
|
|
799
|
+
const [y] = await Promise.allSettled([
|
|
800
|
+
l.deleteTemplate(g),
|
|
801
|
+
new Promise((x) => setTimeout(x, 1e3))
|
|
802
802
|
]);
|
|
803
|
-
if (
|
|
803
|
+
if (y.status === "rejected") throw y.reason;
|
|
804
804
|
n.open({
|
|
805
|
-
title: `Deleted ${
|
|
805
|
+
title: `Deleted ${g.name}`,
|
|
806
806
|
type: "success"
|
|
807
807
|
});
|
|
808
|
-
} catch (
|
|
808
|
+
} catch (y) {
|
|
809
809
|
n.open({
|
|
810
|
-
title: `Unable to delete ${
|
|
811
|
-
message: `See error from server: ${
|
|
810
|
+
title: `Unable to delete ${g.name}`,
|
|
811
|
+
message: `See error from server: ${y}`,
|
|
812
812
|
type: "error"
|
|
813
|
-
}), console.error("error on deleting closing template",
|
|
813
|
+
}), console.error("error on deleting closing template", y);
|
|
814
814
|
} finally {
|
|
815
815
|
s.value = !1, k();
|
|
816
816
|
}
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
|
-
function
|
|
819
|
+
function d(g, s, k) {
|
|
820
|
+
let y;
|
|
820
821
|
o.open({
|
|
821
|
-
title: `Confirm duplicating template "${
|
|
822
|
+
title: `Confirm duplicating template "${g.name}"?`,
|
|
822
823
|
message: "Duplicated template can be edited after creation",
|
|
823
824
|
primaryActions: {
|
|
824
825
|
text: "Duplicate",
|
|
@@ -829,44 +830,57 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
829
830
|
text: "Cancel",
|
|
830
831
|
variant: Z.Plain,
|
|
831
832
|
close: !0
|
|
832
|
-
}
|
|
833
|
+
},
|
|
834
|
+
contentComponent: L({
|
|
835
|
+
props: ["modelValue"],
|
|
836
|
+
emits: ["update:modelValue"],
|
|
837
|
+
setup(x) {
|
|
838
|
+
return () => M(B.FmTextField, {
|
|
839
|
+
modelValue: x.modelValue,
|
|
840
|
+
"onUpdate:modelValue": (S) => y = S,
|
|
841
|
+
label: "New Template Name",
|
|
842
|
+
size: "md",
|
|
843
|
+
variant: "primary"
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
})
|
|
833
847
|
}).onPrimary(async () => {
|
|
834
848
|
n.open({
|
|
835
|
-
title: `Duplicating "${
|
|
849
|
+
title: `Duplicating "${g.name}"`,
|
|
836
850
|
type: "info"
|
|
837
851
|
});
|
|
838
852
|
try {
|
|
839
853
|
s.value = !0;
|
|
840
|
-
const [
|
|
841
|
-
t.duplicateClosingTemplate(
|
|
842
|
-
new Promise((
|
|
854
|
+
const [x] = await Promise.allSettled([
|
|
855
|
+
t.duplicateClosingTemplate(g._id, y),
|
|
856
|
+
new Promise((S) => setTimeout(S, 1e3))
|
|
843
857
|
]);
|
|
844
|
-
if (
|
|
858
|
+
if (x.status === "rejected") throw x.reason;
|
|
845
859
|
n.open({
|
|
846
|
-
title: `Duplicated "${
|
|
860
|
+
title: `Duplicated "${g.name}"`,
|
|
847
861
|
type: "success"
|
|
848
862
|
});
|
|
849
|
-
} catch (
|
|
863
|
+
} catch (x) {
|
|
850
864
|
n.open({
|
|
851
|
-
title: `Unable to duplicate "${
|
|
852
|
-
message: `See error from server: ${
|
|
865
|
+
title: `Unable to duplicate "${g.name}"`,
|
|
866
|
+
message: `See error from server: ${x}`,
|
|
853
867
|
type: "error"
|
|
854
|
-
}), console.error("error on duplicating closing template",
|
|
868
|
+
}), console.error("error on duplicating closing template", x);
|
|
855
869
|
} finally {
|
|
856
870
|
s.value = !1, k();
|
|
857
871
|
}
|
|
858
872
|
});
|
|
859
873
|
}
|
|
860
|
-
const
|
|
861
|
-
function _(
|
|
862
|
-
|
|
863
|
-
template:
|
|
874
|
+
const v = F({});
|
|
875
|
+
function _(g) {
|
|
876
|
+
v.value = {
|
|
877
|
+
template: g,
|
|
864
878
|
show: !0,
|
|
865
879
|
"onUpdate:show"(s) {
|
|
866
|
-
|
|
880
|
+
v.value.show = s;
|
|
867
881
|
},
|
|
868
882
|
"onAction:edit"() {
|
|
869
|
-
|
|
883
|
+
v.value.show = !1, a(Ae(g));
|
|
870
884
|
}
|
|
871
885
|
};
|
|
872
886
|
}
|
|
@@ -878,10 +892,10 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
878
892
|
});
|
|
879
893
|
return;
|
|
880
894
|
}
|
|
881
|
-
const
|
|
895
|
+
const g = yt(e.templates);
|
|
882
896
|
n.open({
|
|
883
897
|
title: r("inventory.ingredient.export.success"),
|
|
884
|
-
message: r("inventory.ingredient.export.filename", [
|
|
898
|
+
message: r("inventory.ingredient.export.filename", [g]),
|
|
885
899
|
type: "success"
|
|
886
900
|
});
|
|
887
901
|
}
|
|
@@ -904,15 +918,15 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
904
918
|
close: !1,
|
|
905
919
|
variant: "plain"
|
|
906
920
|
}
|
|
907
|
-
}).onPrimary((
|
|
908
|
-
if (!
|
|
921
|
+
}).onPrimary((g) => {
|
|
922
|
+
if (!g) {
|
|
909
923
|
n.open({
|
|
910
924
|
title: r("inventory.ingredient.import.error.noData"),
|
|
911
925
|
type: "error"
|
|
912
926
|
});
|
|
913
927
|
return;
|
|
914
928
|
}
|
|
915
|
-
if (!
|
|
929
|
+
if (!g.importCreateResult.length && !g.importUpdateResult.length) {
|
|
916
930
|
n.open({
|
|
917
931
|
title: r("inventory.ingredient.import.error.invalidContent"),
|
|
918
932
|
message: r("inventory.ingredient.import.error.noImportData"),
|
|
@@ -920,7 +934,7 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
920
934
|
});
|
|
921
935
|
return;
|
|
922
936
|
}
|
|
923
|
-
if (
|
|
937
|
+
if (g.importCreateResult.some((s) => s.errors.length) || g.importUpdateResult.some((s) => s.errors.length)) {
|
|
924
938
|
n.open({
|
|
925
939
|
title: r("inventory.ingredient.import.error.invalidContent"),
|
|
926
940
|
message: r("inventory.ingredient.import.error.hasErrors"),
|
|
@@ -928,31 +942,31 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
928
942
|
});
|
|
929
943
|
return;
|
|
930
944
|
}
|
|
931
|
-
o.close(),
|
|
945
|
+
o.close(), p(g);
|
|
932
946
|
}).onTertiary(ht);
|
|
933
947
|
}
|
|
934
|
-
async function
|
|
948
|
+
async function p(g) {
|
|
935
949
|
b.value = !0;
|
|
936
950
|
try {
|
|
937
951
|
const s = [
|
|
938
|
-
...
|
|
952
|
+
...g.importCreateResult.map(
|
|
939
953
|
(S) => S.template
|
|
940
954
|
),
|
|
941
|
-
...
|
|
955
|
+
...g.importUpdateResult.map(
|
|
942
956
|
(S) => S.template
|
|
943
957
|
)
|
|
944
958
|
], k = 100;
|
|
945
|
-
let
|
|
946
|
-
const
|
|
947
|
-
|
|
959
|
+
let y = 0;
|
|
960
|
+
const x = () => {
|
|
961
|
+
y += k, n.open({
|
|
948
962
|
title: r("inventory.ingredient.import.progress", [
|
|
949
|
-
Math.min(
|
|
963
|
+
Math.min(y, s.length),
|
|
950
964
|
s.length
|
|
951
965
|
])
|
|
952
966
|
});
|
|
953
967
|
};
|
|
954
968
|
for (const S of s.chunk(100))
|
|
955
|
-
|
|
969
|
+
x(), await l.importTemplates(S);
|
|
956
970
|
n.open({
|
|
957
971
|
title: r("inventory.ingredient.import.success"),
|
|
958
972
|
type: "success"
|
|
@@ -962,21 +976,21 @@ const $t = { class: "flex items-center gap-12 pl-8" }, Ct = { class: "flex flex-
|
|
|
962
976
|
title: r("inventory.ingredient.import.error.failed"),
|
|
963
977
|
message: r("inventory.ingredient.import.error.systemMessage", [s == null ? void 0 : s.message]),
|
|
964
978
|
type: "error"
|
|
965
|
-
}), console.error("Error in importing skus",
|
|
979
|
+
}), console.error("Error in importing skus", g, s);
|
|
966
980
|
} finally {
|
|
967
981
|
b.value = !1, e.fetchTemplates();
|
|
968
982
|
}
|
|
969
983
|
}
|
|
970
984
|
return {
|
|
971
|
-
createTemplate:
|
|
985
|
+
createTemplate: f,
|
|
972
986
|
viewTemplate: _,
|
|
973
987
|
updateTemplate: a,
|
|
974
|
-
deleteTemplate:
|
|
975
|
-
duplicateTemplate:
|
|
988
|
+
deleteTemplate: u,
|
|
989
|
+
duplicateTemplate: d,
|
|
976
990
|
exportTemplates: c,
|
|
977
991
|
importTemplates: i,
|
|
978
|
-
templateDialogProps:
|
|
979
|
-
templateDetailsProps:
|
|
992
|
+
templateDialogProps: m,
|
|
993
|
+
templateDetailsProps: v
|
|
980
994
|
};
|
|
981
995
|
});
|
|
982
996
|
var K = /* @__PURE__ */ ((r) => (r.Name = "Name", r.Unit = "Unit", r.Delete = "Delete", r))(K || {});
|
|
@@ -994,19 +1008,19 @@ function Ht(r) {
|
|
|
994
1008
|
accessorFn: (t) => `${t.sku.name} ${t.sku.code}`,
|
|
995
1009
|
cell(t) {
|
|
996
1010
|
const e = t.row.original;
|
|
997
|
-
return
|
|
1011
|
+
return M(
|
|
998
1012
|
"div",
|
|
999
1013
|
{
|
|
1000
1014
|
class: "flex flex-col",
|
|
1001
1015
|
style: { minWidth: "400px" }
|
|
1002
1016
|
},
|
|
1003
1017
|
[
|
|
1004
|
-
|
|
1018
|
+
M(
|
|
1005
1019
|
"span",
|
|
1006
1020
|
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1" },
|
|
1007
1021
|
e.sku.name
|
|
1008
1022
|
),
|
|
1009
|
-
|
|
1023
|
+
M(
|
|
1010
1024
|
"span",
|
|
1011
1025
|
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
|
|
1012
1026
|
e.sku.code
|
|
@@ -1022,58 +1036,58 @@ function Ht(r) {
|
|
|
1022
1036
|
minSize: 200,
|
|
1023
1037
|
maxSize: 400,
|
|
1024
1038
|
cell(t) {
|
|
1025
|
-
var b,
|
|
1039
|
+
var b, m, f;
|
|
1026
1040
|
const e = t.row.original;
|
|
1027
|
-
return
|
|
1028
|
-
|
|
1029
|
-
|
|
1041
|
+
return M("div", { class: "flex items-center gap-32" }, [
|
|
1042
|
+
M(
|
|
1043
|
+
B.FmFormGroup,
|
|
1030
1044
|
{
|
|
1031
1045
|
value: e.sku.unit._id,
|
|
1032
1046
|
modelValue: !((b = e.disabledMeasurements) != null && b.includes(e.sku.unit._id))
|
|
1033
1047
|
},
|
|
1034
|
-
|
|
1048
|
+
M(
|
|
1035
1049
|
"div",
|
|
1036
1050
|
{
|
|
1037
1051
|
class: "flex items-center gap-4",
|
|
1038
1052
|
style: { width: "120px" }
|
|
1039
1053
|
},
|
|
1040
1054
|
[
|
|
1041
|
-
|
|
1055
|
+
M(B.FmCheckbox, {
|
|
1042
1056
|
value: e.sku.unit._id,
|
|
1043
|
-
modelValue: !((
|
|
1044
|
-
disabled: r.disabled || !((
|
|
1057
|
+
modelValue: !((m = e.disabledMeasurements) != null && m.includes(e.sku.unit._id)),
|
|
1058
|
+
disabled: r.disabled || !((f = e.disabledMeasurements) != null && f.includes(e.sku.unit._id)) && e.sku.unit.measurements.every(
|
|
1045
1059
|
(a) => {
|
|
1046
|
-
var
|
|
1047
|
-
return (
|
|
1060
|
+
var u;
|
|
1061
|
+
return (u = e.disabledMeasurements) == null ? void 0 : u.includes(a.id);
|
|
1048
1062
|
}
|
|
1049
1063
|
),
|
|
1050
1064
|
"onUpdate:modelValue"(a) {
|
|
1051
|
-
var
|
|
1065
|
+
var u;
|
|
1052
1066
|
if (a)
|
|
1053
1067
|
r.updateItem({
|
|
1054
1068
|
...e,
|
|
1055
|
-
disabledMeasurements: (
|
|
1056
|
-
(
|
|
1069
|
+
disabledMeasurements: (u = e.disabledMeasurements) == null ? void 0 : u.filter(
|
|
1070
|
+
(d) => d !== e.sku.unit._id
|
|
1057
1071
|
)
|
|
1058
1072
|
});
|
|
1059
1073
|
else {
|
|
1060
|
-
const
|
|
1074
|
+
const d = e.disabledMeasurements ?? [];
|
|
1061
1075
|
r.updateItem({
|
|
1062
1076
|
...e,
|
|
1063
|
-
disabledMeasurements: [...
|
|
1077
|
+
disabledMeasurements: [...d, e.sku.unit._id]
|
|
1064
1078
|
});
|
|
1065
1079
|
}
|
|
1066
1080
|
}
|
|
1067
1081
|
}),
|
|
1068
|
-
|
|
1069
|
-
|
|
1082
|
+
M(
|
|
1083
|
+
B.FmTooltip,
|
|
1070
1084
|
{ zIndex: 51 },
|
|
1071
1085
|
{
|
|
1072
1086
|
content() {
|
|
1073
1087
|
return e.sku.unit.abbrev;
|
|
1074
1088
|
},
|
|
1075
1089
|
default() {
|
|
1076
|
-
return
|
|
1090
|
+
return M(
|
|
1077
1091
|
"div",
|
|
1078
1092
|
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
1079
1093
|
e.sku.unit.abbrev
|
|
@@ -1084,59 +1098,59 @@ function Ht(r) {
|
|
|
1084
1098
|
]
|
|
1085
1099
|
)
|
|
1086
1100
|
),
|
|
1087
|
-
...Array.from({ length: Math.max(n, 0) }).map((a,
|
|
1088
|
-
var _, c, i,
|
|
1089
|
-
const
|
|
1090
|
-
return
|
|
1091
|
-
|
|
1101
|
+
...Array.from({ length: Math.max(n, 0) }).map((a, u) => {
|
|
1102
|
+
var _, c, i, p;
|
|
1103
|
+
const d = t.row.original, v = d.sku.unit.measurements[u];
|
|
1104
|
+
return v ? M(
|
|
1105
|
+
B.FmFormGroup,
|
|
1092
1106
|
{
|
|
1093
|
-
modelValue: !((_ =
|
|
1094
|
-
value:
|
|
1107
|
+
modelValue: !((_ = d.disabledMeasurements) != null && _.includes(v.id)),
|
|
1108
|
+
value: v.id
|
|
1095
1109
|
},
|
|
1096
|
-
|
|
1110
|
+
M(
|
|
1097
1111
|
"div",
|
|
1098
1112
|
{
|
|
1099
1113
|
class: "flex items-center gap-4",
|
|
1100
1114
|
style: { width: "120px" }
|
|
1101
1115
|
},
|
|
1102
1116
|
[
|
|
1103
|
-
|
|
1104
|
-
value:
|
|
1105
|
-
modelValue: !((c =
|
|
1106
|
-
disabled: r.disabled || !((i =
|
|
1117
|
+
M(B.FmCheckbox, {
|
|
1118
|
+
value: v.id,
|
|
1119
|
+
modelValue: !((c = d.disabledMeasurements) != null && c.includes(v.id)),
|
|
1120
|
+
disabled: r.disabled || !((i = d.disabledMeasurements) != null && i.includes(v.id)) && ((p = d.disabledMeasurements) == null ? void 0 : p.includes(d.sku.unit._id)) && d.sku.unit.measurements.filter((g) => g.id != v.id).every((g) => {
|
|
1107
1121
|
var s;
|
|
1108
|
-
return (s =
|
|
1122
|
+
return (s = d.disabledMeasurements) == null ? void 0 : s.includes(g.id);
|
|
1109
1123
|
}),
|
|
1110
|
-
"onUpdate:modelValue"(
|
|
1124
|
+
"onUpdate:modelValue"(g) {
|
|
1111
1125
|
var s;
|
|
1112
|
-
if (
|
|
1126
|
+
if (g)
|
|
1113
1127
|
r.updateItem({
|
|
1114
|
-
...
|
|
1115
|
-
disabledMeasurements: (s =
|
|
1116
|
-
(k) => k !==
|
|
1128
|
+
...d,
|
|
1129
|
+
disabledMeasurements: (s = d.disabledMeasurements) == null ? void 0 : s.filter(
|
|
1130
|
+
(k) => k !== v.id
|
|
1117
1131
|
)
|
|
1118
1132
|
});
|
|
1119
1133
|
else {
|
|
1120
|
-
const k =
|
|
1134
|
+
const k = d.disabledMeasurements ?? [];
|
|
1121
1135
|
r.updateItem({
|
|
1122
|
-
...
|
|
1123
|
-
disabledMeasurements: [...k,
|
|
1136
|
+
...d,
|
|
1137
|
+
disabledMeasurements: [...k, v.id]
|
|
1124
1138
|
});
|
|
1125
1139
|
}
|
|
1126
1140
|
}
|
|
1127
1141
|
}),
|
|
1128
|
-
|
|
1129
|
-
|
|
1142
|
+
M(
|
|
1143
|
+
B.FmTooltip,
|
|
1130
1144
|
{ zIndex: 51 },
|
|
1131
1145
|
{
|
|
1132
1146
|
content() {
|
|
1133
|
-
return
|
|
1147
|
+
return v.abbrev;
|
|
1134
1148
|
},
|
|
1135
1149
|
default() {
|
|
1136
|
-
return
|
|
1150
|
+
return M(
|
|
1137
1151
|
"div",
|
|
1138
1152
|
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
1139
|
-
|
|
1153
|
+
v.abbrev
|
|
1140
1154
|
);
|
|
1141
1155
|
}
|
|
1142
1156
|
}
|
|
@@ -1153,10 +1167,10 @@ function Ht(r) {
|
|
|
1153
1167
|
header: "",
|
|
1154
1168
|
cell(t) {
|
|
1155
1169
|
const e = t.row.original;
|
|
1156
|
-
return
|
|
1170
|
+
return M(
|
|
1157
1171
|
"div",
|
|
1158
1172
|
{ class: "w-full flex justify-end" },
|
|
1159
|
-
|
|
1173
|
+
M(B.FmButton, {
|
|
1160
1174
|
class: "delete-button",
|
|
1161
1175
|
key: e.sku._id,
|
|
1162
1176
|
type: "button",
|
|
@@ -1181,7 +1195,7 @@ function Ht(r) {
|
|
|
1181
1195
|
})
|
|
1182
1196
|
};
|
|
1183
1197
|
}
|
|
1184
|
-
const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt = { class: "flex-1 flex flex-col" }, Kt = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, Gt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Jt = { class: "flex flex-col gap-4" }, Wt = /* @__PURE__ */
|
|
1198
|
+
const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt = { class: "flex-1 flex flex-col" }, Kt = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, Gt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, Jt = { class: "flex flex-col gap-4" }, Wt = /* @__PURE__ */ L({
|
|
1185
1199
|
__name: "ClosingTemplateItem",
|
|
1186
1200
|
props: {
|
|
1187
1201
|
cellByColId: {},
|
|
@@ -1192,30 +1206,30 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1192
1206
|
() => n.value.getVisibleCells().filter((t) => t.column.id !== K.Name && t.column.id !== K.Delete)
|
|
1193
1207
|
);
|
|
1194
1208
|
return (t, e) => {
|
|
1195
|
-
var b,
|
|
1209
|
+
var b, m, f, a, u;
|
|
1196
1210
|
return T(), I("div", jt, [
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1211
|
+
w("div", Ot, [
|
|
1212
|
+
w("div", Yt, [
|
|
1213
|
+
w("div", Kt, C(n.value.original.sku.name), 1),
|
|
1214
|
+
w("div", Gt, C(n.value.original.sku.code), 1)
|
|
1201
1215
|
]),
|
|
1202
|
-
|
|
1216
|
+
w("div", null, [
|
|
1203
1217
|
$(h(O), {
|
|
1204
|
-
render: (
|
|
1205
|
-
props: (
|
|
1218
|
+
render: (f = (m = (b = t.cellByColId[h(K).Delete]) == null ? void 0 : b.column) == null ? void 0 : m.columnDef) == null ? void 0 : f.cell,
|
|
1219
|
+
props: (u = (a = t.cellByColId[h(K).Delete]) == null ? void 0 : a.getContext) == null ? void 0 : u.call(a)
|
|
1206
1220
|
}, null, 8, ["render", "props"])
|
|
1207
1221
|
])
|
|
1208
1222
|
]),
|
|
1209
|
-
|
|
1210
|
-
e[0] || (e[0] =
|
|
1211
|
-
(T(!0), I(
|
|
1212
|
-
var
|
|
1223
|
+
w("div", Jt, [
|
|
1224
|
+
e[0] || (e[0] = w("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, null, -1)),
|
|
1225
|
+
(T(!0), I(j, null, J(l.value, (d) => {
|
|
1226
|
+
var v, _, c;
|
|
1213
1227
|
return T(), I("div", {
|
|
1214
|
-
key:
|
|
1228
|
+
key: d.id
|
|
1215
1229
|
}, [
|
|
1216
1230
|
$(h(O), {
|
|
1217
|
-
render: (_ = (
|
|
1218
|
-
props: (c =
|
|
1231
|
+
render: (_ = (v = d.column) == null ? void 0 : v.columnDef) == null ? void 0 : _.cell,
|
|
1232
|
+
props: (c = d.getContext) == null ? void 0 : c.call(d)
|
|
1219
1233
|
}, null, 8, ["render", "props"])
|
|
1220
1234
|
]);
|
|
1221
1235
|
}), 128))
|
|
@@ -1223,19 +1237,19 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1223
1237
|
]);
|
|
1224
1238
|
};
|
|
1225
1239
|
}
|
|
1226
|
-
}), qt = { class: "flex flex-col gap-16" }, Qt = { class: "flex flex-col gap-24" }, Xt = { class: "flex flex-col gap-16" }, Zt = { class: "flex items-center" }, en = { class: "flex-1 fm-typo-en-title-sm-600" }, tn = { class: "flex flex-col gap-16" }, nn = { class: "flex items-center" }, on = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, sn = /* @__PURE__ */
|
|
1240
|
+
}), qt = { class: "flex flex-col gap-16" }, Qt = { class: "flex flex-col gap-24" }, Xt = { class: "flex flex-col gap-16" }, Zt = { class: "flex items-center" }, en = { class: "flex-1 fm-typo-en-title-sm-600" }, tn = { class: "flex flex-col gap-16" }, nn = { class: "flex items-center" }, on = { class: "flex-1 gap-8 fm-typo-en-title-sm-600" }, sn = /* @__PURE__ */ L({
|
|
1227
1241
|
__name: "ClosingTemplateForm",
|
|
1228
1242
|
props: {
|
|
1229
1243
|
modelValue: {},
|
|
1230
1244
|
disabled: { type: Boolean }
|
|
1231
1245
|
},
|
|
1232
1246
|
setup(r, { expose: o }) {
|
|
1233
|
-
const n = r, l = lt(), { t } =
|
|
1247
|
+
const n = r, l = lt(), { t } = z(), e = ie();
|
|
1234
1248
|
me();
|
|
1235
1249
|
const {
|
|
1236
1250
|
promptSelectLocations: b,
|
|
1237
|
-
columnDefs:
|
|
1238
|
-
rowData:
|
|
1251
|
+
columnDefs: m,
|
|
1252
|
+
rowData: f
|
|
1239
1253
|
} = at({
|
|
1240
1254
|
getLocations() {
|
|
1241
1255
|
return l.locations;
|
|
@@ -1243,27 +1257,27 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1243
1257
|
setLocations(i) {
|
|
1244
1258
|
l.locations = i;
|
|
1245
1259
|
}
|
|
1246
|
-
}), a =
|
|
1260
|
+
}), a = F(), u = F("");
|
|
1247
1261
|
o({
|
|
1248
1262
|
validateInputs: () => {
|
|
1249
|
-
var i,
|
|
1250
|
-
(
|
|
1263
|
+
var i, p;
|
|
1264
|
+
(p = (i = a.value) == null ? void 0 : i.validateInputs) == null || p.call(i);
|
|
1251
1265
|
},
|
|
1252
1266
|
resetInputsValidation: () => {
|
|
1253
|
-
var i,
|
|
1254
|
-
(
|
|
1267
|
+
var i, p;
|
|
1268
|
+
(p = (i = a.value) == null ? void 0 : i.resetInputsValidation) == null || p.call(i);
|
|
1255
1269
|
},
|
|
1256
1270
|
resetInputs: () => {
|
|
1257
|
-
var i,
|
|
1258
|
-
(
|
|
1271
|
+
var i, p;
|
|
1272
|
+
(p = (i = a.value) == null ? void 0 : i.resetInputs) == null || p.call(i);
|
|
1259
1273
|
}
|
|
1260
1274
|
});
|
|
1261
|
-
const
|
|
1275
|
+
const d = Ht({
|
|
1262
1276
|
updateItem: (i) => {
|
|
1263
|
-
l.items = l.items.map((
|
|
1277
|
+
l.items = l.items.map((p) => p.sku._id !== i.sku._id ? p : i);
|
|
1264
1278
|
},
|
|
1265
1279
|
deleteItem: (i) => {
|
|
1266
|
-
l.items = l.items.filter((
|
|
1280
|
+
l.items = l.items.filter((p) => p.sku._id !== i.sku._id);
|
|
1267
1281
|
},
|
|
1268
1282
|
get items() {
|
|
1269
1283
|
return l.items;
|
|
@@ -1271,28 +1285,28 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1271
1285
|
get disabled() {
|
|
1272
1286
|
return n.disabled;
|
|
1273
1287
|
}
|
|
1274
|
-
}),
|
|
1288
|
+
}), v = E(() => d.columnDefs.value), { promptSelectIngredients: _ } = gt();
|
|
1275
1289
|
async function c() {
|
|
1276
|
-
const
|
|
1290
|
+
const p = e.skus.map((k) => ({
|
|
1277
1291
|
label: k.name,
|
|
1278
1292
|
sublabel: k.code,
|
|
1279
1293
|
value: k
|
|
1280
1294
|
})).filter((k) => {
|
|
1281
|
-
var
|
|
1282
|
-
return (
|
|
1283
|
-
}).map((k) => k.value),
|
|
1284
|
-
|
|
1295
|
+
var y;
|
|
1296
|
+
return (y = l.items) == null ? void 0 : y.find((x) => x.sku._id === k.value._id);
|
|
1297
|
+
}).map((k) => k.value), g = l.items ?? [], s = await _(
|
|
1298
|
+
p.map((k) => k._id),
|
|
1285
1299
|
(k) => {
|
|
1286
|
-
const
|
|
1287
|
-
return
|
|
1288
|
-
sku:
|
|
1300
|
+
const y = e.skuById[k], x = g.find((P) => P.sku._id === y._id);
|
|
1301
|
+
return x || {
|
|
1302
|
+
sku: y
|
|
1289
1303
|
};
|
|
1290
1304
|
}
|
|
1291
1305
|
);
|
|
1292
|
-
s && (s.sort((k,
|
|
1306
|
+
s && (s.sort((k, y) => k.sku.code.localeCompare(y.sku.code)), l.items = s);
|
|
1293
1307
|
}
|
|
1294
|
-
return (i,
|
|
1295
|
-
const
|
|
1308
|
+
return (i, p) => {
|
|
1309
|
+
const g = R("FmTextField"), s = R("FmButton"), k = R("FmTable"), y = R("FmIcon"), x = R("FmFormGroup"), S = R("FmForm");
|
|
1296
1310
|
return T(), N(S, {
|
|
1297
1311
|
ref_key: "formRef",
|
|
1298
1312
|
ref: a,
|
|
@@ -1300,26 +1314,26 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1300
1314
|
disabled: i.disabled
|
|
1301
1315
|
}, {
|
|
1302
1316
|
default: A(() => [
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
$(
|
|
1317
|
+
w("div", qt, [
|
|
1318
|
+
w("div", Qt, [
|
|
1319
|
+
$(g, {
|
|
1306
1320
|
label: h(t)("inventory.closing.form.name"),
|
|
1307
1321
|
"label-mark": "required",
|
|
1308
1322
|
modelValue: h(l).name,
|
|
1309
|
-
"onUpdate:modelValue":
|
|
1323
|
+
"onUpdate:modelValue": p[0] || (p[0] = (P) => h(l).name = P),
|
|
1310
1324
|
rules: [h(rt)()]
|
|
1311
1325
|
}, null, 8, ["label", "modelValue", "rules"]),
|
|
1312
|
-
$(
|
|
1326
|
+
$(g, {
|
|
1313
1327
|
label: h(t)("inventory.closing.form.reference"),
|
|
1314
1328
|
"label-mark": "optional",
|
|
1315
1329
|
modelValue: h(l).ref,
|
|
1316
|
-
"onUpdate:modelValue":
|
|
1330
|
+
"onUpdate:modelValue": p[1] || (p[1] = (P) => h(l).ref = P)
|
|
1317
1331
|
}, null, 8, ["label", "modelValue"])
|
|
1318
1332
|
])
|
|
1319
1333
|
]),
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1334
|
+
w("div", Xt, [
|
|
1335
|
+
w("div", Zt, [
|
|
1336
|
+
w("div", en, C(h(t)("inventory.closing.form.locations")), 1),
|
|
1323
1337
|
$(s, {
|
|
1324
1338
|
disabled: i.disabled,
|
|
1325
1339
|
label: h(t)("inventory.closing.form.selectLocation"),
|
|
@@ -1330,37 +1344,37 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1330
1344
|
}, null, 8, ["disabled", "label", "onClick"])
|
|
1331
1345
|
]),
|
|
1332
1346
|
$(k, {
|
|
1333
|
-
"column-defs": h(
|
|
1334
|
-
"row-data": h(
|
|
1347
|
+
"column-defs": h(m),
|
|
1348
|
+
"row-data": h(f),
|
|
1335
1349
|
"shrink-at": 9999,
|
|
1336
1350
|
onRowClick: h(b),
|
|
1337
1351
|
"hide-footer": ""
|
|
1338
1352
|
}, null, 8, ["column-defs", "row-data", "onRowClick"])
|
|
1339
1353
|
]),
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1354
|
+
w("div", tn, [
|
|
1355
|
+
w("div", nn, [
|
|
1356
|
+
w("div", on, C(h(t)("inventory.closing.form.items.title")), 1),
|
|
1343
1357
|
$(s, {
|
|
1344
1358
|
disabled: i.disabled,
|
|
1345
1359
|
label: h(t)("inventory.closing.form.items.addItem"),
|
|
1346
1360
|
"prepend-icon": "add",
|
|
1347
1361
|
variant: "plain",
|
|
1348
1362
|
class: "border-2 rounded-lg border-fm-color-primary",
|
|
1349
|
-
onClick:
|
|
1363
|
+
onClick: p[2] || (p[2] = (P) => c()),
|
|
1350
1364
|
size: "md"
|
|
1351
1365
|
}, null, 8, ["disabled", "label"])
|
|
1352
1366
|
]),
|
|
1353
|
-
$(
|
|
1367
|
+
$(g, {
|
|
1354
1368
|
placeholder: "Filter items",
|
|
1355
|
-
modelValue:
|
|
1356
|
-
"onUpdate:modelValue":
|
|
1369
|
+
modelValue: u.value,
|
|
1370
|
+
"onUpdate:modelValue": p[4] || (p[4] = (P) => u.value = P)
|
|
1357
1371
|
}, Re({ _: 2 }, [
|
|
1358
|
-
|
|
1372
|
+
u.value ? {
|
|
1359
1373
|
name: "append",
|
|
1360
1374
|
fn: A(() => [
|
|
1361
|
-
$(
|
|
1375
|
+
$(y, {
|
|
1362
1376
|
name: "close",
|
|
1363
|
-
onClick:
|
|
1377
|
+
onClick: p[3] || (p[3] = (P) => u.value = ""),
|
|
1364
1378
|
class: "cursor-pointer"
|
|
1365
1379
|
})
|
|
1366
1380
|
]),
|
|
@@ -1368,21 +1382,21 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1368
1382
|
} : void 0
|
|
1369
1383
|
]), 1032, ["modelValue"]),
|
|
1370
1384
|
(T(), N(k, {
|
|
1371
|
-
"search-value":
|
|
1372
|
-
"column-defs":
|
|
1385
|
+
"search-value": u.value,
|
|
1386
|
+
"column-defs": v.value,
|
|
1373
1387
|
"row-data": h(l).items,
|
|
1374
|
-
key: h(l).items.map((
|
|
1388
|
+
key: h(l).items.map((P) => P.sku._id).join("."),
|
|
1375
1389
|
"hide-footer": h(l).items.length <= 10,
|
|
1376
1390
|
"page-size": Math.min(10, h(l).items.length)
|
|
1377
1391
|
}, {
|
|
1378
|
-
"list-row": A((
|
|
1392
|
+
"list-row": A((P) => [
|
|
1379
1393
|
(T(), N(Ne, {
|
|
1380
|
-
row:
|
|
1394
|
+
row: P,
|
|
1381
1395
|
key: h(l).items.map((D) => D.sku._id).join(".")
|
|
1382
1396
|
}, {
|
|
1383
1397
|
default: A((D) => [
|
|
1384
1398
|
$(Wt, {
|
|
1385
|
-
row:
|
|
1399
|
+
row: P,
|
|
1386
1400
|
"cell-by-col-id": D
|
|
1387
1401
|
}, null, 8, ["row", "cell-by-col-id"])
|
|
1388
1402
|
]),
|
|
@@ -1391,7 +1405,7 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1391
1405
|
]),
|
|
1392
1406
|
_: 1
|
|
1393
1407
|
}, 8, ["search-value", "column-defs", "row-data", "hide-footer", "page-size"])),
|
|
1394
|
-
$(
|
|
1408
|
+
$(x, {
|
|
1395
1409
|
"model-value": h(l).items.length,
|
|
1396
1410
|
rules: [h(it)(1)]
|
|
1397
1411
|
}, null, 8, ["model-value", "rules"])
|
|
@@ -1401,7 +1415,7 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1401
1415
|
}, 8, ["disabled"]);
|
|
1402
1416
|
};
|
|
1403
1417
|
}
|
|
1404
|
-
}), ln = { class: "flex items-center" }, an = { class: "fm-typo-en-title-md-600" }, rn = { class: "flex gap-4" }, cn = /* @__PURE__ */
|
|
1418
|
+
}), ln = { class: "flex items-center" }, an = { class: "fm-typo-en-title-md-600" }, rn = { class: "flex gap-4" }, cn = /* @__PURE__ */ L({
|
|
1405
1419
|
__name: "ClosingTemplateDialog",
|
|
1406
1420
|
props: {
|
|
1407
1421
|
mode: {},
|
|
@@ -1411,7 +1425,7 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1411
1425
|
emits: ["update:show", "submitted"],
|
|
1412
1426
|
setup(r, { expose: o, emit: n }) {
|
|
1413
1427
|
var k;
|
|
1414
|
-
const l = r, t = n, e = te(), b = ee(), { t:
|
|
1428
|
+
const l = r, t = n, e = te(), b = ee(), { t: m } = z(), f = ft(l, "show");
|
|
1415
1429
|
function a() {
|
|
1416
1430
|
return {
|
|
1417
1431
|
_id: "",
|
|
@@ -1419,108 +1433,108 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1419
1433
|
items: []
|
|
1420
1434
|
};
|
|
1421
1435
|
}
|
|
1422
|
-
const
|
|
1436
|
+
const u = F(l.modelValue ?? a()), d = F(((k = l.modelValue) == null ? void 0 : k._id) ?? `${Math.random()}`);
|
|
1423
1437
|
Pe(
|
|
1424
1438
|
() => l.show,
|
|
1425
|
-
(
|
|
1426
|
-
var
|
|
1427
|
-
|
|
1439
|
+
(y) => {
|
|
1440
|
+
var x;
|
|
1441
|
+
y && (u.value = l.modelValue ?? a(), d.value = ((x = l.modelValue) == null ? void 0 : x._id) ?? `${Math.random()}`);
|
|
1428
1442
|
}
|
|
1429
1443
|
);
|
|
1430
|
-
const
|
|
1444
|
+
const v = F(!1), _ = E(() => {
|
|
1431
1445
|
switch (l.mode) {
|
|
1432
|
-
case
|
|
1446
|
+
case H.READ:
|
|
1433
1447
|
return "";
|
|
1434
|
-
case
|
|
1435
|
-
return
|
|
1436
|
-
case
|
|
1437
|
-
return
|
|
1448
|
+
case H.CREATE:
|
|
1449
|
+
return m("inventory.closing.template.create.title");
|
|
1450
|
+
case H.UPDATE:
|
|
1451
|
+
return m("inventory.closing.template.update.title");
|
|
1438
1452
|
}
|
|
1439
1453
|
return "";
|
|
1440
|
-
}), c =
|
|
1454
|
+
}), c = F();
|
|
1441
1455
|
o({
|
|
1442
1456
|
validateInputs: () => {
|
|
1443
|
-
var
|
|
1444
|
-
(
|
|
1457
|
+
var y, x;
|
|
1458
|
+
(x = (y = c.value) == null ? void 0 : y.validateInputs) == null || x.call(y);
|
|
1445
1459
|
},
|
|
1446
1460
|
resetInputsValidation: () => {
|
|
1447
|
-
var
|
|
1448
|
-
(
|
|
1461
|
+
var y, x;
|
|
1462
|
+
(x = (y = c.value) == null ? void 0 : y.resetInputsValidation) == null || x.call(y);
|
|
1449
1463
|
},
|
|
1450
1464
|
resetInputs: () => {
|
|
1451
|
-
var
|
|
1452
|
-
(
|
|
1465
|
+
var y, x;
|
|
1466
|
+
(x = (y = c.value) == null ? void 0 : y.resetInputs) == null || x.call(y);
|
|
1453
1467
|
}
|
|
1454
1468
|
});
|
|
1455
1469
|
async function i() {
|
|
1456
|
-
const
|
|
1457
|
-
if (
|
|
1458
|
-
|
|
1470
|
+
const y = u.value;
|
|
1471
|
+
if (y) {
|
|
1472
|
+
v.value = !0;
|
|
1459
1473
|
try {
|
|
1460
|
-
await e.createTemplate(
|
|
1461
|
-
title:
|
|
1462
|
-
message:
|
|
1474
|
+
await e.createTemplate(y), await new Promise((x) => setTimeout(x, 1e3)), b.open({
|
|
1475
|
+
title: m("inventory.closing.template.create.success"),
|
|
1476
|
+
message: m("inventory.closing.template.create.successMessage"),
|
|
1463
1477
|
type: "success"
|
|
1464
1478
|
}), t("update:show", !1), t("submitted");
|
|
1465
|
-
} catch (
|
|
1479
|
+
} catch (x) {
|
|
1466
1480
|
b.open({
|
|
1467
|
-
title:
|
|
1468
|
-
message:
|
|
1481
|
+
title: m("inventory.closing.template.create.error"),
|
|
1482
|
+
message: m("inventory.closing.template.create.errorMessage"),
|
|
1469
1483
|
type: "error"
|
|
1470
|
-
}), console.error("Error in creating closing template",
|
|
1484
|
+
}), console.error("Error in creating closing template", x);
|
|
1471
1485
|
} finally {
|
|
1472
|
-
|
|
1486
|
+
v.value = !1;
|
|
1473
1487
|
}
|
|
1474
1488
|
}
|
|
1475
1489
|
}
|
|
1476
|
-
async function
|
|
1477
|
-
const
|
|
1478
|
-
if (
|
|
1479
|
-
|
|
1490
|
+
async function p() {
|
|
1491
|
+
const y = u.value;
|
|
1492
|
+
if (y) {
|
|
1493
|
+
v.value = !0;
|
|
1480
1494
|
try {
|
|
1481
1495
|
await e.updateTemplate({
|
|
1482
|
-
...
|
|
1483
|
-
_rev:
|
|
1484
|
-
}), await new Promise((
|
|
1485
|
-
title:
|
|
1486
|
-
message:
|
|
1496
|
+
...y,
|
|
1497
|
+
_rev: y._rev ?? ""
|
|
1498
|
+
}), await new Promise((x) => setTimeout(x, 1e3)), b.open({
|
|
1499
|
+
title: m("inventory.closing.template.update.success"),
|
|
1500
|
+
message: m("inventory.closing.template.update.successMessage"),
|
|
1487
1501
|
type: "success"
|
|
1488
1502
|
}), t("update:show", !1), t("submitted");
|
|
1489
|
-
} catch (
|
|
1503
|
+
} catch (x) {
|
|
1490
1504
|
b.open({
|
|
1491
|
-
title:
|
|
1492
|
-
message:
|
|
1505
|
+
title: m("inventory.closing.template.update.error"),
|
|
1506
|
+
message: m("inventory.closing.template.update.errorMessage"),
|
|
1493
1507
|
type: "error"
|
|
1494
|
-
}), console.error("Error in updating closing template",
|
|
1508
|
+
}), console.error("Error in updating closing template", x);
|
|
1495
1509
|
} finally {
|
|
1496
|
-
|
|
1510
|
+
v.value = !1;
|
|
1497
1511
|
}
|
|
1498
1512
|
}
|
|
1499
1513
|
}
|
|
1500
|
-
function
|
|
1514
|
+
function g() {
|
|
1501
1515
|
switch (l.mode) {
|
|
1502
|
-
case
|
|
1516
|
+
case H.CREATE:
|
|
1503
1517
|
return i();
|
|
1504
|
-
case
|
|
1505
|
-
return
|
|
1518
|
+
case H.UPDATE:
|
|
1519
|
+
return p();
|
|
1506
1520
|
}
|
|
1507
1521
|
}
|
|
1508
1522
|
function s() {
|
|
1509
|
-
var
|
|
1510
|
-
(
|
|
1523
|
+
var y, x;
|
|
1524
|
+
(x = (y = c.value) == null ? void 0 : y.validateInputs) == null || x.call(y);
|
|
1511
1525
|
}
|
|
1512
|
-
return (
|
|
1513
|
-
const S = R("FmButton"),
|
|
1514
|
-
return T(), N(
|
|
1515
|
-
modelValue: h(
|
|
1516
|
-
"onUpdate:modelValue":
|
|
1526
|
+
return (y, x) => {
|
|
1527
|
+
const S = R("FmButton"), P = R("FmSideSheet");
|
|
1528
|
+
return T(), N(P, {
|
|
1529
|
+
modelValue: h(f),
|
|
1530
|
+
"onUpdate:modelValue": x[2] || (x[2] = (D) => Oe(f) ? f.value = D : null),
|
|
1517
1531
|
"dismiss-away": "",
|
|
1518
1532
|
"close-button": "",
|
|
1519
1533
|
"max-width": 800
|
|
1520
1534
|
}, {
|
|
1521
1535
|
"side-sheet-header": A(() => [
|
|
1522
|
-
|
|
1523
|
-
|
|
1536
|
+
w("div", ln, [
|
|
1537
|
+
w("div", an, C(_.value), 1)
|
|
1524
1538
|
])
|
|
1525
1539
|
]),
|
|
1526
1540
|
default: A(() => [
|
|
@@ -1528,25 +1542,25 @@ const jt = { class: "flex flex-col gap-16 py-12" }, Ot = { class: "flex" }, Yt =
|
|
|
1528
1542
|
class: "w-full",
|
|
1529
1543
|
ref_key: "formRef",
|
|
1530
1544
|
ref: c,
|
|
1531
|
-
onValidationSuccess:
|
|
1532
|
-
"model-value":
|
|
1533
|
-
"onUpdate:modelValue":
|
|
1534
|
-
disabled:
|
|
1535
|
-
key:
|
|
1545
|
+
onValidationSuccess: g,
|
|
1546
|
+
"model-value": u.value,
|
|
1547
|
+
"onUpdate:modelValue": x[0] || (x[0] = (D) => u.value = D),
|
|
1548
|
+
disabled: v.value,
|
|
1549
|
+
key: d.value
|
|
1536
1550
|
}, null, 8, ["model-value", "disabled"]))
|
|
1537
1551
|
]),
|
|
1538
1552
|
"side-sheet-footer": A(() => [
|
|
1539
|
-
|
|
1553
|
+
w("div", rn, [
|
|
1540
1554
|
$(S, {
|
|
1541
|
-
loading:
|
|
1542
|
-
label: h(
|
|
1555
|
+
loading: v.value,
|
|
1556
|
+
label: h(m)("common.save"),
|
|
1543
1557
|
onClick: s
|
|
1544
1558
|
}, null, 8, ["loading", "label"]),
|
|
1545
1559
|
$(S, {
|
|
1546
|
-
disabled:
|
|
1560
|
+
disabled: v.value,
|
|
1547
1561
|
variant: "tertiary",
|
|
1548
|
-
label: h(
|
|
1549
|
-
onClick:
|
|
1562
|
+
label: h(m)("common.close"),
|
|
1563
|
+
onClick: x[1] || (x[1] = (D) => t("update:show", !1))
|
|
1550
1564
|
}, null, 8, ["disabled", "label"])
|
|
1551
1565
|
])
|
|
1552
1566
|
]),
|
|
@@ -1567,47 +1581,47 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1567
1581
|
}, hn = {
|
|
1568
1582
|
key: 3,
|
|
1569
1583
|
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
|
|
1570
|
-
}, bn = { class: "fm-typo-en-body-md-600" }, _n = { class: "fm-typo-en-body-md-600" }, xn = { key: 4 }, wn = { class: "fm-typo-en-body-md-600" }, kn = { class: "fm-typo-en-body-md-600" }, Tn = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, $n = /* @__PURE__ */
|
|
1584
|
+
}, bn = { class: "fm-typo-en-body-md-600" }, _n = { class: "fm-typo-en-body-md-600" }, xn = { key: 4 }, wn = { class: "fm-typo-en-body-md-600" }, kn = { class: "fm-typo-en-body-md-600" }, Tn = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, $n = /* @__PURE__ */ L({
|
|
1571
1585
|
__name: "ClosingTemplatePublish",
|
|
1572
1586
|
emits: ["close"],
|
|
1573
1587
|
setup(r, { emit: o }) {
|
|
1574
|
-
const n =
|
|
1575
|
-
async function
|
|
1588
|
+
const n = F(!1), l = ee(), t = te(), e = ne(), { t: b } = z(), m = o;
|
|
1589
|
+
async function f() {
|
|
1576
1590
|
n.value = !0;
|
|
1577
1591
|
try {
|
|
1578
1592
|
await t.startNewPublish().delayed(1e3), l.open({
|
|
1579
1593
|
title: "Success",
|
|
1580
1594
|
message: "You may refresh after a while to review publish status",
|
|
1581
1595
|
type: "success"
|
|
1582
|
-
}),
|
|
1583
|
-
} catch (
|
|
1596
|
+
}), d();
|
|
1597
|
+
} catch (v) {
|
|
1584
1598
|
l.open({
|
|
1585
1599
|
title: "Something went wrong",
|
|
1586
1600
|
message: "Please try again",
|
|
1587
1601
|
type: "error"
|
|
1588
|
-
}), console.error("error on creating publish task",
|
|
1602
|
+
}), console.error("error on creating publish task", v);
|
|
1589
1603
|
} finally {
|
|
1590
1604
|
n.value = !1;
|
|
1591
1605
|
}
|
|
1592
1606
|
}
|
|
1593
|
-
const a = E(() => e.recentPublish.recentJob),
|
|
1607
|
+
const a = E(() => e.recentPublish.recentJob), u = E(
|
|
1594
1608
|
() => e.templates.length && (!a.value || a.value.outlets.length === a.value.completed.length)
|
|
1595
1609
|
);
|
|
1596
|
-
function
|
|
1597
|
-
|
|
1610
|
+
function d() {
|
|
1611
|
+
m("close");
|
|
1598
1612
|
}
|
|
1599
|
-
return (
|
|
1600
|
-
const c = R("FmCircularProgress"), i = R("i18n-t"),
|
|
1613
|
+
return (v, _) => {
|
|
1614
|
+
const c = R("FmCircularProgress"), i = R("i18n-t"), p = R("FmButton");
|
|
1601
1615
|
return T(), I("div", pn, [
|
|
1602
1616
|
h(e).templates.length ? n.value ? (T(), I("div", vn, [
|
|
1603
|
-
|
|
1617
|
+
w("div", null, [
|
|
1604
1618
|
$(c, {
|
|
1605
1619
|
size: "md",
|
|
1606
1620
|
color: "neutral-gray-300"
|
|
1607
1621
|
})
|
|
1608
1622
|
]),
|
|
1609
|
-
|
|
1610
|
-
|
|
1623
|
+
w("div", gn, [
|
|
1624
|
+
w("span", null, C(h(b)("inventory.closing.template.publish.publishing")), 1)
|
|
1611
1625
|
])
|
|
1612
1626
|
])) : a.value ? a.value.outlets.length === a.value.completed.length ? (T(), I("div", hn, [
|
|
1613
1627
|
$(i, {
|
|
@@ -1615,58 +1629,58 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1615
1629
|
tag: "p"
|
|
1616
1630
|
}, {
|
|
1617
1631
|
started: A(() => [
|
|
1618
|
-
|
|
1632
|
+
w("span", bn, C(h(se)(new Date(a.value.createdAt))), 1)
|
|
1619
1633
|
]),
|
|
1620
1634
|
finished: A(() => [
|
|
1621
|
-
|
|
1635
|
+
w("span", _n, C(h(se)(new Date(a.value.updatedAt))), 1)
|
|
1622
1636
|
]),
|
|
1623
1637
|
_: 1
|
|
1624
1638
|
}),
|
|
1625
|
-
|
|
1639
|
+
w("p", null, C(h(b)("inventory.closing.template.publish.message")), 1)
|
|
1626
1640
|
])) : (T(), I("div", xn, [
|
|
1627
1641
|
$(i, {
|
|
1628
1642
|
keypath: "inventory.closing.template.publish.stillPublishing",
|
|
1629
1643
|
tag: "p"
|
|
1630
1644
|
}, {
|
|
1631
1645
|
started: A(() => [
|
|
1632
|
-
|
|
1646
|
+
w("span", wn, C(h(se)(new Date(a.value.createdAt))), 1)
|
|
1633
1647
|
]),
|
|
1634
1648
|
progress: A(() => [
|
|
1635
|
-
|
|
1649
|
+
w("span", kn, " (" + C(a.value.completed.length) + "/" + C(a.value.outlets.length) + " completed) ", 1)
|
|
1636
1650
|
]),
|
|
1637
1651
|
_: 1
|
|
1638
1652
|
}),
|
|
1639
1653
|
Fe(" Your recent publishing task is still pending (" + C(a.value.completed.length) + " / " + C(a.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)
|
|
1640
1654
|
])) : (T(), I("div", yn, [
|
|
1641
|
-
|
|
1642
|
-
|
|
1655
|
+
w("p", null, C(h(b)("inventory.closing.template.publish.noRecentActivity")), 1),
|
|
1656
|
+
w("p", null, C(h(b)("inventory.closing.template.publish.message")), 1)
|
|
1643
1657
|
])) : (T(), I("div", fn, [
|
|
1644
|
-
|
|
1658
|
+
w("p", null, C(h(b)("inventory.closing.template.publish.nothingToPublish")), 1)
|
|
1645
1659
|
])),
|
|
1646
|
-
|
|
1647
|
-
$(
|
|
1648
|
-
disabled: !
|
|
1660
|
+
w("div", Tn, [
|
|
1661
|
+
$(p, {
|
|
1662
|
+
disabled: !u.value,
|
|
1649
1663
|
loading: n.value,
|
|
1650
1664
|
label: "Publish to all outlets",
|
|
1651
|
-
onClick:
|
|
1665
|
+
onClick: f
|
|
1652
1666
|
}, null, 8, ["disabled", "loading"]),
|
|
1653
|
-
$(
|
|
1667
|
+
$(p, {
|
|
1654
1668
|
variant: "tertiary",
|
|
1655
1669
|
label: "Close",
|
|
1656
|
-
onClick:
|
|
1670
|
+
onClick: d
|
|
1657
1671
|
})
|
|
1658
1672
|
])
|
|
1659
1673
|
]);
|
|
1660
1674
|
};
|
|
1661
1675
|
}
|
|
1662
|
-
}), Cn = { class: "flex-1 flex flex-col gap-8" }, In = { class: "flex flex-col" }, Sn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Mn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Fn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Nn = /* @__PURE__ */
|
|
1676
|
+
}), Cn = { class: "flex-1 flex flex-col gap-8" }, In = { class: "flex flex-col" }, Sn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Dn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Mn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Fn = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, Nn = /* @__PURE__ */ L({
|
|
1663
1677
|
__name: "ClosingTemplateView",
|
|
1664
1678
|
setup(r) {
|
|
1665
|
-
const { t: o } =
|
|
1666
|
-
|
|
1667
|
-
const _ = E(() =>
|
|
1668
|
-
function
|
|
1669
|
-
switch (
|
|
1679
|
+
const { t: o } = z(), { createTemplate: n, updateTemplate: l, exportTemplates: t, importTemplates: e } = ae(), { templateDialogProps: b, templateDetailsProps: m } = Le(ae()), f = re(), a = me(), u = ne(), d = mt(), { breakpoints: v } = vt();
|
|
1680
|
+
f.watchLocation(u.fetchTemplates);
|
|
1681
|
+
const _ = E(() => u.loading), c = F(""), i = E(() => v.value.xs || v.value.sm), p = E(() => i.value ? 10 : 20);
|
|
1682
|
+
function g(x) {
|
|
1683
|
+
switch (x) {
|
|
1670
1684
|
case V.Add:
|
|
1671
1685
|
return n();
|
|
1672
1686
|
case "publish":
|
|
@@ -1676,7 +1690,7 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1676
1690
|
case "export":
|
|
1677
1691
|
return t();
|
|
1678
1692
|
case "refresh":
|
|
1679
|
-
return
|
|
1693
|
+
return u.fetchTemplates();
|
|
1680
1694
|
}
|
|
1681
1695
|
}
|
|
1682
1696
|
function s() {
|
|
@@ -1690,10 +1704,10 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1690
1704
|
}
|
|
1691
1705
|
});
|
|
1692
1706
|
}
|
|
1693
|
-
function k(
|
|
1694
|
-
return
|
|
1707
|
+
function k(x) {
|
|
1708
|
+
return x;
|
|
1695
1709
|
}
|
|
1696
|
-
const
|
|
1710
|
+
const y = E(() => i.value ? [
|
|
1697
1711
|
{
|
|
1698
1712
|
label: o("inventory.closing.template.create.title"),
|
|
1699
1713
|
value: V.Add,
|
|
@@ -1748,16 +1762,16 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1748
1762
|
isPrimary: !1
|
|
1749
1763
|
}
|
|
1750
1764
|
]);
|
|
1751
|
-
return (
|
|
1752
|
-
const
|
|
1753
|
-
return T(), I(
|
|
1765
|
+
return (x, S) => {
|
|
1766
|
+
const P = R("FmTable");
|
|
1767
|
+
return T(), I(j, null, [
|
|
1754
1768
|
$(ut, {
|
|
1755
1769
|
title: h(o)("inventory.closing.template.title"),
|
|
1756
|
-
actions:
|
|
1757
|
-
"onClick:action":
|
|
1770
|
+
actions: y.value,
|
|
1771
|
+
"onClick:action": g
|
|
1758
1772
|
}, {
|
|
1759
1773
|
default: A(() => [
|
|
1760
|
-
|
|
1774
|
+
w("div", {
|
|
1761
1775
|
class: Y([
|
|
1762
1776
|
"flex flex-col gap-8 max-h-full",
|
|
1763
1777
|
{
|
|
@@ -1771,14 +1785,14 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1771
1785
|
search: c.value,
|
|
1772
1786
|
"onUpdate:search": S[0] || (S[0] = (D) => c.value = D)
|
|
1773
1787
|
}, null, 8, ["search"]),
|
|
1774
|
-
$(
|
|
1775
|
-
style: Ye(h(
|
|
1776
|
-
"column-defs": h(
|
|
1777
|
-
"row-data": h(
|
|
1788
|
+
$(P, {
|
|
1789
|
+
style: Ye(h(d).tableHeight),
|
|
1790
|
+
"column-defs": h(u).columnDefs,
|
|
1791
|
+
"row-data": h(u).templates,
|
|
1778
1792
|
"search-value": c.value,
|
|
1779
1793
|
loading: _.value,
|
|
1780
1794
|
onRowClick: S[1] || (S[1] = (D) => h(l)(D.original)),
|
|
1781
|
-
"page-size":
|
|
1795
|
+
"page-size": p.value
|
|
1782
1796
|
}, {
|
|
1783
1797
|
"list-row": A((D) => [
|
|
1784
1798
|
$(Ne, {
|
|
@@ -1788,35 +1802,35 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1788
1802
|
default: A((U) => {
|
|
1789
1803
|
var de, pe, fe, W, ve, ge, ye, he, q, be, _e, xe, we, ke, Te, Q, $e, Ce, Ie, Se, X, De;
|
|
1790
1804
|
return [
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1805
|
+
w("div", Cn, [
|
|
1806
|
+
w("div", In, [
|
|
1807
|
+
w("div", Sn, [
|
|
1794
1808
|
$(h(O), {
|
|
1795
1809
|
render: (fe = (pe = (de = U._id) == null ? void 0 : de.column) == null ? void 0 : pe.columnDef) == null ? void 0 : fe.cell,
|
|
1796
1810
|
props: (ve = (W = U._id) == null ? void 0 : W.getContext) == null ? void 0 : ve.call(W)
|
|
1797
1811
|
}, null, 8, ["render", "props"])
|
|
1798
1812
|
]),
|
|
1799
|
-
|
|
1813
|
+
w("div", Dn, [
|
|
1800
1814
|
$(h(O), {
|
|
1801
1815
|
render: (he = (ye = (ge = U.name) == null ? void 0 : ge.column) == null ? void 0 : ye.columnDef) == null ? void 0 : he.cell,
|
|
1802
1816
|
props: (be = (q = U.name) == null ? void 0 : q.getContext) == null ? void 0 : be.call(q)
|
|
1803
1817
|
}, null, 8, ["render", "props"])
|
|
1804
1818
|
]),
|
|
1805
|
-
|
|
1819
|
+
w("div", null, C((_e = D.original.locations) != null && _e.length ? h(o)("inventory.closing.table.enabledForN", {
|
|
1806
1820
|
count: ((xe = D.original.locations) == null ? void 0 : xe.length) ?? 0
|
|
1807
1821
|
}) : h(o)("inventory.closing.table.enabledForAll")), 1),
|
|
1808
|
-
|
|
1822
|
+
w("div", Mn, C([
|
|
1809
1823
|
...D.original.items.slice(0, 3).map((je) => je.sku.name),
|
|
1810
1824
|
...D.original.items.length >= 3 ? [`and ${D.original.items.length - 3} more items`] : []
|
|
1811
1825
|
].join(", ")), 1),
|
|
1812
|
-
|
|
1826
|
+
w("div", Fn, [
|
|
1813
1827
|
$(h(O), {
|
|
1814
1828
|
render: (Te = (ke = (we = U.ref) == null ? void 0 : we.column) == null ? void 0 : ke.columnDef) == null ? void 0 : Te.cell,
|
|
1815
1829
|
props: ($e = (Q = U.ref) == null ? void 0 : Q.getContext) == null ? void 0 : $e.call(Q)
|
|
1816
1830
|
}, null, 8, ["render", "props"])
|
|
1817
1831
|
])
|
|
1818
1832
|
]),
|
|
1819
|
-
|
|
1833
|
+
w("div", null, [
|
|
1820
1834
|
$(h(O), {
|
|
1821
1835
|
render: (Se = (Ie = (Ce = U.status) == null ? void 0 : Ce.column) == null ? void 0 : Ie.columnDef) == null ? void 0 : Se.cell,
|
|
1822
1836
|
props: (De = (X = U.status) == null ? void 0 : X.getContext) == null ? void 0 : De.call(X)
|
|
@@ -1835,9 +1849,9 @@ const dn = /* @__PURE__ */ ct(mn, [["render", un]]), pn = { class: "flex flex-co
|
|
|
1835
1849
|
_: 1
|
|
1836
1850
|
}, 8, ["title", "actions"]),
|
|
1837
1851
|
(T(), N(Ke, { to: "body" }, [
|
|
1838
|
-
$(dn, Ge(Je(h(
|
|
1852
|
+
$(dn, Ge(Je(h(m))), null, 16),
|
|
1839
1853
|
$(cn, We(h(b), {
|
|
1840
|
-
onSubmitted: S[2] || (S[2] = (D) => h(
|
|
1854
|
+
onSubmitted: S[2] || (S[2] = (D) => h(u).fetchTemplates())
|
|
1841
1855
|
}), null, 16)
|
|
1842
1856
|
]))
|
|
1843
1857
|
], 64);
|