@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.11

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 (117) hide show
  1. package/dist/ApprovalView-BtgtZgDY.js +121 -0
  2. package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-DDqu7p2z.js} +9 -10
  3. package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-BDhn5Do7.js} +7 -8
  4. package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-C5R7orsB.js} +4 -6
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js +272 -0
  6. package/dist/IngredientsView-Ac52Wd12.js +1751 -0
  7. package/dist/IntegrationView-6mJtJK-d.js +1172 -0
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C2BFaTg-.js} +1 -1
  9. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-CL0RBLOF.js +88 -0
  10. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js +29 -0
  11. package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-UzrsJ0AN.js} +12 -12
  12. package/dist/ReceiveRequestView-DW9u9TJZ.js +208 -0
  13. package/dist/RecipeView-W15pCZKU.js +573 -0
  14. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  15. package/dist/StockView-BqEe-OIX.js +1877 -0
  16. package/dist/SupplierView-CGr2N-e7.js +801 -0
  17. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DupNA58V.js +739 -0
  18. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-COVncBoC.js +1676 -0
  19. package/dist/TransferTemplateView-HgaSR8L8.js +1101 -0
  20. package/dist/UnitView-C07Yrynl.js +638 -0
  21. package/dist/WarehouseView-DL-8j9vX.js +1050 -0
  22. package/dist/api/bill.d.ts +2 -2
  23. package/dist/api/purchase-order-template.d.ts +7 -0
  24. package/dist/app-B1MZZxUg.js +67134 -0
  25. package/dist/app.d.ts +1185 -0
  26. package/dist/app.js +7 -3
  27. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  28. package/dist/components/FmMultiselectDialogProps.d.ts +7 -0
  29. package/dist/components/FmUnitInputProps.d.ts +2 -0
  30. package/dist/components/FmUnitInputRules.d.ts +1 -0
  31. package/dist/components/row-action.enum.d.ts +5 -1
  32. package/dist/composable/defineDeepModel.d.ts +2 -0
  33. package/dist/{decimal-BAZuuTcd.js → decimal-BXf_WdLk.js} +1 -1
  34. package/dist/helper/country.d.ts +2 -0
  35. package/dist/id-to-date-Dlovyec6.js +30 -0
  36. package/dist/layout-BJjS48J5.js +151 -0
  37. package/dist/purchase-order-transaction-type-CMIu0jrP.js +299 -0
  38. package/dist/router/name.d.ts +2 -1
  39. package/dist/row-action.enum-PMKMRrZR.js +50 -0
  40. package/dist/stores/supplier.d.ts +90 -7
  41. package/dist/style.css +1 -1
  42. package/dist/supplier-IDQmZ4VM.js +54 -0
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +2 -0
  45. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +2 -0
  46. package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +26 -0
  47. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +14 -2
  48. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -2
  49. package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
  50. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -0
  51. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  52. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +4 -0
  53. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +22 -0
  54. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -1
  55. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +187 -0
  56. package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +23 -0
  57. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +21 -0
  58. package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +9 -0
  59. package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +6 -0
  60. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +112 -0
  61. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -1
  62. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +18 -12
  63. package/dist/views/receive-request/helper/get-transfer-type.d.ts +2 -0
  64. package/dist/views/recipe/composables/use-recipe-form.d.ts +14 -2
  65. package/dist/views/recipe/composables/use-recipe-table.d.ts +1 -2
  66. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  67. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  68. package/dist/views/stock/composables/use-stock-action.d.ts +26 -0
  69. package/dist/views/stock/composables/use-stock-table.d.ts +1 -8
  70. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  71. package/dist/views/stock/helper/stock-row-action.d.ts +2 -2
  72. package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +2 -0
  73. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +20 -0
  74. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +9 -0
  75. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +22 -0
  76. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialogProps.d.ts +10 -0
  77. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +16 -0
  78. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateFormProps.d.ts +7 -0
  79. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +18 -0
  80. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +116 -0
  81. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +113 -0
  82. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +914 -0
  83. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +290 -0
  84. package/dist/views/unit/composables/use-unit-form.d.ts +14 -2
  85. package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
  86. package/dist/{xlsx-vUzm_udV.js → xlsx-CfdXcS72.js} +1 -1
  87. package/dist/xlsx.util-C5Wx4IUs.js +109 -0
  88. package/package.json +6 -5
  89. package/dist/ApprovalView-BTZwnKLf.js +0 -118
  90. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
  91. package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js +0 -143
  92. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js +0 -236
  93. package/dist/IngredientsView-DMyEGdik.js +0 -1767
  94. package/dist/IntegrationView-Dn_qL_vC.js +0 -1166
  95. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
  96. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js +0 -35
  97. package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
  98. package/dist/RecipeView-B1aNLDIK.js +0 -573
  99. package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
  100. package/dist/StockView-C_Ur_jTg.js +0 -1862
  101. package/dist/SupplierView-CXfOoHTr.js +0 -796
  102. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
  103. package/dist/UnitView-DHXfAsnq.js +0 -635
  104. package/dist/WarehouseView-DMwbxs1q.js +0 -1043
  105. package/dist/app-BkcO8oNJ.js +0 -66113
  106. package/dist/date2-Cvp5iJkI.js +0 -95
  107. package/dist/dayjs.min-D1_pOsO7.js +0 -282
  108. package/dist/fuzzy-0roCBvgC.js +0 -41
  109. package/dist/index-B_aEOJsR.js +0 -21515
  110. package/dist/layout-BnTfCS_X.js +0 -151
  111. package/dist/number-DLj3W3RW.js +0 -97
  112. package/dist/row-action.enum-BwQbURNh.js +0 -28
  113. package/dist/rules-CCmXA0Yi.js +0 -85
  114. package/dist/stock-estimate-CL4HShG8.js +0 -122
  115. package/dist/supplier-CjAH8O1y.js +0 -65
  116. package/dist/use-inventory-binding-dialog-GkJOzE6V.js +0 -93
  117. package/dist/xlsx.util-B_bqymTM.js +0 -107
