@feedmepos/mf-inventory-portal 1.6.1-dev.0 → 1.6.1-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 (107) hide show
  1. package/dist/{App-CL5dPCEj.js → App-tsLr4IOP.js} +5 -5
  2. package/dist/{ApprovalView-DKJibNlK.js → ApprovalView-CQjXRw8C.js} +24 -23
  3. package/dist/{BindingsDialog-DLJXu8Dw.js → BindingsDialog-CxDEdC6C.js} +2 -2
  4. package/dist/{BindingsPicker-CW6Tk9JI.js → BindingsPicker-BkAb19vW.js} +2 -2
  5. package/dist/{BindingsTable-3JJEAQz3.js → BindingsTable-1wVrUeMy.js} +3 -3
  6. package/dist/BulkReceiveRequestView-CcMDC8AO.js +2000 -0
  7. package/dist/{ClosingDraftView-DVoWnPTQ.js → ClosingDraftView-B80djffM.js} +14 -14
  8. package/dist/{ClosingHistoryView-qWjIbBsX.js → ClosingHistoryView-DHvyhey_.js} +247 -247
  9. package/dist/{ClosingTemplateView-C3Hf510z.js → ClosingTemplateView-DqX2g8PI.js} +14 -14
  10. package/dist/{DefaultView-wBhT3ag9.js → DefaultView-oPI1wm7e.js} +2 -2
  11. package/dist/{DeliveryOrderPrintPreview-VnG9wrNu.js → DeliveryOrderPrintPreview-D59Lf8S5.js} +11 -11
  12. package/dist/{ReceiveRequestView-DIPZCXxV.js → EmailDialog.vue_vue_type_script_setup_true_lang-BVhjsBP3.js} +12571 -12873
  13. package/dist/FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-CLTI25iw.js +61 -0
  14. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-C4pvSYN-.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-RpCYckxf.js} +2 -2
  15. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BqJ3SnfZ.js +237 -0
  16. package/dist/{FmMultiselectDialog-C7P1UET0.js → FmMultiselectDialog-BZlf6oZl.js} +50 -44
  17. package/dist/{FmMultiselectDialog-Dru64kWF.js → FmMultiselectDialog-DMQjKOrJ.js} +1 -1
  18. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-BklBxBGT.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DvQvV6jN.js} +5 -5
  19. package/dist/{ImportView-C9w-sF5E.js → ImportView-BWAllFBa.js} +6 -6
  20. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-BuphGYe2.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-CYLpzpdL.js} +1 -1
  21. package/dist/{IngredientGroupView-BZqXPr_n.js → IngredientGroupView-B_qUY9ik.js} +5 -5
  22. package/dist/{IngredientsView-DgTPgkN9.js → IngredientsView-DHo7Ywtt.js} +15 -15
  23. package/dist/{IntegrationExplorerView-B8U3LTtj.js → IntegrationExplorerView-BiYdzcS3.js} +5 -5
  24. package/dist/{IntegrationView-QyHxizvF.js → IntegrationView-e0R16LLC.js} +13 -13
  25. package/dist/{InventoryBindingForm-NRwFwJt5.js → InventoryBindingForm-C6BZhtqn.js} +1 -1
  26. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-C-If3KBe.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-7FoOHhX8.js} +5 -5
  27. package/dist/{InventoryBindingSummary-DqI3M6jQ.js → InventoryBindingSummary-C5AQnnCs.js} +1 -1
  28. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-Xt_1oU-z.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CTWexpNg.js} +1 -1
  29. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-DFYTlv_K.js → PremiumBadge.vue_vue_type_script_setup_true_lang-Dzr8FeSh.js} +1 -1
  30. package/dist/{PublishView-2ytn8EUo.js → PublishView-C0ErXWjz.js} +3 -3
  31. package/dist/{PurchaseOrderPrintPreview-Bqim_q38.js → PurchaseOrderPrintPreview-BifBn6Fo.js} +9 -9
  32. package/dist/ReceiveRequestView-5w1OX2de.js +345 -0
  33. package/dist/{RecipeView-Bs326Ew3.js → RecipeView-I_FnrtHB.js} +17 -17
  34. package/dist/{SettingsView-frX_dI_K.js → SettingsView-pHCzYXZr.js} +4 -4
  35. package/dist/{StockView-Us8Wx8y_.js → StockView-BO-LR1WR.js} +28 -27
  36. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Du8BI_cZ.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-Dz9VvX-B.js} +1 -1
  37. package/dist/{SupplierView-8dnHAbK3.js → SupplierView-Bn-ul1j8.js} +12 -12
  38. package/dist/{SurchargeView-CfqjYiBs.js → SurchargeView-Da-H4FzH.js} +6 -6
  39. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-_03vSZ4W.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-Do-wa8bS.js} +6 -5
  40. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CAb7UWFP.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-DcBA8hzp.js} +1 -1
  41. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-B58A7dWI.js → TransferDetails.vue_vue_type_script_setup_true_lang-F7bFaIip.js} +1440 -1433
  42. package/dist/{TransferTemplateView-CI84cmV5.js → TransferTemplateView-IncI48M6.js} +20 -20
  43. package/dist/{UnitCostHistoryView-DXolsbDT.js → UnitCostHistoryView-0mbMN39f.js} +4 -4
  44. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-Bpoawj7B.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-DM0t-SJD.js} +4 -4
  45. package/dist/{UnitView-DT3fcagF.js → UnitView-mq5WIx8v.js} +7 -7
  46. package/dist/WarehouseView-CrD6agyt.js +1079 -0
  47. package/dist/{WastageTemplateView-Bc5CZJ58.js → WastageTemplateView-MrS6QsDh.js} +14 -14
  48. package/dist/api/purchase-order.d.ts +2 -1
  49. package/dist/api/supplier.d.ts +1 -0
  50. package/dist/{app-DpMCzQql.js → app-DV7aQ_cQ.js} +1363 -999
  51. package/dist/app.d.ts +354 -2
  52. package/dist/app.js +1 -1
  53. package/dist/{closing-template-CaFX19g1.js → closing-template-DJ_1EoSh.js} +1 -1
  54. package/dist/components/FmCoordinateInputProps.d.ts +1 -0
  55. package/dist/components/FmMultiselectDialog.vue.d.ts +8 -4
  56. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  57. package/dist/components/MultiLocationSelector.vue.d.ts +202 -0
  58. package/dist/components/map/coordinates.d.ts +13 -0
  59. package/dist/{date2-DBsUy1HH.js → date2-M311L05t.js} +1 -1
  60. package/dist/{dayjs.min-BVKjPmJE.js → dayjs.min-9zk0IgeS.js} +12 -12
  61. package/dist/{decimal-DKl2dUd0.js → decimal-iv0YYQk_.js} +2 -2
  62. package/dist/{defineDeepModel-YeHxg9wN.js → defineDeepModel-CgMeJpz5.js} +1 -1
  63. package/dist/{duplicate-template-Dyx4X380.js → duplicate-template-CGWTaWeS.js} +1 -1
  64. package/dist/{feature-ltFu24H8.js → feature-CKH-cZsq.js} +70 -65
  65. package/dist/{format-time-from-id-D3lPFiqA.js → format-time-from-id-DaxR-jQl.js} +1 -1
  66. package/dist/{format-unit-display-CD8C9YZc.js → format-unit-display-C4vI4fRV.js} +12 -12
  67. package/dist/{googlemap-BGi_aKUA.js → googlemap-D9vA7GsS.js} +48 -35
  68. package/dist/{import-export.helper-BJ5Lz4Gg.js → import-export.helper-zsEeF3Qb.js} +6 -6
  69. package/dist/{index-TQKBiFuU.js → index-CBQF1IDr.js} +3 -3
  70. package/dist/{index-JOemzj27.js → index-Cu1y898s.js} +1 -1
  71. package/dist/{index-B8xTUvTH.js → index-DZ-7c-AR.js} +1 -1
  72. package/dist/{inventory-core-dart.default-Xz0fuxVn.js → inventory-core-dart.default-Czt49AGY.js} +1 -1
  73. package/dist/jszip.min-DuMMMB7Y.js +2322 -0
  74. package/dist/{lz-string-DAdPi3YY.js → lz-string-BpMyCNFt.js} +1 -1
  75. package/dist/{netsuite-qr2wHoV5.js → netsuite-BEwbzOju.js} +2 -2
  76. package/dist/{number-xgIylzEb.js → number-H0O0vBDD.js} +3 -3
  77. package/dist/{predefined-templates-j5MqD37J.js → predefined-templates-gzc0FRzN.js} +1 -1
  78. package/dist/{purchase-order-template-CglLUVxv.js → purchase-order-template-BDat5HvG.js} +1 -1
  79. package/dist/{recalculationUtils-O8dnzyPD.js → recalculationUtils-hksr7WVZ.js} +1 -1
  80. package/dist/router/name.d.ts +1 -0
  81. package/dist/{rules-BPu-CBAX.js → rules-BJJYOD6y.js} +2 -2
  82. package/dist/{stock-VM7b7_Km.js → stock-CKMkhKG-.js} +1 -1
  83. package/dist/stores/feature.d.ts +2 -0
  84. package/dist/style.css +1 -1
  85. package/dist/supplier-D8G3A4Fh.js +83 -0
  86. package/dist/{surcharge-CUUDBYUf.js → surcharge-DPwNFa1t.js} +1 -1
  87. package/dist/tsconfig.app.tsbuildinfo +1 -1
  88. package/dist/{uom-rules-D6eW0fAO.js → uom-rules-DoYkZ5ZU.js} +1 -1
  89. package/dist/{use-ingredient-select-dialog-Cd700UkI.js → use-ingredient-select-dialog-D0mBasQT.js} +2 -2
  90. package/dist/{use-inventory-binding-dialog-Cf8wC8AI.js → use-inventory-binding-dialog-C6HEtbBs.js} +2 -2
  91. package/dist/{use-template-enabled-locations-D1AVostH.js → use-template-enabled-locations-CnEcb7h4.js} +2 -2
  92. package/dist/{use-transfer-locations-uOi6cGul.js → use-transfer-locations-BmqLOJob.js} +8 -8
  93. package/dist/{useHrmPermission-DEu2Lyei.js → useHrmPermission-O-zOwblR.js} +1 -1
  94. package/dist/{useNavigationMenu-DuIGSnMd.js → useNavigationMenu-B-LGFL0q.js} +43 -38
  95. package/dist/{useSseClient-D1uc8ZIc.js → useSseClient-BDjXWGbT.js} +3 -3
  96. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -0
  97. package/dist/views/receive-request/components/transfer-form/TransferFormWithController.vue.d.ts +194 -0
  98. package/dist/views/receive-request-bulk/BulkReceiveRequestView.vue.d.ts +3 -0
  99. package/dist/views/receive-request-bulk/components/CreateTransferWizard.vue.d.ts +25 -0
  100. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-form.d.ts +4138 -0
  101. package/dist/views/receive-request-bulk/composables/use-bulk-receive-request-table.d.ts +771 -0
  102. package/dist/{vue-i18n-DElpxFA8.js → vue-i18n-BfVinz9g.js} +99 -99
  103. package/dist/{xlsx.util-Cm8s0ZJD.js → xlsx.util-BkECcQ9d.js} +3 -3
  104. package/package.json +5 -4
  105. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bkh9LvJQ.js +0 -293
  106. package/dist/WarehouseView-C1BHChSJ.js +0 -1077
  107. package/dist/supplier-W00UQBDk.js +0 -78
