@feedmepos/mf-inventory-portal 1.7.15-dev.0 → 1.7.15-dev.2

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 (91) hide show
  1. package/dist/{App-aeh6OigH.js → App-x7EF8_Dx.js} +7 -7
  2. package/dist/{ApprovalView-D9U2VmYa.js → ApprovalView-C8s3yNwt.js} +9 -9
  3. package/dist/{BindingsDialog-Ddh44o3y.js → BindingsDialog--TTDbAdy.js} +2 -2
  4. package/dist/{BindingsPicker-CFtdG6ld.js → BindingsPicker-Xvt0y5oY.js} +2 -2
  5. package/dist/{BindingsTable-Dl44JUUS.js → BindingsTable-BBHM6HO2.js} +4 -4
  6. package/dist/{BulkReceiveRequestView-DzjYw8z3.js → BulkReceiveRequestView-C_M-MeV5.js} +19 -19
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Bg8FBGzq.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-ISQNRax5.js} +1 -1
  8. package/dist/{ClosingDraftView-D0SGlTkF.js → ClosingDraftView-cXIe_zZa.js} +19 -19
  9. package/dist/{ClosingHistoryView-BKfhpOEw.js → ClosingHistoryView-CdI3X3jm.js} +5 -5
  10. package/dist/{ClosingTemplateView-Ikq2OM4z.js → ClosingTemplateView-BVXEafI0.js} +16 -16
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BhTM2C3K.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-CNo8JTBg.js} +1 -1
  12. package/dist/{DefaultView-ClKfklyX.js → DefaultView-BgeXHnzC.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-Cfz_N8Bf.js → DeliveryOrderPrintPreview-CrUm8dxB.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-C-GPckzY.js → EmailDialog.vue_vue_type_script_setup_true_lang-ZhXfCtfF.js} +23 -23
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-BxkzheM9.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-C3834Bla.js} +1 -1
  16. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CoFcZ-Zv.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CEfI_gbM.js} +2 -2
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BAEpf31G.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BSQXO3d-.js} +2 -2
  18. package/dist/{FmMultiselectDialog-Dr8wRNW7.js → FmMultiselectDialog-Ba733RUG.js} +2 -2
  19. package/dist/{FmMultiselectDialog-CiOdsRlf.js → FmMultiselectDialog-CWEKCez2.js} +1 -1
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-D-Ycop6K.js → FmUnitInput.vue_vue_type_script_setup_true_lang-hsonocUb.js} +6 -6
  21. package/dist/{ImportView-BBqak01n.js → ImportView-D_3k-nET.js} +6 -6
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-CAJDLjrN.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-viBu-wyT.js} +1 -1
  23. package/dist/{IngredientGroupView-CghsReO0.js → IngredientGroupView-CLG7K6UA.js} +5 -5
  24. package/dist/{IngredientsView-DLxTWo-n.js → IngredientsView-CBqIZxCN.js} +15 -15
  25. package/dist/{IntegrationExplorerView-C05R8EzL.js → IntegrationExplorerView-VXoxFpfY.js} +4 -4
  26. package/dist/IntegrationView-BYjz9qYk.js +7418 -0
  27. package/dist/{InventoryBindingForm-CnHzZu12.js → InventoryBindingForm-BVGzPMvx.js} +1 -1
  28. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-Cls49Zgb.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-BzbykaNV.js} +5 -5
  29. package/dist/{InventoryBindingSummary-DK5Z9AKC.js → InventoryBindingSummary-HxitAU00.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-FsxbejSt.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DvtxH9pL.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DvIbqRH9.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dx5rT30e.js} +1 -1
  32. package/dist/{ProductionView-DeUmELdm.js → ProductionView-CAYrlRm2.js} +7 -7
  33. package/dist/{PublishView-CGHFmmCG.js → PublishView-D2U1ROhT.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-xyXZU3oQ.js → PurchaseOrderPrintPreview-CCpomR66.js} +2 -2
  35. package/dist/{ReceiveRequestView-CVmAUuqN.js → ReceiveRequestView-DJFXJZEb.js} +14 -14
  36. package/dist/{RecipeView-BSd1V9En.js → RecipeView-BTtVbNGZ.js} +17 -17
  37. package/dist/{SettingsView-AI-JaGxh.js → SettingsView-CrJOY9UQ.js} +4 -4
  38. package/dist/{StockView-CRrYes0h.js → StockView-COT14Zwm.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DNXdZVOA.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BPJWxLvm.js} +1 -1
  40. package/dist/{SupplierView-BMupiPVi.js → SupplierView-C_dEiF3w.js} +92 -90
  41. package/dist/{SurchargeView-77KsLF2T.js → SurchargeView-Dt6trbdC.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-Brw98Ihw.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-XFoPtc5O.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-Cjt4YAII.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-5yutlMJo.js} +1 -1
  44. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BHeqFlka.js → TransferDetails.vue_vue_type_script_setup_true_lang-ByUjzrQh.js} +20 -20
  45. package/dist/{TransferTemplateView-BMF1_tLd.js → TransferTemplateView-Brk8sUfw.js} +20 -20
  46. package/dist/{UnitCostHistoryView-Gp8uWjMQ.js → UnitCostHistoryView-DK3QGyiN.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-mwAMQ0B3.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-B11L7TOx.js} +4 -4
  48. package/dist/UnitView-DIw9i7R4.js +694 -0
  49. package/dist/{WarehouseView-Bat0looR.js → WarehouseView-B-0ZAP09.js} +37 -37
  50. package/dist/{WastageTemplateView-Coag2jbG.js → WastageTemplateView-ul1KyAnp.js} +14 -14
  51. package/dist/{app-C3gNrduY.js → app-D9Xbf8WU.js} +17 -16
  52. package/dist/app.js +1 -1
  53. package/dist/{closing-template-DKklbhBW.js → closing-template-DpVULPQK.js} +1 -1
  54. package/dist/{date2-Cx-YVc4N.js → date2-XrNgTDEB.js} +1 -1
  55. package/dist/{dayjs.min-Cj2Eh8Tj.js → dayjs.min-CxXJsNHn.js} +1 -1
  56. package/dist/{decimal-OxPQV_Pd.js → decimal-Va-1UYBr.js} +2 -2
  57. package/dist/{defineDeepModel-Dud4PiVz.js → defineDeepModel-Dvpfn0Cm.js} +1 -1
  58. package/dist/{duplicate-template-XAhspiYs.js → duplicate-template-rvjIztYD.js} +1 -1
  59. package/dist/{feature-gYL54g_K.js → feature-DhGsAUUI.js} +2 -2
  60. package/dist/{format-time-from-id-T7WHy_x1.js → format-time-from-id-D3oW3ve1.js} +1 -1
  61. package/dist/{format-unit-display-BsjRSrAe.js → format-unit-display-CWqzihIV.js} +12 -12
  62. package/dist/{import-export.helper-CEdt0BWR.js → import-export.helper-CDp_lx7Q.js} +6 -6
  63. package/dist/{index-DQKbOIoT.js → index-BGa6gMrw.js} +1 -1
  64. package/dist/{index-CBcKeIhg.js → index-CBpNUi7N.js} +1 -1
  65. package/dist/{index-BZynONs2.js → index-DIHL6Dk_.js} +3 -3
  66. package/dist/{inventory-core-dart.default-D4zV0IQQ.js → inventory-core-dart.default-qDD0yw1g.js} +1 -1
  67. package/dist/{lz-string-BtyfM17N.js → lz-string-gAln7c0h.js} +1 -1
  68. package/dist/{netsuite-BEW5HsxM.js → netsuite-COpwngIC.js} +2 -2
  69. package/dist/{number-CQBgN-M7.js → number-DuxVRDti.js} +3 -3
  70. package/dist/{predefined-templates-CpP9HOqv.js → predefined-templates-BgdJTEjJ.js} +1 -1
  71. package/dist/{purchase-order-template-PekDPb4u.js → purchase-order-template-B5WAwnj3.js} +1 -1
  72. package/dist/{recalculationUtils-lfhKnVFx.js → recalculationUtils-YsktsWA9.js} +1 -1
  73. package/dist/{rules-5x2UEFmU.js → rules-DDPqCQKN.js} +2 -2
  74. package/dist/{stock-DqIRhhsu.js → stock-CTbDycoC.js} +1 -1
  75. package/dist/{stock-Ch5c3jO9.js → stock-F1qODY2Y.js} +3 -3
  76. package/dist/{supplier-DVxdFpgr.js → supplier-Qz0A-0XC.js} +2 -2
  77. package/dist/{surcharge-CNGep-bs.js → surcharge-DIvMgggy.js} +1 -1
  78. package/dist/tsconfig.app.tsbuildinfo +1 -1
  79. package/dist/{uom-rules-RPvKxFQI.js → uom-rules-B_dQ_8Sn.js} +1 -1
  80. package/dist/{use-ingredient-select-dialog-CPdwTQrN.js → use-ingredient-select-dialog-C3lzKwQs.js} +2 -2
  81. package/dist/{use-inventory-binding-dialog-CeyqcDPW.js → use-inventory-binding-dialog-CtFipRW1.js} +2 -2
  82. package/dist/{use-template-enabled-locations-DJ46fm8w.js → use-template-enabled-locations-DMjyiUUX.js} +2 -2
  83. package/dist/{use-transfer-locations-DBIAb9MY.js → use-transfer-locations-CMmEtNuh.js} +2 -2
  84. package/dist/{useHrmPermission-BEDY0i29.js → useHrmPermission-Dpi-MhVB.js} +1 -1
  85. package/dist/{useNavigationMenu-xXANo9uC.js → useNavigationMenu-Bsh6JHQv.js} +2 -2
  86. package/dist/{useSseClient-B-dfDpdW.js → useSseClient-DjM93tLA.js} +1 -1
  87. package/dist/{vue-i18n-D64MVhs-.js → vue-i18n-CjBk3CXF.js} +308 -308
  88. package/dist/{xlsx.util-BntGs-ye.js → xlsx.util-CE9kr5xg.js} +2 -2
  89. package/package.json +2 -2
  90. package/dist/IntegrationView-DpN7PYPc.js +0 -7623
  91. package/dist/UnitView-Cuk5oaOf.js +0 -693
