@feedmepos/mf-inventory-portal 0.0.19-dev.15 → 0.0.19-dev.17

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 (48) hide show
  1. package/dist/{ApprovalView-CRHU3Bv0.js → ApprovalView-YVJ8rI2M.js} +5 -5
  2. package/dist/{BindingsDialog-ChIRg0d3.js → BindingsDialog-C7ZO5bXe.js} +9 -9
  3. package/dist/{BindingsPicker-BJAbeiDf.js → BindingsPicker-BDsVbM3L.js} +1 -1
  4. package/dist/{BindingsTable-5MxWD_qa.js → BindingsTable-BiVQ4mvK.js} +1 -1
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-vuSl8LVG.js +308 -0
  6. package/dist/{IngredientsView-qXrDtzSK.js → IngredientsView-CKDZsR2e.js} +5 -5
  7. package/dist/{IntegrationView-D6yFqod1.js → IntegrationView-DQZeJKul.js} +2 -2
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DGurlvYg.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-DDcFEUcz.js} +1 -1
  9. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-2Ady4pB4.js → PremiumBadge.vue_vue_type_script_setup_true_lang-6plo8rnV.js} +1 -1
  10. package/dist/{PurchaseOrderPrintPreview-BWwjMRqb.js → PurchaseOrderPrintPreview-Df-gYZFA.js} +1 -1
  11. package/dist/{ReceiveRequestView-C94SWDaj.js → ReceiveRequestView-CxW1ONAk.js} +8 -8
  12. package/dist/{RecipeView-CG9H_ZOo.js → RecipeView-B8eIaR2f.js} +4 -4
  13. package/dist/{StockView-BdXGfDNl.js → StockView-CqgqPyvI.js} +8 -8
  14. package/dist/SupplierView-CPHQT1Hn.js +817 -0
  15. package/dist/{TransferDetails.vue_vue_type_script_setup_true_lang-DktBkwCx.js → TransferDetails.vue_vue_type_script_setup_true_lang-CBmoU3pN.js} +4 -4
  16. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-DV6IxKMM.js +1435 -0
  17. package/dist/TransferTemplateView-BR2-tTiQ.js +1290 -0
  18. package/dist/{UnitView-Dx2vWJXi.js → UnitView-vUCf46QM.js} +5 -5
  19. package/dist/{WarehouseView-UkmUZnqH.js → WarehouseView-B3D5kkAU.js} +3 -3
  20. package/dist/api/purchase-order-template.d.ts +4 -0
  21. package/dist/api/supplier.d.ts +6 -4
  22. package/dist/{app-BLzTa0Ut.js → app-Ds9lsiAo.js} +5542 -5522
  23. package/dist/app.js +1 -1
  24. package/dist/{array-AvWd53LI.js → array-ClJzD_Lt.js} +3 -3
  25. package/dist/components/ChangeLocationComponent.vue.d.ts +14 -11
  26. package/dist/components/FmInventoryTableToolbar.vue.d.ts +0 -2
  27. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  28. package/dist/{decimal-DLYVb_I_.js → decimal-BZJuYjv-.js} +1 -1
  29. package/dist/format-unit-display-Dw4iQUDG.js +707 -0
  30. package/dist/{id-to-date-CKplrnj_.js → id-to-date-CLG4t5Zp.js} +1 -1
  31. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
  32. package/dist/{layout-B9sdKjL9.js → layout-b03Lvqhx.js} +1 -1
  33. package/dist/stores/feature.d.ts +1 -0
  34. package/dist/stores/location.d.ts +1 -0
  35. package/dist/stores/supplier.d.ts +9 -9
  36. package/dist/supplier-C9OQNEl0.js +69 -0
  37. package/dist/tsconfig.app.tsbuildinfo +1 -1
  38. package/dist/views/supplier/components/SupplierDialogProps.d.ts +0 -1
  39. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +583 -1
  40. package/dist/{xlsx-C3AV6UrJ.js → xlsx-B5RUBjKV.js} +1209 -1209
  41. package/dist/{xlsx.util-slrhXhsk.js → xlsx.util-H2UkpLte.js} +4 -4
  42. package/package.json +3 -3
  43. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js +0 -306
  44. package/dist/SupplierView-ClL2oc8K.js +0 -813
  45. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-BE95F9r1.js +0 -1437
  46. package/dist/TransferTemplateView-BXrNS8pg.js +0 -1279
  47. package/dist/format-unit-display-D_Z4TNZd.js +0 -668
  48. package/dist/supplier-BZ6HZcYB.js +0 -60
