@feedmepos/mf-inventory-portal 1.2.30-dev.1 → 1.2.31-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-kX4bqoEe.js → App-DfKh34ES.js} +43 -41
- package/dist/{ApprovalView-DCNKqVE2.js → ApprovalView-DyoKsEqh.js} +34 -28
- package/dist/{BindingsDialog-d7f1f8gf.js → BindingsDialog-7rGLzkyA.js} +8 -8
- package/dist/{BindingsPicker-2HJOx0QW.js → BindingsPicker-Cj1DvhQN.js} +6 -5
- package/dist/{BindingsTable-CPAjxOZG.js → BindingsTable-CAreptqr.js} +28 -24
- package/dist/{ClosingDraftView-CUng41eo.js → ClosingDraftView-DoDGz9Y8.js} +183 -175
- package/dist/{ClosingHistoryView-CcGc2NwU.js → ClosingHistoryView-BJSE7ZSv.js} +43 -41
- package/dist/{ClosingTemplateView-D8IAdhDb.js → ClosingTemplateView-Dr2eJk4h.js} +94 -76
- package/dist/{DeliveryOrderPrintPreview-BsM-CCc5.js → DeliveryOrderPrintPreview-BzYLm6J6.js} +15 -14
- package/dist/FmDroppableField-J0xUsOTV.js +154 -0
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-cuggJ5Xd.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-16r_hkBE.js} +74 -72
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Csesow4V.js +279 -0
- package/dist/FmMultiselectDialog-BGhSjgbj.js +597 -0
- package/dist/{FmMultiselectDialog-BGbrqXUF.js → FmMultiselectDialog-DUrpqAkF.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-isogcN1O.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CSv7osJW.js} +51 -49
- package/dist/{ImportView-wAVrMEwL.js → ImportView-BAkyTU_3.js} +81 -74
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVUF4I2Q.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-z0IAsrH_.js} +5 -5
- package/dist/{IngredientGroupView-BZczeXdL.js → IngredientGroupView-D7gurA7T.js} +73 -65
- package/dist/{IngredientsView-D5N5Y1ZY.js → IngredientsView-hwfpMtTX.js} +358 -345
- package/dist/{IntegrationView-Hrslmuc1.js → IntegrationView-DwqzQ6E3.js} +1618 -1593
- package/dist/{InventoryBindingForm-DH6wgxOG.js → InventoryBindingForm-CwjM6Rqk.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Drr5vD6f.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BPr8PDwu.js} +41 -40
- package/dist/{InventoryBindingSummary-BU1ehpQZ.js → InventoryBindingSummary-B7UFFMkm.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-1ueC4GfZ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Djo2b2Ix.js} +5 -5
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-FHcU1zZt.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BSgGGiN6.js} +22 -21
- package/dist/{PublishView-CQtj0f31.js → PublishView-CA9gFV_r.js} +26 -23
- package/dist/{PurchaseOrderPrintPreview-BQyXtHST.js → PurchaseOrderPrintPreview-BeHd82Y0.js} +10 -9
- package/dist/{ReceiveRequestView-Dm-h_SrY.js → ReceiveRequestView-DEthRdM1.js} +472 -456
- package/dist/{RecipeView-DNNRvr1w.js → RecipeView-D45gkYHY.js} +73 -64
- package/dist/SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js +251 -0
- package/dist/{StockView-CaOm5BCx.js → StockView-COx7A4Ac.js} +292 -282
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Z91XRszD.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DX35xDkm.js} +1 -1
- package/dist/{SupplierView-JSII9qwL.js → SupplierView-DHM3dJMZ.js} +92 -80
- package/dist/SystemTrailDialog.vue_vue_type_script_setup_true_lang-Bg2K2ULw.js +177 -0
- package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +135 -0
- package/dist/TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CyMEGFh5.js +123 -0
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Mehd4lGs.js → TransferDetails.vue_vue_type_script_setup_true_lang-CVm2bXic.js} +318 -305
- package/dist/{TransferTemplateView-DyCpNKJd.js → TransferTemplateView-BtYozLuk.js} +228 -216
- package/dist/{UnitView-CqN7mlJ2.js → UnitView-B4mqodQa.js} +70 -63
- package/dist/{WarehouseView-gFWD-m8e.js → WarehouseView-CjDM8L_V.js} +123 -114
- package/dist/WastageTemplateView-Be4Y_zV8.js +2288 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/api/netsuite.d.ts +9 -3
- package/dist/app-DYsP0gKj.js +64121 -0
- package/dist/app-rgirz_52.js +8024 -0
- package/dist/app.js +6 -6
- package/dist/closing-template-BVy1ga2g.js +117 -0
- package/dist/date2-BO7HiZTk.js +116 -0
- package/dist/dayjs.min-HNt4C1ja.js +282 -0
- package/dist/{decimal-DfF_g5rc.js → decimal-BJ8rKm1R.js} +4 -3
- package/dist/defineDeepModel-CidpVmK7.js +19 -0
- package/dist/duplicate-template-C25Z0lvq.js +34 -0
- package/dist/feature-DCia3aqG.js +20162 -0
- package/dist/form-mode.enum-BKiNVH6A.js +4 -0
- package/dist/format-time-from-id-BPws326b.js +15 -0
- package/dist/{format-unit-display-ivAljvlo.js → format-unit-display-C2P3mS8l.js} +308 -297
- package/dist/{import-export.helper-B2MWv9v7.js → import-export.helper-Dt6ZMAPT.js} +56 -52
- package/dist/{index-DZaT0ZaL.js → index-6zxXdF-V.js} +1 -1
- package/dist/index-BjUDHtA2.js +45 -0
- package/dist/{index-BbhuWHyh.js → index-tZj47B-j.js} +16 -14
- package/dist/lodash-DLMgBu6M.js +3678 -0
- package/dist/netsuite-BSMLXIQa.js +4979 -0
- package/dist/{purchase-order-template-DdybMC_P.js → purchase-order-template-D5NGCbI2.js} +1 -1
- package/dist/router/shared.spec.d.ts +1 -0
- package/dist/row-action.enum-BcW_L_nE.js +67 -0
- package/dist/rules-BiaGzhvQ.js +201 -0
- package/dist/{stock-BYagIdsj.js → stock-DOCQ91Jh.js} +1 -1
- package/dist/{stock-V4ciPiBe.js → stock-Ty-89Ap8.js} +11 -10
- package/dist/stores/integration/netsuite.d.ts +5 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-CgtB1I9I.js → supplier-Dxb5ULjF.js} +27 -26
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-BIQovyZX.js → use-ingredient-select-dialog-BI0yIG6A.js} +4 -3
- package/dist/{use-inventory-binding-dialog-DyjicXgc.js → use-inventory-binding-dialog-CbZC-VuL.js} +4 -3
- package/dist/use-template-enabled-locations-2-Dhttpl0B.js +111 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +1 -1
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +1 -1
- package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +6 -2
- package/dist/vue-i18n-Cqx7gNJF.js +2365 -0
- package/dist/xlsx-ex8Bmftq.js +24004 -0
- package/dist/xlsx.util-C8YXEqEl.js +78 -0
- package/package.json +2 -2
- package/dist/app-CnQ49Lyb.js +0 -131483
|
@@ -1,20 +1,184 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useRouter as
|
|
8
|
-
import {
|
|
1
|
+
import { components as X, useDialogChild as Ie, useSnackbar as ye, useDialog as Ne, FmButtonVariant as j } from "@feedmepos/ui-library";
|
|
2
|
+
import { defineStore as he } from "pinia";
|
|
3
|
+
import { F as le } from "./form-mode.enum-BKiNVH6A.js";
|
|
4
|
+
import { u as ve } from "./purchase-order-template-D5NGCbI2.js";
|
|
5
|
+
import { ref as k, h as Y, defineComponent as te, resolveComponent as Q, openBlock as _, createElementBlock as E, createElementVNode as C, normalizeClass as H, createTextVNode as De, toDisplayString as D, unref as I, createCommentVNode as V, createVNode as P, withCtx as ee, Fragment as U, renderList as W, onMounted as Oe, computed as me, watch as Fe, createSlots as Pe, createBlock as z } from "vue";
|
|
6
|
+
import { a as q, c as re, u as Z, n as Me, k as ce, t as Ue, R as ue } from "./app-DYsP0gKj.js";
|
|
7
|
+
import { useRouter as Le } from "vue-router";
|
|
8
|
+
import { a as Be } from "./FmMultiselectDialog-BGhSjgbj.js";
|
|
9
|
+
import { D as K, R as N } from "./row-action.enum-BcW_L_nE.js";
|
|
10
|
+
import { c as Qe } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js";
|
|
11
|
+
import { f as He } from "./format-time-from-id-BPws326b.js";
|
|
12
|
+
import { useI18n as ne, useCoreStore as ge } from "@feedmepos/mf-common";
|
|
13
|
+
import { t as L, a as be, d as xe, s as Se, r as Ve } from "./xlsx.util-C8YXEqEl.js";
|
|
14
|
+
import { F as qe } from "./FmDroppableField-J0xUsOTV.js";
|
|
15
|
+
import { d as je, a as B, t as G, g as J, c as ze, B as Ke } from "./rules-BiaGzhvQ.js";
|
|
16
|
+
import { f as Ye } from "./date2-BO7HiZTk.js";
|
|
17
|
+
import { u as oe } from "./supplier-Dxb5ULjF.js";
|
|
18
|
+
import { u as ae } from "./netsuite-BSMLXIQa.js";
|
|
19
|
+
import { u as We } from "./duplicate-template-C25Z0lvq.js";
|
|
9
20
|
function Te(e) {
|
|
10
21
|
const t = q(), a = e.sku, u = t.skuById[a._id];
|
|
11
22
|
if (u.unit._id !== a.unit._id) return !0;
|
|
12
23
|
const i = e.measurement;
|
|
13
24
|
return i ? !t.unitById[u.unit._id].measurements.find((l) => l.id === i.id) : !1;
|
|
14
25
|
}
|
|
26
|
+
function de(e) {
|
|
27
|
+
const { skuById: t } = q(), a = re(e);
|
|
28
|
+
return a.purchaseOrder.items = e.purchaseOrder.items.filter((u) => t[u.sku._id]), a;
|
|
29
|
+
}
|
|
30
|
+
const _e = he(
|
|
31
|
+
"transferTemplateTable",
|
|
32
|
+
function() {
|
|
33
|
+
const { t } = ne(), a = _t(), u = k(!1), i = k(new Array()), s = ve(), f = q();
|
|
34
|
+
async function l() {
|
|
35
|
+
i.value = [], u.value = !0;
|
|
36
|
+
try {
|
|
37
|
+
f.isInventoryLoaded || await f.readInventory();
|
|
38
|
+
const [d] = await Promise.all([s.readTemplates()]).delayed(
|
|
39
|
+
1e3
|
|
40
|
+
);
|
|
41
|
+
i.value = d.map(de);
|
|
42
|
+
} catch (d) {
|
|
43
|
+
console.log("Something went wrong when fetching templates:", d);
|
|
44
|
+
} finally {
|
|
45
|
+
u.value = !1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function o(d) {
|
|
49
|
+
if (!i.value.find((c) => c._id)) {
|
|
50
|
+
u.value = !0;
|
|
51
|
+
try {
|
|
52
|
+
i.value = [
|
|
53
|
+
await s.getTemplate(d).then(de).delayed(1e3)
|
|
54
|
+
];
|
|
55
|
+
} catch (c) {
|
|
56
|
+
console.log("Something went wrong when fetching templates:", c);
|
|
57
|
+
} finally {
|
|
58
|
+
u.value = !1;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function m(d, c) {
|
|
63
|
+
switch (c = re(c), d) {
|
|
64
|
+
case N.Details:
|
|
65
|
+
return a.viewTemplate(c);
|
|
66
|
+
case N.Edit:
|
|
67
|
+
return a.updateTemplate(c);
|
|
68
|
+
case N.Delete:
|
|
69
|
+
return a.deleteTemplate(c, u, l);
|
|
70
|
+
case N.Duplicate:
|
|
71
|
+
return a.duplicateTemplate(c, u, l);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
columnDefs: [
|
|
76
|
+
{
|
|
77
|
+
id: "_id",
|
|
78
|
+
accessorKey: "_id",
|
|
79
|
+
header: () => t("inventory.transfer.table.createdAt"),
|
|
80
|
+
cell(d) {
|
|
81
|
+
return He(`${d.getValue()}`);
|
|
82
|
+
},
|
|
83
|
+
enableSorting: !0
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "name",
|
|
87
|
+
accessorKey: "name",
|
|
88
|
+
header: () => t("inventory.transfer.table.name"),
|
|
89
|
+
enableSorting: !0,
|
|
90
|
+
size: 200
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "supplier",
|
|
94
|
+
accessorKey: "purchaseOrder.supplier.name",
|
|
95
|
+
header: () => t("inventory.transfer.table.from"),
|
|
96
|
+
enableSorting: !0,
|
|
97
|
+
size: 200
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "noOfItems",
|
|
101
|
+
accessorKey: "purchaseOrder.items.length",
|
|
102
|
+
header: () => t("inventory.transfer.table.noOfItems"),
|
|
103
|
+
enableSorting: !1,
|
|
104
|
+
meta: {
|
|
105
|
+
width: "10rem",
|
|
106
|
+
textAlign: "right"
|
|
107
|
+
},
|
|
108
|
+
cell(d) {
|
|
109
|
+
const c = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(Te);
|
|
110
|
+
return c === 0 || v ? Y("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
111
|
+
Y(
|
|
112
|
+
X.FmTooltip,
|
|
113
|
+
{},
|
|
114
|
+
{
|
|
115
|
+
content() {
|
|
116
|
+
return v ? "The template is invalid due to invalid unit on some of the items. Please update this template." : "The template is invalid due to deleted ingredients. Please update this template.";
|
|
117
|
+
},
|
|
118
|
+
default() {
|
|
119
|
+
return Y(X.FmIcon, {
|
|
120
|
+
name: "error",
|
|
121
|
+
color: "system-error-300",
|
|
122
|
+
size: "sm"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
c
|
|
128
|
+
]) : c;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "enabledLocations",
|
|
133
|
+
accessorKey: "purchaseOrder.locations.length",
|
|
134
|
+
header: () => "Enabled outlets",
|
|
135
|
+
cell(d) {
|
|
136
|
+
var v;
|
|
137
|
+
const c = (v = d.row.original.locations) == null ? void 0 : v.length;
|
|
138
|
+
return c ? `${c}` : "All";
|
|
139
|
+
},
|
|
140
|
+
enableSorting: !1,
|
|
141
|
+
meta: {
|
|
142
|
+
width: "10rem",
|
|
143
|
+
textAlign: "right"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "ref",
|
|
148
|
+
accessorKey: "purchaseOrder.ref",
|
|
149
|
+
header: () => t("inventory.transfer.table.reference"),
|
|
150
|
+
enableSorting: !1,
|
|
151
|
+
size: "auto"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "action",
|
|
155
|
+
cell(d) {
|
|
156
|
+
const c = d.row.original, v = [
|
|
157
|
+
K[N.Details],
|
|
158
|
+
K[N.Edit],
|
|
159
|
+
K[N.Duplicate],
|
|
160
|
+
K[N.Delete]
|
|
161
|
+
];
|
|
162
|
+
return Qe(v, (b) => m(b, c));
|
|
163
|
+
},
|
|
164
|
+
enableSorting: !1,
|
|
165
|
+
size: 40,
|
|
166
|
+
meta: {
|
|
167
|
+
cellClass: "",
|
|
168
|
+
headerClass: ""
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
templates: i,
|
|
173
|
+
loading: u,
|
|
174
|
+
fetchTemplates: l,
|
|
175
|
+
loadTemplate: o
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
);
|
|
15
179
|
var A = /* @__PURE__ */ ((e) => (e.PURCHASE = "PURCHASE", e.TRANSFER = "TRANSFER", e))(A || {}), se = /* @__PURE__ */ ((e) => (e.Source = "Source", e.Destination = "Destination", e.Ingredient = "Ingredient", e))(se || {});
|
|
16
|
-
const
|
|
17
|
-
function
|
|
180
|
+
const pe = je(0);
|
|
181
|
+
function we(e) {
|
|
18
182
|
var u;
|
|
19
183
|
const t = e.sku;
|
|
20
184
|
return {
|
|
@@ -22,13 +186,13 @@ function _e(e) {
|
|
|
22
186
|
overrideCode: e.code,
|
|
23
187
|
name: t.name,
|
|
24
188
|
unit: ((u = t.unit.measurements.find((i) => i.id === t.trackingMeasurement)) == null ? void 0 : u.abbrev) ?? t.unit.abbrev,
|
|
25
|
-
defaultQuantity: +
|
|
26
|
-
minimumQuantity: +
|
|
27
|
-
maximumQuantity: +
|
|
28
|
-
quantityStep: +
|
|
189
|
+
defaultQuantity: +B(e.quantity),
|
|
190
|
+
minimumQuantity: +B(e.minimumQuantity ?? pe),
|
|
191
|
+
maximumQuantity: +B(e.maximumQuantity ?? pe),
|
|
192
|
+
quantityStep: +B(e.quantityStep)
|
|
29
193
|
};
|
|
30
194
|
}
|
|
31
|
-
function
|
|
195
|
+
function $e() {
|
|
32
196
|
return [
|
|
33
197
|
{
|
|
34
198
|
id: "code",
|
|
@@ -68,7 +232,7 @@ function Ge(e) {
|
|
|
68
232
|
var l;
|
|
69
233
|
const a = ge().currentBusiness.value, i = (l = e.map((o) => {
|
|
70
234
|
var b;
|
|
71
|
-
const
|
|
235
|
+
const m = o.purchaseOrder.items.map((r) => we(r)), h = $e(), d = [
|
|
72
236
|
["Template ID", o._id],
|
|
73
237
|
["Template name", o.name],
|
|
74
238
|
["Business name", a == null ? void 0 : a.name],
|
|
@@ -93,24 +257,24 @@ function Ge(e) {
|
|
|
93
257
|
["Remark", o.purchaseOrder.remark ?? ""],
|
|
94
258
|
[],
|
|
95
259
|
h.map((r) => r.name),
|
|
96
|
-
...
|
|
97
|
-
],
|
|
260
|
+
...m.map((r) => h.map((x) => r[x.id]))
|
|
261
|
+
], c = h.map((r) => `system:${r.id}`), v = L(d, c);
|
|
98
262
|
return { name: o.name, sheet: v };
|
|
99
263
|
}).reduce(
|
|
100
|
-
(o,
|
|
264
|
+
(o, m) => {
|
|
101
265
|
var d;
|
|
102
|
-
const h =
|
|
103
|
-
return (d = o.sheetOccurence)[h] ?? (d[h] = 0), o.sheetOccurence[h] += 1, o.sheets[`${h} (${o.sheetOccurence[h]})`] =
|
|
266
|
+
const h = m.name.slice(0, 12);
|
|
267
|
+
return (d = o.sheetOccurence)[h] ?? (d[h] = 0), o.sheetOccurence[h] += 1, o.sheets[`${h} (${o.sheetOccurence[h]})`] = m.sheet, o;
|
|
104
268
|
},
|
|
105
269
|
{
|
|
106
270
|
sheets: {},
|
|
107
271
|
sheetOccurence: {}
|
|
108
272
|
}
|
|
109
|
-
)) == null ? void 0 : l.sheets, s = `${a == null ? void 0 : a.name} transfer templates (${
|
|
110
|
-
return
|
|
273
|
+
)) == null ? void 0 : l.sheets, s = `${a == null ? void 0 : a.name} transfer templates (${Ye(/* @__PURE__ */ new Date())}).xlsx`, f = be(i);
|
|
274
|
+
return xe(f, s), s;
|
|
111
275
|
}
|
|
112
|
-
function
|
|
113
|
-
const e = ge(), t =
|
|
276
|
+
function Ze() {
|
|
277
|
+
const e = ge(), t = oe(), a = Z(), u = q(), i = e.currentBusiness.value, s = we({
|
|
114
278
|
sku: {
|
|
115
279
|
unit: {
|
|
116
280
|
_id: "",
|
|
@@ -141,7 +305,7 @@ function Xe() {
|
|
|
141
305
|
amount: 1,
|
|
142
306
|
precision: 0
|
|
143
307
|
}
|
|
144
|
-
}), f =
|
|
308
|
+
}), f = $e(), l = [
|
|
145
309
|
["Template ID (leave empty to create new)"],
|
|
146
310
|
["Template Name", "New template"],
|
|
147
311
|
["Business name", i == null ? void 0 : i.name],
|
|
@@ -163,7 +327,7 @@ function Xe() {
|
|
|
163
327
|
[],
|
|
164
328
|
f.map((r) => r.name),
|
|
165
329
|
f.map((r) => s[r.id])
|
|
166
|
-
], o = f.map((r) => `system:${r.id}`),
|
|
330
|
+
], o = f.map((r) => `system:${r.id}`), m = L(l, o), h = L(
|
|
167
331
|
[
|
|
168
332
|
...t.businessSuppliers.map((r) => [
|
|
169
333
|
`${r.name} (${r._id})`,
|
|
@@ -190,7 +354,7 @@ function Xe() {
|
|
|
190
354
|
})
|
|
191
355
|
],
|
|
192
356
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
193
|
-
), d =
|
|
357
|
+
), d = L(
|
|
194
358
|
a.locations.map((r) => {
|
|
195
359
|
var x, w, S, p, n, y;
|
|
196
360
|
return [
|
|
@@ -204,7 +368,7 @@ function Xe() {
|
|
|
204
368
|
];
|
|
205
369
|
}),
|
|
206
370
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
207
|
-
),
|
|
371
|
+
), c = L(
|
|
208
372
|
u.skus.map((r) => [
|
|
209
373
|
r.code,
|
|
210
374
|
r.name,
|
|
@@ -212,24 +376,24 @@ function Xe() {
|
|
|
212
376
|
...r.unit.measurements.map((x) => x.abbrev)
|
|
213
377
|
]),
|
|
214
378
|
["Code", "Name", "Base unit", "Measurements"]
|
|
215
|
-
), v =
|
|
216
|
-
Template:
|
|
379
|
+
), v = be({
|
|
380
|
+
Template: m,
|
|
217
381
|
Source: h,
|
|
218
382
|
Destination: d,
|
|
219
|
-
Ingredient:
|
|
383
|
+
Ingredient: c
|
|
220
384
|
}), b = `${i == null ? void 0 : i.name} transfer templates import.xlsx`;
|
|
221
|
-
return
|
|
385
|
+
return xe(v, b), b;
|
|
222
386
|
}
|
|
223
|
-
function
|
|
224
|
-
const a = new Array(), u = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, s =
|
|
225
|
-
if (!
|
|
387
|
+
function Je(e, t) {
|
|
388
|
+
const a = new Array(), u = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, s = Z().locationByDbName, l = oe().supplierById, o = e.trim(), m = u.exec(o);
|
|
389
|
+
if (!m)
|
|
226
390
|
return a.push(`Transfer from location value of ${o} cannot be read.`), {
|
|
227
391
|
errors: a
|
|
228
392
|
};
|
|
229
|
-
const h =
|
|
230
|
-
let
|
|
393
|
+
const h = m[1], d = m[2];
|
|
394
|
+
let c;
|
|
231
395
|
if (d.startsWith("supplier"))
|
|
232
|
-
|
|
396
|
+
c = l[d], t !== A.PURCHASE && a.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
233
397
|
else {
|
|
234
398
|
const v = s[d];
|
|
235
399
|
if (!v)
|
|
@@ -238,7 +402,7 @@ function Ze(e, t) {
|
|
|
238
402
|
};
|
|
239
403
|
h !== v.name && a.push(
|
|
240
404
|
`Location id ${d} has non-matching name. Found ${h} but expected ${v.name}`
|
|
241
|
-
),
|
|
405
|
+
), c = {
|
|
242
406
|
_id: v.doc._id,
|
|
243
407
|
name: v.name,
|
|
244
408
|
address: v.doc.profile.address ?? {
|
|
@@ -249,7 +413,7 @@ function Ze(e, t) {
|
|
|
249
413
|
postcode: "",
|
|
250
414
|
coordinates: [0, 0]
|
|
251
415
|
},
|
|
252
|
-
internal: d.split("_")[0] === "restaurant" ?
|
|
416
|
+
internal: d.split("_")[0] === "restaurant" ? ce.enum.restaurant : ce.enum.warehouse,
|
|
253
417
|
phoneNumber: v.doc.profile.phoneNo ?? "",
|
|
254
418
|
email: v.doc.profile.email ?? "",
|
|
255
419
|
_rev: "",
|
|
@@ -258,27 +422,27 @@ function Ze(e, t) {
|
|
|
258
422
|
};
|
|
259
423
|
}
|
|
260
424
|
return {
|
|
261
|
-
from:
|
|
425
|
+
from: c,
|
|
262
426
|
errors: a
|
|
263
427
|
};
|
|
264
428
|
}
|
|
265
|
-
function
|
|
429
|
+
function Xe(e) {
|
|
266
430
|
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
267
431
|
return [];
|
|
268
|
-
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, u =
|
|
432
|
+
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, u = Z().locationByDbName;
|
|
269
433
|
return e.map((i) => {
|
|
270
434
|
const s = new Array(), f = i.trim(), l = t.exec(f);
|
|
271
435
|
if (!l)
|
|
272
436
|
return s.push(`Enabled location value of ${f} cannot be read.`), {
|
|
273
437
|
errors: s
|
|
274
438
|
};
|
|
275
|
-
const o = l[1],
|
|
439
|
+
const o = l[1], m = l[2], h = u[m];
|
|
276
440
|
return h ? (o !== h.name && s.push(
|
|
277
|
-
`Location id ${
|
|
441
|
+
`Location id ${m} has non-matching name. Found ${o} but expected ${h.name}`
|
|
278
442
|
), {
|
|
279
443
|
errors: s,
|
|
280
444
|
location: h
|
|
281
|
-
}) : (s.push(`Location (${o}) of id ${
|
|
445
|
+
}) : (s.push(`Location (${o}) of id ${m} is not found.`), {
|
|
282
446
|
errors: s
|
|
283
447
|
});
|
|
284
448
|
});
|
|
@@ -293,16 +457,16 @@ function et(e) {
|
|
|
293
457
|
f,
|
|
294
458
|
l,
|
|
295
459
|
o,
|
|
296
|
-
|
|
460
|
+
m,
|
|
297
461
|
h,
|
|
298
462
|
d
|
|
299
|
-
] =
|
|
463
|
+
] = Se(e);
|
|
300
464
|
return {
|
|
301
465
|
id: `${a[1] ?? ""}`.trim(),
|
|
302
466
|
name: `${u[1] ?? ""}`.trim(),
|
|
303
467
|
type: `${l[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? A.TRANSFER : A.PURCHASE,
|
|
304
468
|
transferFrom: `${o[1] ?? ""}`.trim(),
|
|
305
|
-
locations:
|
|
469
|
+
locations: m.slice(1).map((c) => `${c}`.trim()).filter((c) => c),
|
|
306
470
|
reference: `${h[1] ?? ""}`.trim(),
|
|
307
471
|
remark: `${d[1] ?? ""}`.trim()
|
|
308
472
|
};
|
|
@@ -317,13 +481,13 @@ function tt(e) {
|
|
|
317
481
|
f,
|
|
318
482
|
l,
|
|
319
483
|
o,
|
|
320
|
-
|
|
484
|
+
m,
|
|
321
485
|
h,
|
|
322
486
|
d,
|
|
323
|
-
|
|
487
|
+
c,
|
|
324
488
|
v,
|
|
325
489
|
...b
|
|
326
|
-
] =
|
|
490
|
+
] = Se(e);
|
|
327
491
|
if (!t || !t.length || t.some((p) => p.length && !p.startsWith("system:")))
|
|
328
492
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
329
493
|
const r = t.map((p) => p.split(":")[1]), w = [
|
|
@@ -360,7 +524,7 @@ function rt(e, t, a) {
|
|
|
360
524
|
};
|
|
361
525
|
}
|
|
362
526
|
function nt(e, t, a) {
|
|
363
|
-
const u = q(), i =
|
|
527
|
+
const u = q(), i = ae(), s = u.skuByCode[e.code], f = new Array();
|
|
364
528
|
if (!s)
|
|
365
529
|
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
366
530
|
index: t,
|
|
@@ -395,20 +559,20 @@ function nt(e, t, a) {
|
|
|
395
559
|
templateItem: n
|
|
396
560
|
};
|
|
397
561
|
}
|
|
398
|
-
const
|
|
562
|
+
const m = G(
|
|
399
563
|
e.quantityStep,
|
|
400
|
-
|
|
564
|
+
J(l, o)
|
|
401
565
|
);
|
|
402
566
|
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
403
|
-
const h =
|
|
567
|
+
const h = ze(m), d = rt(
|
|
404
568
|
e.minimumQuantity,
|
|
405
569
|
e.maximumQuantity,
|
|
406
|
-
|
|
407
|
-
),
|
|
570
|
+
J(l, o)
|
|
571
|
+
), c = d.min, v = d.max;
|
|
408
572
|
d.compareError && f.push(d.compareError);
|
|
409
|
-
const b =
|
|
573
|
+
const b = Ke(+e.minimumQuantity, +e.maximumQuantity), r = G(
|
|
410
574
|
e.defaultQuantity,
|
|
411
|
-
|
|
575
|
+
J(l, o)
|
|
412
576
|
), x = h(r);
|
|
413
577
|
typeof x == "string" && f.push(`Default amount: ${x}`);
|
|
414
578
|
const w = d.min && d.max ? b(`${e.defaultQuantity}`) : null;
|
|
@@ -419,8 +583,8 @@ function nt(e, t, a) {
|
|
|
419
583
|
name: e.name || s.name,
|
|
420
584
|
measurement: o,
|
|
421
585
|
quantity: r,
|
|
422
|
-
quantityStep:
|
|
423
|
-
minimumQuantity:
|
|
586
|
+
quantityStep: m,
|
|
587
|
+
minimumQuantity: c,
|
|
424
588
|
maximumQuantity: v
|
|
425
589
|
};
|
|
426
590
|
return {
|
|
@@ -432,15 +596,15 @@ function nt(e, t, a) {
|
|
|
432
596
|
function ot(e) {
|
|
433
597
|
const t = e.SheetNames.filter(
|
|
434
598
|
(s) => !Object.values(se).map(String).includes(s)
|
|
435
|
-
), u =
|
|
599
|
+
), u = _e().templates, i = Me(u, "_id");
|
|
436
600
|
try {
|
|
437
601
|
return t.reduce(
|
|
438
602
|
(s, f) => {
|
|
439
603
|
var p;
|
|
440
|
-
const l = new Array(), o = e.Sheets[f],
|
|
604
|
+
const l = new Array(), o = e.Sheets[f], m = et(o), h = Je(m.transferFrom, m.type);
|
|
441
605
|
l.push(...h.errors);
|
|
442
|
-
const d = h.from,
|
|
443
|
-
l.push(...
|
|
606
|
+
const d = h.from, c = Xe(m.locations), v = c.filter((n) => n.location).map((n) => n.location);
|
|
607
|
+
l.push(...c.flatMap((n) => n.errors));
|
|
444
608
|
const b = tt(o).filter((n) => n.data.code), r = b.map(
|
|
445
609
|
(n, y) => nt(n.data, y, b)
|
|
446
610
|
);
|
|
@@ -450,16 +614,16 @@ function ot(e) {
|
|
|
450
614
|
)
|
|
451
615
|
);
|
|
452
616
|
const x = r.filter((n) => n.templateItem).map((n) => n.templateItem);
|
|
453
|
-
if (
|
|
454
|
-
const n = i[
|
|
617
|
+
if (m.id) {
|
|
618
|
+
const n = i[m.id];
|
|
455
619
|
if (!n) {
|
|
456
620
|
const T = {
|
|
457
|
-
_id:
|
|
621
|
+
_id: m.id,
|
|
458
622
|
_rev: "",
|
|
459
|
-
name:
|
|
623
|
+
name: m.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
460
624
|
purchaseOrder: at()
|
|
461
625
|
};
|
|
462
|
-
return l.push(`Template ID ${
|
|
626
|
+
return l.push(`Template ID ${m.id} is not found.`), s.importUpdateResult.push({
|
|
463
627
|
type: "update",
|
|
464
628
|
original: T,
|
|
465
629
|
template: T,
|
|
@@ -472,13 +636,13 @@ function ot(e) {
|
|
|
472
636
|
original: n,
|
|
473
637
|
template: {
|
|
474
638
|
...n,
|
|
475
|
-
name:
|
|
639
|
+
name: m.name,
|
|
476
640
|
locations: v.length ? v : null,
|
|
477
641
|
purchaseOrder: {
|
|
478
642
|
...n.purchaseOrder,
|
|
479
643
|
supplier: d ?? ((p = n.purchaseOrder) == null ? void 0 : p.supplier),
|
|
480
|
-
ref:
|
|
481
|
-
remark:
|
|
644
|
+
ref: m.reference,
|
|
645
|
+
remark: m.remark,
|
|
482
646
|
items: x
|
|
483
647
|
}
|
|
484
648
|
},
|
|
@@ -490,12 +654,12 @@ function ot(e) {
|
|
|
490
654
|
const S = {
|
|
491
655
|
type: "create",
|
|
492
656
|
template: {
|
|
493
|
-
name:
|
|
657
|
+
name: m.name,
|
|
494
658
|
locations: v.length ? v : null,
|
|
495
659
|
purchaseOrder: {
|
|
496
|
-
supplier: d ??
|
|
497
|
-
ref:
|
|
498
|
-
remark:
|
|
660
|
+
supplier: d ?? Ce(),
|
|
661
|
+
ref: m.reference,
|
|
662
|
+
remark: m.remark,
|
|
499
663
|
items: x
|
|
500
664
|
}
|
|
501
665
|
},
|
|
@@ -519,7 +683,7 @@ function ot(e) {
|
|
|
519
683
|
};
|
|
520
684
|
}
|
|
521
685
|
}
|
|
522
|
-
function
|
|
686
|
+
function Ce() {
|
|
523
687
|
return {
|
|
524
688
|
_id: "",
|
|
525
689
|
name: "",
|
|
@@ -538,13 +702,13 @@ function at() {
|
|
|
538
702
|
remark: void 0,
|
|
539
703
|
ref: void 0,
|
|
540
704
|
items: [],
|
|
541
|
-
supplier:
|
|
705
|
+
supplier: Ce()
|
|
542
706
|
};
|
|
543
707
|
}
|
|
544
|
-
const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-col" }, lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" },
|
|
708
|
+
const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-col" }, lt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, mt = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, ct = {
|
|
545
709
|
key: 0,
|
|
546
710
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
547
|
-
}, ut = { key: 0 },
|
|
711
|
+
}, ut = { key: 0 }, fe = /* @__PURE__ */ te({
|
|
548
712
|
__name: "TransferTemplateImportItem",
|
|
549
713
|
props: {
|
|
550
714
|
type: {},
|
|
@@ -567,15 +731,15 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
567
731
|
"text-fm-color-system-error-300": t.errors.length
|
|
568
732
|
})
|
|
569
733
|
}, [
|
|
570
|
-
|
|
571
|
-
C("span",
|
|
572
|
-
t.type === "create" ? (_(), E("span",
|
|
734
|
+
De(D(t.name) + " ", 1),
|
|
735
|
+
C("span", mt, " (" + D(I(Ue)(`${t.transferType}`)) + ") ", 1),
|
|
736
|
+
t.type === "create" ? (_(), E("span", ct, "(new)")) : V("", !0)
|
|
573
737
|
], 2),
|
|
574
738
|
t.errors.length ? (_(), E("div", ut, [
|
|
575
739
|
P(i, { "z-index": 50 }, {
|
|
576
740
|
content: ee(() => [
|
|
577
741
|
C("ol", null, [
|
|
578
|
-
(_(!0), E(
|
|
742
|
+
(_(!0), E(U, null, W(t.errors, (o, m) => (_(), E("li", { key: m }, D(o), 1))), 128))
|
|
579
743
|
])
|
|
580
744
|
]),
|
|
581
745
|
default: ee(() => [
|
|
@@ -614,11 +778,11 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
614
778
|
}, gt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, bt = {
|
|
615
779
|
key: 0,
|
|
616
780
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
617
|
-
}, xt = { class: "fm-typo-en-body-lg-600" }, St = /* @__PURE__ */
|
|
781
|
+
}, xt = { class: "fm-typo-en-body-lg-600" }, St = /* @__PURE__ */ te({
|
|
618
782
|
__name: "TransferTemplateImport",
|
|
619
783
|
setup(e) {
|
|
620
|
-
const t = k(null), a =
|
|
621
|
-
|
|
784
|
+
const t = k(null), a = Ie(), u = ye(), i = k(!1), s = k(!1), f = oe();
|
|
785
|
+
Oe(async () => {
|
|
622
786
|
s.value = !0;
|
|
623
787
|
try {
|
|
624
788
|
await f.readSuppliers().delayed(1e3);
|
|
@@ -632,52 +796,52 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
632
796
|
s.value = !1;
|
|
633
797
|
}
|
|
634
798
|
});
|
|
635
|
-
const l = k(new Array()), o = k([]),
|
|
636
|
-
() => !!l.value.length || o.value.some((b) => b.errors.length) ||
|
|
637
|
-
), d =
|
|
638
|
-
() => !!o.value.length || !!
|
|
639
|
-
), { t:
|
|
799
|
+
const l = k(new Array()), o = k([]), m = k([]), h = me(
|
|
800
|
+
() => !!l.value.length || o.value.some((b) => b.errors.length) || m.value.some((b) => b.errors.length)
|
|
801
|
+
), d = me(
|
|
802
|
+
() => !!o.value.length || !!m.value.length
|
|
803
|
+
), { t: c } = ne();
|
|
640
804
|
async function v(b) {
|
|
641
|
-
l.value = [], o.value = [],
|
|
805
|
+
l.value = [], o.value = [], m.value = [];
|
|
642
806
|
try {
|
|
643
807
|
i.value = !0;
|
|
644
808
|
const [r] = await Promise.all([
|
|
645
|
-
|
|
809
|
+
Ve(b),
|
|
646
810
|
// fake buffer
|
|
647
811
|
new Promise((p) => setTimeout(p, 1e3))
|
|
648
812
|
]);
|
|
649
813
|
if (!r.SheetNames.filter(
|
|
650
814
|
(p) => !Object.values(se).map(String).includes(p)
|
|
651
815
|
).find((p) => p)) {
|
|
652
|
-
l.value.push(
|
|
816
|
+
l.value.push(c("inventory.ingredient.import.fileError.noSheet"));
|
|
653
817
|
return;
|
|
654
818
|
}
|
|
655
819
|
const S = ot(r);
|
|
656
820
|
if (S.invalidExcel) {
|
|
657
821
|
l.value.push(
|
|
658
|
-
S.invalidExcelMessage ??
|
|
822
|
+
S.invalidExcelMessage ?? c("inventory.ingredient.import.fileError.invalidExcel")
|
|
659
823
|
);
|
|
660
824
|
return;
|
|
661
825
|
}
|
|
662
|
-
if (o.value = S.importCreateResult,
|
|
663
|
-
l.value.push(
|
|
826
|
+
if (o.value = S.importCreateResult, m.value = S.importUpdateResult, !o.value.length && !m.value.length) {
|
|
827
|
+
l.value.push(c("inventory.ingredient.import.fileError.noData"));
|
|
664
828
|
return;
|
|
665
829
|
}
|
|
666
830
|
a.emitData(S);
|
|
667
831
|
} catch (r) {
|
|
668
832
|
u.open({
|
|
669
|
-
title:
|
|
833
|
+
title: c("inventory.ingredient.import.fileError.unableToRead"),
|
|
670
834
|
message: r == null ? void 0 : r.message,
|
|
671
835
|
type: "error"
|
|
672
836
|
}), console.error("Error in reading file", r);
|
|
673
837
|
} finally {
|
|
674
838
|
l.value.length && u.open({
|
|
675
|
-
title:
|
|
839
|
+
title: c("inventory.ingredient.import.fileError.invalidExcel"),
|
|
676
840
|
type: "error"
|
|
677
841
|
}), i.value = !1;
|
|
678
842
|
}
|
|
679
843
|
}
|
|
680
|
-
return
|
|
844
|
+
return Fe(t, (b) => {
|
|
681
845
|
b && v(b);
|
|
682
846
|
}), (b, r) => {
|
|
683
847
|
const x = Q("FmCircularProgress"), w = Q("FmIcon"), S = Q("FmButton");
|
|
@@ -691,17 +855,17 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
691
855
|
})
|
|
692
856
|
]),
|
|
693
857
|
r[1] || (r[1] = C("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
694
|
-
])) : (_(), E(
|
|
695
|
-
P(
|
|
858
|
+
])) : (_(), E(U, { key: 1 }, [
|
|
859
|
+
P(qe, {
|
|
696
860
|
class: H({
|
|
697
861
|
"w-full": !0,
|
|
698
862
|
"h-[200px]": !t.value
|
|
699
863
|
}),
|
|
700
864
|
accept: ".xlsx",
|
|
701
865
|
onFileUpload: r[0] || (r[0] = (p) => t.value = p),
|
|
702
|
-
label: I(
|
|
703
|
-
"button-label": I(
|
|
704
|
-
},
|
|
866
|
+
label: I(c)("inventory.ingredient.import.uploadTemplate"),
|
|
867
|
+
"button-label": I(c)("inventory.ingredient.import.selectFile")
|
|
868
|
+
}, Pe({ _: 2 }, [
|
|
705
869
|
t.value ? {
|
|
706
870
|
name: "default",
|
|
707
871
|
fn: ee(({ openFileDialog: p }) => [
|
|
@@ -716,11 +880,11 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
716
880
|
}
|
|
717
881
|
])
|
|
718
882
|
}, [
|
|
719
|
-
i.value ? (_(),
|
|
883
|
+
i.value ? (_(), z(x, {
|
|
720
884
|
key: 0,
|
|
721
885
|
size: "md",
|
|
722
886
|
color: "neutral-gray-200"
|
|
723
|
-
})) : (_(),
|
|
887
|
+
})) : (_(), z(w, {
|
|
724
888
|
key: 1,
|
|
725
889
|
name: h.value ? "error" : "attach_file",
|
|
726
890
|
outline: "",
|
|
@@ -739,7 +903,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
739
903
|
], 2),
|
|
740
904
|
i.value ? V("", !0) : (_(), E("div", ht, [
|
|
741
905
|
P(S, {
|
|
742
|
-
label: I(
|
|
906
|
+
label: I(c)("inventory.ingredient.import.replaceFile"),
|
|
743
907
|
variant: h.value ? "destructive" : "secondary",
|
|
744
908
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
745
909
|
onClick: p
|
|
@@ -747,7 +911,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
747
911
|
]))
|
|
748
912
|
], 2),
|
|
749
913
|
l.value.length ? (_(), E("div", vt, [
|
|
750
|
-
(_(!0), E(
|
|
914
|
+
(_(!0), E(U, null, W(l.value, (n, y) => (_(), E("div", {
|
|
751
915
|
key: y,
|
|
752
916
|
class: "flex gap-8 items-center"
|
|
753
917
|
}, [
|
|
@@ -765,8 +929,8 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
765
929
|
} : void 0
|
|
766
930
|
]), 1032, ["class", "label", "button-label"]),
|
|
767
931
|
d.value ? (_(), E("div", bt, [
|
|
768
|
-
C("div", xt, D(I(
|
|
769
|
-
(_(!0), E(
|
|
932
|
+
C("div", xt, D(I(c)("inventory.ingredient.import.summary")), 1),
|
|
933
|
+
(_(!0), E(U, null, W(o.value, (p, n) => (_(), z(fe, {
|
|
770
934
|
key: n,
|
|
771
935
|
name: p.template.name,
|
|
772
936
|
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? I(A).TRANSFER : I(A).PURCHASE,
|
|
@@ -775,7 +939,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
775
939
|
errors: p.errors,
|
|
776
940
|
type: "create"
|
|
777
941
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
778
|
-
(_(!0), E(
|
|
942
|
+
(_(!0), E(U, null, W(m.value, (p) => (_(), z(fe, {
|
|
779
943
|
key: p.template._id,
|
|
780
944
|
name: p.template.name,
|
|
781
945
|
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? I(A).TRANSFER : I(A).PURCHASE,
|
|
@@ -792,48 +956,48 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
792
956
|
});
|
|
793
957
|
function Tt(e) {
|
|
794
958
|
var s, f;
|
|
795
|
-
const t =
|
|
959
|
+
const t = ae();
|
|
796
960
|
if (!t.isEnabled) return !0;
|
|
797
961
|
if (!e.internal) {
|
|
798
|
-
const l = t.getNetSuiteVendor(e._id), o = l == null ? void 0 : l.subsidiaryId,
|
|
799
|
-
return o && o ==
|
|
962
|
+
const l = t.getNetSuiteVendor(e._id), o = l == null ? void 0 : l.subsidiaryId, m = (s = t.currentVendorSubsidiary(e._id)) == null ? void 0 : s.id;
|
|
963
|
+
return o && o == m;
|
|
800
964
|
}
|
|
801
965
|
const a = t.getNetSuiteLocation(`${e.internal}_${e._id}`), u = t.getLocationSubsidiary(a == null ? void 0 : a.netSuiteId).id, i = (f = t.currentLocationSubsidiary()) == null ? void 0 : f.id;
|
|
802
966
|
return u && u == i;
|
|
803
967
|
}
|
|
804
|
-
const _t =
|
|
805
|
-
const e =
|
|
968
|
+
const _t = he("transferTemplateActions", () => {
|
|
969
|
+
const e = Ne(), t = ye(), a = Z(), u = _e(), i = We(), s = ve(), f = ae(), l = Le(), { t: o } = ne(), m = k({});
|
|
806
970
|
function h() {
|
|
807
|
-
|
|
808
|
-
mode:
|
|
971
|
+
m.value = {
|
|
972
|
+
mode: le.CREATE,
|
|
809
973
|
show: !0,
|
|
810
974
|
"onUpdate:show"(n) {
|
|
811
|
-
|
|
975
|
+
m.value.show = n;
|
|
812
976
|
}
|
|
813
977
|
};
|
|
814
978
|
}
|
|
815
979
|
function d(n) {
|
|
816
|
-
|
|
817
|
-
mode:
|
|
980
|
+
m.value = {
|
|
981
|
+
mode: le.UPDATE,
|
|
818
982
|
modelValue: n,
|
|
819
983
|
show: !0,
|
|
820
984
|
"onUpdate:show"(y) {
|
|
821
|
-
|
|
985
|
+
m.value.show = y;
|
|
822
986
|
}
|
|
823
987
|
};
|
|
824
988
|
}
|
|
825
|
-
function
|
|
989
|
+
function c(n, y, T) {
|
|
826
990
|
e.open({
|
|
827
991
|
title: `Confirm deleting template ${n.name}?`,
|
|
828
992
|
message: "Deleted template can no longer be retrieved",
|
|
829
993
|
primaryActions: {
|
|
830
994
|
text: "Delete",
|
|
831
|
-
variant:
|
|
995
|
+
variant: j.Destructive,
|
|
832
996
|
close: !0
|
|
833
997
|
},
|
|
834
998
|
secondaryActions: {
|
|
835
999
|
text: "Cancel",
|
|
836
|
-
variant:
|
|
1000
|
+
variant: j.Plain,
|
|
837
1001
|
close: !0
|
|
838
1002
|
}
|
|
839
1003
|
}).onPrimary(async () => {
|
|
@@ -870,19 +1034,19 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
870
1034
|
message: "Duplicated template can be edited and used independently",
|
|
871
1035
|
primaryActions: {
|
|
872
1036
|
text: "Duplicate",
|
|
873
|
-
variant:
|
|
1037
|
+
variant: j.Destructive,
|
|
874
1038
|
close: !0
|
|
875
1039
|
},
|
|
876
1040
|
secondaryActions: {
|
|
877
1041
|
text: "Cancel",
|
|
878
|
-
variant:
|
|
1042
|
+
variant: j.Plain,
|
|
879
1043
|
close: !0
|
|
880
1044
|
},
|
|
881
|
-
contentComponent:
|
|
1045
|
+
contentComponent: te({
|
|
882
1046
|
props: ["modelValue"],
|
|
883
1047
|
emits: ["update:modelValue"],
|
|
884
1048
|
setup(R) {
|
|
885
|
-
return () =>
|
|
1049
|
+
return () => Y(X.FmTextField, {
|
|
886
1050
|
modelValue: R.modelValue,
|
|
887
1051
|
"onUpdate:modelValue": (g) => $ = g,
|
|
888
1052
|
label: "New Template Name",
|
|
@@ -951,7 +1115,7 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
951
1115
|
close: !0
|
|
952
1116
|
}
|
|
953
1117
|
}).onPrimary(() => {
|
|
954
|
-
l.push({ name:
|
|
1118
|
+
l.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
|
|
955
1119
|
}).onSecondary(() => T(void 0)).onClose(() => T(void 0)), n;
|
|
956
1120
|
const R = $.map((g) => {
|
|
957
1121
|
var ie;
|
|
@@ -986,7 +1150,7 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
986
1150
|
close: !0
|
|
987
1151
|
}
|
|
988
1152
|
}).onPrimary((g) => Array.isArray(g) ? T(g[0]) : null).onSecondary(() => T(void 0)).onTertiary(() => {
|
|
989
|
-
l.push({ name:
|
|
1153
|
+
l.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
|
|
990
1154
|
}).onClose(() => T(void 0)), n;
|
|
991
1155
|
}
|
|
992
1156
|
function w() {
|
|
@@ -1033,7 +1197,7 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
1033
1197
|
return;
|
|
1034
1198
|
}
|
|
1035
1199
|
e.close(), S(n);
|
|
1036
|
-
}).onTertiary(
|
|
1200
|
+
}).onTertiary(Ze);
|
|
1037
1201
|
}
|
|
1038
1202
|
async function S(n) {
|
|
1039
1203
|
try {
|
|
@@ -1082,176 +1246,23 @@ const _t = xe("transferTemplateActions", () => {
|
|
|
1082
1246
|
createTemplate: h,
|
|
1083
1247
|
viewTemplate: r,
|
|
1084
1248
|
updateTemplate: d,
|
|
1085
|
-
deleteTemplate:
|
|
1249
|
+
deleteTemplate: c,
|
|
1086
1250
|
duplicateTemplate: v,
|
|
1087
1251
|
getTemplateId: x,
|
|
1088
1252
|
importTemplates: w,
|
|
1089
1253
|
exportTemplates: p,
|
|
1090
|
-
templateDialogProps:
|
|
1254
|
+
templateDialogProps: m,
|
|
1091
1255
|
templateDetailsProps: b
|
|
1092
1256
|
};
|
|
1093
1257
|
});
|
|
1094
|
-
function
|
|
1095
|
-
const { skuById: t } = q(), a = re(e);
|
|
1096
|
-
return a.purchaseOrder.items = e.purchaseOrder.items.filter((u) => t[u.sku._id]), a;
|
|
1097
|
-
}
|
|
1098
|
-
const Ce = xe(
|
|
1099
|
-
"transferTemplateTable",
|
|
1100
|
-
function() {
|
|
1101
|
-
const { t } = ne(), a = _t(), u = k(!1), i = k(new Array()), s = Se(), f = q();
|
|
1102
|
-
async function l() {
|
|
1103
|
-
i.value = [], u.value = !0;
|
|
1104
|
-
try {
|
|
1105
|
-
f.isInventoryLoaded || await f.readInventory();
|
|
1106
|
-
const [d] = await Promise.all([s.readTemplates()]).delayed(
|
|
1107
|
-
1e3
|
|
1108
|
-
);
|
|
1109
|
-
i.value = d.map(fe);
|
|
1110
|
-
} catch (d) {
|
|
1111
|
-
console.log("Something went wrong when fetching templates:", d);
|
|
1112
|
-
} finally {
|
|
1113
|
-
u.value = !1;
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
async function o(d) {
|
|
1117
|
-
if (!i.value.find((m) => m._id)) {
|
|
1118
|
-
u.value = !0;
|
|
1119
|
-
try {
|
|
1120
|
-
i.value = [
|
|
1121
|
-
await s.getTemplate(d).then(fe).delayed(1e3)
|
|
1122
|
-
];
|
|
1123
|
-
} catch (m) {
|
|
1124
|
-
console.log("Something went wrong when fetching templates:", m);
|
|
1125
|
-
} finally {
|
|
1126
|
-
u.value = !1;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
function c(d, m) {
|
|
1131
|
-
switch (m = re(m), d) {
|
|
1132
|
-
case N.Details:
|
|
1133
|
-
return a.viewTemplate(m);
|
|
1134
|
-
case N.Edit:
|
|
1135
|
-
return a.updateTemplate(m);
|
|
1136
|
-
case N.Delete:
|
|
1137
|
-
return a.deleteTemplate(m, u, l);
|
|
1138
|
-
case N.Duplicate:
|
|
1139
|
-
return a.duplicateTemplate(m, u, l);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return {
|
|
1143
|
-
columnDefs: [
|
|
1144
|
-
{
|
|
1145
|
-
id: "_id",
|
|
1146
|
-
accessorKey: "_id",
|
|
1147
|
-
header: () => t("inventory.transfer.table.createdAt"),
|
|
1148
|
-
cell(d) {
|
|
1149
|
-
return Qe(`${d.getValue()}`);
|
|
1150
|
-
},
|
|
1151
|
-
enableSorting: !0
|
|
1152
|
-
},
|
|
1153
|
-
{
|
|
1154
|
-
id: "name",
|
|
1155
|
-
accessorKey: "name",
|
|
1156
|
-
header: () => t("inventory.transfer.table.name"),
|
|
1157
|
-
enableSorting: !0,
|
|
1158
|
-
size: 200
|
|
1159
|
-
},
|
|
1160
|
-
{
|
|
1161
|
-
id: "supplier",
|
|
1162
|
-
accessorKey: "purchaseOrder.supplier.name",
|
|
1163
|
-
header: () => t("inventory.transfer.table.from"),
|
|
1164
|
-
enableSorting: !0,
|
|
1165
|
-
size: 200
|
|
1166
|
-
},
|
|
1167
|
-
{
|
|
1168
|
-
id: "noOfItems",
|
|
1169
|
-
accessorKey: "purchaseOrder.items.length",
|
|
1170
|
-
header: () => t("inventory.transfer.table.noOfItems"),
|
|
1171
|
-
enableSorting: !1,
|
|
1172
|
-
meta: {
|
|
1173
|
-
width: "10rem",
|
|
1174
|
-
textAlign: "right"
|
|
1175
|
-
},
|
|
1176
|
-
cell(d) {
|
|
1177
|
-
const m = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(Te);
|
|
1178
|
-
return m === 0 || v ? W("div", { class: "flex justify-end gap-4 items-center" }, [
|
|
1179
|
-
W(
|
|
1180
|
-
J.FmTooltip,
|
|
1181
|
-
{},
|
|
1182
|
-
{
|
|
1183
|
-
content() {
|
|
1184
|
-
return v ? "The template is invalid due to invalid unit on some of the items. Please update this template." : "The template is invalid due to deleted ingredients. Please update this template.";
|
|
1185
|
-
},
|
|
1186
|
-
default() {
|
|
1187
|
-
return W(J.FmIcon, {
|
|
1188
|
-
name: "error",
|
|
1189
|
-
color: "system-error-300",
|
|
1190
|
-
size: "sm"
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
),
|
|
1195
|
-
m
|
|
1196
|
-
]) : m;
|
|
1197
|
-
}
|
|
1198
|
-
},
|
|
1199
|
-
{
|
|
1200
|
-
id: "enabledLocations",
|
|
1201
|
-
accessorKey: "purchaseOrder.locations.length",
|
|
1202
|
-
header: () => "Enabled outlets",
|
|
1203
|
-
cell(d) {
|
|
1204
|
-
var v;
|
|
1205
|
-
const m = (v = d.row.original.locations) == null ? void 0 : v.length;
|
|
1206
|
-
return m ? `${m}` : "All";
|
|
1207
|
-
},
|
|
1208
|
-
enableSorting: !1,
|
|
1209
|
-
meta: {
|
|
1210
|
-
width: "10rem",
|
|
1211
|
-
textAlign: "right"
|
|
1212
|
-
}
|
|
1213
|
-
},
|
|
1214
|
-
{
|
|
1215
|
-
id: "ref",
|
|
1216
|
-
accessorKey: "purchaseOrder.ref",
|
|
1217
|
-
header: () => t("inventory.transfer.table.reference"),
|
|
1218
|
-
enableSorting: !1,
|
|
1219
|
-
size: "auto"
|
|
1220
|
-
},
|
|
1221
|
-
{
|
|
1222
|
-
id: "action",
|
|
1223
|
-
cell(d) {
|
|
1224
|
-
const m = d.row.original, v = [
|
|
1225
|
-
j[N.Details],
|
|
1226
|
-
j[N.Edit],
|
|
1227
|
-
j[N.Duplicate],
|
|
1228
|
-
j[N.Delete]
|
|
1229
|
-
];
|
|
1230
|
-
return He(v, (b) => c(b, m));
|
|
1231
|
-
},
|
|
1232
|
-
enableSorting: !1,
|
|
1233
|
-
size: 40,
|
|
1234
|
-
meta: {
|
|
1235
|
-
cellClass: "",
|
|
1236
|
-
headerClass: ""
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
],
|
|
1240
|
-
templates: i,
|
|
1241
|
-
loading: u,
|
|
1242
|
-
fetchTemplates: l,
|
|
1243
|
-
loadTemplate: o
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
|
-
);
|
|
1247
|
-
function Dt(e, t, a) {
|
|
1258
|
+
function qt(e, t, a) {
|
|
1248
1259
|
const u = (a == null ? void 0 : a.abbrev) ?? t.abbrev;
|
|
1249
|
-
return `${
|
|
1260
|
+
return `${B(e, !1)} ${u}`;
|
|
1250
1261
|
}
|
|
1251
1262
|
export {
|
|
1252
1263
|
A as P,
|
|
1253
|
-
|
|
1254
|
-
|
|
1264
|
+
_e as a,
|
|
1265
|
+
qt as f,
|
|
1255
1266
|
Te as t,
|
|
1256
|
-
|
|
1267
|
+
_t as u
|
|
1257
1268
|
};
|