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