- Aktueller Stand: {{ balance.balance.toFixed(2) }} €
+ Aktueller Stand: {{ balance.balance?.toFixed(2) }} €
gesperrt
diff --git a/src/plugins/balance/pages/Admin.vue b/src/plugins/balance/pages/Admin.vue
index 517e442..398c3ac 100644
--- a/src/plugins/balance/pages/Admin.vue
+++ b/src/plugins/balance/pages/Admin.vue
@@ -16,6 +16,24 @@
+
+
+
+ {{ getName(props.row.userid) }}
+
+ {{ getLimit(props.row.userid) }}€
+
+ {{ getBalance(props.row.debit, props.row.credit) }}€
+
+
+
+
+
+
+
+
+
+
@@ -27,8 +45,10 @@
import { ref, defineComponent, computed, onBeforeMount } from 'vue';
import { useBalanceStore } from '../store';
import { useUserStore } from 'src/plugins/user/store';
+import BalanceAddBody from 'src/plugins/balance/components/BalanceAddBody.vue';
export default defineComponent({
+ components: { BalanceAddBody },
// name: 'PageName'
setup() {
const store = useBalanceStore();
@@ -51,7 +71,7 @@ export default defineComponent({
required: true,
align: 'left',
sortable: true,
- format: (val: string) => userStore.users.find((a) => a.userid === val)?.display_name,
+ format: getName,
},
/*{
name: 'credit',
@@ -68,18 +88,44 @@ export default defineComponent({
{
name: 'limit',
label: 'Limit',
- format: (_: undefined, row: { userid: string }) =>
- store.user_limits.find((a) => a.userid === row.userid)?.limit?.toFixed(2),
+ align: 'right',
+ format: (_: undefined, row: { userid: string }) => getLimit(row.userid),
},
{
name: 'balance',
label: 'Kontostand',
+ align: 'right',
format: (_: undefined, row: { debit: number; credit: number }) =>
- (row.credit - row.debit).toFixed(2),
+ getBalance(row.debit, row.credit),
},
];
- return { rows, columns, limit, setLimits: store.setLimits };
+ function getName(val: string) {
+ return userStore.users.find((a) => a.userid === val)?.display_name;
+ }
+
+ function getLimit(val: string) {
+ return store.user_limits.find((a) => a.userid === val)?.limit?.toFixed(2);
+ }
+
+ function getBalance(debit: number, credit: number) {
+ return (credit - debit).toFixed(2);
+ }
+
+ function updateBalance(user: FG.User) {
+ void store.getBalance(user);
+ }
+
+ return {
+ rows,
+ columns,
+ limit,
+ setLimits: store.setLimits,
+ getName,
+ getLimit,
+ getBalance,
+ updateBalance,
+ };
},
});