@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
@@ -1,693 +0,0 @@
1
- import { defineComponent as O, computed as b, createElementBlock as C, openBlock as f, createElementVNode as s, createCommentVNode as J, Fragment as K, renderList as G, toDisplayString as h, ref as I, watch as ne, resolveComponent as $, createBlock as T, withCtx as A, createVNode as y, unref as i, isRef as le, normalizeClass as me, normalizeStyle as ce, Teleport as pe, normalizeProps as ve, guardReactiveProps as fe } from "vue";
2
- import { a as W, S as ye, c as ie, w as be, j as se, u as ge } from "./app-C3gNrduY.js";
3
- import { useDialog as ue, useSnackbar as Z, useProxiedModel as ae, useBreakpoints as xe } from "@feedmepos/ui-library";
4
- import { i as _e, _ as he, m as Ve } from "./menu-usage-module-BdjYEk3s.js";
5
- import { F as w } from "./form-mode.enum-BKiNVH6A.js";
6
- import { defineStore as Ue, storeToRefs as we } 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 Y } from "@feedmepos/mf-common";
10
- import { u as Se, _ as Fe } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
11
- import { R as H, A as ke, c as Ee } from "./rules-5x2UEFmU.js";
12
- import { a as Q, c as $e } from "./number-CQBgN-M7.js";
13
- import { F as Ie } from "./decimal-OxPQV_Pd.js";
14
- import { _ as Ae } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-FsxbejSt.js";
15
- import { _ as De, F as Re } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
16
- import { _ as Me } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BAEpf31G.js";
17
- import { u as Pe } from "./netsuite-BEW5HsxM.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__ */ O({
37
- __name: "UnitUsedBy",
38
- props: {
39
- unit: {}
40
- },
41
- setup(F) {
42
- const p = F, g = W(), c = b(() => g.validateUnitUsage(p.unit)), l = b(() => c.value.filter((o) => o.from === "INGREDIENT")), a = b(() => c.value.filter((o) => o.from === "RECIPE")), d = b(() => c.value.filter((o) => o.from === "MENU"));
43
- return (o, v) => (f(), C("div", Te, [
44
- v[3] || (v[3] = s("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
45
- l.value.length ? (f(), C("div", Be, [
46
- v[0] || (v[0] = s("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
- s("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
48
- s("div", {
49
- class: "flex-0 py-8 px-16",
50
- style: { "flex-basis": "240px" }
51
- }, "Used in")
52
- ], -1)),
53
- (f(!0), C(K, null, G(l.value, (r) => {
54
- var t;
55
- return f(), C("div", {
56
- key: r.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
- s("div", Ne, h(r.code) + " " + h(r.name), 1),
60
- s("div", Le, h((t = r.bindedIngredient) != null && t.length ? "Convert binding" : "Item unit"), 1)
61
- ]);
62
- }), 128))
63
- ])) : J("", !0),
64
- a.value.length ? (f(), C("div", ze, [
65
- v[1] || (v[1] = s("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
- s("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
67
- s("div", {
68
- class: "flex-0 py-8 px-16",
69
- style: { "flex-basis": "240px" }
70
- }, "Used in")
71
- ], -1)),
72
- (f(!0), C(K, null, G(a.value, (r) => {
73
- var t, u, m;
74
- return f(), C("div", {
75
- key: r.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
- s("div", je, h(r.code) + " " + h(r.name), 1),
79
- s("div", qe, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((V) => V.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((m = r.bindedIngredient) == null ? void 0 : m.length) - 3} more` : ""), 1)
80
- ]);
81
- }), 128))
82
- ])) : J("", !0),
83
- d.value.length ? (f(), C("div", He, [
84
- v[2] || (v[2] = s("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
- s("div", { class: "flex-1 py-8 px-16" }, "Menu"),
86
- s("div", {
87
- class: "flex-0 py-8 px-16",
88
- style: { "flex-basis": "240px" }
89
- }, "Used in")
90
- ], -1)),
91
- (f(!0), C(K, null, G(d.value, (r) => {
92
- var t, u, m;
93
- return f(), C("div", {
94
- key: r.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
- s("div", Ke, h(r.code) + " " + h(r.name), 1),
98
- s("div", Ge, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((V) => V.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((m = r.bindedIngredient) == null ? void 0 : m.length) - 3} more` : ""), 1)
99
- ]);
100
- }), 128))
101
- ])) : J("", !0)
102
- ]));
103
- }
104
- }), X = Ue("unitForm", function() {
105
- const p = ue(), g = Z(), c = W(), l = I(!1), a = I();
106
- function d() {
107
- const t = {
108
- unit: {},
109
- mode: w.CREATE,
110
- show: !0,
111
- "onUpdate:show"(u) {
112
- a.value.show = u;
113
- }
114
- };
115
- a.value = t;
116
- }
117
- async function o(t) {
118
- const u = {
119
- unit: t,
120
- mode: w.UPDATE,
121
- show: !0,
122
- "onUpdate:show"(m) {
123
- a.value.show = m;
124
- }
125
- };
126
- a.value = u;
127
- }
128
- async function v(t) {
129
- l.value = !0;
130
- try {
131
- await c.deleteUnit(t), g.open({
132
- title: "Success",
133
- message: `Deleted ${t.name}`,
134
- type: "success"
135
- });
136
- } catch (u) {
137
- u instanceof ye && _e(u) ? p.open({
138
- title: "Cannot delete unit",
139
- contentComponent: he,
140
- contentComponentProps: {
141
- subject: (t == null ? void 0 : t.name) ?? "",
142
- items: u.errorResponse.errors.map((m) => {
143
- var V;
144
- return {
145
- chain: [
146
- {
147
- itemName: m.name,
148
- moduleKey: (V = m.message) != null && V.startsWith("modules.") ? Ve(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", u), g.open({
159
- title: `Cannot delete ${t.name}`,
160
- message: "Please try again.",
161
- type: "error"
162
- }), console.error("failed to delete unit", u);
163
- } finally {
164
- l.value = !1;
165
- }
166
- }
167
- function r(t) {
168
- if (c.validateUnitUsage(t).length) {
169
- p.open({
170
- title: `Cannot delete ${(t == null ? void 0 : t.name) ?? "unit"}`,
171
- overlay: !0,
172
- dismissAway: !0,
173
- closeButton: !0,
174
- contentComponent: Oe,
175
- contentComponentProps: {
176
- unit: t
177
- },
178
- primaryActions: {
179
- text: "Confirm",
180
- close: !0
181
- }
182
- });
183
- return;
184
- }
185
- p.open({
186
- title: `Delete ${(t == null ? void 0 : t.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(() => v(t));
199
- }
200
- return {
201
- createUnit: d,
202
- updateUnit: o,
203
- deleteUnit: r,
204
- unitDialogProps: a,
205
- unitViewLoading: l
206
- };
207
- });
208
- function We() {
209
- const { updateUnit: F, deleteUnit: p } = X(), { t: g } = Y();
210
- async function c(a, d) {
211
- const o = ie(d);
212
- if (a === q.Edit) {
213
- await F(o);
214
- return;
215
- }
216
- if (a === q.Delete) {
217
- await p(o);
218
- return;
219
- }
220
- }
221
- return { columnDefs: [
222
- {
223
- accessorKey: "name",
224
- header: g("inventory.unit.table.name"),
225
- enableSorting: !0,
226
- size: 300
227
- },
228
- {
229
- accessorKey: "abbrev",
230
- header: g("inventory.unit.table.symbol"),
231
- enableSorting: !1,
232
- size: "auto"
233
- },
234
- {
235
- id: "action",
236
- header: "",
237
- cell(a) {
238
- return Ce(
239
- [re[q.Edit], re[q.Delete]],
240
- (d) => {
241
- c(d, a.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__ */ O({
255
- __name: "UnitForm",
256
- props: {
257
- mode: {},
258
- modelValue: {},
259
- disabled: { type: Boolean }
260
- },
261
- emits: ["update:modelValue", "click:submit"],
262
- setup(F, { expose: p, emit: g }) {
263
- const c = F, l = g, { t: a } = Y();
264
- function d() {
265
- l("click:submit");
266
- }
267
- const o = I(c.modelValue);
268
- ne(
269
- () => c.modelValue,
270
- (e) => {
271
- o.value = e;
272
- }
273
- );
274
- const v = b({
275
- get() {
276
- var e;
277
- return ((e = o.value) == null ? void 0 : e.name) ?? "";
278
- },
279
- set(e) {
280
- o.value.name = e, l("update:modelValue", o.value);
281
- }
282
- }), r = b({
283
- get() {
284
- var e;
285
- return ((e = o.value) == null ? void 0 : e.abbrev) ?? "";
286
- },
287
- set(e) {
288
- o.value.abbrev = e, l("update:modelValue", o.value);
289
- }
290
- }), t = b({
291
- get() {
292
- var e;
293
- return ((e = o.value) == null ? void 0 : e.precision) ?? 0;
294
- },
295
- set(e) {
296
- o.value.precision = e, l("update:modelValue", o.value);
297
- }
298
- }), u = b({
299
- get() {
300
- var e;
301
- return ((e = o.value) == null ? void 0 : e.measurements) ?? [];
302
- },
303
- set(e) {
304
- o.value.measurements = e, l("update:modelValue", o.value);
305
- }
306
- });
307
- ne(
308
- () => t.value,
309
- (e) => {
310
- if (typeof e == "number" && !isNaN(e)) {
311
- const n = u.value.map((U) => ({
312
- ...U,
313
- conversion: be.convertPrecision({
314
- value: U.conversion,
315
- precision: e
316
- })
317
- }));
318
- o.value.measurements = n, l("update:modelValue", o.value);
319
- }
320
- },
321
- { immediate: !0 }
322
- );
323
- function m() {
324
- const e = o.value.measurements ?? [];
325
- o.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
- ], l("update:modelValue", o.value);
337
- }
338
- function V(e) {
339
- const n = o.value.measurements ?? [];
340
- n.splice(e, 1), o.value.measurements = n, l("update:modelValue", o.value);
341
- }
342
- const E = I();
343
- return p({
344
- validateInputs: () => {
345
- var e, n;
346
- (n = (e = E.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
347
- },
348
- resetInputsValidation: () => {
349
- var e, n;
350
- (n = (e = E.value) == null ? void 0 : e.resetInputsValidation) == null || n.call(e);
351
- },
352
- resetInputs: () => {
353
- var e, n;
354
- (n = (e = E.value) == null ? void 0 : e.resetInputs) == null || n.call(e);
355
- }
356
- }), (e, n) => {
357
- const U = $("FmTextField"), R = $("FmStepperField"), S = $("FmButton"), M = $("FmCard"), D = $("FmForm");
358
- return f(), T(D, {
359
- ref_key: "formRef",
360
- ref: E,
361
- class: "flex flex-col gap-40",
362
- onValidationSuccess: d
363
- }, {
364
- default: A(() => {
365
- var B;
366
- return [
367
- s("div", Ye, [
368
- s("div", Je, [
369
- s("div", Qe, [
370
- y(U, {
371
- disabled: e.disabled,
372
- label: i(a)("inventory.unit.name"),
373
- modelValue: v.value,
374
- "onUpdate:modelValue": n[0] || (n[0] = (x) => v.value = x),
375
- rules: [i(H)()],
376
- "label-mark": "required"
377
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
378
- ]),
379
- s("div", Xe, [
380
- y(U, {
381
- disabled: e.disabled,
382
- label: i(a)("inventory.unit.symbol"),
383
- modelValue: r.value,
384
- "onUpdate:modelValue": n[1] || (n[1] = (x) => r.value = x),
385
- rules: [i(H)()],
386
- "label-mark": "required"
387
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
388
- ])
389
- ]),
390
- s("div", null, [
391
- y(R, {
392
- disabled: e.disabled,
393
- class: "col-span-3",
394
- label: i(a)("inventory.unit.precision"),
395
- modelValue: t.value,
396
- "onUpdate:modelValue": n[2] || (n[2] = (x) => t.value = x),
397
- rules: [i(ke)(0)]
398
- }, null, 8, ["disabled", "label", "modelValue", "rules"])
399
- ])
400
- ]),
401
- s("div", Ze, [
402
- y(S, {
403
- disabled: e.disabled,
404
- type: "button",
405
- "prepend-icon": "add",
406
- label: i(a)("inventory.unit.measurement.addMeasurement"),
407
- variant: "plain",
408
- onClick: m
409
- }, null, 8, ["disabled", "label"])
410
- ]),
411
- (f(!0), C(K, null, G((B = e.modelValue) == null ? void 0 : B.measurements, (x, _) => (f(), T(M, {
412
- class: "flex flex-col gap-16 p-16",
413
- variant: "outlined",
414
- key: x.id
415
- }, {
416
- default: A(() => [
417
- s("div", et, [
418
- s("div", tt, h(i(a)("inventory.unit.measurement.measurementDefault", [_ + 1])), 1),
419
- y(S, {
420
- disabled: e.disabled,
421
- variant: "tertiary",
422
- "prepend-icon": "delete",
423
- onClick: (k) => V(_)
424
- }, null, 8, ["disabled", "onClick"])
425
- ]),
426
- s("div", ot, [
427
- s("div", nt, [
428
- s("div", lt, [
429
- y(U, {
430
- disabled: e.disabled,
431
- class: "col-span-2",
432
- label: i(a)("inventory.unit.measurement.name"),
433
- modelValue: e.modelValue.measurements[_].name,
434
- "onUpdate:modelValue": (k) => e.modelValue.measurements[_].name = k,
435
- rules: [i(H)()],
436
- "label-mark": "required"
437
- }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
438
- ]),
439
- s("div", st, [
440
- y(U, {
441
- disabled: e.disabled,
442
- label: i(a)("inventory.unit.measurement.symbol"),
443
- modelValue: e.modelValue.measurements[_].abbrev,
444
- "onUpdate:modelValue": (k) => e.modelValue.measurements[_].abbrev = k,
445
- rules: [i(H)()],
446
- "label-mark": "required"
447
- }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
448
- ])
449
- ]),
450
- y(Ae, {
451
- disabled: e.disabled,
452
- class: "col-span-3",
453
- label: i(a)("inventory.unit.measurement.conversion"),
454
- "model-value": +i(Q)(e.modelValue.measurements[_].conversion),
455
- "onUpdate:modelValue": (k) => u.value = u.value.map(
456
- (P, N) => N === _ ? {
457
- ...P,
458
- conversion: i(Ie).toPrecision(
459
- i($e)(k),
460
- t.value
461
- )
462
- } : P
463
- ),
464
- rules: [i(Ee)(0)],
465
- step: +i(Q)({ amount: 1, precision: t.value }),
466
- "helper-text": i(a)("inventory.unit.measurement.conversionHelper", {
467
- measurementSymbol: e.modelValue.measurements[_].name || " measurement unit",
468
- conversion: +i(Q)(e.modelValue.measurements[_].conversion),
469
- unitSymbol: r.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__ */ O({
483
- __name: "UnitDialog",
484
- props: {
485
- show: { type: Boolean },
486
- unit: {},
487
- mode: { default: w.READ }
488
- },
489
- emits: ["update:show"],
490
- setup(F) {
491
- const p = F, g = W(), c = Z(), { t: l } = Y(), a = ae(p, "show"), d = ae(p, "unit"), o = b(() => {
492
- switch (p.mode) {
493
- case w.READ:
494
- return "";
495
- case w.UPDATE:
496
- return l("inventory.unit.update.title");
497
- case w.CREATE:
498
- return l("inventory.unit.create.title");
499
- }
500
- return "";
501
- }), v = b(() => {
502
- switch (p.mode) {
503
- case w.READ:
504
- return "";
505
- case w.UPDATE:
506
- return l("common.save");
507
- case w.CREATE:
508
- return l("common.add");
509
- }
510
- return "";
511
- }), r = I(), t = I(!1);
512
- async function u() {
513
- t.value = !0;
514
- try {
515
- const e = ie(d.value);
516
- e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await g.createUnit(e), a.value = !1, c.open({
517
- title: l("inventory.common.success"),
518
- message: l("inventory.unit.create.success", { name: d.value.name }),
519
- type: "success"
520
- });
521
- } catch (e) {
522
- e instanceof se || c.open({
523
- title: l("inventory.unit.create.error.title"),
524
- message: l("inventory.unit.create.error.message"),
525
- type: "error"
526
- });
527
- } finally {
528
- t.value = !1;
529
- }
530
- }
531
- async function m() {
532
- t.value = !0;
533
- try {
534
- await g.updateUnit(d.value), a.value = !1, c.open({
535
- title: l("inventory.common.success"),
536
- message: l("inventory.unit.update.success", { name: d.value.name }),
537
- type: "success"
538
- });
539
- } catch (e) {
540
- e instanceof se || c.open({
541
- title: l("inventory.unit.update.error.title"),
542
- message: l("inventory.unit.update.error.message"),
543
- type: "error"
544
- });
545
- } finally {
546
- t.value = !1;
547
- }
548
- }
549
- function V() {
550
- var e, n;
551
- (n = (e = r.value) == null ? void 0 : e.validateInputs) == null || n.call(e);
552
- }
553
- function E() {
554
- switch (p.mode) {
555
- case w.READ:
556
- return;
557
- case w.UPDATE:
558
- return m();
559
- case w.CREATE:
560
- return u();
561
- }
562
- }
563
- return (e, n) => {
564
- const U = $("FmButton"), R = $("FmSideSheet");
565
- return f(), T(R, {
566
- "model-value": i(a),
567
- "onUpdate:modelValue": n[3] || (n[3] = (S) => le(a) ? a.value = S : null),
568
- header: o.value,
569
- "close-button": "",
570
- "dismiss-away": "",
571
- "max-width": 500
572
- }, {
573
- "side-sheet-footer": A(() => [
574
- s("div", rt, [
575
- y(U, {
576
- loading: t.value,
577
- label: v.value,
578
- onClick: V
579
- }, null, 8, ["loading", "label"]),
580
- y(U, {
581
- disabled: t.value,
582
- label: i(l)("common.close"),
583
- variant: "tertiary",
584
- onClick: n[2] || (n[2] = (S) => a.value = !1)
585
- }, null, 8, ["disabled", "label"])
586
- ])
587
- ]),
588
- default: A(() => [
589
- y(at, {
590
- class: "w-full",
591
- ref_key: "hasValidationExpose",
592
- ref: r,
593
- modelValue: i(d),
594
- "onUpdate:modelValue": n[0] || (n[0] = (S) => le(d) ? d.value = S : null),
595
- mode: e.mode,
596
- disabled: t.value,
597
- "onClick:submit": n[1] || (n[1] = (S) => E())
598
- }, null, 8, ["modelValue", "mode", "disabled"])
599
- ]),
600
- _: 1
601
- }, 8, ["model-value", "header"]);
602
- };
603
- }
604
- }), 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__ */ O({
605
- __name: "UnitView",
606
- setup(F) {
607
- const p = W(), g = ge(), c = Pe();
608
- ue(), Z();
609
- const { t: l } = Y(), a = b(() => p.units), { createUnit: d, updateUnit: o } = X(), { unitDialogProps: v, unitViewLoading: r } = we(X()), { columnDefs: t } = We();
610
- function u(M) {
611
- switch (M) {
612
- case "add":
613
- return c.isEnabled ? void 0 : d();
614
- }
615
- }
616
- const m = I(""), V = I(!1), E = b(() => V.value || r.value), { breakpoints: e } = xe(), n = b(() => e.value.xs || e.value.sm), U = b(() => n.value ? 10 : 20), R = Se(), S = b(() => [
617
- ...c.isEnabled ? [] : [
618
- {
619
- label: l("inventory.unit.create.title"),
620
- value: "add",
621
- isPrimary: !0,
622
- prependIcon: "add"
623
- }
624
- ]
625
- ]);
626
- return (M, D) => {
627
- const B = $("FmTable");
628
- return f(), T(Fe, {
629
- title: i(l)("inventory.unit.title"),
630
- actions: S.value,
631
- "onClick:action": u
632
- }, {
633
- default: A(() => [
634
- s("div", {
635
- class: me([
636
- "relative flex flex-col gap-8 max-h-full",
637
- {
638
- "p-0": n.value,
639
- "px-24 ": !n.value
640
- }
641
- ])
642
- }, [
643
- y(Me, {
644
- searchable: "",
645
- search: m.value,
646
- "onUpdate:search": D[0] || (D[0] = (x) => m.value = x)
647
- }, null, 8, ["search"]),
648
- y(B, {
649
- style: ce(i(R).tableHeight),
650
- "column-defs": i(t),
651
- "row-data": a.value,
652
- "search-value": m.value,
653
- loading: !i(g)._currentLocation || E.value,
654
- onRowClick: D[1] || (D[1] = (x) => i(o)(x.original)),
655
- "page-size": U.value
656
- }, {
657
- "list-row": A((x) => [
658
- y(De, {
659
- row: x,
660
- onRowClick: i(o)
661
- }, {
662
- default: A((_) => {
663
- var k, P, N, L, ee, z, te, j, oe;
664
- return [
665
- s("div", ut, [
666
- s("div", dt, [
667
- y(i(Re), {
668
- render: (N = (P = (k = _.name) == null ? void 0 : k.column) == null ? void 0 : P.columnDef) == null ? void 0 : N.cell,
669
- props: (ee = (L = _.name) == null ? void 0 : L.getContext) == null ? void 0 : ee.call(L)
670
- }, null, 8, ["render", "props"])
671
- ]),
672
- s("div", mt, h((oe = (j = (te = (z = x.original.measurements) == null ? void 0 : z.map) == null ? void 0 : te.call(z, (de) => de.name)) == null ? void 0 : j.join) == null ? void 0 : oe.call(j, ", ")), 1)
673
- ])
674
- ];
675
- }),
676
- _: 2
677
- }, 1032, ["row", "onRowClick"])
678
- ]),
679
- _: 1
680
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
681
- ], 2),
682
- (f(), T(pe, { to: "body" }, [
683
- y(it, ve(fe(i(v))), null, 16)
684
- ]))
685
- ]),
686
- _: 1
687
- }, 8, ["title", "actions"]);
688
- };
689
- }
690
- });
691
- export {
692
- Et as default
693
- };