From 0da7a2e98fee70a99c6e73f587637560db6b83e8 Mon Sep 17 00:00:00 2001 From: Marco Audiffredi Date: Thu, 15 May 2025 17:43:23 +0200 Subject: [PATCH] chiamate filtro per stato --- Controllers/ChiamateController.cs | 36 +++++++++++- Views/Chiamate/Details.cshtml | 97 ++++++++++++++++++++++++++++++- Views/Chiamate/Index.cshtml | 72 +++++++++++++++++------ 3 files changed, 184 insertions(+), 21 deletions(-) diff --git a/Controllers/ChiamateController.cs b/Controllers/ChiamateController.cs index 61d14b3..7bd7b90 100644 --- a/Controllers/ChiamateController.cs +++ b/Controllers/ChiamateController.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Newtonsoft.Json; using System.Data; using System.Diagnostics; +using System.Linq.Expressions; using System.Text; using VirtualTask.Models; using X.PagedList; @@ -132,10 +133,32 @@ namespace VirtualTask.Controllers if (!string.IsNullOrEmpty(stato)) { - modelList = modelList.Where(x => x.chstato.Contains(stato)).ToList(); - + switch (stato) + { + case "Z": + // Chiusa: devo andare a vedere se ser_buono_chiu è valorizzato + modelList = modelList.Where(x => !string.IsNullOrEmpty(x.ser_buono_chiu)).ToList(); + break; + case "R": + // rifiutata: devo anadre a vedere se rif è valorizzato e uguale a S + modelList = modelList.Where(x => !string.IsNullOrEmpty(x.rif) && x.rif.Equals("S")).ToList(); + break; + case "B": + // da assegnare: devo anadre a vedere che il tecnico NON SIA valorizzato + modelList = modelList.Where(x => string.IsNullOrEmpty(x.chtchiam)).ToList(); + break; + case "C": + // assegnato: devo anadre a vedere CHE il tecnico SIA valorizzato + modelList = modelList.Where(x => !string.IsNullOrEmpty(x.chtchiam)).ToList(); + break; + default: + // S=sospese + // in questi casi vado ad cercare nel campo stato della chiamata + modelList = modelList.Where(x => !string.IsNullOrEmpty(x.chstato) && x.chstato.Contains(stato)).ToList(); + + break; + } ViewData["CurrentFilterStato"] = stato; - } else ViewData["CurrentFilterStato"] = null; @@ -633,6 +656,13 @@ namespace VirtualTask.Controllers listItem.Selected = true; selectItems.Add(listItem); + listItem = new SelectListItem(); + listItem.Value = "R"; + listItem.Text = "Rifiutata"; + if (!string.IsNullOrEmpty(stato) && stato.Equals("R")) + listItem.Selected = true; + selectItems.Add(listItem); + return selectItems; } private List getTipiChiamata() diff --git a/Views/Chiamate/Details.cshtml b/Views/Chiamate/Details.cshtml index b52ba33..66b8f43 100644 --- a/Views/Chiamate/Details.cshtml +++ b/Views/Chiamate/Details.cshtml @@ -6,7 +6,47 @@ int numChia = -1; numChia = Convert.ToInt32(Model.chnumero); } +
@@ -40,10 +80,65 @@
@Html.DisplayNameFor(model => model.chtchiam) @Html.DisplayFor(model => model.chtchiam)
-
@Html.DisplayNameFor(model => model.chstato) @Html.DisplayFor(model => model.chstato)
+@*
+
@Html.DisplayNameFor(model => model.chstato)
+
 
+ + @{ + //Unico caso in cui vado a vedere lo stato è il caso S=sospesa (grigio) + if (!string.IsNullOrEmpty(Model.chstato) && Model.chstato.Equals("S")) + { + + @Html.DisplayFor(model => model.chstato) - SOSPESA + } + else + { + //Caso rifiutato (nero): devo andare a valutare se il valore di rif è valorizzato e vale S + if (!string.IsNullOrEmpty(Model.rif) && Model.rif.Equals("S")) + { + //rifiutato + + @Html.DisplayFor(model => model.chstato) - RIFIUTATA + } + else + { + //caso chiuso: devo andare a valutare che ser_buono_chiu sia valorizzato + if (!string.IsNullOrEmpty(Model.ser_buono_chiu)) + { + //seriale buono presente: chiusa-verde + @Html.DisplayFor(model => model.chstato) - CHIUSA + + } + else + { + //assegnata(arancio)/non assegnata(giallo) : devo vedere se il tecnico è valorizzato o no + if (!string.IsNullOrEmpty(Model.chtchiam)) + { +
+ +
+
+ @Html.DisplayFor(model => model.chstato) - ASSEGNATA +
+ } + else + { + + @Html.DisplayFor(model => model.chstato) - NON ASSEGNATA + } + } + } + } + } + + + + + +
*@ diff --git a/Views/Chiamate/Index.cshtml b/Views/Chiamate/Index.cshtml index 14d6106..6520b22 100644 --- a/Views/Chiamate/Index.cshtml +++ b/Views/Chiamate/Index.cshtml @@ -173,39 +173,77 @@ @* @Html.DisplayFor(modelItem => item.chstato) - @Html.DisplayFor(modelItem => item.descStato)*@ @{ - if (!string.IsNullOrEmpty(item.rif) && item.rif.Equals("S") ) + //Unico caso in cui vado a vedere lo stato è il caso S=sospesa (grigio) + if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("S")) { - //rifiutato - + } else { - if ( !string.IsNullOrEmpty(item.ser_buono_chiu)) + //Caso rifiutato (nero): devo andare a valutare se il valore di rif è valorizzato e vale S + if (!string.IsNullOrEmpty(item.rif) && item.rif.Equals("S") ) { - //seriale buono presente: chiusa - + //rifiutato + } else { - if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("B")) + //caso chiuso: devo andare a valutare che ser_buono_chiu sia valorizzato + if ( !string.IsNullOrEmpty(item.ser_buono_chiu)) { - + //seriale buono presente: chiusa-verde + } - if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("C")) + else { - - - } - - if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("S")) - { - + //assegnata(arancio)/non assegnata(giallo) : devo vedere se il tecnico è valorizzato o no + if (!string.IsNullOrEmpty(item.chtchiam)) + { + + + } + else + { + + } } } - } + //if (!string.IsNullOrEmpty(item.rif) && item.rif.Equals("S") ) + //{ + // //rifiutato + // + //} + //else + //{ + // if ( !string.IsNullOrEmpty(item.ser_buono_chiu)) + // { + // //seriale buono presente: chiusa + // + // } + // else + // { + // if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("B")) + // { + // + // } + // if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("C")) + // { + // + + // } + + // if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("S")) + // { + // + // } + // } + + //} + + } @* @Html.DisplayFor(modelItem => item.rif)