@feedmepos/mf-inventory-portal 0.0.23-dev.9 → 0.0.24-dev.1

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 (140) hide show
  1. package/dist/App-D3sNH2MR.js +276 -0
  2. package/dist/{ApprovalView-e85YmdZN.js → ApprovalView-DHnRx0hJ.js} +17 -20
  3. package/dist/{BindingsDialog-giBUD0IH.js → BindingsDialog-oTeg2Dai.js} +6 -6
  4. package/dist/{BindingsPicker-CC4MmPbF.js → BindingsPicker-CWdjmMJ3.js} +8 -9
  5. package/dist/{BindingsTable-WphZdzrA.js → BindingsTable-bKLR1OKX.js} +18 -22
  6. package/dist/ClosingDraftView-CIQVz7lY.js +1225 -0
  7. package/dist/{ClosingTemplateView-1lzoDyet.js → ClosingTemplateView-D5pLzQwU.js} +259 -274
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-ClLDcchC.js +142 -0
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cv-vvzr5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_c6Vn6P.js} +23 -24
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DIFQcrc0.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DhpHOaRH.js} +50 -51
  11. package/dist/{IngredientGroupView-UegBM_JK.js → IngredientGroupView-4C437mso.js} +63 -70
  12. package/dist/IngredientsView-DoiGgjre.js +1706 -0
  13. package/dist/{IntegrationView-FYNNzKia.js → IntegrationView-8ZKE7MAM.js} +123 -126
  14. package/dist/{InventoryBindingForm-DsHv_IHG.js → InventoryBindingForm-CcnfliYQ.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BURSXafS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B_J-6C9x.js} +116 -108
  16. package/dist/{InventoryBindingSummary-BLb4MRPZ.js → InventoryBindingSummary-CRdHCzNE.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BG78-DHs.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B2-TypU0.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CqID5_7v.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BuQde75S.js} +20 -21
  19. package/dist/PublishView-t5gjGmK_.js +192 -0
  20. package/dist/{PurchaseOrderPrintPreview-BBMU3teq.js → PurchaseOrderPrintPreview-6i53Y-v1.js} +13 -14
  21. package/dist/ReceiveRequestView-uOeSh0Mr.js +1866 -0
  22. package/dist/RecipeView-BTWywckD.js +609 -0
  23. package/dist/StockView-DN2xk8ei.js +1817 -0
  24. package/dist/{SupplierView-B2aObtwK.js → SupplierView-l0XUg3J4.js} +185 -196
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CWMn6fFf.js +1327 -0
  26. package/dist/TransferTemplateView-wDKXpCWZ.js +1263 -0
  27. package/dist/UnitView-CUI-k-tS.js +648 -0
  28. package/dist/{WarehouseView-G8pej6Y2.js → WarehouseView-WsI_eG5r.js} +190 -197
  29. package/dist/api/adjustment-template.d.ts +25 -0
  30. package/dist/api/bill.d.ts +240 -84
  31. package/dist/api/inventory.d.ts +19 -6
  32. package/dist/api/netsuite.d.ts +3 -3
  33. package/dist/app-DntcWR3_.js +85558 -0
  34. package/dist/app.d.ts +85 -0
  35. package/dist/app.js +2 -2
  36. package/dist/components/FmCustomAttribute.vue.d.ts +23 -0
  37. package/dist/components/FmLockableField.vue.d.ts +37 -0
  38. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +3 -1
  40. package/dist/components/shell/inventory/binding-ui.vue.d.ts +3 -1
  41. package/dist/composable/defineDeepModel.d.ts +1 -1
  42. package/dist/{decimal-DC07xoJW.js → decimal-DTCTnMwO.js} +1 -1
  43. package/dist/format-unit-display-Hy48Iw5j.js +1215 -0
  44. package/dist/index-Bv9RYyTZ.js +29202 -0
  45. package/dist/{StockView-C5btudss.js → index-D4yJP9I2.js} +2220 -3863
  46. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
  47. package/dist/router/name.d.ts +2 -0
  48. package/dist/stock-BsdmfT-b.js +125 -0
  49. package/dist/stores/feature.d.ts +41 -1
  50. package/dist/stores/integration/netsuite.d.ts +3 -2
  51. package/dist/stores/inventory.d.ts +20 -8
  52. package/dist/stores/location.d.ts +29 -1
  53. package/dist/stores/supplier.d.ts +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist/supplier-CXhkgC4M.js +77 -0
  56. package/dist/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/{use-inventory-binding-dialog-B0G2XYSw.js → use-inventory-binding-dialog-DPMJmBCr.js} +10 -11
  58. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
  59. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
  60. package/dist/views/adjustment-template/import/export.d.ts +60 -0
  61. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
  62. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
  63. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
  64. package/dist/views/adjustment-template/wastage-template/WastageTemplateReason.vue.d.ts +18 -0
  65. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
  66. package/dist/views/adjustment-template/wastage-template/actions.d.ts +1377 -0
  67. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
  68. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
  69. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
  70. package/dist/views/adjustment-template/wastage-template/props.d.ts +36 -0
  71. package/dist/views/adjustment-template/wastage-template/table.d.ts +1351 -0
  72. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +198 -12
  73. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +7 -4
  74. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1559 -467
  75. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
  76. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
  77. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +2 -1
  78. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +72 -12
  79. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +73 -13
  80. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -3
  81. package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +1 -0
  82. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -2
  83. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +1 -0
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +2 -1
  85. package/dist/views/publish/PublishView.vue.d.ts +2 -0
  86. package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
  87. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
  88. package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
  89. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +13 -0
  90. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +86 -17
  92. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -2
  93. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -1
  94. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +126 -24
  95. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +126 -24
  96. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -0
  97. package/dist/views/stock/components/StockRecordCard.vue.d.ts +120 -42
  98. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  99. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  100. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -0
  101. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -1
  102. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -12
  103. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -12
  104. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +2 -1
  105. package/dist/vue-i18n-ByVzHsI7.js +2365 -0
  106. package/package.json +5 -4
  107. package/dist/App-ByLgARNp.js +0 -259
  108. package/dist/ClosingDraftView-CQM1Sx45.js +0 -755
  109. package/dist/FmDroppableField-8RzKjEdL.js +0 -154
  110. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BvkN-71q.js +0 -436
  111. package/dist/FmMultiselectDialog-DScMA6iG.js +0 -415
  112. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-t4pim_k9.js +0 -51
  113. package/dist/IngredientsView-BfW-jZLM.js +0 -1666
  114. package/dist/ReceiveRequestView-vbANEzne.js +0 -4165
  115. package/dist/RecipeView-DW4DY0C0.js +0 -598
  116. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
  117. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B2LOvVef.js +0 -1229
  118. package/dist/TransferTemplateView-BKumN_p6.js +0 -1262
  119. package/dist/UnitView-CHLucv9s.js +0 -648
  120. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  121. package/dist/app-BXjk74IB.js +0 -33538
  122. package/dist/date2-CWAt9bRf.js +0 -117
  123. package/dist/dayjs.min-D3jPOnu6.js +0 -282
  124. package/dist/defineDeepModel-CiD4GtOw.js +0 -13
  125. package/dist/feature-6tcLMotY.js +0 -92
  126. package/dist/form-mode.enum-BKiNVH6A.js +0 -4
  127. package/dist/format-time-from-id-CYU5Z9Mt.js +0 -15
  128. package/dist/format-unit-display-CY-0bznr.js +0 -1217
  129. package/dist/fuzzy-BMkhNYLR.js +0 -41
  130. package/dist/index-BXwQa14X.js +0 -45
  131. package/dist/index-CRLd5xyg.js +0 -22283
  132. package/dist/index-DqwAtOgI.js +0 -12087
  133. package/dist/netsuite-fYUUk_ss.js +0 -225
  134. package/dist/row-action.enum-7rGLGZ5v.js +0 -55
  135. package/dist/rules-BmRGm3yv.js +0 -203
  136. package/dist/stock-CEX0DP2B.js +0 -111
  137. package/dist/supplier-CdJmZr7w.js +0 -77
  138. package/dist/use-template-enabled-locations-2-xbPJWHCs.js +0 -86
  139. package/dist/xlsx-CTOKp7SQ.js +0 -24004
  140. package/dist/xlsx.util-D5NFSfDg.js +0 -78
