Merge branch 'master' of 10.0.0.83:/usr/local/git/VirtualTask

This commit is contained in:
Marco Audiffredi 2024-05-20 14:55:48 +02:00
commit 908d11abc9
3 changed files with 69 additions and 24 deletions

View File

@ -29,7 +29,7 @@ namespace VirtualTask.Controllers
#region INDEX #region INDEX
public IActionResult Index(int id, int? page = 1) public IActionResult Index(DateTime dataTimb, string commessa, string tecnico, int? page = 1)
{ {
SessionHelper helper = new SessionHelper(this); SessionHelper helper = new SessionHelper(this);
token = helper.GetStringValue("tok"); token = helper.GetStringValue("tok");
@ -57,15 +57,30 @@ namespace VirtualTask.Controllers
string data = response.Content.ReadAsStringAsync().Result; string data = response.Content.ReadAsStringAsync().Result;
modelList = JsonConvert.DeserializeObject<List<Timbratura>>(data); modelList = JsonConvert.DeserializeObject<List<Timbratura>>(data);
if (id != 0) if (dataTimb.Date != DateTime.MinValue)
{ {
modelList = modelList.Where(s => s.id == id).ToList(); modelList = modelList.Where(x => x.data_timbratura.GetValueOrDefault().Date == dataTimb).ToList();
ViewData["CurrentFilter"] = id;
} }
else
if (!string.IsNullOrEmpty(commessa))
{ {
ViewData["CurrentFilter"] = null; modelList = modelList.Where(s => s.commessa.ToLower().Contains(commessa.ToLower())).ToList();
} }
if (!string.IsNullOrEmpty(tecnico))
{
modelList = modelList.Where(s => s.tecnico.ToLower().Contains(tecnico.ToLower())).ToList();
}
//if (id != 0)
//{
// modelList = modelList.Where(s => s.id == id).ToList();
// ViewData["CurrentFilter"] = id;
//}
//else
//{
// ViewData["CurrentFilter"] = null;
//}
if (page != null && page < 1) if (page != null && page < 1)
{ {
page = 1; page = 1;
@ -133,7 +148,7 @@ namespace VirtualTask.Controllers
#region metodi interni #region metodi interni
public IActionResult ExportExcel(int id) public IActionResult ExportExcel(DateTime dataTimb, string commessa, string tecnico)
{ {
SessionHelper helper = new SessionHelper(this); SessionHelper helper = new SessionHelper(this);
token = helper.GetStringValue("tok"); token = helper.GetStringValue("tok");
@ -161,6 +176,22 @@ namespace VirtualTask.Controllers
modelList = JsonConvert.DeserializeObject<List<Timbratura>>(data); modelList = JsonConvert.DeserializeObject<List<Timbratura>>(data);
if (dataTimb.Date != DateTime.MinValue)
{
modelList = modelList.Where(x => x.data_timbratura.GetValueOrDefault().Date == dataTimb).ToList();
}
if (!string.IsNullOrEmpty(commessa))
{
modelList = modelList.Where(s => s.commessa.Contains(commessa)).ToList();
}
if (!string.IsNullOrEmpty(tecnico))
{
modelList = modelList.Where(s => s.tecnico.Contains(tecnico)).ToList();
}
var workbook = new XLWorkbook(); var workbook = new XLWorkbook();
workbook.AddWorksheet("sheetName"); workbook.AddWorksheet("sheetName");
var ws = workbook.Worksheet("sheetName"); var ws = workbook.Worksheet("sheetName");

View File

@ -4,8 +4,8 @@
ViewData["Title"] = "Listino Virtual Task 2024"; ViewData["Title"] = "Listino Virtual Task 2024";
} }
<div> <div>
<img src="~/assets/images/immagine1Trasp.png" alt="Virtual Task App" style="width:12%; height:12%; margin-left:50%" /> <img src="~/assets/images/immagine1Trasp.png" alt="Virtual Task App" style="width:12%; height:12%; margin-left:25%"/>
<img src="~/assets/images/virtualTaskTS.png" alt="Virtual Task App" style="width:9%;height:9%" /> <img src="~/assets/images/virtualTaskTS.png" alt="Virtual Task App" style="width:9% ;height:9%; margin-left:25%"/>
</div> </div>
<div class="agy-project-wrapper agy-project-page-wrapper"> <div class="agy-project-wrapper agy-project-page-wrapper">
<div class="container" style="width:100%; text-align:justify"> <div class="container" style="width:100%; text-align:justify">

View File

@ -14,22 +14,32 @@
<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">
@using (Html.BeginForm()) @using (Html.BeginForm("Index", "Timbrature"))
{ {
<div> <div>
<div class="row"> <div style="float:left;width:40%;padding:0 20px;">
<div style="float:left;width:40%;padding:0 10px;"> <th><b>Data timbratura:</b></th>
@Html.TextBox("id", null, new { placeholder = "Cerca per id", @class = "agy-form-field require" }) @* @Html.TextBox("dataTimb", ViewBag.Timbrature, null, new { @class = "agy-form-field require" }) *@
</div> @Html.TextBox("dataTimb", null, new { type = "date", @class = "agy-form-field require" })
</div>
<div style="float:left;width:2%;">&nbsp;</div>
<div style="float:left;width:57%;"><input type="submit" value="Cerca" class="agy-btn submitForm" /></div>
</div>
<div style="float:left;width:2%;">&nbsp;</div> @* <div style="float:left;width:40%;padding:0 20px;"> *@
<div style="float:left;width:2%;">&nbsp;</div> <th><b>Commessa:</b></th>
<div style="float:left;width:2%;">&nbsp;</div> @Html.TextBox("commessa", ViewBag.Timbrature, null, new { @class = "agy-form-field require" })
@* </div> *@
@* <div style="float:left;width:40%;padding:0 20px;"> *@
<th><b>Tecnico:</b></th>
@Html.TextBox("tecnico", ViewBag.Timbrature, null, new { @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%;">&nbsp;</div>
<div style="float:left;width:2%;">&nbsp;</div>
<div style="float:left;width:2%;">&nbsp;</div>
</div>
} }
<br> <br>
@ -38,11 +48,15 @@
@using (Html.BeginForm("ExportExcel", "Timbrature")) @using (Html.BeginForm("ExportExcel", "Timbrature"))
{ {
<div style="float:left;width:40%;padding:0 5px;"> @Html.Hidden("dataTimb", ViewBag.Timbrature, null)
@Html.Hidden("commessa", ViewBag.Timbrature, null)
@Html.Hidden("tecnico", ViewBag.Timbrature, null)
<div style="float:left;width:40%;padding:0 20px;">
<input type="submit" value="Esporta excel" name="Esporta excel" class="agy-btn submitForm" /> <input type="submit" value="Esporta excel" name="Esporta excel" class="agy-btn submitForm" />
@* <div style="float:left;width:57%;"><input type="submit" value="Esporta excel" class="agy-btn submitForm" /></div> *@
</div> </div>
} }
<table class="table"> <table class="table">
<thead> <thead>