separaded endpoints + cleaned page templates + added constants to time formatting
Some checks failed
Tests / Run Go Tests (push) Failing after 1m34s

This commit is contained in:
2025-10-27 22:53:07 +01:00
parent e1f0f85401
commit a634b7a69e
26 changed files with 654 additions and 639 deletions

View File

@@ -3,6 +3,7 @@ package templates
import (
"arbeitszeitmessung/helper"
"arbeitszeitmessung/models"
"fmt"
"time"
)
@@ -10,33 +11,44 @@ templ PDFForm(teamMembers []models.User) {
@Base()
@headerComponent()
<div class="grid-main divide-y-1">
<div class="grid-sub divide-x-1">
<div>Zeitraum wählen</div>
<div class="grid-cell col-span-full bg-neutral-300">
<h1 class="text-xl uppercase font-bold">PDF Abrechnung erstellen</h1>
</div>
<div class="grid-sub divide-x-1 responsive">
<div class="grid-cell">Zeitraum wählen</div>
<div class="grid-cell col-span-3">
<label class="block mb-1 text-sm text-neutral-700">Abrechnungsmonat</label>
<input name="start_date" type="date" value="" class="btn bg-neutral-100"/>
</div>
<div></div>
</div>
<div class="grid-sub divide-x-1">
<div>Mitarbeiter wählen</div>
<div class="grid-sub divide-x-1 responsive">
<div class="grid-cell">Mitarbeiter wählen</div>
<div class="grid-cell col-span-3 flex flex-col gap-2">
<div class="flex flex-row gap-2">
<button class="btn" type="button">Alle</button>
<button class="btn" type="button">Keine</button>
<button class="btn" type="button" onclick={ templ.JSFuncCall("checkAll", "pdf-", templ.JSExpression("true")) }>Alle</button>
<button class="btn" type="button" onclick={ templ.JSFuncCall("checkAll", "pdf-", templ.JSExpression("false")) }>Keine</button>
</div>
@CheckboxComponent("pdf-123", "Kim Mustermensch")
for _, member := range teamMembers {
@CheckboxComponent(fmt.Sprintf("pdf-%d", member.PersonalNummer), fmt.Sprintf("%s %s", member.Vorname, member.Name))
}
</div>
<div></div>
</div>
<div class="grid-sub divide-x-1"><div>Direktvorschau oder Download</div></div>
<div class="grid-sub divide-x-1 responsive">
<div class="grid-cell">Direktvorschau oder Download</div>
<div class="grid-cell col-span-3 flex gap-2 flex-col md:flex-row">
<button class="btn" type="button" name="action" value="download">Download</button>
<button class="btn" type="button" name="action" value="preview" onclick="">Vorschau</button>
</div>
</div>
</div>
}
templ CheckboxComponent(id, label string) {
<div class="inline-flex items-center">
<label class="flex items-center cursor-pointer relative" for={ id }>
<input type="checkbox" checked="" class="peer h-5 w-5 cursor-pointer transition-all appearance-none rounded border border-slate-300 checked:bg-slate-800 checked:border-slate-800" id={ id }/>
<input type="checkbox" class="peer h-5 w-5 cursor-pointer transition-all appearance-none rounded border border-slate-800 checked:bg-slate-800 checked:border-slate-800" id={ id }/>
<span class="absolute text-white opacity-0 peer-checked:opacity-100 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-3.5 w-3.5" viewBox="0 0 20 20" fill="currentColor" stroke="currentColor" stroke-width="1">
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"></path>