@@ -0,0 +1,694 @@
1
+ import { defineComponent as W, computed as b, createElementBlock as F, openBlock as y, createElementVNode as l, createCommentVNode as K, Fragment as G, renderList as O, toDisplayString as U, ref as D, watch as ne, resolveComponent as I, createBlock as P, withCtx as M, createVNode as x, unref as s, isRef as le, normalizeClass as ce, normalizeStyle as pe, Teleport as ve, normalizeProps as fe, guardReactiveProps as ye } from "vue";
2
+ import { a as Y, S as be, c as ie, w as ge, j as se, u as xe } from "./app-D9Xbf8WU.js";
3
+ import { useDialog as ue, useSnackbar as Z, useProxiedModel as ae, useBreakpoints as _e } from "@feedmepos/ui-library";
4
+ import { i as he, _ as Ve, m as Ue } from "./menu-usage-module-BdjYEk3s.js";
5
+ import { F as C } from "./form-mode.enum-BKiNVH6A.js";
6
+ import { defineStore as we, storeToRefs as Se } from "pinia";
7
+ import { D as re, R as q } from "./row-action.enum-ncgDYAjP.js";
8
+ import { c as Ce } from "./component-BmLAdDiY.js";
9
+ import { useI18n as J } from "@feedmepos/mf-common";
10
+ import { u as Fe, _ as ke } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
11
+ import { R as H, A as Ee, c as $e } from "./rules-DDPqCQKN.js";
12
+ import { a as Q, c as Ie } from "./number-DuxVRDti.js";
13
+ import { F as De } from "./decimal-Va-1UYBr.js";
14
+ import { _ as Ae } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DvtxH9pL.js";
15
+ import { u as de } from "./netsuite-COpwngIC.js";
16
+ import { _ as Re, F as Me } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
17
+ import { _ as Pe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BSQXO3d-.js";
18
+ const Te = { class: "flex flex-col gap-8" }, Be = {
19
+ key: 0,
20
+ class: "flex flex-col"
21
+ }, Ne = { class: "flex-1 py-8 px-16" }, Le = {
22
+ class: "flex-0 py-8 px-16",
23
+ style: { "flex-basis": "240px" }
24
+ }, ze = {
25
+ key: 1,
26
+ class: "flex flex-col"
27
+ }, je = { class: "flex-1 py-8 px-16" }, qe = {
28
+ class: "flex-0 py-8 px-16",
29
+ style: { "flex-basis": "240px" }
30
+ }, He = {
31
+ key: 2,
32
+ class: "flex flex-col"
33
+ }, Ke = { class: "flex-1 py-8 px-16" }, Ge = {
34
+ class: "flex-0 py-8 px-16",
35
+ style: { "flex-basis": "240px" }
36
+ }, Oe = /* @__PURE__ */ W({
37
+ __name: "UnitUsedBy",
38
+ props: {
39
+ unit: {}
40
+ },
41
+ setup(k) {
42
+ const p = k, _ = Y(), v = b(() => _.validateUnitUsage(p.unit)), d = b(() => v.value.filter((t) => t.from === "INGREDIENT")), n = b(() => v.value.filter((t) => t.from === "RECIPE")), c = b(() => v.value.filter((t) => t.from === "MENU"));
43
+ return (t, f) => (y(), F("div", Te, [
44
+ f[3] || (f[3] = l("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
45
+ d.value.length ? (y(), F("div", Be, [
46
+ f[0] || (f[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" }, [
47
+ l("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
48
+ l("div", {
49
+ class: "flex-0 py-8 px-16",
50
+ style: { "flex-basis": "240px" }
51
+ }, "Used in")
52
+ ], -1)),
53
+ (y(!0), F(G, null, O(d.value, (a) => {
54
+ var o;
55
+ return y(), F("div", {
56
+ key: a.code,
57
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
58
+ }, [
59
+ l("div", Ne, U(a.code) + " " + U(a.name), 1),
60
+ l("div", Le, U((o = a.bindedIngredient) != null && o.length ? "Convert binding" : "Item unit"), 1)
61
+ ]);
62
+ }), 128))
63
+ ])) : K("", !0),
64
+ n.value.length ? (y(), F("div", ze, [
65
+ f[1] || (f[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" }, [
66
+ l("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
67
+ l("div", {
68
+ class: "flex-0 py-8 px-16",
69
+ style: { "flex-basis": "240px" }
70
+ }, "Used in")
71
+ ], -1)),
72
+ (y(!0), F(G, null, O(n.value, (a) => {
73
+ var o, r, m;
74
+ return y(), F("div", {
75
+ key: a.code,
76
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
77
+ }, [
78
+ l("div", je, U(a.code) + " " + U(a.name), 1),
79
+ l("div", qe, U((o = a.bindedIngredient) == null ? void 0 : o.slice(0, 3).map((w) => w.code).join(", ")) + " " + U(a.bindedIngredient && ((r = a.bindedIngredient) == null ? void 0 : r.length) > 3 ? `and ${((m = a.bindedIngredient) == null ? void 0 : m.length) - 3} more` : ""), 1)
80
+ ]);
81
+ }), 128))
82
+ ])) : K("", !0),
83
+ c.value.length ? (y(), F("div", He, [
84
+ f[2] || (f[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" }, [
85
+ l("div", { class: "flex-1 py-8 px-16" }, "Menu"),
86
+ l("div", {
87
+ class: "flex-0 py-8 px-16",
88
+ style: { "flex-basis": "240px" }
89
+ }, "Used in")
90
+ ], -1)),
91
+ (y(!0), F(G, null, O(c.value, (a) => {
92
+ var o, r, m;
93
+ return y(), F("div", {
94
+ key: a.code,
95
+ class: "flex flex-row fm-typo-en-body-md-400 h-48 items-center border-b border-b-fm-color-neutral-gray-100"
96
+ }, [
97
+ l("div", Ke, U(a.code) + " " + U(a.name), 1),
98
+ l("div", Ge, U((o = a.bindedIngredient) == null ? void 0 : o.slice(0, 3).map((w) => w.code).join(", ")) + " " + U(a.bindedIngredient && ((r = a.bindedIngredient) == null ? void 0 : r.length) > 3 ? `and ${((m = a.bindedIngredient) == null ? void 0 : m.length) - 3} more` : ""), 1)
99
+ ]);
100
+ }), 128))
101
+ ])) : K("", !0)
102
+ ]));
103
+ }
104
+ }), X = we("unitForm", function() {
105
+ const p = ue(), _ = Z(), v = Y(), d = D(!1), n = D();
106
+ function c() {
107
+ const o = {
108
+ unit: {},
109
+ mode: C.CREATE,
110
+ show: !0,
111
+ "onUpdate:show"(r) {
112
+ n.value.show = r;
113
+ }
114
+ };
115
+ n.value = o;
116
+ }
117
+ async function t(o) {
118
+ const r = {
119
+ unit: o,
120
+ mode: C.UPDATE,
121
+ show: !0,
122
+ "onUpdate:show"(m) {
123
+ n.value.show = m;
124
+ }
125
+ };
126
+ n.value = r;
127
+ }
128
+ async function f(o) {
129
+ d.value = !0;
130
+ try {
131
+ await v.deleteUnit(o), _.open({
132
+ title: "Success",
133
+ message: `Deleted ${o.name}`,
134
+ type: "success"
135
+ });
136
+ } catch (r) {
137
+ r instanceof be && he(r) ? p.open({
138
+ title: "Cannot delete unit",
139
+ contentComponent: Ve,
140
+ contentComponentProps: {
141
+ subject: (o == null ? void 0 : o.name) ?? "",
142
+ items: r.errorResponse.errors.map((m) => {
143
+ var w;
144
+ return {
145
+ chain: [
146
+ {
147
+ itemName: m.name,
148
+ moduleKey: (w = m.message) != null && w.startsWith("modules.") ? Ue(m.message) : m.module
149
+ }
150
+ ]
151
+ };
152
+ })
153
+ },
154
+ secondaryActions: {
155
+ text: "Close",
156
+ close: !0
157
+ }
158
+ }) : console.log("unable to delete unit", r), _.open({
159
+ title: `Cannot delete ${o.name}`,
160
+ message: "Please try again.",
161
+ type: "error"
162
+ }), console.error("failed to delete unit", r);
163
+ } finally {
164
+ d.value = !1;
165
+ }
166
+ }
167
+ function a(o) {
168
+ if (v.validateUnitUsage(o).length) {
169
+ p.open({
170
+ title: `Cannot delete ${(o == null ? void 0 : o.name) ?? "unit"}`,
171
+ overlay: !0,
172
+ dismissAway: !0,
173
+ closeButton: !0,
174
+ contentComponent: Oe,
175
+ contentComponentProps: {
176
+ unit: o
177
+ },
178
+ primaryActions: {
179
+ text: "Confirm",
180
+ close: !0
181
+ }
182
+ });
183
+ return;
184
+ }
185
+ p.open({
186
+ title: `Delete ${(o == null ? void 0 : o.name) ?? "unit"}?`,
187
+ closeButton: !1,
188
+ message: "You may not be able to delete this unit if it is linked in any of the inventory modules.",
189
+ primaryActions: {
190
+ text: "Delete",
191
+ close: !0,
192
+ variant: "destructive"
193
+ },
194
+ secondaryActions: {
195
+ text: "Cancel",
196
+ close: !0
197
+ }
198
+ }).onPrimary(() => f(o));
199
+ }
200
+ return {
201
+ createUnit: c,
202
+ updateUnit: t,
203
+ deleteUnit: a,
204
+ unitDialogProps: n,
205
+ unitViewLoading: d
206
+ };
207
+ });
208
+ function We() {
209
+ const { updateUnit: k, deleteUnit: p } = X(), { t: _ } = J();
210
+ async function v(n, c) {
211
+ const t = ie(c);
212
+ if (n === q.Edit) {
213
+ await k(t);
214
+ return;
215
+ }
216
+ if (n === q.Delete) {
217
+ await p(t);
218
+ return;
219
+ }
220
+ }
221
+ return { columnDefs: [
222
+ {
223
+ accessorKey: "name",
224
+ header: _("inventory.unit.table.name"),
225
+ enableSorting: !0,
226
+ size: 300
227
+ },
228
+ {
229
+ accessorKey: "abbrev",
230
+ header: _("inventory.unit.table.symbol"),
231
+ enableSorting: !1,
232
+ size: "auto"
233
+ },
234
+ {
235
+ id: "action",
236
+ header: "",
237
+ cell(n) {
238
+ return Ce(
239
+ [re[q.Edit], re[q.Delete]],
240
+ (c) => {
241
+ v(c, n.row.original);
242
+ }
243
+ );
244
+ },
245
+ enableSorting: !1,
246
+ size: 40,
247
+ meta: {
248
+ cellClass: "",
249
+ headerClass: ""
250
+ }
251
+ }
252
+ ] };
253
+ }
254
+ const Ye = { class: "flex flex-col gap-24" }, Je = { class: "flex gap-24" }, Qe = { class: "flex-1" }, Xe = { class: "flex-1" }, Ze = { class: "flex" }, et = { class: "flex items-center" }, tt = { class: "fm-typo-en-body-lg-600 flex-grow" }, ot = { class: "flex flex-col gap-24" }, nt = { class: "flex gap-24" }, lt = { class: "flex-1" }, st = { class: "flex-1" }, at = /* @__PURE__ */ W({
255
+ __name: "UnitForm",
256
+ props: {
257
+ mode: {},
258
+ modelValue: {},
259
+ disabled: { type: Boolean }
260
+ },
261
+ emits: ["update:modelValue", "click:submit"],
262
+ setup(k, { expose: p, emit: _ }) {
263
+ const v = k, d = _, { t: n } = J();
264
+ function c() {
265
+ d("click:submit");
266
+ }
267
+ const t = D(v.modelValue);
268
+ ne(
269
+ () => v.modelValue,
270
+ (e) => {
271
+ t.value = e;
272
+ }
273
+ );
274
+ const f = b({
275
+ get() {
276
+ var e;
277
+ return ((e = t.value) == null ? void 0 : e.name) ?? "";
278
+ },
279
+ set(e) {
280
+ t.value.name = e, d("update:modelValue", t.value);
281
+ }
282
+ }), a = b({
283
+ get() {
284
+ var e;
285
+ return ((e = t.value) == null ? void 0 : e.abbrev) ?? "";
286
+ },
287
+ set(e) {
288
+ t.value.abbrev = e, d("update:modelValue", t.value);
289
+ }
290
+ }), o = b({
291
+ get() {
292
+ var e;
293
+ return ((e = t.value) == null ? void 0 : e.precision) ?? 0;
294
+ },
295
+ set(e) {
296
+ t.value.precision = e, d("update:modelValue", t.value);
297
+ }
298
+ }), r = b({
299
+ get() {
300
+ var e;
301
+ return ((e = t.value) == null ? void 0 : e.measurements) ?? [];
302
+ },
303
+ set(e) {
304
+ t.value.measurements = e, d("update:modelValue", t.value);
305
+ }
306
+ });
307
+ ne(
308
+ () => o.value,
309
+ (e) => {
310
+ if (typeof e == "number" && !isNaN(e)) {
311
+ const u = r.value.map((i) => ({
312
+ ...i,
313
+ conversion: ge.convertPrecision({
314
+ value: i.conversion,
315
+ precision: e
316
+ })
317
+ }));
318
+ t.value.measurements = u, d("update:modelValue", t.value);
319
+ }
320
+ },
321
+ { immediate: !0 }
322
+ );
323
+ function m() {
324
+ const e = t.value.measurements ?? [];
325
+ t.value.measurements = [
326
+ ...e,
327
+ {
328
+ id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
329
+ name: "",
330
+ abbrev: "",
331
+ conversion: {
332
+ amount: 1,
333
+ precision: 0
334
+ }
335
+ }
336
+ ], d("update:modelValue", t.value);
337
+ }
338
+ function w(e) {
339
+ const u = t.value.measurements ?? [];
340
+ u.splice(e, 1), t.value.measurements = u, d("update:modelValue", t.value);
341
+ }
342
+ const $ = D();
343
+ return p({
344
+ validateInputs: () => {
345
+ var e, u;
346
+ (u = (e = $.value) == null ? void 0 : e.validateInputs) == null || u.call(e);
347
+ },
348
+ resetInputsValidation: () => {
349
+ var e, u;
350
+ (u = (e = $.value) == null ? void 0 : e.resetInputsValidation) == null || u.call(e);
351
+ },
352
+ resetInputs: () => {
353
+ var e, u;
354
+ (u = (e = $.value) == null ? void 0 : e.resetInputs) == null || u.call(e);
355
+ }
356
+ }), (e, u) => {
357
+ const i = I("FmTextField"), g = I("FmStepperField"), A = I("FmButton"), R = I("FmCard"), S = I("FmForm");
358
+ return y(), P(S, {
359
+ ref_key: "formRef",
360
+ ref: $,
361
+ class: "flex flex-col gap-40",
362
+ onValidationSuccess: c
363
+ }, {
364
+ default: M(() => {
365
+ var B;
366
+ return [
367
+ l("div", Ye, [
368
+ l("div", Je, [
369
+ l("div", Qe, [
370
+ x(i, {
371
+ disabled: e.disabled,
372
+ label: s(n)("inventory.unit.name"),
373
+ modelValue: f.value,
374
+ "onUpdate:modelValue": u[0] || (u[0] = (h) => f.value = h),
375
+ rules: [s(H)()],
376
+ "label-mark": "required"
377
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
378
+ ]),
379
+ l("div", Xe, [
380
+ x(i, {
381
+ disabled: e.disabled,
382
+ label: s(n)("inventory.unit.symbol"),
383
+ modelValue: a.value,
384
+ "onUpdate:modelValue": u[1] || (u[1] = (h) => a.value = h),
385
+ rules: [s(H)()],
386
+ "label-mark": "required"
387
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
388
+ ])
389
+ ]),
390
+ l("div", null, [
391
+ x(g, {
392
+ disabled: e.disabled,
393
+ class: "col-span-3",
394
+ label: s(n)("inventory.unit.precision"),
395
+ modelValue: o.value,
396
+ "onUpdate:modelValue": u[2] || (u[2] = (h) => o.value = h),
397
+ rules: [s(Ee)(0)]
398
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
399
+ ])
400
+ ]),
401
+ l("div", Ze, [
402
+ x(A, {
403
+ disabled: e.disabled,
404
+ type: "button",
405
+ "prepend-icon": "add",
406
+ label: s(n)("inventory.unit.measurement.addMeasurement"),
407
+ variant: "plain",
408
+ onClick: m
409
+ }, null, 8, ["disabled", "label"])
410
+ ]),
411
+ (y(!0), F(G, null, O((B = e.modelValue) == null ? void 0 : B.measurements, (h, V) => (y(), P(R, {
412
+ class: "flex flex-col gap-16 p-16",
413
+ variant: "outlined",
414
+ key: h.id
415
+ }, {
416
+ default: M(() => [
417
+ l("div", et, [
418
+ l("div", tt, U(s(n)("inventory.unit.measurement.measurementDefault", [V + 1])), 1),
419
+ x(A, {
420
+ disabled: e.disabled,
421
+ variant: "tertiary",
422
+ "prepend-icon": "delete",
423
+ onClick: (E) => w(V)
424
+ }, null, 8, ["disabled", "onClick"])
425
+ ]),
426
+ l("div", ot, [
427
+ l("div", nt, [
428
+ l("div", lt, [
429
+ x(i, {
430
+ disabled: e.disabled,
431
+ class: "col-span-2",
432
+ label: s(n)("inventory.unit.measurement.name"),
433
+ modelValue: e.modelValue.measurements[V].name,
434
+ "onUpdate:modelValue": (E) => e.modelValue.measurements[V].name = E,
435
+ rules: [s(H)()],
436
+ "label-mark": "required"
437
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
438
+ ]),
439
+ l("div", st, [
440
+ x(i, {
441
+ disabled: e.disabled,
442
+ label: s(n)("inventory.unit.measurement.symbol"),
443
+ modelValue: e.modelValue.measurements[V].abbrev,
444
+ "onUpdate:modelValue": (E) => e.modelValue.measurements[V].abbrev = E,
445
+ rules: [s(H)()],
446
+ "label-mark": "required"
447
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
448
+ ])
449
+ ]),
450
+ x(Ae, {
451
+ disabled: e.disabled,
452
+ class: "col-span-3",
453
+ label: s(n)("inventory.unit.measurement.conversion"),
454
+ "model-value": +s(Q)(e.modelValue.measurements[V].conversion),
455
+ "onUpdate:modelValue": (E) => r.value = r.value.map(
456
+ (T, N) => N === V ? {
457
+ ...T,
458
+ conversion: s(De).toPrecision(
459
+ s(Ie)(E),
460
+ o.value
461
+ )
462
+ } : T
463
+ ),
464
+ rules: [s($e)(0)],
465
+ step: +s(Q)({ amount: 1, precision: o.value }),
466
+ "helper-text": s(n)("inventory.unit.measurement.conversionHelper", {
467
+ measurementSymbol: e.modelValue.measurements[V].name || " measurement unit",
468
+ conversion: +s(Q)(e.modelValue.measurements[V].conversion),
469
+ unitSymbol: a.value || "base unit"
470
+ })
471
+ }, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
472
+ ])
473
+ ]),
474
+ _: 2
475
+ }, 1024))), 128))
476
+ ];
477
+ }),
478
+ _: 1
479
+ }, 512);
480
+ };
481
+ }
482
+ }), rt = { class: "flex gap-4" }, it = /* @__PURE__ */ W({
483
+ __name: "UnitDialog",
484
+ props: {
485
+ show: { type: Boolean },
486
+ unit: {},
487
+ mode: { default: C.READ }
488
+ },
489
+ emits: ["update:show"],
490
+ setup(k) {
491
+ const p = k, _ = Y(), v = de(), d = Z(), { t: n } = J(), c = ae(p, "show"), t = ae(p, "unit"), f = b(() => {
492
+ switch (p.mode) {
493
+ case C.READ:
494
+ return "";
495
+ case C.UPDATE:
496
+ return n("inventory.unit.update.title");
497
+ case C.CREATE:
498
+ return n("inventory.unit.create.title");
499
+ }
500
+ return "";
501
+ }), a = b(() => {
502
+ switch (p.mode) {
503
+ case C.READ:
504
+ return "";
505
+ case C.UPDATE:
506
+ return n("common.save");
507
+ case C.CREATE:
508
+ return n("common.add");
509
+ }
510
+ return "";
511
+ }), o = D(), r = D(!1), m = b(() => r.value || v.isEnabled);
512
+ async function w() {
513
+ r.value = !0;
514
+ try {
515
+ const i = ie(t.value);
516
+ i.precision ?? (i.precision = 0), i.measurements ?? (i.measurements = []), await _.createUnit(i), c.value = !1, d.open({
517
+ title: n("inventory.common.success"),
518
+ message: n("inventory.unit.create.success", { name: t.value.name }),
519
+ type: "success"
520
+ });
521
+ } catch (i) {
522
+ i instanceof se || d.open({
523
+ title: n("inventory.unit.create.error.title"),
524
+ message: n("inventory.unit.create.error.message"),
525
+ type: "error"
526
+ });
527
+ } finally {
528
+ r.value = !1;
529
+ }
530
+ }
531
+ async function $() {
532
+ r.value = !0;
533
+ try {
534
+ await _.updateUnit(t.value), c.value = !1, d.open({
535
+ title: n("inventory.common.success"),
536
+ message: n("inventory.unit.update.success", { name: t.value.name }),
537
+ type: "success"
538
+ });
539
+ } catch (i) {
540
+ i instanceof se || d.open({
541
+ title: n("inventory.unit.update.error.title"),
542
+ message: n("inventory.unit.update.error.message"),
543
+ type: "error"
544
+ });
545
+ } finally {
546
+ r.value = !1;
547
+ }
548
+ }
549
+ function e() {
550
+ var i, g;
551
+ (g = (i = o.value) == null ? void 0 : i.validateInputs) == null || g.call(i);
552
+ }
553
+ function u() {
554
+ switch (p.mode) {
555
+ case C.READ:
556
+ return;
557
+ case C.UPDATE:
558
+ return $();
559
+ case C.CREATE:
560
+ return w();
561
+ }
562
+ }
563
+ return (i, g) => {
564
+ const A = I("FmButton"), R = I("FmSideSheet");
565
+ return y(), P(R, {
566
+ "model-value": s(c),
567
+ "onUpdate:modelValue": g[3] || (g[3] = (S) => le(c) ? c.value = S : null),
568
+ header: f.value,
569
+ "close-button": "",
570
+ "dismiss-away": "",
571
+ "max-width": 500
572
+ }, {
573
+ "side-sheet-footer": M(() => [
574
+ l("div", rt, [
575
+ s(v).isEnabled ? K("", !0) : (y(), P(A, {
576
+ key: 0,
577
+ loading: r.value,
578
+ label: a.value,
579
+ onClick: e
580
+ }, null, 8, ["loading", "label"])),
581
+ x(A, {
582
+ disabled: r.value,
583
+ label: s(n)("common.close"),
584
+ variant: "tertiary",
585
+ onClick: g[2] || (g[2] = (S) => c.value = !1)
586
+ }, null, 8, ["disabled", "label"])
587
+ ])
588
+ ]),
589
+ default: M(() => [
590
+ x(at, {
591
+ class: "w-full",
592
+ ref_key: "hasValidationExpose",
593
+ ref: o,
594
+ modelValue: s(t),
595
+ "onUpdate:modelValue": g[0] || (g[0] = (S) => le(t) ? t.value = S : null),
596
+ mode: i.mode,
597
+ disabled: m.value,
598
+ "onClick:submit": g[1] || (g[1] = (S) => u())
599
+ }, null, 8, ["modelValue", "mode", "disabled"])
600
+ ]),
601
+ _: 1
602
+ }, 8, ["model-value", "header"]);
603
+ };
604
+ }
605
+ }), ut = { class: "flex flex-col py-8" }, dt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Et = /* @__PURE__ */ W({
606
+ __name: "UnitView",
607
+ setup(k) {
608
+ const p = Y(), _ = xe(), v = de();
609
+ ue(), Z();
610
+ const { t: d } = J(), n = b(() => p.units), { createUnit: c, updateUnit: t } = X(), { unitDialogProps: f, unitViewLoading: a } = Se(X()), { columnDefs: o } = We();
611
+ function r(R) {
612
+ switch (R) {
613
+ case "add":
614
+ return v.isEnabled ? void 0 : c();
615
+ }
616
+ }
617
+ const m = D(""), w = D(!1), $ = b(() => w.value || a.value), { breakpoints: e } = _e(), u = b(() => e.value.xs || e.value.sm), i = b(() => u.value ? 10 : 20), g = Fe(), A = b(() => [
618
+ ...v.isEnabled ? [] : [
619
+ {
620
+ label: d("inventory.unit.create.title"),
621
+ value: "add",
622
+ isPrimary: !0,
623
+ prependIcon: "add"
624
+ }
625
+ ]
626
+ ]);
627
+ return (R, S) => {
628
+ const B = I("FmTable");
629
+ return y(), P(ke, {
630
+ title: s(d)("inventory.unit.title"),
631
+ actions: A.value,
632
+ "onClick:action": r
633
+ }, {
634
+ default: M(() => [
635
+ l("div", {
636
+ class: ce([
637
+ "relative flex flex-col gap-8 max-h-full",
638
+ {
639
+ "p-0": u.value,
640
+ "px-24 ": !u.value
641
+ }
642
+ ])
643
+ }, [
644
+ x(Pe, {
645
+ searchable: "",
646
+ search: m.value,
647
+ "onUpdate:search": S[0] || (S[0] = (h) => m.value = h)
648
+ }, null, 8, ["search"]),
649
+ x(B, {
650
+ style: pe(s(g).tableHeight),
651
+ "column-defs": s(o),
652
+ "row-data": n.value,
653
+ "search-value": m.value,
654
+ loading: !s(_)._currentLocation || $.value,
655
+ onRowClick: S[1] || (S[1] = (h) => s(t)(h.original)),
656
+ "page-size": i.value
657
+ }, {
658
+ "list-row": M((h) => [
659
+ x(Re, {
660
+ row: h,
661
+ onRowClick: s(t)
662
+ }, {
663
+ default: M((V) => {
664
+ var E, T, N, L, ee, z, te, j, oe;
665
+ return [
666
+ l("div", ut, [
667
+ l("div", dt, [
668
+ x(s(Me), {
669
+ render: (N = (T = (E = V.name) == null ? void 0 : E.column) == null ? void 0 : T.columnDef) == null ? void 0 : N.cell,
670
+ props: (ee = (L = V.name) == null ? void 0 : L.getContext) == null ? void 0 : ee.call(L)
671
+ }, null, 8, ["render", "props"])
672
+ ]),
673
+ l("div", mt, U((oe = (j = (te = (z = h.original.measurements) == null ? void 0 : z.map) == null ? void 0 : te.call(z, (me) => me.name)) == null ? void 0 : j.join) == null ? void 0 : oe.call(j, ", ")), 1)
674
+ ])
675
+ ];
676
+ }),
677
+ _: 2
678
+ }, 1032, ["row", "onRowClick"])
679
+ ]),
680
+ _: 1
681
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
682
+ ], 2),
683
+ (y(), P(ve, { to: "body" }, [
684
+ x(it, fe(ye(s(f))), null, 16)
685
+ ]))
686
+ ]),
687
+ _: 1
688
+ }, 8, ["title", "actions"]);
689
+ };
690
+ }
691
+ });
692
+ export {
693
+ Et as default
694
+ };