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