Num bancali obbligatori, nascosto bottone modifica tutte destinazioni quando giro iniziato

This commit is contained in:
michele 2024-10-24 16:47:08 +02:00
parent 461d23d67d
commit 2335a15cd1
4 changed files with 83 additions and 68 deletions

View File

@ -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");

View File

@ -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; }

View File

@ -22,7 +22,7 @@
<div class="mb-3" style="width:10%;">
<label class="form-label" for="basic-default-fullname"><label asp-for="BancaliCaricati" class="agy-client-quote"></label></label>
<input asp-for="BancaliCaricati" class="form-control" />
<input asp-for="BancaliCaricati" class="form-control" />
<span asp-validation-for="BancaliCaricati" class="control"></span>
</div>
@Html.HiddenFor(x => x.SerialeGiro)
@ -39,6 +39,11 @@
@Html.HiddenFor(x => x.parzialeImpRec)
<button type="submit" class="btn btn-primary">Salva</button>
<a asp-action="Index" value="Torna alla lista" class="btn btn-primary">Torna alla lista</a>
@* @if (Model.BancaliCaricati == null)
{
<p style="color:red;">Inserire il numero di bancali</p>
} *@
</form>
</div>
</div>

View File

@ -80,80 +80,86 @@
</tr>
</thead>
<tbody class="table-border-bottom-0">
@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);
}
<tr>
<td style="border-right-width:2px"><i class="bx bxl-angular bx-sm text-danger me-3"></i> <span class="fw-medium">@Html.DisplayFor(modelItem => item.DataGiro)</span></td>
<td style="border-right-width:2px">@Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista)</td>
<td style="border-right-width:2px">
@Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo)
</td>
<td style="border-right-width:2px">
@Html.DisplayFor(modelItem => item.DestinazioniFatte)/@Html.DisplayFor(modelItem => item.DestinazioniTutte)
</td>
<td style="border-right-width:2px">
<span style="color:blue;">@totBancaliCaricati</span>/<span style="color:green;">@Html.DisplayFor(modelItem => item.parzialeBanRec)</span>/<span style="color:brown;">@Html.DisplayFor(modelItem => item.parzialeBanSca)</span>
</td>
@if (item.ImportoDaRecuperare != null && item.ImportoDaRecuperare > 0)
{
totBancaliCaricati = Convert.ToString(item.BancaliCaricati.Value);
<td style="border-right-width:2px">
@Html.DisplayFor(modelItem => item.ImportoDaRecuperare)/@Html.DisplayFor(modelItem => item.parzialeImpRec)
</td>
}
<tr>
<td style="border-right-width:2px"><i class="bx bxl-angular bx-sm text-danger me-3"></i> <span class="fw-medium">@Html.DisplayFor(modelItem => item.DataGiro)</span></td>
<td style="border-right-width:2px">@Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista)</td>
<td style="border-right-width:2px">
@Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo)
</td>
<td style="border-right-width:2px">
@Html.DisplayFor(modelItem => item.DestinazioniFatte)/@Html.DisplayFor(modelItem => item.DestinazioniTutte)
</td>
<td style="border-right-width:2px">
<span style="color:blue;">@totBancaliCaricati</span>/<span style="color:green;">@Html.DisplayFor(modelItem => item.parzialeBanRec)</span>/<span style="color:brown;">@Html.DisplayFor(modelItem => item.parzialeBanSca)</span>
</td>
@if (item.ImportoDaRecuperare != null && item.ImportoDaRecuperare > 0)
else
{
<td style="border-right-width:2px">&nbsp;</td>
}
<td>
<a href="@Url.ActionLink("IndexValidate", "Destinazioni", new { id=item.SerialeGiro,
codAutista=item.CodAutista,
nomeAutista=item.Autista,
dataGiro=item.DataGiro,
codMezzo=item.CodMezzo,
desMezzo=item.Automezzo})" title="Destinazioni" class="links" style="text-decoration: none">
<img alt="Destinazioni" src="@Url.Content("~/images/icons8-oggetti-puntiforme-30.png")" style="width:24px;height:24px;">
</a>
@if(item.DestinazioniFatte == 0)
{
<td style="border-right-width:2px">
@Html.DisplayFor(modelItem => item.ImportoDaRecuperare)/@Html.DisplayFor(modelItem => item.parzialeImpRec)
</td>
<a href="@Url.ActionLink("Bancali", "Giri", new { id=item.SerialeGiro })" title="Bancali" class="links"><img alt="Bancali" src="@Url.Content("~/images/icons8-bancale-24.png")" style="width:24px;height:24px;"></a>
}
<a href="@Url.ActionLink("Chiudi", "GiriChiudi", new { id=item.SerialeGiro,nbanc=item.parzialeBanRec,imp=item.parzialeImpRec })" title="Chiudi" class="links"><img alt="Chiudi" src="@Url.Content("~/images/icons8-bandiera-a-scacchi-64.png")" style="width:24px;height:24px;"></a>
@if (item.DestinazioniFatte == 0)
{
<a href="@Url.ActionLink("ModificaTutteDestinazioni", "Giri", new { id = item.SerialeGiro,
codAutista = item.CodAutista,
nomeAutista = item.Autista,
codMezzo= item.CodMezzo,
nomeMezzo = item.Automezzo,
dataGiroCons = item.DataGiro @* id=item.SerialeGiro,nbanc=item.parzialeBanRec,imp=item.parzialeImpRec *@})" title="Modifica tutte le destinazioni" class="links" style="text-decoration: none">
<img alt="Modifica Tutte" src="@Url.Content("~/images/system.png")" style="width:24px;height:24px;">
</a>
}
@if (item.DestinazioniFatte == 0)
{
<a href="@Url.ActionLink("AddDestinazione", "AddDestinazione", new{serialeGiro = item.SerialeGiro,
codAutista=item.CodAutista,
nomeAutista=item.Autista,
dataGiro=item.DataGiro,
codMezzo=item.CodMezzo,
desMezzo=item.Automezzo})" title="Aggiungi nuova destinazione" class="links" style="text-decoration: none">
<img alt="Aggiungi nuova destinazione" src="@Url.Content("~/images/addBtn.png")" style="width:25px;height:25px;">
</a>
}
@if (item.BancaliCaricati == null)
{
<img alt="noBancali" src="@Url.Content("~/images/alert.png")" style="width:23px;height:23px;">
}
@if (/*item.DestinazioniModificate != null &&*/ item.DestinazioniModificate > 0)
{
<img alt="nocons" src="@Url.Content("~/images/warning.png")" style="width:24px;height:24px;">
}
else
{
<td style="border-right-width:2px">&nbsp;</td>
}
<td>
<a href="@Url.ActionLink("IndexValidate", "Destinazioni", new { id=item.SerialeGiro,
codAutista=item.CodAutista,
nomeAutista=item.Autista,
dataGiro=item.DataGiro,
codMezzo=item.CodMezzo,
desMezzo=item.Automezzo})" title="Destinazioni" class="links"><img alt="Destinazioni" src="@Url.Content("~/images/icons8-oggetti-puntiforme-30.png")" style="width:24px;height:24px;">
</a>
@if(item.DestinazioniFatte == 0)
{
<a href="@Url.ActionLink("Bancali", "Giri", new { id=item.SerialeGiro })" title="Bancali" class="links"><img alt="Bancali" src="@Url.Content("~/images/icons8-bancale-24.png")" style="width:24px;height:24px;"></a>
}
<a href="@Url.ActionLink("Chiudi", "GiriChiudi", new { id=item.SerialeGiro,nbanc=item.parzialeBanRec,imp=item.parzialeImpRec })" title="Chiudi" class="links"><img alt="Chiudi" src="@Url.Content("~/images/icons8-bandiera-a-scacchi-64.png")" style="width:24px;height:24px;"></a>
@if (item.DestinazioniFatte == 0)
{
<a href="@Url.ActionLink("ModificaTutteDestinazioni", "Giri", new { id = item.SerialeGiro,
codAutista = item.CodAutista,
nomeAutista = item.Autista,
codMezzo= item.CodMezzo,
nomeMezzo = item.Automezzo,
dataGiroCons = item.DataGiro @* id=item.SerialeGiro,nbanc=item.parzialeBanRec,imp=item.parzialeImpRec *@})" title="Modifica tutte le destinazioni" class="links">
<img alt="Modifica Tutte" src="@Url.Content("~/images/system.png")" style="width:24px;height:24px;">
</a>
}
<a href="@Url.ActionLink("AddDestinazione", "AddDestinazione", new{serialeGiro = item.SerialeGiro,
codAutista=item.CodAutista,
nomeAutista=item.Autista,
dataGiro=item.DataGiro,
codMezzo=item.CodMezzo,
desMezzo=item.Automezzo})" title="Aggiungi nuova destinazione" class="links"><img alt="Aggiungi nuova destinazione" src="@Url.Content("~/images/addBtn.png")" style="width:25px;height:25px;"></a>
@if (item.BancaliCaricati == null)
{
<img alt="noBancali" src="@Url.Content("~/images/alert.png")" style="width:23px;height:23px;">
}
@if (item.DestinazioniModificate != null && item.DestinazioniModificate > 0)
{
<img alt="nocons" src="@Url.Content("~/images/warning.png")" style="width:24px;height:24px;">
}
else
{
}
</td>
</tr>
}
</td>
</tr>
}
</tbody>
</table>