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