- completato editing macchine/operatori
This commit is contained in:
Samuele Locatelli
2025-04-16 11:47:11 +02:00
parent 31d8269399
commit 167aa2d98a
3 changed files with 112 additions and 36 deletions
+49 -12
View File
@@ -1,24 +1,32 @@
@using MP.SPEC.Data
<div class="modal-dialog">
<div class="modal-dialog shadow">
<div class="modal-content p-2">
<div class="modal-title d-flex justify-content-between">
<div class="px-0">
<h5>Selezione Macchine</h5>
<div class="modal-title border-bottom">
<div class="d-flex justify-content-between">
<div class="px-1">
<h5>Selezione Operatori</h5>
</div>
<div class="px-1">
<button class="btn btn-outline-dark" @onclick="() => DoClose()"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="px-0">
<button class="btn btn-outline-dark" @onclick="() => DoClose()"><i class="fa-solid fa-xmark"></i></button>
<div class="px-0 mt-1 mb-2">
<div class="input-group">
<span class="input-group-text"><i class="fa fa-search"></i></span>
<input type="text" class="form-control" placeholder="Search Ctr-R" @bind="@SearchVal" accesskey="R">
<button class="btn @btnSearchCss" @onclick="ResetSearch"><i class="fa fa-ban"></i></button>
</div>
</div>
</div>
<div class="modal-body p-1">
@if (ListRecords == null || ListRecords.Count == 0)
{
<div class="alert alert-warning text-center display-6">
Nessuna macchina da aggiungere
Nessun Operatore da aggiungere
</div>
}
else
{
<table class="table table-sm table-striped small">
<thead>
<tr>
@@ -66,12 +74,35 @@
private int numRecord = 5;
protected string SearchVal
{
get => searchVal;
set
{
if (searchVal != value)
{
searchVal = value;
UpdateTable();
}
}
}
private string searchVal = "";
private int totalCount = 0;
private int currPage = 1;
private bool isLoading = false;
private List<AnagOperatoriModel>? ListRecords;
private string btnSearchCss
{
get => string.IsNullOrWhiteSpace(SearchVal) ? "btn-secondary" : "btn-primary";
}
private void ResetSearch()
{
SearchVal = "";
}
protected override void OnParametersSet()
{
numRecord = 10;
@@ -84,11 +115,17 @@
totalCount = 0;
if (AllRecords != null)
{
ListRecords = AllRecords
List<AnagOperatoriModel> tmpList = new List<AnagOperatoriModel>(AllRecords);
// verifico ricerca
if (!string.IsNullOrEmpty(SearchVal))
{
tmpList = AllRecords.Where(x => x.Cognome.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || x.Nome.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)).ToList();
}
ListRecords = tmpList
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
totalCount = AllRecords.Count;
totalCount = tmpList.Count;
}
}