michle: icone destinazioni fatte/non fatte

This commit is contained in:
michele 2024-07-08 17:59:15 +02:00
parent 9f15748ac6
commit 9bd0f76740
8 changed files with 92 additions and 32 deletions

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json; using Newtonsoft.Json;
using SoftwayWeb.Models; using SoftwayWeb.Models;
using X.PagedList; using X.PagedList;
@ -23,13 +24,13 @@ namespace SoftwayWeb.Controllers
apiUrl = key; apiUrl = key;
} }
public IActionResult Index(string id, string? codAutista, DateTime dataGiro, string? codMezzo) public IActionResult Index(string id, string? codAutista, DateTime dataGiro, /*Destinazioni_Out giro,*/ string? codMezzo, int? page = 1)
{ {
helper = new SessionHelper(this); helper = new SessionHelper(this);
token = helper.GetStringValue("tok"); token = helper.GetStringValue("tok");
urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo"; urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
//dataGiro = dataGiro.ToUniversalTime(); //dataGiro = dataGiro.ToUniversalTime();
//urlBase = urlBase + "autista=" + giro.CodAutista + "datGiro=" + giro.DataGiro; //urlBase = urlBase + "autista=" + giro.CodAutista + "datGiro=" /*+ giro.DataGiro*/;
urlBase = urlBase + "?autista=" + codAutista.Trim() + "&dataGiro=2023-05-30T00%3A00%3A00.000Z" + "&mezzo=" + codMezzo /*+ dataGiro*/; urlBase = urlBase + "?autista=" + codAutista.Trim() + "&dataGiro=2023-05-30T00%3A00%3A00.000Z" + "&mezzo=" + codMezzo /*+ dataGiro*/;
Uri baseAddress = new Uri(urlBase); Uri baseAddress = new Uri(urlBase);
client = new HttpClient(); client = new HttpClient();
@ -44,8 +45,14 @@ namespace SoftwayWeb.Controllers
modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato); modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato);
modelList = modelList.Where(x => x.serialeGiro == id).ToList(); modelList = modelList.Where(x => x.serialeGiro == id).ToList();
var shortList = modelList.ToPagedList(); //if (page != null && page < 1)
return View(modelList/*shortList*/); //{
// page = 1;
//}
//var pageSize = 10;
var shortList = modelList.ToPagedList(/*page ?? 1, pageSize*/);
return View(/*modelList*/shortList);
} }
else else
{ {

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json; using Newtonsoft.Json;
using SoftwayWeb.Models; using SoftwayWeb.Models;
@ -27,7 +28,7 @@ namespace SoftwayWeb.Controllers
apiUrl = key; apiUrl = key;
} }
public IActionResult Index(string? codAutista, DateTime data, bool aperto = true) public IActionResult Index(string? codAutista, DateTime data, bool aperto = true, int? page = 1)
{ {
helper = new SessionHelper(this); helper = new SessionHelper(this);
token = helper.GetStringValue("tok"); token = helper.GetStringValue("tok");
@ -66,7 +67,14 @@ namespace SoftwayWeb.Controllers
modelList = modelList.Where(x => x.DataGiro.GetValueOrDefault().Date == data.Date).ToList(); modelList = modelList.Where(x => x.DataGiro.GetValueOrDefault().Date == data.Date).ToList();
} }
var shortList = modelList.ToPagedList(); if (page != null && page < 1)
{
page = 1;
}
var pageSize = 1/*10*/;
var shortList = modelList.ToPagedList(page ?? 1, pageSize);
return View(shortList/*modelList*/); return View(shortList/*modelList*/);
} }
else else

View File

@ -58,8 +58,11 @@ namespace SoftwayWeb.Models
public string? consFattaAut { get; set; } public string? consFattaAut { get; set; }
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 5)")] [System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 5)")]
public decimal? consFattaImpor { get; set; } public decimal? consFattaImpor { get; set; }
[Display(Name = "Note 1")]
public string? consFattaNotImp { get; set; } public string? consFattaNotImp { get; set; }
[Display(Name = "Note 2")]
public string? consFattaNotBan { get; set; } public string? consFattaNotBan { get; set; }
[Display(Name = "Consegato")]
public string? consFattaFlagCons { get; set; } public string? consFattaFlagCons { get; set; }

View File

