diff --git a/Controllers/GiriController.cs b/Controllers/GiriController.cs index fb5b514..7f75714 100644 --- a/Controllers/GiriController.cs +++ b/Controllers/GiriController.cs @@ -223,6 +223,10 @@ namespace SoftwayWeb.Controllers [HttpPost] public IActionResult Bancali(GiriConsegnaView model) { + if (model.BancaliCaricati == null) + { + return View(model); + } SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); diff --git a/Models/GiriConsegnaView.cs b/Models/GiriConsegnaView.cs index ee7be90..5a7f3b3 100644 --- a/Models/GiriConsegnaView.cs +++ b/Models/GiriConsegnaView.cs @@ -17,7 +17,7 @@ namespace SoftwayWeb.Models [Display(Name = "Autista")] public string? Autista { get; set; } - [Display(Name = "Bancali caricati")] + [Display(Name = "Bancali caricati"), Required(ErrorMessage = "Inserire il numero di bancali")] public int? BancaliCaricati { get; set; } diff --git a/Views/Giri/Bancali.cshtml b/Views/Giri/Bancali.cshtml index 170ece5..656bddd 100644 --- a/Views/Giri/Bancali.cshtml +++ b/Views/Giri/Bancali.cshtml @@ -22,7 +22,7 @@
- +
@Html.HiddenFor(x => x.SerialeGiro) @@ -39,6 +39,11 @@ @Html.HiddenFor(x => x.parzialeImpRec) Torna alla lista + + @* @if (Model.BancaliCaricati == null) + { +

Inserire il numero di bancali

+ } *@ diff --git a/Views/Giri/Index.cshtml b/Views/Giri/Index.cshtml index 48abdea..877cf8e 100644 --- a/Views/Giri/Index.cshtml +++ b/Views/Giri/Index.cshtml @@ -80,80 +80,86 @@ - @foreach (var item in Model) + @foreach (var item in Model) { - string totBancaliCaricati = "-"; - if (item.BancaliCaricati!=null) + string totBancaliCaricati = "-"; + if (item.BancaliCaricati!=null) + { + totBancaliCaricati = Convert.ToString(item.BancaliCaricati.Value); + } + + @Html.DisplayFor(modelItem => item.DataGiro) + @Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista) + + @Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo) + + + @Html.DisplayFor(modelItem => item.DestinazioniFatte)/@Html.DisplayFor(modelItem => item.DestinazioniTutte) + + + @totBancaliCaricati/@Html.DisplayFor(modelItem => item.parzialeBanRec)/@Html.DisplayFor(modelItem => item.parzialeBanSca) + + @if (item.ImportoDaRecuperare != null && item.ImportoDaRecuperare > 0) { - totBancaliCaricati = Convert.ToString(item.BancaliCaricati.Value); + + @Html.DisplayFor(modelItem => item.ImportoDaRecuperare)/@Html.DisplayFor(modelItem => item.parzialeImpRec) + } - - @Html.DisplayFor(modelItem => item.DataGiro) - @Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista) - - @Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo) - - - @Html.DisplayFor(modelItem => item.DestinazioniFatte)/@Html.DisplayFor(modelItem => item.DestinazioniTutte) - - - @totBancaliCaricati/@Html.DisplayFor(modelItem => item.parzialeBanRec)/@Html.DisplayFor(modelItem => item.parzialeBanSca) - - @if (item.ImportoDaRecuperare != null && item.ImportoDaRecuperare > 0) + else + { +   + } + + + + Destinazioni + + @if(item.DestinazioniFatte == 0) { - - @Html.DisplayFor(modelItem => item.ImportoDaRecuperare)/@Html.DisplayFor(modelItem => item.parzialeImpRec) - + Bancali + } + Chiudi + @if (item.DestinazioniFatte == 0) + { + + Modifica Tutte + + } + @if (item.DestinazioniFatte == 0) + { + + Aggiungi nuova destinazione + + } + @if (item.BancaliCaricati == null) + { + noBancali + } + @if (/*item.DestinazioniModificate != null &&*/ item.DestinazioniModificate > 0) + { + nocons } else { -   - } - - - Destinazioni - - @if(item.DestinazioniFatte == 0) - { - Bancali - } - Chiudi - @if (item.DestinazioniFatte == 0) - { - - Modifica Tutte - - } - Aggiungi nuova destinazione - @if (item.BancaliCaricati == null) - { - noBancali - } - @if (item.DestinazioniModificate != null && item.DestinazioniModificate > 0) - { - nocons - } - else - { - } - - + } + + }