@@ -0,0 +1,648 @@
1
+ import { defineComponent as H, computed as g, openBlock as v, createElementBlock as C, createElementVNode as l, Fragment as j, renderList as q, toDisplayString as V, createCommentVNode as Y, ref as M, resolveComponent as $, createBlock as T, withCtx as A, createVNode as y, unref as o, isRef as ee, normalizeClass as re, normalizeStyle as ie, Teleport as ue, normalizeProps as de, guardReactiveProps as me } from "vue";
2
+ import { a as G, e as w, S as ce, h as pe, D as te, i as L, f as le, m as N, A as fe, j as J, L as ve, N as ye, p as ne, u as be, b as ge, z as xe, _ as _e, B as he, E as Ve, G as Ue } from "./app-DntcWR3_.js";
3
+ import { useDialog as we, useSnackbar as se, useProxiedModel as oe, useBreakpoints as Ce } from "@feedmepos/ui-library";
4
+ import { i as Se, _ as ke } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
+ import { defineStore as Ee, storeToRefs as Fe } from "pinia";
6
+ import { useI18n as K } from "@feedmepos/mf-common";
7
+ import { F as $e } from "./decimal-DTCTnMwO.js";
8
+ import { _ as Ie } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B2-TypU0.js";
9
+ const De = { class: "flex flex-col gap-8" }, Ae = {
10
+ key: 0,
11
+ class: "flex flex-col"
12
+ }, Re = { class: "flex-1 py-8 px-16" }, Me = {
13
+ class: "flex-0 py-8 px-16",
14
+ style: { "flex-basis": "240px" }
15
+ }, Pe = {
16
+ key: 1,
17
+ class: "flex flex-col"
18
+ }, Te = { class: "flex-1 py-8 px-16" }, Be = {
19
+ class: "flex-0 py-8 px-16",
20
+ style: { "flex-basis": "240px" }
21
+ }, ze = {
22
+ key: 2,
23
+ class: "flex flex-col"
24
+ }, Le = { class: "flex-1 py-8 px-16" }, Ne = {
25
+ class: "flex-0 py-8 px-16",
26
+ style: { "flex-basis": "240px" }
27
+ }, je = /* @__PURE__ */ H({
28
+ __name: "UnitUsedBy",
29
+ props: {
30
+ unit: {}
31
+ },
32
+ setup(k) {
33
+ const f = k, b = G(), i = g(() => b.validateUnitUsage(f.unit)), r = g(() => i.value.filter((c) => c.from === "INGREDIENT")), s = g(() => i.value.filter((c) => c.from === "RECIPE")), d = g(() => i.value.filter((c) => c.from === "MENU"));
34
+ return (c, p) => (v(), C("div", De, [
35
+ p[3] || (p[3] = l("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
36
+ r.value.length ? (v(), C("div", Ae, [
37
+ p[0] || (p[0] = l("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
38
+ l("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
39
+ l("div", {
40
+ class: "flex-0 py-8 px-16",
41
+ style: { "flex-basis": "240px" }
42
+ }, "Used in")
43
+ ], -1)),
44
+ (v(!0), C(j, null, q(r.value, (a) => {
45
+ var n;
46
+ return v(), C("div", {
47
+ key: a.code,
48
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
49
+ }, [
50
+ l("div", Re, V(a.code) + " " + V(a.name), 1),
51
+ l("div", Me, V((n = a.bindedIngredient) != null && n.length ? "Convert binding" : "Item unit"), 1)
52
+ ]);
53
+ }), 128))
54
+ ])) : Y("", !0),
55
+ s.value.length ? (v(), C("div", Pe, [
56
+ p[1] || (p[1] = l("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
57
+ l("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
58
+ l("div", {
59
+ class: "flex-0 py-8 px-16",
60
+ style: { "flex-basis": "240px" }
61
+ }, "Used in")
62
+ ], -1)),
63
+ (v(!0), C(j, null, q(s.value, (a) => {
64
+ var n, u, x;
65
+ return v(), C("div", {
66
+ key: a.code,
67
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
68
+ }, [
69
+ l("div", Te, V(a.code) + " " + V(a.name), 1),
70
+ l("div", Be, V((n = a.bindedIngredient) == null ? void 0 : n.slice(0, 3).map((_) => _.code).join(", ")) + " " + V(a.bindedIngredient && ((u = a.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((x = a.bindedIngredient) == null ? void 0 : x.length) - 3} more` : ""), 1)
71
+ ]);
72
+ }), 128))
73
+ ])) : Y("", !0),
74
+ d.value.length ? (v(), C("div", ze, [
75
+ p[2] || (p[2] = l("div", { class: "flex flex-row fm-typo-en-body-md-600 bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary h-48 items-center" }, [
76
+ l("div", { class: "flex-1 py-8 px-16" }, "Menu"),
77
+ l("div", {
78
+ class: "flex-0 py-8 px-16",
79
+ style: { "flex-basis": "240px" }
80
+ }, "Used in")
81
+ ], -1)),
82
+ (v(!0), C(j, null, q(d.value, (a) => {
83
+ var n, u, x;
84
+ return v(), C("div", {
85
+ key: a.code,
86
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
87
+ }, [
88
+ l("div", Le, V(a.code) + " " + V(a.name), 1),
89
+ l("div", Ne, V((n = a.bindedIngredient) == null ? void 0 : n.slice(0, 3).map((_) => _.code).join(", ")) + " " + V(a.bindedIngredient && ((u = a.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((x = a.bindedIngredient) == null ? void 0 : x.length) - 3} more` : ""), 1)
90
+ ]);
91
+ }), 128))
92
+ ])) : Y("", !0)
93
+ ]));
94
+ }
95
+ }), Q = Ee("unitForm", function() {
96
+ const f = we(), b = se(), i = G(), r = M(!1), s = M();
97
+ function d() {
98
+ const n = {
99
+ unit: {},
100
+ mode: w.CREATE,
101
+ show: !0,
102
+ "onUpdate:show"(u) {
103
+ s.value.show = u;
104
+ }
105
+ };
106
+ s.value = n;
107
+ }
108
+ async function c(n) {
109
+ const u = {
110
+ unit: n,
111
+ mode: w.UPDATE,
112
+ show: !0,
113
+ "onUpdate:show"(x) {
114
+ s.value.show = x;
115
+ }
116
+ };
117
+ s.value = u;
118
+ }
119
+ async function p(n) {
120
+ r.value = !0;
121
+ try {
122
+ await i.deleteUnit(n), b.open({
123
+ title: "Success",
124
+ message: `Deleted ${n.name}`,
125
+ type: "success"
126
+ });
127
+ } catch (u) {
128
+ u instanceof ce && Se(u) ? f.open({
129
+ title: "Cannot delete unit",
130
+ contentComponent: ke,
131
+ contentComponentProps: {
132
+ subject: (n == null ? void 0 : n.name) ?? "",
133
+ items: u.errorResponse.message
134
+ },
135
+ secondaryActions: {
136
+ text: "Close",
137
+ close: !0
138
+ }
139
+ }) : console.log("unable to delete unit", u), b.open({
140
+ title: `Cannot delete ${n.name}`,
141
+ message: "Please try again.",
142
+ type: "error"
143
+ }), console.error("failed to delete unit", u);
144
+ } finally {
145
+ r.value = !1;
146
+ }
147
+ }
148
+ function a(n) {
149
+ if (i.validateUnitUsage(n).length) {
150
+ f.open({
151
+ title: `Cannot delete ${(n == null ? void 0 : n.name) ?? "unit"}`,
152
+ overlay: !0,
153
+ dismissAway: !0,
154
+ closeButton: !0,
155
+ contentComponent: je,
156
+ contentComponentProps: {
157
+ unit: n
158
+ },
159
+ primaryActions: {
160
+ text: "Confirm",
161
+ close: !0
162
+ }
163
+ });
164
+ return;
165
+ }
166
+ f.open({
167
+ title: `Delete ${(n == null ? void 0 : n.name) ?? "unit"}?`,
168
+ closeButton: !1,
169
+ message: "You may not be able to delete this unit if it is linked in any of the inventory modules.",
170
+ primaryActions: {
171
+ text: "Delete",
172
+ close: !0,
173
+ variant: "destructive"
174
+ },
175
+ secondaryActions: {
176
+ text: "Cancel",
177
+ close: !0
178
+ }
179
+ }).onPrimary(() => p(n));
180
+ }
181
+ return {
182
+ createUnit: d,
183
+ updateUnit: c,
184
+ deleteUnit: a,
185
+ unitDialogProps: s,
186
+ unitViewLoading: r
187
+ };
188
+ });
189
+ function qe() {
190
+ const { updateUnit: k, deleteUnit: f } = Q(), { t: b } = K();
191
+ async function i(s, d) {
192
+ const c = le(d);
193
+ if (s === L.Edit) {
194
+ await k(c);
195
+ return;
196
+ }
197
+ if (s === L.Delete) {
198
+ await f(c);
199
+ return;
200
+ }
201
+ }
202
+ return { columnDefs: [
203
+ {
204
+ accessorKey: "name",
205
+ header: b("inventory.unit.table.name"),
206
+ enableSorting: !0,
207
+ size: 300
208
+ },
209
+ {
210
+ accessorKey: "abbrev",
211
+ header: b("inventory.unit.table.symbol"),
212
+ enableSorting: !1,
213
+ size: "auto"
214
+ },
215
+ {
216
+ id: "action",
217
+ header: "",
218
+ cell(s) {
219
+ return pe(
220
+ [te[L.Edit], te[L.Delete]],
221
+ (d) => {
222
+ i(d, s.row.original);
223
+ }
224
+ );
225
+ },
226
+ enableSorting: !1,
227
+ size: 40,
228
+ meta: {
229
+ cellClass: "",
230
+ headerClass: ""
231
+ }
232
+ }
233
+ ] };
234
+ }
235
+ const He = { class: "flex flex-col gap-24" }, Ge = { class: "flex gap-24" }, Ke = { class: "flex-1" }, Oe = { class: "flex-1" }, Ye = { class: "flex" }, Je = { class: "flex items-center" }, Qe = { class: "fm-typo-en-body-lg-600 flex-grow" }, We = { class: "flex flex-col gap-24" }, Xe = { class: "flex gap-24" }, Ze = { class: "flex-1" }, et = { class: "flex-1" }, tt = /* @__PURE__ */ H({
236
+ __name: "UnitForm",
237
+ props: {
238
+ mode: {},
239
+ modelValue: {},
240
+ disabled: { type: Boolean }
241
+ },
242
+ emits: ["update:modelValue", "click:submit"],
243
+ setup(k, { expose: f, emit: b }) {
244
+ const i = k, r = b, { t: s } = K();
245
+ function d() {
246
+ r("click:submit");
247
+ }
248
+ const c = g({
249
+ get() {
250
+ var e;
251
+ return ((e = i.modelValue) == null ? void 0 : e.name) ?? "";
252
+ },
253
+ set(e) {
254
+ const t = i.modelValue ?? {};
255
+ t.name = e, r("update:modelValue", t);
256
+ }
257
+ }), p = g({
258
+ get() {
259
+ var e;
260
+ return ((e = i.modelValue) == null ? void 0 : e.abbrev) ?? "";
261
+ },
262
+ set(e) {
263
+ const t = i.modelValue ?? {};
264
+ t.abbrev = e, r("update:modelValue", t);
265
+ }
266
+ }), a = g({
267
+ get() {
268
+ var e;
269
+ return ((e = i.modelValue) == null ? void 0 : e.precision) ?? 0;
270
+ },
271
+ set(e) {
272
+ const t = i.modelValue ?? {};
273
+ t.precision = e, r("update:modelValue", t);
274
+ }
275
+ }), n = g({
276
+ get() {
277
+ var e;
278
+ return ((e = i.modelValue) == null ? void 0 : e.measurements) ?? [];
279
+ },
280
+ set(e) {
281
+ const t = i.modelValue ?? {};
282
+ t.measurements = e, r("update:modelValue", t);
283
+ }
284
+ });
285
+ function u() {
286
+ const e = i.modelValue ?? {}, t = e.measurements ?? [];
287
+ e.measurements = [
288
+ ...t,
289
+ {
290
+ id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
291
+ name: "",
292
+ abbrev: "",
293
+ conversion: {
294
+ amount: 1,
295
+ precision: 0
296
+ }
297
+ }
298
+ ], r("update:modelValue", e);
299
+ }
300
+ function x(e) {
301
+ const t = i.modelValue ?? {}, m = t.measurements ?? [];
302
+ m.splice(e, 1), t.measurements = m, r("update:modelValue", t);
303
+ }
304
+ const _ = M();
305
+ return f({
306
+ validateInputs: () => {
307
+ var e, t;
308
+ (t = (e = _.value) == null ? void 0 : e.validateInputs) == null || t.call(e);
309
+ },
310
+ resetInputsValidation: () => {
311
+ var e, t;
312
+ (t = (e = _.value) == null ? void 0 : e.resetInputsValidation) == null || t.call(e);
313
+ },
314
+ resetInputs: () => {
315
+ var e, t;
316
+ (t = (e = _.value) == null ? void 0 : e.resetInputs) == null || t.call(e);
317
+ }
318
+ }), (e, t) => {
319
+ const m = $("FmTextField"), I = $("FmStepperField"), D = $("FmButton"), U = $("FmCard"), O = $("FmForm");
320
+ return v(), T(O, {
321
+ ref_key: "formRef",
322
+ ref: _,
323
+ class: "flex flex-col gap-40",
324
+ onValidationSuccess: d
325
+ }, {
326
+ default: A(() => {
327
+ var E;
328
+ return [
329
+ l("div", He, [
330
+ l("div", Ge, [
331
+ l("div", Ke, [
332
+ y(m, {
333
+ disabled: e.disabled,
334
+ label: o(s)("inventory.unit.name"),
335
+ modelValue: c.value,
336
+ "onUpdate:modelValue": t[0] || (t[0] = (S) => c.value = S),
337
+ rules: [o(N)()],
338
+ "label-mark": "required"
339
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
340
+ ]),
341
+ l("div", Oe, [
342
+ y(m, {
343
+ disabled: e.disabled,
344
+ label: o(s)("inventory.unit.symbol"),
345
+ modelValue: p.value,
346
+ "onUpdate:modelValue": t[1] || (t[1] = (S) => p.value = S),
347
+ rules: [o(N)()],
348
+ "label-mark": "required"
349
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
350
+ ])
351
+ ]),
352
+ l("div", null, [
353
+ y(I, {
354
+ disabled: e.disabled,
355
+ class: "col-span-3",
356
+ label: o(s)("inventory.unit.precision"),
357
+ modelValue: a.value,
358
+ "onUpdate:modelValue": t[2] || (t[2] = (S) => a.value = S),
359
+ rules: [o(fe)(0)]
360
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
361
+ ])
362
+ ]),
363
+ l("div", Ye, [
364
+ y(D, {
365
+ disabled: e.disabled,
366
+ type: "button",
367
+ "prepend-icon": "add",
368
+ label: o(s)("inventory.unit.measurement.addMeasurement"),
369
+ variant: "plain",
370
+ onClick: u
371
+ }, null, 8, ["disabled", "label"])
372
+ ]),
373
+ (v(!0), C(j, null, q((E = e.modelValue) == null ? void 0 : E.measurements, (S, h) => (v(), T(U, {
374
+ class: "flex flex-col gap-16 p-16",
375
+ variant: "outlined",
376
+ key: S.id
377
+ }, {
378
+ default: A(() => [
379
+ l("div", Je, [
380
+ l("div", Qe, V(o(s)("inventory.unit.measurement.measurementDefault", [h + 1])), 1),
381
+ y(D, {
382
+ disabled: e.disabled,
383
+ variant: "tertiary",
384
+ "prepend-icon": "delete",
385
+ onClick: (F) => x(h)
386
+ }, null, 8, ["disabled", "onClick"])
387
+ ]),
388
+ l("div", We, [
389
+ l("div", Xe, [
390
+ l("div", Ze, [
391
+ y(m, {
392
+ disabled: e.disabled,
393
+ class: "col-span-2",
394
+ label: o(s)("inventory.unit.measurement.name"),
395
+ modelValue: e.modelValue.measurements[h].name,
396
+ "onUpdate:modelValue": (F) => e.modelValue.measurements[h].name = F,
397
+ rules: [o(N)()],
398
+ "label-mark": "required"
399
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
400
+ ]),
401
+ l("div", et, [
402
+ y(m, {
403
+ disabled: e.disabled,
404
+ label: o(s)("inventory.unit.measurement.symbol"),
405
+ modelValue: e.modelValue.measurements[h].abbrev,
406
+ "onUpdate:modelValue": (F) => e.modelValue.measurements[h].abbrev = F,
407
+ rules: [o(N)()],
408
+ "label-mark": "required"
409
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
410
+ ])
411
+ ]),
412
+ y(Ie, {
413
+ disabled: e.disabled,
414
+ class: "col-span-3",
415
+ label: o(s)("inventory.unit.measurement.conversion"),
416
+ "model-value": +o(J)(e.modelValue.measurements[h].conversion),
417
+ "onUpdate:modelValue": (F) => n.value = n.value.map(
418
+ (P, R) => R === h ? {
419
+ ...P,
420
+ conversion: o($e).toPrecision(
421
+ o(ve)(F),
422
+ a.value
423
+ )
424
+ } : P
425
+ ),
426
+ rules: [o(ye)(0)],
427
+ step: +o(J)({ amount: 1, precision: a.value }),
428
+ "helper-text": o(s)("inventory.unit.measurement.conversionHelper", {
429
+ measurementSymbol: e.modelValue.measurements[h].name || " measurement unit",
430
+ conversion: +o(J)(e.modelValue.measurements[h].conversion),
431
+ unitSymbol: p.value || "base unit"
432
+ })
433
+ }, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
434
+ ])
435
+ ]),
436
+ _: 2
437
+ }, 1024))), 128))
438
+ ];
439
+ }),
440
+ _: 1
441
+ }, 512);
442
+ };
443
+ }
444
+ }), nt = { class: "flex gap-4" }, ot = /* @__PURE__ */ H({
445
+ __name: "UnitDialog",
446
+ props: {
447
+ show: { type: Boolean },
448
+ unit: {},
449
+ mode: { default: w.READ }
450
+ },
451
+ emits: ["update:show"],
452
+ setup(k) {
453
+ const f = k, b = G(), i = se(), { t: r } = K(), s = oe(f, "show"), d = oe(f, "unit"), c = g(() => {
454
+ switch (f.mode) {
455
+ case w.READ:
456
+ return "";
457
+ case w.UPDATE:
458
+ return r("inventory.unit.update.title");
459
+ case w.CREATE:
460
+ return r("inventory.unit.create.title");
461
+ }
462
+ return "";
463
+ }), p = g(() => {
464
+ switch (f.mode) {
465
+ case w.READ:
466
+ return "";
467
+ case w.UPDATE:
468
+ return r("common.save");
469
+ case w.CREATE:
470
+ return r("common.add");
471
+ }
472
+ return "";
473
+ }), a = M(), n = M(!1);
474
+ async function u() {
475
+ n.value = !0;
476
+ try {
477
+ const t = le(d.value);
478
+ t.precision ?? (t.precision = 0), t.measurements ?? (t.measurements = []), await b.createUnit(t), s.value = !1, i.open({
479
+ title: r("inventory.common.success"),
480
+ message: r("inventory.unit.create.success", { name: d.value.name }),
481
+ type: "success"
482
+ });
483
+ } catch (t) {
484
+ t instanceof ne || i.open({
485
+ title: r("inventory.unit.create.error.title"),
486
+ message: r("inventory.unit.create.error.message"),
487
+ type: "error"
488
+ });
489
+ } finally {
490
+ n.value = !1;
491
+ }
492
+ }
493
+ async function x() {
494
+ n.value = !0;
495
+ try {
496
+ await b.updateUnit(d.value), s.value = !1, i.open({
497
+ title: r("inventory.common.success"),
498
+ message: r("inventory.unit.update.success", { name: d.value.name }),
499
+ type: "success"
500
+ });
501
+ } catch (t) {
502
+ t instanceof ne || i.open({
503
+ title: r("inventory.unit.update.error.title"),
504
+ message: r("inventory.unit.update.error.message"),
505
+ type: "error"
506
+ });
507
+ } finally {
508
+ n.value = !1;
509
+ }
510
+ }
511
+ function _() {
512
+ var t, m;
513
+ (m = (t = a.value) == null ? void 0 : t.validateInputs) == null || m.call(t);
514
+ }
515
+ function e() {
516
+ switch (f.mode) {
517
+ case w.READ:
518
+ return;
519
+ case w.UPDATE:
520
+ return x();
521
+ case w.CREATE:
522
+ return u();
523
+ }
524
+ }
525
+ return (t, m) => {
526
+ const I = $("FmButton"), D = $("FmSideSheet");
527
+ return v(), T(D, {
528
+ "model-value": o(s),
529
+ "onUpdate:modelValue": m[3] || (m[3] = (U) => ee(s) ? s.value = U : null),
530
+ header: c.value,
531
+ "close-button": "",
532
+ "dismiss-away": "",
533
+ "max-width": 500
534
+ }, {
535
+ "side-sheet-footer": A(() => [
536
+ l("div", nt, [
537
+ y(I, {
538
+ loading: n.value,
539
+ label: p.value,
540
+ onClick: _
541
+ }, null, 8, ["loading", "label"]),
542
+ y(I, {
543
+ disabled: n.value,
544
+ label: o(r)("common.close"),
545
+ variant: "tertiary",
546
+ onClick: m[2] || (m[2] = (U) => s.value = !1)
547
+ }, null, 8, ["disabled", "label"])
548
+ ])
549
+ ]),
550
+ default: A(() => [
551
+ y(tt, {
552
+ class: "w-full",
553
+ ref_key: "hasValidationExpose",
554
+ ref: a,
555
+ modelValue: o(d),
556
+ "onUpdate:modelValue": m[0] || (m[0] = (U) => ee(d) ? d.value = U : null),
557
+ mode: t.mode,
558
+ disabled: n.value,
559
+ "onClick:submit": m[1] || (m[1] = (U) => e())
560
+ }, null, 8, ["modelValue", "mode", "disabled"])
561
+ ]),
562
+ _: 1
563
+ }, 8, ["model-value", "header"]);
564
+ };
565
+ }
566
+ }), lt = { class: "flex flex-col py-8" }, st = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, at = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vt = /* @__PURE__ */ H({
567
+ __name: "UnitView",
568
+ setup(k) {
569
+ const f = G(), b = be(), i = ge(), r = g(() => f.units), { createUnit: s, updateUnit: d } = Q(), { unitDialogProps: c, unitViewLoading: p } = Fe(Q()), { columnDefs: a } = qe();
570
+ function n(D) {
571
+ D === "add" && s();
572
+ }
573
+ const u = M(""), x = g(() => p.value), { breakpoints: _ } = Ce(), e = g(() => _.value.xs || _.value.sm), t = g(() => e.value ? 10 : 20), m = xe(), { t: I } = K();
574
+ return (D, U) => {
575
+ const O = $("FmTable");
576
+ return v(), T(_e, {
577
+ title: o(I)("inventory.unit.title"),
578
+ actions: o(i).isEnabled ? [] : [
579
+ {
580
+ label: o(I)("inventory.unit.create.title"),
581
+ value: "add",
582
+ isPrimary: !0,
583
+ prependIcon: "add"
584
+ }
585
+ ],
586
+ "onClick:action": n
587
+ }, {
588
+ default: A(() => [
589
+ l("div", {
590
+ class: re([
591
+ "flex flex-col gap-8 max-h-full",
592
+ {
593
+ "p-0": e.value,
594
+ "px-24 ": !e.value
595
+ }
596
+ ])
597
+ }, [
598
+ y(he, {
599
+ searchable: "",
600
+ search: u.value,
601
+ "onUpdate:search": U[0] || (U[0] = (E) => u.value = E)
602
+ }, null, 8, ["search"]),
603
+ y(O, {
604
+ style: ie(o(m).tableHeight),
605
+ "column-defs": o(a),
606
+ "row-data": r.value,
607
+ "search-value": u.value,
608
+ loading: !o(b)._currentLocation || x.value,
609
+ onRowClick: U[1] || (U[1] = (E) => o(d)(E.original)),
610
+ "page-size": t.value
611
+ }, {
612
+ "list-row": A((E) => [
613
+ y(Ve, {
614
+ row: E,
615
+ onRowClick: o(d)
616
+ }, {
617
+ default: A((S) => {
618
+ var h, F, P, R, W, B, X, z, Z;
619
+ return [
620
+ l("div", lt, [
621
+ l("div", st, [
622
+ y(o(Ue), {
623
+ render: (P = (F = (h = S.name) == null ? void 0 : h.column) == null ? void 0 : F.columnDef) == null ? void 0 : P.cell,
624
+ props: (W = (R = S.name) == null ? void 0 : R.getContext) == null ? void 0 : W.call(R)
625
+ }, null, 8, ["render", "props"])
626
+ ]),
627
+ l("div", at, V((Z = (z = (X = (B = E.original.measurements) == null ? void 0 : B.map) == null ? void 0 : X.call(B, (ae) => ae.name)) == null ? void 0 : z.join) == null ? void 0 : Z.call(z, ", ")), 1)
628
+ ])
629
+ ];
630
+ }),
631
+ _: 2
632
+ }, 1032, ["row", "onRowClick"])
633
+ ]),
634
+ _: 1
635
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
636
+ ], 2),
637
+ (v(), T(ue, { to: "body" }, [
638
+ y(ot, de(me(o(c))), null, 16)
639
+ ]))
640
+ ]),
641
+ _: 1
642
+ }, 8, ["title", "actions"]);
643
+ };
644
+ }
645
+ });
646
+ export {
647
+ vt as default
648
+ };