(admin) avoid empty strings in timesheets

This commit is contained in:
Andrea Vos 2025-06-29 12:33:46 +02:00
parent efcd383c1a
commit 746ec76a3f
2 changed files with 5 additions and 4 deletions

View File

@ -153,7 +153,7 @@ const sumCells = (area: typeof areas[number] | undefined, month: keyof typeof mo
<template> <template>
<Page wide> <Page wide>
<NotFound v-if="!$isGranted('panel') && !$isGranted('external')" /> <NotFound v-if="!$isGranted('panel') && !$isGranted('external')" />
<div v-else> <form @submit="save" v-else>
<p class="d-flex justify-content-between"> <p class="d-flex justify-content-between">
<nuxt-link to="/admin"> <nuxt-link to="/admin">
<Icon v="user-cog" /> <Icon v="user-cog" />
@ -212,6 +212,7 @@ const sumCells = (area: typeof areas[number] | undefined, month: keyof typeof mo
class="form-control form-control-sm" class="form-control form-control-sm"
style="min-width: 3rem" style="min-width: 3rem"
:disabled="dt(year, +m) < closed || dt(year, +m) > max" :disabled="dt(year, +m) < closed || dt(year, +m) > max"
required
@focus="focusMonth = m;focusArea = areas.indexOf(area)" @focus="focusMonth = m;focusArea = areas.indexOf(area)"
@keydown="cellKeydown" @keydown="cellKeydown"
> >
@ -289,10 +290,10 @@ const sumCells = (area: typeof areas[number] | undefined, month: keyof typeof mo
<input id="notes" v-model="transferDetails.notes" type="text" class="form-control" placeholder=""> <input id="notes" v-model="transferDetails.notes" type="text" class="form-control" placeholder="">
</div> </div>
</section> </section>
<button type="button" class="btn btn-primary" :disabled="!transferMethod" @click="save"> <button type="submit" class="btn btn-primary" :disabled="!transferMethod">
<Icon v="save" /> <Icon v="save" />
Save Save
</button> </button>
</div> </form>
</Page> </Page>
</template> </template>

View File

@ -46,7 +46,7 @@ const hoursSummary = computed((): Record<string, number> => {
continue; continue;
} }
for (const h of Object.values(timesheet[parseInt(year)][month])) { for (const h of Object.values(timesheet[parseInt(year)][month])) {
hours += h; hours += parseInt(h as any);
} }
} }
} }