POSDL:
- FIX Selezione stato comemssa e filtraggio
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
<h3>ODL</h3>
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
|
||||
@@ -9,9 +9,6 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool isActive { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
@@ -24,11 +21,8 @@ namespace MP.SPEC.Components
|
||||
if (_statoSel != value)
|
||||
{
|
||||
_statoSel = value;
|
||||
if (isActive)
|
||||
{
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,18 +140,11 @@ namespace MP.SPEC.Components
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
if (isActive)
|
||||
{
|
||||
SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(1);
|
||||
}
|
||||
SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
<h3>PODL</h3>
|
||||
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
|
||||
@@ -9,28 +9,23 @@ namespace MP.SPEC.Components
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public bool isActive { get; set; } = false;
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string StatoSel
|
||||
private string StatoSel
|
||||
{
|
||||
get => _statoSel;
|
||||
set
|
||||
{
|
||||
if (_statoSel != value)
|
||||
{
|
||||
_statoSel = value;
|
||||
if (isActive)
|
||||
{
|
||||
var pUpd = Task.Run(async () => await reloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
get => MsgService.StateSel;
|
||||
set => MsgService.StateSel = value;
|
||||
//get => _statoSel;
|
||||
//set
|
||||
//{
|
||||
// if (_statoSel != value)
|
||||
// {
|
||||
// _statoSel = value;
|
||||
// var pUpd = Task.Run(async () => await reloadData());
|
||||
// pUpd.Wait();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
@@ -63,7 +58,7 @@ namespace MP.SPEC.Components
|
||||
protected MpDataService MDService { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
protected MessageService MessageService { get; set; } = null!;
|
||||
protected MessageService MsgService { get; set; } = null!;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
@@ -71,11 +66,23 @@ namespace MP.SPEC.Components
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MessageService.EA_PageUpdated += MessageService_EA_PageUpdated;
|
||||
MessageService.EA_SearchUpdated += OnSeachUpdated;
|
||||
MsgService.EA_PageUpdated += MessageService_EA_PageUpdated;
|
||||
MsgService.EA_SearchUpdated += OnSeachUpdated;
|
||||
MsgService.EA_StatoSearch += MsgService_EA_StatoSearch;
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
private async void MsgService_EA_StatoSearch()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
PagerResetReq.InvokeAsync(true);
|
||||
//currPage = 1;
|
||||
Task task = UpdateData();
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
{
|
||||
await InvokeAsync(() =>
|
||||
@@ -97,7 +104,9 @@ namespace MP.SPEC.Components
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string _statoSel = "*";
|
||||
#if false
|
||||
private string _statoSel = "*";
|
||||
#endif
|
||||
|
||||
private PODLModel? currRecord = null;
|
||||
|
||||
@@ -111,27 +120,27 @@ namespace MP.SPEC.Components
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get => MessageService.currPage;
|
||||
set => MessageService.currPage = value;
|
||||
get => MsgService.currPage;
|
||||
set => MsgService.currPage = value;
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get => MessageService.numRecord;
|
||||
set => MessageService.numRecord = value;
|
||||
get => MsgService.numRecord;
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get => string.IsNullOrEmpty(MessageService.SearchVal) ? "*" : MessageService.SearchVal;
|
||||
get => string.IsNullOrEmpty(MsgService.SearchVal) ? "*" : MsgService.SearchVal;
|
||||
}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
get => MessageService.totalCount;
|
||||
set => MessageService.totalCount = value;
|
||||
get => MsgService.totalCount;
|
||||
set => MsgService.totalCount = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -146,18 +155,11 @@ namespace MP.SPEC.Components
|
||||
private async Task reloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
if (isActive)
|
||||
{
|
||||
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
}
|
||||
else
|
||||
{
|
||||
await Task.Delay(1);
|
||||
}
|
||||
SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel);
|
||||
totalCount = SearchRecords.Count;
|
||||
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
|
||||
await Task.Delay(1);
|
||||
await InvokeAsync(() => StateHasChanged());
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
{
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_HideSearch;
|
||||
|
||||
public event Action EA_PageUpdated;
|
||||
|
||||
public event Action EA_SearchUpdated;
|
||||
|
||||
public event Action EA_ShowSearch;
|
||||
|
||||
public event Action EA_StatoSearch;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
@@ -81,6 +81,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
public string StateSel
|
||||
{
|
||||
get => stateSel;
|
||||
set
|
||||
{
|
||||
stateSel = value;
|
||||
|
||||
if (EA_StatoSearch != null)
|
||||
{
|
||||
EA_StatoSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TipoSearch
|
||||
{
|
||||
get => tipoSearch;
|
||||
@@ -135,6 +149,7 @@
|
||||
|
||||
private string searchVal = "";
|
||||
private bool showSearch;
|
||||
private string stateSel = "*";
|
||||
private string tipoSearch = "*";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="col-5">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h2>Ordini Di Lavoro </h2>
|
||||
<h4><b>ODL</b></h4>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" disabled="!@addEnabled" @onclick="() => reqNewPODL()">Nuovo ODL <i class="bi bi-plus-square"></i></button>
|
||||
@@ -218,7 +218,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq" isActive="true"></ListODL>
|
||||
<ListODL StatoSel="@selStato" PagerResetReq="pgResetReq"></ListODL>
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="col-5">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<h2>Ordini Di Lavoro </h2>
|
||||
<h4><b>P</b>romesse <b>ODL</b></h4>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<button class="btn btn-success" disabled="!@addEnabled" @onclick="() => reqNewPODL()">Nuovo PODL <i class="bi bi-plus-square"></i></button>
|
||||
@@ -80,75 +80,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currRecordOdl != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-light">Modifica ODL</div>
|
||||
<div class="card-body">
|
||||
@*<div class="row">
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Codice</span>
|
||||
<input type="text" class="form-control" placeholder="Articolo" @bind-value="@currRecord.CodArticolo">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">Disegno</span>
|
||||
<input type="text" class="form-control" placeholder="Disegno" @bind-value="@currRecord.Disegno">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<div class="input-group" title="Tipo">
|
||||
<select @bind="@currRecord.Tipo" class="form-select text-end">
|
||||
@if (ListTipoArt != null)
|
||||
{
|
||||
foreach (var item in ListTipoArt)
|
||||
{
|
||||
<option value="@item.value">@item.label</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="input-group" title="Azienda">
|
||||
<select @bind="@currRecord.Azienda" class="form-select text-end">
|
||||
@if (ListAziende != null)
|
||||
{
|
||||
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control" placeholder="Descrizione Articolo" @bind-value="@currRecord.DescArticolo">
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div class="d-grid gap-2">
|
||||
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (currRecordPOdl != null)
|
||||
else if (currRecord != null)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@@ -219,7 +151,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ListPODL StatoSel="@selStato" PagerResetReq="pgResetReq" isActive="true"></ListPODL>
|
||||
<ListPODL PagerResetReq="pgResetReq"></ListPODL>
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager @ref="pagerODL" PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
|
||||
|
||||
@@ -44,8 +44,7 @@ namespace MP.SPEC.Pages
|
||||
}
|
||||
|
||||
|
||||
private MP.Data.DatabaseModels.ODLModel? currRecordOdl = null;
|
||||
private MP.Data.DatabaseModels.PODLModel? currRecordPOdl = null;
|
||||
private MP.Data.DatabaseModels.PODLModel? currRecord = null;
|
||||
|
||||
/// <summary>
|
||||
/// Crea nuovo record e va in editing...
|
||||
@@ -53,7 +52,7 @@ namespace MP.SPEC.Pages
|
||||
/// <returns></returns>
|
||||
protected async Task addNew()
|
||||
{
|
||||
currRecordPOdl = new MP.Data.DatabaseModels.PODLModel()
|
||||
currRecord = new MP.Data.DatabaseModels.PODLModel()
|
||||
{
|
||||
CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}"
|
||||
};
|
||||
@@ -62,8 +61,7 @@ namespace MP.SPEC.Pages
|
||||
|
||||
protected async Task cancel()
|
||||
{
|
||||
currRecordOdl = null;
|
||||
currRecordPOdl = null;
|
||||
currRecord = null;
|
||||
await reloadData();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
@@ -123,38 +121,14 @@ namespace MP.SPEC.Pages
|
||||
set => MsgService.numRecord = value;
|
||||
}
|
||||
|
||||
private string selStato { get; set; } = "*";
|
||||
#if false
|
||||
private string selStato
|
||||
{
|
||||
get => _selStato;
|
||||
set
|
||||
{
|
||||
if (!_selStato.Equals(value))
|
||||
{
|
||||
_selStato = value;
|
||||
addEnabled = selStato != "*";
|
||||
////StateHasChanged();
|
||||
//var pUpd = Task.Run(async () =>
|
||||
//{
|
||||
// //await reloadData();
|
||||
// await Task.Delay(1);
|
||||
// await InvokeAsync(() => StateHasChanged());
|
||||
//});
|
||||
//pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//private bool showPODL { get; set; } = false;
|
||||
get => MsgService.StateSel;
|
||||
set => MsgService.StateSel = value;
|
||||
}
|
||||
|
||||
private bool addEnabled = false;
|
||||
|
||||
//private string textToggle
|
||||
//{
|
||||
// get => showPODL ? "In Corso" : "Programmati";
|
||||
//}
|
||||
|
||||
private int totalCount
|
||||
{
|
||||
@@ -173,12 +147,10 @@ namespace MP.SPEC.Pages
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
//private async Task toggleCurrent()
|
||||
//{
|
||||
// NavManager.NavigateTo("/ODL");
|
||||
//}
|
||||
|
||||
private async Task navToODL()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
NavManager.NavigateTo("/ODL");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user