michele: destinazioni

This commit is contained in:
michele 2024-07-08 09:15:04 +02:00
parent 67471ee2ac
commit f2767ed067
10 changed files with 286 additions and 45 deletions

View File

@ -0,0 +1,59 @@
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SoftwayWeb.Models;
using X.PagedList;
namespace SoftwayWeb.Controllers
{
public class ConsegneController : Controller
{
string apiUrl = string.Empty;
string urlBase = string.Empty;
string token = string.Empty;
string errMes = string.Empty;
private readonly IConfiguration _configuration;
HttpClient client;
SessionHelper helper;
public ConsegneController(IConfiguration configuration)
{
_configuration = configuration;
client = new HttpClient();
var key = _configuration["ApplicationInsights:rootUrlApi"];
apiUrl = key;
}
public IActionResult Index(string id/*, string? codAutista, DateTime dataGiro, string? codMezzo*/)
{
//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=" + codAutista.Trim() + "&dataGiro=2023-05-30T00%3A00%3A00.000Z" + "&mezzo=" + codMezzo /*+ dataGiro*/;
//Uri baseAddress = new Uri(urlBase);
//client = new HttpClient();
//client.BaseAddress = baseAddress;
//List<Destinazioni_Out.ConsegnaFatta> modelList = new List<Destinazioni_Out.ConsegnaFatta>();
//HttpResponseMessage response = client.GetAsync(baseAddress).Result;
//if (response.IsSuccessStatusCode)
//{
// string dato = response.Content.ReadAsStringAsync().Result;
// modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out.ConsegnaFatta>>(dato);
// modelList = modelList.Where(x => x.consFattaSerial == id).ToList();
// var shortList = modelList.ToPagedList();
// return View(modelList/*shortList*/);
//}
//else
//{
// errMes = response.Content.ReadAsStringAsync().Result;
// helper.SetStringValue("errMsg", errMes);
// return RedirectToAction("Error");
//}
return View();
}
}
}

View File

@ -43,6 +43,9 @@ namespace SoftwayWeb.Controllers
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*/);
}
else
{
@ -52,7 +55,7 @@ namespace SoftwayWeb.Controllers
}
//var shortList = modelList.ToPagedList();
return View(modelList);
//return View(shortList);
}
}
}

137
Views/Consegne/Index.cshtml Normal file
View File

@ -0,0 +1,137 @@
@model IEnumerable<SoftwayWeb.Models.Destinazioni_Out.ConsegnaFatta>
@{
ViewData["Title"] = "Index";
}
<h1>Index</h1>
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.consFattaSerial)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaRow)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaBanCar)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaBanSca)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaMezzo)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaAut)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaImpor)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaNotImp)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaNotBan)
</th>
<th>
@Html.DisplayNameFor(model => model.consFattaFlagCons)
</th>
@* <th>
@Html.DisplayNameFor(model => model.IndirizzoSede)
</th>
<th>
@Html.DisplayNameFor(model => model.Cproword)
</th>
<th>
@Html.DisplayNameFor(model => model.Cprownum)
</th>
<th>
@Html.DisplayNameFor(model => model.Brmerce)
</th>
<th>
@Html.DisplayNameFor(model => model.Brnote)
</th>
<th>
@Html.DisplayNameFor(model => model.ImportoDaRitirare)
</th>
<th>
@Html.DisplayNameFor(model => model.ItemList)
</th>
<th>
@Html.DisplayNameFor(model => model.serialeGiro)
</th> *@
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.consFattaSerial)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaRow)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaBanCar)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaBanSca)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaMezzo)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaAut)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaImpor)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaNotImp)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaNotBan)
</td>
<td>
@Html.DisplayFor(modelItem => item.consFattaFlagCons)
</td>
@* <td>
@Html.DisplayFor(modelItem => item.IndirizzoSede)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cproword)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cprownum)
</td>
<td>
@Html.DisplayFor(modelItem => item.Brmerce)
</td>
<td>
@Html.DisplayFor(modelItem => item.Brnote)
</td>
<td>
@Html.DisplayFor(modelItem => item.ImportoDaRitirare)
</td>
<td>
@Html.DisplayFor(modelItem => item.ItemList)
</td>
<td>
@Html.DisplayFor(modelItem => item.serialeGiro)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
</td> *@
</tr>
}
</tbody>
</table>

View File

