Compare commits

...

3 Commits

Author SHA1 Message Date
6d2e0241c9
feat(templates): Added selfservice qr
All checks were successful
Build release images / build-container (push) Successful in 2m12s
Build latest image / build-container (push) Successful in 2m26s
2025-04-17 21:44:58 +02:00
afc5b1f0c6
fix(models): Add required SelfServiceLink field to RunnerWithDonations struct 2025-04-17 21:43:54 +02:00
4a76ee469b
fix(barcode): Use auto encoding for QR code generation to support all characters 2025-04-17 21:43:44 +02:00
4 changed files with 48 additions and 8 deletions

View File

@ -15,6 +15,7 @@ type RunnerWithDonations struct {
DistanceDonations []DistanceDonation `json:"distance_donations" validate:"optional"`
TotalPerDistance int `json:"total_per_distance" validate:"optional"`
TotalDonations int `json:"total_donations" validate:"optional"`
SelfServiceLink string `json:"self_service_link" validate:"required"`
}
type DistanceDonation struct {

View File

@ -69,7 +69,11 @@ func (b *DefaultBarcodeService) GenerateBarcode(format string, content string, w
}
break
case "qr":
generatedCode, err = qr.Encode(content, qr.M, qr.AlphaNumeric)
// Always use qr.Auto encoding to support all characters in the content
encoding := qr.Auto
// QR code generation with error correction level M and auto encoding
generatedCode, err = qr.Encode(content, qr.M, encoding)
if err != nil {
return bytes.Buffer{}, err
}

View File

@ -87,13 +87,30 @@
<td>Gesamt</td>
<td>{{ formatUnit "euro" $.Locale .TotalPerDistance }} {{ $.CurrencySymbol }}</td>
<td>{{ formatUnit "euro" $.Locale .TotalDonations }} {{ $.CurrencySymbol }}</td>
</tfoot>
</table>
</main>
<footer class="certificate-footer">
<p>
{{ $.Footer }}
</p>
</table>
</main>
<footer class="certificate-footer">
<table style="border-collapse: collapse; border: none; width: 17cm;">
<thead>
<tr>
<th style="border: none; width: 50%; text-align: center;">Link zu deinen Rundenzeiten</th>
<!-- <th style="border: none; width: 50%; text-align: center;">Spende überweisen</th> -->
</tr>
</thead>
<tbody>
<tr>
<td style="border: none; text-align: center;">
<img src="data:image/png;base64,{{ barcode .SelfServiceLink "qr" "" }}" style="height: 2.5cm; padding: 0.2cm">
</td>
<td style="border: none; text-align: center;">
<!-- <img src="data:image/png;base64,{{ barcode ".SelfServiceLink" "qr" "" }}" style="height: 2.5cm; padding: 0.2cm"> -->
</td>
</tr>
</tbody>
</table>
<p style="text-align: center;">
{{ $.Footer }}
</p>
</footer>
</article>
{{ end }}

View File

@ -91,6 +91,24 @@
</table>
</main>
<footer class="certificate-footer">
<table style="border-collapse: collapse; border: none; width: 17cm;">
<thead>
<tr>
<th style="border: none; width: 50%; text-align: center;">Link to your lap times</th>
<!-- <th style="border: none; width: 50%; text-align: center;">Transfer donation</th> -->
</tr>
</thead>
<tbody>
<tr>
<td style="border: none; text-align: center;">
<img src="data:image/png;base64,{{ barcode .SelfServiceLink "qr" "" }}" style="height: 2.5cm; padding: 0.2cm">
</td>
<td style="border: none; text-align: center;">
<!-- <img src="data:image/png;base64,{{ barcode ".SelfServiceLink" "qr" "" }}" style="height: 2.5cm; padding: 0.2cm"> -->
</td>
</tr>
</tbody>
</table>
<p>
{{ $.Footer }}
</p>