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