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