From 489fed7471b63b4d617d0472368e53f063992512 Mon Sep 17 00:00:00 2001 From: aespin Date: Tue, 8 Oct 2024 09:00:33 +0200 Subject: [PATCH] wip --- handlers/barcodes.go | 1 - handlers/bundle.go | 38 ++++++++++++++++++-------------------- types/barcode.go | 8 ++++++++ 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/handlers/barcodes.go b/handlers/barcodes.go index 18c00ce..80fc0c5 100644 --- a/handlers/barcodes.go +++ b/handlers/barcodes.go @@ -55,7 +55,6 @@ func BarcodesHandler(storage storage.Storager) httprouter.Handle { // append barcode to holder Barcodes = append(Barcodes, *data) } else { - // get loading bed from string lb, ok := types.MapLoadingBed[evacuadores] // if loading bed not found diff --git a/handlers/bundle.go b/handlers/bundle.go index 650af83..d916f21 100644 --- a/handlers/bundle.go +++ b/handlers/bundle.go @@ -4,9 +4,7 @@ import ( "net/http" "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/types" "github.com/julienschmidt/httprouter" ) @@ -22,24 +20,24 @@ func BundleHandler(storage storage.Storager) httprouter.Handle { } } - if r.Method == http.MethodPost { - // barcodes holder - Bundles := []types.BundleData{} - // parse form data from formulary - if err := r.ParseForm(); err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - } - // barcode - codigo := r.FormValue("codigo") - // date range - fechas := r.FormValue("fechas") - // get range dates - inicio, final, err := helper.Dates(fechas) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - } + // if r.Method == http.MethodPost { + // // barcodes holder + // Bundles := []types.BundleData{} + // // parse form data from formulary + // if err := r.ParseForm(); err != nil { + // http.Error(w, err.Error(), http.StatusInternalServerError) + // } + // // barcode + // codigo := r.FormValue("codigo") + // // date range + // fechas := r.FormValue("fechas") + // // get range dates + // inicio, final, err := helper.Dates(fechas) + // if err != nil { + // http.Error(w, err.Error(), http.StatusInternalServerError) + // return + // } + // } } } diff --git a/types/barcode.go b/types/barcode.go index 07e3aa7..32bcf46 100644 --- a/types/barcode.go +++ b/types/barcode.go @@ -29,3 +29,11 @@ type Barcode struct { UpdatedAt time.Time `json:"updatedat,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") +// }