Aggiunto blocco per ispezioni non completate più vecchie di 20 giorni
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using SteUp.Shared.Core.Entities
|
||||
@using SteUp.Shared.Core.Interface.IntegryApi
|
||||
@using SteUp.Shared.Core.Interface.System.Network
|
||||
@using SteUp.Shared.Core.Messages.Ispezione
|
||||
@using SteUp.Shared.Core.Messages.Scheda
|
||||
@inject INetworkService NetworkService
|
||||
@@ -40,18 +37,18 @@
|
||||
Size="Size.Medium" IconSize="Size.Medium">
|
||||
@if (SchedaVisible)
|
||||
{
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda"
|
||||
Label="Nuova scheda" Color="Color.Surface"/>
|
||||
|
||||
if (ShowCompleteInspection)
|
||||
{
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@CompleteInspection"
|
||||
Label="Concludi ispezione" Color="Color.Surface"/>
|
||||
}
|
||||
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewScheda"
|
||||
Label="Nuova scheda" Color="Color.Surface"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewActivity"
|
||||
<MudFabMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="@NewInspection"
|
||||
Label="Nuova ispezione" Color="Color.Surface"/>
|
||||
}
|
||||
</MudFabMenu>
|
||||
@@ -87,9 +84,16 @@
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void NewActivity()
|
||||
private async Task NewInspection()
|
||||
{
|
||||
_ = ModalHelper.OpenSelectShop(Dialog);
|
||||
if (await SteupDataService.CanOpenNewInspection())
|
||||
{
|
||||
_ = Dialog.OpenSelectShop();
|
||||
}
|
||||
else
|
||||
{
|
||||
await Dialog.ShowWarning("Per aprire una nuova ispezione è necessario concludere prima tutte le ispezioni aperte più vecchie di 20 giorni!");
|
||||
}
|
||||
}
|
||||
|
||||
private void CompleteInspection() =>
|
||||
@@ -98,7 +102,7 @@
|
||||
private async Task NewScheda()
|
||||
{
|
||||
var ispezione = SteupDataService.InspectionPageState.Ispezione;
|
||||
var modal = await ModalHelper.OpenFormScheda(Dialog, ispezione.CodMdep, ispezione.Data, true);
|
||||
var modal = await Dialog.OpenFormScheda(ispezione.CodMdep, ispezione.Data, true);
|
||||
|
||||
if (modal is { Canceled: false })
|
||||
Messenger.Send(new NewSchedaMessage());
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
|
||||
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
VisibleOverlay = false;
|
||||
@@ -173,8 +173,7 @@
|
||||
|
||||
private async Task CreateNewScheda(JtbFasiDto jtbFasi)
|
||||
{
|
||||
var modal = await ModalHelper.OpenFormScheda(
|
||||
Dialog,
|
||||
var modal = await Dialog.OpenFormScheda(
|
||||
SteupDataService.InspectionPageState.Ispezione.CodMdep,
|
||||
SteupDataService.InspectionPageState.Ispezione.Data,
|
||||
true,
|
||||
@@ -244,7 +243,7 @@
|
||||
{
|
||||
if (errorMessage == null) return;
|
||||
|
||||
_ = ModalHelper.ShowError(Dialog, errorMessage);
|
||||
_ = Dialog.ShowError(errorMessage);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
|
||||
@@ -64,18 +64,27 @@
|
||||
|
||||
private async Task UpdateScheda()
|
||||
{
|
||||
var modal = await ModalHelper.OpenFormScheda(Dialog, CodMdep, Data, false, Scheda);
|
||||
var modal = await Dialog.OpenFormScheda(CodMdep, Data, false, Scheda);
|
||||
if (modal is { Canceled: false, Data: Scheda scheda }) await OnSchedaModified.InvokeAsync(scheda);
|
||||
}
|
||||
|
||||
private async Task DeleteScheda()
|
||||
{
|
||||
var result = await _deleteMessageBox.ShowAsync();
|
||||
|
||||
|
||||
if (result is true)
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
if (Scheda.ActivityId != null)
|
||||
await IntegrySteupService.DeleteScheda(Scheda.ActivityId);
|
||||
|
||||
var deleteScheda = await IspezioniService.DeleteSchedaAsync(Scheda.Id);
|
||||
if (deleteScheda) await OnSchedaDeleted.InvokeAsync(Scheda);
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
<MudDialog OnBackdropClick="Cancel">
|
||||
<DialogContent>
|
||||
<div class="exception-header mb-2">
|
||||
<i class="ri-emotion-unhappy-line"></i>
|
||||
<span>Ops</span>
|
||||
</div>
|
||||
@if (IsWarning)
|
||||
{
|
||||
<div class="exception-header mb-2">
|
||||
<i class="ri-error-warning-line"></i>
|
||||
<span>Attenzione</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="exception-header mb-2">
|
||||
<i class="ri-emotion-unhappy-line"></i>
|
||||
<span>Ops</span>
|
||||
</div>
|
||||
}
|
||||
<div class="text">
|
||||
<code>@ErrorMessage</code>
|
||||
</div>
|
||||
@@ -18,6 +28,7 @@
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
[Parameter] public string ErrorMessage { get; set; } = string.Empty;
|
||||
[Parameter] public bool IsWarning { get; set; }
|
||||
|
||||
private void Cancel() => MudDialog.Cancel();
|
||||
}
|
||||
@@ -8,9 +8,16 @@
|
||||
.exception-header > i {
|
||||
font-size: 3rem;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
color: var(--bs-danger);
|
||||
}
|
||||
|
||||
.warning-icon {
|
||||
color: var(--bs-warning);
|
||||
}
|
||||
|
||||
.exception-header > span {
|
||||
font-size: x-large;
|
||||
font-weight: 700;
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
|
||||
await ModalHelper.ShowError(Dialog, e.Message);
|
||||
await Dialog.ShowError(e.Message);
|
||||
}
|
||||
|
||||
if (IsNew) await NewSave(apiResponse);
|
||||
@@ -474,7 +474,7 @@
|
||||
|
||||
private async Task OpenAddAttached()
|
||||
{
|
||||
var result = await ModalHelper.OpenAddAttached(Dialog);
|
||||
var result = await Dialog.OpenAddAttached();
|
||||
if (result is not { Canceled: false, Data: List<AttachedDto> attachedList }) return;
|
||||
|
||||
OnLoading = true;
|
||||
@@ -561,7 +561,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var modal = await ModalHelper.OpenSelectArt(Dialog, articoli);
|
||||
var modal = await Dialog.OpenSelectArt(articoli);
|
||||
|
||||
await InvokeAsync(() =>
|
||||
{
|
||||
@@ -614,7 +614,7 @@
|
||||
{
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(Scheda.ActivityTypeId);
|
||||
|
||||
var modal = await ModalHelper.OpenSuggestActivityDescription(Dialog, activityDescriptions);
|
||||
var modal = await Dialog.OpenSuggestActivityDescription(activityDescriptions);
|
||||
|
||||
if (modal is { Canceled: false, Data: not null })
|
||||
Scheda.Note = modal.Data!.ToString();
|
||||
@@ -694,7 +694,7 @@
|
||||
{
|
||||
if (errorMessage == null) return;
|
||||
|
||||
_ = ModalHelper.ShowError(Dialog, errorMessage);
|
||||
_ = Dialog.ShowError(errorMessage);
|
||||
}
|
||||
|
||||
private void RemoveArt(string barcode)
|
||||
|
||||
Reference in New Issue
Block a user