From a1a8285a3698920834fab041581a90b035619a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Tue, 29 Jun 2021 11:42:10 +0200 Subject: [PATCH] update balance from last local commit 3b185e677ca6055bfb9ad7d9a6ed2e0deca66725 --- package.json | 7 +- src/api.d.ts | 20 +-- src/components/BalanceAdd.vue | 63 ++------- src/components/BalanceAddBody.vue | 82 +++++++++++ src/components/BalanceHeader.vue | 2 +- src/components/BalanceTransfer.vue | 50 ++----- src/components/BalanceTransferBody.vue | 81 +++++++++++ src/pages/Admin.vue | 187 ++++++++++++++++++++++--- src/pages/Overview.vue | 54 ++++--- src/store.ts | 60 +++++--- 10 files changed, 435 insertions(+), 171 deletions(-) create mode 100644 src/components/BalanceAddBody.vue create mode 100644 src/components/BalanceTransferBody.vue diff --git a/package.json b/package.json index 7d13a58..ee2c89c 100644 --- a/package.json +++ b/package.json @@ -20,16 +20,16 @@ }, "devDependencies": { "@flaschengeist/types": "^1.0.0-alpha.1", - "@quasar/app": "^3.0.0-beta.25", + "@quasar/app": "^3.0.0", "@typescript-eslint/eslint-plugin": "^4.24.0", "@typescript-eslint/parser": "^4.24.0", "axios": "^0.21.1", "eslint": "^7.26.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-vue": "^7.9.0", - "pinia": "^2.0.0-alpha.19", + "pinia": "^2.0.0-beta.3", "prettier": "^2.3.0", - "quasar": "^2.0.0-beta.18", + "quasar": "^2.0.0", "typescript": "^4.2.4" }, "peerDependencies": { @@ -43,4 +43,3 @@ "arrowParens": "always" } } - \ No newline at end of file diff --git a/src/api.d.ts b/src/api.d.ts index 5170819..5e497ca 100644 --- a/src/api.d.ts +++ b/src/api.d.ts @@ -1,12 +1,12 @@ declare namespace FG { - interface Transaction { - id: number; - time: Date; - amount: number; - reversal_id?: number; - author_id?: string; - sender_id?: string; - original_id?: number; - receiver_id?: string; - } + interface Transaction { + id: number; + time: Date; + amount: number; + reversal_id?: number; + author_id?: string; + sender_id?: string; + original_id?: number; + receiver_id?: string; + } } diff --git a/src/components/BalanceAdd.vue b/src/components/BalanceAdd.vue index ef17e10..fd4e5de 100644 --- a/src/components/BalanceAdd.vue +++ b/src/components/BalanceAdd.vue @@ -13,45 +13,15 @@ :label="shortcut.toFixed(2).toString() + ' €'" @click="changeBalance(shortcut)" > - + - - Rechtsklick um Verknüpfung zu entfernen + + Rechtsklick um Verknüpfung zu entfernen - + + -
- -
-
- Rechtsklick um Betrag als Verknüpfung hinzuzufügen - - - - -
-
- -
+
@@ -60,12 +30,13 @@ import { computed, ref, defineComponent, onBeforeMount } from 'vue'; import { hasPermission, useMainStore } from '@flaschengeist/api'; import BalanceHeader from '../components/BalanceHeader.vue'; +import BalanceAddBody from '../components/BalanceAddBody.vue'; import PERMISSIONS from '../permissions'; import { useBalanceStore } from '../store'; export default defineComponent({ name: 'BalanceAdd', - components: { BalanceHeader }, + components: { BalanceHeader, BalanceAddBody }, emits: { 'open-history': () => true }, setup(_, { emit }) { const store = useBalanceStore(); @@ -75,39 +46,29 @@ export default defineComponent({ void store.getShortcuts(); }); - const amount = ref(0); - const showAddShortcut = ref(false); const user = ref(mainStore.currentUser); const shortCuts = computed(() => store.shortcuts); - const canAddCredit = hasPermission(PERMISSIONS.CREDIT); const showSelector = hasPermission(PERMISSIONS.DEBIT) || hasPermission(PERMISSIONS.CREDIT); - function addShortcut() { - if (amount.value != 0) void store.createShortcut(amount.value * -1); - } function removeShortcut(shortcut: number) { void store.removeShortcut(shortcut); } - async function changeBalance(amount: number) { - await store.changeBalance(amount, user.value); - } function openHistory() { emit('open-history'); } + async function changeBalance(amount: number) { + await store.changeBalance(amount, user.value); + } return { user, - addShortcut, - canAddCredit, removeShortcut, - showAddShortcut, - changeBalance, - amount, showSelector, shortCuts, openHistory, + changeBalance, }; }, }); diff --git a/src/components/BalanceAddBody.vue b/src/components/BalanceAddBody.vue new file mode 100644 index 0000000..f89afd2 --- /dev/null +++ b/src/components/BalanceAddBody.vue @@ -0,0 +1,82 @@ + + + + diff --git a/src/components/BalanceHeader.vue b/src/components/BalanceHeader.vue index 7a6a5b5..c38f8db 100644 --- a/src/components/BalanceHeader.vue +++ b/src/components/BalanceHeader.vue @@ -2,7 +2,7 @@
- Aktueller Stand: {{ balance.balance.toFixed(2) }} € + Aktueller Stand: {{ balance.balance ? balance.balance.toFixed(2) : "" }} € gesperrt
diff --git a/src/components/BalanceTransfer.vue b/src/components/BalanceTransfer.vue index d4429b8..1499fb1 100644 --- a/src/components/BalanceTransfer.vue +++ b/src/components/BalanceTransfer.vue @@ -1,60 +1,30 @@ + + diff --git a/src/pages/Admin.vue b/src/pages/Admin.vue index eeab423..d4970cc 100644 --- a/src/pages/Admin.vue +++ b/src/pages/Admin.vue @@ -1,11 +1,90 @@ @@ -13,17 +92,27 @@ diff --git a/src/pages/Overview.vue b/src/pages/Overview.vue index fc421dd..2797f43 100644 --- a/src/pages/Overview.vue +++ b/src/pages/Overview.vue @@ -17,8 +17,12 @@ binary-state-sort @request="onRequest" > -