[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

@ -18,8 +18,8 @@
</q-menu> </q-menu>
<q-tooltip> Rechtsklick um Verknüpfung zu entfernen </q-tooltip> <q-tooltip> Rechtsklick um Verknüpfung zu entfernen </q-tooltip>
</q-btn> </q-btn>
</div></q-card-section </div>
> </q-card-section>
<q-card-section class="row q-col-gutter-md items-center"> <q-card-section class="row q-col-gutter-md items-center">
<balance-add-body :user="user" /> <balance-add-body :user="user" />
</q-card-section> </q-card-section>

View File

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

View File

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