From 07b851f0cf133ea83c3fe6ac44386acccb74c6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Markovi=C4=87?= Date: Sat, 20 Jun 2026 01:08:26 +0200 Subject: [PATCH] Magacin: dodato polje nabavne cene u formu za artikal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Polje NabavnaCena postojalo je u modelu i bazi ali nije bilo prikazano niti čitano iz forme — sad se prikazuje pored prodajne cene --- internal/handler/magacin_forma.go | 8 ++++++++ web/templates/stranice/magacin_forma.html | 12 +++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/internal/handler/magacin_forma.go b/internal/handler/magacin_forma.go index 7328639..eb58a28 100644 --- a/internal/handler/magacin_forma.go +++ b/internal/handler/magacin_forma.go @@ -260,6 +260,14 @@ func parseFormuArtikla(r *http.Request) (model.Artikal, string) { artikal.KolicinMin = v } + if c := r.FormValue("nabavna_cena"); c != "" { + v, err := strconv.ParseFloat(c, 64) + if err != nil || v < 0 { + return artikal, "Nabavna cena mora biti pozitivan broj." + } + artikal.NabavnaCena = v + } + if c := r.FormValue("prodajna_cena"); c != "" { v, err := strconv.ParseFloat(c, 64) if err != nil || v < 0 { diff --git a/web/templates/stranice/magacin_forma.html b/web/templates/stranice/magacin_forma.html index 98e996b..32cd0ce 100644 --- a/web/templates/stranice/magacin_forma.html +++ b/web/templates/stranice/magacin_forma.html @@ -84,9 +84,15 @@ -
- - +
+
+ + +
+
+ + +