Implementato controllo conessione dispositivo e servizi. Completata pagination commesse e attività per cliente

This commit is contained in:
2025-09-08 10:24:50 +02:00
parent 014e2ffc41
commit 82d268d9f8
23 changed files with 530 additions and 139 deletions

View File

@@ -29,11 +29,25 @@
<span class="activity-hours">
@if (Activity.EffectiveTime is null)
{
@($"{Activity.EstimatedTime:t}")
if (ShowDate)
{
@($"{Activity.EstimatedTime:g}")
}
else
{
@($"{Activity.EstimatedTime:t}")
}
}
else
{
@($"{Activity.EffectiveTime:t}")
if (ShowDate)
{
@($"{Activity.EffectiveTime:g}")
}
else
{
@($"{Activity.EffectiveTime:t}")
}
}
</span>
</div>
@@ -68,6 +82,8 @@
[Parameter] public EventCallback<string> ActivityChanged { get; set; }
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
[Parameter] public bool ShowDate { get; set; }
private TimeSpan? Durata { get; set; }
protected override void OnParametersSet()
@@ -82,7 +98,7 @@
private async Task OpenActivity()
{
var result = await ModalHelpers.OpenActivityForm(Dialog, null, Activity.ActivityId);
var result = await ModalHelpers.OpenActivityForm(Dialog, Activity, null);
switch (result)
{

View File

@@ -25,11 +25,23 @@
@if (!Commesse.IsNullOrEmpty())
{
<div @onclick="OpenUser" class="container-commesse">
@foreach (var commessa in Commesse!)
@for (var i = 0; i < Commesse!.Count; i++)
{
var commessa = Commesse[i];
<div class="commessa">
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
@if (i > 5 && Commesse.Count - i > 1)
{
<span>@($"E altre {Commesse.Count - i} commesse")</span>
}
else
{
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
}
</div>
@if (i > 5 && Commesse.Count - i > 1) break;
}
</div>
}
@@ -63,7 +75,8 @@
if (ShowSectionCommesse)
{
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodContact));
Commesse = (await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodContact)))
.OrderByDescending(x => x.CodJcom).ToList();
IsLoading = false;
StateHasChanged();
return;

View File

@@ -250,8 +250,8 @@
private List<PtbPros> Pros { get; set; } = [];
private List<ActivityFileDto>? ActivityFileList { get; set; }
private bool IsNew => Id.IsNullOrEmpty();
private bool IsView => !NetworkService.IsNetworkAvailable();
private bool IsNew { get; set; }
private bool IsView => !NetworkService.ConnectionAvailable;
private string? LabelSave { get; set; }
@@ -276,18 +276,18 @@
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
_ = LoadData();
LabelSave = IsNew ? "Aggiungi" : null;
if (!Id.IsNullOrEmpty())
ActivityModel = (await ManageData.GetActivity(new WhereCondActivity { ActivityId = Id }, true)).Last();
if (ActivityCopied != null)
{
ActivityModel = ActivityCopied.Clone();
}
else if (!Id.IsNullOrEmpty())
ActivityModel = (await ManageData.GetActivity(new WhereCondActivity { ActivityId = Id }, true)).Last();
if (Id.IsNullOrEmpty()) Id = ActivityModel.ActivityId;
IsNew = Id.IsNullOrEmpty();
LabelSave = IsNew ? "Aggiungi" : null;
_ = LoadData();
await LoadCommesse();
if (IsNew)

View File

@@ -280,7 +280,7 @@
}
else
{
@if (NetworkService.IsNetworkAvailable() && !ContactModel.IsContact)
@if (NetworkService.ConnectionAvailable && !ContactModel.IsContact)
{
<MudButton Class="button-settings blue-icon"
FullWidth="true"
@@ -332,7 +332,7 @@
private List<StbUser> Users { get; set; } = [];
private bool IsNew => OriginalModel is null;
private bool IsView => !NetworkService.IsNetworkAvailable();
private bool IsView => !NetworkService.ConnectionAvailable;
private string? LabelSave { get; set; }

View File

@@ -118,7 +118,7 @@
private PersRifDTO PersRifModel { get; set; } = new();
private bool IsNew => OriginalModel is null;
private bool IsView => !NetworkService.IsNetworkAvailable();
private bool IsView => !NetworkService.ConnectionAvailable;
private string? LabelSave { get; set; }