Aggiunta filtro search per PODL
This commit is contained in:
@@ -124,7 +124,7 @@ namespace MP.SPEC.Components
|
||||
var done = await MDService.POdlDeleteRecord(selRec);
|
||||
await callSyncDb(selRec.IdxMacchina);
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace MP.SPEC.Components
|
||||
lastFilter = actFilter.clone();
|
||||
_lastPadCodXdl = padCodXdl;
|
||||
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace MP.SPEC.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
protected async Task ReloadDataAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
ListRecords = null;
|
||||
@@ -275,8 +275,24 @@ namespace MP.SPEC.Components
|
||||
|
||||
// ✅ aspetta tutto insieme
|
||||
await Task.WhenAll(odlTask, searchTask);
|
||||
|
||||
SearchRecords = searchTask.Result;
|
||||
var rawList = searchTask.Result;
|
||||
// se abilitata ricerca filtro ulteriormente..
|
||||
if (string.IsNullOrEmpty(actFilter.SearchVal))
|
||||
{
|
||||
SearchRecords = rawList;
|
||||
}
|
||||
else
|
||||
{
|
||||
SearchRecords = rawList
|
||||
.Where(x =>
|
||||
//EF.Functions.Like(x.CodArticolo, actFilter.SearchVal) ||
|
||||
//EF.Functions.Like(x.CodFase, actFilter.SearchVal) ||
|
||||
//EF.Functions.Like(x.DescArticolo, actFilter.SearchVal)
|
||||
x.CodArticolo.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|
||||
|| x.CodFase.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|
||||
|| x.DescArticolo.Contains(actFilter.SearchVal, StringComparison.InvariantCulture)
|
||||
).ToList();
|
||||
}
|
||||
|
||||
totalCount = SearchRecords.Count;
|
||||
|
||||
@@ -320,7 +336,7 @@ namespace MP.SPEC.Components
|
||||
showRecipeConf = false;
|
||||
if (forceUpdate)
|
||||
{
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
}
|
||||
await RecordEdit.InvokeAsync(null);
|
||||
}
|
||||
@@ -395,7 +411,7 @@ namespace MP.SPEC.Components
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
@@ -2131,9 +2131,9 @@ namespace MP.SPEC.Data
|
||||
/// Elimina record + svuotamento cache
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
public async Task<bool> TemplateKitDelete(TemplateKitModel currRecord)
|
||||
public async Task<bool> TemplateKitDeleteAsync(TemplateKitModel currRecord)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("TemplateKitDelete");
|
||||
using var activity = ActivitySource.StartActivity("TemplateKitDeleteAsync");
|
||||
string source = "DB";
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
@@ -2141,7 +2141,7 @@ namespace MP.SPEC.Data
|
||||
await FlushCacheByTagAsync(Utils.redisKitTempl);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"TemplateKitDelete | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"TemplateKitDeleteAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
@@ -2169,9 +2169,9 @@ namespace MP.SPEC.Data
|
||||
/// </summary>
|
||||
/// <param name="currRecord"></param>
|
||||
/// <param name="codAzienda"></param>
|
||||
public async Task<bool> TemplateKitUpsert(TemplateKitModel currRecord, string codAzienda)
|
||||
public async Task<bool> TemplateKitUpsertAsync(TemplateKitModel currRecord, string codAzienda)
|
||||
{
|
||||
using var activity = ActivitySource.StartActivity("TemplateKitUpsert");
|
||||
using var activity = ActivitySource.StartActivity("TemplateKitUpsertAsync");
|
||||
string source = "DB";
|
||||
bool fatto = false;
|
||||
// salvo
|
||||
@@ -2179,7 +2179,7 @@ namespace MP.SPEC.Data
|
||||
await FlushCacheByTagAsync(Utils.redisKitTempl);
|
||||
activity?.SetTag("data.source", source);
|
||||
activity?.Stop();
|
||||
LogTrace($"TemplateKitUpsert | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
LogTrace($"TemplateKitUpsertAsync | {source} | {activity?.Duration.TotalMilliseconds}ms");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace MP.SPEC.Pages
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Eliminazione riga KIT: sei sicuro di voler procedere?"))
|
||||
return;
|
||||
|
||||
var done = await MDService.TemplateKitDelete(selRec);
|
||||
var done = await MDService.TemplateKitDeleteAsync(selRec);
|
||||
EditRecord = null;
|
||||
await ResetDataAsync();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ namespace MP.SPEC.Pages
|
||||
return;
|
||||
|
||||
await Task.Delay(1);
|
||||
var done = await MDService.TemplateKitUpsert(selRec, CodAzienda);
|
||||
var done = await MDService.TemplateKitUpsertAsync(selRec, CodAzienda);
|
||||
EditRecord = null;
|
||||
await ResetDataAsync();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<div class="input-group-text">
|
||||
<span class="me-1" title="Elenco PODL disponibili da produrre">Da Produrre</span>
|
||||
<div class="form-check form-check-sm form-switch py-1" title="Modalità display (Disponibili / Lanciati)">
|
||||
<input class="form-check-input" type="checkbox" name="setupAlarms" @onclick="()=> toggleClosed()">
|
||||
<input class="form-check-input" type="checkbox" name="setupAlarms" @onclick="() => toggleClosed()">
|
||||
</div>
|
||||
<span class="" title="Elenco PODL già lanciati/prodotti">Lanciati</span>
|
||||
</div>
|
||||
@@ -29,20 +29,27 @@
|
||||
</div>
|
||||
<div class="d-flex justify-content-end col-6">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="p-1">
|
||||
<div class="input-group me-2" style="min-width: 20rem;">
|
||||
<span class="input-group-text"><i class="fa fa-search"></i></span>
|
||||
<input type="text" class="form-control" placeholder="@($"Ricerca Ctrl-R")" aria-label="Ricerca" title="@($"Ricerca Articolo | Ctrl-R")" @bind="@currFilter.SearchVal" @bind:after="ReloadDataAsync" accesskey="R">
|
||||
<button class="btn @sSearchCss" @onclick="ResetSearch"><i class="fa fa-ban"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
@if (filtActive)
|
||||
{
|
||||
<div class=" rounded small d-flex justify-content-between" title="Filtri attivi">
|
||||
@if (selReparto != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetReparto()" title="Rimuovi Filtro Reparto"><i class="fa-solid fa-building"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => resetReparto()" title="Rimuovi Filtro Reparto"><i class="fa-solid fa-building"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
@if (macchina != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => resetMacchina()" title="Rimuovi Filtro Impianto"><i class="fa-solid fa-hard-drive"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
@if (StatoSel != "*")
|
||||
{
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="()=>resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
<button class="btn btn-outline-primary btn-sm mx-2" @onclick="() => resetFase()" title="Rimuovi Filtro Parametro"><i class="fa-solid fa-sliders"></i>   <i class="fa-solid fa-xmark text-warning"></i></button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -164,7 +171,7 @@
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-text" id="inputGroup-sizing-sm">Gruppo</span>
|
||||
@if (currGruppoSel != null && currGruppoSel.CodGruppo!=null)
|
||||
@if (currGruppoSel != null && currGruppoSel.CodGruppo != null)
|
||||
{
|
||||
<input @bind-value="@currGruppoSel.DescrGruppo" class="form-control" disabled />
|
||||
}
|
||||
|
||||
+15
-11
@@ -58,10 +58,6 @@ namespace MP.SPEC.Pages
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
#if false
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
#endif
|
||||
|
||||
[Inject]
|
||||
protected ILocalStorageService localStorage { get; set; } = null!;
|
||||
@@ -84,7 +80,7 @@ namespace MP.SPEC.Pages
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecord = null;
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
@@ -165,7 +161,7 @@ namespace MP.SPEC.Pages
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
// carico dati
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
}
|
||||
|
||||
protected async Task pgResetReq(bool doReset)
|
||||
@@ -341,7 +337,7 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
currRecord.CodArticolo = "";
|
||||
}
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -360,7 +356,7 @@ namespace MP.SPEC.Pages
|
||||
_currAzienda = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -380,7 +376,7 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private SelectXdlParams currFilter { get; set; } = new SelectXdlParams();
|
||||
private SelectXdlParams currFilter { get; set; } = new SelectXdlParams() { SearchVal = "" };
|
||||
|
||||
private int currPage
|
||||
{
|
||||
@@ -495,7 +491,7 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
private async Task ReloadDataAsync()
|
||||
{
|
||||
isLoading = true;
|
||||
ListMacchine = await MDService.MacchineGetFiltAsync(selReparto);
|
||||
@@ -511,6 +507,14 @@ namespace MP.SPEC.Pages
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private string sSearchCss => string.IsNullOrEmpty(currFilter.SearchVal) ? "btn-secondary" : "btn-primary";
|
||||
|
||||
private async Task ResetSearch()
|
||||
{
|
||||
currFilter.SearchVal = "";
|
||||
await ReloadDataAsync();
|
||||
}
|
||||
|
||||
private async Task UpdateFilter(SelectXdlParams newParams)
|
||||
{
|
||||
isLoading = true;
|
||||
@@ -518,7 +522,7 @@ namespace MP.SPEC.Pages
|
||||
currPage = 1;
|
||||
// salvo comunque filtro reparto x utente
|
||||
await localStorage.SetItemAsync("reparto", selReparto);
|
||||
await ReloadData();
|
||||
await ReloadDataAsync();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
currFilter = newParams;
|
||||
|
||||
Reference in New Issue
Block a user