Show the selected month for the total hour view

This commit is contained in:
Niko Reunanen 2025-03-01 11:20:39 +02:00
parent 6498a181c8
commit 4a9890496a
Signed by: nreunane
GPG key ID: D192625387DB0F16

View file

@ -8,10 +8,12 @@ import { inject, ref } from "vue";
const modalTotalHours = ref<{ const modalTotalHours = ref<{
hours: { [project: string]: number }; hours: { [project: string]: number };
period: string;
total: number; total: number;
visible: boolean; visible: boolean;
}>({ }>({
hours: {}, hours: {},
period: "",
total: 0, total: 0,
visible: false, visible: false,
}); });
@ -35,7 +37,7 @@ async function showModalTotalHours() {
const response = await pb.send(`/hours/${organisation}/${year}/${monthDoubleDigit}`, {}); const response = await pb.send(`/hours/${organisation}/${year}/${monthDoubleDigit}`, {});
console.log(response); modalTotalHours.value.period = `${monthDoubleDigit}/${year}`;
if (response.error === null) { if (response.error === null) {
let total = 0.0; let total = 0.0;
@ -57,7 +59,7 @@ async function showModalTotalHours() {
<DatePicker v-model="selectedDate" style="width: 150px; margin-left: 3px;" /> <DatePicker v-model="selectedDate" style="width: 150px; margin-left: 3px;" />
<Button label=">" @click="setDate(1)" style="margin-left: 3px;" /> <Button label=">" @click="setDate(1)" style="margin-left: 3px;" />
<Button label="total hours" @click="showModalTotalHours" style="margin-left: 20px;" /> <Button label="total hours" @click="showModalTotalHours" style="margin-left: 20px;" />
<Dialog v-model:visible="modalTotalHours.visible" modal header="Total hours"> <Dialog v-model:visible="modalTotalHours.visible" modal :header="`Total hours for ${modalTotalHours.period}`">
<table style="width: 100%; border-collapse: collapse; border: 1px solid #ccc; font-family: Arial, sans-serif; font-size: 14px;"> <table style="width: 100%; border-collapse: collapse; border: 1px solid #ccc; font-family: Arial, sans-serif; font-size: 14px;">
<tbody> <tbody>
<tr v-for="project in Object.keys(modalTotalHours.hours)"> <tr v-for="project in Object.keys(modalTotalHours.hours)">