@feedmepos/mf-inventory-portal 0.0.23-dev.9 → 0.0.24-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/App-D3sNH2MR.js +276 -0
  2. package/dist/{ApprovalView-e85YmdZN.js → ApprovalView-DHnRx0hJ.js} +17 -20
  3. package/dist/{BindingsDialog-giBUD0IH.js → BindingsDialog-oTeg2Dai.js} +6 -6
  4. package/dist/{BindingsPicker-CC4MmPbF.js → BindingsPicker-CWdjmMJ3.js} +8 -9
  5. package/dist/{BindingsTable-WphZdzrA.js → BindingsTable-bKLR1OKX.js} +18 -22
  6. package/dist/ClosingDraftView-CIQVz7lY.js +1225 -0
  7. package/dist/{ClosingTemplateView-1lzoDyet.js → ClosingTemplateView-D5pLzQwU.js} +259 -274
  8. package/dist/FmCustomAttribute.vue_vue_type_script_setup_true_lang-ClLDcchC.js +142 -0
  9. package/dist/{FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-Cv-vvzr5.js → FmFilterableMenuOptions.vue_vue_type_script_setup_true_lang-B_c6Vn6P.js} +23 -24
  10. package/dist/{FmUnitInput.vue_vue_type_script_setup_true_lang-DIFQcrc0.js → FmUnitInput.vue_vue_type_script_setup_true_lang-DhpHOaRH.js} +50 -51
  11. package/dist/{IngredientGroupView-UegBM_JK.js → IngredientGroupView-4C437mso.js} +63 -70
  12. package/dist/IngredientsView-DoiGgjre.js +1706 -0
  13. package/dist/{IntegrationView-FYNNzKia.js → IntegrationView-8ZKE7MAM.js} +123 -126
  14. package/dist/{InventoryBindingForm-DsHv_IHG.js → InventoryBindingForm-CcnfliYQ.js} +1 -1
  15. package/dist/{InventoryBindingForm.vue_vue_type_script_setup_true_lang-BURSXafS.js → InventoryBindingForm.vue_vue_type_script_setup_true_lang-B_J-6C9x.js} +116 -108
  16. package/dist/{InventoryBindingSummary-BLb4MRPZ.js → InventoryBindingSummary-CRdHCzNE.js} +1 -1
  17. package/dist/{NumberPrecisionInput.vue_vue_type_script_setup_true_lang-BG78-DHs.js → NumberPrecisionInput.vue_vue_type_script_setup_true_lang-B2-TypU0.js} +1 -1
  18. package/dist/{PremiumBadge.vue_vue_type_script_setup_true_lang-CqID5_7v.js → PremiumBadge.vue_vue_type_script_setup_true_lang-BuQde75S.js} +20 -21
  19. package/dist/PublishView-t5gjGmK_.js +192 -0
  20. package/dist/{PurchaseOrderPrintPreview-BBMU3teq.js → PurchaseOrderPrintPreview-6i53Y-v1.js} +13 -14
  21. package/dist/ReceiveRequestView-uOeSh0Mr.js +1866 -0
  22. package/dist/RecipeView-BTWywckD.js +609 -0
  23. package/dist/StockView-DN2xk8ei.js +1817 -0
  24. package/dist/{SupplierView-B2aObtwK.js → SupplierView-l0XUg3J4.js} +185 -196
  25. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-CWMn6fFf.js +1327 -0
  26. package/dist/TransferTemplateView-wDKXpCWZ.js +1263 -0
  27. package/dist/UnitView-CUI-k-tS.js +648 -0
  28. package/dist/{WarehouseView-G8pej6Y2.js → WarehouseView-WsI_eG5r.js} +190 -197
  29. package/dist/api/adjustment-template.d.ts +25 -0
  30. package/dist/api/bill.d.ts +240 -84
  31. package/dist/api/inventory.d.ts +19 -6
  32. package/dist/api/netsuite.d.ts +3 -3
  33. package/dist/app-DntcWR3_.js +85558 -0
  34. package/dist/app.d.ts +85 -0
  35. package/dist/app.js +2 -2
  36. package/dist/components/FmCustomAttribute.vue.d.ts +23 -0
  37. package/dist/components/FmLockableField.vue.d.ts +37 -0
  38. package/dist/components/FmMultiselectDialogProps.d.ts +1 -0
  39. package/dist/components/inventory-binding/InventoryBinding.vue.d.ts +3 -1
  40. package/dist/components/shell/inventory/binding-ui.vue.d.ts +3 -1
  41. package/dist/composable/defineDeepModel.d.ts +1 -1
  42. package/dist/{decimal-DC07xoJW.js → decimal-DTCTnMwO.js} +1 -1
  43. package/dist/format-unit-display-Hy48Iw5j.js +1215 -0
  44. package/dist/index-Bv9RYyTZ.js +29202 -0
  45. package/dist/{StockView-C5btudss.js → index-D4yJP9I2.js} +2220 -3863
  46. package/dist/layout/SingleColumnLayout.vue.d.ts +1 -0
  47. package/dist/router/name.d.ts +2 -0
  48. package/dist/stock-BsdmfT-b.js +125 -0
  49. package/dist/stores/feature.d.ts +41 -1
  50. package/dist/stores/integration/netsuite.d.ts +3 -2
  51. package/dist/stores/inventory.d.ts +20 -8
  52. package/dist/stores/location.d.ts +29 -1
  53. package/dist/stores/supplier.d.ts +1 -1
  54. package/dist/style.css +1 -1
  55. package/dist/supplier-CXhkgC4M.js +77 -0
  56. package/dist/tsconfig.app.tsbuildinfo +1 -1
  57. package/dist/{use-inventory-binding-dialog-B0G2XYSw.js → use-inventory-binding-dialog-DPMJmBCr.js} +10 -11
  58. package/dist/views/adjustment-template/import/AdjustmentTemplateImport.vue.d.ts +2 -0
  59. package/dist/views/adjustment-template/import/AdjustmentTemplateImportItem.vue.d.ts +18 -0
  60. package/dist/views/adjustment-template/import/export.d.ts +60 -0
  61. package/dist/views/adjustment-template/wastage-template/WastageTemplateDetails.vue.d.ts +2 -0
  62. package/dist/views/adjustment-template/wastage-template/WastageTemplateDialog.vue.d.ts +22 -0
  63. package/dist/views/adjustment-template/wastage-template/WastageTemplatePublish.vue.d.ts +6 -0
  64. package/dist/views/adjustment-template/wastage-template/WastageTemplateReason.vue.d.ts +18 -0
  65. package/dist/views/adjustment-template/wastage-template/WastageTemplateView.vue.d.ts +2 -0
  66. package/dist/views/adjustment-template/wastage-template/actions.d.ts +1377 -0
  67. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateForm.vue.d.ts +16 -0
  68. package/dist/views/adjustment-template/wastage-template/form/WastageTemplateItemTable.vue.d.ts +35 -0
  69. package/dist/views/adjustment-template/wastage-template/form/useAdjustmentTemplateItems.d.ts +20 -0
  70. package/dist/views/adjustment-template/wastage-template/props.d.ts +36 -0
  71. package/dist/views/adjustment-template/wastage-template/table.d.ts +1351 -0
  72. package/dist/views/closing-draft/components/closing-draft-dialog/ClosingDraftDialog.vue.d.ts +198 -12
  73. package/dist/views/closing-draft/composables/use-closing-draft-actions.d.ts +7 -4
  74. package/dist/views/closing-draft/composables/use-closing-draft-table.d.ts +1559 -467
  75. package/dist/views/closing-draft/helpers/export-draft.helper.d.ts +19 -0
  76. package/dist/views/closing-draft/helpers/get-calculated-total.helper.d.ts +4 -0
  77. package/dist/views/closing-template/components/closing-template-form/composables/use-closing-template-items.d.ts +2 -1
  78. package/dist/views/closing-template/composables/use-closing-template-actions.d.ts +72 -12
  79. package/dist/views/closing-template/composables/use-closing-template-table.d.ts +73 -13
  80. package/dist/views/ingredient-group/composables/use-ingredient-group-table.d.ts +6 -3
  81. package/dist/views/ingredients/components/convert/ConvertFormProps.d.ts +1 -0
  82. package/dist/views/ingredients/components/ingredient-form/IngredientForm.vue.d.ts +4 -2
  83. package/dist/views/ingredients/components/inventory-binding/InventoryBindingForm.vue.d.ts +1 -0
  84. package/dist/views/ingredients/composables/use-ingredient-table.d.ts +2 -1
  85. package/dist/views/publish/PublishView.vue.d.ts +2 -0
  86. package/dist/views/receive-request/components/netsuite/NetSuiteInfo.vue.d.ts +12 -0
  87. package/dist/views/receive-request/components/netsuite/NetSuiteProps.d.ts +13 -0
  88. package/dist/views/receive-request/components/netsuite/NetSuiteSync.vue.d.ts +12 -0
  89. package/dist/views/receive-request/components/transfer-form/NetSuiteField.vue.d.ts +13 -0
  90. package/dist/views/receive-request/components/transfer-form/SparkIcon.vue.d.ts +1 -1
  91. package/dist/views/receive-request/components/transfer-form/TransferForm.vue.d.ts +86 -17
  92. package/dist/views/receive-request/components/transfer-form/components/ForecastStock.vue.d.ts +4 -2
  93. package/dist/views/receive-request/components/transfer-form/composables/use-transfer-items.d.ts +2 -1
  94. package/dist/views/receive-request/composables/use-receive-request-form.d.ts +126 -24
  95. package/dist/views/receive-request/composables/use-receive-request-table.d.ts +126 -24
  96. package/dist/views/recipe/components/recipe-form/RecipeForm.vue.d.ts +2 -0
  97. package/dist/views/stock/components/StockRecordCard.vue.d.ts +120 -42
  98. package/dist/views/stock/components/dialog/AdjustedItemForm.vue.d.ts +6 -4
  99. package/dist/views/stock/helper/compute-summary-total.d.ts +2 -2
  100. package/dist/views/transfer-template/components/transfer-template-form/composables/use-template-enabled-locations.d.ts +4 -0
  101. package/dist/views/transfer-template/components/transfer-template-form/composables/use-transfer-template-items.d.ts +2 -1
  102. package/dist/views/transfer-template/composables/use-transfer-template-actions.d.ts +72 -12
  103. package/dist/views/transfer-template/composables/use-transfer-template-table.d.ts +72 -12
  104. package/dist/views/transfer-template/helpers/import-export.helper.d.ts +2 -1
  105. package/dist/vue-i18n-ByVzHsI7.js +2365 -0
  106. package/package.json +5 -4
  107. package/dist/App-ByLgARNp.js +0 -259
  108. package/dist/ClosingDraftView-CQM1Sx45.js +0 -755
  109. package/dist/FmDroppableField-8RzKjEdL.js +0 -154
  110. package/dist/FmInventoryTableToolbar.vue_vue_type_script_setup_true_lang-BvkN-71q.js +0 -436
  111. package/dist/FmMultiselectDialog-DScMA6iG.js +0 -415
  112. package/dist/IngredientBindedItem.vue_vue_type_script_setup_true_lang-t4pim_k9.js +0 -51
  113. package/dist/IngredientsView-BfW-jZLM.js +0 -1666
  114. package/dist/ReceiveRequestView-vbANEzne.js +0 -4165
  115. package/dist/RecipeView-DW4DY0C0.js +0 -598
  116. package/dist/TableActionableRow.vue_vue_type_script_setup_true_lang-DlNJ6kRg.js +0 -135
  117. package/dist/TransferDetails.vue_vue_type_script_setup_true_lang-B2LOvVef.js +0 -1229
  118. package/dist/TransferTemplateView-BKumN_p6.js +0 -1262
  119. package/dist/UnitView-CHLucv9s.js +0 -648
  120. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  121. package/dist/app-BXjk74IB.js +0 -33538
  122. package/dist/date2-CWAt9bRf.js +0 -117
  123. package/dist/dayjs.min-D3jPOnu6.js +0 -282
  124. package/dist/defineDeepModel-CiD4GtOw.js +0 -13
  125. package/dist/feature-6tcLMotY.js +0 -92
  126. package/dist/form-mode.enum-BKiNVH6A.js +0 -4
  127. package/dist/format-time-from-id-CYU5Z9Mt.js +0 -15
  128. package/dist/format-unit-display-CY-0bznr.js +0 -1217
  129. package/dist/fuzzy-BMkhNYLR.js +0 -41
  130. package/dist/index-BXwQa14X.js +0 -45
  131. package/dist/index-CRLd5xyg.js +0 -22283
  132. package/dist/index-DqwAtOgI.js +0 -12087
  133. package/dist/netsuite-fYUUk_ss.js +0 -225
  134. package/dist/row-action.enum-7rGLGZ5v.js +0 -55
  135. package/dist/rules-BmRGm3yv.js +0 -203
  136. package/dist/stock-CEX0DP2B.js +0 -111
  137. package/dist/supplier-CdJmZr7w.js +0 -77
  138. package/dist/use-template-enabled-locations-2-xbPJWHCs.js +0 -86
  139. package/dist/xlsx-CTOKp7SQ.js +0 -24004
  140. package/dist/xlsx.util-D5NFSfDg.js +0 -78
