@feedmepos/mf-inventory-portal 1.7.9-dev.1 → 1.7.9

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.
Files changed (117) hide show
  1. package/dist/App-wSwzHKiz.js +311 -0
  2. package/dist/{ApprovalView-DpkYimTU.js → ApprovalView-DRT6Qd2e.js} +9 -9
  3. package/dist/{BindingsDialog-9MteMW5_.js → BindingsDialog-CdAUadBI.js} +2 -2
  4. package/dist/{BindingsPicker-C3R1Iaci.js → BindingsPicker-BN_wX0N8.js} +2 -2
  5. package/dist/{BindingsTable-yWS4vjmz.js → BindingsTable-CK6m-C2K.js} +4 -4
  6. package/dist/BulkReceiveRequestView-BXs22T-g.js +2584 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-DrehE0r3.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CFX666Wz.js} +1 -1
  8. package/dist/{ClosingDraftView-BO0eUpk7.js → ClosingDraftView-IffpT50J.js} +19 -19
  9. package/dist/{ClosingHistoryView-1Gu4B0qB.js → ClosingHistoryView-DrI5Qo6C.js} +5 -5
  10. package/dist/{ClosingTemplateView-CvAn5afN.js → ClosingTemplateView-DilRh_vH.js} +16 -16
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-CwWbC1oH.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-Dzaimy8_.js} +1 -1
  12. package/dist/{DefaultView-DeXxhLsq.js → DefaultView-DAud5FWQ.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-Bilzn1WS.js → DeliveryOrderPrintPreview-V-x1xvBl.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-C5xp1ceO.js → EmailDialog.vue_vue_type_script_setup_true_lang-KUJLmR7a.js} +5067 -5072
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DL5i2-tq.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BStqqCMn.js} +6 -6
  16. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Bq36-nnH.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BnHM1BX1.js} +2 -2
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D2l0nTi_.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BPyrxPpe.js} +2 -2
  18. package/dist/{FmMultiselectDialog-COp24wS3.js → FmMultiselectDialog-BniqAG4j.js} +1 -1
  19. package/dist/{FmMultiselectDialog-CKQ1eFVZ.js → FmMultiselectDialog-C2PspPWe.js} +2 -2
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CN4ENCPZ.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Bf3SW_Cs.js} +6 -6
  21. package/dist/{ImportView-CB3qjhvy.js → ImportView-DWRmu0QT.js} +6 -6
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CBxUyjH8.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-DY0kkryN.js} +1 -1
  23. package/dist/{IngredientGroupView-DuY6Gw5V.js → IngredientGroupView-C6VVdwdq.js} +5 -5
  24. package/dist/{IngredientsView-DxzyJE_h.js → IngredientsView-DuEBYiLy.js} +17 -18
  25. package/dist/{IntegrationExplorerView-Ma59NTHM.js → IntegrationExplorerView-DJh7dTAl.js} +4 -4
  26. package/dist/{IntegrationView-SBMEO_e9.js → IntegrationView-DsH2Hs1K.js} +925 -912
  27. package/dist/{InventoryBindingForm-CBFJRVNH.js → InventoryBindingForm-BACENuFH.js} +1 -1
  28. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-BlxNT4bV.js +441 -0
  29. package/dist/{InventoryBindingSummary-c5g-35nq.js → InventoryBindingSummary-BncS50eD.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DEtNW2wJ.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-LzXw3Flm.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-BInLhmxe.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dra4APix.js} +1 -1
  32. package/dist/{ProductionView-BlhsrkXW.js → ProductionView-CJ6Oi2ae.js} +7 -7
  33. package/dist/{PublishView-bMEZSiVN.js → PublishView-30yz5vFX.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-HvIFszQX.js → PurchaseOrderPrintPreview-CclxLcCT.js} +2 -2
  35. package/dist/{ReceiveRequestView-jwXYj2Wy.js → ReceiveRequestView-DIQeDhuy.js} +14 -14
  36. package/dist/RecipeView-D8DyqwP-.js +3584 -0
  37. package/dist/{SettingsView-BqELMK6p.js → SettingsView-Bfp1K782.js} +4 -4
  38. package/dist/{StockView-6xDfuSnV.js → StockView-BNqzu1Rt.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-CBUZIEA5.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DFI2fuD0.js} +1 -1
  40. package/dist/{SupplierView-BwMl9JFO.js → SupplierView-Bnw_eUE1.js} +12 -12
  41. package/dist/{SurchargeView-AGXGqhxy.js → SurchargeView-B0VoAU4k.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DQSq3UGp.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-Cymvi3zl.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BBUG8N2w.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DBQx6RAo.js} +1 -1
  44. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BMrGsD-f.js → TransferDetails.vue_vue_type_script_setup_true_lang-BMpUm52g.js} +20 -20
  45. package/dist/{TransferTemplateView-DJYXlxpw.js → TransferTemplateView-BjfxrwzR.js} +20 -20
  46. package/dist/{UnitCostHistoryView-DRgWgXhB.js → UnitCostHistoryView-C3ffDyKS.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-CR8a6DkX.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-VG2ecWER.js} +4 -4
  48. package/dist/{UnitView-mWUCF13E.js → UnitView-BaR_a9Kw.js} +8 -8
  49. package/dist/{WarehouseView-DY4_bxzS.js → WarehouseView-RQjCcteZ.js} +5 -5
  50. package/dist/{WastageTemplateView-D4YFC_zj.js → WastageTemplateView-D4z8zpwb.js} +14 -14
  51. package/dist/api/codemax.d.ts +5 -1
  52. package/dist/api/purchase-order.d.ts +0 -2
  53. package/dist/{app-DCSH6Br7.js → app-CyTU8N3H.js} +18885 -19657
  54. package/dist/app.d.ts +9 -888
  55. package/dist/app.js +1 -1
  56. package/dist/{closing-template-knrmn7Jq.js → closing-template-B2tB7sQC.js} +1 -1
  57. package/dist/{date2-m9Qq52B4.js → date2-DQH6DhKn.js} +5 -5
  58. package/dist/{dayjs.min-BX2fRC46.js → dayjs.min-BOciSc8b.js} +1 -1
  59. package/dist/{decimal-pgdYbjfw.js → decimal-yQvd_IOl.js} +2 -2
  60. package/dist/{defineDeepModel-C5kt7Waa.js → defineDeepModel-DXNMJH2I.js} +1 -1
  61. package/dist/{duplicate-template-B74iiBzz.js → duplicate-template-DO7WYSTm.js} +1 -1
  62. package/dist/{feature-CfkazbcV.js → feature-v0qFoj-w.js} +2 -2
  63. package/dist/{format-time-from-id-C1AIz8rq.js → format-time-from-id-BuBtGQBF.js} +1 -1
  64. package/dist/{format-unit-display-A-G-IaSa.js → format-unit-display-sljdJGi2.js} +27 -27
  65. package/dist/{import-export.helper-Dx6UODpr.js → import-export.helper-B72QRGIw.js} +6 -6
  66. package/dist/{index-uk9CA-G3.js → index-BCGkKprE.js} +33 -27
  67. package/dist/{index-DjKTLy_K.js → index-CU4Kuswf.js} +1 -1
  68. package/dist/{index-CiQiwzTH.js → index-TQcHaMrv.js} +3232 -3306
  69. package/dist/{inventory-core-dart.default-CMAgxo1z.js → inventory-core-dart.default-BgoK1eTS.js} +1 -1
  70. package/dist/{lz-string-DZI7eVks.js → lz-string-BjdS2wyT.js} +1 -1
  71. package/dist/{netsuite-CoajVOCj.js → netsuite-z7vVdCsZ.js} +2 -2
  72. package/dist/{number-qzibfxtV.js → number-CPj4E2k6.js} +3 -3
  73. package/dist/{predefined-templates-Bi2KN0S0.js → predefined-templates-Bhig3JBF.js} +1 -1
  74. package/dist/{purchase-order-template-q60hgvfd.js → purchase-order-template-CNDfnM86.js} +1 -1
  75. package/dist/{recalculationUtils-ThdsSQXA.js → recalculationUtils-CQNmwxc2.js} +1 -1
  76. package/dist/{rules-DkRl1mdI.js → rules-9N5HIcET.js} +2 -2
  77. package/dist/{stock-CDBl371n.js → stock-B7QJYZif.js} +3 -3
  78. package/dist/{stock-CfGnNgNm.js → stock-uZA1to9T.js} +1 -1
  79. package/dist/stores/bulk-job.d.ts +0 -13
  80. package/dist/style.css +1 -1
  81. package/dist/{supplier-m95t74cw.js → supplier-B8DQBfvr.js} +2 -2
  82. package/dist/{surcharge-D0KNDUtM.js → surcharge-DHf5QM_k.js} +8 -8
  83. package/dist/tsconfig.app.tsbuildinfo +1 -1
  84. package/dist/{uom-rules-DoC_viYg.js → uom-rules-IHu3f_dQ.js} +1 -1
  85. package/dist/{use-ingredient-select-dialog-DUDA6jkc.js → use-ingredient-select-dialog-Cd3IeQRi.js} +2 -2
  86. package/dist/{use-inventory-binding-dialog-DyZVwYRw.js → use-inventory-binding-dialog-BG0l9YPD.js} +2 -2
  87. package/dist/{use-template-enabled-locations-DU6ebPLW.js → use-template-enabled-locations-b39RUsFB.js} +2 -2
  88. package/dist/{use-transfer-locations-i4WVdQfZ.js → use-transfer-locations-BPzNKZEi.js} +2 -2
  89. package/dist/{useHrmPermission-D4dofQF9.js → useHrmPermission-BpoNpgJ-.js} +1 -1
  90. package/dist/{useNavigationMenu-BwZoEiX3.js → useNavigationMenu-CaG9YOud.js} +2 -2
  91. package/dist/{useSseClient-vOXEoq_d.js → useSseClient-B2KhM-LZ.js} +1 -1
  92. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -2
  93. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -2
  94. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -4
  95. package/dist/views/receive-request/components/email-dialog/EmailDialogProps.d.ts +9 -23
  96. package/dist/views/recipe/composables/use-recipe-table.d.ts +0 -11
  97. package/dist/{vue-i18n-CV9ieqUG.js → vue-i18n-DgJpgCMa.js} +501 -501
  98. package/dist/{xlsx.util-CfgV0r9W.js → xlsx.util-Bkd2A_If.js} +2 -2
  99. package/package.json +4 -4
  100. package/dist/App-DEdkuDaS.js +0 -1155
  101. package/dist/BulkReceiveRequestView-MYLE3mXl.js +0 -2646
  102. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-B-nEFGKA.js +0 -563
  103. package/dist/RecipeView-DKd5h85n.js +0 -3625
  104. package/dist/api/changelog.d.ts +0 -64
  105. package/dist/views/changelog/components/ChangelogDialog.vue.d.ts +0 -19
  106. package/dist/views/changelog/components/ChangelogFloatingButton.vue.d.ts +0 -2
  107. package/dist/views/changelog/components/ChangelogPanel.vue.d.ts +0 -18
  108. package/dist/views/changelog/composables/change-path.d.ts +0 -10
  109. package/dist/views/changelog/composables/commit-message.d.ts +0 -9
  110. package/dist/views/changelog/composables/commit-message.spec.d.ts +0 -1
  111. package/dist/views/changelog/composables/json-line-diff.d.ts +0 -10
  112. package/dist/views/changelog/composables/json-line-diff.spec.d.ts +0 -1
  113. package/dist/views/changelog/composables/use-changelog.d.ts +0 -36
  114. package/dist/views/ingredients/components/inventory-binding/RecipeBindingBreakdown.vue.d.ts +0 -25
  115. package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.d.ts +0 -34
  116. package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.spec.d.ts +0 -1
  117. package/dist/views/receive-request/components/email-dialog/EmailDialog.spec.d.ts +0 -1
