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