@feedmepos/mf-inventory-portal 1.2.46 → 1.2.48
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-DBd4DVaZ.js → App-DPGaFV4B.js} +3 -3
- package/dist/{ApprovalView-C-XcEiMZ.js → ApprovalView-833HS5kH.js} +5 -5
- package/dist/{BindingsDialog-CXKDYmmR.js → BindingsDialog-ChODu5A1.js} +2 -2
- package/dist/{BindingsPicker-Cq1yHJhJ.js → BindingsPicker-DvX4GyKv.js} +3 -3
- package/dist/{BindingsTable-BL8DhipQ.js → BindingsTable-DNAiQ3jC.js} +3 -3
- package/dist/ClosingDraftView-BNmLpJEn.js +2421 -0
- package/dist/{ClosingHistoryView-BC8ZP51z.js → ClosingHistoryView-BWCsFzL4.js} +3 -3
- package/dist/{ClosingTemplateView-B4jnOrpc.js → ClosingTemplateView-oZwROzRq.js} +14 -14
- package/dist/{DeliveryOrderPrintPreview-Bxy5xIrP.js → DeliveryOrderPrintPreview-CgF6Ah_t.js} +4 -4
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-D5DApGXT.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-COu3S25S.js} +12 -12
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DHS5LMuy.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Br-AzVal.js} +2 -2
- package/dist/{FmMultiselectDialog-C6OzbsWu.js → FmMultiselectDialog-BcnuMvBx.js} +2 -2
- package/dist/{FmMultiselectDialog-C7DVf8cL.js → FmMultiselectDialog-nOXJfHcT.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BtN3UL40.js → FmUnitInput.vue_vue_type_script_setup_true_lang-B0TLNBD_.js} +3 -3
- package/dist/{ImportView-BhmfI7Am.js → ImportView-DiCAaSmP.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BXSO5UKK.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjzJ3O5a.js} +1 -1
- package/dist/{IngredientGroupView-DfAt-7Fz.js → IngredientGroupView-DJ_gq48z.js} +5 -5
- package/dist/{IngredientsView-4MNLuMhd.js → IngredientsView-B2tdcbaR.js} +916 -910
- package/dist/{IntegrationView-CvgAJIaG.js → IntegrationView-siGNamS4.js} +12 -12
- package/dist/{InventoryBindingForm-CQB1X3d5.js → InventoryBindingForm-CMH2losI.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Sebvr-gm.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-D68w7k0f.js} +4 -4
- package/dist/{InventoryBindingSummary-_-dkvb4N.js → InventoryBindingSummary-DAGsx_Mo.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BGsjKOls.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Cyl5cUO6.js} +1 -1
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-D9goSrss.js → PremiumBadge.vue_vue_type_script_setup_true_lang-CNze8ZJ7.js} +2 -2
- package/dist/{PublishView-BFdsGmRf.js → PublishView-D1AKbuKs.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-DpaV5GjO.js → PurchaseOrderPrintPreview-BzGcJK1f.js} +10 -10
- package/dist/{ReceiveRequestView-DNimgIgR.js → ReceiveRequestView-hvDCU729.js} +896 -889
- package/dist/{RecipeView-D8CH2rJC.js → RecipeView-BcnjGf_a.js} +8 -8
- package/dist/StockView-DdgYT4_P.js +2497 -0
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bb-yJBxo.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DRPzgTm4.js} +1 -1
- package/dist/{SupplierView-Bl0JNI44.js → SupplierView-LRNOgWQk.js} +11 -11
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-C-VmXiM3.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CQJJ3XRC.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DqmlOtC4.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-KBs8Dq8C.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D-4LyU74.js → TransferDetails.vue_vue_type_script_setup_true_lang-bP-1-mLN.js} +99 -99
- package/dist/{TransferTemplateView-COJEXmF0.js → TransferTemplateView-Dp2W2doS.js} +412 -412
- package/dist/{UnitView-ecUANF8x.js → UnitView-N5l93VfY.js} +6 -6
- package/dist/{WarehouseView-DZ9OCali.js → WarehouseView-D7FGBKUP.js} +5 -5
- package/dist/{WastageTemplateView-DXu5bayJ.js → WastageTemplateView-BmSNPRPI.js} +14 -14
- package/dist/api/inventory.d.ts +10 -10
- package/dist/api/stock.d.ts +1 -0
- package/dist/{app-aLZoWUfQ.js → app-CfCaSzjl.js} +4623 -5097
- package/dist/app.d.ts +176 -834
- package/dist/app.js +1 -1
- package/dist/{closing-template-D-cf9Vnu.js → closing-template-CJ4VCKvB.js} +1 -1
- package/dist/{date2-DluMG3-3.js → date2-BcmOfaME.js} +1 -1
- package/dist/{dayjs.min-UuQWuDkU.js → dayjs.min-CiFpY16f.js} +13 -13
- package/dist/{decimal-B2f58cUQ.js → decimal-DtLL5qsA.js} +2 -2
- package/dist/{defineDeepModel-DUvW0g9M.js → defineDeepModel-DBV1M6fx.js} +1 -1
- package/dist/{duplicate-template-BiGYHuPK.js → duplicate-template-DjhY01M8.js} +1 -1
- package/dist/{feature-B-rekKRC.js → feature-0OR7WTHu.js} +2 -2
- package/dist/{format-time-from-id-CMm14GBq.js → format-time-from-id-DATUhiz_.js} +1 -1
- package/dist/{format-unit-display-DeHfXVX_.js → format-unit-display-9qQdeD4R.js} +10 -10
- package/dist/{import-export.helper-rXmKqRlR.js → import-export.helper-isWO7OKw.js} +5 -5
- package/dist/{index-CYdIQDVa.js → index-BvtrCC8o.js} +1 -1
- package/dist/{index-DGs4MBmv.js → index-CG0HXAUt.js} +3 -3
- package/dist/{index-CEK6OlSE.js → index-YLMXpUuG.js} +1 -1
- package/dist/{lodash-DO8ShgBV.js → lodash-D1GaTimh.js} +1 -1
- package/dist/{netsuite-NShFW2SJ.js → netsuite-C3C6Uju7.js} +3 -3
- package/dist/{purchase-order-template-COeJz9vK.js → purchase-order-template-C8k-zHLA.js} +1 -1
- package/dist/{rules-C_U2Ahtv.js → rules-DCfupVMX.js} +3 -3
- package/dist/{stock-B9KGLNAt.js → stock-AXiQCAeU.js} +3 -3
- package/dist/{stock-DdZuie8e.js → stock-BwYeYuFG.js} +7 -1
- package/dist/stores/inventory.d.ts +13 -13
- package/dist/stores/stock.d.ts +5 -5
- package/dist/stores/supplier.d.ts +24 -24
- package/dist/{supplier-BCfa74hz.js → supplier-p9r9OqFz.js} +2 -2
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CoAP08vZ.js → use-ingredient-select-dialog-Cpmsu92V.js} +2 -2
- package/dist/{use-inventory-binding-dialog-BPXhlhVD.js → use-inventory-binding-dialog-BPm1TXkw.js} +2 -2
- package/dist/{use-template-enabled-locations-2-CYfkmGP5.js → use-template-enabled-locations-2-Batk5Jq7.js} +2 -2
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftApprovalDialog.vue.d.ts +29 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +20 -20
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +60 -60
- package/dist/views/ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +2 -2
- package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +1 -1
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -6
- package/dist/views/integration/components/netsuite/business/AddVendorDialog.vue.d.ts +12 -12
- package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +2 -2
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +2 -2
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +12 -12
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +14 -14
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +29 -6
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +2 -2
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +2 -2
- package/dist/views/supplier/composables/use-supplier-table.d.ts +1 -1
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +2 -2
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +4 -4
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +12 -12
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +12 -12
- package/dist/{vue-i18n-Cn8L1Fah.js → vue-i18n-Xu3ISvbS.js} +258 -258
- package/dist/{xlsx-jqtV3ziP.js → xlsx-DTdVIUTe.js} +1 -1
- package/dist/{xlsx.util-BBey-FqO.js → xlsx.util-twnxgS4l.js} +1 -1
- package/package.json +1 -1
- package/dist/ClosingDraftView-nwQQl4U1.js +0 -2164
- package/dist/StockView-cXMeYZEU.js +0 -2407
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import { ref as B, defineComponent as pe, computed as
|
|
2
|
-
import { a as Ce, c as
|
|
3
|
-
import { useDialog as
|
|
1
|
+
import { ref as B, defineComponent as pe, computed as b, resolveComponent as C, openBlock as c, createElementBlock as T, Fragment as X, unref as l, createVNode as s, withModifiers as Bt, createCommentVNode as L, withCtx as g, createElementVNode as n, toDisplayString as F, normalizeClass as te, renderList as ue, createBlock as O, h as Q, renderSlot as xe, createSlots as qe, createTextVNode as Ye, mergeModels as dt, onMounted as Dt, watch as Tt, useModel as Ot, isRef as ut, normalizeStyle as Nt, Teleport as ct, normalizeProps as zt, guardReactiveProps as Lt } from "vue";
|
|
2
|
+
import { a as Ce, c as wt, S as jt, d as mt, e as pt, f as Wt, h as vt, i as ft, j as yt, k as gt, u as Ht, l as qt } from "./app-CfCaSzjl.js";
|
|
3
|
+
import { useDialog as Ge, useSnackbar as Fe, components as Oe, useProxiedModel as bt, useDialogChild as Yt, useBreakpoints as Gt } from "@feedmepos/ui-library";
|
|
4
4
|
import { i as Kt, _ as Zt } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
5
|
import { F as H } from "./form-mode.enum-BKiNVH6A.js";
|
|
6
|
-
import { useI18n as ve, useCoreStore as
|
|
6
|
+
import { useI18n as ve, useCoreStore as Ke } from "@feedmepos/mf-common";
|
|
7
7
|
import { defineStore as Jt, storeToRefs as Qt } from "pinia";
|
|
8
|
-
import { D as
|
|
9
|
-
import { c as Xt, _ as en, F as
|
|
10
|
-
import { u as Ae, _ as tn } from "./netsuite-
|
|
11
|
-
import { F as
|
|
12
|
-
import { A as Pe, a as ln, t as an, R as Ne, U as sn, M as rn, g as dn } from "./rules-
|
|
13
|
-
import { g as un, _ as ze, S as Le, a as cn } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-
|
|
14
|
-
import { _ as mn } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-
|
|
15
|
-
import { _ as je } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-
|
|
16
|
-
import { u as Vt } from "./feature-
|
|
8
|
+
import { D as ht, R as Me } from "./row-action.enum-BcW_L_nE.js";
|
|
9
|
+
import { c as Xt, _ as en, F as _t } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-cfFHDIwQ.js";
|
|
10
|
+
import { u as Ae, _ as tn } from "./netsuite-C3C6Uju7.js";
|
|
11
|
+
import { F as Re, u as nn, _ as on } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-CWZkVCAj.js";
|
|
12
|
+
import { A as Pe, a as ln, t as an, R as Ne, U as sn, M as rn, g as dn } from "./rules-DCfupVMX.js";
|
|
13
|
+
import { g as un, _ as ze, S as Le, a as cn } from "./SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DRPzgTm4.js";
|
|
14
|
+
import { _ as mn } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-D68w7k0f.js";
|
|
15
|
+
import { _ as je } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-CjzJ3O5a.js";
|
|
16
|
+
import { u as Vt } from "./feature-0OR7WTHu.js";
|
|
17
17
|
import { _ as he } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
18
|
-
import { d as Ue, g as pn, e as vn, a as fn } from "./import-export.helper-
|
|
18
|
+
import { d as Ue, g as pn, e as vn, a as fn } from "./import-export.helper-isWO7OKw.js";
|
|
19
19
|
import { _ as yn } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
20
|
-
import { F as gn, a as We } from "./FmMultiselectDialog-
|
|
21
|
-
import { u as It } from "./purchase-order-template-
|
|
22
|
-
import { u as St, a as Ct } from "./closing-template-
|
|
23
|
-
import { r as bn } from "./xlsx.util-
|
|
20
|
+
import { F as gn, a as We } from "./FmMultiselectDialog-BcnuMvBx.js";
|
|
21
|
+
import { u as It } from "./purchase-order-template-C8k-zHLA.js";
|
|
22
|
+
import { u as St, a as Ct } from "./closing-template-CJ4VCKvB.js";
|
|
23
|
+
import { r as bn } from "./xlsx.util-twnxgS4l.js";
|
|
24
24
|
import { F as hn } from "./FmDroppableField-J0xUsOTV.js";
|
|
25
|
-
import { _ as _n } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-
|
|
26
|
-
import { u as xn } from "./FmMultiselectDialog-
|
|
25
|
+
import { _ as _n } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Br-AzVal.js";
|
|
26
|
+
import { u as xn } from "./FmMultiselectDialog-nOXJfHcT.js";
|
|
27
27
|
import { N as kn, H as Tn } from "./app-uBuHtW8m.js";
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
function
|
|
31
|
-
const
|
|
28
|
+
const He = Jt("ingredientForm", function() {
|
|
29
|
+
const r = Ge(), k = Fe(), d = Ce(), h = B(!1), { t: I } = ve(), E = B();
|
|
30
|
+
function P() {
|
|
31
|
+
const a = {
|
|
32
32
|
sku: {},
|
|
33
33
|
mode: H.CREATE,
|
|
34
34
|
show: !0,
|
|
35
|
-
"onUpdate:show"(
|
|
36
|
-
|
|
35
|
+
"onUpdate:show"(i) {
|
|
36
|
+
E.value.show = i;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
E.value = a;
|
|
40
40
|
}
|
|
41
|
-
async function
|
|
42
|
-
const
|
|
43
|
-
sku:
|
|
41
|
+
async function o(a) {
|
|
42
|
+
const i = {
|
|
43
|
+
sku: wt(a),
|
|
44
44
|
mode: H.UPDATE,
|
|
45
45
|
show: !0,
|
|
46
46
|
"onUpdate:show"(m) {
|
|
47
|
-
|
|
47
|
+
E.value.show = m;
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
E.value = i;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
53
|
-
|
|
52
|
+
async function u(a) {
|
|
53
|
+
h.value = !0;
|
|
54
54
|
try {
|
|
55
|
-
await
|
|
55
|
+
await d.deleteSku(a), k.open({
|
|
56
56
|
title: "Success",
|
|
57
|
-
message: `Deleted ${
|
|
57
|
+
message: `Deleted ${a.name}`,
|
|
58
58
|
type: "success"
|
|
59
59
|
});
|
|
60
|
-
} catch (
|
|
61
|
-
|
|
60
|
+
} catch (i) {
|
|
61
|
+
i instanceof jt && Kt(i) ? r.open({
|
|
62
62
|
title: "Cannot delete ingredient",
|
|
63
63
|
contentComponent: Zt,
|
|
64
64
|
contentComponentProps: {
|
|
65
|
-
subject: (
|
|
66
|
-
items:
|
|
65
|
+
subject: (a == null ? void 0 : a.name) ?? "",
|
|
66
|
+
items: i.errorResponse.message
|
|
67
67
|
},
|
|
68
68
|
secondaryActions: {
|
|
69
69
|
text: "Close",
|
|
70
70
|
close: !0
|
|
71
71
|
}
|
|
72
|
-
}) : console.log("unable to delete ingredient",
|
|
73
|
-
title: `Cannot delete ${
|
|
72
|
+
}) : console.log("unable to delete ingredient", i), k.open({
|
|
73
|
+
title: `Cannot delete ${a.name}`,
|
|
74
74
|
message: "Please try again.",
|
|
75
75
|
type: "error"
|
|
76
|
-
}), console.error("failed to delete ingredient",
|
|
76
|
+
}), console.error("failed to delete ingredient", i);
|
|
77
77
|
} finally {
|
|
78
|
-
|
|
78
|
+
h.value = !1;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
title:
|
|
81
|
+
function p(a) {
|
|
82
|
+
r.open({
|
|
83
|
+
title: I("inventory.ingredient.delete.title", [(a == null ? void 0 : a.name) ?? ""]),
|
|
84
84
|
closeButton: !1,
|
|
85
|
-
message:
|
|
85
|
+
message: I("inventory.ingredient.delete.message"),
|
|
86
86
|
primaryActions: {
|
|
87
|
-
text:
|
|
87
|
+
text: I("common.delete"),
|
|
88
88
|
close: !0,
|
|
89
89
|
variant: "destructive"
|
|
90
90
|
},
|
|
91
91
|
secondaryActions: {
|
|
92
|
-
text:
|
|
92
|
+
text: I("common.cancel"),
|
|
93
93
|
close: !0
|
|
94
94
|
}
|
|
95
|
-
}).onPrimary(() =>
|
|
95
|
+
}).onPrimary(() => u(a));
|
|
96
96
|
}
|
|
97
97
|
return {
|
|
98
|
-
createIngredient:
|
|
99
|
-
updateIngredient:
|
|
100
|
-
deleteIngredient:
|
|
101
|
-
ingredientDialogProps:
|
|
102
|
-
ingredientViewLoading:
|
|
98
|
+
createIngredient: P,
|
|
99
|
+
updateIngredient: o,
|
|
100
|
+
deleteIngredient: p,
|
|
101
|
+
ingredientDialogProps: E,
|
|
102
|
+
ingredientViewLoading: h
|
|
103
103
|
};
|
|
104
104
|
}), wn = {
|
|
105
105
|
key: 0,
|
|
@@ -118,109 +118,109 @@ const qe = Jt("ingredientForm", function() {
|
|
|
118
118
|
itemCode: {}
|
|
119
119
|
},
|
|
120
120
|
setup(W) {
|
|
121
|
-
const
|
|
121
|
+
const r = W, { t: k } = ve(), d = Ke(), h = Ae(), I = B(!1), E = b(() => {
|
|
122
122
|
var m;
|
|
123
|
-
return ((m =
|
|
124
|
-
}),
|
|
123
|
+
return ((m = d.sessionUser.value) == null ? void 0 : m.role.isAdmin) ?? !1;
|
|
124
|
+
}), P = b(() => h.getSkuSubsidiaries(r.skuId)), o = b(() => {
|
|
125
125
|
const m = /* @__PURE__ */ new Set();
|
|
126
|
-
function
|
|
127
|
-
for (const
|
|
128
|
-
|
|
126
|
+
function f(A) {
|
|
127
|
+
for (const v of A)
|
|
128
|
+
v.isAssigned && (m.add(v.id), P.value.includeChildren && w(v)), v.children && v.children.length > 0 && f(v.children);
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
if (
|
|
132
|
-
for (const
|
|
133
|
-
m.add(
|
|
130
|
+
function w(A) {
|
|
131
|
+
if (A.children)
|
|
132
|
+
for (const v of A.children)
|
|
133
|
+
m.add(v.id), w(v);
|
|
134
134
|
}
|
|
135
|
-
return
|
|
135
|
+
return f(P.value.subsidiaryTree), m;
|
|
136
136
|
});
|
|
137
|
-
function
|
|
138
|
-
const
|
|
139
|
-
return m.forEach((
|
|
140
|
-
const D = N === m.length - 1, fe = [...
|
|
137
|
+
function u(m, f = [], w = !1) {
|
|
138
|
+
const A = [];
|
|
139
|
+
return m.forEach((v, N) => {
|
|
140
|
+
const D = N === m.length - 1, fe = [...f, D];
|
|
141
141
|
let ne = "";
|
|
142
|
-
for (let ee = 0; ee <
|
|
143
|
-
ne +=
|
|
142
|
+
for (let ee = 0; ee < f.length; ee++)
|
|
143
|
+
ne += f[ee] ? " " : "│ ";
|
|
144
144
|
ne += D ? "└── " : "├── ";
|
|
145
|
-
const ce =
|
|
146
|
-
if (
|
|
147
|
-
id:
|
|
148
|
-
name:
|
|
149
|
-
prefix:
|
|
145
|
+
const ce = o.value.has(v.id), oe = v.isAssigned === !0, le = w && !oe;
|
|
146
|
+
if (A.push({
|
|
147
|
+
id: v.id,
|
|
148
|
+
name: v.name,
|
|
149
|
+
prefix: f.length === 0 ? "" : ne,
|
|
150
150
|
isHighlighted: ce,
|
|
151
151
|
isDirectlyBound: oe,
|
|
152
152
|
isParentIncludedChild: le,
|
|
153
|
-
isRoot:
|
|
154
|
-
}),
|
|
155
|
-
const ee =
|
|
156
|
-
|
|
153
|
+
isRoot: f.length === 0
|
|
154
|
+
}), v.children && v.children.length > 0) {
|
|
155
|
+
const ee = w || oe && P.value.includeChildren;
|
|
156
|
+
A.push(...u(v.children, fe, ee));
|
|
157
157
|
}
|
|
158
|
-
}),
|
|
158
|
+
}), A;
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
const
|
|
162
|
-
for (const
|
|
163
|
-
const
|
|
164
|
-
|
|
160
|
+
function p(m, f = []) {
|
|
161
|
+
const w = /* @__PURE__ */ new Set();
|
|
162
|
+
for (const A of m) {
|
|
163
|
+
const v = [...f, A.id];
|
|
164
|
+
A.isAssigned === !0 && v.forEach((N) => w.add(N)), A.children && A.children.length > 0 && p(A.children, v).forEach((D) => w.add(D));
|
|
165
165
|
}
|
|
166
|
-
return
|
|
166
|
+
return w;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
return m.map((
|
|
170
|
-
...
|
|
168
|
+
function a(m, f) {
|
|
169
|
+
return m.map((w) => f.has(w.id) || w.isAssigned === !0 ? {
|
|
170
|
+
...w,
|
|
171
171
|
// Recursively filter children
|
|
172
|
-
children:
|
|
172
|
+
children: w.children ? a(w.children, f) : []
|
|
173
173
|
} : null).filter(Boolean);
|
|
174
174
|
}
|
|
175
|
-
const
|
|
176
|
-
let m =
|
|
177
|
-
if ((!m || m.length === 0) && (m =
|
|
178
|
-
const
|
|
179
|
-
m =
|
|
175
|
+
const i = b(() => {
|
|
176
|
+
let m = P.value.subsidiaryTree;
|
|
177
|
+
if ((!m || m.length === 0) && (m = h.getBusinessSubsidiaryTree()), !E.value) {
|
|
178
|
+
const f = p(m);
|
|
179
|
+
m = a(m, f);
|
|
180
180
|
}
|
|
181
|
-
return
|
|
181
|
+
return u(m, []);
|
|
182
182
|
});
|
|
183
|
-
return (m,
|
|
184
|
-
const
|
|
185
|
-
return
|
|
186
|
-
l(
|
|
187
|
-
|
|
183
|
+
return (m, f) => {
|
|
184
|
+
const w = C("FmButton"), A = C("FmDialog");
|
|
185
|
+
return c(), T(X, null, [
|
|
186
|
+
l(h).isEnabled ? (c(), T("div", wn, [
|
|
187
|
+
s(w, {
|
|
188
188
|
"prepend-icon": "info",
|
|
189
189
|
variant: "tertiary",
|
|
190
|
-
onClick:
|
|
190
|
+
onClick: f[0] || (f[0] = Bt((v) => I.value = !0, ["stop"]))
|
|
191
191
|
})
|
|
192
192
|
])) : L("", !0),
|
|
193
|
-
|
|
194
|
-
modelValue:
|
|
195
|
-
"onUpdate:modelValue":
|
|
193
|
+
s(A, {
|
|
194
|
+
modelValue: I.value,
|
|
195
|
+
"onUpdate:modelValue": f[1] || (f[1] = (v) => I.value = v),
|
|
196
196
|
"close-button": "",
|
|
197
197
|
dismissAway: ""
|
|
198
198
|
}, {
|
|
199
|
-
"dialog-header":
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
"dialog-header": g(() => [
|
|
200
|
+
n("div", Vn, [
|
|
201
|
+
n("div", In, F(l(k)("inventory.integration.netsuite.subsidiaryHierarchy.title")), 1),
|
|
202
|
+
n("p", Sn, " Name: " + F(r.itemName), 1),
|
|
203
|
+
n("p", Cn, " Code: " + F(r.itemCode), 1),
|
|
204
|
+
E.value ? (c(), T("p", Fn, " All subsidiaries are shown since you are an admin. ")) : (c(), T("p", An, " Only showing subsidiaries in your business path and bound subsidiaries. ")),
|
|
205
|
+
n("div", En, [
|
|
206
|
+
n("div", $n, [
|
|
207
|
+
f[2] || (f[2] = n("span", { class: "font-semibold" }, "Include Children Subsidiaries:", -1)),
|
|
208
|
+
n("span", {
|
|
209
209
|
class: te(
|
|
210
|
-
|
|
210
|
+
P.value.includeChildren ? "text-green-600 font-semibold" : "text-red-600 font-semibold"
|
|
211
211
|
)
|
|
212
|
-
},
|
|
212
|
+
}, F(P.value.includeChildren ? "Yes" : "No"), 3)
|
|
213
213
|
]),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
n("div", Mn, [
|
|
215
|
+
f[4] || (f[4] = n("div", { class: "flex items-center gap-2 px-2 py-1 bg-fm-color-bg-brand-secondary rounded-md" }, [
|
|
216
|
+
n("span", { class: "w-3 h-3 rounded-sm bg-green-400" }),
|
|
217
|
+
n("span", { class: "fm-typo-en-body-sm-400" }, "Directly Bound")
|
|
218
218
|
], -1)),
|
|
219
|
-
|
|
220
|
-
default:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
219
|
+
s(Re, null, {
|
|
220
|
+
default: g(() => f[3] || (f[3] = [
|
|
221
|
+
n("div", { class: "flex items-center gap-2 px-2 py-1 rounded-md" }, [
|
|
222
|
+
n("span", { class: "w-3 h-3 rounded-sm bg-blue-400" }),
|
|
223
|
+
n("span", { class: "fm-typo-en-body-sm-400" }, "Included as Child")
|
|
224
224
|
], -1)
|
|
225
225
|
])),
|
|
226
226
|
_: 1
|
|
@@ -229,36 +229,36 @@ const qe = Jt("ingredientForm", function() {
|
|
|
229
229
|
])
|
|
230
230
|
])
|
|
231
231
|
]),
|
|
232
|
-
default:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
(
|
|
236
|
-
key:
|
|
232
|
+
default: g(() => [
|
|
233
|
+
n("div", Un, [
|
|
234
|
+
n("div", Pn, [
|
|
235
|
+
(c(!0), T(X, null, ue(i.value, (v) => (c(), T("div", {
|
|
236
|
+
key: v.id,
|
|
237
237
|
class: "flex items-stretch"
|
|
238
238
|
}, [
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
n("span", Rn, F(v.prefix), 1),
|
|
240
|
+
v.isParentIncludedChild ? (c(), O(Re, {
|
|
241
241
|
key: 0,
|
|
242
242
|
class: "flex-1"
|
|
243
243
|
}, {
|
|
244
|
-
default:
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
default: g(() => [
|
|
245
|
+
n("div", Bn, [
|
|
246
|
+
n("span", Dn, F(v.name), 1)
|
|
247
247
|
])
|
|
248
248
|
]),
|
|
249
249
|
_: 2
|
|
250
|
-
}, 1024)) : (
|
|
250
|
+
}, 1024)) : (c(), T("div", {
|
|
251
251
|
key: 1,
|
|
252
252
|
class: te([
|
|
253
253
|
"px-2 py-1 rounded-md flex-1",
|
|
254
|
-
|
|
254
|
+
v.isDirectlyBound ? "border-2 bg-green-200 border-green-400" : "bg-fm-color-bg-primary border border-fm-color-border-secondary"
|
|
255
255
|
])
|
|
256
256
|
}, [
|
|
257
|
-
|
|
257
|
+
n("span", {
|
|
258
258
|
class: te([
|
|
259
|
-
|
|
259
|
+
v.isHighlighted ? "fm-typo-en-body-md-600 text-fm-color-typo-primary" : "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
|
|
260
260
|
])
|
|
261
|
-
},
|
|
261
|
+
}, F(v.name), 3)
|
|
262
262
|
], 2))
|
|
263
263
|
]))), 128))
|
|
264
264
|
])
|
|
@@ -271,38 +271,44 @@ const qe = Jt("ingredientForm", function() {
|
|
|
271
271
|
}
|
|
272
272
|
});
|
|
273
273
|
function Nn() {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
await W(c);
|
|
274
|
+
var o;
|
|
275
|
+
const { updateIngredient: W, deleteIngredient: r } = He(), k = Ce(), d = Ae(), { t: h } = ve(), I = Ke();
|
|
276
|
+
async function E(u, p) {
|
|
277
|
+
const a = wt(p);
|
|
278
|
+
if (u === Me.Edit) {
|
|
279
|
+
await W(a);
|
|
281
280
|
return;
|
|
282
281
|
}
|
|
283
|
-
if (
|
|
284
|
-
await
|
|
282
|
+
if (u === Me.Delete) {
|
|
283
|
+
await r(a);
|
|
285
284
|
return;
|
|
286
285
|
}
|
|
287
286
|
}
|
|
288
287
|
return { columnDefs: [
|
|
288
|
+
...(o = I.sessionUser.value) != null && o.role.isAdmin ? [
|
|
289
|
+
{
|
|
290
|
+
accessorKey: "_id",
|
|
291
|
+
header: () => Q(Re, {}, () => "ID"),
|
|
292
|
+
size: 200
|
|
293
|
+
}
|
|
294
|
+
] : [],
|
|
289
295
|
{
|
|
290
296
|
accessorKey: "code",
|
|
291
|
-
header: () =>
|
|
297
|
+
header: () => h("inventory.ingredient.code"),
|
|
292
298
|
enableSorting: !0,
|
|
293
299
|
size: 200
|
|
294
300
|
},
|
|
295
301
|
{
|
|
296
302
|
accessorKey: "name",
|
|
297
|
-
header: () =>
|
|
303
|
+
header: () => h("inventory.ingredient.name"),
|
|
298
304
|
enableSorting: !0,
|
|
299
305
|
size: 300,
|
|
300
|
-
cell(
|
|
301
|
-
const
|
|
302
|
-
(
|
|
306
|
+
cell(u) {
|
|
307
|
+
const p = u.row.original, a = k.skuBindingFlattenCache[p._id], i = a == null ? void 0 : a.inventoryBindings.some(
|
|
308
|
+
(m) => "error" in m && m.reason === "circularDependency"
|
|
303
309
|
);
|
|
304
310
|
return Q("div", { class: "flex items-center w-full gap-4" }, [
|
|
305
|
-
|
|
311
|
+
i ? Q(
|
|
306
312
|
Oe.FmTooltip,
|
|
307
313
|
{ class: "text-left" },
|
|
308
314
|
{
|
|
@@ -314,29 +320,29 @@ function Nn() {
|
|
|
314
320
|
});
|
|
315
321
|
},
|
|
316
322
|
content() {
|
|
317
|
-
return
|
|
323
|
+
return h("inventory.inventoryBindings.circularError");
|
|
318
324
|
}
|
|
319
325
|
}
|
|
320
326
|
) : null,
|
|
321
|
-
|
|
327
|
+
p.name
|
|
322
328
|
]);
|
|
323
329
|
}
|
|
324
330
|
},
|
|
325
331
|
{
|
|
326
332
|
id: "unit",
|
|
327
|
-
header: () =>
|
|
328
|
-
accessorFn: (
|
|
329
|
-
cell(
|
|
330
|
-
const
|
|
333
|
+
header: () => h("inventory.ingredient.unit"),
|
|
334
|
+
accessorFn: (u) => xt(u),
|
|
335
|
+
cell(u) {
|
|
336
|
+
const p = u.row.original, a = xt(p);
|
|
331
337
|
return Q(
|
|
332
338
|
Oe.FmTooltip,
|
|
333
|
-
{ zIndex: 51, content:
|
|
339
|
+
{ zIndex: 51, content: a },
|
|
334
340
|
Q(
|
|
335
341
|
"span",
|
|
336
342
|
{
|
|
337
343
|
class: "flex-auto line-clamp-2 text-ellipsis break-all"
|
|
338
344
|
},
|
|
339
|
-
|
|
345
|
+
a
|
|
340
346
|
)
|
|
341
347
|
);
|
|
342
348
|
},
|
|
@@ -345,37 +351,37 @@ function Nn() {
|
|
|
345
351
|
},
|
|
346
352
|
{
|
|
347
353
|
accessorKey: "isInactive",
|
|
348
|
-
header: () =>
|
|
349
|
-
cell(
|
|
350
|
-
const
|
|
354
|
+
header: () => h("inventory.ingredient.status.title"),
|
|
355
|
+
cell(u) {
|
|
356
|
+
const p = u.row.original.isInactive;
|
|
351
357
|
return Q(
|
|
352
358
|
"span",
|
|
353
359
|
{
|
|
354
360
|
class: [
|
|
355
361
|
"inline-block px-3 py-1 rounded-full text-xs font-semibold",
|
|
356
|
-
|
|
362
|
+
p ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
|
|
357
363
|
].join(" ")
|
|
358
364
|
},
|
|
359
|
-
|
|
365
|
+
h(p ? "inventory.ingredient.status.inactive" : "inventory.ingredient.status.active")
|
|
360
366
|
);
|
|
361
367
|
},
|
|
362
368
|
enableSorting: !0
|
|
363
369
|
},
|
|
364
370
|
{
|
|
365
371
|
id: "netsuiteSubsidiary",
|
|
366
|
-
accessorFn: (
|
|
372
|
+
accessorFn: (u) => d.getSkuSubsidiaries(u._id),
|
|
367
373
|
header: () => "NetSuite Subsidiary",
|
|
368
|
-
cell(
|
|
369
|
-
const
|
|
374
|
+
cell(u) {
|
|
375
|
+
const p = u.row.original, { flattenedSubsidiaryNames: a } = d.getSkuSubsidiaries(p._id);
|
|
370
376
|
return Q("div", { class: "flex gap-2 items-start" }, [
|
|
371
377
|
Q(
|
|
372
378
|
"span",
|
|
373
379
|
{
|
|
374
380
|
class: "flex-1 line-clamp-2 text-ellipsis break-all whitespace-pre-wrap"
|
|
375
381
|
},
|
|
376
|
-
|
|
382
|
+
a.join(", ")
|
|
377
383
|
),
|
|
378
|
-
Q(On, { skuId:
|
|
384
|
+
Q(On, { skuId: p._id, itemName: p.name, itemCode: p.code })
|
|
379
385
|
]);
|
|
380
386
|
},
|
|
381
387
|
enableSorting: !1,
|
|
@@ -384,11 +390,11 @@ function Nn() {
|
|
|
384
390
|
{
|
|
385
391
|
id: "action",
|
|
386
392
|
header: "",
|
|
387
|
-
cell(
|
|
393
|
+
cell(u) {
|
|
388
394
|
return Xt(
|
|
389
|
-
[
|
|
390
|
-
(
|
|
391
|
-
|
|
395
|
+
[ht[Me.Edit], ht[Me.Delete]],
|
|
396
|
+
(p) => {
|
|
397
|
+
E(p, u.row.original);
|
|
392
398
|
}
|
|
393
399
|
);
|
|
394
400
|
},
|
|
@@ -401,12 +407,12 @@ function Nn() {
|
|
|
401
407
|
}
|
|
402
408
|
] };
|
|
403
409
|
}
|
|
404
|
-
function
|
|
405
|
-
var
|
|
410
|
+
function xt(W) {
|
|
411
|
+
var r;
|
|
406
412
|
if (W.trackingMeasurement) {
|
|
407
|
-
const
|
|
408
|
-
if (
|
|
409
|
-
return `${
|
|
413
|
+
const k = (r = W.unit.measurements) == null ? void 0 : r.find((d) => d.id === W.trackingMeasurement);
|
|
414
|
+
if (k)
|
|
415
|
+
return `${k.name} (${k.abbrev})`;
|
|
410
416
|
}
|
|
411
417
|
return `${W.unit.name} (${W.unit.abbrev})`;
|
|
412
418
|
}
|
|
@@ -419,72 +425,72 @@ const zn = /* @__PURE__ */ pe({
|
|
|
419
425
|
readonly: { type: Boolean }
|
|
420
426
|
},
|
|
421
427
|
emits: ["update:modelValue"],
|
|
422
|
-
setup(W, { emit:
|
|
423
|
-
const
|
|
424
|
-
var
|
|
425
|
-
return (
|
|
426
|
-
}),
|
|
427
|
-
var
|
|
428
|
-
return (
|
|
429
|
-
}),
|
|
428
|
+
setup(W, { emit: r }) {
|
|
429
|
+
const k = W, d = b(() => {
|
|
430
|
+
var i;
|
|
431
|
+
return (i = k.rootValue) == null ? void 0 : i.unit;
|
|
432
|
+
}), h = b(() => {
|
|
433
|
+
var i;
|
|
434
|
+
return (i = k.rootValue) == null ? void 0 : i._id;
|
|
435
|
+
}), I = r, { t: E } = ve(), P = b({
|
|
430
436
|
get() {
|
|
431
|
-
return !!
|
|
437
|
+
return !!k.modelValue;
|
|
432
438
|
},
|
|
433
|
-
set(
|
|
434
|
-
|
|
439
|
+
set(i) {
|
|
440
|
+
i ? I("update:modelValue", {
|
|
435
441
|
measurement: null,
|
|
436
442
|
inventoryBindings: []
|
|
437
|
-
}) :
|
|
443
|
+
}) : I("update:modelValue", null);
|
|
438
444
|
}
|
|
439
|
-
}),
|
|
440
|
-
function
|
|
441
|
-
const m =
|
|
442
|
-
m.measurement =
|
|
445
|
+
}), o = b(() => un(d.value));
|
|
446
|
+
function u(i) {
|
|
447
|
+
const m = k.modelValue ?? {};
|
|
448
|
+
m.measurement = i ? `${i}` : null, I("update:modelValue", m);
|
|
443
449
|
}
|
|
444
|
-
function
|
|
445
|
-
const m =
|
|
446
|
-
m.inventoryBindings =
|
|
450
|
+
function p(i) {
|
|
451
|
+
const m = k.modelValue ?? {};
|
|
452
|
+
m.inventoryBindings = i, I("update:modelValue", m);
|
|
447
453
|
}
|
|
448
|
-
const
|
|
449
|
-
if (!
|
|
450
|
-
const
|
|
451
|
-
return
|
|
454
|
+
const a = b(() => {
|
|
455
|
+
if (!k.modelValue) return null;
|
|
456
|
+
const i = k.modelValue;
|
|
457
|
+
return i.measurement ? o.value.find((m) => m.value === i.measurement) ?? null : o.value.find((m) => m.value === null) ?? null;
|
|
452
458
|
});
|
|
453
|
-
return (
|
|
454
|
-
const
|
|
455
|
-
return
|
|
459
|
+
return (i, m) => {
|
|
460
|
+
const f = C("FmSwitch"), w = C("FmSelect"), A = C("FmCard");
|
|
461
|
+
return c(), O(A, {
|
|
456
462
|
variant: "outlined",
|
|
457
463
|
class: "p-16 flex flex-col gap-16"
|
|
458
464
|
}, {
|
|
459
|
-
default:
|
|
460
|
-
var
|
|
465
|
+
default: g(() => {
|
|
466
|
+
var v, N;
|
|
461
467
|
return [
|
|
462
|
-
|
|
468
|
+
s(f, {
|
|
463
469
|
value: "",
|
|
464
|
-
"model-value":
|
|
465
|
-
"onUpdate:modelValue": m[0] || (m[0] = (D) =>
|
|
466
|
-
label: l(
|
|
467
|
-
sublabel: l(
|
|
470
|
+
"model-value": P.value,
|
|
471
|
+
"onUpdate:modelValue": m[0] || (m[0] = (D) => P.value = D),
|
|
472
|
+
label: l(E)("inventory.ingredient.convertible.title"),
|
|
473
|
+
sublabel: l(E)("inventory.ingredient.convertible.subtitle"),
|
|
468
474
|
labelPlacement: "right",
|
|
469
|
-
disabled:
|
|
475
|
+
disabled: i.readonly
|
|
470
476
|
}, null, 8, ["model-value", "label", "sublabel", "disabled"]),
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
label: l(
|
|
475
|
-
modelValue: (
|
|
476
|
-
"onUpdate:modelValue":
|
|
477
|
-
items:
|
|
478
|
-
disabled:
|
|
477
|
+
P.value ? (c(), T(X, { key: 0 }, [
|
|
478
|
+
n("div", null, [
|
|
479
|
+
s(w, {
|
|
480
|
+
label: l(E)("inventory.ingredient.convertible.convertTo"),
|
|
481
|
+
modelValue: (v = a.value) == null ? void 0 : v.value,
|
|
482
|
+
"onUpdate:modelValue": u,
|
|
483
|
+
items: o.value,
|
|
484
|
+
disabled: i.readonly
|
|
479
485
|
}, null, 8, ["label", "modelValue", "items", "disabled"])
|
|
480
486
|
]),
|
|
481
|
-
|
|
482
|
-
id:
|
|
483
|
-
"model-value": ((N =
|
|
484
|
-
"onUpdate:modelValue":
|
|
485
|
-
"exclude-binding-id":
|
|
487
|
+
s(mn, {
|
|
488
|
+
id: h.value,
|
|
489
|
+
"model-value": ((N = i.modelValue) == null ? void 0 : N.inventoryBindings) ?? [],
|
|
490
|
+
"onUpdate:modelValue": p,
|
|
491
|
+
"exclude-binding-id": h.value,
|
|
486
492
|
rules: [l(Pe)(1)],
|
|
487
|
-
readonly:
|
|
493
|
+
readonly: i.readonly
|
|
488
494
|
}, null, 8, ["id", "model-value", "exclude-binding-id", "rules", "readonly"])
|
|
489
495
|
], 64)) : L("", !0)
|
|
490
496
|
];
|
|
@@ -510,71 +516,71 @@ const zn = /* @__PURE__ */ pe({
|
|
|
510
516
|
appendText: {}
|
|
511
517
|
},
|
|
512
518
|
setup(W) {
|
|
513
|
-
return (
|
|
514
|
-
const
|
|
515
|
-
return
|
|
516
|
-
xe(
|
|
517
|
-
|
|
518
|
-
label:
|
|
519
|
-
disabled:
|
|
519
|
+
return (r, k) => {
|
|
520
|
+
const d = C("FmLabel"), h = C("FmIcon"), I = C("FmTooltip"), E = C("FmField");
|
|
521
|
+
return r.locked ? (c(), T("div", Ln, [
|
|
522
|
+
xe(r.$slots, "label", {}, () => [
|
|
523
|
+
s(d, {
|
|
524
|
+
label: r.label,
|
|
525
|
+
disabled: r.disabled
|
|
520
526
|
}, null, 8, ["label", "disabled"])
|
|
521
527
|
]),
|
|
522
|
-
xe(
|
|
523
|
-
|
|
524
|
-
prepend:
|
|
525
|
-
|
|
528
|
+
xe(r.$slots, "field", {}, () => [
|
|
529
|
+
s(E, { disabled: r.disabled }, qe({
|
|
530
|
+
prepend: g(() => [
|
|
531
|
+
r.tooltipMessage ? (c(), O(I, {
|
|
526
532
|
key: 0,
|
|
527
|
-
placement:
|
|
528
|
-
"z-index":
|
|
533
|
+
placement: r.tooltipPlacement,
|
|
534
|
+
"z-index": r.tooltipZIndex
|
|
529
535
|
}, {
|
|
530
|
-
content:
|
|
531
|
-
|
|
536
|
+
content: g(() => [
|
|
537
|
+
Ye(F(r.tooltipMessage), 1)
|
|
532
538
|
]),
|
|
533
|
-
default:
|
|
534
|
-
|
|
539
|
+
default: g(() => [
|
|
540
|
+
s(h, {
|
|
535
541
|
name: "lock",
|
|
536
542
|
color: "neutral-gray-400"
|
|
537
543
|
})
|
|
538
544
|
]),
|
|
539
545
|
_: 1
|
|
540
|
-
}, 8, ["placement", "z-index"])) : (
|
|
546
|
+
}, 8, ["placement", "z-index"])) : (c(), O(h, {
|
|
541
547
|
key: 1,
|
|
542
548
|
name: "lock",
|
|
543
549
|
color: "neutral-gray-400"
|
|
544
550
|
}))
|
|
545
551
|
]),
|
|
546
|
-
default:
|
|
547
|
-
xe(
|
|
548
|
-
|
|
552
|
+
default: g(() => [
|
|
553
|
+
xe(r.$slots, "modelValue", {}, () => [
|
|
554
|
+
n("div", {
|
|
549
555
|
class: te([
|
|
550
|
-
|
|
556
|
+
r.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary",
|
|
551
557
|
"line-clamp-1 text-ellipsis break-all"
|
|
552
558
|
])
|
|
553
|
-
},
|
|
559
|
+
}, F(r.modelValue), 3)
|
|
554
560
|
])
|
|
555
561
|
]),
|
|
556
562
|
_: 2
|
|
557
563
|
}, [
|
|
558
|
-
|
|
564
|
+
r.appendText || r.$slots.fieldAppend ? {
|
|
559
565
|
name: "append",
|
|
560
|
-
fn:
|
|
561
|
-
xe(
|
|
562
|
-
|
|
566
|
+
fn: g(() => [
|
|
567
|
+
xe(r.$slots, "fieldAppend", {}, () => [
|
|
568
|
+
n("div", jn, F(r.appendText), 1)
|
|
563
569
|
])
|
|
564
570
|
]),
|
|
565
571
|
key: "0"
|
|
566
572
|
} : void 0
|
|
567
573
|
]), 1032, ["disabled"])
|
|
568
574
|
]),
|
|
569
|
-
xe(
|
|
570
|
-
|
|
575
|
+
xe(r.$slots, "helper-text", {}, () => [
|
|
576
|
+
n("div", {
|
|
571
577
|
class: te([
|
|
572
578
|
"fm-typo-en-body-sm-400 line-clamp-1",
|
|
573
|
-
|
|
579
|
+
r.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
574
580
|
])
|
|
575
|
-
},
|
|
581
|
+
}, F(r.helperText), 3)
|
|
576
582
|
])
|
|
577
|
-
])) : xe(
|
|
583
|
+
])) : xe(r.$slots, "default", { key: 1 });
|
|
578
584
|
};
|
|
579
585
|
}
|
|
580
586
|
}), Wn = { class: "flex gap-8" }, Hn = { class: "flex-1" }, qn = { class: "flex-1" }, Yn = { class: "flex flex-col gap-5" }, Gn = { class: "text-fm-color-typo-secondary" }, Kn = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Zn = {
|
|
@@ -603,7 +609,7 @@ const zn = /* @__PURE__ */ pe({
|
|
|
603
609
|
class: "flex flex-col gap-8"
|
|
604
610
|
}, Oo = { class: "flex flex-wrap gap-8" }, No = /* @__PURE__ */ pe({
|
|
605
611
|
__name: "IngredientForm",
|
|
606
|
-
props: /* @__PURE__ */
|
|
612
|
+
props: /* @__PURE__ */ dt({
|
|
607
613
|
mode: {},
|
|
608
614
|
modelValue: {},
|
|
609
615
|
disabled: { type: Boolean },
|
|
@@ -614,34 +620,34 @@ const zn = /* @__PURE__ */ pe({
|
|
|
614
620
|
search: {},
|
|
615
621
|
searchModifiers: {}
|
|
616
622
|
}),
|
|
617
|
-
emits: /* @__PURE__ */
|
|
618
|
-
setup(W, { expose:
|
|
619
|
-
var
|
|
620
|
-
const { t:
|
|
623
|
+
emits: /* @__PURE__ */ dt(["update:modelValue", "click:submit", "update:purchaseOrderTemplateIds", "update:wastageTemplateIds", "update:closingTemplateIds"], ["update:search"]),
|
|
624
|
+
setup(W, { expose: r, emit: k }) {
|
|
625
|
+
var tt;
|
|
626
|
+
const { t: d } = ve(), h = Ge();
|
|
621
627
|
Fe();
|
|
622
|
-
const
|
|
628
|
+
const I = It(), E = St(), P = Ct(), o = W, u = k, p = Ce(), a = Ke(), i = Vt(), m = Ae(), f = b(() => m.isEnabled);
|
|
623
629
|
B(void 0);
|
|
624
|
-
const
|
|
630
|
+
const w = B([]), A = B([]), v = B([]), N = B(!1);
|
|
625
631
|
function D(e) {
|
|
626
632
|
if (e.length === 0) return;
|
|
627
|
-
const t = e[0], x =
|
|
628
|
-
unit:
|
|
633
|
+
const t = e[0], x = o.modelValue ?? {
|
|
634
|
+
unit: p.units.find((S) => S)
|
|
629
635
|
};
|
|
630
|
-
x.unit || (x.unit = t,
|
|
636
|
+
x.unit || (x.unit = t, u("update:modelValue", x));
|
|
631
637
|
}
|
|
632
638
|
Dt(() => {
|
|
633
|
-
D(
|
|
634
|
-
}),
|
|
639
|
+
D(p.units), o.mode === H.CREATE && (i.mustUsePoTemplate && ne(), i.enableWastageTemplate && ce(), i.enableClosingTemplate && oe());
|
|
640
|
+
}), Tt([() => p.units], ([e]) => {
|
|
635
641
|
D(e);
|
|
636
642
|
});
|
|
637
643
|
function fe() {
|
|
638
|
-
|
|
644
|
+
u("click:submit");
|
|
639
645
|
}
|
|
640
646
|
async function ne() {
|
|
641
|
-
|
|
647
|
+
w.value = [], N.value = !0;
|
|
642
648
|
try {
|
|
643
|
-
const [e] = await Promise.all([
|
|
644
|
-
|
|
649
|
+
const [e] = await Promise.all([I.readTemplates()]).delayed(1e3);
|
|
650
|
+
w.value = e;
|
|
645
651
|
} catch (e) {
|
|
646
652
|
console.log("Something went wrong when fetching templates:", e);
|
|
647
653
|
} finally {
|
|
@@ -649,12 +655,12 @@ const zn = /* @__PURE__ */ pe({
|
|
|
649
655
|
}
|
|
650
656
|
}
|
|
651
657
|
async function ce() {
|
|
652
|
-
|
|
658
|
+
A.value = [], N.value = !0;
|
|
653
659
|
try {
|
|
654
|
-
const [e] = await Promise.all([
|
|
660
|
+
const [e] = await Promise.all([E.readTemplates()]).delayed(
|
|
655
661
|
1e3
|
|
656
662
|
);
|
|
657
|
-
|
|
663
|
+
A.value = e;
|
|
658
664
|
} catch (e) {
|
|
659
665
|
console.log("Something went wrong when fetching wastage templates:", e);
|
|
660
666
|
} finally {
|
|
@@ -662,92 +668,92 @@ const zn = /* @__PURE__ */ pe({
|
|
|
662
668
|
}
|
|
663
669
|
}
|
|
664
670
|
async function oe() {
|
|
665
|
-
|
|
671
|
+
v.value = [], N.value = !0;
|
|
666
672
|
try {
|
|
667
|
-
const [e] = await Promise.all([
|
|
673
|
+
const [e] = await Promise.all([P.readTemplates()]).delayed(
|
|
668
674
|
1e3
|
|
669
675
|
);
|
|
670
|
-
|
|
676
|
+
v.value = e;
|
|
671
677
|
} catch (e) {
|
|
672
678
|
console.log("Something went wrong when fetching closing templates:", e);
|
|
673
679
|
} finally {
|
|
674
680
|
N.value = !1;
|
|
675
681
|
}
|
|
676
682
|
}
|
|
677
|
-
const le =
|
|
683
|
+
const le = b({
|
|
678
684
|
get() {
|
|
679
685
|
var e;
|
|
680
|
-
return ((e =
|
|
686
|
+
return ((e = o.modelValue) == null ? void 0 : e.code) ?? "";
|
|
681
687
|
},
|
|
682
688
|
set(e) {
|
|
683
|
-
const t =
|
|
684
|
-
...
|
|
689
|
+
const t = o.modelValue ? {
|
|
690
|
+
...o.modelValue
|
|
685
691
|
} : {};
|
|
686
|
-
t.code = e,
|
|
692
|
+
t.code = e, u("update:modelValue", t);
|
|
687
693
|
}
|
|
688
|
-
}), ee =
|
|
694
|
+
}), ee = b({
|
|
689
695
|
get() {
|
|
690
696
|
var e;
|
|
691
|
-
return ((e =
|
|
697
|
+
return ((e = o.modelValue) == null ? void 0 : e.isInactive) ?? !1;
|
|
692
698
|
},
|
|
693
699
|
set(e) {
|
|
694
|
-
const t =
|
|
695
|
-
...
|
|
700
|
+
const t = o.modelValue ? {
|
|
701
|
+
...o.modelValue
|
|
696
702
|
} : {};
|
|
697
|
-
t.isInactive = e,
|
|
703
|
+
t.isInactive = e, u("update:modelValue", t);
|
|
698
704
|
}
|
|
699
|
-
}), ae =
|
|
705
|
+
}), ae = b({
|
|
700
706
|
get() {
|
|
701
707
|
var e;
|
|
702
|
-
return ((e =
|
|
708
|
+
return ((e = o.modelValue) == null ? void 0 : e.name) ?? "";
|
|
703
709
|
},
|
|
704
710
|
set(e) {
|
|
705
|
-
const t =
|
|
706
|
-
...
|
|
711
|
+
const t = o.modelValue ? {
|
|
712
|
+
...o.modelValue
|
|
707
713
|
} : {};
|
|
708
|
-
t.name = e,
|
|
714
|
+
t.name = e, u("update:modelValue", t);
|
|
709
715
|
}
|
|
710
|
-
}), ye =
|
|
716
|
+
}), ye = b({
|
|
711
717
|
get() {
|
|
712
718
|
var t, x;
|
|
713
|
-
const e = (x = (t =
|
|
719
|
+
const e = (x = (t = o.modelValue) == null ? void 0 : t.defaultCost) == null ? void 0 : x.costPerUnit;
|
|
714
720
|
return e ? +ln(e) : 0;
|
|
715
721
|
},
|
|
716
722
|
set(e) {
|
|
717
|
-
var x,
|
|
718
|
-
const t =
|
|
719
|
-
...
|
|
723
|
+
var x, S, Y, z;
|
|
724
|
+
const t = o.modelValue ? {
|
|
725
|
+
...o.modelValue
|
|
720
726
|
} : {};
|
|
721
727
|
t.defaultCost ?? (t.defaultCost = {
|
|
722
728
|
costPerUnit: {
|
|
723
729
|
amount: 0,
|
|
724
730
|
precision: 2,
|
|
725
|
-
currency: ((x =
|
|
731
|
+
currency: ((x = mt(a.currentCountry.value)) == null ? void 0 : x.currency) ?? "MYR"
|
|
726
732
|
},
|
|
727
|
-
measurement: (z = (Y = (
|
|
733
|
+
measurement: (z = (Y = (S = o.modelValue) == null ? void 0 : S.unit) == null ? void 0 : Y.measurements) == null ? void 0 : z.find(
|
|
728
734
|
(re) => {
|
|
729
735
|
var ie;
|
|
730
|
-
return re.id === ((ie =
|
|
736
|
+
return re.id === ((ie = o.modelValue) == null ? void 0 : ie.trackingMeasurement);
|
|
731
737
|
}
|
|
732
738
|
)
|
|
733
739
|
}), t.defaultCost.costPerUnit = {
|
|
734
740
|
...t.defaultCost.costPerUnit,
|
|
735
741
|
...an(+e, 4)
|
|
736
|
-
},
|
|
742
|
+
}, u("update:modelValue", t);
|
|
737
743
|
}
|
|
738
|
-
}), ge =
|
|
739
|
-
var t, x,
|
|
740
|
-
const e = ((t =
|
|
744
|
+
}), ge = b(() => {
|
|
745
|
+
var t, x, S;
|
|
746
|
+
const e = ((t = o.modelValue) == null ? void 0 : t.unit) ?? p.units.find((Y) => Y);
|
|
741
747
|
return e ? {
|
|
742
748
|
_id: e._id,
|
|
743
|
-
measurement: (x =
|
|
744
|
-
name: ((
|
|
749
|
+
measurement: (x = o.modelValue) == null ? void 0 : x.trackingMeasurement,
|
|
750
|
+
name: ((S = e.measurements.find((Y) => {
|
|
745
751
|
var z;
|
|
746
|
-
return Y.id === ((z =
|
|
747
|
-
})) == null ? void 0 :
|
|
752
|
+
return Y.id === ((z = o.modelValue) == null ? void 0 : z.trackingMeasurement);
|
|
753
|
+
})) == null ? void 0 : S.name) ?? e.name
|
|
748
754
|
} : null;
|
|
749
|
-
}), ke =
|
|
750
|
-
() =>
|
|
755
|
+
}), ke = b(
|
|
756
|
+
() => p.units.flatMap(({ name: e, _id: t, abbrev: x, measurements: S }) => [
|
|
751
757
|
{
|
|
752
758
|
label: `${e}`,
|
|
753
759
|
value: null,
|
|
@@ -758,83 +764,83 @@ const zn = /* @__PURE__ */ pe({
|
|
|
758
764
|
value: { _id: t },
|
|
759
765
|
displayAsSection: !1
|
|
760
766
|
},
|
|
761
|
-
...
|
|
767
|
+
...S.map(({ id: Y, name: z, abbrev: re }) => ({
|
|
762
768
|
label: `${z} (${re})`,
|
|
763
769
|
value: { _id: t, measurement: Y },
|
|
764
770
|
displayAsSection: !1
|
|
765
771
|
}))
|
|
766
772
|
])
|
|
767
|
-
),
|
|
773
|
+
), _ = Ot(W, "search"), U = b(
|
|
768
774
|
() => new gn(ke.value, ["label", "value"], {
|
|
769
775
|
caseSensitive: !1,
|
|
770
776
|
sort: !0
|
|
771
777
|
})
|
|
772
|
-
), G =
|
|
778
|
+
), G = b(() => U.value.search(_.value));
|
|
773
779
|
function $(e) {
|
|
774
|
-
var t, x,
|
|
775
|
-
return ((x = (t =
|
|
780
|
+
var t, x, S, Y, z;
|
|
781
|
+
return ((x = (t = o.modelValue) == null ? void 0 : t.unit) == null ? void 0 : x._id) === ((S = e.value) == null ? void 0 : S._id) && ((Y = o.modelValue) == null ? void 0 : Y.trackingMeasurement) === ((z = e.value) == null ? void 0 : z.measurement);
|
|
776
782
|
}
|
|
777
|
-
function
|
|
783
|
+
function y(e) {
|
|
778
784
|
var re, ie;
|
|
779
785
|
if (!e) return;
|
|
780
|
-
const { _id: t, measurement: x } = e,
|
|
786
|
+
const { _id: t, measurement: x } = e, S = x || void 0, Y = p.units.find((Ie) => Ie._id === t);
|
|
781
787
|
if (!Y)
|
|
782
788
|
return;
|
|
783
|
-
const z =
|
|
784
|
-
z.unit = Y, z.trackingMeasurement =
|
|
785
|
-
measurement: Y.measurements.find((Ie) => Ie.id ===
|
|
789
|
+
const z = o.modelValue ?? {};
|
|
790
|
+
z.unit = Y, z.trackingMeasurement = S, z.convert && (z.convert.measurement = S || null), i.enableTotalCost && (z.defaultCost = {
|
|
791
|
+
measurement: Y.measurements.find((Ie) => Ie.id === S),
|
|
786
792
|
costPerUnit: {
|
|
787
793
|
...((re = z.defaultCost) == null ? void 0 : re.costPerUnit) ?? {
|
|
788
794
|
amount: 0,
|
|
789
795
|
precision: 2,
|
|
790
|
-
currency: ((ie =
|
|
796
|
+
currency: ((ie = mt(a.currentCountry.value)) == null ? void 0 : ie.currency) ?? "MYR"
|
|
791
797
|
}
|
|
792
798
|
}
|
|
793
|
-
}),
|
|
799
|
+
}), u("update:modelValue", z);
|
|
794
800
|
}
|
|
795
|
-
const j =
|
|
801
|
+
const j = b({
|
|
796
802
|
get() {
|
|
797
803
|
var e;
|
|
798
|
-
return ((e =
|
|
804
|
+
return ((e = o.modelValue) == null ? void 0 : e.convert) ?? null;
|
|
799
805
|
},
|
|
800
806
|
set(e) {
|
|
801
|
-
const t =
|
|
802
|
-
...
|
|
807
|
+
const t = o.modelValue ? {
|
|
808
|
+
...o.modelValue
|
|
803
809
|
} : {};
|
|
804
|
-
e ? t.convert = e : t.convert = null,
|
|
810
|
+
e ? t.convert = e : t.convert = null, u("update:modelValue", t);
|
|
805
811
|
}
|
|
806
|
-
}), K =
|
|
812
|
+
}), K = b(() => pt.options.filter(
|
|
807
813
|
(e) => (
|
|
808
814
|
// e === F_INVENTORY_VALUATION_METHODS.enum.FIFO ||
|
|
809
|
-
e ===
|
|
815
|
+
e === pt.enum.WAVG
|
|
810
816
|
)
|
|
811
817
|
).map((e) => ({
|
|
812
|
-
label:
|
|
818
|
+
label: d(`inventory.ingredient.valuationMethod.${e}`),
|
|
813
819
|
value: e
|
|
814
|
-
}))), me =
|
|
820
|
+
}))), me = b({
|
|
815
821
|
get() {
|
|
816
822
|
var e;
|
|
817
|
-
return ((e =
|
|
823
|
+
return ((e = o.modelValue) == null ? void 0 : e.valuation) ?? "WAVG";
|
|
818
824
|
},
|
|
819
825
|
set(e) {
|
|
820
|
-
const t =
|
|
821
|
-
...
|
|
826
|
+
const t = o.modelValue ? {
|
|
827
|
+
...o.modelValue
|
|
822
828
|
} : {};
|
|
823
|
-
t.valuation = e,
|
|
829
|
+
t.valuation = e, u("update:modelValue", t);
|
|
824
830
|
}
|
|
825
|
-
}), Z =
|
|
831
|
+
}), Z = b({
|
|
826
832
|
get() {
|
|
827
833
|
var e;
|
|
828
|
-
return ((e =
|
|
834
|
+
return ((e = o.modelValue) == null ? void 0 : e.customAttributes) ?? {};
|
|
829
835
|
},
|
|
830
836
|
set(e) {
|
|
831
|
-
const t =
|
|
832
|
-
...
|
|
837
|
+
const t = o.modelValue ? {
|
|
838
|
+
...o.modelValue
|
|
833
839
|
} : {};
|
|
834
|
-
t.customAttributes = e,
|
|
840
|
+
t.customAttributes = e, u("update:modelValue", t);
|
|
835
841
|
}
|
|
836
842
|
}), M = B();
|
|
837
|
-
|
|
843
|
+
r({
|
|
838
844
|
validateInputs: () => {
|
|
839
845
|
var e, t;
|
|
840
846
|
(t = (e = M.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
|
|
@@ -848,151 +854,151 @@ const zn = /* @__PURE__ */ pe({
|
|
|
848
854
|
(t = (e = M.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
|
|
849
855
|
}
|
|
850
856
|
});
|
|
851
|
-
const R = B(!1), q =
|
|
857
|
+
const R = B(!1), q = b(
|
|
852
858
|
() => {
|
|
853
859
|
var e, t, x;
|
|
854
|
-
return (e =
|
|
855
|
-
(
|
|
860
|
+
return (e = o.modelValue) != null && e._id ? ((x = p.menu.bindedBySkuId[(t = o.modelValue) == null ? void 0 : t._id]) == null ? void 0 : x.filter(
|
|
861
|
+
(S) => S.from === "INGREDIENT"
|
|
856
862
|
)) ?? [] : [];
|
|
857
863
|
}
|
|
858
|
-
), de =
|
|
864
|
+
), de = b(
|
|
859
865
|
() => {
|
|
860
866
|
var e, t, x;
|
|
861
|
-
return (e =
|
|
862
|
-
(
|
|
867
|
+
return (e = o.modelValue) != null && e._id ? ((x = p.menu.bindedBySkuId[(t = o.modelValue) == null ? void 0 : t._id]) == null ? void 0 : x.filter(
|
|
868
|
+
(S) => S.from === "RECIPE"
|
|
863
869
|
)) ?? [] : [];
|
|
864
870
|
}
|
|
865
|
-
), Te =
|
|
871
|
+
), Te = b(
|
|
866
872
|
() => {
|
|
867
873
|
var e, t, x;
|
|
868
|
-
return (e =
|
|
874
|
+
return (e = o.modelValue) != null && e._id ? ((x = p.menu.bindedBySkuId[(t = o.modelValue) == null ? void 0 : t._id]) == null ? void 0 : x.filter((S) => S.from === "MENU")) ?? [] : [];
|
|
869
875
|
}
|
|
870
|
-
), _e =
|
|
871
|
-
() =>
|
|
872
|
-
), Ee = B((
|
|
876
|
+
), _e = b(
|
|
877
|
+
() => p.skus.map((e) => ({ label: e.name, value: e.code }))
|
|
878
|
+
), Ee = B((tt = o.modelValue) == null ? void 0 : tt.code);
|
|
873
879
|
function $e(e) {
|
|
874
880
|
var x;
|
|
875
881
|
const t = e.el;
|
|
876
882
|
t && ((x = t.querySelector("[x-should-scroll-into=true]")) == null || x.scrollIntoView());
|
|
877
883
|
}
|
|
878
|
-
const we =
|
|
884
|
+
const we = b(
|
|
879
885
|
() => {
|
|
880
|
-
var e, t, x,
|
|
881
|
-
return ((
|
|
886
|
+
var e, t, x, S, Y, z;
|
|
887
|
+
return ((S = (x = (t = (e = o.modelValue) == null ? void 0 : e.unit) == null ? void 0 : t.measurements) == null ? void 0 : x.find(
|
|
882
888
|
(re) => {
|
|
883
889
|
var ie;
|
|
884
|
-
return re.id === ((ie =
|
|
890
|
+
return re.id === ((ie = o.modelValue) == null ? void 0 : ie.trackingMeasurement);
|
|
885
891
|
}
|
|
886
|
-
)) == null ? void 0 :
|
|
892
|
+
)) == null ? void 0 : S.abbrev) ?? ((z = (Y = o.modelValue) == null ? void 0 : Y.unit) == null ? void 0 : z.abbrev);
|
|
887
893
|
}
|
|
888
|
-
), be =
|
|
894
|
+
), be = b({
|
|
889
895
|
get() {
|
|
890
896
|
var e, t;
|
|
891
|
-
return ((t = (e =
|
|
897
|
+
return ((t = (e = o.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : t.low) ?? Ue().low;
|
|
892
898
|
},
|
|
893
899
|
set(e) {
|
|
894
|
-
var
|
|
895
|
-
const t = ((
|
|
900
|
+
var S;
|
|
901
|
+
const t = ((S = o.modelValue) == null ? void 0 : S.thresholds) ?? Ue();
|
|
896
902
|
t.low = e;
|
|
897
|
-
const x =
|
|
898
|
-
...
|
|
903
|
+
const x = o.modelValue ? {
|
|
904
|
+
...o.modelValue
|
|
899
905
|
} : {};
|
|
900
|
-
x.thresholds = t,
|
|
906
|
+
x.thresholds = t, u("update:modelValue", x);
|
|
901
907
|
}
|
|
902
|
-
}), se =
|
|
908
|
+
}), se = b({
|
|
903
909
|
get() {
|
|
904
910
|
var e, t;
|
|
905
|
-
return ((t = (e =
|
|
911
|
+
return ((t = (e = o.modelValue) == null ? void 0 : e.thresholds) == null ? void 0 : t.mid) ?? Ue().mid;
|
|
906
912
|
},
|
|
907
913
|
set(e) {
|
|
908
|
-
var
|
|
909
|
-
const t = ((
|
|
914
|
+
var S;
|
|
915
|
+
const t = ((S = o.modelValue) == null ? void 0 : S.thresholds) ?? Ue();
|
|
910
916
|
t.mid = e;
|
|
911
|
-
const x =
|
|
912
|
-
...
|
|
917
|
+
const x = o.modelValue ? {
|
|
918
|
+
...o.modelValue
|
|
913
919
|
} : {};
|
|
914
|
-
x.thresholds = t,
|
|
920
|
+
x.thresholds = t, u("update:modelValue", x);
|
|
915
921
|
}
|
|
916
|
-
}), Ve =
|
|
922
|
+
}), Ve = b(() => i.mustUsePoTemplate && o.mode === H.CREATE && w.value.length > 0 ? w.value.map((e) => ({
|
|
917
923
|
label: e.name || "Template",
|
|
918
924
|
value: e._id || "template_" + e.name
|
|
919
|
-
})) : []),
|
|
920
|
-
(e) => (
|
|
921
|
-
)),
|
|
925
|
+
})) : []), Ze = b(() => Ve.value.filter(
|
|
926
|
+
(e) => (o.purchaseOrderTemplateIds ?? []).includes(e.value)
|
|
927
|
+
)), Je = b(() => i.enableWastageTemplate && o.mode === H.CREATE && A.value.length > 0 ? A.value.map((e) => ({
|
|
922
928
|
label: e.name || "Template",
|
|
923
929
|
value: e._id || "template_" + e.name
|
|
924
|
-
})) : []),
|
|
925
|
-
(e) => (
|
|
926
|
-
)),
|
|
930
|
+
})) : []), Qe = b(() => Je.value.filter(
|
|
931
|
+
(e) => (o.wastageTemplateIds ?? []).includes(e.value)
|
|
932
|
+
)), Xe = b(() => i.enableClosingTemplate && o.mode === H.CREATE && v.value.length > 0 ? v.value.map((e) => ({
|
|
927
933
|
label: e.name || "Template",
|
|
928
934
|
value: e._id || "template_" + e.name
|
|
929
|
-
})) : []),
|
|
930
|
-
(e) => (
|
|
935
|
+
})) : []), et = b(() => Xe.value.filter(
|
|
936
|
+
(e) => (o.closingTemplateIds ?? []).includes(e.value)
|
|
931
937
|
));
|
|
932
938
|
function Ft() {
|
|
933
|
-
|
|
934
|
-
title:
|
|
939
|
+
h.open({
|
|
940
|
+
title: d("inventory.ingredient.purchaseOrderTemplates.selectTitle"),
|
|
935
941
|
closeButton: !0,
|
|
936
942
|
contentComponent: We,
|
|
937
943
|
contentComponentProps: {
|
|
938
|
-
modelValue:
|
|
944
|
+
modelValue: o.purchaseOrderTemplateIds ?? [],
|
|
939
945
|
items: Ve.value
|
|
940
946
|
},
|
|
941
947
|
primaryActions: {
|
|
942
|
-
text:
|
|
948
|
+
text: d("common.confirm"),
|
|
943
949
|
close: !0
|
|
944
950
|
},
|
|
945
951
|
secondaryActions: {
|
|
946
|
-
text:
|
|
952
|
+
text: d("common.cancel"),
|
|
947
953
|
close: !0,
|
|
948
954
|
variant: "tertiary"
|
|
949
955
|
}
|
|
950
956
|
}).onPrimary((e) => {
|
|
951
|
-
|
|
957
|
+
u("update:purchaseOrderTemplateIds", e);
|
|
952
958
|
});
|
|
953
959
|
}
|
|
954
960
|
function At() {
|
|
955
|
-
|
|
956
|
-
title:
|
|
961
|
+
h.open({
|
|
962
|
+
title: d("inventory.ingredient.wastageTemplates.selectTitle"),
|
|
957
963
|
closeButton: !0,
|
|
958
964
|
contentComponent: We,
|
|
959
965
|
contentComponentProps: {
|
|
960
|
-
modelValue:
|
|
961
|
-
items:
|
|
966
|
+
modelValue: o.wastageTemplateIds ?? [],
|
|
967
|
+
items: Je.value
|
|
962
968
|
},
|
|
963
969
|
primaryActions: {
|
|
964
|
-
text:
|
|
970
|
+
text: d("common.confirm"),
|
|
965
971
|
close: !0
|
|
966
972
|
},
|
|
967
973
|
secondaryActions: {
|
|
968
|
-
text:
|
|
974
|
+
text: d("common.cancel"),
|
|
969
975
|
close: !0,
|
|
970
976
|
variant: "tertiary"
|
|
971
977
|
}
|
|
972
978
|
}).onPrimary((e) => {
|
|
973
|
-
|
|
979
|
+
u("update:wastageTemplateIds", e);
|
|
974
980
|
});
|
|
975
981
|
}
|
|
976
982
|
function Et() {
|
|
977
|
-
|
|
978
|
-
title:
|
|
983
|
+
h.open({
|
|
984
|
+
title: d("inventory.ingredient.closingTemplates.selectTitle"),
|
|
979
985
|
closeButton: !0,
|
|
980
986
|
contentComponent: We,
|
|
981
987
|
contentComponentProps: {
|
|
982
|
-
modelValue:
|
|
983
|
-
items:
|
|
988
|
+
modelValue: o.closingTemplateIds ?? [],
|
|
989
|
+
items: Xe.value
|
|
984
990
|
},
|
|
985
991
|
primaryActions: {
|
|
986
|
-
text:
|
|
992
|
+
text: d("common.confirm"),
|
|
987
993
|
close: !0
|
|
988
994
|
},
|
|
989
995
|
secondaryActions: {
|
|
990
|
-
text:
|
|
996
|
+
text: d("common.cancel"),
|
|
991
997
|
close: !0,
|
|
992
998
|
variant: "tertiary"
|
|
993
999
|
}
|
|
994
1000
|
}).onPrimary((e) => {
|
|
995
|
-
|
|
1001
|
+
u("update:closingTemplateIds", e);
|
|
996
1002
|
});
|
|
997
1003
|
}
|
|
998
1004
|
function $t() {
|
|
@@ -1001,33 +1007,33 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1001
1007
|
};
|
|
1002
1008
|
}
|
|
1003
1009
|
return (e, t) => {
|
|
1004
|
-
const x =
|
|
1005
|
-
return
|
|
1010
|
+
const x = C("FmTextField"), S = C("FmLabel"), Y = C("FmField"), z = C("FmIcon"), re = C("FmMenuHeader"), ie = C("FmMenuDivider"), Ie = C("FmMenuItem"), Mt = C("FmMenu"), nt = C("FmFormGroup"), Ut = C("FmSelect"), ot = C("FmSwitch"), lt = C("FmStepperField"), Be = C("FmButton"), De = C("FmChip"), Pt = C("FmForm");
|
|
1011
|
+
return c(), O(Pt, {
|
|
1006
1012
|
disabled: e.disabled,
|
|
1007
1013
|
ref_key: "formRef",
|
|
1008
1014
|
ref: M,
|
|
1009
1015
|
class: "flex flex-col gap-32",
|
|
1010
1016
|
onValidationSuccess: fe
|
|
1011
1017
|
}, {
|
|
1012
|
-
default:
|
|
1013
|
-
var
|
|
1018
|
+
default: g(() => {
|
|
1019
|
+
var at, st, rt, it;
|
|
1014
1020
|
return [
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1021
|
+
n("div", Wn, [
|
|
1022
|
+
n("div", Hn, [
|
|
1023
|
+
s(Se, {
|
|
1018
1024
|
"tooltip-message": "This field is managed by NetSuite",
|
|
1019
1025
|
"tooltip-z-index": 50,
|
|
1020
|
-
label: l(
|
|
1026
|
+
label: l(d)("inventory.ingredient.code"),
|
|
1021
1027
|
"model-value": le.value,
|
|
1022
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
1023
|
-
locked:
|
|
1028
|
+
"onUpdate:modelValue": t[1] || (t[1] = (V) => le.value = V),
|
|
1029
|
+
locked: f.value,
|
|
1024
1030
|
disabled: e.disabled
|
|
1025
1031
|
}, {
|
|
1026
|
-
default:
|
|
1027
|
-
|
|
1028
|
-
label: l(
|
|
1032
|
+
default: g(() => [
|
|
1033
|
+
s(x, {
|
|
1034
|
+
label: l(d)("inventory.ingredient.code"),
|
|
1029
1035
|
"model-value": le.value,
|
|
1030
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
1036
|
+
"onUpdate:modelValue": t[0] || (t[0] = (V) => le.value = V),
|
|
1031
1037
|
rules: [l(Ne)(), l(sn)(_e.value, Ee.value)],
|
|
1032
1038
|
"label-mark": "required"
|
|
1033
1039
|
}, null, 8, ["label", "model-value", "rules"])
|
|
@@ -1035,21 +1041,21 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1035
1041
|
_: 1
|
|
1036
1042
|
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
1037
1043
|
]),
|
|
1038
|
-
|
|
1039
|
-
|
|
1044
|
+
n("div", qn, [
|
|
1045
|
+
s(Se, {
|
|
1040
1046
|
"tooltip-message": "This field is managed by NetSuite",
|
|
1041
1047
|
"tooltip-z-index": 50,
|
|
1042
|
-
label: l(
|
|
1048
|
+
label: l(d)("inventory.ingredient.name"),
|
|
1043
1049
|
"model-value": ae.value,
|
|
1044
|
-
"onUpdate:modelValue": t[3] || (t[3] = (
|
|
1045
|
-
locked:
|
|
1050
|
+
"onUpdate:modelValue": t[3] || (t[3] = (V) => ae.value = V),
|
|
1051
|
+
locked: f.value,
|
|
1046
1052
|
disabled: e.disabled
|
|
1047
1053
|
}, {
|
|
1048
|
-
default:
|
|
1049
|
-
|
|
1050
|
-
label: l(
|
|
1054
|
+
default: g(() => [
|
|
1055
|
+
s(x, {
|
|
1056
|
+
label: l(d)("inventory.ingredient.name"),
|
|
1051
1057
|
"model-value": ae.value,
|
|
1052
|
-
"onUpdate:modelValue": t[2] || (t[2] = (
|
|
1058
|
+
"onUpdate:modelValue": t[2] || (t[2] = (V) => ae.value = V),
|
|
1053
1059
|
rules: [l(Ne)()],
|
|
1054
1060
|
"label-mark": "required"
|
|
1055
1061
|
}, null, 8, ["label", "model-value", "rules"])
|
|
@@ -1058,30 +1064,30 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1058
1064
|
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
1059
1065
|
])
|
|
1060
1066
|
]),
|
|
1061
|
-
|
|
1067
|
+
s(Se, {
|
|
1062
1068
|
"tooltip-message": "This field is managed by NetSuite",
|
|
1063
1069
|
"tooltip-z-index": 50,
|
|
1064
|
-
label: l(
|
|
1065
|
-
"helper-text": (
|
|
1066
|
-
"model-value": (
|
|
1067
|
-
locked:
|
|
1070
|
+
label: l(d)("inventory.ingredient.unit"),
|
|
1071
|
+
"helper-text": (at = e.modelValue) != null && at.trackingMeasurement ? `Base unit: ${(rt = (st = e.modelValue) == null ? void 0 : st.unit) == null ? void 0 : rt.name}` : void 0,
|
|
1072
|
+
"model-value": (it = ge.value) == null ? void 0 : it.name,
|
|
1073
|
+
locked: f.value,
|
|
1068
1074
|
disabled: e.disabled
|
|
1069
1075
|
}, {
|
|
1070
|
-
default:
|
|
1071
|
-
|
|
1076
|
+
default: g(() => [
|
|
1077
|
+
s(nt, {
|
|
1072
1078
|
"model-value": ge.value,
|
|
1073
1079
|
rules: [l(Ne)()],
|
|
1074
1080
|
"label-mark": "required"
|
|
1075
1081
|
}, {
|
|
1076
|
-
label:
|
|
1077
|
-
|
|
1078
|
-
label: l(
|
|
1082
|
+
label: g(() => [
|
|
1083
|
+
s(S, {
|
|
1084
|
+
label: l(d)("inventory.ingredient.unit")
|
|
1079
1085
|
}, null, 8, ["label"])
|
|
1080
1086
|
]),
|
|
1081
|
-
default:
|
|
1082
|
-
|
|
1083
|
-
"menu-button":
|
|
1084
|
-
|
|
1087
|
+
default: g(({ invalid: V }) => [
|
|
1088
|
+
s(Mt, null, {
|
|
1089
|
+
"menu-button": g(() => [
|
|
1090
|
+
s(Y, {
|
|
1085
1091
|
class: te([
|
|
1086
1092
|
"fm-typo-en-body-lg-400",
|
|
1087
1093
|
{
|
|
@@ -1089,45 +1095,45 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1089
1095
|
"text-fm-color-typo-disabled": e.disabled
|
|
1090
1096
|
}
|
|
1091
1097
|
]),
|
|
1092
|
-
invalid:
|
|
1098
|
+
invalid: V,
|
|
1093
1099
|
"append-icon": "expand_more"
|
|
1094
1100
|
}, {
|
|
1095
|
-
default:
|
|
1101
|
+
default: g(() => {
|
|
1096
1102
|
var J;
|
|
1097
1103
|
return [
|
|
1098
|
-
|
|
1104
|
+
Ye(F((J = ge.value) == null ? void 0 : J.name), 1)
|
|
1099
1105
|
];
|
|
1100
1106
|
}),
|
|
1101
1107
|
_: 2
|
|
1102
1108
|
}, 1032, ["class", "invalid"])
|
|
1103
1109
|
]),
|
|
1104
|
-
default:
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
modelValue:
|
|
1108
|
-
"onUpdate:modelValue": t[4] || (t[4] = (J) =>
|
|
1110
|
+
default: g(() => [
|
|
1111
|
+
n("div", Yn, [
|
|
1112
|
+
s(x, {
|
|
1113
|
+
modelValue: _.value,
|
|
1114
|
+
"onUpdate:modelValue": t[4] || (t[4] = (J) => _.value = J),
|
|
1109
1115
|
placeholder: "Filter options"
|
|
1110
1116
|
}, {
|
|
1111
|
-
prepend:
|
|
1112
|
-
|
|
1117
|
+
prepend: g(() => [
|
|
1118
|
+
s(z, { name: "search" })
|
|
1113
1119
|
]),
|
|
1114
1120
|
_: 1
|
|
1115
1121
|
}, 8, ["modelValue"]),
|
|
1116
|
-
|
|
1122
|
+
n("div", {
|
|
1117
1123
|
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
1118
1124
|
onVnodeMounted: $e
|
|
1119
1125
|
}, [
|
|
1120
|
-
(
|
|
1121
|
-
J.displayAsSection ? (
|
|
1122
|
-
|
|
1126
|
+
(c(!0), T(X, null, ue(G.value, (J, Rt) => (c(), T(X, { key: Rt }, [
|
|
1127
|
+
J.displayAsSection ? (c(), T(X, { key: 0 }, [
|
|
1128
|
+
s(re, {
|
|
1123
1129
|
label: J.label
|
|
1124
1130
|
}, null, 8, ["label"]),
|
|
1125
|
-
|
|
1126
|
-
], 64)) : (
|
|
1131
|
+
s(ie)
|
|
1132
|
+
], 64)) : (c(), O(Ie, {
|
|
1127
1133
|
key: 1,
|
|
1128
1134
|
label: J.label,
|
|
1129
1135
|
"model-value": $(J),
|
|
1130
|
-
onClick: (cl) =>
|
|
1136
|
+
onClick: (cl) => y(J.value),
|
|
1131
1137
|
"x-should-scroll-into": `${$(J)}`
|
|
1132
1138
|
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
1133
1139
|
], 64))), 128))
|
|
@@ -1142,161 +1148,161 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1142
1148
|
]),
|
|
1143
1149
|
_: 1
|
|
1144
1150
|
}, 8, ["label", "helper-text", "model-value", "locked", "disabled"]),
|
|
1145
|
-
l(
|
|
1151
|
+
l(i).enableTotalCost ? (c(), O(Se, {
|
|
1146
1152
|
key: 0,
|
|
1147
1153
|
"tooltip-message": "This field is managed by NetSuite",
|
|
1148
1154
|
"tooltip-z-index": 50,
|
|
1149
|
-
label: l(
|
|
1150
|
-
"model-value": l(
|
|
1151
|
-
locked:
|
|
1155
|
+
label: l(d)("inventory.ingredient.valuationMethod.title"),
|
|
1156
|
+
"model-value": l(d)("inventory.ingredient.valuationMethod." + me.value),
|
|
1157
|
+
locked: f.value,
|
|
1152
1158
|
disabled: e.disabled
|
|
1153
1159
|
}, {
|
|
1154
|
-
label:
|
|
1155
|
-
|
|
1156
|
-
default:
|
|
1157
|
-
|
|
1158
|
-
label: l(
|
|
1160
|
+
label: g(() => [
|
|
1161
|
+
s(he, { "z-index": 50 }, {
|
|
1162
|
+
default: g(() => [
|
|
1163
|
+
s(S, {
|
|
1164
|
+
label: l(d)("inventory.ingredient.valuationMethod.title")
|
|
1159
1165
|
}, null, 8, ["label"])
|
|
1160
1166
|
]),
|
|
1161
1167
|
_: 1
|
|
1162
1168
|
})
|
|
1163
1169
|
]),
|
|
1164
|
-
default:
|
|
1165
|
-
|
|
1170
|
+
default: g(() => [
|
|
1171
|
+
s(Ut, {
|
|
1166
1172
|
class: "col-span-2",
|
|
1167
|
-
label: l(
|
|
1173
|
+
label: l(d)("inventory.ingredient.valuationMethod.title"),
|
|
1168
1174
|
"model-value": me.value,
|
|
1169
|
-
"onUpdate:modelValue": t[5] || (t[5] = (
|
|
1175
|
+
"onUpdate:modelValue": t[5] || (t[5] = (V) => me.value = V),
|
|
1170
1176
|
items: K.value
|
|
1171
1177
|
}, null, 8, ["label", "model-value", "items"])
|
|
1172
1178
|
]),
|
|
1173
1179
|
_: 1
|
|
1174
1180
|
}, 8, ["label", "model-value", "locked", "disabled"])) : L("", !0),
|
|
1175
|
-
l(
|
|
1181
|
+
l(i).enableTotalCost ? (c(), O(Se, {
|
|
1176
1182
|
key: 1,
|
|
1177
1183
|
"tooltip-message": "This field is managed by NetSuite",
|
|
1178
1184
|
"tooltip-z-index": 50,
|
|
1179
1185
|
"model-value": `${l(Wt)()} ${ye.value}`,
|
|
1180
|
-
locked:
|
|
1186
|
+
locked: f.value,
|
|
1181
1187
|
"append-text": `/ ${we.value}`,
|
|
1182
1188
|
disabled: e.disabled
|
|
1183
1189
|
}, {
|
|
1184
|
-
label:
|
|
1185
|
-
|
|
1186
|
-
default:
|
|
1187
|
-
|
|
1188
|
-
label: l(
|
|
1190
|
+
label: g(() => [
|
|
1191
|
+
s(he, { "z-index": 50 }, {
|
|
1192
|
+
default: g(() => [
|
|
1193
|
+
s(S, {
|
|
1194
|
+
label: l(d)("inventory.ingredient.pricePerUnit")
|
|
1189
1195
|
}, null, 8, ["label"])
|
|
1190
1196
|
]),
|
|
1191
1197
|
_: 1
|
|
1192
1198
|
})
|
|
1193
1199
|
]),
|
|
1194
|
-
default:
|
|
1195
|
-
|
|
1200
|
+
default: g(() => [
|
|
1201
|
+
s(x, {
|
|
1196
1202
|
"model-value": ye.value,
|
|
1197
|
-
"onUpdate:modelValue": t[6] || (t[6] = (
|
|
1203
|
+
"onUpdate:modelValue": t[6] || (t[6] = (V) => ye.value = V),
|
|
1198
1204
|
rules: [l(Pe)(0), l(rn)(4)]
|
|
1199
1205
|
}, {
|
|
1200
|
-
label:
|
|
1201
|
-
|
|
1202
|
-
default:
|
|
1203
|
-
|
|
1204
|
-
label: l(
|
|
1206
|
+
label: g(() => [
|
|
1207
|
+
s(he, { "z-index": 50 }, {
|
|
1208
|
+
default: g(() => [
|
|
1209
|
+
s(S, {
|
|
1210
|
+
label: l(d)("inventory.ingredient.pricePerUnit")
|
|
1205
1211
|
}, null, 8, ["label"])
|
|
1206
1212
|
]),
|
|
1207
1213
|
_: 1
|
|
1208
1214
|
})
|
|
1209
1215
|
]),
|
|
1210
|
-
prepend:
|
|
1211
|
-
var
|
|
1216
|
+
prepend: g(() => {
|
|
1217
|
+
var V, J;
|
|
1212
1218
|
return [
|
|
1213
|
-
|
|
1219
|
+
n("div", Gn, F(l(vt)(((V = l(a).currentCountry) == null ? void 0 : V.value) ?? l(ft)) === "MYR" ? "RM" : l(vt)(((J = l(a).currentCountry) == null ? void 0 : J.value) ?? l(ft))), 1)
|
|
1214
1220
|
];
|
|
1215
1221
|
}),
|
|
1216
|
-
append:
|
|
1217
|
-
|
|
1222
|
+
append: g(() => [
|
|
1223
|
+
n("div", Kn, " / " + F(we.value), 1)
|
|
1218
1224
|
]),
|
|
1219
1225
|
_: 1
|
|
1220
1226
|
}, 8, ["model-value", "rules"])
|
|
1221
1227
|
]),
|
|
1222
1228
|
_: 1
|
|
1223
1229
|
}, 8, ["model-value", "locked", "append-text", "disabled"])) : L("", !0),
|
|
1224
|
-
!
|
|
1230
|
+
!f.value || j.value ? (c(), O(zn, {
|
|
1225
1231
|
key: 2,
|
|
1226
1232
|
"model-value": j.value,
|
|
1227
|
-
"onUpdate:modelValue": t[7] || (t[7] = (
|
|
1233
|
+
"onUpdate:modelValue": t[7] || (t[7] = (V) => j.value = V),
|
|
1228
1234
|
"root-value": e.modelValue,
|
|
1229
|
-
readonly:
|
|
1235
|
+
readonly: f.value
|
|
1230
1236
|
}, null, 8, ["model-value", "root-value", "readonly"])) : L("", !0),
|
|
1231
|
-
e.mode !== l(H).CREATE ? (
|
|
1232
|
-
|
|
1233
|
-
label: l(
|
|
1237
|
+
e.mode !== l(H).CREATE ? (c(), T("div", Zn, [
|
|
1238
|
+
s(ot, {
|
|
1239
|
+
label: l(d)("inventory.ingredient.status.inactive"),
|
|
1234
1240
|
"model-value": ee.value,
|
|
1235
|
-
"onUpdate:modelValue": t[8] || (t[8] = (
|
|
1241
|
+
"onUpdate:modelValue": t[8] || (t[8] = (V) => ee.value = V),
|
|
1236
1242
|
"label-placement": "right",
|
|
1237
|
-
disabled:
|
|
1243
|
+
disabled: f.value
|
|
1238
1244
|
}, null, 8, ["label", "model-value", "disabled"]),
|
|
1239
|
-
|
|
1240
|
-
|
|
1245
|
+
n("div", Jn, [
|
|
1246
|
+
n("div", Qn, F(l(d)("inventory.ingredient.status.preventFromOrder")), 1)
|
|
1241
1247
|
])
|
|
1242
1248
|
])) : L("", !0),
|
|
1243
|
-
e.mode !== l(H).CREATE ? (
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
label: l(
|
|
1249
|
+
e.mode !== l(H).CREATE ? (c(), T("div", Xn, [
|
|
1250
|
+
n("div", null, [
|
|
1251
|
+
s(ot, {
|
|
1252
|
+
label: l(d)("inventory.ingredient.bindedItems.title"),
|
|
1247
1253
|
modelValue: R.value,
|
|
1248
|
-
"onUpdate:modelValue": t[9] || (t[9] = (
|
|
1254
|
+
"onUpdate:modelValue": t[9] || (t[9] = (V) => R.value = V),
|
|
1249
1255
|
"label-placement": "right"
|
|
1250
1256
|
}, null, 8, ["label", "modelValue"])
|
|
1251
1257
|
]),
|
|
1252
|
-
R.value && q.value.length ? (
|
|
1258
|
+
R.value && q.value.length ? (c(), O(je, {
|
|
1253
1259
|
key: 0,
|
|
1254
|
-
name: l(
|
|
1260
|
+
name: l(d)("inventory.ingredient.bindedItems.ingredient"),
|
|
1255
1261
|
bindings: q.value
|
|
1256
1262
|
}, null, 8, ["name", "bindings"])) : L("", !0),
|
|
1257
|
-
R.value && de.value.length ? (
|
|
1263
|
+
R.value && de.value.length ? (c(), O(je, {
|
|
1258
1264
|
key: 1,
|
|
1259
|
-
name: l(
|
|
1265
|
+
name: l(d)("inventory.ingredient.bindedItems.recipe"),
|
|
1260
1266
|
bindings: de.value
|
|
1261
1267
|
}, null, 8, ["name", "bindings"])) : L("", !0),
|
|
1262
|
-
R.value && Te.value.length ? (
|
|
1268
|
+
R.value && Te.value.length ? (c(), O(je, {
|
|
1263
1269
|
key: 2,
|
|
1264
|
-
name: l(
|
|
1270
|
+
name: l(d)("inventory.ingredient.bindedItems.menu"),
|
|
1265
1271
|
bindings: Te.value
|
|
1266
1272
|
}, null, 8, ["name", "bindings"])) : L("", !0)
|
|
1267
1273
|
])) : L("", !0),
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
default:
|
|
1272
|
-
|
|
1274
|
+
n("div", eo, [
|
|
1275
|
+
n("div", to, [
|
|
1276
|
+
s(he, null, {
|
|
1277
|
+
default: g(() => [
|
|
1278
|
+
n("div", no, F(l(d)("inventory.ingredient.threshold.title")), 1)
|
|
1273
1279
|
]),
|
|
1274
1280
|
_: 1
|
|
1275
1281
|
}),
|
|
1276
|
-
|
|
1282
|
+
n("div", oo, F(l(d)("inventory.ingredient.threshold.subtitle")), 1)
|
|
1277
1283
|
]),
|
|
1278
|
-
|
|
1279
|
-
|
|
1284
|
+
n("div", lo, [
|
|
1285
|
+
s(nt, {
|
|
1280
1286
|
"model-value": { low: be.value, mid: se.value },
|
|
1281
1287
|
rules: [$t()]
|
|
1282
1288
|
}, null, 8, ["model-value", "rules"]),
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1289
|
+
n("div", ao, [
|
|
1290
|
+
n("div", so, [
|
|
1291
|
+
n("div", ro, [
|
|
1292
|
+
s(ze, {
|
|
1287
1293
|
days: be.value,
|
|
1288
1294
|
level: l(Le).low
|
|
1289
1295
|
}, null, 8, ["days", "level"])
|
|
1290
1296
|
]),
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1297
|
+
n("div", io, [
|
|
1298
|
+
n("div", uo, F(l(d)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
1299
|
+
s(lt, {
|
|
1294
1300
|
modelValue: be.value,
|
|
1295
|
-
"onUpdate:modelValue": t[10] || (t[10] = (
|
|
1301
|
+
"onUpdate:modelValue": t[10] || (t[10] = (V) => be.value = V),
|
|
1296
1302
|
rules: [l(Pe)(0)]
|
|
1297
1303
|
}, {
|
|
1298
|
-
append:
|
|
1299
|
-
|
|
1304
|
+
append: g(() => t[13] || (t[13] = [
|
|
1305
|
+
n("div", {
|
|
1300
1306
|
class: "text-fm-color-typo-secondary",
|
|
1301
1307
|
style: { "padding-right": "32px" }
|
|
1302
1308
|
}, "days", -1)
|
|
@@ -1305,31 +1311,31 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1305
1311
|
}, 8, ["modelValue", "rules"])
|
|
1306
1312
|
])
|
|
1307
1313
|
]),
|
|
1308
|
-
t[15] || (t[15] =
|
|
1314
|
+
t[15] || (t[15] = n("div", {
|
|
1309
1315
|
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
1310
1316
|
style: { width: "1px" }
|
|
1311
1317
|
}, [
|
|
1312
|
-
|
|
1318
|
+
n("div", {
|
|
1313
1319
|
class: "absolute bg-white",
|
|
1314
1320
|
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
1315
1321
|
}, " < ")
|
|
1316
1322
|
], -1)),
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1323
|
+
n("div", co, [
|
|
1324
|
+
n("div", mo, [
|
|
1325
|
+
s(ze, {
|
|
1320
1326
|
days: se.value,
|
|
1321
1327
|
level: l(Le).mid
|
|
1322
1328
|
}, null, 8, ["days", "level"])
|
|
1323
1329
|
]),
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1330
|
+
n("div", po, [
|
|
1331
|
+
n("div", vo, F(l(d)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
1332
|
+
s(lt, {
|
|
1327
1333
|
modelValue: se.value,
|
|
1328
|
-
"onUpdate:modelValue": t[11] || (t[11] = (
|
|
1334
|
+
"onUpdate:modelValue": t[11] || (t[11] = (V) => se.value = V),
|
|
1329
1335
|
rules: [l(Pe)(0)]
|
|
1330
1336
|
}, {
|
|
1331
|
-
append:
|
|
1332
|
-
|
|
1337
|
+
append: g(() => t[14] || (t[14] = [
|
|
1338
|
+
n("div", {
|
|
1333
1339
|
class: "text-fm-color-typo-secondary",
|
|
1334
1340
|
style: { "padding-right": "32px" }
|
|
1335
1341
|
}, "days", -1)
|
|
@@ -1338,39 +1344,39 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1338
1344
|
}, 8, ["modelValue", "rules"])
|
|
1339
1345
|
])
|
|
1340
1346
|
]),
|
|
1341
|
-
t[16] || (t[16] =
|
|
1347
|
+
t[16] || (t[16] = n("div", {
|
|
1342
1348
|
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
1343
1349
|
style: { width: "1px" }
|
|
1344
1350
|
}, [
|
|
1345
|
-
|
|
1351
|
+
n("div", {
|
|
1346
1352
|
class: "absolute bg-white",
|
|
1347
1353
|
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
1348
1354
|
}, " < ")
|
|
1349
1355
|
], -1)),
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1356
|
+
n("div", fo, [
|
|
1357
|
+
n("div", yo, [
|
|
1358
|
+
s(ze, {
|
|
1353
1359
|
days: se.value + 1,
|
|
1354
1360
|
level: l(Le).high
|
|
1355
1361
|
}, null, 8, ["days", "level"])
|
|
1356
1362
|
]),
|
|
1357
|
-
|
|
1358
|
-
|
|
1363
|
+
n("div", go, [
|
|
1364
|
+
n("div", bo, F(l(d)("inventory.ingredient.threshold.stockIsStaple")), 1)
|
|
1359
1365
|
])
|
|
1360
1366
|
])
|
|
1361
1367
|
])
|
|
1362
1368
|
])
|
|
1363
1369
|
]),
|
|
1364
|
-
l(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
default:
|
|
1369
|
-
|
|
1370
|
+
l(i).mustUsePoTemplate && e.mode === l(H).CREATE ? (c(), T("div", ho, [
|
|
1371
|
+
n("div", _o, [
|
|
1372
|
+
n("div", xo, [
|
|
1373
|
+
s(he, null, {
|
|
1374
|
+
default: g(() => [
|
|
1375
|
+
n("div", ko, F(l(d)("inventory.ingredient.purchaseOrderTemplates.title")), 1)
|
|
1370
1376
|
]),
|
|
1371
1377
|
_: 1
|
|
1372
1378
|
}),
|
|
1373
|
-
|
|
1379
|
+
s(Be, {
|
|
1374
1380
|
variant: "secondary",
|
|
1375
1381
|
"text-color": "primary",
|
|
1376
1382
|
"border-color": "primary",
|
|
@@ -1378,29 +1384,29 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1378
1384
|
onClick: Ft
|
|
1379
1385
|
})
|
|
1380
1386
|
]),
|
|
1381
|
-
|
|
1387
|
+
n("div", To, F(l(d)("inventory.ingredient.purchaseOrderTemplates.description")), 1)
|
|
1382
1388
|
]),
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
(
|
|
1386
|
-
key:
|
|
1387
|
-
label:
|
|
1389
|
+
Ze.value.length > 0 ? (c(), T("div", wo, [
|
|
1390
|
+
n("div", Vo, [
|
|
1391
|
+
(c(!0), T(X, null, ue(Ze.value, (V) => (c(), O(De, {
|
|
1392
|
+
key: V.value,
|
|
1393
|
+
label: V.label,
|
|
1388
1394
|
variant: "info",
|
|
1389
1395
|
compact: ""
|
|
1390
1396
|
}, null, 8, ["label"]))), 128))
|
|
1391
1397
|
])
|
|
1392
1398
|
])) : L("", !0)
|
|
1393
1399
|
])) : L("", !0),
|
|
1394
|
-
l(
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
default:
|
|
1399
|
-
|
|
1400
|
+
l(i).enableWastageTemplate && e.mode === l(H).CREATE ? (c(), T("div", Io, [
|
|
1401
|
+
n("div", So, [
|
|
1402
|
+
n("div", Co, [
|
|
1403
|
+
s(he, null, {
|
|
1404
|
+
default: g(() => [
|
|
1405
|
+
n("div", Fo, F(l(d)("inventory.ingredient.wastageTemplates.title")), 1)
|
|
1400
1406
|
]),
|
|
1401
1407
|
_: 1
|
|
1402
1408
|
}),
|
|
1403
|
-
|
|
1409
|
+
s(Be, {
|
|
1404
1410
|
variant: "secondary",
|
|
1405
1411
|
"text-color": "primary",
|
|
1406
1412
|
"border-color": "primary",
|
|
@@ -1408,29 +1414,29 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1408
1414
|
onClick: At
|
|
1409
1415
|
})
|
|
1410
1416
|
]),
|
|
1411
|
-
|
|
1417
|
+
n("div", Ao, F(l(d)("inventory.ingredient.wastageTemplates.description")), 1)
|
|
1412
1418
|
]),
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
(
|
|
1416
|
-
key:
|
|
1417
|
-
label:
|
|
1419
|
+
Qe.value.length > 0 ? (c(), T("div", Eo, [
|
|
1420
|
+
n("div", $o, [
|
|
1421
|
+
(c(!0), T(X, null, ue(Qe.value, (V) => (c(), O(De, {
|
|
1422
|
+
key: V.value,
|
|
1423
|
+
label: V.label,
|
|
1418
1424
|
variant: "info",
|
|
1419
1425
|
compact: ""
|
|
1420
1426
|
}, null, 8, ["label"]))), 128))
|
|
1421
1427
|
])
|
|
1422
1428
|
])) : L("", !0)
|
|
1423
1429
|
])) : L("", !0),
|
|
1424
|
-
l(
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
default:
|
|
1429
|
-
|
|
1430
|
+
l(i).enableClosingTemplate && e.mode === l(H).CREATE ? (c(), T("div", Mo, [
|
|
1431
|
+
n("div", Uo, [
|
|
1432
|
+
n("div", Po, [
|
|
1433
|
+
s(he, null, {
|
|
1434
|
+
default: g(() => [
|
|
1435
|
+
n("div", Ro, F(l(d)("inventory.ingredient.closingTemplates.title")), 1)
|
|
1430
1436
|
]),
|
|
1431
1437
|
_: 1
|
|
1432
1438
|
}),
|
|
1433
|
-
|
|
1439
|
+
s(Be, {
|
|
1434
1440
|
variant: "secondary",
|
|
1435
1441
|
"text-color": "primary",
|
|
1436
1442
|
"border-color": "primary",
|
|
@@ -1438,24 +1444,24 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1438
1444
|
onClick: Et
|
|
1439
1445
|
})
|
|
1440
1446
|
]),
|
|
1441
|
-
|
|
1447
|
+
n("div", Bo, F(l(d)("inventory.ingredient.closingTemplates.description")), 1)
|
|
1442
1448
|
]),
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
(
|
|
1446
|
-
key:
|
|
1447
|
-
label:
|
|
1449
|
+
et.value.length > 0 ? (c(), T("div", Do, [
|
|
1450
|
+
n("div", Oo, [
|
|
1451
|
+
(c(!0), T(X, null, ue(et.value, (V) => (c(), O(De, {
|
|
1452
|
+
key: V.value,
|
|
1453
|
+
label: V.label,
|
|
1448
1454
|
variant: "info",
|
|
1449
1455
|
compact: ""
|
|
1450
1456
|
}, null, 8, ["label"]))), 128))
|
|
1451
1457
|
])
|
|
1452
1458
|
])) : L("", !0)
|
|
1453
1459
|
])) : L("", !0),
|
|
1454
|
-
|
|
1455
|
-
|
|
1460
|
+
n("div", null, [
|
|
1461
|
+
s(yn, {
|
|
1456
1462
|
entity: "inventorySku",
|
|
1457
1463
|
modelValue: Z.value,
|
|
1458
|
-
"onUpdate:modelValue": t[12] || (t[12] = (
|
|
1464
|
+
"onUpdate:modelValue": t[12] || (t[12] = (V) => Z.value = V)
|
|
1459
1465
|
}, null, 8, ["modelValue"])
|
|
1460
1466
|
])
|
|
1461
1467
|
];
|
|
@@ -1476,46 +1482,46 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1476
1482
|
},
|
|
1477
1483
|
emits: ["update:show"],
|
|
1478
1484
|
setup(W) {
|
|
1479
|
-
const
|
|
1485
|
+
const r = W, k = Ce(), d = Vt(), h = Ae(), I = It(), E = St(), P = Ct(), o = Fe(), { t: u } = ve(), p = bt(r, "show"), a = bt(r, "sku"), i = B([]), m = B([]), f = B([]), w = b(
|
|
1480
1486
|
() => {
|
|
1481
|
-
var
|
|
1482
|
-
return
|
|
1487
|
+
var _;
|
|
1488
|
+
return h.isEnabled && h.netSuiteItemBySkuId.has((_ = r.sku) == null ? void 0 : _._id);
|
|
1483
1489
|
}
|
|
1484
|
-
),
|
|
1485
|
-
switch (
|
|
1490
|
+
), A = b(() => {
|
|
1491
|
+
switch (r.mode) {
|
|
1486
1492
|
case H.READ:
|
|
1487
1493
|
return "";
|
|
1488
1494
|
case H.UPDATE:
|
|
1489
|
-
return
|
|
1495
|
+
return u("inventory.ingredient.update.title");
|
|
1490
1496
|
case H.CREATE:
|
|
1491
|
-
return
|
|
1497
|
+
return u("inventory.ingredient.create.title");
|
|
1492
1498
|
}
|
|
1493
1499
|
return "";
|
|
1494
|
-
}),
|
|
1495
|
-
switch (
|
|
1500
|
+
}), v = b(() => {
|
|
1501
|
+
switch (r.mode) {
|
|
1496
1502
|
case H.READ:
|
|
1497
1503
|
return "";
|
|
1498
1504
|
case H.UPDATE:
|
|
1499
|
-
return
|
|
1505
|
+
return u("common.save");
|
|
1500
1506
|
case H.CREATE:
|
|
1501
|
-
return
|
|
1507
|
+
return u("common.add");
|
|
1502
1508
|
}
|
|
1503
1509
|
return "";
|
|
1504
1510
|
}), N = B(), D = B(!1);
|
|
1505
1511
|
async function fe() {
|
|
1506
1512
|
D.value = !0;
|
|
1507
1513
|
try {
|
|
1508
|
-
await
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1511
|
-
title:
|
|
1512
|
-
message:
|
|
1514
|
+
await k.createSku(a.value);
|
|
1515
|
+
const _ = k.skuByCode[a.value.code];
|
|
1516
|
+
d.enablePoTemplate && i.value.length > 0 && await ce(_), d.enableWastageTemplate && m.value.length > 0 && await oe(_), d.enableClosingTemplate && f.value.length > 0 && await le(_), p.value = !1, o.open({
|
|
1517
|
+
title: u("inventory.common.success"),
|
|
1518
|
+
message: u("inventory.ingredient.create.success", { name: a.value.name }),
|
|
1513
1519
|
type: "success"
|
|
1514
1520
|
});
|
|
1515
|
-
} catch (
|
|
1516
|
-
|
|
1517
|
-
title:
|
|
1518
|
-
message:
|
|
1521
|
+
} catch (_) {
|
|
1522
|
+
_ instanceof yt || o.open({
|
|
1523
|
+
title: u("inventory.ingredient.create.error.title"),
|
|
1524
|
+
message: u("inventory.ingredient.create.error.message"),
|
|
1519
1525
|
type: "error"
|
|
1520
1526
|
});
|
|
1521
1527
|
} finally {
|
|
@@ -1525,41 +1531,41 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1525
1531
|
async function ne() {
|
|
1526
1532
|
D.value = !0;
|
|
1527
1533
|
try {
|
|
1528
|
-
await
|
|
1529
|
-
title:
|
|
1530
|
-
message:
|
|
1534
|
+
await k.updateSku(a.value), D.value = !1, p.value = !1, o.open({
|
|
1535
|
+
title: u("inventory.common.success"),
|
|
1536
|
+
message: u("inventory.ingredient.update.success", { name: a.value.name }),
|
|
1531
1537
|
type: "success"
|
|
1532
1538
|
});
|
|
1533
|
-
} catch (
|
|
1534
|
-
|
|
1535
|
-
title:
|
|
1536
|
-
message:
|
|
1539
|
+
} catch (_) {
|
|
1540
|
+
_ instanceof yt || o.open({
|
|
1541
|
+
title: u("inventory.ingredient.update.error.title"),
|
|
1542
|
+
message: u("inventory.ingredient.update.error.message"),
|
|
1537
1543
|
type: "error"
|
|
1538
1544
|
});
|
|
1539
1545
|
} finally {
|
|
1540
1546
|
D.value = !1;
|
|
1541
1547
|
}
|
|
1542
1548
|
}
|
|
1543
|
-
async function ce(
|
|
1544
|
-
var
|
|
1549
|
+
async function ce(_) {
|
|
1550
|
+
var U, G, $, y;
|
|
1545
1551
|
try {
|
|
1546
|
-
for (const j of
|
|
1547
|
-
const K = await
|
|
1552
|
+
for (const j of i.value) {
|
|
1553
|
+
const K = await I.getTemplate(j);
|
|
1548
1554
|
if (!K) {
|
|
1549
1555
|
console.warn(`Template with ID ${j} not found`);
|
|
1550
1556
|
continue;
|
|
1551
1557
|
}
|
|
1552
1558
|
if (!K.purchaseOrder.items.find(
|
|
1553
|
-
(Z) => Z.sku._id ===
|
|
1559
|
+
(Z) => Z.sku._id === _._id
|
|
1554
1560
|
)) {
|
|
1555
|
-
const Z = { amount: 1, precision: dn(
|
|
1556
|
-
sku:
|
|
1557
|
-
name:
|
|
1558
|
-
code:
|
|
1561
|
+
const Z = { amount: 1, precision: dn(_.unit) }, M = {
|
|
1562
|
+
sku: _,
|
|
1563
|
+
name: _.name,
|
|
1564
|
+
code: _.code,
|
|
1559
1565
|
quantity: Z,
|
|
1560
1566
|
minimumQuantity: Z,
|
|
1561
1567
|
quantityStep: Z,
|
|
1562
|
-
measurement: ((G = (
|
|
1568
|
+
measurement: ((G = (U = _.unit) == null ? void 0 : U.measurements) == null ? void 0 : G[0]) || null
|
|
1563
1569
|
}, R = {
|
|
1564
1570
|
...K,
|
|
1565
1571
|
purchaseOrder: {
|
|
@@ -1567,81 +1573,81 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1567
1573
|
items: [...K.purchaseOrder.items, M]
|
|
1568
1574
|
}
|
|
1569
1575
|
};
|
|
1570
|
-
((($ = R.purchaseOrder.supplier) == null ? void 0 : $.internal) ===
|
|
1576
|
+
((($ = R.purchaseOrder.supplier) == null ? void 0 : $.internal) === gt.enum.warehouse || ((y = R.purchaseOrder.supplier) == null ? void 0 : y.internal) === gt.enum.restaurant) && (R.purchaseOrder.items = R.purchaseOrder.items.map(
|
|
1571
1577
|
({ totalCost: q, ...de }) => de
|
|
1572
|
-
)), await
|
|
1578
|
+
)), await I.updateTemplate(R), await new Promise((q) => setTimeout(q, 1e3));
|
|
1573
1579
|
}
|
|
1574
1580
|
}
|
|
1575
1581
|
} catch (j) {
|
|
1576
|
-
|
|
1577
|
-
title:
|
|
1578
|
-
message:
|
|
1582
|
+
o.open({
|
|
1583
|
+
title: u("inventory.transfer.template.update.error"),
|
|
1584
|
+
message: u("inventory.transfer.template.update.errorMessage"),
|
|
1579
1585
|
type: "error"
|
|
1580
1586
|
}), console.error("Error in updating transfer template", j);
|
|
1581
1587
|
}
|
|
1582
1588
|
}
|
|
1583
|
-
async function oe(
|
|
1589
|
+
async function oe(_) {
|
|
1584
1590
|
try {
|
|
1585
|
-
for (const
|
|
1586
|
-
const G = await
|
|
1591
|
+
for (const U of m.value) {
|
|
1592
|
+
const G = await E.getTemplate(U);
|
|
1587
1593
|
if (!G) {
|
|
1588
|
-
console.warn(`Wastage Template with ID ${
|
|
1594
|
+
console.warn(`Wastage Template with ID ${U} not found`);
|
|
1589
1595
|
continue;
|
|
1590
1596
|
}
|
|
1591
|
-
if (!G.items.find((
|
|
1592
|
-
const
|
|
1593
|
-
id:
|
|
1594
|
-
name:
|
|
1595
|
-
code:
|
|
1597
|
+
if (!G.items.find((y) => y.id === _._id)) {
|
|
1598
|
+
const y = {
|
|
1599
|
+
id: _._id,
|
|
1600
|
+
name: _.name,
|
|
1601
|
+
code: _.code,
|
|
1596
1602
|
type: "sku",
|
|
1597
1603
|
disabledMeasurements: []
|
|
1598
1604
|
}, j = {
|
|
1599
1605
|
...G,
|
|
1600
|
-
items: [...G.items,
|
|
1606
|
+
items: [...G.items, y]
|
|
1601
1607
|
};
|
|
1602
|
-
await
|
|
1608
|
+
await E.updateTemplate(j), await new Promise((K) => setTimeout(K, 1e3));
|
|
1603
1609
|
}
|
|
1604
1610
|
}
|
|
1605
|
-
} catch (
|
|
1606
|
-
|
|
1607
|
-
title:
|
|
1608
|
-
message:
|
|
1611
|
+
} catch (U) {
|
|
1612
|
+
o.open({
|
|
1613
|
+
title: u("inventory.wastage.template.update.error"),
|
|
1614
|
+
message: u("inventory.wastage.template.update.errorMessage"),
|
|
1609
1615
|
type: "error"
|
|
1610
|
-
}), console.error("Error in updating wastage template",
|
|
1616
|
+
}), console.error("Error in updating wastage template", U);
|
|
1611
1617
|
}
|
|
1612
1618
|
}
|
|
1613
|
-
async function le(
|
|
1619
|
+
async function le(_) {
|
|
1614
1620
|
try {
|
|
1615
|
-
for (const
|
|
1616
|
-
const G = await
|
|
1621
|
+
for (const U of f.value) {
|
|
1622
|
+
const G = await P.getTemplate(U);
|
|
1617
1623
|
if (!G) {
|
|
1618
|
-
console.warn(`Closing Template with ID ${
|
|
1624
|
+
console.warn(`Closing Template with ID ${U} not found`);
|
|
1619
1625
|
continue;
|
|
1620
1626
|
}
|
|
1621
|
-
if (!G.items.find((
|
|
1622
|
-
const
|
|
1623
|
-
sku:
|
|
1627
|
+
if (!G.items.find((y) => y.sku._id === _._id)) {
|
|
1628
|
+
const y = {
|
|
1629
|
+
sku: _
|
|
1624
1630
|
}, j = {
|
|
1625
1631
|
...G,
|
|
1626
|
-
items: [...G.items,
|
|
1632
|
+
items: [...G.items, y]
|
|
1627
1633
|
};
|
|
1628
|
-
await
|
|
1634
|
+
await P.updateTemplate(j), await new Promise((K) => setTimeout(K, 1e3));
|
|
1629
1635
|
}
|
|
1630
1636
|
}
|
|
1631
|
-
} catch (
|
|
1632
|
-
|
|
1633
|
-
title:
|
|
1634
|
-
message:
|
|
1637
|
+
} catch (U) {
|
|
1638
|
+
o.open({
|
|
1639
|
+
title: u("inventory.closing.template.update.error"),
|
|
1640
|
+
message: u("inventory.closing.template.update.errorMessage"),
|
|
1635
1641
|
type: "error"
|
|
1636
|
-
}), console.error("Error in updating closing template",
|
|
1642
|
+
}), console.error("Error in updating closing template", U);
|
|
1637
1643
|
}
|
|
1638
1644
|
}
|
|
1639
1645
|
function ee() {
|
|
1640
|
-
var
|
|
1641
|
-
(
|
|
1646
|
+
var _, U;
|
|
1647
|
+
(U = (_ = N.value) == null ? void 0 : _.validateInputs) == null || U.call(_);
|
|
1642
1648
|
}
|
|
1643
1649
|
function ae() {
|
|
1644
|
-
switch (
|
|
1650
|
+
switch (r.mode) {
|
|
1645
1651
|
case H.READ:
|
|
1646
1652
|
return;
|
|
1647
1653
|
case H.UPDATE:
|
|
@@ -1650,65 +1656,65 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1650
1656
|
return fe();
|
|
1651
1657
|
}
|
|
1652
1658
|
}
|
|
1653
|
-
function ye(
|
|
1654
|
-
|
|
1659
|
+
function ye(_) {
|
|
1660
|
+
i.value = _;
|
|
1655
1661
|
}
|
|
1656
|
-
function ge(
|
|
1657
|
-
m.value =
|
|
1662
|
+
function ge(_) {
|
|
1663
|
+
m.value = _;
|
|
1658
1664
|
}
|
|
1659
|
-
function ke(
|
|
1660
|
-
|
|
1665
|
+
function ke(_) {
|
|
1666
|
+
f.value = _;
|
|
1661
1667
|
}
|
|
1662
|
-
return (
|
|
1663
|
-
const G =
|
|
1664
|
-
return
|
|
1665
|
-
"model-value": l(
|
|
1666
|
-
"onUpdate:modelValue":
|
|
1667
|
-
header:
|
|
1668
|
+
return (_, U) => {
|
|
1669
|
+
const G = C("FmChip"), $ = C("FmButton"), y = C("FmSideSheet");
|
|
1670
|
+
return c(), O(y, {
|
|
1671
|
+
"model-value": l(p),
|
|
1672
|
+
"onUpdate:modelValue": U[3] || (U[3] = (j) => ut(p) ? p.value = j : null),
|
|
1673
|
+
header: A.value,
|
|
1668
1674
|
"close-button": "",
|
|
1669
1675
|
"dismiss-away": "",
|
|
1670
1676
|
"max-width": 500
|
|
1671
1677
|
}, {
|
|
1672
|
-
"side-sheet-footer":
|
|
1673
|
-
|
|
1674
|
-
|
|
1678
|
+
"side-sheet-footer": g(() => [
|
|
1679
|
+
n("div", jo, [
|
|
1680
|
+
s($, {
|
|
1675
1681
|
loading: D.value,
|
|
1676
|
-
label:
|
|
1682
|
+
label: v.value,
|
|
1677
1683
|
onClick: ee
|
|
1678
1684
|
}, null, 8, ["loading", "label"]),
|
|
1679
|
-
|
|
1685
|
+
s($, {
|
|
1680
1686
|
disabled: D.value,
|
|
1681
|
-
label: l(
|
|
1687
|
+
label: l(u)("common.close"),
|
|
1682
1688
|
variant: "tertiary",
|
|
1683
|
-
onClick:
|
|
1689
|
+
onClick: U[2] || (U[2] = (j) => p.value = !1)
|
|
1684
1690
|
}, null, 8, ["disabled", "label"])
|
|
1685
1691
|
])
|
|
1686
1692
|
]),
|
|
1687
|
-
default:
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1693
|
+
default: g(() => [
|
|
1694
|
+
n("div", zo, [
|
|
1695
|
+
w.value ? (c(), T("div", Lo, [
|
|
1696
|
+
s(G, {
|
|
1691
1697
|
label: "Managed by Netsuite",
|
|
1692
1698
|
compact: ""
|
|
1693
1699
|
}),
|
|
1694
|
-
|
|
1700
|
+
s(tn, {
|
|
1695
1701
|
readonly: "",
|
|
1696
|
-
sku:
|
|
1697
|
-
settingOptions: l(
|
|
1702
|
+
sku: _.sku,
|
|
1703
|
+
settingOptions: l(h).skuSettingOptions
|
|
1698
1704
|
}, null, 8, ["sku", "settingOptions"])
|
|
1699
1705
|
])) : L("", !0),
|
|
1700
|
-
|
|
1706
|
+
s(No, {
|
|
1701
1707
|
class: "w-full",
|
|
1702
1708
|
ref_key: "hasValidationExpose",
|
|
1703
1709
|
ref: N,
|
|
1704
|
-
modelValue: l(
|
|
1705
|
-
"onUpdate:modelValue":
|
|
1706
|
-
mode:
|
|
1710
|
+
modelValue: l(a),
|
|
1711
|
+
"onUpdate:modelValue": U[0] || (U[0] = (j) => ut(a) ? a.value = j : null),
|
|
1712
|
+
mode: _.mode,
|
|
1707
1713
|
disabled: D.value,
|
|
1708
|
-
purchaseOrderTemplateIds:
|
|
1714
|
+
purchaseOrderTemplateIds: i.value,
|
|
1709
1715
|
wastageTemplateIds: m.value,
|
|
1710
|
-
closingTemplateIds:
|
|
1711
|
-
"onClick:submit":
|
|
1716
|
+
closingTemplateIds: f.value,
|
|
1717
|
+
"onClick:submit": U[1] || (U[1] = (j) => ae()),
|
|
1712
1718
|
"onUpdate:purchaseOrderTemplateIds": ye,
|
|
1713
1719
|
"onUpdate:wastageTemplateIds": ge,
|
|
1714
1720
|
"onUpdate:closingTemplateIds": ke
|
|
@@ -1722,7 +1728,7 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1722
1728
|
}), Ho = { class: "flex items-center gap-12 pl-8" }, qo = { class: "flex flex-col" }, Yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Go = {
|
|
1723
1729
|
key: 0,
|
|
1724
1730
|
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1725
|
-
}, Ko = { key: 0 },
|
|
1731
|
+
}, Ko = { key: 0 }, kt = /* @__PURE__ */ pe({
|
|
1726
1732
|
__name: "ImportIngredientItem",
|
|
1727
1733
|
props: {
|
|
1728
1734
|
type: {},
|
|
@@ -1731,29 +1737,29 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1731
1737
|
errors: {}
|
|
1732
1738
|
},
|
|
1733
1739
|
setup(W) {
|
|
1734
|
-
return (
|
|
1735
|
-
const
|
|
1736
|
-
return
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1740
|
+
return (r, k) => {
|
|
1741
|
+
const d = C("FmIcon"), h = C("FmTooltip");
|
|
1742
|
+
return c(), T("div", Ho, [
|
|
1743
|
+
k[0] || (k[0] = n("div", null, "•", -1)),
|
|
1744
|
+
n("div", qo, [
|
|
1745
|
+
n("div", Yo, [
|
|
1746
|
+
n("div", {
|
|
1741
1747
|
class: te({
|
|
1742
|
-
"text-fm-color-system-error-300":
|
|
1748
|
+
"text-fm-color-system-error-300": r.errors.length
|
|
1743
1749
|
})
|
|
1744
1750
|
}, [
|
|
1745
|
-
|
|
1746
|
-
|
|
1751
|
+
Ye(F(r.name) + " ", 1),
|
|
1752
|
+
r.type === "create" ? (c(), T("span", Go, "(new)")) : L("", !0)
|
|
1747
1753
|
], 2),
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
content:
|
|
1751
|
-
|
|
1752
|
-
(
|
|
1754
|
+
r.errors.length ? (c(), T("div", Ko, [
|
|
1755
|
+
s(h, { "z-index": 50 }, {
|
|
1756
|
+
content: g(() => [
|
|
1757
|
+
n("ol", null, [
|
|
1758
|
+
(c(!0), T(X, null, ue(r.errors, (I, E) => (c(), T("li", { key: E }, F(I), 1))), 128))
|
|
1753
1759
|
])
|
|
1754
1760
|
]),
|
|
1755
|
-
default:
|
|
1756
|
-
|
|
1761
|
+
default: g(() => [
|
|
1762
|
+
s(d, {
|
|
1757
1763
|
name: "error",
|
|
1758
1764
|
size: "sm",
|
|
1759
1765
|
color: "system-error-300"
|
|
@@ -1763,15 +1769,15 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1763
1769
|
})
|
|
1764
1770
|
])) : L("", !0)
|
|
1765
1771
|
]),
|
|
1766
|
-
|
|
1772
|
+
n("div", {
|
|
1767
1773
|
class: te([
|
|
1768
1774
|
"fm-typo-en-body-sm-400",
|
|
1769
1775
|
{
|
|
1770
|
-
"text-fm-color-system-error-200":
|
|
1771
|
-
"text-fm-color-typo-secondary": !
|
|
1776
|
+
"text-fm-color-system-error-200": r.errors.length,
|
|
1777
|
+
"text-fm-color-typo-secondary": !r.errors.length
|
|
1772
1778
|
}
|
|
1773
1779
|
])
|
|
1774
|
-
},
|
|
1780
|
+
}, F(r.code), 3)
|
|
1775
1781
|
])
|
|
1776
1782
|
]);
|
|
1777
1783
|
};
|
|
@@ -1788,118 +1794,118 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1788
1794
|
}, ll = { class: "fm-typo-en-body-lg-600" }, al = /* @__PURE__ */ pe({
|
|
1789
1795
|
__name: "ImportIngredients",
|
|
1790
1796
|
setup(W) {
|
|
1791
|
-
const
|
|
1792
|
-
() => !!
|
|
1793
|
-
),
|
|
1794
|
-
() => !!
|
|
1795
|
-
), { t:
|
|
1796
|
-
async function i
|
|
1797
|
-
|
|
1797
|
+
const r = B(null), k = Yt(), d = Fe(), h = B(!1), I = B(new Array()), E = B([]), P = B([]), o = b(
|
|
1798
|
+
() => !!I.value.length || E.value.some((i) => i.errors.length) || P.value.some((i) => i.errors.length)
|
|
1799
|
+
), u = b(
|
|
1800
|
+
() => !!E.value.length || !!P.value.length
|
|
1801
|
+
), { t: p } = ve();
|
|
1802
|
+
async function a(i) {
|
|
1803
|
+
I.value = [], E.value = [], P.value = [];
|
|
1798
1804
|
try {
|
|
1799
|
-
|
|
1805
|
+
h.value = !0;
|
|
1800
1806
|
const [m] = await Promise.all([
|
|
1801
|
-
bn(
|
|
1807
|
+
bn(i),
|
|
1802
1808
|
// fake buffer
|
|
1803
|
-
new Promise((
|
|
1804
|
-
]),
|
|
1805
|
-
if (!
|
|
1806
|
-
|
|
1809
|
+
new Promise((A) => setTimeout(A, 1e3))
|
|
1810
|
+
]), f = m.SheetNames.find((A) => A);
|
|
1811
|
+
if (!f) {
|
|
1812
|
+
I.value.push(p("inventory.ingredient.import.fileError.noSheet"));
|
|
1807
1813
|
return;
|
|
1808
1814
|
}
|
|
1809
|
-
const
|
|
1810
|
-
if (
|
|
1811
|
-
|
|
1815
|
+
const w = pn(m.Sheets[f]);
|
|
1816
|
+
if (w.invalidExcel) {
|
|
1817
|
+
I.value.push(w.invalidExcelMessage ?? p("inventory.ingredient.import.fileError.invalidExcel"));
|
|
1812
1818
|
return;
|
|
1813
1819
|
}
|
|
1814
|
-
if (
|
|
1815
|
-
|
|
1820
|
+
if (E.value = w.importCreateResult, P.value = w.importUpdateResult, !E.value.length && !P.value.length) {
|
|
1821
|
+
I.value.push(p("inventory.ingredient.import.fileError.noData"));
|
|
1816
1822
|
return;
|
|
1817
1823
|
}
|
|
1818
|
-
|
|
1824
|
+
k.emitData(w);
|
|
1819
1825
|
} catch (m) {
|
|
1820
|
-
|
|
1821
|
-
title:
|
|
1826
|
+
d.open({
|
|
1827
|
+
title: p("inventory.ingredient.import.fileError.unableToRead"),
|
|
1822
1828
|
message: m == null ? void 0 : m.message,
|
|
1823
1829
|
type: "error"
|
|
1824
1830
|
}), console.error("Error in reading file", m);
|
|
1825
1831
|
} finally {
|
|
1826
|
-
|
|
1827
|
-
title:
|
|
1832
|
+
I.value.length && d.open({
|
|
1833
|
+
title: p("inventory.ingredient.import.fileError.invalidExcel"),
|
|
1828
1834
|
type: "error"
|
|
1829
|
-
}),
|
|
1835
|
+
}), h.value = !1;
|
|
1830
1836
|
}
|
|
1831
1837
|
}
|
|
1832
|
-
return
|
|
1833
|
-
|
|
1834
|
-
}), (
|
|
1835
|
-
const
|
|
1836
|
-
return
|
|
1837
|
-
|
|
1838
|
-
|
|
1838
|
+
return Tt(r, (i) => {
|
|
1839
|
+
i && a(i);
|
|
1840
|
+
}), (i, m) => {
|
|
1841
|
+
const f = C("FmCircularProgress"), w = C("FmIcon"), A = C("FmButton");
|
|
1842
|
+
return c(), T("div", Zo, [
|
|
1843
|
+
n("div", Jo, F(l(p)("inventory.ingredient.import.uploadDescription")), 1),
|
|
1844
|
+
s(hn, {
|
|
1839
1845
|
class: te({
|
|
1840
1846
|
"w-full": !0,
|
|
1841
|
-
"h-[200px]": !
|
|
1847
|
+
"h-[200px]": !r.value
|
|
1842
1848
|
}),
|
|
1843
1849
|
accept: ".xlsx",
|
|
1844
|
-
onFileUpload: m[0] || (m[0] = (
|
|
1845
|
-
label: l(
|
|
1846
|
-
"button-label": l(
|
|
1847
|
-
},
|
|
1848
|
-
|
|
1850
|
+
onFileUpload: m[0] || (m[0] = (v) => r.value = v),
|
|
1851
|
+
label: l(p)("inventory.ingredient.import.uploadTemplate"),
|
|
1852
|
+
"button-label": l(p)("inventory.ingredient.import.selectFile")
|
|
1853
|
+
}, qe({ _: 2 }, [
|
|
1854
|
+
r.value ? {
|
|
1849
1855
|
name: "default",
|
|
1850
|
-
fn:
|
|
1851
|
-
|
|
1852
|
-
|
|
1856
|
+
fn: g(({ openFileDialog: v }) => [
|
|
1857
|
+
n("div", Qo, [
|
|
1858
|
+
n("div", {
|
|
1853
1859
|
class: te([
|
|
1854
1860
|
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
1855
1861
|
{
|
|
1856
|
-
"border border-fm-color-neutral-gray-100":
|
|
1857
|
-
"border border-fm-color-neutral-gray-200": !
|
|
1858
|
-
"border border-fm-color-system-error-200":
|
|
1862
|
+
"border border-fm-color-neutral-gray-100": h.value,
|
|
1863
|
+
"border border-fm-color-neutral-gray-200": !h.value && !o.value,
|
|
1864
|
+
"border border-fm-color-system-error-200": o.value
|
|
1859
1865
|
}
|
|
1860
1866
|
])
|
|
1861
1867
|
}, [
|
|
1862
|
-
|
|
1868
|
+
h.value ? (c(), O(f, {
|
|
1863
1869
|
key: 0,
|
|
1864
1870
|
size: "md",
|
|
1865
1871
|
color: "neutral-gray-200"
|
|
1866
|
-
})) : (
|
|
1872
|
+
})) : (c(), O(w, {
|
|
1867
1873
|
key: 1,
|
|
1868
|
-
name:
|
|
1874
|
+
name: o.value ? "error" : "attach_file",
|
|
1869
1875
|
outline: "",
|
|
1870
|
-
color:
|
|
1876
|
+
color: o.value ? "system-error-300" : void 0
|
|
1871
1877
|
}, null, 8, ["name", "color"])),
|
|
1872
|
-
|
|
1878
|
+
n("div", {
|
|
1873
1879
|
class: te([
|
|
1874
1880
|
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
1875
1881
|
{
|
|
1876
|
-
"text-fm-color-typo-disabled":
|
|
1877
|
-
"text-fm-color-typo-primary": !
|
|
1882
|
+
"text-fm-color-typo-disabled": h.value,
|
|
1883
|
+
"text-fm-color-typo-primary": !h.value
|
|
1878
1884
|
}
|
|
1879
1885
|
])
|
|
1880
1886
|
}, [
|
|
1881
|
-
|
|
1887
|
+
n("div", Xo, F(r.value.name), 1)
|
|
1882
1888
|
], 2),
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
label: l(
|
|
1886
|
-
variant:
|
|
1887
|
-
"prepend-icon":
|
|
1888
|
-
onClick:
|
|
1889
|
+
h.value ? L("", !0) : (c(), T("div", el, [
|
|
1890
|
+
s(A, {
|
|
1891
|
+
label: l(p)("inventory.ingredient.import.replaceFile"),
|
|
1892
|
+
variant: o.value ? "destructive" : "secondary",
|
|
1893
|
+
"prepend-icon": o.value ? void 0 : "autorenew",
|
|
1894
|
+
onClick: v
|
|
1889
1895
|
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
1890
1896
|
]))
|
|
1891
1897
|
], 2),
|
|
1892
|
-
|
|
1893
|
-
(
|
|
1898
|
+
I.value.length ? (c(), T("div", tl, [
|
|
1899
|
+
(c(!0), T(X, null, ue(I.value, (N, D) => (c(), T("div", {
|
|
1894
1900
|
key: D,
|
|
1895
1901
|
class: "flex gap-8 items-center"
|
|
1896
1902
|
}, [
|
|
1897
|
-
|
|
1903
|
+
s(w, {
|
|
1898
1904
|
name: "error",
|
|
1899
1905
|
size: "sm",
|
|
1900
1906
|
color: "system-error-300"
|
|
1901
1907
|
}),
|
|
1902
|
-
|
|
1908
|
+
n("div", nl, F(N), 1)
|
|
1903
1909
|
]))), 128))
|
|
1904
1910
|
])) : L("", !0)
|
|
1905
1911
|
])
|
|
@@ -1907,20 +1913,20 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1907
1913
|
key: "0"
|
|
1908
1914
|
} : void 0
|
|
1909
1915
|
]), 1032, ["class", "label", "button-label"]),
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
(
|
|
1913
|
-
key:
|
|
1914
|
-
code:
|
|
1915
|
-
name:
|
|
1916
|
-
errors:
|
|
1916
|
+
u.value ? (c(), T("div", ol, [
|
|
1917
|
+
n("div", ll, F(l(p)("inventory.ingredient.import.summary")), 1),
|
|
1918
|
+
(c(!0), T(X, null, ue(E.value, (v) => (c(), O(kt, {
|
|
1919
|
+
key: v.sku._id,
|
|
1920
|
+
code: v.sku.code,
|
|
1921
|
+
name: v.sku.name,
|
|
1922
|
+
errors: v.errors,
|
|
1917
1923
|
type: "create"
|
|
1918
1924
|
}, null, 8, ["code", "name", "errors"]))), 128)),
|
|
1919
|
-
(
|
|
1920
|
-
key:
|
|
1921
|
-
code:
|
|
1922
|
-
name:
|
|
1923
|
-
errors:
|
|
1925
|
+
(c(!0), T(X, null, ue(P.value, (v) => (c(), O(kt, {
|
|
1926
|
+
key: v.sku._id,
|
|
1927
|
+
code: v.sku.code,
|
|
1928
|
+
name: v.sku.name,
|
|
1929
|
+
errors: v.errors,
|
|
1924
1930
|
type: "update"
|
|
1925
1931
|
}, null, 8, ["code", "name", "errors"]))), 128))
|
|
1926
1932
|
])) : L("", !0)
|
|
@@ -1933,18 +1939,18 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1933
1939
|
}, rl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, il = { class: "flex flex-col py-8" }, dl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ul = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ol = /* @__PURE__ */ pe({
|
|
1934
1940
|
__name: "IngredientsView",
|
|
1935
1941
|
setup(W) {
|
|
1936
|
-
const
|
|
1942
|
+
const r = Ce(), k = Ae(), d = b(() => [
|
|
1937
1943
|
{
|
|
1938
1944
|
type: "string",
|
|
1939
1945
|
key: "skuCode",
|
|
1940
1946
|
entity: "sku",
|
|
1941
|
-
values:
|
|
1947
|
+
values: r.skus.map((y) => y.code)
|
|
1942
1948
|
},
|
|
1943
1949
|
{
|
|
1944
1950
|
type: "string",
|
|
1945
1951
|
key: "skuUnitAbbrev",
|
|
1946
1952
|
entity: "sku",
|
|
1947
|
-
values:
|
|
1953
|
+
values: r.units.map((y) => y.abbrev)
|
|
1948
1954
|
},
|
|
1949
1955
|
{
|
|
1950
1956
|
type: "string",
|
|
@@ -1952,7 +1958,7 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1952
1958
|
entity: "sku",
|
|
1953
1959
|
values: ["Active", "Inactive"]
|
|
1954
1960
|
}
|
|
1955
|
-
]),
|
|
1961
|
+
]), h = B({
|
|
1956
1962
|
logic: "AND",
|
|
1957
1963
|
rules: [
|
|
1958
1964
|
{
|
|
@@ -1962,135 +1968,135 @@ const zn = /* @__PURE__ */ pe({
|
|
|
1962
1968
|
type: "string"
|
|
1963
1969
|
}
|
|
1964
1970
|
]
|
|
1965
|
-
}),
|
|
1966
|
-
() => new Set(
|
|
1967
|
-
),
|
|
1968
|
-
if (!
|
|
1969
|
-
return
|
|
1970
|
-
const $ = kn.build(
|
|
1971
|
-
return
|
|
1971
|
+
}), I = b(
|
|
1972
|
+
() => new Set(k.getAvailableItems(k.businessSubsidiaryId))
|
|
1973
|
+
), E = b(() => {
|
|
1974
|
+
if (!h.value)
|
|
1975
|
+
return r.skus;
|
|
1976
|
+
const $ = kn.build(h.value);
|
|
1977
|
+
return r.skus.filter((y) => k.isEnabled && ne.value && I.value && !I.value.has(y._id) ? !1 : Tn(
|
|
1972
1978
|
{
|
|
1973
|
-
skuCode:
|
|
1974
|
-
skuUnitAbbrev:
|
|
1975
|
-
status:
|
|
1979
|
+
skuCode: y.code,
|
|
1980
|
+
skuUnitAbbrev: y.unit.abbrev,
|
|
1981
|
+
status: y.isInactive ? "Inactive" : "Active"
|
|
1976
1982
|
},
|
|
1977
1983
|
$
|
|
1978
1984
|
));
|
|
1979
|
-
}),
|
|
1980
|
-
function
|
|
1985
|
+
}), P = Ht(), o = Ge(), u = xn(), p = Fe(), { t: a } = ve(), { createIngredient: i, updateIngredient: m } = He(), { ingredientDialogProps: f, ingredientViewLoading: w } = Qt(He()), { columnDefs: A } = Nn();
|
|
1986
|
+
function v($) {
|
|
1981
1987
|
switch ($) {
|
|
1982
1988
|
case "add":
|
|
1983
|
-
return
|
|
1989
|
+
return k.isEnabled ? void 0 : i();
|
|
1984
1990
|
case "import":
|
|
1985
|
-
return
|
|
1991
|
+
return U();
|
|
1986
1992
|
case "export":
|
|
1987
|
-
return
|
|
1993
|
+
return _();
|
|
1988
1994
|
}
|
|
1989
1995
|
}
|
|
1990
|
-
const N = B(""), D = B(!1), fe =
|
|
1996
|
+
const N = B(""), D = B(!1), fe = b(() => D.value || w.value), ne = B(!0), { breakpoints: ce } = Gt(), oe = b(() => ce.value.xs || ce.value.sm), le = b(() => oe.value ? 10 : 20), ee = nn(), ae = B(!1), ye = [
|
|
1991
1997
|
{
|
|
1992
1998
|
value: "import",
|
|
1993
|
-
label:
|
|
1999
|
+
label: a("common.import")
|
|
1994
2000
|
},
|
|
1995
2001
|
{
|
|
1996
2002
|
value: "export",
|
|
1997
|
-
label:
|
|
2003
|
+
label: a("common.export")
|
|
1998
2004
|
}
|
|
1999
2005
|
];
|
|
2000
2006
|
function ge($) {
|
|
2001
2007
|
switch (ae.value = !1, $) {
|
|
2002
2008
|
case "import":
|
|
2003
|
-
return
|
|
2009
|
+
return U();
|
|
2004
2010
|
case "export":
|
|
2005
|
-
return
|
|
2011
|
+
return _();
|
|
2006
2012
|
}
|
|
2007
2013
|
}
|
|
2008
|
-
const ke =
|
|
2009
|
-
...
|
|
2014
|
+
const ke = b(() => [
|
|
2015
|
+
...k.isEnabled ? [] : [
|
|
2010
2016
|
{
|
|
2011
|
-
label:
|
|
2017
|
+
label: a("inventory.ingredient.create.title"),
|
|
2012
2018
|
value: "add",
|
|
2013
2019
|
isPrimary: !0,
|
|
2014
2020
|
prependIcon: "add"
|
|
2015
2021
|
}
|
|
2016
2022
|
],
|
|
2017
|
-
{ label:
|
|
2018
|
-
{ label:
|
|
2023
|
+
{ label: a("common.import"), value: "import" },
|
|
2024
|
+
{ label: a("common.export"), value: "export" }
|
|
2019
2025
|
]);
|
|
2020
|
-
function
|
|
2026
|
+
function _() {
|
|
2021
2027
|
const $ = vn();
|
|
2022
|
-
|
|
2023
|
-
title:
|
|
2024
|
-
message:
|
|
2028
|
+
p.open({
|
|
2029
|
+
title: a("inventory.ingredient.export.success"),
|
|
2030
|
+
message: a("inventory.ingredient.export.filename", [$]),
|
|
2025
2031
|
type: "success"
|
|
2026
2032
|
});
|
|
2027
2033
|
}
|
|
2028
|
-
function
|
|
2029
|
-
|
|
2030
|
-
title:
|
|
2034
|
+
function U() {
|
|
2035
|
+
o.open({
|
|
2036
|
+
title: a("inventory.ingredient.import.title"),
|
|
2031
2037
|
contentComponent: al,
|
|
2032
2038
|
overlay: !0,
|
|
2033
2039
|
closeButton: !0,
|
|
2034
2040
|
primaryActions: {
|
|
2035
|
-
text:
|
|
2041
|
+
text: a("common.import"),
|
|
2036
2042
|
close: !1
|
|
2037
2043
|
},
|
|
2038
2044
|
secondaryActions: {
|
|
2039
|
-
text:
|
|
2045
|
+
text: a("common.close"),
|
|
2040
2046
|
close: !0
|
|
2041
2047
|
},
|
|
2042
2048
|
tertiaryActions: {
|
|
2043
|
-
text:
|
|
2049
|
+
text: a("inventory.ingredient.import.actions.downloadTemplate"),
|
|
2044
2050
|
close: !1,
|
|
2045
2051
|
variant: "plain"
|
|
2046
2052
|
}
|
|
2047
2053
|
}).onPrimary(($) => {
|
|
2048
2054
|
if (!$) {
|
|
2049
|
-
|
|
2050
|
-
title:
|
|
2055
|
+
p.open({
|
|
2056
|
+
title: a("inventory.ingredient.import.error.noData"),
|
|
2051
2057
|
type: "error"
|
|
2052
2058
|
});
|
|
2053
2059
|
return;
|
|
2054
2060
|
}
|
|
2055
2061
|
if (!$.importCreateResult.length && !$.importUpdateResult.length) {
|
|
2056
|
-
|
|
2057
|
-
title:
|
|
2058
|
-
message:
|
|
2062
|
+
p.open({
|
|
2063
|
+
title: a("inventory.ingredient.import.error.invalidContent"),
|
|
2064
|
+
message: a("inventory.ingredient.import.error.noImportData"),
|
|
2059
2065
|
type: "error"
|
|
2060
2066
|
});
|
|
2061
2067
|
return;
|
|
2062
2068
|
}
|
|
2063
|
-
if ($.importCreateResult.some((
|
|
2064
|
-
|
|
2065
|
-
title:
|
|
2066
|
-
message:
|
|
2069
|
+
if ($.importCreateResult.some((y) => y.errors.length) || $.importUpdateResult.some((y) => y.errors.length)) {
|
|
2070
|
+
p.open({
|
|
2071
|
+
title: a("inventory.ingredient.import.error.invalidContent"),
|
|
2072
|
+
message: a("inventory.ingredient.import.error.hasErrors"),
|
|
2067
2073
|
type: "error"
|
|
2068
2074
|
});
|
|
2069
2075
|
return;
|
|
2070
2076
|
}
|
|
2071
|
-
|
|
2077
|
+
o.close(), G($);
|
|
2072
2078
|
}).onTertiary(fn);
|
|
2073
2079
|
}
|
|
2074
2080
|
async function G($) {
|
|
2075
2081
|
D.value = !0;
|
|
2076
2082
|
try {
|
|
2077
|
-
const
|
|
2083
|
+
const y = [
|
|
2078
2084
|
...$.importCreateResult.map(({ sku: M }) => ({ type: "create", sku: M })),
|
|
2079
2085
|
...$.importUpdateResult.map(({ sku: M }) => ({ type: "update", sku: M }))
|
|
2080
2086
|
], j = 100;
|
|
2081
2087
|
let K = 0;
|
|
2082
2088
|
const me = () => {
|
|
2083
|
-
K += j,
|
|
2084
|
-
title:
|
|
2085
|
-
Math.min(K,
|
|
2086
|
-
|
|
2089
|
+
K += j, p.open({
|
|
2090
|
+
title: a("inventory.ingredient.import.progress", [
|
|
2091
|
+
Math.min(K, y.length),
|
|
2092
|
+
y.length
|
|
2087
2093
|
])
|
|
2088
2094
|
});
|
|
2089
2095
|
}, Z = new Array();
|
|
2090
|
-
for (const M of
|
|
2096
|
+
for (const M of y.chunk(100)) {
|
|
2091
2097
|
me();
|
|
2092
2098
|
try {
|
|
2093
|
-
const R = await
|
|
2099
|
+
const R = await r.importSkus({
|
|
2094
2100
|
create: M.filter((q) => q.type === "create").map((q) => q.sku),
|
|
2095
2101
|
update: M.filter((q) => q.type === "update").map((q) => q.sku)
|
|
2096
2102
|
});
|
|
@@ -2112,10 +2118,10 @@ const zn = /* @__PURE__ */ pe({
|
|
|
2112
2118
|
);
|
|
2113
2119
|
}
|
|
2114
2120
|
}
|
|
2115
|
-
|
|
2116
|
-
title:
|
|
2121
|
+
p.open({
|
|
2122
|
+
title: a("inventory.ingredient.import.success"),
|
|
2117
2123
|
type: "success"
|
|
2118
|
-
}), Z.length &&
|
|
2124
|
+
}), Z.length && u.alert(
|
|
2119
2125
|
"Some operation failed",
|
|
2120
2126
|
Q(
|
|
2121
2127
|
"div",
|
|
@@ -2132,25 +2138,25 @@ const zn = /* @__PURE__ */ pe({
|
|
|
2132
2138
|
)
|
|
2133
2139
|
)
|
|
2134
2140
|
);
|
|
2135
|
-
} catch (
|
|
2136
|
-
|
|
2137
|
-
title:
|
|
2138
|
-
message:
|
|
2141
|
+
} catch (y) {
|
|
2142
|
+
p.open({
|
|
2143
|
+
title: a("inventory.ingredient.import.error.failed"),
|
|
2144
|
+
message: a("inventory.ingredient.import.error.systemMessage", [y == null ? void 0 : y.message]),
|
|
2139
2145
|
type: "error"
|
|
2140
|
-
}), console.error("Error in importing skus", $,
|
|
2146
|
+
}), console.error("Error in importing skus", $, y);
|
|
2141
2147
|
} finally {
|
|
2142
2148
|
D.value = !1;
|
|
2143
2149
|
}
|
|
2144
2150
|
}
|
|
2145
|
-
return ($,
|
|
2146
|
-
const j =
|
|
2147
|
-
return
|
|
2148
|
-
title: l(
|
|
2151
|
+
return ($, y) => {
|
|
2152
|
+
const j = C("FmSwitch"), K = C("FmTable"), me = C("FmCollapsibleTabs"), Z = C("FmBottomSheet");
|
|
2153
|
+
return c(), O(on, {
|
|
2154
|
+
title: l(a)("inventory.ingredient.title"),
|
|
2149
2155
|
actions: ke.value,
|
|
2150
|
-
"onClick:action":
|
|
2156
|
+
"onClick:action": v
|
|
2151
2157
|
}, {
|
|
2152
|
-
default:
|
|
2153
|
-
|
|
2158
|
+
default: g(() => [
|
|
2159
|
+
n("div", {
|
|
2154
2160
|
class: te([
|
|
2155
2161
|
"flex flex-col gap-8 max-h-full",
|
|
2156
2162
|
{
|
|
@@ -2159,24 +2165,24 @@ const zn = /* @__PURE__ */ pe({
|
|
|
2159
2165
|
}
|
|
2160
2166
|
])
|
|
2161
2167
|
}, [
|
|
2162
|
-
|
|
2168
|
+
s(_n, {
|
|
2163
2169
|
searchable: "",
|
|
2164
2170
|
search: N.value,
|
|
2165
|
-
"onUpdate:search":
|
|
2171
|
+
"onUpdate:search": y[1] || (y[1] = (M) => N.value = M),
|
|
2166
2172
|
filterable: "",
|
|
2167
|
-
"filter-attributes":
|
|
2168
|
-
filter:
|
|
2169
|
-
"onUpdate:filter":
|
|
2173
|
+
"filter-attributes": d.value,
|
|
2174
|
+
filter: h.value,
|
|
2175
|
+
"onUpdate:filter": y[2] || (y[2] = (M) => h.value = M)
|
|
2170
2176
|
}, {
|
|
2171
|
-
default:
|
|
2172
|
-
l(
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
default:
|
|
2177
|
-
|
|
2177
|
+
default: g(() => [
|
|
2178
|
+
l(k).isEnabled ? (c(), T("div", sl, [
|
|
2179
|
+
n("span", rl, F(l(a)("inventory.integration.netsuite.subsidiaryHierarchy.filtering")), 1),
|
|
2180
|
+
s(cn),
|
|
2181
|
+
s(Re, null, {
|
|
2182
|
+
default: g(() => [
|
|
2183
|
+
s(j, {
|
|
2178
2184
|
modelValue: ne.value,
|
|
2179
|
-
"onUpdate:modelValue":
|
|
2185
|
+
"onUpdate:modelValue": y[0] || (y[0] = (M) => ne.value = M)
|
|
2180
2186
|
}, null, 8, ["modelValue"])
|
|
2181
2187
|
]),
|
|
2182
2188
|
_: 1
|
|
@@ -2185,37 +2191,37 @@ const zn = /* @__PURE__ */ pe({
|
|
|
2185
2191
|
]),
|
|
2186
2192
|
_: 1
|
|
2187
2193
|
}, 8, ["search", "filter-attributes", "filter"]),
|
|
2188
|
-
(
|
|
2189
|
-
key: JSON.stringify(
|
|
2194
|
+
(c(), O(K, {
|
|
2195
|
+
key: JSON.stringify(h.value),
|
|
2190
2196
|
style: Nt(l(ee).tableHeight),
|
|
2191
|
-
"column-defs": l(
|
|
2192
|
-
"row-data":
|
|
2197
|
+
"column-defs": l(A),
|
|
2198
|
+
"row-data": E.value,
|
|
2193
2199
|
"search-value": N.value,
|
|
2194
2200
|
columnVisibility: {
|
|
2195
|
-
netsuiteSubsidiary: l(
|
|
2201
|
+
netsuiteSubsidiary: l(k).isEnabled
|
|
2196
2202
|
},
|
|
2197
|
-
loading: (!l(
|
|
2203
|
+
loading: (!l(P)._currentLocation || fe.value) && l(k).isReady,
|
|
2198
2204
|
"loading-text": "Loading",
|
|
2199
|
-
onRowClick:
|
|
2205
|
+
onRowClick: y[3] || (y[3] = (M) => l(m)(M.original)),
|
|
2200
2206
|
"page-size": le.value
|
|
2201
2207
|
}, {
|
|
2202
|
-
"list-row":
|
|
2203
|
-
|
|
2208
|
+
"list-row": g((M) => [
|
|
2209
|
+
s(en, {
|
|
2204
2210
|
row: M,
|
|
2205
2211
|
onRowClick: l(m)
|
|
2206
|
-
},
|
|
2207
|
-
default:
|
|
2212
|
+
}, qe({
|
|
2213
|
+
default: g((R) => {
|
|
2208
2214
|
var q, de, Te, _e, Ee, $e, we, be, se, Ve;
|
|
2209
2215
|
return [
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2216
|
+
n("div", il, [
|
|
2217
|
+
n("div", dl, [
|
|
2218
|
+
s(l(_t), {
|
|
2213
2219
|
render: (Te = (de = (q = R.code) == null ? void 0 : q.column) == null ? void 0 : de.columnDef) == null ? void 0 : Te.cell,
|
|
2214
2220
|
props: (Ee = (_e = R.code) == null ? void 0 : _e.getContext) == null ? void 0 : Ee.call(_e)
|
|
2215
2221
|
}, null, 8, ["render", "props"])
|
|
2216
2222
|
]),
|
|
2217
|
-
|
|
2218
|
-
|
|
2223
|
+
n("div", ul, [
|
|
2224
|
+
s(l(_t), {
|
|
2219
2225
|
render: (be = (we = ($e = R.name) == null ? void 0 : $e.column) == null ? void 0 : we.columnDef) == null ? void 0 : be.cell,
|
|
2220
2226
|
props: (Ve = (se = R.name) == null ? void 0 : se.getContext) == null ? void 0 : Ve.call(se)
|
|
2221
2227
|
}, null, 8, ["render", "props"])
|
|
@@ -2227,8 +2233,8 @@ const zn = /* @__PURE__ */ pe({
|
|
|
2227
2233
|
}, [
|
|
2228
2234
|
D.value ? {
|
|
2229
2235
|
name: "loading-text",
|
|
2230
|
-
fn:
|
|
2231
|
-
|
|
2236
|
+
fn: g(() => [
|
|
2237
|
+
n("div", null, F(l(a)("inventory.ingredient.table.importing")), 1)
|
|
2232
2238
|
]),
|
|
2233
2239
|
key: "0"
|
|
2234
2240
|
} : void 0
|
|
@@ -2237,20 +2243,20 @@ const zn = /* @__PURE__ */ pe({
|
|
|
2237
2243
|
_: 1
|
|
2238
2244
|
}, 8, ["style", "column-defs", "row-data", "search-value", "columnVisibility", "loading", "page-size"]))
|
|
2239
2245
|
], 2),
|
|
2240
|
-
(
|
|
2241
|
-
|
|
2246
|
+
(c(), O(ct, { to: "body" }, [
|
|
2247
|
+
s(Wo, zt(Lt(l(f))), null, 16)
|
|
2242
2248
|
])),
|
|
2243
|
-
(
|
|
2244
|
-
|
|
2249
|
+
(c(), O(ct, { to: "body" }, [
|
|
2250
|
+
s(Z, {
|
|
2245
2251
|
"dismiss-away": "",
|
|
2246
2252
|
modelValue: ae.value,
|
|
2247
|
-
"onUpdate:modelValue":
|
|
2253
|
+
"onUpdate:modelValue": y[5] || (y[5] = (M) => ae.value = M)
|
|
2248
2254
|
}, {
|
|
2249
|
-
default:
|
|
2250
|
-
|
|
2255
|
+
default: g(() => [
|
|
2256
|
+
s(me, {
|
|
2251
2257
|
class: "pb-8",
|
|
2252
2258
|
items: ye,
|
|
2253
|
-
"onUpdate:modelValue":
|
|
2259
|
+
"onUpdate:modelValue": y[4] || (y[4] = (M) => ge(M))
|
|
2254
2260
|
})
|
|
2255
2261
|
]),
|
|
2256
2262
|
_: 1
|