diff --git a/src/pages/BalanceAdminPage.vue b/src/pages/BalanceAdminPage.vue
index 8ada183..4b756aa 100644
--- a/src/pages/BalanceAdminPage.vue
+++ b/src/pages/BalanceAdminPage.vue
@@ -15,7 +15,17 @@
-
+
+
+
+
+
@@ -35,10 +45,14 @@
buttons
label-cancel="Abbrechen"
label-set="Speichern"
- @save="setLimit(props.row.userid)"
+ @save="setLimit($event, props.row.userid)"
@cancel="limit = undefined"
>
-
+
+
+
+
+
@@ -62,7 +76,7 @@
@@ -115,6 +129,7 @@ export default defineComponent({
const rows = computed(() => store.balances);
const limit = ref();
+ const sign = ref<'+' | '-'>('-');
const filter = ref();
const columns = [
@@ -222,13 +237,12 @@ export default defineComponent({
}
}
- function setLimit(userid: string) {
- setTimeout(() => {
- void store.setLimit(limit.value, userid);
- }, 50);
- setTimeout(() => {
- limit.value = undefined;
- }, 100);
+ async function setLimit(l: number, userid: string) {
+ if (sign.value === '-') {
+ l = -l;
+ }
+ await store.setLimit(l, userid);
+ limit.value = undefined;
}
function getFirstname(userid: string) {
@@ -239,12 +253,23 @@ export default defineComponent({
return userStore.users.find((a) => a.userid === userid)?.lastname;
}
+ function changeSign() {
+ sign.value = sign.value === '+' ? '-' : '+';
+ }
+
+ function setLimits(l: number) {
+ if (sign.value === '-') {
+ l = -l;
+ }
+ void store.setLimits(l);
+ }
+
const tab = ref('add');
return {
rows,
columns,
limit,
- setLimits: (l: number) => store.setLimits(l),
+ setLimits,
getName,
getLimit,
setLimit,
@@ -258,6 +283,8 @@ export default defineComponent({
getLastname,
filter,
showMenu,
+ sign,
+ changeSign,
};
},
});