diff --git a/src/plugins/balance/pages/Admin.vue b/src/plugins/balance/pages/Admin.vue
index 3e770d8..517e442 100644
--- a/src/plugins/balance/pages/Admin.vue
+++ b/src/plugins/balance/pages/Admin.vue
@@ -1,11 +1,22 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -13,17 +24,24 @@
diff --git a/src/plugins/balance/store.ts b/src/plugins/balance/store.ts
index 3e328ed..4a11fbc 100644
--- a/src/plugins/balance/store.ts
+++ b/src/plugins/balance/store.ts
@@ -16,10 +16,16 @@ export interface TransactionsResponse {
count?: number;
}
+export interface UserLimit {
+ userid: string;
+ limit?: number;
+}
+
import { defineStore } from 'pinia';
import { useMainStore } from 'src/stores';
import { AxiosResponse } from 'axios';
import { Notify } from 'quasar';
+import { useUserStore } from 'src/plugins/user/store';
function fixTransaction(t: FG.Transaction) {
t.time = new Date(t.time);
@@ -33,6 +39,7 @@ export const useBalanceStore = defineStore({
shortcuts: [] as number[],
transactions: [] as FG.Transaction[],
_balances_dirty: 0,
+ user_limits: [] as Array,
}),
getters: {
@@ -163,5 +170,22 @@ export const useBalanceStore = defineStore({
}
this._balances_dirty = 0;
},
+
+ async getLimits() {
+ const { data } = await api.get>('users/balance/limit');
+ this.user_limits = data;
+ },
+
+ async setLimits(limit: number) {
+ await api.put('users/balance/limit', { limit });
+ useUserStore().users.forEach((user) => {
+ const user_limit = this.user_limits.find((a) => a.userid === user.userid);
+ if (user_limit) {
+ user_limit.limit = limit;
+ } else {
+ this.user_limits.push({ userid: user.userid, limit });
+ }
+ });
+ },
},
});