@feedmepos/mf-inventory-portal 1.2.1 → 1.2.2-5.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 (147) hide show
  1. package/dist/App-DMkUg806.js +297 -0
  2. package/dist/{ApprovalView-DwRrbVDo.js → ApprovalView-DWJh2K6W.js} +65 -64
  3. package/dist/{BindingsDialog-DUVKv10-.js → BindingsDialog-EmHCvqJI.js} +2 -2
  4. package/dist/{BindingsPicker-Daib_iq4.js → BindingsPicker-h_9jm1s0.js} +3 -3
  5. package/dist/{BindingsTable-Bv9UmcJP.js → BindingsTable-BAVWGUoa.js} +1 -1
  6. package/dist/ClosingDraftView-Du4kOwIg.js +1899 -0
  7. package/dist/ClosingHistoryView-DuW2Vtrs.js +355 -0
  8. package/dist/ClosingTemplateView-CfPY8R5M.js +2001 -0
  9. package/dist/{DeliveryOrderPrintPreview-DZPcRAja.js → DeliveryOrderPrintPreview-C6Cj8mOp.js} +9 -9
  10. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-WWIrybw_.js +230 -0
  11. package/dist/{FmMultiselectDialog-CZmwOkrb.js → FmMultiselectDialog-BzWrQOS4.js} +1 -1
  12. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-C-2V2bGc.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DwqVRUFz.js} +36 -36
  13. package/dist/ImportView-lKlYeLay.js +1291 -0
  14. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BGnoF1Zz.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-_2WZMZU2.js} +5 -5
  15. package/dist/{IngredientGroupView-CAVYpEj3.js → IngredientGroupView-CrmwR2Xt.js} +34 -35
  16. package/dist/IngredientsView-1bAsyz-b.js +2254 -0
  17. package/dist/{IntegrationView-DdLFyZ4H.js → IntegrationView-D16qeEc_.js} +1773 -1635
  18. package/dist/{InventoryBindingForm-C7BdEDtM.js → InventoryBindingForm-BRwOXV_P.js} +1 -1
  19. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-B7DND2dQ.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-NDbtbtqK.js} +28 -28
  20. package/dist/{InventoryBindingSummary-IZ7F-Lti.js → InventoryBindingSummary-DKM2gX8_.js} +1 -1
  21. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-sgqVSlUB.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js} +4 -4
  22. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DeF32bHu.js → PremiumBadge.vue_vue_type_script_setup_true_lang-B0OKeK5O.js} +7 -7
  23. package/dist/{PublishView-DkgfYneI.js → PublishView-D0NnU22l.js} +73 -63
  24. package/dist/{PurchaseOrderPrintPreview-CltLC4o4.js → PurchaseOrderPrintPreview-BmuwNbeL.js} +4 -4
  25. package/dist/{ReceiveRequestView-Dj7ji0DY.js → ReceiveRequestView-j79m7TKk.js} +343 -333
  26. package/dist/RecipeView-D_fNQQ-C.js +636 -0
  27. package/dist/StockView-DX_xeFBT.js +2385 -0
  28. package/dist/SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Bg49isUy.js +172 -0
  29. package/dist/{SupplierView-DE_M_9kd.js → SupplierView-DuFTqbOg.js} +1193 -1073
  30. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-c428GXwc.js +3233 -0
  31. package/dist/{TransferTemplateView-gWGBCF3u.js → TransferTemplateView-Ccsfcetz.js} +104 -103
  32. package/dist/UnitView-BklpNsFN.js +674 -0
  33. package/dist/WarehouseView-BrURbU67.js +1066 -0
  34. package/dist/api/adjustment-template.d.ts +1 -0
  35. package/dist/api/bill.d.ts +140 -2
  36. package/dist/api/closing-template.d.ts +1 -0
  37. package/dist/api/closing.d.ts +1 -0
  38. package/dist/api/inventory.d.ts +405 -0
  39. package/dist/api/netsuite.d.ts +5 -1
  40. package/dist/api/purchase-order-template.d.ts +1 -0
  41. package/dist/api/purchase-order.d.ts +3 -0
  42. package/dist/api/shipment.d.ts +11 -0
  43. package/dist/api/stock.d.ts +2 -44
  44. package/dist/api/warehouse.d.ts +3 -1
  45. package/dist/{app-CruHLH1e.js → app-a9r50k3U.js} +68551 -67573
  46. package/dist/app.d.ts +643 -15
  47. package/dist/app.js +6 -6
  48. package/dist/components/FmAdminBadge.vue.d.ts +1 -4
  49. package/dist/components/FmEnhancedSelect.vue.d.ts +30 -0
  50. package/dist/components/FmInventoryTableToolbar.vue.d.ts +16 -2
  51. package/dist/components/FmLockableField.vue.d.ts +3 -0
  52. package/dist/components/netsuite/ItemSubsidiaryTreeDialog.vue.d.ts +16 -0
  53. package/dist/components/netsuite/SubsidiaryTreeDialog.vue.d.ts +2 -0
  54. package/dist/composable/defineApi.d.ts +1 -1
  55. package/dist/composable/useIframe.d.ts +2 -2
  56. package/dist/{decimal-izbvCC1j.js → decimal-AusUnA1W.js} +1 -1
  57. package/dist/{format-unit-display-4SAdfyZB.js → format-unit-display-BqkHL-ph.js} +397 -429
  58. package/dist/helper/array.d.ts +1 -0
  59. package/dist/helper/core/country/utils.d.ts +3 -4
  60. package/dist/helper/country.d.ts +6 -255
  61. package/dist/helper/number.d.ts +1 -0
  62. package/dist/import-export.helper-PIyNeHfa.js +238 -0
  63. package/dist/{index-B6GGthLw.js → index-CjxirPvn.js} +283 -268
  64. package/dist/{index-CnQloOEo.js → index-Dj9-pdT9.js} +1 -1
  65. package/dist/layout/SingleColumnLayout.vue.d.ts +6 -3
  66. package/dist/purchase-order-template-CQikvY1p.js +41 -0
  67. package/dist/router/name.d.ts +2 -0
  68. package/dist/stock-CDZ2uWSF.js +83 -0
  69. package/dist/stock-Dw908dIC.js +74 -0
  70. package/dist/stores/feature.d.ts +12 -0
  71. package/dist/stores/integration/netsuite.d.ts +42 -0
  72. package/dist/stores/inventory.d.ts +28 -199
  73. package/dist/stores/location.d.ts +331 -1
  74. package/dist/stores/supplier.d.ts +96 -0
  75. package/dist/stores/warehouse.d.ts +4 -0
  76. package/dist/style.css +1 -1
  77. package/dist/{supplier-CTVE1lHO.js → supplier-BPPBUudN.js} +1 -1
  78. package/dist/tsconfig.app.tsbuildinfo +1 -1
  79. package/dist/{use-ingredient-select-dialog-CM80TfX0.js → use-ingredient-select-dialog-C_fSKN3_.js} +5 -5
  80. package/dist/{use-inventory-binding-dialog-D_omdhgn.js → use-inventory-binding-dialog-ClAkJ864.js} +8 -8
  81. package/dist/views/adjustment-template/wastage-template/actions.d.ts +60 -0
  82. package/dist/views/adjustment-template/wastage-template/table.d.ts +60 -0
  83. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +56 -0
  84. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +3 -3
  85. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +468 -0
  86. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +9 -2
  87. package/dist/views/closing-history/ClosingHistoryView.vue.d.ts +2 -0
  88. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +4 -1
  89. package/dist/views/closing-template/helpers/import-export.helper.d.ts +5 -0
  90. package/dist/views/import/ImportView.vue.d.ts +3 -0
  91. package/dist/views/import/components/ImportDialog.vue.d.ts +2 -0
  92. package/dist/views/import/helper/import-export.helper.d.ts +4 -0
  93. package/dist/views/ingredients/components/ingredient-dialog/IngredientDialogProps.d.ts +1 -1
  94. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +181 -12
  95. package/dist/views/ingredients/components/ingredient-form/IngredientFormProps.d.ts +6 -0
  96. package/dist/views/ingredients/helper/import-export.helper.d.ts +4 -1
  97. package/dist/views/integration/components/netsuite/business/BusinessNetSuiteSideSheet.vue.d.ts +2 -0
  98. package/dist/views/receive-request/components/delivery-order-form/CreateForm.vue.d.ts +16 -0
  99. package/dist/views/receive-request/components/delivery-order-form/CreateFormProps.d.ts +4 -0
  100. package/dist/views/receive-request/components/delivery-order-form/EditForm.vue.d.ts +16 -0
  101. package/dist/views/receive-request/components/delivery-order-form/EditFormProps.d.ts +4 -0
  102. package/dist/views/receive-request/components/delivery-order-form/SystemTrailDialog.vue.d.ts +21 -0
  103. package/dist/views/receive-request/components/netsuite/NetSuiteTransactionChangeLog.vue.d.ts +15 -0
  104. package/dist/views/receive-request/components/transfer-details/TransferDetailsProps.d.ts +1 -0
  105. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +420 -2
  106. package/dist/views/receive-request/composables/use-process-purchase-order.d.ts +99 -0
  107. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +644 -13
  108. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +711 -14
  109. package/dist/views/recipe/RecipeView.vue.d.ts +1 -0
  110. package/dist/views/recipe/components/import-recipes/ImportRecipeItem.vue.d.ts +16 -0
  111. package/dist/views/recipe/components/import-recipes/ImportRecipes.vue.d.ts +2 -0
  112. package/dist/views/recipe/helper/import-recipe.d.ts +48 -0
  113. package/dist/views/stock/components/StockRecordCard.vue.d.ts +70 -1
  114. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +11 -0
  115. package/dist/views/stock/components/dialog/RecalculationDialogProps.d.ts +3 -0
  116. package/dist/views/stock/components/dialog/StockAdjustmentSideSheet.vue.d.ts +20 -0
  117. package/dist/views/supplier/components/SupplierForm.vue.d.ts +8 -0
  118. package/dist/views/supplier/components/SupplierSupplyItemField.vue.d.ts +3 -0
  119. package/dist/views/supplier/composables/use-supplier-table.d.ts +4 -0
  120. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +8 -0
  121. package/dist/views/transfer-template/components/transfer-template-form/components/NetSuiteCustomCodeSelection.vue.d.ts +2 -0
  122. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +16 -0
  123. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +48 -0
  124. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +48 -0
  125. package/dist/views/unit/UnitView.vue.d.ts +1 -0
  126. package/dist/views/unit/components/import-units/ImportUnitItem.vue.d.ts +12 -0
  127. package/dist/views/unit/components/import-units/ImportUnitItemProps.d.ts +6 -0
  128. package/dist/views/unit/components/import-units/ImportUnits.vue.d.ts +9 -0
  129. package/dist/views/unit/components/import-units/ImportUnitsProps.d.ts +5 -0
  130. package/dist/views/unit/helper/import-export.helper.d.ts +40 -0
  131. package/dist/views/warehouse/components/WarehouseForm.vue.d.ts +8 -0
  132. package/package.json +3 -3
  133. package/dist/App-BqaRC0Sb.js +0 -276
  134. package/dist/ClosingDraftView-sJ_zRPeo.js +0 -1687
  135. package/dist/ClosingTemplateView-cNgXHq1r.js +0 -1908
  136. package/dist/FmAdminBadge-oCnz8SW6.js +0 -34
  137. package/dist/FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-BKR8C4p_.js +0 -224
  138. package/dist/IngredientsView-CHHeAJH_.js +0 -1858
  139. package/dist/RecipeView-BukmKdVG.js +0 -621
  140. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +0 -59
  141. package/dist/StockView-wxRCw_w-.js +0 -2087
  142. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-eqUOnJoM.js +0 -2336
  143. package/dist/UnitView-BgwDmGZo.js +0 -667
  144. package/dist/WarehouseView-BdccenhO.js +0 -1034
  145. package/dist/array-Ca8T3f_G.js +0 -44
  146. package/dist/helper/core/country/codes.d.ts +0 -255
  147. package/dist/stock-BJP5BB5b.js +0 -146
