Michele: modifiche per filtri, paginazioni impianti e rapportini
This commit is contained in:
parent
fba773ce32
commit
ecfc109507
@ -33,7 +33,7 @@ namespace VirtualTask.Controllers
|
|||||||
|
|
||||||
#region INDEX
|
#region INDEX
|
||||||
|
|
||||||
public IActionResult Index(string searchString, int? page = 1)
|
public IActionResult Index(string searchString, string cliente, int? page = 1)
|
||||||
{
|
{
|
||||||
SessionHelper helper = new SessionHelper(this);
|
SessionHelper helper = new SessionHelper(this);
|
||||||
token = helper.GetStringValue("tok");
|
token = helper.GetStringValue("tok");
|
||||||
@ -71,6 +71,15 @@ namespace VirtualTask.Controllers
|
|||||||
else
|
else
|
||||||
ViewData["CurrentFilter"] = null;
|
ViewData["CurrentFilter"] = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(cliente))
|
||||||
|
{
|
||||||
|
modelList = modelList.Where(x => x.imultcli != null && x.imultcli.Contains(cliente)).ToList();
|
||||||
|
ViewData["CurrentFilterCli"] = cliente;
|
||||||
|
ViewBag.Cliente = cliente;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ViewData["CurrentFilterCli"] = null;
|
||||||
|
|
||||||
if (page != null && page < 1)
|
if (page != null && page < 1)
|
||||||
{
|
{
|
||||||
page = 1;
|
page = 1;
|
||||||
@ -82,6 +91,8 @@ namespace VirtualTask.Controllers
|
|||||||
.OrderByDescending(s => s.imcodimp)
|
.OrderByDescending(s => s.imcodimp)
|
||||||
.ToPagedList(page ?? 1, pageSize);
|
.ToPagedList(page ?? 1, pageSize);
|
||||||
|
|
||||||
|
ViewBag.Clienti = LoadStockitems();
|
||||||
|
|
||||||
return View(shortLinks);
|
return View(shortLinks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -31,10 +31,11 @@ namespace VirtualTask.Controllers
|
|||||||
|
|
||||||
#region INDEX
|
#region INDEX
|
||||||
|
|
||||||
public IActionResult Index(string searchString, int? page = 1)
|
public IActionResult Index(DateTime dataIni, DateTime dataFin, string Codbuono, string tecnico, int? page = 1)
|
||||||
{
|
{
|
||||||
SessionHelper helper = new SessionHelper(this);
|
SessionHelper helper = new SessionHelper(this);
|
||||||
token = helper.GetStringValue("tok");
|
token = helper.GetStringValue("tok");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(token))
|
if (string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
return RedirectToAction("Login2", "Login");
|
return RedirectToAction("Login2", "Login");
|
||||||
@ -59,15 +60,44 @@ namespace VirtualTask.Controllers
|
|||||||
string data = response.Content.ReadAsStringAsync().Result;
|
string data = response.Content.ReadAsStringAsync().Result;
|
||||||
modelList = JsonConvert.DeserializeObject<List<Rapp_New>>(data);
|
modelList = JsonConvert.DeserializeObject<List<Rapp_New>>(data);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchString))
|
if (dataIni.Date != DateTime.MinValue)
|
||||||
{
|
{
|
||||||
//modelList = modelList.Where(s => s.descrizione_intervento.ToUpper().Contains(searchString.ToUpper())).ToList();
|
modelList = modelList.Where(x => x.data_rapportino.Date >= dataIni.Date).ToList();
|
||||||
modelList = modelList.Where(s => s.data_rapportino.ToString().Substring(0,10).Contains(searchString.ToUpper())).ToList();
|
|
||||||
|
|
||||||
ViewData["CurrentFilter"] = searchString;
|
ViewData["dataIni"] = dataIni;
|
||||||
|
//ViewData["dataFin"] = dataFin;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ViewData["CurrentFilter"] = null;
|
{
|
||||||
|
ViewData["dataIni"] = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (dataFin.Date != DateTime.MinValue)
|
||||||
|
{
|
||||||
|
modelList = modelList.Where(x => x.data_rapportino.Date <= dataFin.Date).ToList();
|
||||||
|
ViewData["dataFin"] = dataFin;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ViewData["dataFin"] = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Codbuono))
|
||||||
|
{
|
||||||
|
modelList = modelList.Where(x => x.seriale_rapportino.ToUpper().Contains(Codbuono)).ToList();
|
||||||
|
ViewData["Codbuono"] = Codbuono;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ViewData["Codbuono"] = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(tecnico))
|
||||||
|
{
|
||||||
|
modelList = modelList.Where(x => x.codice_tecnico.ToUpper().Contains(tecnico)).ToList();
|
||||||
|
ViewData["tecnico"] = tecnico;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ViewData["tecnico"] = null;
|
||||||
|
|
||||||
if (page != null && page < 1)
|
if (page != null && page < 1)
|
||||||
{
|
{
|
||||||
@ -80,6 +110,9 @@ namespace VirtualTask.Controllers
|
|||||||
.OrderByDescending(s => s.seriale_rapportino)
|
.OrderByDescending(s => s.seriale_rapportino)
|
||||||
.ToPagedList(page ?? 1, pageSize);
|
.ToPagedList(page ?? 1, pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
ViewBag.Tecnici = GetTecnici();
|
||||||
|
|
||||||
return View(shortLinks);
|
return View(shortLinks);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -346,11 +379,22 @@ namespace VirtualTask.Controllers
|
|||||||
{
|
{
|
||||||
string data = response.Content.ReadAsStringAsync().Result;
|
string data = response.Content.ReadAsStringAsync().Result;
|
||||||
modelList = JsonConvert.DeserializeObject<List<Tecnici>>(data);
|
modelList = JsonConvert.DeserializeObject<List<Tecnici>>(data);
|
||||||
|
|
||||||
|
//per gestire primo elemento tendina (deve essere vuoto)
|
||||||
|
SelectListItem listItemFirst = new SelectListItem();
|
||||||
|
|
||||||
|
listItemFirst.Value = string.Empty;
|
||||||
|
listItemFirst.Text = " - Tecnico";
|
||||||
|
selectItems.Add(listItemFirst);
|
||||||
|
|
||||||
foreach (var role in modelList)
|
foreach (var role in modelList)
|
||||||
{
|
{
|
||||||
SelectListItem listItem = new SelectListItem();
|
SelectListItem listItem = new SelectListItem();
|
||||||
|
|
||||||
|
string s = role.tccodice + " - " + role.tcdescri;
|
||||||
listItem.Value = role.tccodice;
|
listItem.Value = role.tccodice;
|
||||||
listItem.Text = role.tcdescri;
|
listItem.Text = s/*role.tcdescri*/;
|
||||||
|
|
||||||
selectItems.Add(listItem);
|
selectItems.Add(listItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,21 +12,45 @@
|
|||||||
|
|
||||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="Create" class="info-data"><img src="~/assets/images/icons8-nuovo-50.png" alt="Crea un nuovo elemento" /></a>
|
<a asp-action="Create" class="info-data"><img src="~/assets/images/icons8-nuovo-50.png" alt="Crea un nuovo elemento" /></a>
|
||||||
</p>
|
</p>
|
||||||
@using (Html.BeginForm())
|
|
||||||
|
@using (Html.BeginForm("Index", "Impianti"))
|
||||||
{
|
{
|
||||||
|
<div class="card">
|
||||||
<div>
|
<h5 class="card-header">Ricerca</h5>
|
||||||
<div style="float:left;width:40%;padding:0 20px;">@Html.TextBox("SearchString", null, new { placeholder = "Cerca per Indirizzo", @class = "agy-form-field require" })</div>
|
<div class="table-responsive text-nowrap">
|
||||||
<div style="float:left;width:2%;"> </div>
|
<table class="table">
|
||||||
<div style="float:left;width:57%;"><input type="submit" value="Cerca" class="agy-btn submitForm" /></div>
|
<tbody class="table-border-bottom-0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3">Indirizzo:</i>
|
||||||
|
<span class="fw-medium">@Html.TextBox("searchString", null, new { placeholder = "Cerca per indirizzo impianto", @class = "agy-form-field require" })</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3">Cliente:</i>
|
||||||
|
<span class="fw-medium">@Html.DropDownList("cliente", ViewBag.Clienti, null, new { @class = "agy-form-field require" })</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3"> </i>
|
||||||
|
<span class="fw-medium"><input type="submit" value="Cerca" class="agy-btn submitForm" /></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<table class="table">
|
|
||||||
|
<div style="width:100%;height:30px;">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h5 class="card-header">IMPIANTI</h5>
|
||||||
|
<div class="table-responsive text-nowrap">
|
||||||
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:20%;">Impianto</th>
|
<th style="width:20%;">Impianto</th>
|
||||||
@ -66,14 +90,16 @@
|
|||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<nav>
|
<nav>
|
||||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString=@ViewData["CurrentFilter"] }), new PagedListRenderOptions()
|
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString = @ViewData["CurrentFilter"], cliente = ViewData["CurrentFilterCli"]}), new PagedListRenderOptions()
|
||||||
{
|
{
|
||||||
ActiveLiElementClass = "active",
|
ActiveLiElementClass = "active",
|
||||||
PageClasses = new[]{ "page-link"},
|
PageClasses = new[] { "page-link" },
|
||||||
LiElementClasses=new[] { "page-item" },
|
LiElementClasses = new[] { "page-item" },
|
||||||
UlElementClasses = new[] { "pagination","justify-content-center", "mt-3" },
|
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
|
||||||
LinkToNextPageFormat = "Successiva",
|
LinkToNextPageFormat = "Successiva",
|
||||||
LinkToPreviousPageFormat = "Precedente",
|
LinkToPreviousPageFormat = "Precedente",
|
||||||
MaximumPageNumbersToDisplay = 5,
|
MaximumPageNumbersToDisplay = 5,
|
||||||
@ -82,6 +108,7 @@
|
|||||||
})
|
})
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@*
|
@*
|
||||||
|
|
||||||
|
|||||||
@ -3,17 +3,13 @@
|
|||||||
@using X.PagedList.Mvc.Core;
|
@using X.PagedList.Mvc.Core;
|
||||||
@using X.PagedList.Web.Common;
|
@using X.PagedList.Web.Common;
|
||||||
|
|
||||||
|
|
||||||
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
|
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Buoni intervento";
|
ViewData["Title"] = "Buoni intervento";
|
||||||
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -21,24 +17,64 @@
|
|||||||
@* <p>
|
@* <p>
|
||||||
<a asp-action="Create" class="info-data"><img src="~/assets/images/icons8-nuovo-50.png" alt="Crea un nuovo elemento" /></a>
|
<a asp-action="Create" class="info-data"><img src="~/assets/images/icons8-nuovo-50.png" alt="Crea un nuovo elemento" /></a>
|
||||||
</p> *@
|
</p> *@
|
||||||
@using (Html.BeginForm())
|
|
||||||
|
@using (Html.BeginForm("Index","Rapp_New"))
|
||||||
{
|
{
|
||||||
|
<div class="card">
|
||||||
|
<h5 class="card-header">Ricerca</h5>
|
||||||
|
<div class="table-responsive text-nowrap">
|
||||||
|
<table class="table">
|
||||||
|
<tbody class="table-border-bottom-0">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3">Codice buono:</i>
|
||||||
|
<span class="fw-medium">@Html.TextBox("Codbuono", null, new { placeholder = "Cerca per Buono", @class = "agy-form-field require" })</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3">Tecnico:</i>
|
||||||
|
<span class="fw-medium">@Html.DropDownList("tecnico", ViewBag.Tecnici, null, new { @class = "agy-form-field require" })</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3">Data da:</i>
|
||||||
|
<span class="fw-medium">@Html.TextBox("dataIni", null, new { type = "date", @class = "agy-form-field require" })</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3">Data a:</i>
|
||||||
|
<span class="fw-medium">@Html.TextBox("dataFin", null, new { type = "date", @class = "agy-form-field require" })</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<i class="bx bxl-angular bx-sm text-black me-3"> </i>
|
||||||
|
<span class="fw-medium"><input type="submit" value="Cerca" class="agy-btn submitForm" /></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<div>
|
</tbody>
|
||||||
<div style="float:left;width:40%;padding:0 20px;">@Html.TextBox("SearchString", null, new { placeholder = "Cerca per data buono", @class = "agy-form-field require" })</div>
|
</table>
|
||||||
<div style="float:left;width:2%;"> </div>
|
</div>
|
||||||
<div style="float:left;width:57%;"><input type="submit" value="Cerca" class="agy-btn submitForm" /></div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
<table class="table">
|
|
||||||
|
<div style="width:100%;height:30px;">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h5 class="card-header">BUONI INTERVENTO</h5>
|
||||||
|
<div class="table-responsive text-nowrap">
|
||||||
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@* <th>Seriale rapportino</th> *@
|
<th>Codice buono</th>
|
||||||
@* <th>Tipo rapportino</th> *@
|
@* <th>Tipo rapportino</th> *@
|
||||||
@* <th>Azienda</th> *@
|
@* <th>Azienda</th> *@
|
||||||
<th>Data buono</th>
|
<th>Data</th>
|
||||||
<th>Codice impianto</th>
|
<th>Codice impianto</th>
|
||||||
@* <th hidden>Az. chiamata</th> *@
|
@* <th hidden>Az. chiamata</th> *@
|
||||||
@* <th hidden>Seriale chiamata</th> *@
|
@* <th hidden>Seriale chiamata</th> *@
|
||||||
@ -102,7 +138,6 @@
|
|||||||
@foreach (var item in Model)
|
@foreach (var item in Model)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
@Html.HiddenFor(modelItem => item.seriale_rapportino)
|
|
||||||
@Html.HiddenFor(modelItem => item.tipo_rapportino)
|
@Html.HiddenFor(modelItem => item.tipo_rapportino)
|
||||||
@Html.HiddenFor(modelItem => item.azienda_impianto)
|
@Html.HiddenFor(modelItem => item.azienda_impianto)
|
||||||
@Html.HiddenFor(modelItem => item.azienda_chiamata)
|
@Html.HiddenFor(modelItem => item.azienda_chiamata)
|
||||||
@ -160,6 +195,9 @@
|
|||||||
@Html.HiddenFor(modelItem => item.rafoto8)
|
@Html.HiddenFor(modelItem => item.rafoto8)
|
||||||
@Html.HiddenFor(modelItem => item.rafoto9)
|
@Html.HiddenFor(modelItem => item.rafoto9)
|
||||||
@Html.DisplayFor(modelItem => item.rafoto10)
|
@Html.DisplayFor(modelItem => item.rafoto10)
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.seriale_rapportino)
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.data_rapportino)
|
@Html.DisplayFor(modelItem => item.data_rapportino)
|
||||||
</td>
|
</td>
|
||||||
@ -191,9 +229,14 @@
|
|||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<nav>
|
<nav>
|
||||||
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString=@ViewData["CurrentFilter"] }), new PagedListRenderOptions()
|
@Html.PagedListPager(Model, page => Url.Action("index", new { page = page, searchString = @ViewData["CurrentFilter"],
|
||||||
|
CodBuono = ViewData["Codbuono"], tecnico = @ViewData["tecnico"], dataIni = ViewData["dataIni"], dataFin=@ViewData["dataFin"]}), new PagedListRenderOptions()
|
||||||
{
|
{
|
||||||
ActiveLiElementClass = "active",
|
ActiveLiElementClass = "active",
|
||||||
PageClasses = new[]{ "page-link"},
|
PageClasses = new[]{ "page-link"},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user