@feedmepos/mf-inventory-portal 1.7.13-dev.4 → 1.7.14

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 (138) hide show
  1. package/dist/App-Blx6Ojzj.js +311 -0
  2. package/dist/{ApprovalView-DO91AQ5f.js → ApprovalView-BPDiAWh_.js} +9 -9
  3. package/dist/{BindingsDialog-DUj0z6N7.js → BindingsDialog-RUlhC05W.js} +2 -2
  4. package/dist/{BindingsPicker-CD2J6-_Z.js → BindingsPicker-voEXbc8p.js} +2 -2
  5. package/dist/{BindingsTable-B2FEKZXU.js → BindingsTable-QuFV3fHq.js} +4 -4
  6. package/dist/BulkReceiveRequestView-Bix6MV0Z.js +2595 -0
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-ashHOuZt.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-CSxFa-Hr.js} +2 -6
  8. package/dist/{ClosingDraftView-tIvrsfYH.js → ClosingDraftView-BUWt7ufW.js} +19 -19
  9. package/dist/ClosingHistoryView-BzQ7f_31.js +761 -0
  10. package/dist/{ClosingTemplateView-C-hL9uPv.js → ClosingTemplateView-BoDHKL2a.js} +16 -16
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BffF8S_q.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-B-t0N1PO.js} +1 -1
  12. package/dist/{DefaultView-BLbtx0Ho.js → DefaultView-CO4Fk0X3.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-BLQHL7aB.js → DeliveryOrderPrintPreview-Clslc2Wf.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-BnTAuutB.js → EmailDialog.vue_vue_type_script_setup_true_lang-BfQdw5-j.js} +2254 -2259
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Mxhn0b6c.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-Brtj-hCD.js} +6 -6
  16. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-hrk0cTBX.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CHUQOFif.js} +2 -2
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-hTQmIyaf.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BqIWvN-i.js} +2 -2
  18. package/dist/{FmMultiselectDialog-Bpi5rI0h.js → FmMultiselectDialog-D7cnUmM5.js} +1 -1
  19. package/dist/{FmMultiselectDialog-Bi6XlAAU.js → FmMultiselectDialog-GAdb6F9O.js} +2 -2
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-e55tnl4u.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DAjM0Dya.js} +6 -6
  21. package/dist/{ImportView-xPTzBekx.js → ImportView-CrmY9zsK.js} +496 -499
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-tvmS42s_.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-Sm0goJ7U.js} +1 -1
  23. package/dist/{IngredientGroupView-RFcqjF8T.js → IngredientGroupView-BebnVDQI.js} +5 -5
  24. package/dist/{IngredientsView-CvWOgquN.js → IngredientsView-CZ6Angq_.js} +17 -18
  25. package/dist/{IntegrationExplorerView-CYNhsJSS.js → IntegrationExplorerView-DxjMZi_f.js} +4 -4
  26. package/dist/{IntegrationView-ZtLokbu3.js → IntegrationView-Dm6Bkv1g.js} +15 -19
  27. package/dist/{InventoryBindingForm-DwiAIf5v.js → InventoryBindingForm-B5Dd6UGk.js} +1 -1
  28. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-D4shlQ9Z.js +441 -0
  29. package/dist/{InventoryBindingSummary-zim_Bp5_.js → InventoryBindingSummary-BO8imeDG.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CfTgt5xW.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Dp6O-oVL.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-LLtd1VvM.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Mkt2BoGf.js} +1 -1
  32. package/dist/{ProductionView-BWn7RBEg.js → ProductionView-DIwvqo6L.js} +7 -7
  33. package/dist/{PublishView-DFXOi7Hx.js → PublishView-CbeljE1v.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-CG6kBQ26.js → PurchaseOrderPrintPreview-PzYdJJW9.js} +2 -2
  35. package/dist/{ReceiveRequestView-DKMVMo7M.js → ReceiveRequestView-NKnqWM_b.js} +14 -14
  36. package/dist/RecipeView-COQ6WUcz.js +3584 -0
  37. package/dist/{SettingsView-Cmf2ZOUL.js → SettingsView-BjX4I2pe.js} +4 -4
  38. package/dist/{StockView-DTai8l8U.js → StockView--9-NLfX0.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BlKm7GLw.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-BWHPauQW.js} +1 -1
  40. package/dist/{SupplierView-CRAHOOLm.js → SupplierView-B8T6cose.js} +12 -12
  41. package/dist/{SurchargeView-3XymEvcr.js → SurchargeView-eVcM29Ss.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-DcXfQr_8.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-CYXfguPD.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-qhJVHahS.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CMM1DWU3.js} +1 -1
  44. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CuNAt9UU.js +4733 -0
  45. package/dist/{TransferTemplateView-ByhvK4Ua.js → TransferTemplateView-D_oKyOUD.js} +20 -20
  46. package/dist/{UnitCostHistoryView-DHHWNJYA.js → UnitCostHistoryView-DThFdkNP.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-bQu2KOI7.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-B6cHxf2Q.js} +4 -4
  48. package/dist/{UnitView-BZTS-Ahu.js → UnitView-BQZepbTS.js} +8 -8
  49. package/dist/WarehouseView-BZSn9BHl.js +1079 -0
  50. package/dist/{WastageTemplateView-CUDL3HUD.js → WastageTemplateView-BQO1geZz.js} +14 -14
  51. package/dist/api/purchase-order.d.ts +0 -2
  52. package/dist/api/stock.d.ts +0 -6
  53. package/dist/{app-BUQUpe4c.js → app-KaSY7GIt.js} +9137 -10098
  54. package/dist/app.d.ts +9 -952
  55. package/dist/app.js +1 -1
  56. package/dist/{closing-template-DzxDiEQB.js → closing-template-BFEWl8-N.js} +1 -1
  57. package/dist/cypress/support/component.d.ts +2 -1
  58. package/dist/{date2-6jkfRNS_.js → date2-DnqAk4pp.js} +5 -5
  59. package/dist/{dayjs.min-ByRnXzrl.js → dayjs.min-e3pyVvVk.js} +1 -1
  60. package/dist/{decimal-CqWBdj8E.js → decimal-DUKpY1WE.js} +2 -2
  61. package/dist/{defineDeepModel-CaT-4fiq.js → defineDeepModel-T75uoBAd.js} +1 -1
  62. package/dist/{duplicate-template-Cyvx-WK7.js → duplicate-template-CdBNGLA2.js} +1 -1
  63. package/dist/{feature-FjXz4WXw.js → feature-dE--ixN-.js} +2 -2
  64. package/dist/{format-time-from-id-cSri3OoO.js → format-time-from-id-D8SWSpBR.js} +1 -1
  65. package/dist/{format-unit-display-DPbcT7Ff.js → format-unit-display-ChGKpRsq.js} +27 -27
  66. package/dist/{import-export.helper-_yqcePYs.js → import-export.helper-BGjE6JjK.js} +6 -6
  67. package/dist/{index-nSL5yxNn.js → index-D_QylMOJ.js} +3 -3
  68. package/dist/{index-CyJVMHQW.js → index-DdMg0SgN.js} +1 -1
  69. package/dist/{index-CGvNoBid.js → index-JPtVC3tk.js} +3232 -3306
  70. package/dist/{inventory-core-dart.default-DSYRPQNZ.js → inventory-core-dart.default-0h8jmf3F.js} +1428 -1322
  71. package/dist/{lz-string-iyER1Klb.js → lz-string-NnYfN1XC.js} +1 -1
  72. package/dist/{netsuite-BD8LVxaA.js → netsuite-CAphkhg7.js} +1387 -1397
  73. package/dist/{number-C7CJ9ZfE.js → number-C8J8sC6d.js} +3 -3
  74. package/dist/{predefined-templates-o-_pKVSM.js → predefined-templates-CB1opHrA.js} +1 -1
  75. package/dist/{purchase-order-template-BHS8T1VA.js → purchase-order-template-p6EdpieI.js} +1 -1
  76. package/dist/{recalculationUtils-BCByr_CU.js → recalculationUtils-C5whNKrN.js} +1 -1
  77. package/dist/{rules-wZo-8FZ0.js → rules-sRZqLpuQ.js} +2 -2
  78. package/dist/{stock-CnAjxV7P.js → stock-BpfRRZPr.js} +3 -3
  79. package/dist/stock-DWrhlch4.js +85 -0
  80. package/dist/stores/bulk-job.d.ts +0 -13
  81. package/dist/style.css +1 -1
  82. package/dist/{supplier-DkqNwQmi.js → supplier-MzC5sRqv.js} +2 -2
  83. package/dist/{surcharge-Csj1WYbH.js → surcharge-ClMtrRgS.js} +8 -8
  84. package/dist/tsconfig.app.tsbuildinfo +1 -1
  85. package/dist/{uom-rules-BI1CdWeS.js → uom-rules-Di7y-2Xl.js} +1 -1
  86. package/dist/{use-ingredient-select-dialog-5AqoZJDA.js → use-ingredient-select-dialog-BPhQJhXq.js} +2 -2
  87. package/dist/{use-inventory-binding-dialog-ChiyhiuP.js → use-inventory-binding-dialog-BStbsMsT.js} +2 -2
  88. package/dist/{use-template-enabled-locations-BqXxegct.js → use-template-enabled-locations-ChCTz0-t.js} +2 -2
  89. package/dist/{use-transfer-locations-Ckj_diGt.js → use-transfer-locations-D8N8x1cE.js} +2 -2
  90. package/dist/{useHrmPermission-USG_KRoq.js → useHrmPermission-DCSqbLxW.js} +1 -1
  91. package/dist/{useNavigationMenu-BhYf87KI.js → useNavigationMenu-D3-zmwIs.js} +2 -2
  92. package/dist/{useSseClient-BqoE-ir6.js → useSseClient-BRHLaPnM.js} +1 -1
  93. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +0 -2
  94. package/dist/views/ingredients/components/inventory-binding/v2/InventoryBindingFormV2.vue.d.ts +0 -2
  95. package/dist/views/ingredients/components/inventory-binding/v2/components/InventoryRecipeBindingV2Field.vue.d.ts +0 -4
  96. package/dist/views/receive-request/components/email-dialog/EmailDialogProps.d.ts +9 -23
  97. package/dist/views/recipe/composables/use-recipe-table.d.ts +0 -11
  98. package/dist/views/stock/components/dialog/RecalculationDialog.vue.d.ts +2 -17
  99. package/dist/{vue-i18n-DoKioQ81.js → vue-i18n-BMo8ADYz.js} +196 -196
  100. package/dist/{xlsx.util-BXjE2o-3.js → xlsx.util-BSzjcX4G.js} +2 -2
  101. package/package.json +2 -2
  102. package/dist/App-Cfp4CqzQ.js +0 -1470
  103. package/dist/BulkReceiveRequestView-ejHyukEp.js +0 -2657
  104. package/dist/ClosingHistoryView-BYVZ01Ma.js +0 -1112
  105. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-njDaQe10.js +0 -563
  106. package/dist/RecipeView-cLLKlLmE.js +0 -3625
  107. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CibsrZXw.js +0 -4781
  108. package/dist/WarehouseView-DVak1RPs.js +0 -1082
  109. package/dist/api/changelog.d.ts +0 -132
  110. package/dist/cypress/component/ChangelogPanel.cy.d.ts +0 -1
  111. package/dist/stock-DwqEvWM5.js +0 -95
  112. package/dist/views/changelog/components/ChangelogDialog.vue.d.ts +0 -19
  113. package/dist/views/changelog/components/ChangelogFloatingButton.spec.d.ts +0 -1
  114. package/dist/views/changelog/components/ChangelogFloatingButton.vue.d.ts +0 -2
  115. package/dist/views/changelog/components/ChangelogPanel.spec.d.ts +0 -1
  116. package/dist/views/changelog/components/ChangelogPanel.vue.d.ts +0 -20
  117. package/dist/views/changelog/composables/change-path.d.ts +0 -10
  118. package/dist/views/changelog/composables/commit-message.d.ts +0 -9
  119. package/dist/views/changelog/composables/commit-message.spec.d.ts +0 -1
  120. package/dist/views/changelog/composables/fab-position.d.ts +0 -21
  121. package/dist/views/changelog/composables/json-line-diff.d.ts +0 -10
  122. package/dist/views/changelog/composables/json-line-diff.spec.d.ts +0 -1
  123. package/dist/views/changelog/composables/use-changelog.d.ts +0 -90
  124. package/dist/views/changelog/composables/use-changelog.spec.d.ts +0 -1
  125. package/dist/views/changelog/composables/use-inventory-record-commits.d.ts +0 -97
  126. package/dist/views/changelog/composables/use-inventory-record-commits.spec.d.ts +0 -1
  127. package/dist/views/changelog/composables/use-snapshot-diff.d.ts +0 -29
  128. package/dist/views/changelog/composables/use-snapshot-diff.spec.d.ts +0 -1
  129. package/dist/views/changelog/composables/value-tree.d.ts +0 -14
  130. package/dist/views/changelog/composables/value-tree.spec.d.ts +0 -1
  131. package/dist/views/import/helper/submit-rows.d.ts +0 -13
  132. package/dist/views/import/helper/submit-rows.spec.d.ts +0 -1
  133. package/dist/views/ingredients/components/inventory-binding/RecipeBindingBreakdown.vue.d.ts +0 -25
  134. package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.d.ts +0 -34
  135. package/dist/views/ingredients/components/inventory-binding/composables/recipe-breakdown.spec.d.ts +0 -1
  136. package/dist/views/receive-request/components/email-dialog/EmailDialog.spec.d.ts +0 -1
  137. package/dist/views/stock/components/StockRecalculateDialog.vue.d.ts +0 -9
  138. package/dist/views/stock/components/dialog/SnapshotRecalculationDialog.vue.d.ts +0 -24