@@ -1,1077 +0,0 @@
1
- import { ref as D, defineComponent as O, watch as ee, onMounted as te, onUnmounted as $e, openBlock as W, createElementBlock as q, toRaw as we, reactive as Se, createElementVNode as g, toDisplayString as E, unref as u, createVNode as k, resolveComponent as N, createSlots as Te, withCtx as I, createTextVNode as Me, renderSlot as De, createBlock as j, createCommentVNode as ae, computed as $, isRef as Ve, normalizeClass as We, normalizeStyle as Re } from "vue";
2
- import { m as Pe, n as Ue, o as Ee, c as z, p as Ne, S as Le, u as Ie } from "./app-DpMCzQql.js";
3
- import { useCoreStore as Ce, useI18n as G } from "@feedmepos/mf-common";
4
- import { D as _e, R as J } from "./row-action.enum-DQ9bJ_uv.js";
5
- import { c as Be } from "./component-kqxARxvM.js";
6
- import { u as qe, _ as ze } from "./SingleColumnLayout.vue_vue_type_script_setup_true_lang-DGlWE5I8.js";
7
- import { F as U } from "./form-mode.enum-BKiNVH6A.js";
8
- import { useDialogChild as je, useDialog as Fe, useSnackbar as le, useProxiedModel as oe, useBreakpoints as Oe } from "@feedmepos/ui-library";
9
- import { R as L } from "./rules-BPu-CBAX.js";
10
- import { c as se, u as re } from "./googlemap-BGi_aKUA.js";
11
- import { d as Ge } from "./index-B8xTUvTH.js";
12
- import { _ as Ke } from "./_plugin-vue_export-helper-CHgC5LLL.js";
13
- import { _ as He } from "./FmCustomAttribute.vue_vue_type_script_setup_true_lang-D-IWRjRD.js";
14
- import { u as Ye } from "./feature-ltFu24H8.js";
15
- import { _ as Ze, F as Q } from "./TableActionableRow.vue_vue_type_script_setup_true_lang-Ca_eYa8-.js";
16
- import { _ as Je } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-Bkh9LvJQ.js";
17
- const X = Pe((v, h) => {
18
- const b = Ce();
19
- return {
20
- async readWarehouses() {
21
- var i;
22
- const a = ((i = b.currentBusiness.value) == null ? void 0 : i._id) ?? "", n = `${v.inventoryBackendUrl}/businesses/${a}/warehouses`;
23
- return await h.get(n);
24
- },
25
- async createWarehouse(a) {
26
- var r;
27
- const n = ((r = b.currentBusiness.value) == null ? void 0 : r._id) ?? "", i = `${v.inventoryBackendUrl}/businesses/${n}/warehouse`;
28
- return await h.post(i, a);
29
- },
30
- async updateWarehouse(a, n) {
31
- var l;
32
- const i = ((l = b.currentBusiness.value) == null ? void 0 : l._id) ?? "", r = `${v.inventoryBackendUrl}/businesses/${i}/warehouse/${a}`;
33
- return await h.put(r, n);
34
- },
35
- async deleteWarehouse(a) {
36
- var r;
37
- const n = ((r = b.currentBusiness.value) == null ? void 0 : r._id) ?? "", i = `${v.inventoryBackendUrl}/businesses/${n}/warehouse/${a}`;
38
- return await h.delete(i);
39
- }
40
- };
41
- });
42
- function Qe() {
43
- return {
44
- warehouses: []
45
- };
46
- }
47
- const ke = D(Qe());
48
- function xe() {
49
- return {
50
- // state
51
- get warehouses() {
52
- return ke.value.warehouses;
53
- },
54
- set warehouses(v) {
55
- ke.value.warehouses = v;
56
- },
57
- // actions
58
- async readWarehouses() {
59
- const v = X();
60
- this.warehouses = await v.readWarehouses();
61
- },
62
- async createWarehouse(v) {
63
- await X().createWarehouse(v);
64
- },
65
- async updateWarehouse(v) {
66
- await X().updateWarehouse(v._id, {
67
- ...v.profile,
68
- preparationTime: v.preparationTime
69
- });
70
- },
71
- async deleteWarehouse(v) {
72
- await X().deleteWarehouse(v._id);
73
- },
74
- async init() {
75
- const v = Ue();
76
- try {
77
- await this.readWarehouses();
78
- } catch (h) {
79
- throw h instanceof Ee || v.error("Error at reading warehouses"), h;
80
- }
81
- }
82
- };
83
- }
84
- function Xe(v, h) {
85
- function b(r, l) {
86
- if (r === J.Edit) {
87
- v(z(l));
88
- return;
89
- }
90
- if (r === J.Delete) {
91
- h(z(l));
92
- return;
93
- }
94
- }
95
- const { t: a } = G(), n = [
96
- {
97
- accessorKey: "warehouse",
98
- header: () => a("inventory.warehouse.table.warehouse"),
99
- size: 200
100
- },
101
- {
102
- accessorKey: "contact",
103
- header: () => a("inventory.warehouse.table.contact"),
104
- size: 200
105
- },
106
- {
107
- accessorKey: "email",
108
- header: () => a("inventory.warehouse.table.email"),
109
- size: 200
110
- },
111
- {
112
- accessorKey: "address",
113
- header: () => a("inventory.warehouse.table.address"),
114
- size: "auto"
115
- },
116
- {
117
- id: "action",
118
- header: "",
119
- cell(r) {
120
- return Be(
121
- [_e[J.Edit], _e[J.Delete]],
122
- (l) => {
123
- b(l, r.row.original.original);
124
- }
125
- );
126
- },
127
- enableSorting: !1,
128
- size: 40,
129
- meta: {
130
- cellClass: "",
131
- headerClass: ""
132
- }
133
- }
134
- ];
135
- function i(r) {
136
- return r.map((l) => ({
137
- original: l,
138
- warehouse: l.profile.name,
139
- contact: l.profile.phoneNo,
140
- email: l.profile.email,
141
- get address() {
142
- const d = l.profile.address;
143
- return [
144
- d == null ? void 0 : d.line1,
145
- d == null ? void 0 : d.line2,
146
- d == null ? void 0 : d.city,
147
- d == null ? void 0 : d.postcode,
148
- d == null ? void 0 : d.state,
149
- d == null ? void 0 : d.country
150
- ].map((w) => w == null ? void 0 : w.trim()).filter((w) => w).join(", ");
151
- }
152
- }));
153
- }
154
- return { columnDefs: n, formatRowData: i };
155
- }
156
- const eo = /* @__PURE__ */ O({
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: se.jb
178
- }
179
- },
180
- emits: ["map-click", "marker-change", "polygon-change", "polygon-right-click"],
181
- setup(v, { expose: h, emit: b }) {
182
- const a = v, n = b;
183
- h({
184
- setCenter: (s) => {
185
- var y, _;
186
- (y = l.value) == null || y.setCenter(s), (_ = l.value) == null || _.setZoom(18);
187
- }
188
- });
189
- const { googleMap: i } = re(), r = D(), l = D(null), d = [];
190
- function M(s) {
191
- return {
192
- lat: s.latLng.lat(),
193
- lng: s.latLng.lng()
194
- };
195
- }
196
- function w(s, y, _) {
197
- const p = i.maps.event.addListener(s, y, _);
198
- d.push(p);
199
- }
200
- const F = D([]);
201
- function T(s, y, _) {
202
- w(s, y, _);
203
- }
204
- function x(s) {
205
- P(null), F.value = s.map((y, _) => {
206
- const p = new i.maps.Marker({
207
- position: y,
208
- draggable: !0
209
- });
210
- return T(p, "dragend", (R) => {
211
- n("marker-change", { index: _, position: M(R) });
212
- }), p;
213
- }), P(l.value);
214
- }
215
- function P(s) {
216
- F.value.map((y) => we(y).setMap(s));
217
- }
218
- const c = D([]);
219
- function C(s, y, _) {
220
- w(s, y, _);
221
- }
222
- function S(s, y, _) {
223
- w(s, y, _);
224
- }
225
- function m(s) {
226
- return c.value[s].getPath().getArray().map(({ lat: _, lng: p }) => ({
227
- lat: _(),
228
- lng: p()
229
- }));
230
- }
231
- function f(s) {
232
- const y = m(s);
233
- n("polygon-change", { index: s, path: y });
234
- }
235
- function A(s, y) {
236
- const p = m(s).filter((R, K) => K !== y);
237
- n("polygon-change", { index: s, path: p });
238
- }
239
- function B(s, y) {
240
- y.vertex !== void 0 ? A(s, y.vertex) : n("polygon-right-click", s);
241
- }
242
- function V(s) {
243
- o(null), c.value = s.map((y, _) => {
244
- const p = new i.maps.Polygon({
245
- paths: y.paths,
246
- strokeColor: y.strokeColor,
247
- fillColor: y.fillColor,
248
- fillOpacity: 0.5,
249
- editable: a.editable
250
- });
251
- return C(p, "contextmenu", (R) => B(_, R)), p.getPaths().forEach((R) => {
252
- S(R, "insert_at", () => f(_)), S(R, "set_at", () => f(_));
253
- }), p;
254
- }), o(l.value);
255
- }
256
- function o(s) {
257
- c.value.map((y) => we(y).setMap(s));
258
- }
259
- function e(s, y, _) {
260
- w(s, y, _);
261
- }
262
- function t() {
263
- l.value = new i.maps.Map(r.value, {
264
- center: a.center,
265
- zoom: a.zoom,
266
- mapTypeControl: !1,
267
- streetViewControl: !1,
268
- draggable: !0,
269
- scrollwheel: !0
270
- }), e(l.value, "click", (s) => n("map-click", M(s)));
271
- }
272
- return ee(() => a.markers, x, { deep: !0 }), ee(() => a.polygons, V, { deep: !0 }), te(() => {
273
- !r.value || !i || (t(), x(a.markers), V(a.polygons));
274
- }), $e(() => {
275
- d.forEach((s) => s.remove());
276
- }), (s, y) => (W(), q("div", {
277
- ref_key: "mapRef",
278
- ref: r,
279
- class: "map app-map"
280
- }, null, 512));
281
- }
282
- }), oo = { class: "flex flex-col gap-24" }, to = { class: "flex flex-col gap-8" }, ao = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, lo = { class: "fm-typo-en-body-lg-600" }, so = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ro = { class: "fm-typo-en-body-lg-600" }, no = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, uo = { class: "fm-typo-en-body-lg-600" }, io = /* @__PURE__ */ O({
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(v) {
295
- const h = v, b = je(), a = re(), { t: n } = G(), i = Se(
296
- z(h.coordinate ? h.coordinate : se.jb)
297
- ), r = D(""), l = Ge(async function() {
298
- r.value = await a.getFirstMatchingAddress(
299
- i.lat,
300
- i.lng
301
- );
302
- }, 1e3);
303
- te(() => {
304
- b.emitData(z(i)), l();
305
- });
306
- function d({ position: w }) {
307
- i.lat = w.lat, i.lng = w.lng, b.emitData(z(i)), l();
308
- }
309
- const M = D();
310
- return (w, F) => (W(), q("div", oo, [
311
- g("div", to, [
312
- g("div", null, [
313
- g("span", ao, E(u(n)("inventory.formField.coordinate.address")) + ": ", 1),
314
- g("span", lo, E(r.value), 1)
315
- ]),
316
- g("div", null, [
317
- g("span", so, E(u(n)("inventory.formField.coordinate.longitude")) + ": ", 1),
318
- g("span", ro, E(i.lng), 1)
319
- ]),
320
- g("div", null, [
321
- g("span", no, E(u(n)("inventory.formField.coordinate.latitude")) + ": ", 1),
322
- g("span", uo, E(i.lat), 1)
323
- ])
324
- ]),
325
- k(eo, {
326
- ref_key: "gmapRef",
327
- ref: M,
328
- class: "h-[272px] sm:h-[240px] xs:h-[240px]",
329
- editable: "",
330
- center: i,
331
- markers: [i],
332
- onMarkerChange: d,
333
- onMapClick: F[0] || (F[0] = (T) => d({ position: T }))
334
- }, null, 8, ["center", "markers"])
335
- ]));
336
- }
337
- }), co = /* @__PURE__ */ Ke(io, [["__scopeId", "data-v-272f5e8b"]]);
338
- function Ae([v, h]) {
339
- return {
340
- lat: h,
341
- lng: v
342
- };
343
- }
344
- function po({ lng: v, lat: h }) {
345
- return [v, h];
346
- }
347
- const mo = { class: "flex gap-8 items-center" }, fo = { key: 0 }, yo = { key: 1 }, vo = /* @__PURE__ */ O({
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
- },
362
- emits: ["update:modelValue"],
363
- setup(v, { emit: h }) {
364
- const b = v, a = h, n = re(), i = Fe(), r = le(), l = oe(b, "modelValue"), d = D(!1), { t: M } = G();
365
- function w(c) {
366
- if (c != null && c[0] && (c != null && c[1]))
367
- return M("inventory.formField.coordinate.longLat", [c[0].toFixed(3), c[1].toFixed(3)]);
368
- }
369
- async function F(c) {
370
- var f, A;
371
- const C = b.modelValue, S = !C && ((f = b.address) != null && f.formatted) ? await n.getFirstMatchingCoordinate(b.address.formatted) : null, m = C ? Ae(C) : S ? Ae(S) : se.jb;
372
- i.open({
373
- title: b.dialogTitle ?? b.label ?? M("inventory.formField.coordinate.pinLocation"),
374
- closeButton: !0,
375
- contentComponent: co,
376
- contentComponentProps: {
377
- address: (A = b.address) == null ? void 0 : A.formatted,
378
- coordinate: m
379
- },
380
- primaryActions: {
381
- text: M("common.select"),
382
- close: !0
383
- },
384
- secondaryActions: {
385
- text: M("common.close"),
386
- close: !0
387
- }
388
- }).onPrimary(c);
389
- }
390
- const T = (c) => a("update:modelValue", c ? po(c) : null);
391
- async function x() {
392
- if (!b.disabled) {
393
- if (!n.isGoogleMapReady) {
394
- r.open({
395
- title: M("common.error"),
396
- message: M("inventory.formField.coordinate.error.loadMap"),
397
- type: "error"
398
- });
399
- return;
400
- }
401
- F(T);
402
- }
403
- }
404
- function P() {
405
- a("update:modelValue", null);
406
- }
407
- return (c, C) => {
408
- const S = N("FmField"), m = N("FmButton"), f = N("FmFormGroup");
409
- return W(), q("div", mo, [
410
- k(f, {
411
- class: "flex-1",
412
- "model-value": u(l),
413
- label: c.label,
414
- disabled: c.disabled,
415
- required: c.labelMark === "required",
416
- optional: c.labelMark === "optional",
417
- info: c.labelInfo,
418
- rules: c.rules,
419
- focused: d.value,
420
- "helper-text": c.helperText,
421
- "helper-state": c.helperState,
422
- onClick: C[0] || (C[0] = (A) => x())
423
- }, Te({
424
- default: I(({ invalid: A }) => [
425
- c.modelValue && c.modelValue[0] && c.modelValue[1] ? (W(), q("div", fo, [
426
- k(S, {
427
- invalid: A,
428
- class: "fm-typo-en-body-lg-400"
429
- }, {
430
- default: I(() => [
431
- Me(E(w(c.modelValue)), 1)
432
- ]),
433
- _: 2
434
- }, 1032, ["invalid"])
435
- ])) : (W(), q("div", yo, [
436
- k(m, {
437
- label: u(M)("inventory.formField.coordinate.addCoordinate"),
438
- "prepend-icon": "add",
439
- variant: "plain"
440
- }, null, 8, ["label"])
441
- ]))
442
- ]),
443
- _: 2
444
- }, [
445
- c.$slots.label ? {
446
- name: "label",
447
- fn: I(() => [
448
- De(c.$slots, "label")
449
- ]),
450
- key: "0"
451
- } : void 0
452
- ]), 1032, ["model-value", "label", "disabled", "required", "optional", "info", "rules", "focused", "helper-text", "helper-state"]),
453
- c.modelValue && c.modelValue[0] && c.modelValue[1] ? (W(), j(m, {
454
- key: 0,
455
- "prepend-icon": "delete",
456
- variant: "tertiary",
457
- onClick: C[1] || (C[1] = (A) => P())
458
- })) : ae("", !0)
459
- ]);
460
- };
461
- }
462
- }), ho = { class: "flex flex-col gap-40" }, bo = { class: "flex flex-col gap-16" }, go = { class: "flex flex-col gap-8" }, wo = { class: "fm-typo-en-title-sm-600" }, Vo = { class: "grid grid-cols-2 gap-24" }, _o = { class: "flex flex-col gap-8" }, ko = { class: "fm-typo-en-title-sm-600" }, Ao = {
463
- key: 0,
464
- class: "flex flex-col gap-8"
465
- }, Mo = { class: "fm-typo-en-title-sm-600" }, Co = { class: "flex flex-col gap-8" }, Fo = { class: "fm-typo-en-title-sm-600" }, xo = { class: "flex flex-col gap-16" }, $o = /* @__PURE__ */ O({
466
- __name: "WarehouseForm",
467
- props: {
468
- modelValue: {},
469
- disabled: { type: Boolean }
470
- },
471
- emits: ["update:modelValue", "validation-success"],
472
- setup(v, { expose: h, emit: b }) {
473
- const a = v, n = b, i = Ye(), { t: r } = G(), l = $({
474
- get() {
475
- var o, e;
476
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.name) ?? "";
477
- },
478
- set(o) {
479
- const e = a.modelValue ?? {};
480
- e.profile ?? (e.profile = {}), e.profile.name = o, n("update:modelValue", e);
481
- }
482
- }), d = $({
483
- get() {
484
- var o, e;
485
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.regNo) ?? "";
486
- },
487
- set(o) {
488
- const e = a.modelValue ?? {};
489
- e.profile ?? (e.profile = {}), e.profile.regNo = o, n("update:modelValue", e);
490
- }
491
- }), M = $({
492
- get() {
493
- var o, e, t;
494
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.line1) ?? "";
495
- },
496
- set(o) {
497
- var t;
498
- const e = a.modelValue ?? {};
499
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.line1 = o, n("update:modelValue", e);
500
- }
501
- }), w = $({
502
- get() {
503
- var o, e, t;
504
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.line2) ?? "";
505
- },
506
- set(o) {
507
- var t;
508
- const e = a.modelValue ?? {};
509
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.line2 = o, n("update:modelValue", e);
510
- }
511
- }), F = $({
512
- get() {
513
- var o, e, t;
514
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.city) ?? "";
515
- },
516
- set(o) {
517
- var t;
518
- const e = a.modelValue ?? {};
519
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.city = o, n("update:modelValue", e);
520
- }
521
- }), T = $({
522
- get() {
523
- var o, e, t;
524
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.postcode) ?? "";
525
- },
526
- set(o) {
527
- var t;
528
- const e = a.modelValue ?? {};
529
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.postcode = o, n("update:modelValue", e);
530
- }
531
- }), x = $({
532
- get() {
533
- var o, e, t;
534
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.state) ?? "";
535
- },
536
- set(o) {
537
- var t;
538
- const e = a.modelValue ?? {};
539
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.state = o, n("update:modelValue", e);
540
- }
541
- }), P = $({
542
- get() {
543
- var o, e, t;
544
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.country) ?? "";
545
- },
546
- set(o) {
547
- var t;
548
- const e = a.modelValue ?? {};
549
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.country = o, n("update:modelValue", e);
550
- }
551
- }), c = $({
552
- get() {
553
- var e;
554
- const o = (e = a.modelValue) == null ? void 0 : e.preparationTime;
555
- return o && typeof o == "object" && "value" in o ? o.value.toString() : "";
556
- },
557
- set(o) {
558
- const e = a.modelValue ?? {};
559
- e.profile ?? (e.profile = {}), e.preparationTime = {
560
- value: parseInt(o),
561
- unit: Ne.Enum.day
562
- }, n("update:modelValue", e);
563
- }
564
- }), C = $({
565
- get() {
566
- var o, e, t;
567
- return ((t = (e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.coordinates) ?? null;
568
- },
569
- set(o) {
570
- var t;
571
- const e = a.modelValue ?? {};
572
- e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.coordinates = o, n("update:modelValue", e);
573
- }
574
- }), S = $({
575
- get() {
576
- var o, e;
577
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.phoneNo) ?? "";
578
- },
579
- set(o) {
580
- const e = a.modelValue ?? {};
581
- e.profile ?? (e.profile = {}), e.profile.phoneNo = o, n("update:modelValue", e);
582
- }
583
- }), { enabledCountries: m, currentCountry: f } = Ce(), A = $({
584
- get() {
585
- var o, e;
586
- return ((e = (o = a.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.email) ?? "";
587
- },
588
- set(o) {
589
- const e = a.modelValue ?? {};
590
- e.profile ?? (e.profile = {}), e.profile.email = o, n("update:modelValue", e);
591
- }
592
- }), B = $({
593
- get() {
594
- var o;
595
- return ((o = a.modelValue) == null ? void 0 : o.customAttributes) ?? {};
596
- },
597
- set(o) {
598
- const e = a.modelValue ? {
599
- ...a.modelValue
600
- } : {};
601
- e.customAttributes = o, n("update:modelValue", e);
602
- }
603
- }), V = D();
604
- return h({
605
- validateInputs: () => {
606
- var o, e;
607
- (e = (o = V.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
608
- },
609
- resetInputsValidation: () => {
610
- var o, e;
611
- (e = (o = V.value) == null ? void 0 : o.resetInputsValidation) == null || e.call(o);
612
- },
613
- resetInputs: () => {
614
- var o, e;
615
- (e = (o = V.value) == null ? void 0 : o.resetInputs) == null || e.call(o);
616
- }
617
- }), (o, e) => {
618
- const t = N("FmTextField"), s = N("FmPill"), y = N("FmPhoneNumber"), _ = N("FmForm");
619
- return W(), j(_, {
620
- ref_key: "formRef",
621
- ref: V,
622
- onValidationSuccess: e[13] || (e[13] = (p) => n("validation-success"))
623
- }, {
624
- default: I(() => [
625
- g("div", ho, [
626
- g("div", bo, [
627
- k(t, {
628
- disabled: o.disabled,
629
- rules: [u(L)()],
630
- "label-mark": "required",
631
- label: u(r)("inventory.warehouse.companyName"),
632
- modelValue: l.value,
633
- "onUpdate:modelValue": e[0] || (e[0] = (p) => l.value = p)
634
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
635
- k(t, {
636
- disabled: o.disabled,
637
- rules: [u(L)()],
638
- "label-mark": "required",
639
- label: u(r)("inventory.warehouse.registrationNo"),
640
- modelValue: d.value,
641
- "onUpdate:modelValue": e[1] || (e[1] = (p) => d.value = p)
642
- }, null, 8, ["disabled", "rules", "label", "modelValue"])
643
- ]),
644
- g("div", go, [
645
- g("div", wo, E(u(r)("inventory.warehouse.address.title")), 1),
646
- g("div", Vo, [
647
- k(t, {
648
- disabled: o.disabled,
649
- rules: [u(L)()],
650
- "label-mark": "required",
651
- label: u(r)("inventory.warehouse.address.line1"),
652
- modelValue: M.value,
653
- "onUpdate:modelValue": e[2] || (e[2] = (p) => M.value = p)
654
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
655
- k(t, {
656
- disabled: o.disabled,
657
- "label-mark": "optional",
658
- label: u(r)("inventory.warehouse.address.line2"),
659
- modelValue: w.value,
660
- "onUpdate:modelValue": e[3] || (e[3] = (p) => w.value = p)
661
- }, null, 8, ["disabled", "label", "modelValue"]),
662
- k(t, {
663
- disabled: o.disabled,
664
- rules: [u(L)()],
665
- "label-mark": "required",
666
- label: u(r)("inventory.warehouse.address.city"),
667
- modelValue: F.value,
668
- "onUpdate:modelValue": e[4] || (e[4] = (p) => F.value = p)
669
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
670
- k(t, {
671
- disabled: o.disabled,
672
- rules: [u(L)()],
673
- "label-mark": "required",
674
- label: u(r)("inventory.warehouse.address.postcode"),
675
- modelValue: T.value,
676
- "onUpdate:modelValue": e[5] || (e[5] = (p) => T.value = p)
677
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
678
- k(t, {
679
- disabled: o.disabled,
680
- rules: [u(L)()],
681
- "label-mark": "required",
682
- label: u(r)("inventory.warehouse.address.state"),
683
- modelValue: x.value,
684
- "onUpdate:modelValue": e[6] || (e[6] = (p) => x.value = p)
685
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
686
- k(t, {
687
- disabled: o.disabled,
688
- rules: [u(L)()],
689
- "label-mark": "required",
690
- label: u(r)("inventory.warehouse.address.country"),
691
- modelValue: P.value,
692
- "onUpdate:modelValue": e[7] || (e[7] = (p) => P.value = p)
693
- }, null, 8, ["disabled", "rules", "label", "modelValue"])
694
- ])
695
- ]),
696
- g("div", _o, [
697
- g("div", ko, E(u(r)("inventory.warehouse.coordinate.title")), 1),
698
- k(vo, {
699
- disabled: o.disabled,
700
- rules: [u(L)()],
701
- "label-mark": "required",
702
- modelValue: C.value,
703
- "onUpdate:modelValue": e[8] || (e[8] = (p) => C.value = p)
704
- }, null, 8, ["disabled", "rules", "modelValue"])
705
- ]),
706
- u(i).enableSupplierPreparationTime ? (W(), q("div", Ao, [
707
- g("div", Mo, [
708
- Me(E(u(r)("inventory.supplier.delivery.title")) + " ", 1),
709
- k(s, { variant: "beta" })
710
- ]),
711
- k(t, {
712
- disabled: o.disabled,
713
- label: u(r)("inventory.supplier.delivery.preparationTime"),
714
- modelValue: c.value,
715
- "onUpdate:modelValue": e[9] || (e[9] = (p) => c.value = p),
716
- type: "number"
717
- }, null, 8, ["disabled", "label", "modelValue"])
718
- ])) : ae("", !0),
719
- g("div", Co, [
720
- g("div", Fo, E(u(r)("inventory.warehouse.contact.title")), 1),
721
- g("div", xo, [
722
- k(y, {
723
- disabled: o.disabled,
724
- rules: [u(L)()],
725
- "label-mark": "required",
726
- label: u(r)("inventory.warehouse.contact.phoneNumber"),
727
- modelValue: S.value,
728
- "onUpdate:modelValue": e[10] || (e[10] = (p) => S.value = p),
729
- "extra-country-codes": u(m),
730
- "default-country": u(f)
731
- }, null, 8, ["disabled", "rules", "label", "modelValue", "extra-country-codes", "default-country"]),
732
- k(t, {
733
- disabled: o.disabled,
734
- "label-mark": "optional",
735
- label: u(r)("inventory.warehouse.contact.email"),
736
- modelValue: A.value,
737
- "onUpdate:modelValue": e[11] || (e[11] = (p) => A.value = p)
738
- }, null, 8, ["disabled", "label", "modelValue"])
739
- ])
740
- ]),
741
- g("div", null, [
742
- k(He, {
743
- entity: "warehouse",
744
- modelValue: B.value,
745
- "onUpdate:modelValue": e[12] || (e[12] = (p) => B.value = p)
746
- }, null, 8, ["modelValue"])
747
- ])
748
- ])
749
- ]),
750
- _: 1
751
- }, 512);
752
- };
753
- }
754
- }), So = { class: "flex gap-4" }, To = /* @__PURE__ */ O({
755
- __name: "WarehouseDialog",
756
- props: {
757
- mode: {},
758
- warehouse: {},
759
- show: { type: Boolean }
760
- },
761
- emits: ["update:show", "submitted"],
762
- setup(v, { expose: h, emit: b }) {
763
- const a = v, n = b, i = D(!1), r = le(), { t: l } = G(), d = xe(), M = $(() => {
764
- switch (a.mode) {
765
- case U.READ:
766
- return "";
767
- case U.UPDATE:
768
- return l("inventory.warehouse.update.title");
769
- case U.CREATE:
770
- return l("inventory.warehouse.create.title");
771
- }
772
- return "";
773
- }), w = $(() => {
774
- switch (a.mode) {
775
- case U.READ:
776
- return "";
777
- case U.UPDATE:
778
- return l("common.save");
779
- case U.CREATE:
780
- return l("common.add");
781
- }
782
- return "";
783
- }), F = D();
784
- h({
785
- validateInputs: () => {
786
- var m, f;
787
- (f = (m = F.value) == null ? void 0 : m.validateInputs) == null || f.call(m);
788
- },
789
- resetInputsValidation: () => {
790
- var m, f;
791
- (f = (m = F.value) == null ? void 0 : m.resetInputsValidation) == null || f.call(m);
792
- },
793
- resetInputs: () => {
794
- var m, f;
795
- (f = (m = F.value) == null ? void 0 : m.resetInputs) == null || f.call(m);
796
- }
797
- });
798
- const T = oe(a, "show"), x = oe(a, "warehouse");
799
- function P() {
800
- var m, f;
801
- (f = (m = F.value) == null ? void 0 : m.validateInputs) == null || f.call(m);
802
- }
803
- function c() {
804
- switch (a.mode) {
805
- case U.READ:
806
- return;
807
- case U.UPDATE:
808
- return S();
809
- case U.CREATE:
810
- return C();
811
- }
812
- }
813
- async function C() {
814
- var m, f;
815
- i.value = !0;
816
- try {
817
- await Promise.all([
818
- d.createWarehouse(x.value),
819
- new Promise((A) => setTimeout(A, 1e3))
820
- ]), r.open({
821
- title: l("inventory.common.success"),
822
- message: l("inventory.warehouse.create.success", { name: (f = (m = x.value) == null ? void 0 : m.profile) == null ? void 0 : f.name }),
823
- type: "success"
824
- }), n("update:show", !1), n("submitted");
825
- } catch (A) {
826
- r.open({
827
- title: l("inventory.warehouse.create.error.title"),
828
- message: A instanceof Le ? A.message : l("inventory.warehouse.create.error.message"),
829
- type: "error"
830
- }), console.error("cannot create warehouse", A);
831
- } finally {
832
- i.value = !1;
833
- }
834
- }
835
- async function S() {
836
- var m, f;
837
- if (x.value === null) {
838
- r.open({
839
- title: l("inventory.warehouse.update.error.title"),
840
- message: l("inventory.warehouse.update.error.emptyWarehouse"),
841
- type: "error"
842
- });
843
- return;
844
- }
845
- i.value = !0;
846
- try {
847
- await Promise.all([
848
- d.updateWarehouse(x.value),
849
- new Promise((A) => setTimeout(A, 1e3))
850
- ]), r.open({
851
- title: l("inventory.common.success"),
852
- message: l("inventory.warehouse.update.success", { name: (f = (m = x.value) == null ? void 0 : m.profile) == null ? void 0 : f.name }),
853
- type: "success"
854
- }), n("update:show", !1), n("submitted");
855
- } catch (A) {
856
- r.open({
857
- title: l("inventory.warehouse.update.error.title"),
858
- message: l("inventory.warehouse.update.error.message"),
859
- type: "error"
860
- }), console.error("cannot update warehouse", A);
861
- } finally {
862
- i.value = !1;
863
- }
864
- }
865
- return (m, f) => {
866
- const A = N("FmButton"), B = N("FmSideSheet");
867
- return W(), j(B, {
868
- header: M.value,
869
- modelValue: u(T),
870
- "onUpdate:modelValue": f[1] || (f[1] = (V) => Ve(T) ? T.value = V : null),
871
- "dismiss-away": !i.value,
872
- "close-button": "",
873
- "max-width": 500
874
- }, {
875
- default: I(() => {
876
- var V;
877
- return [
878
- (W(), j($o, {
879
- class: "w-full",
880
- ref_key: "formRef",
881
- ref: F,
882
- modelValue: u(x),
883
- "onUpdate:modelValue": f[0] || (f[0] = (o) => Ve(x) ? x.value = o : null),
884
- onValidationSuccess: c,
885
- key: ((V = m.warehouse) == null ? void 0 : V._id) ?? "",
886
- disabled: i.value
887
- }, null, 8, ["modelValue", "disabled"]))
888
- ];
889
- }),
890
- "side-sheet-footer": I(() => [
891
- g("div", So, [
892
- k(A, {
893
- loading: i.value,
894
- label: w.value,
895
- onClick: P
896
- }, null, 8, ["loading", "label"])
897
- ])
898
- ]),
899
- _: 1
900
- }, 8, ["header", "modelValue", "dismiss-away"]);
901
- };
902
- }
903
- }), Do = { class: "flex flex-col py-8" }, Wo = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Ro = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Po = {
904
- key: 0,
905
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
906
- }, Uo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-3" }, Xo = /* @__PURE__ */ O({
907
- __name: "WarehouseView",
908
- setup(v) {
909
- const h = xe(), b = Ie(), a = $(() => h.warehouses), n = Fe(), i = le(), r = D(!1), { t: l } = G();
910
- te(() => {
911
- b._currentLocation && S();
912
- }), ee([() => b._currentLocation], () => {
913
- b._currentLocation && S();
914
- });
915
- const d = D({});
916
- function M() {
917
- d.value.mode = U.CREATE, d.value.warehouse = {}, d.value.show = !0;
918
- }
919
- function w(V) {
920
- const o = z(V);
921
- d.value.mode = U.UPDATE, d.value.warehouse = o, d.value.show = !0;
922
- }
923
- async function F(V) {
924
- n.open({
925
- title: l("inventory.warehouse.delete.confirm"),
926
- message: l("inventory.warehouse.delete.confirmMessage", { name: V.profile.name }),
927
- primaryActions: {
928
- text: "Delete",
929
- close: !0,
930
- variant: "destructive"
931
- },
932
- secondaryActions: {
933
- text: "Cancel",
934
- close: !0
935
- }
936
- }).onPrimary(() => T(V));
937
- }
938
- async function T(V) {
939
- n.open({
940
- title: l("inventory.warehouse.delete.deletingWarehouse"),
941
- closeButton: !1
942
- });
943
- try {
944
- await h.deleteWarehouse(V), i.open({
945
- title: l("inventory.warehouse.delete.success"),
946
- message: l("inventory.warehouse.delete.deletedWarehouse", { name: V.profile.name }),
947
- type: "success"
948
- }), await S(!0);
949
- } catch (o) {
950
- i.open({
951
- title: l("inventory.warehouse.delete.error"),
952
- message: l("inventory.warehouse.delete.errorMessage", { name: V.profile.name }),
953
- type: "error"
954
- }), console.error("failed to delete warehouse", o);
955
- } finally {
956
- n.close();
957
- }
958
- }
959
- const { columnDefs: x, formatRowData: P } = Xe(
960
- w,
961
- F
962
- );
963
- function c(V) {
964
- V === "create" && M();
965
- }
966
- const C = D("");
967
- async function S(V = !1) {
968
- r.value = !0;
969
- try {
970
- await h.readWarehouses(), V && await b.readLocations();
971
- } catch {
972
- i.open({
973
- title: "Cannot fetch warehouse list",
974
- type: "error"
975
- });
976
- } finally {
977
- r.value = !1;
978
- }
979
- }
980
- const { breakpoints: m } = Oe(), f = $(() => m.value.xs || m.value.sm), A = $(() => f.value ? 10 : 20), B = qe();
981
- return (V, o) => {
982
- const e = N("FmTable");
983
- return W(), j(ze, {
984
- title: u(l)("inventory.warehouse.title"),
985
- actions: [
986
- {
987
- label: u(l)("inventory.warehouse.create.title"),
988
- value: "create",
989
- isPrimary: !0,
990
- prependIcon: "add"
991
- }
992
- ],
993
- "onClick:action": c
994
- }, {
995
- default: I(() => [
996
- g("div", {
997
- class: We([
998
- "flex flex-col gap-8 max-h-full",
999
- {
1000
- "p-0": f.value,
1001
- "px-24 ": !f.value
1002
- }
1003
- ])
1004
- }, [
1005
- k(Je, {
1006
- searchable: "",
1007
- search: C.value,
1008
- "onUpdate:search": o[0] || (o[0] = (t) => C.value = t)
1009
- }, null, 8, ["search"]),
1010
- (W(), j(e, {
1011
- style: Re(u(B).tableHeight),
1012
- "column-defs": u(x),
1013
- "row-data": u(P)(a.value),
1014
- "search-value": C.value,
1015
- loading: !u(b)._currentLocation || r.value,
1016
- onRowClick: o[1] || (o[1] = (t) => w(t.original.original)),
1017
- key: a.value.length,
1018
- "page-size": A.value
1019
- }, {
1020
- "list-row": I((t) => [
1021
- k(Ze, {
1022
- row: t,
1023
- onRowClick: (s) => w(s.original)
1024
- }, {
1025
- default: I((s) => {
1026
- var y, _, p, R, K, ne, ue, ie, H, de, ce, pe, me, fe, Y, ye, ve, he, be, Z, ge;
1027
- return [
1028
- g("div", Do, [
1029
- g("div", Wo, [
1030
- k(u(Q), {
1031
- render: (p = (_ = (y = s.warehouse) == null ? void 0 : y.column) == null ? void 0 : _.columnDef) == null ? void 0 : p.cell,
1032
- props: (K = (R = s.warehouse) == null ? void 0 : R.getContext) == null ? void 0 : K.call(R)
1033
- }, null, 8, ["render", "props"])
1034
- ]),
1035
- g("div", Ro, [
1036
- k(u(Q), {
1037
- render: (ie = (ue = (ne = s.contact) == null ? void 0 : ne.column) == null ? void 0 : ue.columnDef) == null ? void 0 : ie.cell,
1038
- props: (de = (H = s.contact) == null ? void 0 : H.getContext) == null ? void 0 : de.call(H)
1039
- }, null, 8, ["render", "props"])
1040
- ]),
1041
- (ce = t.original) != null && ce.email ? (W(), q("div", Po, [
1042
- k(u(Q), {
1043
- render: (fe = (me = (pe = s.email) == null ? void 0 : pe.column) == null ? void 0 : me.columnDef) == null ? void 0 : fe.cell,
1044
- props: (ye = (Y = s.email) == null ? void 0 : Y.getContext) == null ? void 0 : ye.call(Y)
1045
- }, null, 8, ["render", "props"])
1046
- ])) : ae("", !0),
1047
- g("div", Uo, [
1048
- k(u(Q), {
1049
- render: (be = (he = (ve = s.address) == null ? void 0 : ve.column) == null ? void 0 : he.columnDef) == null ? void 0 : be.cell,
1050
- props: (ge = (Z = s.address) == null ? void 0 : Z.getContext) == null ? void 0 : ge.call(Z)
1051
- }, null, 8, ["render", "props"])
1052
- ])
1053
- ])
1054
- ];
1055
- }),
1056
- _: 2
1057
- }, 1032, ["row", "onRowClick"])
1058
- ]),
1059
- _: 1
1060
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1061
- ], 2),
1062
- k(To, {
1063
- show: d.value.show,
1064
- "onUpdate:show": o[2] || (o[2] = (t) => d.value.show = t),
1065
- warehouse: d.value.warehouse,
1066
- mode: d.value.mode,
1067
- onSubmitted: o[3] || (o[3] = (t) => S(!0))
1068
- }, null, 8, ["show", "warehouse", "mode"])
1069
- ]),
1070
- _: 1
1071
- }, 8, ["title", "actions"]);
1072
- };
1073
- }
1074
- });
1075
- export {
1076
- Xo as default
1077
- };