@@ -0,0 +1,1050 @@
1
+ import { ref as W, defineComponent as O, watch as ee, onMounted as te, onUnmounted as Fe, openBlock as R, createElementBlock as z, toRaw as be, reactive as $e, createElementVNode as b, toDisplayString as L, unref as p, createVNode as k, resolveComponent as B, createSlots as De, withCtx as q, createTextVNode as We, renderSlot as Se, createBlock as j, createCommentVNode as xe, computed as D, isRef as we, normalizeStyle as Te } from "vue";
2
+ import { n as Re, Q as Ee, T as Pe, c as G, V as ae, W as le, X as Ue, i as Le, R as N, j as Ne } from "./app-B1MZZxUg.js";
3
+ import { useCoreStore as Be, useI18n as I } from "@feedmepos/mf-common";
4
+ import { D as Ve, R as Z, F as P } from "./row-action.enum-PMKMRrZR.js";
5
+ import { c as qe, _ as Ie, F as J, u as ze } from "./layout-BJjS48J5.js";
6
+ import { _ as je, a as Oe } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js";
7
+ import { useDialogChild as Ge, useDialog as Ae, useSnackbar as se, useProxiedModel as oe, useBreakpoints as Ke } from "@feedmepos/ui-library";
8
+ const Y = Re((c, m) => {
9
+ const f = Be();
10
+ return {
11
+ async readWarehouses() {
12
+ var a;
13
+ const l = ((a = f.currentBusiness.value) == null ? void 0 : a._id) ?? "", s = `${c.inventoryBackendUrl}/businesses/${l}/warehouses`;
14
+ return await m.get(s);
15
+ },
16
+ async createWarehouse(l) {
17
+ var n;
18
+ const s = ((n = f.currentBusiness.value) == null ? void 0 : n._id) ?? "", a = `${c.inventoryBackendUrl}/businesses/${s}/warehouse`;
19
+ return await m.post(a, l);
20
+ },
21
+ async updateWarehouse(l, s) {
22
+ var r;
23
+ const a = ((r = f.currentBusiness.value) == null ? void 0 : r._id) ?? "", n = `${c.inventoryBackendUrl}/businesses/${a}/warehouse/${l}`;
24
+ return await m.put(n, s);
25
+ },
26
+ async deleteWarehouse(l) {
27
+ var n;
28
+ const s = ((n = f.currentBusiness.value) == null ? void 0 : n._id) ?? "", a = `${c.inventoryBackendUrl}/businesses/${s}/warehouse/${l}`;
29
+ return await m.delete(a);
30
+ }
31
+ };
32
+ });
33
+ function He() {
34
+ return {
35
+ warehouses: []
36
+ };
37
+ }
38
+ const _e = W(He());
39
+ function Ce() {
40
+ return {
41
+ // state
42
+ get warehouses() {
43
+ return _e.value.warehouses;
44
+ },
45
+ set warehouses(c) {
46
+ _e.value.warehouses = c;
47
+ },
48
+ // actions
49
+ async readWarehouses() {
50
+ const c = Y();
51
+ this.warehouses = await c.readWarehouses();
52
+ },
53
+ async createWarehouse(c) {
54
+ await Y().createWarehouse(c);
55
+ },
56
+ async updateWarehouse(c) {
57
+ await Y().updateWarehouse(c._id, c.profile);
58
+ },
59
+ async deleteWarehouse(c) {
60
+ await Y().deleteWarehouse(c._id);
61
+ },
62
+ async init() {
63
+ const c = Ee();
64
+ try {
65
+ await this.readWarehouses();
66
+ } catch (m) {
67
+ throw m instanceof Pe || c.error("Error at reading warehouses"), m;
68
+ }
69
+ }
70
+ };
71
+ }
72
+ function Qe(c, m) {
73
+ function f(n, r) {
74
+ if (n === Z.Edit) {
75
+ c(G(r));
76
+ return;
77
+ }
78
+ if (n === Z.Delete) {
79
+ m(G(r));
80
+ return;
81
+ }
82
+ }
83
+ const { t: l } = I(), s = [
84
+ {
85
+ accessorKey: "warehouse",
86
+ header: () => l("inventory.warehouse.table.warehouse"),
87
+ size: 200
88
+ },
89
+ {
90
+ accessorKey: "contact",
91
+ header: () => l("inventory.warehouse.table.contact"),
92
+ size: 200
93
+ },
94
+ {
95
+ accessorKey: "email",
96
+ header: () => l("inventory.warehouse.table.email"),
97
+ size: 200
98
+ },
99
+ {
100
+ accessorKey: "address",
101
+ header: () => l("inventory.warehouse.table.address"),
102
+ size: "auto"
103
+ },
104
+ {
105
+ id: "action",
106
+ header: "",
107
+ cell(n) {
108
+ return qe(
109
+ [Ve[Z.Edit], Ve[Z.Delete]],
110
+ (r) => {
111
+ f(r, n.row.original.original);
112
+ }
113
+ );
114
+ },
115
+ enableSorting: !1,
116
+ size: 40,
117
+ meta: {
118
+ cellClass: "",
119
+ headerClass: ""
120
+ }
121
+ }
122
+ ];
123
+ function a(n) {
124
+ return n.map((r) => ({
125
+ original: r,
126
+ warehouse: r.profile.name,
127
+ contact: r.profile.phoneNo,
128
+ email: r.profile.email,
129
+ get address() {
130
+ const u = r.profile.address;
131
+ return [
132
+ u == null ? void 0 : u.line1,
133
+ u == null ? void 0 : u.line2,
134
+ u == null ? void 0 : u.city,
135
+ u == null ? void 0 : u.postcode,
136
+ u == null ? void 0 : u.state,
137
+ u == null ? void 0 : u.country
138
+ ].map((v) => v == null ? void 0 : v.trim()).filter((v) => v).join(", ");
139
+ }
140
+ }));
141
+ }
142
+ return { columnDefs: s, formatRowData: a };
143
+ }
144
+ const Xe = /* @__PURE__ */ O({
145
+ __name: "GoogleMap",
146
+ props: {
147
+ markers: {
148
+ type: Array,
149
+ default: () => []
150
+ },
151
+ polygons: {
152
+ type: Array,
153
+ default: () => []
154
+ },
155
+ zoom: {
156
+ type: Number,
157
+ default: 14
158
+ },
159
+ editable: {
160
+ type: Boolean,
161
+ default: !1
162
+ },
163
+ center: {
164
+ type: Object,
165
+ default: ae.jb
166
+ }
167
+ },
168
+ emits: ["map-click", "marker-change", "polygon-change", "polygon-right-click"],
169
+ setup(c, { expose: m, emit: f }) {
170
+ const l = c, s = f;
171
+ m({
172
+ setCenter: (d) => {
173
+ var h, V;
174
+ (h = r.value) == null || h.setCenter(d), (V = r.value) == null || V.setZoom(18);
175
+ }
176
+ });
177
+ const { googleMap: a } = le(), n = W(), r = W(null), u = [];
178
+ function _(d) {
179
+ return {
180
+ lat: d.latLng.lat(),
181
+ lng: d.latLng.lng()
182
+ };
183
+ }
184
+ function v(d, h, V) {
185
+ const $ = a.maps.event.addListener(d, h, V);
186
+ u.push($);
187
+ }
188
+ const g = W([]);
189
+ function A(d, h, V) {
190
+ v(d, h, V);
191
+ }
192
+ function x(d) {
193
+ S(null), g.value = d.map((h, V) => {
194
+ const $ = new a.maps.Marker({
195
+ position: h,
196
+ draggable: !0
197
+ });
198
+ return A($, "dragend", (U) => {
199
+ s("marker-change", { index: V, position: _(U) });
200
+ }), $;
201
+ }), S(r.value);
202
+ }
203
+ function S(d) {
204
+ g.value.map((h) => be(h).setMap(d));
205
+ }
206
+ const i = W([]);
207
+ function C(d, h, V) {
208
+ v(d, h, V);
209
+ }
210
+ function M(d, h, V) {
211
+ v(d, h, V);
212
+ }
213
+ function o(d) {
214
+ return i.value[d].getPath().getArray().map(({ lat: V, lng: $ }) => ({
215
+ lat: V(),
216
+ lng: $()
217
+ }));
218
+ }
219
+ function e(d) {
220
+ const h = o(d);
221
+ s("polygon-change", { index: d, path: h });
222
+ }
223
+ function t(d, h) {
224
+ const $ = o(d).filter((U, K) => K !== h);
225
+ s("polygon-change", { index: d, path: $ });
226
+ }
227
+ function F(d, h) {
228
+ h.vertex !== void 0 ? t(d, h.vertex) : s("polygon-right-click", d);
229
+ }
230
+ function w(d) {
231
+ y(null), i.value = d.map((h, V) => {
232
+ const $ = new a.maps.Polygon({
233
+ paths: h.paths,
234
+ strokeColor: h.strokeColor,
235
+ fillColor: h.fillColor,
236
+ fillOpacity: 0.5,
237
+ editable: l.editable
238
+ });
239
+ return C($, "contextmenu", (U) => F(V, U)), $.getPaths().forEach((U) => {
240
+ M(U, "insert_at", () => e(V)), M(U, "set_at", () => e(V));
241
+ }), $;
242
+ }), y(r.value);
243
+ }
244
+ function y(d) {
245
+ i.value.map((h) => be(h).setMap(d));
246
+ }
247
+ function E(d, h, V) {
248
+ v(d, h, V);
249
+ }
250
+ function T() {
251
+ r.value = new a.maps.Map(n.value, {
252
+ center: l.center,
253
+ zoom: l.zoom,
254
+ mapTypeControl: !1,
255
+ streetViewControl: !1,
256
+ draggable: !0,
257
+ scrollwheel: !0
258
+ }), E(r.value, "click", (d) => s("map-click", _(d)));
259
+ }
260
+ return ee(() => l.markers, x, { deep: !0 }), ee(() => l.polygons, w, { deep: !0 }), te(() => {
261
+ !n.value || !a || (T(), x(l.markers), w(l.polygons));
262
+ }), Fe(() => {
263
+ u.forEach((d) => d.remove());
264
+ }), (d, h) => (R(), z("div", {
265
+ ref_key: "mapRef",
266
+ ref: n,
267
+ class: "map app-map"
268
+ }, null, 512));
269
+ }
270
+ });
271
+ var re = { exports: {} };
272
+ function Me(c, m = 100, f = {}) {
273
+ if (typeof c != "function")
274
+ throw new TypeError(`Expected the first parameter to be a function, got \`${typeof c}\`.`);
275
+ if (m < 0)
276
+ throw new RangeError("`wait` must not be negative.");
277
+ const { immediate: l } = typeof f == "boolean" ? { immediate: f } : f;
278
+ let s, a, n, r, u;
279
+ function _() {
280
+ const g = Date.now() - r;
281
+ if (g < m && g >= 0)
282
+ n = setTimeout(_, m - g);
283
+ else if (n = void 0, !l) {
284
+ const A = s, x = a;
285
+ s = void 0, a = void 0, u = c.apply(A, x);
286
+ }
287
+ }
288
+ const v = function(...g) {
289
+ if (s && this !== s)
290
+ throw new Error("Debounced method called with different contexts.");
291
+ s = this, a = g, r = Date.now();
292
+ const A = l && !n;
293
+ if (n || (n = setTimeout(_, m)), A) {
294
+ const x = s, S = a;
295
+ s = void 0, a = void 0, u = c.apply(x, S);
296
+ }
297
+ return u;
298
+ };
299
+ return v.clear = () => {
300
+ n && (clearTimeout(n), n = void 0);
301
+ }, v.flush = () => {
302
+ if (!n)
303
+ return;
304
+ const g = s, A = a;
305
+ s = void 0, a = void 0, u = c.apply(g, A), clearTimeout(n), n = void 0;
306
+ }, v;
307
+ }
308
+ re.exports.debounce = Me;
309
+ re.exports = Me;
310
+ var Ze = re.exports;
311
+ const Je = /* @__PURE__ */ Ue(Ze), Ye = { class: "flex flex-col gap-24" }, eo = { class: "flex flex-col gap-8" }, oo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, to = { class: "fm-typo-en-body-lg-600" }, 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 = /* @__PURE__ */ O({
312
+ __name: "CoordinateDialog",
313
+ props: {
314
+ address: {
315
+ type: String,
316
+ required: !0
317
+ },
318
+ coordinate: {
319
+ type: Object,
320
+ default: void 0
321
+ }
322
+ },
323
+ setup(c) {
324
+ const m = c, f = Ge(), l = le(), { t: s } = I(), a = $e(
325
+ G(m.coordinate ? m.coordinate : ae.jb)
326
+ ), n = W(""), r = Je(async function() {
327
+ n.value = await l.getFirstMatchingAddress(
328
+ a.lat,
329
+ a.lng
330
+ );
331
+ }, 1e3);
332
+ te(() => {
333
+ f.emitData(G(a)), r();
334
+ });
335
+ function u({ position: v }) {
336
+ a.lat = v.lat, a.lng = v.lng, f.emitData(G(a)), r();
337
+ }
338
+ const _ = W();
339
+ return (v, g) => (R(), z("div", Ye, [
340
+ b("div", eo, [
341
+ b("div", null, [
342
+ b("span", oo, L(p(s)("inventory.formField.coordinate.address")) + ": ", 1),
343
+ b("span", to, L(n.value), 1)
344
+ ]),
345
+ b("div", null, [
346
+ b("span", ao, L(p(s)("inventory.formField.coordinate.longitude")) + ": ", 1),
347
+ b("span", lo, L(a.lng), 1)
348
+ ]),
349
+ b("div", null, [
350
+ b("span", so, L(p(s)("inventory.formField.coordinate.latitude")) + ": ", 1),
351
+ b("span", ro, L(a.lat), 1)
352
+ ])
353
+ ]),
354
+ k(Xe, {
355
+ ref_key: "gmapRef",
356
+ ref: _,
357
+ class: "h-[272px] sm:h-[240px] xs:h-[240px]",
358
+ editable: "",
359
+ center: a,
360
+ markers: [a],
361
+ onMarkerChange: u,
362
+ onMapClick: g[0] || (g[0] = (A) => u({ position: A }))
363
+ }, null, 8, ["center", "markers"])
364
+ ]));
365
+ }
366
+ }), uo = /* @__PURE__ */ Le(no, [["__scopeId", "data-v-272f5e8b"]]);
367
+ function ke([c, m]) {
368
+ return {
369
+ lat: m,
370
+ lng: c
371
+ };
372
+ }
373
+ function io({ lng: c, lat: m }) {
374
+ return [c, m];
375
+ }
376
+ const co = { class: "flex gap-8 items-center" }, po = { key: 0 }, mo = { key: 1 }, fo = /* @__PURE__ */ O({
377
+ __name: "FmCoordinateInput",
378
+ props: {
379
+ address: {},
380
+ modelValue: {},
381
+ dialogTitle: {},
382
+ label: {},
383
+ helperText: {},
384
+ helperState: {},
385
+ labelMark: {},
386
+ labelInfo: {},
387
+ placeholder: {},
388
+ disabled: { type: Boolean },
389
+ rules: {}
390
+ },
391
+ emits: ["update:modelValue"],
392
+ setup(c, { emit: m }) {
393
+ const f = c, l = m, s = le(), a = Ae(), n = se(), r = oe(f, "modelValue"), u = W(!1), { t: _ } = I();
394
+ function v(i) {
395
+ if (i != null && i[0] && (i != null && i[1]))
396
+ return _("inventory.formField.coordinate.longLat", [i[0].toFixed(3), i[1].toFixed(3)]);
397
+ }
398
+ async function g(i) {
399
+ var e, t;
400
+ const C = f.modelValue, M = !C && ((e = f.address) != null && e.formatted) ? await s.getFirstMatchingCoordinate(f.address.formatted) : null, o = C ? ke(C) : M ? ke(M) : ae.jb;
401
+ a.open({
402
+ title: f.dialogTitle ?? f.label ?? _("inventory.formField.coordinate.pinLocation"),
403
+ closeButton: !0,
404
+ contentComponent: uo,
405
+ contentComponentProps: {
406
+ address: (t = f.address) == null ? void 0 : t.formatted,
407
+ coordinate: o
408
+ },
409
+ primaryActions: {
410
+ text: _("common.select"),
411
+ close: !0
412
+ },
413
+ secondaryActions: {
414
+ text: _("common.close"),
415
+ close: !0
416
+ }
417
+ }).onPrimary(i);
418
+ }
419
+ const A = (i) => l("update:modelValue", i ? io(i) : null);
420
+ async function x() {
421
+ if (!f.disabled) {
422
+ if (!s.isGoogleMapReady) {
423
+ n.open({
424
+ title: _("common.error"),
425
+ message: _("inventory.formField.coordinate.error.loadMap"),
426
+ type: "error"
427
+ });
428
+ return;
429
+ }
430
+ g(A);
431
+ }
432
+ }
433
+ function S() {
434
+ l("update:modelValue", null);
435
+ }
436
+ return (i, C) => {
437
+ const M = B("FmField"), o = B("FmButton"), e = B("FmFormGroup");
438
+ return R(), z("div", co, [
439
+ k(e, {
440
+ class: "flex-1",
441
+ "model-value": p(r),
442
+ label: i.label,
443
+ disabled: i.disabled,
444
+ required: i.labelMark === "required",
445
+ optional: i.labelMark === "optional",
446
+ info: i.labelInfo,
447
+ rules: i.rules,
448
+ focused: u.value,
449
+ "helper-text": i.helperText,
450
+ "helper-state": i.helperState,
451
+ onClick: C[0] || (C[0] = (t) => x())
452
+ }, De({
453
+ default: q(({ invalid: t }) => [
454
+ i.modelValue && i.modelValue[0] && i.modelValue[1] ? (R(), z("div", po, [
455
+ k(M, {
456
+ invalid: t,
457
+ class: "fm-typo-en-body-lg-400"
458
+ }, {
459
+ default: q(() => [
460
+ We(L(v(i.modelValue)), 1)
461
+ ]),
462
+ _: 2
463
+ }, 1032, ["invalid"])
464
+ ])) : (R(), z("div", mo, [
465
+ k(o, {
466
+ label: p(_)("inventory.formField.coordinate.addCoordinate"),
467
+ "prepend-icon": "add",
468
+ variant: "plain"
469
+ }, null, 8, ["label"])
470
+ ]))
471
+ ]),
472
+ _: 2
473
+ }, [
474
+ i.$slots.label ? {
475
+ name: "label",
476
+ fn: q(() => [
477
+ Se(i.$slots, "label")
478
+ ]),
479
+ key: "0"
480
+ } : void 0
481
+ ]), 1032, ["model-value", "label", "disabled", "required", "optional", "info", "rules", "focused", "helper-text", "helper-state"]),
482
+ i.modelValue && i.modelValue[0] && i.modelValue[1] ? (R(), j(o, {
483
+ key: 0,
484
+ "prepend-icon": "delete",
485
+ variant: "tertiary",
486
+ onClick: C[1] || (C[1] = (t) => S())
487
+ })) : xe("", !0)
488
+ ]);
489
+ };
490
+ }
491
+ }), ho = { class: "flex flex-col gap-40" }, yo = { class: "flex flex-col gap-16" }, vo = { class: "flex flex-col gap-8" }, go = { class: "fm-typo-en-title-sm-800" }, bo = { class: "grid grid-cols-2 gap-24" }, wo = { class: "flex flex-col gap-8" }, Vo = { class: "fm-typo-en-title-sm-800" }, _o = { class: "flex flex-col gap-8" }, ko = { class: "fm-typo-en-title-sm-800" }, xo = { class: "flex flex-col gap-16" }, Ao = /* @__PURE__ */ O({
492
+ __name: "WarehouseForm",
493
+ props: {
494
+ modelValue: {},
495
+ disabled: { type: Boolean }
496
+ },
497
+ emits: ["update:modelValue", "validation-success"],
498
+ setup(c, { expose: m, emit: f }) {
499
+ const l = c, s = f, { t: a } = I(), n = D({
500
+ get() {
501
+ var o, e;
502
+ return ((e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.name) ?? "";
503
+ },
504
+ set(o) {
505
+ const e = l.modelValue ?? {};
506
+ e.profile ?? (e.profile = {}), e.profile.name = o, s("update:modelValue", e);
507
+ }
508
+ }), r = D({
509
+ get() {
510
+ var o, e;
511
+ return ((e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.regNo) ?? "";
512
+ },
513
+ set(o) {
514
+ const e = l.modelValue ?? {};
515
+ e.profile ?? (e.profile = {}), e.profile.regNo = o, s("update:modelValue", e);
516
+ }
517
+ }), u = D({
518
+ get() {
519
+ var o, e, t;
520
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.line1) ?? "";
521
+ },
522
+ set(o) {
523
+ var t;
524
+ const e = l.modelValue ?? {};
525
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.line1 = o, s("update:modelValue", e);
526
+ }
527
+ }), _ = D({
528
+ get() {
529
+ var o, e, t;
530
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.line2) ?? "";
531
+ },
532
+ set(o) {
533
+ var t;
534
+ const e = l.modelValue ?? {};
535
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.line2 = o, s("update:modelValue", e);
536
+ }
537
+ }), v = D({
538
+ get() {
539
+ var o, e, t;
540
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.city) ?? "";
541
+ },
542
+ set(o) {
543
+ var t;
544
+ const e = l.modelValue ?? {};
545
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.city = o, s("update:modelValue", e);
546
+ }
547
+ }), g = D({
548
+ get() {
549
+ var o, e, t;
550
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.postcode) ?? "";
551
+ },
552
+ set(o) {
553
+ var t;
554
+ const e = l.modelValue ?? {};
555
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.postcode = o, s("update:modelValue", e);
556
+ }
557
+ }), A = D({
558
+ get() {
559
+ var o, e, t;
560
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.state) ?? "";
561
+ },
562
+ set(o) {
563
+ var t;
564
+ const e = l.modelValue ?? {};
565
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.state = o, s("update:modelValue", e);
566
+ }
567
+ }), x = D({
568
+ get() {
569
+ var o, e, t;
570
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.country) ?? "";
571
+ },
572
+ set(o) {
573
+ var t;
574
+ const e = l.modelValue ?? {};
575
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.country = o, s("update:modelValue", e);
576
+ }
577
+ }), S = D({
578
+ get() {
579
+ var o, e, t;
580
+ return ((t = (e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.address) == null ? void 0 : t.coordinates) ?? null;
581
+ },
582
+ set(o) {
583
+ var t;
584
+ const e = l.modelValue ?? {};
585
+ e.profile ?? (e.profile = {}), (t = e.profile).address ?? (t.address = {}), e.profile.address.coordinates = o, s("update:modelValue", e);
586
+ }
587
+ }), i = D({
588
+ get() {
589
+ var o, e;
590
+ return ((e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.phoneNo) ?? "";
591
+ },
592
+ set(o) {
593
+ const e = l.modelValue ?? {};
594
+ e.profile ?? (e.profile = {}), e.profile.phoneNo = o, s("update:modelValue", e);
595
+ }
596
+ }), C = D({
597
+ get() {
598
+ var o, e;
599
+ return ((e = (o = l.modelValue) == null ? void 0 : o.profile) == null ? void 0 : e.email) ?? "";
600
+ },
601
+ set(o) {
602
+ const e = l.modelValue ?? {};
603
+ e.profile ?? (e.profile = {}), e.profile.email = o, s("update:modelValue", e);
604
+ }
605
+ }), M = W();
606
+ return m({
607
+ validateInputs: () => {
608
+ var o, e;
609
+ (e = (o = M.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
610
+ },
611
+ resetInputsValidation: () => {
612
+ var o, e;
613
+ (e = (o = M.value) == null ? void 0 : o.resetInputsValidation) == null || e.call(o);
614
+ },
615
+ resetInputs: () => {
616
+ var o, e;
617
+ (e = (o = M.value) == null ? void 0 : o.resetInputs) == null || e.call(o);
618
+ }
619
+ }), (o, e) => {
620
+ const t = B("FmTextField"), F = B("FmPhoneNumber"), w = B("FmForm");
621
+ return R(), j(w, {
622
+ ref_key: "formRef",
623
+ ref: M,
624
+ onValidationSuccess: e[11] || (e[11] = (y) => s("validation-success"))
625
+ }, {
626
+ default: q(() => [
627
+ b("div", ho, [
628
+ b("div", yo, [
629
+ k(t, {
630
+ disabled: o.disabled,
631
+ rules: [p(N)()],
632
+ "label-mark": "required",
633
+ label: p(a)("inventory.warehouse.companyName"),
634
+ modelValue: n.value,
635
+ "onUpdate:modelValue": e[0] || (e[0] = (y) => n.value = y)
636
+ }, null, 8, ["disabled", "rules", "label", "modelValue"]),
637
+ k(t, {
638
+ disabled: o.disabled,
639
+ rules: [p(N)()],
640
+ "label-mark": "required",
641
+ label: p(a)("inventory.warehouse.registrationNo"),
642
+ modelValue: r.value,
643
+ "onUpdate:modelValue": e[1] || (e[1] = (y) => r.value = y)
644
+ }, null, 8, ["disabled", "rules", "label", "modelValue"])
645
+ ]),
646
+ b("div", vo, [
647
+ b("div", go, L(p(a)("inventory.warehouse.address.title")), 1),
648
+ b("div", bo, [
649
+ k(t, {
650
+ disabled: o.disabled,
651
+ rules: [p(N)()],
652
+ "label-mark": "required",
653
+ label: p(a)("inventory.warehouse.address.line1"),
654
+ modelValue: u.value,
655
+ "onUpdate:modelValue": e[2] || (e[2] = (y) => u.value = y)
656
+ }, null, 8, ["disabled", "rules", "label", "modelValue"]),
657
+ k(t, {
658
+ disabled: o.disabled,
659
+ "label-mark": "optional",
660
+ label: p(a)("inventory.warehouse.address.line2"),
661
+ modelValue: _.value,
662
+ "onUpdate:modelValue": e[3] || (e[3] = (y) => _.value = y)
663
+ }, null, 8, ["disabled", "label", "modelValue"]),
664
+ k(t, {
665
+ disabled: o.disabled,
666
+ rules: [p(N)()],
667
+ "label-mark": "required",
668
+ label: p(a)("inventory.warehouse.address.city"),
669
+ modelValue: v.value,
670
+ "onUpdate:modelValue": e[4] || (e[4] = (y) => v.value = y)
671
+ }, null, 8, ["disabled", "rules", "label", "modelValue"]),
672
+ k(t, {
673
+ disabled: o.disabled,
674
+ rules: [p(N)()],
675
+ "label-mark": "required",
676
+ label: p(a)("inventory.warehouse.address.postcode"),
677
+ modelValue: g.value,
678
+ "onUpdate:modelValue": e[5] || (e[5] = (y) => g.value = y)
679
+ }, null, 8, ["disabled", "rules", "label", "modelValue"]),
680
+ k(t, {
681
+ disabled: o.disabled,
682
+ rules: [p(N)()],
683
+ "label-mark": "required",
684
+ label: p(a)("inventory.warehouse.address.state"),
685
+ modelValue: A.value,
686
+ "onUpdate:modelValue": e[6] || (e[6] = (y) => A.value = y)
687
+ }, null, 8, ["disabled", "rules", "label", "modelValue"]),
688
+ k(t, {
689
+ disabled: o.disabled,
690
+ rules: [p(N)()],
691
+ "label-mark": "required",
692
+ label: p(a)("inventory.warehouse.address.country"),
693
+ modelValue: x.value,
694
+ "onUpdate:modelValue": e[7] || (e[7] = (y) => x.value = y)
695
+ }, null, 8, ["disabled", "rules", "label", "modelValue"])
696
+ ])
697
+ ]),
698
+ b("div", wo, [
699
+ b("div", Vo, L(p(a)("inventory.warehouse.coordinate.title")), 1),
700
+ k(fo, {
701
+ disabled: o.disabled,
702
+ rules: [p(N)()],
703
+ "label-mark": "required",
704
+ modelValue: S.value,
705
+ "onUpdate:modelValue": e[8] || (e[8] = (y) => S.value = y)
706
+ }, null, 8, ["disabled", "rules", "modelValue"])
707
+ ]),
708
+ b("div", _o, [
709
+ b("div", ko, L(p(a)("inventory.warehouse.contact.title")), 1),
710
+ b("div", xo, [
711
+ k(F, {
712
+ disabled: o.disabled,
713
+ rules: [p(N)()],
714
+ "label-mark": "required",
715
+ label: p(a)("inventory.warehouse.contact.phoneNumber"),
716
+ modelValue: i.value,
717
+ "onUpdate:modelValue": e[9] || (e[9] = (y) => i.value = y)
718
+ }, null, 8, ["disabled", "rules", "label", "modelValue"]),
719
+ k(t, {
720
+ disabled: o.disabled,
721
+ "label-mark": "optional",
722
+ label: p(a)("inventory.warehouse.contact.email"),
723
+ modelValue: C.value,
724
+ "onUpdate:modelValue": e[10] || (e[10] = (y) => C.value = y)
725
+ }, null, 8, ["disabled", "label", "modelValue"])
726
+ ])
727
+ ])
728
+ ])
729
+ ]),
730
+ _: 1
731
+ }, 512);
732
+ };
733
+ }
734
+ }), Co = { class: "flex gap-4" }, Mo = /* @__PURE__ */ O({
735
+ __name: "WarehouseDialog",
736
+ props: {
737
+ mode: {},
738
+ warehouse: {},
739
+ show: { type: Boolean }
740
+ },
741
+ emits: ["update:show", "submitted"],
742
+ setup(c, { expose: m, emit: f }) {
743
+ const l = c, s = f, a = W(!1), n = se(), { t: r } = I(), u = Ce(), _ = D(() => {
744
+ switch (l.mode) {
745
+ case P.READ:
746
+ return "";
747
+ case P.UPDATE:
748
+ return r("inventory.warehouse.update.title");
749
+ case P.CREATE:
750
+ return r("inventory.warehouse.create.title");
751
+ }
752
+ return "";
753
+ }), v = D(() => {
754
+ switch (l.mode) {
755
+ case P.READ:
756
+ return "";
757
+ case P.UPDATE:
758
+ return r("common.save");
759
+ case P.CREATE:
760
+ return r("common.add");
761
+ }
762
+ return "";
763
+ }), g = W();
764
+ m({
765
+ validateInputs: () => {
766
+ var o, e;
767
+ (e = (o = g.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
768
+ },
769
+ resetInputsValidation: () => {
770
+ var o, e;
771
+ (e = (o = g.value) == null ? void 0 : o.resetInputsValidation) == null || e.call(o);
772
+ },
773
+ resetInputs: () => {
774
+ var o, e;
775
+ (e = (o = g.value) == null ? void 0 : o.resetInputs) == null || e.call(o);
776
+ }
777
+ });
778
+ const A = oe(l, "show"), x = oe(l, "warehouse");
779
+ function S() {
780
+ var o, e;
781
+ (e = (o = g.value) == null ? void 0 : o.validateInputs) == null || e.call(o);
782
+ }
783
+ function i() {
784
+ switch (l.mode) {
785
+ case P.READ:
786
+ return;
787
+ case P.UPDATE:
788
+ return M();
789
+ case P.CREATE:
790
+ return C();
791
+ }
792
+ }
793
+ async function C() {
794
+ var o, e;
795
+ a.value = !0;
796
+ try {
797
+ await Promise.all([
798
+ u.createWarehouse(x.value),
799
+ new Promise((t) => setTimeout(t, 1e3))
800
+ ]), n.open({
801
+ title: r("common.success"),
802
+ message: r("inventory.warehouse.create.success", { name: (e = (o = x.value) == null ? void 0 : o.profile) == null ? void 0 : e.name }),
803
+ type: "success"
804
+ }), s("update:show", !1), s("submitted");
805
+ } catch (t) {
806
+ n.open({
807
+ title: r("inventory.warehouse.create.error.title"),
808
+ message: r("inventory.warehouse.create.error.message"),
809
+ type: "error"
810
+ }), console.error("cannot create warehouse", t);
811
+ } finally {
812
+ a.value = !1;
813
+ }
814
+ }
815
+ async function M() {
816
+ var o, e;
817
+ if (x.value === null) {
818
+ n.open({
819
+ title: r("inventory.warehouse.update.error.title"),
820
+ message: r("inventory.warehouse.update.error.emptyWarehouse"),
821
+ type: "error"
822
+ });
823
+ return;
824
+ }
825
+ a.value = !0;
826
+ try {
827
+ await Promise.all([
828
+ u.updateWarehouse(x.value),
829
+ new Promise((t) => setTimeout(t, 1e3))
830
+ ]), n.open({
831
+ title: r("common.success"),
832
+ message: r("inventory.warehouse.update.success", { name: (e = (o = x.value) == null ? void 0 : o.profile) == null ? void 0 : e.name }),
833
+ type: "success"
834
+ }), s("update:show", !1), s("submitted");
835
+ } catch (t) {
836
+ n.open({
837
+ title: r("inventory.warehouse.update.error.title"),
838
+ message: r("inventory.warehouse.update.error.message"),
839
+ type: "error"
840
+ }), console.error("cannot update warehouse", t);
841
+ } finally {
842
+ a.value = !1;
843
+ }
844
+ }
845
+ return (o, e) => {
846
+ const t = B("FmButton"), F = B("FmSideSheet");
847
+ return R(), j(F, {
848
+ header: _.value,
849
+ modelValue: p(A),
850
+ "onUpdate:modelValue": e[1] || (e[1] = (w) => we(A) ? A.value = w : null),
851
+ "dismiss-away": !a.value,
852
+ "close-button": "",
853
+ "max-width": 500
854
+ }, {
855
+ default: q(() => {
856
+ var w;
857
+ return [
858
+ (R(), j(Ao, {
859
+ class: "w-full",
860
+ ref_key: "formRef",
861
+ ref: g,
862
+ modelValue: p(x),
863
+ "onUpdate:modelValue": e[0] || (e[0] = (y) => we(x) ? x.value = y : null),
864
+ onValidationSuccess: i,
865
+ key: ((w = o.warehouse) == null ? void 0 : w._id) ?? "",
866
+ disabled: a.value
867
+ }, null, 8, ["modelValue", "disabled"]))
868
+ ];
869
+ }),
870
+ "side-sheet-footer": q(() => [
871
+ b("div", Co, [
872
+ k(t, {
873
+ loading: a.value,
874
+ label: v.value,
875
+ onClick: S
876
+ }, null, 8, ["loading", "label"])
877
+ ])
878
+ ]),
879
+ _: 1
880
+ }, 8, ["header", "modelValue", "dismiss-away"]);
881
+ };
882
+ }
883
+ }), Fo = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, $o = { class: "flex flex-col py-8" }, Do = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, Wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, So = {
884
+ key: 0,
885
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
886
+ }, To = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary line-clamp-3" }, qo = /* @__PURE__ */ O({
887
+ __name: "WarehouseView",
888
+ setup(c) {
889
+ const m = Ce(), f = Ne(), l = D(() => m.warehouses), s = Ae(), a = se(), n = W(!1), { t: r } = I();
890
+ te(() => {
891
+ f._currentLocation && M();
892
+ }), ee([() => f._currentLocation], () => {
893
+ f._currentLocation && M();
894
+ });
895
+ const u = W({});
896
+ function _() {
897
+ u.value.mode = P.CREATE, u.value.warehouse = {}, u.value.show = !0;
898
+ }
899
+ function v(F) {
900
+ u.value.mode = P.UPDATE, u.value.warehouse = F, u.value.show = !0;
901
+ }
902
+ async function g(F) {
903
+ s.open({
904
+ title: r("inventory.warehouse.delete.confirm"),
905
+ message: r("inventory.warehouse.delete.confirmMessage", { name: F.profile.name }),
906
+ primaryActions: {
907
+ text: "Delete",
908
+ close: !0,
909
+ variant: "destructive"
910
+ },
911
+ secondaryActions: {
912
+ text: "Cancel",
913
+ close: !0
914
+ }
915
+ }).onPrimary(() => A(F));
916
+ }
917
+ async function A(F) {
918
+ const { t: w } = I();
919
+ s.open({
920
+ title: w("inventory.warehouse.delete.deletingWarehouse"),
921
+ closeButton: !1
922
+ });
923
+ try {
924
+ await m.deleteWarehouse(F), a.open({
925
+ title: w("inventory.warehouse.delete.success"),
926
+ message: w("inventory.warehouse.delete.deletedWarehouse", { name: F.profile.name }),
927
+ type: "success"
928
+ }), await M(!0);
929
+ } catch (y) {
930
+ a.open({
931
+ title: w("inventory.warehouse.delete.error"),
932
+ message: w("inventory.warehouse.delete.errorMessage", { name: F.profile.name }),
933
+ type: "error"
934
+ }), console.error("failed to delete warehouse", y);
935
+ } finally {
936
+ s.close();
937
+ }
938
+ }
939
+ const { columnDefs: x, formatRowData: S } = Qe(
940
+ v,
941
+ g
942
+ );
943
+ function i(F) {
944
+ F === "create" && _();
945
+ }
946
+ const C = W("");
947
+ async function M(F = !1) {
948
+ n.value = !0;
949
+ try {
950
+ await m.readWarehouses(), F && await f.readLocations();
951
+ } catch {
952
+ a.open({
953
+ title: "Cannot fetch warehouse list",
954
+ type: "error"
955
+ });
956
+ } finally {
957
+ n.value = !1;
958
+ }
959
+ }
960
+ const { breakpoints: o } = Ke(), e = D(() => o.value.xs || o.value.sm ? 10 : 20), t = ze();
961
+ return (F, w) => {
962
+ const y = B("FmTable");
963
+ return R(), j(je, {
964
+ title: p(r)("inventory.warehouse.title"),
965
+ actions: [
966
+ {
967
+ label: p(r)("inventory.warehouse.create.title"),
968
+ value: "create",
969
+ isPrimary: !0,
970
+ prependIcon: "add"
971
+ }
972
+ ],
973
+ "onClick:action": i
974
+ }, {
975
+ default: q(() => [
976
+ b("div", Fo, [
977
+ k(Oe, {
978
+ searchable: "",
979
+ "change-location": "",
980
+ search: C.value,
981
+ "onUpdate:search": w[0] || (w[0] = (E) => C.value = E)
982
+ }, null, 8, ["search"]),
983
+ (R(), j(y, {
984
+ style: Te(p(t).tableHeight),
985
+ "column-defs": p(x),
986
+ "row-data": p(S)(l.value),
987
+ "search-value": C.value,
988
+ loading: !p(f)._currentLocation || n.value,
989
+ onRowClick: w[1] || (w[1] = (E) => v(E.original.original)),
990
+ key: l.value.length,
991
+ "page-size": e.value
992
+ }, {
993
+ "list-row": q((E) => [
994
+ k(Ie, {
995
+ row: E,
996
+ onRowClick: (T) => v(T.original)
997
+ }, {
998
+ default: q((T) => {
999
+ var d, h, V, $, U, K, ne, ue, H, ie, de, ce, pe, me, Q, fe, he, ye, ve, X, ge;
1000
+ return [
1001
+ b("div", $o, [
1002
+ b("div", Do, [
1003
+ k(p(J), {
1004
+ render: (V = (h = (d = T.warehouse) == null ? void 0 : d.column) == null ? void 0 : h.columnDef) == null ? void 0 : V.cell,
1005
+ props: (U = ($ = T.warehouse) == null ? void 0 : $.getContext) == null ? void 0 : U.call($)
1006
+ }, null, 8, ["render", "props"])
1007
+ ]),
1008
+ b("div", Wo, [
1009
+ k(p(J), {
1010
+ render: (ue = (ne = (K = T.contact) == null ? void 0 : K.column) == null ? void 0 : ne.columnDef) == null ? void 0 : ue.cell,
1011
+ props: (ie = (H = T.contact) == null ? void 0 : H.getContext) == null ? void 0 : ie.call(H)
1012
+ }, null, 8, ["render", "props"])
1013
+ ]),
1014
+ (de = E.original) != null && de.email ? (R(), z("div", So, [
1015
+ k(p(J), {
1016
+ render: (me = (pe = (ce = T.email) == null ? void 0 : ce.column) == null ? void 0 : pe.columnDef) == null ? void 0 : me.cell,
1017
+ props: (fe = (Q = T.email) == null ? void 0 : Q.getContext) == null ? void 0 : fe.call(Q)
1018
+ }, null, 8, ["render", "props"])
1019
+ ])) : xe("", !0),
1020
+ b("div", To, [
1021
+ k(p(J), {
1022
+ render: (ve = (ye = (he = T.address) == null ? void 0 : he.column) == null ? void 0 : ye.columnDef) == null ? void 0 : ve.cell,
1023
+ props: (ge = (X = T.address) == null ? void 0 : X.getContext) == null ? void 0 : ge.call(X)
1024
+ }, null, 8, ["render", "props"])
1025
+ ])
1026
+ ])
1027
+ ];
1028
+ }),
1029
+ _: 2
1030
+ }, 1032, ["row", "onRowClick"])
1031
+ ]),
1032
+ _: 1
1033
+ }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"]))
1034
+ ]),
1035
+ k(Mo, {
1036
+ show: u.value.show,
1037
+ "onUpdate:show": w[2] || (w[2] = (E) => u.value.show = E),
1038
+ warehouse: u.value.warehouse,
1039
+ mode: u.value.mode,
1040
+ onSubmitted: w[3] || (w[3] = (E) => M(!0))
1041
+ }, null, 8, ["show", "warehouse", "mode"])
1042
+ ]),
1043
+ _: 1
1044
+ }, 8, ["title", "actions"]);
1045
+ };
1046
+ }
1047
+ });
1048
+ export {
1049
+ qo as default
1050
+ };