release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
5 changed files with 66 additions and 35 deletions
Showing only changes of commit 006e7e4048 - Show all commits

View File

@ -1,6 +1,6 @@
<template> <template>
<q-card> <q-card>
<BalanceHeader @update:user="userUpdated" :showSelector="showSelector" /> <BalanceHeader @update:user="userUpdated" :showSelector="showSelector" @open-history="openHistory"/>
<q-separator /> <q-separator />
<q-card-section class="row q-col-gutter-md" v-if="shortCuts"> <q-card-section class="row q-col-gutter-md" v-if="shortCuts">
@ -67,7 +67,7 @@ import PERMISSIONS from '../permissions';
export default defineComponent({ export default defineComponent({
name: 'BalanceAdd', name: 'BalanceAdd',
components: { BalanceHeader }, components: { BalanceHeader },
setup(_, { root }) { setup(_, { root, emit }) {
onBeforeMount(() => { onBeforeMount(() => {
void store.dispatch('balance/getShortcuts'); void store.dispatch('balance/getShortcuts');
if (store.state.balance.transactions.length == 0) if (store.state.balance.transactions.length == 0)
@ -103,6 +103,10 @@ export default defineComponent({
.catch(err => console.log(err)); .catch(err => console.log(err));
} }
function openHistory() {
emit('open-history')
}
return { return {
user, user,
addShortcut, addShortcut,
@ -113,7 +117,8 @@ export default defineComponent({
amount, amount,
showSelector, showSelector,
shortCuts, shortCuts,
userUpdated userUpdated,
openHistory
}; };
} }
}); });

View File

@ -1,12 +1,15 @@
<template> <template>
<q-card-section class="fit row justify-left content-center items-center q-col-gutter-sm"> <q-card-section class="fit row justify-left content-center items-center q-col-gutter-sm">
<div class="text-h6 col-6"> <div class="text-h6 col-5">
Aktueller Stand: {{ balance.balance.toFixed(2) }} Aktueller Stand: {{ balance.balance.toFixed(2) }}
<q-badge color="negative" align="top" v-if="isLocked"> gesperrt </q-badge> <q-badge color="negative" align="top" v-if="isLocked"> gesperrt </q-badge>
</div> </div>
<div v-if="showSelector" class="col-6"> <div v-if="showSelector" class="col-6">
<UserSelector :user="user" @update:user="userUpdated" /> <UserSelector :user="user" @update:user="userUpdated" />
</div> </div>
<div class="col-1 justify-end">
<q-btn round flat icon="mdi-format-list-checks" @click="openHistory" />
</div>
</q-card-section> </q-card-section>
</template> </template>
@ -43,7 +46,11 @@ export default defineComponent({
emit('update:user', selectedUser); emit('update:user', selectedUser);
} }
return { user, balance, isLocked, userUpdated }; function openHistory() {
emit('open-history');
}
return { user, balance, isLocked, userUpdated, openHistory };
} }
}); });
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<q-card> <q-card>
<BalanceHeader @update:user="senderUpdated" :showSelector="showSelector" /> <BalanceHeader @update:user="senderUpdated" :showSelector="showSelector" @open-history="openHistory"/>
<q-separator /> <q-separator />
<q-card-section class="row q-col-gutter-md items-center"> <q-card-section class="row q-col-gutter-md items-center">
<div class="col-sm-4 col-xs-12"> <div class="col-sm-4 col-xs-12">
@ -34,7 +34,7 @@ import PERMISSIONS from '../permissions';
export default defineComponent({ export default defineComponent({
name: 'BalanceTransfer', name: 'BalanceTransfer',
components: { BalanceHeader, UserSelector }, components: { BalanceHeader, UserSelector },
setup(_, { root }) { setup(_, { root, emit }) {
const store: Store<StateInterfaceBalance> = <Store<StateInterfaceBalance>>root.$store; const store: Store<StateInterfaceBalance> = <Store<StateInterfaceBalance>>root.$store;
const showSelector = computed(() => hasPermission(PERMISSIONS.SEND_OTHER, store)); const showSelector = computed(() => hasPermission(PERMISSIONS.SEND_OTHER, store));
@ -69,6 +69,10 @@ export default defineComponent({
.catch(err => console.log(err)); .catch(err => console.log(err));
} }
function openHistory() {
emit('open-history');
}
return { return {
sender, sender,
receiver, receiver,
@ -77,7 +81,8 @@ export default defineComponent({
showSelector, showSelector,
senderUpdated, senderUpdated,
receiverUpdated, receiverUpdated,
sendDisabled sendDisabled,
openHistory
}; };
} }
}); });

View File

@ -1,29 +1,37 @@
<template> <template>
<q-card v-bind:class="{ 'bg-grey': isReversed }"> <div>
<q-card-section class="row items-start justify-between"> <q-card flat square>
<div class="col text-center"> <q-card-section class="row items-center justify-between" horizontal>
<div class="col-5 text-left q-px-sm">
<div <div
v-bind:class="{ 'text-negative': isNegative() }" v-bind:class="{ 'text-negative': isNegative() }"
class="text-weight-bold" class="text-weight-bold text-h6"
style="font-size: 2em"
> >
<span v-if="isNegative()">-</span>{{ transaction.amount.toFixed(2) }}&#8239; <span v-if="isNegative()">-</span>{{ transaction.amount.toFixed(2) }}&#8239;
</div> </div>
<div>{{ text }}</div> <div class="text-caption">{{ text }}</div>
<div>{{ timeStr }}</div> <div class="text-caption">{{ timeStr }}</div>
</div> </div>
<div class="col" style="text-align: right"> <div class="col-5 q-px-sm text-center">
<div class="text-subtitle1" v-if="isReversed">
Storniert
</div>
</div>
<div class="col-2 q-pr-sm" style="text-align: right">
<q-btn <q-btn
color="negative" :color="isReversed ? 'positive' : 'negative'"
aria-label="Reverse transaction" aria-label="Reverse transaction"
icon="mdi-trash-can" :icon="!isReversed ? 'mdi-trash-can' : 'mdi-check-bold'"
square size="sm"
round
:disable="!canReverse" :disable="!canReverse"
@click="reverse" @click="reverse"
/> />
</div> </div>
</q-card-section> </q-card-section>
</q-card> </q-card>
<q-separator />
</div>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@ -9,10 +9,10 @@
/> />
</q-tabs> </q-tabs>
<div class="fit row justify-end" v-else> <div class="fit row justify-end" v-else>
<q-btn flat round icon="mdi-menu" @click="showDrawer = !showDrawer" /> <q-btn flat round icon="mdi-menu" @click="showDrawer = !showDrawer; show = false" />
</div> </div>
<q-drawer side="right" v-model="showDrawer" @click="showDrawer = !showDrawer" behavior="mobile"> <q-drawer side="right" v-model="showDrawer" @click="showDrawer = !showDrawer" behavior="mobile">
<q-list v-model="tab"> <q-list v-model="tab" v-if="!$q.screen.gt.sm && !show">
<q-item <q-item
v-for="(tabindex, index) in tabs" v-for="(tabindex, index) in tabs"
:key="'tab' + index" :key="'tab' + index"
@ -23,6 +23,16 @@
<q-item-label>{{ tabindex.label }}</q-item-label> <q-item-label>{{ tabindex.label }}</q-item-label>
</q-item> </q-item>
</q-list> </q-list>
<q-list v-if="show">
<div
v-for="(transaction, index) in transactions"
v-bind:key="index"
class="col-sm-12"
>
<!-- TODO: In Vue3 use v-model:transaction="..." -->
<Transaction :transaction.sync="transactions[index]" />
</div>
</q-list>
</q-drawer> </q-drawer>
<q-page padding class="fit row justify-left q-col-gutter-sm"> <q-page padding class="fit row justify-left q-col-gutter-sm">
<q-tab-panels <q-tab-panels
@ -32,26 +42,18 @@
animated animated
> >
<q-tab-panel name="add" class="q-px-xs"> <q-tab-panel name="add" class="q-px-xs">
<BalanceAdd /> <BalanceAdd @open-history="showDrawer = !showDrawer; show = showDrawer"/>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="transfer" class="q-px-xs"> <q-tab-panel name="transfer" class="q-px-xs">
<BalanceTransfer /> <BalanceTransfer @open-history="showDrawer = !showDrawer; show = showDrawer"/>
</q-tab-panel> </q-tab-panel>
</q-tab-panels> </q-tab-panels>
<div
v-for="(transaction, index) in transactions"
v-bind:key="index"
class="col-md-4 col-sm-6"
>
<!-- TODO: In Vue3 use v-model:transaction="..." -->
<Transaction :transaction.sync="transactions[index]" />
</div>
</q-page> </q-page>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, defineComponent, ref } from '@vue/composition-api'; import { computed, defineComponent, ref, onMounted } from '@vue/composition-api';
import { Store } from 'vuex'; import { Store } from 'vuex';
import { hasPermissions, hasSomePermissions } from 'src/utils/permission'; import { hasPermissions, hasSomePermissions } from 'src/utils/permission';
import PERMISSIONS from '../permissions'; import PERMISSIONS from '../permissions';
@ -66,7 +68,10 @@ export default defineComponent({
components: { BalanceAdd, BalanceTransfer, Transaction }, components: { BalanceAdd, BalanceTransfer, Transaction },
setup(_, { root }) { setup(_, { root }) {
const store = <Store<StateInterfaceBalance>>root.$store; const store = <Store<StateInterfaceBalance>>root.$store;
const now = new Date()
onMounted(() => {
store.dispatch('balance/getTransactions', {filter: {from: new Date(now.getFullYear(), now.getMonth(), now.getDay())}})
})
const transactions = computed(() => const transactions = computed(() =>
store.state.balance.transactions store.state.balance.transactions
.filter(t => t.original_id == undefined) .filter(t => t.original_id == undefined)
@ -100,12 +105,13 @@ export default defineComponent({
}); });
const tab = ref<string>(canAdd() ? 'add' : 'transfer'); const tab = ref<string>(canAdd() ? 'add' : 'transfer');
const show = ref<boolean>(false);
return { return {
showDrawer, showDrawer,
tab, tab,
tabs, tabs,
transactions transactions,
show
}; };
} }
}); });