enhance: add membership total view in member

This commit is contained in:
Julian Krauser 2025-05-30 15:13:50 +02:00
parent 0defc9b0ba
commit ec0222ff2f
3 changed files with 37 additions and 4 deletions

View file

@ -25,9 +25,15 @@
<label for="birthdate">Geburtsdatum</label>
<input type="date" id="birthdate" :value="activeMemberObj.birthdate" readonly />
</div>
<div v-if="membershipStatistics.length != 0">
<div v-if="membershipStatistics.length != 0 || totalMembershipStatistics != undefined">
<p>Statistiken zur Mitgliedschaft</p>
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
<div class="flex flex-col h-fit w-full rounded-md overflow-hidden">
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
<p>
gesamt {{ totalMembershipStatistics.durationInDays }} Tage
<span class="whitespace-nowrap"> ~> {{ totalMembershipStatistics.exactDuration }}</span>
</p>
</div>
<div
v-for="stat in membershipStatistics"
class="bg-primary p-2 text-white flex flex-row justify-between items-center"
@ -149,16 +155,20 @@ export default defineComponent({
},
computed: {
...mapState(useMemberStore, ["activeMemberObj", "activeMemberStatistics", "loadingActive"]),
...mapState(useMembershipStore, ["membershipStatistics"]),
...mapState(useMembershipStore, ["membershipStatistics", "totalMembershipStatistics"]),
},
mounted() {
this.fetchMemberByActiveId();
this.fetchMemberStatisticsByActiveId();
this.fetchMembershipStatisticsForMember();
this.fetchMembershipTotalStatisticsForMember();
},
methods: {
...mapActions(useMemberStore, ["fetchMemberByActiveId", "fetchMemberStatisticsByActiveId"]),
...mapActions(useMembershipStore, ["fetchMembershipStatisticsForMember"]),
...mapActions(useMembershipStore, [
"fetchMembershipStatisticsForMember",
"fetchMembershipTotalStatisticsForMember",
]),
},
});
</script>