@ -1,5 +1,6 @@
@model IEnumerable<SoftwayWeb.Models.Destinazioni_Out> @* @model IEnumerable<SoftwayWeb.Models.Destinazioni_Out> *@
@* @model SoftwayWeb.Models.Destinazioni_Out *@ @* @model SoftwayWeb.Models.Destinazioni_Out *@
@model IPagedList<SoftwayWeb.Models.Destinazioni_Out>
@using X.PagedList; @using X.PagedList;
@using X.PagedList.Mvc.Core; @using X.PagedList.Mvc.Core;
@using X.PagedList; @using X.PagedList;
@ -21,16 +22,16 @@
<th>Committente</th> <th>Committente</th>
<th>Sede</th> <th>Sede</th>
<th>Indirizzo sede</th> <th>Indirizzo sede</th>
<th>Consegna @* effettuata *@</th> <th hidden>Consegna @* effettuata *@</th>
<th>Riga</th> <th hidden>Riga</th>
<th>Bancali caricati</th> <th>Bancali caricati</th>
<th>Bancali scaricati</th> <th>Bancali scaricati</th>
<th>Automezzo</th> <th hidden>Automezzo</th>
<th>Autista</th> <th @* hidden *@>Autista</th>
<th>Importo recuperato</th> <th>Importo recuperato</th>
<th>Importo non recuperato</th> <th>Note (importo)@* Importo non recuperato *@</th>
<th>Bancali non recuperati</th> <th>Note (bancali)@* Bancali non recuperati *@</th>
<th>Flag</th> <th>Esito consegna</th>
@* <th>Consegna fatta</th> *@ @* <th>Consegna fatta</th> *@
@* <th>Seriale giro</th> *@ @* <th>Seriale giro</th> *@
@* <th> @* <th>
@ -111,11 +112,11 @@
@if (item.ConsFatta != null) @if (item.ConsFatta != null)
{ {
<td> <td hidden>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaSerial) @Html.HiddenFor(modelItem => item.ConsFatta.consFattaSerial)
</td> </td>
<td> <td hidden>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaRow) @Html.HiddenFor(modelItem => item.ConsFatta.consFattaRow)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanCar) @Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanCar)
@ -123,11 +124,11 @@
<td> <td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanSca) @Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanSca)
</td> </td>
<td> <td hidden>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaMezzo) @Html.HiddenFor(modelItem => item.ConsFatta.consFattaMezzo)
</td> </td>
<td> <td hidden>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaAut) @Html.HiddenFor(modelItem => item.ConsFatta.consFattaAut)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaImpor) @Html.DisplayFor(modelItem => item.ConsFatta.consFattaImpor)
@ -139,7 +140,16 @@
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaNotBan) @Html.DisplayFor(modelItem => item.ConsFatta.consFattaNotBan)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaFlagCons) @Html.HiddenFor(modelItem => item.ConsFatta.consFattaFlagCons)
@if (item.ConsFatta.consFattaFlagCons.Contains("S"))
{
<img alt="cons" src="@Url.Content("~/images/Green.png")" style="width:50px;height:50px;">
}
else
{
<img alt="nocons" src="@Url.Content("~/images/Red.png")" style="width:50px;height:50px;">
}
</td> </td>
} }
else else
@ -153,7 +163,9 @@
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td>&nbsp;</td>
<td>&nbsp;</td> <td>
<img alt="notyet" src="@Url.Content("~/images/Yellow.png")" style="width:50px;height:50px;">
</td>
} }
@ -167,7 +179,7 @@
@Html.HiddenFor(modelItem => item.DataCarico) @Html.HiddenFor(modelItem => item.DataCarico)
</td> </td>
<td hidden> <td hidden>
@Html.HiddenFor(modelItem => item.CodAutista) @* - *@ @Html.HiddenFor(modelItem => item.Autista) @Html.DisplayFor(modelItem => item.CodAutista) @* - *@ @Html.DisplayFor(modelItem => item.Autista)
</td> </td>
<td> <td>
@Html.HiddenFor(modelItem => item.Brmerce) @Html.HiddenFor(modelItem => item.Brmerce)
@ -190,17 +202,17 @@
<td hidden> <td hidden>
@Html.HiddenFor(modelItem => item.ItemList) @Html.HiddenFor(modelItem => item.ItemList)
</td> </td>
@if (item.ConsFatta != null){ @* @if (item.ConsFatta != null){
<td> <td>
<img alt="cons" src="@Url.Content("~/images/fatto1.png")" style="width:35px;height:35px;"> <img alt="cons" src="@Url.Content("~/images/fatto1.png")" style="width:35px;height:35px;">
</td> </td>
} } *@
@if (item.ConsFatta == null) @* @if (item.ConsFatta == null)
{ {
<td> <td>
<img alt="nocons" src="@Url.Content("~/images/noFatto2.png")" style="width:50px;height:50px;"> <img alt="nocons" src="@Url.Content("~/images/Yellow.png")" style="width:50px;height:50px;">
</td> </td>
} } *@
@* <td> @* <td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) | @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) | @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@ -210,3 +222,18 @@
} }
</tbody> </tbody>
</table> </table>
<br />
@* <nav>
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, Model/* , searchString = @ViewData["CurrentFilter"] */ }), new PagedListRenderOptions()
{
ActiveLiElementClass = "active",
PageClasses = new[] { "page-link" },
LiElementClasses = new[] { "page-item" },
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
LinkToNextPageFormat = "Successiva",
LinkToPreviousPageFormat = "Precedente",
MaximumPageNumbersToDisplay = 5,
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
DisplayLinkToNextPage = PagedListDisplayMode.Always
})
</nav> *@

View File

@ -95,7 +95,7 @@
@Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista) @Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo) @Html.HiddenFor(modelItem => item.CodMezzo) - @Html.HiddenFor(modelItem => item.Automezzo)
</td> </td>
<td> <td>
@Html.DisplayFor(modelItem => item.BancaliCaricati) @Html.DisplayFor(modelItem => item.BancaliCaricati)
@ -126,3 +126,18 @@
} }
</tbody> </tbody>
</table> </table>
<br />
<nav>
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString = @ViewData["CurrentFilter"] }), new PagedListRenderOptions()
{
ActiveLiElementClass = "active",
PageClasses = new[] { "page-link" },
LiElementClasses = new[] { "page-item" },
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
LinkToNextPageFormat = "Successiva",
LinkToPreviousPageFormat = "Precedente",
MaximumPageNumbersToDisplay = 5,
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
DisplayLinkToNextPage = PagedListDisplayMode.Always
})
</nav>

BIN
wwwroot/images/Green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
wwwroot/images/Red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
wwwroot/images/yellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB