generated from Integry/Template_NetMauiBlazorHybrid
Compare commits
7 Commits
61ea1776b3
...
b423ce8d16
| Author | SHA1 | Date | |
|---|---|---|---|
| b423ce8d16 | |||
| 514f98a8a7 | |||
| a26f1a57cc | |||
| f4b2e70881 | |||
| bb0bf1e496 | |||
| d0f961b052 | |||
| 8dcd61b697 |
@ -29,8 +29,8 @@
|
||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>2.1.1</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>18</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>2.1.3</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>20</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
|
||||
@ -22,7 +22,9 @@
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && lastSyncDate.Equals(DateTime.MinValue))
|
||||
var syncAllData = lastSyncDate.Equals(DateTime.MinValue) || (DateTime.Now - lastSyncDate).TotalDays >= 7;
|
||||
|
||||
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && syncAllData)
|
||||
{
|
||||
var returnPath = System.Web.HttpUtility.UrlEncode("/");
|
||||
NavigationManager.NavigateTo($"/sync?path={returnPath}");
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
{
|
||||
<SpinnerLayout FullScreen="false"/>
|
||||
}
|
||||
else if (GroupedUserList.IsNullOrEmpty() || FilteredGroupedUserList.IsNullOrEmpty())
|
||||
else if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
|
||||
@if (item.ShowHeader)
|
||||
|
||||
@ -214,29 +214,36 @@
|
||||
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
|
||||
{
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success"
|
||||
OnClick="() => OpenPosition(item.p)" OnClose="() => OnRemoveAttached(item.index)">
|
||||
OnClick="@(() => OpenPosition(item.p))" OnClose="@(() => OnRemoveAttached(item.index))">
|
||||
@item.p.Description
|
||||
</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Default" OnClick="() => OpenAttached(item.p)"
|
||||
OnClose="() => OnRemoveAttached(item.index)">
|
||||
<MudChip T="string" Color="Color.Default" OnClick="@(() => OpenAttached(item.p))"
|
||||
OnClose="@(() => OnRemoveAttached(item.index))">
|
||||
@item.p.Name
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if (ActivityFileList != null)
|
||||
@if (!IsLoading)
|
||||
{
|
||||
foreach (var file in ActivityFileList)
|
||||
if (ActivityFileList != null)
|
||||
{
|
||||
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" Color="Color.Default">
|
||||
@file.FileName
|
||||
</MudChip>
|
||||
foreach (var file in ActivityFileList)
|
||||
{
|
||||
<MudChip T="string" OnClick="@(() => OpenAttached(file.Id, file.FileName))" OnClose="@(() => DeleteAttach(file))" Color="Color.Default">
|
||||
@file.FileName
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (!IsView)
|
||||
@ -318,6 +325,7 @@
|
||||
private List<ActivityFileDto>? ActivityFileList { get; set; }
|
||||
|
||||
private bool IsNew { get; set; }
|
||||
private bool IsLoading { get; set; }
|
||||
private bool IsView => !NetworkService.ConnectionAvailable;
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
@ -443,6 +451,9 @@
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
IsLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
SelectedComessa = ActivityModel.Commessa;
|
||||
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
@ -456,6 +467,7 @@
|
||||
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
|
||||
Pros = await ManageData.GetProspect();
|
||||
|
||||
IsLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
}
|
||||
@ -479,8 +491,8 @@
|
||||
if (ActivityModel.CodAnag == null)
|
||||
{
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x =>
|
||||
x.CodJcom.Contains(searchValue, StringComparison.OrdinalIgnoreCase) ||
|
||||
x.Descrizione.Contains(searchValue, StringComparison.OrdinalIgnoreCase)
|
||||
x.CodJcom.ToUpper().Contains(searchValue.ToUpper()) ||
|
||||
x.Descrizione.ToUpper().Contains(searchValue.ToUpper())
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -544,11 +556,11 @@
|
||||
var results = new List<string>();
|
||||
|
||||
results.AddRange(Clienti
|
||||
.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
.Where(x => (x.CodAnag != null && x.CodAnag.Contains(value, StringComparison.OrdinalIgnoreCase)) || x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
.Select(x => $"{x.CodAnag} - {x.RagSoc}"));
|
||||
|
||||
results.AddRange(Pros
|
||||
.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
.Where(x => (x.CodPpro != null && x.CodPpro.Contains(value, StringComparison.OrdinalIgnoreCase)) || x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
.Select(x => $"{x.CodPpro} - {x.RagSoc}"));
|
||||
|
||||
return Task.FromResult<IEnumerable<string>?>(results);
|
||||
@ -774,6 +786,33 @@
|
||||
Snackbar.Add("Impossibile aprire il file", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteAttach(ActivityFileDto file)
|
||||
{
|
||||
Snackbar.Clear();
|
||||
|
||||
if (ActivityFileList == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
ActivityFileList.Remove(file);
|
||||
StateHasChanged();
|
||||
|
||||
await IntegryApiService.DeleteFile(ActivityModel.ActivityId!, file.FileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ActivityFileList.Add(file);
|
||||
StateHasChanged();
|
||||
|
||||
Snackbar.Add("Impossibile eliminare il file", Severity.Error);
|
||||
Console.WriteLine($"Impossibile eliminare il file: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Snackbar.Add($"{file.FileName} eliminato con successo", Severity.Info);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenPosition(AttachedDTO attached)
|
||||
{
|
||||
@ -804,7 +843,7 @@
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(ActivityModel.ActivityTypeId);
|
||||
@ -813,7 +852,7 @@
|
||||
|
||||
if (modal is { IsCanceled: false, Result: not null })
|
||||
ActivityModel.ActivityDescription = modal.Result.Data!.ToString();
|
||||
|
||||
|
||||
VisibleOverlay = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
|
||||
@ -160,7 +160,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
}
|
||||
|
||||
public Task<Stream> DownloadFile(string activityId, string fileName) =>
|
||||
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!;
|
||||
integryApiRestClient.Download($"downloadStbActivityFileAttachment/{activityId}/{fileName}")!;
|
||||
|
||||
public Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user