[balance] sortable balance in adminpage

This commit is contained in:
Tim Gröger 2021-04-18 11:20:46 +02:00
parent ea01742e00
commit d2044975db
1 changed files with 13 additions and 0 deletions

View File

@ -140,14 +140,27 @@ export default defineComponent({
name: 'limit',
label: 'Limit',
align: 'right',
field: 'userid',
format: (_: undefined, row: { userid: string }) => getLimit(row.userid),
},
{
name: 'balance',
label: 'Kontostand',
align: 'right',
field: 'userid',
format: (_: undefined, row: { debit: number; credit: number }) =>
getBalance(row.debit, row.credit),
sortable: true,
sort: (
_: undefined,
__: undefined,
a: { debit: number; credit: number },
b: { debit: number; credit: number }
) => {
return (
parseFloat(getBalance(a.debit, a.credit)) - parseFloat(getBalance(b.debit, b.credit))
);
},
},
];