@ -4,7 +4,8 @@
@using X.PagedList.Mvc.Core;
@using X.PagedList;
@{
ViewData["Title"] = "Index";
ViewData["Title"] = "Lista Destinazioni";
Layout = "~/Views/Shared/_LayoutAreaRis.cshtml";
}
<h1>Lista destinazioni</h1>
@ -14,25 +15,24 @@
</p>
*@
<table class="table">
<table class="table" style="width:100%">
<thead>
<tr>
<th>Automezzo</th>
<th>Seriale</th>
<th>Data carico</th>
<th>Committente</th>
<th>Autista</th>
<th>Sede</th>
<th>Indirizzo sede</th>
@* <th>Num Riga</th>
<th>Ord riga</th> *@
<th>Merce</th>
<th>Note</th>
<th>Importo da ritirare</th>
<th>Consegna @* effettuata *@</th>
<th>Riga</th>
<th>Bancali caricati</th>
<th>Bancali scaricati</th>
<th>Automezzo</th>
<th>Autista</th>
<th>Importo recuperato</th>
<th>Importo non recuperato</th>
<th>Bancali non recuperati</th>
<th>Flag</th>
@* <th>Consegna fatta</th> *@
<th>Seriale giro</th>
@* <th>Seriale giro</th> *@
@* <th>
@Html.DisplayNameFor(model => model.CodAutomezzo)
</th>
@ -93,50 +93,95 @@
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.CodAutomezzo) - @Html.DisplayFor(modelItem => item.DescAutomezzo)
</td>
<td>
@Html.DisplayFor(modelItem => item.Brserial)
</td>
<td>
@Html.DisplayFor(modelItem => item.DataCarico)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodCommittente) - @Html.DisplayFor(modelItem => item.Committente)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodAutista) - @Html.DisplayFor(modelItem => item.Autista)
</td>
<td>
@Html.DisplayFor(modelItem => item.CodSede) - @Html.DisplayFor(modelItem => item.Sede)
</td>
<td>
@Html.DisplayFor(modelItem => item.IndirizzoSede)
</td>
@* @if (item.ConsFatta != null)
{
<td>
<a href="@Url.ActionLink("Index","Consegne", new{id = item.ConsFatta.consFattaSerial})" title="ConsFatta">Dettaglio consegna</a>
</td>
} *@
<td>
@Html.DisplayFor(modelItem => item.Brmerce)
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaSerial)
</td>
<td>
@Html.DisplayFor(modelItem => item.Brnote)
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaRow)
</td>
<td>
@Html.DisplayFor(modelItem => item.ImportoDaRitirare)
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanCar)
</td>
<td>
@Html.DisplayFor(modelItem => item.serialeGiro)
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaBanSca)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaMezzo)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaAut)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaImpor)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaNotImp)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaNotBan)
</td>
<td>
@Html.DisplayFor(modelItem => item.ConsFatta.consFattaFlagCons)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.CodAutomezzo) @* - *@ @Html.HiddenFor(modelItem => item.DescAutomezzo)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.Brserial)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.DataCarico)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.CodAutista) @* - *@ @Html.HiddenFor(modelItem => item.Autista)
</td>
<td>
@Html.HiddenFor(modelItem => item.Brmerce)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.Brnote)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.ImportoDaRitirare)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.serialeGiro)
</td>
<td hidden>
@Html.HiddenFor(modelItem => item.Cproword)
</td>
<td>
<td hidden>
@Html.HiddenFor(modelItem => item.Cprownum)
</td>
<td>
<td hidden>
@Html.HiddenFor(modelItem => item.ItemList)
</td>
@if (item.ConsFatta != null){
<td>
<img alt="cons" src="@Url.Content("~/images/fatto1.png")" style="width:35px;height:35px;">
</td>
}
@if (item.ConsFatta == null)
{
<td>
<img alt="nocons" src="@Url.Content("~/images/noFatto2.png")" style="width:50px;height:50px;">
</td>
}
@* <td>
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |

View File

@ -97,11 +97,6 @@
<td>
@Html.DisplayFor(modelItem => item.CodMezzo) - @Html.DisplayFor(modelItem => item.Automezzo)
</td>
@* <td>
@Html.DisplayFor(modelItem => item.Autista)
</td>*@
<td>
@Html.DisplayFor(modelItem => item.BancaliCaricati)
</td>
@ -114,16 +109,18 @@
<td>
@Html.DisplayFor(modelItem => item.ImportoRecuperato)
</td>
<td>
<td hidden>
@Html.HiddenFor(modelItem => item.DataChiusura)
</td>
<td>
<td hidden>
@Html.HiddenFor(modelItem => item.SerialeGiro)
</td>
<td>
<a href="@Url.Action("Index", "Destinazioni", new { id=item.SerialeGiro, codAutista=item.CodAutista, dataGiro=item.DataGiro, codMezzo=item.CodMezzo })" title="Destinazioni" class="links">Destinazioni</a>
<a href="@Url.Action("Chiudi", "GiriChiudi", new { id=item.SerialeGiro })" title="Chiudi" class="links">Chiudi</a>
<a href="@Url.Action("Elimina", "GiriElimina", new { id=item.SerialeGiro })" title="Elimina" class="links">Elimina</a>
<a href="@Url.ActionLink("Index", "Destinazioni", new { id=item.SerialeGiro, codAutista=item.CodAutista, dataGiro=item.DataGiro, codMezzo=item.CodMezzo })" title="Destinazioni" class="links">Destinazioni</a>
<a href="@Url.ActionLink("Bancali", "GiriChiudi", new { id=item.SerialeGiro })" title="Bancali" class="links">Modifica bancali</a>
<a href="@Url.ActionLink("Chiudi", "GiriChiudi", new { id=item.SerialeGiro })" title="Chiudi" class="links">Chiudi</a>
<a href="@Url.ActionLink("Riapri", "GiriChiudi", new { id=item.SerialeGiro })" title="Riapri" class="links">Riapri</a>
<a href="@Url.ActionLink("Elimina", "GiriElimina", new { id=item.SerialeGiro })" title="Elimina" class="links">Elimina</a>
</td>
</tr>
}

BIN
wwwroot/images/fatto.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
wwwroot/images/fatto1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
wwwroot/images/noFatto.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
wwwroot/images/noFatto2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
wwwroot/images/nofatto1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB