Gestite schede nella pagina ispezione e migliorie grafiche
This commit is contained in:
@@ -8,11 +8,11 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
|||||||
{
|
{
|
||||||
public Task<Ispezione?> GetIspezioneAsync(string codMdep, DateOnly data, string rilevatore) =>
|
public Task<Ispezione?> GetIspezioneAsync(string codMdep, DateOnly data, string rilevatore) =>
|
||||||
db.Ispezioni
|
db.Ispezioni
|
||||||
.Include(x => x.Schede)
|
.Include(x => x.Schede)
|
||||||
.FirstOrDefaultAsync(x =>
|
.FirstOrDefaultAsync(x =>
|
||||||
x.CodMdep == codMdep &&
|
x.CodMdep == codMdep &&
|
||||||
x.Data == data &&
|
x.Data == data &&
|
||||||
x.Rilevatore == rilevatore);
|
x.Rilevatore == rilevatore);
|
||||||
|
|
||||||
public Task<List<Ispezione>> GetAllIspezioniWithSchedeAsync() =>
|
public Task<List<Ispezione>> GetAllIspezioniWithSchedeAsync() =>
|
||||||
db.Ispezioni
|
db.Ispezioni
|
||||||
@@ -30,7 +30,7 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
|||||||
public async Task<Ispezione> GetOrCreateIspezioneAsync(string codMdep, DateOnly data, string rilevatore)
|
public async Task<Ispezione> GetOrCreateIspezioneAsync(string codMdep, DateOnly data, string rilevatore)
|
||||||
{
|
{
|
||||||
var existing = await db.Ispezioni
|
var existing = await db.Ispezioni
|
||||||
.Include(x => x.Schede)
|
.AsNoTracking()
|
||||||
.FirstOrDefaultAsync(x =>
|
.FirstOrDefaultAsync(x =>
|
||||||
x.CodMdep == codMdep &&
|
x.CodMdep == codMdep &&
|
||||||
x.Data == data &&
|
x.Data == data &&
|
||||||
@@ -48,8 +48,20 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
|||||||
|
|
||||||
db.Ispezioni.Add(created);
|
db.Ispezioni.Add(created);
|
||||||
await db.SaveChangesAsync();
|
await db.SaveChangesAsync();
|
||||||
|
|
||||||
|
return await db.Ispezioni
|
||||||
|
.AsNoTracking()
|
||||||
|
.FirstAsync(x =>
|
||||||
|
x.CodMdep == codMdep &&
|
||||||
|
x.Data == data &&
|
||||||
|
x.Rilevatore == rilevatore);
|
||||||
|
}
|
||||||
|
|
||||||
return created;
|
public async Task<bool> UpdateIspezioneAsync(Ispezione ispezione)
|
||||||
|
{
|
||||||
|
db.Ispezioni.Update(ispezione);
|
||||||
|
await db.SaveChangesAsync();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -84,16 +96,24 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
|||||||
await db.SaveChangesAsync();
|
await db.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<List<Scheda>> GetAllSchedeOfIspezioneAsync(string codMdep, DateOnly data, string rilevatore) =>
|
||||||
|
db.Schede
|
||||||
|
.AsNoTracking()
|
||||||
|
.Where(x => x.CodMdep == codMdep &&
|
||||||
|
x.Data == data &&
|
||||||
|
x.Rilevatore == rilevatore)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
public Task<Scheda?> GetSchedaAsync(int schedaId) =>
|
public Task<Scheda?> GetSchedaAsync(int schedaId) =>
|
||||||
db.Schede
|
db.Schede
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.FirstOrDefaultAsync(x => x.Id == schedaId);
|
.FirstOrDefaultAsync(x => x.Id == schedaId);
|
||||||
|
|
||||||
public Task<Scheda?> GetSchedaWithIspezioneAsync(int schedaId) =>
|
public Task<Scheda?> GetSchedaWithIspezioneAsync(int schedaId) =>
|
||||||
db.Schede
|
db.Schede
|
||||||
.Include(x => x.Ispezione)
|
.Include(x => x.Ispezione)
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.FirstOrDefaultAsync(x => x.Id == schedaId);
|
.FirstOrDefaultAsync(x => x.Id == schedaId);
|
||||||
|
|
||||||
public async Task<bool> DeleteSchedaAsync(int schedaId)
|
public async Task<bool> DeleteSchedaAsync(int schedaId)
|
||||||
{
|
{
|
||||||
@@ -106,6 +126,17 @@ public class IspezioniService(AppDbContext db) : IIspezioniService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UpdateSchedaAsync(Scheda scheda)
|
||||||
|
{
|
||||||
|
var exists = await db.Schede.AnyAsync(x => x.Id == scheda.Id);
|
||||||
|
if (!exists)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
db.Schede.Update(scheda);
|
||||||
|
await db.SaveChangesAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cancella tutte le schede di una ispezione senza cancellare l'ispezione.
|
/// Cancella tutte le schede di una ispezione senza cancellare l'ispezione.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.AspNetCore.Components.Authorization;
|
using Microsoft.AspNetCore.Components.Authorization;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using SteUp.Data.LocalDb;
|
using SteUp.Data.LocalDb;
|
||||||
@@ -13,6 +14,7 @@ using SteUp.Shared.Core.Interface.IntegryApi;
|
|||||||
using SteUp.Shared.Core.Interface.LocalDb;
|
using SteUp.Shared.Core.Interface.LocalDb;
|
||||||
using SteUp.Shared.Core.Interface.System;
|
using SteUp.Shared.Core.Interface.System;
|
||||||
using SteUp.Shared.Core.Interface.System.Network;
|
using SteUp.Shared.Core.Interface.System.Network;
|
||||||
|
using SteUp.Shared.Core.Messages.Scheda;
|
||||||
using SteUp.Shared.Core.Services;
|
using SteUp.Shared.Core.Services;
|
||||||
|
|
||||||
namespace SteUp.Maui.Core;
|
namespace SteUp.Maui.Core;
|
||||||
@@ -47,6 +49,12 @@ public static class CoreModule
|
|||||||
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RegisterMessageServices(this MauiAppBuilder builder)
|
||||||
|
{
|
||||||
|
builder.Services.AddSingleton<IMessenger, WeakReferenceMessenger>();
|
||||||
|
builder.Services.AddSingleton<NewSchedaService>();
|
||||||
|
}
|
||||||
|
|
||||||
public static void RegisterDbServices(this MauiAppBuilder builder)
|
public static void RegisterDbServices(this MauiAppBuilder builder)
|
||||||
{
|
{
|
||||||
builder.Services.AddSingleton<IDbPathProvider, DbPathProvider>();
|
builder.Services.AddSingleton<IDbPathProvider, DbPathProvider>();
|
||||||
@@ -55,7 +63,7 @@ public static class CoreModule
|
|||||||
var dbPath = sp.GetRequiredService<IDbPathProvider>().GetDbPath();
|
var dbPath = sp.GetRequiredService<IDbPathProvider>().GetDbPath();
|
||||||
options.UseSqlite($"Filename={dbPath}");
|
options.UseSqlite($"Filename={dbPath}");
|
||||||
});
|
});
|
||||||
builder.Services.AddSingleton<IDbInitializer, DbInitializer>();
|
builder.Services.AddScoped<IDbInitializer, DbInitializer>();
|
||||||
builder.Services.AddSingleton<IIspezioniService, IspezioniService>();
|
builder.Services.AddScoped<IIspezioniService, IspezioniService>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,6 +47,7 @@ namespace SteUp.Maui
|
|||||||
builder.RegisterIntegryServices();
|
builder.RegisterIntegryServices();
|
||||||
builder.RegisterSystemService();
|
builder.RegisterSystemService();
|
||||||
builder.RegisterDbServices();
|
builder.RegisterDbServices();
|
||||||
|
builder.RegisterMessageServices();
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<MudText Typo="Typo.h6">
|
<MudText Typo="Typo.h6">
|
||||||
<b>@Title</b>
|
<b>@Title</b>
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="@GoBack" />
|
<MudIconButton Icon="@Icons.Material.Rounded.Close" OnClick="@GoBack" />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
@using CommunityToolkit.Mvvm.Messaging
|
||||||
@using SteUp.Shared.Core.Interface.System.Network
|
@using SteUp.Shared.Core.Interface.System.Network
|
||||||
|
@using SteUp.Shared.Core.Messages.Scheda
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
|
@inject IMessenger Messenger
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
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">
|
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||||
<ActivatorContent>
|
<ActivatorContent>
|
||||||
<MudFab Class="custom-plus-button" OnClick="OnOpenMenu" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium"
|
<MudFab Class="custom-plus-button" OnClick="OnOpenMenu" Color="Color.Surface" Size="Size.Medium"
|
||||||
IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add"/>
|
IconSize="Size.Medium"
|
||||||
|
IconColor="Color.Primary" StartIcon="@Icons.Material.Rounded.Add"/>
|
||||||
</ActivatorContent>
|
</ActivatorContent>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
@if (SchedaVisible)
|
@if (SchedaVisible)
|
||||||
@@ -84,15 +88,19 @@
|
|||||||
_ = ModalHelper.OpenSelectShop(Dialog);
|
_ = 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()
|
private void OnOpenMenu()
|
||||||
{
|
{
|
||||||
var location = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Length);
|
var location = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Length);
|
||||||
|
|
||||||
SchedaVisible = new List<string> { "ispezione" }.Contains(location);
|
SchedaVisible = new List<string> { "ispezione" }.Contains(location);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,85 @@
|
|||||||
@page "/ispezione"
|
@page "/ispezione"
|
||||||
@using SteUp.Shared.Components.Layout
|
@using SteUp.Shared.Components.Layout
|
||||||
@using SteUp.Shared.Components.SingleElements.Card
|
@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"/>
|
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
|
||||||
|
|
||||||
<div class="container content pb-safe-area">
|
<div class="container content pb-safe-area">
|
||||||
<InspectionCard Ispezione="SteupDataService.InspectionPageState.Ispezione"/>
|
<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>
|
</div>
|
||||||
|
|
||||||
@code {
|
@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.Layout
|
||||||
@using SteUp.Shared.Components.SingleElements
|
@using SteUp.Shared.Components.SingleElements
|
||||||
@using SteUp.Shared.Core.Authorization.Enum
|
@using SteUp.Shared.Core.Authorization.Enum
|
||||||
@using SteUp.Shared.Core.Helpers
|
|
||||||
@using SteUp.Shared.Core.Interface.System.Network
|
@using SteUp.Shared.Core.Interface.System.Network
|
||||||
@using SteUp.Shared.Core.Services
|
@using SteUp.Shared.Core.Services
|
||||||
@using SteUp.Shared.Core.Utility
|
@using SteUp.Shared.Core.Utility
|
||||||
@@ -15,7 +14,7 @@
|
|||||||
@if (IsLoggedIn)
|
@if (IsLoggedIn)
|
||||||
{
|
{
|
||||||
<div class="container content pb-safe-area">
|
<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">
|
<div class="section-primary-info">
|
||||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold"
|
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold"
|
||||||
Color="Color.Secondary">
|
Color="Color.Secondary">
|
||||||
@@ -64,7 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container-button">
|
<div class="container-button mud-elevation-1">
|
||||||
<MudButton Class="button-settings green-icon"
|
<MudButton Class="button-settings green-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Outlined.Sync"
|
StartIcon="@Icons.Material.Outlined.Sync"
|
||||||
@@ -75,7 +74,7 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container-button">
|
<div class="container-button mud-elevation-1">
|
||||||
<MudButton Class="button-settings exit"
|
<MudButton Class="button-settings exit"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
Color="Color.Error"
|
Color="Color.Error"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
.container-primary-info {
|
.container-primary-info {
|
||||||
background: var(--light-card-background);
|
/*background: var(--light-card-background);*/
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
border-radius: 12px;
|
border-radius: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-primary-info .divider {
|
.container-primary-info .divider {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
@using SteUp.Shared.Core.Dto
|
@using SteUp.Shared.Core.Dto
|
||||||
@using SteUp.Shared.Core.Entities
|
@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="section-primary-info">
|
||||||
<div class="inspection-info">
|
<div class="inspection-info">
|
||||||
@if (CompactView)
|
@if (CompactView)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
.container-primary-info {
|
.container-primary-info {
|
||||||
background: var(--light-card-background);
|
/*background: var(--light-card-background);*/
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
border-radius: 12px;
|
border-radius: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-primary-info .divider {
|
.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>
|
</MudText>
|
||||||
</div>
|
</div>
|
||||||
<div class="sub-info-section">
|
<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
|
@PuntoVendita.Citta
|
||||||
</MudChip>
|
</MudChip>
|
||||||
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
||||||
|
|||||||
@@ -6,12 +6,14 @@
|
|||||||
@using SteUp.Shared.Core.Dto
|
@using SteUp.Shared.Core.Dto
|
||||||
@using SteUp.Shared.Core.Entities
|
@using SteUp.Shared.Core.Entities
|
||||||
@using SteUp.Shared.Core.Interface.IntegryApi
|
@using SteUp.Shared.Core.Interface.IntegryApi
|
||||||
|
@using SteUp.Shared.Core.Interface.LocalDb
|
||||||
@using SteUp.Shared.Core.Interface.System
|
@using SteUp.Shared.Core.Interface.System
|
||||||
@using SteUp.Shared.Core.Interface.System.Network
|
@using SteUp.Shared.Core.Interface.System.Network
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
@inject IIntegryApiService IntegryApiService
|
@inject IIntegryApiService IntegryApiService
|
||||||
@inject IAttachedService AttachedService
|
@inject IAttachedService AttachedService
|
||||||
|
@inject IIspezioniService IspezioniService
|
||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
@@ -128,6 +130,8 @@
|
|||||||
|
|
||||||
@code {
|
@code {
|
||||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
[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();
|
private Scheda Scheda { get; set; } = new();
|
||||||
|
|
||||||
@@ -155,6 +159,16 @@
|
|||||||
|
|
||||||
private async Task Save()
|
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()
|
private async Task Cancel()
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class Scheda : EntityBase<Scheda>
|
|||||||
public string? ActivityTypeId { get; set; }
|
public string? ActivityTypeId { get; set; }
|
||||||
public string? Note { get; set; }
|
public string? Note { get; set; }
|
||||||
public string? Responsabile { get; set; }
|
public string? Responsabile { get; set; }
|
||||||
public int Scadenza { get; set; } = 24;
|
public int Scadenza { get; set; } = 1460;
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public JtbFasiDto? Reparto
|
public JtbFasiDto? Reparto
|
||||||
|
|||||||
@@ -23,11 +23,15 @@ public abstract class ModalHelper
|
|||||||
return await modal.Result;
|
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>(
|
var modal = await dialog.ShowAsync<ModalFormScheda>(
|
||||||
"ModalFormScheda",
|
"ModalFormScheda",
|
||||||
new DialogParameters(),
|
new DialogParameters<ModalFormScheda>
|
||||||
|
{
|
||||||
|
{ x => x.CodMdep, codMdep },
|
||||||
|
{ x => x.Data, data },
|
||||||
|
},
|
||||||
new DialogOptions
|
new DialogOptions
|
||||||
{
|
{
|
||||||
FullScreen = true,
|
FullScreen = true,
|
||||||
|
|||||||
@@ -9,12 +9,15 @@ public interface IIspezioniService
|
|||||||
Task<List<Ispezione>> GetAllIspezioniWithSchedeAsync();
|
Task<List<Ispezione>> GetAllIspezioniWithSchedeAsync();
|
||||||
Task AddIspezioneAsync(Ispezione ispezione);
|
Task AddIspezioneAsync(Ispezione ispezione);
|
||||||
Task<Ispezione> GetOrCreateIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
Task<Ispezione> GetOrCreateIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
||||||
|
Task<bool> UpdateIspezioneAsync(Ispezione ispezione);
|
||||||
Task<bool> DeleteIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
Task<bool> DeleteIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
||||||
|
|
||||||
// SCHEDE
|
// SCHEDE
|
||||||
Task AddSchedaAsync(string codMdep, DateOnly data, string rilevatore, Scheda scheda);
|
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?> GetSchedaAsync(int schedaId);
|
||||||
Task<Scheda?> GetSchedaWithIspezioneAsync(int schedaId);
|
Task<Scheda?> GetSchedaWithIspezioneAsync(int schedaId);
|
||||||
|
Task<bool> UpdateSchedaAsync(Scheda scheda);
|
||||||
Task<bool> DeleteSchedaAsync(int schedaId);
|
Task<bool> DeleteSchedaAsync(int schedaId);
|
||||||
Task<int> DeleteAllSchedeOfIspezioneAsync(string codMdep, DateOnly data, string rilevatore);
|
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;
|
border-radius: 1em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mud-skeleton{
|
.mud-skeleton {
|
||||||
border-radius: .5em !important;
|
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 {
|
.container-button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: var(--mud-palette-table-striped);
|
/*background: var(--mud-palette-table-striped);*/
|
||||||
padding: .5rem 0;
|
padding: .5rem 0;
|
||||||
border-radius: 12px;
|
border-radius: 20px;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user