@@ -1,563 +0,0 @@
1
- import { defineComponent as H, ref as ye, computed as w, resolveComponent as E, createElementBlock as u, createCommentVNode as x, openBlock as d, createElementVNode as n, createVNode as p, toDisplayString as c, unref as l, Fragment as G, renderList as T, normalizeStyle as fe, createTextVNode as ve, reactive as Y, withCtx as A, createBlock as S, nextTick as _e } from "vue";
2
- import { a as J, t as xe, v as be, F as ge } from "./app-DCSH6Br7.js";
3
- import { t as he, n as ke, f as Be, a as P, c as Ve } from "./number-qzibfxtV.js";
4
- import { u as Ie } from "./use-inventory-binding-dialog-DyZVwYRw.js";
5
- import { useI18n as Q } from "@feedmepos/mf-common";
6
- import { b as q, c as O } from "./rules-DkRl1mdI.js";
7
- import { _ as we, c as Fe, d as Ee } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-CN4ENCPZ.js";
8
- const N = { amount: 1, precision: 0 };
9
- function X(_, y) {
10
- return { amount: _.amount * y.amount, precision: _.precision + y.precision };
11
- }
12
- function Ue(_, y) {
13
- const a = Z(y), m = X(_, a);
14
- return ke(m.amount / 10 ** m.precision, m.precision);
15
- }
16
- function Z(_) {
17
- if (_.trim().length === 0) return N;
18
- const y = Number(_);
19
- return Number.isFinite(y) ? he(y, Be(y)) : N;
20
- }
21
- function ee(_, y, a = 0, m = /* @__PURE__ */ new Set(), U = N) {
22
- if (m.has(_)) return [];
23
- const k = new Set(m).add(_);
24
- return y.contentsOf(_).flatMap((b, s) => {
25
- const r = b.type === "RECIPE", f = X(b.amount ?? N, U), g = {
26
- key: `${a}-${s}-${b.id}`,
27
- name: y.bindingName(b),
28
- amount: f,
29
- unit: y.bindingUnit(b),
30
- depth: a,
31
- isRecipe: r
32
- };
33
- return r ? [g, ...ee(b.id, y, a + 1, k, f)] : [g];
34
- });
35
- }
36
- const Re = {
37
- key: 0,
38
- class: "flex flex-col pb-8 fm-typo-en-body-sm-400"
39
- }, Ce = {
40
- key: 0,
41
- class: "flex items-center gap-4 px-12 text-fm-color-typo-secondary"
42
- }, Ae = {
43
- key: 1,
44
- class: "flex flex-col text-fm-color-typo-secondary"
45
- }, Pe = { class: "flex-1 line-clamp-1" }, Ge = {
46
- key: 0,
47
- class: "text-fm-color-typo-disabled"
48
- }, $e = {
49
- key: 2,
50
- class: "flex gap-4 px-12 text-fm-color-system-warning-400"
51
- }, Se = /* @__PURE__ */ H({
52
- __name: "RecipeBindingBreakdown",
53
- props: {
54
- recipeId: {},
55
- multiplier: {}
56
- },
57
- setup(_) {
58
- const y = _, { t: a } = Q(), m = J(), U = {
59
- contentsOf: (r) => {
60
- var f;
61
- return ((f = m.recipeById[r]) == null ? void 0 : f.contains) ?? [];
62
- },
63
- bindingName: (r) => {
64
- var f, g, R;
65
- switch (r.type) {
66
- case "RECIPE":
67
- return ((f = m.recipeById[r.id]) == null ? void 0 : f.name) ?? r.id;
68
- case "SKU_GROUP":
69
- return ((g = m.skuGroupById[r.id]) == null ? void 0 : g.name) ?? r.id;
70
- default:
71
- return ((R = m.skuById[r.id]) == null ? void 0 : R.name) ?? r.id;
72
- }
73
- },
74
- // a binding measurement overrides the ingredient's base unit, same as deduction reads it
75
- bindingUnit: (r) => {
76
- var f, g;
77
- return r.type === "RECIPE" ? "" : ((f = r.measurement) == null ? void 0 : f.abbrev) ?? ((g = m.skuById[r.id]) == null ? void 0 : g.unit.abbrev) ?? "";
78
- }
79
- }, k = ye(!1), b = w(() => ee(y.recipeId, U)), s = w(() => Z(y.multiplier).precision > 0);
80
- return (r, f) => {
81
- const g = E("FmButton"), R = E("FmIcon");
82
- return b.value.length || s.value ? (d(), u("div", Re, [
83
- b.value.length ? (d(), u("div", Ce, [
84
- n("span", null, c(l(a)("inventory.inventoryBindings.itemsLinked", { count: b.value.length }, b.value.length)), 1),
85
- p(g, {
86
- type: "button",
87
- variant: "plain",
88
- icon: k.value ? "expand_less" : "expand_more",
89
- onClick: f[0] || (f[0] = (F) => k.value = !k.value)
90
- }, null, 8, ["icon"])
91
- ])) : x("", !0),
92
- k.value ? (d(), u("div", Ae, [
93
- (d(!0), u(G, null, T(b.value, (F) => (d(), u("div", {
94
- key: F.key,
95
- class: "flex gap-8 py-4 px-12",
96
- style: fe({ paddingLeft: `${12 + F.depth * 16}px` })
97
- }, [
98
- n("span", Pe, [
99
- ve(c(F.name) + " ", 1),
100
- F.isRecipe ? (d(), u("span", Ge, " (" + c(l(a)("inventory.inventoryBindings.recipe")) + ") ", 1)) : x("", !0)
101
- ]),
102
- n("span", null, c(l(Ue)(F.amount, r.multiplier)) + " " + c(F.unit), 1)
103
- ], 4))), 128))
104
- ])) : x("", !0),
105
- s.value ? (d(), u("div", $e, [
106
- p(R, {
107
- name: "warning",
108
- color: "system-warning-300",
109
- size: "sm"
110
- }),
111
- n("div", null, c(l(a)("inventory.inventoryBindings.precisionWarning")), 1)
112
- ])) : x("", !0)
113
- ])) : x("", !0);
114
- };
115
- }
116
- }), Te = { class: "flex flex-col gap-24" }, Ne = { class: "flex flex-col gap-16" }, Me = { class: "flex items-center" }, De = { class: "flex-1 fm-typo-en-title-sm-600" }, ze = { class: "flex flex-col" }, Oe = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, Ke = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Le = {
117
- class: "flex items-center",
118
- style: { "min-height": "48px" }
119
- }, je = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, We = { class: "line-clamp-1" }, Ye = { class: "w-[200px]" }, qe = {
120
- key: 0,
121
- class: "w-[52px]"
122
- }, He = {
123
- key: 0,
124
- class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-8"
125
- }, Je = {
126
- key: 0,
127
- class: "flex flex-col gap-16"
128
- }, Qe = { class: "flex items-center" }, Xe = { class: "flex-1 fm-typo-en-title-sm-600" }, Ze = { class: "flex flex-col" }, en = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, nn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, on = { class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100" }, tn = {
129
- key: 0,
130
- class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400"
131
- }, ln = {
132
- class: "flex items-center",
133
- style: { "min-height": "48px" }
134
- }, sn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, rn = { class: "flex flex-col" }, dn = { class: "w-[200px]" }, an = {
135
- key: 0,
136
- class: "w-[52px]"
137
- }, un = { class: "flex flex-col gap-16" }, cn = { class: "flex items-center" }, mn = { class: "flex-1 fm-typo-en-title-sm-600" }, pn = { class: "flex flex-col" }, yn = { class: "flex py-8 px-12 border-b border-fm-color-neutral-gray-200 bg-fm-color-neutral-gray-100 h-[44px] items-center" }, fn = { class: "flex-1 fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, vn = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary w-[150px] px-16" }, _n = {
138
- key: 0,
139
- class: "flex flex-col border-b border-fm-color-neutral-gray-100"
140
- }, xn = {
141
- class: "flex items-center w-full",
142
- style: { "min-height": "48px" }
143
- }, bn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12 text-fm-color-typo-secondary line-clamp-1" }, gn = {
144
- key: 0,
145
- class: "w-[52px]"
146
- }, hn = { class: "flex gap-4 text-fm-color-system-error-400 fm-typo-en-body-sm-400 px-12 pb-4" }, kn = {
147
- key: 1,
148
- class: "flex flex-col border-b border-fm-color-neutral-gray-100"
149
- }, Bn = {
150
- class: "flex items-center w-full",
151
- style: { "min-height": "48px" }
152
- }, Vn = { class: "flex-1 fm-typo-en-body-md-400 py-8 px-12" }, In = { class: "line-clamp-1 w-full" }, wn = { class: "w-[150px]" }, Fn = {
153
- key: 0,
154
- class: "w-[52px]"
155
- }, En = { class: "flex flex-col px-12 pb-4" }, Sn = /* @__PURE__ */ H({
156
- __name: "InventoryBindingForm",
157
- props: {
158
- id: {},
159
- modelValue: { default: () => [] },
160
- excludeBindingId: {},
161
- rules: { default: () => [] },
162
- iframeMode: { type: Boolean },
163
- disabled: { type: Boolean },
164
- readonly: { type: Boolean },
165
- enableIngredientGroup: { type: Boolean },
166
- allowRecipeDecimal: { type: Boolean }
167
- },
168
- emits: ["update:modelValue", "click:pick-inventory-bindings"],
169
- setup(_, { emit: y }) {
170
- const { t: a } = Q(), m = J(), U = w(() => m.recipeById), k = w(() => m.skuById), b = w(() => m.skuGroupById), s = _, r = y, f = w(() => xe({
171
- parentId: s.id,
172
- bindings: s.modelValue,
173
- recipes: m.recipes.map((i) => i._id === s.id ? {
174
- ...i,
175
- contains: s.modelValue
176
- } : i),
177
- skus: m.skus.map((i) => i._id === s.id ? {
178
- ...i,
179
- convert: {
180
- inventoryBindings: s.modelValue
181
- }
182
- } : i),
183
- skuGroups: m.skuGroups
184
- }).inventoryBindings.filter((i) => "error" in i && i.error).map((i) => i).filter((i) => i.reason === be.enum.circularDependency)), g = w(
185
- () => new Set(f.value.map((e) => {
186
- var t;
187
- return (t = e.bindingPaths[0]) == null ? void 0 : t.id;
188
- }))
189
- ), R = w(() => s.modelValue.filter((e) => e.type === "RECIPE")), F = { amount: 1, precision: 0 }, M = Y({});
190
- function D(e) {
191
- return M[e.id] ?? P(e.amount ?? F);
192
- }
193
- function ne(e, t) {
194
- M[e.id] = t, L(e.id, t, s.modelValue);
195
- }
196
- const { promptIngredientsBinding: oe, promptRecipesBinding: te, promptIngredientGroupsBinding: ie } = Ie();
197
- async function le() {
198
- if (s.iframeMode) {
199
- r("click:pick-inventory-bindings", "RECIPE");
200
- return;
201
- }
202
- te(
203
- s.modelValue,
204
- (e) => r("update:modelValue", e),
205
- s.id ? [s.id] : []
206
- );
207
- }
208
- const se = w(() => s.modelValue.filter((e) => e.type === "SKU_GROUP"));
209
- async function re() {
210
- ie(
211
- s.modelValue,
212
- (e) => r("update:modelValue", e),
213
- s.id ? [s.id] : []
214
- );
215
- }
216
- const K = w(() => s.modelValue.filter((e) => e.type === "SKU") ?? []);
217
- async function de() {
218
- if (s.iframeMode) {
219
- r("click:pick-inventory-bindings", "SKU");
220
- return;
221
- }
222
- oe(
223
- s.modelValue,
224
- (e) => r("update:modelValue", e),
225
- s.excludeBindingId,
226
- s.id ? [s.id] : []
227
- );
228
- }
229
- function L(e, t, i) {
230
- const v = +t;
231
- let I = i;
232
- t.length > 0 && isFinite(v) ? I = i.map((B) => (B.id !== e || (B.amount = Ve(v)), B)) : I = i.map((B) => (B.id !== e || (B.amount = { amount: 0, precision: 0 }), B)), r("update:modelValue", I);
233
- }
234
- function $(e, t) {
235
- delete M[e];
236
- const i = t.filter((v) => v.id !== e);
237
- r("update:modelValue", i);
238
- }
239
- function j(e) {
240
- var i, v;
241
- if (e.type !== ge.enum.SKU)
242
- throw new Error("Non-SKU binding does not have unit");
243
- if (!((i = k.value[e.id]) == null ? void 0 : i.unit))
244
- throw new Error(`Cannot find ingredient: ${e.id}`);
245
- return (v = k.value[e.id]) == null ? void 0 : v.unit;
246
- }
247
- function ae(e) {
248
- return !k.value[e.id];
249
- }
250
- function ue(e) {
251
- return { amount: e.amount, measurement: e.measurement };
252
- }
253
- function ce(e, t, i) {
254
- const v = i.map((I) => I.id !== e ? I : {
255
- ...I,
256
- amount: t.amount,
257
- measurement: t.measurement
258
- });
259
- r("update:modelValue", v);
260
- }
261
- const W = Y({});
262
- function me(e) {
263
- return W[e.id] ?? {
264
- modelValue: {
265
- amount: e.amount,
266
- measurement: e.measurement
267
- },
268
- amountAsString: P(e.amount)
269
- };
270
- }
271
- function pe(e, t) {
272
- _e(() => {
273
- W[e.id] = {
274
- modelValue: {
275
- amount: e.amount,
276
- measurement: e.measurement
277
- },
278
- amountAsString: t
279
- };
280
- });
281
- }
282
- return (e, t) => {
283
- const i = E("FmFormGroup"), v = E("FmButton"), I = E("FmTooltip"), B = E("FmTextField"), z = E("FmIcon");
284
- return d(), u("div", Te, [
285
- p(i, {
286
- disabled: e.disabled,
287
- "model-value": e.modelValue,
288
- rules: [
289
- ...e.rules,
290
- () => f.value.length ? "There is a binding error in your configuration" : !0
291
- ]
292
- }, {
293
- label: A(() => t[0] || (t[0] = [
294
- n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Define the inventory bindings for this recipe or ingredient. ", -1)
295
- ])),
296
- _: 1
297
- }, 8, ["disabled", "model-value", "rules"]),
298
- n("div", Ne, [
299
- n("div", Me, [
300
- n("div", De, c(l(a)("inventory.inventoryBindings.recipe")), 1),
301
- e.readonly ? x("", !0) : (d(), S(v, {
302
- key: 0,
303
- variant: "secondary",
304
- "text-color": "primary",
305
- "border-color": "primary",
306
- label: l(a)("inventory.inventoryBindings.linkRecipe"),
307
- "prepend-icon": "link",
308
- onClick: le
309
- }, null, 8, ["label"]))
310
- ]),
311
- n("div", ze, [
312
- n("div", Oe, [
313
- n("div", Ke, c(l(a)("inventory.inventoryBindings.recipe")), 1),
314
- t[1] || (t[1] = n("div", { class: "w-[200px]" }, null, -1)),
315
- t[2] || (t[2] = n("div", { class: "w-[52px]" }, null, -1))
316
- ]),
317
- (d(!0), u(G, null, T(R.value, (o) => {
318
- var C;
319
- return d(), u("div", {
320
- key: o.id,
321
- class: "flex flex-col w-full border-b border-fm-color-neutral-gray-100"
322
- }, [
323
- n("div", Le, [
324
- n("div", je, [
325
- p(I, {
326
- zIndex: 51,
327
- variant: "plain",
328
- placement: "top",
329
- content: (C = U.value[o.id]) == null ? void 0 : C.name
330
- }, {
331
- default: A(() => {
332
- var V;
333
- return [
334
- n("span", We, c((V = U.value[o.id]) == null ? void 0 : V.name), 1)
335
- ];
336
- }),
337
- _: 2
338
- }, 1032, ["content"])
339
- ]),
340
- n("div", Ye, [
341
- p(i, {
342
- disabled: e.disabled,
343
- modelValue: +D(o),
344
- rules: [l(q)(e.allowRecipeDecimal ? 5 : 0), l(O)(-1)]
345
- }, {
346
- default: A(({ invalid: V }) => [
347
- p(B, {
348
- class: "w-full",
349
- disabled: e.disabled,
350
- modelValue: D(o),
351
- "onUpdate:modelValue": (h) => ne(o, h),
352
- invalid: V
353
- }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"])
354
- ]),
355
- _: 2
356
- }, 1032, ["disabled", "modelValue", "rules"])
357
- ]),
358
- e.readonly ? x("", !0) : (d(), u("div", qe, [
359
- p(v, {
360
- disabled: e.disabled,
361
- type: "button",
362
- variant: "plain",
363
- icon: "delete",
364
- "icon-color": "#000000",
365
- onClick: (V) => $(o.id, e.modelValue)
366
- }, null, 8, ["disabled", "onClick"])
367
- ]))
368
- ]),
369
- p(Se, {
370
- "recipe-id": o.id,
371
- multiplier: D(o)
372
- }, null, 8, ["recipe-id", "multiplier"]),
373
- g.value.has(o.id) ? (d(), u("div", He, [
374
- p(z, {
375
- name: "error",
376
- color: "system-error-300",
377
- size: "sm"
378
- }),
379
- n("div", null, c(l(a)("inventory.inventoryBindings.circularError")), 1)
380
- ])) : x("", !0)
381
- ]);
382
- }), 128))
383
- ])
384
- ]),
385
- e.enableIngredientGroup ? (d(), u("div", Je, [
386
- n("div", Qe, [
387
- n("div", Xe, c(l(a)("inventory.inventoryBindings.ingredientGroup")), 1),
388
- e.readonly ? x("", !0) : (d(), S(v, {
389
- key: 0,
390
- variant: "secondary",
391
- "text-color": "primary",
392
- "border-color": "primary",
393
- label: l(a)("inventory.inventoryBindings.linkIngredientGroup"),
394
- "prepend-icon": "link",
395
- onClick: re
396
- }, null, 8, ["label"]))
397
- ]),
398
- n("div", Ze, [
399
- n("div", en, [
400
- n("div", nn, c(l(a)("inventory.inventoryBindings.ingredientGroup")), 1),
401
- t[3] || (t[3] = n("div", { class: "w-[200px]" }, null, -1)),
402
- t[4] || (t[4] = n("div", { class: "w-[52px]" }, null, -1))
403
- ]),
404
- (d(!0), u(G, null, T(se.value, (o) => (d(), S(i, {
405
- key: o.id,
406
- disabled: e.disabled,
407
- modelValue: +l(P)(o.amount ?? { amount: 1, precision: 0 }),
408
- rules: [l(q)(0), l(O)(0)]
409
- }, {
410
- default: A(({ invalid: C }) => {
411
- var V;
412
- return [
413
- n("div", on, [
414
- g.value.has(o.id) ? (d(), u("div", tn, [
415
- p(z, {
416
- name: "error",
417
- color: "system-error-300",
418
- size: "sm"
419
- }),
420
- n("div", null, c(l(a)("inventory.inventoryBindings.circularError")), 1)
421
- ])) : x("", !0),
422
- n("div", ln, [
423
- n("div", sn, [
424
- n("div", rn, c((V = b.value[o.id]) == null ? void 0 : V.name), 1)
425
- ]),
426
- n("div", dn, [
427
- p(B, {
428
- class: "w-full",
429
- disabled: e.disabled,
430
- modelValue: +l(P)(o.amount ?? { amount: 1, precision: 0 }),
431
- "onUpdate:modelValue": (h) => L(o.id, h, e.modelValue),
432
- invalid: C
433
- }, null, 8, ["disabled", "modelValue", "onUpdate:modelValue", "invalid"])
434
- ]),
435
- e.readonly ? x("", !0) : (d(), u("div", an, [
436
- p(v, {
437
- disabled: e.disabled,
438
- type: "button",
439
- variant: "plain",
440
- icon: "delete",
441
- "icon-color": "#000000",
442
- onClick: (h) => $(o.id, e.modelValue)
443
- }, null, 8, ["disabled", "onClick"])
444
- ]))
445
- ])
446
- ])
447
- ];
448
- }),
449
- _: 2
450
- }, 1032, ["disabled", "modelValue", "rules"]))), 128))
451
- ])
452
- ])) : x("", !0),
453
- n("div", un, [
454
- n("div", cn, [
455
- n("div", mn, c(l(a)("inventory.inventoryBindings.ingredient")), 1),
456
- e.readonly ? x("", !0) : (d(), S(v, {
457
- key: 0,
458
- variant: "secondary",
459
- "text-color": "primary",
460
- "border-color": "primary",
461
- label: l(a)("inventory.inventoryBindings.linkIngredient"),
462
- "prepend-icon": "link",
463
- onClick: de
464
- }, null, 8, ["label"]))
465
- ]),
466
- n("div", pn, [
467
- n("div", yn, [
468
- n("div", fn, c(l(a)("inventory.inventoryBindings.ingredient")), 1),
469
- n("div", vn, c(l(a)("inventory.inventoryBindings.amount")), 1),
470
- t[5] || (t[5] = n("div", { class: "w-[52px]" }, null, -1))
471
- ]),
472
- (d(!0), u(G, null, T(K.value, (o, C) => {
473
- var V;
474
- return d(), u(G, {
475
- key: o.id
476
- }, [
477
- ae(o) ? (d(), u("div", _n, [
478
- n("div", xn, [
479
- n("div", bn, c(o.id), 1),
480
- e.readonly ? x("", !0) : (d(), u("div", gn, [
481
- p(v, {
482
- disabled: e.disabled,
483
- type: "button",
484
- variant: "tertiary",
485
- icon: "delete",
486
- onClick: (h) => $(o.id, e.modelValue)
487
- }, null, 8, ["disabled", "onClick"])
488
- ]))
489
- ]),
490
- n("div", hn, [
491
- p(z, {
492
- name: "error",
493
- color: "system-error-300",
494
- size: "sm"
495
- }),
496
- n("div", null, c(l(a)("inventory.inventoryBindings.missingIngredient")), 1)
497
- ])
498
- ])) : (d(), u("div", kn, [
499
- n("div", Bn, [
500
- n("div", Vn, [
501
- p(I, {
502
- zIndex: 51,
503
- variant: "plain",
504
- placement: "top",
505
- content: (V = k.value[o.id]) == null ? void 0 : V.name
506
- }, {
507
- default: A(() => {
508
- var h;
509
- return [
510
- n("span", In, c((h = k.value[o.id]) == null ? void 0 : h.name), 1)
511
- ];
512
- }),
513
- _: 2
514
- }, 1032, ["content"])
515
- ]),
516
- n("div", wn, [
517
- p(we, {
518
- "model-value": ue(o),
519
- "onUpdate:modelValue": (h) => h && ce(o.id, h, e.modelValue),
520
- "onUpdate:amount": (h) => pe(o, h),
521
- unit: j(o),
522
- placement: C === K.value.length - 1 ? "top" : "bottom",
523
- "convert-amount-on-change-unit": "",
524
- disabled: e.readonly
525
- }, null, 8, ["model-value", "onUpdate:modelValue", "onUpdate:amount", "unit", "placement", "disabled"])
526
- ]),
527
- e.readonly ? x("", !0) : (d(), u("div", Fn, [
528
- p(v, {
529
- disabled: e.disabled,
530
- type: "button",
531
- variant: "tertiary",
532
- icon: "delete",
533
- onClick: (h) => $(o.id, e.modelValue)
534
- }, null, 8, ["disabled", "onClick"])
535
- ]))
536
- ]),
537
- n("div", En, [
538
- p(i, {
539
- modelValue: +l(P)(o.amount ?? { amount: 1, precision: 0 }),
540
- rules: [l(O)(0)]
541
- }, null, 8, ["modelValue", "rules"]),
542
- p(i, {
543
- modelValue: me(o),
544
- rules: [
545
- l(Fe)(),
546
- l(Ee)(j(o)),
547
- () => g.value.has(o.id) ? l(a)("inventory.inventoryBindings.invalidWarning") : !0
548
- ]
549
- }, null, 8, ["modelValue", "rules"])
550
- ])
551
- ]))
552
- ], 64);
553
- }), 128))
554
- ])
555
- ])
556
- ]);
557
- };
558
- }
559
- });
560
- export {
561
- Sn as _,
562
- Se as a
563
- };