@@ -1,813 +0,0 @@
1
- import { defineComponent as O, mergeModels as _e, computed as S, useModel as he, resolveComponent as E, openBlock as U, createElementBlock as T, createElementVNode as u, createVNode as y, withCtx as F, toDisplayString as P, unref as t, Fragment as Se, renderList as xe, ref as N, createBlock as B, createCommentVNode as fe, isRef as pe, watch as we, normalizeStyle as ke, Teleport as Ce } from "vue";
2
- import { u as ye } from "./supplier-BZ6HZcYB.js";
3
- import { D as me, R as j, F as M } from "./row-action.enum-PMKMRrZR.js";
4
- import { c as Ie, _ as Me, F as G, u as $e } from "./layout-B9sdKjL9.js";
5
- import { c as Q, u as be, a2 as Ue, d as ce, g as Ae, y as De, C as J, h as Re, R as A, b as Fe, j as Pe } from "./app-BLzTa0Ut.js";
6
- import { useI18n as L, useCoreStore as Ne } from "@feedmepos/mf-common";
7
- import { useDialog as ge, useSnackbar as Ve, useProxiedModel as ve, useBreakpoints as Ee } from "@feedmepos/ui-library";
8
- import { _ as Te, a as Be } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0j4VOis.js";
9
- import { _ as Le } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js";
10
- function qe(D, w) {
11
- const { t: V } = L();
12
- function o(b, r) {
13
- if (b === j.Edit) {
14
- D(Q(r));
15
- return;
16
- }
17
- if (b === j.Delete) {
18
- w(Q(r));
19
- return;
20
- }
21
- }
22
- return { columnDefs: [
23
- {
24
- accessorKey: "name",
25
- header: () => V("inventory.supplier.table.supplier"),
26
- enableSorting: !0,
27
- size: 200
28
- },
29
- {
30
- accessorKey: "contactName",
31
- header: () => V("inventory.supplier.table.pic"),
32
- enableSorting: !1,
33
- size: 250
34
- },
35
- {
36
- accessorKey: "phoneNumber",
37
- header: () => V("inventory.supplier.table.contact"),
38
- enableSorting: !1,
39
- size: 200
40
- },
41
- {
42
- accessorKey: "email",
43
- header: () => V("inventory.supplier.table.email"),
44
- enableSorting: !1,
45
- size: "auto"
46
- },
47
- {
48
- id: "action",
49
- header: "",
50
- cell(b) {
51
- return Ie(
52
- [me[j.Edit], me[j.Delete]],
53
- (r) => {
54
- o(r, b.row.original);
55
- }
56
- );
57
- },
58
- size: 40,
59
- meta: {
60
- cellClass: "",
61
- headerClass: ""
62
- }
63
- }
64
- ] };
65
- }
66
- const ze = { class: "flex flex-col gap-12" }, Ye = { class: "flex flex-col" }, He = { class: "flex items-center gap-8 py-8" }, Ke = { class: "flex-1" }, je = { class: "fm-typo-en-title-sm-800" }, Ge = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oe = { class: "flex flex-col gap-4" }, Je = { class: "flex-1" }, Qe = { class: "flex flex-col" }, We = { class: "fm-typo-en-body-lg-400" }, Xe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ze = { class: "flex-1" }, el = { class: "flex" }, ll = { class: "text-fm-color-typo-secondary" }, tl = /* @__PURE__ */ O({
67
- __name: "SupplierSupplyItemField",
68
- props: /* @__PURE__ */ _e({
69
- modelValue: {}
70
- }, {
71
- modelValue: {},
72
- modelModifiers: {}
73
- }),
74
- emits: ["update:modelValue"],
75
- setup(D) {
76
- const w = Ne(), V = be(), o = S(() => V.skus), v = ge(), { t: b } = L(), r = he(D, "modelValue");
77
- function i() {
78
- var g;
79
- const d = V.skus.map((a) => ({
80
- label: a.name,
81
- sublabel: a.code,
82
- value: a._id
83
- })), _ = ((g = r.value) == null ? void 0 : g.map((a) => a.skuId)) ?? [], k = S(
84
- () => {
85
- var a;
86
- return ((a = Ae(w.currentCountry.value)) == null ? void 0 : a.currency) ?? "MYR";
87
- }
88
- );
89
- v.open({
90
- title: b("inventory.supplier.supplyItems.selectItem"),
91
- closeButton: !0,
92
- contentComponent: De,
93
- contentComponentProps: {
94
- modelValue: _,
95
- items: d
96
- },
97
- primaryActions: {
98
- text: "Confirm",
99
- close: !0
100
- },
101
- secondaryActions: {
102
- text: "Close",
103
- close: !0,
104
- variant: "tertiary"
105
- }
106
- }).onPrimary((a) => {
107
- const s = a.map((h) => V.skuById[h]).filter((h) => h);
108
- s.sort((h, n) => h.code.localeCompare(n.code));
109
- const m = s.map((h) => {
110
- var e;
111
- const n = (e = r.value) == null ? void 0 : e.find((c) => c.skuId === h._id);
112
- return n || {
113
- skuId: h._id,
114
- defaultCost: h.defaultCost ?? {
115
- costPerUnit: {
116
- currency: k.value,
117
- amount: 0,
118
- precision: 2
119
- }
120
- }
121
- };
122
- });
123
- r.value = m;
124
- });
125
- }
126
- function f(d) {
127
- switch (d) {
128
- case J.MY:
129
- return "MYR";
130
- case J.SG:
131
- return "SGD";
132
- case J.ID:
133
- return "IDR";
134
- default:
135
- return "MYR";
136
- }
137
- }
138
- function R(d) {
139
- const _ = [...(r == null ? void 0 : r.value) ?? []];
140
- _.splice(d, 1), r.value = _;
141
- }
142
- function x(d) {
143
- var g;
144
- const _ = d.skuId, k = (g = o.value.find((a) => a._id === _)) == null ? void 0 : g.unit;
145
- if (!k)
146
- throw new Error(`Cannot find ingredient: ${_}`);
147
- return k;
148
- }
149
- function C(d) {
150
- return {
151
- amount: d.defaultCost.costPerUnit,
152
- measurement: d.defaultCost.measurement
153
- };
154
- }
155
- function I(d, _) {
156
- const g = (r.value ?? []).map((a) => a.skuId !== d.skuId ? a : {
157
- ...a,
158
- defaultCost: {
159
- ...a.defaultCost,
160
- measurement: _.measurement,
161
- costPerUnit: {
162
- ...a.defaultCost.costPerUnit,
163
- ..._.amount
164
- }
165
- }
166
- });
167
- r.value = g;
168
- }
169
- return (d, _) => {
170
- const k = E("FmButton");
171
- return U(), T("div", ze, [
172
- u("div", Ye, [
173
- u("div", He, [
174
- u("div", Ke, [
175
- y(Le, { "z-index": 50 }, {
176
- default: F(() => [
177
- u("div", je, P(t(b)("inventory.supplier.supplyItems.title")), 1)
178
- ]),
179
- _: 1
180
- })
181
- ]),
182
- u("div", null, [
183
- y(k, {
184
- "prepend-icon": "link",
185
- label: t(b)("inventory.supplier.supplyItems.addItems"),
186
- variant: "plain",
187
- onClick: i
188
- }, null, 8, ["label"])
189
- ])
190
- ]),
191
- u("div", Ge, P(t(b)("inventory.supplier.supplyItems.overridePriceHint")), 1)
192
- ]),
193
- u("div", Oe, [
194
- (U(!0), T(Se, null, xe(r.value, (g, a) => {
195
- var s, m, h;
196
- return U(), T("div", {
197
- key: g.skuId,
198
- class: "flex"
199
- }, [
200
- u("div", Je, [
201
- u("div", Qe, [
202
- u("div", We, P((s = t(V).skuById[g.skuId]) == null ? void 0 : s.name), 1),
203
- u("div", Xe, P((m = t(V).skuById[g.skuId]) == null ? void 0 : m.code), 1)
204
- ])
205
- ]),
206
- u("div", Ze, [
207
- u("div", el, [
208
- y(Ue, {
209
- "model-value": C(g),
210
- unit: x(g),
211
- "onUpdate:modelValue": (n) => I(g, n),
212
- placement: r.value && a === ((h = r.value) == null ? void 0 : h.length) - 1 ? "top" : "bottom",
213
- separator: "/",
214
- "apply-default-rules": "",
215
- precision: 4,
216
- "format-minimum-precision": 2
217
- }, {
218
- prepend: F(() => {
219
- var n, l;
220
- return [
221
- u("div", ll, P(f(((n = t(w).currentCountry) == null ? void 0 : n.value) ?? t(ce)) === "MYR" ? "RM" : f(((l = t(w).currentCountry) == null ? void 0 : l.value) ?? t(ce))), 1)
222
- ];
223
- }),
224
- _: 2
225
- }, 1032, ["model-value", "unit", "onUpdate:modelValue", "placement"]),
226
- u("div", null, [
227
- y(k, {
228
- "prepend-icon": "close",
229
- variant: "tertiary",
230
- onClick: (n) => R(a)
231
- }, null, 8, ["onClick"])
232
- ])
233
- ])
234
- ])
235
- ]);
236
- }), 128))
237
- ])
238
- ]);
239
- };
240
- }
241
- }), sl = { class: "flex flex-col gap-40" }, ol = { class: "flex flex-col gap-16" }, nl = { class: "flex flex-col gap-8" }, al = { class: "fm-typo-en-title-sm-800" }, rl = { class: "grid grid-cols-2 gap-24" }, ul = { class: "flex flex-col gap-8" }, il = { class: "fm-typo-en-title-sm-800" }, dl = { class: "flex flex-col gap-16" }, pl = {
242
- key: 0,
243
- class: "flex flex-col gap-8"
244
- }, ml = /* @__PURE__ */ O({
245
- __name: "SupplierForm",
246
- props: {
247
- modelValue: {},
248
- disabled: { type: Boolean }
249
- },
250
- emits: ["update:modelValue", "validation-success"],
251
- setup(D, { expose: w, emit: V }) {
252
- const o = D, v = V, b = Fe(), r = be(), i = S(() => Re(r.skus, "_id")), { t: f } = L(), R = S({
253
- get() {
254
- var l;
255
- return ((l = o.modelValue) == null ? void 0 : l.name) ?? "";
256
- },
257
- set(l) {
258
- const e = o.modelValue ?? {};
259
- e.name = l, v("update:modelValue", e);
260
- }
261
- }), x = S({
262
- get() {
263
- var l;
264
- return ((l = o.modelValue) == null ? void 0 : l.registrationNumber) ?? "";
265
- },
266
- set(l) {
267
- const e = o.modelValue ?? {};
268
- e.registrationNumber = l, v("update:modelValue", e);
269
- }
270
- }), C = S({
271
- get() {
272
- var l, e;
273
- return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.line1) ?? "";
274
- },
275
- set(l) {
276
- const e = o.modelValue ?? {};
277
- e.address ?? (e.address = {}), e.address.line1 = l, v("update:modelValue", e);
278
- }
279
- }), I = S({
280
- get() {
281
- var l, e;
282
- return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.line2) ?? "";
283
- },
284
- set(l) {
285
- const e = o.modelValue ?? {};
286
- e.address ?? (e.address = {}), e.address.line2 = l, v("update:modelValue", e);
287
- }
288
- }), d = S({
289
- get() {
290
- var l, e;
291
- return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.city) ?? "";
292
- },
293
- set(l) {
294
- const e = o.modelValue ?? {};
295
- e.address ?? (e.address = {}), e.address.city = l, v("update:modelValue", e);
296
- }
297
- }), _ = S({
298
- get() {
299
- var l, e;
300
- return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.postcode) ?? "";
301
- },
302
- set(l) {
303
- const e = o.modelValue ?? {};
304
- e.address ?? (e.address = {}), e.address.postcode = l, v("update:modelValue", e);
305
- }
306
- }), k = S({
307
- get() {
308
- var l, e;
309
- return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.state) ?? "";
310
- },
311
- set(l) {
312
- const e = o.modelValue ?? {};
313
- e.address ?? (e.address = {}), e.address.state = l, v("update:modelValue", e);
314
- }
315
- }), g = S({
316
- get() {
317
- var l, e;
318
- return ((e = (l = o.modelValue) == null ? void 0 : l.address) == null ? void 0 : e.country) ?? "";
319
- },
320
- set(l) {
321
- const e = o.modelValue ?? {};
322
- e.address ?? (e.address = {}), e.address.country = l, v("update:modelValue", e);
323
- }
324
- }), a = S({
325
- get() {
326
- var l;
327
- return ((l = o.modelValue) == null ? void 0 : l.contactName) ?? "";
328
- },
329
- set(l) {
330
- const e = o.modelValue ?? {};
331
- e.contactName = l, v("update:modelValue", e);
332
- }
333
- }), s = S({
334
- get() {
335
- var l;
336
- return ((l = o.modelValue) == null ? void 0 : l.phoneNumber) ?? "";
337
- },
338
- set(l) {
339
- const e = o.modelValue ?? {};
340
- e.phoneNumber = l, v("update:modelValue", e);
341
- }
342
- }), m = S({
343
- get() {
344
- var l;
345
- return ((l = o.modelValue) == null ? void 0 : l.email) ?? "";
346
- },
347
- set(l) {
348
- const e = o.modelValue ?? {};
349
- e.email = l, v("update:modelValue", e);
350
- }
351
- }), h = S({
352
- get() {
353
- var e;
354
- return (((e = o.modelValue) == null ? void 0 : e.supplyItems) ?? []).filter((c) => i.value[c.skuId]);
355
- },
356
- set(l) {
357
- const e = o.modelValue ?? {};
358
- e.supplyItems = l, v("update:modelValue", e);
359
- }
360
- }), n = N();
361
- return w({
362
- validateInputs: () => {
363
- var l, e;
364
- (e = (l = n.value) == null ? void 0 : l.validateInputs) == null || e.call(l);
365
- },
366
- resetInputsValidation: () => {
367
- var l, e;
368
- (e = (l = n.value) == null ? void 0 : l.resetInputsValidation) == null || e.call(l);
369
- },
370
- resetInputs: () => {
371
- var l, e;
372
- (e = (l = n.value) == null ? void 0 : l.resetInputs) == null || e.call(l);
373
- }
374
- }), (l, e) => {
375
- const c = E("FmTextField"), $ = E("FmPhoneNumber"), q = E("FmForm");
376
- return U(), B(q, {
377
- ref_key: "formRef",
378
- ref: n,
379
- onValidationSuccess: e[12] || (e[12] = (p) => v("validation-success"))
380
- }, {
381
- default: F(() => [
382
- u("div", sl, [
383
- u("div", ol, [
384
- y(c, {
385
- disabled: l.disabled,
386
- rules: [t(A)()],
387
- "label-mark": "required",
388
- label: t(f)("inventory.supplier.companyName"),
389
- modelValue: R.value,
390
- "onUpdate:modelValue": e[0] || (e[0] = (p) => R.value = p)
391
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
392
- y(c, {
393
- disabled: l.disabled,
394
- rules: [t(A)()],
395
- "label-mark": "required",
396
- label: t(f)("inventory.supplier.registrationNo"),
397
- modelValue: x.value,
398
- "onUpdate:modelValue": e[1] || (e[1] = (p) => x.value = p)
399
- }, null, 8, ["disabled", "rules", "label", "modelValue"])
400
- ]),
401
- u("div", nl, [
402
- u("div", al, P(t(f)("inventory.supplier.address.title")), 1),
403
- u("div", rl, [
404
- y(c, {
405
- disabled: l.disabled,
406
- rules: [t(A)()],
407
- "label-mark": "required",
408
- label: t(f)("inventory.supplier.address.line1"),
409
- modelValue: C.value,
410
- "onUpdate:modelValue": e[2] || (e[2] = (p) => C.value = p)
411
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
412
- y(c, {
413
- disabled: l.disabled,
414
- "label-mark": "optional",
415
- label: t(f)("inventory.supplier.address.line2"),
416
- modelValue: I.value,
417
- "onUpdate:modelValue": e[3] || (e[3] = (p) => I.value = p)
418
- }, null, 8, ["disabled", "label", "modelValue"]),
419
- y(c, {
420
- disabled: l.disabled,
421
- rules: [t(A)()],
422
- "label-mark": "required",
423
- label: t(f)("inventory.supplier.address.city"),
424
- modelValue: d.value,
425
- "onUpdate:modelValue": e[4] || (e[4] = (p) => d.value = p)
426
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
427
- y(c, {
428
- disabled: l.disabled,
429
- rules: [t(A)()],
430
- "label-mark": "required",
431
- label: t(f)("inventory.supplier.address.postcode"),
432
- modelValue: _.value,
433
- "onUpdate:modelValue": e[5] || (e[5] = (p) => _.value = p)
434
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
435
- y(c, {
436
- disabled: l.disabled,
437
- rules: [t(A)()],
438
- "label-mark": "required",
439
- label: t(f)("inventory.supplier.address.state"),
440
- modelValue: k.value,
441
- "onUpdate:modelValue": e[6] || (e[6] = (p) => k.value = p)
442
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
443
- y(c, {
444
- disabled: l.disabled,
445
- rules: [t(A)()],
446
- "label-mark": "required",
447
- label: t(f)("inventory.supplier.address.country"),
448
- modelValue: g.value,
449
- "onUpdate:modelValue": e[7] || (e[7] = (p) => g.value = p)
450
- }, null, 8, ["disabled", "rules", "label", "modelValue"])
451
- ])
452
- ]),
453
- u("div", ul, [
454
- u("div", il, P(t(f)("inventory.supplier.contact.title")), 1),
455
- u("div", dl, [
456
- y(c, {
457
- disabled: l.disabled,
458
- rules: [t(A)()],
459
- "label-mark": "required",
460
- label: t(f)("inventory.supplier.contact.pic"),
461
- modelValue: a.value,
462
- "onUpdate:modelValue": e[8] || (e[8] = (p) => a.value = p)
463
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
464
- y($, {
465
- disabled: l.disabled,
466
- rules: [t(A)()],
467
- "label-mark": "required",
468
- label: t(f)("inventory.supplier.contact.phoneNumber"),
469
- modelValue: s.value,
470
- "onUpdate:modelValue": e[9] || (e[9] = (p) => s.value = p)
471
- }, null, 8, ["disabled", "rules", "label", "modelValue"]),
472
- y(c, {
473
- disabled: l.disabled,
474
- "label-mark": "optional",
475
- label: t(f)("inventory.supplier.contact.email"),
476
- modelValue: m.value,
477
- "onUpdate:modelValue": e[10] || (e[10] = (p) => m.value = p)
478
- }, null, 8, ["disabled", "label", "modelValue"])
479
- ])
480
- ]),
481
- t(b).enableTotalCost ? (U(), T("div", pl, [
482
- y(tl, {
483
- modelValue: h.value,
484
- "onUpdate:modelValue": e[11] || (e[11] = (p) => h.value = p)
485
- }, null, 8, ["modelValue"])
486
- ])) : fe("", !0)
487
- ])
488
- ]),
489
- _: 1
490
- }, 512);
491
- };
492
- }
493
- }), cl = { class: "flex gap-4" }, vl = /* @__PURE__ */ O({
494
- __name: "SupplierDialog",
495
- props: {
496
- mode: {},
497
- supplier: {},
498
- show: { type: Boolean },
499
- businessLevel: { type: Boolean }
500
- },
501
- emits: ["update:show", "submitted"],
502
- setup(D, { expose: w, emit: V }) {
503
- const o = D, v = V, b = N(!1), r = Ve(), { t: i } = L(), f = ye(), R = S(() => {
504
- switch (o.mode) {
505
- case M.READ:
506
- return "";
507
- case M.UPDATE:
508
- return i("inventory.supplier.update.title");
509
- case M.CREATE:
510
- return i("inventory.supplier.create.title");
511
- }
512
- return "";
513
- }), x = S(() => {
514
- switch (o.mode) {
515
- case M.READ:
516
- return "";
517
- case M.UPDATE:
518
- return i("common.save");
519
- case M.CREATE:
520
- return i("common.add");
521
- }
522
- return "";
523
- }), C = N();
524
- w({
525
- validateInputs: () => {
526
- var s, m;
527
- (m = (s = C.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
528
- },
529
- resetInputsValidation: () => {
530
- var s, m;
531
- (m = (s = C.value) == null ? void 0 : s.resetInputsValidation) == null || m.call(s);
532
- },
533
- resetInputs: () => {
534
- var s, m;
535
- (m = (s = C.value) == null ? void 0 : s.resetInputs) == null || m.call(s);
536
- }
537
- });
538
- const I = ve(o, "show"), d = ve(o, "supplier");
539
- function _() {
540
- var s, m;
541
- (m = (s = C.value) == null ? void 0 : s.validateInputs) == null || m.call(s);
542
- }
543
- function k() {
544
- switch (o.mode) {
545
- case M.READ:
546
- return;
547
- case M.UPDATE:
548
- return a();
549
- case M.CREATE:
550
- return g();
551
- }
552
- }
553
- async function g() {
554
- b.value = !0;
555
- try {
556
- await Promise.all([
557
- f.createSupplier(d.value, o.businessLevel),
558
- new Promise((s) => setTimeout(s, 1e3))
559
- ]), r.open({
560
- title: i("common.success"),
561
- message: i("inventory.supplier.create.success", { name: d.value.name }),
562
- type: "success"
563
- }), v("update:show", !1), v("submitted");
564
- } catch (s) {
565
- r.open({
566
- title: "Something went wrong",
567
- message: `Cannot create ${d.value.name} supplier. Please try again`,
568
- type: "error"
569
- }), console.error("cannot create supplier", s);
570
- } finally {
571
- b.value = !1;
572
- }
573
- }
574
- async function a() {
575
- if (d.value === null) {
576
- r.open({
577
- title: i("inventory.supplier.update.error.title"),
578
- message: i("inventory.supplier.update.error.emptySupplier"),
579
- type: "error"
580
- });
581
- return;
582
- }
583
- b.value = !0;
584
- try {
585
- await Promise.all([
586
- f.updateSupplier(d.value, o.businessLevel),
587
- new Promise((s) => setTimeout(s, 1e3))
588
- ]), r.open({
589
- title: i("common.success"),
590
- message: i("inventory.supplier.update.success", { name: d.value.name }),
591
- type: "success"
592
- }), v("update:show", !1), v("submitted");
593
- } catch (s) {
594
- r.open({
595
- title: i("inventory.supplier.update.error.title"),
596
- message: i("inventory.supplier.update.error.message"),
597
- type: "error"
598
- }), console.error("cannot update supplier", s);
599
- } finally {
600
- b.value = !1;
601
- }
602
- }
603
- return (s, m) => {
604
- const h = E("FmButton"), n = E("FmSideSheet");
605
- return U(), B(n, {
606
- header: R.value,
607
- modelValue: t(I),
608
- "onUpdate:modelValue": m[1] || (m[1] = (l) => pe(I) ? I.value = l : null),
609
- "dismiss-away": !b.value,
610
- "close-button": "",
611
- "max-width": 500
612
- }, {
613
- default: F(() => {
614
- var l;
615
- return [
616
- (U(), B(ml, {
617
- class: "w-full",
618
- ref_key: "formRef",
619
- ref: C,
620
- modelValue: t(d),
621
- "onUpdate:modelValue": m[0] || (m[0] = (e) => pe(d) ? d.value = e : null),
622
- onValidationSuccess: k,
623
- key: ((l = s.supplier) == null ? void 0 : l._id) ?? "",
624
- disabled: b.value
625
- }, null, 8, ["modelValue", "disabled"]))
626
- ];
627
- }),
628
- "side-sheet-footer": F(() => [
629
- u("div", cl, [
630
- y(h, {
631
- loading: b.value,
632
- label: x.value,
633
- onClick: _
634
- }, null, 8, ["loading", "label"])
635
- ])
636
- ]),
637
- _: 1
638
- }, 8, ["header", "modelValue", "dismiss-away"]);
639
- };
640
- }
641
- }), fl = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, yl = { class: "flex flex-col py-8" }, bl = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, gl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Vl = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _l = {
642
- key: 0,
643
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
644
- }, hl = "You are managing business-level supplier list. These suppliers will be made visible to all locations.", Al = /* @__PURE__ */ O({
645
- __name: "SupplierView",
646
- setup(D) {
647
- const w = N(!1), V = ye(), o = Pe(), v = N(!1), b = ge(), r = Ve(), { t: i } = L();
648
- o.watchLocation(f), we(w, f);
649
- async function f() {
650
- if (o._currentLocation) {
651
- v.value = !0;
652
- try {
653
- await Promise.all([
654
- V.readSuppliers(),
655
- new Promise((l) => setTimeout(l, 1e3))
656
- ]);
657
- } catch {
658
- r.open({
659
- title: "Cannot fetch supplier list",
660
- type: "error"
661
- });
662
- } finally {
663
- v.value = !1;
664
- }
665
- }
666
- }
667
- const R = S(
668
- () => w.value ? V.businessSuppliers : V.locationSuppliers
669
- ), x = N({});
670
- function C() {
671
- x.value.mode = M.CREATE, x.value.supplier = {}, x.value.show = !0;
672
- }
673
- function I(n) {
674
- x.value.mode = M.UPDATE, x.value.supplier = Q(n), x.value.show = !0;
675
- }
676
- async function d(n) {
677
- b.open({
678
- title: i("inventory.supplier.delete.confirm"),
679
- message: i("inventory.supplier.delete.confirmMessage", { name: n.name }),
680
- primaryActions: {
681
- text: i("common.delete"),
682
- close: !0,
683
- variant: "destructive"
684
- },
685
- secondaryActions: {
686
- text: i("common.cancel"),
687
- close: !0
688
- }
689
- }).onPrimary(() => _(n));
690
- }
691
- async function _(n) {
692
- b.open({
693
- title: i("inventory.supplier.deletingSupplier"),
694
- closeButton: !1
695
- });
696
- try {
697
- await V.deleteSupplier(n, w.value), r.open({
698
- title: i("inventory.supplier.delete.success"),
699
- message: i("inventory.supplier.delete.successMessage", { name: n == null ? void 0 : n.name }),
700
- type: "success"
701
- }), f();
702
- } catch (l) {
703
- r.open({
704
- title: i("inventory.supplier.delete.error"),
705
- message: i("inventory.supplier.delete.errorMessage", { name: n == null ? void 0 : n.name }),
706
- type: "error"
707
- }), console.error("failed to delete supplier", l);
708
- } finally {
709
- b.close();
710
- }
711
- }
712
- const { columnDefs: k } = qe(I, d);
713
- function g(n) {
714
- n === "create" && C();
715
- }
716
- const a = N(""), { breakpoints: s } = Ee(), m = S(() => s.value.xs || s.value.sm ? 10 : 20), h = $e();
717
- return (n, l) => {
718
- const e = E("FmTable");
719
- return U(), B(Te, {
720
- title: t(i)("inventory.supplier.title"),
721
- actions: [
722
- {
723
- label: t(i)("inventory.supplier.create.title"),
724
- value: "create",
725
- isPrimary: !0,
726
- prependIcon: "add"
727
- }
728
- ],
729
- "onClick:action": g
730
- }, {
731
- default: F(() => [
732
- u("div", fl, [
733
- y(Be, {
734
- searchable: "",
735
- "change-location": "",
736
- search: a.value,
737
- "onUpdate:search": l[0] || (l[0] = (c) => a.value = c),
738
- "show-business": "",
739
- "using-business": w.value,
740
- "onUpdate:usingBusiness": l[1] || (l[1] = (c) => w.value = c),
741
- "using-business-helper-text": hl,
742
- actions: [{ icon: "refresh", onClick: () => f() }]
743
- }, null, 8, ["search", "using-business", "actions"]),
744
- y(e, {
745
- style: ke(t(h).tableHeight),
746
- "column-defs": t(k),
747
- "row-data": R.value,
748
- "search-value": a.value,
749
- loading: !t(o)._currentLocation || v.value,
750
- onRowClick: l[2] || (l[2] = (c) => I(c.original)),
751
- "page-size": m.value
752
- }, {
753
- "list-row": F((c) => [
754
- y(Me, {
755
- row: c,
756
- onRowClick: I
757
- }, {
758
- default: F(($) => {
759
- var q, p, W, z, X, Z, ee, le, Y, te, se, oe, ne, H, ae, re, ue, ie, K, de;
760
- return [
761
- u("div", yl, [
762
- u("div", bl, [
763
- y(t(G), {
764
- render: (W = (p = (q = $.name) == null ? void 0 : q.column) == null ? void 0 : p.columnDef) == null ? void 0 : W.cell,
765
- props: (X = (z = $.name) == null ? void 0 : z.getContext) == null ? void 0 : X.call(z)
766
- }, null, 8, ["render", "props"])
767
- ]),
768
- u("div", gl, [
769
- y(t(G), {
770
- render: (le = (ee = (Z = $.contactName) == null ? void 0 : Z.column) == null ? void 0 : ee.columnDef) == null ? void 0 : le.cell,
771
- props: (te = (Y = $.contactName) == null ? void 0 : Y.getContext) == null ? void 0 : te.call(Y)
772
- }, null, 8, ["render", "props"])
773
- ]),
774
- u("div", Vl, [
775
- y(t(G), {
776
- render: (ne = (oe = (se = $.phoneNumber) == null ? void 0 : se.column) == null ? void 0 : oe.columnDef) == null ? void 0 : ne.cell,
777
- props: (ae = (H = $.phoneNumber) == null ? void 0 : H.getContext) == null ? void 0 : ae.call(H)
778
- }, null, 8, ["render", "props"])
779
- ]),
780
- c.original.email ? (U(), T("div", _l, [
781
- y(t(G), {
782
- render: (ie = (ue = (re = $.email) == null ? void 0 : re.column) == null ? void 0 : ue.columnDef) == null ? void 0 : ie.cell,
783
- props: (de = (K = $.email) == null ? void 0 : K.getContext) == null ? void 0 : de.call(K)
784
- }, null, 8, ["render", "props"])
785
- ])) : fe("", !0)
786
- ])
787
- ];
788
- }),
789
- _: 2
790
- }, 1032, ["row"])
791
- ]),
792
- _: 1
793
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
794
- ]),
795
- (U(), B(Ce, { to: "body" }, [
796
- y(vl, {
797
- show: x.value.show,
798
- "onUpdate:show": l[3] || (l[3] = (c) => x.value.show = c),
799
- supplier: x.value.supplier,
800
- mode: x.value.mode,
801
- businessLevel: w.value,
802
- onSubmitted: l[4] || (l[4] = (c) => f())
803
- }, null, 8, ["show", "supplier", "mode", "businessLevel"])
804
- ]))
805
- ]),
806
- _: 1
807
- }, 8, ["title", "actions"]);
808
- };
809
- }
810
- });
811
- export {
812
- Al as default
813
- };