UPdate display planner GPW CORE

This commit is contained in:
Samuele Locatelli
2021-12-16 10:25:26 +01:00
parent 618bdfb5ef
commit 0ef3249b7f
5 changed files with 243 additions and 25 deletions
+11 -4
View File
@@ -37,11 +37,17 @@ namespace GPW.CORE.Data.Controllers
// cerco su DB recuperando set di dati....
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
// recupero intero set dati timbrature e attività....
dbResult = localDbCtx
try
{
// recupero intero set dati timbrature e attività....
dbResult = localDbCtx
.DbSetAnagFasi
//.Include(p => p.ProgettoNav)
.ToList();
.ToList();
}
catch(Exception exc)
{
Log.Error($"Errore in AnagFasiAll:{Environment.NewLine}{exc}");
}
}
return dbResult;
}
@@ -78,6 +84,7 @@ namespace GPW.CORE.Data.Controllers
rawRegAtt = localDbCtx
.DbSetRegAttivita
.Where(x => x.IdxDipendente == idxDipendente && dtInizio <= x.Inizio && x.Inizio <= dtFine)
.Include(a => a.FasiNav).ThenInclude(p=>p.ProgettoNav)
.ToList();
// calcolo intervallo date...
+6 -20
View File
@@ -2,17 +2,18 @@
@using UI.Data
@inject GpwDataService GDataServ
<div class="px-1 py-0 small flex-fill @blockCss" style="width: @widthPerc">
<div class="py-0 small flex-fill @blockCss" style="width: @widthPerc">
<div class="d-flex">
@if (@CurrData.IdxFase > 0)
{
<div class="px-1 text-left border border-secondary border-top-0 border-bottom-0 border-left-0">
<div class="px-1 text-left border border-secondary border-top-0 border-bottom-0 border-left-0 table-info small">
<div>@CurrData.Inizio.ToString("HH:mm")</div>
<div class="small">@CurrData.Fine.ToString("HH:mm")</div>
<div class="">@CurrData.Fine.ToString("HH:mm")</div>
<div><b>@($"{CurrData.OreTot:N2}h")</b></div>
</div>
<div class="px-1 text-left textTrim">
<div><b>@(headFase(CurrData.IdxFase))</b></div>
<div class="text-dark" title="@CurrData.FasiNav?.ProgettoNav?.NomeProj"><b>@CurrData.FasiNav?.ProgettoNav?.NomeProj</b></div>
<div class="text-secondary" title="@CurrData.FasiNav?.DescrizioneFase">@CurrData.FasiNav?.DescrizioneFase</div>
<div class="small" title="@CurrData.Descrizione">@CurrData.Descrizione</div>
</div>
}
@@ -56,25 +57,10 @@
{
get
{
string answ = CurrData.IdxFase == 0 ? "" : "table-info border border-info rounded";
string answ = CurrData.IdxFase == 0 ? "" : " border border-info rounded";
return answ;
}
}
private string headFase(int idxFase)
{
string answ = $"F.{idxFase}";
if (ListFasi != null)
{
var currFase = ListFasi
.Where(x => x.IdxFase == idxFase)
.FirstOrDefault();
if (currFase != null)
{
answ = $"{currFase.NomeFase}";
}
}
return answ;
}
}
+72
View File
@@ -0,0 +1,72 @@
@page "/Test"
@using GPW.CORE.UI.Components
<PageTitle>Test - Fasi</PageTitle>
<div class="card">
<div class="card-header table-primary pb-0 mb-0">
<h2>Fasi</h2>
</div>
<div class="card-body">
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">No Record Found</div>
}
else
{
<div class="row">
<div class="col-12">
@*<div id="qrCodeImg"></div>*@
<table class="table table-sm table-striped">
<thead>
<tr>
@*<th></th>*@
<th>ID</th>
<th>Cod</th>
<th>Nome</th>
<th class="text-right">Descrizione</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr>
@*<td class="text-nowrap">
<button class="btn btn-sm btn-info" @onclick="() => Select(record)">
<i class="oi oi-magnifying-glass"></i>
</button>
</td>*@
<td>
<span>P<b>@record.IdxProgetto</b> | @record.IdxFase (&larr; @record.IdxFaseAncest)</span>
</td>
<td>
<span><b>@record.CodFase</b></span>
</td>
<td>
<span>@record.NomeFase</span>
</td>
<td class="text-right">
@record.DescrizioneFase
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
<div class="card-footer p-1">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+153
View File
@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using GPW.CORE.UI;
using GPW.CORE.UI.Shared;
using GPW.CORE.UI.Components;
using GPW.CORE.Data.DbModels;
using GPW.CORE.UI.Data;
namespace GPW.CORE.UI.Pages
{
public partial class Test : ComponentBase, IDisposable
{
#region Private Fields
private List<AnagFasiModel> ListRecords = null!;
private List<AnagFasiModel> SearchRecords = null!;
#endregion Private Fields
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
private int currPage
{
get => _currPage;
set
{
if (_currPage != value)
{
_currPage = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
private bool isLoading { get; set; } = false;
private int IdxDipSel = 0;
[Inject]
private NavigationManager NavManager { get; set; } = null!;
private int numRecord
{
get => _numRecord;
set
{
if (_numRecord != value)
{
_numRecord = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
#endregion Private Properties
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; } = null!;
[Inject]
protected GpwDataService DataService { get; set; } = null!;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected int totalCount
{
get
{
int answ = 0;
if (SearchRecords != null)
{
answ = SearchRecords.Count;
}
return answ;
}
}
#endregion Protected Properties
#region Private Methods
private async Task ReloadData()
{
isLoading = true;
SearchRecords = await DataService.AnagFasiAll();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
#endregion Private Methods
#region Protected Methods
protected void ForceReload(int newNum)
{
numRecord = newNum;
}
protected void ForceReloadPage(int newNum)
{
currPage = newNum;
}
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected void ResetData()
{
//DataService.rollBackEdit(currRecord);
}
protected void Select(DipendentiModel selRecord)
{
IdxDipSel = selRecord.IdxDipendente;
//// rimando a remnants
//NavManager.NavigateTo($"Remnants");
}
#endregion Protected Methods
#region Public Methods
public void Dispose()
{
//AppMService.EA_SearchUpdated -= OnSeachUpdated;
}
#endregion Public Methods
}
}
+1 -1
View File
@@ -13,7 +13,7 @@
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>
<article class="content px-4">
<article class="content px-2">
@Body
</article>
</main>