@feedmepos/mf-inventory-portal 0.0.22-dev.5 → 0.0.22-dev.50

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