Implemetato databese locale con EntityFramework
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
@page "/ispezione"
|
||||
@using SteUp.Shared.Components.Layout
|
||||
|
||||
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
|
||||
|
||||
<div class="container content pb-safe-area">
|
||||
|
||||
<div class="container-primary-info">
|
||||
<div class="section-primary-info">
|
||||
<div class="inspection-info">
|
||||
<span class="info-title">
|
||||
@SteupDataService.Inspection.PuntoVendita!.CodMdep - @SteupDataService.Inspection.PuntoVendita.Descrizione
|
||||
</span>
|
||||
<span class="info-subtitle">
|
||||
@SteupDataService.Inspection.PuntoVendita.Indirizzo
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="section-info">
|
||||
<div class="section-inspection-info">
|
||||
<div>
|
||||
<span class="info-inspection-title">Data ispezione</span>
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
||||
@SteupDataService.Inspection.DateInspection.ToString("d")
|
||||
</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-inspection-info">
|
||||
<div>
|
||||
<span class="info-inspection-title">Stato ispezione</span>
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Warning">
|
||||
IN CORSO
|
||||
</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
17
SteUp.Shared/Components/Pages/IspezionePage.razor
Normal file
17
SteUp.Shared/Components/Pages/IspezionePage.razor
Normal file
@@ -0,0 +1,17 @@
|
||||
@page "/ispezione"
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.SingleElements.Card
|
||||
|
||||
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
|
||||
|
||||
<div class="container content pb-safe-area">
|
||||
<InspectionCard Ispezione="SteupDataService.InspectionPageState.Ispezione"/>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
@page "/ispezioni"
|
||||
@attribute [Authorize]
|
||||
@using SteUp.Shared.Components.Layout
|
||||
|
||||
<HeaderLayout Title="Ispezioni"/>
|
||||
|
||||
<div class="container">
|
||||
|
||||
</div>
|
||||
52
SteUp.Shared/Components/Pages/IspezioniPage.razor
Normal file
52
SteUp.Shared/Components/Pages/IspezioniPage.razor
Normal file
@@ -0,0 +1,52 @@
|
||||
@page "/ispezioni"
|
||||
@attribute [Authorize]
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.Layout.Overlay
|
||||
@using SteUp.Shared.Components.SingleElements
|
||||
@using SteUp.Shared.Components.SingleElements.Card
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Core.Interface.LocalDb
|
||||
@inject IIspezioniService IspezioniService
|
||||
|
||||
<HeaderLayout Title="Ispezioni"/>
|
||||
|
||||
<div class="container ispezioni">
|
||||
@if (Ispezioni.IsNullOrEmpty())
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna ispezione effettuata" ImageSource="_content/SteUp.Shared/images/undraw_file-search_cbur.svg"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Virtualize Items="Ispezioni" Context="ispezione">
|
||||
<InspectionCard Ispezione="ispezione" CompactView="true" OnClick="@OnClickIspezione"/>
|
||||
</Virtualize>
|
||||
}
|
||||
</div>
|
||||
|
||||
<SpinnerOverlay VisibleOverlay="VisibleOverlay"/>
|
||||
|
||||
@code{
|
||||
private List<Ispezione> Ispezioni { get; set; } = [];
|
||||
|
||||
private bool VisibleOverlay { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Ispezioni = await IspezioniService.GetAllIspezioniWithSchedeAsync();
|
||||
}
|
||||
|
||||
private void OnClickIspezione(Ispezione ispezione)
|
||||
{
|
||||
SteupDataService.InspectionPageState.Ispezione = ispezione;
|
||||
NavigationManager.NavigateTo("/ispezione");
|
||||
}
|
||||
|
||||
}
|
||||
1
SteUp.Shared/Components/Pages/IspezioniPage.razor.css
Normal file
1
SteUp.Shared/Components/Pages/IspezioniPage.razor.css
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
@@ -36,7 +36,7 @@ else
|
||||
</div>
|
||||
|
||||
<div class="my-4 login-footer">
|
||||
<span>@GenericSystemService.GetCurrentAppVersion() | Powered by")</span>
|
||||
<span>@GenericSystemService.GetCurrentAppVersion() | Powered by</span>
|
||||
<img src="_content/SteUp.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
|
||||
</div>
|
||||
</div>
|
||||
104
SteUp.Shared/Components/SingleElements/Card/InspectionCard.razor
Normal file
104
SteUp.Shared/Components/SingleElements/Card/InspectionCard.razor
Normal file
@@ -0,0 +1,104 @@
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Entities
|
||||
|
||||
<div class="container-primary-info @(OnClick.HasDelegate ? "ripple-container" : "")" @onclick="OnCardClick">
|
||||
<div class="section-primary-info">
|
||||
<div class="inspection-info">
|
||||
@if (CompactView)
|
||||
{
|
||||
if (OnLoading)
|
||||
{
|
||||
<MudSkeleton Width="40vw"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="info-title compactView">
|
||||
@PuntoVendita.CodMdep - @PuntoVendita.Descrizione
|
||||
</span>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (OnLoading)
|
||||
{
|
||||
<MudSkeleton Width="40vw"/>
|
||||
<MudSkeleton Width="55vw"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="info-title">
|
||||
@PuntoVendita.CodMdep - @PuntoVendita.Descrizione
|
||||
</span>
|
||||
<span class="info-subtitle">
|
||||
@PuntoVendita.Indirizzo
|
||||
</span>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="section-info">
|
||||
<div class="section-inspection-info">
|
||||
<div>
|
||||
<span class="info-inspection-title">Data ispezione</span>
|
||||
@if (OnLoading)
|
||||
{
|
||||
<MudSkeleton Width="100%"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Size="Size.Small" Color="Color.Default">
|
||||
@Ispezione.Data.ToString("d")
|
||||
</MudChip>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-inspection-info">
|
||||
<div>
|
||||
<span class="info-inspection-title">Stato ispezione</span>
|
||||
@if (OnLoading)
|
||||
{
|
||||
<MudSkeleton Width="100%"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Size="Size.Small" Color="@Ispezione.Stato.GetColor()">
|
||||
@Ispezione.Stato.ConvertToHumanReadable()
|
||||
</MudChip>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public Ispezione Ispezione { get; set; } = new();
|
||||
[Parameter] public bool CompactView { get; set; }
|
||||
[Parameter] public EventCallback<Ispezione> OnClick { get; set; }
|
||||
|
||||
private PuntoVenditaDto PuntoVendita { get; set; } = new();
|
||||
|
||||
private bool OnLoading { get; set; } = true;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
OnLoading = true;
|
||||
StateHasChanged();
|
||||
|
||||
var puntoVendita = SteupDataService.PuntiVenditaList.Find(x =>
|
||||
x.CodMdep != null && x.CodMdep.EqualsIgnoreCase(Ispezione.CodMdep)
|
||||
);
|
||||
await Task.Delay(750);
|
||||
|
||||
PuntoVendita = puntoVendita ?? throw new Exception("Punto vendita non trovato");
|
||||
OnLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private Task OnCardClick() =>
|
||||
OnClick.HasDelegate ? OnClick.InvokeAsync(Ispezione) : Task.CompletedTask;
|
||||
}
|
||||
@@ -38,6 +38,11 @@
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.info-title.compactView{
|
||||
font-size: medium;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.section-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -1,5 +1,7 @@
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Dto.PageState
|
||||
@using SteUp.Shared.Components.Layout.Overlay
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Interface.LocalDb
|
||||
@inject IIspezioniService IspezioniService
|
||||
|
||||
<div class="shop-card ripple-container" @onclick="StartInspection">
|
||||
<div class="shop-body-section">
|
||||
@@ -31,16 +33,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SpinnerOverlay VisibleOverlay="VisibleOverlay"/>
|
||||
|
||||
@code {
|
||||
[Parameter] public PuntoVenditaDto PuntoVendita { get; set; } = null!;
|
||||
|
||||
private void StartInspection()
|
||||
private bool VisibleOverlay { get; set; }
|
||||
|
||||
private async Task StartInspection()
|
||||
{
|
||||
SteupDataService.Inspection = new InspectionPageState
|
||||
{
|
||||
DateInspection = DateTime.Today,
|
||||
PuntoVendita = PuntoVendita
|
||||
};
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
SteupDataService.InspectionPageState.Ispezione = await IspezioniService.GetOrCreateIspezioneAsync(
|
||||
PuntoVendita.CodMdep!,
|
||||
DateOnly.FromDateTime(DateTime.Today),
|
||||
UserSession.User.Username
|
||||
);
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
|
||||
NavigationManager.NavigateTo("/ispezione");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@using SteUp.Shared.Components.Layout
|
||||
@using SteUp.Shared.Components.Layout.Overlay
|
||||
@using SteUp.Shared.Core.Dto
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Core.Interface.IntegryApi
|
||||
@using SteUp.Shared.Core.Interface.System.Network
|
||||
@inject INetworkService NetworkService
|
||||
@@ -24,7 +25,7 @@
|
||||
else
|
||||
{
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="JtbFasiDto?" Variant="Variant.Text"
|
||||
@bind-Value="SchedaDto.Reparto" AdornmentIcon="@Icons.Material.Filled.Code"
|
||||
@bind-Value="Scheda.Reparto" AdornmentIcon="@Icons.Material.Filled.Code"
|
||||
ToStringFunc="@(x => x?.Descrizione)"
|
||||
@bind-Value:after="OnAfterChangeValue" Class="customIcon-select">
|
||||
@foreach (var fasi in SteupDataService.Reparti)
|
||||
@@ -49,7 +50,7 @@
|
||||
else
|
||||
{
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text"
|
||||
@bind-Value="SchedaDto.ActivityTypeId" Class="customIcon-select"
|
||||
@bind-Value="Scheda.ActivityTypeId" Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"
|
||||
@bind-Value:after="OnAfterChangeValue">
|
||||
@foreach (var type in SteupDataService.TipiAttività)
|
||||
@@ -123,7 +124,7 @@
|
||||
<span class="disable-full-width">Scadenza</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@IsView" T="int" Variant="Variant.Text"
|
||||
@bind-Value="@SchedaDto.Scadenza" @bind-Value:after="OnAfterChangeValue"
|
||||
@bind-Value="@Scheda.Scadenza" @bind-Value:after="OnAfterChangeValue"
|
||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="24H" Value="24" />
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="1 Settimana" Value="168" />
|
||||
@@ -135,13 +136,13 @@
|
||||
<div class="divider"></div>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Responsabile" Variant="Variant.Text"
|
||||
@bind-Value="SchedaDto.Responsabile" @bind-Value:after="OnAfterChangeValue"
|
||||
@bind-Value="Scheda.Responsabile" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="3"
|
||||
@bind-Value="SchedaDto.Note" @bind-Value:after="OnAfterChangeValue"
|
||||
@bind-Value="Scheda.Note" @bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
@@ -159,12 +160,12 @@
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
<SpinnerOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
private SchedaDto SchedaDto { get; set; } = new();
|
||||
private Scheda Scheda { get; set; } = new();
|
||||
|
||||
private bool IsNew { get; set; }
|
||||
private bool IsLoading { get; set; }
|
||||
@@ -211,7 +212,7 @@
|
||||
|
||||
private void SuggestActivityDescription()
|
||||
{
|
||||
if (SchedaDto.ActivityTypeId == null)
|
||||
if (Scheda.ActivityTypeId == null)
|
||||
{
|
||||
Snackbar.Add("Indicare prima il motivo", Severity.Error);
|
||||
return;
|
||||
@@ -222,12 +223,12 @@
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(SchedaDto.ActivityTypeId);
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(Scheda.ActivityTypeId);
|
||||
|
||||
var modal = await ModalHelper.OpenSuggestActivityDescription(Dialog, activityDescriptions);
|
||||
|
||||
if (modal is { Canceled: false, Data: not null })
|
||||
SchedaDto.Note = modal.Data!.ToString();
|
||||
Scheda.Note = modal.Data!.ToString();
|
||||
|
||||
VisibleOverlay = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<div class="no-data opacity-75 d-flex flex-column align-items-center">
|
||||
<img
|
||||
src="@ImageSource"/>
|
||||
|
||||
<img src="@ImageSource" alt=""/>
|
||||
|
||||
<p class="mt-3">@Text</p>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user