@feedmepos/mf-inventory-portal 1.2.41-dev.2 → 1.2.41
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-DjVeGAF9.js → App-BIte52Pp.js} +3 -3
- package/dist/{ApprovalView-NN1B2IOQ.js → ApprovalView-JfMRinbO.js} +5 -5
- package/dist/{BindingsDialog-BUYZ8tw1.js → BindingsDialog-vWWVE53r.js} +8 -8
- package/dist/{BindingsPicker-D6CV8wn1.js → BindingsPicker-CaioRGQF.js} +2 -2
- package/dist/{BindingsTable-FWfJIE7U.js → BindingsTable-C7wQYr4Q.js} +3 -3
- package/dist/{ClosingDraftView-ERFxw2au.js → ClosingDraftView-BQUPmOGf.js} +8 -8
- package/dist/{ClosingHistoryView-B_VBYXQ0.js → ClosingHistoryView-DJCPMxxe.js} +22 -22
- package/dist/{ClosingTemplateView-B-Zb6Ir6.js → ClosingTemplateView-2G5nlEZD.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-DZOdyNMy.js → DeliveryOrderPrintPreview-52SJyur7.js} +9 -9
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CUO5in5A.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D4y509uw.js} +61 -60
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CURtV-K5.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bu4F9apP.js} +2 -2
- package/dist/{FmMultiselectDialog-B_pY8XP5.js → FmMultiselectDialog-DFjTvhrL.js} +1 -1
- package/dist/{FmMultiselectDialog-I1n2kVON.js → FmMultiselectDialog-ynZ3ZEkp.js} +2 -2
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-Af3ob_cD.js → FmUnitInput.vue_vue_type_script_setup_true_lang-CHZcrzs1.js} +3 -3
- package/dist/{ImportView-NgLl8SAd.js → ImportView-B7cWiUlq.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DJ6M4bMf.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DLLVwbc_.js} +1 -1
- package/dist/{IngredientGroupView-QPjSPbPk.js → IngredientGroupView-BheK-hr7.js} +5 -5
- package/dist/{IngredientsView-RP45JT6F.js → IngredientsView-CcBD0nYz.js} +14 -14
- package/dist/{IntegrationView-CQLKUdeV.js → IntegrationView-BjSMrWJi.js} +12 -12
- package/dist/{InventoryBindingForm-DbPjVHvx.js → InventoryBindingForm-CA0jI2fl.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-D_Z3uBZS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BREhgetj.js} +14 -14
- package/dist/{InventoryBindingSummary-BMfOHhBW.js → InventoryBindingSummary-BwTziKzM.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Bf_H-he3.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C3U2CRwm.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeiPsNQS.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Oz2AyEGP.js} +2 -2
- package/dist/{PublishView-6pKWty2v.js → PublishView-TMhQAsyu.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-Bexn0z-1.js → PurchaseOrderPrintPreview-DuYNXbd4.js} +9 -9
- package/dist/ReceiveRequestView-CHBSuE63.js +2841 -0
- package/dist/{RecipeView-C-rzKweI.js → RecipeView-DppUQeYL.js} +8 -8
- package/dist/{StockView-DBu_ssH_.js → StockView-DAm5kNok.js} +15 -15
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-YLdgHpck.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BkGdp_SI.js} +1 -1
- package/dist/{SupplierView-BtQGtwqx.js → SupplierView-DYBw03Op.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-BFzQ9YOw.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DGb1ngHq.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BfH5N4qH.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CiAORJrZ.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BlcdYJ8b.js → TransferDetails.vue_vue_type_script_setup_true_lang-Bng7t5aA.js} +430 -430
- package/dist/{TransferTemplateView-DkwjjiW8.js → TransferTemplateView-BsSwtFY0.js} +354 -354
- package/dist/{UnitView-C7DbjS8v.js → UnitView-sCwSm5jh.js} +6 -6
- package/dist/{WarehouseView-ztwU7TTt.js → WarehouseView-CU5qLsQL.js} +5 -5
- package/dist/{WastageTemplateView-DWi9lDs7.js → WastageTemplateView-DiqGE7E3.js} +14 -14
- package/dist/{app-DI81LaYD.js → app-CRAhcbhd.js} +332 -345
- package/dist/app.js +1 -1
- package/dist/{closing-template-CiJZAF2p.js → closing-template-DYislCMF.js} +1 -1
- package/dist/{date2-BYKFHbis.js → date2-C-xZ8cqf.js} +1 -1
- package/dist/{dayjs.min-DWzYoqEQ.js → dayjs.min-BLcebhHP.js} +12 -12
- package/dist/{decimal-H1GrMoC9.js → decimal-UKannZrQ.js} +2 -2
- package/dist/{defineDeepModel-WqBfh9j4.js → defineDeepModel-D8ScMZZw.js} +1 -1
- package/dist/{duplicate-template-uuCvon-m.js → duplicate-template-De-74YH6.js} +1 -1
- package/dist/feature-D_iKVPEM.js +20162 -0
- package/dist/{format-time-from-id-BRS6Wf0e.js → format-time-from-id-Cop0w9qb.js} +1 -1
- package/dist/{format-unit-display-CQhnHa-X.js → format-unit-display-1G-lIy-O.js} +246 -245
- package/dist/{import-export.helper-DQ5ia8oQ.js → import-export.helper-DwtwMGUg.js} +5 -5
- package/dist/{index-CxB-ZEdh.js → index-CZVxWvXs.js} +3 -3
- package/dist/{index-DKcXhLj3.js → index-D0Jbqka0.js} +1 -1
- package/dist/{index-CeVJchTm.js → index-mHuFfoTd.js} +9 -9
- package/dist/{lodash-DLcim3g_.js → lodash-ChFp_-Yp.js} +1 -1
- package/dist/{netsuite-Vwqgf-Yk.js → netsuite-51c6h4mk.js} +48 -48
- package/dist/{purchase-order-template-CzmTSuyW.js → purchase-order-template-BmmBT4iS.js} +1 -1
- package/dist/{rules-_Qrn8iAv.js → rules-BleXdYUs.js} +3 -3
- package/dist/{stock-Du9y9LZH.js → stock-6SYODLp6.js} +3 -3
- package/dist/{stock-BUvbn_27.js → stock-B-nJZjoG.js} +1 -1
- package/dist/{supplier-BRrJ--tq.js → supplier-BuYvvMKA.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-DVVbnh_L.js → use-ingredient-select-dialog-Bh5T8TmW.js} +2 -2
- package/dist/{use-inventory-binding-dialog-CatakG_z.js → use-inventory-binding-dialog-Dh0hVzGV.js} +2 -2
- package/dist/{use-template-enabled-locations-2-Cxk8b75m.js → use-template-enabled-locations-2-pEIG0Sd8.js} +2 -2
- package/dist/views/receive-request/components/netsuite/NetSuitePanel.vue.d.ts +2 -3
- package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +2 -3
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +2197 -490
- package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +0 -1430
- package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +0 -1
- package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -3
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +1 -1
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +6 -6
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +7 -7
- package/dist/views/receive-request/constants/purchase-order-transaction-type.d.ts +4 -0
- package/dist/views/receive-request/helper/get-transfer-type.d.ts +2 -1
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -3
- package/dist/views/transfer-template/components/transfer-template-import/TransferTemplateImportItemProps.d.ts +2 -3
- package/dist/views/transfer-template/helpers/import-export.helper.d.ts +3 -4
- package/dist/{vue-i18n-Dl1sRfbB.js → vue-i18n-DRHpfOaU.js} +376 -376
- package/dist/{xlsx-D_k1aCyC.js → xlsx-DzVz917g.js} +398 -398
- package/dist/{xlsx.util-CPXsPFyJ.js → xlsx.util-D6AoBHGt.js} +1 -1
- package/package.json +3 -3
- package/dist/ReceiveRequestView-qkJJ3VFK.js +0 -2877
- package/dist/feature-BRonrkVa.js +0 -25312
- package/dist/helper/reactivity.d.ts +0 -11
- package/dist/helper/reactivity.spec.d.ts +0 -1
- package/dist/views/receive-request/components/transfer-form/composables/use-purchase-order-form-controller.d.ts +0 -13974
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { components as X, useDialogChild as
|
|
1
|
+
import { components as X, useDialogChild as Ie, useSnackbar as ye, useDialog as Ne, FmButtonVariant as j } from "@feedmepos/ui-library";
|
|
2
2
|
import { defineStore as he } from "pinia";
|
|
3
3
|
import { F as le } from "./form-mode.enum-BKiNVH6A.js";
|
|
4
|
-
import { u as ve } from "./purchase-order-template-
|
|
5
|
-
import { ref as
|
|
6
|
-
import { a as
|
|
7
|
-
import { useRouter as
|
|
8
|
-
import { a as
|
|
9
|
-
import { D as
|
|
10
|
-
import { c as
|
|
11
|
-
import { f as
|
|
4
|
+
import { u as ve } from "./purchase-order-template-BmmBT4iS.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-CRAhcbhd.js";
|
|
7
|
+
import { useRouter as Le } from "vue-router";
|
|
8
|
+
import { a as Be } from "./FmMultiselectDialog-ynZ3ZEkp.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-Cop0w9qb.js";
|
|
12
12
|
import { useI18n as ne, useCoreStore as ge } from "@feedmepos/mf-common";
|
|
13
|
-
import { t as
|
|
14
|
-
import { F as
|
|
15
|
-
import { d as je, a as
|
|
16
|
-
import { f as
|
|
17
|
-
import { u as oe } from "./supplier-
|
|
18
|
-
import { u as ae } from "./netsuite-
|
|
19
|
-
import { u as We } from "./duplicate-template-
|
|
20
|
-
function
|
|
21
|
-
const
|
|
13
|
+
import { t as L, a as be, d as xe, s as Se, r as Ve } from "./xlsx.util-D6AoBHGt.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-BleXdYUs.js";
|
|
16
|
+
import { f as Ye } from "./date2-C-xZ8cqf.js";
|
|
17
|
+
import { u as oe } from "./supplier-BuYvvMKA.js";
|
|
18
|
+
import { u as ae } from "./netsuite-51c6h4mk.js";
|
|
19
|
+
import { u as We } from "./duplicate-template-De-74YH6.js";
|
|
20
|
+
function Te(e) {
|
|
21
|
+
const t = q(), a = e.sku, u = t.skuById[a._id];
|
|
22
22
|
if (u.unit._id !== a.unit._id) return !0;
|
|
23
|
-
const i =
|
|
24
|
-
return i ? !
|
|
23
|
+
const i = e.measurement;
|
|
24
|
+
return i ? !t.unitById[u.unit._id].measurements.find((l) => l.id === i.id) : !1;
|
|
25
25
|
}
|
|
26
|
-
function de(
|
|
27
|
-
const { skuById:
|
|
28
|
-
return a.purchaseOrder.items =
|
|
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
29
|
}
|
|
30
30
|
const _e = he(
|
|
31
31
|
"transferTemplateTable",
|
|
32
32
|
function() {
|
|
33
|
-
const { t
|
|
33
|
+
const { t } = ne(), a = _t(), u = k(!1), i = k(new Array()), s = ve(), f = q();
|
|
34
34
|
async function l() {
|
|
35
35
|
i.value = [], u.value = !0;
|
|
36
36
|
try {
|
|
@@ -61,13 +61,13 @@ const _e = he(
|
|
|
61
61
|
}
|
|
62
62
|
function m(d, c) {
|
|
63
63
|
switch (c = re(c), d) {
|
|
64
|
-
case
|
|
64
|
+
case N.Details:
|
|
65
65
|
return a.viewTemplate(c);
|
|
66
|
-
case
|
|
66
|
+
case N.Edit:
|
|
67
67
|
return a.updateTemplate(c);
|
|
68
|
-
case
|
|
68
|
+
case N.Delete:
|
|
69
69
|
return a.deleteTemplate(c, u, l);
|
|
70
|
-
case
|
|
70
|
+
case N.Duplicate:
|
|
71
71
|
return a.duplicateTemplate(c, u, l);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -76,39 +76,39 @@ const _e = he(
|
|
|
76
76
|
{
|
|
77
77
|
id: "_id",
|
|
78
78
|
accessorKey: "_id",
|
|
79
|
-
header: () =>
|
|
79
|
+
header: () => t("inventory.transfer.table.createdAt"),
|
|
80
80
|
cell(d) {
|
|
81
|
-
return
|
|
81
|
+
return He(`${d.getValue()}`);
|
|
82
82
|
},
|
|
83
83
|
enableSorting: !0
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
id: "name",
|
|
87
87
|
accessorKey: "name",
|
|
88
|
-
header: () =>
|
|
88
|
+
header: () => t("inventory.transfer.table.name"),
|
|
89
89
|
enableSorting: !0,
|
|
90
90
|
size: 200
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
id: "supplier",
|
|
94
94
|
accessorKey: "purchaseOrder.supplier.name",
|
|
95
|
-
header: () =>
|
|
95
|
+
header: () => t("inventory.transfer.table.from"),
|
|
96
96
|
enableSorting: !0,
|
|
97
97
|
size: 200
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
id: "noOfItems",
|
|
101
101
|
accessorKey: "purchaseOrder.items.length",
|
|
102
|
-
header: () =>
|
|
102
|
+
header: () => t("inventory.transfer.table.noOfItems"),
|
|
103
103
|
enableSorting: !1,
|
|
104
104
|
meta: {
|
|
105
105
|
width: "10rem",
|
|
106
106
|
textAlign: "right"
|
|
107
107
|
},
|
|
108
108
|
cell(d) {
|
|
109
|
-
const c = Number(d.getValue()) || 0, v = d.row.original.purchaseOrder.items.some(
|
|
110
|
-
return c === 0 || v ?
|
|
111
|
-
|
|
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
112
|
X.FmTooltip,
|
|
113
113
|
{},
|
|
114
114
|
{
|
|
@@ -116,7 +116,7 @@ const _e = he(
|
|
|
116
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
117
|
},
|
|
118
118
|
default() {
|
|
119
|
-
return
|
|
119
|
+
return Y(X.FmIcon, {
|
|
120
120
|
name: "error",
|
|
121
121
|
color: "system-error-300",
|
|
122
122
|
size: "sm"
|
|
@@ -146,7 +146,7 @@ const _e = he(
|
|
|
146
146
|
{
|
|
147
147
|
id: "ref",
|
|
148
148
|
accessorKey: "purchaseOrder.ref",
|
|
149
|
-
header: () =>
|
|
149
|
+
header: () => t("inventory.transfer.table.reference"),
|
|
150
150
|
enableSorting: !1,
|
|
151
151
|
size: "auto"
|
|
152
152
|
},
|
|
@@ -154,12 +154,12 @@ const _e = he(
|
|
|
154
154
|
id: "action",
|
|
155
155
|
cell(d) {
|
|
156
156
|
const c = d.row.original, v = [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
K[N.Details],
|
|
158
|
+
K[N.Edit],
|
|
159
|
+
K[N.Duplicate],
|
|
160
|
+
K[N.Delete]
|
|
161
161
|
];
|
|
162
|
-
return
|
|
162
|
+
return Qe(v, (b) => m(b, c));
|
|
163
163
|
},
|
|
164
164
|
enableSorting: !1,
|
|
165
165
|
size: 40,
|
|
@@ -176,20 +176,20 @@ const _e = he(
|
|
|
176
176
|
};
|
|
177
177
|
}
|
|
178
178
|
);
|
|
179
|
-
var se = /* @__PURE__ */ ((
|
|
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 || {});
|
|
180
180
|
const pe = je(0);
|
|
181
|
-
function we(
|
|
181
|
+
function we(e) {
|
|
182
182
|
var u;
|
|
183
|
-
const
|
|
183
|
+
const t = e.sku;
|
|
184
184
|
return {
|
|
185
|
-
code:
|
|
186
|
-
overrideCode:
|
|
187
|
-
name:
|
|
188
|
-
unit: ((u =
|
|
189
|
-
defaultQuantity: +
|
|
190
|
-
minimumQuantity: +
|
|
191
|
-
maximumQuantity: +
|
|
192
|
-
quantityStep: +
|
|
185
|
+
code: t.code,
|
|
186
|
+
overrideCode: e.code,
|
|
187
|
+
name: t.name,
|
|
188
|
+
unit: ((u = t.unit.measurements.find((i) => i.id === t.trackingMeasurement)) == null ? void 0 : u.abbrev) ?? t.unit.abbrev,
|
|
189
|
+
defaultQuantity: +B(e.quantity),
|
|
190
|
+
minimumQuantity: +B(e.minimumQuantity ?? pe),
|
|
191
|
+
maximumQuantity: +B(e.maximumQuantity ?? pe),
|
|
192
|
+
quantityStep: +B(e.quantityStep)
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
function $e() {
|
|
@@ -228,9 +228,9 @@ function $e() {
|
|
|
228
228
|
}
|
|
229
229
|
];
|
|
230
230
|
}
|
|
231
|
-
function Ge(
|
|
231
|
+
function Ge(e) {
|
|
232
232
|
var l;
|
|
233
|
-
const a = ge().currentBusiness.value, i = (l =
|
|
233
|
+
const a = ge().currentBusiness.value, i = (l = e.map((o) => {
|
|
234
234
|
var b;
|
|
235
235
|
const m = o.purchaseOrder.items.map((r) => we(r)), h = $e(), d = [
|
|
236
236
|
["Template ID", o._id],
|
|
@@ -240,7 +240,7 @@ function Ge(t) {
|
|
|
240
240
|
["Menu version", a == null ? void 0 : a.menuVersion],
|
|
241
241
|
[
|
|
242
242
|
"Purchase/Transfer",
|
|
243
|
-
typeof o.purchaseOrder.supplier.internal == "string" ? A.
|
|
243
|
+
typeof o.purchaseOrder.supplier.internal == "string" ? A.TRANSFER : A.PURCHASE
|
|
244
244
|
],
|
|
245
245
|
[
|
|
246
246
|
"Transfer from",
|
|
@@ -258,7 +258,7 @@ function Ge(t) {
|
|
|
258
258
|
[],
|
|
259
259
|
h.map((r) => r.name),
|
|
260
260
|
...m.map((r) => h.map((x) => r[x.id]))
|
|
261
|
-
], c = h.map((r) => `system:${r.id}`), v =
|
|
261
|
+
], c = h.map((r) => `system:${r.id}`), v = L(d, c);
|
|
262
262
|
return { name: o.name, sheet: v };
|
|
263
263
|
}).reduce(
|
|
264
264
|
(o, m) => {
|
|
@@ -270,11 +270,11 @@ function Ge(t) {
|
|
|
270
270
|
sheets: {},
|
|
271
271
|
sheetOccurence: {}
|
|
272
272
|
}
|
|
273
|
-
)) == null ? void 0 : l.sheets, s = `${a == null ? void 0 : a.name} transfer templates (${
|
|
273
|
+
)) == null ? void 0 : l.sheets, s = `${a == null ? void 0 : a.name} transfer templates (${Ye(/* @__PURE__ */ new Date())}).xlsx`, f = be(i);
|
|
274
274
|
return xe(f, s), s;
|
|
275
275
|
}
|
|
276
276
|
function Ze() {
|
|
277
|
-
const
|
|
277
|
+
const e = ge(), t = oe(), a = Z(), u = q(), i = e.currentBusiness.value, s = we({
|
|
278
278
|
sku: {
|
|
279
279
|
unit: {
|
|
280
280
|
_id: "",
|
|
@@ -327,9 +327,9 @@ function Ze() {
|
|
|
327
327
|
[],
|
|
328
328
|
f.map((r) => r.name),
|
|
329
329
|
f.map((r) => s[r.id])
|
|
330
|
-
], o = f.map((r) => `system:${r.id}`), m =
|
|
330
|
+
], o = f.map((r) => `system:${r.id}`), m = L(l, o), h = L(
|
|
331
331
|
[
|
|
332
|
-
...
|
|
332
|
+
...t.businessSuppliers.map((r) => [
|
|
333
333
|
`${r.name} (${r._id})`,
|
|
334
334
|
"Purchase",
|
|
335
335
|
r.address.line1,
|
|
@@ -340,13 +340,13 @@ function Ze() {
|
|
|
340
340
|
r.address.country
|
|
341
341
|
]),
|
|
342
342
|
...a.locations.map((r) => {
|
|
343
|
-
var x, w,
|
|
343
|
+
var x, w, S, p, n, y;
|
|
344
344
|
return [
|
|
345
345
|
`${r.name} (${r.dbName})`,
|
|
346
346
|
"Transfer",
|
|
347
347
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
348
348
|
(w = r.doc.profile.address) == null ? void 0 : w.line2,
|
|
349
|
-
(
|
|
349
|
+
(S = r.doc.profile.address) == null ? void 0 : S.city,
|
|
350
350
|
(p = r.doc.profile.address) == null ? void 0 : p.postcode,
|
|
351
351
|
(n = r.doc.profile.address) == null ? void 0 : n.state,
|
|
352
352
|
(y = r.doc.profile.address) == null ? void 0 : y.country
|
|
@@ -354,21 +354,21 @@ function Ze() {
|
|
|
354
354
|
})
|
|
355
355
|
],
|
|
356
356
|
["Name", "Type", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
357
|
-
), d =
|
|
357
|
+
), d = L(
|
|
358
358
|
a.locations.map((r) => {
|
|
359
|
-
var x, w,
|
|
359
|
+
var x, w, S, p, n, y;
|
|
360
360
|
return [
|
|
361
361
|
`${r.name} (${r.dbName})`,
|
|
362
362
|
(x = r.doc.profile.address) == null ? void 0 : x.line1,
|
|
363
363
|
(w = r.doc.profile.address) == null ? void 0 : w.line2,
|
|
364
|
-
(
|
|
364
|
+
(S = r.doc.profile.address) == null ? void 0 : S.city,
|
|
365
365
|
(p = r.doc.profile.address) == null ? void 0 : p.postcode,
|
|
366
366
|
(n = r.doc.profile.address) == null ? void 0 : n.state,
|
|
367
367
|
(y = r.doc.profile.address) == null ? void 0 : y.country
|
|
368
368
|
];
|
|
369
369
|
}),
|
|
370
370
|
["Name", "Line 1", "Line 2", "City", "Postal", "State", "Country"]
|
|
371
|
-
), c =
|
|
371
|
+
), c = L(
|
|
372
372
|
u.skus.map((r) => [
|
|
373
373
|
r.code,
|
|
374
374
|
r.name,
|
|
@@ -384,8 +384,8 @@ function Ze() {
|
|
|
384
384
|
}), b = `${i == null ? void 0 : i.name} transfer templates import.xlsx`;
|
|
385
385
|
return xe(v, b), b;
|
|
386
386
|
}
|
|
387
|
-
function Je(
|
|
388
|
-
const a = new Array(), u = /(.*) \(((supplier_|warehouse_|restaurant_).{24,})\)/, s = Z().locationByDbName, l = oe().supplierById, o =
|
|
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
389
|
if (!m)
|
|
390
390
|
return a.push(`Transfer from location value of ${o} cannot be read.`), {
|
|
391
391
|
errors: a
|
|
@@ -393,7 +393,7 @@ function Je(t, e) {
|
|
|
393
393
|
const h = m[1], d = m[2];
|
|
394
394
|
let c;
|
|
395
395
|
if (d.startsWith("supplier"))
|
|
396
|
-
c = l[d],
|
|
396
|
+
c = l[d], t !== A.PURCHASE && a.push(`Expected transfer type Purchase but found ${t} instead.`);
|
|
397
397
|
else {
|
|
398
398
|
const v = s[d];
|
|
399
399
|
if (!v)
|
|
@@ -426,12 +426,12 @@ function Je(t, e) {
|
|
|
426
426
|
errors: a
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
-
function Xe(
|
|
430
|
-
if (!
|
|
429
|
+
function Xe(e) {
|
|
430
|
+
if (!e.length || `${e[0]}`.toLocaleLowerCase() === "all")
|
|
431
431
|
return [];
|
|
432
|
-
const
|
|
433
|
-
return
|
|
434
|
-
const s = new Array(), f = i.trim(), l =
|
|
432
|
+
const t = /(.*) \(((warehouse_|restaurant_).{24,})\)/, u = Z().locationByDbName;
|
|
433
|
+
return e.map((i) => {
|
|
434
|
+
const s = new Array(), f = i.trim(), l = t.exec(f);
|
|
435
435
|
if (!l)
|
|
436
436
|
return s.push(`Enabled location value of ${f} cannot be read.`), {
|
|
437
437
|
errors: s
|
|
@@ -447,9 +447,9 @@ function Xe(t) {
|
|
|
447
447
|
});
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
|
-
function et(
|
|
450
|
+
function et(e) {
|
|
451
451
|
const [
|
|
452
|
-
|
|
452
|
+
t,
|
|
453
453
|
a,
|
|
454
454
|
u,
|
|
455
455
|
i,
|
|
@@ -460,20 +460,20 @@ function et(t) {
|
|
|
460
460
|
m,
|
|
461
461
|
h,
|
|
462
462
|
d
|
|
463
|
-
] =
|
|
463
|
+
] = Se(e);
|
|
464
464
|
return {
|
|
465
465
|
id: `${a[1] ?? ""}`.trim(),
|
|
466
466
|
name: `${u[1] ?? ""}`.trim(),
|
|
467
|
-
type: `${l[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? A.
|
|
467
|
+
type: `${l[1] ?? ""}`.trim().toLocaleLowerCase() === "transfer" ? A.TRANSFER : A.PURCHASE,
|
|
468
468
|
transferFrom: `${o[1] ?? ""}`.trim(),
|
|
469
469
|
locations: m.slice(1).map((c) => `${c}`.trim()).filter((c) => c),
|
|
470
470
|
reference: `${h[1] ?? ""}`.trim(),
|
|
471
471
|
remark: `${d[1] ?? ""}`.trim()
|
|
472
472
|
};
|
|
473
473
|
}
|
|
474
|
-
function tt(
|
|
474
|
+
function tt(e) {
|
|
475
475
|
const [
|
|
476
|
-
|
|
476
|
+
t,
|
|
477
477
|
a,
|
|
478
478
|
u,
|
|
479
479
|
i,
|
|
@@ -487,10 +487,10 @@ function tt(t) {
|
|
|
487
487
|
c,
|
|
488
488
|
v,
|
|
489
489
|
...b
|
|
490
|
-
] =
|
|
491
|
-
if (!
|
|
490
|
+
] = Se(e);
|
|
491
|
+
if (!t || !t.length || t.some((p) => p.length && !p.startsWith("system:")))
|
|
492
492
|
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
493
|
-
const r =
|
|
493
|
+
const r = t.map((p) => p.split(":")[1]), w = [
|
|
494
494
|
"code",
|
|
495
495
|
"name",
|
|
496
496
|
"unit",
|
|
@@ -505,9 +505,9 @@ function tt(t) {
|
|
|
505
505
|
);
|
|
506
506
|
return b.map((p, n) => {
|
|
507
507
|
const y = {};
|
|
508
|
-
for (const
|
|
509
|
-
const $ = r[
|
|
510
|
-
Object.assign(y, { [$]: p[
|
|
508
|
+
for (const T in r) {
|
|
509
|
+
const $ = r[T];
|
|
510
|
+
Object.assign(y, { [$]: p[T] });
|
|
511
511
|
}
|
|
512
512
|
return {
|
|
513
513
|
index: n,
|
|
@@ -515,33 +515,33 @@ function tt(t) {
|
|
|
515
515
|
};
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
|
-
function rt(
|
|
519
|
-
const u =
|
|
518
|
+
function rt(e, t, a) {
|
|
519
|
+
const u = e === "" ? null : G(e, a), i = t === "" ? null : G(t, a), s = u && i && u.amount > i.amount;
|
|
520
520
|
return {
|
|
521
521
|
min: u,
|
|
522
522
|
max: i,
|
|
523
523
|
compareError: s ? "Minimum amount must be less than or equal to maximum amount" : void 0
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
|
-
function nt(
|
|
527
|
-
const u =
|
|
526
|
+
function nt(e, t, a) {
|
|
527
|
+
const u = q(), i = ae(), s = u.skuByCode[e.code], f = new Array();
|
|
528
528
|
if (!s)
|
|
529
|
-
return f.push(`Cannot find ingredient with code (${
|
|
530
|
-
index:
|
|
529
|
+
return f.push(`Cannot find ingredient with code (${e.code}) ${e.name}.`), {
|
|
530
|
+
index: t,
|
|
531
531
|
errors: f
|
|
532
532
|
};
|
|
533
|
-
if (a.filter((p) => p.data.code ===
|
|
534
|
-
return f.push(`Ingredient ${
|
|
535
|
-
index:
|
|
533
|
+
if (a.filter((p) => p.data.code === e.code).length > 1)
|
|
534
|
+
return f.push(`Ingredient ${e.code} is defined twice.`), {
|
|
535
|
+
index: t,
|
|
536
536
|
errors: f
|
|
537
537
|
};
|
|
538
|
-
const l = s.unit, o = l == null ? void 0 : l.measurements.find((p) => p.abbrev ===
|
|
539
|
-
if (l.abbrev !==
|
|
540
|
-
const p = `Cannot find unit measurement of symbol ${
|
|
538
|
+
const l = s.unit, o = l == null ? void 0 : l.measurements.find((p) => p.abbrev === e.unit);
|
|
539
|
+
if (l.abbrev !== e.unit && !o) {
|
|
540
|
+
const p = `Cannot find unit measurement of symbol ${e.unit || "[empty]"} for ingredient (${e.code}) ${e.name}.`;
|
|
541
541
|
f.push(p);
|
|
542
542
|
const n = {
|
|
543
543
|
sku: s,
|
|
544
|
-
code:
|
|
544
|
+
code: e.overrideCode || s.code,
|
|
545
545
|
name: s.name,
|
|
546
546
|
measurement: o,
|
|
547
547
|
quantity: { amount: 0, precision: 0 },
|
|
@@ -554,33 +554,33 @@ function nt(t, e, a) {
|
|
|
554
554
|
y && (n.code = y);
|
|
555
555
|
}
|
|
556
556
|
return {
|
|
557
|
-
index:
|
|
557
|
+
index: t,
|
|
558
558
|
errors: f,
|
|
559
559
|
templateItem: n
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
562
|
const m = G(
|
|
563
|
-
|
|
563
|
+
e.quantityStep,
|
|
564
564
|
J(l, o)
|
|
565
565
|
);
|
|
566
|
-
(Number.isNaN(Number(
|
|
566
|
+
(Number.isNaN(Number(e.quantityStep)) || Number(e.quantityStep) <= 0) && f.push("Amount step must be more than 0");
|
|
567
567
|
const h = ze(m), d = rt(
|
|
568
|
-
|
|
569
|
-
|
|
568
|
+
e.minimumQuantity,
|
|
569
|
+
e.maximumQuantity,
|
|
570
570
|
J(l, o)
|
|
571
571
|
), c = d.min, v = d.max;
|
|
572
572
|
d.compareError && f.push(d.compareError);
|
|
573
|
-
const b =
|
|
574
|
-
|
|
573
|
+
const b = Ke(+e.minimumQuantity, +e.maximumQuantity), r = G(
|
|
574
|
+
e.defaultQuantity,
|
|
575
575
|
J(l, o)
|
|
576
576
|
), x = h(r);
|
|
577
577
|
typeof x == "string" && f.push(`Default amount: ${x}`);
|
|
578
|
-
const w = d.min && d.max ? b(`${
|
|
578
|
+
const w = d.min && d.max ? b(`${e.defaultQuantity}`) : null;
|
|
579
579
|
typeof w == "string" && f.push(`Default amount: ${w}`);
|
|
580
|
-
const
|
|
580
|
+
const S = {
|
|
581
581
|
sku: s,
|
|
582
|
-
code:
|
|
583
|
-
name:
|
|
582
|
+
code: e.overrideCode || s.code,
|
|
583
|
+
name: e.name || s.name,
|
|
584
584
|
measurement: o,
|
|
585
585
|
quantity: r,
|
|
586
586
|
quantityStep: m,
|
|
@@ -588,20 +588,20 @@ function nt(t, e, a) {
|
|
|
588
588
|
maximumQuantity: v
|
|
589
589
|
};
|
|
590
590
|
return {
|
|
591
|
-
index:
|
|
591
|
+
index: t,
|
|
592
592
|
errors: f,
|
|
593
|
-
templateItem:
|
|
593
|
+
templateItem: S
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
|
-
function ot(
|
|
597
|
-
const
|
|
596
|
+
function ot(e) {
|
|
597
|
+
const t = e.SheetNames.filter(
|
|
598
598
|
(s) => !Object.values(se).map(String).includes(s)
|
|
599
599
|
), u = _e().templates, i = Me(u, "_id");
|
|
600
600
|
try {
|
|
601
|
-
return
|
|
601
|
+
return t.reduce(
|
|
602
602
|
(s, f) => {
|
|
603
603
|
var p;
|
|
604
|
-
const l = new Array(), o =
|
|
604
|
+
const l = new Array(), o = e.Sheets[f], m = et(o), h = Je(m.transferFrom, m.type);
|
|
605
605
|
l.push(...h.errors);
|
|
606
606
|
const d = h.from, c = Xe(m.locations), v = c.filter((n) => n.location).map((n) => n.location);
|
|
607
607
|
l.push(...c.flatMap((n) => n.errors));
|
|
@@ -617,7 +617,7 @@ function ot(t) {
|
|
|
617
617
|
if (m.id) {
|
|
618
618
|
const n = i[m.id];
|
|
619
619
|
if (!n) {
|
|
620
|
-
const
|
|
620
|
+
const T = {
|
|
621
621
|
_id: m.id,
|
|
622
622
|
_rev: "",
|
|
623
623
|
name: m.name || `(unnamed from sheet ${f || "<unnamed sheet>"})`,
|
|
@@ -625,8 +625,8 @@ function ot(t) {
|
|
|
625
625
|
};
|
|
626
626
|
return l.push(`Template ID ${m.id} is not found.`), s.importUpdateResult.push({
|
|
627
627
|
type: "update",
|
|
628
|
-
original:
|
|
629
|
-
template:
|
|
628
|
+
original: T,
|
|
629
|
+
template: T,
|
|
630
630
|
excelSheetName: f,
|
|
631
631
|
errors: l
|
|
632
632
|
}), s;
|
|
@@ -651,7 +651,7 @@ function ot(t) {
|
|
|
651
651
|
};
|
|
652
652
|
return s.importUpdateResult.push(y), s;
|
|
653
653
|
}
|
|
654
|
-
const
|
|
654
|
+
const S = {
|
|
655
655
|
type: "create",
|
|
656
656
|
template: {
|
|
657
657
|
name: m.name,
|
|
@@ -666,7 +666,7 @@ function ot(t) {
|
|
|
666
666
|
excelSheetName: f,
|
|
667
667
|
errors: l
|
|
668
668
|
};
|
|
669
|
-
return s.importCreateResult.push(
|
|
669
|
+
return s.importCreateResult.push(S), s;
|
|
670
670
|
},
|
|
671
671
|
{
|
|
672
672
|
invalidExcel: !1,
|
|
@@ -718,28 +718,28 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
718
718
|
items: {},
|
|
719
719
|
errors: {}
|
|
720
720
|
},
|
|
721
|
-
setup(
|
|
722
|
-
return (
|
|
721
|
+
setup(e) {
|
|
722
|
+
return (t, a) => {
|
|
723
723
|
var s, f, l;
|
|
724
|
-
const u =
|
|
725
|
-
return _(),
|
|
724
|
+
const u = Q("FmIcon"), i = Q("FmTooltip");
|
|
725
|
+
return _(), E("div", st, [
|
|
726
726
|
a[0] || (a[0] = C("div", null, "•", -1)),
|
|
727
727
|
C("div", it, [
|
|
728
728
|
C("div", lt, [
|
|
729
729
|
C("div", {
|
|
730
|
-
class:
|
|
731
|
-
"text-fm-color-system-error-300":
|
|
730
|
+
class: H({
|
|
731
|
+
"text-fm-color-system-error-300": t.errors.length
|
|
732
732
|
})
|
|
733
733
|
}, [
|
|
734
|
-
|
|
735
|
-
C("span", mt, " (" +
|
|
736
|
-
|
|
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)
|
|
737
737
|
], 2),
|
|
738
|
-
|
|
738
|
+
t.errors.length ? (_(), E("div", ut, [
|
|
739
739
|
P(i, { "z-index": 50 }, {
|
|
740
740
|
content: ee(() => [
|
|
741
741
|
C("ol", null, [
|
|
742
|
-
(_(!0),
|
|
742
|
+
(_(!0), E(U, null, W(t.errors, (o, m) => (_(), E("li", { key: m }, D(o), 1))), 128))
|
|
743
743
|
])
|
|
744
744
|
]),
|
|
745
745
|
default: ee(() => [
|
|
@@ -751,17 +751,17 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
751
751
|
]),
|
|
752
752
|
_: 1
|
|
753
753
|
})
|
|
754
|
-
])) :
|
|
754
|
+
])) : V("", !0)
|
|
755
755
|
]),
|
|
756
756
|
C("div", {
|
|
757
|
-
class:
|
|
757
|
+
class: H([
|
|
758
758
|
"fm-typo-en-body-sm-400",
|
|
759
759
|
{
|
|
760
|
-
"text-fm-color-system-error-200":
|
|
761
|
-
"text-fm-color-typo-secondary": !
|
|
760
|
+
"text-fm-color-system-error-200": t.errors.length,
|
|
761
|
+
"text-fm-color-typo-secondary": !t.errors.length
|
|
762
762
|
}
|
|
763
763
|
])
|
|
764
|
-
},
|
|
764
|
+
}, D((s = t.locations) != null && s.length ? `${(f = t.locations) == null ? void 0 : f.length} locations` : "All locations") + ", " + D(`${(l = t.items) == null ? void 0 : l.length} items`), 3)
|
|
765
765
|
])
|
|
766
766
|
]);
|
|
767
767
|
};
|
|
@@ -778,11 +778,11 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
778
778
|
}, gt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, bt = {
|
|
779
779
|
key: 0,
|
|
780
780
|
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
781
|
-
}, xt = { class: "fm-typo-en-body-lg-600" },
|
|
781
|
+
}, xt = { class: "fm-typo-en-body-lg-600" }, St = /* @__PURE__ */ te({
|
|
782
782
|
__name: "TransferTemplateImport",
|
|
783
|
-
setup(
|
|
784
|
-
const
|
|
785
|
-
|
|
783
|
+
setup(e) {
|
|
784
|
+
const t = k(null), a = Ie(), u = ye(), i = k(!1), s = k(!1), f = oe();
|
|
785
|
+
Oe(async () => {
|
|
786
786
|
s.value = !0;
|
|
787
787
|
try {
|
|
788
788
|
await f.readSuppliers().delayed(1e3);
|
|
@@ -796,7 +796,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
796
796
|
s.value = !1;
|
|
797
797
|
}
|
|
798
798
|
});
|
|
799
|
-
const l =
|
|
799
|
+
const l = k(new Array()), o = k([]), m = k([]), h = me(
|
|
800
800
|
() => !!l.value.length || o.value.some((b) => b.errors.length) || m.value.some((b) => b.errors.length)
|
|
801
801
|
), d = me(
|
|
802
802
|
() => !!o.value.length || !!m.value.length
|
|
@@ -806,7 +806,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
806
806
|
try {
|
|
807
807
|
i.value = !0;
|
|
808
808
|
const [r] = await Promise.all([
|
|
809
|
-
|
|
809
|
+
Ve(b),
|
|
810
810
|
// fake buffer
|
|
811
811
|
new Promise((p) => setTimeout(p, 1e3))
|
|
812
812
|
]);
|
|
@@ -816,18 +816,18 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
816
816
|
l.value.push(c("inventory.ingredient.import.fileError.noSheet"));
|
|
817
817
|
return;
|
|
818
818
|
}
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
819
|
+
const S = ot(r);
|
|
820
|
+
if (S.invalidExcel) {
|
|
821
821
|
l.value.push(
|
|
822
|
-
|
|
822
|
+
S.invalidExcelMessage ?? c("inventory.ingredient.import.fileError.invalidExcel")
|
|
823
823
|
);
|
|
824
824
|
return;
|
|
825
825
|
}
|
|
826
|
-
if (o.value =
|
|
826
|
+
if (o.value = S.importCreateResult, m.value = S.importUpdateResult, !o.value.length && !m.value.length) {
|
|
827
827
|
l.value.push(c("inventory.ingredient.import.fileError.noData"));
|
|
828
828
|
return;
|
|
829
829
|
}
|
|
830
|
-
a.emitData(
|
|
830
|
+
a.emitData(S);
|
|
831
831
|
} catch (r) {
|
|
832
832
|
u.open({
|
|
833
833
|
title: c("inventory.ingredient.import.fileError.unableToRead"),
|
|
@@ -841,13 +841,13 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
841
841
|
}), i.value = !1;
|
|
842
842
|
}
|
|
843
843
|
}
|
|
844
|
-
return Fe(
|
|
844
|
+
return Fe(t, (b) => {
|
|
845
845
|
b && v(b);
|
|
846
846
|
}), (b, r) => {
|
|
847
|
-
const x =
|
|
848
|
-
return _(),
|
|
847
|
+
const x = Q("FmCircularProgress"), w = Q("FmIcon"), S = Q("FmButton");
|
|
848
|
+
return _(), E("div", dt, [
|
|
849
849
|
r[2] || (r[2] = C("div", { class: "fm-typo-en-body-md-400" }, "Import transfer templates from excel sheets.", -1)),
|
|
850
|
-
s.value ? (_(),
|
|
850
|
+
s.value ? (_(), E("div", pt, [
|
|
851
851
|
C("div", null, [
|
|
852
852
|
P(x, {
|
|
853
853
|
size: "md",
|
|
@@ -855,23 +855,23 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
855
855
|
})
|
|
856
856
|
]),
|
|
857
857
|
r[1] || (r[1] = C("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, "Loading...", -1))
|
|
858
|
-
])) : (_(),
|
|
859
|
-
P(
|
|
860
|
-
class:
|
|
858
|
+
])) : (_(), E(U, { key: 1 }, [
|
|
859
|
+
P(qe, {
|
|
860
|
+
class: H({
|
|
861
861
|
"w-full": !0,
|
|
862
|
-
"h-[200px]": !
|
|
862
|
+
"h-[200px]": !t.value
|
|
863
863
|
}),
|
|
864
864
|
accept: ".xlsx",
|
|
865
|
-
onFileUpload: r[0] || (r[0] = (p) =>
|
|
866
|
-
label:
|
|
867
|
-
"button-label":
|
|
865
|
+
onFileUpload: r[0] || (r[0] = (p) => t.value = p),
|
|
866
|
+
label: I(c)("inventory.ingredient.import.uploadTemplate"),
|
|
867
|
+
"button-label": I(c)("inventory.ingredient.import.selectFile")
|
|
868
868
|
}, Pe({ _: 2 }, [
|
|
869
|
-
|
|
869
|
+
t.value ? {
|
|
870
870
|
name: "default",
|
|
871
871
|
fn: ee(({ openFileDialog: p }) => [
|
|
872
872
|
C("div", ft, [
|
|
873
873
|
C("div", {
|
|
874
|
-
class:
|
|
874
|
+
class: H([
|
|
875
875
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
876
876
|
{
|
|
877
877
|
"border border-fm-color-neutral-gray-100": i.value,
|
|
@@ -891,7 +891,7 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
891
891
|
color: h.value ? "system-error-300" : void 0
|
|
892
892
|
}, null, 8, ["name", "color"])),
|
|
893
893
|
C("div", {
|
|
894
|
-
class:
|
|
894
|
+
class: H([
|
|
895
895
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
896
896
|
{
|
|
897
897
|
"text-fm-color-typo-disabled": i.value,
|
|
@@ -899,19 +899,19 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
899
899
|
}
|
|
900
900
|
])
|
|
901
901
|
}, [
|
|
902
|
-
C("div", yt,
|
|
902
|
+
C("div", yt, D(t.value.name), 1)
|
|
903
903
|
], 2),
|
|
904
|
-
i.value ?
|
|
905
|
-
P(
|
|
906
|
-
label:
|
|
904
|
+
i.value ? V("", !0) : (_(), E("div", ht, [
|
|
905
|
+
P(S, {
|
|
906
|
+
label: I(c)("inventory.ingredient.import.replaceFile"),
|
|
907
907
|
variant: h.value ? "destructive" : "secondary",
|
|
908
908
|
"prepend-icon": h.value ? void 0 : "autorenew",
|
|
909
909
|
onClick: p
|
|
910
910
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
911
911
|
]))
|
|
912
912
|
], 2),
|
|
913
|
-
l.value.length ? (_(),
|
|
914
|
-
(_(!0),
|
|
913
|
+
l.value.length ? (_(), E("div", vt, [
|
|
914
|
+
(_(!0), E(U, null, W(l.value, (n, y) => (_(), E("div", {
|
|
915
915
|
key: y,
|
|
916
916
|
class: "flex gap-8 items-center"
|
|
917
917
|
}, [
|
|
@@ -920,53 +920,53 @@ const st = { class: "flex items-center gap-12 pl-8" }, it = { class: "flex flex-
|
|
|
920
920
|
size: "sm",
|
|
921
921
|
color: "system-error-300"
|
|
922
922
|
}),
|
|
923
|
-
C("div", gt,
|
|
923
|
+
C("div", gt, D(n), 1)
|
|
924
924
|
]))), 128))
|
|
925
|
-
])) :
|
|
925
|
+
])) : V("", !0)
|
|
926
926
|
])
|
|
927
927
|
]),
|
|
928
928
|
key: "0"
|
|
929
929
|
} : void 0
|
|
930
930
|
]), 1032, ["class", "label", "button-label"]),
|
|
931
|
-
d.value ? (_(),
|
|
932
|
-
C("div", xt,
|
|
933
|
-
(_(!0),
|
|
931
|
+
d.value ? (_(), E("div", bt, [
|
|
932
|
+
C("div", xt, D(I(c)("inventory.ingredient.import.summary")), 1),
|
|
933
|
+
(_(!0), E(U, null, W(o.value, (p, n) => (_(), z(fe, {
|
|
934
934
|
key: n,
|
|
935
935
|
name: p.template.name,
|
|
936
|
-
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ?
|
|
936
|
+
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? I(A).TRANSFER : I(A).PURCHASE,
|
|
937
937
|
locations: p.template.locations,
|
|
938
938
|
items: p.template.purchaseOrder.items,
|
|
939
939
|
errors: p.errors,
|
|
940
940
|
type: "create"
|
|
941
941
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128)),
|
|
942
|
-
(_(!0),
|
|
942
|
+
(_(!0), E(U, null, W(m.value, (p) => (_(), z(fe, {
|
|
943
943
|
key: p.template._id,
|
|
944
944
|
name: p.template.name,
|
|
945
|
-
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ?
|
|
945
|
+
"transfer-type": typeof p.template.purchaseOrder.supplier.internal == "string" ? I(A).TRANSFER : I(A).PURCHASE,
|
|
946
946
|
locations: p.template.locations,
|
|
947
947
|
items: p.template.purchaseOrder.items,
|
|
948
948
|
errors: p.errors,
|
|
949
949
|
type: "update"
|
|
950
950
|
}, null, 8, ["name", "transfer-type", "locations", "items", "errors"]))), 128))
|
|
951
|
-
])) :
|
|
951
|
+
])) : V("", !0)
|
|
952
952
|
], 64))
|
|
953
953
|
]);
|
|
954
954
|
};
|
|
955
955
|
}
|
|
956
956
|
});
|
|
957
|
-
function
|
|
957
|
+
function Tt(e) {
|
|
958
958
|
var s, f;
|
|
959
|
-
const
|
|
960
|
-
if (!
|
|
961
|
-
if (!
|
|
962
|
-
const l =
|
|
959
|
+
const t = ae();
|
|
960
|
+
if (!t.isEnabled) return !0;
|
|
961
|
+
if (!e.internal) {
|
|
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
963
|
return o && o == m;
|
|
964
964
|
}
|
|
965
|
-
const a =
|
|
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;
|
|
966
966
|
return u && u == i;
|
|
967
967
|
}
|
|
968
968
|
const _t = he("transferTemplateActions", () => {
|
|
969
|
-
const
|
|
969
|
+
const e = Ne(), t = ye(), a = Z(), u = _e(), i = We(), s = ve(), f = ae(), l = Le(), { t: o } = ne(), m = k({});
|
|
970
970
|
function h() {
|
|
971
971
|
m.value = {
|
|
972
972
|
mode: le.CREATE,
|
|
@@ -986,8 +986,8 @@ const _t = he("transferTemplateActions", () => {
|
|
|
986
986
|
}
|
|
987
987
|
};
|
|
988
988
|
}
|
|
989
|
-
function c(n, y,
|
|
990
|
-
|
|
989
|
+
function c(n, y, T) {
|
|
990
|
+
e.open({
|
|
991
991
|
title: `Confirm deleting template ${n.name}?`,
|
|
992
992
|
message: "Deleted template can no longer be retrieved",
|
|
993
993
|
primaryActions: {
|
|
@@ -1001,7 +1001,7 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1001
1001
|
close: !0
|
|
1002
1002
|
}
|
|
1003
1003
|
}).onPrimary(async () => {
|
|
1004
|
-
|
|
1004
|
+
t.open({
|
|
1005
1005
|
title: `Deleting ${n.name}`,
|
|
1006
1006
|
type: "info"
|
|
1007
1007
|
});
|
|
@@ -1009,27 +1009,27 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1009
1009
|
y.value = !0;
|
|
1010
1010
|
const [$] = await Promise.allSettled([
|
|
1011
1011
|
s.deleteTemplate(n),
|
|
1012
|
-
new Promise((
|
|
1012
|
+
new Promise((R) => setTimeout(R, 1e3))
|
|
1013
1013
|
]);
|
|
1014
1014
|
if ($.status === "rejected") throw $.reason;
|
|
1015
|
-
|
|
1015
|
+
t.open({
|
|
1016
1016
|
title: `Deleted ${n.name}`,
|
|
1017
1017
|
type: "success"
|
|
1018
1018
|
});
|
|
1019
1019
|
} catch ($) {
|
|
1020
|
-
|
|
1020
|
+
t.open({
|
|
1021
1021
|
title: `Unable to delete ${n.name}`,
|
|
1022
1022
|
message: `See error from server: ${$}`,
|
|
1023
1023
|
type: "error"
|
|
1024
1024
|
}), console.error("error on deleting purchase order template", $);
|
|
1025
1025
|
} finally {
|
|
1026
|
-
y.value = !1,
|
|
1026
|
+
y.value = !1, T();
|
|
1027
1027
|
}
|
|
1028
1028
|
});
|
|
1029
1029
|
}
|
|
1030
|
-
function v(n, y,
|
|
1030
|
+
function v(n, y, T) {
|
|
1031
1031
|
let $;
|
|
1032
|
-
|
|
1032
|
+
e.open({
|
|
1033
1033
|
title: `Confirm duplicating template "${n.name}"?`,
|
|
1034
1034
|
message: "Duplicated template can be edited and used independently",
|
|
1035
1035
|
primaryActions: {
|
|
@@ -1045,9 +1045,9 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1045
1045
|
contentComponent: te({
|
|
1046
1046
|
props: ["modelValue"],
|
|
1047
1047
|
emits: ["update:modelValue"],
|
|
1048
|
-
setup(
|
|
1049
|
-
return () =>
|
|
1050
|
-
modelValue:
|
|
1048
|
+
setup(R) {
|
|
1049
|
+
return () => Y(X.FmTextField, {
|
|
1050
|
+
modelValue: R.modelValue,
|
|
1051
1051
|
"onUpdate:modelValue": (g) => $ = g,
|
|
1052
1052
|
label: "New Template Name",
|
|
1053
1053
|
size: "md",
|
|
@@ -1056,33 +1056,33 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
})
|
|
1058
1058
|
}).onPrimary(async () => {
|
|
1059
|
-
|
|
1059
|
+
t.open({
|
|
1060
1060
|
title: `Duplicating ${n.name}`,
|
|
1061
1061
|
type: "info"
|
|
1062
1062
|
});
|
|
1063
1063
|
try {
|
|
1064
1064
|
y.value = !0;
|
|
1065
|
-
const [
|
|
1065
|
+
const [R] = await Promise.allSettled([
|
|
1066
1066
|
i.duplicatePurchaseOrderTemplate(n._id, $),
|
|
1067
1067
|
new Promise((g) => setTimeout(g, 1e3))
|
|
1068
1068
|
]);
|
|
1069
|
-
if (
|
|
1070
|
-
|
|
1069
|
+
if (R.status === "rejected") throw R.reason;
|
|
1070
|
+
t.open({
|
|
1071
1071
|
title: `Duplicated ${n.name}`,
|
|
1072
1072
|
type: "success"
|
|
1073
1073
|
});
|
|
1074
|
-
} catch (
|
|
1075
|
-
|
|
1074
|
+
} catch (R) {
|
|
1075
|
+
t.open({
|
|
1076
1076
|
title: `Unable to duplicate ${n.name}`,
|
|
1077
|
-
message: `See error from server: ${
|
|
1077
|
+
message: `See error from server: ${R}`,
|
|
1078
1078
|
type: "error"
|
|
1079
|
-
}), console.error("error on duplicating purchase order template",
|
|
1079
|
+
}), console.error("error on duplicating purchase order template", R);
|
|
1080
1080
|
} finally {
|
|
1081
|
-
y.value = !1,
|
|
1081
|
+
y.value = !1, T();
|
|
1082
1082
|
}
|
|
1083
1083
|
});
|
|
1084
1084
|
}
|
|
1085
|
-
const b =
|
|
1085
|
+
const b = k({});
|
|
1086
1086
|
function r(n) {
|
|
1087
1087
|
b.value = {
|
|
1088
1088
|
template: n,
|
|
@@ -1096,14 +1096,14 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1096
1096
|
};
|
|
1097
1097
|
}
|
|
1098
1098
|
function x() {
|
|
1099
|
-
const { promise: n, resolve: y } = Promise.withResolvers(),
|
|
1099
|
+
const { promise: n, resolve: y } = Promise.withResolvers(), T = (g) => {
|
|
1100
1100
|
y(g);
|
|
1101
1101
|
}, $ = u.templates.filter((g) => {
|
|
1102
|
-
var
|
|
1103
|
-
return ((
|
|
1102
|
+
var O, F;
|
|
1103
|
+
return ((O = g.purchaseOrder.supplier) == null ? void 0 : O._id) === a.currentLocation.doc._id ? !1 : (F = g.locations) != null && F.length ? g.locations.find((M) => M.doc._id === a.currentLocation.doc._id) : !0;
|
|
1104
1104
|
});
|
|
1105
1105
|
if (!$.length)
|
|
1106
|
-
return
|
|
1106
|
+
return e.open({
|
|
1107
1107
|
title: "Select one template",
|
|
1108
1108
|
message: "There is no available template in your business. Configure a new template?",
|
|
1109
1109
|
primaryActions: {
|
|
@@ -1115,26 +1115,26 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1115
1115
|
close: !0
|
|
1116
1116
|
}
|
|
1117
1117
|
}).onPrimary(() => {
|
|
1118
|
-
l.push({ name: ue.TRANSFER_TEMPLATE }),
|
|
1119
|
-
}).onSecondary(() =>
|
|
1120
|
-
const
|
|
1118
|
+
l.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
|
|
1119
|
+
}).onSecondary(() => T(void 0)).onClose(() => T(void 0)), n;
|
|
1120
|
+
const R = $.map((g) => {
|
|
1121
1121
|
var ie;
|
|
1122
|
-
const
|
|
1122
|
+
const O = !g.purchaseOrder.items.length || g.purchaseOrder.items.some(Te), F = !Tt(g.purchaseOrder.supplier), M = g.purchaseOrder.supplier.internal ? f.getNetSuiteLocation(
|
|
1123
1123
|
`${g.purchaseOrder.supplier.internal}_${g.purchaseOrder.supplier._id}`
|
|
1124
|
-
) : f.getNetSuiteVendor(g.purchaseOrder.supplier._id),
|
|
1125
|
-
location is ${(ie = f.getLocationSubsidiary(M == null ? void 0 : M.netSuiteId)) == null ? void 0 : ie.fullName}.` : void 0,
|
|
1124
|
+
) : f.getNetSuiteVendor(g.purchaseOrder.supplier._id), Ee = F ? `The subsidiary of the request
|
|
1125
|
+
location is ${(ie = f.getLocationSubsidiary(M == null ? void 0 : M.netSuiteId)) == null ? void 0 : ie.fullName}.` : void 0, Re = O || F, ke = O ? "This template is invalid. Update this template." : F ? Ee : void 0, Ae = `${g.purchaseOrder.supplier.internal ? "Transfer" : "Purchase"} from ${g.purchaseOrder.supplier.name}`;
|
|
1126
1126
|
return {
|
|
1127
1127
|
label: g.name,
|
|
1128
1128
|
value: g._id,
|
|
1129
|
-
disabled:
|
|
1130
|
-
sublabel:
|
|
1129
|
+
disabled: Re,
|
|
1130
|
+
sublabel: ke ?? Ae
|
|
1131
1131
|
};
|
|
1132
1132
|
});
|
|
1133
|
-
return
|
|
1133
|
+
return R.sort((g, O) => +!!g.disabled - +!!O.disabled), e.open({
|
|
1134
1134
|
title: "Select one template",
|
|
1135
|
-
contentComponent:
|
|
1135
|
+
contentComponent: Be,
|
|
1136
1136
|
contentComponentProps: {
|
|
1137
|
-
items:
|
|
1137
|
+
items: R,
|
|
1138
1138
|
singleSelect: !0
|
|
1139
1139
|
},
|
|
1140
1140
|
primaryActions: {
|
|
@@ -1149,14 +1149,14 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1149
1149
|
text: "Templates",
|
|
1150
1150
|
close: !0
|
|
1151
1151
|
}
|
|
1152
|
-
}).onPrimary((g) => Array.isArray(g) ?
|
|
1153
|
-
l.push({ name: ue.TRANSFER_TEMPLATE }),
|
|
1154
|
-
}).onClose(() =>
|
|
1152
|
+
}).onPrimary((g) => Array.isArray(g) ? T(g[0]) : null).onSecondary(() => T(void 0)).onTertiary(() => {
|
|
1153
|
+
l.push({ name: ue.TRANSFER_TEMPLATE }), T(void 0);
|
|
1154
|
+
}).onClose(() => T(void 0)), n;
|
|
1155
1155
|
}
|
|
1156
1156
|
function w() {
|
|
1157
|
-
|
|
1157
|
+
e.open({
|
|
1158
1158
|
title: o("inventory.ingredient.import.title"),
|
|
1159
|
-
contentComponent:
|
|
1159
|
+
contentComponent: St,
|
|
1160
1160
|
overlay: !0,
|
|
1161
1161
|
closeButton: !0,
|
|
1162
1162
|
primaryActions: {
|
|
@@ -1174,14 +1174,14 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
}).onPrimary((n) => {
|
|
1176
1176
|
if (!n) {
|
|
1177
|
-
|
|
1177
|
+
t.open({
|
|
1178
1178
|
title: o("inventory.ingredient.import.error.noData"),
|
|
1179
1179
|
type: "error"
|
|
1180
1180
|
});
|
|
1181
1181
|
return;
|
|
1182
1182
|
}
|
|
1183
1183
|
if (!n.importCreateResult.length && !n.importUpdateResult.length) {
|
|
1184
|
-
|
|
1184
|
+
t.open({
|
|
1185
1185
|
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
1186
1186
|
message: o("inventory.ingredient.import.error.noImportData"),
|
|
1187
1187
|
type: "error"
|
|
@@ -1189,17 +1189,17 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1189
1189
|
return;
|
|
1190
1190
|
}
|
|
1191
1191
|
if (n.importCreateResult.some((y) => y.errors.length) || n.importUpdateResult.some((y) => y.errors.length)) {
|
|
1192
|
-
|
|
1192
|
+
t.open({
|
|
1193
1193
|
title: o("inventory.ingredient.import.error.invalidContent"),
|
|
1194
1194
|
message: o("inventory.ingredient.import.error.hasErrors"),
|
|
1195
1195
|
type: "error"
|
|
1196
1196
|
});
|
|
1197
1197
|
return;
|
|
1198
1198
|
}
|
|
1199
|
-
|
|
1199
|
+
e.close(), S(n);
|
|
1200
1200
|
}).onTertiary(Ze);
|
|
1201
1201
|
}
|
|
1202
|
-
async function
|
|
1202
|
+
async function S(n) {
|
|
1203
1203
|
try {
|
|
1204
1204
|
const y = [
|
|
1205
1205
|
...n.importCreateResult.map(
|
|
@@ -1208,10 +1208,10 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1208
1208
|
...n.importUpdateResult.map(
|
|
1209
1209
|
(g) => g.template
|
|
1210
1210
|
)
|
|
1211
|
-
],
|
|
1211
|
+
], T = 100;
|
|
1212
1212
|
let $ = 0;
|
|
1213
|
-
const
|
|
1214
|
-
$ +=
|
|
1213
|
+
const R = () => {
|
|
1214
|
+
$ += T, t.open({
|
|
1215
1215
|
title: o("inventory.ingredient.import.progress", [
|
|
1216
1216
|
Math.min($, y.length),
|
|
1217
1217
|
y.length
|
|
@@ -1219,13 +1219,13 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1219
1219
|
});
|
|
1220
1220
|
};
|
|
1221
1221
|
for (const g of y.chunk(100))
|
|
1222
|
-
|
|
1223
|
-
|
|
1222
|
+
R(), await s.importTemplates(g);
|
|
1223
|
+
t.open({
|
|
1224
1224
|
title: o("inventory.ingredient.import.success"),
|
|
1225
1225
|
type: "success"
|
|
1226
1226
|
});
|
|
1227
1227
|
} catch (y) {
|
|
1228
|
-
|
|
1228
|
+
t.open({
|
|
1229
1229
|
title: o("inventory.ingredient.import.error.failed"),
|
|
1230
1230
|
message: o("inventory.ingredient.import.error.systemMessage", [y == null ? void 0 : y.message]),
|
|
1231
1231
|
type: "error"
|
|
@@ -1236,7 +1236,7 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
function p() {
|
|
1238
1238
|
const n = Ge(u.templates);
|
|
1239
|
-
|
|
1239
|
+
t.open({
|
|
1240
1240
|
title: o("inventory.ingredient.export.success"),
|
|
1241
1241
|
message: o("inventory.ingredient.export.filename", [n]),
|
|
1242
1242
|
type: "success"
|
|
@@ -1255,13 +1255,14 @@ const _t = he("transferTemplateActions", () => {
|
|
|
1255
1255
|
templateDetailsProps: b
|
|
1256
1256
|
};
|
|
1257
1257
|
});
|
|
1258
|
-
function
|
|
1259
|
-
const u = (a == null ? void 0 : a.abbrev) ??
|
|
1260
|
-
return `${
|
|
1258
|
+
function qt(e, t, a) {
|
|
1259
|
+
const u = (a == null ? void 0 : a.abbrev) ?? t.abbrev;
|
|
1260
|
+
return `${B(e, !1)} ${u}`;
|
|
1261
1261
|
}
|
|
1262
1262
|
export {
|
|
1263
|
+
A as P,
|
|
1263
1264
|
_e as a,
|
|
1264
|
-
|
|
1265
|
-
|
|
1265
|
+
qt as f,
|
|
1266
|
+
Te as t,
|
|
1266
1267
|
_t as u
|
|
1267
1268
|
};
|