@feedmepos/mf-inventory-portal 1.8.0-dev.1 → 1.8.0-dev.2
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-DVHgBTHP.js +1499 -0
- package/dist/{ApprovalView-C8_ax05b.js → ApprovalView-RaXuWWSu.js} +9 -9
- package/dist/{BindingsDialog-t0ZY9eh5.js → BindingsDialog-DomvXijP.js} +2 -2
- package/dist/{BindingsPicker-C0Qblmml.js → BindingsPicker-DGnzxEs7.js} +2 -2
- package/dist/{BindingsTable-CsqUBbRA.js → BindingsTable-DfG9kWrv.js} +4 -4
- package/dist/{BulkReceiveRequestView-DAG-TMox.js → BulkReceiveRequestView-DxHWrfbi.js} +21 -22
- package/dist/ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CVekIoiN.js +151 -0
- package/dist/{ClosingDraftView-CdKp4Ny6.js → ClosingDraftView-C3n66bbh.js} +20 -20
- package/dist/{ClosingHistoryView-Blyq9-BS.js → ClosingHistoryView-kdpYGy1Y.js} +5 -5
- package/dist/{ClosingTemplateView-C326DL4q.js → ClosingTemplateView-DwGloYxn.js} +302 -291
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-CXjubRbj.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-9eY_r8LF.js} +1 -1
- package/dist/{DefaultView-CsIMmQAY.js → DefaultView-JC_e4xgC.js} +2 -2
- package/dist/{DeliveryOrderPrintPreview-eTrMvJzA.js → DeliveryOrderPrintPreview-BBCvI67S.js} +2 -2
- package/dist/DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-5Cc08Svt.js +58 -0
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-B7nBbxMo.js → EmailDialog.vue_vue_type_script_setup_true_lang-H4FWc9ga.js} +1663 -1668
- package/dist/FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-C1C8aDA6.js +61 -0
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CI2KTzDs.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Q8Mptiv3.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Db_FiSRe.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CE1_yyHe.js} +2 -2
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CGJi3f86.js +120 -0
- package/dist/{FmMultiselectDialog-CYUxtxnS.js → FmMultiselectDialog-DCaRlBIy.js} +2 -2
- package/dist/{FmMultiselectDialog-BAw-gp5K.js → FmMultiselectDialog-yVPY5aBV.js} +1 -1
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DOkV11NN.js → FmUnitInput.vue_vue_type_script_setup_true_lang-ClaLVtpK.js} +6 -6
- package/dist/{ImportView-BmotFC-3.js → ImportView-DQrVMzxN.js} +6 -6
- package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-DVCCpvS4.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-7lT5UZc8.js} +1 -1
- package/dist/IngredientGroupView-BMUnEaY7.js +1000 -0
- package/dist/{IngredientsView-CZ6E7cXf.js → IngredientsView-DPj9lBTK.js} +303 -296
- package/dist/{IntegrationExplorerView-B15ND4Fg.js → IntegrationExplorerView-CO2wpUR_.js} +4 -4
- package/dist/{IntegrationView-hkNhsqx2.js → IntegrationView-DIeZoey0.js} +2403 -2408
- package/dist/{InventoryBindingForm-SfuUF0_O.js → InventoryBindingForm-Cj4_Chue.js} +1 -1
- package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Zq81p_MF.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-CaBOK7NC.js} +5 -5
- package/dist/{InventoryBindingSummary-DUcukkyJ.js → InventoryBindingSummary-yzGzd7jJ.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BmfROiLM.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DzzTPdyF.js} +1 -1
- package/dist/{ProductionRunDetailView-BwgRX-14.js → ProductionRunDetailView-Cw-ecaey.js} +4 -4
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BbNXNhpr.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BYyiiAWb.js} +7 -7
- package/dist/{ProductionRunView-CZU7LY9-.js → ProductionRunView-C11eseXQ.js} +3 -3
- package/dist/{PublishView-DS2FZ66p.js → PublishView-CPK9NeVF.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-CZa0MVAs.js → PurchaseOrderPrintPreview-DosqWQeN.js} +2 -2
- package/dist/{ReceiveRequestView-Bk5b3nVB.js → ReceiveRequestView-BxSkpK2t.js} +15 -16
- package/dist/{RecipeView-DvI6X-uN.js → RecipeView-oHDWsT0P.js} +19 -20
- package/dist/SettingsView-QlUNwFhM.js +983 -0
- package/dist/{StockView-Z9wGihT7.js → StockView-a8LbVZ_7.js} +324 -322
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DdZg9T4n.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-GdGJCuc0.js} +1 -1
- package/dist/{SupplierView-D8q6siZW.js → SupplierView-BKxKoi_0.js} +451 -447
- package/dist/{SurchargeView-Db_5YFoR.js → SurchargeView-Db4cwhZv.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-WOVs4Fr1.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CpkF77Ow.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BtoP4XgE.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CCCj4WVF.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-Bljc4Vuy.js → TransferDetails.vue_vue_type_script_setup_true_lang-CFNPXqt5.js} +39 -40
- package/dist/{TransferTemplateView-DtsJzmUr.js → TransferTemplateView-CzwxOBMQ.js} +22 -23
- package/dist/{UnitCostHistoryView-BqDiQ4IE.js → UnitCostHistoryView-CqcyjCCd.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BjSmg5LX.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DO80_8SZ.js} +4 -4
- package/dist/{UnitView-CM695-VI.js → UnitView-BqdK1AM_.js} +8 -8
- package/dist/{WarehouseView-BdidU4p6.js → WarehouseView-COJM9IXM.js} +193 -189
- package/dist/{WastageTemplateView-DdhwdXT6.js → WastageTemplateView-DW3viTHN.js} +15 -15
- package/dist/api/feature-flags.d.ts +10 -0
- package/dist/api/license.d.ts +9 -0
- package/dist/{app-Cb5s4jMu.js → app-yvK__CBL.js} +143 -106
- package/dist/app.d.ts +36 -0
- package/dist/app.js +1 -1
- package/dist/{closing-template-DnqnpXxn.js → closing-template-DezidSM0.js} +1 -1
- package/dist/components/ChangeLocationComponent.vue.d.ts +21 -14
- package/dist/components/DeprecateSoonWarningDialog.vue.d.ts +22 -0
- package/dist/components/FeatureCapabilityBadge.vue.d.ts +25 -0
- package/dist/components/{PreviewBadge.vue.d.ts → FeatureCapabilityGate.vue.d.ts} +10 -7
- package/dist/components/{PremiumBadge.vue.d.ts → PlanTierBadge.vue.d.ts} +5 -13
- package/dist/components/PlanUpgradeDialog.vue.d.ts +30 -0
- package/dist/composable/useNavigationMenu.d.ts +2 -1
- package/dist/{date2-BPhD_1Of.js → date2-2XjepIqc.js} +1 -1
- package/dist/{dayjs.min-Zbd6-uVD.js → dayjs.min-CNp5DLBB.js} +1 -1
- package/dist/{decimal-Df6a50Ld.js → decimal-Z7oJdGk8.js} +2 -2
- package/dist/{defineDeepModel-Brbsikbi.js → defineDeepModel-CMxJn_H2.js} +1 -1
- package/dist/{duplicate-template-B9kuShaF.js → duplicate-template-BetV5oy_.js} +1 -1
- package/dist/{inventory-core-dart.default-DDRxXXnt.js → feature-CkWaZ-5K.js} +3046 -1837
- package/dist/feature-flags/core.d.ts +27 -0
- package/dist/feature-flags/core.spec.d.ts +1 -0
- package/dist/feature-flags/navigation-capabilities.d.ts +23 -0
- package/dist/feature-flags/navigation-capabilities.spec.d.ts +1 -0
- package/dist/feature-flags/plan-tier.d.ts +6 -0
- package/dist/feature-flags/plan-tier.spec.d.ts +1 -0
- package/dist/feature-flags/portal-feature-catalog.d.ts +24 -0
- package/dist/feature-flags/vue.d.ts +14 -0
- package/dist/{format-time-from-id-DmUjUcVj.js → format-time-from-id-DatSI9uD.js} +1 -1
- package/dist/{format-unit-display-CsQA0SQd.js → format-unit-display-DM5We5cx.js} +13 -13
- package/dist/id-to-date-Dxw2jKhy.js +67 -0
- package/dist/{import-export.helper-DCQ6oX9s.js → import-export.helper-BOmADwUw.js} +6 -6
- package/dist/{index-C-mazZwS.js → index-7fz5sGDO.js} +3 -3
- package/dist/{index-UmM6gHJ1.js → index-CIH9NCvs.js} +1 -1
- package/dist/{index-BXaIMGnI.js → index-ClYgfwW7.js} +1 -1
- package/dist/{lz-string-Bibw5D_6.js → lz-string-CCsc2X7t.js} +1 -1
- package/dist/{netsuite-Bev0OtQT.js → netsuite-COumFXC2.js} +2 -2
- package/dist/{number-y_W4pn_d.js → number-gSLvxNqA.js} +3 -3
- package/dist/portal-feature-catalog-yGIESKTc.js +246 -0
- package/dist/{predefined-templates-BHvUnTk_.js → predefined-templates-Bw9A9LNA.js} +1 -1
- package/dist/{purchase-order-template-DgOKEzhS.js → purchase-order-template-BaZjdGq8.js} +1 -1
- package/dist/{recalculationUtils-Dv__DzZh.js → recalculationUtils-t32wAurN.js} +1 -1
- package/dist/{row-action.enum-ncgDYAjP.js → row-action.enum-BDeudY4d.js} +2 -2
- package/dist/{rules-CZTBvenw.js → rules-C1btu0Md.js} +2 -2
- package/dist/{stock-CxCRZo_D.js → stock-B59sfN28.js} +1 -1
- package/dist/{stock-XINW8JOM.js → stock-BF86TMW0.js} +3 -3
- package/dist/stores/feature.d.ts +12 -0
- package/dist/{supplier-CkZdeMcl.js → supplier-DnbLJ_cS.js} +2 -2
- package/dist/{surcharge-FRSFqjGl.js → surcharge-C1uE3uQa.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-Cm1styDr.js → uom-rules-DjfyrFHJ.js} +1 -1
- package/dist/{use-ingredient-select-dialog-ntAqHX04.js → use-ingredient-select-dialog-7A7fWyEH.js} +2 -2
- package/dist/{use-inventory-binding-dialog-DVIJO8Cl.js → use-inventory-binding-dialog-Cc1tjTfV.js} +2 -2
- package/dist/{use-template-enabled-locations-CIZqw-Z8.js → use-template-enabled-locations-C-Hqqgzt.js} +2 -2
- package/dist/{use-transfer-locations-CM5vNttA.js → use-transfer-locations-CqsXvOI2.js} +2 -2
- package/dist/{useHrmPermission-CslLuBoP.js → useHrmPermission-BzwD3Ctc.js} +1 -1
- package/dist/useNavigationMenu-PrZg9HS7.js +352 -0
- package/dist/{useSseClient-CCV4mPzD.js → useSseClient-FCyLWq8k.js} +1 -1
- package/dist/views/integration/components/IntegrationCard.vue.d.ts +38 -0
- package/dist/views/settings/FeatureFlagView.vue.d.ts +2 -0
- package/dist/{vue-i18n-C5j4EQhi.js → vue-i18n-C34f-Tph.js} +434 -434
- package/dist/{xlsx.util-B50OvX4z.js → xlsx.util-X4amwe_k.js} +2 -2
- package/package.json +6 -6
- package/dist/App-BXgpGzGR.js +0 -1476
- package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-zcEv1Swg.js +0 -243
- package/dist/IngredientGroupView-qrR9ksEn.js +0 -985
- package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-3e3kDsbN.js +0 -93
- package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-DX2MJqL4.js +0 -29
- package/dist/SettingsView-sThYErMz.js +0 -698
- package/dist/feature-Ckn5ra3z.js +0 -1136
- package/dist/useNavigationMenu-CSinmNCY.js +0 -172
- /package/dist/components/{FmFeatureFlagDialog.vue.d.ts → DeprecateSoonPill.vue.d.ts} +0 -0
|
@@ -1,985 +0,0 @@
|
|
|
1
|
-
import { ref as A, computed as G, h as C, defineComponent as j, watch as re, resolveComponent as R, createElementBlock as B, openBlock as F, createVNode as b, createElementVNode as c, unref as i, toDisplayString as $, createBlock as M, withCtx as T, Fragment as pe, renderList as ve, createTextVNode as ye, createCommentVNode as se, isRef as ge, normalizeClass as _e, normalizeStyle as be, createSlots as ke, Teleport as xe, normalizeProps as he, guardReactiveProps as we } from "vue";
|
|
2
|
-
import { a as L, c as P, j as oe, u as Re } from "./app-Cb5s4jMu.js";
|
|
3
|
-
import { useDialog as Ie, useSnackbar as Y, components as U, useProxiedModel as Se, useBreakpoints as Fe } from "@feedmepos/ui-library";
|
|
4
|
-
import { F as S } from "./form-mode.enum-BKiNVH6A.js";
|
|
5
|
-
import { useI18n as z, useCoreStore as Ge } from "@feedmepos/mf-common";
|
|
6
|
-
import { defineStore as ue, storeToRefs as ae } from "pinia";
|
|
7
|
-
import { D as ie, R as K } from "./row-action.enum-ncgDYAjP.js";
|
|
8
|
-
import { c as Ve } from "./component-BmLAdDiY.js";
|
|
9
|
-
import { u as Ce, _ as De } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
10
|
-
import { _ as Ae, F as le } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
|
|
11
|
-
import { _ as $e } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-zcEv1Swg.js";
|
|
12
|
-
import { d as de } from "./defineDeepModel-Brbsikbi.js";
|
|
13
|
-
import { I as Te, A as Ee, U as Me, R as ce } from "./rules-CZTBvenw.js";
|
|
14
|
-
import { L as Ue, P as Be, D as Pe } from "./app-C39bYJmq.js";
|
|
15
|
-
import { u as Le } from "./FmMultiselectDialog-BAw-gp5K.js";
|
|
16
|
-
import { r as me } from "./random-CSbEbElR.js";
|
|
17
|
-
import { u as ze, R as Ne } from "./usePromise-CbVUCxhj.js";
|
|
18
|
-
const H = ue(
|
|
19
|
-
"ingredientGroupactions",
|
|
20
|
-
function() {
|
|
21
|
-
const _ = Ie(), f = Y(), k = L(), { t: l } = z(), v = A();
|
|
22
|
-
function e() {
|
|
23
|
-
const u = {
|
|
24
|
-
modelValue: {},
|
|
25
|
-
mode: S.CREATE,
|
|
26
|
-
show: !0,
|
|
27
|
-
"onUpdate:show"(m) {
|
|
28
|
-
v.value.show = m;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
v.value = u;
|
|
32
|
-
}
|
|
33
|
-
async function a(u) {
|
|
34
|
-
const m = {
|
|
35
|
-
modelValue: P(u),
|
|
36
|
-
mode: S.UPDATE,
|
|
37
|
-
show: !0,
|
|
38
|
-
"onUpdate:show"(r) {
|
|
39
|
-
v.value.show = r;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
v.value = m;
|
|
43
|
-
}
|
|
44
|
-
async function t(u, m, r) {
|
|
45
|
-
m.value = !0;
|
|
46
|
-
try {
|
|
47
|
-
await k.deleteSkuGroup(u), f.open({
|
|
48
|
-
title: "Success",
|
|
49
|
-
message: `Deleted ${u.name}`,
|
|
50
|
-
type: "success"
|
|
51
|
-
});
|
|
52
|
-
} catch (y) {
|
|
53
|
-
f.open({
|
|
54
|
-
title: `Cannot delete ${u.name}`,
|
|
55
|
-
message: "Please try again.",
|
|
56
|
-
type: "error"
|
|
57
|
-
}), console.error("failed to delete ingredient", y);
|
|
58
|
-
} finally {
|
|
59
|
-
m.value = !1, r();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function n(u, m, r) {
|
|
63
|
-
_.open({
|
|
64
|
-
title: l("inventory.ingredient.delete.title", [(u == null ? void 0 : u.name) ?? ""]),
|
|
65
|
-
closeButton: !1,
|
|
66
|
-
message: l("inventory.ingredient.delete.message"),
|
|
67
|
-
primaryActions: {
|
|
68
|
-
text: l("common.delete"),
|
|
69
|
-
close: !0,
|
|
70
|
-
variant: "destructive"
|
|
71
|
-
},
|
|
72
|
-
secondaryActions: {
|
|
73
|
-
text: l("common.cancel"),
|
|
74
|
-
close: !0
|
|
75
|
-
}
|
|
76
|
-
}).onPrimary(() => t(u, m, r));
|
|
77
|
-
}
|
|
78
|
-
function s() {
|
|
79
|
-
}
|
|
80
|
-
function g() {
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
createIngredientGroup: e,
|
|
84
|
-
updateIngredientGroup: a,
|
|
85
|
-
deleteIngredientGroup: n,
|
|
86
|
-
importIngredientGroups: s,
|
|
87
|
-
exportIngredientGroups: g,
|
|
88
|
-
ingredientGroupDialogProps: v
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
), Oe = ue(
|
|
92
|
-
"ingredientGroupTable",
|
|
93
|
-
function() {
|
|
94
|
-
const _ = A(!1), f = Y(), k = L(), l = H();
|
|
95
|
-
async function v() {
|
|
96
|
-
_.value = !0;
|
|
97
|
-
try {
|
|
98
|
-
await k.readInventory();
|
|
99
|
-
} catch (t) {
|
|
100
|
-
console.error("error on reading inventory", t), f.open({
|
|
101
|
-
title: "Error",
|
|
102
|
-
message: "Something went wrong, please try again.",
|
|
103
|
-
type: "error"
|
|
104
|
-
});
|
|
105
|
-
} finally {
|
|
106
|
-
_.value = !1;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function e(t, n) {
|
|
110
|
-
switch (n = P(n), t) {
|
|
111
|
-
case K.Edit:
|
|
112
|
-
return l.updateIngredientGroup(n);
|
|
113
|
-
case K.Delete:
|
|
114
|
-
return l.deleteIngredientGroup(
|
|
115
|
-
n,
|
|
116
|
-
_,
|
|
117
|
-
() => v()
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const a = G(() => [
|
|
122
|
-
{
|
|
123
|
-
accessorKey: "name",
|
|
124
|
-
header: () => "Name"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
accessorKey: "skuRefs.length",
|
|
128
|
-
header: () => "No. of items"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
accessorKey: "ref",
|
|
132
|
-
header: () => "Reference"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: "action",
|
|
136
|
-
header: "",
|
|
137
|
-
cell(t) {
|
|
138
|
-
return Ve(
|
|
139
|
-
[ie[K.Edit], ie[K.Delete]],
|
|
140
|
-
(n) => {
|
|
141
|
-
e(n, t.row.original);
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
},
|
|
145
|
-
enableSorting: !1,
|
|
146
|
-
size: 40,
|
|
147
|
-
meta: {
|
|
148
|
-
cellClass: "",
|
|
149
|
-
headerClass: ""
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
]);
|
|
153
|
-
return {
|
|
154
|
-
fetchIngredientGroups: v,
|
|
155
|
-
loading: _,
|
|
156
|
-
columnDefs: a
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
function qe(o) {
|
|
161
|
-
return {
|
|
162
|
-
addItem: () => {
|
|
163
|
-
const l = o.create();
|
|
164
|
-
o.items = [...o.items, l];
|
|
165
|
-
},
|
|
166
|
-
updateItem: (l) => {
|
|
167
|
-
l && (o.items = o.items.map(
|
|
168
|
-
(v) => o.id(v) === o.id(l) ? l : v
|
|
169
|
-
));
|
|
170
|
-
},
|
|
171
|
-
removeItem: (l) => {
|
|
172
|
-
o.items = o.items.filter((v) => o.id(v) !== o.id(l));
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
function fe(o) {
|
|
177
|
-
const _ = Le(), f = L(), k = G(() => [
|
|
178
|
-
{
|
|
179
|
-
id: "delete",
|
|
180
|
-
header: "",
|
|
181
|
-
cell(e) {
|
|
182
|
-
const a = e.row.original;
|
|
183
|
-
return C(
|
|
184
|
-
"div",
|
|
185
|
-
{ class: "w-full flex justify-end" },
|
|
186
|
-
C(U.FmButton, {
|
|
187
|
-
class: "delete-button",
|
|
188
|
-
key: a._id,
|
|
189
|
-
type: "button",
|
|
190
|
-
icon: "delete",
|
|
191
|
-
variant: "tertiary",
|
|
192
|
-
size: "md",
|
|
193
|
-
disabled: o.disabled ?? !1,
|
|
194
|
-
onClick: () => {
|
|
195
|
-
o.skuRefs = o.skuRefs.filter((t) => t._id !== a._id);
|
|
196
|
-
}
|
|
197
|
-
})
|
|
198
|
-
);
|
|
199
|
-
},
|
|
200
|
-
enableSorting: !1,
|
|
201
|
-
size: 40,
|
|
202
|
-
meta: {
|
|
203
|
-
cellClass: "",
|
|
204
|
-
headerClass: ""
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
id: "skuRef",
|
|
209
|
-
header: () => "Ingredient",
|
|
210
|
-
accessorFn: (e) => {
|
|
211
|
-
var a, t;
|
|
212
|
-
return `${((a = f.skuById[e._id]) == null ? void 0 : a.name) ?? ""} (${((t = f.skuById[e._id]) == null ? void 0 : t.code) ?? ""})`;
|
|
213
|
-
},
|
|
214
|
-
cell: ({ row: e }) => {
|
|
215
|
-
const a = f.skuById[e.original._id];
|
|
216
|
-
return C(
|
|
217
|
-
"div",
|
|
218
|
-
{
|
|
219
|
-
class: "w-full flex flex-col"
|
|
220
|
-
},
|
|
221
|
-
[
|
|
222
|
-
C("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, a.name),
|
|
223
|
-
C(
|
|
224
|
-
"div",
|
|
225
|
-
{ class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
|
|
226
|
-
a.code
|
|
227
|
-
)
|
|
228
|
-
]
|
|
229
|
-
);
|
|
230
|
-
},
|
|
231
|
-
size: "auto",
|
|
232
|
-
enableSorting: !1
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
id: "unit",
|
|
236
|
-
header: () => "Unit",
|
|
237
|
-
accessorFn: (e) => {
|
|
238
|
-
const a = f.skuById[e._id];
|
|
239
|
-
return a.unit.measurements.computeFirst(
|
|
240
|
-
(t) => t.id === e.trackingMeasurement ? t.name : null
|
|
241
|
-
) ?? a.unit.name;
|
|
242
|
-
},
|
|
243
|
-
enableSorting: !1
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
id: "unitOption",
|
|
247
|
-
header: () => "Unit",
|
|
248
|
-
accessorKey: "trackingMeasurement",
|
|
249
|
-
cell(e) {
|
|
250
|
-
const a = f.skuById[e.row.original._id];
|
|
251
|
-
if (!a) return null;
|
|
252
|
-
const t = [
|
|
253
|
-
{
|
|
254
|
-
label: a.unit.name,
|
|
255
|
-
sublabel: a.unit.abbrev,
|
|
256
|
-
value: null
|
|
257
|
-
},
|
|
258
|
-
...a.unit.measurements.map((n) => ({
|
|
259
|
-
label: n.name,
|
|
260
|
-
sublabel: n.abbrev,
|
|
261
|
-
value: n.id
|
|
262
|
-
}))
|
|
263
|
-
].filter((n) => !n.label.toLowerCase().includes("inactive"));
|
|
264
|
-
return C(U.FmSelect, {
|
|
265
|
-
modelValue: e.row.original.trackingMeasurement ?? null,
|
|
266
|
-
items: t,
|
|
267
|
-
disabled: o.disabled ?? !1,
|
|
268
|
-
"onUpdate:modelValue": (n) => {
|
|
269
|
-
o.skuRefs = o.skuRefs.map((s) => s._id === e.row.original._id ? { ...s, trackingMeasurement: n } : s);
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
},
|
|
273
|
-
enableSorting: !1
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
id: "priority",
|
|
277
|
-
header: () => "Priority",
|
|
278
|
-
accessorKey: "priority",
|
|
279
|
-
enableSorting: !0,
|
|
280
|
-
cell(e) {
|
|
281
|
-
const a = e.row.original;
|
|
282
|
-
return C(U.FmTextField, {
|
|
283
|
-
modelValue: a.priority ?? e.row.index + 1,
|
|
284
|
-
rules: [
|
|
285
|
-
Te(),
|
|
286
|
-
Ee(1),
|
|
287
|
-
Me(
|
|
288
|
-
o.skuRefs.filter((t) => t._id !== a._id).map((t) => {
|
|
289
|
-
const n = f.skuById[t._id];
|
|
290
|
-
return {
|
|
291
|
-
label: n == null ? void 0 : n.name,
|
|
292
|
-
value: t.priority
|
|
293
|
-
};
|
|
294
|
-
})
|
|
295
|
-
)
|
|
296
|
-
],
|
|
297
|
-
"onUpdate:modelValue": (t) => {
|
|
298
|
-
const n = Number(t);
|
|
299
|
-
isNaN(n) || (o.skuRefs = o.skuRefs.map((s) => s._id === e.row.original._id ? { ...s, priority: n } : s));
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
id: "default",
|
|
306
|
-
header: () => "",
|
|
307
|
-
accessorKey: "default",
|
|
308
|
-
cell(e) {
|
|
309
|
-
const a = f.skuById[e.row.original._id];
|
|
310
|
-
return a ? C(U.FmCheckbox, {
|
|
311
|
-
modelValue: e.row.original.default ?? !1,
|
|
312
|
-
value: a._id,
|
|
313
|
-
disabled: o.disabled ?? !1,
|
|
314
|
-
"onUpdate:modelValue": () => {
|
|
315
|
-
o.skuRefs = o.skuRefs.map((t) => t._id === e.row.original._id ? { ...t, default: !0 } : { ...t, default: !1 });
|
|
316
|
-
}
|
|
317
|
-
}) : null;
|
|
318
|
-
},
|
|
319
|
-
enableSorting: !1,
|
|
320
|
-
size: 40,
|
|
321
|
-
meta: {
|
|
322
|
-
cellClass: "",
|
|
323
|
-
headerClass: ""
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
id: "move",
|
|
328
|
-
header: "",
|
|
329
|
-
cell(e) {
|
|
330
|
-
const a = e.row.original;
|
|
331
|
-
return C("div", { class: "w-full flex justify-end" }, [
|
|
332
|
-
C(U.FmButton, {
|
|
333
|
-
key: a._id,
|
|
334
|
-
type: "button",
|
|
335
|
-
icon: "keyboard_arrow_up",
|
|
336
|
-
variant: "tertiary",
|
|
337
|
-
size: "md",
|
|
338
|
-
disabled: o.disabled ?? !1,
|
|
339
|
-
onClick: () => {
|
|
340
|
-
const t = [...o.skuRefs], n = t.findIndex((s) => s._id === a._id);
|
|
341
|
-
if (n > 0) {
|
|
342
|
-
const s = t[n - 1];
|
|
343
|
-
t[n - 1] = a, t[n] = s;
|
|
344
|
-
}
|
|
345
|
-
o.skuRefs = [...t];
|
|
346
|
-
}
|
|
347
|
-
}),
|
|
348
|
-
C(U.FmButton, {
|
|
349
|
-
key: a._id,
|
|
350
|
-
type: "button",
|
|
351
|
-
icon: "keyboard_arrow_down",
|
|
352
|
-
variant: "tertiary",
|
|
353
|
-
size: "md",
|
|
354
|
-
disabled: o.disabled ?? !1,
|
|
355
|
-
onClick: () => {
|
|
356
|
-
const t = [...o.skuRefs], n = t.findIndex((s) => s._id === a._id);
|
|
357
|
-
if (n < t.length - 1) {
|
|
358
|
-
const s = t[n + 1];
|
|
359
|
-
t[n + 1] = a, t[n] = s;
|
|
360
|
-
}
|
|
361
|
-
o.skuRefs = [...t];
|
|
362
|
-
}
|
|
363
|
-
})
|
|
364
|
-
]);
|
|
365
|
-
},
|
|
366
|
-
enableSorting: !1,
|
|
367
|
-
size: 40,
|
|
368
|
-
meta: {
|
|
369
|
-
cellClass: "",
|
|
370
|
-
headerClass: ""
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
]);
|
|
374
|
-
return {
|
|
375
|
-
get columnDefs() {
|
|
376
|
-
return k.value;
|
|
377
|
-
},
|
|
378
|
-
promptAddIngredient: async () => {
|
|
379
|
-
if (!o.isDefaultList && !o.allowOverride)
|
|
380
|
-
return _.alert("Not allowed", "You cannot add ingredients to this list.");
|
|
381
|
-
const v = f.skus.map((t) => ({
|
|
382
|
-
label: t.name,
|
|
383
|
-
sublabel: t.code,
|
|
384
|
-
value: t._id
|
|
385
|
-
})), e = (o.skuRefs ?? []).map((t) => t._id), a = await _.multiSelect(v, e, (t) => {
|
|
386
|
-
var s, g, u, m, r, y;
|
|
387
|
-
const n = (s = o.skuRefs) == null ? void 0 : s.findIndex((w) => w._id === t);
|
|
388
|
-
return {
|
|
389
|
-
_id: t,
|
|
390
|
-
trackingMeasurement: typeof n != "number" || n == -1 ? (g = f.skuById[t]) == null ? void 0 : g.trackingMeasurement : (m = (u = o.skuRefs) == null ? void 0 : u[n]) == null ? void 0 : m.trackingMeasurement,
|
|
391
|
-
priority: ((y = (r = o.skuRefs) == null ? void 0 : r[n]) == null ? void 0 : y.priority) ?? o.skuRefs.length,
|
|
392
|
-
default: !1
|
|
393
|
-
};
|
|
394
|
-
});
|
|
395
|
-
o.skuRefs = a ?? o.skuRefs;
|
|
396
|
-
},
|
|
397
|
-
columnVisibility: {
|
|
398
|
-
delete: o.isDefaultList || !!o.allowOverride,
|
|
399
|
-
unit: !o.isDefaultList && !o.allowOverride,
|
|
400
|
-
unitOption: o.isDefaultList || !!o.allowOverride,
|
|
401
|
-
// previous demo: sort priority by moving sku element in the array,
|
|
402
|
-
// new demo: sort priority using priority field.
|
|
403
|
-
// can reenable if this use case is requested to be restored
|
|
404
|
-
move: !1
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
const Ke = { class: "flex flex-col gap-16" }, je = { class: "flex flex-col" }, He = { class: "flex flex-col gap-4" }, Ye = { class: "flex flex-col gap-16" }, Je = { class: "flex flex-col" }, Qe = { class: "flex flex-col gap-4" }, We = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xe = /* @__PURE__ */ j({
|
|
409
|
-
__name: "IngredientGroupRuleField",
|
|
410
|
-
props: {
|
|
411
|
-
disabled: { type: Boolean },
|
|
412
|
-
modelValue: {}
|
|
413
|
-
},
|
|
414
|
-
setup(o) {
|
|
415
|
-
const _ = o, { t: f } = z(), k = Ge(), l = G(() => {
|
|
416
|
-
var g;
|
|
417
|
-
const n = /* @__PURE__ */ new Map(), s = k.restaurants.value.map((u) => u.customAttributes ?? {});
|
|
418
|
-
for (const u of s)
|
|
419
|
-
for (const [m, r] of Object.entries(u))
|
|
420
|
-
n.has(m) || n.set(m, /* @__PURE__ */ new Set()), r && ((g = n.get(m)) == null || g.add(r));
|
|
421
|
-
return n;
|
|
422
|
-
}), v = G(() => [
|
|
423
|
-
...[...l.value.entries()].map(([s, g]) => ({
|
|
424
|
-
type: "string",
|
|
425
|
-
key: s,
|
|
426
|
-
entity: "restaurant",
|
|
427
|
-
values: [...g]
|
|
428
|
-
}))
|
|
429
|
-
]), e = de("modelValue", {
|
|
430
|
-
get default() {
|
|
431
|
-
return {
|
|
432
|
-
_id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${me(4)}`,
|
|
433
|
-
name: "",
|
|
434
|
-
rule: null,
|
|
435
|
-
skuRefs: []
|
|
436
|
-
};
|
|
437
|
-
},
|
|
438
|
-
watchProps: !0
|
|
439
|
-
}), a = A(e.rule ? Ue.build(e.rule) : null);
|
|
440
|
-
re(
|
|
441
|
-
a,
|
|
442
|
-
(n) => {
|
|
443
|
-
e.rule = n ? Be.build(n) : null;
|
|
444
|
-
},
|
|
445
|
-
{ deep: !0, immediate: !0 }
|
|
446
|
-
);
|
|
447
|
-
const t = fe({
|
|
448
|
-
get disabled() {
|
|
449
|
-
return _.disabled ?? !1;
|
|
450
|
-
},
|
|
451
|
-
get skuRefs() {
|
|
452
|
-
return e.skuRefs ?? [];
|
|
453
|
-
},
|
|
454
|
-
set skuRefs(n) {
|
|
455
|
-
e.skuRefs = n;
|
|
456
|
-
},
|
|
457
|
-
isDefaultList: !1,
|
|
458
|
-
allowOverride: !1
|
|
459
|
-
});
|
|
460
|
-
return (n, s) => {
|
|
461
|
-
const g = R("FmTextField"), u = R("FmLabel"), m = R("FmFormGroup"), r = R("FmTable");
|
|
462
|
-
return F(), B("div", Ke, [
|
|
463
|
-
b(g, {
|
|
464
|
-
modelValue: i(e).name,
|
|
465
|
-
"onUpdate:modelValue": s[0] || (s[0] = (y) => i(e).name = y),
|
|
466
|
-
label: i(f)("inventory.ingredientGroup.form.rules.name"),
|
|
467
|
-
"label-mark": "required",
|
|
468
|
-
rules: [i(ce)()]
|
|
469
|
-
}, null, 8, ["modelValue", "label", "rules"]),
|
|
470
|
-
c("div", je, [
|
|
471
|
-
c("div", He, [
|
|
472
|
-
b(u, {
|
|
473
|
-
label: i(f)("inventory.ingredientGroup.form.rules.title"),
|
|
474
|
-
required: ""
|
|
475
|
-
}, null, 8, ["label"]),
|
|
476
|
-
b(i(Pe), {
|
|
477
|
-
modelValue: a.value,
|
|
478
|
-
"onUpdate:modelValue": s[1] || (s[1] = (y) => a.value = y),
|
|
479
|
-
attributes: v.value
|
|
480
|
-
}, null, 8, ["modelValue", "attributes"])
|
|
481
|
-
]),
|
|
482
|
-
b(m, {
|
|
483
|
-
"model-value": a.value,
|
|
484
|
-
rules: [
|
|
485
|
-
(y) => {
|
|
486
|
-
var w;
|
|
487
|
-
return !!((w = y == null ? void 0 : y.rules) != null && w.length) || "At least one rule is required";
|
|
488
|
-
}
|
|
489
|
-
]
|
|
490
|
-
}, null, 8, ["model-value", "rules"])
|
|
491
|
-
]),
|
|
492
|
-
c("div", Ye, [
|
|
493
|
-
c("div", Je, [
|
|
494
|
-
c("div", Qe, [
|
|
495
|
-
c("div", null, [
|
|
496
|
-
b(u, {
|
|
497
|
-
label: i(f)("inventory.ingredientGroup.form.rules.ingredients"),
|
|
498
|
-
required: ""
|
|
499
|
-
}, null, 8, ["label"])
|
|
500
|
-
])
|
|
501
|
-
]),
|
|
502
|
-
b(m, {
|
|
503
|
-
"model-value": i(e).skuRefs,
|
|
504
|
-
rules: [
|
|
505
|
-
(y) => !!(y != null && y.length) || "At least one ingredient is required"
|
|
506
|
-
]
|
|
507
|
-
}, null, 8, ["model-value", "rules"])
|
|
508
|
-
]),
|
|
509
|
-
b(r, {
|
|
510
|
-
"row-data": i(e).skuRefs,
|
|
511
|
-
"column-defs": i(t).columnDefs,
|
|
512
|
-
"page-size": i(e).skuRefs.length,
|
|
513
|
-
"shrink-at": 9999,
|
|
514
|
-
"column-visibility": i(t).columnVisibility,
|
|
515
|
-
"hide-footer": ""
|
|
516
|
-
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
517
|
-
]),
|
|
518
|
-
c("div", We, $(i(f)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
|
|
519
|
-
]);
|
|
520
|
-
};
|
|
521
|
-
}
|
|
522
|
-
}), Ze = { class: "flex flex-col gap-16" }, et = { class: "flex flex-col gap-16" }, tt = { class: "flex flex-col" }, nt = { class: "flex items-center" }, st = { class: "flex-1" }, ot = { class: "flex flex-col gap-8" }, at = { class: "flex-1 fm-typo-en-title-sm-600" }, it = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary px-4" }, lt = { class: "flex flex-col gap-16" }, rt = { class: "flex flex-col gap-8" }, ut = { class: "flex-1 fm-typo-en-title-sm-600" }, dt = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ct = { class: "flex flex-col gap-12" }, mt = { class: "flex items-center" }, ft = { class: "flex-1 fm-typo-en-body-lg-600 line-clamp-1" }, pt = { key: 0 }, vt = {
|
|
523
|
-
key: 1,
|
|
524
|
-
class: "fm-typo-en-body-lg-400"
|
|
525
|
-
}, yt = /* @__PURE__ */ j({
|
|
526
|
-
__name: "IngredientGroupForm",
|
|
527
|
-
props: {
|
|
528
|
-
mode: {},
|
|
529
|
-
disabled: { type: Boolean },
|
|
530
|
-
modelValue: {},
|
|
531
|
-
menu: {}
|
|
532
|
-
},
|
|
533
|
-
emits: ["validation-success"],
|
|
534
|
-
setup(o, { expose: _, emit: f }) {
|
|
535
|
-
const k = o, l = de("modelValue", {
|
|
536
|
-
watchProps: !0
|
|
537
|
-
}), v = f, { t: e } = z(), a = qe({
|
|
538
|
-
get items() {
|
|
539
|
-
return l.rules ?? [];
|
|
540
|
-
},
|
|
541
|
-
set items(s) {
|
|
542
|
-
l.rules = s;
|
|
543
|
-
},
|
|
544
|
-
create: function() {
|
|
545
|
-
var s;
|
|
546
|
-
return {
|
|
547
|
-
_id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${me(4)}`,
|
|
548
|
-
name: "",
|
|
549
|
-
rule: null,
|
|
550
|
-
skuRefs: ((s = k.modelValue) == null ? void 0 : s.defaultSkuRefs) ?? []
|
|
551
|
-
};
|
|
552
|
-
},
|
|
553
|
-
id: function(s) {
|
|
554
|
-
return s._id;
|
|
555
|
-
}
|
|
556
|
-
}), t = fe({
|
|
557
|
-
get disabled() {
|
|
558
|
-
return k.disabled;
|
|
559
|
-
},
|
|
560
|
-
get skuRefs() {
|
|
561
|
-
return l.defaultSkuRefs ?? [];
|
|
562
|
-
},
|
|
563
|
-
set skuRefs(s) {
|
|
564
|
-
l.defaultSkuRefs = s;
|
|
565
|
-
const g = s.map((r) => r._id), u = l.rules;
|
|
566
|
-
if (!u) return;
|
|
567
|
-
const m = s.groupBy(
|
|
568
|
-
(r) => r._id,
|
|
569
|
-
(r) => r.trackingMeasurement
|
|
570
|
-
);
|
|
571
|
-
for (const r of u) {
|
|
572
|
-
const y = r.skuRefs.filter((x) => g.includes(x._id)), w = s.filter(
|
|
573
|
-
(x) => !y.some((I) => I._id === x._id)
|
|
574
|
-
);
|
|
575
|
-
r.skuRefs = [...y, ...w].map((x) => {
|
|
576
|
-
var I;
|
|
577
|
-
return {
|
|
578
|
-
...x,
|
|
579
|
-
trackingMeasurement: ((I = m.get(x._id)) == null ? void 0 : I[0]) ?? null
|
|
580
|
-
};
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
l.rules = [...u];
|
|
584
|
-
},
|
|
585
|
-
isDefaultList: !0
|
|
586
|
-
}), n = A();
|
|
587
|
-
return _({
|
|
588
|
-
validateInputs: () => {
|
|
589
|
-
var s;
|
|
590
|
-
return (s = n.value) == null ? void 0 : s.validateInputs();
|
|
591
|
-
},
|
|
592
|
-
resetInputsValidation: () => {
|
|
593
|
-
var s;
|
|
594
|
-
return (s = n.value) == null ? void 0 : s.resetInputsValidation();
|
|
595
|
-
},
|
|
596
|
-
resetInputs: () => {
|
|
597
|
-
var s;
|
|
598
|
-
return (s = n.value) == null ? void 0 : s.resetInputs();
|
|
599
|
-
}
|
|
600
|
-
}), (s, g) => {
|
|
601
|
-
const u = R("FmTextField"), m = R("FmButton"), r = R("FmFormGroup"), y = R("FmTable"), w = R("FmCard"), x = R("FmForm");
|
|
602
|
-
return F(), M(x, {
|
|
603
|
-
onValidationSuccess: g[2] || (g[2] = (I) => v("validation-success")),
|
|
604
|
-
ref_key: "formRef",
|
|
605
|
-
ref: n,
|
|
606
|
-
class: "flex flex-col gap-64"
|
|
607
|
-
}, {
|
|
608
|
-
default: T(() => {
|
|
609
|
-
var I;
|
|
610
|
-
return [
|
|
611
|
-
c("div", Ze, [
|
|
612
|
-
b(u, {
|
|
613
|
-
label: i(e)("inventory.ingredientGroup.form.name"),
|
|
614
|
-
"label-mark": "required",
|
|
615
|
-
rules: [i(ce)()],
|
|
616
|
-
modelValue: i(l).name,
|
|
617
|
-
"onUpdate:modelValue": g[0] || (g[0] = (d) => i(l).name = d)
|
|
618
|
-
}, null, 8, ["label", "rules", "modelValue"]),
|
|
619
|
-
b(u, {
|
|
620
|
-
label: i(e)("inventory.ingredientGroup.form.ref"),
|
|
621
|
-
"label-mark": "optional",
|
|
622
|
-
modelValue: i(l).ref,
|
|
623
|
-
"onUpdate:modelValue": g[1] || (g[1] = (d) => i(l).ref = d)
|
|
624
|
-
}, null, 8, ["label", "modelValue"])
|
|
625
|
-
]),
|
|
626
|
-
c("div", et, [
|
|
627
|
-
c("div", tt, [
|
|
628
|
-
c("div", nt, [
|
|
629
|
-
c("div", st, [
|
|
630
|
-
c("div", ot, [
|
|
631
|
-
c("div", at, $(i(e)("inventory.ingredientGroup.form.defaultRule.title")), 1)
|
|
632
|
-
])
|
|
633
|
-
]),
|
|
634
|
-
c("div", null, [
|
|
635
|
-
b(m, {
|
|
636
|
-
disabled: s.disabled,
|
|
637
|
-
label: "Add ingredient",
|
|
638
|
-
"prepend-icon": "link",
|
|
639
|
-
variant: "plain",
|
|
640
|
-
class: "border-1 rounded-lg border-fm-color-primary",
|
|
641
|
-
onClick: i(t).promptAddIngredient,
|
|
642
|
-
size: "md"
|
|
643
|
-
}, null, 8, ["disabled", "onClick"])
|
|
644
|
-
])
|
|
645
|
-
]),
|
|
646
|
-
b(r, {
|
|
647
|
-
"model-value": i(l).defaultSkuRefs,
|
|
648
|
-
rules: [
|
|
649
|
-
(d) => !!(d != null && d.length) || "At least one ingredient is required"
|
|
650
|
-
]
|
|
651
|
-
}, null, 8, ["model-value", "rules"])
|
|
652
|
-
]),
|
|
653
|
-
c("div", null, [
|
|
654
|
-
b(y, {
|
|
655
|
-
"row-data": i(l).defaultSkuRefs ?? [],
|
|
656
|
-
"column-defs": i(t).columnDefs,
|
|
657
|
-
"column-visibility": i(t).columnVisibility,
|
|
658
|
-
"page-size": (I = i(l).defaultSkuRefs) == null ? void 0 : I.length,
|
|
659
|
-
"shrink-at": 9999,
|
|
660
|
-
"hide-footer": ""
|
|
661
|
-
}, null, 8, ["row-data", "column-defs", "column-visibility", "page-size"])
|
|
662
|
-
]),
|
|
663
|
-
c("div", it, $(i(e)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
|
|
664
|
-
]),
|
|
665
|
-
c("div", lt, [
|
|
666
|
-
c("div", rt, [
|
|
667
|
-
c("div", ut, $(i(e)("inventory.ingredientGroup.form.rules.title")), 1),
|
|
668
|
-
c("div", dt, $(i(e)("inventory.ingredientGroup.form.rules.description")), 1)
|
|
669
|
-
]),
|
|
670
|
-
(F(!0), B(pe, null, ve(i(l).rules, (d, p) => (F(), M(w, {
|
|
671
|
-
key: d.id,
|
|
672
|
-
variant: "outlined",
|
|
673
|
-
class: "p-16"
|
|
674
|
-
}, {
|
|
675
|
-
default: T(() => [
|
|
676
|
-
c("div", ct, [
|
|
677
|
-
c("div", mt, [
|
|
678
|
-
c("div", ft, [
|
|
679
|
-
ye($(i(e)("inventory.ingredientGroup.form.rules.rule_N", [p + 1])), 1),
|
|
680
|
-
d.name ? (F(), B("span", pt, ": ")) : se("", !0),
|
|
681
|
-
d.name ? (F(), B("span", vt, $(d.name), 1)) : se("", !0)
|
|
682
|
-
]),
|
|
683
|
-
b(m, {
|
|
684
|
-
variant: "tertiary",
|
|
685
|
-
icon: "delete",
|
|
686
|
-
onClick: (h) => i(a).removeItem(d)
|
|
687
|
-
}, null, 8, ["onClick"])
|
|
688
|
-
]),
|
|
689
|
-
c("div", null, [
|
|
690
|
-
(F(), M(Xe, {
|
|
691
|
-
key: d._id,
|
|
692
|
-
"model-value": d,
|
|
693
|
-
"onUpdate:modelValue": i(a).updateItem,
|
|
694
|
-
disabled: s.disabled,
|
|
695
|
-
menu: s.menu
|
|
696
|
-
}, null, 8, ["model-value", "onUpdate:modelValue", "disabled", "menu"]))
|
|
697
|
-
])
|
|
698
|
-
])
|
|
699
|
-
]),
|
|
700
|
-
_: 2
|
|
701
|
-
}, 1024))), 128)),
|
|
702
|
-
c("div", null, [
|
|
703
|
-
b(m, {
|
|
704
|
-
variant: "plain",
|
|
705
|
-
icon: "add",
|
|
706
|
-
label: i(e)("inventory.ingredientGroup.form.rules.addRule"),
|
|
707
|
-
onClick: i(a).addItem
|
|
708
|
-
}, null, 8, ["label", "onClick"])
|
|
709
|
-
])
|
|
710
|
-
])
|
|
711
|
-
];
|
|
712
|
-
}),
|
|
713
|
-
_: 1
|
|
714
|
-
}, 512);
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
|
-
}), gt = {
|
|
718
|
-
key: 0,
|
|
719
|
-
class: "text-fm-color-typo-primary fm-typo-en-body-lg-400"
|
|
720
|
-
}, _t = { class: "flex gap-4" }, bt = /* @__PURE__ */ j({
|
|
721
|
-
__name: "IngredientGroupDialog",
|
|
722
|
-
props: {
|
|
723
|
-
show: { type: Boolean },
|
|
724
|
-
mode: { default: S.READ },
|
|
725
|
-
modelValue: {}
|
|
726
|
-
},
|
|
727
|
-
emits: ["update:show"],
|
|
728
|
-
setup(o) {
|
|
729
|
-
const _ = o, f = L(), k = ze(() => f.readCachedMenu()), l = G(
|
|
730
|
-
() => k.result.value.state === Ne.success ? k.result.value.data : void 0
|
|
731
|
-
), v = Y(), { t: e } = z(), a = Se(_, "show");
|
|
732
|
-
function t() {
|
|
733
|
-
return {
|
|
734
|
-
_id: "",
|
|
735
|
-
name: "",
|
|
736
|
-
rules: []
|
|
737
|
-
};
|
|
738
|
-
}
|
|
739
|
-
const n = A(t()), s = A(`${Math.random()}`);
|
|
740
|
-
re(
|
|
741
|
-
() => _.show,
|
|
742
|
-
(d) => {
|
|
743
|
-
if (!d) return;
|
|
744
|
-
let p = P(_.modelValue ?? t());
|
|
745
|
-
p.defaultSkuRefs && (p.defaultSkuRefs = p.defaultSkuRefs.map((h, V) => ({
|
|
746
|
-
...h,
|
|
747
|
-
priority: h.priority ?? V + 1
|
|
748
|
-
})));
|
|
749
|
-
for (let h = 0; p.rules && h < p.rules.length; h++) {
|
|
750
|
-
const V = p.rules[h];
|
|
751
|
-
V.skuRefs = V.skuRefs.map((D, E) => ({
|
|
752
|
-
...D,
|
|
753
|
-
priority: D.priority ?? E + 1
|
|
754
|
-
}));
|
|
755
|
-
}
|
|
756
|
-
n.value = p, s.value = p._id || `${Math.random()}`;
|
|
757
|
-
}
|
|
758
|
-
);
|
|
759
|
-
const g = G(() => {
|
|
760
|
-
switch (_.mode) {
|
|
761
|
-
case S.READ:
|
|
762
|
-
return "";
|
|
763
|
-
case S.UPDATE:
|
|
764
|
-
return e("inventory.ingredientGroup.update.title");
|
|
765
|
-
case S.CREATE:
|
|
766
|
-
return e("inventory.ingredientGroup.create.title");
|
|
767
|
-
}
|
|
768
|
-
return "";
|
|
769
|
-
}), u = G(() => {
|
|
770
|
-
switch (_.mode) {
|
|
771
|
-
case S.READ:
|
|
772
|
-
return "";
|
|
773
|
-
case S.UPDATE:
|
|
774
|
-
return e("common.save");
|
|
775
|
-
case S.CREATE:
|
|
776
|
-
return e("common.add");
|
|
777
|
-
}
|
|
778
|
-
return "";
|
|
779
|
-
}), m = A(), r = A(!1);
|
|
780
|
-
async function y() {
|
|
781
|
-
r.value = !0;
|
|
782
|
-
const d = P(n.value);
|
|
783
|
-
try {
|
|
784
|
-
await f.createSkuGroup(d), a.value = !1, v.open({
|
|
785
|
-
title: e("inventory.common.success"),
|
|
786
|
-
message: e("inventory.ingredientGroup.create.success", { name: d.name }),
|
|
787
|
-
type: "success"
|
|
788
|
-
});
|
|
789
|
-
} catch (p) {
|
|
790
|
-
p instanceof oe || v.open({
|
|
791
|
-
title: e("inventory.ingredientGroup.create.error.title"),
|
|
792
|
-
message: e("inventory.ingredientGroup.create.error.message"),
|
|
793
|
-
type: "error"
|
|
794
|
-
});
|
|
795
|
-
} finally {
|
|
796
|
-
r.value = !1;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
async function w() {
|
|
800
|
-
r.value = !0;
|
|
801
|
-
const d = P(n.value);
|
|
802
|
-
try {
|
|
803
|
-
await f.updateSkuGroup(d), r.value = !1, a.value = !1, v.open({
|
|
804
|
-
title: e("inventory.common.success"),
|
|
805
|
-
message: e("inventory.ingredientGroup.update.success", { name: d.name }),
|
|
806
|
-
type: "success"
|
|
807
|
-
});
|
|
808
|
-
} catch (p) {
|
|
809
|
-
p instanceof oe || v.open({
|
|
810
|
-
title: e("inventory.ingredientGroup.update.error.title"),
|
|
811
|
-
message: e("inventory.ingredientGroup.update.error.message"),
|
|
812
|
-
type: "error"
|
|
813
|
-
});
|
|
814
|
-
} finally {
|
|
815
|
-
r.value = !1;
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
function x() {
|
|
819
|
-
var d, p;
|
|
820
|
-
(p = (d = m.value) == null ? void 0 : d.validateInputs) == null || p.call(d);
|
|
821
|
-
}
|
|
822
|
-
function I() {
|
|
823
|
-
switch (_.mode) {
|
|
824
|
-
case S.READ:
|
|
825
|
-
return;
|
|
826
|
-
case S.UPDATE:
|
|
827
|
-
return w();
|
|
828
|
-
case S.CREATE:
|
|
829
|
-
return y();
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return (d, p) => {
|
|
833
|
-
const h = R("FmButton"), V = R("FmSideSheet");
|
|
834
|
-
return F(), M(V, {
|
|
835
|
-
"model-value": i(a),
|
|
836
|
-
"onUpdate:modelValue": p[3] || (p[3] = (D) => ge(a) ? a.value = D : null),
|
|
837
|
-
header: g.value,
|
|
838
|
-
"close-button": "",
|
|
839
|
-
"dismiss-away": "",
|
|
840
|
-
"max-width": 800
|
|
841
|
-
}, {
|
|
842
|
-
"side-sheet-footer": T(() => [
|
|
843
|
-
c("div", _t, [
|
|
844
|
-
b(h, {
|
|
845
|
-
loading: r.value,
|
|
846
|
-
label: u.value,
|
|
847
|
-
onClick: x
|
|
848
|
-
}, null, 8, ["loading", "label"]),
|
|
849
|
-
b(h, {
|
|
850
|
-
disabled: r.value,
|
|
851
|
-
label: i(e)("common.close"),
|
|
852
|
-
variant: "tertiary",
|
|
853
|
-
onClick: p[2] || (p[2] = (D) => a.value = !1)
|
|
854
|
-
}, null, 8, ["disabled", "label"])
|
|
855
|
-
])
|
|
856
|
-
]),
|
|
857
|
-
default: T(() => [
|
|
858
|
-
l.value ? (F(), M(yt, {
|
|
859
|
-
menu: l.value,
|
|
860
|
-
class: "w-full",
|
|
861
|
-
ref_key: "hasValidationExpose",
|
|
862
|
-
ref: m,
|
|
863
|
-
key: s.value,
|
|
864
|
-
"model-value": n.value,
|
|
865
|
-
"onUpdate:modelValue": p[0] || (p[0] = (D) => n.value = D),
|
|
866
|
-
mode: d.mode,
|
|
867
|
-
disabled: r.value,
|
|
868
|
-
onValidationSuccess: p[1] || (p[1] = (D) => I())
|
|
869
|
-
}, null, 8, ["menu", "model-value", "mode", "disabled"])) : (F(), B("div", gt, "Loading.."))
|
|
870
|
-
]),
|
|
871
|
-
_: 1
|
|
872
|
-
}, 8, ["model-value", "header"]);
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
}), kt = { class: "flex flex-col py-8" }, xt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ht = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Lt = /* @__PURE__ */ j({
|
|
876
|
-
__name: "IngredientGroupView",
|
|
877
|
-
setup(o) {
|
|
878
|
-
const _ = L(), f = G(() => _.skuGroups), k = Re(), { t: l } = z(), {
|
|
879
|
-
createIngredientGroup: v,
|
|
880
|
-
updateIngredientGroup: e,
|
|
881
|
-
importIngredientGroups: a,
|
|
882
|
-
exportIngredientGroups: t
|
|
883
|
-
} = H(), { columnDefs: n, loading: s } = ae(Oe()), { ingredientGroupDialogProps: g } = ae(H());
|
|
884
|
-
function u(h) {
|
|
885
|
-
switch (h) {
|
|
886
|
-
case "add":
|
|
887
|
-
return v();
|
|
888
|
-
case "import":
|
|
889
|
-
return a();
|
|
890
|
-
case "export":
|
|
891
|
-
return t();
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
const m = A(""), r = A(!1), y = G(() => r.value || s.value), { breakpoints: w } = Fe(), x = G(() => w.value.xs || w.value.sm), I = G(() => x.value ? 10 : 20), d = Ce(), p = G(() => [
|
|
895
|
-
{
|
|
896
|
-
label: l("inventory.ingredient.create.title"),
|
|
897
|
-
value: "add",
|
|
898
|
-
isPrimary: !0,
|
|
899
|
-
prependIcon: "add"
|
|
900
|
-
},
|
|
901
|
-
{ label: l("common.import"), value: "import" },
|
|
902
|
-
{ label: l("common.export"), value: "export" }
|
|
903
|
-
]);
|
|
904
|
-
return (h, V) => {
|
|
905
|
-
const D = R("FmTable");
|
|
906
|
-
return F(), M(De, {
|
|
907
|
-
title: i(l)("inventory.ingredientGroup.title"),
|
|
908
|
-
actions: p.value,
|
|
909
|
-
"onClick:action": u
|
|
910
|
-
}, {
|
|
911
|
-
default: T(() => [
|
|
912
|
-
c("div", {
|
|
913
|
-
class: _e([
|
|
914
|
-
"flex flex-col gap-8 max-h-full",
|
|
915
|
-
{
|
|
916
|
-
"p-0": x.value,
|
|
917
|
-
"px-24 ": !x.value
|
|
918
|
-
}
|
|
919
|
-
])
|
|
920
|
-
}, [
|
|
921
|
-
b($e, {
|
|
922
|
-
searchable: "",
|
|
923
|
-
search: m.value,
|
|
924
|
-
"onUpdate:search": V[0] || (V[0] = (E) => m.value = E)
|
|
925
|
-
}, null, 8, ["search"]),
|
|
926
|
-
b(D, {
|
|
927
|
-
style: be(i(d).tableHeight),
|
|
928
|
-
"column-defs": i(n),
|
|
929
|
-
"row-data": f.value,
|
|
930
|
-
"search-value": m.value,
|
|
931
|
-
loading: !i(k)._currentLocation || y.value,
|
|
932
|
-
"loading-text": i(l)("inventory.common.loading"),
|
|
933
|
-
onRowClick: V[1] || (V[1] = (E) => i(e)(E.original)),
|
|
934
|
-
"page-size": I.value
|
|
935
|
-
}, {
|
|
936
|
-
"list-row": T((E) => [
|
|
937
|
-
b(Ae, {
|
|
938
|
-
row: E,
|
|
939
|
-
onRowClick: i(e)
|
|
940
|
-
}, ke({
|
|
941
|
-
default: T((N) => {
|
|
942
|
-
var J, Q, W, O, X, Z, ee, te, q, ne;
|
|
943
|
-
return [
|
|
944
|
-
c("div", kt, [
|
|
945
|
-
c("div", xt, [
|
|
946
|
-
b(i(le), {
|
|
947
|
-
render: (W = (Q = (J = N.code) == null ? void 0 : J.column) == null ? void 0 : Q.columnDef) == null ? void 0 : W.cell,
|
|
948
|
-
props: (X = (O = N.code) == null ? void 0 : O.getContext) == null ? void 0 : X.call(O)
|
|
949
|
-
}, null, 8, ["render", "props"])
|
|
950
|
-
]),
|
|
951
|
-
c("div", ht, [
|
|
952
|
-
b(i(le), {
|
|
953
|
-
render: (te = (ee = (Z = N.name) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : te.cell,
|
|
954
|
-
props: (ne = (q = N.name) == null ? void 0 : q.getContext) == null ? void 0 : ne.call(q)
|
|
955
|
-
}, null, 8, ["render", "props"])
|
|
956
|
-
])
|
|
957
|
-
])
|
|
958
|
-
];
|
|
959
|
-
}),
|
|
960
|
-
_: 2
|
|
961
|
-
}, [
|
|
962
|
-
r.value ? {
|
|
963
|
-
name: "loading-text",
|
|
964
|
-
fn: T(() => [
|
|
965
|
-
c("div", null, $(i(l)("inventory.ingredient.table.importing")), 1)
|
|
966
|
-
]),
|
|
967
|
-
key: "0"
|
|
968
|
-
} : void 0
|
|
969
|
-
]), 1032, ["row", "onRowClick"])
|
|
970
|
-
]),
|
|
971
|
-
_: 1
|
|
972
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "loading-text", "page-size"])
|
|
973
|
-
], 2),
|
|
974
|
-
(F(), M(xe, { to: "body" }, [
|
|
975
|
-
b(bt, he(we(i(g))), null, 16)
|
|
976
|
-
]))
|
|
977
|
-
]),
|
|
978
|
-
_: 1
|
|
979
|
-
}, 8, ["title", "actions"]);
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
|
-
});
|
|
983
|
-
export {
|
|
984
|
-
Lt as default
|
|
985
|
-
};
|