@feedmepos/mf-inventory-portal 1.7.12-dev.1 → 1.7.12-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 (90) hide show
  1. package/dist/{App-Zjoj7th9.js → App-DE5q8pJt.js} +7 -7
  2. package/dist/{ApprovalView-Cl5HhN3j.js → ApprovalView-tn3kgVnm.js} +9 -9
  3. package/dist/{BindingsDialog-3NRAskTw.js → BindingsDialog-BcpMSsbG.js} +2 -2
  4. package/dist/{BindingsPicker-Dn_Z7AXH.js → BindingsPicker-D-XtjmkW.js} +2 -2
  5. package/dist/{BindingsTable-DJfPc3bX.js → BindingsTable-CpQ6DVv6.js} +4 -4
  6. package/dist/{BulkReceiveRequestView-kFVonMtj.js → BulkReceiveRequestView-BOUrL6ir.js} +19 -19
  7. package/dist/{ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Cu-LwhMc.js → ChangeLocationComponent.vue_vue_type_script_setup_true_lang-Bu9YI9f7.js} +1 -1
  8. package/dist/{ClosingDraftView-rgY5R7rH.js → ClosingDraftView-BQkusa3K.js} +19 -19
  9. package/dist/{ClosingHistoryView-BWo5Zfg9.js → ClosingHistoryView-DNmUcfKW.js} +5 -5
  10. package/dist/{ClosingTemplateView-0hd1bbRF.js → ClosingTemplateView-BGMMQIlm.js} +16 -16
  11. package/dist/{CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BVLkGI3q.js → CustomPrintTemplatePreview.vue_vue_type_script_setup_true_lang-BlrhLlmx.js} +1 -1
  12. package/dist/{DefaultView-D_a7mO1d.js → DefaultView-DbW7mva7.js} +2 -2
  13. package/dist/{DeliveryOrderPrintPreview-wvMJXbqW.js → DeliveryOrderPrintPreview-C6gqP8ro.js} +2 -2
  14. package/dist/{EmailDialog.vue_vue_type_script_setup_true_lang-CI5wpzVc.js → EmailDialog.vue_vue_type_script_setup_true_lang-XU50lg6w.js} +2250 -2250
  15. package/dist/{FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-DVeCzgYj.js → FmDateRangePickerChip.vue_vue_type_script_setup_true_lang-D-3eipuP.js} +1 -1
  16. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-aY75LBvg.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-CfmhYGml.js} +2 -2
  17. package/dist/{FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-I7MyyY0l.js → FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DyEY4i7p.js} +2 -2
  18. package/dist/{FmMultiselectDialog-CALAu98v.js → FmMultiselectDialog-DCzjYd3G.js} +2 -2
  19. package/dist/{FmMultiselectDialog-Bzx3qvlQ.js → FmMultiselectDialog-zWGXAdy0.js} +1 -1
  20. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DXcWyoms.js → FmUnitInput.vue_vue_type_script_setup_true_lang-Ple3fGYg.js} +6 -6
  21. package/dist/{ImportView-C03iv8Rz.js → ImportView-pEnmvGQZ.js} +6 -6
  22. package/dist/{IngredientBindedItem.vue_vue_type_script_setup_true_lang-D22hIFRS.js → IngredientBindedItem.vue_vue_type_script_setup_true_lang-zneEDRRK.js} +1 -1
  23. package/dist/{IngredientGroupView-D9sVDZ4K.js → IngredientGroupView-C4LKT2no.js} +5 -5
  24. package/dist/{IngredientsView-mWr_3IOT.js → IngredientsView-BuAz_kTx.js} +15 -15
  25. package/dist/{IntegrationExplorerView-BP4OsTrw.js → IntegrationExplorerView-C2BSURrj.js} +4 -4
  26. package/dist/{IntegrationView-tDdgJq8v.js → IntegrationView-D_mBNCCe.js} +14 -14
  27. package/dist/{InventoryBindingForm-B3xXDk9D.js → InventoryBindingForm-bZo-006V.js} +1 -1
  28. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BrCfJMBq.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-DJg4Yogw.js} +5 -5
  29. package/dist/{InventoryBindingSummary-IwLszyLP.js → InventoryBindingSummary-BB9KGZ2m.js} +1 -1
  30. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-CnTmeO6C.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DXUTZvuO.js} +1 -1
  31. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-WLmWGNM1.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BaBJdjs1.js} +1 -1
  32. package/dist/{ProductionView-D674uvHU.js → ProductionView-Dl-Cyg38.js} +7 -7
  33. package/dist/{PublishView-CnObB4ed.js → PublishView-C3X5HiH6.js} +3 -3
  34. package/dist/{PurchaseOrderPrintPreview-SRYoRNXX.js → PurchaseOrderPrintPreview-CSrsukQD.js} +2 -2
  35. package/dist/{ReceiveRequestView-BH9q6BNw.js → ReceiveRequestView-DHfHO1hN.js} +14 -14
  36. package/dist/{RecipeView-B6rTxGUj.js → RecipeView-CDWEAe2t.js} +17 -17
  37. package/dist/{SettingsView-ChRZoXOQ.js → SettingsView-BLIWAA-o.js} +4 -4
  38. package/dist/{StockView-CNbLoirW.js → StockView-C0v3io9V.js} +21 -21
  39. package/dist/{SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-D431xXOp.js → SubsidiaryTreeDialog.vue_vue_type_script_setup_true_lang-DlECppRw.js} +1 -1
  40. package/dist/{SupplierView-0Ik9t7h5.js → SupplierView-J61tPOTo.js} +12 -12
  41. package/dist/{SurchargeView-B0EOef3a.js → SurchargeView-BACvlFV2.js} +6 -6
  42. package/dist/{SystemTrailDialog.vue_vue_type_script_setup_true_lang-CJQzCpzK.js → SystemTrailDialog.vue_vue_type_script_setup_true_lang-DJ08rDXE.js} +2 -2
  43. package/dist/{TemplatePublishDialog.vue_vue_type_script_setup_true_lang-BA_3tfAX.js → TemplatePublishDialog.vue_vue_type_script_setup_true_lang-CSLs6e0k.js} +1 -1
  44. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-BLATExKY.js → TransferDetails.vue_vue_type_script_setup_true_lang-C_cRs9Cy.js} +20 -20
  45. package/dist/{TransferTemplateView-BlYUrUSk.js → TransferTemplateView-CEAAZaYQ.js} +20 -20
  46. package/dist/{UnitCostHistoryView-BJV-skNz.js → UnitCostHistoryView-rmgLm5vt.js} +4 -4
  47. package/dist/{UnitDisplayControl.vue_vue_type_script_setup_true_lang-Bc8RdRi2.js → UnitDisplayControl.vue_vue_type_script_setup_true_lang-o1eSDUbx.js} +4 -4
  48. package/dist/{UnitView-B6CKmwnd.js → UnitView-C0xIGsAy.js} +7 -7
  49. package/dist/WarehouseView-RPXyVYIR.js +1082 -0
  50. package/dist/{WastageTemplateView-Bc54z0GW.js → WastageTemplateView-DrEDl-Cn.js} +14 -14
  51. package/dist/{app-B5gyvQqp.js → app-DxdWfyxo.js} +251 -235
  52. package/dist/app.js +1 -1
  53. package/dist/{closing-template-BX7M6U28.js → closing-template-DLkEPmhO.js} +1 -1
  54. package/dist/{date2-B3vSNZPa.js → date2-_HV-UUr-.js} +1 -1
  55. package/dist/{dayjs.min-RI1MhHIp.js → dayjs.min-B4ZBHgnH.js} +1 -1
  56. package/dist/{decimal-C8GlBD-D.js → decimal-BP9r-3Fd.js} +2 -2
  57. package/dist/{defineDeepModel-BlNY4PKK.js → defineDeepModel-512Elkp4.js} +1 -1
  58. package/dist/{duplicate-template-DOLKU747.js → duplicate-template-B5Wg73Th.js} +1 -1
  59. package/dist/{feature-Db_mzTW5.js → feature-CqyeXw0w.js} +2 -2
  60. package/dist/{format-time-from-id-D2NTH4Kl.js → format-time-from-id-CBkBQaBx.js} +1 -1
  61. package/dist/{format-unit-display-BzIlnWVZ.js → format-unit-display-DNWWwkbf.js} +12 -12
  62. package/dist/{import-export.helper-B2zDbTZ-.js → import-export.helper-BSz6k4kC.js} +6 -6
  63. package/dist/{index-BOKqtp7W.js → index-BcC1HW4y.js} +3 -3
  64. package/dist/{index-B-yiNvFs.js → index-DCGTaCsW.js} +1 -1
  65. package/dist/{index-CTKj2npl.js → index-Dxc2IYXi.js} +1 -1
  66. package/dist/{inventory-core-dart.default-BtP1IlTd.js → inventory-core-dart.default-BbZy6Cok.js} +1 -1
  67. package/dist/{lz-string-TliBBzY1.js → lz-string-RCKGmlTu.js} +1 -1
  68. package/dist/{netsuite-Bx9zfO6D.js → netsuite-tMIpKK4c.js} +2 -2
  69. package/dist/{number-ON9UUtj8.js → number-Bf8QDJ39.js} +3 -3
  70. package/dist/{predefined-templates-DN_WPJfI.js → predefined-templates-Bh5ObypP.js} +1 -1
  71. package/dist/{purchase-order-template-C_9wLae5.js → purchase-order-template-Cdeh8-im.js} +1 -1
  72. package/dist/{recalculationUtils-DBTDkx9G.js → recalculationUtils-CJ02T70y.js} +1 -1
  73. package/dist/{rules-xnn3-Len.js → rules-BrpDaHZu.js} +2 -2
  74. package/dist/{stock-B3zGQryO.js → stock-BP1CvvEN.js} +3 -3
  75. package/dist/{stock-CB7P__qm.js → stock-Ca3ejqyO.js} +1 -1
  76. package/dist/{supplier-BTXTn0bN.js → supplier-CikAplrR.js} +2 -2
  77. package/dist/{surcharge-voSJfpsM.js → surcharge-z_QfAREF.js} +1 -1
  78. package/dist/tsconfig.app.tsbuildinfo +1 -1
  79. package/dist/{uom-rules-64EwcIr7.js → uom-rules-BU0EkWV5.js} +1 -1
  80. package/dist/{use-ingredient-select-dialog-CWSEDu-m.js → use-ingredient-select-dialog-DxxL31dH.js} +2 -2
  81. package/dist/{use-inventory-binding-dialog-HuxFkPP0.js → use-inventory-binding-dialog-oRxuJqJI.js} +2 -2
  82. package/dist/{use-template-enabled-locations-Cw5roIHZ.js → use-template-enabled-locations-CcQMhBXm.js} +2 -2
  83. package/dist/{use-transfer-locations-4QYq6lOQ.js → use-transfer-locations-ByuoGAkE.js} +2 -2
  84. package/dist/{useHrmPermission-lATKCM9d.js → useHrmPermission-VmapATbV.js} +1 -1
  85. package/dist/{useNavigationMenu-gDaTop4p.js → useNavigationMenu-D6vXqC9N.js} +2 -2
  86. package/dist/{useSseClient-C8HDJYTK.js → useSseClient-Dzsg1Vj-.js} +1 -1
  87. package/dist/{vue-i18n-guKtBUVP.js → vue-i18n-DApbl4qi.js} +337 -337
  88. package/dist/{xlsx.util-DFBAJNta.js → xlsx.util-B75j3mbr.js} +2 -2
  89. package/package.json +3 -3
  90. package/dist/WarehouseView-Bib8KRcn.js +0 -1079
@@ -0,0 +1,1082 @@
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-DxdWfyxo.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-tMIpKK4c.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-BrpDaHZu.js";
11
+ import { c as $e, u as re, g as Ye } from "./googlemap-D9vA7GsS.js";
12
+ import { d as Ze } from "./index-DCGTaCsW.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-CqyeXw0w.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-DyEY4i7p.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
+ };