From 84beb5140437a51915d6fa1425e746e790ccce91 Mon Sep 17 00:00:00 2001 From: michele Date: Fri, 19 Jan 2024 16:37:46 +0100 Subject: [PATCH] Michele: modifica ricerca estrazione rapportini + Template --- Controllers/RapportiniController.cs | 16 +++++++++----- Views/Rapportini/Index.cshtml | 28 +++++++++++++----------- Views/Shared/_LayoutAreaRiservata.cshtml | 4 ++-- Views/Shared/_LayoutPortale.cshtml | 4 ++-- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Controllers/RapportiniController.cs b/Controllers/RapportiniController.cs index 466aa4a..1997484 100644 --- a/Controllers/RapportiniController.cs +++ b/Controllers/RapportiniController.cs @@ -36,7 +36,7 @@ namespace VirtualTask.Controllers #region INDEX - public IActionResult Index(string impianto, int? page = 1) + public IActionResult Index(string impianto, DateTime dataIni, DateTime dataFin, int? page = 1) { SessionHelper helper = new SessionHelper(this); token = helper.GetStringValue("tok"); @@ -75,6 +75,15 @@ namespace VirtualTask.Controllers else ViewData["CurrentFilter"] = null; + if (!dataFin.ToString().Substring(0, 10).Equals("01/01/0001")) + { + modelList = modelList.Where(x => x.data_rapportino.GetValueOrDefault().Date >= dataIni.Date && x.data_rapportino.GetValueOrDefault().Date <= dataFin.Date).ToList(); + } + else + { + modelList = modelList.Where(x => x.data_rapportino.GetValueOrDefault().Date >= dataIni.Date).ToList(); + } + if (page != null && page < 1) { page = 1; @@ -128,9 +137,7 @@ namespace VirtualTask.Controllers modelList = JsonConvert.DeserializeObject>(data); - ViewData["CurrentFilter"] = impianto; - - if (!impianto.Equals("System.Collections.Generic.List`1[Microsoft.AspNetCore.Mvc.Rendering.SelectListItem]")/* || impianto != null*/) + if (impianto != null) { modelList = modelList.Where(x => x.codice_impianto.Equals(impianto)).ToList(); } @@ -148,7 +155,6 @@ namespace VirtualTask.Controllers workbook.AddWorksheet("sheetName"); var ws = workbook.Worksheet("sheetName"); - int col = 1; //Scrivo intestazioni colonne diff --git a/Views/Rapportini/Index.cshtml b/Views/Rapportini/Index.cshtml index 4dae37e..9f910d0 100644 --- a/Views/Rapportini/Index.cshtml +++ b/Views/Rapportini/Index.cshtml @@ -10,7 +10,6 @@ Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml"; } -
@@ -20,11 +19,24 @@
Impianto: @Html.DropDownList("impianto", ViewBag.Rapportini, null, new { @class = "agy-form-field require" }) + + @*
*@ + Data da: + @Html.TextBox("dataIni", null, new { type = "date", @class = "agy-form-field require" }) + @*
*@ + + @*
*@ + Data a: + @Html.TextBox("dataFin", null, new { type = "date", @class = "agy-form-field require" }) + @*
*@ +
+
 
 
 
+
} @@ -34,20 +46,10 @@ @using (Html.BeginForm("ExportDataToExcel", "Rapportini")) { -
- Data da: - @Html.TextBox("dataIni", null, new { type = "date", @class = "agy-form-field require" }) -
- -
- Data a: - @Html.TextBox("dataFin", null, new { type = "date", @class = "agy-form-field require" }) -
- + @Html.Hidden("dataIni", ViewBag.Rapportini, null) + @Html.Hidden("dataFin", ViewBag.Rapportini, null) @Html.Hidden("impianto", ViewBag.Rapportini, null) - @* @Html.Hiddenfor(x => x.codice) *@ -
diff --git a/Views/Shared/_LayoutAreaRiservata.cshtml b/Views/Shared/_LayoutAreaRiservata.cshtml index bf310f7..64ed298 100644 --- a/Views/Shared/_LayoutAreaRiservata.cshtml +++ b/Views/Shared/_LayoutAreaRiservata.cshtml @@ -174,7 +174,7 @@ Purchase:
- *@
diff --git a/Views/Shared/_LayoutPortale.cshtml b/Views/Shared/_LayoutPortale.cshtml index 6db79d2..4b81365 100644 --- a/Views/Shared/_LayoutPortale.cshtml +++ b/Views/Shared/_LayoutPortale.cshtml @@ -150,7 +150,7 @@ Purchase:
  • Accedi
  • - *@