@feedmepos/mf-inventory-portal 1.8.0-dev.3 → 1.8.0-dev.5
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-DEbWEOwe.js +1537 -0
- package/dist/{ApprovalView-hV1msz5Y.js → ApprovalView-BEnYHIlU.js} +9 -9
- package/dist/{BindingsDialog-BX1Lopf0.js → BindingsDialog-CJVkMoBS.js} +2 -2
- package/dist/{BindingsPicker-BNKW8-XY.js → BindingsPicker-CX9o-xdQ.js} +2 -2
- package/dist/{BindingsTable-DiLDsL83.js → BindingsTable-Cil4LJ7l.js} +4 -4
- package/dist/{BulkReceiveRequestView-oQh6kFLc.js → BulkReceiveRequestView-DYEc2jPw.js} +21 -22
- package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-BaMcGU-x.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DoAv2mHA.js} +1 -1
- package/dist/{ClosingDraftView-sgLoaSf4.js → ClosingDraftView-Bz94Iejf.js} +20 -20
- package/dist/{ClosingHistoryView-BnE9HrzA.js → ClosingHistoryView-B479Y-mH.js} +5 -5
- package/dist/{ClosingTemplateView-BD3Pa11r.js → ClosingTemplateView-F_nx43n6.js} +18 -18
- package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DlbyxkMQ.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DddYGHxQ.js} +1 -1
- package/dist/{DefaultView-CuzvVkfE.js → DefaultView-CkZOl0ov.js} +5 -5
- package/dist/{DeliveryOrderPrintPreview-w-1aAOY1.js → DeliveryOrderPrintPreview-BJEpwAX6.js} +2 -2
- package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-CxD12Qct.js → EmailDialog.vue_vue_type_script_setup_true_lang-BW988AoC.js} +29 -30
- package/dist/{FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-CMoQKl_a.js → FeatureCapabilityBadge.vue_vue_type_script_setup_true_lang-Izn-hTjK.js} +107 -118
- package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BqCh_vTP.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CoUWxHlj.js} +1 -1
- package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CAXnmdUy.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ci81xTbl.js} +2 -2
- package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-NhOdW33O.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CnaHTAUZ.js} +2 -2
- package/dist/{FmMultiselectDialog-CULwA_hi.js → FmMultiselectDialog-BE8BlO6_.js} +2 -2
- package/dist/FmMultiselectDialog-COKgBmPZ.js +123 -0
- package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CI3Y9kDl.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BQHd3NjM.js} +6 -6
- package/dist/ImportView-Crb_yrNb.js +1291 -0
- package/dist/{IngredientsView-pzpP6oXT.js → IngredientsView-lDypeR4c.js} +34 -35
- package/dist/{IntegrationExplorerView-C5aAhB6e.js → IntegrationExplorerView-DgOFGj7H.js} +4 -4
- package/dist/{IntegrationView-Bqun7nX0.js → IntegrationView-0sbjINo5.js} +973 -974
- package/dist/{InventoryBindingForm-r_Ua1C4a.js → InventoryBindingForm-BhyrjIXJ.js} +1 -1
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-KCz_BQ6T.js +472 -0
- package/dist/{InventoryBindingSummary-BQuZLohR.js → InventoryBindingSummary-CsfNKd1r.js} +1 -1
- package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-7r-QcJdU.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C32OoIBz.js} +1 -1
- package/dist/{ProductionRunDetailView-95fu_CfH.js → ProductionRunDetailView-BxbDtGMo.js} +4 -4
- package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CdOca1tV.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BdJVvwSP.js} +9 -9
- package/dist/{ProductionRunView-DIjor_Ix.js → ProductionRunView-CJhNEIzT.js} +3 -3
- package/dist/{PublishView-DYObyHQq.js → PublishView-vkt6-D6P.js} +3 -3
- package/dist/{PurchaseOrderPrintPreview-C0jCmI9L.js → PurchaseOrderPrintPreview-25dHfVKp.js} +2 -2
- package/dist/{ReceiveRequestView-i7ibPfIE.js → ReceiveRequestView-BO4Z2dZu.js} +15 -16
- package/dist/RecipeView-B_AE7QQv.js +3428 -0
- package/dist/{SettingsView-CdBloj9k.js → SettingsView-qTUvQCuu.js} +163 -168
- package/dist/{StockView-g_6eJ62R.js → StockView-yh6qkYUS.js} +269 -270
- package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-C1rKc7MA.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Cn_fx9qG.js} +1 -1
- package/dist/{SupplierView-DkYp_Frj.js → SupplierView-Dqzu1Bvh.js} +14 -14
- package/dist/{SurchargeView-CfkV4Y3y.js → SurchargeView-CDosn36c.js} +7 -7
- package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-2MtN1p5t.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DZ3Gdlp9.js} +2 -2
- package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CYMjKXq4.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CWoh2FqQ.js} +1 -1
- package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-D0zNr_vQ.js → TransferDetails.vue_vue_type_script_setup_true_lang-BtjKnIwf.js} +867 -844
- package/dist/{TransferTemplateView-Ne2gYUSn.js → TransferTemplateView-fDZcC9i4.js} +22 -23
- package/dist/{UnitCostHistoryView-Db0_otOb.js → UnitCostHistoryView-CmTTIXAp.js} +4 -4
- package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BzO1lq7j.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DZihCM0T.js} +4 -4
- package/dist/{UnitView-CiCeQ63i.js → UnitView-BTx59sFK.js} +8 -8
- package/dist/{WarehouseView-BcuJSOMF.js → WarehouseView-BIFe08FJ.js} +8 -8
- package/dist/{WastageTemplateView-CPQmtOKQ.js → WastageTemplateView-B_oJqm0_.js} +15 -15
- package/dist/api/feature-flags.d.ts +2 -0
- package/dist/api/license.d.ts +0 -2
- package/dist/{app-DqJp3dcI.js → app-DyEvx3Em.js} +1628 -1817
- package/dist/app.d.ts +0 -150
- package/dist/app.js +1 -1
- package/dist/{closing-template-BNlgZviN.js → closing-template-FgcLy4RT.js} +1 -1
- package/dist/components/FeatureCapabilityBadge.vue.d.ts +1 -1
- package/dist/{date2-Ci7521dn.js → date2-Rv4IwT9a.js} +1 -1
- package/dist/{dayjs.min-Cyp32v4J.js → dayjs.min-DOq1QM_M.js} +1 -1
- package/dist/{decimal-BGdm5R3A.js → decimal-7vA05AaD.js} +2 -2
- package/dist/{defineDeepModel-B2cJ-rtd.js → defineDeepModel-22Md2SKY.js} +1 -1
- package/dist/{duplicate-template-By5WeKZ0.js → duplicate-template-D2tjCY7C.js} +1 -1
- package/dist/{core-Js7d-3Pv.js → feature-BMTKl6PK.js} +732 -389
- package/dist/feature-flags/core.d.ts +3 -2
- package/dist/feature-flags/portal-feature-catalog.d.ts +0 -5
- package/dist/feature-flags/vue.d.ts +2 -0
- package/dist/{format-time-from-id-Q8C2P96H.js → format-time-from-id-DXhm_Ji1.js} +1 -1
- package/dist/{format-unit-display-CICrmm8r.js → format-unit-display-DxWLjFPz.js} +13 -13
- package/dist/helper/menu-usage-module.d.ts +1 -1
- package/dist/{id-to-date-DeN5x0LR.js → id-to-date-VKlOL3mN.js} +1 -1
- package/dist/{import-export.helper-BOTQWxr6.js → import-export.helper-BiF5aKUp.js} +28 -28
- package/dist/{index-BbbqCCfp.js → index-DEl_gZn0.js} +3 -3
- package/dist/{index-tCYhLCKP.js → index-DdtsVAcv.js} +1 -1
- package/dist/{index-Cxm3Sgfv.js → index-DoBWE4Ci.js} +1 -1
- package/dist/{lz-string-Dy4Pg8mh.js → lz-string-BwQj8QRN.js} +1 -1
- package/dist/{netsuite-BaJjkDM8.js → netsuite-s1S33-lP.js} +2 -2
- package/dist/{number-CB36d2PQ.js → number-BmKjsNrc.js} +3 -3
- package/dist/{predefined-templates-DLm93Bpx.js → predefined-templates-BZ2KqNix.js} +1 -1
- package/dist/{purchase-order-template-CDhn9ZIF.js → purchase-order-template-CINU4my1.js} +1 -1
- package/dist/{recalculationUtils-Cqvefakh.js → recalculationUtils-R5tFu_ts.js} +1 -1
- package/dist/router/name.d.ts +0 -1
- package/dist/{row-action.enum-NTfVmGY8.js → row-action.enum-ePO-Py0V.js} +1 -1
- package/dist/{rules-C8dfM84-.js → rules-BZrZVzw7.js} +2 -2
- package/dist/{stock-BGB0Siue.js → stock-C2HOKq0k.js} +8 -8
- package/dist/{stock-Qu5IiN2_.js → stock-Ce1UvAZ3.js} +1 -1
- package/dist/stores/feature.d.ts +10 -9
- package/dist/stores/inventory.d.ts +0 -47
- package/dist/stores/supplier.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/{supplier-CZdNOSMN.js → supplier-DgT66emI.js} +17 -17
- package/dist/{surcharge-Cm40oJvU.js → surcharge-CsVMuzPM.js} +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/{uom-rules-L-IW4Nwk.js → uom-rules-CR1XukyM.js} +1 -1
- package/dist/{use-ingredient-select-dialog-B2TDVJM6.js → use-ingredient-select-dialog-CJkG4hEX.js} +2 -2
- package/dist/use-inventory-binding-dialog-B36kPj4V.js +113 -0
- package/dist/{use-template-enabled-locations-DYAPMvo9.js → use-template-enabled-locations-Boa9QLPV.js} +2 -2
- package/dist/{use-transfer-locations-w-9tymYS.js → use-transfer-locations-BxOygSUg.js} +2 -2
- package/dist/{useHrmPermission-BFCIo5sA.js → useHrmPermission-DLHAqbLV.js} +1 -1
- package/dist/{useNavigationMenu-BPHAH5sJ.js → useNavigationMenu-D6abZMGz.js} +102 -109
- package/dist/{useSseClient-CWjRacRs.js → useSseClient-C7pff-EW.js} +1 -1
- package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -1
- package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +0 -1
- package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -1
- package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -1
- package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +1 -1
- package/dist/views/integration/components/IntegrationCard.vue.d.ts +3 -3
- package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +0 -1
- package/dist/views/recipe/helper/import-recipe.d.ts +2 -2
- package/dist/{vue-i18n-S4YQ9w6a.js → vue-i18n-CpOOFhVU.js} +219 -219
- package/dist/{xlsx.util-CP8_VajN.js → xlsx.util-xwI5tVz6.js} +2 -2
- package/package.json +5 -5
- package/dist/App-DRXADP0k.js +0 -1498
- package/dist/DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-Bp8bjDU1.js +0 -58
- package/dist/FmMultiselectDialog-BqZgHP8s.js +0 -77
- package/dist/ImportView-DqQG673_.js +0 -1302
- package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DfvNUu80.js +0 -51
- package/dist/IngredientGroupView-CyngKxPo.js +0 -1000
- package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CYDuu4kU.js +0 -563
- package/dist/RecipeView-C5VO7yr3.js +0 -3625
- package/dist/feature-fG7d73oi.js +0 -371
- package/dist/index-Dqf27vLH.js +0 -841
- package/dist/random-CSbEbElR.js +0 -10
- package/dist/use-inventory-binding-dialog-BJ00hl5f.js +0 -152
- package/dist/usePromise-CbVUCxhj.js +0 -29
- package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +0 -3
- package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
- package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -10
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -21
- package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
- package/dist/views/ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +0 -37
- package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
- package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +0 -31
- package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -77
|
@@ -1,1000 +0,0 @@
|
|
|
1
|
-
import { ref as C, computed as F, h as V, defineComponent as W, watch as ce, resolveComponent as R, createElementBlock as z, openBlock as G, createVNode as b, createElementVNode as c, unref as l, toDisplayString as E, createBlock as U, withCtx as M, Fragment as _e, renderList as be, createTextVNode as ke, createCommentVNode as le, isRef as xe, normalizeClass as he, normalizeStyle as we, createSlots as Re, Teleport as Ie, normalizeProps as Se, guardReactiveProps as Ge } from "vue";
|
|
2
|
-
import { a as O, c as N, j as ie, u as Fe } from "./app-DqJp3dcI.js";
|
|
3
|
-
import { useDialog as Ve, useSnackbar as Q, components as L, useProxiedModel as Ce, useBreakpoints as De } from "@feedmepos/ui-library";
|
|
4
|
-
import { F as S } from "./form-mode.enum-BKiNVH6A.js";
|
|
5
|
-
import { useI18n as q, useCoreStore as Ae } from "@feedmepos/mf-common";
|
|
6
|
-
import { defineStore as me, storeToRefs as re } from "pinia";
|
|
7
|
-
import { D as ue, R as H } from "./row-action.enum-NTfVmGY8.js";
|
|
8
|
-
import { c as $e } from "./component-BmLAdDiY.js";
|
|
9
|
-
import { u as Te, _ as Ee } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
|
|
10
|
-
import { _ as Me, F as de } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
|
|
11
|
-
import { _ as Pe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-NhOdW33O.js";
|
|
12
|
-
import { d as fe } from "./defineDeepModel-B2cJ-rtd.js";
|
|
13
|
-
import { I as Ue, A as Be, U as Le, R as pe } from "./rules-C8dfM84-.js";
|
|
14
|
-
import { L as ze, P as Ne, D as Oe } from "./app-C39bYJmq.js";
|
|
15
|
-
import { u as qe } from "./FmMultiselectDialog-BqZgHP8s.js";
|
|
16
|
-
import { r as ve } from "./random-CSbEbElR.js";
|
|
17
|
-
import { u as Ke, R as je } from "./usePromise-CbVUCxhj.js";
|
|
18
|
-
import { _ as He } from "./DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-Bp8bjDU1.js";
|
|
19
|
-
const J = me(
|
|
20
|
-
"ingredientGroupactions",
|
|
21
|
-
function() {
|
|
22
|
-
const _ = Ve(), p = Q(), k = O(), { t: i } = q(), v = C();
|
|
23
|
-
function e() {
|
|
24
|
-
const u = {
|
|
25
|
-
modelValue: {},
|
|
26
|
-
mode: S.CREATE,
|
|
27
|
-
show: !0,
|
|
28
|
-
"onUpdate:show"(m) {
|
|
29
|
-
v.value.show = m;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
v.value = u;
|
|
33
|
-
}
|
|
34
|
-
async function a(u) {
|
|
35
|
-
const m = {
|
|
36
|
-
modelValue: N(u),
|
|
37
|
-
mode: S.UPDATE,
|
|
38
|
-
show: !0,
|
|
39
|
-
"onUpdate:show"(r) {
|
|
40
|
-
v.value.show = r;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
v.value = m;
|
|
44
|
-
}
|
|
45
|
-
async function t(u, m, r) {
|
|
46
|
-
m.value = !0;
|
|
47
|
-
try {
|
|
48
|
-
await k.deleteSkuGroup(u), p.open({
|
|
49
|
-
title: "Success",
|
|
50
|
-
message: `Deleted ${u.name}`,
|
|
51
|
-
type: "success"
|
|
52
|
-
});
|
|
53
|
-
} catch (g) {
|
|
54
|
-
p.open({
|
|
55
|
-
title: `Cannot delete ${u.name}`,
|
|
56
|
-
message: "Please try again.",
|
|
57
|
-
type: "error"
|
|
58
|
-
}), console.error("failed to delete ingredient", g);
|
|
59
|
-
} finally {
|
|
60
|
-
m.value = !1, r();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function n(u, m, r) {
|
|
64
|
-
_.open({
|
|
65
|
-
title: i("inventory.ingredient.delete.title", [(u == null ? void 0 : u.name) ?? ""]),
|
|
66
|
-
closeButton: !1,
|
|
67
|
-
message: i("inventory.ingredient.delete.message"),
|
|
68
|
-
primaryActions: {
|
|
69
|
-
text: i("common.delete"),
|
|
70
|
-
close: !0,
|
|
71
|
-
variant: "destructive"
|
|
72
|
-
},
|
|
73
|
-
secondaryActions: {
|
|
74
|
-
text: i("common.cancel"),
|
|
75
|
-
close: !0
|
|
76
|
-
}
|
|
77
|
-
}).onPrimary(() => t(u, m, r));
|
|
78
|
-
}
|
|
79
|
-
function o() {
|
|
80
|
-
}
|
|
81
|
-
function y() {
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
createIngredientGroup: e,
|
|
85
|
-
updateIngredientGroup: a,
|
|
86
|
-
deleteIngredientGroup: n,
|
|
87
|
-
importIngredientGroups: o,
|
|
88
|
-
exportIngredientGroups: y,
|
|
89
|
-
ingredientGroupDialogProps: v
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
), We = me(
|
|
93
|
-
"ingredientGroupTable",
|
|
94
|
-
function() {
|
|
95
|
-
const _ = C(!1), p = Q(), k = O(), i = J();
|
|
96
|
-
async function v() {
|
|
97
|
-
_.value = !0;
|
|
98
|
-
try {
|
|
99
|
-
await k.readInventory();
|
|
100
|
-
} catch (t) {
|
|
101
|
-
console.error("error on reading inventory", t), p.open({
|
|
102
|
-
title: "Error",
|
|
103
|
-
message: "Something went wrong, please try again.",
|
|
104
|
-
type: "error"
|
|
105
|
-
});
|
|
106
|
-
} finally {
|
|
107
|
-
_.value = !1;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function e(t, n) {
|
|
111
|
-
switch (n = N(n), t) {
|
|
112
|
-
case H.Edit:
|
|
113
|
-
return i.updateIngredientGroup(n);
|
|
114
|
-
case H.Delete:
|
|
115
|
-
return i.deleteIngredientGroup(
|
|
116
|
-
n,
|
|
117
|
-
_,
|
|
118
|
-
() => v()
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const a = F(() => [
|
|
123
|
-
{
|
|
124
|
-
accessorKey: "name",
|
|
125
|
-
header: () => "Name"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
accessorKey: "skuRefs.length",
|
|
129
|
-
header: () => "No. of items"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
accessorKey: "ref",
|
|
133
|
-
header: () => "Reference"
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: "action",
|
|
137
|
-
header: "",
|
|
138
|
-
cell(t) {
|
|
139
|
-
return $e(
|
|
140
|
-
[ue[H.Edit], ue[H.Delete]],
|
|
141
|
-
(n) => {
|
|
142
|
-
e(n, t.row.original);
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
},
|
|
146
|
-
enableSorting: !1,
|
|
147
|
-
size: 40,
|
|
148
|
-
meta: {
|
|
149
|
-
cellClass: "",
|
|
150
|
-
headerClass: ""
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
]);
|
|
154
|
-
return {
|
|
155
|
-
fetchIngredientGroups: v,
|
|
156
|
-
loading: _,
|
|
157
|
-
columnDefs: a
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
function Ye(s) {
|
|
162
|
-
return {
|
|
163
|
-
addItem: () => {
|
|
164
|
-
const i = s.create();
|
|
165
|
-
s.items = [...s.items, i];
|
|
166
|
-
},
|
|
167
|
-
updateItem: (i) => {
|
|
168
|
-
i && (s.items = s.items.map(
|
|
169
|
-
(v) => s.id(v) === s.id(i) ? i : v
|
|
170
|
-
));
|
|
171
|
-
},
|
|
172
|
-
removeItem: (i) => {
|
|
173
|
-
s.items = s.items.filter((v) => s.id(v) !== s.id(i));
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function ge(s) {
|
|
178
|
-
const _ = qe(), p = O(), k = F(() => [
|
|
179
|
-
{
|
|
180
|
-
id: "delete",
|
|
181
|
-
header: "",
|
|
182
|
-
cell(e) {
|
|
183
|
-
const a = e.row.original;
|
|
184
|
-
return V(
|
|
185
|
-
"div",
|
|
186
|
-
{ class: "w-full flex justify-end" },
|
|
187
|
-
V(L.FmButton, {
|
|
188
|
-
class: "delete-button",
|
|
189
|
-
key: a._id,
|
|
190
|
-
type: "button",
|
|
191
|
-
icon: "delete",
|
|
192
|
-
variant: "tertiary",
|
|
193
|
-
size: "md",
|
|
194
|
-
disabled: s.disabled ?? !1,
|
|
195
|
-
onClick: () => {
|
|
196
|
-
s.skuRefs = s.skuRefs.filter((t) => t._id !== a._id);
|
|
197
|
-
}
|
|
198
|
-
})
|
|
199
|
-
);
|
|
200
|
-
},
|
|
201
|
-
enableSorting: !1,
|
|
202
|
-
size: 40,
|
|
203
|
-
meta: {
|
|
204
|
-
cellClass: "",
|
|
205
|
-
headerClass: ""
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
id: "skuRef",
|
|
210
|
-
header: () => "Ingredient",
|
|
211
|
-
accessorFn: (e) => {
|
|
212
|
-
var a, t;
|
|
213
|
-
return `${((a = p.skuById[e._id]) == null ? void 0 : a.name) ?? ""} (${((t = p.skuById[e._id]) == null ? void 0 : t.code) ?? ""})`;
|
|
214
|
-
},
|
|
215
|
-
cell: ({ row: e }) => {
|
|
216
|
-
const a = p.skuById[e.original._id];
|
|
217
|
-
return V(
|
|
218
|
-
"div",
|
|
219
|
-
{
|
|
220
|
-
class: "w-full flex flex-col"
|
|
221
|
-
},
|
|
222
|
-
[
|
|
223
|
-
V("div", { class: "fm-typo-en-body-lg-400 line-clamp-1" }, a.name),
|
|
224
|
-
V(
|
|
225
|
-
"div",
|
|
226
|
-
{ class: "fm-typo-en-body-md-400 line-clamp-1 text-fm-color-typo-secondary" },
|
|
227
|
-
a.code
|
|
228
|
-
)
|
|
229
|
-
]
|
|
230
|
-
);
|
|
231
|
-
},
|
|
232
|
-
size: "auto",
|
|
233
|
-
enableSorting: !1
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
id: "unit",
|
|
237
|
-
header: () => "Unit",
|
|
238
|
-
accessorFn: (e) => {
|
|
239
|
-
const a = p.skuById[e._id];
|
|
240
|
-
return a.unit.measurements.computeFirst(
|
|
241
|
-
(t) => t.id === e.trackingMeasurement ? t.name : null
|
|
242
|
-
) ?? a.unit.name;
|
|
243
|
-
},
|
|
244
|
-
enableSorting: !1
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
id: "unitOption",
|
|
248
|
-
header: () => "Unit",
|
|
249
|
-
accessorKey: "trackingMeasurement",
|
|
250
|
-
cell(e) {
|
|
251
|
-
const a = p.skuById[e.row.original._id];
|
|
252
|
-
if (!a) return null;
|
|
253
|
-
const t = [
|
|
254
|
-
{
|
|
255
|
-
label: a.unit.name,
|
|
256
|
-
sublabel: a.unit.abbrev,
|
|
257
|
-
value: null
|
|
258
|
-
},
|
|
259
|
-
...a.unit.measurements.map((n) => ({
|
|
260
|
-
label: n.name,
|
|
261
|
-
sublabel: n.abbrev,
|
|
262
|
-
value: n.id
|
|
263
|
-
}))
|
|
264
|
-
].filter((n) => !n.label.toLowerCase().includes("inactive"));
|
|
265
|
-
return V(L.FmSelect, {
|
|
266
|
-
modelValue: e.row.original.trackingMeasurement ?? null,
|
|
267
|
-
items: t,
|
|
268
|
-
disabled: s.disabled ?? !1,
|
|
269
|
-
"onUpdate:modelValue": (n) => {
|
|
270
|
-
s.skuRefs = s.skuRefs.map((o) => o._id === e.row.original._id ? { ...o, trackingMeasurement: n } : o);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
},
|
|
274
|
-
enableSorting: !1
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
id: "priority",
|
|
278
|
-
header: () => "Priority",
|
|
279
|
-
accessorKey: "priority",
|
|
280
|
-
enableSorting: !0,
|
|
281
|
-
cell(e) {
|
|
282
|
-
const a = e.row.original;
|
|
283
|
-
return V(L.FmTextField, {
|
|
284
|
-
modelValue: a.priority ?? e.row.index + 1,
|
|
285
|
-
rules: [
|
|
286
|
-
Ue(),
|
|
287
|
-
Be(1),
|
|
288
|
-
Le(
|
|
289
|
-
s.skuRefs.filter((t) => t._id !== a._id).map((t) => {
|
|
290
|
-
const n = p.skuById[t._id];
|
|
291
|
-
return {
|
|
292
|
-
label: n == null ? void 0 : n.name,
|
|
293
|
-
value: t.priority
|
|
294
|
-
};
|
|
295
|
-
})
|
|
296
|
-
)
|
|
297
|
-
],
|
|
298
|
-
"onUpdate:modelValue": (t) => {
|
|
299
|
-
const n = Number(t);
|
|
300
|
-
isNaN(n) || (s.skuRefs = s.skuRefs.map((o) => o._id === e.row.original._id ? { ...o, priority: n } : o));
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
id: "default",
|
|
307
|
-
header: () => "",
|
|
308
|
-
accessorKey: "default",
|
|
309
|
-
cell(e) {
|
|
310
|
-
const a = p.skuById[e.row.original._id];
|
|
311
|
-
return a ? V(L.FmCheckbox, {
|
|
312
|
-
modelValue: e.row.original.default ?? !1,
|
|
313
|
-
value: a._id,
|
|
314
|
-
disabled: s.disabled ?? !1,
|
|
315
|
-
"onUpdate:modelValue": () => {
|
|
316
|
-
s.skuRefs = s.skuRefs.map((t) => t._id === e.row.original._id ? { ...t, default: !0 } : { ...t, default: !1 });
|
|
317
|
-
}
|
|
318
|
-
}) : null;
|
|
319
|
-
},
|
|
320
|
-
enableSorting: !1,
|
|
321
|
-
size: 40,
|
|
322
|
-
meta: {
|
|
323
|
-
cellClass: "",
|
|
324
|
-
headerClass: ""
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
id: "move",
|
|
329
|
-
header: "",
|
|
330
|
-
cell(e) {
|
|
331
|
-
const a = e.row.original;
|
|
332
|
-
return V("div", { class: "w-full flex justify-end" }, [
|
|
333
|
-
V(L.FmButton, {
|
|
334
|
-
key: a._id,
|
|
335
|
-
type: "button",
|
|
336
|
-
icon: "keyboard_arrow_up",
|
|
337
|
-
variant: "tertiary",
|
|
338
|
-
size: "md",
|
|
339
|
-
disabled: s.disabled ?? !1,
|
|
340
|
-
onClick: () => {
|
|
341
|
-
const t = [...s.skuRefs], n = t.findIndex((o) => o._id === a._id);
|
|
342
|
-
if (n > 0) {
|
|
343
|
-
const o = t[n - 1];
|
|
344
|
-
t[n - 1] = a, t[n] = o;
|
|
345
|
-
}
|
|
346
|
-
s.skuRefs = [...t];
|
|
347
|
-
}
|
|
348
|
-
}),
|
|
349
|
-
V(L.FmButton, {
|
|
350
|
-
key: a._id,
|
|
351
|
-
type: "button",
|
|
352
|
-
icon: "keyboard_arrow_down",
|
|
353
|
-
variant: "tertiary",
|
|
354
|
-
size: "md",
|
|
355
|
-
disabled: s.disabled ?? !1,
|
|
356
|
-
onClick: () => {
|
|
357
|
-
const t = [...s.skuRefs], n = t.findIndex((o) => o._id === a._id);
|
|
358
|
-
if (n < t.length - 1) {
|
|
359
|
-
const o = t[n + 1];
|
|
360
|
-
t[n + 1] = a, t[n] = o;
|
|
361
|
-
}
|
|
362
|
-
s.skuRefs = [...t];
|
|
363
|
-
}
|
|
364
|
-
})
|
|
365
|
-
]);
|
|
366
|
-
},
|
|
367
|
-
enableSorting: !1,
|
|
368
|
-
size: 40,
|
|
369
|
-
meta: {
|
|
370
|
-
cellClass: "",
|
|
371
|
-
headerClass: ""
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
]);
|
|
375
|
-
return {
|
|
376
|
-
get columnDefs() {
|
|
377
|
-
return k.value;
|
|
378
|
-
},
|
|
379
|
-
promptAddIngredient: async () => {
|
|
380
|
-
if (!s.isDefaultList && !s.allowOverride)
|
|
381
|
-
return _.alert("Not allowed", "You cannot add ingredients to this list.");
|
|
382
|
-
const v = p.skus.map((t) => ({
|
|
383
|
-
label: t.name,
|
|
384
|
-
sublabel: t.code,
|
|
385
|
-
value: t._id
|
|
386
|
-
})), e = (s.skuRefs ?? []).map((t) => t._id), a = await _.multiSelect(v, e, (t) => {
|
|
387
|
-
var o, y, u, m, r, g;
|
|
388
|
-
const n = (o = s.skuRefs) == null ? void 0 : o.findIndex((I) => I._id === t);
|
|
389
|
-
return {
|
|
390
|
-
_id: t,
|
|
391
|
-
trackingMeasurement: typeof n != "number" || n == -1 ? (y = p.skuById[t]) == null ? void 0 : y.trackingMeasurement : (m = (u = s.skuRefs) == null ? void 0 : u[n]) == null ? void 0 : m.trackingMeasurement,
|
|
392
|
-
priority: ((g = (r = s.skuRefs) == null ? void 0 : r[n]) == null ? void 0 : g.priority) ?? s.skuRefs.length,
|
|
393
|
-
default: !1
|
|
394
|
-
};
|
|
395
|
-
});
|
|
396
|
-
s.skuRefs = a ?? s.skuRefs;
|
|
397
|
-
},
|
|
398
|
-
columnVisibility: {
|
|
399
|
-
delete: s.isDefaultList || !!s.allowOverride,
|
|
400
|
-
unit: !s.isDefaultList && !s.allowOverride,
|
|
401
|
-
unitOption: s.isDefaultList || !!s.allowOverride,
|
|
402
|
-
// previous demo: sort priority by moving sku element in the array,
|
|
403
|
-
// new demo: sort priority using priority field.
|
|
404
|
-
// can reenable if this use case is requested to be restored
|
|
405
|
-
move: !1
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
const Je = { class: "flex flex-col gap-16" }, Qe = { class: "flex flex-col" }, Xe = { class: "flex flex-col gap-4" }, Ze = { class: "flex flex-col gap-16" }, et = { class: "flex flex-col" }, tt = { class: "flex flex-col gap-4" }, nt = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = /* @__PURE__ */ W({
|
|
410
|
-
__name: "IngredientGroupRuleField",
|
|
411
|
-
props: {
|
|
412
|
-
disabled: { type: Boolean },
|
|
413
|
-
modelValue: {}
|
|
414
|
-
},
|
|
415
|
-
setup(s) {
|
|
416
|
-
const _ = s, { t: p } = q(), k = Ae(), i = F(() => {
|
|
417
|
-
var y;
|
|
418
|
-
const n = /* @__PURE__ */ new Map(), o = k.restaurants.value.map((u) => u.customAttributes ?? {});
|
|
419
|
-
for (const u of o)
|
|
420
|
-
for (const [m, r] of Object.entries(u))
|
|
421
|
-
n.has(m) || n.set(m, /* @__PURE__ */ new Set()), r && ((y = n.get(m)) == null || y.add(r));
|
|
422
|
-
return n;
|
|
423
|
-
}), v = F(() => [
|
|
424
|
-
...[...i.value.entries()].map(([o, y]) => ({
|
|
425
|
-
type: "string",
|
|
426
|
-
key: o,
|
|
427
|
-
entity: "restaurant",
|
|
428
|
-
values: [...y]
|
|
429
|
-
}))
|
|
430
|
-
]), e = fe("modelValue", {
|
|
431
|
-
get default() {
|
|
432
|
-
return {
|
|
433
|
-
_id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${ve(4)}`,
|
|
434
|
-
name: "",
|
|
435
|
-
rule: null,
|
|
436
|
-
skuRefs: []
|
|
437
|
-
};
|
|
438
|
-
},
|
|
439
|
-
watchProps: !0
|
|
440
|
-
}), a = C(e.rule ? ze.build(e.rule) : null);
|
|
441
|
-
ce(
|
|
442
|
-
a,
|
|
443
|
-
(n) => {
|
|
444
|
-
e.rule = n ? Ne.build(n) : null;
|
|
445
|
-
},
|
|
446
|
-
{ deep: !0, immediate: !0 }
|
|
447
|
-
);
|
|
448
|
-
const t = ge({
|
|
449
|
-
get disabled() {
|
|
450
|
-
return _.disabled ?? !1;
|
|
451
|
-
},
|
|
452
|
-
get skuRefs() {
|
|
453
|
-
return e.skuRefs ?? [];
|
|
454
|
-
},
|
|
455
|
-
set skuRefs(n) {
|
|
456
|
-
e.skuRefs = n;
|
|
457
|
-
},
|
|
458
|
-
isDefaultList: !1,
|
|
459
|
-
allowOverride: !1
|
|
460
|
-
});
|
|
461
|
-
return (n, o) => {
|
|
462
|
-
const y = R("FmTextField"), u = R("FmLabel"), m = R("FmFormGroup"), r = R("FmTable");
|
|
463
|
-
return G(), z("div", Je, [
|
|
464
|
-
b(y, {
|
|
465
|
-
modelValue: l(e).name,
|
|
466
|
-
"onUpdate:modelValue": o[0] || (o[0] = (g) => l(e).name = g),
|
|
467
|
-
label: l(p)("inventory.ingredientGroup.form.rules.name"),
|
|
468
|
-
"label-mark": "required",
|
|
469
|
-
rules: [l(pe)()]
|
|
470
|
-
}, null, 8, ["modelValue", "label", "rules"]),
|
|
471
|
-
c("div", Qe, [
|
|
472
|
-
c("div", Xe, [
|
|
473
|
-
b(u, {
|
|
474
|
-
label: l(p)("inventory.ingredientGroup.form.rules.title"),
|
|
475
|
-
required: ""
|
|
476
|
-
}, null, 8, ["label"]),
|
|
477
|
-
b(l(Oe), {
|
|
478
|
-
modelValue: a.value,
|
|
479
|
-
"onUpdate:modelValue": o[1] || (o[1] = (g) => a.value = g),
|
|
480
|
-
attributes: v.value
|
|
481
|
-
}, null, 8, ["modelValue", "attributes"])
|
|
482
|
-
]),
|
|
483
|
-
b(m, {
|
|
484
|
-
"model-value": a.value,
|
|
485
|
-
rules: [
|
|
486
|
-
(g) => {
|
|
487
|
-
var I;
|
|
488
|
-
return !!((I = g == null ? void 0 : g.rules) != null && I.length) || "At least one rule is required";
|
|
489
|
-
}
|
|
490
|
-
]
|
|
491
|
-
}, null, 8, ["model-value", "rules"])
|
|
492
|
-
]),
|
|
493
|
-
c("div", Ze, [
|
|
494
|
-
c("div", et, [
|
|
495
|
-
c("div", tt, [
|
|
496
|
-
c("div", null, [
|
|
497
|
-
b(u, {
|
|
498
|
-
label: l(p)("inventory.ingredientGroup.form.rules.ingredients"),
|
|
499
|
-
required: ""
|
|
500
|
-
}, null, 8, ["label"])
|
|
501
|
-
])
|
|
502
|
-
]),
|
|
503
|
-
b(m, {
|
|
504
|
-
"model-value": l(e).skuRefs,
|
|
505
|
-
rules: [
|
|
506
|
-
(g) => !!(g != null && g.length) || "At least one ingredient is required"
|
|
507
|
-
]
|
|
508
|
-
}, null, 8, ["model-value", "rules"])
|
|
509
|
-
]),
|
|
510
|
-
b(r, {
|
|
511
|
-
"row-data": l(e).skuRefs,
|
|
512
|
-
"column-defs": l(t).columnDefs,
|
|
513
|
-
"page-size": l(e).skuRefs.length,
|
|
514
|
-
"shrink-at": 9999,
|
|
515
|
-
"column-visibility": l(t).columnVisibility,
|
|
516
|
-
"hide-footer": ""
|
|
517
|
-
}, null, 8, ["row-data", "column-defs", "page-size", "column-visibility"])
|
|
518
|
-
]),
|
|
519
|
-
c("div", nt, E(l(p)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
|
|
520
|
-
]);
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
}), st = { class: "flex flex-col gap-16" }, at = { class: "flex flex-col gap-16" }, lt = { class: "flex flex-col" }, it = { class: "flex items-center" }, rt = { class: "flex-1" }, ut = { class: "flex flex-col gap-8" }, dt = { class: "flex-1 fm-typo-en-title-sm-600" }, ct = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary px-4" }, mt = { class: "flex flex-col gap-16" }, ft = { class: "flex flex-col gap-8" }, pt = { class: "flex-1 fm-typo-en-title-sm-600" }, vt = { class: "flex-1 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "flex flex-col gap-12" }, yt = { class: "flex items-center" }, _t = { class: "flex-1 fm-typo-en-body-lg-600 line-clamp-1" }, bt = { key: 0 }, kt = {
|
|
524
|
-
key: 1,
|
|
525
|
-
class: "fm-typo-en-body-lg-400"
|
|
526
|
-
}, xt = /* @__PURE__ */ W({
|
|
527
|
-
__name: "IngredientGroupForm",
|
|
528
|
-
props: {
|
|
529
|
-
mode: {},
|
|
530
|
-
disabled: { type: Boolean },
|
|
531
|
-
modelValue: {},
|
|
532
|
-
menu: {}
|
|
533
|
-
},
|
|
534
|
-
emits: ["validation-success"],
|
|
535
|
-
setup(s, { expose: _, emit: p }) {
|
|
536
|
-
const k = s, i = fe("modelValue", {
|
|
537
|
-
watchProps: !0
|
|
538
|
-
}), v = p, { t: e } = q(), a = Ye({
|
|
539
|
-
get items() {
|
|
540
|
-
return i.rules ?? [];
|
|
541
|
-
},
|
|
542
|
-
set items(o) {
|
|
543
|
-
i.rules = o;
|
|
544
|
-
},
|
|
545
|
-
create: function() {
|
|
546
|
-
var o;
|
|
547
|
-
return {
|
|
548
|
-
_id: `skuGroupRule_${(/* @__PURE__ */ new Date()).toISOString()}_${ve(4)}`,
|
|
549
|
-
name: "",
|
|
550
|
-
rule: null,
|
|
551
|
-
skuRefs: ((o = k.modelValue) == null ? void 0 : o.defaultSkuRefs) ?? []
|
|
552
|
-
};
|
|
553
|
-
},
|
|
554
|
-
id: function(o) {
|
|
555
|
-
return o._id;
|
|
556
|
-
}
|
|
557
|
-
}), t = ge({
|
|
558
|
-
get disabled() {
|
|
559
|
-
return k.disabled;
|
|
560
|
-
},
|
|
561
|
-
get skuRefs() {
|
|
562
|
-
return i.defaultSkuRefs ?? [];
|
|
563
|
-
},
|
|
564
|
-
set skuRefs(o) {
|
|
565
|
-
i.defaultSkuRefs = o;
|
|
566
|
-
const y = o.map((r) => r._id), u = i.rules;
|
|
567
|
-
if (!u) return;
|
|
568
|
-
const m = o.groupBy(
|
|
569
|
-
(r) => r._id,
|
|
570
|
-
(r) => r.trackingMeasurement
|
|
571
|
-
);
|
|
572
|
-
for (const r of u) {
|
|
573
|
-
const g = r.skuRefs.filter((x) => y.includes(x._id)), I = o.filter(
|
|
574
|
-
(x) => !g.some((w) => w._id === x._id)
|
|
575
|
-
);
|
|
576
|
-
r.skuRefs = [...g, ...I].map((x) => {
|
|
577
|
-
var w;
|
|
578
|
-
return {
|
|
579
|
-
...x,
|
|
580
|
-
trackingMeasurement: ((w = m.get(x._id)) == null ? void 0 : w[0]) ?? null
|
|
581
|
-
};
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
i.rules = [...u];
|
|
585
|
-
},
|
|
586
|
-
isDefaultList: !0
|
|
587
|
-
}), n = C();
|
|
588
|
-
return _({
|
|
589
|
-
validateInputs: () => {
|
|
590
|
-
var o;
|
|
591
|
-
return (o = n.value) == null ? void 0 : o.validateInputs();
|
|
592
|
-
},
|
|
593
|
-
resetInputsValidation: () => {
|
|
594
|
-
var o;
|
|
595
|
-
return (o = n.value) == null ? void 0 : o.resetInputsValidation();
|
|
596
|
-
},
|
|
597
|
-
resetInputs: () => {
|
|
598
|
-
var o;
|
|
599
|
-
return (o = n.value) == null ? void 0 : o.resetInputs();
|
|
600
|
-
}
|
|
601
|
-
}), (o, y) => {
|
|
602
|
-
const u = R("FmTextField"), m = R("FmButton"), r = R("FmFormGroup"), g = R("FmTable"), I = R("FmCard"), x = R("FmForm");
|
|
603
|
-
return G(), U(x, {
|
|
604
|
-
onValidationSuccess: y[2] || (y[2] = (w) => v("validation-success")),
|
|
605
|
-
ref_key: "formRef",
|
|
606
|
-
ref: n,
|
|
607
|
-
class: "flex flex-col gap-64"
|
|
608
|
-
}, {
|
|
609
|
-
default: M(() => {
|
|
610
|
-
var w;
|
|
611
|
-
return [
|
|
612
|
-
c("div", st, [
|
|
613
|
-
b(u, {
|
|
614
|
-
label: l(e)("inventory.ingredientGroup.form.name"),
|
|
615
|
-
"label-mark": "required",
|
|
616
|
-
rules: [l(pe)()],
|
|
617
|
-
modelValue: l(i).name,
|
|
618
|
-
"onUpdate:modelValue": y[0] || (y[0] = (d) => l(i).name = d)
|
|
619
|
-
}, null, 8, ["label", "rules", "modelValue"]),
|
|
620
|
-
b(u, {
|
|
621
|
-
label: l(e)("inventory.ingredientGroup.form.ref"),
|
|
622
|
-
"label-mark": "optional",
|
|
623
|
-
modelValue: l(i).ref,
|
|
624
|
-
"onUpdate:modelValue": y[1] || (y[1] = (d) => l(i).ref = d)
|
|
625
|
-
}, null, 8, ["label", "modelValue"])
|
|
626
|
-
]),
|
|
627
|
-
c("div", at, [
|
|
628
|
-
c("div", lt, [
|
|
629
|
-
c("div", it, [
|
|
630
|
-
c("div", rt, [
|
|
631
|
-
c("div", ut, [
|
|
632
|
-
c("div", dt, E(l(e)("inventory.ingredientGroup.form.defaultRule.title")), 1)
|
|
633
|
-
])
|
|
634
|
-
]),
|
|
635
|
-
c("div", null, [
|
|
636
|
-
b(m, {
|
|
637
|
-
disabled: o.disabled,
|
|
638
|
-
label: "Add ingredient",
|
|
639
|
-
"prepend-icon": "link",
|
|
640
|
-
variant: "plain",
|
|
641
|
-
class: "border-1 rounded-lg border-fm-color-primary",
|
|
642
|
-
onClick: l(t).promptAddIngredient,
|
|
643
|
-
size: "md"
|
|
644
|
-
}, null, 8, ["disabled", "onClick"])
|
|
645
|
-
])
|
|
646
|
-
]),
|
|
647
|
-
b(r, {
|
|
648
|
-
"model-value": l(i).defaultSkuRefs,
|
|
649
|
-
rules: [
|
|
650
|
-
(d) => !!(d != null && d.length) || "At least one ingredient is required"
|
|
651
|
-
]
|
|
652
|
-
}, null, 8, ["model-value", "rules"])
|
|
653
|
-
]),
|
|
654
|
-
c("div", null, [
|
|
655
|
-
b(g, {
|
|
656
|
-
"row-data": l(i).defaultSkuRefs ?? [],
|
|
657
|
-
"column-defs": l(t).columnDefs,
|
|
658
|
-
"column-visibility": l(t).columnVisibility,
|
|
659
|
-
"page-size": (w = l(i).defaultSkuRefs) == null ? void 0 : w.length,
|
|
660
|
-
"shrink-at": 9999,
|
|
661
|
-
"hide-footer": ""
|
|
662
|
-
}, null, 8, ["row-data", "column-defs", "column-visibility", "page-size"])
|
|
663
|
-
]),
|
|
664
|
-
c("div", ct, E(l(e)("inventory.ingredientGroup.form.defaultRule.defaultCheckbox")), 1)
|
|
665
|
-
]),
|
|
666
|
-
c("div", mt, [
|
|
667
|
-
c("div", ft, [
|
|
668
|
-
c("div", pt, E(l(e)("inventory.ingredientGroup.form.rules.title")), 1),
|
|
669
|
-
c("div", vt, E(l(e)("inventory.ingredientGroup.form.rules.description")), 1)
|
|
670
|
-
]),
|
|
671
|
-
(G(!0), z(_e, null, be(l(i).rules, (d, f) => (G(), U(I, {
|
|
672
|
-
key: d.id,
|
|
673
|
-
variant: "outlined",
|
|
674
|
-
class: "p-16"
|
|
675
|
-
}, {
|
|
676
|
-
default: M(() => [
|
|
677
|
-
c("div", gt, [
|
|
678
|
-
c("div", yt, [
|
|
679
|
-
c("div", _t, [
|
|
680
|
-
ke(E(l(e)("inventory.ingredientGroup.form.rules.rule_N", [f + 1])), 1),
|
|
681
|
-
d.name ? (G(), z("span", bt, ": ")) : le("", !0),
|
|
682
|
-
d.name ? (G(), z("span", kt, E(d.name), 1)) : le("", !0)
|
|
683
|
-
]),
|
|
684
|
-
b(m, {
|
|
685
|
-
variant: "tertiary",
|
|
686
|
-
icon: "delete",
|
|
687
|
-
onClick: (h) => l(a).removeItem(d)
|
|
688
|
-
}, null, 8, ["onClick"])
|
|
689
|
-
]),
|
|
690
|
-
c("div", null, [
|
|
691
|
-
(G(), U(ot, {
|
|
692
|
-
key: d._id,
|
|
693
|
-
"model-value": d,
|
|
694
|
-
"onUpdate:modelValue": l(a).updateItem,
|
|
695
|
-
disabled: o.disabled,
|
|
696
|
-
menu: o.menu
|
|
697
|
-
}, null, 8, ["model-value", "onUpdate:modelValue", "disabled", "menu"]))
|
|
698
|
-
])
|
|
699
|
-
])
|
|
700
|
-
]),
|
|
701
|
-
_: 2
|
|
702
|
-
}, 1024))), 128)),
|
|
703
|
-
c("div", null, [
|
|
704
|
-
b(m, {
|
|
705
|
-
variant: "plain",
|
|
706
|
-
icon: "add",
|
|
707
|
-
label: l(e)("inventory.ingredientGroup.form.rules.addRule"),
|
|
708
|
-
onClick: l(a).addItem
|
|
709
|
-
}, null, 8, ["label", "onClick"])
|
|
710
|
-
])
|
|
711
|
-
])
|
|
712
|
-
];
|
|
713
|
-
}),
|
|
714
|
-
_: 1
|
|
715
|
-
}, 512);
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
}), ht = {
|
|
719
|
-
key: 0,
|
|
720
|
-
class: "text-fm-color-typo-primary fm-typo-en-body-lg-400"
|
|
721
|
-
}, wt = { class: "flex gap-4" }, Rt = /* @__PURE__ */ W({
|
|
722
|
-
__name: "IngredientGroupDialog",
|
|
723
|
-
props: {
|
|
724
|
-
show: { type: Boolean },
|
|
725
|
-
mode: { default: S.READ },
|
|
726
|
-
modelValue: {}
|
|
727
|
-
},
|
|
728
|
-
emits: ["update:show"],
|
|
729
|
-
setup(s) {
|
|
730
|
-
const _ = s, p = O(), k = Ke(() => p.readCachedMenu()), i = F(
|
|
731
|
-
() => k.result.value.state === je.success ? k.result.value.data : void 0
|
|
732
|
-
), v = Q(), { t: e } = q(), a = Ce(_, "show");
|
|
733
|
-
function t() {
|
|
734
|
-
return {
|
|
735
|
-
_id: "",
|
|
736
|
-
name: "",
|
|
737
|
-
rules: []
|
|
738
|
-
};
|
|
739
|
-
}
|
|
740
|
-
const n = C(t()), o = C(`${Math.random()}`);
|
|
741
|
-
ce(
|
|
742
|
-
() => _.show,
|
|
743
|
-
(d) => {
|
|
744
|
-
if (!d) return;
|
|
745
|
-
let f = N(_.modelValue ?? t());
|
|
746
|
-
f.defaultSkuRefs && (f.defaultSkuRefs = f.defaultSkuRefs.map((h, $) => ({
|
|
747
|
-
...h,
|
|
748
|
-
priority: h.priority ?? $ + 1
|
|
749
|
-
})));
|
|
750
|
-
for (let h = 0; f.rules && h < f.rules.length; h++) {
|
|
751
|
-
const $ = f.rules[h];
|
|
752
|
-
$.skuRefs = $.skuRefs.map((D, Y) => ({
|
|
753
|
-
...D,
|
|
754
|
-
priority: D.priority ?? Y + 1
|
|
755
|
-
}));
|
|
756
|
-
}
|
|
757
|
-
n.value = f, o.value = f._id || `${Math.random()}`;
|
|
758
|
-
}
|
|
759
|
-
);
|
|
760
|
-
const y = F(() => {
|
|
761
|
-
switch (_.mode) {
|
|
762
|
-
case S.READ:
|
|
763
|
-
return "";
|
|
764
|
-
case S.UPDATE:
|
|
765
|
-
return e("inventory.ingredientGroup.update.title");
|
|
766
|
-
case S.CREATE:
|
|
767
|
-
return e("inventory.ingredientGroup.create.title");
|
|
768
|
-
}
|
|
769
|
-
return "";
|
|
770
|
-
}), u = F(() => {
|
|
771
|
-
switch (_.mode) {
|
|
772
|
-
case S.READ:
|
|
773
|
-
return "";
|
|
774
|
-
case S.UPDATE:
|
|
775
|
-
return e("common.save");
|
|
776
|
-
case S.CREATE:
|
|
777
|
-
return e("common.add");
|
|
778
|
-
}
|
|
779
|
-
return "";
|
|
780
|
-
}), m = C(), r = C(!1);
|
|
781
|
-
async function g() {
|
|
782
|
-
r.value = !0;
|
|
783
|
-
const d = N(n.value);
|
|
784
|
-
try {
|
|
785
|
-
await p.createSkuGroup(d), a.value = !1, v.open({
|
|
786
|
-
title: e("inventory.common.success"),
|
|
787
|
-
message: e("inventory.ingredientGroup.create.success", { name: d.name }),
|
|
788
|
-
type: "success"
|
|
789
|
-
});
|
|
790
|
-
} catch (f) {
|
|
791
|
-
f instanceof ie || v.open({
|
|
792
|
-
title: e("inventory.ingredientGroup.create.error.title"),
|
|
793
|
-
message: e("inventory.ingredientGroup.create.error.message"),
|
|
794
|
-
type: "error"
|
|
795
|
-
});
|
|
796
|
-
} finally {
|
|
797
|
-
r.value = !1;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
|
-
async function I() {
|
|
801
|
-
r.value = !0;
|
|
802
|
-
const d = N(n.value);
|
|
803
|
-
try {
|
|
804
|
-
await p.updateSkuGroup(d), r.value = !1, a.value = !1, v.open({
|
|
805
|
-
title: e("inventory.common.success"),
|
|
806
|
-
message: e("inventory.ingredientGroup.update.success", { name: d.name }),
|
|
807
|
-
type: "success"
|
|
808
|
-
});
|
|
809
|
-
} catch (f) {
|
|
810
|
-
f instanceof ie || v.open({
|
|
811
|
-
title: e("inventory.ingredientGroup.update.error.title"),
|
|
812
|
-
message: e("inventory.ingredientGroup.update.error.message"),
|
|
813
|
-
type: "error"
|
|
814
|
-
});
|
|
815
|
-
} finally {
|
|
816
|
-
r.value = !1;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
function x() {
|
|
820
|
-
var d, f;
|
|
821
|
-
(f = (d = m.value) == null ? void 0 : d.validateInputs) == null || f.call(d);
|
|
822
|
-
}
|
|
823
|
-
function w() {
|
|
824
|
-
switch (_.mode) {
|
|
825
|
-
case S.READ:
|
|
826
|
-
return;
|
|
827
|
-
case S.UPDATE:
|
|
828
|
-
return I();
|
|
829
|
-
case S.CREATE:
|
|
830
|
-
return g();
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
return (d, f) => {
|
|
834
|
-
const h = R("FmButton"), $ = R("FmSideSheet");
|
|
835
|
-
return G(), U($, {
|
|
836
|
-
"model-value": l(a),
|
|
837
|
-
"onUpdate:modelValue": f[3] || (f[3] = (D) => xe(a) ? a.value = D : null),
|
|
838
|
-
header: y.value,
|
|
839
|
-
"close-button": "",
|
|
840
|
-
"dismiss-away": "",
|
|
841
|
-
"max-width": 800
|
|
842
|
-
}, {
|
|
843
|
-
"side-sheet-footer": M(() => [
|
|
844
|
-
c("div", wt, [
|
|
845
|
-
b(h, {
|
|
846
|
-
loading: r.value,
|
|
847
|
-
label: u.value,
|
|
848
|
-
onClick: x
|
|
849
|
-
}, null, 8, ["loading", "label"]),
|
|
850
|
-
b(h, {
|
|
851
|
-
disabled: r.value,
|
|
852
|
-
label: l(e)("common.close"),
|
|
853
|
-
variant: "tertiary",
|
|
854
|
-
onClick: f[2] || (f[2] = (D) => a.value = !1)
|
|
855
|
-
}, null, 8, ["disabled", "label"])
|
|
856
|
-
])
|
|
857
|
-
]),
|
|
858
|
-
default: M(() => [
|
|
859
|
-
i.value ? (G(), U(xt, {
|
|
860
|
-
menu: i.value,
|
|
861
|
-
class: "w-full",
|
|
862
|
-
ref_key: "hasValidationExpose",
|
|
863
|
-
ref: m,
|
|
864
|
-
key: o.value,
|
|
865
|
-
"model-value": n.value,
|
|
866
|
-
"onUpdate:modelValue": f[0] || (f[0] = (D) => n.value = D),
|
|
867
|
-
mode: d.mode,
|
|
868
|
-
disabled: r.value,
|
|
869
|
-
onValidationSuccess: f[1] || (f[1] = (D) => w())
|
|
870
|
-
}, null, 8, ["menu", "model-value", "mode", "disabled"])) : (G(), z("div", ht, "Loading.."))
|
|
871
|
-
]),
|
|
872
|
-
_: 1
|
|
873
|
-
}, 8, ["model-value", "header"]);
|
|
874
|
-
};
|
|
875
|
-
}
|
|
876
|
-
}), It = { class: "flex flex-col py-8" }, St = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, jt = /* @__PURE__ */ W({
|
|
877
|
-
__name: "IngredientGroupView",
|
|
878
|
-
setup(s) {
|
|
879
|
-
const _ = O(), p = F(() => _.skuGroups), k = Fe(), { t: i } = q(), {
|
|
880
|
-
createIngredientGroup: v,
|
|
881
|
-
updateIngredientGroup: e,
|
|
882
|
-
importIngredientGroups: a,
|
|
883
|
-
exportIngredientGroups: t
|
|
884
|
-
} = J(), { columnDefs: n, loading: o } = re(We()), { ingredientGroupDialogProps: y } = re(J()), u = C(!1);
|
|
885
|
-
let m;
|
|
886
|
-
function r(A) {
|
|
887
|
-
m = A, u.value = !0;
|
|
888
|
-
}
|
|
889
|
-
function g() {
|
|
890
|
-
const A = m;
|
|
891
|
-
m = void 0, A == null || A();
|
|
892
|
-
}
|
|
893
|
-
function I(A) {
|
|
894
|
-
switch (A) {
|
|
895
|
-
case "add":
|
|
896
|
-
return r(() => v());
|
|
897
|
-
case "import":
|
|
898
|
-
return r(() => a());
|
|
899
|
-
case "export":
|
|
900
|
-
return r(() => t());
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
const x = C(""), w = C(!1), d = F(() => w.value || o.value), { breakpoints: f } = De(), h = F(() => f.value.xs || f.value.sm), $ = F(() => h.value ? 10 : 20), D = Te(), Y = F(() => [
|
|
904
|
-
{
|
|
905
|
-
label: i("inventory.ingredient.create.title"),
|
|
906
|
-
value: "add",
|
|
907
|
-
isPrimary: !0,
|
|
908
|
-
prependIcon: "add"
|
|
909
|
-
},
|
|
910
|
-
{ label: i("common.import"), value: "import" },
|
|
911
|
-
{ label: i("common.export"), value: "export" }
|
|
912
|
-
]);
|
|
913
|
-
return (A, T) => {
|
|
914
|
-
const ye = R("FmTable");
|
|
915
|
-
return G(), U(Ee, {
|
|
916
|
-
title: l(i)("inventory.ingredientGroup.title"),
|
|
917
|
-
actions: Y.value,
|
|
918
|
-
"onClick:action": I
|
|
919
|
-
}, {
|
|
920
|
-
default: M(() => [
|
|
921
|
-
c("div", {
|
|
922
|
-
class: he([
|
|
923
|
-
"flex flex-col gap-8 max-h-full",
|
|
924
|
-
{
|
|
925
|
-
"p-0": h.value,
|
|
926
|
-
"px-24 ": !h.value
|
|
927
|
-
}
|
|
928
|
-
])
|
|
929
|
-
}, [
|
|
930
|
-
b(Pe, {
|
|
931
|
-
searchable: "",
|
|
932
|
-
search: x.value,
|
|
933
|
-
"onUpdate:search": T[0] || (T[0] = (P) => x.value = P)
|
|
934
|
-
}, null, 8, ["search"]),
|
|
935
|
-
b(ye, {
|
|
936
|
-
style: we(l(D).tableHeight),
|
|
937
|
-
"column-defs": l(n),
|
|
938
|
-
"row-data": p.value,
|
|
939
|
-
"search-value": x.value,
|
|
940
|
-
loading: !l(k)._currentLocation || d.value,
|
|
941
|
-
"loading-text": l(i)("inventory.common.loading"),
|
|
942
|
-
onRowClick: T[2] || (T[2] = (P) => r(() => l(e)(P.original))),
|
|
943
|
-
"page-size": $.value
|
|
944
|
-
}, {
|
|
945
|
-
"list-row": M((P) => [
|
|
946
|
-
b(Me, {
|
|
947
|
-
row: P,
|
|
948
|
-
onRowClick: T[1] || (T[1] = (B) => r(() => l(e)(B)))
|
|
949
|
-
}, Re({
|
|
950
|
-
default: M((B) => {
|
|
951
|
-
var X, Z, ee, K, te, ne, oe, se, j, ae;
|
|
952
|
-
return [
|
|
953
|
-
c("div", It, [
|
|
954
|
-
c("div", St, [
|
|
955
|
-
b(l(de), {
|
|
956
|
-
render: (ee = (Z = (X = B.code) == null ? void 0 : X.column) == null ? void 0 : Z.columnDef) == null ? void 0 : ee.cell,
|
|
957
|
-
props: (te = (K = B.code) == null ? void 0 : K.getContext) == null ? void 0 : te.call(K)
|
|
958
|
-
}, null, 8, ["render", "props"])
|
|
959
|
-
]),
|
|
960
|
-
c("div", Gt, [
|
|
961
|
-
b(l(de), {
|
|
962
|
-
render: (se = (oe = (ne = B.name) == null ? void 0 : ne.column) == null ? void 0 : oe.columnDef) == null ? void 0 : se.cell,
|
|
963
|
-
props: (ae = (j = B.name) == null ? void 0 : j.getContext) == null ? void 0 : ae.call(j)
|
|
964
|
-
}, null, 8, ["render", "props"])
|
|
965
|
-
])
|
|
966
|
-
])
|
|
967
|
-
];
|
|
968
|
-
}),
|
|
969
|
-
_: 2
|
|
970
|
-
}, [
|
|
971
|
-
w.value ? {
|
|
972
|
-
name: "loading-text",
|
|
973
|
-
fn: M(() => [
|
|
974
|
-
c("div", null, E(l(i)("inventory.ingredient.table.importing")), 1)
|
|
975
|
-
]),
|
|
976
|
-
key: "0"
|
|
977
|
-
} : void 0
|
|
978
|
-
]), 1032, ["row"])
|
|
979
|
-
]),
|
|
980
|
-
_: 1
|
|
981
|
-
}, 8, ["style", "column-defs", "row-data", "search-value", "loading", "loading-text", "page-size"])
|
|
982
|
-
], 2),
|
|
983
|
-
(G(), U(Ie, { to: "body" }, [
|
|
984
|
-
b(Rt, Se(Ge(l(y))), null, 16),
|
|
985
|
-
b(He, {
|
|
986
|
-
modelValue: u.value,
|
|
987
|
-
"onUpdate:modelValue": T[3] || (T[3] = (P) => u.value = P),
|
|
988
|
-
"feature-name": "Ingredient Group",
|
|
989
|
-
onProceed: g
|
|
990
|
-
}, null, 8, ["modelValue"])
|
|
991
|
-
]))
|
|
992
|
-
]),
|
|
993
|
-
_: 1
|
|
994
|
-
}, 8, ["title", "actions"]);
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
});
|
|
998
|
-
export {
|
|
999
|
-
jt as default
|
|
1000
|
-
};
|