- 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
+15 -12
View File
@@ -5,7 +5,10 @@
<h4>Elenco Reparti</h4>
</div>
<div class="px-0">
<button @onclick="() => ToggleAddNew()" class="btn @addNewCss btn-sm"><i class="fa-solid @addNewIcon"></i> @addNewTxt</button>
@if (SelRecord == null)
{
<button @onclick="() => ToggleAddNew()" class="btn @addNewCss btn-sm"><i class="fa-solid @addNewIcon"></i> @addNewTxt</button>
}
</div>
</div>
@if (EditRec != null)
@@ -83,8 +86,8 @@
{
<th class="text-end"><i class="fa-solid fa-hashtag"></i> Macchine</th>
<th class="text-end"><i class="fa-solid fa-hashtag"></i> Operatori</th>
<th class="text-end"></th>
}
<th class="text-end"></th>
</tr>
</thead>
<tbody>
@@ -111,17 +114,17 @@
{
<td class="text-end">@record.CountMacc</td>
<td class="text-end">@record.CountOpr</td>
<td class="text-end">
@if (DelEnabled(record))
{
<button @onclick="() => DoDelete(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
else
{
<button class="btn btn-secondary disabled btn-sm"><i class="bi bi-trash-fill"></i></button>
}
</td>
}
<td class="text-end">
@if (DelEnabled(record))
{
<button @onclick="() => DoDelete(record)" class="btn btn-danger btn-sm"><i class="bi bi-trash-fill"></i></button>
}
else
{
<button class="btn btn-secondary disabled btn-sm"><i class="bi bi-trash-fill"></i></button>
}
</td>
</tr>
}
</tbody>
+48 -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 Macchine</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
Nessuna Macchina da aggiungere
</div>
}
else
{
<table class="table table-sm table-striped small">
<thead>
<tr>
@@ -66,12 +74,34 @@
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<Macchine>? ListRecords;
private string btnSearchCss
{
get => string.IsNullOrWhiteSpace(SearchVal) ? "btn-secondary" : "btn-primary";
}
private void ResetSearch()
{
SearchVal = "";
}
protected override void OnParametersSet()
{
numRecord = 10;
@@ -84,11 +114,17 @@
totalCount = 0;
if (AllRecords != null)
{
ListRecords = AllRecords
List<Macchine> tmpList = new List<Macchine>(AllRecords);
// verifico ricerca
if (!string.IsNullOrEmpty(SearchVal))
{
tmpList = AllRecords.Where(x => x.CodMacchina.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase) || x.Descrizione.Contains(SearchVal, StringComparison.InvariantCultureIgnoreCase)).ToList();
}
ListRecords = tmpList
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
totalCount = AllRecords.Count;
totalCount = tmpList.Count;
}
}
+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;
}
}