This commit is contained in:
@@ -14,12 +14,14 @@ import (
|
|||||||
"github.com/Dadido3/go-typst"
|
"github.com/Dadido3/go-typst"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const DE_DATE string = "02.01.2006"
|
||||||
|
|
||||||
func convertDaysToTypst(days []models.IWorkDay, u models.User) ([]typstDay, error) {
|
func convertDaysToTypst(days []models.IWorkDay, u models.User) ([]typstDay, error) {
|
||||||
var typstDays []typstDay
|
var typstDays []typstDay
|
||||||
for _, day := range days {
|
for _, day := range days {
|
||||||
var thisTypstDay typstDay
|
var thisTypstDay typstDay
|
||||||
work, pause, overtime := day.GetAllWorkTimesVirtual(u)
|
work, pause, overtime := day.GetAllWorkTimesVirtual(u)
|
||||||
thisTypstDay.Date = day.Date().Format("02.01.2006")
|
thisTypstDay.Date = day.Date().Format(DE_DATE)
|
||||||
thisTypstDay.Worktime = helper.FormatDurationFill(work, true)
|
thisTypstDay.Worktime = helper.FormatDurationFill(work, true)
|
||||||
thisTypstDay.Pausetime = helper.FormatDurationFill(pause, true)
|
thisTypstDay.Pausetime = helper.FormatDurationFill(pause, true)
|
||||||
thisTypstDay.Overtime = helper.FormatDurationFill(overtime, true)
|
thisTypstDay.Overtime = helper.FormatDurationFill(overtime, true)
|
||||||
@@ -140,7 +142,7 @@ func createEmployeReport(employee models.User, startDate, endDate time.Time) (by
|
|||||||
|
|
||||||
metadata := typstMetadata{
|
metadata := typstMetadata{
|
||||||
EmployeeName: fmt.Sprintf("%s %s", employee.Vorname, employee.Name),
|
EmployeeName: fmt.Sprintf("%s %s", employee.Vorname, employee.Name),
|
||||||
TimeRange: fmt.Sprintf("%s - %s", startDate.Format("02.01.2006"), endDate.Format("02.01.2006")),
|
TimeRange: fmt.Sprintf("%s - %s", startDate.Format(DE_DATE), endDate.Format(DE_DATE)),
|
||||||
Overtime: helper.FormatDurationFill(worktimeBalance, true),
|
Overtime: helper.FormatDurationFill(worktimeBalance, true),
|
||||||
WorkTime: helper.FormatDurationFill(actualHours, true),
|
WorkTime: helper.FormatDurationFill(actualHours, true),
|
||||||
OvertimeTotal: "",
|
OvertimeTotal: "",
|
||||||
@@ -179,7 +181,7 @@ func PDFHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
metadata := typstMetadata{
|
metadata := typstMetadata{
|
||||||
EmployeeName: fmt.Sprintf("%s %s", user.Vorname, user.Name),
|
EmployeeName: fmt.Sprintf("%s %s", user.Vorname, user.Name),
|
||||||
TimeRange: fmt.Sprintf("%s - %s", startDate.Format("02.01.2006"), endDate.Format("02.01.2006")),
|
TimeRange: fmt.Sprintf("%s - %s", startDate.Format(DE_DATE), endDate.Format(DE_DATE)),
|
||||||
Overtime: helper.FormatDurationFill(aggregatedOvertime, true),
|
Overtime: helper.FormatDurationFill(aggregatedOvertime, true),
|
||||||
WorkTime: helper.FormatDurationFill(aggregatedWorkTime, true),
|
WorkTime: helper.FormatDurationFill(aggregatedWorkTime, true),
|
||||||
OvertimeTotal: "",
|
OvertimeTotal: "",
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ func (e *NoValueError) Error() string {
|
|||||||
return fmt.Sprintf("No value found for key %s", e.Key)
|
return fmt.Sprintf("No value found for key %s", e.Key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(_urlParams url.Values) ParamsParser {
|
func New(params url.Values) ParamsParser {
|
||||||
return ParamsParser{
|
return ParamsParser{
|
||||||
urlParams: _urlParams,
|
urlParams: params,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user