Michele: filtri nuovi Chiamate
This commit is contained in:
parent
424bf98e9d
commit
a5ad8321e3
@ -35,7 +35,7 @@ namespace VirtualTask.Controllers
|
||||
|
||||
#region INDEX
|
||||
|
||||
public IActionResult Index(string searchString, int? page = 1)
|
||||
public IActionResult Index(string impianto, string tecnico, DateTime dataIni, DateTime dataFin, string stato, string indirizzo, int? page = 1)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
token = helper.GetStringValue("tok");
|
||||
@ -48,6 +48,7 @@ namespace VirtualTask.Controllers
|
||||
ViewBag.Admin = admin;
|
||||
time_sheet = helper.GetStringValue("time_sheet");
|
||||
ViewBag.TimeSheet = time_sheet;
|
||||
|
||||
urlBase = apiUrl + "chiamateListMngr";
|
||||
urlBase = urlBase + "?token=" + token;
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
@ -61,12 +62,67 @@ namespace VirtualTask.Controllers
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
modelList = JsonConvert.DeserializeObject<List<Chiamate>>(data);
|
||||
|
||||
if (!string.IsNullOrEmpty(searchString))
|
||||
{
|
||||
modelList = modelList.Where(s => s.chcodimp.ToUpper().Contains(searchString.ToUpper())).ToList();
|
||||
|
||||
ViewData["CurrentFilter"] = searchString;
|
||||
ViewBag.Impianti = getImpianti();
|
||||
ViewBag.Tecnici = getTecnici();
|
||||
ViewBag.StatiChiamata = getStatiChiamata();
|
||||
|
||||
//if (!string.IsNullOrEmpty(searchString))
|
||||
//{
|
||||
// modelList = modelList.Where(s => s.chcodimp.ToUpper().Contains(searchString.ToUpper())).ToList();
|
||||
|
||||
// ViewData["CurrentFilter"] = searchString;
|
||||
//}
|
||||
//else
|
||||
// ViewData["CurrentFilter"] = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(impianto))
|
||||
{
|
||||
modelList = modelList.Where(s => s.chcodimp.Contains(impianto)).ToList();
|
||||
|
||||
ViewData["CurrentFilter"] = impianto;
|
||||
|
||||
ViewBag.Impianto = impianto;
|
||||
}
|
||||
else
|
||||
ViewData["CurrentFilter"] = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(tecnico))
|
||||
{
|
||||
modelList = modelList.Where(s => s.chtchiam.Contains(tecnico)).ToList();
|
||||
|
||||
ViewData["CurrentFilter"] = tecnico;
|
||||
|
||||
ViewBag.Impianto = tecnico;
|
||||
}
|
||||
else
|
||||
ViewData["CurrentFilter"] = null;
|
||||
|
||||
if (dataIni.Date != DateTime.MinValue)
|
||||
{
|
||||
modelList = modelList.Where(x => x.chdata.GetValueOrDefault().Date >= dataIni.Date).ToList();
|
||||
}
|
||||
if (dataFin.Date != DateTime.MinValue)
|
||||
{
|
||||
modelList = modelList.Where(x => x.chdata.GetValueOrDefault().Date <= dataFin.Date).ToList();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(stato))
|
||||
{
|
||||
modelList = modelList.Where(x => x.chstato.Contains(stato)).ToList();
|
||||
|
||||
ViewData["CurrentFilter"] = stato;
|
||||
|
||||
ViewBag.Impianto = stato;
|
||||
}
|
||||
else
|
||||
ViewData["CurrentFilter"] = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(indirizzo))
|
||||
{
|
||||
modelList = modelList.Where(s => s.indirizzoBreve.ToUpper().Contains(indirizzo.ToUpper())).ToList();
|
||||
|
||||
ViewData["CurrentFilter"] = indirizzo;
|
||||
}
|
||||
else
|
||||
ViewData["CurrentFilter"] = null;
|
||||
|
||||
@ -12,17 +12,41 @@
|
||||
<div class="agy-project-wrapper agy-project-page-wrapper">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
|
||||
<p>
|
||||
<a asp-action="Create" class="info-data"><img src="~/assets/images/icons8-nuovo-50.png" alt="Crea un nuovo elemento" /></a>
|
||||
</p>
|
||||
@using (Html.BeginForm())
|
||||
|
||||
@using (Html.BeginForm("Index","Chiamate"))
|
||||
{
|
||||
<div>
|
||||
<div style="float:left;width:40%;padding:0 20px;">@Html.TextBox("SearchString", null, new { placeholder = "Cerca per impianto", @class = "agy-form-field require" })</div>
|
||||
<div style="float:left;width:2%;"> </div>
|
||||
<div style="float:left;width:57%;"><input type="submit" value="Cerca" class="agy-btn submitForm" /></div>
|
||||
<div style="float:left;width:40%;padding:0 20px;">
|
||||
|
||||
<th><b>Tecnico:</b></th>
|
||||
@Html.DropDownList("tecnico", ViewBag.Tecnici, null, new { @class = "agy-form-field require" })
|
||||
|
||||
<th><b>Impianto:</b></th>
|
||||
@Html.DropDownList("impianto", ViewBag.Impianti, null, new { @class = "agy-form-field require" })
|
||||
|
||||
<th><b>Data da:</b></th>
|
||||
@Html.TextBox("dataIni", null, new { type = "date", @class = "agy-form-field require" })
|
||||
|
||||
<th><b>Data a:</b></th>
|
||||
@Html.TextBox("dataFin", null, new { type = "date", @class = "agy-form-field require" })
|
||||
|
||||
<th><b>Stato chiamata:</b></th>
|
||||
@Html.DropDownList("stato", ViewBag.StatiChiamata, null, new { @class = "agy-form-field require" })
|
||||
|
||||
<th><b>Indirizzo:</b></th>
|
||||
<div>
|
||||
@Html.TextBox("indirizzo", null, new { placeholder = "Cerca per indirizzo", @class = "agy-form-field require" })
|
||||
</div>
|
||||
|
||||
<div style="float:left;width:57%;"><input type="submit" value="Cerca" class="agy-btn submitForm" /></div>
|
||||
</div>
|
||||
|
||||
<div style="float:left;width:2%;"> </div>
|
||||
<div style="float:left;width:2%;"> </div>
|
||||
<div style="float:left;width:2%;"> </div>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user