@feedmepos/mf-inventory-portal 1.2.1 → 1.2.2-5.dev-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App-DMkUg806.js +297 -0
- package/dist/{ApprovalView-DwRrbVDo.js → ApprovalView-DWJh2K6W.js} +65 -64
- package/dist/{BindingsDialog-DUVKv10-.js → BindingsDialog-EmHCvqJI.js} +2 -2
- package/dist/{BindingsPicker-Daib_iq4.js → BindingsPicker-h_9jm1s0.js} +3 -3
- package/dist/{BindingsTable-Bv9UmcJP.js → BindingsTable-BAVWGUoa.js} +1 -1
- package/dist/ClosingDraftView-Du4kOwIg.js +1899 -0
- package/dist/ClosingHistoryView-DuW2Vtrs.js +355 -0
- package/dist/ClosingTemplateView-CfPY8R5M.js +2001 -0
- package/dist/{DeliveryOrderPrintPreview-DZPcRAja.js → DeliveryOrderPrintPreview-C6Cj8mOp.js} +9 -9
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-WWIrybw_.js +230 -0
- package/dist/{FmMultiselectDialog-CZmwOkrb.js → FmMultiselectDialog-BzWrQOS4.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C-2V2bGc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DwqVRUFz.js} +36 -36
- package/dist/ImportView-lKlYeLay.js +1291 -0
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js} +5 -5
- package/dist/{IngredientGroupView-CAVYpEj3.js → IngredientGroupView-CrmwR2Xt.js} +34 -35
- package/dist/IngredientsView-1bAsyz-b.js +2254 -0
- package/dist/{IntegrationView-DdLFyZ4H.js → IntegrationView-D16qeEc_.js} +1773 -1635
- package/dist/{InventoryBindingForm-C7BdEDtM.js → InventoryBindingForm-BRwOXV_P.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js} +28 -28
- package/dist/{InventoryBindingSummary-IZ7F-Lti.js → InventoryBindingSummary-DKM2gX8_.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sgqVSlUB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js} +4 -4
- package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeF32bHu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B0OKeK5O.js} +7 -7
- package/dist/{PublishView-DkgfYneI.js → PublishView-D0NnU22l.js} +73 -63
- package/dist/{PurchaseOrderPrintPreview-CltLC4o4.js → PurchaseOrderPrintPreview-BmuwNbeL.js} +4 -4
- package/dist/{ReceiveRequestView-Dj7ji0DY.js → ReceiveRequestView-j79m7TKk.js} +343 -333
- package/dist/RecipeView-D_fNQQ-C.js +636 -0
- package/dist/StockView-DX_xeFBT.js +2385 -0
- package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bg49isUy.js +172 -0
- package/dist/{SupplierView-DE_M_9kd.js → SupplierView-DuFTqbOg.js} +1193 -1073
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-c428GXwc.js +3233 -0
- package/dist/{TransferTemplateView-gWGBCF3u.js → TransferTemplateView-Ccsfcetz.js} +104 -103
- package/dist/UnitView-BklpNsFN.js +674 -0
- package/dist/WarehouseView-BrURbU67.js +1066 -0
- package/dist/api/adjustment-template.d.ts +1 -0
- package/dist/api/bill.d.ts +140 -2
- package/dist/api/closing-template.d.ts +1 -0
- package/dist/api/closing.d.ts +1 -0
- package/dist/api/inventory.d.ts +405 -0
- package/dist/api/netsuite.d.ts +5 -1
- package/dist/api/purchase-order-template.d.ts +1 -0
- package/dist/api/purchase-order.d.ts +3 -0
- package/dist/api/shipment.d.ts +11 -0
- package/dist/api/stock.d.ts +2 -44
- package/dist/api/warehouse.d.ts +3 -1
- package/dist/{app-CruHLH1e.js → app-a9r50k3U.js} +68551 -67573
- package/dist/app.d.ts +643 -15
- package/dist/app.js +6 -6
- package/dist/components/FmAdminBadge.vue.d.ts +1 -4
- package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
- package/dist/components/FmInventoryTableToolbar.vue.d.ts +16 -2
- package/dist/components/FmLockableField.vue.d.ts +3 -0
- package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
- package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +2 -0
- package/dist/composable/defineApi.d.ts +1 -1
- package/dist/composable/useIframe.d.ts +2 -2
- package/dist/{decimal-izbvCC1j.js → decimal-AusUnA1W.js} +1 -1
- package/dist/{format-unit-display-4SAdfyZB.js → format-unit-display-BqkHL-ph.js} +397 -429
- package/dist/helper/array.d.ts +1 -0
- package/dist/helper/core/country/utils.d.ts +3 -4
- package/dist/helper/country.d.ts +6 -255
- package/dist/helper/number.d.ts +1 -0
- package/dist/import-export.helper-PIyNeHfa.js +238 -0
- package/dist/{index-B6GGthLw.js → index-CjxirPvn.js} +283 -268
- package/dist/{index-CnQloOEo.js → index-Dj9-pdT9.js} +1 -1
- package/dist/layout/SingleColumnLayout.vue.d.ts +6 -3
- package/dist/purchase-order-template-CQikvY1p.js +41 -0
- package/dist/router/name.d.ts +2 -0
- package/dist/stock-CDZ2uWSF.js +83 -0
- package/dist/stock-Dw908dIC.js +74 -0
- package/dist/stores/feature.d.ts +12 -0
- package/dist/stores/integration/netsuite.d.ts +42 -0
- package/dist/stores/inventory.d.ts +28 -199
- package/dist/stores/location.d.ts +331 -1
- package/dist/stores/supplier.d.ts +96 -0
- package/dist/stores/warehouse.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/{supplier-CTVE1lHO.js → supplier-BPPBUudN.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{use-ingredient-select-dialog-CM80TfX0.js → use-ingredient-select-dialog-C_fSKN3_.js} +5 -5
- package/dist/{use-inventory-binding-dialog-D_omdhgn.js → use-inventory-binding-dialog-ClAkJ864.js} +8 -8
- package/dist/views/adjustment-template/wastage-template/actions.d.ts +60 -0
- package/dist/views/adjustment-template/wastage-template/table.d.ts +60 -0
- package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
- package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
- package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
- package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +9 -2
- package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
- package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +4 -1
- package/dist/views/closing-template/helpers/import-export.helper.d.ts +5 -0
- package/dist/views/import/ImportView.vue.d.ts +3 -0
- package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
- package/dist/views/import/helper/import-export.helper.d.ts +4 -0
- package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +1 -1
- package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +181 -12
- package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +6 -0
- package/dist/views/ingredients/helper/import-export.helper.d.ts +4 -1
- package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
- package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
- package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
- package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
- package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
- package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +21 -0
- package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
- package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
- package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +420 -2
- package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +99 -0
- package/dist/views/receive-request/composables/use-receive-request-form.d.ts +644 -13
- package/dist/views/receive-request/composables/use-receive-request-table.d.ts +711 -14
- package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
- package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
- package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
- package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
- package/dist/views/stock/components/StockRecordCard.vue.d.ts +70 -1
- package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
- package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
- package/dist/views/stock/components/dialog/StockAdjustmentSideSheet.vue.d.ts +20 -0
- package/dist/views/supplier/components/SupplierForm.vue.d.ts +8 -0
- package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
- package/dist/views/supplier/composables/use-supplier-table.d.ts +4 -0
- package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -0
- package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -0
- package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +16 -0
- package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -0
- package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -0
- package/dist/views/unit/UnitView.vue.d.ts +1 -0
- package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
- package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
- package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
- package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
- package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
- package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -0
- package/package.json +3 -3
- package/dist/App-BqaRC0Sb.js +0 -276
- package/dist/ClosingDraftView-sJ_zRPeo.js +0 -1687
- package/dist/ClosingTemplateView-cNgXHq1r.js +0 -1908
- package/dist/FmAdminBadge-oCnz8SW6.js +0 -34
- package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKR8C4p_.js +0 -224
- package/dist/IngredientsView-CHHeAJH_.js +0 -1858
- package/dist/RecipeView-BukmKdVG.js +0 -621
- package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
- package/dist/StockView-wxRCw_w-.js +0 -2087
- package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eqUOnJoM.js +0 -2336
- package/dist/UnitView-BgwDmGZo.js +0 -667
- package/dist/WarehouseView-BdccenhO.js +0 -1034
- package/dist/array-Ca8T3f_G.js +0 -44
- package/dist/helper/core/country/codes.d.ts +0 -255
- package/dist/stock-BJP5BB5b.js +0 -146
|
@@ -1,1858 +0,0 @@
|
|
|
1
|
-
import { ref as L, h as X, defineComponent as le, computed as S, resolveComponent as w, openBlock as _, createBlock as A, withCtx as V, createVNode as v, unref as d, createElementBlock as D, Fragment as ee, createElementVNode as c, createCommentVNode as O, renderSlot as ve, createTextVNode as Ee, toDisplayString as T, normalizeClass as Q, onMounted as ut, watch as Je, renderList as ye, isRef as Ne, createSlots as Ze, normalizeStyle as dt, Teleport as ze, normalizeProps as mt, guardReactiveProps as ct } from "vue";
|
|
2
|
-
import { a as te, e as H, f as Qe, S as pt, h as vt, D as Le, i as _e, A as ke, b as Ue, j as Xe, k as Ve, t as et, l as ge, m as we, U as ft, n as yt, M as gt, o as Oe, p as He, c as tt, q as je, r as nt, s as bt, v as ot, w as ht, x as _t, I as xt, y as kt, z as Vt, N as St, H as Ct, u as wt, B as Ft, _ as Mt, C as It, E as $t, G as Ye, J as Et } from "./app-CruHLH1e.js";
|
|
3
|
-
import { useDialog as lt, useSnackbar as Se, components as qe, useProxiedModel as Ge, useDialogChild as Ut, useBreakpoints as Rt } from "@feedmepos/ui-library";
|
|
4
|
-
import { i as At, _ as Tt } from "./is-linked-ingredient-error-fJ2TJb3z.js";
|
|
5
|
-
import { useI18n as ae, useCoreStore as be } from "@feedmepos/mf-common";
|
|
6
|
-
import { defineStore as Dt, storeToRefs as Bt } from "pinia";
|
|
7
|
-
import { g as Pt, _ as Fe, S as Me } from "./StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js";
|
|
8
|
-
import { _ as Nt } from "./InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js";
|
|
9
|
-
import { _ as Ie } from "./IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js";
|
|
10
|
-
import { _ as xe } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
|
|
11
|
-
import { _ as zt } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
|
|
12
|
-
import { r as Lt } from "./random-CSbEbElR.js";
|
|
13
|
-
import "./array-Ca8T3f_G.js";
|
|
14
|
-
import { u as Ot } from "./FmMultiselectDialog-CZmwOkrb.js";
|
|
15
|
-
const $e = Dt("ingredientForm", function() {
|
|
16
|
-
const o = lt(), y = Se(), l = te(), n = L(!1), { t: a } = ae(), r = L();
|
|
17
|
-
function m() {
|
|
18
|
-
const b = {
|
|
19
|
-
unit: {},
|
|
20
|
-
mode: H.CREATE,
|
|
21
|
-
show: !0,
|
|
22
|
-
"onUpdate:show"(s) {
|
|
23
|
-
r.value.show = s;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
r.value = b;
|
|
27
|
-
}
|
|
28
|
-
async function p(b) {
|
|
29
|
-
const s = {
|
|
30
|
-
unit: Qe(b),
|
|
31
|
-
mode: H.UPDATE,
|
|
32
|
-
show: !0,
|
|
33
|
-
"onUpdate:show"(x) {
|
|
34
|
-
r.value.show = x;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
r.value = s;
|
|
38
|
-
}
|
|
39
|
-
async function g(b) {
|
|
40
|
-
n.value = !0;
|
|
41
|
-
try {
|
|
42
|
-
await l.deleteSku(b), y.open({
|
|
43
|
-
title: "Success",
|
|
44
|
-
message: `Deleted ${b.name}`,
|
|
45
|
-
type: "success"
|
|
46
|
-
});
|
|
47
|
-
} catch (s) {
|
|
48
|
-
s instanceof pt && At(s) ? o.open({
|
|
49
|
-
title: "Cannot delete ingredient",
|
|
50
|
-
contentComponent: Tt,
|
|
51
|
-
contentComponentProps: {
|
|
52
|
-
subject: (b == null ? void 0 : b.name) ?? "",
|
|
53
|
-
items: s.errorResponse.message
|
|
54
|
-
},
|
|
55
|
-
secondaryActions: {
|
|
56
|
-
text: "Close",
|
|
57
|
-
close: !0
|
|
58
|
-
}
|
|
59
|
-
}) : console.log("unable to delete ingredient", s), y.open({
|
|
60
|
-
title: `Cannot delete ${b.name}`,
|
|
61
|
-
message: "Please try again.",
|
|
62
|
-
type: "error"
|
|
63
|
-
}), console.error("failed to delete ingredient", s);
|
|
64
|
-
} finally {
|
|
65
|
-
n.value = !1;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
function i(b) {
|
|
69
|
-
o.open({
|
|
70
|
-
title: a("inventory.ingredient.delete.title", [(b == null ? void 0 : b.name) ?? ""]),
|
|
71
|
-
closeButton: !1,
|
|
72
|
-
message: a("inventory.ingredient.delete.message"),
|
|
73
|
-
primaryActions: {
|
|
74
|
-
text: a("common.delete"),
|
|
75
|
-
close: !0,
|
|
76
|
-
variant: "destructive"
|
|
77
|
-
},
|
|
78
|
-
secondaryActions: {
|
|
79
|
-
text: a("common.cancel"),
|
|
80
|
-
close: !0
|
|
81
|
-
}
|
|
82
|
-
}).onPrimary(() => g(b));
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
createIngredient: m,
|
|
86
|
-
updateIngredient: p,
|
|
87
|
-
deleteIngredient: i,
|
|
88
|
-
ingredientDialogProps: r,
|
|
89
|
-
ingredientViewLoading: n
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
function Ht() {
|
|
93
|
-
const { updateIngredient: u, deleteIngredient: o } = $e(), y = te(), { t: l } = ae();
|
|
94
|
-
async function n(r, m) {
|
|
95
|
-
const p = Qe(m);
|
|
96
|
-
if (r === _e.Edit) {
|
|
97
|
-
await u(p);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (r === _e.Delete) {
|
|
101
|
-
await o(p);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return { columnDefs: [
|
|
106
|
-
{
|
|
107
|
-
accessorKey: "code",
|
|
108
|
-
header: () => l("inventory.ingredient.code"),
|
|
109
|
-
enableSorting: !0,
|
|
110
|
-
size: 300
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
accessorKey: "name",
|
|
114
|
-
header: () => l("inventory.ingredient.name"),
|
|
115
|
-
enableSorting: !0,
|
|
116
|
-
size: 300,
|
|
117
|
-
cell(r) {
|
|
118
|
-
const m = r.row.original, p = y.skuBindingFlattenCache[m._id], g = p == null ? void 0 : p.inventoryBindings.some(
|
|
119
|
-
(i) => "error" in i && i.reason === "circularDependency"
|
|
120
|
-
);
|
|
121
|
-
return X("div", { class: "flex items-center w-full gap-4" }, [
|
|
122
|
-
g ? X(
|
|
123
|
-
qe.FmTooltip,
|
|
124
|
-
{},
|
|
125
|
-
{
|
|
126
|
-
default() {
|
|
127
|
-
return X(qe.FmIcon, {
|
|
128
|
-
name: "info",
|
|
129
|
-
color: "system-error-300",
|
|
130
|
-
size: "sm"
|
|
131
|
-
});
|
|
132
|
-
},
|
|
133
|
-
content() {
|
|
134
|
-
return l("inventory.inventoryBindings.circularError");
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
) : null,
|
|
138
|
-
m.name
|
|
139
|
-
]);
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
id: "unit",
|
|
144
|
-
header: () => l("inventory.ingredient.unit"),
|
|
145
|
-
cell(r) {
|
|
146
|
-
var p;
|
|
147
|
-
const m = r.row.original;
|
|
148
|
-
if (m.trackingMeasurement) {
|
|
149
|
-
const g = (p = m.unit.measurements) == null ? void 0 : p.find(
|
|
150
|
-
(i) => i.id === m.trackingMeasurement
|
|
151
|
-
);
|
|
152
|
-
if (g)
|
|
153
|
-
return `${g.name} (${g.abbrev})`;
|
|
154
|
-
}
|
|
155
|
-
return `${m.unit.name} (${m.unit.abbrev})`;
|
|
156
|
-
},
|
|
157
|
-
enableSorting: !1,
|
|
158
|
-
size: "auto"
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
accessorKey: "isInactive",
|
|
162
|
-
header: () => l("inventory.ingredient.isInactive.title"),
|
|
163
|
-
cell(r) {
|
|
164
|
-
const m = r.row.original.isInactive;
|
|
165
|
-
return X(
|
|
166
|
-
"span",
|
|
167
|
-
{
|
|
168
|
-
class: [
|
|
169
|
-
"inline-block px-3 py-1 rounded-full text-xs font-semibold",
|
|
170
|
-
m ? "bg-red-100 text-red-700" : "bg-green-100 text-green-700"
|
|
171
|
-
].join(" ")
|
|
172
|
-
},
|
|
173
|
-
l(m ? "inventory.ingredient.isInactive.yes" : "inventory.ingredient.isInactive.no")
|
|
174
|
-
);
|
|
175
|
-
},
|
|
176
|
-
enableSorting: !0,
|
|
177
|
-
size: 300
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: "action",
|
|
181
|
-
header: "",
|
|
182
|
-
cell(r) {
|
|
183
|
-
return vt(
|
|
184
|
-
[Le[_e.Edit], Le[_e.Delete]],
|
|
185
|
-
(m) => {
|
|
186
|
-
n(m, r.row.original);
|
|
187
|
-
}
|
|
188
|
-
);
|
|
189
|
-
},
|
|
190
|
-
enableSorting: !1,
|
|
191
|
-
size: 40,
|
|
192
|
-
meta: {
|
|
193
|
-
cellClass: "",
|
|
194
|
-
headerClass: ""
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
] };
|
|
198
|
-
}
|
|
199
|
-
const jt = /* @__PURE__ */ le({
|
|
200
|
-
__name: "ConvertForm",
|
|
201
|
-
props: {
|
|
202
|
-
modelValue: {},
|
|
203
|
-
rootValue: {},
|
|
204
|
-
disabled: { type: Boolean },
|
|
205
|
-
readonly: { type: Boolean }
|
|
206
|
-
},
|
|
207
|
-
emits: ["update:modelValue"],
|
|
208
|
-
setup(u, { emit: o }) {
|
|
209
|
-
const y = u, l = S(() => {
|
|
210
|
-
var s;
|
|
211
|
-
return (s = y.rootValue) == null ? void 0 : s.unit;
|
|
212
|
-
}), n = S(() => {
|
|
213
|
-
var s;
|
|
214
|
-
return (s = y.rootValue) == null ? void 0 : s._id;
|
|
215
|
-
}), a = o, { t: r } = ae(), m = S({
|
|
216
|
-
get() {
|
|
217
|
-
return !!y.modelValue;
|
|
218
|
-
},
|
|
219
|
-
set(s) {
|
|
220
|
-
s ? a("update:modelValue", {
|
|
221
|
-
measurement: null,
|
|
222
|
-
inventoryBindings: []
|
|
223
|
-
}) : a("update:modelValue", null);
|
|
224
|
-
}
|
|
225
|
-
}), p = S(() => Pt(l.value));
|
|
226
|
-
function g(s) {
|
|
227
|
-
const x = y.modelValue ?? {};
|
|
228
|
-
x.measurement = s ? `${s}` : null, a("update:modelValue", x);
|
|
229
|
-
}
|
|
230
|
-
function i(s) {
|
|
231
|
-
const x = y.modelValue ?? {};
|
|
232
|
-
x.inventoryBindings = s, a("update:modelValue", x);
|
|
233
|
-
}
|
|
234
|
-
const b = S(() => {
|
|
235
|
-
if (!y.modelValue) return null;
|
|
236
|
-
const s = y.modelValue;
|
|
237
|
-
return s.measurement ? p.value.find((x) => x.value === s.measurement) ?? null : p.value.find((x) => x.value === null) ?? null;
|
|
238
|
-
});
|
|
239
|
-
return (s, x) => {
|
|
240
|
-
const P = w("FmSwitch"), E = w("FmSelect"), N = w("FmCard");
|
|
241
|
-
return _(), A(N, {
|
|
242
|
-
variant: "outlined",
|
|
243
|
-
class: "p-16 flex flex-col gap-16"
|
|
244
|
-
}, {
|
|
245
|
-
default: V(() => {
|
|
246
|
-
var k, I;
|
|
247
|
-
return [
|
|
248
|
-
v(P, {
|
|
249
|
-
value: "",
|
|
250
|
-
"model-value": m.value,
|
|
251
|
-
"onUpdate:modelValue": x[0] || (x[0] = (M) => m.value = M),
|
|
252
|
-
label: d(r)("inventory.ingredient.convertible.title"),
|
|
253
|
-
sublabel: d(r)("inventory.ingredient.convertible.subtitle"),
|
|
254
|
-
labelPlacement: "right",
|
|
255
|
-
disabled: s.readonly
|
|
256
|
-
}, null, 8, ["model-value", "label", "sublabel", "disabled"]),
|
|
257
|
-
m.value ? (_(), D(ee, { key: 0 }, [
|
|
258
|
-
c("div", null, [
|
|
259
|
-
v(E, {
|
|
260
|
-
label: d(r)("inventory.ingredient.convertible.convertTo"),
|
|
261
|
-
modelValue: (k = b.value) == null ? void 0 : k.value,
|
|
262
|
-
"onUpdate:modelValue": g,
|
|
263
|
-
items: p.value,
|
|
264
|
-
disabled: s.readonly
|
|
265
|
-
}, null, 8, ["label", "modelValue", "items", "disabled"])
|
|
266
|
-
]),
|
|
267
|
-
v(Nt, {
|
|
268
|
-
id: n.value,
|
|
269
|
-
"model-value": ((I = s.modelValue) == null ? void 0 : I.inventoryBindings) ?? [],
|
|
270
|
-
"onUpdate:modelValue": i,
|
|
271
|
-
"exclude-binding-id": n.value,
|
|
272
|
-
rules: [d(ke)(1)],
|
|
273
|
-
readonly: s.readonly
|
|
274
|
-
}, null, 8, ["id", "model-value", "exclude-binding-id", "rules", "readonly"])
|
|
275
|
-
], 64)) : O("", !0)
|
|
276
|
-
];
|
|
277
|
-
}),
|
|
278
|
-
_: 1
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
function ie() {
|
|
284
|
-
return {
|
|
285
|
-
low: 6,
|
|
286
|
-
mid: 14
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
const Yt = {
|
|
290
|
-
key: 0,
|
|
291
|
-
class: "flex flex-col gap-4"
|
|
292
|
-
}, fe = /* @__PURE__ */ le({
|
|
293
|
-
__name: "FmLockableField",
|
|
294
|
-
props: {
|
|
295
|
-
locked: { type: Boolean },
|
|
296
|
-
disabled: { type: Boolean },
|
|
297
|
-
label: {},
|
|
298
|
-
helperText: {},
|
|
299
|
-
modelValue: {},
|
|
300
|
-
tooltipMessage: {},
|
|
301
|
-
tooltipPlacement: {},
|
|
302
|
-
tooltipZIndex: {}
|
|
303
|
-
},
|
|
304
|
-
setup(u) {
|
|
305
|
-
return (o, y) => {
|
|
306
|
-
const l = w("FmLabel"), n = w("FmIcon"), a = w("FmTooltip"), r = w("FmField");
|
|
307
|
-
return o.locked ? (_(), D("div", Yt, [
|
|
308
|
-
ve(o.$slots, "label", {}, () => [
|
|
309
|
-
v(l, {
|
|
310
|
-
label: o.label,
|
|
311
|
-
disabled: o.disabled
|
|
312
|
-
}, null, 8, ["label", "disabled"])
|
|
313
|
-
]),
|
|
314
|
-
ve(o.$slots, "field", {}, () => [
|
|
315
|
-
v(r, { disabled: o.disabled }, {
|
|
316
|
-
prepend: V(() => [
|
|
317
|
-
o.tooltipMessage ? (_(), A(a, {
|
|
318
|
-
key: 0,
|
|
319
|
-
placement: o.tooltipPlacement,
|
|
320
|
-
"z-index": o.tooltipZIndex
|
|
321
|
-
}, {
|
|
322
|
-
content: V(() => [
|
|
323
|
-
Ee(T(o.tooltipMessage), 1)
|
|
324
|
-
]),
|
|
325
|
-
default: V(() => [
|
|
326
|
-
v(n, {
|
|
327
|
-
name: "lock",
|
|
328
|
-
color: "neutral-gray-400"
|
|
329
|
-
})
|
|
330
|
-
]),
|
|
331
|
-
_: 1
|
|
332
|
-
}, 8, ["placement", "z-index"])) : (_(), A(n, {
|
|
333
|
-
key: 1,
|
|
334
|
-
name: "lock",
|
|
335
|
-
color: "neutral-gray-400"
|
|
336
|
-
}))
|
|
337
|
-
]),
|
|
338
|
-
default: V(() => [
|
|
339
|
-
ve(o.$slots, "modelValue", {}, () => [
|
|
340
|
-
c("div", {
|
|
341
|
-
class: Q([
|
|
342
|
-
o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-primary",
|
|
343
|
-
"line-clamp-1 text-ellipsis break-all"
|
|
344
|
-
])
|
|
345
|
-
}, T(o.modelValue), 3)
|
|
346
|
-
])
|
|
347
|
-
]),
|
|
348
|
-
_: 3
|
|
349
|
-
}, 8, ["disabled"])
|
|
350
|
-
]),
|
|
351
|
-
ve(o.$slots, "helper-text", {}, () => [
|
|
352
|
-
c("div", {
|
|
353
|
-
class: Q([
|
|
354
|
-
"fm-typo-en-body-sm-400 line-clamp-1",
|
|
355
|
-
o.disabled ? "text-fm-color-typo-disabled" : "text-fm-color-typo-secondary"
|
|
356
|
-
])
|
|
357
|
-
}, T(o.helperText), 3)
|
|
358
|
-
])
|
|
359
|
-
])) : ve(o.$slots, "default", { key: 1 });
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
}), qt = { class: "flex gap-8" }, Gt = { class: "flex-1" }, Wt = { class: "flex-1" }, Kt = { class: "text-fm-color-typo-secondary" }, Jt = { class: "text-fm-color-typo-secondary whitespace-nowrap" }, Zt = {
|
|
363
|
-
key: 3,
|
|
364
|
-
class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
365
|
-
}, Qt = { class: "flex flex-col" }, Xt = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, en = {
|
|
366
|
-
key: 4,
|
|
367
|
-
class: "border-1 border-fm-color-neutral-gray-200 fm-corner-radius-lg flex flex-col p-16 gap-16"
|
|
368
|
-
}, tn = { class: "flex flex-col gap-12" }, nn = { class: "flex flex-col gap-4" }, on = { class: "fm-typo-en-title-sm-600" }, ln = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, an = { class: "flex flex-col gap-4" }, sn = { class: "flex fm-corner-radius-md border-1 border-fm-color-neutral-gray-200" }, rn = { class: "flex-1 p-12 flex flex-col gap-8" }, un = { class: "mx-auto" }, dn = { class: "flex flex-col" }, mn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, cn = { class: "flex-1 p-12 flex flex-col gap-8" }, pn = { class: "mx-auto" }, vn = { class: "flex flex-col" }, fn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, yn = { class: "flex-1 p-12 flex flex-col gap-8" }, gn = { class: "mx-auto" }, bn = { class: "flex flex-col" }, hn = { class: "fm-typo-en-body-sm-600 translate-y-4" }, _n = /* @__PURE__ */ le({
|
|
369
|
-
__name: "IngredientForm",
|
|
370
|
-
props: {
|
|
371
|
-
mode: {},
|
|
372
|
-
modelValue: {},
|
|
373
|
-
disabled: { type: Boolean }
|
|
374
|
-
},
|
|
375
|
-
emits: ["update:modelValue", "click:submit"],
|
|
376
|
-
setup(u, { expose: o, emit: y }) {
|
|
377
|
-
var B;
|
|
378
|
-
const { t: l } = ae(), n = u, a = y, r = te(), m = be(), p = tt(), g = Ue(), i = S(() => g.isEnabled);
|
|
379
|
-
function b(t) {
|
|
380
|
-
if (t.length === 0) return;
|
|
381
|
-
const e = t[0], f = n.modelValue ?? {
|
|
382
|
-
unit: r.units.find((h) => h)
|
|
383
|
-
};
|
|
384
|
-
f.unit || (f.unit = e, a("update:modelValue", f));
|
|
385
|
-
}
|
|
386
|
-
ut(() => {
|
|
387
|
-
b(r.units);
|
|
388
|
-
}), Je([() => r.units], ([t]) => {
|
|
389
|
-
b(t);
|
|
390
|
-
});
|
|
391
|
-
function s() {
|
|
392
|
-
a("click:submit");
|
|
393
|
-
}
|
|
394
|
-
const x = S({
|
|
395
|
-
get() {
|
|
396
|
-
var t;
|
|
397
|
-
return ((t = n.modelValue) == null ? void 0 : t.code) ?? "";
|
|
398
|
-
},
|
|
399
|
-
set(t) {
|
|
400
|
-
const e = n.modelValue ? {
|
|
401
|
-
...n.modelValue
|
|
402
|
-
} : {};
|
|
403
|
-
e.code = t, a("update:modelValue", e);
|
|
404
|
-
}
|
|
405
|
-
}), P = S({
|
|
406
|
-
get() {
|
|
407
|
-
var t;
|
|
408
|
-
return ((t = n.modelValue) == null ? void 0 : t.isInactive) ?? !1;
|
|
409
|
-
},
|
|
410
|
-
set(t) {
|
|
411
|
-
const e = n.modelValue ? {
|
|
412
|
-
...n.modelValue
|
|
413
|
-
} : {};
|
|
414
|
-
e.isInactive = t, a("update:modelValue", e);
|
|
415
|
-
}
|
|
416
|
-
}), E = S({
|
|
417
|
-
get() {
|
|
418
|
-
var t;
|
|
419
|
-
return ((t = n.modelValue) == null ? void 0 : t.name) ?? "";
|
|
420
|
-
},
|
|
421
|
-
set(t) {
|
|
422
|
-
const e = n.modelValue ? {
|
|
423
|
-
...n.modelValue
|
|
424
|
-
} : {};
|
|
425
|
-
e.name = t, a("update:modelValue", e);
|
|
426
|
-
}
|
|
427
|
-
}), N = S({
|
|
428
|
-
get() {
|
|
429
|
-
var e, f;
|
|
430
|
-
const t = (f = (e = n.modelValue) == null ? void 0 : e.defaultCost) == null ? void 0 : f.costPerUnit;
|
|
431
|
-
return t ? +Xe(t) : 0;
|
|
432
|
-
},
|
|
433
|
-
set(t) {
|
|
434
|
-
var f, h, R, $;
|
|
435
|
-
const e = n.modelValue ? {
|
|
436
|
-
...n.modelValue
|
|
437
|
-
} : {};
|
|
438
|
-
e.defaultCost ?? (e.defaultCost = {
|
|
439
|
-
costPerUnit: {
|
|
440
|
-
amount: 0,
|
|
441
|
-
precision: 2,
|
|
442
|
-
currency: ((f = Ve(m.currentCountry.value)) == null ? void 0 : f.currency) ?? "MYR"
|
|
443
|
-
},
|
|
444
|
-
measurement: ($ = (R = (h = n.modelValue) == null ? void 0 : h.unit) == null ? void 0 : R.measurements) == null ? void 0 : $.find(
|
|
445
|
-
(j) => {
|
|
446
|
-
var Y;
|
|
447
|
-
return j.id === ((Y = n.modelValue) == null ? void 0 : Y.trackingMeasurement);
|
|
448
|
-
}
|
|
449
|
-
)
|
|
450
|
-
}), e.defaultCost.costPerUnit = {
|
|
451
|
-
...e.defaultCost.costPerUnit,
|
|
452
|
-
...et(+t, 4)
|
|
453
|
-
}, a("update:modelValue", e);
|
|
454
|
-
}
|
|
455
|
-
}), k = S(() => {
|
|
456
|
-
var e, f, h;
|
|
457
|
-
const t = ((e = n.modelValue) == null ? void 0 : e.unit) ?? r.units.find((R) => R);
|
|
458
|
-
return t ? {
|
|
459
|
-
_id: t._id,
|
|
460
|
-
measurement: (f = n.modelValue) == null ? void 0 : f.trackingMeasurement,
|
|
461
|
-
name: ((h = t.measurements.find((R) => {
|
|
462
|
-
var $;
|
|
463
|
-
return R.id === (($ = n.modelValue) == null ? void 0 : $.trackingMeasurement);
|
|
464
|
-
})) == null ? void 0 : h.name) ?? t.name
|
|
465
|
-
} : null;
|
|
466
|
-
}), I = S(
|
|
467
|
-
() => r.units.flatMap(({ name: t, _id: e, abbrev: f, measurements: h }) => [
|
|
468
|
-
{
|
|
469
|
-
label: `${t}`,
|
|
470
|
-
value: null,
|
|
471
|
-
displayAsSection: !0
|
|
472
|
-
},
|
|
473
|
-
{
|
|
474
|
-
label: `${t} (${f})`,
|
|
475
|
-
value: { _id: e },
|
|
476
|
-
displayAsSection: !1
|
|
477
|
-
},
|
|
478
|
-
...h.map(({ id: R, name: $, abbrev: j }) => ({
|
|
479
|
-
label: `${$} (${j})`,
|
|
480
|
-
value: { _id: e, measurement: R },
|
|
481
|
-
displayAsSection: !1
|
|
482
|
-
}))
|
|
483
|
-
])
|
|
484
|
-
);
|
|
485
|
-
function M(t) {
|
|
486
|
-
var e, f, h, R, $;
|
|
487
|
-
return ((f = (e = n.modelValue) == null ? void 0 : e.unit) == null ? void 0 : f._id) === ((h = t.value) == null ? void 0 : h._id) && ((R = n.modelValue) == null ? void 0 : R.trackingMeasurement) === (($ = t.value) == null ? void 0 : $.measurement);
|
|
488
|
-
}
|
|
489
|
-
function ne(t) {
|
|
490
|
-
var j, Y;
|
|
491
|
-
if (!t) return;
|
|
492
|
-
const { _id: e, measurement: f } = t, h = f || void 0, R = r.units.find((G) => G._id === e);
|
|
493
|
-
if (!R)
|
|
494
|
-
return;
|
|
495
|
-
const $ = n.modelValue ?? {};
|
|
496
|
-
$.unit = R, $.trackingMeasurement = h, $.convert && ($.convert.measurement = h || null), p.enableTotalCost && ($.defaultCost = {
|
|
497
|
-
measurement: R.measurements.find((G) => G.id === h),
|
|
498
|
-
costPerUnit: {
|
|
499
|
-
...((j = $.defaultCost) == null ? void 0 : j.costPerUnit) ?? {
|
|
500
|
-
amount: 0,
|
|
501
|
-
precision: 2,
|
|
502
|
-
currency: ((Y = Ve(m.currentCountry.value)) == null ? void 0 : Y.currency) ?? "MYR"
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}), a("update:modelValue", $);
|
|
506
|
-
}
|
|
507
|
-
const W = S({
|
|
508
|
-
get() {
|
|
509
|
-
var t;
|
|
510
|
-
return ((t = n.modelValue) == null ? void 0 : t.convert) ?? null;
|
|
511
|
-
},
|
|
512
|
-
set(t) {
|
|
513
|
-
const e = n.modelValue ? {
|
|
514
|
-
...n.modelValue
|
|
515
|
-
} : {};
|
|
516
|
-
t ? e.convert = t : e.convert = null, a("update:modelValue", e);
|
|
517
|
-
}
|
|
518
|
-
}), K = S(() => ge.options.filter(
|
|
519
|
-
(t) => t === ge.enum.FIFO || t === ge.enum.WAVG
|
|
520
|
-
).map((t) => ({
|
|
521
|
-
label: l(`inventory.ingredient.valuationMethod.${t}`),
|
|
522
|
-
value: t
|
|
523
|
-
}))), ue = S({
|
|
524
|
-
get() {
|
|
525
|
-
var t;
|
|
526
|
-
return ((t = n.modelValue) == null ? void 0 : t.valuation) ?? "WAVG";
|
|
527
|
-
},
|
|
528
|
-
set(t) {
|
|
529
|
-
const e = n.modelValue ? {
|
|
530
|
-
...n.modelValue
|
|
531
|
-
} : {};
|
|
532
|
-
e.valuation = t, a("update:modelValue", e);
|
|
533
|
-
}
|
|
534
|
-
}), se = S({
|
|
535
|
-
get() {
|
|
536
|
-
var t;
|
|
537
|
-
return ((t = n.modelValue) == null ? void 0 : t.customAttributes) ?? {};
|
|
538
|
-
},
|
|
539
|
-
set(t) {
|
|
540
|
-
const e = n.modelValue ? {
|
|
541
|
-
...n.modelValue
|
|
542
|
-
} : {};
|
|
543
|
-
e.customAttributes = t, a("update:modelValue", e);
|
|
544
|
-
}
|
|
545
|
-
}), re = L();
|
|
546
|
-
o({
|
|
547
|
-
validateInputs: () => {
|
|
548
|
-
var t, e;
|
|
549
|
-
(e = (t = re.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
|
|
550
|
-
},
|
|
551
|
-
resetInputsValidation: () => {
|
|
552
|
-
var t, e;
|
|
553
|
-
(e = (t = re.value) == null ? void 0 : t.resetInputsValidation) == null || e.call(t);
|
|
554
|
-
},
|
|
555
|
-
resetInputs: () => {
|
|
556
|
-
var t, e;
|
|
557
|
-
(e = (t = re.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
const oe = L(!1), he = S(
|
|
561
|
-
() => {
|
|
562
|
-
var t, e, f;
|
|
563
|
-
return (t = n.modelValue) != null && t._id ? ((f = r.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : f.filter(
|
|
564
|
-
(h) => h.from === "INGREDIENT"
|
|
565
|
-
)) ?? [] : [];
|
|
566
|
-
}
|
|
567
|
-
), de = S(
|
|
568
|
-
() => {
|
|
569
|
-
var t, e, f;
|
|
570
|
-
return (t = n.modelValue) != null && t._id ? ((f = r.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : f.filter(
|
|
571
|
-
(h) => h.from === "RECIPE"
|
|
572
|
-
)) ?? [] : [];
|
|
573
|
-
}
|
|
574
|
-
), me = S(
|
|
575
|
-
() => {
|
|
576
|
-
var t, e, f;
|
|
577
|
-
return (t = n.modelValue) != null && t._id ? ((f = r.menu.bindedBySkuId[(e = n.modelValue) == null ? void 0 : e._id]) == null ? void 0 : f.filter((h) => h.from === "MENU")) ?? [] : [];
|
|
578
|
-
}
|
|
579
|
-
), Ce = S(
|
|
580
|
-
() => r.skus.map((t) => ({ label: t.name, value: t.code }))
|
|
581
|
-
), U = L((B = n.modelValue) == null ? void 0 : B.code);
|
|
582
|
-
function C(t) {
|
|
583
|
-
var f;
|
|
584
|
-
const e = t.el;
|
|
585
|
-
e && ((f = e.querySelector("[x-should-scroll-into=true]")) == null || f.scrollIntoView());
|
|
586
|
-
}
|
|
587
|
-
const ce = S(
|
|
588
|
-
() => {
|
|
589
|
-
var t, e, f, h, R, $;
|
|
590
|
-
return ((h = (f = (e = (t = n.modelValue) == null ? void 0 : t.unit) == null ? void 0 : e.measurements) == null ? void 0 : f.find(
|
|
591
|
-
(j) => {
|
|
592
|
-
var Y;
|
|
593
|
-
return j.id === ((Y = n.modelValue) == null ? void 0 : Y.trackingMeasurement);
|
|
594
|
-
}
|
|
595
|
-
)) == null ? void 0 : h.abbrev) ?? (($ = (R = n.modelValue) == null ? void 0 : R.unit) == null ? void 0 : $.abbrev);
|
|
596
|
-
}
|
|
597
|
-
), J = S({
|
|
598
|
-
get() {
|
|
599
|
-
var t, e;
|
|
600
|
-
return ((e = (t = n.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.low) ?? ie().low;
|
|
601
|
-
},
|
|
602
|
-
set(t) {
|
|
603
|
-
var h;
|
|
604
|
-
const e = ((h = n.modelValue) == null ? void 0 : h.thresholds) ?? ie();
|
|
605
|
-
e.low = t;
|
|
606
|
-
const f = n.modelValue ? {
|
|
607
|
-
...n.modelValue
|
|
608
|
-
} : {};
|
|
609
|
-
f.thresholds = e, a("update:modelValue", f);
|
|
610
|
-
}
|
|
611
|
-
}), Z = S({
|
|
612
|
-
get() {
|
|
613
|
-
var t, e;
|
|
614
|
-
return ((e = (t = n.modelValue) == null ? void 0 : t.thresholds) == null ? void 0 : e.mid) ?? ie().mid;
|
|
615
|
-
},
|
|
616
|
-
set(t) {
|
|
617
|
-
var h;
|
|
618
|
-
const e = ((h = n.modelValue) == null ? void 0 : h.thresholds) ?? ie();
|
|
619
|
-
e.mid = t;
|
|
620
|
-
const f = n.modelValue ? {
|
|
621
|
-
...n.modelValue
|
|
622
|
-
} : {};
|
|
623
|
-
f.thresholds = e, a("update:modelValue", f);
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
function z() {
|
|
627
|
-
return function(e) {
|
|
628
|
-
return typeof (e == null ? void 0 : e.low) != "number" || typeof (e == null ? void 0 : e.mid) != "number" ? "Required" : e.low >= e.mid ? "Days for red indicator should be less than yellow indicator." : !0;
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
return (t, e) => {
|
|
632
|
-
const f = w("FmTextField"), h = w("FmLabel"), R = w("FmField"), $ = w("FmMenuHeader"), j = w("FmMenuDivider"), Y = w("FmMenuItem"), G = w("FmMenu"), pe = w("FmFormGroup"), rt = w("FmSelect"), Re = w("FmSwitch"), Ae = w("FmStepperField"), it = w("FmForm");
|
|
633
|
-
return _(), A(it, {
|
|
634
|
-
disabled: t.disabled,
|
|
635
|
-
ref_key: "formRef",
|
|
636
|
-
ref: re,
|
|
637
|
-
class: "flex flex-col gap-32",
|
|
638
|
-
onValidationSuccess: s
|
|
639
|
-
}, {
|
|
640
|
-
default: V(() => {
|
|
641
|
-
var Te, De, Be, Pe;
|
|
642
|
-
return [
|
|
643
|
-
c("div", qt, [
|
|
644
|
-
c("div", Gt, [
|
|
645
|
-
v(fe, {
|
|
646
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
647
|
-
"tooltip-z-index": 50,
|
|
648
|
-
label: d(l)("inventory.ingredient.code"),
|
|
649
|
-
"model-value": x.value,
|
|
650
|
-
"onUpdate:modelValue": e[1] || (e[1] = (F) => x.value = F),
|
|
651
|
-
locked: i.value,
|
|
652
|
-
disabled: t.disabled
|
|
653
|
-
}, {
|
|
654
|
-
default: V(() => [
|
|
655
|
-
v(f, {
|
|
656
|
-
label: d(l)("inventory.ingredient.code"),
|
|
657
|
-
"model-value": x.value,
|
|
658
|
-
"onUpdate:modelValue": e[0] || (e[0] = (F) => x.value = F),
|
|
659
|
-
rules: [d(we)(), d(ft)(Ce.value, U.value)],
|
|
660
|
-
"label-mark": "required"
|
|
661
|
-
}, null, 8, ["label", "model-value", "rules"])
|
|
662
|
-
]),
|
|
663
|
-
_: 1
|
|
664
|
-
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
665
|
-
]),
|
|
666
|
-
c("div", Wt, [
|
|
667
|
-
v(fe, {
|
|
668
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
669
|
-
"tooltip-z-index": 50,
|
|
670
|
-
label: d(l)("inventory.ingredient.name"),
|
|
671
|
-
"model-value": E.value,
|
|
672
|
-
"onUpdate:modelValue": e[3] || (e[3] = (F) => E.value = F),
|
|
673
|
-
locked: i.value,
|
|
674
|
-
disabled: t.disabled
|
|
675
|
-
}, {
|
|
676
|
-
default: V(() => [
|
|
677
|
-
v(f, {
|
|
678
|
-
label: d(l)("inventory.ingredient.name"),
|
|
679
|
-
"model-value": E.value,
|
|
680
|
-
"onUpdate:modelValue": e[2] || (e[2] = (F) => E.value = F),
|
|
681
|
-
rules: [d(we)()],
|
|
682
|
-
"label-mark": "required"
|
|
683
|
-
}, null, 8, ["label", "model-value", "rules"])
|
|
684
|
-
]),
|
|
685
|
-
_: 1
|
|
686
|
-
}, 8, ["label", "model-value", "locked", "disabled"])
|
|
687
|
-
])
|
|
688
|
-
]),
|
|
689
|
-
v(fe, {
|
|
690
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
691
|
-
"tooltip-z-index": 50,
|
|
692
|
-
label: d(l)("inventory.ingredient.unit"),
|
|
693
|
-
"helper-text": (Te = t.modelValue) != null && Te.trackingMeasurement ? `Base unit: ${(Be = (De = t.modelValue) == null ? void 0 : De.unit) == null ? void 0 : Be.name}` : void 0,
|
|
694
|
-
"model-value": (Pe = k.value) == null ? void 0 : Pe.name,
|
|
695
|
-
locked: i.value,
|
|
696
|
-
disabled: t.disabled
|
|
697
|
-
}, {
|
|
698
|
-
default: V(() => [
|
|
699
|
-
v(pe, {
|
|
700
|
-
"model-value": k.value,
|
|
701
|
-
rules: [d(we)()],
|
|
702
|
-
"label-mark": "required"
|
|
703
|
-
}, {
|
|
704
|
-
label: V(() => [
|
|
705
|
-
v(h, {
|
|
706
|
-
label: d(l)("inventory.ingredient.unit")
|
|
707
|
-
}, null, 8, ["label"])
|
|
708
|
-
]),
|
|
709
|
-
default: V(({ invalid: F }) => [
|
|
710
|
-
v(G, null, {
|
|
711
|
-
"menu-button": V(() => [
|
|
712
|
-
v(R, {
|
|
713
|
-
class: Q([
|
|
714
|
-
"fm-typo-en-body-lg-400",
|
|
715
|
-
{
|
|
716
|
-
"text-fm-color-typo-primary": !t.disabled,
|
|
717
|
-
"text-fm-color-typo-disabled": t.disabled
|
|
718
|
-
}
|
|
719
|
-
]),
|
|
720
|
-
invalid: F,
|
|
721
|
-
"append-icon": "expand_more"
|
|
722
|
-
}, {
|
|
723
|
-
default: V(() => {
|
|
724
|
-
var q;
|
|
725
|
-
return [
|
|
726
|
-
Ee(T((q = k.value) == null ? void 0 : q.name), 1)
|
|
727
|
-
];
|
|
728
|
-
}),
|
|
729
|
-
_: 2
|
|
730
|
-
}, 1032, ["class", "invalid"])
|
|
731
|
-
]),
|
|
732
|
-
default: V(() => [
|
|
733
|
-
c("div", {
|
|
734
|
-
class: "overflow-x-hidden overflow-y-auto max-h-[300px]",
|
|
735
|
-
onVnodeMounted: C
|
|
736
|
-
}, [
|
|
737
|
-
(_(!0), D(ee, null, ye(I.value, (q) => (_(), D(ee, {
|
|
738
|
-
key: q.label
|
|
739
|
-
}, [
|
|
740
|
-
q.displayAsSection ? (_(), D(ee, { key: 0 }, [
|
|
741
|
-
v($, {
|
|
742
|
-
label: q.label
|
|
743
|
-
}, null, 8, ["label"]),
|
|
744
|
-
v(j)
|
|
745
|
-
], 64)) : (_(), A(Y, {
|
|
746
|
-
key: 1,
|
|
747
|
-
label: q.label,
|
|
748
|
-
"model-value": M(q),
|
|
749
|
-
onClick: (Jn) => ne(q.value),
|
|
750
|
-
"x-should-scroll-into": `${M(q)}`
|
|
751
|
-
}, null, 8, ["label", "model-value", "onClick", "x-should-scroll-into"]))
|
|
752
|
-
], 64))), 128))
|
|
753
|
-
], 512)
|
|
754
|
-
]),
|
|
755
|
-
_: 2
|
|
756
|
-
}, 1024)
|
|
757
|
-
]),
|
|
758
|
-
_: 1
|
|
759
|
-
}, 8, ["model-value", "rules"])
|
|
760
|
-
]),
|
|
761
|
-
_: 1
|
|
762
|
-
}, 8, ["label", "helper-text", "model-value", "locked", "disabled"]),
|
|
763
|
-
d(p).enableTotalCost ? (_(), A(fe, {
|
|
764
|
-
key: 0,
|
|
765
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
766
|
-
"tooltip-z-index": 50,
|
|
767
|
-
label: d(l)("inventory.ingredient.valuationMethod.title"),
|
|
768
|
-
"model-value": d(l)("inventory.ingredient.valuationMethod." + ue.value),
|
|
769
|
-
locked: i.value,
|
|
770
|
-
disabled: t.disabled
|
|
771
|
-
}, {
|
|
772
|
-
label: V(() => [
|
|
773
|
-
v(xe, { "z-index": 50 }, {
|
|
774
|
-
default: V(() => [
|
|
775
|
-
v(h, {
|
|
776
|
-
label: d(l)("inventory.ingredient.valuationMethod.title")
|
|
777
|
-
}, null, 8, ["label"])
|
|
778
|
-
]),
|
|
779
|
-
_: 1
|
|
780
|
-
})
|
|
781
|
-
]),
|
|
782
|
-
default: V(() => [
|
|
783
|
-
v(rt, {
|
|
784
|
-
class: "col-span-2",
|
|
785
|
-
label: d(l)("inventory.ingredient.valuationMethod.title"),
|
|
786
|
-
"model-value": ue.value,
|
|
787
|
-
"onUpdate:modelValue": e[4] || (e[4] = (F) => ue.value = F),
|
|
788
|
-
items: K.value
|
|
789
|
-
}, null, 8, ["label", "model-value", "items"])
|
|
790
|
-
]),
|
|
791
|
-
_: 1
|
|
792
|
-
}, 8, ["label", "model-value", "locked", "disabled"])) : O("", !0),
|
|
793
|
-
d(p).enableTotalCost ? (_(), A(fe, {
|
|
794
|
-
key: 1,
|
|
795
|
-
"tooltip-message": "This field is managed by NetSuite",
|
|
796
|
-
"tooltip-z-index": 50,
|
|
797
|
-
"model-value": `${d(yt)()} ${N.value}`,
|
|
798
|
-
locked: i.value,
|
|
799
|
-
disabled: t.disabled
|
|
800
|
-
}, {
|
|
801
|
-
label: V(() => [
|
|
802
|
-
v(xe, { "z-index": 50 }, {
|
|
803
|
-
default: V(() => [
|
|
804
|
-
v(h, {
|
|
805
|
-
label: d(l)("inventory.ingredient.pricePerUnit")
|
|
806
|
-
}, null, 8, ["label"])
|
|
807
|
-
]),
|
|
808
|
-
_: 1
|
|
809
|
-
})
|
|
810
|
-
]),
|
|
811
|
-
default: V(() => [
|
|
812
|
-
v(f, {
|
|
813
|
-
"model-value": N.value,
|
|
814
|
-
"onUpdate:modelValue": e[5] || (e[5] = (F) => N.value = F),
|
|
815
|
-
rules: [d(ke)(0), d(gt)(4)]
|
|
816
|
-
}, {
|
|
817
|
-
label: V(() => [
|
|
818
|
-
v(xe, { "z-index": 50 }, {
|
|
819
|
-
default: V(() => [
|
|
820
|
-
v(h, {
|
|
821
|
-
label: d(l)("inventory.ingredient.pricePerUnit")
|
|
822
|
-
}, null, 8, ["label"])
|
|
823
|
-
]),
|
|
824
|
-
_: 1
|
|
825
|
-
})
|
|
826
|
-
]),
|
|
827
|
-
prepend: V(() => {
|
|
828
|
-
var F, q;
|
|
829
|
-
return [
|
|
830
|
-
c("div", Kt, T(d(Oe)(((F = d(m).currentCountry) == null ? void 0 : F.value) ?? d(He)) === "MYR" ? "RM" : d(Oe)(((q = d(m).currentCountry) == null ? void 0 : q.value) ?? d(He))), 1)
|
|
831
|
-
];
|
|
832
|
-
}),
|
|
833
|
-
append: V(() => [
|
|
834
|
-
c("div", Jt, " / " + T(ce.value), 1)
|
|
835
|
-
]),
|
|
836
|
-
_: 1
|
|
837
|
-
}, 8, ["model-value", "rules"])
|
|
838
|
-
]),
|
|
839
|
-
_: 1
|
|
840
|
-
}, 8, ["model-value", "locked", "disabled"])) : O("", !0),
|
|
841
|
-
!i.value || W.value ? (_(), A(jt, {
|
|
842
|
-
key: 2,
|
|
843
|
-
"model-value": W.value,
|
|
844
|
-
"onUpdate:modelValue": e[6] || (e[6] = (F) => W.value = F),
|
|
845
|
-
"root-value": t.modelValue,
|
|
846
|
-
readonly: i.value
|
|
847
|
-
}, null, 8, ["model-value", "root-value", "readonly"])) : O("", !0),
|
|
848
|
-
t.mode !== d(H).CREATE ? (_(), D("div", Zt, [
|
|
849
|
-
v(Re, {
|
|
850
|
-
label: d(l)("inventory.ingredient.isInactive.title"),
|
|
851
|
-
"model-value": P.value,
|
|
852
|
-
"onUpdate:modelValue": e[7] || (e[7] = (F) => P.value = F),
|
|
853
|
-
"label-placement": "right",
|
|
854
|
-
disabled: i.value
|
|
855
|
-
}, null, 8, ["label", "model-value", "disabled"]),
|
|
856
|
-
c("div", Qt, [
|
|
857
|
-
c("div", Xt, T(d(l)("inventory.ingredient.isInactive.preventFromOrder")), 1)
|
|
858
|
-
])
|
|
859
|
-
])) : O("", !0),
|
|
860
|
-
t.mode !== d(H).CREATE ? (_(), D("div", en, [
|
|
861
|
-
c("div", null, [
|
|
862
|
-
v(Re, {
|
|
863
|
-
label: d(l)("inventory.ingredient.bindedItems.title"),
|
|
864
|
-
modelValue: oe.value,
|
|
865
|
-
"onUpdate:modelValue": e[8] || (e[8] = (F) => oe.value = F),
|
|
866
|
-
"label-placement": "right"
|
|
867
|
-
}, null, 8, ["label", "modelValue"])
|
|
868
|
-
]),
|
|
869
|
-
oe.value && he.value.length ? (_(), A(Ie, {
|
|
870
|
-
key: 0,
|
|
871
|
-
name: d(l)("inventory.ingredient.bindedItems.ingredient"),
|
|
872
|
-
bindings: he.value
|
|
873
|
-
}, null, 8, ["name", "bindings"])) : O("", !0),
|
|
874
|
-
oe.value && de.value.length ? (_(), A(Ie, {
|
|
875
|
-
key: 1,
|
|
876
|
-
name: d(l)("inventory.ingredient.bindedItems.recipe"),
|
|
877
|
-
bindings: de.value
|
|
878
|
-
}, null, 8, ["name", "bindings"])) : O("", !0),
|
|
879
|
-
oe.value && me.value.length ? (_(), A(Ie, {
|
|
880
|
-
key: 2,
|
|
881
|
-
name: d(l)("inventory.ingredient.bindedItems.menu"),
|
|
882
|
-
bindings: me.value
|
|
883
|
-
}, null, 8, ["name", "bindings"])) : O("", !0)
|
|
884
|
-
])) : O("", !0),
|
|
885
|
-
c("div", tn, [
|
|
886
|
-
c("div", nn, [
|
|
887
|
-
v(xe, null, {
|
|
888
|
-
default: V(() => [
|
|
889
|
-
c("div", on, T(d(l)("inventory.ingredient.threshold.title")), 1)
|
|
890
|
-
]),
|
|
891
|
-
_: 1
|
|
892
|
-
}),
|
|
893
|
-
c("div", ln, T(d(l)("inventory.ingredient.threshold.subtitle")), 1)
|
|
894
|
-
]),
|
|
895
|
-
c("div", an, [
|
|
896
|
-
v(pe, {
|
|
897
|
-
"model-value": { low: J.value, mid: Z.value },
|
|
898
|
-
rules: [z()]
|
|
899
|
-
}, null, 8, ["model-value", "rules"]),
|
|
900
|
-
c("div", sn, [
|
|
901
|
-
c("div", rn, [
|
|
902
|
-
c("div", un, [
|
|
903
|
-
v(Fe, {
|
|
904
|
-
days: J.value,
|
|
905
|
-
level: d(Me).low
|
|
906
|
-
}, null, 8, ["days", "level"])
|
|
907
|
-
]),
|
|
908
|
-
c("div", dn, [
|
|
909
|
-
c("div", mn, T(d(l)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
910
|
-
v(Ae, {
|
|
911
|
-
modelValue: J.value,
|
|
912
|
-
"onUpdate:modelValue": e[9] || (e[9] = (F) => J.value = F),
|
|
913
|
-
rules: [d(ke)(0)]
|
|
914
|
-
}, {
|
|
915
|
-
append: V(() => e[12] || (e[12] = [
|
|
916
|
-
c("div", {
|
|
917
|
-
class: "text-fm-color-typo-secondary",
|
|
918
|
-
style: { "padding-right": "32px" }
|
|
919
|
-
}, "days", -1)
|
|
920
|
-
])),
|
|
921
|
-
_: 1
|
|
922
|
-
}, 8, ["modelValue", "rules"])
|
|
923
|
-
])
|
|
924
|
-
]),
|
|
925
|
-
e[14] || (e[14] = c("div", {
|
|
926
|
-
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
927
|
-
style: { width: "1px" }
|
|
928
|
-
}, [
|
|
929
|
-
c("div", {
|
|
930
|
-
class: "absolute bg-white",
|
|
931
|
-
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
932
|
-
}, " < ")
|
|
933
|
-
], -1)),
|
|
934
|
-
c("div", cn, [
|
|
935
|
-
c("div", pn, [
|
|
936
|
-
v(Fe, {
|
|
937
|
-
days: Z.value,
|
|
938
|
-
level: d(Me).mid
|
|
939
|
-
}, null, 8, ["days", "level"])
|
|
940
|
-
]),
|
|
941
|
-
c("div", vn, [
|
|
942
|
-
c("div", fn, T(d(l)("inventory.ingredient.threshold.whenRemaining")), 1),
|
|
943
|
-
v(Ae, {
|
|
944
|
-
modelValue: Z.value,
|
|
945
|
-
"onUpdate:modelValue": e[10] || (e[10] = (F) => Z.value = F),
|
|
946
|
-
rules: [d(ke)(0)]
|
|
947
|
-
}, {
|
|
948
|
-
append: V(() => e[13] || (e[13] = [
|
|
949
|
-
c("div", {
|
|
950
|
-
class: "text-fm-color-typo-secondary",
|
|
951
|
-
style: { "padding-right": "32px" }
|
|
952
|
-
}, "days", -1)
|
|
953
|
-
])),
|
|
954
|
-
_: 1
|
|
955
|
-
}, 8, ["modelValue", "rules"])
|
|
956
|
-
])
|
|
957
|
-
]),
|
|
958
|
-
e[15] || (e[15] = c("div", {
|
|
959
|
-
class: "h-full bg-fm-color-neutral-gray-200 relative",
|
|
960
|
-
style: { width: "1px" }
|
|
961
|
-
}, [
|
|
962
|
-
c("div", {
|
|
963
|
-
class: "absolute bg-white",
|
|
964
|
-
style: { transform: "translate(-50%, -50%)", left: "50%", top: "24px" }
|
|
965
|
-
}, " < ")
|
|
966
|
-
], -1)),
|
|
967
|
-
c("div", yn, [
|
|
968
|
-
c("div", gn, [
|
|
969
|
-
v(Fe, {
|
|
970
|
-
days: Z.value + 1,
|
|
971
|
-
level: d(Me).high
|
|
972
|
-
}, null, 8, ["days", "level"])
|
|
973
|
-
]),
|
|
974
|
-
c("div", bn, [
|
|
975
|
-
c("div", hn, T(d(l)("inventory.ingredient.threshold.stockIsStaple")), 1)
|
|
976
|
-
])
|
|
977
|
-
])
|
|
978
|
-
])
|
|
979
|
-
])
|
|
980
|
-
]),
|
|
981
|
-
c("div", null, [
|
|
982
|
-
v(zt, {
|
|
983
|
-
entity: "inventorySku",
|
|
984
|
-
modelValue: se.value,
|
|
985
|
-
"onUpdate:modelValue": e[11] || (e[11] = (F) => se.value = F)
|
|
986
|
-
}, null, 8, ["modelValue"])
|
|
987
|
-
])
|
|
988
|
-
];
|
|
989
|
-
}),
|
|
990
|
-
_: 1
|
|
991
|
-
}, 8, ["disabled"]);
|
|
992
|
-
};
|
|
993
|
-
}
|
|
994
|
-
}), xn = { class: "flex flex-col gap-32" }, kn = { class: "flex gap-4" }, Vn = /* @__PURE__ */ le({
|
|
995
|
-
__name: "IngredientDialog",
|
|
996
|
-
props: {
|
|
997
|
-
show: { type: Boolean },
|
|
998
|
-
unit: {},
|
|
999
|
-
mode: { default: H.READ }
|
|
1000
|
-
},
|
|
1001
|
-
emits: ["update:show"],
|
|
1002
|
-
setup(u) {
|
|
1003
|
-
const o = u, y = te(), l = Ue(), n = Se(), { t: a } = ae(), r = Ge(o, "show"), m = Ge(o, "unit"), p = S(
|
|
1004
|
-
() => {
|
|
1005
|
-
var k;
|
|
1006
|
-
return l.isEnabled && l.netSuiteItemBySkuId.has((k = o.unit) == null ? void 0 : k._id);
|
|
1007
|
-
}
|
|
1008
|
-
), g = S(() => {
|
|
1009
|
-
switch (o.mode) {
|
|
1010
|
-
case H.READ:
|
|
1011
|
-
return "";
|
|
1012
|
-
case H.UPDATE:
|
|
1013
|
-
return a("inventory.ingredient.update.title");
|
|
1014
|
-
case H.CREATE:
|
|
1015
|
-
return a("inventory.ingredient.create.title");
|
|
1016
|
-
}
|
|
1017
|
-
return "";
|
|
1018
|
-
}), i = S(() => {
|
|
1019
|
-
switch (o.mode) {
|
|
1020
|
-
case H.READ:
|
|
1021
|
-
return "";
|
|
1022
|
-
case H.UPDATE:
|
|
1023
|
-
return a("common.save");
|
|
1024
|
-
case H.CREATE:
|
|
1025
|
-
return a("common.add");
|
|
1026
|
-
}
|
|
1027
|
-
return "";
|
|
1028
|
-
}), b = L(), s = L(!1);
|
|
1029
|
-
async function x() {
|
|
1030
|
-
s.value = !0;
|
|
1031
|
-
try {
|
|
1032
|
-
await y.createSku(m.value), r.value = !1, n.open({
|
|
1033
|
-
title: a("inventory.common.success"),
|
|
1034
|
-
message: a("inventory.ingredient.create.success", { name: m.value.name }),
|
|
1035
|
-
type: "success"
|
|
1036
|
-
});
|
|
1037
|
-
} catch (k) {
|
|
1038
|
-
k instanceof je || n.open({
|
|
1039
|
-
title: a("inventory.ingredient.create.error.title"),
|
|
1040
|
-
message: a("inventory.ingredient.create.error.message"),
|
|
1041
|
-
type: "error"
|
|
1042
|
-
});
|
|
1043
|
-
} finally {
|
|
1044
|
-
s.value = !1;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
async function P() {
|
|
1048
|
-
s.value = !0;
|
|
1049
|
-
try {
|
|
1050
|
-
await y.updateSku(m.value), s.value = !1, r.value = !1, n.open({
|
|
1051
|
-
title: a("inventory.common.success"),
|
|
1052
|
-
message: a("inventory.ingredient.update.success", { name: m.value.name }),
|
|
1053
|
-
type: "success"
|
|
1054
|
-
});
|
|
1055
|
-
} catch (k) {
|
|
1056
|
-
k instanceof je || n.open({
|
|
1057
|
-
title: a("inventory.ingredient.update.error.title"),
|
|
1058
|
-
message: a("inventory.ingredient.update.error.message"),
|
|
1059
|
-
type: "error"
|
|
1060
|
-
});
|
|
1061
|
-
} finally {
|
|
1062
|
-
s.value = !1;
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
function E() {
|
|
1066
|
-
var k, I;
|
|
1067
|
-
(I = (k = b.value) == null ? void 0 : k.validateInputs) == null || I.call(k);
|
|
1068
|
-
}
|
|
1069
|
-
function N() {
|
|
1070
|
-
switch (o.mode) {
|
|
1071
|
-
case H.READ:
|
|
1072
|
-
return;
|
|
1073
|
-
case H.UPDATE:
|
|
1074
|
-
return P();
|
|
1075
|
-
case H.CREATE:
|
|
1076
|
-
return x();
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
return (k, I) => {
|
|
1080
|
-
const M = w("FmChip"), ne = w("FmButton"), W = w("FmSideSheet");
|
|
1081
|
-
return _(), A(W, {
|
|
1082
|
-
"model-value": d(r),
|
|
1083
|
-
"onUpdate:modelValue": I[3] || (I[3] = (K) => Ne(r) ? r.value = K : null),
|
|
1084
|
-
header: g.value,
|
|
1085
|
-
"close-button": "",
|
|
1086
|
-
"dismiss-away": "",
|
|
1087
|
-
"max-width": 500
|
|
1088
|
-
}, {
|
|
1089
|
-
"side-sheet-footer": V(() => [
|
|
1090
|
-
c("div", kn, [
|
|
1091
|
-
v(ne, {
|
|
1092
|
-
loading: s.value,
|
|
1093
|
-
label: i.value,
|
|
1094
|
-
onClick: E
|
|
1095
|
-
}, null, 8, ["loading", "label"]),
|
|
1096
|
-
v(ne, {
|
|
1097
|
-
disabled: s.value,
|
|
1098
|
-
label: d(a)("common.close"),
|
|
1099
|
-
variant: "tertiary",
|
|
1100
|
-
onClick: I[2] || (I[2] = (K) => r.value = !1)
|
|
1101
|
-
}, null, 8, ["disabled", "label"])
|
|
1102
|
-
])
|
|
1103
|
-
]),
|
|
1104
|
-
default: V(() => [
|
|
1105
|
-
c("div", xn, [
|
|
1106
|
-
c("div", null, [
|
|
1107
|
-
p.value ? (_(), A(M, {
|
|
1108
|
-
key: 0,
|
|
1109
|
-
label: "Managed by Netsuite",
|
|
1110
|
-
compact: ""
|
|
1111
|
-
})) : O("", !0)
|
|
1112
|
-
]),
|
|
1113
|
-
v(_n, {
|
|
1114
|
-
class: "w-full",
|
|
1115
|
-
ref_key: "hasValidationExpose",
|
|
1116
|
-
ref: b,
|
|
1117
|
-
modelValue: d(m),
|
|
1118
|
-
"onUpdate:modelValue": I[0] || (I[0] = (K) => Ne(m) ? m.value = K : null),
|
|
1119
|
-
mode: k.mode,
|
|
1120
|
-
disabled: s.value,
|
|
1121
|
-
"onClick:submit": I[1] || (I[1] = (K) => N())
|
|
1122
|
-
}, null, 8, ["modelValue", "mode", "disabled"])
|
|
1123
|
-
])
|
|
1124
|
-
]),
|
|
1125
|
-
_: 1
|
|
1126
|
-
}, 8, ["model-value", "header"]);
|
|
1127
|
-
};
|
|
1128
|
-
}
|
|
1129
|
-
});
|
|
1130
|
-
function Sn() {
|
|
1131
|
-
return `sku_${(/* @__PURE__ */ new Date()).toISOString()}_${Lt()}`;
|
|
1132
|
-
}
|
|
1133
|
-
const Cn = {
|
|
1134
|
-
_id: "",
|
|
1135
|
-
name: "",
|
|
1136
|
-
abbrev: "",
|
|
1137
|
-
precision: 0,
|
|
1138
|
-
measurements: []
|
|
1139
|
-
};
|
|
1140
|
-
function wn(u) {
|
|
1141
|
-
return !u || Object.keys(u).length === 0 ? "" : Object.entries(u).map(([o, y]) => `${o}: ${y}`).join(", ");
|
|
1142
|
-
}
|
|
1143
|
-
function at(u) {
|
|
1144
|
-
if (!u || u.trim() === "")
|
|
1145
|
-
return;
|
|
1146
|
-
const o = {}, y = u.split(",").map((l) => l.trim());
|
|
1147
|
-
for (const l of y) {
|
|
1148
|
-
const n = l.indexOf(":");
|
|
1149
|
-
if (n > 0) {
|
|
1150
|
-
const a = l.substring(0, n).trim(), r = l.substring(n + 1).trim();
|
|
1151
|
-
a && r && (o[a] = r);
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
return Object.keys(o).length > 0 ? o : void 0;
|
|
1155
|
-
}
|
|
1156
|
-
function Fn(u) {
|
|
1157
|
-
var y, l, n, a, r;
|
|
1158
|
-
return {
|
|
1159
|
-
code: u.code,
|
|
1160
|
-
name: u.name,
|
|
1161
|
-
unit: ((y = u.unit.measurements.find((m) => m.id === u.trackingMeasurement)) == null ? void 0 : y.abbrev) ?? u.unit.abbrev,
|
|
1162
|
-
baseUnit: u.unit.abbrev,
|
|
1163
|
-
valuationMethod: u.valuation ?? "WAVG",
|
|
1164
|
-
pricePerUnit: (l = u.defaultCost) != null && l.costPerUnit ? +Xe((n = u.defaultCost) == null ? void 0 : n.costPerUnit) : 0,
|
|
1165
|
-
thresholdLow: ((a = u.thresholds) == null ? void 0 : a.low) ?? ie().low,
|
|
1166
|
-
thresholdMid: ((r = u.thresholds) == null ? void 0 : r.mid) ?? ie().mid,
|
|
1167
|
-
customAttributes: wn(u.customAttributes)
|
|
1168
|
-
};
|
|
1169
|
-
}
|
|
1170
|
-
function st() {
|
|
1171
|
-
var n;
|
|
1172
|
-
const u = [
|
|
1173
|
-
{
|
|
1174
|
-
id: "code",
|
|
1175
|
-
name: "Code"
|
|
1176
|
-
},
|
|
1177
|
-
{
|
|
1178
|
-
id: "name",
|
|
1179
|
-
name: "Name"
|
|
1180
|
-
},
|
|
1181
|
-
{
|
|
1182
|
-
id: "unit",
|
|
1183
|
-
name: "Unit"
|
|
1184
|
-
},
|
|
1185
|
-
{
|
|
1186
|
-
id: "baseUnit",
|
|
1187
|
-
name: "Base unit"
|
|
1188
|
-
}
|
|
1189
|
-
], o = tt(), y = be(), l = Ve(y.currentCountry.value);
|
|
1190
|
-
return o.enableTotalCost && u.push(
|
|
1191
|
-
{
|
|
1192
|
-
id: "valuationMethod",
|
|
1193
|
-
name: "Valuation method"
|
|
1194
|
-
},
|
|
1195
|
-
{
|
|
1196
|
-
id: "pricePerUnit",
|
|
1197
|
-
name: `Price per unit (${l == null ? void 0 : l.currency})`
|
|
1198
|
-
}
|
|
1199
|
-
), ((n = y.currentBusiness.value) == null ? void 0 : n.menuVersion) === "v4" && u.push(
|
|
1200
|
-
{
|
|
1201
|
-
id: "thresholdLow",
|
|
1202
|
-
name: "Show RED when remaining"
|
|
1203
|
-
},
|
|
1204
|
-
{
|
|
1205
|
-
id: "thresholdMid",
|
|
1206
|
-
name: "Show YELLOW when remaining"
|
|
1207
|
-
}
|
|
1208
|
-
), u.push({
|
|
1209
|
-
id: "customAttributes",
|
|
1210
|
-
name: "Custom Attributes"
|
|
1211
|
-
}), u;
|
|
1212
|
-
}
|
|
1213
|
-
function Mn() {
|
|
1214
|
-
const o = te().skus.map(Fn), l = be().currentBusiness.value, n = st(), a = [
|
|
1215
|
-
["Business name:", l == null ? void 0 : l.name],
|
|
1216
|
-
["Business ID:", l == null ? void 0 : l._id],
|
|
1217
|
-
["Menu version", l == null ? void 0 : l.menuVersion],
|
|
1218
|
-
[],
|
|
1219
|
-
n.map((g) => g.name),
|
|
1220
|
-
...o.map((g) => n.map((i) => g[i.id]))
|
|
1221
|
-
], r = n.map((g) => `system:${g.id}`), m = nt(a, r), p = `${l == null ? void 0 : l.name} ingredients (${bt(/* @__PURE__ */ new Date())}).xlsx`;
|
|
1222
|
-
return ot(m, p), p;
|
|
1223
|
-
}
|
|
1224
|
-
function In() {
|
|
1225
|
-
const o = be().currentBusiness.value, y = st(), l = [
|
|
1226
|
-
["Business name:", o == null ? void 0 : o.name],
|
|
1227
|
-
["Business ID:", o == null ? void 0 : o._id],
|
|
1228
|
-
["Menu version", o == null ? void 0 : o.menuVersion],
|
|
1229
|
-
[],
|
|
1230
|
-
y.map((m) => m.name)
|
|
1231
|
-
], n = y.map((m) => `system:${m.id}`), a = nt(l, n), r = "FeedMe ingredients template.xlsx";
|
|
1232
|
-
return ot(a, r), r;
|
|
1233
|
-
}
|
|
1234
|
-
function $n(u) {
|
|
1235
|
-
const [
|
|
1236
|
-
o,
|
|
1237
|
-
y,
|
|
1238
|
-
l,
|
|
1239
|
-
n,
|
|
1240
|
-
a,
|
|
1241
|
-
r,
|
|
1242
|
-
...m
|
|
1243
|
-
] = _t(u);
|
|
1244
|
-
if (!o || !o.length || o.some((s) => s.length && !s.startsWith("system:")))
|
|
1245
|
-
throw new Error("Missing meta header. Excel file does not come from the template.");
|
|
1246
|
-
const p = o.map((s) => s.split(":")[1]), i = ["code", "name", "unit", "baseUnit"].filter((s) => !p.includes(s));
|
|
1247
|
-
if (i.length)
|
|
1248
|
-
throw new Error(
|
|
1249
|
-
`Missing meta headers (${i.join()}). Excel file does not come from the template.`
|
|
1250
|
-
);
|
|
1251
|
-
return m.map((s, x) => {
|
|
1252
|
-
const P = {};
|
|
1253
|
-
for (const E in p) {
|
|
1254
|
-
const N = p[E];
|
|
1255
|
-
Object.assign(P, { [N]: s[E] });
|
|
1256
|
-
}
|
|
1257
|
-
return {
|
|
1258
|
-
index: x,
|
|
1259
|
-
data: P
|
|
1260
|
-
};
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
function We(u, o, y) {
|
|
1264
|
-
var I;
|
|
1265
|
-
const n = te().units, a = new Array(), r = y.filter((M) => M.data.code === u.code);
|
|
1266
|
-
r.length > 1 && a.push(
|
|
1267
|
-
`Code ${u.code} is already used in row ${r.map((M) => M.index + 6).join()}.`
|
|
1268
|
-
);
|
|
1269
|
-
const m = n.find((M) => M.abbrev === u.baseUnit), p = m == null ? void 0 : m.measurements.find((M) => M.abbrev === u.unit);
|
|
1270
|
-
if (!m)
|
|
1271
|
-
a.push(`Cannot find base unit of symbol ${u.baseUnit}.`);
|
|
1272
|
-
else if (u.baseUnit !== u.unit && !p) {
|
|
1273
|
-
const M = `Cannot find unit conversion for ${u.baseUnit} with symbol ${u.unit || "[empty]"}.`;
|
|
1274
|
-
a.push(M);
|
|
1275
|
-
}
|
|
1276
|
-
const g = ge.options.find(
|
|
1277
|
-
(M) => M === u.valuationMethod
|
|
1278
|
-
);
|
|
1279
|
-
u.valuationMethod && !g && a.push(
|
|
1280
|
-
`Expected valuation method to be one of ${ge.options.join()} but got ${u.valuationMethod} instead.`
|
|
1281
|
-
);
|
|
1282
|
-
const b = be().currentCountry.value, s = (M) => `${M}`.length && xt()(M) === !0, x = s(`${u.pricePerUnit}`) === !0 ? {
|
|
1283
|
-
costPerUnit: {
|
|
1284
|
-
...et(Number(u.pricePerUnit) || 0),
|
|
1285
|
-
currency: ((I = Ve(b)) == null ? void 0 : I.currency) ?? "MYR"
|
|
1286
|
-
},
|
|
1287
|
-
measurement: p
|
|
1288
|
-
} : void 0, P = s(`${u.thresholdLow}`) && s(`${u.thresholdMid}`) ? {
|
|
1289
|
-
low: Number(u.thresholdLow) || 0,
|
|
1290
|
-
mid: Number(u.thresholdMid) || 0
|
|
1291
|
-
} : void 0, E = "customAttributes" in u ? at(u.customAttributes) : null;
|
|
1292
|
-
return {
|
|
1293
|
-
type: "create",
|
|
1294
|
-
sku: {
|
|
1295
|
-
_id: Sn(),
|
|
1296
|
-
code: u.code,
|
|
1297
|
-
name: u.name,
|
|
1298
|
-
unit: m ?? n.find((M) => M) ?? Cn,
|
|
1299
|
-
trackingMeasurement: p == null ? void 0 : p.id,
|
|
1300
|
-
valuation: g,
|
|
1301
|
-
defaultCost: x,
|
|
1302
|
-
thresholds: P,
|
|
1303
|
-
...E !== null && { customAttributes: E }
|
|
1304
|
-
},
|
|
1305
|
-
errors: a,
|
|
1306
|
-
excelRowNumber: o + 6
|
|
1307
|
-
};
|
|
1308
|
-
}
|
|
1309
|
-
function En(u) {
|
|
1310
|
-
try {
|
|
1311
|
-
const o = $n(u).filter((g) => g.data.code), l = te().skus, n = ht(l, "code"), a = o.filter((g) => !n[g.data.code]), r = o.filter((g) => n[g.data.code]), m = a.map(
|
|
1312
|
-
(g) => We(g.data, g.index, o)
|
|
1313
|
-
), p = r.map((g) => {
|
|
1314
|
-
const i = We(g.data, g.index, o), b = n[g.data.code];
|
|
1315
|
-
let s = b.customAttributes;
|
|
1316
|
-
return "customAttributes" in g.data && (s = at(g.data.customAttributes)), {
|
|
1317
|
-
...i,
|
|
1318
|
-
type: "update",
|
|
1319
|
-
original: b,
|
|
1320
|
-
sku: {
|
|
1321
|
-
// to maintain original props not in the import excel, e.g. inventory binding, etc...
|
|
1322
|
-
...b,
|
|
1323
|
-
code: i.sku.code || b.code,
|
|
1324
|
-
name: i.sku.name || b.name,
|
|
1325
|
-
unit: i.sku.unit || b.unit,
|
|
1326
|
-
trackingMeasurement: i.sku.trackingMeasurement || b.trackingMeasurement,
|
|
1327
|
-
valuation: i.sku.valuation || b.valuation,
|
|
1328
|
-
defaultCost: i.sku.defaultCost || b.defaultCost,
|
|
1329
|
-
thresholds: i.sku.thresholds || b.thresholds,
|
|
1330
|
-
customAttributes: s
|
|
1331
|
-
}
|
|
1332
|
-
};
|
|
1333
|
-
});
|
|
1334
|
-
return {
|
|
1335
|
-
invalidExcel: !1,
|
|
1336
|
-
importCreateResult: m,
|
|
1337
|
-
importUpdateResult: p
|
|
1338
|
-
};
|
|
1339
|
-
} catch (o) {
|
|
1340
|
-
return {
|
|
1341
|
-
invalidExcel: !0,
|
|
1342
|
-
invalidExcelMessage: (o == null ? void 0 : o.message) ?? "Invalid excel",
|
|
1343
|
-
importCreateResult: [],
|
|
1344
|
-
importUpdateResult: []
|
|
1345
|
-
};
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
const Un = { class: "flex items-center gap-12 pl-8" }, Rn = { class: "flex flex-col" }, An = { class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex items-center gap-4" }, Tn = {
|
|
1349
|
-
key: 0,
|
|
1350
|
-
class: "text-fm-color-typo-secondary fm-typo-en-body-sm-400"
|
|
1351
|
-
}, Dn = { key: 0 }, Ke = /* @__PURE__ */ le({
|
|
1352
|
-
__name: "ImportIngredientItem",
|
|
1353
|
-
props: {
|
|
1354
|
-
type: {},
|
|
1355
|
-
code: {},
|
|
1356
|
-
name: {},
|
|
1357
|
-
errors: {}
|
|
1358
|
-
},
|
|
1359
|
-
setup(u) {
|
|
1360
|
-
return (o, y) => {
|
|
1361
|
-
const l = w("FmIcon"), n = w("FmTooltip");
|
|
1362
|
-
return _(), D("div", Un, [
|
|
1363
|
-
y[0] || (y[0] = c("div", null, "•", -1)),
|
|
1364
|
-
c("div", Rn, [
|
|
1365
|
-
c("div", An, [
|
|
1366
|
-
c("div", {
|
|
1367
|
-
class: Q({
|
|
1368
|
-
"text-fm-color-system-error-300": o.errors.length
|
|
1369
|
-
})
|
|
1370
|
-
}, [
|
|
1371
|
-
Ee(T(o.name) + " ", 1),
|
|
1372
|
-
o.type === "create" ? (_(), D("span", Tn, "(new)")) : O("", !0)
|
|
1373
|
-
], 2),
|
|
1374
|
-
o.errors.length ? (_(), D("div", Dn, [
|
|
1375
|
-
v(n, { "z-index": 50 }, {
|
|
1376
|
-
content: V(() => [
|
|
1377
|
-
c("ol", null, [
|
|
1378
|
-
(_(!0), D(ee, null, ye(o.errors, (a, r) => (_(), D("li", { key: r }, T(a), 1))), 128))
|
|
1379
|
-
])
|
|
1380
|
-
]),
|
|
1381
|
-
default: V(() => [
|
|
1382
|
-
v(l, {
|
|
1383
|
-
name: "error",
|
|
1384
|
-
size: "sm",
|
|
1385
|
-
color: "system-error-300"
|
|
1386
|
-
})
|
|
1387
|
-
]),
|
|
1388
|
-
_: 1
|
|
1389
|
-
})
|
|
1390
|
-
])) : O("", !0)
|
|
1391
|
-
]),
|
|
1392
|
-
c("div", {
|
|
1393
|
-
class: Q([
|
|
1394
|
-
"fm-typo-en-body-sm-400",
|
|
1395
|
-
{
|
|
1396
|
-
"text-fm-color-system-error-200": o.errors.length,
|
|
1397
|
-
"text-fm-color-typo-secondary": !o.errors.length
|
|
1398
|
-
}
|
|
1399
|
-
])
|
|
1400
|
-
}, T(o.code), 3)
|
|
1401
|
-
])
|
|
1402
|
-
]);
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
}), Bn = { class: "flex flex-col gap-24" }, Pn = { class: "fm-typo-en-body-md-400" }, Nn = { class: "flex flex-col gap-8" }, zn = { class: "line-clamp-2 text-ellipsis break-all" }, Ln = {
|
|
1406
|
-
key: 2,
|
|
1407
|
-
class: "shrink-0"
|
|
1408
|
-
}, On = {
|
|
1409
|
-
key: 0,
|
|
1410
|
-
class: "flex flex-col"
|
|
1411
|
-
}, Hn = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, jn = {
|
|
1412
|
-
key: 0,
|
|
1413
|
-
class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
|
|
1414
|
-
}, Yn = { class: "fm-typo-en-body-lg-600" }, qn = /* @__PURE__ */ le({
|
|
1415
|
-
__name: "ImportIngredients",
|
|
1416
|
-
setup(u) {
|
|
1417
|
-
const o = L(null), y = Ut(), l = Se(), n = L(!1), a = L(new Array()), r = L([]), m = L([]), p = S(
|
|
1418
|
-
() => !!a.value.length || r.value.some((s) => s.errors.length) || m.value.some((s) => s.errors.length)
|
|
1419
|
-
), g = S(
|
|
1420
|
-
() => !!r.value.length || !!m.value.length
|
|
1421
|
-
), { t: i } = ae();
|
|
1422
|
-
async function b(s) {
|
|
1423
|
-
a.value = [], r.value = [], m.value = [];
|
|
1424
|
-
try {
|
|
1425
|
-
n.value = !0;
|
|
1426
|
-
const [x] = await Promise.all([
|
|
1427
|
-
Vt(s),
|
|
1428
|
-
// fake buffer
|
|
1429
|
-
new Promise((N) => setTimeout(N, 1e3))
|
|
1430
|
-
]), P = x.SheetNames.find((N) => N);
|
|
1431
|
-
if (!P) {
|
|
1432
|
-
a.value.push(i("inventory.ingredient.import.fileError.noSheet"));
|
|
1433
|
-
return;
|
|
1434
|
-
}
|
|
1435
|
-
const E = En(x.Sheets[P]);
|
|
1436
|
-
if (E.invalidExcel) {
|
|
1437
|
-
a.value.push(E.invalidExcelMessage ?? i("inventory.ingredient.import.fileError.invalidExcel"));
|
|
1438
|
-
return;
|
|
1439
|
-
}
|
|
1440
|
-
if (r.value = E.importCreateResult, m.value = E.importUpdateResult, !r.value.length && !m.value.length) {
|
|
1441
|
-
a.value.push(i("inventory.ingredient.import.fileError.noData"));
|
|
1442
|
-
return;
|
|
1443
|
-
}
|
|
1444
|
-
y.emitData(E);
|
|
1445
|
-
} catch (x) {
|
|
1446
|
-
l.open({
|
|
1447
|
-
title: i("inventory.ingredient.import.fileError.unableToRead"),
|
|
1448
|
-
message: x == null ? void 0 : x.message,
|
|
1449
|
-
type: "error"
|
|
1450
|
-
}), console.error("Error in reading file", x);
|
|
1451
|
-
} finally {
|
|
1452
|
-
a.value.length && l.open({
|
|
1453
|
-
title: i("inventory.ingredient.import.fileError.invalidExcel"),
|
|
1454
|
-
type: "error"
|
|
1455
|
-
}), n.value = !1;
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
return Je(o, (s) => {
|
|
1459
|
-
s && b(s);
|
|
1460
|
-
}), (s, x) => {
|
|
1461
|
-
const P = w("FmCircularProgress"), E = w("FmIcon"), N = w("FmButton");
|
|
1462
|
-
return _(), D("div", Bn, [
|
|
1463
|
-
c("div", Pn, T(d(i)("inventory.ingredient.import.uploadDescription")), 1),
|
|
1464
|
-
v(kt, {
|
|
1465
|
-
class: Q({
|
|
1466
|
-
"w-full": !0,
|
|
1467
|
-
"h-[200px]": !o.value
|
|
1468
|
-
}),
|
|
1469
|
-
accept: ".xlsx",
|
|
1470
|
-
onFileUpload: x[0] || (x[0] = (k) => o.value = k),
|
|
1471
|
-
label: d(i)("inventory.ingredient.import.uploadTemplate"),
|
|
1472
|
-
"button-label": d(i)("inventory.ingredient.import.selectFile")
|
|
1473
|
-
}, Ze({ _: 2 }, [
|
|
1474
|
-
o.value ? {
|
|
1475
|
-
name: "default",
|
|
1476
|
-
fn: V(({ openFileDialog: k }) => [
|
|
1477
|
-
c("div", Nn, [
|
|
1478
|
-
c("div", {
|
|
1479
|
-
class: Q([
|
|
1480
|
-
"fm-corner-radius-md p-16 flex items-center gap-16",
|
|
1481
|
-
{
|
|
1482
|
-
"border border-fm-color-neutral-gray-100": n.value,
|
|
1483
|
-
"border border-fm-color-neutral-gray-200": !n.value && !p.value,
|
|
1484
|
-
"border border-fm-color-system-error-200": p.value
|
|
1485
|
-
}
|
|
1486
|
-
])
|
|
1487
|
-
}, [
|
|
1488
|
-
n.value ? (_(), A(P, {
|
|
1489
|
-
key: 0,
|
|
1490
|
-
size: "md",
|
|
1491
|
-
color: "neutral-gray-200"
|
|
1492
|
-
})) : (_(), A(E, {
|
|
1493
|
-
key: 1,
|
|
1494
|
-
name: p.value ? "error" : "attach_file",
|
|
1495
|
-
outline: "",
|
|
1496
|
-
color: p.value ? "system-error-300" : void 0
|
|
1497
|
-
}, null, 8, ["name", "color"])),
|
|
1498
|
-
c("div", {
|
|
1499
|
-
class: Q([
|
|
1500
|
-
"fm-typo-en-body-md-400 flex-1 h-[36px] flex items-center",
|
|
1501
|
-
{
|
|
1502
|
-
"text-fm-color-typo-disabled": n.value,
|
|
1503
|
-
"text-fm-color-typo-primary": !n.value
|
|
1504
|
-
}
|
|
1505
|
-
])
|
|
1506
|
-
}, [
|
|
1507
|
-
c("div", zn, T(o.value.name), 1)
|
|
1508
|
-
], 2),
|
|
1509
|
-
n.value ? O("", !0) : (_(), D("div", Ln, [
|
|
1510
|
-
v(N, {
|
|
1511
|
-
label: d(i)("inventory.ingredient.import.replaceFile"),
|
|
1512
|
-
variant: p.value ? "destructive" : "secondary",
|
|
1513
|
-
"prepend-icon": p.value ? void 0 : "autorenew",
|
|
1514
|
-
onClick: k
|
|
1515
|
-
}, null, 8, ["label", "variant", "prepend-icon", "onClick"])
|
|
1516
|
-
]))
|
|
1517
|
-
], 2),
|
|
1518
|
-
a.value.length ? (_(), D("div", On, [
|
|
1519
|
-
(_(!0), D(ee, null, ye(a.value, (I, M) => (_(), D("div", {
|
|
1520
|
-
key: M,
|
|
1521
|
-
class: "flex gap-8 items-center"
|
|
1522
|
-
}, [
|
|
1523
|
-
v(E, {
|
|
1524
|
-
name: "error",
|
|
1525
|
-
size: "sm",
|
|
1526
|
-
color: "system-error-300"
|
|
1527
|
-
}),
|
|
1528
|
-
c("div", Hn, T(I), 1)
|
|
1529
|
-
]))), 128))
|
|
1530
|
-
])) : O("", !0)
|
|
1531
|
-
])
|
|
1532
|
-
]),
|
|
1533
|
-
key: "0"
|
|
1534
|
-
} : void 0
|
|
1535
|
-
]), 1032, ["class", "label", "button-label"]),
|
|
1536
|
-
g.value ? (_(), D("div", jn, [
|
|
1537
|
-
c("div", Yn, T(d(i)("inventory.ingredient.import.summary")), 1),
|
|
1538
|
-
(_(!0), D(ee, null, ye(r.value, (k) => (_(), A(Ke, {
|
|
1539
|
-
key: k.sku._id,
|
|
1540
|
-
code: k.sku.code,
|
|
1541
|
-
name: k.sku.name,
|
|
1542
|
-
errors: k.errors,
|
|
1543
|
-
type: "create"
|
|
1544
|
-
}, null, 8, ["code", "name", "errors"]))), 128)),
|
|
1545
|
-
(_(!0), D(ee, null, ye(m.value, (k) => (_(), A(Ke, {
|
|
1546
|
-
key: k.sku._id,
|
|
1547
|
-
code: k.sku.code,
|
|
1548
|
-
name: k.sku.name,
|
|
1549
|
-
errors: k.errors,
|
|
1550
|
-
type: "update"
|
|
1551
|
-
}, null, 8, ["code", "name", "errors"]))), 128))
|
|
1552
|
-
])) : O("", !0)
|
|
1553
|
-
]);
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
1556
|
-
}), Gn = { class: "flex flex-col py-8" }, Wn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Kn = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, co = /* @__PURE__ */ le({
|
|
1557
|
-
__name: "IngredientsView",
|
|
1558
|
-
setup(u) {
|
|
1559
|
-
const o = te(), y = S(() => [
|
|
1560
|
-
{
|
|
1561
|
-
type: "string",
|
|
1562
|
-
key: "skuCode",
|
|
1563
|
-
entity: "sku",
|
|
1564
|
-
values: o.skus.map((C) => C.code)
|
|
1565
|
-
},
|
|
1566
|
-
{
|
|
1567
|
-
type: "string",
|
|
1568
|
-
key: "skuUnitAbbrev",
|
|
1569
|
-
entity: "sku",
|
|
1570
|
-
values: o.units.map((C) => C.abbrev)
|
|
1571
|
-
},
|
|
1572
|
-
{
|
|
1573
|
-
type: "string",
|
|
1574
|
-
key: "skuInactive",
|
|
1575
|
-
entity: "sku",
|
|
1576
|
-
values: ["Yes", "No"]
|
|
1577
|
-
}
|
|
1578
|
-
]), l = L(null), n = S(() => {
|
|
1579
|
-
if (!l.value)
|
|
1580
|
-
return o.skus;
|
|
1581
|
-
const U = St.build(l.value);
|
|
1582
|
-
return o.skus.filter((C) => Ct(
|
|
1583
|
-
{
|
|
1584
|
-
skuCode: C.code,
|
|
1585
|
-
skuUnitAbbrev: C.unit.abbrev,
|
|
1586
|
-
skuInactive: C.isInactive ? "Yes" : "No"
|
|
1587
|
-
},
|
|
1588
|
-
U
|
|
1589
|
-
));
|
|
1590
|
-
}), a = wt(), r = lt(), m = Ot(), p = Se(), g = Ue(), { t: i } = ae(), { createIngredient: b, updateIngredient: s } = $e(), { ingredientDialogProps: x, ingredientViewLoading: P } = Bt($e()), { columnDefs: E } = Ht();
|
|
1591
|
-
function N(U) {
|
|
1592
|
-
switch (U) {
|
|
1593
|
-
case "add":
|
|
1594
|
-
return g.isEnabled ? void 0 : b();
|
|
1595
|
-
case "import":
|
|
1596
|
-
return me();
|
|
1597
|
-
case "export":
|
|
1598
|
-
return de();
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
const k = L(""), I = L(!1), M = S(() => I.value || P.value), { breakpoints: ne } = Rt(), W = S(() => ne.value.xs || ne.value.sm), K = S(() => W.value ? 10 : 20), ue = Ft(), se = L(!1), re = [
|
|
1602
|
-
{
|
|
1603
|
-
value: "import",
|
|
1604
|
-
label: i("common.import")
|
|
1605
|
-
},
|
|
1606
|
-
{
|
|
1607
|
-
value: "export",
|
|
1608
|
-
label: i("common.export")
|
|
1609
|
-
}
|
|
1610
|
-
];
|
|
1611
|
-
function oe(U) {
|
|
1612
|
-
switch (se.value = !1, U) {
|
|
1613
|
-
case "import":
|
|
1614
|
-
return me();
|
|
1615
|
-
case "export":
|
|
1616
|
-
return de();
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
const he = S(() => [
|
|
1620
|
-
...g.isEnabled ? [] : [
|
|
1621
|
-
{
|
|
1622
|
-
label: i("inventory.ingredient.create.title"),
|
|
1623
|
-
value: "add",
|
|
1624
|
-
isPrimary: !0,
|
|
1625
|
-
prependIcon: "add"
|
|
1626
|
-
}
|
|
1627
|
-
],
|
|
1628
|
-
{ label: i("common.import"), value: "import" },
|
|
1629
|
-
{ label: i("common.export"), value: "export" }
|
|
1630
|
-
]);
|
|
1631
|
-
function de() {
|
|
1632
|
-
const U = Mn();
|
|
1633
|
-
p.open({
|
|
1634
|
-
title: i("inventory.ingredient.export.success"),
|
|
1635
|
-
message: i("inventory.ingredient.export.filename", [U]),
|
|
1636
|
-
type: "success"
|
|
1637
|
-
});
|
|
1638
|
-
}
|
|
1639
|
-
function me() {
|
|
1640
|
-
r.open({
|
|
1641
|
-
title: i("inventory.ingredient.import.title"),
|
|
1642
|
-
contentComponent: qn,
|
|
1643
|
-
overlay: !0,
|
|
1644
|
-
closeButton: !0,
|
|
1645
|
-
primaryActions: {
|
|
1646
|
-
text: i("common.import"),
|
|
1647
|
-
close: !1
|
|
1648
|
-
},
|
|
1649
|
-
secondaryActions: {
|
|
1650
|
-
text: i("common.close"),
|
|
1651
|
-
close: !0
|
|
1652
|
-
},
|
|
1653
|
-
tertiaryActions: {
|
|
1654
|
-
text: i("inventory.ingredient.import.actions.downloadTemplate"),
|
|
1655
|
-
close: !1,
|
|
1656
|
-
variant: "plain"
|
|
1657
|
-
}
|
|
1658
|
-
}).onPrimary((U) => {
|
|
1659
|
-
if (!U) {
|
|
1660
|
-
p.open({
|
|
1661
|
-
title: i("inventory.ingredient.import.error.noData"),
|
|
1662
|
-
type: "error"
|
|
1663
|
-
});
|
|
1664
|
-
return;
|
|
1665
|
-
}
|
|
1666
|
-
if (!U.importCreateResult.length && !U.importUpdateResult.length) {
|
|
1667
|
-
p.open({
|
|
1668
|
-
title: i("inventory.ingredient.import.error.invalidContent"),
|
|
1669
|
-
message: i("inventory.ingredient.import.error.noImportData"),
|
|
1670
|
-
type: "error"
|
|
1671
|
-
});
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
if (U.importCreateResult.some((C) => C.errors.length) || U.importUpdateResult.some((C) => C.errors.length)) {
|
|
1675
|
-
p.open({
|
|
1676
|
-
title: i("inventory.ingredient.import.error.invalidContent"),
|
|
1677
|
-
message: i("inventory.ingredient.import.error.hasErrors"),
|
|
1678
|
-
type: "error"
|
|
1679
|
-
});
|
|
1680
|
-
return;
|
|
1681
|
-
}
|
|
1682
|
-
r.close(), Ce(U);
|
|
1683
|
-
}).onTertiary(In);
|
|
1684
|
-
}
|
|
1685
|
-
async function Ce(U) {
|
|
1686
|
-
I.value = !0;
|
|
1687
|
-
try {
|
|
1688
|
-
const C = [
|
|
1689
|
-
...U.importCreateResult.map(({ sku: B }) => ({ type: "create", sku: B })),
|
|
1690
|
-
...U.importUpdateResult.map(({ sku: B }) => ({ type: "update", sku: B }))
|
|
1691
|
-
], ce = 100;
|
|
1692
|
-
let J = 0;
|
|
1693
|
-
const Z = () => {
|
|
1694
|
-
J += ce, p.open({
|
|
1695
|
-
title: i("inventory.ingredient.import.progress", [
|
|
1696
|
-
Math.min(J, C.length),
|
|
1697
|
-
C.length
|
|
1698
|
-
])
|
|
1699
|
-
});
|
|
1700
|
-
}, z = new Array();
|
|
1701
|
-
for (const B of C.chunk(100)) {
|
|
1702
|
-
Z();
|
|
1703
|
-
try {
|
|
1704
|
-
const t = await o.importSkus({
|
|
1705
|
-
create: B.filter((e) => e.type === "create").map((e) => e.sku),
|
|
1706
|
-
update: B.filter((e) => e.type === "update").map((e) => e.sku)
|
|
1707
|
-
});
|
|
1708
|
-
z.push(...t.errors);
|
|
1709
|
-
} catch (t) {
|
|
1710
|
-
z.push(
|
|
1711
|
-
...B.map((e) => {
|
|
1712
|
-
const f = {
|
|
1713
|
-
module: Et.enum.sku,
|
|
1714
|
-
_id: e.sku._id,
|
|
1715
|
-
name: e.sku.name,
|
|
1716
|
-
message: (t == null ? void 0 : t.stack) ?? t
|
|
1717
|
-
};
|
|
1718
|
-
return {
|
|
1719
|
-
data: e.sku,
|
|
1720
|
-
error: [f]
|
|
1721
|
-
};
|
|
1722
|
-
})
|
|
1723
|
-
);
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
p.open({
|
|
1727
|
-
title: i("inventory.ingredient.import.success"),
|
|
1728
|
-
type: "success"
|
|
1729
|
-
}), z.length && m.alert(
|
|
1730
|
-
"Some operation failed",
|
|
1731
|
-
X(
|
|
1732
|
-
"div",
|
|
1733
|
-
{ class: "flex flex-col gap-8" },
|
|
1734
|
-
z.map(
|
|
1735
|
-
(B) => X("div", { class: "flex flex-col" }, [
|
|
1736
|
-
X("div", { class: "fm-typo-en-body-lg-600" }, `(${B.data.code}) ${B.data.name}`),
|
|
1737
|
-
X(
|
|
1738
|
-
"div",
|
|
1739
|
-
{ class: "fm-typo-en-body-lg-400" },
|
|
1740
|
-
`${B.error.map((t) => (t == null ? void 0 : t.message) ?? "Unknown error").join(", ")}`
|
|
1741
|
-
)
|
|
1742
|
-
])
|
|
1743
|
-
)
|
|
1744
|
-
)
|
|
1745
|
-
);
|
|
1746
|
-
} catch (C) {
|
|
1747
|
-
p.open({
|
|
1748
|
-
title: i("inventory.ingredient.import.error.failed"),
|
|
1749
|
-
message: i("inventory.ingredient.import.error.systemMessage", [C == null ? void 0 : C.message]),
|
|
1750
|
-
type: "error"
|
|
1751
|
-
}), console.error("Error in importing skus", U, C);
|
|
1752
|
-
} finally {
|
|
1753
|
-
I.value = !1;
|
|
1754
|
-
}
|
|
1755
|
-
}
|
|
1756
|
-
return (U, C) => {
|
|
1757
|
-
const ce = w("FmTable"), J = w("FmCollapsibleTabs"), Z = w("FmBottomSheet");
|
|
1758
|
-
return _(), A(Mt, {
|
|
1759
|
-
title: d(i)("inventory.ingredient.title"),
|
|
1760
|
-
actions: he.value,
|
|
1761
|
-
"onClick:action": N
|
|
1762
|
-
}, {
|
|
1763
|
-
default: V(() => [
|
|
1764
|
-
c("div", {
|
|
1765
|
-
class: Q([
|
|
1766
|
-
"flex flex-col gap-8 max-h-full",
|
|
1767
|
-
{
|
|
1768
|
-
"p-0": W.value,
|
|
1769
|
-
"px-24 ": !W.value
|
|
1770
|
-
}
|
|
1771
|
-
])
|
|
1772
|
-
}, [
|
|
1773
|
-
v(It, {
|
|
1774
|
-
searchable: "",
|
|
1775
|
-
search: k.value,
|
|
1776
|
-
"onUpdate:search": C[0] || (C[0] = (z) => k.value = z),
|
|
1777
|
-
filterable: "",
|
|
1778
|
-
"filter-attributes": y.value,
|
|
1779
|
-
filter: l.value,
|
|
1780
|
-
"onUpdate:filter": C[1] || (C[1] = (z) => l.value = z)
|
|
1781
|
-
}, null, 8, ["search", "filter-attributes", "filter"]),
|
|
1782
|
-
(_(), A(ce, {
|
|
1783
|
-
key: JSON.stringify(l.value),
|
|
1784
|
-
style: dt(d(ue).tableHeight),
|
|
1785
|
-
"column-defs": d(E),
|
|
1786
|
-
"row-data": n.value,
|
|
1787
|
-
"search-value": k.value,
|
|
1788
|
-
loading: !d(a)._currentLocation || M.value,
|
|
1789
|
-
"loading-text": "Loading",
|
|
1790
|
-
onRowClick: C[2] || (C[2] = (z) => d(s)(z.original)),
|
|
1791
|
-
"page-size": K.value
|
|
1792
|
-
}, {
|
|
1793
|
-
"list-row": V((z) => [
|
|
1794
|
-
v($t, {
|
|
1795
|
-
row: z,
|
|
1796
|
-
onRowClick: d(s)
|
|
1797
|
-
}, Ze({
|
|
1798
|
-
default: V((B) => {
|
|
1799
|
-
var t, e, f, h, R, $, j, Y, G, pe;
|
|
1800
|
-
return [
|
|
1801
|
-
c("div", Gn, [
|
|
1802
|
-
c("div", Wn, [
|
|
1803
|
-
v(d(Ye), {
|
|
1804
|
-
render: (f = (e = (t = B.code) == null ? void 0 : t.column) == null ? void 0 : e.columnDef) == null ? void 0 : f.cell,
|
|
1805
|
-
props: (R = (h = B.code) == null ? void 0 : h.getContext) == null ? void 0 : R.call(h)
|
|
1806
|
-
}, null, 8, ["render", "props"])
|
|
1807
|
-
]),
|
|
1808
|
-
c("div", Kn, [
|
|
1809
|
-
v(d(Ye), {
|
|
1810
|
-
render: (Y = (j = ($ = B.name) == null ? void 0 : $.column) == null ? void 0 : j.columnDef) == null ? void 0 : Y.cell,
|
|
1811
|
-
props: (pe = (G = B.name) == null ? void 0 : G.getContext) == null ? void 0 : pe.call(G)
|
|
1812
|
-
}, null, 8, ["render", "props"])
|
|
1813
|
-
])
|
|
1814
|
-
])
|
|
1815
|
-
];
|
|
1816
|
-
}),
|
|
1817
|
-
_: 2
|
|
1818
|
-
}, [
|
|
1819
|
-
I.value ? {
|
|
1820
|
-
name: "loading-text",
|
|
1821
|
-
fn: V(() => [
|
|
1822
|
-
c("div", null, T(d(i)("inventory.ingredient.table.importing")), 1)
|
|
1823
|
-
]),
|
|
1824
|
-
key: "0"
|
|
1825
|
-
} : void 0
|
|
1826
|
-
]), 1032, ["row", "onRowClick"])
|
|
1827
|
-
]),
|
|
1828
|
-
_: 1
|
|
1829
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
|
|
1830
|
-
], 2),
|
|
1831
|
-
(_(), A(ze, { to: "body" }, [
|
|
1832
|
-
v(Vn, mt(ct(d(x))), null, 16)
|
|
1833
|
-
])),
|
|
1834
|
-
(_(), A(ze, { to: "body" }, [
|
|
1835
|
-
v(Z, {
|
|
1836
|
-
"dismiss-away": "",
|
|
1837
|
-
modelValue: se.value,
|
|
1838
|
-
"onUpdate:modelValue": C[4] || (C[4] = (z) => se.value = z)
|
|
1839
|
-
}, {
|
|
1840
|
-
default: V(() => [
|
|
1841
|
-
v(J, {
|
|
1842
|
-
class: "pb-8",
|
|
1843
|
-
items: re,
|
|
1844
|
-
"onUpdate:modelValue": C[3] || (C[3] = (z) => oe(z))
|
|
1845
|
-
})
|
|
1846
|
-
]),
|
|
1847
|
-
_: 1
|
|
1848
|
-
}, 8, ["modelValue"])
|
|
1849
|
-
]))
|
|
1850
|
-
]),
|
|
1851
|
-
_: 1
|
|
1852
|
-
}, 8, ["title", "actions"]);
|
|
1853
|
-
};
|
|
1854
|
-
}
|
|
1855
|
-
});
|
|
1856
|
-
export {
|
|
1857
|
-
co as default
|
|
1858
|
-
};
|