Primo sviluppo sincronizzazione e migliorie ui
This commit is contained in:
@@ -1,6 +1,61 @@
|
||||
<div class="calendar">
|
||||
@for (var i = 0; i < 3; i++)
|
||||
@using ConSegna.Shared.Core.Helpers
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="calendar">
|
||||
@if (!Activities.IsNullOrEmpty())
|
||||
{
|
||||
<ActivityCard Type="interna" />
|
||||
@foreach (var activity in Activities!)
|
||||
{
|
||||
<ActivityCard Activity="activity"/>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna attività trovata" ImageSource="_content/Template.Shared/images/undraw_file-search_cbur.svg"/>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public required DateTime? Date { get; set; }
|
||||
[Parameter] public EventCallback<DateTime?> DateChanged { get; set; }
|
||||
|
||||
private List<ActivityDTO>? Activities { get; set; } = null;
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
var refreshActivity = await RefreshActivity();
|
||||
Activities = refreshActivity;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task<List<ActivityDTO>> RefreshActivity()
|
||||
{
|
||||
var activityDto = await Task.Run(async () =>
|
||||
{
|
||||
return (await manageData.GetActivity(x =>
|
||||
(x.EffectiveDate == null && x.EstimatedDate.Equals(Date)) || x.EffectiveDate.Equals(Date)))
|
||||
.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate)
|
||||
.ToList();
|
||||
});
|
||||
|
||||
return activityDto;
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,15 @@
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
gap: 1rem;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.calendar::-webkit-scrollbar { display: none; }
|
||||
|
||||
|
||||
.calendar {
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
@@ -42,7 +42,6 @@
|
||||
@code
|
||||
{
|
||||
[Parameter] public required DateTime Date { get; set; }
|
||||
|
||||
[Parameter] public EventCallback<DateTime> DateChanged { get; set; }
|
||||
|
||||
private List<CalendarEvent> Events { get; set; }
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
@using ConSegna.Shared.Core.Helpers
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="calendar">
|
||||
@{
|
||||
DateTime? currentDate = null;
|
||||
}
|
||||
|
||||
@if (!Activities.IsNullOrEmpty())
|
||||
{
|
||||
foreach (var activity in Activities!)
|
||||
{
|
||||
var dateToShow = activity.EffectiveDate ?? activity.EstimatedDate;
|
||||
|
||||
if (currentDate != dateToShow?.Date)
|
||||
{
|
||||
currentDate = dateToShow?.Date;
|
||||
<div class="week-info">
|
||||
<span>@($"{currentDate:D}")</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<ActivityCard Activity="activity"/>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna attività trovata" ImageSource="_content/Template.Shared/images/undraw_file-search_cbur.svg"/>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public required DateRange Date { get; set; }
|
||||
[Parameter] public EventCallback<DateRange> DateChanged { get; set; }
|
||||
|
||||
private List<ActivityDTO>? Activities { get; set; }
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
var refreshActivity = await RefreshActivity();
|
||||
Activities = refreshActivity;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task<List<ActivityDTO>> RefreshActivity()
|
||||
{
|
||||
var activityDto = await Task.Run(async () =>
|
||||
{
|
||||
return Activities = (await manageData.GetActivity(x =>
|
||||
(x.EffectiveDate == null && x.EstimatedDate >= Date.Start && x.EstimatedDate <= Date.End) ||
|
||||
(x.EffectiveDate >= Date.Start && x.EffectiveDate <= Date.End)
|
||||
))
|
||||
.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate)
|
||||
.ToList();
|
||||
});
|
||||
|
||||
return activityDto;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
.calendar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
gap: 1rem;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.calendar::-webkit-scrollbar { display: none; }
|
||||
|
||||
.calendar {
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.week-info {
|
||||
background: var(--mud-palette-action-disabled-background);
|
||||
width: 100%;
|
||||
padding: .3rem .5rem;
|
||||
border-radius: 8px;
|
||||
text-transform: capitalize;
|
||||
font-weight: 700;
|
||||
}
|
||||
Reference in New Issue
Block a user