Ok fino editing attività
This commit is contained in:
@@ -248,6 +248,38 @@ namespace GPW.CORE.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool RegAttUpdate(RegAttivitaModel currItem)
|
||||
{
|
||||
bool answ = false;
|
||||
using (GPWContext localDbCtx = new GPWContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.DbSetRegAttivita
|
||||
.FirstOrDefault(x => x.IdxRa == currItem.IdxRa);
|
||||
if (currRec != null)
|
||||
{
|
||||
currRec.IdxDipendente = currItem.IdxDipendente;
|
||||
currRec.IdxFase = currItem.IdxFase;
|
||||
currRec.Inizio = currItem.Inizio;
|
||||
currRec.Fine = currItem.Fine;
|
||||
currRec.Descrizione = currItem.Descrizione;
|
||||
|
||||
localDbCtx.DbSetRegAttivita.Update(currRec);
|
||||
localDbCtx.SaveChanges();
|
||||
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in RegAttUpdate{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera overview di un periodo settimanale x dipendente, data riferimento, numero settimane precedenti
|
||||
/// </summary>
|
||||
|
||||
@@ -22,12 +22,6 @@
|
||||
<option value="@item.Gruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
</InputSelect>
|
||||
@*<InputSelect @bind-Value="@currRecord.FasiNav.ProgettoNav.IdxCliente" class="form-control" title="Cliente">
|
||||
@foreach (var item in clientiList)
|
||||
{
|
||||
<option value="@item.IdxCliente">@item.RagSociale</option>
|
||||
}
|
||||
</InputSelect>*@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -39,26 +33,28 @@
|
||||
<div class="col-9">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="input-group">
|
||||
<label class="small">Progetto</label>
|
||||
<div class="input-group" title="Progetto">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="input-group-text" style="width:3em;">
|
||||
<i class="fas fa-project-diagram"></i>
|
||||
</span>
|
||||
</div>
|
||||
<InputSelect @bind-Value="@currRecord.FasiNav.IdxProgetto" class="form-control btn btn-dark text-left" title="Progetto">
|
||||
<InputSelect @bind-Value="@idxProj" class="form-control bg-dark text-light text-left" title="Progetto">
|
||||
@foreach (var item in projList)
|
||||
{
|
||||
<option value="@item.IdxProgetto">@item.ClienteNav.RagSociale | @item.NomeProj</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<label class="small">Fase</label>
|
||||
<div class="input-group" title="Fase">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
<span class="input-group-text" style="width:3em;">
|
||||
<i class="fas fa-tasks"></i>
|
||||
</span>
|
||||
</div>
|
||||
<InputSelect @bind-Value="@currRecord.IdxFase" class="form-control btn btn-lg btn-light text-left" title="Fase">
|
||||
<InputSelect @bind-Value="@currRecord.IdxFase" class="form-control bg-light text-left" title="Fase">
|
||||
@foreach (var item in fasiList)
|
||||
{
|
||||
if (@item.EnableTime)
|
||||
@@ -74,6 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 px-0">
|
||||
<label class="small">Periodo</label>
|
||||
<div class="input-group input-group-sm2">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
@@ -109,6 +106,7 @@
|
||||
<button class="btn btn-danger" type="button">8h</button>
|
||||
</div>
|
||||
</div>*@
|
||||
<label class="small">Descrizione</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">
|
||||
@@ -122,14 +120,20 @@
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<label class="small">Record</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-block btn-success"><i class="fas fa-check-circle"></i> Save</button>
|
||||
<button type="button" class="btn btn-block btn-success" @onclick="DoUpdate"><i class="fas fa-check-circle"></i> Save</button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-block btn-warning" @onclick="DoReset"><i class="fas fa-ban"></i> Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<hr />
|
||||
<br />
|
||||
<label class="small">Smart Action</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-block btn-primary"><i class="far fa-clone"></i> Clone</button>
|
||||
|
||||
@@ -26,7 +26,10 @@ namespace GPW.CORE.UI.Components
|
||||
|
||||
protected RegAttivitaModel selRecord { get; set; } = null;
|
||||
|
||||
protected bool vetoUpd = false;
|
||||
|
||||
protected string _gruppoSel = "";
|
||||
protected int _idxProj = 0;
|
||||
|
||||
public string gruppoSel
|
||||
{
|
||||
@@ -37,8 +40,28 @@ namespace GPW.CORE.UI.Components
|
||||
set
|
||||
{
|
||||
_gruppoSel = value;
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
if (!vetoUpd)
|
||||
{
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int idxProj
|
||||
{
|
||||
get
|
||||
{
|
||||
return _idxProj;
|
||||
}
|
||||
set
|
||||
{
|
||||
_idxProj = value;
|
||||
if (!vetoUpd)
|
||||
{
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,20 +75,23 @@ namespace GPW.CORE.UI.Components
|
||||
set
|
||||
{
|
||||
selRecord = value;
|
||||
vetoUpd = true;
|
||||
if (value.FasiNav != null && value.FasiNav.ProgettoNav != null)
|
||||
{
|
||||
gruppoSel = value.FasiNav.ProgettoNav.Gruppo;
|
||||
idxProj = value.FasiNav.IdxProgetto != null ? (int)value.FasiNav.IdxProgetto : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
}
|
||||
var pUpd = Task.Run(async () => await ReloadData());
|
||||
pUpd.Wait();
|
||||
vetoUpd = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ItemReset { get; set; }
|
||||
[Parameter]
|
||||
public EventCallback<bool> ItemUpdated { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; }
|
||||
@@ -81,7 +107,7 @@ namespace GPW.CORE.UI.Components
|
||||
.ToList();
|
||||
var allFasi = await GDataServ.AnagFasiAll();
|
||||
fasiList = allFasi
|
||||
.Where(x => x.IdxProgetto == currRecord.FasiNav.IdxProgetto)
|
||||
.Where(x => x.IdxProgetto == idxProj)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -92,5 +118,15 @@ namespace GPW.CORE.UI.Components
|
||||
{
|
||||
await ItemReset.InvokeAsync(true);
|
||||
}
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void DoUpdate()
|
||||
{
|
||||
// aggiorno
|
||||
await GDataServ.RegAttUpdate(currRecord);
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -388,6 +388,20 @@ namespace GPW.CORE.UI.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<bool> RegAttUpdate(RegAttivitaModel currItem)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
dbController.RegAttUpdate(currItem);
|
||||
// invalido la cache...
|
||||
await InvalidateAllCache();
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
#if false
|
||||
public async Task<List<MaterialDTO>> MaterialsGetAll()
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
@if (currRecord != null)
|
||||
{
|
||||
<RegAttEditor currRecord="@currRecord" ItemReset="@ResetData"></RegAttEditor>
|
||||
<RegAttEditor currRecord="@currRecord" ItemReset="@ResetData" ItemUpdated="@ResetData"></RegAttEditor>
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user