Michele: dettaglio consegne (controller + view)

This commit is contained in:
michele 2024-07-26 17:57:38 +02:00
parent 63c7f162b8
commit 032eb10e7c
4 changed files with 189 additions and 71 deletions

View File

@ -23,19 +23,19 @@ namespace SoftwayWeb.Controllers
apiUrl = key;
}
public IActionResult Index(string id, string? codAutista, DateTime dataGiro, string? codMezzo)
public IActionResult Dettaglio(string id, string? codAutista, DateTime dataGiro, string? codMezzo)
{
helper = new SessionHelper(this);
token = helper.GetStringValue("tok");
urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
var dataGiroFormattata = dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
urlBase = urlBase + "?autista=" + codAutista + "&dataGiro="+ dataGiroFormattata + "&mezzo=" + codMezzo;
urlBase = urlBase + "?autista=" + codAutista + "&dataGiro=" + dataGiroFormattata + "&mezzo=" + codMezzo;
Uri baseAddress = new Uri(urlBase);
client = new HttpClient();
client.BaseAddress = baseAddress;
List<Destinazioni_Out> modelList = new List<Destinazioni_Out>();
Destinazioni_Out model = new Destinazioni_Out();
Destinazioni_Out model = new Destinazioni_Out();
Destinazioni_Out.ConsegnaFatta modelCons = new Destinazioni_Out.ConsegnaFatta();
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
@ -47,7 +47,7 @@ namespace SoftwayWeb.Controllers
model = modelList.Where(x => x.Brserial == id).First();
modelCons = model.ConsFatta;
return View(modelCons);
return View("Dettaglio",model);
}
else
{
@ -55,7 +55,42 @@ namespace SoftwayWeb.Controllers
helper.SetStringValue("errMsg", errMes);
return RedirectToAction("Error");
}
}
//public IActionResult Index(string id, string? codAutista, DateTime dataGiro, string? codMezzo)
//{
// helper = new SessionHelper(this);
// token = helper.GetStringValue("tok");
// urlBase = apiUrl + "Giri/listaDestinazioniByAutistaDataMezzo";
// var dataGiroFormattata = dataGiro.ToString("yyyy-MM-dd'T'HH:mm:ss.fff'Z'");
// urlBase = urlBase + "?autista=" + codAutista + "&dataGiro="+ dataGiroFormattata + "&mezzo=" + codMezzo;
// Uri baseAddress = new Uri(urlBase);
// client = new HttpClient();
// client.BaseAddress = baseAddress;
// List<Destinazioni_Out> modelList = new List<Destinazioni_Out>();
// Destinazioni_Out model = new Destinazioni_Out();
// Destinazioni_Out.ConsegnaFatta modelCons = new Destinazioni_Out.ConsegnaFatta();
// HttpResponseMessage response = client.GetAsync(baseAddress).Result;
// if (response.IsSuccessStatusCode)
// {
// string dato = response.Content.ReadAsStringAsync().Result;
// modelList = JsonConvert.DeserializeObject<List<Destinazioni_Out>>(dato);
// model = modelList.Where(x => x.Brserial == id).First();
// modelCons = model.ConsFatta;
// return View(modelCons);
// }
// else
// {
// errMes = response.Content.ReadAsStringAsync().Result;
// helper.SetStringValue("errMsg", errMes);
// return RedirectToAction("Error");
// }
//}
}
}

View File

