Aggiunto blocco per ispezioni non completate più vecchie di 20 giorni

This commit is contained in:
2026-03-02 12:30:24 +01:00
parent ab9578a45f
commit 63368748ab
13 changed files with 232 additions and 142 deletions

View File

@@ -6,6 +6,7 @@ namespace SteUp.Shared.Core.Data.Contracts;
public interface ISteupDataService
{
Task Init();
Task<bool> CanOpenNewInspection();
void RegisterAppVersion();
List<PuntoVenditaDto> PuntiVenditaList { get; }

View File

@@ -3,11 +3,11 @@ using IntegryApiClient.Core.Domain.Abstraction.Contracts.Device;
using SteUp.Shared.Core.Data.Contracts;
using SteUp.Shared.Core.Dto;
using SteUp.Shared.Core.Dto.PageState;
using SteUp.Shared.Core.Enum;
using SteUp.Shared.Core.Helpers;
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;
namespace SteUp.Shared.Core.Data;
@@ -76,6 +76,20 @@ public class SteupDataService(
}
}
public async Task<bool> CanOpenNewInspection()
{
var completedInspection = await ispezioniService.GetAllIspezioni();
if (completedInspection.IsNullOrEmpty()) return true;
//Controllo se sono presenti attività più vecchie di 20 giorni non chiuse
//Se presenti non si possono aprire nuove ispezioni
return !completedInspection.Any(x =>
x.Stato != StatusEnum.Completata &&
x.Data < DateTime.Now.AddDays(-20)
);
}
private async Task LoadDataAsync()
{
if (!await userSession.IsLoggedIn()) return;