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.RazorPages;
using Newtonsoft.Json;
using SoftwayWeb.Models;
using X.PagedList;
@ -23,13 +24,13 @@ namespace SoftwayWeb.Controllers
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);
token = helper.GetStringValue("tok");
urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
//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*/;
Uri baseAddress = new Uri(urlBase);
client = new HttpClient();
@ -37,15 +38,21 @@ namespace SoftwayWeb.Controllers
List<Destinazioni_Out> modelList = new List<Destinazioni_Out>();
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
if (response.IsSuccessStatusCode)
{
string dato = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato);
modelList = modelList.Where(x => x.serialeGiro == id).ToList();
var shortList = modelList.ToPagedList();
return View(modelList/*shortList*/);
//if (page != null && page < 1)
//{
// page = 1;
//}
//var pageSize = 10;
var shortList = modelList.ToPagedList(/*page ?? 1, pageSize*/);
return View(/*modelList*/shortList);
}
else
{

View File

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json;
using SoftwayWeb.Models;
@ -27,7 +28,7 @@ namespace SoftwayWeb.Controllers
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);
token = helper.GetStringValue("tok");
@ -66,7 +67,14 @@ namespace SoftwayWeb.Controllers
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*/);
}
else

View File

@ -58,8 +58,11 @@ namespace SoftwayWeb.Models
public string? consFattaAut { get; set; }
[System.ComponentModel.DataAnnotations.Schema.Column(TypeName = "decimal(18, 5)")]
public decimal? consFattaImpor { get; set; }
[Display(Name = "Note 1")]
public string? consFattaNotImp { get; set; }
[Display(Name = "Note 2")]
public string? consFattaNotBan { get; set; }
[Display(Name = "Consegato")]
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 IPagedList<SoftwayWeb.Models.Destinazioni_Out>
@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList;
@ -21,16 +22,16 @@
<th>Committente</th>
<th>Sede</th>
<th>Indirizzo sede</th>
<th>Consegna @* effettuata *@</th>
<th>Riga</th>
<th hidden>Consegna @* effettuata *@</th>
<th hidden>Riga</th>
<th>Bancali caricati</th>
<th>Bancali scaricati</th>
<th>Automezzo</th>
<th>Autista</th>
<th hidden>Automezzo</th>
<th @* hidden *@>Autista</th>
<th>Importo recuperato</th>
<th>Importo non recuperato</th>
<th>Bancali non recuperati</th>
<th>Flag</th>
<th>Note (importo)@* Importo non recuperato *@</th>
<th>Note (bancali)@* Bancali non recuperati *@</th>
<th>Esito consegna</th>
@* <th>Consegna fatta</th> *@
@* <th>Seriale giro</th> *@
@* <th>
@ -111,11 +112,11 @@
@if (item.ConsFatta != null)
{
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaSerial)
<td hidden>
@Html.HiddenFor(modelItem => item.ConsFatta.consFattaSerial)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaRow)
<td hidden>
@Html.HiddenFor(modelItem => item.ConsFatta.consFattaRow)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanCar)
@ -123,11 +124,11 @@
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanSca)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaMezzo)
<td hidden>
@Html.HiddenFor(modelItem => item.ConsFatta.consFattaMezzo)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaAut)
<td hidden>
@Html.HiddenFor(modelItem => item.ConsFatta.consFattaAut)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaImpor)
@ -139,7 +140,16 @@
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaNotBan)
</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>
}
else
@ -153,7 +163,9 @@
<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)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.CodAutista) @* - *@ @Html.HiddenFor(modelItem => item.Autista)
@Html.DisplayFor(modelItem => item.CodAutista) @* - *@ @Html.DisplayFor(modelItem => item.Autista)
</td>
<td>
@Html.HiddenFor(modelItem => item.Brmerce)
@ -190,17 +202,17 @@
<td hidden>
@Html.HiddenFor(modelItem => item.ItemList)
</td>
@if (item.ConsFatta != null){
@* @if (item.ConsFatta != null){
<td>
<img alt="cons" src="@Url.Content("~/images/fatto1.png")" style="width:35px;height:35px;">
</td>
}
@if (item.ConsFatta == null)
} *@
@* @if (item.ConsFatta == null)
{
<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>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@ -210,3 +222,18 @@
}
</tbody>
</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)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo)
@Html.HiddenFor(modelItem => item.CodMezzo) - @Html.HiddenFor(modelItem => item.Automezzo)
</td>
<td>
@Html.DisplayFor(modelItem => item.BancaliCaricati)
@ -126,3 +126,18 @@
}
</tbody>
</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