@feedmepos/mf-inventory-portal 0.0.19-dev.1 → 0.0.19-dev.11

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 (117) hide show
  1. package/dist/ApprovalView-BtgtZgDY.js +121 -0
  2. package/dist/{BindingsDialog-DpC48bqK.js → BindingsDialog-DDqu7p2z.js} +9 -10
  3. package/dist/{BindingsPicker-BU52g6zk.js → BindingsPicker-BDhn5Do7.js} +7 -8
  4. package/dist/{BindingsTable-aIuFdScv.js → BindingsTable-C5R7orsB.js} +4 -6
  5. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-D0sbKAX9.js +272 -0
  6. package/dist/IngredientsView-Ac52Wd12.js +1751 -0
  7. package/dist/IntegrationView-6mJtJK-d.js +1172 -0
  8. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BuyM580N.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-C2BFaTg-.js} +1 -1
  9. package/dist/PremiumBadge.vue_vue_type_script_setup_true_lang-CL0RBLOF.js +88 -0
  10. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-CRZiQHjx.js +29 -0
  11. package/dist/{PurchaseOrderPrintPreview-EeKhENYH.js → PurchaseOrderPrintPreview-UzrsJ0AN.js} +12 -12
  12. package/dist/ReceiveRequestView-DW9u9TJZ.js +208 -0
  13. package/dist/RecipeView-W15pCZKU.js +573 -0
  14. package/dist/StockForecast.vue_vue_type_style_index_0_lang-KLXSWvo5.js +59 -0
  15. package/dist/StockView-BqEe-OIX.js +1877 -0
  16. package/dist/SupplierView-CGr2N-e7.js +801 -0
  17. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-DupNA58V.js +739 -0
  18. package/dist/TransferDialog.vue_vue_type_script_setup_true_lang-COVncBoC.js +1676 -0
  19. package/dist/TransferTemplateView-HgaSR8L8.js +1101 -0
  20. package/dist/UnitView-C07Yrynl.js +638 -0
  21. package/dist/WarehouseView-DL-8j9vX.js +1050 -0
  22. package/dist/api/bill.d.ts +2 -2
  23. package/dist/api/purchase-order-template.d.ts +7 -0
  24. package/dist/app-B1MZZxUg.js +67134 -0
  25. package/dist/app.d.ts +1185 -0
  26. package/dist/app.js +7 -3
  27. package/dist/components/FmDroppableField.vue.d.ts +1 -1
  28. package/dist/components/FmMultiselectDialogProps.d.ts +7 -0
  29. package/dist/components/FmUnitInputProps.d.ts +2 -0
  30. package/dist/components/FmUnitInputRules.d.ts +1 -0
  31. package/dist/components/row-action.enum.d.ts +5 -1
  32. package/dist/composable/defineDeepModel.d.ts +2 -0
  33. package/dist/{decimal-BAZuuTcd.js → decimal-BXf_WdLk.js} +1 -1
  34. package/dist/helper/country.d.ts +2 -0
  35. package/dist/id-to-date-Dlovyec6.js +30 -0
  36. package/dist/layout-BJjS48J5.js +151 -0
  37. package/dist/purchase-order-transaction-type-CMIu0jrP.js +299 -0
  38. package/dist/router/name.d.ts +2 -1
  39. package/dist/row-action.enum-PMKMRrZR.js +50 -0
  40. package/dist/stores/supplier.d.ts +90 -7
  41. package/dist/style.css +1 -1
  42. package/dist/supplier-IDQmZ4VM.js +54 -0
  43. package/dist/tsconfig.app.tsbuildinfo +1 -1
  44. package/dist/views/dev/components/FmMultiselectDialogGrouped.vue.d.ts +2 -0
  45. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +2 -0
  46. package/dist/views/ingredients/components/inventory-binding/InventoryBindingSummary.vue.d.ts +26 -0
  47. package/dist/views/ingredients/composables/use-ingredient-form.d.ts +14 -2
  48. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +1 -2
  49. package/dist/views/ingredients/helper/calculate-default-cost.d.ts +9 -0
  50. package/dist/views/receive-request/components/transfer-dialog/TransferDialogProps.d.ts +1 -0
  51. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  52. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +4 -0
  53. package/dist/views/receive-request/components/transfer-form/TransferForm2.vue.d.ts +22 -0
  54. package/dist/views/receive-request/components/transfer-form/TransferFormProps.d.ts +2 -1
  55. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +187 -0
  56. package/dist/views/receive-request/components/transfer-form/components/TransferItem.vue.d.ts +23 -0
  57. package/dist/views/receive-request/components/transfer-form/components/TransferItemTable.vue.d.ts +21 -0
  58. package/dist/views/receive-request/components/transfer-form/composables/use-backdate-po.d.ts +9 -0
  59. package/dist/views/receive-request/components/transfer-form/composables/use-compare-price.d.ts +6 -0
  60. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +112 -0
  61. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +3 -1
  62. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +18 -12
  63. package/dist/views/receive-request/helper/get-transfer-type.d.ts +2 -0
  64. package/dist/views/recipe/composables/use-recipe-form.d.ts +14 -2
  65. package/dist/views/recipe/composables/use-recipe-table.d.ts +1 -2
  66. package/dist/views/stock/components/StockRecordCard.vue.d.ts +1 -1
  67. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +2 -2
  68. package/dist/views/stock/composables/use-stock-action.d.ts +26 -0
  69. package/dist/views/stock/composables/use-stock-table.d.ts +1 -8
  70. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  71. package/dist/views/stock/helper/stock-row-action.d.ts +2 -2
  72. package/dist/views/transfer-template/TransferTemplateView.vue.d.ts +2 -0
  73. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetails.vue.d.ts +20 -0
  74. package/dist/views/transfer-template/components/transfer-template-details/TransferTemplateDetailsProps.d.ts +9 -0
  75. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialog.vue.d.ts +22 -0
  76. package/dist/views/transfer-template/components/transfer-template-dialog/TransferTemplateDialogProps.d.ts +10 -0
  77. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateForm.vue.d.ts +16 -0
  78. package/dist/views/transfer-template/components/transfer-template-form/TransferTemplateFormProps.d.ts +7 -0
  79. package/dist/views/transfer-template/components/transfer-template-form/components/TransferTemplateItem.vue.d.ts +18 -0
  80. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-locations.d.ts +116 -0
  81. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +113 -0
  82. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +914 -0
  83. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +290 -0
  84. package/dist/views/unit/composables/use-unit-form.d.ts +14 -2
  85. package/dist/views/unit/composables/use-unit-table.d.ts +1 -2
  86. package/dist/{xlsx-vUzm_udV.js → xlsx-CfdXcS72.js} +1 -1
  87. package/dist/xlsx.util-C5Wx4IUs.js +109 -0
  88. package/package.json +6 -5
  89. package/dist/ApprovalView-BTZwnKLf.js +0 -118
  90. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js +0 -268
  91. package/dist/FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js +0 -143
  92. package/dist/FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js +0 -236
  93. package/dist/IngredientsView-DMyEGdik.js +0 -1767
  94. package/dist/IntegrationView-Dn_qL_vC.js +0 -1166
  95. package/dist/InventoryBindingForm.vue_vue_type_script_setup_true_lang-DGTLUrb9.js +0 -276
  96. package/dist/PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js +0 -35
  97. package/dist/ReceiveRequestView-BOdgbFFM.js +0 -1394
  98. package/dist/RecipeView-B1aNLDIK.js +0 -573
  99. package/dist/StockForecast.vue_vue_type_style_index_0_lang-B5EK101t.js +0 -58
  100. package/dist/StockView-C_Ur_jTg.js +0 -1862
  101. package/dist/SupplierView-CXfOoHTr.js +0 -796
  102. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-kjV5Eazv.js +0 -1028
  103. package/dist/UnitView-DHXfAsnq.js +0 -635
  104. package/dist/WarehouseView-DMwbxs1q.js +0 -1043
  105. package/dist/app-BkcO8oNJ.js +0 -66113
  106. package/dist/date2-Cvp5iJkI.js +0 -95
  107. package/dist/dayjs.min-D1_pOsO7.js +0 -282
  108. package/dist/fuzzy-0roCBvgC.js +0 -41
  109. package/dist/index-B_aEOJsR.js +0 -21515
  110. package/dist/layout-BnTfCS_X.js +0 -151
  111. package/dist/number-DLj3W3RW.js +0 -97
  112. package/dist/row-action.enum-BwQbURNh.js +0 -28
  113. package/dist/rules-CCmXA0Yi.js +0 -85
  114. package/dist/stock-estimate-CL4HShG8.js +0 -122
  115. package/dist/supplier-CjAH8O1y.js +0 -65
  116. package/dist/use-inventory-binding-dialog-GkJOzE6V.js +0 -93
  117. package/dist/xlsx.util-B_bqymTM.js +0 -107