@@ -1,1082 +0,0 @@
1
- import { ref as T, defineComponent as j, watch as te, onMounted as le, onUnmounted as Te, createElementBlock as q, openBlock as R, toRaw as Ve, reactive as Re, createElementVNode as w, createVNode as k, toDisplayString as N, unref as r, resolveComponent as L, createBlock as O, createCommentVNode as oe, createSlots as Ee, withCtx as B, createTextVNode as Me, renderSlot as We, computed as A, isRef as _e, normalizeClass as Pe, normalizeStyle as Ue } from "vue";
2
- import { d as Ne, n as Le, o as Ie, c as z, p as Be, S as qe, u as ze } from "./app-BUQUpe4c.js";
3
- import { useCoreStore as Fe, useI18n as G } from "@feedmepos/mf-common";
4
- import { D as ke, R as Q } from "./row-action.enum-ncgDYAjP.js";
5
- import { c as Oe } from "./component-BmLAdDiY.js";
6
- import { u as xe } from "./netsuite-BD8LVxaA.js";
7
- import { u as je, _ as Ge } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DpwneGOV.js";
8
- import { F as D } from "./form-mode.enum-BKiNVH6A.js";
9
- import { useDialogChild as Ke, useDialog as Se, useSnackbar as se, useProxiedModel as ae, useBreakpoints as He } from "@feedmepos/ui-library";
10
- import { R as I } from "./rules-wZo-8FZ0.js";
11
- import { c as $e, u as re, g as Ye } from "./googlemap-D9vA7GsS.js";
12
- import { d as Ze } from "./index-CyJVMHQW.js";
13
- import { _ as Je } from "./_plugin-vue_export-helper-CHgC5LLL.js";
14
- import { _ as Qe } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-CG1m-B2p.js";
15
- import { u as Xe } from "./feature-FjXz4WXw.js";
16
- import { _ as eo, F as X } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-DAMpuZ1X.js";
17
- import { _ as oo } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-hTQmIyaf.js";
18
- const ee = Ne((f, b) => {
19
- const g = Fe();
20
- return {
21
- async readWarehouses() {
22
- var i;
23
- const a = ((i = g.currentBusiness.value) == null ? void 0 : i._id) ?? "", s = `${f.inventoryBackendUrl}/businesses/${a}/warehouses`;
24
- return await b.get(s);
25
- },
26
- async createWarehouse(a) {
27
- var n;
28
- const s = ((n = g.currentBusiness.value) == null ? void 0 : n._id) ?? "", i = `${f.inventoryBackendUrl}/businesses/${s}/warehouse`;
29
- return await b.post(i, a);
30
- },
31
- async updateWarehouse(a, s) {
32
- var d;
33
- const i = ((d = g.currentBusiness.value) == null ? void 0 : d._id) ?? "", n = `${f.inventoryBackendUrl}/businesses/${i}/warehouse/${a}`;
34
- return await b.put(n, s);
35
- },
36
- async deleteWarehouse(a) {
37
- var n;
38
- const s = ((n = g.currentBusiness.value) == null ? void 0 : n._id) ?? "", i = `${f.inventoryBackendUrl}/businesses/${s}/warehouse/${a}`;
39
- return await b.delete(i);
40
- }
41
- };
42
- });
43
- function to() {
44
- return {
45
- warehouses: []
46
- };
47
- }
48
- const Ae = T(to());
49
- function De() {
50
- return {
51
- // state
52
- get warehouses() {
53
- return Ae.value.warehouses;
54
- },
55
- set warehouses(f) {
56
- Ae.value.warehouses = f;
57
- },
58
- // actions
59
- async readWarehouses() {
60
- const f = ee();
61
- this.warehouses = await f.readWarehouses();
62
- },
63
- async createWarehouse(f) {
64
- await ee().createWarehouse(f);
65
- },
66
- async updateWarehouse(f) {
67
- await ee().updateWarehouse(f._id, {
68
- ...f.profile,
69
- preparationTime: f.preparationTime
70
- });
71
- },
72
- async deleteWarehouse(f) {
73
- await ee().deleteWarehouse(f._id);
74
- },
75
- async init() {
76
- const f = Le();
77
- try {
78
- await this.readWarehouses();
79
- } catch (b) {
80
- throw b instanceof Ie || f.error("Error at reading warehouses"), b;
81
- }
82
- }
83
- };
84
- }
85
- function ao(f, b) {
86
- const g = xe();
87
- function a(d, v) {
88
- if (d === Q.Edit) {
89
- f(z(v));
90
- return;
91
- }
92
- if (d === Q.Delete) {
93
- b(z(v));
94
- return;
95
- }
96
- }
97
- const { t: s } = G(), i = [
98
- {
99
- accessorKey: "warehouse",
100
- header: () => s("inventory.warehouse.table.warehouse"),
101
- size: 200
102
- },
103
- {
104
- accessorKey: "contact",
105
- header: () => s("inventory.warehouse.table.contact"),
106
- size: 200
107
- },
108
- {
109
- accessorKey: "email",
110
- header: () => s("inventory.warehouse.table.email"),
111
- size: 200
112
- },
113
- {
114
- accessorKey: "address",
115
- header: () => s("inventory.warehouse.table.address"),
116
- size: "auto"
117
- },
118
- {
119
- id: "action",
120
- header: "",
121
- cell(d) {
122
- const v = g.isEnabled ? [] : [ke[Q.Edit], ke[Q.Delete]];
123
- return Oe(v, (l) => {
124
- a(l, d.row.original.original);
125
- });
126
- },
127
- enableSorting: !1,
128
- size: 40,
129
- meta: {
130
- cellClass: "",
131
- headerClass: ""
132
- }
133
- }
134
- ];
135
- function n(d) {
136
- return d.map((v) => ({
137
- original: v,
138
- warehouse: v.profile.name,
139
- contact: v.profile.phoneNo,
140
- email: v.profile.email,
141
- get address() {
142
- const l = v.profile.address;
143
- return [
144
- l == null ? void 0 : l.line1,
145
- l == null ? void 0 : l.line2,
146
- l == null ? void 0 : l.city,
147
- l == null ? void 0 : l.postcode,
148
- l == null ? void 0 : l.state,
149
- l == null ? void 0 : l.country
150
- ].map((V) => V == null ? void 0 : V.trim()).filter((V) => V).join(", ");
151
- }
152
- }));
153
- }
154
- return { columnDefs: i, formatRowData: n };
155
- }
156
- const lo = /* @__PURE__ */ j({
157
- __name: "GoogleMap",
158
- props: {
159
- markers: {
160
- type: Array,
161
- default: () => []
162
- },
163
- polygons: {
164
- type: Array,
165
- default: () => []
166
- },
167
- zoom: {
168
- type: Number,
169
- default: 14
170
- },
171
- editable: {
172
- type: Boolean,
173
- default: !1
174
- },
175
- center: {
176
- type: Object,
177
- default: $e.jb
178
- }
179
- },
180
- emits: ["map-click", "marker-change", "polygon-change", "polygon-right-click"],
181
- setup(f, { expose: b, emit: g }) {
182
- const a = f, s = g;
183
- b({
184
- setCenter: (t) => {
185
- var c, h;
186
- (c = d.value) == null || c.setCenter(t), (h = d.value) == null || h.setZoom(18);
187
- }
188
- });
189
- const { googleMap: i } = re(), n = T(), d = T(null), v = [];
190
- function l(t) {
191
- return {
192
- lat: t.latLng.lat(),
193
- lng: t.latLng.lng()
194
- };
195
- }
196
- function C(t, c, h) {
197
- const x = i.maps.event.addListener(t, c, h);
198
- v.push(x);
199
- }
200
- const V = T([]);
201
- function $(t, c, h) {
202
- C(t, c, h);
203
- }
204
- function M(t) {
205
- W(null), V.value = t.map((c, h) => {
206
- const x = new i.maps.Marker({
207
- position: c,
208
- draggable: !0
209
- });
210
- return $(x, "dragend", (m) => {
211
- s("marker-change", { index: h, position: l(m) });
212
- }), x;
213
- }), W(d.value);
214
- }
215
- function W(t) {
216
- V.value.map((c) => Ve(c).setMap(t));
217
- }
218
- const p = T([]);
219
- function F(t, c, h) {
220
- C(t, c, h);
221
- }
222
- function S(t, c, h) {
223
- C(t, c, h);
224
- }
225
- function u(t) {
226
- return p.value[t].getPath().getArray().map(({ lat: h, lng: x }) => ({
227
- lat: h(),
228
- lng: x()
229
- }));
230
- }
231
- function y(t) {
232
- const c = u(t);
233
- s("polygon-change", { index: t, path: c });
234
- }
235
- function _(t, c) {
236
- const x = u(t).filter((m, K) => K !== c);
237
- s("polygon-change", { index: t, path: x });
238
- }
239
- function P(t, c) {
240
- c.vertex !== void 0 ? _(t, c.vertex) : s("polygon-right-click", t);
241
- }
242
- function E(t) {
243
- U(null), p.value = t.map((c, h) => {
244
- const x = new i.maps.Polygon({
245
- paths: c.paths,
246
- strokeColor: c.strokeColor,
247
- fillColor: c.fillColor,
248
- fillOpacity: 0.5,
249
- editable: a.editable
250
- });
251
- return F(x, "contextmenu", (m) => P(h, m)), x.getPaths().forEach((m) => {
252
- S(m, "insert_at", () => y(h)), S(m, "set_at", () => y(h));
253
- }), x;
254
- }), U(d.value);
255
- }
256
- function U(t) {
257
- p.value.map((c) => Ve(c).setMap(t));
258
- }
259
- function o(t, c, h) {
260
- C(t, c, h);
261
- }
262
- function e() {
263
- d.value = new i.maps.Map(n.value, {
264
- center: a.center,
265
- zoom: a.zoom,
266
- mapTypeControl: !1,
267
- streetViewControl: !1,
268
- draggable: !0,
269
- scrollwheel: !0
270
- }), o(d.value, "click", (t) => s("map-click", l(t)));
271
- }
272
- return te(() => a.markers, M, { deep: !0 }), te(() => a.polygons, E, { deep: !0 }), le(() => {
273
- !n.value || !i || (e(), M(a.markers), E(a.polygons));
274
- }), Te(() => {
275
- v.forEach((t) => t.remove());
276
- }), (t, c) => (R(), q("div", {
277
- ref_key: "mapRef",
278
- ref: n,
279
- class: "map app-map"
280
- }, null, 512));
281
- }
282
- }), so = { class: "flex flex-col gap-24" }, ro = { class: "flex flex-col gap-8" }, no = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, uo = { class: "fm-typo-en-body-lg-600" }, io = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, co = { class: "fm-typo-en-body-lg-600" }, po = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, mo = { class: "fm-typo-en-body-lg-600" }, fo = /* @__PURE__ */ j({
283
- __name: "CoordinateDialog",
284
- props: {
285
- address: {
286
- type: String,
287
- required: !0
288
- },
289
- coordinate: {
290
- type: Object,
291
- default: void 0
292
- }
293
- },
294
- setup(f) {
295
- const b = f, g = Ke(), a = re(), { t: s } = G(), i = Re(
296
- z(b.coordinate ? b.coordinate : $e.jb)
297
- ), n = T(""), d = Ze(async function() {
298
- n.value = await a.getFirstMatchingAddress(
299
- i.lat,
300
- i.lng
301
- );
302
- }, 1e3);
303
- le(() => {
304
- g.emitData(z(i)), d();
305
- });
306
- function v({ position: C }) {
307
- i.lat = C.lat, i.lng = C.lng, g.emitData(z(i)), d();
308
- }
309
- const l = T();
310
- return (C, V) => (R(), q("div", so, [
311
- w("div", ro, [
312
- w("div", null, [
313
- w("span", no, N(r(s)("inventory.formField.coordinate.address")) + ": ", 1),
314
- w("span", uo, N(n.value), 1)
315
- ]),
316
- w("div", null, [
317
- w("span", io, N(r(s)("inventory.formField.coordinate.longitude")) + ": ", 1),
318
- w("span", co, N(i.lng), 1)
319
- ]),
320
- w("div", null, [
321
- w("span", po, N(r(s)("inventory.formField.coordinate.latitude")) + ": ", 1),
322
- w("span", mo, N(i.lat), 1)
323
- ])
324
- ]),
325
- k(lo, {
326
- ref_key: "gmapRef",
327
- ref: l,
328
- class: "h-[272px] sm:h-[240px] xs:h-[240px]",
329
- editable: "",
330
- center: i,
331
- markers: [i],
332
- onMarkerChange: v,
333
- onMapClick: V[0] || (V[0] = ($) => v({ position: $ }))
334
- }, null, 8, ["center", "markers"])
335
- ]));
336
- }
337
- }), yo = /* @__PURE__ */ Je(fo, [["__scopeId", "data-v-272f5e8b"]]);
338
- function Ce([f, b]) {
339
- return {
340
- lat: b,
341
- lng: f
342
- };
343
- }
344
- function vo({ lng: f, lat: b }) {
345
- return [f, b];
346
- }
347
- const ho = { class: "flex gap-8 items-center" }, bo = { key: 0 }, go = { key: 1 }, wo = /* @__PURE__ */ j({
348
- __name: "FmCoordinateInput",
349
- props: {
350
- address: {},
351
- modelValue: {},
352
- dialogTitle: {},
353
- label: {},
354
- helperText: {},
355
- helperState: {},
356
- labelMark: {},
357
- labelInfo: {},
358
- placeholder: {},
359
- disabled: { type: Boolean },
360
- rules: {},
361
- country: {}
362
- },
363
- emits: ["update:modelValue"],
364
- setup(f, { emit: b }) {
365
- const g = f, a = b, s = re(), i = Se(), n = se(), d = ae(g, "modelValue"), v = T(!1), { t: l } = G();
366
- function C(p) {
367
- if (p != null && p[0] && (p != null && p[1]))
368
- return l("inventory.formField.coordinate.longLat", [p[0].toFixed(3), p[1].toFixed(3)]);
369
- }
370
- async function V(p) {
371
- var _, P;
372
- const F = g.modelValue, S = !F && ((_ = g.address) != null && _.formatted) ? await s.getFirstMatchingCoordinate(g.address.formatted) : null, u = Ye(g.country), y = F ? Ce(F) : S ? Ce(S) : u;
373
- i.open({
374
- title: g.dialogTitle ?? g.label ?? l("inventory.formField.coordinate.pinLocation"),
375
- closeButton: !0,
376
- contentComponent: yo,
377
- contentComponentProps: {
378
- address: (P = g.address) == null ? void 0 : P.formatted,
379
- coordinate: y
380
- },
381
- primaryActions: {
382
- text: l("common.select"),
383
- close: !0
384
- },
385
- secondaryActions: {
386
- text: l("common.close"),
387
- close: !0
388
- }
389
- }).onPrimary(p);
390
- }
391
- const $ = (p) => a("update:modelValue", p ? vo(p) : null);
392
- async function M() {
393
- if (!g.disabled) {
394
- if (!s.isGoogleMapReady) {
395
- n.open({
396
- title: l("common.error"),
397
- message: l("inventory.formField.coordinate.error.loadMap"),
398
- type: "error"
399
- });
400
- return;
401
- }
402
- V($);
403
- }
404
- }
405
- function W() {
406
- a("update:modelValue", null);
407
- }
408
- return (p, F) => {
409
- const S = L("FmField"), u = L("FmButton"), y = L("FmFormGroup");
410
- return R(), q("div", ho, [
411
- k(y, {
412
- class: "flex-1",
413
- "model-value": r(d),
414
- label: p.label,
415
- disabled: p.disabled,
416
- required: p.labelMark === "required",
417
- optional: p.labelMark === "optional",
418
- info: p.labelInfo,
419
- rules: p.rules,
420
- focused: v.value,
421
- "helper-text": p.helperText,
422
- "helper-state": p.helperState,
423
- onClick: F[0] || (F[0] = (_) => M())
424
- }, Ee({
425
- default: B(({ invalid: _ }) => [
426
- p.modelValue && p.modelValue[0] && p.modelValue[1] ? (R(), q("div", bo, [
427
- k(S, {
428
- invalid: _,
429
- class: "fm-typo-en-body-lg-400"
430
- }, {
431
- default: B(() => [
432
- Me(N(C(p.modelValue)), 1)
433
- ]),
434
- _: 2
435
- }, 1032, ["invalid"])
436
- ])) : (R(), q("div", go, [
437
- k(u, {
438
- label: r(l)("inventory.formField.coordinate.addCoordinate"),
439
- "prepend-icon": "add",
440
- variant: "plain"
441
- }, null, 8, ["label"])
442
- ]))
443
- ]),
444
- _: 2
445
- }, [
446
- p.$slots.label ? {
447
- name: "label",
448
- fn: B(() => [
449
- We(p.$slots, "label")
450
- ]),
451
- key: "0"
452
- } : void 0
453
- ]), 1032, ["model-value", "label", "disabled", "required", "optional", "info", "rules", "focused", "helper-text", "helper-state"]),
454
- p.modelValue && p.modelValue[0] && p.modelValue[1] ? (R(), O(u, {
455
- key: 0,
456
- "prepend-icon": "delete",
457
- variant: "tertiary",
458
- onClick: F[1] || (F[1] = (_) => W())
459
- })) : oe("", !0)
460
- ]);
461
- };
462
- }
463
- }), Vo = { class: "flex flex-col gap-40" }, _o = { class: "flex flex-col gap-16" }, ko = { class: "flex flex-col gap-8" }, Ao = { class: "fm-typo-en-title-sm-600" }, Co = { class: "grid grid-cols-2 gap-24" }, Mo = { class: "flex flex-col gap-8" }, Fo = { class: "fm-typo-en-title-sm-600" }, xo = {
464
- key: 0,
465
- class: "flex flex-col gap-8"
466
- }, So = { class: "fm-typo-en-title-sm-600" }, $o = { class: "flex flex-col gap-8" }, Do = { class: "fm-typo-en-title-sm-600" }, To = { class: "flex flex-col gap-16" }, Ro = /* @__PURE__ */ j({
467
- __name: "WarehouseForm",
468
- props: {
469
- modelValue: {},
470
- disabled: { type: Boolean }
471
- },
472
- emits: ["update:modelValue", "validation-success"],
473
- setup(f, { expose: b, emit: g }) {
474
- const a = f, s = g, i = Xe(), { t: n } = G(), d = A({
475
- get() {
476
- var o, e;
477
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.name) ?? "";
478
- },
479
- set(o) {
480
- const e = a.modelValue ?? {};
481
- e.profile ?? (e.profile = {}), e.profile.name = o, s("update:modelValue", e);
482
- }
483
- }), v = A({
484
- get() {
485
- var o, e;
486
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.regNo) ?? "";
487
- },
488
- set(o) {
489
- const e = a.modelValue ?? {};
490
- e.profile ?? (e.profile = {}), e.profile.regNo = o, s("update:modelValue", e);
491
- }
492
- }), l = A({
493
- get() {
494
- var o, e, t;
495
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.line1) ?? "";
496
- },
497
- set(o) {
498
- var t;
499
- const e = a.modelValue ?? {};
500
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.line1 = o, s("update:modelValue", e);
501
- }
502
- }), C = A({
503
- get() {
504
- var o, e, t;
505
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.line2) ?? "";
506
- },
507
- set(o) {
508
- var t;
509
- const e = a.modelValue ?? {};
510
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.line2 = o, s("update:modelValue", e);
511
- }
512
- }), V = A({
513
- get() {
514
- var o, e, t;
515
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.city) ?? "";
516
- },
517
- set(o) {
518
- var t;
519
- const e = a.modelValue ?? {};
520
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.city = o, s("update:modelValue", e);
521
- }
522
- }), $ = A({
523
- get() {
524
- var o, e, t;
525
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.postcode) ?? "";
526
- },
527
- set(o) {
528
- var t;
529
- const e = a.modelValue ?? {};
530
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.postcode = o, s("update:modelValue", e);
531
- }
532
- }), M = A({
533
- get() {
534
- var o, e, t;
535
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.state) ?? "";
536
- },
537
- set(o) {
538
- var t;
539
- const e = a.modelValue ?? {};
540
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.state = o, s("update:modelValue", e);
541
- }
542
- }), W = A({
543
- get() {
544
- var o, e, t;
545
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.country) ?? "";
546
- },
547
- set(o) {
548
- var t;
549
- const e = a.modelValue ?? {};
550
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.country = o, s("update:modelValue", e);
551
- }
552
- }), p = A({
553
- get() {
554
- var e;
555
- const o = (e = a.modelValue) == null ? void 0 : e.preparationTime;
556
- return o && typeof o == "object" && "value" in o ? o.value.toString() : "";
557
- },
558
- set(o) {
559
- const e = a.modelValue ?? {};
560
- e.profile ?? (e.profile = {}), e.preparationTime = {
561
- value: parseInt(o),
562
- unit: Be.Enum.day
563
- }, s("update:modelValue", e);
564
- }
565
- }), F = A({
566
- get() {
567
- var o, e, t;
568
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.coordinates) ?? null;
569
- },
570
- set(o) {
571
- var t;
572
- const e = a.modelValue ?? {};
573
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.coordinates = o, s("update:modelValue", e);
574
- }
575
- }), S = A({
576
- get() {
577
- var o, e;
578
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.phoneNo) ?? "";
579
- },
580
- set(o) {
581
- const e = a.modelValue ?? {};
582
- e.profile ?? (e.profile = {}), e.profile.phoneNo = o, s("update:modelValue", e);
583
- }
584
- }), { enabledCountries: u, currentCountry: y } = Fe(), _ = A(() => y.value || ""), P = A({
585
- get() {
586
- var o, e;
587
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.email) ?? "";
588
- },
589
- set(o) {
590
- const e = a.modelValue ?? {};
591
- e.profile ?? (e.profile = {}), e.profile.email = o, s("update:modelValue", e);
592
- }
593
- }), E = A({
594
- get() {
595
- var o;
596
- return ((o = a.modelValue) == null ? void 0 : o.customAttributes) ?? {};
597
- },
598
- set(o) {
599
- const e = a.modelValue ? {
600
- ...a.modelValue
601
- } : {};
602
- e.customAttributes = o, s("update:modelValue", e);
603
- }
604
- }), U = T();
605
- return b({
606
- validateInputs: () => {
607
- var o, e;
608
- (e = (o = U.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
609
- },
610
- resetInputsValidation: () => {
611
- var o, e;
612
- (e = (o = U.value) == null ? void 0 : o.resetInputsValidation) == null || e.call(o);
613
- },
614
- resetInputs: () => {
615
- var o, e;
616
- (e = (o = U.value) == null ? void 0 : o.resetInputs) == null || e.call(o);
617
- }
618
- }), (o, e) => {
619
- const t = L("FmTextField"), c = L("FmPill"), h = L("FmPhoneNumber"), x = L("FmForm");
620
- return R(), O(x, {
621
- ref_key: "formRef",
622
- ref: U,
623
- onValidationSuccess: e[13] || (e[13] = (m) => s("validation-success"))
624
- }, {
625
- default: B(() => [
626
- w("div", Vo, [
627
- w("div", _o, [
628
- k(t, {
629
- disabled: o.disabled,
630
- rules: [r(I)()],
631
- "label-mark": "required",
632
- label: r(n)("inventory.warehouse.companyName"),
633
- modelValue: d.value,
634
- "onUpdate:modelValue": e[0] || (e[0] = (m) => d.value = m)
635
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
636
- k(t, {
637
- disabled: o.disabled,
638
- rules: [r(I)()],
639
- "label-mark": "required",
640
- label: r(n)("inventory.warehouse.registrationNo"),
641
- modelValue: v.value,
642
- "onUpdate:modelValue": e[1] || (e[1] = (m) => v.value = m)
643
- }, null, 8, ["disabled", "rules", "label", "modelValue"])
644
- ]),
645
- w("div", ko, [
646
- w("div", Ao, N(r(n)("inventory.warehouse.address.title")), 1),
647
- w("div", Co, [
648
- k(t, {
649
- disabled: o.disabled,
650
- rules: [r(I)()],
651
- "label-mark": "required",
652
- label: r(n)("inventory.warehouse.address.line1"),
653
- modelValue: l.value,
654
- "onUpdate:modelValue": e[2] || (e[2] = (m) => l.value = m)
655
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
656
- k(t, {
657
- disabled: o.disabled,
658
- "label-mark": "optional",
659
- label: r(n)("inventory.warehouse.address.line2"),
660
- modelValue: C.value,
661
- "onUpdate:modelValue": e[3] || (e[3] = (m) => C.value = m)
662
- }, null, 8, ["disabled", "label", "modelValue"]),
663
- k(t, {
664
- disabled: o.disabled,
665
- rules: [r(I)()],
666
- "label-mark": "required",
667
- label: r(n)("inventory.warehouse.address.city"),
668
- modelValue: V.value,
669
- "onUpdate:modelValue": e[4] || (e[4] = (m) => V.value = m)
670
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
671
- k(t, {
672
- disabled: o.disabled,
673
- rules: [r(I)()],
674
- "label-mark": "required",
675
- label: r(n)("inventory.warehouse.address.postcode"),
676
- modelValue: $.value,
677
- "onUpdate:modelValue": e[5] || (e[5] = (m) => $.value = m)
678
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
679
- k(t, {
680
- disabled: o.disabled,
681
- rules: [r(I)()],
682
- "label-mark": "required",
683
- label: r(n)("inventory.warehouse.address.state"),
684
- modelValue: M.value,
685
- "onUpdate:modelValue": e[6] || (e[6] = (m) => M.value = m)
686
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
687
- k(t, {
688
- disabled: o.disabled,
689
- rules: [r(I)()],
690
- "label-mark": "required",
691
- label: r(n)("inventory.warehouse.address.country"),
692
- modelValue: W.value,
693
- "onUpdate:modelValue": e[7] || (e[7] = (m) => W.value = m)
694
- }, null, 8, ["disabled", "rules", "label", "modelValue"])
695
- ])
696
- ]),
697
- w("div", Mo, [
698
- w("div", Fo, N(r(n)("inventory.warehouse.coordinate.title")), 1),
699
- k(wo, {
700
- disabled: o.disabled,
701
- rules: [r(I)()],
702
- "label-mark": "required",
703
- modelValue: F.value,
704
- "onUpdate:modelValue": e[8] || (e[8] = (m) => F.value = m),
705
- country: _.value
706
- }, null, 8, ["disabled", "rules", "modelValue", "country"])
707
- ]),
708
- r(i).enableSupplierPreparationTime ? (R(), q("div", xo, [
709
- w("div", So, [
710
- Me(N(r(n)("inventory.supplier.delivery.title")) + " ", 1),
711
- k(c, { variant: "beta" })
712
- ]),
713
- k(t, {
714
- disabled: o.disabled,
715
- label: r(n)("inventory.supplier.delivery.preparationTime"),
716
- modelValue: p.value,
717
- "onUpdate:modelValue": e[9] || (e[9] = (m) => p.value = m),
718
- type: "number"
719
- }, null, 8, ["disabled", "label", "modelValue"])
720
- ])) : oe("", !0),
721
- w("div", $o, [
722
- w("div", Do, N(r(n)("inventory.warehouse.contact.title")), 1),
723
- w("div", To, [
724
- k(h, {
725
- disabled: o.disabled,
726
- rules: [r(I)()],
727
- "label-mark": "required",
728
- label: r(n)("inventory.warehouse.contact.phoneNumber"),
729
- modelValue: S.value,
730
- "onUpdate:modelValue": e[10] || (e[10] = (m) => S.value = m),
731
- "extra-country-codes": r(u),
732
- "default-country": r(y)
733
- }, null, 8, ["disabled", "rules", "label", "modelValue", "extra-country-codes", "default-country"]),
734
- k(t, {
735
- disabled: o.disabled,
736
- "label-mark": "optional",
737
- label: r(n)("inventory.warehouse.contact.email"),
738
- modelValue: P.value,
739
- "onUpdate:modelValue": e[11] || (e[11] = (m) => P.value = m)
740
- }, null, 8, ["disabled", "label", "modelValue"])
741
- ])
742
- ]),
743
- w("div", null, [
744
- k(Qe, {
745
- entity: "warehouse",
746
- modelValue: E.value,
747
- "onUpdate:modelValue": e[12] || (e[12] = (m) => E.value = m)
748
- }, null, 8, ["modelValue"])
749
- ])
750
- ])
751
- ]),
752
- _: 1
753
- }, 512);
754
- };
755
- }
756
- }), Eo = {
757
- key: 0,
758
- class: "flex gap-4"
759
- }, Wo = /* @__PURE__ */ j({
760
- __name: "WarehouseDialog",
761
- props: {
762
- mode: {},
763
- warehouse: {},
764
- show: { type: Boolean }
765
- },
766
- emits: ["update:show", "submitted"],
767
- setup(f, { expose: b, emit: g }) {
768
- const a = f, s = g, i = T(!1), n = se(), { t: d } = G(), v = De(), l = A(() => {
769
- switch (a.mode) {
770
- case D.READ:
771
- return "";
772
- case D.UPDATE:
773
- return d("inventory.warehouse.update.title");
774
- case D.CREATE:
775
- return d("inventory.warehouse.create.title");
776
- }
777
- return "";
778
- }), C = A(() => {
779
- switch (a.mode) {
780
- case D.READ:
781
- return "";
782
- case D.UPDATE:
783
- return d("common.save");
784
- case D.CREATE:
785
- return d("common.add");
786
- }
787
- return "";
788
- }), V = T();
789
- b({
790
- validateInputs: () => {
791
- var u, y;
792
- (y = (u = V.value) == null ? void 0 : u.validateInputs) == null || y.call(u);
793
- },
794
- resetInputsValidation: () => {
795
- var u, y;
796
- (y = (u = V.value) == null ? void 0 : u.resetInputsValidation) == null || y.call(u);
797
- },
798
- resetInputs: () => {
799
- var u, y;
800
- (y = (u = V.value) == null ? void 0 : u.resetInputs) == null || y.call(u);
801
- }
802
- });
803
- const $ = ae(a, "show"), M = ae(a, "warehouse");
804
- function W() {
805
- var u, y;
806
- (y = (u = V.value) == null ? void 0 : u.validateInputs) == null || y.call(u);
807
- }
808
- function p() {
809
- switch (a.mode) {
810
- case D.READ:
811
- return;
812
- case D.UPDATE:
813
- return S();
814
- case D.CREATE:
815
- return F();
816
- }
817
- }
818
- async function F() {
819
- var u, y;
820
- i.value = !0;
821
- try {
822
- await Promise.all([
823
- v.createWarehouse(M.value),
824
- new Promise((_) => setTimeout(_, 1e3))
825
- ]), n.open({
826
- title: d("inventory.common.success"),
827
- message: d("inventory.warehouse.create.success", { name: (y = (u = M.value) == null ? void 0 : u.profile) == null ? void 0 : y.name }),
828
- type: "success"
829
- }), s("update:show", !1), s("submitted");
830
- } catch (_) {
831
- n.open({
832
- title: d("inventory.warehouse.create.error.title"),
833
- message: _ instanceof qe ? _.message : d("inventory.warehouse.create.error.message"),
834
- type: "error"
835
- }), console.error("cannot create warehouse", _);
836
- } finally {
837
- i.value = !1;
838
- }
839
- }
840
- async function S() {
841
- var u, y;
842
- if (M.value === null) {
843
- n.open({
844
- title: d("inventory.warehouse.update.error.title"),
845
- message: d("inventory.warehouse.update.error.emptyWarehouse"),
846
- type: "error"
847
- });
848
- return;
849
- }
850
- i.value = !0;
851
- try {
852
- await Promise.all([
853
- v.updateWarehouse(M.value),
854
- new Promise((_) => setTimeout(_, 1e3))
855
- ]), n.open({
856
- title: d("inventory.common.success"),
857
- message: d("inventory.warehouse.update.success", { name: (y = (u = M.value) == null ? void 0 : u.profile) == null ? void 0 : y.name }),
858
- type: "success"
859
- }), s("update:show", !1), s("submitted");
860
- } catch (_) {
861
- n.open({
862
- title: d("inventory.warehouse.update.error.title"),
863
- message: d("inventory.warehouse.update.error.message"),
864
- type: "error"
865
- }), console.error("cannot update warehouse", _);
866
- } finally {
867
- i.value = !1;
868
- }
869
- }
870
- return (u, y) => {
871
- const _ = L("FmButton"), P = L("FmSideSheet");
872
- return R(), O(P, {
873
- header: l.value,
874
- modelValue: r($),
875
- "onUpdate:modelValue": y[1] || (y[1] = (E) => _e($) ? $.value = E : null),
876
- "dismiss-away": !i.value,
877
- "close-button": "",
878
- "max-width": 500
879
- }, {
880
- default: B(() => {
881
- var E;
882
- return [
883
- (R(), O(Ro, {
884
- class: "w-full",
885
- ref_key: "formRef",
886
- ref: V,
887
- modelValue: r(M),
888
- "onUpdate:modelValue": y[0] || (y[0] = (U) => _e(M) ? M.value = U : null),
889
- onValidationSuccess: p,
890
- key: ((E = u.warehouse) == null ? void 0 : E._id) ?? "",
891
- disabled: i.value || u.mode === r(D).READ
892
- }, null, 8, ["modelValue", "disabled"]))
893
- ];
894
- }),
895
- "side-sheet-footer": B(() => [
896
- u.mode !== r(D).READ ? (R(), q("div", Eo, [
897
- k(_, {
898
- loading: i.value,
899
- label: C.value,
900
- onClick: W
901
- }, null, 8, ["loading", "label"])
902
- ])) : oe("", !0)
903
- ]),
904
- _: 1
905
- }, 8, ["header", "modelValue", "dismiss-away"]);
906
- };
907
- }
908
- }), Po = { class: "flex flex-col py-8" }, Uo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, No = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lo = {
909
- key: 0,
910
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
911
- }, Io = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-3" }, lt = /* @__PURE__ */ j({
912
- __name: "WarehouseView",
913
- setup(f) {
914
- const b = De(), g = ze(), a = xe(), s = A(() => b.warehouses), i = Se(), n = se(), d = T(!1), { t: v } = G();
915
- le(() => {
916
- g._currentLocation && u();
917
- }), te([() => g._currentLocation], () => {
918
- g._currentLocation && u();
919
- });
920
- const l = T({});
921
- function C() {
922
- l.value.mode = D.CREATE, l.value.warehouse = {}, l.value.show = !0;
923
- }
924
- function V(o) {
925
- const e = z(o);
926
- l.value.mode = a.isEnabled ? D.READ : D.UPDATE, l.value.warehouse = e, l.value.show = !0;
927
- }
928
- async function $(o) {
929
- i.open({
930
- title: v("inventory.warehouse.delete.confirm"),
931
- message: v("inventory.warehouse.delete.confirmMessage", { name: o.profile.name }),
932
- primaryActions: {
933
- text: "Delete",
934
- close: !0,
935
- variant: "destructive"
936
- },
937
- secondaryActions: {
938
- text: "Cancel",
939
- close: !0
940
- }
941
- }).onPrimary(() => M(o));
942
- }
943
- async function M(o) {
944
- i.open({
945
- title: v("inventory.warehouse.delete.deletingWarehouse"),
946
- closeButton: !1
947
- });
948
- try {
949
- await b.deleteWarehouse(o), n.open({
950
- title: v("inventory.warehouse.delete.success"),
951
- message: v("inventory.warehouse.delete.deletedWarehouse", { name: o.profile.name }),
952
- type: "success"
953
- }), await u(!0);
954
- } catch (e) {
955
- n.open({
956
- title: v("inventory.warehouse.delete.error"),
957
- message: v("inventory.warehouse.delete.errorMessage", { name: o.profile.name }),
958
- type: "error"
959
- }), console.error("failed to delete warehouse", e);
960
- } finally {
961
- i.close();
962
- }
963
- }
964
- const { columnDefs: W, formatRowData: p } = ao(
965
- V,
966
- $
967
- );
968
- function F(o) {
969
- a.isEnabled || o === "create" && C();
970
- }
971
- const S = T("");
972
- async function u(o = !1) {
973
- d.value = !0;
974
- try {
975
- await b.readWarehouses(), o && await g.readLocations();
976
- } catch {
977
- n.open({
978
- title: "Cannot fetch warehouse list",
979
- type: "error"
980
- });
981
- } finally {
982
- d.value = !1;
983
- }
984
- }
985
- const { breakpoints: y } = He(), _ = A(() => y.value.xs || y.value.sm), P = A(() => _.value ? 10 : 20), E = je(), U = A(() => a.isEnabled ? [] : [
986
- {
987
- label: v("inventory.warehouse.create.title"),
988
- value: "create",
989
- isPrimary: !0,
990
- prependIcon: "add"
991
- }
992
- ]);
993
- return (o, e) => {
994
- const t = L("FmTable");
995
- return R(), O(Ge, {
996
- title: r(v)("inventory.warehouse.title"),
997
- actions: U.value,
998
- "onClick:action": F
999
- }, {
1000
- default: B(() => [
1001
- w("div", {
1002
- class: Pe([
1003
- "flex flex-col gap-8 max-h-full",
1004
- {
1005
- "p-0": _.value,
1006
- "px-24 ": !_.value
1007
- }
1008
- ])
1009
- }, [
1010
- k(oo, {
1011
- searchable: "",
1012
- search: S.value,
1013
- "onUpdate:search": e[0] || (e[0] = (c) => S.value = c)
1014
- }, null, 8, ["search"]),
1015
- (R(), O(t, {
1016
- style: Ue(r(E).tableHeight),
1017
- "column-defs": r(W),
1018
- "row-data": r(p)(s.value),
1019
- "search-value": S.value,
1020
- loading: !r(g)._currentLocation || d.value,
1021
- onRowClick: e[1] || (e[1] = (c) => V(c.original.original)),
1022
- key: s.value.length,
1023
- "page-size": P.value
1024
- }, {
1025
- "list-row": B((c) => [
1026
- k(eo, {
1027
- row: c,
1028
- onRowClick: (h) => V(h.original)
1029
- }, {
1030
- default: B((h) => {
1031
- var x, m, K, H, ne, ue, ie, de, Y, ce, pe, me, fe, ye, Z, ve, he, be, ge, J, we;
1032
- return [
1033
- w("div", Po, [
1034
- w("div", Uo, [
1035
- k(r(X), {
1036
- render: (K = (m = (x = h.warehouse) == null ? void 0 : x.column) == null ? void 0 : m.columnDef) == null ? void 0 : K.cell,
1037
- props: (ne = (H = h.warehouse) == null ? void 0 : H.getContext) == null ? void 0 : ne.call(H)
1038
- }, null, 8, ["render", "props"])
1039
- ]),
1040
- w("div", No, [
1041
- k(r(X), {
1042
- render: (de = (ie = (ue = h.contact) == null ? void 0 : ue.column) == null ? void 0 : ie.columnDef) == null ? void 0 : de.cell,
1043
- props: (ce = (Y = h.contact) == null ? void 0 : Y.getContext) == null ? void 0 : ce.call(Y)
1044
- }, null, 8, ["render", "props"])
1045
- ]),
1046
- (pe = c.original) != null && pe.email ? (R(), q("div", Lo, [
1047
- k(r(X), {
1048
- render: (ye = (fe = (me = h.email) == null ? void 0 : me.column) == null ? void 0 : fe.columnDef) == null ? void 0 : ye.cell,
1049
- props: (ve = (Z = h.email) == null ? void 0 : Z.getContext) == null ? void 0 : ve.call(Z)
1050
- }, null, 8, ["render", "props"])
1051
- ])) : oe("", !0),
1052
- w("div", Io, [
1053
- k(r(X), {
1054
- render: (ge = (be = (he = h.address) == null ? void 0 : he.column) == null ? void 0 : be.columnDef) == null ? void 0 : ge.cell,
1055
- props: (we = (J = h.address) == null ? void 0 : J.getContext) == null ? void 0 : we.call(J)
1056
- }, null, 8, ["render", "props"])
1057
- ])
1058
- ])
1059
- ];
1060
- }),
1061
- _: 2
1062
- }, 1032, ["row", "onRowClick"])
1063
- ]),
1064
- _: 1
1065
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1066
- ], 2),
1067
- k(Wo, {
1068
- show: l.value.show,
1069
- "onUpdate:show": e[2] || (e[2] = (c) => l.value.show = c),
1070
- warehouse: l.value.warehouse,
1071
- mode: l.value.mode,
1072
- onSubmitted: e[3] || (e[3] = (c) => u(!0))
1073
- }, null, 8, ["show", "warehouse", "mode"])
1074
- ]),
1075
- _: 1
1076
- }, 8, ["title", "actions"]);
1077
- };
1078
- }
1079
- });
1080
- export {
1081
- lt as default
1082
- };