@ -0,0 +1,148 @@
@model SoftwayWeb.Models.Destinazioni_Out
@{
ViewData["Title"] = "Dettaglio";
Layout = "~/Views/Shared/_LayoutAreaRis.cshtml";
}
<div class="row">
<div class="col-xl">
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">Destinazione</h5> <small class="text-muted float-end"></small>
</div>
<div class="card-body">
<form asp-action="ModificaDestinazionePost">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.DataCarico)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.DataCarico)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.CodCommittente)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.CodCommittente) - @Html.DisplayFor(model => model.Committente)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.Sede)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.CodSede) - @Html.DisplayFor(model => model.Sede)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.IndirizzoSede)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.IndirizzoSede)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.CodAutista)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.CodAutista) - @Html.DisplayFor(model => model.Autista)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.DescAutomezzo)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.CodAutomezzo) - @Html.DisplayFor(model => model.DescAutomezzo)</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-xl">
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">Dettaglio consegna</h5> <small class="text-muted float-end"></small>
</div>
<div class="card-body">
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.ConsFatta.consFattaBanCar)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.ConsFatta.consFattaBanCar)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.ConsFatta.consFattaBanSca)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.ConsFatta.consFattaBanSca)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.ConsFatta.consFattaImpor)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.ConsFatta.consFattaImpor)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.ConsFatta.consFattaNotImp)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.ConsFatta.consFattaNotImp)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.ConsFatta.consFattaNotBan)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.ConsFatta.consFattaNotBan)</div>
</div>
<div class="mb-3">
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.ConsFatta.consFattaFlagCons)</b> </label>
<div class="form-text">@Html.DisplayFor(model => model.ConsFatta.consFattaFlagCons)</div>
</div>
</div>
</div>
</div>
</div>
<div>
<a asp-action="Index" asp-controller="Destinazioni" value="" class="btn btn-primary">Torna alla Lista</a>
@* <a href="@Url.ActionLink("Index", "Destinazioni", new { id = Model.serialeGiro,
codAutista = Model.CodAutista,
nomeAutista = Model.Autista,
dataGiro = Model.DataCarico,
codMezzo = Model.CodAutomezzo,
desMezzo = Model.DescAutomezzo})" class="links">Torna alla Lista</a> *@
</div>
@Html.HiddenFor(model => model.CodAutomezzo)
@Html.HiddenFor(model => model.CodAutomezzo)
@Html.HiddenFor(model => model.DescAutomezzo)
@Html.HiddenFor(model => model.DescAutomezzo)
@Html.HiddenFor(model => model.Brserial)
@Html.HiddenFor(model => model.DataCarico)
@Html.HiddenFor(model => model.DataCarico)
@Html.HiddenFor(model => model.CodCommittente)
@Html.HiddenFor(model => model.CodCommittente)
@Html.HiddenFor(model => model.Committente)
@Html.HiddenFor(model => model.Committente)
@Html.HiddenFor(model => model.CodAutista)
@Html.HiddenFor(model => model.CodAutista)
@Html.HiddenFor(model => model.Autista)
@Html.HiddenFor(model => model.Autista)
@Html.HiddenFor(model => model.CodSede)
@Html.HiddenFor(model => model.CodSede)
@Html.HiddenFor(model => model.Sede)
@Html.HiddenFor(model => model.Sede)
@Html.HiddenFor(model => model.IndirizzoSede)
@Html.HiddenFor(model => model.IndirizzoSede)
@Html.HiddenFor(model => model.Cproword)
@Html.HiddenFor(model => model.Cproword)
@Html.HiddenFor(model => model.Cprownum)
@Html.HiddenFor(model => model.Cprownum)
@Html.HiddenFor(model => model.Brmerce)
@Html.HiddenFor(model => model.Brmerce)
@Html.HiddenFor(model => model.Brnote)
@Html.HiddenFor(model => model.Brnote)
@Html.HiddenFor(model => model.ImportoDaRitirare)
@Html.HiddenFor(model => model.ImportoDaRitirare)
@Html.HiddenFor(model => model.ItemList)
@Html.HiddenFor(model => model.ItemList)
@Html.HiddenFor(model => model.serialeGiro)
@Html.HiddenFor(model => model.serialeGiro)
@Html.HiddenFor(model => model.Casse)
@Html.HiddenFor(model => model.Casse)
@Html.HiddenFor(model => model.Trasf)
@Html.HiddenFor(model => model.Trasf)
@Html.HiddenFor(model => model.Colli)
@Html.HiddenFor(model => model.Colli)
@Html.HiddenFor(model => model.num_cons)
@Html.HiddenFor(model => model.num_cons)
@Html.HiddenFor(model => model.Uova)
@Html.HiddenFor(model => model.Uova)
@Html.HiddenFor(model => model.Cist)
@Html.HiddenFor(model => model.Cist)
@Html.HiddenFor(model => model.Note)
@Html.HiddenFor(model => model.Note)
@Html.HiddenFor(model => model.Seq)
@Html.HiddenFor(model => model.Seq)
@Html.HiddenFor(model => model.Prog)
@Html.DisplayFor(model => model.Prog)
@Html.HiddenFor(model => model.Pisergir)
@section Scripts {
@{
await Html.RenderPartialAsync("_ValidationScriptsPartial");
}
}

View File

@ -1,65 +0,0 @@
@* @model IEnumerable<SoftwayWeb.Models.Destinazioni_Out.ConsegnaFatta> *@
@model SoftwayWeb.Models.Destinazioni_Out.ConsegnaFatta
@{
ViewData["Title"] = "Index";
Layout = "~/Views/Shared/_LayoutAreaRis.cshtml";
}
@* <a asp-action="Index" asp-controller="Destinazioni" value="Torna alla lista" class="btn btn-primary">Torna alla lista</a> *@
<br />
<br />
<div class="card">
<h5 class="card-header">Dettaglio consegna</h5>
<div class="table-responsive text-nowrap">
<table class="table table-striped">
<thead>
<tr>
<th>Seriale consegna</th>
<th>Riga</th>
<th>Bancali caricati</th>
<th>Bancali scaricati</th>
<th>Automezzo</th>
<th>Autista</th>
<th>Importo</th>
<th>Note 1</th>
<th>Note 2</th>
<th>Consegato</th>
</tr>
</thead>
<tbody>
<tr>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaSerial)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaRow)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaBanCar)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaBanSca)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaMezzo)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaAut)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaImpor)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaNotImp)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaNotBan)
</td>
<td>
@Html.DisplayFor(modelItem => modelItem.consFattaFlagCons)
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -177,7 +177,7 @@
diffBancali = item.ConsFatta.consFattaBanCar.Value - item.ConsFatta.consFattaBanSca.Value;
<td>
<a href="@Url.ActionLink("Index","Consegne", new{id = item.Brserial,
<a href="@Url.ActionLink("Dettaglio","Consegne", new{id = item.Brserial,
codAutista = item.CodAutista,
dataGiro = item.DataCarico,
codMezzo = item.CodAutomezzo})" class="links">@diffBancali</a>