Compare commits
20 Commits
v2.0.0(6)
...
v2.0.3(10)
| Author | SHA1 | Date | |
|---|---|---|---|
| 11e7b04a88 | |||
| 27588097a3 | |||
| 934258d422 | |||
| c3e646403b | |||
| effdc317c2 | |||
| 9f95bb23e6 | |||
| 5016b3ed8d | |||
| 5981691815 | |||
| f4621f48c8 | |||
| ff36b1cdab | |||
| 36fe05e3c3 | |||
| 0fe1b90417 | |||
| 7359310c48 | |||
| 860a25471e | |||
| 0fab8058f3 | |||
| 2e51420b2c | |||
| fab2836a0e | |||
| 4521b2a02d | |||
| ec7bedeff6 | |||
| ea2f2d47c3 |
@@ -8,7 +8,9 @@ public class AttachedService : IAttachedService
|
||||
public async Task<AttachedDTO?> SelectImageFromCamera()
|
||||
{
|
||||
var cameraPerm = await Permissions.RequestAsync<Permissions.Camera>();
|
||||
if (cameraPerm != PermissionStatus.Granted)
|
||||
var storagePerm = await Permissions.RequestAsync<Permissions.StorageWrite>();
|
||||
|
||||
if (cameraPerm != PermissionStatus.Granted || storagePerm != PermissionStatus.Granted)
|
||||
return null;
|
||||
|
||||
FileResult? result = null;
|
||||
@@ -20,6 +22,7 @@ public class AttachedService : IAttachedService
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore cattura foto: {ex.Message}");
|
||||
SentrySdk.CaptureException(ex);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -41,13 +44,13 @@ public class AttachedService : IAttachedService
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore selezione galleria: {ex.Message}");
|
||||
SentrySdk.CaptureException(ex);
|
||||
return null;
|
||||
}
|
||||
|
||||
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
|
||||
}
|
||||
|
||||
|
||||
public async Task<AttachedDTO?> SelectFile()
|
||||
{
|
||||
var perm = await Permissions.RequestAsync<Permissions.StorageRead>();
|
||||
@@ -115,6 +118,7 @@ public class AttachedService : IAttachedService
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Errore durante il salvataggio dello stream: {e.Message}");
|
||||
SentrySdk.CaptureException(e);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
@@ -128,7 +132,7 @@ public class AttachedService : IAttachedService
|
||||
public async Task OpenFile(Stream file, string fileName)
|
||||
{
|
||||
var filePath = await SaveToTempStorage(file, fileName);
|
||||
|
||||
|
||||
if (filePath is null) return;
|
||||
await Launcher.OpenAsync(new OpenFileRequest
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using AutoMapper;
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Storage;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Dto.Activity;
|
||||
using salesbook.Shared.Core.Dto.Contact;
|
||||
using salesbook.Shared.Core.Dto.PageState;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
using salesbook.Shared.Core.Helpers.Enum;
|
||||
@@ -10,7 +10,7 @@ using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
using salesbook.Shared.Core.Interface.System.Network;
|
||||
using System.Linq.Expressions;
|
||||
using salesbook.Shared.Core.Dto.PageState;
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
@@ -19,7 +19,8 @@ public class ManageDataService(
|
||||
IMapper mapper,
|
||||
UserListState userListState,
|
||||
IIntegryApiService integryApiService,
|
||||
INetworkService networkService
|
||||
INetworkService networkService,
|
||||
IUserSession userSession
|
||||
) : IManageDataService
|
||||
{
|
||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
||||
@@ -178,9 +179,9 @@ public class ManageDataService(
|
||||
|
||||
activities = await localDb.Get<StbActivity>(x =>
|
||||
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null &&
|
||||
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) ||
|
||||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveTime == null &&
|
||||
x.EstimatedTime >= whereCond.Start && x.EstimatedTime <= whereCond.End) ||
|
||||
(x.EffectiveTime >= whereCond.Start && x.EffectiveTime <= whereCond.End) ||
|
||||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
|
||||
);
|
||||
|
||||
@@ -222,9 +223,9 @@ public class ManageDataService(
|
||||
{
|
||||
activities = await localDb.Get<StbActivity>(x =>
|
||||
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null &&
|
||||
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) ||
|
||||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveTime == null &&
|
||||
x.EstimatedTime >= whereCond.Start && x.EstimatedTime <= whereCond.End) ||
|
||||
(x.EffectiveTime >= whereCond.Start && x.EffectiveTime <= whereCond.End) ||
|
||||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
|
||||
);
|
||||
}
|
||||
@@ -260,6 +261,11 @@ public class ManageDataService(
|
||||
var returnDto = activities
|
||||
.Select(activity =>
|
||||
{
|
||||
if (activity.CodJcom is "0000" && userSession.ProfileDb != null && userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
activity.CodJcom = null;
|
||||
}
|
||||
|
||||
var dto = mapper.Map<ActivityDTO>(activity);
|
||||
|
||||
if (activity is { AlarmTime: not null, EstimatedTime: not null })
|
||||
@@ -303,19 +309,28 @@ public class ManageDataService(
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
if (response.AnagClie != null)
|
||||
try
|
||||
{
|
||||
await localDb.InsertOrUpdate(response.AnagClie);
|
||||
if (response.AnagClie != null)
|
||||
{
|
||||
await localDb.InsertOrUpdate(response.AnagClie);
|
||||
|
||||
if (response.VtbDest != null) await localDb.InsertOrUpdate(response.VtbDest);
|
||||
if (response.VtbCliePersRif != null) await localDb.InsertOrUpdate(response.VtbCliePersRif);
|
||||
if (response.VtbDest != null) await localDb.InsertOrUpdate(response.VtbDest);
|
||||
if (response.VtbCliePersRif != null) await localDb.InsertOrUpdate(response.VtbCliePersRif);
|
||||
}
|
||||
|
||||
if (response.PtbPros != null)
|
||||
{
|
||||
await localDb.InsertOrUpdate(response.PtbPros);
|
||||
|
||||
if (response.PtbProsRif != null) await localDb.InsertOrUpdate(response.PtbProsRif);
|
||||
}
|
||||
}
|
||||
|
||||
if (response.PtbPros != null)
|
||||
catch (Exception e)
|
||||
{
|
||||
await localDb.InsertOrUpdate(response.PtbPros);
|
||||
|
||||
if (response.PtbProsRif != null) await localDb.InsertOrUpdate(response.PtbProsRif);
|
||||
Console.WriteLine(e.Message);
|
||||
SentrySdk.CaptureException(e);
|
||||
throw;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
4
salesbook.Maui/ILLink.Descriptors.xml
Normal file
4
salesbook.Maui/ILLink.Descriptors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="salesbook.Shared" preserve="all" />
|
||||
</linker>
|
||||
@@ -1,27 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="it.integry.salesbook">
|
||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true">
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="it.integry.salesbook">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/appicon"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:supportsRtl="true">
|
||||
|
||||
<!-- Firebase push -->
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
|
||||
android:exported="false" />
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
|
||||
android:exported="true"
|
||||
android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
</application>
|
||||
|
||||
<!-- Rete -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!-- Geolocalizzazione -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<!-- Fotocamera -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<!-- Storage / Media -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- Android 10+ -->
|
||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||
|
||||
<!-- Android 13+ -->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
|
||||
<!-- Background / Notifiche -->
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
</manifest>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>2.0.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>6</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>2.0.3</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>10</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
@@ -105,6 +105,20 @@
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BlazorWebAssemblyLazyLoad Include="salesbook.Shared.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="salesbook.Shared" RootMode="All" />
|
||||
<TrimmerRootDescriptor Include="ILLink.Descriptors.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Splash Screen -->
|
||||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#dff2ff" BaseSize="128,128" />
|
||||
@@ -139,11 +153,12 @@
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.110" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.110" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
|
||||
<PackageReference Include="Sentry.Maui" Version="5.15.0" />
|
||||
<PackageReference Include="Sentry.Maui" Version="5.15.1" />
|
||||
<PackageReference Include="Shiny.Hosting.Maui" Version="3.3.4" />
|
||||
<PackageReference Include="Shiny.Notifications" Version="3.3.4" />
|
||||
<PackageReference Include="Shiny.Push" Version="3.3.4" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
|
||||
<PackageReference Include="sqlite-net-e" Version="1.10.0-beta2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
private string _headerTitle = string.Empty;
|
||||
private readonly Dictionary<DateTime, List<ActivityDTO>> _eventsCache = new();
|
||||
private readonly Dictionary<DateTime, CategoryData[]> _categoriesCache = new();
|
||||
private bool _isInitialized = false;
|
||||
private bool _isInitialized;
|
||||
|
||||
// Stato UI
|
||||
private bool Expanded { get; set; }
|
||||
@@ -278,7 +278,7 @@
|
||||
|
||||
// Raggruppa le attività per data
|
||||
var activitiesByDate = MonthActivities
|
||||
.GroupBy(x => (x.EffectiveDate ?? x.EstimatedDate!).Value.Date)
|
||||
.GroupBy(x => (x.EffectiveTime ?? x.EstimatedTime!).Value.Date)
|
||||
.ToDictionary(g => g.Key, g => g.ToList());
|
||||
|
||||
foreach (var (date, activities) in activitiesByDate)
|
||||
@@ -482,7 +482,7 @@
|
||||
var start = CurrentMonth;
|
||||
var end = start.AddDays(DaysInMonth - 1);
|
||||
var activities = await ManageData.GetActivity(new WhereCondActivity{Start = start, End = end});
|
||||
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList();
|
||||
MonthActivities = activities.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime).ToList();
|
||||
|
||||
PrepareRenderingData();
|
||||
IsLoading = false;
|
||||
@@ -574,7 +574,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var date = activity.EffectiveDate ?? activity.EstimatedDate;
|
||||
var date = activity.EffectiveTime ?? activity.EstimatedTime;
|
||||
|
||||
if (CurrentMonth.Month != date!.Value.Month)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
@page "/login"
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject IUserAccountService UserAccountService
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject INetworkService NetworkService
|
||||
|
||||
@if (Spinner)
|
||||
{
|
||||
@@ -29,7 +26,7 @@ else
|
||||
<MudTextField @bind-Value="UserData.CodHash" Label="Profilo azienda" Variant="Variant.Outlined"/>
|
||||
</div>
|
||||
|
||||
<MudButton Disabled="@(!NetworkService.ConnectionAvailable)" OnClick="SignInUser" Color="Color.Primary" Variant="Variant.Filled">Login</MudButton>
|
||||
<MudButton OnClick="SignInUser" Color="Color.Primary" Variant="Variant.Filled">Login</MudButton>
|
||||
@if (_attemptFailed)
|
||||
{
|
||||
<MudAlert Class="my-3" Dense="true" Severity="Severity.Error" Variant="Variant.Filled">@ErrorMessage</MudAlert>
|
||||
|
||||
@@ -85,21 +85,21 @@
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="() => UpdateDb(true)"
|
||||
OnClick="() => UpdateDb()"
|
||||
Variant="Variant.Outlined">
|
||||
Sincronizza
|
||||
</MudButton>
|
||||
|
||||
<div class="divider"></div>
|
||||
@* <div class="divider"></div> *@
|
||||
|
||||
<MudButton Class="button-settings red-icon"
|
||||
@* <MudButton Class="button-settings red-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="() => UpdateDb()"
|
||||
Variant="Variant.Outlined">
|
||||
Ripristina dati
|
||||
</MudButton>
|
||||
</MudButton> *@
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
|
||||
@@ -425,7 +425,7 @@ else
|
||||
set
|
||||
{
|
||||
_filteredActivity = value;
|
||||
StateHasChanged();
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
|
||||
.activity-card.memo {
|
||||
border-left: 5px solid var(--mud-palette-info-darken);
|
||||
background-color: hsl(from var(--mud-palette-info-darken) h s 98%);
|
||||
background-color: hsl(from var(--mud-palette-info-darken) h s 99%);
|
||||
}
|
||||
|
||||
.activity-card.interna {
|
||||
border-left: 5px solid var(--mud-palette-success-darken);
|
||||
background-color: hsl(from var(--mud-palette-success-darken) h s 98%);
|
||||
background-color: hsl(from var(--mud-palette-success-darken) h s 99%);
|
||||
}
|
||||
|
||||
.activity-card.commessa {
|
||||
border-left: 5px solid var(--mud-palette-warning);
|
||||
background-color: hsl(from var(--mud-palette-warning) h s 98%);
|
||||
background-color: hsl(from var(--mud-palette-warning) h s 99%);
|
||||
}
|
||||
|
||||
.activity-left-section {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
@if (ActivityModel.CodJcom != null && SelectedComessa == null)
|
||||
{
|
||||
<MudSkeleton />
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
@if (ActivityModel.UserName != null && SelectedUser == null)
|
||||
{
|
||||
<MudSkeleton />
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
@if (ActivityType.IsNullOrEmpty())
|
||||
{
|
||||
<MudSkeleton />
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -183,7 +183,7 @@
|
||||
{
|
||||
foreach (var file in ActivityFileList)
|
||||
{
|
||||
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" Color="Color.Default">
|
||||
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" OnClose="() => DeleteAttach(file)" Color="Color.Default">
|
||||
@file.FileName
|
||||
</MudChip>
|
||||
}
|
||||
@@ -400,7 +400,25 @@
|
||||
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
|
||||
|
||||
if (!IsNew && Id != null)
|
||||
{
|
||||
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
||||
if (ActivityModel.IdPosizione != null)
|
||||
{
|
||||
ActivityModel.Position = await IntegryApiService.RetrievePosition(ActivityModel.IdPosizione.Value);
|
||||
CanAddPosition = false;
|
||||
|
||||
AttachedList ??= [];
|
||||
AttachedList.Add(
|
||||
new AttachedDTO
|
||||
{
|
||||
Name = ActivityModel.Position.Description!,
|
||||
Lat = ActivityModel.Position.Lat,
|
||||
Lng = ActivityModel.Position.Lng,
|
||||
Type = AttachedDTO.TypeAttached.Position
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
|
||||
@@ -682,6 +700,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
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 async Task OpenAttached(AttachedDTO attached)
|
||||
{
|
||||
if (attached is { FileContent: not null, MimeType: not null })
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<MudDialog Class="customDialog-form disable-safe-area">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" SmallHeader="true" Cancel="true" OnCancel="() => MudDialog.Cancel()" Title="Aggiungi allegati"/>
|
||||
<HeaderLayout ShowProfile="false" SmallHeader="true" Cancel="true" OnCancel="() => MudDialog.Cancel()" Title="@TitleModal"/>
|
||||
|
||||
@if (RequireNewName)
|
||||
{
|
||||
@@ -71,9 +71,21 @@
|
||||
|
||||
private AttachedDTO? Attached { get; set; }
|
||||
|
||||
private bool RequireNewName { get; set; }
|
||||
private bool _requireNewName;
|
||||
private bool RequireNewName
|
||||
{
|
||||
get => _requireNewName;
|
||||
set
|
||||
{
|
||||
_requireNewName = value;
|
||||
TitleModal = _requireNewName ? "Nome allegato" : "Aggiungi allegati";
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
private bool SelectTypePicture { get; set; }
|
||||
|
||||
private string TitleModal { get; set; } = "Aggiungi allegati";
|
||||
|
||||
private string? _newName;
|
||||
private string? NewName
|
||||
{
|
||||
@@ -102,16 +114,22 @@
|
||||
{
|
||||
Attached = await AttachedService.SelectImageFromCamera();
|
||||
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
if (Attached != null)
|
||||
{
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnGallery()
|
||||
{
|
||||
Attached = await AttachedService.SelectImageFromGallery();
|
||||
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
if (Attached != null)
|
||||
{
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnFile()
|
||||
@@ -124,34 +142,40 @@
|
||||
{
|
||||
Attached = await AttachedService.SelectPosition();
|
||||
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
if (Attached != null)
|
||||
{
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNewName()
|
||||
{
|
||||
switch (Attached.Type)
|
||||
if (Attached != null)
|
||||
{
|
||||
case AttachedDTO.TypeAttached.Position:
|
||||
switch (Attached.Type)
|
||||
{
|
||||
CanAddPosition = false;
|
||||
case AttachedDTO.TypeAttached.Position:
|
||||
{
|
||||
CanAddPosition = false;
|
||||
|
||||
Attached.Description = NewName!;
|
||||
Attached.Description = NewName!;
|
||||
Attached.Name = NewName!;
|
||||
|
||||
break;
|
||||
}
|
||||
case AttachedDTO.TypeAttached.Image:
|
||||
{
|
||||
var extension = Path.GetExtension(Attached.Name);
|
||||
Attached.Name = NewName! + extension;
|
||||
break;
|
||||
}
|
||||
case AttachedDTO.TypeAttached.Image:
|
||||
{
|
||||
var extension = Path.GetExtension(Attached.Name);
|
||||
Attached.Name = NewName! + extension;
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case AttachedDTO.TypeAttached.Document:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
case AttachedDTO.TypeAttached.Document:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
MudDialog.Close(Attached);
|
||||
|
||||
@@ -17,7 +17,8 @@ public class ActivityDTO : StbActivity
|
||||
public DateTime? NotificationDate { get; set; }
|
||||
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
|
||||
[JsonPropertyName("stbPosizioni")]
|
||||
public PositionDTO? Position { get; set; }
|
||||
|
||||
public ActivityDTO Clone()
|
||||
@@ -33,7 +34,7 @@ public class ActivityDTO : StbActivity
|
||||
MinuteBefore == other.MinuteBefore &&
|
||||
NotificationDate == other.NotificationDate &&
|
||||
Category == other.Category &&
|
||||
Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedDate, other.EstimatedDate) && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveDate, other.EffectiveDate) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEnddate, other.EstimatedEnddate) && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEnddate, other.EffectiveEnddate) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId;
|
||||
Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
@@ -56,16 +57,12 @@ public class ActivityDTO : StbActivity
|
||||
hashCode.Add(CodAnag);
|
||||
hashCode.Add(CodJcom);
|
||||
hashCode.Add(CodJfas);
|
||||
hashCode.Add(EstimatedDate);
|
||||
hashCode.Add(EstimatedTime);
|
||||
hashCode.Add(AlarmDate);
|
||||
hashCode.Add(AlarmTime);
|
||||
hashCode.Add(EffectiveDate);
|
||||
hashCode.Add(EffectiveTime);
|
||||
hashCode.Add(ResultDescription);
|
||||
hashCode.Add(EstimatedEnddate);
|
||||
hashCode.Add(EstimatedEndtime);
|
||||
hashCode.Add(EffectiveEnddate);
|
||||
hashCode.Add(EffectiveEndtime);
|
||||
hashCode.Add(UserCreator);
|
||||
hashCode.Add(UserName);
|
||||
|
||||
@@ -7,7 +7,7 @@ public class PositionDTO
|
||||
[JsonPropertyName("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
[JsonPropertyName("descrizione")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[JsonPropertyName("lat")]
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
||||
public class PtbProsRif
|
||||
{
|
||||
[PrimaryKey, Column("composite_key")]
|
||||
public string CompositeKey { get; set; }
|
||||
public string CompositeKey { get; set; } = null!;
|
||||
|
||||
private string? _codPpro;
|
||||
|
||||
|
||||
@@ -36,9 +36,6 @@ public class StbActivity
|
||||
[Column("cod_jfas"), JsonPropertyName("codJfas")]
|
||||
public string? CodJfas { get; set; }
|
||||
|
||||
[Column("estimated_date"), JsonPropertyName("estimatedDate")]
|
||||
public DateTime? EstimatedDate { get; set; }
|
||||
|
||||
[Column("estimated_time"), JsonPropertyName("estimatedTime")]
|
||||
public DateTime? EstimatedTime { get; set; }
|
||||
|
||||
@@ -48,24 +45,15 @@ public class StbActivity
|
||||
[Column("alarm_time"), JsonPropertyName("alarmTime")]
|
||||
public DateTime? AlarmTime { get; set; }
|
||||
|
||||
[Column("effective_date"), JsonPropertyName("effectiveDate")]
|
||||
public DateTime? EffectiveDate { get; set; }
|
||||
|
||||
[Column("effective_time"), JsonPropertyName("effectiveTime")]
|
||||
public DateTime? EffectiveTime { get; set; }
|
||||
|
||||
[Column("result_description"), JsonPropertyName("resultDescription")]
|
||||
public string? ResultDescription { get; set; }
|
||||
|
||||
[Column("estimated_enddate"), JsonPropertyName("estimatedEnddate")]
|
||||
public DateTime? EstimatedEnddate { get; set; }
|
||||
|
||||
[Column("estimated_endtime"), JsonPropertyName("estimatedEndtime")]
|
||||
public DateTime? EstimatedEndtime { get; set; }
|
||||
|
||||
[Column("effective_enddate"), JsonPropertyName("effectiveEnddate")]
|
||||
public DateTime? EffectiveEnddate { get; set; }
|
||||
|
||||
[Column("effective_endtime"), JsonPropertyName("effectiveEndtime")]
|
||||
public DateTime? EffectiveEndtime { get; set; }
|
||||
|
||||
@@ -173,4 +161,7 @@ public class StbActivity
|
||||
|
||||
[Column("plan_id"), JsonPropertyName("planId")]
|
||||
public long? PlanId { get; set; }
|
||||
|
||||
[Column("id_posizione"), JsonPropertyName("idPosizione")]
|
||||
public long? IdPosizione { get; set; }
|
||||
}
|
||||
@@ -25,6 +25,7 @@ public interface IIntegryApiService
|
||||
Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request);
|
||||
|
||||
Task UploadFile(string id, byte[] file, string fileName);
|
||||
Task DeleteFile(string activityId, string fileName);
|
||||
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
|
||||
Task<Stream> DownloadFile(string activityId, string fileName);
|
||||
Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName);
|
||||
@@ -33,7 +34,7 @@ public interface IIntegryApiService
|
||||
|
||||
//Position
|
||||
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||
Task<PositionDTO> RetrievePosition(string id);
|
||||
Task<PositionDTO> RetrievePosition(long id);
|
||||
|
||||
//Google
|
||||
Task<List<IndirizzoDTO>?> Geocode(string address);
|
||||
|
||||
@@ -72,8 +72,15 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
return integryApiRestClient.AuthorizedGet<object>($"activity/delete", queryParams);
|
||||
}
|
||||
|
||||
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
|
||||
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
|
||||
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity)
|
||||
{
|
||||
if (activity.CodJcom is null && userSession.ProfileDb != null && userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
activity.CodJcom = "0000";
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
|
||||
}
|
||||
|
||||
public Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request) =>
|
||||
integryApiRestClient.AuthorizedPost<CRMCreateContactResponseDTO>("crm/createContact", request);
|
||||
@@ -127,7 +134,18 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
|
||||
content.Add(fileContent, "files", fileName);
|
||||
|
||||
return integryApiRestClient.Post<object>($"uploadStbActivityFileAttachment", content, queryParams);
|
||||
return integryApiRestClient.Post<object>("uploadStbActivityFileAttachment", content, queryParams);
|
||||
}
|
||||
|
||||
public Task DeleteFile(string activityId, string fileName)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>
|
||||
{
|
||||
{ "activityId", activityId },
|
||||
{ "fileName", fileName }
|
||||
};
|
||||
|
||||
return integryApiRestClient.Get<object>("activity/removeAttachment", queryParams);
|
||||
}
|
||||
|
||||
public Task<List<ActivityFileDto>> GetActivityFile(string activityId)
|
||||
@@ -157,7 +175,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
public Task<PositionDTO> SavePosition(PositionDTO position) =>
|
||||
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
|
||||
|
||||
public Task<PositionDTO> RetrievePosition(string id)
|
||||
public Task<PositionDTO> RetrievePosition(long id)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "id", id } };
|
||||
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.4" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="1.2.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.110" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
|
||||
<PackageReference Include="sqlite-net-e" Version="1.10.0-beta2" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.9" />
|
||||
<PackageReference Include="MudBlazor" Version="8.12.0" />
|
||||
|
||||
Reference in New Issue
Block a user