@if (ListRecords == null || ListRecords.Count == 0)
{
- Nessuna macchina da aggiungere
+ Nessuna Macchina da aggiungere
}
else
{
-
@@ -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? 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 tmpList = new List(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;
}
}
diff --git a/MP.SPEC/Components/Reparti/ModalOperAdd.razor b/MP.SPEC/Components/Reparti/ModalOperAdd.razor
index b0f5b691..d74303b0 100644
--- a/MP.SPEC/Components/Reparti/ModalOperAdd.razor
+++ b/MP.SPEC/Components/Reparti/ModalOperAdd.razor
@@ -1,24 +1,32 @@
@using MP.SPEC.Data
-
+
-
-
-
Selezione Macchine
+
+
+
+
Selezione Operatori
+
+
+
+
-
@if (ListRecords == null || ListRecords.Count == 0)
{
- Nessuna macchina da aggiungere
+ Nessun Operatore da aggiungere
}
else
{
-
@@ -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? 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 tmpList = new List(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;
}
}