@feedmepos/mf-inventory-portal 0.0.22-dev.2 → 0.0.22-dev.21
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.vue.d.ts +2 -0
- package/dist/{ApprovalView-D7WEr35k.js → ApprovalView-CCYykhrK.js} +14 -14
- package/dist/{BindingsDialog-C-3uO6pD.js → BindingsDialog-33VV_AST.js} +1 -1
- package/dist/{BindingsPicker-B3tGisCE.js → BindingsPicker-BKu4vN8J.js} +8 -8
- package/dist/{BindingsTable-CPtiH3vj.js → BindingsTable-Dd0h5gDf.js} +1 -1
- package/dist/ClosingTemplateView-BhevjTLl.js +1067 -0
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-ohHZLOuR.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-3gp56NNJ.js} +14 -16
- package/dist/{IngredientsView-D-EKGLq9.js → IngredientsView-DckIH9eR.js} +5 -6
- package/dist/{IntegrationView-BVAO_vch.js → IntegrationView-BqQ4jRIp.js} +2 -2
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CJYmB7Ct.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Vi0q_bDz.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BxkM-SOw.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BIL8LWRz.js} +1 -1
- package/dist/{PurchaseOrderPrintPreview-CP-mK62z.js → PurchaseOrderPrintPreview-Ct7daTTa.js} +1 -1
- package/dist/{ReceiveRequestView-x8WTvuDk.js → ReceiveRequestView-B4wHTogG.js} +25 -26
- package/dist/RecipeView-DuE4cXLz.js +590 -0
- package/dist/Standalone.vue.d.ts +2 -0
- package/dist/{StockView-SyWxT4Ee.js → StockView-Bn9v2Ix8.js} +602 -585
- package/dist/{SupplierView-a0HAZJau.js → SupplierView-C8rqHSOV.js} +37 -37
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CStnY5Zh.js +851 -0
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DRKiv_t8.js +1511 -0
- package/dist/TransferTemplateView-RM6Y-WL4.js +1209 -0
- package/dist/{UnitView-B3c7W5lw.js → UnitView-BXISVrop.js} +4 -4
- package/dist/{WarehouseView-DDV-yslF.js → WarehouseView-B055eB90.js} +18 -18
- package/dist/api/closing-template.d.ts +14 -0
- package/dist/api/inventory.d.ts +5 -7
- package/dist/api/netsuite.d.ts +46 -0
- package/dist/api/purchase-order-template.d.ts +0 -4
- package/dist/{app-DURkcZal.js → app-9algzyce.js} +16045 -15403
- package/dist/app.d.ts +6 -0
- package/dist/app.js +2 -2
- package/dist/components/FmMinMaxInputRules.d.ts +2 -0
- package/dist/components/FmUnitInputRules.d.ts +2 -0
- package/dist/{decimal-BGJlFDm8.js → decimal-CMuMGm4y.js} +1 -1
- package/dist/{defineDeepModel-pATZSiCT.js → defineDeepModel-CjPowyho.js} +1 -1
- package/dist/extensions/promises.d.ts +14 -0
- package/dist/{format-time-from-id-BCAuJEq2.js → format-time-from-id-DNKcbBFm.js} +1 -1
- package/dist/helper/date2.d.ts +1 -0
- package/dist/helper/rules.d.ts +7 -0
- package/dist/helper/rules.spec.d.ts +1 -0
- package/dist/{id-to-date-CVHmTOJk.js → id-to-date-C6W4aVdr.js} +1 -1
- package/dist/purchase-order-transaction-type-CscRvNAR.js +680 -0
- package/dist/stores/api.d.ts +1 -0
- package/dist/stores/feature.d.ts +0 -1
- package/dist/stores/helper/core-store-proxy.d.ts +3 -0
- package/dist/stores/helper/generate-backend-urls.d.ts +1 -0
- package/dist/stores/inventory.d.ts +7 -0
- package/dist/stores/location.d.ts +24 -42
- package/dist/stores/netsuite.d.ts +56 -0
- package/dist/stores/route.d.ts +0 -5
- package/dist/stores/warehouse.d.ts +4 -7
- package/dist/style.css +1 -1
- package/dist/{supplier-DmBbGAwf.js → supplier-BiCX3dpL.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/use-template-enabled-locations-2-Dtg2qOTm.js +85 -0
- package/dist/views/closing-template/components/closing-template-publish/ClosingTemplatePublish.vue.d.ts +6 -0
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +276 -84
- package/dist/views/closing-template/composables/use-closing-template-table.d.ts +341 -85
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +916 -0
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +1 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +788 -152
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +800 -164
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations-2.d.ts +13 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -7
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +2 -2
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +1285 -109
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +399 -993
- package/dist/views/transfer-template/helpers/remove-deleted-skus.helper.d.ts +345 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -14
- package/dist/{xlsx-1DLm6bBD.js → xlsx-fKJqx2Qc.js} +1 -1
- package/dist/{xlsx.util-DLtch7r5.js → xlsx.util-LOnzE3KS.js} +2 -2
- package/package.json +5 -5
- package/dist/ClosingTemplateView-Df0lgpjS.js +0 -928
- package/dist/RecipeView-BysIWI1W.js +0 -581
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-ckp8gcT_.js +0 -740
- package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BSvpuWY9.js +0 -1409
- package/dist/TransferTemplateView-BGi6zd6d.js +0 -1350
- package/dist/array-ClJzD_Lt.js +0 -30
- package/dist/layout/InventoryLayout.vue.d.ts +0 -2
- package/dist/layout/layout-routes.d.ts +0 -6
- package/dist/purchase-order-transaction-type-DvSpCSXr.js +0 -712
- package/dist/use-template-enabled-locations-BiuOdu1M.js +0 -57
|
@@ -0,0 +1,1067 @@
|
|
|
1
|
+
import { ref as S, h as x, computed as P, defineComponent as Y, openBlock as k, createElementBlock as F, createElementVNode as f, toDisplayString as A, createVNode as w, unref as c, Fragment as _e, renderList as Ce, resolveComponent as V, createBlock as B, withCtx as I, watch as Me, isRef as Pe, createTextVNode as ve, normalizeClass as Se, normalizeStyle as Fe, Teleport as Ae, normalizeProps as Ve, guardReactiveProps as Ie, mergeProps as Re } from "vue";
|
|
2
|
+
import { u as Ue, _ as Ee, a as Ne } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-3gp56NNJ.js";
|
|
3
|
+
import { useCoreStore as ze, useI18n as q } from "@feedmepos/mf-common";
|
|
4
|
+
import { useDialog as Q, useSnackbar as W, FmButtonVariant as be, components as R, useProxiedModel as Be, useBreakpoints as Le } from "@feedmepos/ui-library";
|
|
5
|
+
import { defineStore as we, storeToRefs as Ye } from "pinia";
|
|
6
|
+
import { F as U, D as ye, R as E } from "./row-action.enum-PMKMRrZR.js";
|
|
7
|
+
import { o as je, c as xe, j as ke, u as Ke, R as He, z as Je, i as qe, T as he } from "./app-9algzyce.js";
|
|
8
|
+
import { c as Ge, F as z, _ as Te } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
9
|
+
import { f as Oe } from "./format-time-from-id-DNKcbBFm.js";
|
|
10
|
+
import "vue-router";
|
|
11
|
+
import { d as Qe } from "./defineDeepModel-CjPowyho.js";
|
|
12
|
+
import { u as We } from "./use-template-enabled-locations-2-Dtg2qOTm.js";
|
|
13
|
+
const G = je((m, g) => {
|
|
14
|
+
function v() {
|
|
15
|
+
var t;
|
|
16
|
+
return `business_${((t = ze().currentBusiness.value) == null ? void 0 : t._id) ?? ""}`;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
async getRecentPublishingJob() {
|
|
20
|
+
const s = v(), n = `${m.inventoryBackendUrl}/${s}/closing-template/publish/recent`;
|
|
21
|
+
return g.get(n);
|
|
22
|
+
},
|
|
23
|
+
async startNewPublish() {
|
|
24
|
+
const s = v(), n = `${m.inventoryBackendUrl}/${s}/closing-template/publish`;
|
|
25
|
+
return g.post(n);
|
|
26
|
+
},
|
|
27
|
+
async getTemplate(s) {
|
|
28
|
+
const n = v(), t = `${m.inventoryBackendUrl}/${n}/closing-template/${s}`;
|
|
29
|
+
return g.get(t);
|
|
30
|
+
},
|
|
31
|
+
async readTemplates() {
|
|
32
|
+
const s = v(), n = `${m.inventoryBackendUrl}/${s}/closing-template`;
|
|
33
|
+
return g.get(n);
|
|
34
|
+
},
|
|
35
|
+
async createTemplate(s) {
|
|
36
|
+
const n = v(), t = `${m.inventoryBackendUrl}/${n}/closing-template`;
|
|
37
|
+
return g.post(t, s);
|
|
38
|
+
},
|
|
39
|
+
async updateTemplate(s) {
|
|
40
|
+
const n = v(), t = `${m.inventoryBackendUrl}/${n}/closing-template`;
|
|
41
|
+
return g.put(t, s);
|
|
42
|
+
},
|
|
43
|
+
async deleteTemplate(s) {
|
|
44
|
+
const n = v(), t = `${m.inventoryBackendUrl}/${n}/closing-template`;
|
|
45
|
+
return g.delete(t, { _id: s._id, _rev: s._rev });
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}), O = we("closingTemplateActions", () => {
|
|
49
|
+
const m = Q(), g = W(), v = G(), s = S({});
|
|
50
|
+
function n() {
|
|
51
|
+
s.value = {
|
|
52
|
+
mode: U.CREATE,
|
|
53
|
+
show: !0,
|
|
54
|
+
"onUpdate:show"(d) {
|
|
55
|
+
s.value.show = d;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function t(d) {
|
|
60
|
+
s.value = {
|
|
61
|
+
mode: U.UPDATE,
|
|
62
|
+
modelValue: d,
|
|
63
|
+
show: !0,
|
|
64
|
+
"onUpdate:show"(u) {
|
|
65
|
+
s.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((_) => setTimeout(_, 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 a = S({});
|
|
111
|
+
function i(d) {
|
|
112
|
+
a.value = {
|
|
113
|
+
template: d,
|
|
114
|
+
show: !0,
|
|
115
|
+
"onUpdate:show"(u) {
|
|
116
|
+
a.value.show = u;
|
|
117
|
+
},
|
|
118
|
+
"onAction:edit"() {
|
|
119
|
+
a.value.show = !1, t(xe(d));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
createTemplate: n,
|
|
125
|
+
viewTemplate: i,
|
|
126
|
+
updateTemplate: t,
|
|
127
|
+
deleteTemplate: b,
|
|
128
|
+
templateDialogProps: s,
|
|
129
|
+
templateDetailsProps: a
|
|
130
|
+
};
|
|
131
|
+
}), De = we(
|
|
132
|
+
"closingTable",
|
|
133
|
+
function() {
|
|
134
|
+
const { t: g } = q(), { viewTemplate: v, updateTemplate: s, deleteTemplate: n } = O(), t = S({}), b = S(new Array()), a = S(!1), i = ke(), d = G();
|
|
135
|
+
async function u() {
|
|
136
|
+
if (b.value = [], !!i._currentLocation) {
|
|
137
|
+
a.value = !0;
|
|
138
|
+
try {
|
|
139
|
+
const [e, o] = await Promise.all([
|
|
140
|
+
d.readTemplates(),
|
|
141
|
+
d.getRecentPublishingJob()
|
|
142
|
+
]).delayed(1e3);
|
|
143
|
+
b.value = e, t.value = o;
|
|
144
|
+
} catch (e) {
|
|
145
|
+
console.log("Something went wrong when fetching templates:", e);
|
|
146
|
+
} finally {
|
|
147
|
+
a.value = !1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async function y(e) {
|
|
152
|
+
if (!b.value.find((o) => o._id) && i._currentLocation) {
|
|
153
|
+
a.value = !0;
|
|
154
|
+
try {
|
|
155
|
+
const [o] = await Promise.all([
|
|
156
|
+
d.getTemplate(e),
|
|
157
|
+
new Promise((h) => setTimeout(h, 1e3))
|
|
158
|
+
]);
|
|
159
|
+
b.value = [o];
|
|
160
|
+
} catch (o) {
|
|
161
|
+
console.log("Something went wrong when fetching templates:", o);
|
|
162
|
+
} finally {
|
|
163
|
+
a.value = !1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
function p(e, o) {
|
|
168
|
+
switch (o = xe(o), e) {
|
|
169
|
+
case E.Details:
|
|
170
|
+
return v(o);
|
|
171
|
+
case E.Edit:
|
|
172
|
+
return s(o);
|
|
173
|
+
case E.Delete:
|
|
174
|
+
return n(o, a, 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 Oe(`${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 o = (h = e.row.original.locations) == null ? void 0 : h.length;
|
|
212
|
+
return o ? `${o}` : "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 o = e.row.original, h = o._rev, D = (C = t.value.publishedRevs) == null ? void 0 : C[o._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 o = e.row.original, h = [
|
|
256
|
+
ye[E.Edit],
|
|
257
|
+
ye[E.Delete]
|
|
258
|
+
];
|
|
259
|
+
return Ge(h, (D) => p(D, o));
|
|
260
|
+
},
|
|
261
|
+
enableSorting: !1,
|
|
262
|
+
size: 40,
|
|
263
|
+
meta: {
|
|
264
|
+
cellClass: "",
|
|
265
|
+
headerClass: ""
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
recentPublish: t,
|
|
270
|
+
templates: b,
|
|
271
|
+
loading: a,
|
|
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 Xe(m) {
|
|
279
|
+
return {
|
|
280
|
+
columnDefs: P(() => {
|
|
281
|
+
const v = m.items.map((n) => n.sku.unit.measurements.length).reduce((n, t) => Math.max(n, t), 0);
|
|
282
|
+
return [
|
|
283
|
+
{
|
|
284
|
+
id: "Name",
|
|
285
|
+
header: () => "Name",
|
|
286
|
+
enableSorting: !1,
|
|
287
|
+
size: 400,
|
|
288
|
+
cell(n) {
|
|
289
|
+
const t = n.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
|
+
t.sku.name
|
|
300
|
+
),
|
|
301
|
+
x(
|
|
302
|
+
"span",
|
|
303
|
+
{ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-1" },
|
|
304
|
+
t.sku.code
|
|
305
|
+
)
|
|
306
|
+
]
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
id: "Unit",
|
|
312
|
+
header: () => "Enable unit",
|
|
313
|
+
enableSorting: !1,
|
|
314
|
+
size: "auto",
|
|
315
|
+
cell(n) {
|
|
316
|
+
var b, a, i;
|
|
317
|
+
const t = n.row.original;
|
|
318
|
+
return x(
|
|
319
|
+
R.FmFormGroup,
|
|
320
|
+
{
|
|
321
|
+
value: t.sku.unit._id,
|
|
322
|
+
modelValue: !((b = t.disabledMeasurements) != null && b.includes(t.sku.unit._id))
|
|
323
|
+
},
|
|
324
|
+
x(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
class: "flex items-center gap-4"
|
|
328
|
+
},
|
|
329
|
+
[
|
|
330
|
+
x(R.FmCheckbox, {
|
|
331
|
+
value: t.sku.unit._id,
|
|
332
|
+
modelValue: !((a = t.disabledMeasurements) != null && a.includes(t.sku.unit._id)),
|
|
333
|
+
disabled: m.disabled || !((i = t.disabledMeasurements) != null && i.includes(t.sku.unit._id)) && t.sku.unit.measurements.every(
|
|
334
|
+
(d) => {
|
|
335
|
+
var u;
|
|
336
|
+
return (u = t.disabledMeasurements) == null ? void 0 : u.includes(d.id);
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
"onUpdate:modelValue"(d) {
|
|
340
|
+
var u;
|
|
341
|
+
if (d)
|
|
342
|
+
m.updateItem({
|
|
343
|
+
...t,
|
|
344
|
+
disabledMeasurements: (u = t.disabledMeasurements) == null ? void 0 : u.filter(
|
|
345
|
+
(y) => y !== t.sku.unit._id
|
|
346
|
+
)
|
|
347
|
+
});
|
|
348
|
+
else {
|
|
349
|
+
const y = t.disabledMeasurements ?? [];
|
|
350
|
+
m.updateItem({
|
|
351
|
+
...t,
|
|
352
|
+
disabledMeasurements: [...y, t.sku.unit._id]
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}),
|
|
357
|
+
x(
|
|
358
|
+
R.FmTooltip,
|
|
359
|
+
{ zIndex: 51 },
|
|
360
|
+
{
|
|
361
|
+
content() {
|
|
362
|
+
return t.sku.unit.abbrev;
|
|
363
|
+
},
|
|
364
|
+
default() {
|
|
365
|
+
return x(
|
|
366
|
+
"div",
|
|
367
|
+
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
368
|
+
t.sku.unit.abbrev
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
)
|
|
373
|
+
]
|
|
374
|
+
)
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
...Array.from({ length: Math.max(v, 0) }).map(
|
|
379
|
+
(n, t) => ({
|
|
380
|
+
id: `measurement${t}`,
|
|
381
|
+
header: () => "",
|
|
382
|
+
enableSorting: !1,
|
|
383
|
+
size: "auto",
|
|
384
|
+
cell(b) {
|
|
385
|
+
var d, u, y, p;
|
|
386
|
+
const a = b.row.original, i = a.sku.unit.measurements[t];
|
|
387
|
+
return i ? x(
|
|
388
|
+
R.FmFormGroup,
|
|
389
|
+
{
|
|
390
|
+
modelValue: !((d = a.disabledMeasurements) != null && d.includes(i.id)),
|
|
391
|
+
value: i.id
|
|
392
|
+
},
|
|
393
|
+
x(
|
|
394
|
+
"div",
|
|
395
|
+
{
|
|
396
|
+
class: "flex items-center gap-4"
|
|
397
|
+
},
|
|
398
|
+
[
|
|
399
|
+
x(R.FmCheckbox, {
|
|
400
|
+
value: i.id,
|
|
401
|
+
modelValue: !((u = a.disabledMeasurements) != null && u.includes(i.id)),
|
|
402
|
+
disabled: m.disabled || !((y = a.disabledMeasurements) != null && y.includes(i.id)) && ((p = a.disabledMeasurements) == null ? void 0 : p.includes(a.sku.unit._id)) && a.sku.unit.measurements.filter((_) => _.id != i.id).every((_) => {
|
|
403
|
+
var e;
|
|
404
|
+
return (e = a.disabledMeasurements) == null ? void 0 : e.includes(_.id);
|
|
405
|
+
}),
|
|
406
|
+
"onUpdate:modelValue"(_) {
|
|
407
|
+
var e;
|
|
408
|
+
if (_)
|
|
409
|
+
m.updateItem({
|
|
410
|
+
...a,
|
|
411
|
+
disabledMeasurements: (e = a.disabledMeasurements) == null ? void 0 : e.filter(
|
|
412
|
+
(o) => o !== i.id
|
|
413
|
+
)
|
|
414
|
+
});
|
|
415
|
+
else {
|
|
416
|
+
const o = a.disabledMeasurements ?? [];
|
|
417
|
+
m.updateItem({
|
|
418
|
+
...a,
|
|
419
|
+
disabledMeasurements: [...o, i.id]
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}),
|
|
424
|
+
x(
|
|
425
|
+
R.FmTooltip,
|
|
426
|
+
{ zIndex: 51 },
|
|
427
|
+
{
|
|
428
|
+
content() {
|
|
429
|
+
return i.abbrev;
|
|
430
|
+
},
|
|
431
|
+
default() {
|
|
432
|
+
return x(
|
|
433
|
+
"div",
|
|
434
|
+
{ class: "line-clamp-2 fm-typo-en-body-lg-400" },
|
|
435
|
+
i.abbrev
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
]
|
|
441
|
+
)
|
|
442
|
+
) : null;
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
),
|
|
446
|
+
{
|
|
447
|
+
id: "Delete",
|
|
448
|
+
header: "",
|
|
449
|
+
cell(n) {
|
|
450
|
+
const t = n.row.original;
|
|
451
|
+
return x(
|
|
452
|
+
"div",
|
|
453
|
+
{ class: "w-full flex justify-end" },
|
|
454
|
+
x(R.FmButton, {
|
|
455
|
+
class: "delete-button",
|
|
456
|
+
key: t.sku._id,
|
|
457
|
+
type: "button",
|
|
458
|
+
icon: "delete",
|
|
459
|
+
variant: "tertiary",
|
|
460
|
+
size: "md",
|
|
461
|
+
disabled: m.disabled,
|
|
462
|
+
onClick: () => {
|
|
463
|
+
m.deleteItem(t);
|
|
464
|
+
}
|
|
465
|
+
})
|
|
466
|
+
);
|
|
467
|
+
},
|
|
468
|
+
enableSorting: !1,
|
|
469
|
+
size: 40,
|
|
470
|
+
meta: {
|
|
471
|
+
cellClass: "",
|
|
472
|
+
headerClass: ""
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
];
|
|
476
|
+
})
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
const Ze = { class: "flex flex-col gap-16 py-12" }, et = { class: "flex" }, tt = { class: "flex-1 flex flex-col" }, st = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary" }, lt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ot = { class: "flex flex-col gap-4" }, nt = /* @__PURE__ */ Y({
|
|
480
|
+
__name: "ClosingTemplateItem",
|
|
481
|
+
props: {
|
|
482
|
+
cellByColId: {},
|
|
483
|
+
row: {}
|
|
484
|
+
},
|
|
485
|
+
setup(m) {
|
|
486
|
+
const g = m, v = P(() => g.row), s = P(
|
|
487
|
+
() => v.value.getVisibleCells().filter((n) => n.column.id !== L.Name && n.column.id !== L.Delete)
|
|
488
|
+
);
|
|
489
|
+
return (n, t) => {
|
|
490
|
+
var b, a, i, d, u;
|
|
491
|
+
return k(), F("div", Ze, [
|
|
492
|
+
f("div", et, [
|
|
493
|
+
f("div", tt, [
|
|
494
|
+
f("div", st, A(v.value.original.sku.name), 1),
|
|
495
|
+
f("div", lt, A(v.value.original.sku.code), 1)
|
|
496
|
+
]),
|
|
497
|
+
f("div", null, [
|
|
498
|
+
w(c(z), {
|
|
499
|
+
render: (i = (a = (b = n.cellByColId[c(L).Delete]) == null ? void 0 : b.column) == null ? void 0 : a.columnDef) == null ? void 0 : i.cell,
|
|
500
|
+
props: (u = (d = n.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", ot, [
|
|
505
|
+
t[0] || (t[0] = f("div", { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, "Enabled units", -1)),
|
|
506
|
+
(k(!0), F(_e, null, Ce(s.value, (y) => {
|
|
507
|
+
var p, _, e;
|
|
508
|
+
return k(), F("div", {
|
|
509
|
+
key: y.id
|
|
510
|
+
}, [
|
|
511
|
+
w(c(z), {
|
|
512
|
+
render: (_ = (p = y.column) == null ? void 0 : p.columnDef) == null ? void 0 : _.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
|
+
}), at = { class: "flex flex-col gap-16" }, it = { class: "flex flex-col gap-24" }, rt = { class: "flex flex-col gap-16" }, ct = { class: "flex items-center" }, ut = { class: "flex flex-col gap-16" }, dt = { class: "flex items-center" }, mt = { class: "flex-1 gap-8 fm-typo-en-title-sm-800" }, pt = /* @__PURE__ */ Y({
|
|
522
|
+
__name: "ClosingTemplateForm",
|
|
523
|
+
props: {
|
|
524
|
+
modelValue: {},
|
|
525
|
+
disabled: { type: Boolean }
|
|
526
|
+
},
|
|
527
|
+
setup(m, { expose: g }) {
|
|
528
|
+
const v = m, s = Qe(), { t: n } = q(), t = Ke(), b = Q(), {
|
|
529
|
+
promptSelectLocations: a,
|
|
530
|
+
columnDefs: i,
|
|
531
|
+
rowData: d
|
|
532
|
+
} = We({
|
|
533
|
+
getLocations() {
|
|
534
|
+
return s.locations;
|
|
535
|
+
},
|
|
536
|
+
setLocations(e) {
|
|
537
|
+
s.locations = e;
|
|
538
|
+
}
|
|
539
|
+
}), u = S();
|
|
540
|
+
g({
|
|
541
|
+
validateInputs: () => {
|
|
542
|
+
var e, o;
|
|
543
|
+
(o = (e = u.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
|
|
544
|
+
},
|
|
545
|
+
resetInputsValidation: () => {
|
|
546
|
+
var e, o;
|
|
547
|
+
(o = (e = u.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
|
|
548
|
+
},
|
|
549
|
+
resetInputs: () => {
|
|
550
|
+
var e, o;
|
|
551
|
+
(o = (e = u.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
|
|
552
|
+
}
|
|
553
|
+
});
|
|
554
|
+
const y = Xe({
|
|
555
|
+
updateItem: (e) => {
|
|
556
|
+
s.items = s.items.map((o) => o.sku._id !== e.sku._id ? o : e);
|
|
557
|
+
},
|
|
558
|
+
deleteItem: (e) => {
|
|
559
|
+
s.items = s.items.filter((o) => o.sku._id !== e.sku._id);
|
|
560
|
+
},
|
|
561
|
+
get items() {
|
|
562
|
+
return s.items;
|
|
563
|
+
},
|
|
564
|
+
get disabled() {
|
|
565
|
+
return v.disabled;
|
|
566
|
+
}
|
|
567
|
+
}), p = P(() => y.columnDefs.value);
|
|
568
|
+
function _() {
|
|
569
|
+
const e = t.skus.map((h) => ({
|
|
570
|
+
label: h.name,
|
|
571
|
+
sublabel: h.code,
|
|
572
|
+
value: h
|
|
573
|
+
})), o = e.filter((h) => {
|
|
574
|
+
var D;
|
|
575
|
+
return (D = s.items) == null ? void 0 : D.find(($) => $.sku._id === h.value._id);
|
|
576
|
+
}).map((h) => h.value);
|
|
577
|
+
b.open({
|
|
578
|
+
title: n("inventory.closing.form.items.selectItem"),
|
|
579
|
+
closeButton: !0,
|
|
580
|
+
contentComponent: Je,
|
|
581
|
+
contentComponentProps: {
|
|
582
|
+
modelValue: o,
|
|
583
|
+
items: e,
|
|
584
|
+
virtualScroll: !0
|
|
585
|
+
},
|
|
586
|
+
primaryActions: {
|
|
587
|
+
text: n("common.confirm"),
|
|
588
|
+
close: !0
|
|
589
|
+
},
|
|
590
|
+
secondaryActions: {
|
|
591
|
+
text: n("common.close"),
|
|
592
|
+
close: !0,
|
|
593
|
+
variant: "tertiary"
|
|
594
|
+
}
|
|
595
|
+
}).onPrimary((h) => {
|
|
596
|
+
const D = s.items ?? [], $ = h.map((C) => {
|
|
597
|
+
const l = D.find((N) => N.sku._id === C._id);
|
|
598
|
+
return l || {
|
|
599
|
+
sku: C
|
|
600
|
+
};
|
|
601
|
+
});
|
|
602
|
+
$.sort((C, l) => C.sku.code.localeCompare(l.sku.code)), s.items = $;
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
return (e, o) => {
|
|
606
|
+
const h = V("FmTextField"), D = V("FmButton"), $ = V("FmTable"), C = V("FmForm");
|
|
607
|
+
return k(), B(C, {
|
|
608
|
+
ref_key: "formRef",
|
|
609
|
+
ref: u,
|
|
610
|
+
class: "flex flex-col gap-32",
|
|
611
|
+
disabled: e.disabled
|
|
612
|
+
}, {
|
|
613
|
+
default: I(() => [
|
|
614
|
+
f("div", at, [
|
|
615
|
+
f("div", it, [
|
|
616
|
+
w(h, {
|
|
617
|
+
label: c(n)("inventory.closing.form.name"),
|
|
618
|
+
"label-mark": "required",
|
|
619
|
+
modelValue: c(s).name,
|
|
620
|
+
"onUpdate:modelValue": o[0] || (o[0] = (l) => c(s).name = l),
|
|
621
|
+
rules: [c(He)()]
|
|
622
|
+
}, null, 8, ["label", "modelValue", "rules"]),
|
|
623
|
+
w(h, {
|
|
624
|
+
label: c(n)("inventory.closing.form.reference"),
|
|
625
|
+
"label-mark": "optional",
|
|
626
|
+
modelValue: c(s).ref,
|
|
627
|
+
"onUpdate:modelValue": o[1] || (o[1] = (l) => c(s).ref = l)
|
|
628
|
+
}, null, 8, ["label", "modelValue"])
|
|
629
|
+
])
|
|
630
|
+
]),
|
|
631
|
+
f("div", rt, [
|
|
632
|
+
f("div", ct, [
|
|
633
|
+
o[3] || (o[3] = f("div", { class: "flex-1 fm-typo-en-title-sm-600" }, "Locations", -1)),
|
|
634
|
+
w(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(a)
|
|
641
|
+
}, null, 8, ["disabled", "onClick"])
|
|
642
|
+
]),
|
|
643
|
+
w($, {
|
|
644
|
+
"column-defs": c(i),
|
|
645
|
+
"row-data": c(d),
|
|
646
|
+
"shrink-at": 9999,
|
|
647
|
+
onRowClick: c(a),
|
|
648
|
+
"hide-footer": ""
|
|
649
|
+
}, null, 8, ["column-defs", "row-data", "onRowClick"])
|
|
650
|
+
]),
|
|
651
|
+
f("div", ut, [
|
|
652
|
+
f("div", dt, [
|
|
653
|
+
f("div", mt, A(c(n)("inventory.closing.form.items.title")), 1),
|
|
654
|
+
w(D, {
|
|
655
|
+
disabled: e.disabled,
|
|
656
|
+
label: c(n)("inventory.closing.form.items.addItem"),
|
|
657
|
+
"prepend-icon": "add",
|
|
658
|
+
variant: "plain",
|
|
659
|
+
class: "border-2 rounded-lg border-fm-color-primary",
|
|
660
|
+
onClick: o[2] || (o[2] = (l) => _()),
|
|
661
|
+
size: "md"
|
|
662
|
+
}, null, 8, ["disabled", "label"])
|
|
663
|
+
]),
|
|
664
|
+
(k(), B($, {
|
|
665
|
+
"column-defs": p.value,
|
|
666
|
+
"row-data": c(s).items,
|
|
667
|
+
key: c(s).items.map((l) => l.sku._id).join("."),
|
|
668
|
+
"hide-footer": ""
|
|
669
|
+
}, {
|
|
670
|
+
"list-row": I((l) => [
|
|
671
|
+
(k(), B(Te, {
|
|
672
|
+
row: l,
|
|
673
|
+
key: c(s).items.map((r) => r.sku._id).join(".")
|
|
674
|
+
}, {
|
|
675
|
+
default: I((r) => [
|
|
676
|
+
w(nt, {
|
|
677
|
+
row: l,
|
|
678
|
+
"cell-by-col-id": r
|
|
679
|
+
}, null, 8, ["row", "cell-by-col-id"])
|
|
680
|
+
]),
|
|
681
|
+
_: 2
|
|
682
|
+
}, 1032, ["row"]))
|
|
683
|
+
]),
|
|
684
|
+
_: 1
|
|
685
|
+
}, 8, ["column-defs", "row-data"]))
|
|
686
|
+
])
|
|
687
|
+
]),
|
|
688
|
+
_: 1
|
|
689
|
+
}, 8, ["disabled"]);
|
|
690
|
+
};
|
|
691
|
+
}
|
|
692
|
+
}), ft = { class: "flex items-center" }, gt = { class: "fm-typo-en-title-md-800" }, vt = { class: "flex gap-4" }, bt = /* @__PURE__ */ Y({
|
|
693
|
+
__name: "ClosingTemplateDialog",
|
|
694
|
+
props: {
|
|
695
|
+
mode: {},
|
|
696
|
+
modelValue: {},
|
|
697
|
+
show: { type: Boolean }
|
|
698
|
+
},
|
|
699
|
+
emits: ["update:show", "submitted"],
|
|
700
|
+
setup(m, { expose: g, emit: v }) {
|
|
701
|
+
var C;
|
|
702
|
+
const s = m, n = v, t = G(), b = W(), { t: a } = q(), i = Be(s, "show");
|
|
703
|
+
function d() {
|
|
704
|
+
return {
|
|
705
|
+
_id: "",
|
|
706
|
+
name: "",
|
|
707
|
+
items: []
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
const u = S(s.modelValue ?? d()), y = S(((C = s.modelValue) == null ? void 0 : C._id) ?? `${Math.random()}`);
|
|
711
|
+
Me(
|
|
712
|
+
() => s.show,
|
|
713
|
+
(l) => {
|
|
714
|
+
var r;
|
|
715
|
+
l && (u.value = s.modelValue ?? d(), y.value = ((r = s.modelValue) == null ? void 0 : r._id) ?? `${Math.random()}`);
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
const p = S(!1), _ = P(() => {
|
|
719
|
+
switch (s.mode) {
|
|
720
|
+
case U.READ:
|
|
721
|
+
return "";
|
|
722
|
+
case U.CREATE:
|
|
723
|
+
return a("inventory.closing.template.create.title");
|
|
724
|
+
case U.UPDATE:
|
|
725
|
+
return a("inventory.closing.template.update.title");
|
|
726
|
+
}
|
|
727
|
+
return "";
|
|
728
|
+
}), e = S();
|
|
729
|
+
g({
|
|
730
|
+
validateInputs: () => {
|
|
731
|
+
var l, r;
|
|
732
|
+
(r = (l = e.value) == null ? void 0 : l.validateInputs) == null || r.call(l);
|
|
733
|
+
},
|
|
734
|
+
resetInputsValidation: () => {
|
|
735
|
+
var l, r;
|
|
736
|
+
(r = (l = e.value) == null ? void 0 : l.resetInputsValidation) == null || r.call(l);
|
|
737
|
+
},
|
|
738
|
+
resetInputs: () => {
|
|
739
|
+
var l, r;
|
|
740
|
+
(r = (l = e.value) == null ? void 0 : l.resetInputs) == null || r.call(l);
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
async function o() {
|
|
744
|
+
const l = u.value;
|
|
745
|
+
if (l) {
|
|
746
|
+
p.value = !0;
|
|
747
|
+
try {
|
|
748
|
+
await t.createTemplate(l), await new Promise((r) => setTimeout(r, 1e3)), b.open({
|
|
749
|
+
title: a("inventory.closing.template.create.success"),
|
|
750
|
+
message: a("inventory.closing.template.create.successMessage"),
|
|
751
|
+
type: "success"
|
|
752
|
+
}), n("update:show", !1), n("submitted");
|
|
753
|
+
} catch (r) {
|
|
754
|
+
b.open({
|
|
755
|
+
title: a("inventory.closing.template.create.error"),
|
|
756
|
+
message: a("inventory.closing.template.create.errorMessage"),
|
|
757
|
+
type: "error"
|
|
758
|
+
}), console.error("Error in creating closing template", r);
|
|
759
|
+
} finally {
|
|
760
|
+
p.value = !1;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
async function h() {
|
|
765
|
+
const l = u.value;
|
|
766
|
+
if (l) {
|
|
767
|
+
p.value = !0;
|
|
768
|
+
try {
|
|
769
|
+
await t.updateTemplate(l), await new Promise((r) => setTimeout(r, 1e3)), b.open({
|
|
770
|
+
title: a("inventory.closing.template.update.success"),
|
|
771
|
+
message: a("inventory.closing.template.update.successMessage"),
|
|
772
|
+
type: "success"
|
|
773
|
+
}), n("update:show", !1), n("submitted");
|
|
774
|
+
} catch (r) {
|
|
775
|
+
b.open({
|
|
776
|
+
title: a("inventory.closing.template.update.error"),
|
|
777
|
+
message: a("inventory.closing.template.update.errorMessage"),
|
|
778
|
+
type: "error"
|
|
779
|
+
}), console.error("Error in updating closing template", r);
|
|
780
|
+
} finally {
|
|
781
|
+
p.value = !1;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function D() {
|
|
786
|
+
switch (s.mode) {
|
|
787
|
+
case U.CREATE:
|
|
788
|
+
return o();
|
|
789
|
+
case U.UPDATE:
|
|
790
|
+
return h();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
function $() {
|
|
794
|
+
var l, r;
|
|
795
|
+
(r = (l = e.value) == null ? void 0 : l.validateInputs) == null || r.call(l);
|
|
796
|
+
}
|
|
797
|
+
return (l, r) => {
|
|
798
|
+
const N = V("FmButton"), M = V("FmSideSheet");
|
|
799
|
+
return k(), B(M, {
|
|
800
|
+
modelValue: c(i),
|
|
801
|
+
"onUpdate:modelValue": r[2] || (r[2] = (T) => Pe(i) ? i.value = T : null),
|
|
802
|
+
"dismiss-away": "",
|
|
803
|
+
"close-button": "",
|
|
804
|
+
"max-width": 800
|
|
805
|
+
}, {
|
|
806
|
+
"side-sheet-header": I(() => [
|
|
807
|
+
f("div", ft, [
|
|
808
|
+
f("div", gt, A(_.value), 1)
|
|
809
|
+
])
|
|
810
|
+
]),
|
|
811
|
+
default: I(() => [
|
|
812
|
+
(k(), B(pt, {
|
|
813
|
+
class: "w-full",
|
|
814
|
+
ref_key: "formRef",
|
|
815
|
+
ref: e,
|
|
816
|
+
onValidationSuccess: D,
|
|
817
|
+
"model-value": u.value,
|
|
818
|
+
"onUpdate:modelValue": r[0] || (r[0] = (T) => u.value = T),
|
|
819
|
+
disabled: p.value,
|
|
820
|
+
key: y.value
|
|
821
|
+
}, null, 8, ["model-value", "disabled"]))
|
|
822
|
+
]),
|
|
823
|
+
"side-sheet-footer": I(() => [
|
|
824
|
+
f("div", vt, [
|
|
825
|
+
w(N, {
|
|
826
|
+
loading: p.value,
|
|
827
|
+
label: c(a)("common.save"),
|
|
828
|
+
onClick: $
|
|
829
|
+
}, null, 8, ["loading", "label"]),
|
|
830
|
+
w(N, {
|
|
831
|
+
disabled: p.value,
|
|
832
|
+
variant: "tertiary",
|
|
833
|
+
label: c(a)("common.close"),
|
|
834
|
+
onClick: r[1] || (r[1] = (T) => n("update:show", !1))
|
|
835
|
+
}, null, 8, ["disabled", "label"])
|
|
836
|
+
])
|
|
837
|
+
]),
|
|
838
|
+
_: 1
|
|
839
|
+
}, 8, ["modelValue"]);
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
}), yt = {};
|
|
843
|
+
function ht(m, g) {
|
|
844
|
+
return k(), F("div");
|
|
845
|
+
}
|
|
846
|
+
const _t = /* @__PURE__ */ qe(yt, [["render", ht]]), wt = { class: "flex flex-col gap-40" }, xt = { key: 0 }, kt = {
|
|
847
|
+
key: 1,
|
|
848
|
+
class: "flex gap-8 items-center"
|
|
849
|
+
}, Tt = {
|
|
850
|
+
key: 2,
|
|
851
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary"
|
|
852
|
+
}, Dt = {
|
|
853
|
+
key: 3,
|
|
854
|
+
class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary flex flex-col gap-12"
|
|
855
|
+
}, $t = { key: 4 }, Ct = { class: "flex sm:flex-col xs:flex-col justify-end gap-8 w-full mb-16" }, Mt = /* @__PURE__ */ Y({
|
|
856
|
+
__name: "ClosingTemplatePublish",
|
|
857
|
+
emits: ["close"],
|
|
858
|
+
setup(m, { emit: g }) {
|
|
859
|
+
const v = S(!1), s = W(), n = G(), t = De(), b = g;
|
|
860
|
+
async function a() {
|
|
861
|
+
v.value = !0;
|
|
862
|
+
try {
|
|
863
|
+
await n.startNewPublish().delayed(1e3), s.open({
|
|
864
|
+
title: "Success",
|
|
865
|
+
message: "You may refresh after a while to review publish status",
|
|
866
|
+
type: "success"
|
|
867
|
+
}), u();
|
|
868
|
+
} catch (y) {
|
|
869
|
+
s.open({
|
|
870
|
+
title: "Something went wrong",
|
|
871
|
+
message: "Please try again",
|
|
872
|
+
type: "error"
|
|
873
|
+
}), console.error("error on creating publish task", y);
|
|
874
|
+
} finally {
|
|
875
|
+
v.value = !1;
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const i = P(() => t.recentPublish.recentJob), d = P(
|
|
879
|
+
() => t.templates.length && (!i.value || i.value.outlets.length === i.value.completed.length)
|
|
880
|
+
);
|
|
881
|
+
function u() {
|
|
882
|
+
b("close");
|
|
883
|
+
}
|
|
884
|
+
return (y, p) => {
|
|
885
|
+
const _ = V("FmCircularProgress"), e = V("FmButton");
|
|
886
|
+
return k(), F("div", wt, [
|
|
887
|
+
c(t).templates.length ? v.value ? (k(), F("div", kt, [
|
|
888
|
+
f("div", null, [
|
|
889
|
+
w(_, {
|
|
890
|
+
size: "md",
|
|
891
|
+
color: "neutral-gray-300"
|
|
892
|
+
})
|
|
893
|
+
]),
|
|
894
|
+
p[0] || (p[0] = f("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-primary" }, [
|
|
895
|
+
f("span", null, "Sending a task to publish templates to all outlets...")
|
|
896
|
+
], -1))
|
|
897
|
+
])) : i.value ? i.value.outlets.length === i.value.completed.length ? (k(), F("div", Dt, [
|
|
898
|
+
f("p", null, [
|
|
899
|
+
ve(" Your recent publishing task at " + A(c(he)(new Date(i.value.createdAt))) + " has ", 1),
|
|
900
|
+
p[1] || (p[1] = f("span", { class: "fm-typo-en-body-lg-600" }, "completed", -1)),
|
|
901
|
+
ve(" at " + A(c(he)(new Date(i.value.updatedAt))) + ". ", 1)
|
|
902
|
+
]),
|
|
903
|
+
p[2] || (p[2] = f("p", null, "Do you want to publish to all outlets?", -1))
|
|
904
|
+
])) : (k(), F("div", $t, " Your recent publishing task is still pending (" + A(i.value.completed.length) + " / " + A(i.value.outlets.length) + "). Please wait until all publishing task has completed. ", 1)) : (k(), F("div", Tt, " You have no recent publish activity. Do you want to publish to all outlets? ")) : (k(), F("div", xt, "You have no template to publish.")),
|
|
905
|
+
f("div", Ct, [
|
|
906
|
+
w(e, {
|
|
907
|
+
disabled: !d.value,
|
|
908
|
+
loading: v.value,
|
|
909
|
+
label: "Publish to all outlets",
|
|
910
|
+
onClick: a
|
|
911
|
+
}, null, 8, ["disabled", "loading"]),
|
|
912
|
+
w(e, {
|
|
913
|
+
variant: "tertiary",
|
|
914
|
+
label: "Close",
|
|
915
|
+
onClick: u
|
|
916
|
+
})
|
|
917
|
+
])
|
|
918
|
+
]);
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
}), Pt = { class: "flex-1 flex flex-col gap-8" }, St = { class: "flex flex-col" }, Ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, At = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Vt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary line-clamp-2" }, It = { class: "fm-typo-en-body-lg-400 line-clamp-2" }, qt = /* @__PURE__ */ Y({
|
|
922
|
+
__name: "ClosingTemplateView",
|
|
923
|
+
setup(m) {
|
|
924
|
+
const { t: g } = q(), { createTemplate: v, updateTemplate: s } = O(), { templateDialogProps: n, templateDetailsProps: t } = Ye(O()), b = ke(), a = Q(), i = De(), d = Ue(), { breakpoints: u } = Le();
|
|
925
|
+
b.watchLocation(i.fetchTemplates);
|
|
926
|
+
const y = P(() => i.loading), p = S(""), _ = P(() => u.value.xs || u.value.sm), e = P(() => _.value ? 10 : 20);
|
|
927
|
+
function o(l) {
|
|
928
|
+
switch (l) {
|
|
929
|
+
case E.Add:
|
|
930
|
+
return v();
|
|
931
|
+
case "publish":
|
|
932
|
+
return h();
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
function h() {
|
|
936
|
+
a.open({
|
|
937
|
+
title: "Publish closing templates",
|
|
938
|
+
contentComponent: Mt,
|
|
939
|
+
contentComponentProps: {
|
|
940
|
+
onClose() {
|
|
941
|
+
a.close();
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
function D(l) {
|
|
947
|
+
return l;
|
|
948
|
+
}
|
|
949
|
+
const $ = P(() => {
|
|
950
|
+
const l = [
|
|
951
|
+
{
|
|
952
|
+
label: g("inventory.closing.template.create.title"),
|
|
953
|
+
value: E.Add,
|
|
954
|
+
isPrimary: !0,
|
|
955
|
+
prependIcon: "add"
|
|
956
|
+
}
|
|
957
|
+
];
|
|
958
|
+
return _.value ? l : [
|
|
959
|
+
...l,
|
|
960
|
+
{
|
|
961
|
+
label: "Publish",
|
|
962
|
+
value: "publish",
|
|
963
|
+
isPrimary: !1
|
|
964
|
+
}
|
|
965
|
+
];
|
|
966
|
+
}), C = P(() => {
|
|
967
|
+
const l = [{ icon: "refresh", onClick: i.fetchTemplates }];
|
|
968
|
+
return _.value ? [{ icon: "publish", onClick: h }, ...l] : l;
|
|
969
|
+
});
|
|
970
|
+
return (l, r) => {
|
|
971
|
+
const N = V("FmTable");
|
|
972
|
+
return k(), F(_e, null, [
|
|
973
|
+
w(Ee, {
|
|
974
|
+
title: c(g)("inventory.closing.template.title"),
|
|
975
|
+
actions: $.value,
|
|
976
|
+
"onClick:action": o
|
|
977
|
+
}, {
|
|
978
|
+
default: I(() => [
|
|
979
|
+
f("div", {
|
|
980
|
+
class: Se([
|
|
981
|
+
"flex flex-col gap-8 max-h-full",
|
|
982
|
+
{
|
|
983
|
+
"p-0": _.value,
|
|
984
|
+
"px-24 ": !_.value
|
|
985
|
+
}
|
|
986
|
+
])
|
|
987
|
+
}, [
|
|
988
|
+
w(Ne, {
|
|
989
|
+
searchable: "",
|
|
990
|
+
search: p.value,
|
|
991
|
+
"onUpdate:search": r[0] || (r[0] = (M) => p.value = M),
|
|
992
|
+
actions: C.value
|
|
993
|
+
}, null, 8, ["search", "actions"]),
|
|
994
|
+
w(N, {
|
|
995
|
+
style: Fe(c(d).tableHeight),
|
|
996
|
+
"column-defs": c(i).columnDefs,
|
|
997
|
+
"row-data": c(i).templates,
|
|
998
|
+
"search-value": p.value,
|
|
999
|
+
loading: y.value,
|
|
1000
|
+
onRowClick: r[1] || (r[1] = (M) => c(s)(M.original)),
|
|
1001
|
+
"page-size": e.value
|
|
1002
|
+
}, {
|
|
1003
|
+
"list-row": I((M) => [
|
|
1004
|
+
w(Te, {
|
|
1005
|
+
row: M,
|
|
1006
|
+
onRowClick: (T) => c(s)(T)
|
|
1007
|
+
}, {
|
|
1008
|
+
default: I((T) => {
|
|
1009
|
+
var X, Z, ee, j, te, se, le, oe, K, ne, ae, ie, re, ce, ue, H, de, me, pe, fe, J, ge;
|
|
1010
|
+
return [
|
|
1011
|
+
f("div", Pt, [
|
|
1012
|
+
f("div", St, [
|
|
1013
|
+
f("div", Ft, [
|
|
1014
|
+
w(c(z), {
|
|
1015
|
+
render: (ee = (Z = (X = T._id) == null ? void 0 : X.column) == null ? void 0 : Z.columnDef) == null ? void 0 : ee.cell,
|
|
1016
|
+
props: (te = (j = T._id) == null ? void 0 : j.getContext) == null ? void 0 : te.call(j)
|
|
1017
|
+
}, null, 8, ["render", "props"])
|
|
1018
|
+
]),
|
|
1019
|
+
f("div", At, [
|
|
1020
|
+
w(c(z), {
|
|
1021
|
+
render: (oe = (le = (se = T.name) == null ? void 0 : se.column) == null ? void 0 : le.columnDef) == null ? void 0 : oe.cell,
|
|
1022
|
+
props: (ne = (K = T.name) == null ? void 0 : K.getContext) == null ? void 0 : ne.call(K)
|
|
1023
|
+
}, null, 8, ["render", "props"])
|
|
1024
|
+
]),
|
|
1025
|
+
f("div", null, A((ae = M.original.locations) != null && ae.length ? `Enabled for ${(ie = M.original.locations) == null ? void 0 : ie.length} outlets` : "Enabled for all outlets"), 1),
|
|
1026
|
+
f("div", Vt, A([
|
|
1027
|
+
...M.original.items.slice(0, 3).map(($e) => $e.sku.name),
|
|
1028
|
+
...M.original.items.length >= 3 ? [`and ${M.original.items.length - 3} more items`] : []
|
|
1029
|
+
].join(", ")), 1),
|
|
1030
|
+
f("div", It, [
|
|
1031
|
+
w(c(z), {
|
|
1032
|
+
render: (ue = (ce = (re = T.ref) == null ? void 0 : re.column) == null ? void 0 : ce.columnDef) == null ? void 0 : ue.cell,
|
|
1033
|
+
props: (de = (H = T.ref) == null ? void 0 : H.getContext) == null ? void 0 : de.call(H)
|
|
1034
|
+
}, null, 8, ["render", "props"])
|
|
1035
|
+
])
|
|
1036
|
+
]),
|
|
1037
|
+
f("div", null, [
|
|
1038
|
+
w(c(z), {
|
|
1039
|
+
render: (fe = (pe = (me = T.status) == null ? void 0 : me.column) == null ? void 0 : pe.columnDef) == null ? void 0 : fe.cell,
|
|
1040
|
+
props: (ge = (J = T.status) == null ? void 0 : J.getContext) == null ? void 0 : ge.call(J)
|
|
1041
|
+
}, null, 8, ["render", "props"])
|
|
1042
|
+
])
|
|
1043
|
+
])
|
|
1044
|
+
];
|
|
1045
|
+
}),
|
|
1046
|
+
_: 2
|
|
1047
|
+
}, 1032, ["row", "onRowClick"])
|
|
1048
|
+
]),
|
|
1049
|
+
_: 1
|
|
1050
|
+
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
|
|
1051
|
+
], 2)
|
|
1052
|
+
]),
|
|
1053
|
+
_: 1
|
|
1054
|
+
}, 8, ["title", "actions"]),
|
|
1055
|
+
(k(), B(Ae, { to: "body" }, [
|
|
1056
|
+
w(_t, Ve(Ie(c(t))), null, 16),
|
|
1057
|
+
w(bt, Re(c(n), {
|
|
1058
|
+
onSubmitted: r[2] || (r[2] = (M) => c(i).fetchTemplates())
|
|
1059
|
+
}), null, 16)
|
|
1060
|
+
]))
|
|
1061
|
+
], 64);
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
export {
|
|
1066
|
+
qt as default
|
|
1067
|
+
};
|