@feedmepos/mf-inventory-portal 1.7.13-dev.4 → 1.7.14

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 (138) hide show
  1. package/dist/App-Blx6Ojzj.js +311 -0
  2. package/dist/{ApprovalView-DO91AQ5f.js → ApprovalView-BPDiAWh_.js} +9 -9
  3. package/dist/{BindingsDialog-DUj0z6N7.js → BindingsDialog-RUlhC05W.js} +2 -2
  4. package/dist/{BindingsPicker-CD2J6-_Z.js → BindingsPicker-voEXbc8p.js} +2 -2
  5. package/dist/{BindingsTable-B2FEKZXU.js → BindingsTable-QuFV3fHq.js} +4 -4
  6. package/dist/BulkReceiveRequestView-Bix6MV0Z.js +2595 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-ashHOuZt.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CSxFa-Hr.js} +2 -6
  8. package/dist/{ClosingDraftView-tIvrsfYH.js → ClosingDraftView-BUWt7ufW.js} +19 -19
  9. package/dist/ClosingHistoryView-BzQ7f_31.js +761 -0
  10. package/dist/{ClosingTemplateView-C-hL9uPv.js → ClosingTemplateView-BoDHKL2a.js} +16 -16
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BffF8S_q.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-B-t0N1PO.js} +1 -1
  12. package/dist/{DefaultView-BLbtx0Ho.js → DefaultView-CO4Fk0X3.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-BLQHL7aB.js → DeliveryOrderPrintPreview-Clslc2Wf.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-BnTAuutB.js → EmailDialog.vue_vue_type_script_setup_true_lang-BfQdw5-j.js} +2254 -2259
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Mxhn0b6c.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Brtj-hCD.js} +6 -6
  16. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-hrk0cTBX.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CHUQOFif.js} +2 -2
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-hTQmIyaf.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BqIWvN-i.js} +2 -2
  18. package/dist/{FmMultiselectDialog-Bpi5rI0h.js → FmMultiselectDialog-D7cnUmM5.js} +1 -1
  19. package/dist/{FmMultiselectDialog-Bi6XlAAU.js → FmMultiselectDialog-GAdb6F9O.js} +2 -2
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-e55tnl4u.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DAjM0Dya.js} +6 -6
  21. package/dist/{ImportView-xPTzBekx.js → ImportView-CrmY9zsK.js} +496 -499
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-tvmS42s_.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Sm0goJ7U.js} +1 -1
  23. package/dist/{IngredientGroupView-RFcqjF8T.js → IngredientGroupView-BebnVDQI.js} +5 -5
  24. package/dist/{IngredientsView-CvWOgquN.js → IngredientsView-CZ6Angq_.js} +17 -18
  25. package/dist/{IntegrationExplorerView-CYNhsJSS.js → IntegrationExplorerView-DxjMZi_f.js} +4 -4
  26. package/dist/{IntegrationView-ZtLokbu3.js → IntegrationView-Dm6Bkv1g.js} +15 -19
  27. package/dist/{InventoryBindingForm-DwiAIf5v.js → InventoryBindingForm-B5Dd6UGk.js} +1 -1
  28. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-D4shlQ9Z.js +441 -0
  29. package/dist/{InventoryBindingSummary-zim_Bp5_.js → InventoryBindingSummary-BO8imeDG.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CfTgt5xW.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dp6O-oVL.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-LLtd1VvM.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Mkt2BoGf.js} +1 -1
  32. package/dist/{ProductionView-BWn7RBEg.js → ProductionView-DIwvqo6L.js} +7 -7
  33. package/dist/{PublishView-DFXOi7Hx.js → PublishView-CbeljE1v.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-CG6kBQ26.js → PurchaseOrderPrintPreview-PzYdJJW9.js} +2 -2
  35. package/dist/{ReceiveRequestView-DKMVMo7M.js → ReceiveRequestView-NKnqWM_b.js} +14 -14
  36. package/dist/RecipeView-COQ6WUcz.js +3584 -0
  37. package/dist/{SettingsView-Cmf2ZOUL.js → SettingsView-BjX4I2pe.js} +4 -4
  38. package/dist/{StockView-DTai8l8U.js → StockView--9-NLfX0.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BlKm7GLw.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BWHPauQW.js} +1 -1
  40. package/dist/{SupplierView-CRAHOOLm.js → SupplierView-B8T6cose.js} +12 -12
  41. package/dist/{SurchargeView-3XymEvcr.js → SurchargeView-eVcM29Ss.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DcXfQr_8.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CYXfguPD.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-qhJVHahS.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CMM1DWU3.js} +1 -1
  44. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CuNAt9UU.js +4733 -0
  45. package/dist/{TransferTemplateView-ByhvK4Ua.js → TransferTemplateView-D_oKyOUD.js} +20 -20
  46. package/dist/{UnitCostHistoryView-DHHWNJYA.js → UnitCostHistoryView-DThFdkNP.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-bQu2KOI7.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-B6cHxf2Q.js} +4 -4
  48. package/dist/{UnitView-BZTS-Ahu.js → UnitView-BQZepbTS.js} +8 -8
  49. package/dist/WarehouseView-BZSn9BHl.js +1079 -0
  50. package/dist/{WastageTemplateView-CUDL3HUD.js → WastageTemplateView-BQO1geZz.js} +14 -14
  51. package/dist/api/purchase-order.d.ts +0 -2
  52. package/dist/api/stock.d.ts +0 -6
  53. package/dist/{app-BUQUpe4c.js → app-KaSY7GIt.js} +9137 -10098
  54. package/dist/app.d.ts +9 -952
  55. package/dist/app.js +1 -1
  56. package/dist/{closing-template-DzxDiEQB.js → closing-template-BFEWl8-N.js} +1 -1
  57. package/dist/cypress/support/component.d.ts +2 -1
  58. package/dist/{date2-6jkfRNS_.js → date2-DnqAk4pp.js} +5 -5
  59. package/dist/{dayjs.min-ByRnXzrl.js → dayjs.min-e3pyVvVk.js} +1 -1
  60. package/dist/{decimal-CqWBdj8E.js → decimal-DUKpY1WE.js} +2 -2
  61. package/dist/{defineDeepModel-CaT-4fiq.js → defineDeepModel-T75uoBAd.js} +1 -1
  62. package/dist/{duplicate-template-Cyvx-WK7.js → duplicate-template-CdBNGLA2.js} +1 -1
  63. package/dist/{feature-FjXz4WXw.js → feature-dE--ixN-.js} +2 -2
  64. package/dist/{format-time-from-id-cSri3OoO.js → format-time-from-id-D8SWSpBR.js} +1 -1
  65. package/dist/{format-unit-display-DPbcT7Ff.js → format-unit-display-ChGKpRsq.js} +27 -27
  66. package/dist/{import-export.helper-_yqcePYs.js → import-export.helper-BGjE6JjK.js} +6 -6
  67. package/dist/{index-nSL5yxNn.js → index-D_QylMOJ.js} +3 -3
  68. package/dist/{index-CyJVMHQW.js → index-DdMg0SgN.js} +1 -1
  69. package/dist/{index-CGvNoBid.js → index-JPtVC3tk.js} +3232 -3306
  70. package/dist/{inventory-core-dart.default-DSYRPQNZ.js → inventory-core-dart.default-0h8jmf3F.js} +1428 -1322
  71. package/dist/{lz-string-iyER1Klb.js → lz-string-NnYfN1XC.js} +1 -1
  72. package/dist/{netsuite-BD8LVxaA.js → netsuite-CAphkhg7.js} +1387 -1397
  73. package/dist/{number-C7CJ9ZfE.js → number-C8J8sC6d.js} +3 -3
  74. package/dist/{predefined-templates-o-_pKVSM.js → predefined-templates-CB1opHrA.js} +1 -1
  75. package/dist/{purchase-order-template-BHS8T1VA.js → purchase-order-template-p6EdpieI.js} +1 -1
  76. package/dist/{recalculationUtils-BCByr_CU.js → recalculationUtils-C5whNKrN.js} +1 -1
  77. package/dist/{rules-wZo-8FZ0.js → rules-sRZqLpuQ.js} +2 -2
  78. package/dist/{stock-CnAjxV7P.js → stock-BpfRRZPr.js} +3 -3
  79. package/dist/stock-DWrhlch4.js +85 -0
  80. package/dist/stores/bulk-job.d.ts +0 -13
  81. package/dist/style.css +1 -1
  82. package/dist/{supplier-DkqNwQmi.js → supplier-MzC5sRqv.js} +2 -2
  83. package/dist/{surcharge-Csj1WYbH.js → surcharge-ClMtrRgS.js} +8 -8
  84. package/dist/tsconfig.app.tsbuildinfo +1 -1
  85. package/dist/{uom-rules-BI1CdWeS.js → uom-rules-Di7y-2Xl.js} +1 -1
  86. package/dist/{use-ingredient-select-dialog-5AqoZJDA.js → use-ingredient-select-dialog-BPhQJhXq.js} +2 -2
  87. package/dist/{use-inventory-binding-dialog-ChiyhiuP.js → use-inventory-binding-dialog-BStbsMsT.js} +2 -2
  88. package/dist/{use-template-enabled-locations-BqXxegct.js → use-template-enabled-locations-ChCTz0-t.js} +2 -2
  89. package/dist/{use-transfer-locations-Ckj_diGt.js → use-transfer-locations-D8N8x1cE.js} +2 -2
  90. package/dist/{useHrmPermission-USG_KRoq.js → useHrmPermission-DCSqbLxW.js} +1 -1
  91. package/dist/{useNavigationMenu-BhYf87KI.js → useNavigationMenu-D3-zmwIs.js} +2 -2
  92. package/dist/{useSseClient-BqoE-ir6.js → useSseClient-BRHLaPnM.js} +1 -1
  93. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -2
  94. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -2
  95. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -4
  96. package/dist/views/receive-request/components/email-dialog/EmailDialogProps.d.ts +9 -23
  97. package/dist/views/recipe/composables/use-recipe-table.d.ts +0 -11
  98. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +2 -17
  99. package/dist/{vue-i18n-DoKioQ81.js → vue-i18n-BMo8ADYz.js} +196 -196
  100. package/dist/{xlsx.util-BXjE2o-3.js → xlsx.util-BSzjcX4G.js} +2 -2
  101. package/package.json +2 -2
  102. package/dist/App-Cfp4CqzQ.js +0 -1470
  103. package/dist/BulkReceiveRequestView-ejHyukEp.js +0 -2657
  104. package/dist/ClosingHistoryView-BYVZ01Ma.js +0 -1112
  105. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-njDaQe10.js +0 -563
  106. package/dist/RecipeView-cLLKlLmE.js +0 -3625
  107. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CibsrZXw.js +0 -4781
  108. package/dist/WarehouseView-DVak1RPs.js +0 -1082
  109. package/dist/api/changelog.d.ts +0 -132
  110. package/dist/cypress/component/ChangelogPanel.cy.d.ts +0 -1
  111. package/dist/stock-DwqEvWM5.js +0 -95
  112. package/dist/views/changelog/components/ChangelogDialog.vue.d.ts +0 -19
  113. package/dist/views/changelog/components/ChangelogFloatingButton.spec.d.ts +0 -1
  114. package/dist/views/changelog/components/ChangelogFloatingButton.vue.d.ts +0 -2
  115. package/dist/views/changelog/components/ChangelogPanel.spec.d.ts +0 -1
  116. package/dist/views/changelog/components/ChangelogPanel.vue.d.ts +0 -20
  117. package/dist/views/changelog/composables/change-path.d.ts +0 -10
  118. package/dist/views/changelog/composables/commit-message.d.ts +0 -9
  119. package/dist/views/changelog/composables/commit-message.spec.d.ts +0 -1
  120. package/dist/views/changelog/composables/fab-position.d.ts +0 -21
  121. package/dist/views/changelog/composables/json-line-diff.d.ts +0 -10
  122. package/dist/views/changelog/composables/json-line-diff.spec.d.ts +0 -1
  123. package/dist/views/changelog/composables/use-changelog.d.ts +0 -90
  124. package/dist/views/changelog/composables/use-changelog.spec.d.ts +0 -1
  125. package/dist/views/changelog/composables/use-inventory-record-commits.d.ts +0 -97
  126. package/dist/views/changelog/composables/use-inventory-record-commits.spec.d.ts +0 -1
  127. package/dist/views/changelog/composables/use-snapshot-diff.d.ts +0 -29
  128. package/dist/views/changelog/composables/use-snapshot-diff.spec.d.ts +0 -1
  129. package/dist/views/changelog/composables/value-tree.d.ts +0 -14
  130. package/dist/views/changelog/composables/value-tree.spec.d.ts +0 -1
  131. package/dist/views/import/helper/submit-rows.d.ts +0 -13
  132. package/dist/views/import/helper/submit-rows.spec.d.ts +0 -1
  133. package/dist/views/ingredients/components/inventory-binding/RecipeBindingBreakdown.vue.d.ts +0 -25
  134. package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.d.ts +0 -34
  135. package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.spec.d.ts +0 -1
  136. package/dist/views/receive-request/components/email-dialog/EmailDialog.spec.d.ts +0 -1
  137. package/dist/views/stock/components/StockRecalculateDialog.vue.d.ts +0 -9
  138. package/dist/views/stock/components/dialog/SnapshotRecalculationDialog.vue.d.ts +0 -24
@@ -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-BUQUpe4c.js";
3
- import { t as he, n as ke, f as Be, a as P, c as Ve } from "./number-C7CJ9ZfE.js";
4
- import { u as Ie } from "./use-inventory-binding-dialog-ChiyhiuP.js";
5
- import { useI18n as Q } from "@feedmepos/mf-common";
6
- import { b as q, c as O } from "./rules-wZo-8FZ0.js";
7
- import { _ as we, c as Fe, d as Ee } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-e55tnl4u.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
- };