updated pdf form to send user to pdf generator
All checks were successful
Tests / Run Go Tests (push) Successful in 3m28s
Arbeitszeitmessung Deploy / Build Go Image and Upload (push) Successful in 4m24s

This commit is contained in:
2025-12-12 15:07:57 +01:00
parent c7f8595474
commit 0eb4878c90
10 changed files with 106 additions and 72 deletions

View File

@@ -10,7 +10,7 @@ import (
templ PDFForm(teamMembers []models.User) {
@Base()
@headerComponent()
<div class="grid-main divide-y-1">
<form class="grid-main divide-y-1" action="pdf/generate" method="get">
<div class="grid-cell col-span-full bg-neutral-300">
<h1 class="text-xl uppercase font-bold">PDF Abrechnung erstellen</h1>
</div>
@@ -18,7 +18,7 @@ templ PDFForm(teamMembers []models.User) {
<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"/>
<input name="start_date" type="date" value={ helper.GetFirstOfMonth(time.Now()).Format(time.DateOnly) } class="btn bg-neutral-100"/>
</div>
<div></div>
</div>
@@ -30,7 +30,7 @@ templ PDFForm(teamMembers []models.User) {
<button class="btn" type="button" onclick={ templ.JSFuncCall("checkAll", "pdf-", templ.JSExpression("false")) }>Keine</button>
</div>
for _, member := range teamMembers {
@CheckboxComponent(fmt.Sprintf("pdf-%d", member.PersonalNummer), fmt.Sprintf("%s %s", member.Vorname, member.Name))
@CheckboxComponent(member.PersonalNummer, fmt.Sprintf("%s %s", member.Vorname, member.Name))
}
</div>
<div></div>
@@ -38,17 +38,20 @@ templ PDFForm(teamMembers []models.User) {
<div class="grid-sub divide-x-1 responsive">
<div class="grid-cell">PDFs Bündeln</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">Einzeln</button>
<button class="btn" type="button" name="action" value="preview" onclick="">Bündel</button>
<button class="btn" type="submit" name="output" value="download">Einzeln</button>
<button class="btn" type="submit" name="output" value="render" onclick="">Bündel</button>
</div>
</div>
</div>
</form>
}
templ CheckboxComponent(id, label string) {
templ CheckboxComponent(pNr int, label string) {
{{
id := fmt.Sprintf("pdf-%d", pNr)
}}
<div class="inline-flex items-center">
<label class="flex items-center cursor-pointer relative" for={ 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 }/>
<input type="checkbox" name="employe_list" value={ pNr } id={ id } 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"/>
<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>