@@ -1,225 +0,0 @@
1
- import { k as N, h as B, a as L, u as I } from "./app-BXjk74IB.js";
2
- import { useCoreStore as $ } from "@feedmepos/mf-common";
3
- import { useSnackbar as T } from "@feedmepos/ui-library";
4
- import { ref as M, computed as p } from "vue";
5
- const b = N((f, c) => {
6
- const g = $(), l = T();
7
- return c.onError(async (d) => {
8
- if (d instanceof B)
9
- throw l == null || l.open({
10
- title: d.title,
11
- message: d.message,
12
- type: "error"
13
- }), d;
14
- }), {
15
- async readSetting() {
16
- var e;
17
- const d = ((e = g.currentBusiness.value) == null ? void 0 : e._id) ?? "", m = `${f.netSuiteBackendUrl}/${d}/settings`;
18
- return await c.get(m);
19
- },
20
- async syncTransferOrder(d, m, e) {
21
- var t;
22
- const i = ((t = g.currentBusiness.value) == null ? void 0 : t._id) ?? "", n = `${f.netSuiteBackendUrl}/${i}/sync/transfer-order`;
23
- return await c.post(n, {
24
- type: d,
25
- id: m,
26
- locationId: e
27
- });
28
- },
29
- urls: f
30
- };
31
- });
32
- function h() {
33
- return {
34
- setting: {
35
- _id: "",
36
- items: [],
37
- childItems: [],
38
- units: [],
39
- locations: [],
40
- subsidiaries: [],
41
- vendors: [],
42
- enable: !1,
43
- syncedAt: null
44
- },
45
- vendorSubsidiary: {},
46
- isReady: !1
47
- };
48
- }
49
- const a = M(h());
50
- function A() {
51
- const f = L(), c = p(() => a.value.setting.items.groupBy("netSuiteId", (e) => e.id)), g = p(() => a.value.setting.units.flatMap((e) => e.measurements).groupBy("netSuiteId", (e) => e.id)), l = p(() => a.value.setting.items.groupBy((e) => e.id)), d = p(
52
- () => a.value.setting.units.groupBy(
53
- (e) => e.netSuiteId,
54
- (e) => f.unitById[e.id]
55
- )
56
- ), m = p(
57
- () => a.value.setting.units.flatMap(
58
- (e) => e.measurements.map((i) => {
59
- var n;
60
- return {
61
- unit: (n = d.value.get(e.netSuiteId)) == null ? void 0 : n[0],
62
- measurement: i
63
- };
64
- })
65
- ).groupBy(
66
- (e) => e.measurement.netSuiteId,
67
- (e) => {
68
- var i;
69
- return (i = e.unit) == null ? void 0 : i.measurements.find((n) => n.id === e.measurement.id);
70
- }
71
- )
72
- );
73
- return {
74
- // state
75
- get isReady() {
76
- return a.value.isReady;
77
- },
78
- get isEnabled() {
79
- return a.value.setting.enable;
80
- },
81
- get isBusinessLocation() {
82
- return I().businessLevel;
83
- },
84
- get state() {
85
- return a.value;
86
- },
87
- get netSuiteItemIdToSkuId() {
88
- return c.value;
89
- },
90
- get netSuiteMeasurementIdToMeasurementId() {
91
- return g.value;
92
- },
93
- get netSuiteItemBySkuId() {
94
- return l.value;
95
- },
96
- get unitByNetsuiteId() {
97
- return d.value;
98
- },
99
- get measurementByNetsuiteId() {
100
- return m.value;
101
- },
102
- getNetSuiteVendor(e) {
103
- return a.value.setting.vendors.find((i) => i.id === e);
104
- },
105
- getNetSuiteLocation(e) {
106
- const [i, n] = e.split("_");
107
- return a.value.setting.locations.find((r) => r.id == n && r.type == i);
108
- },
109
- getLocationSubsidiary(e) {
110
- var r;
111
- if (!e)
112
- return {
113
- id: void 0,
114
- name: "",
115
- fullName: ""
116
- };
117
- const i = ((r = a.value.setting.locations.find((s) => s.netSuiteId === e)) == null ? void 0 : r.subsidiaryId) ?? null, { flat: n } = y(a.value.setting.subsidiaries), t = n.find((s) => s.id === i);
118
- return {
119
- id: t == null ? void 0 : t.id,
120
- name: (t == null ? void 0 : t.name) || "",
121
- fullName: `${(t == null ? void 0 : t.fullName) ?? ""}`
122
- };
123
- },
124
- currentLocationSubsidiary() {
125
- var o;
126
- const e = I(), i = e.currentLocation.doc._id, n = e.currentLocation.type, t = ((o = a.value.setting.locations.find(
127
- (u) => u.id === i && u.type == n
128
- )) == null ? void 0 : o.subsidiaryId) ?? null, { flat: r } = y(a.value.setting.subsidiaries), s = r.find((u) => u.id === t);
129
- return {
130
- id: s == null ? void 0 : s.id,
131
- name: (s == null ? void 0 : s.name) || "",
132
- fullName: `${(s == null ? void 0 : s.fullName) ?? ""}`
133
- };
134
- },
135
- currentVendorSubsidiary(e) {
136
- var r;
137
- const i = ((r = a.value.setting.vendors.find((s) => s.id === e)) == null ? void 0 : r.subsidiaryId) ?? null, { flat: n } = y(a.value.setting.subsidiaries), t = n.find((s) => s.id === i);
138
- return {
139
- id: t == null ? void 0 : t.id,
140
- name: (t == null ? void 0 : t.name) || "",
141
- fullName: `${(t == null ? void 0 : t.fullName) ?? ""}`
142
- };
143
- },
144
- get subsidiaryOptions() {
145
- const { flat: e } = y(a.value.setting.subsidiaries);
146
- return e.map((i) => ({
147
- label: `${"   ".repeat(i.depth)}${i.name}`,
148
- value: {
149
- id: i.id,
150
- name: i.name
151
- }
152
- }));
153
- },
154
- getAvailableItems(e) {
155
- const { available: i } = y(a.value.setting.subsidiaries, e);
156
- return a.value.setting.items.filter((n) => n.subsidiaryIds.some((t) => i.includes(t))).map((n) => n.id);
157
- },
158
- getAvailableMeasurements(e, i) {
159
- const n = a.value.setting.items.find((u) => u.id === e);
160
- if (!n)
161
- return [];
162
- const { available: t, flatMapping: r } = y(
163
- a.value.setting.subsidiaries,
164
- i
165
- ), o = a.value.setting.childItems.filter((u) => {
166
- let v = u.subsidiaryIds;
167
- if (u.includeChildren == !0)
168
- for (const S of u.subsidiaryIds)
169
- v = v.concat(r[S]);
170
- return v = [...new Set(v)], u.parentNetSuiteId === n.netSuiteId && v.some((S) => t.includes(S));
171
- }).flatMap((u) => u.unitTypeId);
172
- return a.value.setting.units.filter((u) => o.includes(u.netSuiteId)).flatMap((u) => u.measurements).map((u) => u.id);
173
- },
174
- async readSetting() {
175
- console.log("netsuite init");
176
- const i = await b().readSetting();
177
- if (i) {
178
- this.state.setting = i;
179
- const { flat: n } = y(a.value.setting.subsidiaries);
180
- for (const t of i.vendors) {
181
- const r = n.find((s) => s.id === t.subsidiaryId);
182
- this.state.vendorSubsidiary[t.id] = (r == null ? void 0 : r.fullName) || "";
183
- }
184
- }
185
- this.state.isReady = !0;
186
- },
187
- getVendorSubsidiaryName(e) {
188
- return this.state.vendorSubsidiary[e] || "";
189
- },
190
- async syncTransferOrder(e, i) {
191
- const n = b(), t = I(), r = t.currentLocation.doc._id, s = t.currentLocation.type;
192
- await n.syncTransferOrder(e, i, `${s}_${r}`);
193
- }
194
- };
195
- }
196
- function y(f, c) {
197
- const g = [], l = [];
198
- function d(n, t, r = !1) {
199
- return f.filter((o) => o.parentId === t).map((o) => ((r || o.id === c || !c) && g.push(o.id), {
200
- id: o.id,
201
- name: o.name,
202
- country: o.country,
203
- currency: o.currency,
204
- parentId: o.parentId,
205
- depth: n,
206
- children: d(n + 1, o.id, r || o.id === c)
207
- }));
208
- }
209
- const m = d(0, null), e = {};
210
- function i(n, t = "") {
211
- const r = n.fullName || n.name, s = t ? `${t} : ${r}` : r;
212
- l.push({ ...n, fullName: s }), e[n.id] = [n.id];
213
- for (const o of n.children)
214
- i(o, s), e[n.id].push(...e[o.id]);
215
- }
216
- return m.forEach((n) => i(n)), {
217
- tree: m,
218
- available: g,
219
- flat: l,
220
- flatMapping: e
221
- };
222
- }
223
- export {
224
- A as u
225
- };
@@ -1,55 +0,0 @@
1
- var e = /* @__PURE__ */ ((t) => (t.Add = "Add", t.Create = "Create", t.Print = "Print", t.Export = "Export", t.Update = "Update", t.Details = "Details", t.Edit = "Edit", t.Delete = "Delete", t))(e || {});
2
- const o = {
3
- Add: {
4
- translationKey: "common.add",
5
- color: "text-fm-color-typo-primary",
6
- value: "Add"
7
- /* Add */
8
- },
9
- Create: {
10
- translationKey: "common.create",
11
- color: "text-fm-color-typo-primary",
12
- value: "Create"
13
- /* Create */
14
- },
15
- Update: {
16
- translationKey: "common.update",
17
- color: "text-fm-color-typo-primary",
18
- value: "Update"
19
- /* Update */
20
- },
21
- Details: {
22
- translationKey: "inventory.common.details",
23
- color: "text-fm-color-typo-primary",
24
- value: "Details"
25
- /* Details */
26
- },
27
- Print: {
28
- translationKey: "inventory.common.print",
29
- color: "text-fm-color-typo-primary",
30
- value: "Print"
31
- /* Print */
32
- },
33
- Export: {
34
- translationKey: "common.export",
35
- color: "text-fm-color-typo-primary",
36
- value: "Export"
37
- /* Export */
38
- },
39
- Edit: {
40
- translationKey: "common.edit",
41
- color: "text-fm-color-typo-primary",
42
- value: "Edit"
43
- /* Edit */
44
- },
45
- Delete: {
46
- translationKey: "common.delete",
47
- color: "text-fm-color-typo-error",
48
- value: "Delete"
49
- /* Delete */
50
- }
51
- };
52
- export {
53
- o as D,
54
- e as R
55
- };
@@ -1,203 +0,0 @@
1
- import { F as s } from "./index-CRLd5xyg.js";
2
- import { c as d, a as b } from "./date2-CWAt9bRf.js";
3
- function j(t, n) {
4
- return s.convertPrecision({
5
- value: t,
6
- precision: n
7
- });
8
- }
9
- function P(t, n) {
10
- return s.subtract([t, n]);
11
- }
12
- function $(t, n) {
13
- return s.add([t, n]);
14
- }
15
- function N(t, n) {
16
- return s.multiply([t, n]);
17
- }
18
- function D(t, n) {
19
- const r = Math.floor(t.amount * n.amount), i = r === 0 ? 0 : t.precision + n.precision, e = a(r), o = Math.min(i, e);
20
- return {
21
- amount: r / Math.pow(10, o),
22
- precision: i - o
23
- };
24
- }
25
- function l(t, n) {
26
- const r = +u(t), i = +u(n);
27
- return r / i;
28
- }
29
- function F(t, n) {
30
- const r = l(t, n);
31
- return c(r);
32
- }
33
- function T(t, n) {
34
- return t.precision >= n ? t : s.convertPrecision({ value: t, precision: n });
35
- }
36
- function h(t) {
37
- if (t.amount === 0) return c(0);
38
- const n = a(t.amount), r = t.precision - n;
39
- return s.convertPrecision({ value: t, precision: Math.max(0, r) });
40
- }
41
- function u(t, n = !0) {
42
- return n ? Number(t.amount / Math.pow(10, t.precision)).toFixed(t.precision) : Number(t.amount / Math.pow(10, t.precision)).toString();
43
- }
44
- function x(t, n) {
45
- n = n ?? M(t);
46
- const r = n, i = t.toFixed(r), e = i.includes(".") ? i.replace(/0+$/, "") : i;
47
- return e.endsWith(".") ? e.slice(0, e.length - 1) : e;
48
- }
49
- function w(t, n = !1, r = 2) {
50
- const i = Number(t.amount / Math.pow(10, t.precision)), e = i.toFixed(
51
- Number.isInteger(i) ? 2 : Math.min(4, Math.max(2, r))
52
- );
53
- return n ? `${e} ${t.currency}` : t.currency === "MYR" ? `RM ${e}` : `${t.currency} ${e}`;
54
- }
55
- function O(t) {
56
- return {
57
- ...t,
58
- amount: Math.abs(t.amount)
59
- };
60
- }
61
- function M(t) {
62
- if (!isFinite(t)) return 0;
63
- let n = 1, r = 0;
64
- for (; Math.round(t * n) / n !== t; )
65
- n *= 10, r++;
66
- return r;
67
- }
68
- function c(t) {
69
- const n = M(t);
70
- return {
71
- precision: n,
72
- amount: t * 10 ** n
73
- };
74
- }
75
- function B(t, n = 0, r = !1) {
76
- let i = 0;
77
- return Number.isNaN(Number(t)) || (r || Number(t) >= 0) && (i = Number(t)), {
78
- amount: Number((i * 10 ** n).toFixed(0)),
79
- precision: n
80
- };
81
- }
82
- function a(t) {
83
- const n = `${t}`, r = n.replace(/0*$/g, "");
84
- return n.length - r.length;
85
- }
86
- function y(t, n) {
87
- if (!n)
88
- return t.precision;
89
- const r = a(n.conversion.amount);
90
- return t.precision - n.conversion.precision + r;
91
- }
92
- function R() {
93
- return function(n) {
94
- return !!n || "Required";
95
- };
96
- }
97
- function m(t) {
98
- return t && typeof t == "object" && Object.prototype.hasOwnProperty.call(t, "amount") && Object.prototype.hasOwnProperty.call(t, "precision");
99
- }
100
- function q(t, n) {
101
- const r = typeof t == "object" ? +u(t) : t;
102
- function i(e) {
103
- return Object.prototype.hasOwnProperty.call(e, "length");
104
- }
105
- return function(o) {
106
- return m(o) && (o = +u(o)), Number.isFinite(+o) && (o = +o), i(o) ? o.length >= r ? !0 : typeof n == "function" ? n(o.length) : n ?? `Must be at least ${r}` : typeof o == "number" ? o >= r ? !0 : typeof n == "function" ? n(o) : n ?? `Must be at least ${r}` : `Cannot validate at least ${r}`;
107
- };
108
- }
109
- function L(t) {
110
- const n = typeof t == "object" ? +u(t) : t;
111
- function r(i) {
112
- return Object.prototype.hasOwnProperty.call(i, "length");
113
- }
114
- return function(e, o) {
115
- return m(e) && (e = +u(e)), r(e) ? e.length > n ? !0 : typeof o == "function" ? o(e.length) : o ?? `Must be more than ${n}` : typeof e == "number" ? e > n ? !0 : typeof o == "function" ? o(e) : o ?? `Must be more than ${n}` : `Cannot validate more than ${n}`;
116
- };
117
- }
118
- function C(t, n) {
119
- return t instanceof Date && n instanceof Date ? function(i) {
120
- const e = new Date(i);
121
- return isNaN(e.getTime()) ? "Invalid date" : e.getTime() < t.getTime() ? `Date must be at least ${d(t)} ${b(t)}` : e.getTime() >= n.getTime() ? `Date must be less than ${d(n)} ${b(n)}` : !0;
122
- } : typeof t == "number" && typeof n == "number" ? function(i) {
123
- const e = +i;
124
- return isNaN(e) ? "Invalid number" : e < t ? `Value must be at least ${t}` : e >= n ? `Value must be less than ${n}` : !0;
125
- } : function() {
126
- return "Progamming error: invalid range parameter.";
127
- };
128
- }
129
- function f() {
130
- return function(t) {
131
- if (t = String(t), t.length === 0)
132
- return !0;
133
- const n = +t;
134
- return isFinite(n) || "Must be a number";
135
- };
136
- }
137
- function V(t, n) {
138
- return typeof t == "number" ? function(i) {
139
- const e = f()(i);
140
- return typeof e == "string" ? e : c(+i).precision > t ? `Precision cannot be more than ${t} decimal point.` : !0;
141
- } : function(i) {
142
- const e = f()(i);
143
- if (typeof e == "string")
144
- return e;
145
- const o = y(t, n);
146
- return c(+i).precision > o ? `Precision cannot be more than ${o} decimal point.` : !0;
147
- };
148
- }
149
- function Y(t, n) {
150
- return function(i) {
151
- const e = f()(i);
152
- if (typeof e == "string")
153
- return e;
154
- const o = c(+i);
155
- return o.precision > t ? typeof n == "function" ? n(o.precision) : n ?? `Precision cannot be more than ${t}` : !0;
156
- };
157
- }
158
- function Z(t, n, r) {
159
- return function(e) {
160
- if (e === n) return !0;
161
- const o = t.find((p) => p.value === e);
162
- return o ? r ? r(o) : `Already used in ${o.label}` : !0;
163
- };
164
- }
165
- function S(t) {
166
- let n = typeof t == "number" ? c(t) : t;
167
- n = h(n);
168
- const r = u(n);
169
- return function(e) {
170
- if (!m(e)) {
171
- if (e = +e, Number.isNaN(e)) return !0;
172
- e = c(e);
173
- }
174
- return e = h(e), e.amount % n.amount === 0 && e.precision <= n.precision ? !0 : `${u(e)} must be a multiple of ${r}`;
175
- };
176
- }
177
- export {
178
- q as A,
179
- C as B,
180
- f as I,
181
- V as M,
182
- R,
183
- Z as U,
184
- u as a,
185
- D as b,
186
- c,
187
- L as d,
188
- M as e,
189
- O as f,
190
- y as g,
191
- N as h,
192
- $ as i,
193
- w as j,
194
- j as k,
195
- P as l,
196
- F as m,
197
- h as n,
198
- x as o,
199
- S as p,
200
- Y as q,
201
- B as t,
202
- T as u
203
- };
@@ -1,111 +0,0 @@
1
- import { k as l, u as m, a as B } from "./app-BXjk74IB.js";
2
- import { useCoreStore as k } from "@feedmepos/mf-common";
3
- import { useSnackbar as p } from "@feedmepos/ui-library";
4
- import { g as v } from "./index-CRLd5xyg.js";
5
- import { ref as y } from "vue";
6
- const $ = l((o, t) => {
7
- const s = m(), u = k(), c = p();
8
- return t.onError(async (e) => {
9
- e.name === "SvcForbiddenError" && (c == null || c.open({
10
- title: e.title,
11
- message: e.message,
12
- type: "error"
13
- }));
14
- }), {
15
- async readStockBalance() {
16
- const e = s.currentLocationDBName, n = `${o.inventoryBackendUrl}/${e}/stock-balance`;
17
- return await t.get(n);
18
- },
19
- async readSkuBalance() {
20
- var r;
21
- const e = s.currentLocationDBName, n = `${o.inventoryBackendUrl}/${e}/sku/balance`;
22
- return (((r = u.currentBusiness.value) == null ? void 0 : r.menuVersion) ?? "") === "v3" ? await t.get(n) : await t.get(`${n}?useInventoryDoc=true`);
23
- },
24
- async readSingleAdjustment(e) {
25
- const n = s.currentLocationDBName, a = `${o.inventoryBackendUrl}/${n}/adjustment`;
26
- return await t.get(`${a}?adjustmentId=${e}`);
27
- },
28
- async readStockAdjustment(e, n, a) {
29
- const r = s.currentLocationDBName, i = `${o.inventoryBackendUrl}/${r}/sku`;
30
- return await t.get(`${i}?skuId=${e}&start=${n}&end=${a}`);
31
- },
32
- async convertSku(e) {
33
- var i;
34
- const n = s.currentLocationDBName, a = `${o.inventoryBackendUrl}/${n}/sku/convert`;
35
- return (((i = u.currentBusiness.value) == null ? void 0 : i.menuVersion) ?? "") === "v3" ? await t.post(a, e) : await t.post(`${a}?useInventoryDoc=true`, e);
36
- },
37
- async adjustSku(e) {
38
- var i;
39
- const n = s.currentLocationDBName, a = `${o.inventoryBackendUrl}/${n}/sku/adjust`;
40
- return (((i = u.currentBusiness.value) == null ? void 0 : i.menuVersion) ?? "") === "v3" ? await t.post(a, e) : await t.post(`${a}?useInventoryDoc=true`, e);
41
- },
42
- recalculation: {
43
- getRecalculateAbility() {
44
- var r;
45
- const n = `business_${(r = u.currentBusiness.value) == null ? void 0 : r._id}`, a = `${o.inventoryBackendUrl}/${n}/stock/operations/recalculate`;
46
- return t.get(a);
47
- },
48
- startRecalculateTask() {
49
- var r;
50
- const n = `business_${(r = u.currentBusiness.value) == null ? void 0 : r._id}`, a = `${o.inventoryBackendUrl}/${n}/stock/operations/recalculate?refundFromPreviousAdjustment=true`;
51
- return t.post(a);
52
- }
53
- }
54
- };
55
- });
56
- function S() {
57
- return {
58
- stockBalance: {
59
- _id: "",
60
- items: []
61
- },
62
- productBalance: []
63
- };
64
- }
65
- const d = y(S()), I = () => {
66
- const o = $();
67
- return {
68
- // state
69
- get stockBalance() {
70
- return d.value.stockBalance;
71
- },
72
- set stockBalance(t) {
73
- d.value.stockBalance = t;
74
- },
75
- get productBalance() {
76
- return d.value.productBalance;
77
- },
78
- set productBalance(t) {
79
- d.value.productBalance = t;
80
- },
81
- // actions
82
- async readStockBalance() {
83
- this.stockBalance = await o.readStockBalance();
84
- },
85
- async readProductBalance() {
86
- this.productBalance = [];
87
- const t = B(), s = v({
88
- recipes: t.recipes,
89
- skus: t.skus,
90
- inventoryBindingMapping: {},
91
- stockBalance: this.stockBalance
92
- // silent: true
93
- });
94
- function u(c, e) {
95
- return Object.prototype.hasOwnProperty.call(c, e);
96
- }
97
- for (const c in s.convertCountdown)
98
- if (u(s.convertCountdown, c)) {
99
- const e = s.convertCountdown[c];
100
- this.productBalance.push({
101
- id: c,
102
- count: e
103
- });
104
- }
105
- }
106
- };
107
- };
108
- export {
109
- $ as a,
110
- I as u
111
- };
@@ -1,77 +0,0 @@
1
- import { k as m, u, i as y, t as b, v } from "./app-BXjk74IB.js";
2
- import { useCoreStore as c } from "@feedmepos/mf-common";
3
- import { defineStore as w } from "pinia";
4
- import { ref as l, computed as d } from "vue";
5
- const a = m((s, p) => {
6
- function i() {
7
- var o;
8
- const t = c(), e = u(), r = e.businessLevel, n = `business_${((o = t.currentBusiness.value) == null ? void 0 : o._id) ?? ""}`, S = e.currentLocation.dbName;
9
- return r ? n : S;
10
- }
11
- return {
12
- async readSuppliers() {
13
- const t = i(), e = `${s.inventoryBackendUrl}/${t}/supplier`;
14
- return await p.get(e);
15
- },
16
- async readLocationSuppliers() {
17
- const e = u().currentLocation.dbName, r = `${s.inventoryBackendUrl}/${e}/supplier`;
18
- return await p.get(r);
19
- },
20
- async readBusinessSuppliers() {
21
- var n;
22
- const e = `business_${((n = c().currentBusiness.value) == null ? void 0 : n._id) ?? ""}`, r = `${s.inventoryBackendUrl}/${e}/supplier`;
23
- return await p.get(r);
24
- },
25
- async createSupplier(t) {
26
- const e = i(), r = `${s.inventoryBackendUrl}/${e}/supplier`;
27
- return await p.post(r, t);
28
- },
29
- async importSuppliers(t) {
30
- const e = i(), r = `${s.inventoryBackendUrl}/${e}/supplier/import`;
31
- return await p.post(r, t);
32
- },
33
- async updateSupplier(t) {
34
- const e = i(), r = `${s.inventoryBackendUrl}/${e}/supplier`;
35
- return await p.put(r, t);
36
- },
37
- async deleteSupplier(t) {
38
- const e = i(), r = `${s.inventoryBackendUrl}/${e}/supplier`;
39
- return await p.delete(r, t);
40
- }
41
- };
42
- }), f = w("supplier", () => {
43
- const s = l(new Array()), p = l(new Array()), i = d(() => [...s.value, ...p.value]), t = d(() => y(i.value, "_id"));
44
- return {
45
- async readSuppliers() {
46
- const e = a();
47
- s.value = await e.readLocationSuppliers(), p.value = await e.readBusinessSuppliers();
48
- },
49
- async createSupplier(e) {
50
- await a().createSupplier(e);
51
- },
52
- async updateSupplier(e) {
53
- await a().updateSupplier(e);
54
- },
55
- async deleteSupplier(e) {
56
- await a().deleteSupplier(e);
57
- },
58
- async importSuppliers(e) {
59
- await a().importSuppliers(e);
60
- },
61
- async init() {
62
- const e = b();
63
- try {
64
- await this.readSuppliers();
65
- } catch (r) {
66
- throw r instanceof v || e.error("Error at reading suppliers"), r;
67
- }
68
- },
69
- suppliers: i,
70
- locationSuppliers: s,
71
- businessSuppliers: p,
72
- supplierById: t
73
- };
74
- });
75
- export {
76
- f as u
77
- };