@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.
Files changed (133) hide show
  1. package/dist/App-DEbWEOwe.js +1537 -0
  2. package/dist/{ApprovalView-hV1msz5Y.js → ApprovalView-BEnYHIlU.js} +9 -9
  3. package/dist/{BindingsDialog-BX1Lopf0.js → BindingsDialog-CJVkMoBS.js} +2 -2
  4. package/dist/{BindingsPicker-BNKW8-XY.js → BindingsPicker-CX9o-xdQ.js} +2 -2
  5. package/dist/{BindingsTable-DiLDsL83.js → BindingsTable-Cil4LJ7l.js} +4 -4
  6. package/dist/{BulkReceiveRequestView-oQh6kFLc.js → BulkReceiveRequestView-DYEc2jPw.js} +21 -22
  7. 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
  8. package/dist/{ClosingDraftView-sgLoaSf4.js → ClosingDraftView-Bz94Iejf.js} +20 -20
  9. package/dist/{ClosingHistoryView-BnE9HrzA.js → ClosingHistoryView-B479Y-mH.js} +5 -5
  10. package/dist/{ClosingTemplateView-BD3Pa11r.js → ClosingTemplateView-F_nx43n6.js} +18 -18
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DlbyxkMQ.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-DddYGHxQ.js} +1 -1
  12. package/dist/{DefaultView-CuzvVkfE.js → DefaultView-CkZOl0ov.js} +5 -5
  13. package/dist/{DeliveryOrderPrintPreview-w-1aAOY1.js → DeliveryOrderPrintPreview-BJEpwAX6.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-CxD12Qct.js → EmailDialog.vue_vue_type_script_setup_true_lang-BW988AoC.js} +29 -30
  15. 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
  16. 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
  17. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CAXnmdUy.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Ci81xTbl.js} +2 -2
  18. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-NhOdW33O.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-CnaHTAUZ.js} +2 -2
  19. package/dist/{FmMultiselectDialog-CULwA_hi.js → FmMultiselectDialog-BE8BlO6_.js} +2 -2
  20. package/dist/FmMultiselectDialog-COKgBmPZ.js +123 -0
  21. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-CI3Y9kDl.js → FmUnitInput.vue_vue_type_script_setup_true_lang-BQHd3NjM.js} +6 -6
  22. package/dist/ImportView-Crb_yrNb.js +1291 -0
  23. package/dist/{IngredientsView-pzpP6oXT.js → IngredientsView-lDypeR4c.js} +34 -35
  24. package/dist/{IntegrationExplorerView-C5aAhB6e.js → IntegrationExplorerView-DgOFGj7H.js} +4 -4
  25. package/dist/{IntegrationView-Bqun7nX0.js → IntegrationView-0sbjINo5.js} +973 -974
  26. package/dist/{InventoryBindingForm-r_Ua1C4a.js → InventoryBindingForm-BhyrjIXJ.js} +1 -1
  27. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-KCz_BQ6T.js +472 -0
  28. package/dist/{InventoryBindingSummary-BQuZLohR.js → InventoryBindingSummary-CsfNKd1r.js} +1 -1
  29. 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
  30. package/dist/{ProductionRunDetailView-95fu_CfH.js → ProductionRunDetailView-BxbDtGMo.js} +4 -4
  31. package/dist/{ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-CdOca1tV.js → ProductionRunLifecycleDialogs.vue_vue_type_script_setup_true_lang-BdJVvwSP.js} +9 -9
  32. package/dist/{ProductionRunView-DIjor_Ix.js → ProductionRunView-CJhNEIzT.js} +3 -3
  33. package/dist/{PublishView-DYObyHQq.js → PublishView-vkt6-D6P.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-C0jCmI9L.js → PurchaseOrderPrintPreview-25dHfVKp.js} +2 -2
  35. package/dist/{ReceiveRequestView-i7ibPfIE.js → ReceiveRequestView-BO4Z2dZu.js} +15 -16
  36. package/dist/RecipeView-B_AE7QQv.js +3428 -0
  37. package/dist/{SettingsView-CdBloj9k.js → SettingsView-qTUvQCuu.js} +163 -168
  38. package/dist/{StockView-g_6eJ62R.js → StockView-yh6qkYUS.js} +269 -270
  39. 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
  40. package/dist/{SupplierView-DkYp_Frj.js → SupplierView-Dqzu1Bvh.js} +14 -14
  41. package/dist/{SurchargeView-CfkV4Y3y.js → SurchargeView-CDosn36c.js} +7 -7
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-2MtN1p5t.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DZ3Gdlp9.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CYMjKXq4.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CWoh2FqQ.js} +1 -1
  44. 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
  45. package/dist/{TransferTemplateView-Ne2gYUSn.js → TransferTemplateView-fDZcC9i4.js} +22 -23
  46. package/dist/{UnitCostHistoryView-Db0_otOb.js → UnitCostHistoryView-CmTTIXAp.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-BzO1lq7j.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DZihCM0T.js} +4 -4
  48. package/dist/{UnitView-CiCeQ63i.js → UnitView-BTx59sFK.js} +8 -8
  49. package/dist/{WarehouseView-BcuJSOMF.js → WarehouseView-BIFe08FJ.js} +8 -8
  50. package/dist/{WastageTemplateView-CPQmtOKQ.js → WastageTemplateView-B_oJqm0_.js} +15 -15
  51. package/dist/api/feature-flags.d.ts +2 -0
  52. package/dist/api/license.d.ts +0 -2
  53. package/dist/{app-DqJp3dcI.js → app-DyEvx3Em.js} +1628 -1817
  54. package/dist/app.d.ts +0 -150
  55. package/dist/app.js +1 -1
  56. package/dist/{closing-template-BNlgZviN.js → closing-template-FgcLy4RT.js} +1 -1
  57. package/dist/components/FeatureCapabilityBadge.vue.d.ts +1 -1
  58. package/dist/{date2-Ci7521dn.js → date2-Rv4IwT9a.js} +1 -1
  59. package/dist/{dayjs.min-Cyp32v4J.js → dayjs.min-DOq1QM_M.js} +1 -1
  60. package/dist/{decimal-BGdm5R3A.js → decimal-7vA05AaD.js} +2 -2
  61. package/dist/{defineDeepModel-B2cJ-rtd.js → defineDeepModel-22Md2SKY.js} +1 -1
  62. package/dist/{duplicate-template-By5WeKZ0.js → duplicate-template-D2tjCY7C.js} +1 -1
  63. package/dist/{core-Js7d-3Pv.js → feature-BMTKl6PK.js} +732 -389
  64. package/dist/feature-flags/core.d.ts +3 -2
  65. package/dist/feature-flags/portal-feature-catalog.d.ts +0 -5
  66. package/dist/feature-flags/vue.d.ts +2 -0
  67. package/dist/{format-time-from-id-Q8C2P96H.js → format-time-from-id-DXhm_Ji1.js} +1 -1
  68. package/dist/{format-unit-display-CICrmm8r.js → format-unit-display-DxWLjFPz.js} +13 -13
  69. package/dist/helper/menu-usage-module.d.ts +1 -1
  70. package/dist/{id-to-date-DeN5x0LR.js → id-to-date-VKlOL3mN.js} +1 -1
  71. package/dist/{import-export.helper-BOTQWxr6.js → import-export.helper-BiF5aKUp.js} +28 -28
  72. package/dist/{index-BbbqCCfp.js → index-DEl_gZn0.js} +3 -3
  73. package/dist/{index-tCYhLCKP.js → index-DdtsVAcv.js} +1 -1
  74. package/dist/{index-Cxm3Sgfv.js → index-DoBWE4Ci.js} +1 -1
  75. package/dist/{lz-string-Dy4Pg8mh.js → lz-string-BwQj8QRN.js} +1 -1
  76. package/dist/{netsuite-BaJjkDM8.js → netsuite-s1S33-lP.js} +2 -2
  77. package/dist/{number-CB36d2PQ.js → number-BmKjsNrc.js} +3 -3
  78. package/dist/{predefined-templates-DLm93Bpx.js → predefined-templates-BZ2KqNix.js} +1 -1
  79. package/dist/{purchase-order-template-CDhn9ZIF.js → purchase-order-template-CINU4my1.js} +1 -1
  80. package/dist/{recalculationUtils-Cqvefakh.js → recalculationUtils-R5tFu_ts.js} +1 -1
  81. package/dist/router/name.d.ts +0 -1
  82. package/dist/{row-action.enum-NTfVmGY8.js → row-action.enum-ePO-Py0V.js} +1 -1
  83. package/dist/{rules-C8dfM84-.js → rules-BZrZVzw7.js} +2 -2
  84. package/dist/{stock-BGB0Siue.js → stock-C2HOKq0k.js} +8 -8
  85. package/dist/{stock-Qu5IiN2_.js → stock-Ce1UvAZ3.js} +1 -1
  86. package/dist/stores/feature.d.ts +10 -9
  87. package/dist/stores/inventory.d.ts +0 -47
  88. package/dist/stores/supplier.d.ts +1 -1
  89. package/dist/style.css +1 -1
  90. package/dist/{supplier-CZdNOSMN.js → supplier-DgT66emI.js} +17 -17
  91. package/dist/{surcharge-Cm40oJvU.js → surcharge-CsVMuzPM.js} +1 -1
  92. package/dist/tsconfig.app.tsbuildinfo +1 -1
  93. package/dist/{uom-rules-L-IW4Nwk.js → uom-rules-CR1XukyM.js} +1 -1
  94. package/dist/{use-ingredient-select-dialog-B2TDVJM6.js → use-ingredient-select-dialog-CJkG4hEX.js} +2 -2
  95. package/dist/use-inventory-binding-dialog-B36kPj4V.js +113 -0
  96. package/dist/{use-template-enabled-locations-DYAPMvo9.js → use-template-enabled-locations-Boa9QLPV.js} +2 -2
  97. package/dist/{use-transfer-locations-w-9tymYS.js → use-transfer-locations-BxOygSUg.js} +2 -2
  98. package/dist/{useHrmPermission-BFCIo5sA.js → useHrmPermission-DLHAqbLV.js} +1 -1
  99. package/dist/{useNavigationMenu-BPHAH5sJ.js → useNavigationMenu-D6abZMGz.js} +102 -109
  100. package/dist/{useSseClient-CWjRacRs.js → useSseClient-C7pff-EW.js} +1 -1
  101. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -1
  102. package/dist/views/ingredients/components/inventory-binding/composables/use-inventory-binding-dialog.d.ts +0 -1
  103. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -1
  104. package/dist/views/ingredients/components/inventory-binding/v2/composables/use-inventory-binding-dialog.d.ts +0 -1
  105. package/dist/views/ingredients/helper/is-linked-ingredient-error.d.ts +1 -1
  106. package/dist/views/integration/components/IntegrationCard.vue.d.ts +3 -3
  107. package/dist/views/recipe/helper/bulk-edit-simulation.helper.d.ts +0 -1
  108. package/dist/views/recipe/helper/import-recipe.d.ts +2 -2
  109. package/dist/{vue-i18n-S4YQ9w6a.js → vue-i18n-CpOOFhVU.js} +219 -219
  110. package/dist/{xlsx.util-CP8_VajN.js → xlsx.util-xwI5tVz6.js} +2 -2
  111. package/package.json +5 -5
  112. package/dist/App-DRXADP0k.js +0 -1498
  113. package/dist/DeprecateSoonWarningDialog.vue_vue_type_script_setup_true_lang-Bp8bjDU1.js +0 -58
  114. package/dist/FmMultiselectDialog-BqZgHP8s.js +0 -77
  115. package/dist/ImportView-DqQG673_.js +0 -1302
  116. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-DfvNUu80.js +0 -51
  117. package/dist/IngredientGroupView-CyngKxPo.js +0 -1000
  118. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-CYDuu4kU.js +0 -563
  119. package/dist/RecipeView-C5VO7yr3.js +0 -3625
  120. package/dist/feature-fG7d73oi.js +0 -371
  121. package/dist/index-Dqf27vLH.js +0 -841
  122. package/dist/random-CSbEbElR.js +0 -10
  123. package/dist/use-inventory-binding-dialog-BJ00hl5f.js +0 -152
  124. package/dist/usePromise-CbVUCxhj.js +0 -29
  125. package/dist/views/ingredient-group/IngredientGroupView.vue.d.ts +0 -3
  126. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialog.vue.d.ts +0 -31
  127. package/dist/views/ingredient-group/components/ingredient-group-dialog/IngredientGroupDialogProps.d.ts +0 -10
  128. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupForm.vue.d.ts +0 -21
  129. package/dist/views/ingredient-group/components/ingredient-group-form/IngredientGroupFormProps.d.ts +0 -12
  130. package/dist/views/ingredient-group/components/ingredient-group-rule-field/IngredientGroupRuleField.vue.d.ts +0 -37
  131. package/dist/views/ingredient-group/composables/use-ingredient-group-actions.d.ts +0 -24
  132. package/dist/views/ingredient-group/composables/use-ingredient-group-rule-item.d.ts +0 -31
  133. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +0 -77
