Prima implementazione pagina "Attività"
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<MudDialog Visible="@(Attivita is not null && Visible)" VisibleChanged="OnVisibleChanged"
|
||||
Options="BottomSheetOptions" Class="bottom-sheet">
|
||||
<TitleContent>
|
||||
@if (Attivita is not null)
|
||||
{
|
||||
<div class="sheet-grabber"></div>
|
||||
<div class="sheet-header">
|
||||
<span class="sheet-title">
|
||||
<MudIcon Icon="@Icons.Material.Outlined.Attachment" Size="Size.Small" />
|
||||
Allegati — @Attivita.PuntoVendita
|
||||
</span>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" Size="Size.Small"
|
||||
Class="sheet-close" OnClick="Chiudi" />
|
||||
</div>
|
||||
}
|
||||
</TitleContent>
|
||||
<DialogContent>
|
||||
@if (Attivita is not null)
|
||||
{
|
||||
<div class="allegati-list">
|
||||
@foreach (var allegato in Attivita.Allegati)
|
||||
{
|
||||
<div class="allegato-item">
|
||||
@if (allegato.Tipo is TipoAllegato.Immagine or TipoAllegato.Piantina)
|
||||
{
|
||||
<div class="allegato-preview">
|
||||
<img src="@allegato.Url" alt="@allegato.Nome" loading="lazy" />
|
||||
<span class="allegato-type-badge @(allegato.Tipo == TipoAllegato.Piantina ? "badge-piantina" : "badge-foto")">
|
||||
@(allegato.Tipo == TipoAllegato.Piantina ? "Piantina" : "Foto")
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="allegato-icon-box @(allegato.Tipo == TipoAllegato.Email ? "icon-email" : "icon-doc")">
|
||||
<MudIcon Icon="@(allegato.Tipo == TipoAllegato.Email ? Icons.Material.Outlined.Email : Icons.Material.Outlined.Article)"
|
||||
Size="Size.Large" />
|
||||
</div>
|
||||
}
|
||||
<div class="allegato-info">
|
||||
<span class="allegato-nome">@allegato.Nome</span>
|
||||
<a href="@allegato.Url" class="allegato-download" target="_blank" title="Apri allegato">
|
||||
<MudIcon Icon="@Icons.Material.Outlined.OpenInNew" Size="Size.Small" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
@code {
|
||||
[Parameter] public AttivitaItem? Attivita { get; set; }
|
||||
[Parameter] public bool Visible { get; set; }
|
||||
[Parameter] public EventCallback OnClosed { get; set; }
|
||||
|
||||
static readonly DialogOptions BottomSheetOptions = new()
|
||||
{
|
||||
Position = DialogPosition.BottomCenter,
|
||||
FullWidth = true,
|
||||
MaxWidth = MaxWidth.Medium,
|
||||
CloseButton = false,
|
||||
BackdropClick = true,
|
||||
CloseOnEscapeKey = true
|
||||
};
|
||||
|
||||
Task Chiudi() => OnClosed.InvokeAsync();
|
||||
|
||||
async Task OnVisibleChanged(bool visible)
|
||||
{
|
||||
if (!visible)
|
||||
await Chiudi();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user