Ok delete kit intero

This commit is contained in:
Samuele Locatelli
2023-12-14 12:58:29 +01:00
parent 745b5ac6a7
commit 9c5a0c57e9
4 changed files with 43 additions and 9 deletions
+7 -2
View File
@@ -6,8 +6,13 @@
<table class="table table-light table-sm table-striped mb-0">
<thead>
<tr class="text-start1">
<th class="fs-5">
Esplosione scarti KIT
<th class="fs-5 d-flex justify-content-between">
<div>
Esplosione scarti KIT
</div>
<div>
<button class="btn btn-danger" @onclick="DeleteKitSplit"><i class="fa-solid fa-trash-can"></i> Remove Split</button>
</div>
</th>
</tr>
</thead>
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
@@ -9,6 +10,9 @@ namespace MP_TAB_SERV.Components
{
#region Public Properties
[Parameter]
public EventCallback<bool> E_Updated { get; set; }
[Parameter]
public RegistroScartiModel ParentKit { get; set; } = null!;
@@ -16,6 +20,9 @@ namespace MP_TAB_SERV.Components
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<RegistroScartiKitModel> ListComplete { get; set; } = new List<RegistroScartiKitModel>();
protected List<RegistroScartiKitModel> ListPaged { get; set; } = new List<RegistroScartiKitModel>();
@@ -27,6 +34,19 @@ namespace MP_TAB_SERV.Components
#region Protected Methods
protected async Task DeleteKitSplit()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il dettaglio del KIT scartato?"))
return;
if (ParentKit != null)
{
await TabDServ.RegScartiKitDelete(ParentKit);
await ReloadData();
await E_Updated.InvokeAsync(true);
}
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
+2 -2
View File
@@ -8,7 +8,7 @@
@if (enableScarti)
{
<div class="mb-2">
<ScrapEditor RecMSE="@RecMSE" E_Updated="doUpdate"></ScrapEditor>
<ScrapEditor RecMSE="@RecMSE" E_Updated="ReloadData"></ScrapEditor>
</div>
}
else
@@ -127,7 +127,7 @@
{
<tr>
<td class="p-0">
<ScrapKitMan ParentKit="item"></ScrapKitMan>
<ScrapKitMan ParentKit="item" E_Updated="ForceReload"></ScrapKitMan>
</td>
</tr>
}
+14 -5
View File
@@ -21,7 +21,7 @@ namespace MP_TAB_SERV.Components
/// Aggiorno valori produzione alla data richiesta...
/// </summary>
/// <param name="newDate"></param>
public async Task doUpdate()
protected async Task ReloadData()
{
isProcessing = true;
await Task.Delay(1);
@@ -36,6 +36,15 @@ namespace MP_TAB_SERV.Components
await Task.Delay(1);
}
protected async Task ForceReload(bool DoClose)
{
if (DoClose)
{
selItem = null;
}
await ReloadData();
}
#endregion Public Methods
#region Protected Properties
@@ -67,7 +76,7 @@ namespace MP_TAB_SERV.Components
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-8);
CurrPeriodo = new Periodo(inizio, fine);
await doUpdate();
await ReloadData();
}
}
@@ -93,7 +102,7 @@ namespace MP_TAB_SERV.Components
isProcessing = true;
await Task.Delay(1);
IdxMaccSel = selIdxMacc;
await doUpdate();
await ReloadData();
isProcessing = false;
await Task.Delay(1);
}
@@ -103,7 +112,7 @@ namespace MP_TAB_SERV.Components
isProcessing = true;
await Task.Delay(1);
IdxOdl = selIdxOdl;
await doUpdate();
await ReloadData();
isProcessing = false;
await Task.Delay(1);
}
@@ -111,7 +120,7 @@ namespace MP_TAB_SERV.Components
protected async Task SetPeriodo(Periodo newPeriodo)
{
CurrPeriodo = newPeriodo;
await doUpdate();
await ReloadData();
}
protected async Task ShowKitDetail(RegistroScartiModel currItem)