VirtualTask/Views/Chiamate/Index.cshtml

260 lines
13 KiB
Plaintext

@model IPagedList<VirtualTask.Models.Chiamate>
@using X.PagedList.Mvc.Core;
@using X.PagedList.Web.Common;
@using X.PagedList;
<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
@{
ViewData["Title"] = "Chiamate";
Layout = "~/Views/Shared/_LayoutAreaRiservata.cshtml";
string da = string.Empty;
string a = string.Empty;
if (!string.IsNullOrEmpty((string)ViewBag.Da))
{
da = ViewBag.Da;
}
if (!string.IsNullOrEmpty((string)ViewBag.A))
{
a = ViewBag.A;
}
}
<style>
.dotGray, .dotYellow, .dotGreen, .dotOrange, .dotBlack {
height: 20px;
width: 20px;
border-radius: 50%;
display: inline-block;
}
.dotGray {
background-color: #bbb;
}
.dotYellow {
background-color: yellow;
}
.dotGreen {
background-color: green;
}
.dotOrange {
background-color: orange;
}
.dotBlack {
background-color: black;
}
/* 🔽 Fix per il wrapping della tabella */
.table td,
.table th {
white-space: normal !important; /* consente di andare a capo */
word-wrap: break-word;
word-break: break-word;
max-width: 250px; /* regola la larghezza massima */
}
</style>
<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("Index", "Chiamate"))
{
<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">Cliente</i>
<span class="fw-medium">@Html.TextBox("cliente", null, new { placeholder = "Cerca per nome cliente", @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>
<i class="bx bxl-angular bx-sm text-black me-3">Impianto:</i>
<span class="fw-medium">@Html.DropDownList("impianto", ViewBag.Impianti, null, new { @class = "agy-form-field require" })</span>
</td>
<td>
<i class="bx bxl-angular bx-sm text-black me-3">Indirizzo:</i>
<span class="fw-medium">@Html.TextBox("indirizzo", null, new { placeholder = "Cerca per indirizzo impianto", @class = "agy-form-field require" })</span>
</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<i class="bx bxl-angular bx-sm text-black me-3">Data da:</i>
<span class="fw-medium"><input type="date" id="dataIni" name="dataIni" value="@da" class="agy-form-field" /></span>
</td>
<td>
<i class="bx bxl-angular bx-sm text-black me-3">Data a:</i>
<span class="fw-medium"><input type="date" id="dataFin" name="dataFin" value="@a" class="agy-form-field" /></span>
</td>
<td>
<i class="bx bxl-angular bx-sm text-black me-3">Stato:</i>
<span class="fw-medium">@Html.DropDownList("stato", ViewBag.StatiChiamata, null, new { @class = "agy-form-field require" }) </span>
</td>
<td>
<span class="fw-medium"><input type="submit" value="Cerca" class="agy-btn submitForm" /></span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
}
<div style="width:100%;height:30px;">
&nbsp
</div>
<div class="card">
<h5 class="card-header">CHIAMATE</h5>
<div class="table-responsive text-nowrap">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Data apertura</th>
<th>Data appuntamento</th>
<th>Impianto</th>
<th>Cod. Segnalazione</th>
<th>Cliente</th>
<th>Tecnico</th>
<th>&nbsp;</th>
<th>Buono</th>
<th></th>
</tr>
</thead>
<tbody class="table-border-bottom-0">
@foreach (var item in Model)
{
<tr>
@Html.HiddenFor(modelItem => item.chserial)
@Html.HiddenFor(modelItem => item.chcodese)
<td>@Html.DisplayFor(modelItem => item.numIntero)</td>
<td>@Html.DisplayFor(modelItem => item.chdata)</td>
<td>@Html.DisplayFor(modelItem => item.chdtapp)</td>
<td>@Html.DisplayFor(modelItem => item.chcodimp) - @Html.DisplayFor(modelItem => item.indirizzoBreve)</td>
<td>@* @Html.DisplayFor(modelItem => item.chcodseg) - *@@Html.DisplayFor(modelItem => item.csdescr)</td>
<td>@Html.DisplayFor(modelItem => item.andescri)</td>
<td>@* @Html.DisplayFor(modelItem => item.chtchiam) -*@ @Html.DisplayFor(modelItem => item.tcdescri)</td>
<td>
@if (!string.IsNullOrEmpty(item.chstato) && item.chstato.Equals("S"))
{
<span class="dotGray"></span>
;
}
else if (!string.IsNullOrEmpty(item.rif) && item.rif.Equals("S"))
{
<span class="dotBlack"></span>
;
}
else if (!string.IsNullOrEmpty(item.ser_buono_chiu))
{
<span class="dotGreen"></span>
;
}
else if (!string.IsNullOrEmpty(item.chtchiam))
{
<span class="dotOrange"></span>
;
}
else
{
<span class="dotYellow"></span>
;
}
</td>
<td>
@if (!string.IsNullOrEmpty(item.ser_buono_chiu))
{
<a href="#" class="apri-finestra" data-id="@item.ser_rapp_chiu">@item.ser_buono_chiu</a>
}
</td>
<td>
@{
string _url_edit = Url.Action("Edit", "Chiamate", new { id = item.chserial });
}
@if (string.IsNullOrEmpty(item.ic) && string.IsNullOrEmpty(item.ser_buono_chiu))
{
<a href="@_url_edit" title="Modifica" class="links">
<img alt="Modifica" src="~/assets/images/icons8-modificare-64.png" style="width:30px;height:30px;">
</a>
}
<a href="@Url.Action("Details", "Chiamate", new { id = item.chserial })" title="Dettaglio" class="links">
<img alt="Dettaglio" src="~/assets/images/icons8-visualizza-file-64.png" style="width:30px;height:30px;">
</a>
@{
string _url_del = Url.Action("Delete", "Chiamate", new { id = item.chserial });
}
@if (string.IsNullOrEmpty(item.ic) && string.IsNullOrEmpty(item.ser_buono_chiu))
{
<a href="@_url_del" title="Elimina" class="links">
<img alt="Elimina" src="~/assets/images/icons8-elimina-50.png" style="width:30px;height:30px;">
</a>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
<div style="width:100%;height:15px;">&nbsp;</div>
<div style="width:100%;">
<div style="float:left;"><span class="dotYellow"></span>&nbsp;Da assegnare&nbsp;</div>
<div style="float:left;"><span class="dotOrange"></span>&nbsp;Assegnata&nbsp;</div>
<div style="float:left;"><span class="dotGreen"></span>&nbsp;Chiusa&nbsp;</div>
<div style="float:left;"><span class="dotGray"></span>&nbsp;Sospesa&nbsp;</div>
<div style="float:left;"><span class="dotBlack"></span>&nbsp;Rifiutata&nbsp;</div>
</div>
<nav>
@Html.PagedListPager(Model, page => Url.Action("index", new
{
page = page,
cliente = ViewData["ClienteFilter"],
impianto = ViewData["CurrentFilter"],
tecnico = ViewData["CurrentFilterTec"],
indirizzo = ViewData["CurrentFilterIndiri"],
stato = ViewData["CurrentFilterStato"],
dataIni = ViewData["CurrentFilterDataDa"],
dataFin = ViewData["CurrentFilterDataA"]
}), new PagedListRenderOptions()
{
ActiveLiElementClass = "active",
PageClasses = new[] { "page-link" },
LiElementClasses = new[] { "page-item" },
UlElementClasses = new[] { "pagination", "justify-content-center", "mt-3" },
LinkToNextPageFormat = "Successiva",
LinkToPreviousPageFormat = "Precedente",
MaximumPageNumbersToDisplay = 5,
DisplayLinkToPreviousPage = PagedListDisplayMode.Always,
DisplayLinkToNextPage = PagedListDisplayMode.Always
})
</nav>
</div>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll('.apri-finestra').forEach(function (link) {
link.addEventListener('click', function (e) {
e.preventDefault();
const id = this.getAttribute('data-id');
if (id) {
window.open("/Rapp_New/Immagine?id=" + id, "MyWindow", "top=0,left=0,height=1020,width=1020");
}
});
});
});
</script>