Gestite schede nella pagina ispezione e migliorie grafiche
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>@Title</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="@GoBack" />
|
||||
<MudIconButton Icon="@Icons.Material.Rounded.Close" OnClick="@GoBack" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using SteUp.Shared.Core.Interface.System.Network
|
||||
@using SteUp.Shared.Core.Messages.Scheda
|
||||
@inject INetworkService NetworkService
|
||||
@inject IDialogService Dialog
|
||||
@inject IMessenger Messenger
|
||||
|
||||
<div
|
||||
class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
@@ -30,8 +33,9 @@
|
||||
{
|
||||
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||
<ActivatorContent>
|
||||
<MudFab Class="custom-plus-button" OnClick="OnOpenMenu" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium"
|
||||
IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add"/>
|
||||
<MudFab Class="custom-plus-button" OnClick="OnOpenMenu" Color="Color.Surface" Size="Size.Medium"
|
||||
IconSize="Size.Medium"
|
||||
IconColor="Color.Primary" StartIcon="@Icons.Material.Rounded.Add"/>
|
||||
</ActivatorContent>
|
||||
<ChildContent>
|
||||
@if (SchedaVisible)
|
||||
@@ -84,15 +88,19 @@
|
||||
_ = ModalHelper.OpenSelectShop(Dialog);
|
||||
}
|
||||
|
||||
private void NewScheda()
|
||||
private async Task NewScheda()
|
||||
{
|
||||
_ = ModalHelper.OpenFormScheda(Dialog);
|
||||
var ispezione = SteupDataService.InspectionPageState.Ispezione;
|
||||
var modal = await ModalHelper.OpenFormScheda(Dialog, ispezione.CodMdep, ispezione.Data);
|
||||
|
||||
if (modal is { Canceled: false })
|
||||
Messenger.Send(new NewSchedaMessage());
|
||||
}
|
||||
|
||||
private void OnOpenMenu()
|
||||
{
|
||||
var location = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Length);
|
||||
|
||||
|
||||
SchedaVisible = new List<string> { "ispezione" }.Contains(location);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -1,17 +1,85 @@
|
||||
@page "/ispezione"
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.SingleElements.Card
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Core.Interface.LocalDb
|
||||
@using SteUp.Shared.Core.Messages.Scheda
|
||||
@inject NewSchedaService NewScheda
|
||||
@inject IIspezioniService IspezioniService
|
||||
@implements IDisposable
|
||||
|
||||
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
|
||||
|
||||
<div class="container content pb-safe-area">
|
||||
<InspectionCard Ispezione="SteupDataService.InspectionPageState.Ispezione"/>
|
||||
|
||||
@if (!SchedeGrouped.IsNullOrEmpty())
|
||||
{
|
||||
<MudExpansionPanels MultiExpansion="true">
|
||||
@foreach (var group in SchedeGrouped)
|
||||
{
|
||||
<MudExpansionPanel Expanded="true" Text="@group.Key.Descrizione">
|
||||
<TitleContent>
|
||||
<div class="header-scheda-group">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6"><b>@group.Key.Descrizione</b></MudText>
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
||||
@($"{group.Value.Count} sched{(group.Value.Count == 1 ? "a" : "e")}")
|
||||
</MudChip>
|
||||
</div>
|
||||
<div class="action-scheda-group">
|
||||
<MudIconButton Variant="Variant.Filled" Icon="@Icons.Material.Rounded.Add" Color="Color.Warning" Size="Size.Medium"/>
|
||||
</div>
|
||||
</div>
|
||||
</TitleContent>
|
||||
<ChildContent>
|
||||
@foreach (var scheda in group.Value)
|
||||
{
|
||||
<SchedaCard Scheda="scheda"/>
|
||||
}
|
||||
</ChildContent>
|
||||
</MudExpansionPanel>
|
||||
}
|
||||
</MudExpansionPanels>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private Dictionary<JtbFasiDto, List<Scheda>> SchedeGrouped { get; set; } = [];
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
NewScheda.OnNewScheda += LoadSchede;
|
||||
|
||||
LoadSchede();
|
||||
}
|
||||
|
||||
private void LoadSchede()
|
||||
{
|
||||
var ispezione = SteupDataService.InspectionPageState.Ispezione;
|
||||
|
||||
InvokeAsync(async () =>
|
||||
{
|
||||
var schede = await IspezioniService.GetAllSchedeOfIspezioneAsync(
|
||||
ispezione.CodMdep, ispezione.Data, ispezione.Rilevatore
|
||||
);
|
||||
|
||||
SchedeGrouped = schede
|
||||
.Where(s => s.Reparto != null)
|
||||
.GroupBy(s => s.CodJfas)
|
||||
.ToDictionary(
|
||||
g => g.First().Reparto!,
|
||||
g => g.ToList()
|
||||
);
|
||||
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
NewScheda.OnNewScheda -= LoadSchede;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.SingleElements
|
||||
@using SteUp.Shared.Core.Authorization.Enum
|
||||
@using SteUp.Shared.Core.Helpers
|
||||
@using SteUp.Shared.Core.Interface.System.Network
|
||||
@using SteUp.Shared.Core.Services
|
||||
@using SteUp.Shared.Core.Utility
|
||||
@@ -15,7 +14,7 @@
|
||||
@if (IsLoggedIn)
|
||||
{
|
||||
<div class="container content pb-safe-area">
|
||||
<div class="container-primary-info">
|
||||
<div class="container-primary-info mud-elevation-1">
|
||||
<div class="section-primary-info">
|
||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold"
|
||||
Color="Color.Secondary">
|
||||
@@ -64,7 +63,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<div class="container-button mud-elevation-1">
|
||||
<MudButton Class="button-settings green-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
@@ -75,7 +74,7 @@
|
||||
</MudButton>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<div class="container-button mud-elevation-1">
|
||||
<MudButton Class="button-settings exit"
|
||||
FullWidth="true"
|
||||
Color="Color.Error"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
.container-primary-info {
|
||||
background: var(--light-card-background);
|
||||
/*background: var(--light-card-background);*/
|
||||
width: 100%;
|
||||
margin-bottom: 2rem;
|
||||
border-radius: 12px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.container-primary-info .divider {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Entities
|
||||
|
||||
<div class="container-primary-info @(OnClick.HasDelegate ? "ripple-container" : "")" @onclick="OnCardClick">
|
||||
<div class="container-primary-info mud-elevation-1 @(OnClick.HasDelegate ? "ripple-container" : "")" @onclick="OnCardClick">
|
||||
<div class="section-primary-info">
|
||||
<div class="inspection-info">
|
||||
@if (CompactView)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
.container-primary-info {
|
||||
background: var(--light-card-background);
|
||||
/*background: var(--light-card-background);*/
|
||||
width: 100%;
|
||||
margin-bottom: 2rem;
|
||||
border-radius: 12px;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.container-primary-info .divider {
|
||||
|
||||
30
SteUp.Shared/Components/SingleElements/Card/SchedaCard.razor
Normal file
30
SteUp.Shared/Components/SingleElements/Card/SchedaCard.razor
Normal file
@@ -0,0 +1,30 @@
|
||||
@using SteUp.Shared.Core.Entities
|
||||
|
||||
<div class="scheda-card">
|
||||
<div class="scheda-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="scheda-title" Typo="Typo.subtitle1">
|
||||
<b>@Scheda.ActivityTypeId</b>
|
||||
</MudText>
|
||||
|
||||
<div class="sub-info-section">
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.PhotoCamera" Size="Size.Small" Color="Color.Default">
|
||||
0
|
||||
</MudChip>
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.QrCode2" Size="Size.Small" Color="Color.Default">
|
||||
0
|
||||
</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="scheda-card-action">
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Edit" Color="Color.Info" Size="Size.Small">Modifica</MudButton>
|
||||
<MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Rounded.Delete" Color="Color.Error" Size="Size.Small">Cancella</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code{
|
||||
[Parameter] public required Scheda Scheda { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
.scheda-card{
|
||||
padding: .75rem 1.25rem;
|
||||
background-color: var(--light-card-background);
|
||||
border-radius: 1em;
|
||||
}
|
||||
|
||||
.scheda-body-section{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.title-section{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.scheda-card-action{
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
</MudText>
|
||||
</div>
|
||||
<div class="sub-info-section">
|
||||
<MudChip T="string" Icon="@Icons.Material.Filled.LocationCity" Size="Size.Small" Color="Color.Default">
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationCity" Size="Size.Small" Color="Color.Default">
|
||||
@PuntoVendita.Citta
|
||||
</MudChip>
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Core.Interface.IntegryApi
|
||||
@using SteUp.Shared.Core.Interface.LocalDb
|
||||
@using SteUp.Shared.Core.Interface.System
|
||||
@using SteUp.Shared.Core.Interface.System.Network
|
||||
@inject INetworkService NetworkService
|
||||
@inject IDialogService Dialog
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IAttachedService AttachedService
|
||||
@inject IIspezioniService IspezioniService
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
@@ -128,6 +130,8 @@
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
[Parameter] public required string CodMdep { get; set; }
|
||||
[Parameter] public required DateOnly Data { get; set; }
|
||||
|
||||
private Scheda Scheda { get; set; } = new();
|
||||
|
||||
@@ -155,6 +159,16 @@
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
await IspezioniService.AddSchedaAsync(CodMdep, Data, UserSession.User.Username, Scheda);
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
MudDialog.Close(Scheda);
|
||||
}
|
||||
|
||||
private async Task Cancel()
|
||||
|
||||
@@ -21,7 +21,7 @@ public class Scheda : EntityBase<Scheda>
|
||||
public string? ActivityTypeId { get; set; }
|
||||
public string? Note { get; set; }
|
||||
public string? Responsabile { get; set; }
|
||||
public int Scadenza { get; set; } = 24;
|
||||
public int Scadenza { get; set; } = 1460;
|
||||
|
||||
[NotMapped]
|
||||
public JtbFasiDto? Reparto
|
||||
|
||||
@@ -23,11 +23,15 @@ public abstract class ModalHelper
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenFormScheda(IDialogService dialog)
|
||||
public static async Task<DialogResult?> OpenFormScheda(IDialogService dialog, string codMdep, DateOnly data)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalFormScheda>(
|
||||
"ModalFormScheda",
|
||||
new DialogParameters(),
|
||||
new DialogParameters<ModalFormScheda>
|
||||
{
|
||||
{ x => x.CodMdep, codMdep },
|
||||
{ x => x.Data, data },
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = true,
|
||||
|
||||
@@ -9,12 +9,15 @@ public interface IIspezioniService
|
||||
Task<List<Ispezione>> GetAllIspezioniWithSchedeAsync();
|
||||
Task AddIspezioneAsync(Ispezione ispezione);
|
||||
Task<Ispezione> GetOrCreateIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
||||
Task<bool> UpdateIspezioneAsync(Ispezione ispezione);
|
||||
Task<bool> DeleteIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
||||
|
||||
// SCHEDE
|
||||
Task AddSchedaAsync(string codMdep, DateOnly data, string rilevatore, Scheda scheda);
|
||||
Task<List<Scheda>> GetAllSchedeOfIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
||||
Task<Scheda?> GetSchedaAsync(int schedaId);
|
||||
Task<Scheda?> GetSchedaWithIspezioneAsync(int schedaId);
|
||||
Task<bool> UpdateSchedaAsync(Scheda scheda);
|
||||
Task<bool> DeleteSchedaAsync(int schedaId);
|
||||
Task<int> DeleteAllSchedeOfIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
||||
}
|
||||
5
SteUp.Shared/Core/Messages/Scheda/NewSchedaMessage.cs
Normal file
5
SteUp.Shared/Core/Messages/Scheda/NewSchedaMessage.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
|
||||
namespace SteUp.Shared.Core.Messages.Scheda;
|
||||
|
||||
public class NewSchedaMessage(object? value = null) : ValueChangedMessage<object?>(value);
|
||||
13
SteUp.Shared/Core/Messages/Scheda/NewSchedaService.cs
Normal file
13
SteUp.Shared/Core/Messages/Scheda/NewSchedaService.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
namespace SteUp.Shared.Core.Messages.Scheda;
|
||||
|
||||
public class NewSchedaService
|
||||
{
|
||||
public event Action? OnNewScheda;
|
||||
|
||||
public NewSchedaService(IMessenger messenger)
|
||||
{
|
||||
messenger.Register<NewSchedaMessage>(this, (_, _) => { OnNewScheda?.Invoke(); });
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,15 @@
|
||||
border-radius: 1em !important;
|
||||
}
|
||||
|
||||
.mud-skeleton{
|
||||
.mud-skeleton {
|
||||
border-radius: .5em !important;
|
||||
}
|
||||
|
||||
/*.mud-expand-panel{*/
|
||||
/* background: var(--light-card-background) !important;*/
|
||||
/* box-shadow: unset !important;*/
|
||||
/*}*/
|
||||
|
||||
.mud-expansion-panels {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -138,9 +138,9 @@
|
||||
|
||||
.container-button {
|
||||
width: 100%;
|
||||
background: var(--mud-palette-table-striped);
|
||||
/*background: var(--mud-palette-table-striped);*/
|
||||
padding: .5rem 0;
|
||||
border-radius: 12px;
|
||||
border-radius: 20px;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user