@@ -0,0 +1,674 @@
1
+ import { defineComponent as J, computed as b, openBlock as v, createElementBlock as w, createElementVNode as s, Fragment as K, renderList as G, toDisplayString as h, createCommentVNode as Q, ref as I, watch as oe, resolveComponent as E, createBlock as T, withCtx as A, createVNode as f, 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 O, e as U, S as ye, i as be, D as se, j as q, f as ie, $ as ge, r as H, A as xe, n as W, a0 as _e, a1 as he, y as ae, u as Ve, b as Ue, G as we, I as Ce, J as Se, K as ke, L as Fe } from "./app-a9r50k3U.js";
3
+ import { useDialog as ue, useSnackbar as Z, useProxiedModel as re, useBreakpoints as $e } from "@feedmepos/ui-library";
4
+ import { i as Ee, _ as Ie } from "./is-linked-ingredient-error-fJ2TJb3z.js";
5
+ import { defineStore as Ae, storeToRefs as De } from "pinia";
6
+ import { useI18n as Y } from "@feedmepos/mf-common";
7
+ import { F as Re } from "./decimal-AusUnA1W.js";
8
+ import { _ as Me } from "./NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CdaiYTdf.js";
9
+ const Pe = { class: "flex flex-col gap-8" }, Te = {
10
+ key: 0,
11
+ class: "flex flex-col"
12
+ }, Be = { class: "flex-1 py-8 px-16" }, Le = {
13
+ class: "flex-0 py-8 px-16",
14
+ style: { "flex-basis": "240px" }
15
+ }, Ne = {
16
+ key: 1,
17
+ class: "flex flex-col"
18
+ }, ze = { class: "flex-1 py-8 px-16" }, je = {
19
+ class: "flex-0 py-8 px-16",
20
+ style: { "flex-basis": "240px" }
21
+ }, qe = {
22
+ key: 2,
23
+ class: "flex flex-col"
24
+ }, He = { class: "flex-1 py-8 px-16" }, Ke = {
25
+ class: "flex-0 py-8 px-16",
26
+ style: { "flex-basis": "240px" }
27
+ }, Ge = /* @__PURE__ */ J({
28
+ __name: "UnitUsedBy",
29
+ props: {
30
+ unit: {}
31
+ },
32
+ setup(S) {
33
+ const c = S, g = O(), m = b(() => g.validateUnitUsage(c.unit)), l = b(() => m.value.filter((n) => n.from === "INGREDIENT")), a = b(() => m.value.filter((n) => n.from === "RECIPE")), d = b(() => m.value.filter((n) => n.from === "MENU"));
34
+ return (n, p) => (v(), w("div", Pe, [
35
+ p[3] || (p[3] = s("div", { class: "fm-typo-en-body-md-400" }, "Sorry, this unit is used in the following modules:", -1)),
36
+ l.value.length ? (v(), w("div", Te, [
37
+ p[0] || (p[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" }, [
38
+ s("div", { class: "flex-1 py-8 px-16" }, "Ingredient"),
39
+ s("div", {
40
+ class: "flex-0 py-8 px-16",
41
+ style: { "flex-basis": "240px" }
42
+ }, "Used in")
43
+ ], -1)),
44
+ (v(!0), w(K, null, G(l.value, (r) => {
45
+ var t;
46
+ return v(), w("div", {
47
+ key: r.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
+ s("div", Be, h(r.code) + " " + h(r.name), 1),
51
+ s("div", Le, h((t = r.bindedIngredient) != null && t.length ? "Convert binding" : "Item unit"), 1)
52
+ ]);
53
+ }), 128))
54
+ ])) : Q("", !0),
55
+ a.value.length ? (v(), w("div", Ne, [
56
+ p[1] || (p[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" }, [
57
+ s("div", { class: "flex-1 py-8 px-16" }, "Recipe"),
58
+ s("div", {
59
+ class: "flex-0 py-8 px-16",
60
+ style: { "flex-basis": "240px" }
61
+ }, "Used in")
62
+ ], -1)),
63
+ (v(!0), w(K, null, G(a.value, (r) => {
64
+ var t, u, y;
65
+ return v(), w("div", {
66
+ key: r.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
+ s("div", ze, h(r.code) + " " + h(r.name), 1),
70
+ s("div", je, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((k) => k.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((y = r.bindedIngredient) == null ? void 0 : y.length) - 3} more` : ""), 1)
71
+ ]);
72
+ }), 128))
73
+ ])) : Q("", !0),
74
+ d.value.length ? (v(), w("div", qe, [
75
+ p[2] || (p[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" }, [
76
+ s("div", { class: "flex-1 py-8 px-16" }, "Menu"),
77
+ s("div", {
78
+ class: "flex-0 py-8 px-16",
79
+ style: { "flex-basis": "240px" }
80
+ }, "Used in")
81
+ ], -1)),
82
+ (v(!0), w(K, null, G(d.value, (r) => {
83
+ var t, u, y;
84
+ return v(), w("div", {
85
+ key: r.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
+ s("div", He, h(r.code) + " " + h(r.name), 1),
89
+ s("div", Ke, h((t = r.bindedIngredient) == null ? void 0 : t.slice(0, 3).map((k) => k.code).join(", ")) + " " + h(r.bindedIngredient && ((u = r.bindedIngredient) == null ? void 0 : u.length) > 3 ? `and ${((y = r.bindedIngredient) == null ? void 0 : y.length) - 3} more` : ""), 1)
90
+ ]);
91
+ }), 128))
92
+ ])) : Q("", !0)
93
+ ]));
94
+ }
95
+ }), X = Ae("unitForm", function() {
96
+ const c = ue(), g = Z(), m = O(), l = I(!1), a = I();
97
+ function d() {
98
+ const t = {
99
+ unit: {},
100
+ mode: U.CREATE,
101
+ show: !0,
102
+ "onUpdate:show"(u) {
103
+ a.value.show = u;
104
+ }
105
+ };
106
+ a.value = t;
107
+ }
108
+ async function n(t) {
109
+ const u = {
110
+ unit: t,
111
+ mode: U.UPDATE,
112
+ show: !0,
113
+ "onUpdate:show"(y) {
114
+ a.value.show = y;
115
+ }
116
+ };
117
+ a.value = u;
118
+ }
119
+ async function p(t) {
120
+ l.value = !0;
121
+ try {
122
+ await m.deleteUnit(t), g.open({
123
+ title: "Success",
124
+ message: `Deleted ${t.name}`,
125
+ type: "success"
126
+ });
127
+ } catch (u) {
128
+ u instanceof ye && Ee(u) ? c.open({
129
+ title: "Cannot delete unit",
130
+ contentComponent: Ie,
131
+ contentComponentProps: {
132
+ subject: (t == null ? void 0 : t.name) ?? "",
133
+ items: u.errorResponse.message
134
+ },
135
+ secondaryActions: {
136
+ text: "Close",
137
+ close: !0
138
+ }
139
+ }) : console.log("unable to delete unit", u), g.open({
140
+ title: `Cannot delete ${t.name}`,
141
+ message: "Please try again.",
142
+ type: "error"
143
+ }), console.error("failed to delete unit", u);
144
+ } finally {
145
+ l.value = !1;
146
+ }
147
+ }
148
+ function r(t) {
149
+ if (m.validateUnitUsage(t).length) {
150
+ c.open({
151
+ title: `Cannot delete ${(t == null ? void 0 : t.name) ?? "unit"}`,
152
+ overlay: !0,
153
+ dismissAway: !0,
154
+ closeButton: !0,
155
+ contentComponent: Ge,
156
+ contentComponentProps: {
157
+ unit: t
158
+ },
159
+ primaryActions: {
160
+ text: "Confirm",
161
+ close: !0
162
+ }
163
+ });
164
+ return;
165
+ }
166
+ c.open({
167
+ title: `Delete ${(t == null ? void 0 : t.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(t));
180
+ }
181
+ return {
182
+ createUnit: d,
183
+ updateUnit: n,
184
+ deleteUnit: r,
185
+ unitDialogProps: a,
186
+ unitViewLoading: l
187
+ };
188
+ });
189
+ function Je() {
190
+ const { updateUnit: S, deleteUnit: c } = X(), { t: g } = Y();
191
+ async function m(a, d) {
192
+ const n = ie(d);
193
+ if (a === q.Edit) {
194
+ await S(n);
195
+ return;
196
+ }
197
+ if (a === q.Delete) {
198
+ await c(n);
199
+ return;
200
+ }
201
+ }
202
+ return { columnDefs: [
203
+ {
204
+ accessorKey: "name",
205
+ header: g("inventory.unit.table.name"),
206
+ enableSorting: !0,
207
+ size: 300
208
+ },
209
+ {
210
+ accessorKey: "abbrev",
211
+ header: g("inventory.unit.table.symbol"),
212
+ enableSorting: !1,
213
+ size: "auto"
214
+ },
215
+ {
216
+ id: "action",
217
+ header: "",
218
+ cell(a) {
219
+ return be(
220
+ [se[q.Edit], se[q.Delete]],
221
+ (d) => {
222
+ m(d, a.row.original);
223
+ }
224
+ );
225
+ },
226
+ enableSorting: !1,
227
+ size: 40,
228
+ meta: {
229
+ cellClass: "",
230
+ headerClass: ""
231
+ }
232
+ }
233
+ ] };
234
+ }
235
+ const Oe = { class: "flex flex-col gap-24" }, Ye = { class: "flex gap-24" }, Qe = { class: "flex-1" }, We = { class: "flex-1" }, Xe = { class: "flex" }, Ze = { class: "flex items-center" }, et = { class: "fm-typo-en-body-lg-600 flex-grow" }, tt = { class: "flex flex-col gap-24" }, nt = { class: "flex gap-24" }, ot = { class: "flex-1" }, lt = { class: "flex-1" }, st = /* @__PURE__ */ J({
236
+ __name: "UnitForm",
237
+ props: {
238
+ mode: {},
239
+ modelValue: {},
240
+ disabled: { type: Boolean }
241
+ },
242
+ emits: ["update:modelValue", "click:submit"],
243
+ setup(S, { expose: c, emit: g }) {
244
+ const m = S, l = g, { t: a } = Y();
245
+ function d() {
246
+ l("click:submit");
247
+ }
248
+ const n = I(m.modelValue);
249
+ oe(
250
+ () => m.modelValue,
251
+ (e) => {
252
+ n.value = e;
253
+ }
254
+ );
255
+ const p = b({
256
+ get() {
257
+ var e;
258
+ return ((e = n.value) == null ? void 0 : e.name) ?? "";
259
+ },
260
+ set(e) {
261
+ n.value.name = e, l("update:modelValue", n.value);
262
+ }
263
+ }), r = b({
264
+ get() {
265
+ var e;
266
+ return ((e = n.value) == null ? void 0 : e.abbrev) ?? "";
267
+ },
268
+ set(e) {
269
+ n.value.abbrev = e, l("update:modelValue", n.value);
270
+ }
271
+ }), t = b({
272
+ get() {
273
+ var e;
274
+ return ((e = n.value) == null ? void 0 : e.precision) ?? 0;
275
+ },
276
+ set(e) {
277
+ n.value.precision = e, l("update:modelValue", n.value);
278
+ }
279
+ }), u = b({
280
+ get() {
281
+ var e;
282
+ return ((e = n.value) == null ? void 0 : e.measurements) ?? [];
283
+ },
284
+ set(e) {
285
+ n.value.measurements = e, l("update:modelValue", n.value);
286
+ }
287
+ });
288
+ oe(
289
+ () => t.value,
290
+ (e) => {
291
+ if (typeof e == "number" && !isNaN(e)) {
292
+ const o = u.value.map((V) => ({
293
+ ...V,
294
+ conversion: ge.convertPrecision({
295
+ value: V.conversion,
296
+ precision: e
297
+ })
298
+ }));
299
+ n.value.measurements = o, l("update:modelValue", n.value);
300
+ }
301
+ },
302
+ { immediate: !0 }
303
+ );
304
+ function y() {
305
+ const e = n.value.measurements ?? [];
306
+ n.value.measurements = [
307
+ ...e,
308
+ {
309
+ id: `measurement_${(/* @__PURE__ */ new Date()).toISOString()}_${Math.random().toString(16).slice(2, 8)}`,
310
+ name: "",
311
+ abbrev: "",
312
+ conversion: {
313
+ amount: 1,
314
+ precision: 0
315
+ }
316
+ }
317
+ ], l("update:modelValue", n.value);
318
+ }
319
+ function k(e) {
320
+ const o = n.value.measurements ?? [];
321
+ o.splice(e, 1), n.value.measurements = o, l("update:modelValue", n.value);
322
+ }
323
+ const $ = I();
324
+ return c({
325
+ validateInputs: () => {
326
+ var e, o;
327
+ (o = (e = $.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
328
+ },
329
+ resetInputsValidation: () => {
330
+ var e, o;
331
+ (o = (e = $.value) == null ? void 0 : e.resetInputsValidation) == null || o.call(e);
332
+ },
333
+ resetInputs: () => {
334
+ var e, o;
335
+ (o = (e = $.value) == null ? void 0 : e.resetInputs) == null || o.call(e);
336
+ }
337
+ }), (e, o) => {
338
+ const V = E("FmTextField"), R = E("FmStepperField"), C = E("FmButton"), M = E("FmCard"), D = E("FmForm");
339
+ return v(), T(D, {
340
+ ref_key: "formRef",
341
+ ref: $,
342
+ class: "flex flex-col gap-40",
343
+ onValidationSuccess: d
344
+ }, {
345
+ default: A(() => {
346
+ var B;
347
+ return [
348
+ s("div", Oe, [
349
+ s("div", Ye, [
350
+ s("div", Qe, [
351
+ f(V, {
352
+ disabled: e.disabled,
353
+ label: i(a)("inventory.unit.name"),
354
+ modelValue: p.value,
355
+ "onUpdate:modelValue": o[0] || (o[0] = (x) => p.value = x),
356
+ rules: [i(H)()],
357
+ "label-mark": "required"
358
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
359
+ ]),
360
+ s("div", We, [
361
+ f(V, {
362
+ disabled: e.disabled,
363
+ label: i(a)("inventory.unit.symbol"),
364
+ modelValue: r.value,
365
+ "onUpdate:modelValue": o[1] || (o[1] = (x) => r.value = x),
366
+ rules: [i(H)()],
367
+ "label-mark": "required"
368
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
369
+ ])
370
+ ]),
371
+ s("div", null, [
372
+ f(R, {
373
+ disabled: e.disabled,
374
+ class: "col-span-3",
375
+ label: i(a)("inventory.unit.precision"),
376
+ modelValue: t.value,
377
+ "onUpdate:modelValue": o[2] || (o[2] = (x) => t.value = x),
378
+ rules: [i(xe)(0)]
379
+ }, null, 8, ["disabled", "label", "modelValue", "rules"])
380
+ ])
381
+ ]),
382
+ s("div", Xe, [
383
+ f(C, {
384
+ disabled: e.disabled,
385
+ type: "button",
386
+ "prepend-icon": "add",
387
+ label: i(a)("inventory.unit.measurement.addMeasurement"),
388
+ variant: "plain",
389
+ onClick: y
390
+ }, null, 8, ["disabled", "label"])
391
+ ]),
392
+ (v(!0), w(K, null, G((B = e.modelValue) == null ? void 0 : B.measurements, (x, _) => (v(), T(M, {
393
+ class: "flex flex-col gap-16 p-16",
394
+ variant: "outlined",
395
+ key: x.id
396
+ }, {
397
+ default: A(() => [
398
+ s("div", Ze, [
399
+ s("div", et, h(i(a)("inventory.unit.measurement.measurementDefault", [_ + 1])), 1),
400
+ f(C, {
401
+ disabled: e.disabled,
402
+ variant: "tertiary",
403
+ "prepend-icon": "delete",
404
+ onClick: (F) => k(_)
405
+ }, null, 8, ["disabled", "onClick"])
406
+ ]),
407
+ s("div", tt, [
408
+ s("div", nt, [
409
+ s("div", ot, [
410
+ f(V, {
411
+ disabled: e.disabled,
412
+ class: "col-span-2",
413
+ label: i(a)("inventory.unit.measurement.name"),
414
+ modelValue: e.modelValue.measurements[_].name,
415
+ "onUpdate:modelValue": (F) => e.modelValue.measurements[_].name = F,
416
+ rules: [i(H)()],
417
+ "label-mark": "required"
418
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
419
+ ]),
420
+ s("div", lt, [
421
+ f(V, {
422
+ disabled: e.disabled,
423
+ label: i(a)("inventory.unit.measurement.symbol"),
424
+ modelValue: e.modelValue.measurements[_].abbrev,
425
+ "onUpdate:modelValue": (F) => e.modelValue.measurements[_].abbrev = F,
426
+ rules: [i(H)()],
427
+ "label-mark": "required"
428
+ }, null, 8, ["disabled", "label", "modelValue", "onUpdate:modelValue", "rules"])
429
+ ])
430
+ ]),
431
+ f(Me, {
432
+ disabled: e.disabled,
433
+ class: "col-span-3",
434
+ label: i(a)("inventory.unit.measurement.conversion"),
435
+ "model-value": +i(W)(e.modelValue.measurements[_].conversion),
436
+ "onUpdate:modelValue": (F) => u.value = u.value.map(
437
+ (P, L) => L === _ ? {
438
+ ...P,
439
+ conversion: i(Re).toPrecision(
440
+ i(_e)(F),
441
+ t.value
442
+ )
443
+ } : P
444
+ ),
445
+ rules: [i(he)(0)],
446
+ step: +i(W)({ amount: 1, precision: t.value }),
447
+ "helper-text": i(a)("inventory.unit.measurement.conversionHelper", {
448
+ measurementSymbol: e.modelValue.measurements[_].name || " measurement unit",
449
+ conversion: +i(W)(e.modelValue.measurements[_].conversion),
450
+ unitSymbol: r.value || "base unit"
451
+ })
452
+ }, null, 8, ["disabled", "label", "model-value", "onUpdate:modelValue", "rules", "step", "helper-text"])
453
+ ])
454
+ ]),
455
+ _: 2
456
+ }, 1024))), 128))
457
+ ];
458
+ }),
459
+ _: 1
460
+ }, 512);
461
+ };
462
+ }
463
+ }), at = { class: "flex gap-4" }, rt = /* @__PURE__ */ J({
464
+ __name: "UnitDialog",
465
+ props: {
466
+ show: { type: Boolean },
467
+ unit: {},
468
+ mode: { default: U.READ }
469
+ },
470
+ emits: ["update:show"],
471
+ setup(S) {
472
+ const c = S, g = O(), m = Z(), { t: l } = Y(), a = re(c, "show"), d = re(c, "unit"), n = b(() => {
473
+ switch (c.mode) {
474
+ case U.READ:
475
+ return "";
476
+ case U.UPDATE:
477
+ return l("inventory.unit.update.title");
478
+ case U.CREATE:
479
+ return l("inventory.unit.create.title");
480
+ }
481
+ return "";
482
+ }), p = b(() => {
483
+ switch (c.mode) {
484
+ case U.READ:
485
+ return "";
486
+ case U.UPDATE:
487
+ return l("common.save");
488
+ case U.CREATE:
489
+ return l("common.add");
490
+ }
491
+ return "";
492
+ }), r = I(), t = I(!1);
493
+ async function u() {
494
+ t.value = !0;
495
+ try {
496
+ const e = ie(d.value);
497
+ e.precision ?? (e.precision = 0), e.measurements ?? (e.measurements = []), await g.createUnit(e), a.value = !1, m.open({
498
+ title: l("inventory.common.success"),
499
+ message: l("inventory.unit.create.success", { name: d.value.name }),
500
+ type: "success"
501
+ });
502
+ } catch (e) {
503
+ e instanceof ae || m.open({
504
+ title: l("inventory.unit.create.error.title"),
505
+ message: l("inventory.unit.create.error.message"),
506
+ type: "error"
507
+ });
508
+ } finally {
509
+ t.value = !1;
510
+ }
511
+ }
512
+ async function y() {
513
+ t.value = !0;
514
+ try {
515
+ await g.updateUnit(d.value), a.value = !1, m.open({
516
+ title: l("inventory.common.success"),
517
+ message: l("inventory.unit.update.success", { name: d.value.name }),
518
+ type: "success"
519
+ });
520
+ } catch (e) {
521
+ e instanceof ae || m.open({
522
+ title: l("inventory.unit.update.error.title"),
523
+ message: l("inventory.unit.update.error.message"),
524
+ type: "error"
525
+ });
526
+ } finally {
527
+ t.value = !1;
528
+ }
529
+ }
530
+ function k() {
531
+ var e, o;
532
+ (o = (e = r.value) == null ? void 0 : e.validateInputs) == null || o.call(e);
533
+ }
534
+ function $() {
535
+ switch (c.mode) {
536
+ case U.READ:
537
+ return;
538
+ case U.UPDATE:
539
+ return y();
540
+ case U.CREATE:
541
+ return u();
542
+ }
543
+ }
544
+ return (e, o) => {
545
+ const V = E("FmButton"), R = E("FmSideSheet");
546
+ return v(), T(R, {
547
+ "model-value": i(a),
548
+ "onUpdate:modelValue": o[3] || (o[3] = (C) => le(a) ? a.value = C : null),
549
+ header: n.value,
550
+ "close-button": "",
551
+ "dismiss-away": "",
552
+ "max-width": 500
553
+ }, {
554
+ "side-sheet-footer": A(() => [
555
+ s("div", at, [
556
+ f(V, {
557
+ loading: t.value,
558
+ label: p.value,
559
+ onClick: k
560
+ }, null, 8, ["loading", "label"]),
561
+ f(V, {
562
+ disabled: t.value,
563
+ label: i(l)("common.close"),
564
+ variant: "tertiary",
565
+ onClick: o[2] || (o[2] = (C) => a.value = !1)
566
+ }, null, 8, ["disabled", "label"])
567
+ ])
568
+ ]),
569
+ default: A(() => [
570
+ f(st, {
571
+ class: "w-full",
572
+ ref_key: "hasValidationExpose",
573
+ ref: r,
574
+ modelValue: i(d),
575
+ "onUpdate:modelValue": o[0] || (o[0] = (C) => le(d) ? d.value = C : null),
576
+ mode: e.mode,
577
+ disabled: t.value,
578
+ "onClick:submit": o[1] || (o[1] = (C) => $())
579
+ }, null, 8, ["modelValue", "mode", "disabled"])
580
+ ]),
581
+ _: 1
582
+ }, 8, ["model-value", "header"]);
583
+ };
584
+ }
585
+ }), it = { class: "flex flex-col py-8" }, ut = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = /* @__PURE__ */ J({
586
+ __name: "UnitView",
587
+ setup(S) {
588
+ const c = O(), g = Ve(), m = Ue();
589
+ ue(), Z();
590
+ const { t: l } = Y(), a = b(() => c.units), { createUnit: d, updateUnit: n } = X(), { unitDialogProps: p, unitViewLoading: r } = De(X()), { columnDefs: t } = Je();
591
+ function u(M) {
592
+ switch (M) {
593
+ case "add":
594
+ return m.isEnabled ? void 0 : d();
595
+ }
596
+ }
597
+ const y = I(""), k = I(!1), $ = b(() => k.value || r.value), { breakpoints: e } = $e(), o = b(() => e.value.xs || e.value.sm), V = b(() => o.value ? 10 : 20), R = we(), C = b(() => [
598
+ ...m.isEnabled ? [] : [
599
+ {
600
+ label: l("inventory.unit.create.title"),
601
+ value: "add",
602
+ isPrimary: !0,
603
+ prependIcon: "add"
604
+ }
605
+ ]
606
+ ]);
607
+ return (M, D) => {
608
+ const B = E("FmTable");
609
+ return v(), T(Ce, {
610
+ title: i(l)("inventory.unit.title"),
611
+ actions: C.value,
612
+ "onClick:action": u
613
+ }, {
614
+ default: A(() => [
615
+ s("div", {
616
+ class: me([
617
+ "flex flex-col gap-8 max-h-full",
618
+ {
619
+ "p-0": o.value,
620
+ "px-24 ": !o.value
621
+ }
622
+ ])
623
+ }, [
624
+ f(Se, {
625
+ searchable: "",
626
+ search: y.value,
627
+ "onUpdate:search": D[0] || (D[0] = (x) => y.value = x)
628
+ }, null, 8, ["search"]),
629
+ f(B, {
630
+ style: ce(i(R).tableHeight),
631
+ "column-defs": i(t),
632
+ "row-data": a.value,
633
+ "search-value": y.value,
634
+ loading: !i(g)._currentLocation || $.value,
635
+ onRowClick: D[1] || (D[1] = (x) => i(n)(x.original)),
636
+ "page-size": V.value
637
+ }, {
638
+ "list-row": A((x) => [
639
+ f(ke, {
640
+ row: x,
641
+ onRowClick: i(n)
642
+ }, {
643
+ default: A((_) => {
644
+ var F, P, L, N, ee, z, te, j, ne;
645
+ return [
646
+ s("div", it, [
647
+ s("div", ut, [
648
+ f(i(Fe), {
649
+ render: (L = (P = (F = _.name) == null ? void 0 : F.column) == null ? void 0 : P.columnDef) == null ? void 0 : L.cell,
650
+ props: (ee = (N = _.name) == null ? void 0 : N.getContext) == null ? void 0 : ee.call(N)
651
+ }, null, 8, ["render", "props"])
652
+ ]),
653
+ s("div", dt, h((ne = (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 : ne.call(j, ", ")), 1)
654
+ ])
655
+ ];
656
+ }),
657
+ _: 2
658
+ }, 1032, ["row", "onRowClick"])
659
+ ]),
660
+ _: 1
661
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
662
+ ], 2),
663
+ (v(), T(pe, { to: "body" }, [
664
+ f(rt, ve(fe(i(p))), null, 16)
665
+ ]))
666
+ ]),
667
+ _: 1
668
+ }, 8, ["title", "actions"]);
669
+ };
670
+ }
671
+ });
672
+ export {
673
+ xt as default
674
+ };