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