Abbozzato controllo x filtraggio dati ricerca articoli

This commit is contained in:
Samuele Locatelli
2021-09-06 18:34:38 +02:00
parent c783a2d959
commit 68b9cd4d78
8 changed files with 198 additions and 13 deletions
+110
View File
@@ -0,0 +1,110 @@
@using MP.FileData.DatabaseModels
@using MP.Prog.Data
@inject FileArchDataService DataService
@inject MessageService AppMService
@if (ArtList == null)
{
<LoadingData></LoadingData>
}
else
{
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-search" aria-hidden="true"></span>
</span>
</div>
<input type="text" class="form-control form-control-sm" placeholder="Ricerca Articolo" @bind-value="@SearchArt" />
<select @bind="@SelCodArt" class="form-control form-control-sm">
@if (ArtList != null)
{
foreach (var item in ArtList)
{
<option value="@item.CodArticolo">@item.Disegno | @item.DescArticolo [@item.CodArticolo]</option>
}
}
</select>
<div class="input-group-append">
<button id="searchReset" class="btn btn-sm btn-secondary" @onclick="() => ResetSearchArt()" title="Reset ricerca articolo"><i class="fas fa-ban"></i></button>
</div>
</div>
}
@code {
[Parameter]
public EventCallback<string> searchUpdated { get; set; }
[Parameter]
public string SelCodArt
{
get
{
string answ = "";
if (AppMService.File_Filter != null)
{
answ = AppMService.File_Filter.CodArticolo;
}
return answ;
}
set
{
if (!AppMService.File_Filter.CodArticolo.Equals(value))
{
AppMService.File_Filter.CodArticolo = value;
}
reportChange();
}
}
private void reportChange()
{
searchUpdated.InvokeAsync(SelCodArt);
}
protected string _SearchArt;
protected string defCodArt = "";
protected List<ArticoloModel> ArtList;
protected string SearchArt
{
get
{
return _SearchArt;
}
set
{
_SearchArt = value;
// se son > 3 char... debounce...
if (string.IsNullOrEmpty(value))
{
_SearchArt = defCodArt;
}
if (value.Length >= defCodArt.Length)
{
var pUpd = Task.Run(async () =>
{
ArtList = await DataService.ArticoliGetFilt(SearchArt);
});
pUpd.Wait();
}
}
}
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
_SearchArt = defCodArt;
}
protected async Task ReloadAllData()
{
SelCodArt = defCodArt;
ArtList = await DataService.ArticoliGetFilt(SearchArt);
}
protected void ResetSearchArt()
{
SearchArt = defCodArt;
}
}
+35 -2
View File
@@ -7,12 +7,45 @@
<DataAnnotationsValidator />
<div class="row">
<div class="col-12 col-lg-2">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-industry" aria-hidden="true"></span>
</span>
</div>
<select @bind="@_currItem.IdxMacchina" class="form-control form-control-sm">
@if (MacList != null)
{
foreach (var item in MacList)
{
<option value="@item.IdxMacchina">@item.Descrizione (@item.CodMacchina)</option>
}
}
</select>
</div>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-search" aria-hidden="true"></span>
</span>
</div>
<select @bind="@_currItem.CodArticolo" class="form-control form-control-sm">
@if (ArtList != null)
{
foreach (var item in ArtList)
{
<option value="@item.CodArticolo">@item.Disegno | @item.DescArticolo</option>
}
}
</select>
</div>
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn btn-danger btn-block" value="Delete" @onclick="deleteRecord" title="Delete">Delete <i class="fas fa-trash"></i></button>
</div>
<div class="col-12 col-lg-10">
<textarea @bind="_currItem.FileStringContent" rows="20" class="w-100"></textarea>
<div class="col-12 col-lg-10" style="height: 20rem;">
@*<p>@((MarkupString )_currItem.FileStringContent)</p>*@
<textarea @bind="_currItem.FileStringContent" rows="20" class="bg-light text-dark w-100" contenteditable="false" readonly="readonly"></textarea>
@*<InputTextArea @bind-Value="_currItem.FileStringContent" rows></InputTextArea>*@
</div>
</div>
+7 -1
View File
@@ -29,6 +29,9 @@ namespace MP.Prog.Components
#region Public Properties
[Parameter]
public List<ArticoloModel> ArtList { get; set; }
[Parameter]
public FileModel currItem
{
@@ -48,6 +51,9 @@ namespace MP.Prog.Components
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
[Parameter]
public List<MacchinaModel> MacList { get; set; }
#endregion Public Properties
#region Private Methods
@@ -77,7 +83,7 @@ namespace MP.Prog.Components
{
if (_currItem != null)
{
DataService.FileUpdate(_currItem);
await DataService.FileUpdate(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
+2 -2
View File
@@ -28,9 +28,9 @@
}
}
private void reportChange()
private async Task reportChange()
{
searchUpdated.InvokeAsync(searchVal);
await searchUpdated.InvokeAsync(searchVal);
}
private void reset()
+2 -1
View File
@@ -197,7 +197,8 @@ namespace MP.Prog.Data
public Task<List<MP.FileData.DatabaseModels.ArticoloModel>> ArticoliGetFilt(string SearchVal)
{
return Task.FromResult(dbController.ArtGetFilt(SearchVal, 20).ToList());
return Task.FromResult(dbController.ArtGetFilt(SearchVal, 200).ToList());
//return Task.FromResult(dbController.ArtGetFilt(SearchVal, 20).ToList());
}
public void Dispose()
+2 -1
View File
@@ -64,6 +64,7 @@
<button id="searchReset" class="btn btn-sm btn-secondary" @onclick="() => ResetSearchArt()" title="Reset ricerca articolo"><i class="fas fa-ban"></i></button>
</div>
</div>
<MP.Prog.Components.CodArtSelector searchUpdated="searchArtUpd"></MP.Prog.Components.CodArtSelector>
</div>
<div class="col-1">
<div class="form-group mb-0">
@@ -77,7 +78,7 @@
<div class="card-body p-1">
@if (currRecord != null)
{
<MP.Prog.Components.FileEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></MP.Prog.Components.FileEditor>
<MP.Prog.Components.FileEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" ArtList="@ArtList" MacList="@MacList"></MP.Prog.Components.FileEditor>
}
@if (ListRecords == null)
{
+17 -6
View File
@@ -15,6 +15,7 @@ namespace MP.Prog.Pages
#region Private Fields
private List<ArticoloModel> ArtList;
private FileModel currRecord = null;
private List<FileModel> ListRecords;
private List<MacchinaModel> MacList;
@@ -24,7 +25,9 @@ namespace MP.Prog.Pages
#region Protected Fields
protected string _SearchArt = "###";
protected string _SearchArt;
protected string defCodArt = "";
#endregion Protected Fields
@@ -159,9 +162,9 @@ namespace MP.Prog.Pages
// se son > 3 char... debounce...
if (string.IsNullOrEmpty(value))
{
_SearchArt = "###";
_SearchArt = defCodArt;
}
if (value.Length >= 3)
if (value.Length >= defCodArt.Length)
{
var pUpd = Task.Run(async () =>
{
@@ -234,6 +237,7 @@ namespace MP.Prog.Pages
protected override async Task OnInitializedAsync()
{
DataService.ResetController();
SearchArt = defCodArt;
AppMService.ShowSearch = false;
AppMService.PageName = "Archivio File Programmi";
AppMService.PageIcon = "fas fa-folder pr-2";
@@ -246,8 +250,10 @@ namespace MP.Prog.Pages
isLoading = true;
MacList = await DataService.MacchineGetAll();
SelIdxMacc = "0";
SearchArt = defCodArt;
ArtList = await DataService.ArticoliGetFilt(SearchArt);
SelCodArt = "###";
isLoading = false;
await ReloadData();
}
@@ -264,13 +270,18 @@ namespace MP.Prog.Pages
SearchRecords = null;
ListRecords = null;
AppMService.File_Filter = SelectData.Init(5, 10);
SearchArt = "###";
SearchArt = defCodArt;
await ReloadAllData();
}
protected void ResetSearchArt()
{
SearchArt = "###";
SearchArt = defCodArt;
}
protected void searchArtUpd(string newCod)
{
SelCodArt = newCod;
}
protected void Select(FileModel selRecord)
+23
View File
@@ -0,0 +1,23 @@
@page "/Setup"
@using MP.Prog.Components
@using MP.Prog.Data
@inject MessageService AppMService
<h3>Setup</h3>
<CodArtSelector searchUpdated="searchUpd"></CodArtSelector>
<p>Selezionato <b>@CurrCodArt</b></p>
@code {
protected string CurrCodArt { get; set; } = "";
protected void searchUpd(string newCod)
{
CurrCodArt = newCod;
}
}