dev/main #19
@@ -125,6 +125,16 @@ func updateBooking(w http.ResponseWriter, r *http.Request) {
|
||||
break
|
||||
case "change":
|
||||
log.Println("Changing Booking")
|
||||
absence, err := strconv.Atoi(r.FormValue("absence"))
|
||||
if err != nil {
|
||||
log.Println("Error parsing absence type.", err)
|
||||
absence = 0
|
||||
}
|
||||
if absence != 0 {
|
||||
log.Println("New absence", absence)
|
||||
log.Println("At date", r.FormValue("date"))
|
||||
}
|
||||
|
||||
for index, possibleBooking := range r.PostForm {
|
||||
if len(index) > 7 && index[:7] == "booking" {
|
||||
booking_id, err := strconv.Atoi(index[8:])
|
||||
|
||||
22
Backend/models/absence.go
Normal file
22
Backend/models/absence.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Absence struct {
|
||||
CounterId int
|
||||
CardUID string
|
||||
AbwesenheitTyp int8
|
||||
Datum time.Time
|
||||
}
|
||||
|
||||
func NewAbsence(card_uid string, abwesenheit_typ int8, datum time.Time) Absence {
|
||||
return Absence{
|
||||
CardUID: card_uid,
|
||||
AbwesenheitTyp: abwesenheit_typ,
|
||||
Datum: datum,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Absence) Insert() {
|
||||
// qStr, err := DB.Prepare(`INSERT INTO`)
|
||||
}
|
||||
@@ -15,7 +15,7 @@ type WorkWeek struct {
|
||||
WorkHours time.Duration
|
||||
}
|
||||
|
||||
type WeekStatus int16
|
||||
type WeekStatus int8
|
||||
|
||||
const (
|
||||
None WeekStatus = iota
|
||||
|
||||
@@ -138,7 +138,7 @@ templ lineComponent() {
|
||||
|
||||
templ absenceComponent(d models.WorkDay) {
|
||||
<div class="no-booking-component hidden group-[.edit]:flex flex-col gap-2 align-center">
|
||||
<select name="abwesenheit" onchange={ templ.JSFuncCall("editAbwesenheit", templ.JSExpression("this"), templ.JSExpression("event")) } class="grow cursor-pointer rounded-md text-neutral-800 p-2 md:px-4 border text-center text-sm transition-colors border-neutral-900" disabled>
|
||||
<select name="absence" onchange={ templ.JSFuncCall("editAbwesenheit", templ.JSExpression("this"), templ.JSExpression("event")) } class="grow cursor-pointer rounded-md text-neutral-800 p-2 md:px-4 border text-center text-sm transition-colors border-neutral-900" disabled>
|
||||
<option value="0">Abwesenheit?</option>
|
||||
<option value="1">Urlaub</option>
|
||||
<option value="2">Kurzarbeit</option>
|
||||
|
||||
@@ -506,7 +506,7 @@ func absenceComponent(d models.WorkDay) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<select name=\"abwesenheit\" onchange=\"")
|
||||
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<select name=\"absence\" onchange=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user