diff --git a/MP.Data/Controllers/MpSpecController.cs b/MP.Data/Controllers/MpSpecController.cs
index e4c4e183..a96e0d9d 100644
--- a/MP.Data/Controllers/MpSpecController.cs
+++ b/MP.Data/Controllers/MpSpecController.cs
@@ -365,7 +365,7 @@ namespace MP.Data.Controllers
{
dbResult = dbCtx
.DbSetODL
- .Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (x.CodArticolo == codArt || codArt == "*"))
+ .Where(x => ((inCorso && x.DataFine == null) || (!inCorso && x.DataFine != null)) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (x.CodArticolo.Contains(codArt) || codArt == "*"))
.AsNoTracking()
.OrderBy(x => x.IdxOdl)
.ToList();
diff --git a/MP.SPEC/Components/CmpTop.razor b/MP.SPEC/Components/CmpTop.razor
index 16d7c863..994fd8da 100644
--- a/MP.SPEC/Components/CmpTop.razor
+++ b/MP.SPEC/Components/CmpTop.razor
@@ -10,7 +10,8 @@
+
+ @TipoSearch
@if (ShowSearch)
@@ -29,6 +30,12 @@
private string userName = "";
+ private string TipoSearch
+ {
+ get => MService.TipoSearch;
+ set => MService.TipoSearch = value;
+ }
+
protected override async Task OnInitializedAsync()
{
MService.EA_ShowSearch += MService_EA_ShowSearch;
diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs
index c712551b..34926d65 100644
--- a/MP.SPEC/Components/ListODL.razor.cs
+++ b/MP.SPEC/Components/ListODL.razor.cs
@@ -63,6 +63,23 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
+ MessageService.EA_SearchUpdated += OnSeachUpdated;
+ await reloadData();
+ }
+
+ protected async void OnSeachUpdated()
+ {
+ await InvokeAsync(() =>
+ {
+ currPage = 1;
+ Task task = UpdateData();
+ StateHasChanged();
+ });
+ }
+
+ protected async Task UpdateData()
+ {
+ currRecord = null;
await reloadData();
}
@@ -96,6 +113,11 @@ namespace MP.SPEC.Components
set => MessageService.numRecord = value;
}
+ private string SearchVal
+ {
+ get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal;
+ }
+
private int totalCount
{
get => MessageService.totalCount;
@@ -114,7 +136,7 @@ namespace MP.SPEC.Components
private async Task reloadData()
{
isLoading = true;
- SearchRecords = await MDService.ListODLFilt(true, "*", StatoSel);
+ SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
diff --git a/MP.SPEC/Data/MessageService.cs b/MP.SPEC/Data/MessageService.cs
index f5b354f2..9a2a0192 100644
--- a/MP.SPEC/Data/MessageService.cs
+++ b/MP.SPEC/Data/MessageService.cs
@@ -61,22 +61,22 @@
{
EA_ShowSearch?.Invoke();
}
-#if false
- if (showSearch)
+ }
+ }
+ }
+
+ public string TipoSearch
+ {
+ get => tipoSearch;
+ set
+ {
+ if (tipoSearch != value)
+ {
+ tipoSearch = value;
+ if (EA_ShowSearch != null)
{
- if (EA_ShowSearch != null)
- {
- EA_ShowSearch?.Invoke();
- }
+ EA_ShowSearch?.Invoke();
}
- else
- {
- if (EA_HideSearch != null)
- {
- EA_HideSearch?.Invoke();
- }
- }
-#endif
}
}
}
@@ -107,6 +107,7 @@
private string searchVal = "";
private bool showSearch;
+ private string tipoSearch = "*";
#endregion Private Fields