[balance] show history of last 3hours

This commit is contained in:
Tim Gröger 2021-04-18 10:43:22 +02:00
parent 7395b1f288
commit ea01742e00
3 changed files with 13 additions and 10 deletions

View File

@ -16,10 +16,10 @@
<q-menu anchor="bottom middle" self="top middle" context-menu>
<q-btn label="Entfernen" @click="removeShortcut(shortcut)" />
</q-menu>
<q-tooltip>Rechtsklick um Verknüpfung zu entfernen</q-tooltip>
<q-tooltip> Rechtsklick um Verknüpfung zu entfernen </q-tooltip>
</q-btn>
</div></q-card-section
>
</div>
</q-card-section>
<q-card-section class="row q-col-gutter-md items-center">
<balance-add-body :user="user" />
</q-card-section>

View File

@ -45,7 +45,7 @@
</q-td>
<q-td key="balance" :props="props">
{{ getBalance(props.row.debit, props.row.credit) }}
<q-menu anchor="bottom middle" self="top middle" :persistent='$q.platform.is.mobile'>
<q-menu anchor="bottom middle" self="top middle" :persistent="$q.platform.is.mobile">
<q-card>
<q-card-section>
<q-tab-panels v-model="tab" animated>
@ -64,8 +64,8 @@
</q-tab-panel>
</q-tab-panels>
</q-card-section>
<div v-if='$q.platform.is.mobile' class='full-width row justify-center'>
<q-btn label='Abbrechen' v-close-popup flat color='primary'/>
<div v-if="$q.platform.is.mobile" class="full-width row justify-center">
<q-btn v-close-popup label="Abbrechen" flat color="primary" />
</div>
<q-tabs
v-model="tab"

View File

@ -64,7 +64,7 @@
</template>
<script lang="ts">
import { computed, defineComponent, ref, onMounted } from 'vue';
import { computed, defineComponent, ref, onBeforeMount } from 'vue';
import { hasSomePermissions } from 'src/utils/permission';
import PERMISSIONS from '../permissions';
import BalanceAdd from '../components/BalanceAdd.vue';
@ -81,16 +81,19 @@ export default defineComponent({
const mainStore = useMainStore();
const now = new Date();
onMounted(() => {
onBeforeMount(() => {
void balanceStore.getTransactions(mainStore.currentUser, {
from: new Date(now.getFullYear(), now.getMonth(), now.getDate()),
from: new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours() - 3),
});
});
const transactions = computed(() => {
return balanceStore.transactions
.filter((t) => t.original_id == undefined)
.filter((t) => t.time > new Date(now.getFullYear(), now.getMonth(), now.getDate()))
.filter(
(t) =>
t.time > new Date(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours() - 3)
)
.sort((a, b) => (a.time >= b.time ? -1 : 1));
});