@@ -1,796 +0,0 @@
1
- import { defineComponent as G, mergeModels as be, computed as g, useModel as ge, resolveComponent as P, openBlock as I, createElementBlock as F, createElementVNode as i, createVNode as f, withCtx as U, Fragment as Ve, renderList as _e, toDisplayString as H, unref as p, ref as R, createBlock as E, createCommentVNode as ce, isRef as ue, normalizeStyle as Se, Teleport as he } from "vue";
2
- import { u as pe } from "./supplier-CjAH8O1y.js";
3
- import { D as de, R as Y, F as x } from "./row-action.enum-BwQbURNh.js";
4
- import { c as Ce, _ as we, F as K, u as xe } from "./layout-BnTfCS_X.js";
5
- import { c as j, u as fe, d as ie, g as ke, C as O, e as Ie, a as $e, f as Ae } from "./app-BkcO8oNJ.js";
6
- import { useDialog as ve, useSnackbar as ye, useProxiedModel as me, useBreakpoints as Me } from "@feedmepos/ui-library";
7
- import { _ as De, a as Ue } from "./FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-DjgmtvXU.js";
8
- import { R as A } from "./rules-CCmXA0Yi.js";
9
- import { _ as Pe } from "./FmMultiselectDialog.vue_vue_type_script_setup_true_lang-n09XXJZK.js";
10
- import { useCoreStore as Re } from "@feedmepos/mf-common";
11
- import { _ as Fe } from "./PreviewBadge.vue_vue_type_script_setup_true_lang-BvadeWUz.js";
12
- import { _ as Ee } from "./FmUnitInput.vue_vue_type_script_setup_true_lang-B-19iYaK.js";
13
- function Ne(M, C) {
14
- function _(n, a) {
15
- if (n === Y.Edit) {
16
- M(j(a));
17
- return;
18
- }
19
- if (n === Y.Delete) {
20
- C(j(a));
21
- return;
22
- }
23
- }
24
- return { columnDefs: [
25
- {
26
- accessorKey: "name",
27
- header: "Supplier",
28
- enableSorting: !0,
29
- size: 200
30
- },
31
- {
32
- accessorKey: "contactName",
33
- header: "PIC",
34
- enableSorting: !1,
35
- size: 250
36
- },
37
- {
38
- accessorKey: "phoneNumber",
39
- header: "Contact",
40
- enableSorting: !1,
41
- size: 200
42
- },
43
- {
44
- accessorKey: "email",
45
- header: "Email",
46
- enableSorting: !1,
47
- size: "auto"
48
- },
49
- {
50
- id: "action",
51
- header: "",
52
- cell(n) {
53
- return Ce(
54
- [de[Y.Edit], de[Y.Delete]],
55
- (a) => {
56
- _(a, n.row.original);
57
- }
58
- );
59
- },
60
- size: 40,
61
- meta: {
62
- cellClass: "",
63
- headerClass: ""
64
- }
65
- }
66
- ] };
67
- }
68
- const Te = { class: "flex flex-col gap-12" }, Be = { class: "flex flex-col" }, qe = { class: "flex items-center gap-8 py-8" }, ze = { class: "flex-1" }, Le = /* @__PURE__ */ i("div", { class: "fm-typo-en-title-sm-800" }, "Supply items", -1), Ye = /* @__PURE__ */ i("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Overrides price per unit in ingredient. ", -1), Ke = { class: "flex flex-col gap-4" }, Ge = { class: "flex-1" }, He = { class: "flex flex-col" }, Oe = { class: "fm-typo-en-body-lg-400" }, je = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Je = { class: "flex-1" }, Qe = { class: "flex" }, We = { class: "text-fm-color-typo-secondary" }, Xe = /* @__PURE__ */ G({
69
- __name: "SupplierSupplyItemField",
70
- props: /* @__PURE__ */ be({
71
- modelValue: {}
72
- }, {
73
- modelValue: {},
74
- modelModifiers: {}
75
- }),
76
- emits: ["update:modelValue"],
77
- setup(M) {
78
- const C = Re(), _ = fe(), o = g(() => _.skus), n = ve(), a = ge(M, "modelValue");
79
- function w() {
80
- var v;
81
- const r = _.skus.map((u) => ({
82
- label: u.name,
83
- sublabel: u.code,
84
- value: u._id
85
- })), b = ((v = a.value) == null ? void 0 : v.map((u) => u.skuId)) ?? [], S = g(
86
- () => {
87
- var u;
88
- return ((u = ke(C.currentCountry.value)) == null ? void 0 : u.currency) ?? "MYR";
89
- }
90
- );
91
- n.open({
92
- title: "Select item",
93
- closeButton: !0,
94
- contentComponent: Pe,
95
- contentComponentProps: {
96
- modelValue: b,
97
- items: r
98
- },
99
- primaryActions: {
100
- text: "Confirm",
101
- close: !0
102
- },
103
- secondaryActions: {
104
- text: "Close",
105
- close: !0,
106
- variant: "tertiary"
107
- }
108
- }).onPrimary((u) => {
109
- const l = u.map((s) => _.skuById[s]).filter((s) => s);
110
- l.sort((s, d) => s.code.localeCompare(d.code));
111
- const c = l.map((s) => {
112
- var e;
113
- const d = (e = a.value) == null ? void 0 : e.find((y) => y.skuId === s._id);
114
- return d || {
115
- skuId: s._id,
116
- defaultCost: s.defaultCost ?? {
117
- costPerUnit: {
118
- currency: S.value,
119
- amount: 0,
120
- precision: 2
121
- }
122
- }
123
- };
124
- });
125
- a.value = c;
126
- });
127
- }
128
- function $(r) {
129
- switch (r) {
130
- case O.MY:
131
- return "MYR";
132
- case O.SG:
133
- return "SGD";
134
- case O.ID:
135
- return "IDR";
136
- default:
137
- return "MYR";
138
- }
139
- }
140
- function V(r) {
141
- const b = [...(a == null ? void 0 : a.value) ?? []];
142
- b.splice(r, 1), a.value = b;
143
- }
144
- function D(r) {
145
- var v;
146
- const b = r.skuId, S = (v = o.value.find((u) => u._id === b)) == null ? void 0 : v.unit;
147
- if (!S)
148
- throw new Error(`Cannot find ingredient: ${b}`);
149
- return S;
150
- }
151
- function h(r) {
152
- return {
153
- amount: r.defaultCost.costPerUnit,
154
- measurement: r.defaultCost.measurement
155
- };
156
- }
157
- function k(r, b) {
158
- const v = (a.value ?? []).map((u) => u.skuId !== r.skuId ? u : {
159
- ...u,
160
- defaultCost: {
161
- ...u.defaultCost,
162
- measurement: b.measurement,
163
- costPerUnit: {
164
- ...u.defaultCost.costPerUnit,
165
- ...b.amount
166
- }
167
- }
168
- });
169
- a.value = v;
170
- }
171
- return (r, b) => {
172
- const S = P("FmButton");
173
- return I(), F("div", Te, [
174
- i("div", Be, [
175
- i("div", qe, [
176
- i("div", ze, [
177
- f(Fe, { "z-index": 50 }, {
178
- default: U(() => [
179
- Le
180
- ]),
181
- _: 1
182
- })
183
- ]),
184
- i("div", null, [
185
- f(S, {
186
- "prepend-icon": "link",
187
- label: "Add items",
188
- variant: "plain",
189
- onClick: w
190
- })
191
- ])
192
- ]),
193
- Ye
194
- ]),
195
- i("div", Ke, [
196
- (I(!0), F(Ve, null, _e(a.value, (v, u) => {
197
- var l, c, s;
198
- return I(), F("div", {
199
- key: v.skuId,
200
- class: "flex"
201
- }, [
202
- i("div", Ge, [
203
- i("div", He, [
204
- i("div", Oe, H((l = p(_).skuById[v.skuId]) == null ? void 0 : l.name), 1),
205
- i("div", je, H((c = p(_).skuById[v.skuId]) == null ? void 0 : c.code), 1)
206
- ])
207
- ]),
208
- i("div", Je, [
209
- i("div", Qe, [
210
- f(Ee, {
211
- "model-value": h(v),
212
- unit: D(v),
213
- "onUpdate:modelValue": (d) => k(v, d),
214
- placement: a.value && u === ((s = a.value) == null ? void 0 : s.length) - 1 ? "top" : "bottom",
215
- separator: "/",
216
- "apply-default-rules": "",
217
- precision: 4,
218
- "format-minimum-precision": 2
219
- }, {
220
- prepend: U(() => {
221
- var d, t;
222
- return [
223
- i("div", We, H($(((d = p(C).currentCountry) == null ? void 0 : d.value) ?? p(ie)) === "MYR" ? "RM" : $(((t = p(C).currentCountry) == null ? void 0 : t.value) ?? p(ie))), 1)
224
- ];
225
- }),
226
- _: 2
227
- }, 1032, ["model-value", "unit", "onUpdate:modelValue", "placement"]),
228
- i("div", null, [
229
- f(S, {
230
- "prepend-icon": "close",
231
- variant: "tertiary",
232
- onClick: (d) => V(u)
233
- }, null, 8, ["onClick"])
234
- ])
235
- ])
236
- ])
237
- ]);
238
- }), 128))
239
- ])
240
- ]);
241
- };
242
- }
243
- }), Ze = { class: "flex flex-col gap-40" }, et = { class: "flex flex-col gap-16" }, tt = { class: "flex flex-col gap-8" }, lt = /* @__PURE__ */ i("div", { class: "fm-typo-en-title-sm-800" }, "Address", -1), ot = { class: "grid grid-cols-2 gap-24" }, st = { class: "flex flex-col gap-8" }, at = /* @__PURE__ */ i("div", { class: "fm-typo-en-title-sm-800" }, "Contact", -1), nt = { class: "flex flex-col gap-16" }, rt = {
244
- key: 0,
245
- class: "flex flex-col gap-8"
246
- }, ut = /* @__PURE__ */ G({
247
- __name: "SupplierForm",
248
- props: {
249
- modelValue: {},
250
- disabled: { type: Boolean }
251
- },
252
- emits: ["update:modelValue", "validation-success"],
253
- setup(M, { expose: C, emit: _ }) {
254
- const o = M, n = _, a = $e(), w = fe(), $ = g(() => Ie(w.skus, "_id")), V = g({
255
- get() {
256
- var t;
257
- return ((t = o.modelValue) == null ? void 0 : t.name) ?? "";
258
- },
259
- set(t) {
260
- const e = o.modelValue ?? {};
261
- e.name = t, n("update:modelValue", e);
262
- }
263
- }), D = g({
264
- get() {
265
- var t;
266
- return ((t = o.modelValue) == null ? void 0 : t.registrationNumber) ?? "";
267
- },
268
- set(t) {
269
- const e = o.modelValue ?? {};
270
- e.registrationNumber = t, n("update:modelValue", e);
271
- }
272
- }), h = g({
273
- get() {
274
- var t, e;
275
- return ((e = (t = o.modelValue) == null ? void 0 : t.address) == null ? void 0 : e.line1) ?? "";
276
- },
277
- set(t) {
278
- const e = o.modelValue ?? {};
279
- e.address ?? (e.address = {}), e.address.line1 = t, n("update:modelValue", e);
280
- }
281
- }), k = g({
282
- get() {
283
- var t, e;
284
- return ((e = (t = o.modelValue) == null ? void 0 : t.address) == null ? void 0 : e.line2) ?? "";
285
- },
286
- set(t) {
287
- const e = o.modelValue ?? {};
288
- e.address ?? (e.address = {}), e.address.line2 = t, n("update:modelValue", e);
289
- }
290
- }), r = g({
291
- get() {
292
- var t, e;
293
- return ((e = (t = o.modelValue) == null ? void 0 : t.address) == null ? void 0 : e.city) ?? "";
294
- },
295
- set(t) {
296
- const e = o.modelValue ?? {};
297
- e.address ?? (e.address = {}), e.address.city = t, n("update:modelValue", e);
298
- }
299
- }), b = g({
300
- get() {
301
- var t, e;
302
- return ((e = (t = o.modelValue) == null ? void 0 : t.address) == null ? void 0 : e.postcode) ?? "";
303
- },
304
- set(t) {
305
- const e = o.modelValue ?? {};
306
- e.address ?? (e.address = {}), e.address.postcode = t, n("update:modelValue", e);
307
- }
308
- }), S = g({
309
- get() {
310
- var t, e;
311
- return ((e = (t = o.modelValue) == null ? void 0 : t.address) == null ? void 0 : e.state) ?? "";
312
- },
313
- set(t) {
314
- const e = o.modelValue ?? {};
315
- e.address ?? (e.address = {}), e.address.state = t, n("update:modelValue", e);
316
- }
317
- }), v = g({
318
- get() {
319
- var t, e;
320
- return ((e = (t = o.modelValue) == null ? void 0 : t.address) == null ? void 0 : e.country) ?? "";
321
- },
322
- set(t) {
323
- const e = o.modelValue ?? {};
324
- e.address ?? (e.address = {}), e.address.country = t, n("update:modelValue", e);
325
- }
326
- }), u = g({
327
- get() {
328
- var t;
329
- return ((t = o.modelValue) == null ? void 0 : t.contactName) ?? "";
330
- },
331
- set(t) {
332
- const e = o.modelValue ?? {};
333
- e.contactName = t, n("update:modelValue", e);
334
- }
335
- }), l = g({
336
- get() {
337
- var t;
338
- return ((t = o.modelValue) == null ? void 0 : t.phoneNumber) ?? "";
339
- },
340
- set(t) {
341
- const e = o.modelValue ?? {};
342
- e.phoneNumber = t, n("update:modelValue", e);
343
- }
344
- }), c = g({
345
- get() {
346
- var t;
347
- return ((t = o.modelValue) == null ? void 0 : t.email) ?? "";
348
- },
349
- set(t) {
350
- const e = o.modelValue ?? {};
351
- e.email = t, n("update:modelValue", e);
352
- }
353
- }), s = g({
354
- get() {
355
- var e;
356
- return (((e = o.modelValue) == null ? void 0 : e.supplyItems) ?? []).filter((y) => $.value[y.skuId]);
357
- },
358
- set(t) {
359
- const e = o.modelValue ?? {};
360
- e.supplyItems = t, n("update:modelValue", e);
361
- }
362
- }), d = R();
363
- return C({
364
- validateInputs: () => {
365
- var t, e;
366
- (e = (t = d.value) == null ? void 0 : t.validateInputs) == null || e.call(t);
367
- },
368
- resetInputsValidation: () => {
369
- var t, e;
370
- (e = (t = d.value) == null ? void 0 : t.resetInputsValidation) == null || e.call(t);
371
- },
372
- resetInputs: () => {
373
- var t, e;
374
- (e = (t = d.value) == null ? void 0 : t.resetInputs) == null || e.call(t);
375
- }
376
- }), (t, e) => {
377
- const y = P("FmTextField"), N = P("FmPhoneNumber"), T = P("FmForm");
378
- return I(), E(T, {
379
- ref_key: "formRef",
380
- ref: d,
381
- onValidationSuccess: e[12] || (e[12] = (m) => n("validation-success"))
382
- }, {
383
- default: U(() => [
384
- i("div", Ze, [
385
- i("div", et, [
386
- f(y, {
387
- disabled: t.disabled,
388
- rules: [p(A)()],
389
- "label-mark": "required",
390
- label: "Company name",
391
- modelValue: V.value,
392
- "onUpdate:modelValue": e[0] || (e[0] = (m) => V.value = m)
393
- }, null, 8, ["disabled", "rules", "modelValue"]),
394
- f(y, {
395
- disabled: t.disabled,
396
- rules: [p(A)()],
397
- "label-mark": "required",
398
- label: "Registration no.",
399
- modelValue: D.value,
400
- "onUpdate:modelValue": e[1] || (e[1] = (m) => D.value = m)
401
- }, null, 8, ["disabled", "rules", "modelValue"])
402
- ]),
403
- i("div", tt, [
404
- lt,
405
- i("div", ot, [
406
- f(y, {
407
- disabled: t.disabled,
408
- rules: [p(A)()],
409
- "label-mark": "required",
410
- label: "Line 1",
411
- modelValue: h.value,
412
- "onUpdate:modelValue": e[2] || (e[2] = (m) => h.value = m)
413
- }, null, 8, ["disabled", "rules", "modelValue"]),
414
- f(y, {
415
- disabled: t.disabled,
416
- "label-mark": "optional",
417
- label: "Line 2",
418
- modelValue: k.value,
419
- "onUpdate:modelValue": e[3] || (e[3] = (m) => k.value = m)
420
- }, null, 8, ["disabled", "modelValue"]),
421
- f(y, {
422
- disabled: t.disabled,
423
- rules: [p(A)()],
424
- "label-mark": "required",
425
- label: "City",
426
- modelValue: r.value,
427
- "onUpdate:modelValue": e[4] || (e[4] = (m) => r.value = m)
428
- }, null, 8, ["disabled", "rules", "modelValue"]),
429
- f(y, {
430
- disabled: t.disabled,
431
- rules: [p(A)()],
432
- "label-mark": "required",
433
- label: "Postal code",
434
- modelValue: b.value,
435
- "onUpdate:modelValue": e[5] || (e[5] = (m) => b.value = m)
436
- }, null, 8, ["disabled", "rules", "modelValue"]),
437
- f(y, {
438
- disabled: t.disabled,
439
- rules: [p(A)()],
440
- "label-mark": "required",
441
- label: "State",
442
- modelValue: S.value,
443
- "onUpdate:modelValue": e[6] || (e[6] = (m) => S.value = m)
444
- }, null, 8, ["disabled", "rules", "modelValue"]),
445
- f(y, {
446
- disabled: t.disabled,
447
- rules: [p(A)()],
448
- "label-mark": "required",
449
- label: "Country",
450
- modelValue: v.value,
451
- "onUpdate:modelValue": e[7] || (e[7] = (m) => v.value = m)
452
- }, null, 8, ["disabled", "rules", "modelValue"])
453
- ])
454
- ]),
455
- i("div", st, [
456
- at,
457
- i("div", nt, [
458
- f(y, {
459
- disabled: t.disabled,
460
- rules: [p(A)()],
461
- "label-mark": "required",
462
- label: "PIC",
463
- modelValue: u.value,
464
- "onUpdate:modelValue": e[8] || (e[8] = (m) => u.value = m)
465
- }, null, 8, ["disabled", "rules", "modelValue"]),
466
- f(N, {
467
- disabled: t.disabled,
468
- rules: [p(A)()],
469
- "label-mark": "required",
470
- label: "Phone number",
471
- modelValue: l.value,
472
- "onUpdate:modelValue": e[9] || (e[9] = (m) => l.value = m)
473
- }, null, 8, ["disabled", "rules", "modelValue"]),
474
- f(y, {
475
- disabled: t.disabled,
476
- "label-mark": "optional",
477
- label: "Email",
478
- modelValue: c.value,
479
- "onUpdate:modelValue": e[10] || (e[10] = (m) => c.value = m)
480
- }, null, 8, ["disabled", "modelValue"])
481
- ])
482
- ]),
483
- p(a).enableTotalCost ? (I(), F("div", rt, [
484
- f(Xe, {
485
- modelValue: s.value,
486
- "onUpdate:modelValue": e[11] || (e[11] = (m) => s.value = m)
487
- }, null, 8, ["modelValue"])
488
- ])) : ce("", !0)
489
- ])
490
- ]),
491
- _: 1
492
- }, 512);
493
- };
494
- }
495
- }), dt = { class: "flex gap-4" }, it = /* @__PURE__ */ G({
496
- __name: "SupplierDialog",
497
- props: {
498
- mode: {},
499
- supplier: {},
500
- show: { type: Boolean }
501
- },
502
- emits: ["update:show", "submitted"],
503
- setup(M, { expose: C, emit: _ }) {
504
- const o = M, n = _, a = R(!1), w = ye(), $ = pe(), V = g(() => {
505
- switch (o.mode) {
506
- case x.CREATE:
507
- return "Add supplier";
508
- case x.READ:
509
- return "View";
510
- case x.UPDATE:
511
- return "Edit supplier";
512
- }
513
- return "";
514
- }), D = g(() => {
515
- switch (o.mode) {
516
- case x.READ:
517
- return "";
518
- case x.UPDATE:
519
- return "Save";
520
- case x.CREATE:
521
- return "Add";
522
- }
523
- return "";
524
- }), h = R();
525
- C({
526
- validateInputs: () => {
527
- var l, c;
528
- (c = (l = h.value) == null ? void 0 : l.validateInputs) == null || c.call(l);
529
- },
530
- resetInputsValidation: () => {
531
- var l, c;
532
- (c = (l = h.value) == null ? void 0 : l.resetInputsValidation) == null || c.call(l);
533
- },
534
- resetInputs: () => {
535
- var l, c;
536
- (c = (l = h.value) == null ? void 0 : l.resetInputs) == null || c.call(l);
537
- }
538
- });
539
- const k = me(o, "show"), r = me(o, "supplier");
540
- function b() {
541
- var l, c;
542
- (c = (l = h.value) == null ? void 0 : l.validateInputs) == null || c.call(l);
543
- }
544
- function S() {
545
- switch (o.mode) {
546
- case x.READ:
547
- return;
548
- case x.UPDATE:
549
- return u();
550
- case x.CREATE:
551
- return v();
552
- }
553
- }
554
- async function v() {
555
- a.value = !0;
556
- try {
557
- await Promise.all([
558
- $.createSupplier(r.value),
559
- new Promise((l) => setTimeout(l, 1e3))
560
- ]), w.open({
561
- title: "Success",
562
- message: `Created ${r.value.name} supplier`,
563
- type: "success"
564
- }), n("update:show", !1), n("submitted");
565
- } catch (l) {
566
- w.open({
567
- title: "Something went wrong",
568
- message: `Cannot create ${r.value.name} supplier. Please try again`,
569
- type: "error"
570
- }), console.error("cannot create supplier", l);
571
- } finally {
572
- a.value = !1;
573
- }
574
- }
575
- async function u() {
576
- if (r.value === null) {
577
- w.open({
578
- title: "Something went wrong",
579
- message: "Cannot update empty supplier info",
580
- type: "error"
581
- });
582
- return;
583
- }
584
- a.value = !0;
585
- try {
586
- await Promise.all([
587
- $.updateSupplier(r.value),
588
- new Promise((l) => setTimeout(l, 1e3))
589
- ]), w.open({
590
- title: "Success",
591
- message: `Updated ${r.value.name} supplier`,
592
- type: "success"
593
- }), n("update:show", !1), n("submitted");
594
- } catch (l) {
595
- w.open({
596
- title: "Something went wrong",
597
- message: `Cannot update ${r.value.name} supplier. Please try again`,
598
- type: "error"
599
- }), console.error("cannot update supplier", l);
600
- } finally {
601
- a.value = !1;
602
- }
603
- }
604
- return (l, c) => {
605
- const s = P("FmButton"), d = P("FmSideSheet");
606
- return I(), E(d, {
607
- header: V.value,
608
- modelValue: p(k),
609
- "onUpdate:modelValue": c[1] || (c[1] = (t) => ue(k) ? k.value = t : null),
610
- "dismiss-away": !a.value,
611
- "close-button": "",
612
- "max-width": 500
613
- }, {
614
- default: U(() => {
615
- var t;
616
- return [
617
- (I(), E(ut, {
618
- class: "w-full",
619
- ref_key: "formRef",
620
- ref: h,
621
- modelValue: p(r),
622
- "onUpdate:modelValue": c[0] || (c[0] = (e) => ue(r) ? r.value = e : null),
623
- onValidationSuccess: S,
624
- key: ((t = l.supplier) == null ? void 0 : t._id) ?? "",
625
- disabled: a.value
626
- }, null, 8, ["modelValue", "disabled"]))
627
- ];
628
- }),
629
- "side-sheet-footer": U(() => [
630
- i("div", dt, [
631
- f(s, {
632
- loading: a.value,
633
- label: D.value,
634
- onClick: b
635
- }, null, 8, ["loading", "label"])
636
- ])
637
- ]),
638
- _: 1
639
- }, 8, ["header", "modelValue", "dismiss-away"]);
640
- };
641
- }
642
- }), mt = { class: "px-24 xs:p-0 sm:p-0 flex flex-col gap-8 max-h-full" }, ct = { class: "flex flex-col py-8" }, pt = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, yt = {
643
- key: 0,
644
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
645
- }, At = /* @__PURE__ */ G({
646
- __name: "SupplierView",
647
- setup(M) {
648
- const C = pe(), _ = Ae(), o = R(!1), n = ve(), a = ye();
649
- _.watchLocation(w);
650
- async function w(s) {
651
- if (s) {
652
- o.value = !0;
653
- try {
654
- await C.readSuppliers();
655
- } catch {
656
- a.open({
657
- title: "Cannot fetch supplier list",
658
- type: "error"
659
- });
660
- } finally {
661
- o.value = !1;
662
- }
663
- }
664
- }
665
- const $ = g(() => C.suppliers), V = R({});
666
- function D() {
667
- V.value.mode = x.CREATE, V.value.supplier = {}, V.value.show = !0;
668
- }
669
- function h(s) {
670
- V.value.mode = x.UPDATE, V.value.supplier = j(s), V.value.show = !0;
671
- }
672
- async function k(s) {
673
- n.open({
674
- title: "Delete supplier?",
675
- message: `Confirm deleting ${s.name}?`,
676
- primaryActions: {
677
- text: "Delete",
678
- close: !0,
679
- variant: "destructive"
680
- },
681
- secondaryActions: {
682
- text: "Cancel",
683
- close: !0
684
- }
685
- }).onPrimary(() => r(s));
686
- }
687
- async function r(s) {
688
- n.open({
689
- title: "Deleting supplier...",
690
- closeButton: !1
691
- });
692
- try {
693
- await C.deleteSupplier(s), a.open({
694
- title: "Success",
695
- message: `Deleted ${s == null ? void 0 : s.name}.`,
696
- type: "success"
697
- }), w(_.currentLocation);
698
- } catch (d) {
699
- a.open({
700
- title: "Something went wrong",
701
- message: `Cannot delete ${s == null ? void 0 : s.name}. Please try again.`,
702
- type: "error"
703
- }), console.error("failed to delete supplier", d);
704
- } finally {
705
- n.close();
706
- }
707
- }
708
- const { columnDefs: b } = Ne(h, k);
709
- function S(s) {
710
- s === "create" && D();
711
- }
712
- const v = R(""), { breakpoints: u } = Me(), l = g(() => u.value.xs || u.value.sm ? 10 : 20), c = xe();
713
- return (s, d) => {
714
- const t = P("FmTable");
715
- return I(), E(De, {
716
- title: "Supplier",
717
- actions: [{ label: "Create supplier", value: "create", isPrimary: !0, prependIcon: "add" }],
718
- "onClick:action": S
719
- }, {
720
- default: U(() => [
721
- i("div", mt, [
722
- f(Ue, {
723
- searchable: "",
724
- "change-location": "",
725
- search: v.value,
726
- "onUpdate:search": d[0] || (d[0] = (e) => v.value = e)
727
- }, null, 8, ["search"]),
728
- f(t, {
729
- style: Se(p(c).tableHeight),
730
- "column-defs": p(b),
731
- "row-data": $.value,
732
- "search-value": v.value,
733
- loading: !p(_)._currentLocation || o.value,
734
- onRowClick: d[1] || (d[1] = (e) => h(e.original)),
735
- "page-size": l.value
736
- }, {
737
- "list-row": U((e) => [
738
- f(we, {
739
- row: e,
740
- onRowClick: h
741
- }, {
742
- default: U((y) => {
743
- var N, T, m, B, J, Q, W, X, q, Z, ee, te, le, z, oe, se, ae, ne, L, re;
744
- return [
745
- i("div", ct, [
746
- i("div", pt, [
747
- f(p(K), {
748
- render: (m = (T = (N = y.name) == null ? void 0 : N.column) == null ? void 0 : T.columnDef) == null ? void 0 : m.cell,
749
- props: (J = (B = y.name) == null ? void 0 : B.getContext) == null ? void 0 : J.call(B)
750
- }, null, 8, ["render", "props"])
751
- ]),
752
- i("div", ft, [
753
- f(p(K), {
754
- render: (X = (W = (Q = y.contactName) == null ? void 0 : Q.column) == null ? void 0 : W.columnDef) == null ? void 0 : X.cell,
755
- props: (Z = (q = y.contactName) == null ? void 0 : q.getContext) == null ? void 0 : Z.call(q)
756
- }, null, 8, ["render", "props"])
757
- ]),
758
- i("div", vt, [
759
- f(p(K), {
760
- render: (le = (te = (ee = y.phoneNumber) == null ? void 0 : ee.column) == null ? void 0 : te.columnDef) == null ? void 0 : le.cell,
761
- props: (oe = (z = y.phoneNumber) == null ? void 0 : z.getContext) == null ? void 0 : oe.call(z)
762
- }, null, 8, ["render", "props"])
763
- ]),
764
- e.original.email ? (I(), F("div", yt, [
765
- f(p(K), {
766
- render: (ne = (ae = (se = y.email) == null ? void 0 : se.column) == null ? void 0 : ae.columnDef) == null ? void 0 : ne.cell,
767
- props: (re = (L = y.email) == null ? void 0 : L.getContext) == null ? void 0 : re.call(L)
768
- }, null, 8, ["render", "props"])
769
- ])) : ce("", !0)
770
- ])
771
- ];
772
- }),
773
- _: 2
774
- }, 1032, ["row"])
775
- ]),
776
- _: 1
777
- }, 8, ["style", "column-defs", "row-data", "search-value", "loading", "page-size"])
778
- ]),
779
- (I(), E(he, { to: "body" }, [
780
- f(it, {
781
- show: V.value.show,
782
- "onUpdate:show": d[2] || (d[2] = (e) => V.value.show = e),
783
- supplier: V.value.supplier,
784
- mode: V.value.mode,
785
- onSubmitted: d[3] || (d[3] = (e) => w(p(_).currentLocation))
786
- }, null, 8, ["show", "supplier", "mode"])
787
- ]))
788
- ]),
789
- _: 1
790
- });
791
- };
792
- }
793
- });
794
- export {
795
- At as default
796
- };