@@ -1,1302 +0,0 @@
1
- import { defineComponent as Te, ref as F, computed as L, watch as Be, resolveComponent as Q, createElementBlock as D, openBlock as T, createVNode as A, createCommentVNode as Y, unref as i, normalizeClass as ce, createSlots as Pe, withCtx as q, createElementVNode as n, createBlock as se, toDisplayString as a, Fragment as Me, renderList as $e, shallowRef as Ue, h as Ie, createTextVNode as C } from "vue";
2
- import { u as je, _ as ke } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
3
- import { useCoreStore as Re, useI18n as Fe } from "@feedmepos/mf-common";
4
- import { useDialogChild as Oe, useSnackbar as Ae, useDialog as He, useBreakpoints as ze } from "@feedmepos/ui-library";
5
- import { useFeatureStore as Ke } from "./feature-fG7d73oi.js";
6
- import { a as ie } from "./app-DqJp3dcI.js";
7
- import "./dayjs.min-Cyp32v4J.js";
8
- import "./app-C39bYJmq.js";
9
- import "./FmAdminBadge-DlplQOHb.js";
10
- import { s as De, a as Ve, d as We, t as Ce, r as Le } from "./xlsx.util-CP8_VajN.js";
11
- import { s as Je, g as Xe, b as qe, d as Ge } from "./import-export.helper-BOTQWxr6.js";
12
- import { r as Qe } from "./random-CSbEbElR.js";
13
- import { c as Ne, a as pe } from "./number-CB36d2PQ.js";
14
- import { F as Ye } from "./FmDroppableField-J0tG_U3w.js";
15
- function Ee() {
16
- return `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Qe()}`;
17
- }
18
- function Ze(U) {
19
- const [
20
- e,
21
- S,
22
- y,
23
- b,
24
- k,
25
- h,
26
- ...r
27
- ] = De(U);
28
- if (!e || !e.length || e.some((c) => c.length && !c.startsWith("system:")))
29
- throw new Error("Missing meta header. Excel file does not come from the template.");
30
- const l = e.map((c) => c.split(":")[1]), u = ["name", "symbol", "precision"].filter((c) => !l.includes(c));
31
- if (u.length)
32
- throw new Error(
33
- `Missing meta headers (${u.join()}). Excel file does not come from the template.`
34
- );
35
- return r.map((c, f) => {
36
- const g = {};
37
- for (const d in l) {
38
- const o = l[d];
39
- Object.assign(g, { [o]: c[d] });
40
- }
41
- return {
42
- index: f,
43
- data: g
44
- };
45
- });
46
- }
47
- function et(U) {
48
- try {
49
- const e = Ze(U).filter((r) => {
50
- const { name: l, symbol: s, precision: u, measurement_name: p, measurement_symbol: c, measurement_conversion: f } = r.data;
51
- return l || s || u || p || c || f;
52
- }), y = ie().units, b = [], k = [], h = {};
53
- for (const r of e)
54
- if (r.data.name && r.data.symbol)
55
- h[r.data.name] = {
56
- unit: {
57
- name: r.data.name,
58
- abbrev: r.data.symbol,
59
- precision: Math.max(0, Math.min(10, Math.floor(r.data.precision || 2))),
60
- measurements: []
61
- },
62
- rowNumber: r.index
63
- }, r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && h[r.data.name].unit.measurements.push({
64
- id: Ee(),
65
- name: r.data.measurement_name,
66
- abbrev: r.data.measurement_symbol,
67
- conversion: {
68
- amount: Math.round(r.data.measurement_conversion * Math.pow(10, h[r.data.name].unit.precision)),
69
- precision: h[r.data.name].unit.precision
70
- }
71
- });
72
- else {
73
- const l = Object.keys(h)[Object.keys(h).length - 1];
74
- l && h[l] && r.data.measurement_name && r.data.measurement_symbol && r.data.measurement_conversion && h[l].unit.measurements.push({
75
- id: Ee(),
76
- name: r.data.measurement_name,
77
- abbrev: r.data.measurement_symbol,
78
- conversion: {
79
- amount: Math.round(r.data.measurement_conversion * Math.pow(10, h[l].unit.precision)),
80
- precision: h[l].unit.precision
81
- }
82
- });
83
- }
84
- for (const [r, { unit: l, rowNumber: s }] of Object.entries(h)) {
85
- const u = y.find((p) => {
86
- var c, f;
87
- return p.abbrev === l.abbrev && ((c = p.name) == null ? void 0 : c.trim()) === ((f = l.name) == null ? void 0 : f.trim());
88
- });
89
- u ? k.push({
90
- type: "update",
91
- original: u,
92
- unit: {
93
- ...u,
94
- name: l.name || u.name,
95
- abbrev: l.abbrev || u.abbrev,
96
- precision: l.precision !== void 0 ? l.precision : u.precision,
97
- measurements: l.measurements.map((p) => {
98
- const c = u.measurements.find((f) => f.name === p.name && f.abbrev === p.abbrev);
99
- return c ? { ...c, ...p, id: c.id } : { ...p, id: Ee() };
100
- })
101
- },
102
- errors: [],
103
- excelRowNumber: s
104
- }) : b.push({
105
- type: "create",
106
- unit: {
107
- ...l,
108
- measurements: l.measurements.map((p) => ({ ...p, id: Ee() }))
109
- },
110
- errors: [],
111
- excelRowNumber: s
112
- });
113
- }
114
- return {
115
- invalidExcel: !1,
116
- importCreateResult: b,
117
- importUpdateResult: k
118
- };
119
- } catch (e) {
120
- return {
121
- invalidExcel: !0,
122
- invalidExcelMessage: (e == null ? void 0 : e.message) ?? "Invalid excel",
123
- importCreateResult: [],
124
- importUpdateResult: []
125
- };
126
- }
127
- }
128
- function tt(U, { ignoreErrors: e = !1 } = {}) {
129
- var S;
130
- try {
131
- const y = ie(), b = y.skuByCode, k = y.recipeByName, h = y.skuGroupById, r = y.skuGroups, l = y.units, s = [], u = {};
132
- for (const o of U) {
133
- const v = [];
134
- let w = "";
135
- if (o.data.type === "INGREDIENT") {
136
- const I = b[o.data.code];
137
- I ? w = I._id : v.push(`Ingredient with code '${o.data.code}' not found`);
138
- } else if (o.data.type === "RECIPE") {
139
- const I = k[o.data.name];
140
- I ? w = I._id : v.push(`Recipe with name '${o.data.name}' not found`);
141
- } else if (o.data.type === "SKU_GROUP") {
142
- const I = r.find((E) => E.ref === o.data.code || E.name === o.data.name);
143
- I ? w = I._id : v.push(`SKU Group with ref '${o.data.code}' or name '${o.data.name}' not found`);
144
- } else
145
- v.push(`Invalid type '${o.data.type}'. Must be 'INGREDIENT', 'RECIPE', or 'SKU_GROUP'`);
146
- o.data.amount || v.push(`Invalid amount '${o.data.amount}'. Must be a valid number`);
147
- let N;
148
- if ((o.data.unit || o.data.baseUnit) && o.data.type !== "RECIPE" && o.data.type !== "SKU_GROUP" && (N = l.find((I) => {
149
- var E, Z;
150
- return I.abbrev === o.data.baseUnit && ((E = I.name) == null ? void 0 : E.trim()) === ((Z = o.data.unit) == null ? void 0 : Z.trim());
151
- }), N || (o.data.baseUnit && o.data.unit ? v.push(`Cannot find unit with symbol '${o.data.baseUnit}' and name '${o.data.unit}'`) : o.data.baseUnit ? v.push(`Cannot find unit with symbol '${o.data.baseUnit}'`) : o.data.unit && v.push(`Cannot find unit with name '${o.data.unit}'`))), v.length > 0 && s.push(`Row ${o.index + 6}: ${v.join(", ")}`), e || v.length === 0) {
152
- let I;
153
- if (o.data.type === "RECIPE" || o.data.type === "SKU_GROUP" ? I = void 0 : I = (S = N == null ? void 0 : N.measurements) == null ? void 0 : S.find((E) => E.abbrev === o.data.measurementName), o.data.recipeName)
154
- u[o.data.recipeName] = {
155
- name: o.data.recipeName,
156
- customAttributes: o.data.customAttributes ? Je(o.data.customAttributes) : {},
157
- contains: [{
158
- type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
159
- id: w,
160
- amount: Ne(+o.data.amount),
161
- measurement: I || void 0
162
- }]
163
- }, s[o.data.recipeName] = v.length > 0 ? `Row ${o.index + 6}: ${v.join(", ")}` : [];
164
- else {
165
- const E = Object.keys(u)[Object.keys(u).length - 1];
166
- E && u[E] && (u[E] = {
167
- ...u[E],
168
- contains: [
169
- ...u[E].contains,
170
- {
171
- type: o.data.type === "INGREDIENT" ? "SKU" : o.data.type,
172
- id: w,
173
- amount: Ne(+o.data.amount),
174
- measurement: I || void 0
175
- }
176
- ]
177
- }, s[E] = v.length > 0 ? s[E] ? `${s[E]}, Row ${o.index + 6}: ${v.join(", ")}` : `Row ${o.index + 6}: ${v.join(", ")}` : []);
178
- }
179
- }
180
- }
181
- const p = Object.values(u), c = p.filter((o) => !k[o.name]), f = p.filter((o) => k[o.name]), g = c.map((o, v) => ({
182
- type: "create",
183
- recipe: o,
184
- // Type assertion - _id will be assigned by backend
185
- errors: s[o.name],
186
- excelRowNumber: v + 6
187
- // Assuming header rows
188
- })), d = f.map((o, v) => {
189
- const w = k[o.name];
190
- return {
191
- type: "update",
192
- original: w,
193
- recipe: {
194
- ...w,
195
- name: o.name || w.name,
196
- contains: o.contains.length > 0 ? o.contains : w.contains,
197
- customAttributes: o.customAttributes || w.customAttributes
198
- },
199
- errors: s[o.name],
200
- excelRowNumber: v + 6
201
- };
202
- });
203
- return {
204
- invalidExcel: s.length > 0,
205
- invalidExcelMessage: s.length > 0 ? `Import completed with ${s.length} error(s): ${s.join("; ")}` : void 0,
206
- importCreateResult: g,
207
- importUpdateResult: d
208
- };
209
- } catch (y) {
210
- return {
211
- invalidExcel: !0,
212
- invalidExcelMessage: y instanceof Error ? y.message : "Unknown error occurred",
213
- importCreateResult: [],
214
- importUpdateResult: []
215
- };
216
- }
217
- }
218
- function nt(U) {
219
- const [
220
- e,
221
- S,
222
- y,
223
- b,
224
- k,
225
- h,
226
- ...r
227
- ] = De(U);
228
- if (!e || !e.length || e.some((c) => c.length && !c.startsWith("system:")))
229
- throw new Error("Missing meta header. Excel file does not come from the template.");
230
- const l = e.map((c) => c.split(":")[1]), u = ["code", "recipeName", "unit", "baseUnit", "type", "amount"].filter((c) => !l.includes(c));
231
- if (u.length)
232
- throw new Error(
233
- `Missing meta headers (${u.join()}). Excel file does not come from the template.`
234
- );
235
- return r.map((c, f) => {
236
- const g = {};
237
- for (const d in l) {
238
- const o = l[d];
239
- Object.assign(g, { [o]: c[d] });
240
- }
241
- return {
242
- index: f,
243
- data: g
244
- };
245
- }).filter((c) => {
246
- const { recipeName: f, type: g, code: d, name: o, amount: v, unit: w, baseUnit: N, measurementName: I, customAttributes: E } = c.data;
247
- return f || g || d || o || v || w || N || I || E;
248
- });
249
- }
250
- function ot() {
251
- const e = Re().currentBusiness.value, S = ie(), y = [
252
- { id: "name", name: "Unit Name" },
253
- { id: "symbol", name: "Symbol" },
254
- { id: "precision", name: "Precision" },
255
- { id: "measurement_name", name: "Measurement Symbol" },
256
- { id: "measurement_symbol", name: "Measurement Symbol" },
257
- { id: "measurement_conversion", name: "Measurement Conversion" }
258
- ];
259
- let b = [];
260
- S.units.length > 0 ? S.units.forEach((r) => {
261
- if (r.measurements.length === 0)
262
- b.push([
263
- r.name,
264
- r.abbrev,
265
- r.precision,
266
- "",
267
- "",
268
- ""
269
- ]);
270
- else {
271
- b.push([
272
- r.name,
273
- r.abbrev,
274
- r.precision,
275
- r.measurements[0].name,
276
- r.measurements[0].abbrev,
277
- +pe(r.measurements[0].conversion)
278
- ]);
279
- for (let l = 1; l < r.measurements.length; l++)
280
- b.push([
281
- "",
282
- "",
283
- "",
284
- r.measurements[l].name,
285
- r.measurements[l].abbrev,
286
- +pe(r.measurements[l].conversion)
287
- ]);
288
- }
289
- }) : b = [
290
- ["Length", "m", 2, "Meter", "m", 1],
291
- ["", "", "", "Centimeter", "cm", 0.01],
292
- ["", "", "", "Millimeter", "mm", 1e-3],
293
- ["Weight", "kg", 3, "Kilogram", "kg", 1],
294
- ["", "", "", "Gram", "g", 1e-3],
295
- ["", "", "", "Pound", "lb", 0.453592]
296
- ];
297
- const k = [
298
- ["Business name:", e == null ? void 0 : e.name],
299
- ["Business ID:", e == null ? void 0 : e._id],
300
- ["Menu version", e == null ? void 0 : e.menuVersion],
301
- [],
302
- y.map((r) => r.name),
303
- ...b
304
- ], h = y.map((r) => `system:${r.id}`);
305
- return Ce(k, h);
306
- }
307
- function rt() {
308
- const e = Re().currentBusiness.value, S = ie(), y = qe();
309
- let b = [];
310
- S.skus.length > 0 ? b = S.skus.map((r) => {
311
- var l, s, u, p, c, f, g, d;
312
- return [
313
- r.code,
314
- r.name,
315
- ((l = r.unit) == null ? void 0 : l.name) || "",
316
- ((s = r.unit) == null ? void 0 : s.abbrev) || "",
317
- ((p = (u = r.unit) == null ? void 0 : u.measurements.find((o) => o.id === r.trackingMeasurement)) == null ? void 0 : p.abbrev) ?? r.unit.abbrev,
318
- r.valuation || "WAVG",
319
- (c = r.defaultCost) != null && c.costPerUnit ? +pe((f = r.defaultCost) == null ? void 0 : f.costPerUnit) : 0,
320
- ((g = r.thresholds) == null ? void 0 : g.low) ?? Ge().low,
321
- ((d = r.thresholds) == null ? void 0 : d.mid) ?? Ge().mid,
322
- r.customAttributes ? Object.entries(r.customAttributes).map(([o, v]) => `${o}:${v}`).join("|") : ""
323
- ];
324
- }) : b = [
325
- ["EXAMPLE_CODE", "Example Ingredient", "kg", "kg", "Unit Name", "WAVG", 10.5, 5, 10, ""]
326
- ];
327
- const k = [
328
- ["Business name:", e == null ? void 0 : e.name],
329
- ["Business ID:", e == null ? void 0 : e._id],
330
- ["Menu version", e == null ? void 0 : e.menuVersion],
331
- [],
332
- y.map((r) => r.name),
333
- ...b
334
- ], h = y.map((r) => `system:${r.id}`);
335
- return Ce(k, h);
336
- }
337
- function st() {
338
- const e = Re().currentBusiness.value, S = ie(), y = [
339
- { id: "recipeName", name: "Recipe Name" },
340
- { id: "type", name: "Type" },
341
- { id: "code", name: "Code" },
342
- { id: "name", name: "Item Name" },
343
- { id: "amount", name: "Amount" },
344
- { id: "unit", name: "Unit" },
345
- { id: "baseUnit", name: "Unit Symbol" },
346
- { id: "measurementName", name: "Measurement Symbol" },
347
- { id: "customAttributes", name: "Custom Attributes" }
348
- ];
349
- let b = [];
350
- if (S.recipes.length > 0) {
351
- const r = S.recipeById, l = S.skuById, s = S.skuGroupById;
352
- b = S.recipes.flatMap((u) => {
353
- var c;
354
- const p = u.customAttributes ? Object.entries(u.customAttributes).map(([f, g]) => `${f}:${g}`).join("|") : "";
355
- if ((c = u.contains) != null && c.length) {
356
- const f = u.contains.filter((o) => o.type === "RECIPE"), g = u.contains.filter((o) => o.type === "SKU"), d = u.contains.filter((o) => o.type === "SKU_GROUP");
357
- return [
358
- ...f.map((o, v) => {
359
- var w;
360
- return [
361
- v === 0 ? u.name : "",
362
- "RECIPE",
363
- "",
364
- ((w = r[o.id]) == null ? void 0 : w.name) || "",
365
- o.amount.amount,
366
- "",
367
- "unit",
368
- "Unit",
369
- v === 0 ? p : ""
370
- ];
371
- }),
372
- ...g.map((o, v) => {
373
- var w, N, I, E, Z, ve, ye, ge, fe, ae, be, le, he, xe, _e, we;
374
- return [
375
- !f.length && v === 0 ? u.name : "",
376
- "INGREDIENT",
377
- ((w = l[o.id]) == null ? void 0 : w.code) || "",
378
- ((N = l[o.id]) == null ? void 0 : N.name) || "",
379
- +pe(o.amount),
380
- o.measurement ? ((E = (I = l[o.id]) == null ? void 0 : I.unit) == null ? void 0 : E.name) || "" : ((ve = (Z = l[o.id]) == null ? void 0 : Z.unit) == null ? void 0 : ve.name) || "",
381
- o.measurement ? ((ge = (ye = l[o.id]) == null ? void 0 : ye.unit) == null ? void 0 : ge.abbrev) || "" : ((ae = (fe = l[o.id]) == null ? void 0 : fe.unit) == null ? void 0 : ae.abbrev) || "",
382
- o.measurement ? o.measurement.abbrev : ((xe = (he = (le = (be = l[o.id]) == null ? void 0 : be.unit) == null ? void 0 : le.measurements) == null ? void 0 : he.find((Se) => {
383
- var m;
384
- return Se.id === ((m = l[o.id]) == null ? void 0 : m.trackingMeasurement);
385
- })) == null ? void 0 : xe.abbrev) || ((we = (_e = l[o.id]) == null ? void 0 : _e.unit) == null ? void 0 : we.abbrev) || "",
386
- !f.length && v === 0 ? p : ""
387
- ];
388
- }),
389
- ...d.map((o, v) => {
390
- var w, N;
391
- return [
392
- f.length === 0 && g.length === 0 && v === 0 ? u.name : "",
393
- "SKU_GROUP",
394
- ((w = s[o.id]) == null ? void 0 : w.ref) || "",
395
- ((N = s[o.id]) == null ? void 0 : N.name) || "",
396
- +pe(o.amount),
397
- "",
398
- "unit",
399
- "Unit",
400
- f.length === 0 && g.length === 0 && v === 0 ? p : ""
401
- ];
402
- })
403
- ];
404
- }
405
- return [];
406
- });
407
- } else
408
- b = [
409
- ["Pizza Dough", "INGREDIENT", "FLOUR001", "Flour", "500", "Weight", "g", "Gram", "difficulty:easy, category:italian"],
410
- ["", "INGREDIENT", "WATER001", "Water", "300", "Volume", "ml", "Milliliter", ""],
411
- ["", "INGREDIENT", "SALT001", "Salt", "10", "Weight", "g", "Gram", ""]
412
- ];
413
- const k = [
414
- ["Business name:", e == null ? void 0 : e.name],
415
- ["Business ID:", e == null ? void 0 : e._id],
416
- ["Menu version", e == null ? void 0 : e.menuVersion],
417
- [],
418
- y.map((r) => r.name),
419
- ...b
420
- ], h = y.map((r) => `system:${r.id}`);
421
- return Ce(k, h);
422
- }
423
- function it() {
424
- const U = Ve({
425
- unit: ot(),
426
- ingredient: rt(),
427
- recipe: st()
428
- }), e = "FeedMe comprehensive template.xlsx";
429
- return We(U, e), e;
430
- }
431
- async function at(U) {
432
- if (!U) return null;
433
- try {
434
- return et(U);
435
- } catch (e) {
436
- throw console.error("Error in processUnitsSheet:", e), e;
437
- }
438
- }
439
- async function lt(U) {
440
- if (!U) return null;
441
- try {
442
- return Xe(U);
443
- } catch (e) {
444
- throw console.error("Error in processIngredientsSheet:", e), e;
445
- }
446
- }
447
- async function mt(U) {
448
- if (!U) return null;
449
- try {
450
- const e = nt(U);
451
- return tt(e, { ignoreErrors: !0 });
452
- } catch (e) {
453
- throw console.error("Error in processRecipesSheet:", e), e;
454
- }
455
- }
456
- function re(U) {
457
- return (U ?? []).filter((e) => !e.errors || e.errors.length === 0).map(({ errors: e, ...S }) => S);
458
- }
459
- const ut = { class: "flex flex-col gap-24" }, dt = { class: "flex flex-col gap-8" }, ct = { class: "flex flex-col flex-1 gap-4" }, pt = { class: "fm-typo-en-body-md-600" }, vt = {
460
- key: 2,
461
- class: "shrink-0"
462
- }, yt = {
463
- key: 0,
464
- class: "flex flex-col"
465
- }, gt = { class: "text-fm-color-system-error-300 fm-typo-en-body-sm-400" }, ft = {
466
- key: 0,
467
- class: "max-h-[200px] overflow-y-auto flex flex-col gap-8"
468
- }, bt = { class: "fm-typo-en-body-lg-600" }, ht = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, xt = /* @__PURE__ */ Te({
469
- __name: "ImportDialog",
470
- setup(U) {
471
- const e = F(null), S = Oe();
472
- Ae();
473
- const y = F(!1), b = F(new Array()), k = F(null), h = F([]), r = F([]), l = L(() => !!b.value.length), s = L(() => !!k.value && h.value.length > 0), { t: u } = Fe();
474
- async function p(g) {
475
- b.value = [], k.value = null, h.value = [], r.value = [];
476
- try {
477
- y.value = !0;
478
- const [d] = await Promise.all([
479
- Le(g),
480
- // fake buffer for UX
481
- new Promise((o) => setTimeout(o, 1e3))
482
- ]);
483
- k.value = d, c();
484
- } catch (d) {
485
- console.error("Error parsing Excel file:", d), b.value.push((d == null ? void 0 : d.message) || "Unknown error occurred");
486
- } finally {
487
- y.value = !1;
488
- }
489
- }
490
- function c() {
491
- if (b.value = [], !k.value) return;
492
- const d = ["unit", "ingredient", "recipe"].filter((o) => k.value.Sheets[o]);
493
- if (d.length === 0) {
494
- b.value.push("No valid sheets found. Expected sheets: unit, ingredient, or recipe");
495
- return;
496
- }
497
- h.value = d, S.emitData({ availableSheets: d, workbook: k.value });
498
- }
499
- Be(e, (g) => {
500
- g && p(g);
501
- });
502
- function f() {
503
- if (!k.value || h.value.length === 0) return "";
504
- const g = [];
505
- return h.value.forEach((d) => {
506
- switch (d) {
507
- case "unit":
508
- g.push("Units sheet found");
509
- break;
510
- case "ingredient":
511
- g.push("Ingredients sheet found");
512
- break;
513
- case "recipe":
514
- g.push("Recipes sheet found");
515
- break;
516
- }
517
- }), g.length > 0 ? `Ready to process: ${g.join(", ")}. Processing will follow dependency order.` : "No valid sheets found";
518
- }
519
- return (g, d) => {
520
- const o = Q("FmCircularProgress"), v = Q("FmIcon"), w = Q("FmButton");
521
- return T(), D("div", ut, [
522
- A(Ye, {
523
- class: ce({
524
- "w-full": !0,
525
- "h-[200px]": !e.value
526
- }),
527
- accept: ".xlsx,.xls",
528
- onFileUpload: d[0] || (d[0] = (N) => e.value = N),
529
- label: i(u)("inventory.ingredient.import.uploadTemplate"),
530
- "button-label": i(u)("inventory.ingredient.import.selectFile")
531
- }, Pe({ _: 2 }, [
532
- e.value ? {
533
- name: "default",
534
- fn: q(({ openFileDialog: N }) => [
535
- n("div", dt, [
536
- n("div", {
537
- class: ce([
538
- "fm-corner-radius-md p-16 flex items-center gap-16",
539
- {
540
- "border border-fm-color-neutral-gray-100": y.value,
541
- "border border-fm-color-neutral-gray-200": !y.value && !l.value,
542
- "border border-fm-color-system-error-200": l.value
543
- }
544
- ])
545
- }, [
546
- y.value ? (T(), se(o, {
547
- key: 0,
548
- size: "md",
549
- color: "neutral-gray-200"
550
- })) : (T(), se(v, {
551
- key: 1,
552
- name: l.value ? "error" : "check_circle",
553
- color: l.value ? "system-error-300" : "system-success-400",
554
- size: "lg"
555
- }, null, 8, ["name", "color"])),
556
- n("div", ct, [
557
- n("div", pt, a(e.value.name), 1),
558
- n("div", {
559
- class: ce([
560
- "fm-typo-en-body-sm-400",
561
- {
562
- "text-fm-color-system-error-300": l.value,
563
- "text-fm-color-typo-secondary": !l.value
564
- }
565
- ])
566
- }, a(l.value ? i(u)("inventory.ingredient.import.error.invalidContent") : "File valid"), 3)
567
- ]),
568
- y.value ? Y("", !0) : (T(), D("div", vt, [
569
- A(w, {
570
- label: i(u)("inventory.ingredient.import.replaceFile"),
571
- variant: l.value ? "destructive" : "secondary",
572
- "prepend-icon": l.value ? void 0 : "autorenew",
573
- onClick: N
574
- }, null, 8, ["label", "variant", "prepend-icon", "onClick"])
575
- ]))
576
- ], 2),
577
- b.value.length ? (T(), D("div", yt, [
578
- (T(!0), D(Me, null, $e(b.value, (I, E) => (T(), D("div", {
579
- key: E,
580
- class: "flex gap-8 items-center"
581
- }, [
582
- A(v, {
583
- name: "error",
584
- size: "sm",
585
- color: "system-error-300"
586
- }),
587
- n("div", gt, a(I), 1)
588
- ]))), 128))
589
- ])) : Y("", !0)
590
- ])
591
- ]),
592
- key: "0"
593
- } : void 0
594
- ]), 1032, ["class", "label", "button-label"]),
595
- s.value ? (T(), D("div", ft, [
596
- n("div", bt, a(i(u)("inventory.ingredient.import.summary")), 1),
597
- n("div", ht, a(f()), 1)
598
- ])) : Y("", !0)
599
- ]);
600
- };
601
- }
602
- }), _t = {
603
- key: 0,
604
- class: "bg-blue-50 border border-blue-200 rounded-lg p-16"
605
- }, wt = { class: "flex items-start gap-12" }, It = { class: "flex flex-col gap-8" }, Et = { class: "fm-typo-en-body-md-400 text-blue-800" }, St = { class: "fm-typo-en-body-sm-400 text-blue-700" }, kt = { class: "mb-8" }, Rt = ["innerHTML"], Ct = ["innerHTML"], Ut = { class: "mb-8" }, Gt = { class: "mb-12" }, Nt = { class: "mb-12" }, Tt = { class: "mb-8" }, Mt = { class: "text-orange-600" }, $t = {
606
- key: 1,
607
- class: "bg-white rounded-lg shadow"
608
- }, Ft = { class: "flex items-center justify-between p-16 border-b" }, At = { class: "fm-typo-en-title-md-600" }, Dt = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, Bt = {
609
- key: 0,
610
- class: "text-red-600"
611
- }, Pt = {
612
- key: 1,
613
- class: "text-orange-600"
614
- }, jt = {
615
- key: 2,
616
- class: "text-green-600"
617
- }, Ot = { class: "flex gap-8" }, Ht = { class: "p-16" }, zt = {
618
- key: 2,
619
- class: "bg-white rounded-lg shadow"
620
- }, Kt = { class: "flex items-center justify-between p-16 border-b" }, Vt = { class: "fm-typo-en-title-md-600 text-red-800" }, Wt = { class: "fm-typo-en-body-sm-400 text-gray-600 mt-4" }, Lt = { class: "flex gap-8" }, Jt = { class: "p-16" }, Xt = {
621
- key: 0,
622
- class: "flex flex-col gap-16 p-16"
623
- }, qt = { class: "fm-typo-en-title-sm-600 mb-12" }, Qt = { class: "grid grid-cols-2 gap-12" }, Yt = { class: "fm-typo-en-body-sm-400 text-gray-600" }, Zt = { class: "fm-typo-en-body-md-600" }, en = { key: 0 }, tn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, nn = { class: "fm-typo-en-body-md-600" }, on = { class: "fm-typo-en-body-sm-400 text-gray-600" }, rn = { class: "fm-typo-en-body-md-600" }, sn = { class: "fm-typo-en-body-sm-400 text-gray-600" }, an = { class: "fm-typo-en-body-md-600" }, ln = { class: "fm-typo-en-body-sm-400 text-gray-600" }, mn = { class: "fm-typo-en-title-sm-600 mb-12 text-red-800" }, un = { class: "space-y-8" }, dn = { class: "fm-typo-en-body-md-400 text-red-800" }, cn = { class: "fm-typo-en-title-sm-600 mb-12" }, pn = { class: "bg-gray-50 p-12 rounded border overflow-auto" }, vn = { class: "text-sm" }, yn = { class: "flex gap-8" }, gn = { class: "flex flex-col items-center justify-center h-64 gap-16" }, fn = { class: "text-center" }, bn = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, hn = { class: "flex flex-col items-center justify-center h-64 gap-16" }, xn = { class: "text-center" }, _n = { class: "fm-typo-en-title-md-600 text-gray-600 mb-8" }, wn = { class: "fm-typo-en-body-md-400 text-gray-500" }, Dn = /* @__PURE__ */ Te({
624
- __name: "ImportView",
625
- setup(U) {
626
- const { t: e } = Fe(), S = He(), y = Ae();
627
- je();
628
- const b = Ke(), { breakpoints: k } = ze(), h = ie(), r = F("");
629
- F(!1);
630
- const l = F(!1), s = F(null), u = F(!1), p = F(null), c = F(!1), f = F([]), g = F(null), d = F([]), o = F(!1), v = L(() => k.value.xs || k.value.sm), w = L(() => v.value ? 10 : 20), N = L(() => {
631
- const m = s.value;
632
- if (!m) return [];
633
- const t = [], { units: G, skus: B, recipes: V, _invalidExcel: z, _invalidExcelMessage: J } = m, X = ($) => {
634
- var j;
635
- return ((j = $.errors) == null ? void 0 : j.length) > 0 ? Array.isArray($.errors) ? $.errors.join(", ") : $.errors || e("inventory.common.validationFailed") : z ? J || e("inventory.common.invalidExcelFormat") : e("inventory.common.readyToImport");
636
- }, H = ($, O) => {
637
- if ($)
638
- for (const j of ["create", "update"]) {
639
- const K = $[j];
640
- if (K)
641
- for (const P of K)
642
- t.push({
643
- name: P.name || P.abbrev || P.code || e("inventory.common.unknown"),
644
- type: O,
645
- operation: e(j === "create" ? "inventory.common.create" : "inventory.common.update"),
646
- status: X(P),
647
- errors: P.errors || [],
648
- details: P
649
- });
650
- }
651
- };
652
- return H(G, e("inventory.common.unit")), H(B, e("inventory.common.ingredient")), H(V, e("inventory.common.recipe")), t;
653
- }), I = L(() => N.value.some(
654
- (m) => m.errors && m.errors.length > 0
655
- )), E = L(() => N.value.some(
656
- (m) => m.status && m.status.includes("Invalid Excel")
657
- )), Z = L(() => {
658
- const m = N.value.find(
659
- (t) => t.status && t.status.includes("Invalid Excel")
660
- );
661
- return (m == null ? void 0 : m.status) || e("inventory.common.invalidExcelFormatDetected");
662
- }), ve = L(() => !d.value || d.value.length === 0 ? [] : d.value.map((m, t) => {
663
- var G, B;
664
- return {
665
- id: t + 1,
666
- name: ((G = m.error.data) == null ? void 0 : G.name) || e("inventory.common.unknown"),
667
- type: m.type || e("inventory.common.general"),
668
- message: ((B = m.error) == null ? void 0 : B.message) || JSON.stringify(m.error)
669
- };
670
- }));
671
- function ye(m) {
672
- switch (m) {
673
- case "import":
674
- return ge();
675
- }
676
- }
677
- function ge() {
678
- S.open({
679
- title: e("inventory.common.import"),
680
- contentComponent: xt,
681
- overlay: !0,
682
- closeButton: !0,
683
- primaryActions: {
684
- text: e("inventory.common.next"),
685
- close: !1
686
- },
687
- secondaryActions: {
688
- text: e("inventory.common.close"),
689
- close: !0
690
- },
691
- tertiaryActions: {
692
- text: e("inventory.ingredient.import.actions.downloadTemplate"),
693
- close: !1,
694
- variant: "plain"
695
- }
696
- }).onPrimary(async (m) => {
697
- m && m.workbook && m.availableSheets && (await fe(m), S.close()), f.value.length === 0 && S.close();
698
- }).onTertiary(() => {
699
- try {
700
- const m = it();
701
- y.open({
702
- title: e("inventory.common.export") + " " + e("inventory.ingredient.import.actions.downloadTemplate"),
703
- message: e("inventory.common.templateDownloaded", [m]),
704
- type: "success"
705
- });
706
- } catch (m) {
707
- y.open({
708
- title: e("inventory.common.downloadFailed"),
709
- message: e("inventory.common.failedDownloadTemplate"),
710
- type: "error"
711
- }), console.error("Error downloading template:", m);
712
- }
713
- });
714
- }
715
- async function fe(m) {
716
- g.value = m.workbook, f.value = [...m.availableSheets], s.value = {}, d.value = [], await ae();
717
- }
718
- async function ae() {
719
- var t, G, B, V, z, J, X, H, $, O, j, K, P, me, ue;
720
- if (!g.value || f.value.length === 0) {
721
- u.value = !0;
722
- return;
723
- }
724
- const m = f.value[0];
725
- try {
726
- switch (m) {
727
- case "unit": {
728
- const W = g.value.Sheets.unit, R = await at(W);
729
- R && (s.value = {
730
- ...s.value,
731
- _invalidExcel: R.invalidExcel || ((t = s.value) == null ? void 0 : t._invalidExcel),
732
- _invalidExcelMessage: R.invalidExcelMessage || ((G = s.value) == null ? void 0 : G._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Units sheet",
733
- units: R.importCreateResult || R.importUpdateResult ? {
734
- create: ((B = R.importCreateResult) == null ? void 0 : B.map((x) => ({
735
- ...x.unit,
736
- errors: x.errors
737
- }))) || [],
738
- update: ((V = R.importUpdateResult) == null ? void 0 : V.map((x) => ({
739
- ...x.unit,
740
- errors: x.errors
741
- }))) || []
742
- } : (z = s.value) == null ? void 0 : z.units
743
- });
744
- break;
745
- }
746
- case "ingredient": {
747
- const W = g.value.Sheets.ingredient, R = await lt(W);
748
- R && (s.value = {
749
- ...s.value,
750
- _invalidExcel: R.invalidExcel || ((J = s.value) == null ? void 0 : J._invalidExcel),
751
- _invalidExcelMessage: R.invalidExcelMessage || ((X = s.value) == null ? void 0 : X._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Ingredients sheet",
752
- skus: R.importCreateResult || R.importUpdateResult ? {
753
- create: ((H = R.importCreateResult) == null ? void 0 : H.map((x) => ({
754
- ...x.sku,
755
- errors: x.errors
756
- }))) || [],
757
- update: (($ = R.importUpdateResult) == null ? void 0 : $.map((x) => ({
758
- ...x.sku,
759
- errors: x.errors
760
- }))) || []
761
- } : (O = s.value) == null ? void 0 : O.skus
762
- });
763
- break;
764
- }
765
- case "recipe": {
766
- const W = g.value.Sheets.recipe, R = await mt(W);
767
- R && (s.value = {
768
- ...s.value,
769
- _invalidExcel: R.invalidExcel || ((j = s.value) == null ? void 0 : j._invalidExcel),
770
- _invalidExcelMessage: R.invalidExcelMessage || ((K = s.value) == null ? void 0 : K._invalidExcelMessage) || e("inventory.common.invalidExcelFormat") + " for Recipes sheet",
771
- recipes: R.importCreateResult || R.importUpdateResult ? {
772
- create: ((P = R.importCreateResult) == null ? void 0 : P.map((x) => ({
773
- ...x.recipe,
774
- errors: x.errors
775
- }))) || [],
776
- update: ((me = R.importUpdateResult) == null ? void 0 : me.map((x) => ({
777
- ...x.recipe,
778
- errors: x.errors
779
- }))) || []
780
- } : (ue = s.value) == null ? void 0 : ue.recipes
781
- });
782
- break;
783
- }
784
- }
785
- f.value.shift(), u.value = !0;
786
- } catch (W) {
787
- console.error(`Error processing ${m} sheet:`, W), y.open({
788
- title: e("inventory.common.processingError"),
789
- message: e("inventory.common.failedToProcessSheet", [m]),
790
- type: "error"
791
- });
792
- }
793
- }
794
- async function be() {
795
- var m, t, G, B, V, z, J, X, H, $, O, j, K, P, me, ue, W, R;
796
- if (s.value) {
797
- if (E.value) {
798
- y.open({
799
- title: e("inventory.common.invalidExcelFormatTitle"),
800
- message: Z.value,
801
- type: "error"
802
- });
803
- return;
804
- }
805
- if (I.value) {
806
- y.open({
807
- title: e("inventory.ingredient.import.error.invalidContent"),
808
- message: e("inventory.ingredient.import.error.hasErrors"),
809
- type: "error"
810
- });
811
- return;
812
- }
813
- l.value = !0;
814
- try {
815
- let x = 0, ne = "";
816
- if (s.value.units && ((m = s.value.units.create) != null && m.length || (t = s.value.units.update) != null && t.length)) {
817
- const M = {
818
- create: re(s.value.units.create),
819
- update: re(s.value.units.update)
820
- };
821
- if (M.create.length || M.update.length) {
822
- const _ = await h.importUnits(M);
823
- ((G = _ == null ? void 0 : _.errors) == null ? void 0 : G.length) > 0 && d.value.push(..._.errors.map((oe) => ({
824
- type: "units",
825
- error: oe
826
- })));
827
- const ee = M.create.length + M.update.length, te = ((B = _ == null ? void 0 : _.errors) == null ? void 0 : B.length) || 0;
828
- x = ee - te, ne = "units", s.value = {
829
- ...s.value,
830
- units: null
831
- };
832
- }
833
- } else if (s.value.skus && ((V = s.value.skus.create) != null && V.length || (z = s.value.skus.update) != null && z.length)) {
834
- const M = {
835
- create: re(s.value.skus.create),
836
- update: re(s.value.skus.update)
837
- };
838
- if (M.create.length || M.update.length) {
839
- const _ = await h.importSkus(M);
840
- ((J = _ == null ? void 0 : _.errors) == null ? void 0 : J.length) > 0 && d.value.push(..._.errors.map((oe) => ({
841
- type: "ingredients",
842
- error: oe
843
- })));
844
- const ee = M.create.length + M.update.length, te = ((X = _ == null ? void 0 : _.errors) == null ? void 0 : X.length) || 0;
845
- x = ee - te, ne = "ingredients", s.value = {
846
- ...s.value,
847
- skus: null
848
- };
849
- }
850
- } else if (s.value.recipes && ((H = s.value.recipes.create) != null && H.length || ($ = s.value.recipes.update) != null && $.length)) {
851
- const M = {
852
- create: re(s.value.recipes.create),
853
- update: re(s.value.recipes.update)
854
- };
855
- if (M.create.length || M.update.length) {
856
- const _ = await h.importRecipes(M);
857
- ((O = _ == null ? void 0 : _.errors) == null ? void 0 : O.length) > 0 && d.value.push(..._.errors.map((oe) => ({
858
- type: "recipes",
859
- error: oe
860
- })));
861
- const ee = M.create.length + M.update.length, te = ((j = _ == null ? void 0 : _.errors) == null ? void 0 : j.length) || 0;
862
- x = ee - te, ne = "recipes", s.value = {
863
- ...s.value,
864
- recipes: null
865
- };
866
- }
867
- }
868
- if (x > 0) {
869
- const M = d.value.filter((_) => _.type === ne);
870
- M.length > 0 ? y.open({
871
- title: e("inventory.common.importCompletedWithIssues"),
872
- message: e("inventory.common.successfullyImported", [x, ne, M.length, ne]),
873
- type: "warning"
874
- }) : y.open({
875
- title: e("inventory.ingredient.import.success"),
876
- message: e("inventory.common.successfullyImported", [x, ne, "0", ""]),
877
- type: "success"
878
- });
879
- }
880
- if (f.value.length > 0)
881
- await ae();
882
- else if (!(s.value.units && (((K = s.value.units.create) == null ? void 0 : K.length) || ((P = s.value.units.update) == null ? void 0 : P.length)) || s.value.skus && (((me = s.value.skus.create) == null ? void 0 : me.length) || ((ue = s.value.skus.update) == null ? void 0 : ue.length)) || s.value.recipes && (((W = s.value.recipes.create) == null ? void 0 : W.length) || ((R = s.value.recipes.update) == null ? void 0 : R.length))))
883
- if (le(), d.value.length > 0) {
884
- const _ = d.value.filter((de) => de.type === "units").length, ee = d.value.filter((de) => de.type === "ingredients").length, te = d.value.filter((de) => de.type === "recipes").length, oe = _ + ee + te;
885
- o.value = !0, y.open({
886
- title: e("inventory.common.importCompletedWithIssues"),
887
- message: e("inventory.common.importFinishedWithFailedItems", [oe, _, ee, te]),
888
- type: "warning"
889
- }), console.error("Import errors:", d.value);
890
- } else
891
- y.open({
892
- title: e("inventory.common.importComplete"),
893
- message: e("inventory.common.allDataSuccessfullyImported"),
894
- type: "success"
895
- });
896
- } catch (x) {
897
- y.open({
898
- title: e("inventory.ingredient.import.error.failed"),
899
- message: (x == null ? void 0 : x.message) || e("inventory.common.unknownErrorOccurred"),
900
- type: "error"
901
- }), console.error("Error during import:", x);
902
- } finally {
903
- l.value = !1;
904
- }
905
- }
906
- }
907
- function le() {
908
- u.value = !1, o.value = !1, s.value = null, f.value = [], g.value = null;
909
- }
910
- function he() {
911
- o.value = !1, d.value = [];
912
- }
913
- function xe() {
914
- c.value = !1, p.value = null;
915
- }
916
- const _e = L(() => [
917
- {
918
- label: e("inventory.common.import"),
919
- value: "import",
920
- isPrimary: !1,
921
- prependIcon: "upload"
922
- }
923
- ]), we = Ue([
924
- {
925
- id: "name",
926
- accessorKey: "name",
927
- header: () => e("inventory.common.name"),
928
- size: 200
929
- },
930
- {
931
- id: "type",
932
- accessorKey: "type",
933
- header: () => e("inventory.common.type"),
934
- size: 120
935
- },
936
- {
937
- id: "operation",
938
- accessorKey: "operation",
939
- header: () => e("inventory.common.operation"),
940
- size: 100
941
- },
942
- {
943
- id: "status",
944
- accessorKey: "status",
945
- header: () => e("inventory.common.status"),
946
- size: 120,
947
- cell: (m) => {
948
- const t = m.row.original.status;
949
- let G = "px-8 py-4 rounded";
950
- return t === e("inventory.common.readyToImport") ? G += " bg-blue-100 text-blue-800 border border-blue-200" : t === "Imported" || t === "Successfully Imported" ? G += " bg-green-100 text-green-800 border border-green-200" : t === "Failed" ? G += " bg-red-100 text-red-800 border border-red-200" : t === e("inventory.common.validationFailed") ? G += " bg-orange-100 text-orange-800 border border-orange-200" : (t.includes("Invalid Excel"), G += " bg-red-100 text-red-800 border border-red-200"), Ie("div", { class: G, title: t }, t);
951
- }
952
- }
953
- ]), Se = Ue([
954
- {
955
- id: "name",
956
- accessorKey: "name",
957
- header: () => e("inventory.common.name"),
958
- cell: (m) => Ie("div", { class: "text-gray-800 text-sm py-2" }, m.row.original.name || e("inventory.common.unknown"))
959
- },
960
- {
961
- id: "type",
962
- accessorKey: "type",
963
- header: () => e("inventory.common.errorType"),
964
- cell: (m) => {
965
- const t = m.row.original.type, G = e(t === "units" ? "inventory.common.unit" : t === "ingredients" ? "inventory.common.ingredient" : t === "recipes" ? "inventory.common.recipe" : "inventory.common.unknown");
966
- return Ie("div", { class: "text-gray-800 text-sm py-2" }, G);
967
- }
968
- },
969
- {
970
- id: "message",
971
- accessorKey: "message",
972
- header: () => e("inventory.common.errorMessage"),
973
- cell: (m) => Ie(
974
- "div",
975
- { class: "text-red-800 text-sm py-2", title: m.row.original.message },
976
- m.row.original.message
977
- )
978
- }
979
- ]);
980
- return (m, t) => {
981
- const G = Q("FmIcon"), B = Q("FmButton"), V = Q("FmTable"), z = Q("FmCard"), J = Q("FmSideSheet"), X = Q("FmSpinner");
982
- return i(b).isLoaded && i(b).enableBulkImport ? (T(), se(ke, {
983
- key: 0,
984
- title: i(e)("inventory.common.import"),
985
- actions: _e.value,
986
- "onClick:action": ye
987
- }, {
988
- default: q(() => {
989
- var H;
990
- return [
991
- n("div", {
992
- class: ce([
993
- "flex flex-col gap-8 max-h-full",
994
- {
995
- "p-0": v.value,
996
- "px-24": !v.value
997
- }
998
- ])
999
- }, [
1000
- u.value ? Y("", !0) : (T(), D("div", _t, [
1001
- n("div", wt, [
1002
- A(G, {
1003
- name: "info",
1004
- class: "text-blue-600 mt-2"
1005
- }),
1006
- n("div", It, [
1007
- n("div", Et, a(i(e)("inventory.ingredient.import.multiUploadTemplateInstruction")), 1),
1008
- n("div", St, [
1009
- n("div", kt, [
1010
- n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
1011
- ]),
1012
- t[39] || (t[39] = C(" 1. ")),
1013
- n("span", {
1014
- innerHTML: i(e)("inventory.ingredient.import.importInstructions.step1")
1015
- }, null, 8, Rt),
1016
- t[40] || (t[40] = n("br", null, null, -1)),
1017
- t[41] || (t[41] = C(" 2. ")),
1018
- n("span", {
1019
- innerHTML: i(e)("inventory.ingredient.import.importInstructions.step2")
1020
- }, null, 8, Ct),
1021
- t[42] || (t[42] = n("br", null, null, -1)),
1022
- C(" 3. " + a(i(e)("inventory.ingredient.import.importInstructions.step3")), 1),
1023
- t[43] || (t[43] = n("br", null, null, -1)),
1024
- C(" 4. " + a(i(e)("inventory.ingredient.import.importInstructions.step4")), 1),
1025
- t[44] || (t[44] = n("br", null, null, -1)),
1026
- t[45] || (t[45] = n("br", null, null, -1)),
1027
- n("div", Ut, [
1028
- n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.title")), 1)
1029
- ]),
1030
- n("div", Gt, [
1031
- n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.title")), 1),
1032
- C(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.description")), 1),
1033
- t[1] || (t[1] = n("br", null, null, -1)),
1034
- t[2] || (t[2] = C(" • ")),
1035
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col1")), 1),
1036
- t[3] || (t[3] = n("br", null, null, -1)),
1037
- t[4] || (t[4] = C(" • ")),
1038
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col2")), 1),
1039
- t[5] || (t[5] = n("br", null, null, -1)),
1040
- t[6] || (t[6] = C(" • ")),
1041
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col3")), 1),
1042
- t[7] || (t[7] = n("br", null, null, -1)),
1043
- t[8] || (t[8] = C(" • ")),
1044
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col4")), 1),
1045
- t[9] || (t[9] = n("br", null, null, -1)),
1046
- t[10] || (t[10] = C(" • ")),
1047
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col5")), 1),
1048
- t[11] || (t[11] = n("br", null, null, -1)),
1049
- t[12] || (t[12] = C(" • ")),
1050
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.unitsSheet.col6")), 1)
1051
- ]),
1052
- n("div", Nt, [
1053
- n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.title")), 1),
1054
- C(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.description")), 1),
1055
- t[13] || (t[13] = n("br", null, null, -1)),
1056
- t[14] || (t[14] = C(" • ")),
1057
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col1")), 1),
1058
- t[15] || (t[15] = n("br", null, null, -1)),
1059
- t[16] || (t[16] = C(" • ")),
1060
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col2")), 1),
1061
- t[17] || (t[17] = n("br", null, null, -1)),
1062
- t[18] || (t[18] = C(" • ")),
1063
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col3")), 1),
1064
- t[19] || (t[19] = n("br", null, null, -1)),
1065
- t[20] || (t[20] = C(" • ")),
1066
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col4")), 1),
1067
- t[21] || (t[21] = n("br", null, null, -1)),
1068
- t[22] || (t[22] = C(" • ")),
1069
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.ingredientsSheet.col5")), 1)
1070
- ]),
1071
- n("div", Tt, [
1072
- n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.title")), 1),
1073
- C(" " + a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.description")), 1),
1074
- t[23] || (t[23] = n("br", null, null, -1)),
1075
- t[24] || (t[24] = C(" • ")),
1076
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col1")), 1),
1077
- t[25] || (t[25] = n("br", null, null, -1)),
1078
- t[26] || (t[26] = C(" • ")),
1079
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col2")), 1),
1080
- t[27] || (t[27] = n("br", null, null, -1)),
1081
- t[28] || (t[28] = C(" • ")),
1082
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col3")), 1),
1083
- t[29] || (t[29] = n("br", null, null, -1)),
1084
- t[30] || (t[30] = C(" • ")),
1085
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col4")), 1),
1086
- t[31] || (t[31] = n("br", null, null, -1)),
1087
- t[32] || (t[32] = C(" • ")),
1088
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col5")), 1),
1089
- t[33] || (t[33] = n("br", null, null, -1)),
1090
- t[34] || (t[34] = C(" • ")),
1091
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col6")), 1),
1092
- t[35] || (t[35] = n("br", null, null, -1)),
1093
- t[36] || (t[36] = C(" • ")),
1094
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col7")), 1),
1095
- t[37] || (t[37] = n("br", null, null, -1)),
1096
- t[38] || (t[38] = C(" • ")),
1097
- n("em", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.recipesSheet.col8")), 1)
1098
- ]),
1099
- n("div", Mt, [
1100
- n("strong", null, a(i(e)("inventory.ingredient.import.importInstructions.detailedGuide.warning")), 1)
1101
- ])
1102
- ])
1103
- ])
1104
- ])
1105
- ])),
1106
- u.value ? (T(), D("div", $t, [
1107
- n("div", Ft, [
1108
- n("div", null, [
1109
- n("div", At, a(i(e)("inventory.common.importPreview")), 1),
1110
- n("div", Dt, [
1111
- E.value ? (T(), D("span", Bt, a(i(e)("inventory.common.errorExist")) + ": " + a(Z.value), 1)) : I.value ? (T(), D("span", Pt, a(i(e)("inventory.common.someItemsValidationErrors")), 1)) : (T(), D("span", jt, a(i(e)("inventory.common.allItemsValidReadyImport")), 1))
1112
- ])
1113
- ]),
1114
- n("div", Ot, [
1115
- A(B, {
1116
- variant: "secondary",
1117
- onClick: le,
1118
- label: i(e)("inventory.common.cancel")
1119
- }, null, 8, ["label"]),
1120
- A(B, {
1121
- variant: "primary",
1122
- onClick: be,
1123
- loading: l.value,
1124
- disabled: l.value || I.value || E.value,
1125
- label: i(e)("inventory.common.import")
1126
- }, null, 8, ["loading", "disabled", "label"])
1127
- ])
1128
- ]),
1129
- n("div", Ht, [
1130
- A(V, {
1131
- "column-defs": we.value,
1132
- "row-data": N.value,
1133
- "page-size": w.value,
1134
- "search-value": r.value,
1135
- loading: !1,
1136
- "row-hover": ""
1137
- }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
1138
- ])
1139
- ])) : Y("", !0),
1140
- o.value && d.value.length > 0 ? (T(), D("div", zt, [
1141
- n("div", Kt, [
1142
- n("div", null, [
1143
- n("div", Vt, a(i(e)("inventory.common.importErrors")), 1),
1144
- n("div", Wt, a(d.value.length) + " " + a(i(e)("inventory.common.itemsFailedImport")), 1)
1145
- ]),
1146
- n("div", Lt, [
1147
- A(B, {
1148
- variant: "secondary",
1149
- onClick: he,
1150
- label: i(e)("inventory.common.close")
1151
- }, null, 8, ["label"])
1152
- ])
1153
- ]),
1154
- n("div", Jt, [
1155
- A(V, {
1156
- "column-defs": Se.value,
1157
- "row-data": ve.value,
1158
- "page-size": w.value,
1159
- "search-value": r.value,
1160
- loading: !1,
1161
- "row-hover": ""
1162
- }, null, 8, ["column-defs", "row-data", "page-size", "search-value"])
1163
- ])
1164
- ])) : Y("", !0)
1165
- ], 2),
1166
- A(J, {
1167
- "model-value": c.value,
1168
- "onUpdate:modelValue": t[0] || (t[0] = ($) => c.value = $),
1169
- header: `${(H = p.value) == null ? void 0 : H.type} Details`,
1170
- "max-width": 600,
1171
- "dismiss-away": ""
1172
- }, {
1173
- "side-sheet-footer": q(() => [
1174
- n("div", yn, [
1175
- A(B, {
1176
- label: i(e)("inventory.common.close"),
1177
- variant: "tertiary",
1178
- onClick: xe
1179
- }, null, 8, ["label"])
1180
- ])
1181
- ]),
1182
- default: q(() => [
1183
- p.value != null ? (T(), D("div", Xt, [
1184
- A(z, {
1185
- variant: "outlined",
1186
- class: "p-16"
1187
- }, {
1188
- default: q(() => {
1189
- var $, O, j, K, P;
1190
- return [
1191
- n("div", qt, a(i(e)("inventory.common.basicInformation")), 1),
1192
- n("div", Qt, [
1193
- n("div", null, [
1194
- n("div", Yt, a(i(e)("inventory.common.name")), 1),
1195
- n("div", Zt, a(((O = ($ = p.value) == null ? void 0 : $.details) == null ? void 0 : O.name) || ((j = p.value) == null ? void 0 : j.name)), 1)
1196
- ]),
1197
- (P = (K = p.value) == null ? void 0 : K.details) != null && P.code ? (T(), D("div", en, [
1198
- n("div", tn, a(i(e)("inventory.common.code")), 1),
1199
- n("div", nn, a(p.value.details.code), 1)
1200
- ])) : Y("", !0),
1201
- n("div", null, [
1202
- n("div", on, a(i(e)("inventory.common.type")), 1),
1203
- n("div", rn, a(p.value.type), 1)
1204
- ]),
1205
- n("div", null, [
1206
- n("div", sn, a(i(e)("inventory.common.operation")), 1),
1207
- n("div", an, a(p.value.operation), 1)
1208
- ]),
1209
- n("div", null, [
1210
- n("div", ln, a(i(e)("inventory.common.status")), 1),
1211
- n("div", {
1212
- class: ce([
1213
- "inline-block px-8 py-4 rounded text-sm",
1214
- p.value.status !== i(e)("inventory.common.readyToImport") ? "bg-red-100 text-red-800 border border-red-200" : "bg-green-100 text-green-800 border border-green-200"
1215
- ])
1216
- }, a(p.value.status), 3)
1217
- ])
1218
- ])
1219
- ];
1220
- }),
1221
- _: 1
1222
- }),
1223
- p.value.errors && p.value.errors.length > 0 ? (T(), se(z, {
1224
- key: 0,
1225
- variant: "outlined",
1226
- class: "p-16"
1227
- }, {
1228
- default: q(() => [
1229
- n("div", mn, a(i(e)("inventory.common.validationErrors")), 1),
1230
- n("div", un, [
1231
- (T(!0), D(Me, null, $e(p.value.errors, ($, O) => (T(), D("div", {
1232
- key: O,
1233
- class: "flex items-start gap-8 p-12 bg-red-50 border border-red-200 rounded"
1234
- }, [
1235
- A(G, {
1236
- name: "error",
1237
- class: "text-red-600 mt-2",
1238
- size: "sm"
1239
- }),
1240
- n("div", dn, a($), 1)
1241
- ]))), 128))
1242
- ])
1243
- ]),
1244
- _: 1
1245
- })) : Y("", !0),
1246
- A(z, {
1247
- variant: "outlined",
1248
- class: "p-16"
1249
- }, {
1250
- default: q(() => [
1251
- n("div", cn, a(i(e)("inventory.common.rawData")), 1),
1252
- n("div", pn, [
1253
- n("pre", vn, a(JSON.stringify(p.value.details, null, 2)), 1)
1254
- ])
1255
- ]),
1256
- _: 1
1257
- })
1258
- ])) : Y("", !0)
1259
- ]),
1260
- _: 1
1261
- }, 8, ["model-value", "header"])
1262
- ];
1263
- }),
1264
- _: 1
1265
- }, 8, ["title", "actions"])) : i(b).isLoaded ? (T(), se(ke, {
1266
- key: 2,
1267
- title: i(e)("inventory.common.import")
1268
- }, {
1269
- default: q(() => [
1270
- n("div", hn, [
1271
- A(G, {
1272
- name: "block",
1273
- class: "text-gray-400",
1274
- size: "xl"
1275
- }),
1276
- n("div", xn, [
1277
- n("div", _n, a(i(e)("inventory.common.featureNotAvailable")), 1),
1278
- n("div", wn, a(i(e)("inventory.common.bulkImportNotEnabled")), 1)
1279
- ])
1280
- ])
1281
- ]),
1282
- _: 1
1283
- }, 8, ["title"])) : (T(), se(ke, {
1284
- key: 1,
1285
- title: i(e)("inventory.common.import")
1286
- }, {
1287
- default: q(() => [
1288
- n("div", gn, [
1289
- A(X, { size: "lg" }),
1290
- n("div", fn, [
1291
- n("div", bn, a(i(e)("inventory.common.loading")), 1)
1292
- ])
1293
- ])
1294
- ]),
1295
- _: 1
1296
- }, 8, ["title"]));
1297
- };
1298
- }
1299
- });
1300
- export {
1301
- Dn as default
1302
- };