@feedmepos/mf-inventory-portal 0.0.22-dev.38 → 0.0.22-dev.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ApprovalView-B1EiHn4f.js → ApprovalView-YBjWyBq4.js} +3 -3
- package/dist/{BindingsDialog-DmYWCMdc.js → BindingsDialog-oK4_xDZt.js} +1 -1
- package/dist/{BindingsPicker-B35A7Px5.js → BindingsPicker-CJHX_7QM.js} +1 -1
- package/dist/{BindingsTable-CtN6XTmL.js → BindingsTable-DEc3HXZc.js} +1 -1
- package/dist/ClosingTemplateView-Bboz1gdL.js +1688 -0
- package/dist/{FmDroppableField-DK78vkN3.js → FmDroppableField-BuSz9msU.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-0p8dn-rc.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bq4bEWjV.js} +3 -3
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DPCrkcZU.js +364 -0
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-Bb0W0wUH.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-JM-cmNLZ.js} +1 -1
- package/dist/{IngredientsView-C47jIp0f.js → IngredientsView-BXK0zGFz.js} +5 -5
- package/dist/{IntegrationView-Dulaskd9.js → IntegrationView-DFRBrmVo.js} +2 -2
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-btsYefZJ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B460Nmkl.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BGLxTaW8.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CNlrEPRu.js} +2 -2
- package/dist/{PurchaseOrderPrintPreview-BtDEZAgl.js → PurchaseOrderPrintPreview-FN4L7Qqq.js} +1 -1
- package/dist/{ReceiveRequestView-Cf6UV1Gz.js → ReceiveRequestView-DsNqfWpF.js} +242 -242
- package/dist/{RecipeView-MagbCdki.js → RecipeView-B7wqxZwE.js} +4 -4
- package/dist/{StockView-D1TK5omK.js → StockView-DVu5Zdsm.js} +5 -5
- package/dist/{SupplierView-CIUY0y12.js → SupplierView-D3JRJVHh.js} +3 -3
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-CacJUhOj.js → TransferDetails.vue_vue_type_script_setup_true_lang-D0QlYVuG.js} +5 -5
- package/dist/{TransferTemplateView-CetnHs4Q.js → TransferTemplateView-B2H9PqR1.js} +10 -10
- package/dist/{UnitView-BDZRBWlk.js → UnitView-DbFREhtT.js} +4 -4
- package/dist/{WarehouseView-DtUxLB_u.js → WarehouseView-BWrqHrZP.js} +2 -2
- package/dist/api/closing-template.d.ts +6 -4
- package/dist/{app-BGqgEJv-.js → app-kckHf3TJ.js} +482 -480
- package/dist/app.js +1 -1
- package/dist/components/map/GoogleMap.vue.d.ts +4 -4
- package/dist/{decimal-NPqoitzq.js → decimal-DiIydfIX.js} +1 -1
- package/dist/{defineDeepModel-C4ebJegy.js → defineDeepModel-o5pX7BIA.js} +1 -1
- package/dist/{format-time-from-id-DkB5tphe.js → format-time-from-id-DTKueVJm.js} +1 -1
- package/dist/{purchase-order-transaction-type-ag48uMYt.js → purchase-order-transaction-type-D6FBij-r.js} +2 -2
- package/dist/{supplier-CBaaZ4vA.js → supplier-ap_eyUzS.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-template-enabled-locations-2-CYsM7ABF.js → use-template-enabled-locations-2-D4xMV6ZC.js} +1 -1
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImport.vue.d.ts +2 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItem.vue.d.ts +12 -0
- package/dist/views/closing-template/closing-template-import/ClosingTemplateImportItemProps.d.ts +7 -0
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +11 -4
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +16 -15
- package/dist/views/closing-template/helpers/import-export.helper.d.ts +58 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1 -1
- package/dist/{xlsx-DQC0TWcU.js → xlsx-DhbO8Ka1.js} +1 -1
- package/dist/{xlsx.util-N5bu_PXw.js → xlsx.util-DfUIhfkt.js} +1 -1
- package/package.json +3 -3
- package/dist/ClosingTemplateView-Ch8hg35a.js +0 -1072
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DSQW1Ayz.js +0 -372
|
@@ -1,1072 +0,0 @@
|
|
|
1
|
-
import { ref as F, h as x, computed as P, defineComponent as Y, openBlock as k, createElementBlock as S, createElementVNode as f, toDisplayString as I, createVNode as _, unref as c, Fragment as _e, renderList as Ce, resolveComponent as V, createBlock as B, withCtx as R, watch as Me, isRef as Pe, createTextVNode as ve, normalizeClass as Fe, normalizeStyle as Se, Teleport as Ae, normalizeProps as Ve, guardReactiveProps as Ie, mergeProps as Re } from "vue";
|
|
2
|
-
import { u as Ue, _ as Ee, a as ze } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DSQW1Ayz.js";
|
|
3
|
-
import { useCoreStore as Ne, useI18n as J } from "@feedmepos/mf-common";
|
|
4
|
-
import { useDialog as X, useSnackbar as Q, FmButtonVariant as be, components as U, useProxiedModel as Be, useBreakpoints as Le } from "@feedmepos/ui-library";
|
|
5
|
-
import { defineStore as we, storeToRefs as Ye } from "pinia";
|
|
6
|
-
import { F as E, D as ye, R as z } from "./row-action.enum-PMKMRrZR.js";
|
|
7
|
-
import { n as je, c as xe, i as ke, u as Ke, R as Ge, A as He, y as Je, X as qe, Y as he } from "./app-BGqgEJv-.js";
|
|
8
|
-
import { c as Oe, F as N, _ as Te } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
9
|
-
import { f as Xe } from "./format-time-from-id-DkB5tphe.js";
|
|
10
|
-
import "vue-router";
|
|
11
|
-
import { d as Qe } from "./defineDeepModel-C4ebJegy.js";
|
|
12
|
-
import { u as We } from "./use-template-enabled-locations-2-CYsM7ABF.js";
|
|
13
|
-
const q = je((m, g) => {
|
|
14
|
-
function v() {
|
|
15
|
-
var s;
|
|
16
|
-
return `business_${((s = Ne().currentBusiness.value) == null ? void 0 : s._id) ?? ""}`;
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
async getRecentPublishingJob() {
|
|
20
|
-
const t = v(), o = `${m.inventoryBackendUrl}/${t}/closing-template/publish/recent`;
|
|
21
|
-
return g.get(o);
|
|
22
|
-
},
|
|
23
|
-
async startNewPublish() {
|
|
24
|
-
const t = v(), o = `${m.inventoryBackendUrl}/${t}/closing-template/publish`;
|
|
25
|
-
return g.post(o);
|
|
26
|
-
},
|
|
27
|
-
async getTemplate(t) {
|
|
28
|
-
const o = v(), s = `${m.inventoryBackendUrl}/${o}/closing-template/${t}`;
|
|
29
|
-
return g.get(s);
|
|
30
|
-
},
|
|
31
|
-
async readTemplates() {
|
|
32
|
-
const t = v(), o = `${m.inventoryBackendUrl}/${t}/closing-template`;
|
|
33
|
-
return g.get(o);
|
|
34
|
-
},
|
|
35
|
-
async createTemplate(t) {
|
|
36
|
-
const o = v(), s = `${m.inventoryBackendUrl}/${o}/closing-template`;
|
|
37
|
-
return g.post(s, t);
|
|
38
|
-
},
|
|
39
|
-
async updateTemplate(t) {
|
|
40
|
-
const o = v(), s = `${m.inventoryBackendUrl}/${o}/closing-template`;
|
|
41
|
-
return g.put(s, t);
|
|
42
|
-
},
|
|
43
|
-
async deleteTemplate(t) {
|
|
44
|
-
const o = v(), s = `${m.inventoryBackendUrl}/${o}/closing-template`;
|
|
45
|
-
return g.delete(s, { _id: t._id, _rev: t._rev });
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}), O = we("closingTemplateActions", () => {
|
|
49
|
-
const m = X(), g = Q(), v = q(), t = F({});
|
|
50
|
-
function o() {
|
|
51
|
-
t.value = {
|
|
52
|
-
mode: E.CREATE,
|
|
53
|
-
show: !0,
|
|
54
|
-
"onUpdate:show"(d) {
|
|
55
|
-
t.value.show = d;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
function s(d) {
|
|
60
|
-
t.value = {
|
|
61
|
-
mode: E.UPDATE,
|
|
62
|
-
modelValue: d,
|
|
63
|
-
show: !0,
|
|
64
|
-
"onUpdate:show"(u) {
|
|
65
|
-
t.value.show = u;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
function b(d, u, y) {
|
|
70
|
-
m.open({
|
|
71
|
-
title: `Confirm deleting template ${d.name}?`,
|
|
72
|
-
message: "Deleted template can no longer be retrieved",
|
|
73
|
-
primaryActions: {
|
|
74
|
-
text: "Delete",
|
|
75
|
-
variant: be.Destructive,
|
|
76
|
-
close: !0
|
|
77
|
-
},
|
|
78
|
-
secondaryActions: {
|
|
79
|
-
text: "Cancel",
|
|
80
|
-
variant: be.Plain,
|
|
81
|
-
close: !0
|
|
82
|
-
}
|
|
83
|
-
}).onPrimary(async () => {
|
|
84
|
-
g.open({
|
|
85
|
-
title: `Deleting ${d.name}`,
|
|
86
|
-
type: "info"
|
|
87
|
-
});
|
|
88
|
-
try {
|
|
89
|
-
u.value = !0;
|
|
90
|
-
const [p] = await Promise.allSettled([
|
|
91
|
-
v.deleteTemplate(d),
|
|
92
|
-
new Promise((w) => setTimeout(w, 1e3))
|
|
93
|
-
]);
|
|
94
|
-
if (p.status === "rejected") throw p.reason;
|
|
95
|
-
g.open({
|
|
96
|
-
title: `Deleted ${d.name}`,
|
|
97
|
-
type: "success"
|
|
98
|
-
});
|
|
99
|
-
} catch (p) {
|
|
100
|
-
g.open({
|
|
101
|
-
title: `Unable to delete ${d.name}`,
|
|
102
|
-
message: `See error from server: ${p}`,
|
|
103
|
-
type: "error"
|
|
104
|
-
}), console.error("error on deleting closing template", p);
|
|
105
|
-
} finally {
|
|
106
|
-
u.value = !1, y();
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
const n = F({});
|
|
111
|
-
function r(d) {
|
|
112
|
-
n.value = {
|
|
113
|
-
template: d,
|
|
114
|
-
show: !0,
|
|
115
|
-
"onUpdate:show"(u) {
|
|
116
|
-
n.value.show = u;
|
|
117
|
-
},
|
|
118
|
-
"onAction:edit"() {
|
|
119
|
-
n.value.show = !1, s(xe(d));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
createTemplate: o,
|
|
125
|
-
viewTemplate: r,
|
|
126
|
-
updateTemplate: s,
|
|
127
|
-
deleteTemplate: b,
|
|
128
|
-
templateDialogProps: t,
|
|
129
|
-
templateDetailsProps: n
|
|
130
|
-
};
|
|
131
|
-
}), De = we(
|
|
132
|
-
"closingTable",
|
|
133
|
-
function() {
|
|
134
|
-
const { t: g } = J(), { viewTemplate: v, updateTemplate: t, deleteTemplate: o } = O(), s = F({}), b = F(new Array()), n = F(!1), r = ke(), d = q();
|
|
135
|
-
async function u() {
|
|
136
|
-
if (b.value = [], !!r._currentLocation) {
|
|
137
|
-
n.value = !0;
|
|
138
|
-
try {
|
|
139
|
-
const [e, l] = await Promise.all([
|
|
140
|
-
d.readTemplates(),
|
|
141
|
-
d.getRecentPublishingJob()
|
|
142
|
-
]).delayed(1e3);
|
|
143
|
-
b.value = e, s.value = l;
|
|
144
|
-
} catch (e) {
|
|
145
|
-
console.log("Something went wrong when fetching templates:", e);
|
|
146
|
-
} finally {
|
|
147
|
-
n.value = !1;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async function y(e) {
|
|
152
|
-
if (!b.value.find((l) => l._id) && r._currentLocation) {
|
|
153
|
-
n.value = !0;
|
|
154
|
-
try {
|
|
155
|
-
const [l] = await Promise.all([
|
|
156
|
-
d.getTemplate(e),
|
|
157
|
-
new Promise((h) => setTimeout(h, 1e3))
|
|
158
|
-
]);
|
|
159
|
-
b.value = [l];
|
|
160
|
-
} catch (l) {
|
|
161
|
-
console.log("Something went wrong when fetching templates:", l);
|
|
162
|
-
} finally {
|
|
163
|
-
n.value = !1;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
function p(e, l) {
|
|
168
|
-
switch (l = xe(l), e) {
|
|
169
|
-
case z.Details:
|
|
170
|
-
return v(l);
|
|
171
|
-
case z.Edit:
|
|
172
|
-
return t(l);
|
|
173
|
-
case z.Delete:
|
|
174
|
-
return o(l, n, u);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
columnDefs: [
|
|
179
|
-
{
|
|
180
|
-
id: "_id",
|
|
181
|
-
accessorKey: "_id",
|
|
182
|
-
header: () => g("inventory.closing.table.createdAt"),
|
|
183
|
-
cell(e) {
|
|
184
|
-
return Xe(`${e.getValue()}`);
|
|
185
|
-
},
|
|
186
|
-
enableSorting: !0
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
id: "name",
|
|
190
|
-
accessorKey: "name",
|
|
191
|
-
header: () => g("inventory.closing.table.name"),
|
|
192
|
-
enableSorting: !0,
|
|
193
|
-
size: 200
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
id: "noOfItems",
|
|
197
|
-
accessorKey: "items.length",
|
|
198
|
-
header: () => g("inventory.closing.table.noOfItems"),
|
|
199
|
-
enableSorting: !1,
|
|
200
|
-
meta: {
|
|
201
|
-
width: "10rem",
|
|
202
|
-
textAlign: "right"
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: "enabledLocations",
|
|
207
|
-
accessorKey: "locations.length",
|
|
208
|
-
header: () => "Enabled outlets",
|
|
209
|
-
cell(e) {
|
|
210
|
-
var h;
|
|
211
|
-
const l = (h = e.row.original.locations) == null ? void 0 : h.length;
|
|
212
|
-
return l ? `${l}` : "All";
|
|
213
|
-
},
|
|
214
|
-
enableSorting: !1,
|
|
215
|
-
meta: {
|
|
216
|
-
width: "10rem",
|
|
217
|
-
textAlign: "right"
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
id: "ref",
|
|
222
|
-
accessorKey: "ref",
|
|
223
|
-
header: () => g("inventory.closing.table.reference"),
|
|
224
|
-
enableSorting: !1,
|
|
225
|
-
size: "auto"
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
id: "status",
|
|
229
|
-
header: () => "Status",
|
|
230
|
-
enableSorting: !1,
|
|
231
|
-
cell(e) {
|
|
232
|
-
var C;
|
|
233
|
-
const l = e.row.original, h = l._rev, D = (C = s.value.publishedRevs) == null ? void 0 : C[l._id], $ = h === D;
|
|
234
|
-
return x(
|
|
235
|
-
"div",
|
|
236
|
-
{
|
|
237
|
-
class: "flex"
|
|
238
|
-
},
|
|
239
|
-
x(
|
|
240
|
-
"div",
|
|
241
|
-
{
|
|
242
|
-
class: [
|
|
243
|
-
"fm-status-badge",
|
|
244
|
-
$ ? "fm-status-badge-success-secondary" : "fm-status-badge-info-secondary"
|
|
245
|
-
]
|
|
246
|
-
},
|
|
247
|
-
$ ? "Published" : "Unpublished"
|
|
248
|
-
)
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
id: "action",
|
|
254
|
-
cell(e) {
|
|
255
|
-
const l = e.row.original, h = [
|
|
256
|
-
ye[z.Edit],
|
|
257
|
-
ye[z.Delete]
|
|
258
|
-
];
|
|
259
|
-
return Oe(h, (D) => p(D, l));
|
|
260
|
-
},
|
|
261
|
-
enableSorting: !1,
|
|
262
|
-
size: 40,
|
|
263
|
-
meta: {
|
|
264
|
-
cellClass: "",
|
|
265
|
-
headerClass: ""
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
],
|
|
269
|
-
recentPublish: s,
|
|
270
|
-
templates: b,
|
|
271
|
-
loading: n,
|
|
272
|
-
fetchTemplates: u,
|
|
273
|
-
loadTemplate: y
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
);
|
|
277
|
-
var L = /* @__PURE__ */ ((m) => (m.Name = "Name", m.Unit = "Unit", m.Delete = "Delete", m))(L || {});
|
|
278
|
-
function Ze(m) {
|
|
279
|
-
return {
|
|
280
|
-
columnDefs: P(() => {
|
|
281
|
-
const v = m.items.map((o) => o.sku.unit.measurements.length).reduce((o, s) => Math.max(o, s), 0);
|
|
282
|
-
return [
|
|
283
|
-
{
|
|
284
|
-
id: "Name",
|
|
285
|
-
header: () => "Name",
|
|
286
|
-
enableSorting: !1,
|
|
287
|
-
size: 400,
|
|
288
|
-
cell(o) {
|
|
289
|
-
const s = o.row.original;
|
|
290
|
-
return x(
|
|
291
|
-
"div",
|
|
292
|
-
{
|
|
293
|
-
class: "flex flex-col"
|
|
294
|
-
},
|
|
295
|
-
[
|
|
296
|
-
x(
|
|
297
|
-
"span",
|
|
298
|
-
{ class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary line-clamp-1" },
|
|
299
|
-
s.sku.name
|
|
300
|
-
),
|
|
301
|
-
x(
|
|
302
|
-
"span",
|
|
303
|
-
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
|
|
304
|
-
s.sku.code
|
|
305
|
-
)
|
|
306
|
-
]
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
id: "Unit",
|
|
312
|
-
header: () => "Enable unit",
|
|
313
|
-
enableSorting: !1,
|
|
314
|
-
size: "auto",
|
|
315
|
-
cell(o) {
|
|
316
|
-
var b, n, r;
|
|
317
|
-
const s = o.row.original;
|
|
318
|
-
return x(
|
|
319
|
-
U.FmFormGroup,
|
|
320
|
-
{
|
|
321
|
-
value: s.sku.unit._id,
|
|
322
|
-
modelValue: !((b = s.disabledMeasurements) != null && b.includes(s.sku.unit._id))
|
|
323
|
-
},
|
|
324
|
-
x(
|
|
325
|
-
"div",
|
|
326
|
-
{
|
|
327
|
-
class: "flex items-center gap-4"
|
|
328
|
-
},
|
|
329
|
-
[
|
|
330
|
-
x(U.FmCheckbox, {
|
|
331
|
-
value: s.sku.unit._id,
|
|
332
|
-
modelValue: !((n = s.disabledMeasurements) != null && n.includes(s.sku.unit._id)),
|
|
333
|
-
disabled: m.disabled || !((r = s.disabledMeasurements) != null && r.includes(s.sku.unit._id)) && s.sku.unit.measurements.every(
|
|
334
|
-
(d) => {
|
|
335
|
-
var u;
|
|
336
|
-
return (u = s.disabledMeasurements) == null ? void 0 : u.includes(d.id);
|
|
337
|
-
}
|
|
338
|
-
),
|
|
339
|
-
"onUpdate:modelValue"(d) {
|
|
340
|
-
var u;
|
|
341
|
-
if (d)
|
|
342
|
-
m.updateItem({
|
|
343
|
-
...s,
|
|
344
|
-
disabledMeasurements: (u = s.disabledMeasurements) == null ? void 0 : u.filter(
|
|
345
|
-
(y) => y !== s.sku.unit._id
|
|
346
|
-
)
|
|
347
|
-
});
|
|
348
|
-
else {
|
|
349
|
-
const y = s.disabledMeasurements ?? [];
|
|
350
|
-
m.updateItem({
|
|
351
|
-
...s,
|
|
352
|
-
disabledMeasurements: [...y, s.sku.unit._id]
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}),
|
|
357
|
-
x(
|
|
358
|
-
U.FmTooltip,
|
|
359
|
-
{ zIndex: 51 },
|
|
360
|
-
{
|
|
361
|
-
content() {
|
|
362
|
-
return s.sku.unit.abbrev;
|
|
363
|
-
},
|
|
364
|
-
default() {
|
|
365
|
-
return x(
|
|
366
|
-
"div",
|
|
367
|
-
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
368
|
-
s.sku.unit.abbrev
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
)
|
|
373
|
-
]
|
|
374
|
-
)
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
...Array.from({ length: Math.max(v, 0) }).map(
|
|
379
|
-
(o, s) => ({
|
|
380
|
-
id: `measurement${s}`,
|
|
381
|
-
header: () => "",
|
|
382
|
-
enableSorting: !1,
|
|
383
|
-
size: "auto",
|
|
384
|
-
cell(b) {
|
|
385
|
-
var d, u, y, p;
|
|
386
|
-
const n = b.row.original, r = n.sku.unit.measurements[s];
|
|
387
|
-
return r ? x(
|
|
388
|
-
U.FmFormGroup,
|
|
389
|
-
{
|
|
390
|
-
modelValue: !((d = n.disabledMeasurements) != null && d.includes(r.id)),
|
|
391
|
-
value: r.id
|
|
392
|
-
},
|
|
393
|
-
x(
|
|
394
|
-
"div",
|
|
395
|
-
{
|
|
396
|
-
class: "flex items-center gap-4"
|
|
397
|
-
},
|
|
398
|
-
[
|
|
399
|
-
x(U.FmCheckbox, {
|
|
400
|
-
value: r.id,
|
|
401
|
-
modelValue: !((u = n.disabledMeasurements) != null && u.includes(r.id)),
|
|
402
|
-
disabled: m.disabled || !((y = n.disabledMeasurements) != null && y.includes(r.id)) && ((p = n.disabledMeasurements) == null ? void 0 : p.includes(n.sku.unit._id)) && n.sku.unit.measurements.filter((w) => w.id != r.id).every((w) => {
|
|
403
|
-
var e;
|
|
404
|
-
return (e = n.disabledMeasurements) == null ? void 0 : e.includes(w.id);
|
|
405
|
-
}),
|
|
406
|
-
"onUpdate:modelValue"(w) {
|
|
407
|
-
var e;
|
|
408
|
-
if (w)
|
|
409
|
-
m.updateItem({
|
|
410
|
-
...n,
|
|
411
|
-
disabledMeasurements: (e = n.disabledMeasurements) == null ? void 0 : e.filter(
|
|
412
|
-
(l) => l !== r.id
|
|
413
|
-
)
|
|
414
|
-
});
|
|
415
|
-
else {
|
|
416
|
-
const l = n.disabledMeasurements ?? [];
|
|
417
|
-
m.updateItem({
|
|
418
|
-
...n,
|
|
419
|
-
disabledMeasurements: [...l, r.id]
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}),
|
|
424
|
-
x(
|
|
425
|
-
U.FmTooltip,
|
|
426
|
-
{ zIndex: 51 },
|
|
427
|
-
{
|
|
428
|
-
content() {
|
|
429
|
-
return r.abbrev;
|
|
430
|
-
},
|
|
431
|
-
default() {
|
|
432
|
-
return x(
|
|
433
|
-
"div",
|
|
434
|
-
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
435
|
-
r.abbrev
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
)
|
|
440
|
-
]
|
|
441
|
-
)
|
|
442
|
-
) : null;
|
|
443
|
-
}
|
|
444
|
-
})
|
|
445
|
-
),
|
|
446
|
-
{
|
|
447
|
-
id: "Delete",
|
|
448
|
-
header: "",
|
|
449
|
-
cell(o) {
|
|
450
|
-
const s = o.row.original;
|
|
451
|
-
return x(
|
|
452
|
-
"div",
|
|
453
|
-
{ class: "w-full flex justify-end" },
|
|
454
|
-
x(U.FmButton, {
|
|
455
|
-
class: "delete-button",
|
|
456
|
-
key: s.sku._id,
|
|
457
|
-
type: "button",
|
|
458
|
-
icon: "delete",
|
|
459
|
-
variant: "tertiary",
|
|
460
|
-
size: "md",
|
|
461
|
-
disabled: m.disabled,
|
|
462
|
-
onClick: () => {
|
|
463
|
-
m.deleteItem(s);
|
|
464
|
-
}
|
|
465
|
-
})
|
|
466
|
-
);
|
|
467
|
-
},
|
|
468
|
-
enableSorting: !1,
|
|
469
|
-
size: 40,
|
|
470
|
-
meta: {
|
|
471
|
-
cellClass: "",
|
|
472
|
-
headerClass: ""
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
];
|
|
476
|
-
})
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
const et = { class: "flex flex-col gap-16 py-12" }, tt = { class: "flex" }, st = { class: "flex-1 flex flex-col" }, lt = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, ot = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, nt = { class: "flex flex-col gap-4" }, at = /* @__PURE__ */ Y({
|
|
480
|
-
__name: "ClosingTemplateItem",
|
|
481
|
-
props: {
|
|
482
|
-
cellByColId: {},
|
|
483
|
-
row: {}
|
|
484
|
-
},
|
|
485
|
-
setup(m) {
|
|
486
|
-
const g = m, v = P(() => g.row), t = P(
|
|
487
|
-
() => v.value.getVisibleCells().filter((o) => o.column.id !== L.Name && o.column.id !== L.Delete)
|
|
488
|
-
);
|
|
489
|
-
return (o, s) => {
|
|
490
|
-
var b, n, r, d, u;
|
|
491
|
-
return k(), S("div", et, [
|
|
492
|
-
f("div", tt, [
|
|
493
|
-
f("div", st, [
|
|
494
|
-
f("div", lt, I(v.value.original.sku.name), 1),
|
|
495
|
-
f("div", ot, I(v.value.original.sku.code), 1)
|
|
496
|
-
]),
|
|
497
|
-
f("div", null, [
|
|
498
|
-
_(c(N), {
|
|
499
|
-
render: (r = (n = (b = o.cellByColId[c(L).Delete]) == null ? void 0 : b.column) == null ? void 0 : n.columnDef) == null ? void 0 : r.cell,
|
|
500
|
-
props: (u = (d = o.cellByColId[c(L).Delete]) == null ? void 0 : d.getContext) == null ? void 0 : u.call(d)
|
|
501
|
-
}, null, 8, ["render", "props"])
|
|
502
|
-
])
|
|
503
|
-
]),
|
|
504
|
-
f("div", nt, [
|
|
505
|
-
s[0] || (s[0] = f("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, "Enabled units", -1)),
|
|
506
|
-
(k(!0), S(_e, null, Ce(t.value, (y) => {
|
|
507
|
-
var p, w, e;
|
|
508
|
-
return k(), S("div", {
|
|
509
|
-
key: y.id
|
|
510
|
-
}, [
|
|
511
|
-
_(c(N), {
|
|
512
|
-
render: (w = (p = y.column) == null ? void 0 : p.columnDef) == null ? void 0 : w.cell,
|
|
513
|
-
props: (e = y.getContext) == null ? void 0 : e.call(y)
|
|
514
|
-
}, null, 8, ["render", "props"])
|
|
515
|
-
]);
|
|
516
|
-
}), 128))
|
|
517
|
-
])
|
|
518
|
-
]);
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
}), it = { class: "flex flex-col gap-16" }, rt = { class: "flex flex-col gap-24" }, ct = { class: "flex flex-col gap-16" }, ut = { class: "flex items-center" }, dt = { class: "flex flex-col gap-16" }, mt = { class: "flex items-center" }, pt = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, ft = /* @__PURE__ */ Y({
|
|
522
|
-
__name: "ClosingTemplateForm",
|
|
523
|
-
props: {
|
|
524
|
-
modelValue: {},
|
|
525
|
-
disabled: { type: Boolean }
|
|
526
|
-
},
|
|
527
|
-
setup(m, { expose: g }) {
|
|
528
|
-
const v = m, t = Qe(), { t: o } = J(), s = Ke(), b = X(), {
|
|
529
|
-
promptSelectLocations: n,
|
|
530
|
-
columnDefs: r,
|
|
531
|
-
rowData: d
|
|
532
|
-
} = We({
|
|
533
|
-
getLocations() {
|
|
534
|
-
return t.locations;
|
|
535
|
-
},
|
|
536
|
-
setLocations(e) {
|
|
537
|
-
t.locations = e;
|
|
538
|
-
}
|
|
539
|
-
}), u = F();
|
|
540
|
-
g({
|
|
541
|
-
validateInputs: () => {
|
|
542
|
-
var e, l;
|
|
543
|
-
(l = (e = u.value) == null ? void 0 : e.validateInputs) == null || l.call(e);
|
|
544
|
-
},
|
|
545
|
-
resetInputsValidation: () => {
|
|
546
|
-
var e, l;
|
|
547
|
-
(l = (e = u.value) == null ? void 0 : e.resetInputsValidation) == null || l.call(e);
|
|
548
|
-
},
|
|
549
|
-
resetInputs: () => {
|
|
550
|
-
var e, l;
|
|
551
|
-
(l = (e = u.value) == null ? void 0 : e.resetInputs) == null || l.call(e);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
const y = Ze({
|
|
555
|
-
updateItem: (e) => {
|
|
556
|
-
t.items = t.items.map((l) => l.sku._id !== e.sku._id ? l : e);
|
|
557
|
-
},
|
|
558
|
-
deleteItem: (e) => {
|
|
559
|
-
t.items = t.items.filter((l) => l.sku._id !== e.sku._id);
|
|
560
|
-
},
|
|
561
|
-
get items() {
|
|
562
|
-
return t.items;
|
|
563
|
-
},
|
|
564
|
-
get disabled() {
|
|
565
|
-
return v.disabled;
|
|
566
|
-
}
|
|
567
|
-
}), p = P(() => y.columnDefs.value);
|
|
568
|
-
function w() {
|
|
569
|
-
const e = s.skus.map((h) => ({
|
|
570
|
-
label: h.name,
|
|
571
|
-
sublabel: h.code,
|
|
572
|
-
value: h
|
|
573
|
-
})), l = e.filter((h) => {
|
|
574
|
-
var D;
|
|
575
|
-
return (D = t.items) == null ? void 0 : D.find(($) => $.sku._id === h.value._id);
|
|
576
|
-
}).map((h) => h.value);
|
|
577
|
-
b.open({
|
|
578
|
-
title: o("inventory.closing.form.items.selectItem"),
|
|
579
|
-
closeButton: !0,
|
|
580
|
-
contentComponent: Je,
|
|
581
|
-
contentComponentProps: {
|
|
582
|
-
modelValue: l,
|
|
583
|
-
items: e,
|
|
584
|
-
virtualScroll: !0
|
|
585
|
-
},
|
|
586
|
-
primaryActions: {
|
|
587
|
-
text: o("common.confirm"),
|
|
588
|
-
close: !0
|
|
589
|
-
},
|
|
590
|
-
secondaryActions: {
|
|
591
|
-
text: o("common.close"),
|
|
592
|
-
close: !0,
|
|
593
|
-
variant: "tertiary"
|
|
594
|
-
}
|
|
595
|
-
}).onPrimary((h) => {
|
|
596
|
-
const D = t.items ?? [], $ = h.map((C) => {
|
|
597
|
-
const a = D.find((A) => A.sku._id === C._id);
|
|
598
|
-
return a || {
|
|
599
|
-
sku: C
|
|
600
|
-
};
|
|
601
|
-
});
|
|
602
|
-
$.sort((C, a) => C.sku.code.localeCompare(a.sku.code)), t.items = $;
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
return (e, l) => {
|
|
606
|
-
const h = V("FmTextField"), D = V("FmButton"), $ = V("FmTable"), C = V("FmFormGroup"), a = V("FmForm");
|
|
607
|
-
return k(), B(a, {
|
|
608
|
-
ref_key: "formRef",
|
|
609
|
-
ref: u,
|
|
610
|
-
class: "flex flex-col gap-32",
|
|
611
|
-
disabled: e.disabled
|
|
612
|
-
}, {
|
|
613
|
-
default: R(() => [
|
|
614
|
-
f("div", it, [
|
|
615
|
-
f("div", rt, [
|
|
616
|
-
_(h, {
|
|
617
|
-
label: c(o)("inventory.closing.form.name"),
|
|
618
|
-
"label-mark": "required",
|
|
619
|
-
modelValue: c(t).name,
|
|
620
|
-
"onUpdate:modelValue": l[0] || (l[0] = (i) => c(t).name = i),
|
|
621
|
-
rules: [c(Ge)()]
|
|
622
|
-
}, null, 8, ["label", "modelValue", "rules"]),
|
|
623
|
-
_(h, {
|
|
624
|
-
label: c(o)("inventory.closing.form.reference"),
|
|
625
|
-
"label-mark": "optional",
|
|
626
|
-
modelValue: c(t).ref,
|
|
627
|
-
"onUpdate:modelValue": l[1] || (l[1] = (i) => c(t).ref = i)
|
|
628
|
-
}, null, 8, ["label", "modelValue"])
|
|
629
|
-
])
|
|
630
|
-
]),
|
|
631
|
-
f("div", ct, [
|
|
632
|
-
f("div", ut, [
|
|
633
|
-
l[3] || (l[3] = f("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
|
|
634
|
-
_(D, {
|
|
635
|
-
disabled: e.disabled,
|
|
636
|
-
label: "Select location",
|
|
637
|
-
"prepend-icon": "add",
|
|
638
|
-
variant: "plain",
|
|
639
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
640
|
-
onClick: c(n)
|
|
641
|
-
}, null, 8, ["disabled", "onClick"])
|
|
642
|
-
]),
|
|
643
|
-
_($, {
|
|
644
|
-
"column-defs": c(r),
|
|
645
|
-
"row-data": c(d),
|
|
646
|
-
"shrink-at": 9999,
|
|
647
|
-
onRowClick: c(n),
|
|
648
|
-
"hide-footer": ""
|
|
649
|
-
}, null, 8, ["column-defs", "row-data", "onRowClick"])
|
|
650
|
-
]),
|
|
651
|
-
f("div", dt, [
|
|
652
|
-
f("div", mt, [
|
|
653
|
-
f("div", pt, I(c(o)("inventory.closing.form.items.title")), 1),
|
|
654
|
-
_(D, {
|
|
655
|
-
disabled: e.disabled,
|
|
656
|
-
label: c(o)("inventory.closing.form.items.addItem"),
|
|
657
|
-
"prepend-icon": "add",
|
|
658
|
-
variant: "plain",
|
|
659
|
-
class: "border-2 rounded-lg border-fm-color-primary",
|
|
660
|
-
onClick: l[2] || (l[2] = (i) => w()),
|
|
661
|
-
size: "md"
|
|
662
|
-
}, null, 8, ["disabled", "label"])
|
|
663
|
-
]),
|
|
664
|
-
(k(), B($, {
|
|
665
|
-
"column-defs": p.value,
|
|
666
|
-
"row-data": c(t).items,
|
|
667
|
-
key: c(t).items.map((i) => i.sku._id).join("."),
|
|
668
|
-
"hide-footer": "",
|
|
669
|
-
"page-size": c(t).items.length
|
|
670
|
-
}, {
|
|
671
|
-
"list-row": R((i) => [
|
|
672
|
-
(k(), B(Te, {
|
|
673
|
-
row: i,
|
|
674
|
-
key: c(t).items.map((A) => A.sku._id).join(".")
|
|
675
|
-
}, {
|
|
676
|
-
default: R((A) => [
|
|
677
|
-
_(at, {
|
|
678
|
-
row: i,
|
|
679
|
-
"cell-by-col-id": A
|
|
680
|
-
}, null, 8, ["row", "cell-by-col-id"])
|
|
681
|
-
]),
|
|
682
|
-
_: 2
|
|
683
|
-
}, 1032, ["row"]))
|
|
684
|
-
]),
|
|
685
|
-
_: 1
|
|
686
|
-
}, 8, ["column-defs", "row-data", "page-size"])),
|
|
687
|
-
_(C, {
|
|
688
|
-
"model-value": c(t).items.length,
|
|
689
|
-
rules: [c(He)(1)]
|
|
690
|
-
}, null, 8, ["model-value", "rules"])
|
|
691
|
-
])
|
|
692
|
-
]),
|
|
693
|
-
_: 1
|
|
694
|
-
}, 8, ["disabled"]);
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
}), gt = { class: "flex items-center" }, vt = { class: "fm-typo-en-title-md-800" }, bt = { class: "flex gap-4" }, yt = /* @__PURE__ */ Y({
|
|
698
|
-
__name: "ClosingTemplateDialog",
|
|
699
|
-
props: {
|
|
700
|
-
mode: {},
|
|
701
|
-
modelValue: {},
|
|
702
|
-
show: { type: Boolean }
|
|
703
|
-
},
|
|
704
|
-
emits: ["update:show", "submitted"],
|
|
705
|
-
setup(m, { expose: g, emit: v }) {
|
|
706
|
-
var C;
|
|
707
|
-
const t = m, o = v, s = q(), b = Q(), { t: n } = J(), r = Be(t, "show");
|
|
708
|
-
function d() {
|
|
709
|
-
return {
|
|
710
|
-
_id: "",
|
|
711
|
-
name: "",
|
|
712
|
-
items: []
|
|
713
|
-
};
|
|
714
|
-
}
|
|
715
|
-
const u = F(t.modelValue ?? d()), y = F(((C = t.modelValue) == null ? void 0 : C._id) ?? `${Math.random()}`);
|
|
716
|
-
Me(
|
|
717
|
-
() => t.show,
|
|
718
|
-
(a) => {
|
|
719
|
-
var i;
|
|
720
|
-
a && (u.value = t.modelValue ?? d(), y.value = ((i = t.modelValue) == null ? void 0 : i._id) ?? `${Math.random()}`);
|
|
721
|
-
}
|
|
722
|
-
);
|
|
723
|
-
const p = F(!1), w = P(() => {
|
|
724
|
-
switch (t.mode) {
|
|
725
|
-
case E.READ:
|
|
726
|
-
return "";
|
|
727
|
-
case E.CREATE:
|
|
728
|
-
return n("inventory.closing.template.create.title");
|
|
729
|
-
case E.UPDATE:
|
|
730
|
-
return n("inventory.closing.template.update.title");
|
|
731
|
-
}
|
|
732
|
-
return "";
|
|
733
|
-
}), e = F();
|
|
734
|
-
g({
|
|
735
|
-
validateInputs: () => {
|
|
736
|
-
var a, i;
|
|
737
|
-
(i = (a = e.value) == null ? void 0 : a.validateInputs) == null || i.call(a);
|
|
738
|
-
},
|
|
739
|
-
resetInputsValidation: () => {
|
|
740
|
-
var a, i;
|
|
741
|
-
(i = (a = e.value) == null ? void 0 : a.resetInputsValidation) == null || i.call(a);
|
|
742
|
-
},
|
|
743
|
-
resetInputs: () => {
|
|
744
|
-
var a, i;
|
|
745
|
-
(i = (a = e.value) == null ? void 0 : a.resetInputs) == null || i.call(a);
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
async function l() {
|
|
749
|
-
const a = u.value;
|
|
750
|
-
if (a) {
|
|
751
|
-
p.value = !0;
|
|
752
|
-
try {
|
|
753
|
-
await s.createTemplate(a), await new Promise((i) => setTimeout(i, 1e3)), b.open({
|
|
754
|
-
title: n("inventory.closing.template.create.success"),
|
|
755
|
-
message: n("inventory.closing.template.create.successMessage"),
|
|
756
|
-
type: "success"
|
|
757
|
-
}), o("update:show", !1), o("submitted");
|
|
758
|
-
} catch (i) {
|
|
759
|
-
b.open({
|
|
760
|
-
title: n("inventory.closing.template.create.error"),
|
|
761
|
-
message: n("inventory.closing.template.create.errorMessage"),
|
|
762
|
-
type: "error"
|
|
763
|
-
}), console.error("Error in creating closing template", i);
|
|
764
|
-
} finally {
|
|
765
|
-
p.value = !1;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
async function h() {
|
|
770
|
-
const a = u.value;
|
|
771
|
-
if (a) {
|
|
772
|
-
p.value = !0;
|
|
773
|
-
try {
|
|
774
|
-
await s.updateTemplate(a), await new Promise((i) => setTimeout(i, 1e3)), b.open({
|
|
775
|
-
title: n("inventory.closing.template.update.success"),
|
|
776
|
-
message: n("inventory.closing.template.update.successMessage"),
|
|
777
|
-
type: "success"
|
|
778
|
-
}), o("update:show", !1), o("submitted");
|
|
779
|
-
} catch (i) {
|
|
780
|
-
b.open({
|
|
781
|
-
title: n("inventory.closing.template.update.error"),
|
|
782
|
-
message: n("inventory.closing.template.update.errorMessage"),
|
|
783
|
-
type: "error"
|
|
784
|
-
}), console.error("Error in updating closing template", i);
|
|
785
|
-
} finally {
|
|
786
|
-
p.value = !1;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
function D() {
|
|
791
|
-
switch (t.mode) {
|
|
792
|
-
case E.CREATE:
|
|
793
|
-
return l();
|
|
794
|
-
case E.UPDATE:
|
|
795
|
-
return h();
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
function $() {
|
|
799
|
-
var a, i;
|
|
800
|
-
(i = (a = e.value) == null ? void 0 : a.validateInputs) == null || i.call(a);
|
|
801
|
-
}
|
|
802
|
-
return (a, i) => {
|
|
803
|
-
const A = V("FmButton"), M = V("FmSideSheet");
|
|
804
|
-
return k(), B(M, {
|
|
805
|
-
modelValue: c(r),
|
|
806
|
-
"onUpdate:modelValue": i[2] || (i[2] = (T) => Pe(r) ? r.value = T : null),
|
|
807
|
-
"dismiss-away": "",
|
|
808
|
-
"close-button": "",
|
|
809
|
-
"max-width": 800
|
|
810
|
-
}, {
|
|
811
|
-
"side-sheet-header": R(() => [
|
|
812
|
-
f("div", gt, [
|
|
813
|
-
f("div", vt, I(w.value), 1)
|
|
814
|
-
])
|
|
815
|
-
]),
|
|
816
|
-
default: R(() => [
|
|
817
|
-
(k(), B(ft, {
|
|
818
|
-
class: "w-full",
|
|
819
|
-
ref_key: "formRef",
|
|
820
|
-
ref: e,
|
|
821
|
-
onValidationSuccess: D,
|
|
822
|
-
"model-value": u.value,
|
|
823
|
-
"onUpdate:modelValue": i[0] || (i[0] = (T) => u.value = T),
|
|
824
|
-
disabled: p.value,
|
|
825
|
-
key: y.value
|
|
826
|
-
}, null, 8, ["model-value", "disabled"]))
|
|
827
|
-
]),
|
|
828
|
-
"side-sheet-footer": R(() => [
|
|
829
|
-
f("div", bt, [
|
|
830
|
-
_(A, {
|
|
831
|
-
loading: p.value,
|
|
832
|
-
label: c(n)("common.save"),
|
|
833
|
-
onClick: $
|
|
834
|
-
}, null, 8, ["loading", "label"]),
|
|
835
|
-
_(A, {
|
|
836
|
-
disabled: p.value,
|
|
837
|
-
variant: "tertiary",
|
|
838
|
-
label: c(n)("common.close"),
|
|
839
|
-
onClick: i[1] || (i[1] = (T) => o("update:show", !1))
|
|
840
|
-
}, null, 8, ["disabled", "label"])
|
|
841
|
-
])
|
|
842
|
-
]),
|
|
843
|
-
_: 1
|
|
844
|
-
}, 8, ["modelValue"]);
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
}), ht = {};
|
|
848
|
-
function _t(m, g) {
|
|
849
|
-
return k(), S("div");
|
|
850
|
-
}
|
|
851
|
-
const wt = /* @__PURE__ */ qe(ht, [["render", _t]]), xt = { class: "flex flex-col gap-40" }, kt = { key: 0 }, Tt = {
|
|
852
|
-
key: 1,
|
|
853
|
-
class: "flex gap-8 items-center"
|
|
854
|
-
}, Dt = {
|
|
855
|
-
key: 2,
|
|
856
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
|
|
857
|
-
}, $t = {
|
|
858
|
-
key: 3,
|
|
859
|
-
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
|
|
860
|
-
}, Ct = { key: 4 }, Mt = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, Pt = /* @__PURE__ */ Y({
|
|
861
|
-
__name: "ClosingTemplatePublish",
|
|
862
|
-
emits: ["close"],
|
|
863
|
-
setup(m, { emit: g }) {
|
|
864
|
-
const v = F(!1), t = Q(), o = q(), s = De(), b = g;
|
|
865
|
-
async function n() {
|
|
866
|
-
v.value = !0;
|
|
867
|
-
try {
|
|
868
|
-
await o.startNewPublish().delayed(1e3), t.open({
|
|
869
|
-
title: "Success",
|
|
870
|
-
message: "You may refresh after a while to review publish status",
|
|
871
|
-
type: "success"
|
|
872
|
-
}), u();
|
|
873
|
-
} catch (y) {
|
|
874
|
-
t.open({
|
|
875
|
-
title: "Something went wrong",
|
|
876
|
-
message: "Please try again",
|
|
877
|
-
type: "error"
|
|
878
|
-
}), console.error("error on creating publish task", y);
|
|
879
|
-
} finally {
|
|
880
|
-
v.value = !1;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
const r = P(() => s.recentPublish.recentJob), d = P(
|
|
884
|
-
() => s.templates.length && (!r.value || r.value.outlets.length === r.value.completed.length)
|
|
885
|
-
);
|
|
886
|
-
function u() {
|
|
887
|
-
b("close");
|
|
888
|
-
}
|
|
889
|
-
return (y, p) => {
|
|
890
|
-
const w = V("FmCircularProgress"), e = V("FmButton");
|
|
891
|
-
return k(), S("div", xt, [
|
|
892
|
-
c(s).templates.length ? v.value ? (k(), S("div", Tt, [
|
|
893
|
-
f("div", null, [
|
|
894
|
-
_(w, {
|
|
895
|
-
size: "md",
|
|
896
|
-
color: "neutral-gray-300"
|
|
897
|
-
})
|
|
898
|
-
]),
|
|
899
|
-
p[0] || (p[0] = f("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, [
|
|
900
|
-
f("span", null, "Sending a task to publish templates to all outlets...")
|
|
901
|
-
], -1))
|
|
902
|
-
])) : r.value ? r.value.outlets.length === r.value.completed.length ? (k(), S("div", $t, [
|
|
903
|
-
f("p", null, [
|
|
904
|
-
ve(" Your recent publishing task at " + I(c(he)(new Date(r.value.createdAt))) + " has ", 1),
|
|
905
|
-
p[1] || (p[1] = f("span", { class: "fm-typo-en-body-lg-600" }, "completed", -1)),
|
|
906
|
-
ve(" at " + I(c(he)(new Date(r.value.updatedAt))) + ". ", 1)
|
|
907
|
-
]),
|
|
908
|
-
p[2] || (p[2] = f("p", null, "Do you want to publish to all outlets?", -1))
|
|
909
|
-
])) : (k(), S("div", Ct, " Your recent publishing task is still pending (" + I(r.value.completed.length) + " / " + I(r.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)) : (k(), S("div", Dt, " You have no recent publish activity. Do you want to publish to all outlets? ")) : (k(), S("div", kt, "You have no template to publish.")),
|
|
910
|
-
f("div", Mt, [
|
|
911
|
-
_(e, {
|
|
912
|
-
disabled: !d.value,
|
|
913
|
-
loading: v.value,
|
|
914
|
-
label: "Publish to all outlets",
|
|
915
|
-
onClick: n
|
|
916
|
-
}, null, 8, ["disabled", "loading"]),
|
|
917
|
-
_(e, {
|
|
918
|
-
variant: "tertiary",
|
|
919
|
-
label: "Close",
|
|
920
|
-
onClick: u
|
|
921
|
-
})
|
|
922
|
-
])
|
|
923
|
-
]);
|
|
924
|
-
};
|
|
925
|
-
}
|
|
926
|
-
}), Ft = { class: "flex-1 flex flex-col gap-8" }, St = { class: "flex flex-col" }, At = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, It = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, Rt = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, qt = /* @__PURE__ */ Y({
|
|
927
|
-
__name: "ClosingTemplateView",
|
|
928
|
-
setup(m) {
|
|
929
|
-
const { t: g } = J(), { createTemplate: v, updateTemplate: t } = O(), { templateDialogProps: o, templateDetailsProps: s } = Ye(O()), b = ke(), n = X(), r = De(), d = Ue(), { breakpoints: u } = Le();
|
|
930
|
-
b.watchLocation(r.fetchTemplates);
|
|
931
|
-
const y = P(() => r.loading), p = F(""), w = P(() => u.value.xs || u.value.sm), e = P(() => w.value ? 10 : 20);
|
|
932
|
-
function l(a) {
|
|
933
|
-
switch (a) {
|
|
934
|
-
case z.Add:
|
|
935
|
-
return v();
|
|
936
|
-
case "publish":
|
|
937
|
-
return h();
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
function h() {
|
|
941
|
-
n.open({
|
|
942
|
-
title: "Publish closing templates",
|
|
943
|
-
contentComponent: Pt,
|
|
944
|
-
contentComponentProps: {
|
|
945
|
-
onClose() {
|
|
946
|
-
n.close();
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
function D(a) {
|
|
952
|
-
return a;
|
|
953
|
-
}
|
|
954
|
-
const $ = P(() => {
|
|
955
|
-
const a = [
|
|
956
|
-
{
|
|
957
|
-
label: g("inventory.closing.template.create.title"),
|
|
958
|
-
value: z.Add,
|
|
959
|
-
isPrimary: !0,
|
|
960
|
-
prependIcon: "add"
|
|
961
|
-
}
|
|
962
|
-
];
|
|
963
|
-
return w.value ? a : [
|
|
964
|
-
...a,
|
|
965
|
-
{
|
|
966
|
-
label: "Publish",
|
|
967
|
-
value: "publish",
|
|
968
|
-
isPrimary: !1
|
|
969
|
-
}
|
|
970
|
-
];
|
|
971
|
-
}), C = P(() => {
|
|
972
|
-
const a = [{ icon: "refresh", onClick: r.fetchTemplates }];
|
|
973
|
-
return w.value ? [{ icon: "publish", onClick: h }, ...a] : a;
|
|
974
|
-
});
|
|
975
|
-
return (a, i) => {
|
|
976
|
-
const A = V("FmTable");
|
|
977
|
-
return k(), S(_e, null, [
|
|
978
|
-
_(Ee, {
|
|
979
|
-
title: c(g)("inventory.closing.template.title"),
|
|
980
|
-
actions: $.value,
|
|
981
|
-
"onClick:action": l
|
|
982
|
-
}, {
|
|
983
|
-
default: R(() => [
|
|
984
|
-
f("div", {
|
|
985
|
-
class: Fe([
|
|
986
|
-
"flex flex-col gap-8 max-h-full",
|
|
987
|
-
{
|
|
988
|
-
"p-0": w.value,
|
|
989
|
-
"px-24 ": !w.value
|
|
990
|
-
}
|
|
991
|
-
])
|
|
992
|
-
}, [
|
|
993
|
-
_(ze, {
|
|
994
|
-
searchable: "",
|
|
995
|
-
search: p.value,
|
|
996
|
-
"onUpdate:search": i[0] || (i[0] = (M) => p.value = M),
|
|
997
|
-
actions: C.value
|
|
998
|
-
}, null, 8, ["search", "actions"]),
|
|
999
|
-
_(A, {
|
|
1000
|
-
style: Se(c(d).tableHeight),
|
|
1001
|
-
"column-defs": c(r).columnDefs,
|
|
1002
|
-
"row-data": c(r).templates,
|
|
1003
|
-
"search-value": p.value,
|
|
1004
|
-
loading: y.value,
|
|
1005
|
-
onRowClick: i[1] || (i[1] = (M) => c(t)(M.original)),
|
|
1006
|
-
"page-size": e.value
|
|
1007
|
-
}, {
|
|
1008
|
-
"list-row": R((M) => [
|
|
1009
|
-
_(Te, {
|
|
1010
|
-
row: M,
|
|
1011
|
-
onRowClick: (T) => c(t)(T)
|
|
1012
|
-
}, {
|
|
1013
|
-
default: R((T) => {
|
|
1014
|
-
var W, Z, ee, j, te, se, le, oe, K, ne, ae, ie, re, ce, ue, G, de, me, pe, fe, H, ge;
|
|
1015
|
-
return [
|
|
1016
|
-
f("div", Ft, [
|
|
1017
|
-
f("div", St, [
|
|
1018
|
-
f("div", At, [
|
|
1019
|
-
_(c(N), {
|
|
1020
|
-
render: (ee = (Z = (W = T._id) == null ? void 0 : W.column) == null ? void 0 : Z.columnDef) == null ? void 0 : ee.cell,
|
|
1021
|
-
props: (te = (j = T._id) == null ? void 0 : j.getContext) == null ? void 0 : te.call(j)
|
|
1022
|
-
}, null, 8, ["render", "props"])
|
|
1023
|
-
]),
|
|
1024
|
-
f("div", Vt, [
|
|
1025
|
-
_(c(N), {
|
|
1026
|
-
render: (oe = (le = (se = T.name) == null ? void 0 : se.column) == null ? void 0 : le.columnDef) == null ? void 0 : oe.cell,
|
|
1027
|
-
props: (ne = (K = T.name) == null ? void 0 : K.getContext) == null ? void 0 : ne.call(K)
|
|
1028
|
-
}, null, 8, ["render", "props"])
|
|
1029
|
-
]),
|
|
1030
|
-
f("div", null, I((ae = M.original.locations) != null && ae.length ? `Enabled for ${(ie = M.original.locations) == null ? void 0 : ie.length} outlets` : "Enabled for all outlets"), 1),
|
|
1031
|
-
f("div", It, I([
|
|
1032
|
-
...M.original.items.slice(0, 3).map(($e) => $e.sku.name),
|
|
1033
|
-
...M.original.items.length >= 3 ? [`and ${M.original.items.length - 3} more items`] : []
|
|
1034
|
-
].join(", ")), 1),
|
|
1035
|
-
f("div", Rt, [
|
|
1036
|
-
_(c(N), {
|
|
1037
|
-
render: (ue = (ce = (re = T.ref) == null ? void 0 : re.column) == null ? void 0 : ce.columnDef) == null ? void 0 : ue.cell,
|
|
1038
|
-
props: (de = (G = T.ref) == null ? void 0 : G.getContext) == null ? void 0 : de.call(G)
|
|
1039
|
-
}, null, 8, ["render", "props"])
|
|
1040
|
-
])
|
|
1041
|
-
]),
|
|
1042
|
-
f("div", null, [
|
|
1043
|
-
_(c(N), {
|
|
1044
|
-
render: (fe = (pe = (me = T.status) == null ? void 0 : me.column) == null ? void 0 : pe.columnDef) == null ? void 0 : fe.cell,
|
|
1045
|
-
props: (ge = (H = T.status) == null ? void 0 : H.getContext) == null ? void 0 : ge.call(H)
|
|
1046
|
-
}, null, 8, ["render", "props"])
|
|
1047
|
-
])
|
|
1048
|
-
])
|
|
1049
|
-
];
|
|
1050
|
-
}),
|
|
1051
|
-
_: 2
|
|
1052
|
-
}, 1032, ["row", "onRowClick"])
|
|
1053
|
-
]),
|
|
1054
|
-
_: 1
|
|
1055
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1056
|
-
], 2)
|
|
1057
|
-
]),
|
|
1058
|
-
_: 1
|
|
1059
|
-
}, 8, ["title", "actions"]),
|
|
1060
|
-
(k(), B(Ae, { to: "body" }, [
|
|
1061
|
-
_(wt, Ve(Ie(c(s))), null, 16),
|
|
1062
|
-
_(yt, Re(c(o), {
|
|
1063
|
-
onSubmitted: i[2] || (i[2] = (M) => c(r).fetchTemplates())
|
|
1064
|
-
}), null, 16)
|
|
1065
|
-
]))
|
|
1066
|
-
], 64);
|
|
1067
|
-
};
|
|
1068
|
-
}
|
|
1069
|
-
});
|
|
1070
|
-
export {
|
|
1071
|
-
qt as default
|
|
1072
|
-
};
|