This commit is contained in:
aespin 2024-10-08 09:00:33 +02:00
parent 99a4cc7b7a
commit 489fed7471
3 changed files with 26 additions and 21 deletions

View File

@ -55,7 +55,6 @@ func BarcodesHandler(storage storage.Storager) httprouter.Handle {
// append barcode to holder // append barcode to holder
Barcodes = append(Barcodes, *data) Barcodes = append(Barcodes, *data)
} else { } else {
// get loading bed from string // get loading bed from string
lb, ok := types.MapLoadingBed[evacuadores] lb, ok := types.MapLoadingBed[evacuadores]
// if loading bed not found // if loading bed not found

View File

@ -4,9 +4,7 @@ import (
"net/http" "net/http"
"text/template" "text/template"
"git.espin.casa/albert/cml04-falcon-ui/helper"
"git.espin.casa/albert/cml04-falcon-ui/storage" "git.espin.casa/albert/cml04-falcon-ui/storage"
"git.espin.casa/albert/cml04-falcon-ui/types"
"github.com/julienschmidt/httprouter" "github.com/julienschmidt/httprouter"
) )
@ -22,24 +20,24 @@ func BundleHandler(storage storage.Storager) httprouter.Handle {
} }
} }
if r.Method == http.MethodPost { // if r.Method == http.MethodPost {
// barcodes holder // // barcodes holder
Bundles := []types.BundleData{} // Bundles := []types.BundleData{}
// parse form data from formulary // // parse form data from formulary
if err := r.ParseForm(); err != nil { // if err := r.ParseForm(); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) // http.Error(w, err.Error(), http.StatusInternalServerError)
} // }
// barcode // // barcode
codigo := r.FormValue("codigo") // codigo := r.FormValue("codigo")
// date range // // date range
fechas := r.FormValue("fechas") // fechas := r.FormValue("fechas")
// get range dates // // get range dates
inicio, final, err := helper.Dates(fechas) // inicio, final, err := helper.Dates(fechas)
if err != nil { // if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) // http.Error(w, err.Error(), http.StatusInternalServerError)
return // return
} // }
} // }
} }
} }

View File

@ -29,3 +29,11 @@ type Barcode struct {
UpdatedAt time.Time `json:"updatedat,omitempty"` UpdatedAt time.Time `json:"updatedat,omitempty"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedat,omitempty"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedat,omitempty"`
} }
// func (b *Barcode) FormatCreatedAt() string {
// return b.CreatedAt.Format("02/01/2006 15:04:03")
// }
// func (b *Barcode) FormatUpdateAt() string {
// return b.UpdatedAt.Format("02/01/2006 15:04:03")
// }