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