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