Migliorato calendario
This commit is contained in:
@@ -101,16 +101,6 @@
|
||||
}
|
||||
</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 {
|
||||
|
||||
// Stato UI
|
||||
@@ -167,21 +157,27 @@
|
||||
[JSInvokable]
|
||||
public async Task OnSwipeLeft()
|
||||
{
|
||||
CambiaPeriodo(1);
|
||||
await LoadMonthData();
|
||||
await CambiaPeriodo(1);
|
||||
StateHasChanged();
|
||||
if (Expanded)
|
||||
{
|
||||
await LoadMonthData();
|
||||
}
|
||||
}
|
||||
|
||||
[JSInvokable]
|
||||
public async Task OnSwipeRight()
|
||||
{
|
||||
CambiaPeriodo(-1);
|
||||
await LoadMonthData();
|
||||
await CambiaPeriodo(-1);
|
||||
StateHasChanged();
|
||||
if (Expanded)
|
||||
{
|
||||
await LoadMonthData();
|
||||
}
|
||||
}
|
||||
|
||||
// Cambio periodo mese/settimana
|
||||
private void CambiaPeriodo(int direzione)
|
||||
private async Task CambiaPeriodo(int direzione)
|
||||
{
|
||||
if (Expanded)
|
||||
{
|
||||
@@ -205,13 +201,13 @@
|
||||
else
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
// Cambio modalità
|
||||
private async Task ToggleExpanded()
|
||||
private void ToggleExpanded()
|
||||
{
|
||||
if (Expanded)
|
||||
{
|
||||
@@ -228,7 +224,6 @@
|
||||
|
||||
SliderAnimation = "";
|
||||
StateHasChanged();
|
||||
await LoadMonthData();
|
||||
}
|
||||
|
||||
// Caricamento attività al cambio mese
|
||||
@@ -245,21 +240,24 @@
|
||||
(x.EffectiveDate >= start && x.EffectiveDate <= end));
|
||||
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;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
// Selezione giorno in settimana
|
||||
private void SelezionaData(DateTime day)
|
||||
private async Task SelezionaData(DateTime 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);
|
||||
StateHasChanged();
|
||||
}
|
||||
@@ -276,7 +274,6 @@
|
||||
_internalMonth = new DateTime(day.Year, day.Month, 1); // Sync il mese visualizzato
|
||||
SliderAnimation = "";
|
||||
StateHasChanged();
|
||||
await LoadMonthData(); // Aggiorna anche la lista attività (se hai cambiato mese)
|
||||
}
|
||||
|
||||
// Utility
|
||||
@@ -296,7 +293,4 @@
|
||||
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 {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
@@ -97,13 +84,14 @@
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease, transform 0.2s ease;
|
||||
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;
|
||||
height: 38px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1px solid var(--mud-palette-surface);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@@ -119,9 +107,12 @@
|
||||
|
||||
.day.selected {
|
||||
background: var(--mud-palette-primary);
|
||||
border: 1px solid var(--mud-palette-primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.day.today { border: 1px solid var(--mud-palette-primary); }
|
||||
|
||||
.appointments {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
@@ -149,3 +140,25 @@
|
||||
font-size: 1rem;
|
||||
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