Migliorato calendario
This commit is contained in:
@@ -101,16 +101,6 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudMenu PopoverClass="custom_popover" Class="custom-mudfab" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
|
||||||
<ActivatorContent>
|
|
||||||
<MudFab Color="Color.Primary" Size="Size.Small" StartIcon="@Icons.Material.Filled.Add"/>
|
|
||||||
</ActivatorContent>
|
|
||||||
<ChildContent>
|
|
||||||
<MudMenuItem>Nuovo contatto</MudMenuItem>
|
|
||||||
<MudMenuItem OnClick="OpenActivityForm">Nuova attività</MudMenuItem>
|
|
||||||
</ChildContent>
|
|
||||||
</MudMenu>
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
// Stato UI
|
// Stato UI
|
||||||
@@ -167,21 +157,27 @@
|
|||||||
[JSInvokable]
|
[JSInvokable]
|
||||||
public async Task OnSwipeLeft()
|
public async Task OnSwipeLeft()
|
||||||
{
|
{
|
||||||
CambiaPeriodo(1);
|
await CambiaPeriodo(1);
|
||||||
await LoadMonthData();
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
if (Expanded)
|
||||||
|
{
|
||||||
|
await LoadMonthData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[JSInvokable]
|
[JSInvokable]
|
||||||
public async Task OnSwipeRight()
|
public async Task OnSwipeRight()
|
||||||
{
|
{
|
||||||
CambiaPeriodo(-1);
|
await CambiaPeriodo(-1);
|
||||||
await LoadMonthData();
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
if (Expanded)
|
||||||
|
{
|
||||||
|
await LoadMonthData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambio periodo mese/settimana
|
// Cambio periodo mese/settimana
|
||||||
private void CambiaPeriodo(int direzione)
|
private async Task CambiaPeriodo(int direzione)
|
||||||
{
|
{
|
||||||
if (Expanded)
|
if (Expanded)
|
||||||
{
|
{
|
||||||
@@ -205,13 +201,13 @@
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Cambio settimana: aggiorno anche il giorno selezionato
|
// Cambio settimana: aggiorno anche il giorno selezionato
|
||||||
SelectedDate = SelectedDate.AddDays(7 * direzione);
|
await SelezionaData(SelectedDate.AddDays(7 * direzione));
|
||||||
_internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
|
_internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambio modalità
|
// Cambio modalità
|
||||||
private async Task ToggleExpanded()
|
private void ToggleExpanded()
|
||||||
{
|
{
|
||||||
if (Expanded)
|
if (Expanded)
|
||||||
{
|
{
|
||||||
@@ -228,7 +224,6 @@
|
|||||||
|
|
||||||
SliderAnimation = "";
|
SliderAnimation = "";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
await LoadMonthData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caricamento attività al cambio mese
|
// Caricamento attività al cambio mese
|
||||||
@@ -245,21 +240,24 @@
|
|||||||
(x.EffectiveDate >= start && x.EffectiveDate <= end));
|
(x.EffectiveDate >= start && x.EffectiveDate <= end));
|
||||||
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList();
|
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList();
|
||||||
|
|
||||||
// Filtro per il giorno selezionato (solo se il giorno selezionato è visibile nel mese corrente)
|
|
||||||
if (SelectedDate.Month == CurrentMonth.Month && SelectedDate.Year == CurrentMonth.Year)
|
|
||||||
FilteredActivities = GetEventsForDay(SelectedDate);
|
|
||||||
else
|
|
||||||
FilteredActivities = [];
|
|
||||||
|
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selezione giorno in settimana
|
// Selezione giorno in settimana
|
||||||
private void SelezionaData(DateTime day)
|
private async Task SelezionaData(DateTime day)
|
||||||
{
|
{
|
||||||
SelectedDate = day;
|
SelectedDate = day;
|
||||||
_internalMonth = new DateTime(day.Year, day.Month, 1); // Sync il mese visualizzato solo se cambio settimana!
|
StateHasChanged();
|
||||||
|
|
||||||
|
var cacheInternalMonth = _internalMonth;
|
||||||
|
_internalMonth = new DateTime(day.Year, day.Month, 1);
|
||||||
|
|
||||||
|
if (cacheInternalMonth != _internalMonth)
|
||||||
|
{
|
||||||
|
await LoadMonthData();
|
||||||
|
}
|
||||||
|
|
||||||
FilteredActivities = GetEventsForDay(day);
|
FilteredActivities = GetEventsForDay(day);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
@@ -276,7 +274,6 @@
|
|||||||
_internalMonth = new DateTime(day.Year, day.Month, 1); // Sync il mese visualizzato
|
_internalMonth = new DateTime(day.Year, day.Month, 1); // Sync il mese visualizzato
|
||||||
SliderAnimation = "";
|
SliderAnimation = "";
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
await LoadMonthData(); // Aggiorna anche la lista attività (se hai cambiato mese)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility
|
// Utility
|
||||||
@@ -296,7 +293,4 @@
|
|||||||
dotNetHelper?.Dispose();
|
dotNetHelper?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenActivityForm() =>
|
|
||||||
NavigationManager.NavigateTo("/activity");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,3 @@
|
|||||||
.arrow-btn {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
color: var(--mud-palette-primary);
|
|
||||||
font-size: 1.4rem;
|
|
||||||
padding: 0 0.5rem;
|
|
||||||
cursor: pointer;
|
|
||||||
line-height: 1;
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow-btn:active { color: #2a27b2; }
|
|
||||||
|
|
||||||
.calendar {
|
.calendar {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -97,13 +84,14 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.3s ease, transform 0.2s ease;
|
transition: background 0.3s ease, transform 0.2s ease;
|
||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
width: 38px;
|
width: 38px;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
border: 1px solid var(--mud-palette-surface);
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +107,12 @@
|
|||||||
|
|
||||||
.day.selected {
|
.day.selected {
|
||||||
background: var(--mud-palette-primary);
|
background: var(--mud-palette-primary);
|
||||||
|
border: 1px solid var(--mud-palette-primary);
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.day.today { border: 1px solid var(--mud-palette-primary); }
|
||||||
|
|
||||||
.appointments {
|
.appointments {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
@@ -148,4 +139,26 @@
|
|||||||
color: var(--mud-palette-primary);
|
color: var(--mud-palette-primary);
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.day.selected > .event-dot-container {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-dot-container {
|
||||||
|
display: flex;
|
||||||
|
gap: 5px;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-dot {
|
||||||
|
height: 5px;
|
||||||
|
width: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.event-dot.memo { background-color: var(--mud-palette-info-darken); }
|
||||||
|
|
||||||
|
.event-dot.interna { background-color: var(--mud-palette-success-darken); }
|
||||||
|
|
||||||
|
.event-dot.commessa { background-color: var(--mud-palette-warning); }
|
||||||
Reference in New Issue
Block a user