From 626408412bb91187335d3bcd465190bbaf9ffe62 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Mon, 19 May 2025 16:47:21 +0200 Subject: [PATCH] Primo sviluppo sincronizzazione e migliorie ui --- .../{ => Core}/Services/FormFactor.cs | 4 +- Template.Maui/Core/Services/LocalDbService.cs | 76 +++++++ .../Core/Services/ManageDataService.cs | 72 +++++++ .../{ => Core}/Services/NetworkService.cs | 2 +- Template.Maui/Core/Services/SyncDbService.cs | 69 ++++++ Template.Maui/MainPage.xaml.cs | 10 + Template.Maui/MauiProgram.cs | 12 +- .../Platforms/Android/AndroidManifest.xml | 6 +- .../Platforms/Android/MainActivity.cs | 8 +- Template.Maui/Platforms/iOS/Info.plist | 7 + Template.Maui/Template.Maui.csproj | 4 +- Template.Maui/wwwroot/index.html | 3 +- .../Components/Layout/HeaderLayout.razor | 37 +++- .../Components/Layout/HeaderLayout.razor.css | 26 ++- .../Components/Layout/MainLayout.razor | 15 +- .../Components/Layout/NavMenu.razor.css | 2 + .../Layout/Spinner/SyncSpinner.razor | 20 ++ .../Layout/Spinner/SyncSpinner.razor.css | 27 +++ .../Components/Pages/Calendar.razor | 5 +- .../Components/Pages/Calendar.razor.css | 11 +- Template.Shared/Components/Pages/Home.razor | 8 +- .../Components/Pages/Login.razor.css | 5 + .../Components/Pages/PersonalInfo.razor | 31 +-- .../Components/Pages/PersonalInfo.razor.css | 17 +- .../Components/Pages/Settings.razor | 28 +++ .../Components/Pages/SyncPage.razor | 57 +++++ .../SingleElements/Calendar/DayView.razor | 63 +++++- .../SingleElements/Calendar/DayView.razor.css | 11 + .../SingleElements/Calendar/MonthView.razor | 1 - .../SingleElements/Calendar/WeekView.razor | 76 +++++++ .../Calendar/WeekView.razor.css | 26 +++ .../SingleElements/Card/ActivityCard.razor | 50 ++++- .../Card/ActivityCard.razor.css | 12 +- .../SingleElements/NoDataAvailable.razor | 3 +- .../SingleElements/NoDataAvailable.razor.css | 2 +- Template.Shared/Core/Dto/ActivityDTO.cs | 10 + .../Core/Dto/TaskSyncResponseDTO.cs | 12 ++ Template.Shared/Core/Entity/AnagClie.cs | 83 ++++++++ Template.Shared/Core/Entity/JtbComt.cs | 110 ++++++++++ Template.Shared/Core/Entity/PtbPros.cs | 131 ++++++++++++ Template.Shared/Core/Entity/PtbProsRif.cs | 32 +++ Template.Shared/Core/Entity/StbActivity.cs | 176 ++++++++++++++++ Template.Shared/Core/Entity/VtbCliePersRif.cs | 41 ++++ Template.Shared/Core/Entity/VtbDest.cs | 197 ++++++++++++++++++ .../Core/Helpers/ActivityCategoryHelper.cs | 17 ++ .../Core/Helpers/Enum/ActivityCategoryEnum.cs | 8 + .../Core/Helpers/Enum/ActivityStatusEnum.cs | 6 + .../Core/Helpers/MappingProfile.cs | 13 ++ .../Core/Helpers/ObjectExtensions.cs | 13 ++ .../Interface}/IFormFactor.cs | 2 +- .../Core/Interface/IIntegryApiService.cs | 12 ++ .../Core/Interface/IManageDataService.cs | 18 ++ .../Core/Interface/ISyncDbService.cs | 9 + .../Core/Messages/BackNavigationService.cs | 16 ++ .../Core/Messages/HardwareBackMessage.cs | 5 + .../Core/Services/IntegryApiService.cs | 54 +++++ Template.Shared/Template.Shared.csproj | 4 +- Template.Shared/wwwroot/css/app.css | 5 +- .../images/undraw_file-search_cbur.svg | 43 ++++ Template.Shared/wwwroot/js/main.js | 4 +- .../{ => Core}/Services/FormFactor.cs | 4 +- .../Core/Services/ManageDataService.cs | 49 +++++ .../{ => Core}/Services/NetworkService.cs | 2 +- Template.Web/Core/Services/SyncDbService.cs | 26 +++ Template.Web/Program.cs | 6 +- Template.Web/Template.Web.csproj | 1 + 66 files changed, 1824 insertions(+), 91 deletions(-) rename Template.Maui/{ => Core}/Services/FormFactor.cs (77%) create mode 100644 Template.Maui/Core/Services/LocalDbService.cs create mode 100644 Template.Maui/Core/Services/ManageDataService.cs rename Template.Maui/{ => Core}/Services/NetworkService.cs (84%) create mode 100644 Template.Maui/Core/Services/SyncDbService.cs create mode 100644 Template.Shared/Components/Layout/Spinner/SyncSpinner.razor create mode 100644 Template.Shared/Components/Layout/Spinner/SyncSpinner.razor.css create mode 100644 Template.Shared/Components/Pages/Settings.razor create mode 100644 Template.Shared/Components/Pages/SyncPage.razor create mode 100644 Template.Shared/Components/SingleElements/Calendar/WeekView.razor create mode 100644 Template.Shared/Components/SingleElements/Calendar/WeekView.razor.css create mode 100644 Template.Shared/Core/Dto/ActivityDTO.cs create mode 100644 Template.Shared/Core/Dto/TaskSyncResponseDTO.cs create mode 100644 Template.Shared/Core/Entity/AnagClie.cs create mode 100644 Template.Shared/Core/Entity/JtbComt.cs create mode 100644 Template.Shared/Core/Entity/PtbPros.cs create mode 100644 Template.Shared/Core/Entity/PtbProsRif.cs create mode 100644 Template.Shared/Core/Entity/StbActivity.cs create mode 100644 Template.Shared/Core/Entity/VtbCliePersRif.cs create mode 100644 Template.Shared/Core/Entity/VtbDest.cs create mode 100644 Template.Shared/Core/Helpers/ActivityCategoryHelper.cs create mode 100644 Template.Shared/Core/Helpers/Enum/ActivityCategoryEnum.cs create mode 100644 Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs create mode 100644 Template.Shared/Core/Helpers/MappingProfile.cs create mode 100644 Template.Shared/Core/Helpers/ObjectExtensions.cs rename Template.Shared/{Interfaces => Core/Interface}/IFormFactor.cs (83%) create mode 100644 Template.Shared/Core/Interface/IIntegryApiService.cs create mode 100644 Template.Shared/Core/Interface/IManageDataService.cs create mode 100644 Template.Shared/Core/Interface/ISyncDbService.cs create mode 100644 Template.Shared/Core/Messages/BackNavigationService.cs create mode 100644 Template.Shared/Core/Messages/HardwareBackMessage.cs create mode 100644 Template.Shared/Core/Services/IntegryApiService.cs create mode 100644 Template.Shared/wwwroot/images/undraw_file-search_cbur.svg rename Template.Web/{ => Core}/Services/FormFactor.cs (72%) create mode 100644 Template.Web/Core/Services/ManageDataService.cs rename Template.Web/{ => Core}/Services/NetworkService.cs (80%) create mode 100644 Template.Web/Core/Services/SyncDbService.cs diff --git a/Template.Maui/Services/FormFactor.cs b/Template.Maui/Core/Services/FormFactor.cs similarity index 77% rename from Template.Maui/Services/FormFactor.cs rename to Template.Maui/Core/Services/FormFactor.cs index 8e22d6c..71fe68a 100644 --- a/Template.Maui/Services/FormFactor.cs +++ b/Template.Maui/Core/Services/FormFactor.cs @@ -1,6 +1,6 @@ -using Template.Shared.Interfaces; +using Template.Shared.Core.Interface; -namespace Template.Maui.Services; +namespace Template.Maui.Core.Services; public class FormFactor : IFormFactor { diff --git a/Template.Maui/Core/Services/LocalDbService.cs b/Template.Maui/Core/Services/LocalDbService.cs new file mode 100644 index 0000000..3d2ec8a --- /dev/null +++ b/Template.Maui/Core/Services/LocalDbService.cs @@ -0,0 +1,76 @@ +using System.Linq.Expressions; +using SQLite; +using Template.Shared.Core.Entity; + +namespace Template.Maui.Core.Services; + +public class LocalDbService +{ + private const string DB_NAME = "task_db.db3"; + private readonly SQLiteAsyncConnection _connection; + + public LocalDbService() + { + _connection = new SQLiteAsyncConnection(Path.Combine(FileSystem.AppDataDirectory, DB_NAME)); + + //Creazione tabelle database + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + } + + public async Task ResetDb() + { + try + { + await _connection.ExecuteAsync("DROP TABLE IF EXISTS anag_clie;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS jtb_comt;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS ptb_pros;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS ptb_pros_rif;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_clie_pers_rif;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_dest;"); + + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + + Console.WriteLine("Database resettato con successo."); + } + catch (Exception ex) + { + Console.WriteLine($"Errore durante il reset del database: {ex.Message}"); + throw; + } + } + + public Task Insert(List entityList) => + _connection.InsertAllAsync(entityList, typeof(T)); + + public async Task InsertOrUpdate(List entityList) + { + foreach (var entity in entityList) + { + var result = await _connection.UpdateAsync(entity); + if (result == 0) + { + await _connection.InsertAsync(entity); + } + } + } + + public Task> Get(Expression>? whereCond = null) where T : new() => + whereCond is null + ? _connection.Table().ToListAsync() + : _connection.Table().Where(whereCond).ToListAsync(); + + public List Get(string sql) where T : new() => _connection.QueryAsync(sql).Result; +} \ No newline at end of file diff --git a/Template.Maui/Core/Services/ManageDataService.cs b/Template.Maui/Core/Services/ManageDataService.cs new file mode 100644 index 0000000..7dd08e2 --- /dev/null +++ b/Template.Maui/Core/Services/ManageDataService.cs @@ -0,0 +1,72 @@ +using AutoMapper; +using System.Linq.Expressions; +using Template.Shared.Core.Dto; +using Template.Shared.Core.Entity; +using Template.Shared.Core.Helpers.Enum; +using Template.Shared.Core.Interface; + +namespace Template.Maui.Core.Services; + +public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManageDataService +{ + public Task> GetAnagClie(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public Task> GetJtbComt(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public Task> GetPtbPros(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public Task> GetPtbProsRif(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public Task> GetStbActivity(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public Task> GetVtbCliePersRif(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public Task> GetVtbDest(Expression>? whereCond = null) => + localDb.Get(whereCond); + + public async Task> GetActivity(Expression>? whereCond = null) + { + var activities = await localDb.Get(whereCond); + + var codJcomList = activities + .Select(x => x.CodJcom) + .Where(x => !string.IsNullOrEmpty(x)) + .Distinct() + .ToList(); + + var jtbComtList = await localDb.Get(x => codJcomList.Contains(x.CodJcom)); + var commesseDict = jtbComtList.ToDictionary(x => x.CodJcom, x => x.Descrizione); + + var returnDto = activities + .Select(activity => + { + var dto = mapper.Map(activity); + + if (activity.CodJcom != null) + { + dto.Category = ActivityCategoryEnum.Commessa; + } + else + { + dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo; + } + + dto.Commessa = activity.CodJcom != null && commesseDict.TryGetValue(activity.CodJcom, out var descr) + ? descr + : null; + return dto; + }) + .ToList(); + + return returnDto; + } + + public async Task ClearDb() => + await localDb.ResetDb(); +} \ No newline at end of file diff --git a/Template.Maui/Services/NetworkService.cs b/Template.Maui/Core/Services/NetworkService.cs similarity index 84% rename from Template.Maui/Services/NetworkService.cs rename to Template.Maui/Core/Services/NetworkService.cs index 1f6284e..053c0ff 100644 --- a/Template.Maui/Services/NetworkService.cs +++ b/Template.Maui/Core/Services/NetworkService.cs @@ -1,6 +1,6 @@ using Template.Shared.Core.Interface; -namespace Template.Maui.Services; +namespace Template.Maui.Core.Services; public class NetworkService : INetworkService { diff --git a/Template.Maui/Core/Services/SyncDbService.cs b/Template.Maui/Core/Services/SyncDbService.cs new file mode 100644 index 0000000..1386ab4 --- /dev/null +++ b/Template.Maui/Core/Services/SyncDbService.cs @@ -0,0 +1,69 @@ +using Template.Shared.Core.Interface; + +namespace Template.Maui.Core.Services; + +public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService +{ + public async Task GetAndSaveActivity(string? dateFilter) + { + var allActivity = await integryApiService.GetActivity(dateFilter); + + if (allActivity is not null) + if (dateFilter is null) + await localDb.Insert(allActivity); + else + await localDb.InsertOrUpdate(allActivity); + } + + public async Task GetAndSaveCommesse(string? dateFilter) + { + var allCommesse = await integryApiService.GetAllCommesse(dateFilter); + + if (allCommesse is not null) + if (dateFilter is null) + await localDb.Insert(allCommesse); + else + await localDb.InsertOrUpdate(allCommesse); + } + + public async Task GetAndSaveProspect(string? dateFilter) + { + var taskSyncResponseDto = await integryApiService.GetProspect(dateFilter); + + if (taskSyncResponseDto.PtbPros is not null) + if (dateFilter is null) + await localDb.Insert(taskSyncResponseDto.PtbPros); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.PtbPros); + + if (taskSyncResponseDto.PtbProsRif is not null) + if (dateFilter is null) + await localDb.Insert(taskSyncResponseDto.PtbProsRif); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.PtbProsRif); + } + + public async Task GetAndSaveClienti(string? dateFilter) + { + var taskSyncResponseDto = await integryApiService.GetAnagClie(dateFilter); + + if (taskSyncResponseDto.AnagClie is not null) + if (dateFilter is null) + await localDb.Insert(taskSyncResponseDto.AnagClie); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.AnagClie); + + if (taskSyncResponseDto.VtbDest is not null) + if (dateFilter is null) + await localDb.Insert(taskSyncResponseDto.VtbDest); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.VtbDest); + + if (taskSyncResponseDto.VtbCliePersRif is not null) + if (dateFilter is null) + await localDb.Insert(taskSyncResponseDto.VtbCliePersRif); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.VtbCliePersRif); + } + +} \ No newline at end of file diff --git a/Template.Maui/MainPage.xaml.cs b/Template.Maui/MainPage.xaml.cs index d398a31..71d0780 100644 --- a/Template.Maui/MainPage.xaml.cs +++ b/Template.Maui/MainPage.xaml.cs @@ -1,3 +1,6 @@ +using CommunityToolkit.Mvvm.Messaging; +using Template.Shared.Core.Messages; + namespace Template.Maui { public partial class MainPage : ContentPage @@ -6,5 +9,12 @@ namespace Template.Maui { InitializeComponent(); } + + protected override bool OnBackButtonPressed() + { + WeakReferenceMessenger.Default.Send(new HardwareBackMessage("back")); + return true; + } + } } diff --git a/Template.Maui/MauiProgram.cs b/Template.Maui/MauiProgram.cs index 1d6ba7b..f726335 100644 --- a/Template.Maui/MauiProgram.cs +++ b/Template.Maui/MauiProgram.cs @@ -2,11 +2,12 @@ using IntegryApiClient.MAUI; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.Extensions.Logging; using MudBlazor.Services; -using Template.Maui.Services; +using Template.Maui.Core.Services; using Template.Shared; +using Template.Shared.Core.Helpers; using Template.Shared.Core.Interface; +using Template.Shared.Core.Messages; using Template.Shared.Core.Services; -using Template.Shared.Interfaces; namespace Template.Maui { @@ -30,12 +31,18 @@ namespace Template.Maui builder.Services.AddMauiBlazorWebView(); builder.Services.AddMudServices(); + builder.Services.AddAutoMapper(typeof(MappingProfile)); + builder.Services.AddAuthorizationCore(); builder.Services.AddScoped(); builder.Services.AddScoped(provider => provider.GetRequiredService()); builder.Services.AddScoped(); + builder.Services.AddScoped(); + builder.Services.AddScoped(); + builder.Services.AddScoped(); + builder.Services.AddScoped(); #if DEBUG builder.Services.AddBlazorWebViewDeveloperTools(); @@ -43,6 +50,7 @@ namespace Template.Maui #endif builder.Services.AddSingleton(); + builder.Services.AddSingleton(); return builder.Build(); } diff --git a/Template.Maui/Platforms/Android/AndroidManifest.xml b/Template.Maui/Platforms/Android/AndroidManifest.xml index def1282..9698f04 100644 --- a/Template.Maui/Platforms/Android/AndroidManifest.xml +++ b/Template.Maui/Platforms/Android/AndroidManifest.xml @@ -1,6 +1,6 @@  - - - + + + diff --git a/Template.Maui/Platforms/Android/MainActivity.cs b/Template.Maui/Platforms/Android/MainActivity.cs index 8b0f78b..2a69013 100644 --- a/Template.Maui/Platforms/Android/MainActivity.cs +++ b/Template.Maui/Platforms/Android/MainActivity.cs @@ -1,11 +1,13 @@ using Android.App; using Android.Content.PM; -using Android.OS; namespace Template.Maui { - [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] + [Activity(Theme = "@style/Maui.SplashTheme", + MainLauncher = true, + ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | + ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] public class MainActivity : MauiAppCompatActivity { } -} +} \ No newline at end of file diff --git a/Template.Maui/Platforms/iOS/Info.plist b/Template.Maui/Platforms/iOS/Info.plist index ecb7f71..ee8e215 100644 --- a/Template.Maui/Platforms/iOS/Info.plist +++ b/Template.Maui/Platforms/iOS/Info.plist @@ -28,5 +28,12 @@ XSAppIconAssets Assets.xcassets/appicon.appiconset + NSLocalNetworkUsageDescription + This app requires access to the local network to communicate with the server. + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + diff --git a/Template.Maui/Template.Maui.csproj b/Template.Maui/Template.Maui.csproj index 585d27a..1af6c57 100644 --- a/Template.Maui/Template.Maui.csproj +++ b/Template.Maui/Template.Maui.csproj @@ -77,7 +77,7 @@ - Apple Development: Massimo Fausto Morelli (6C2CUM53BT) + Apple Development: Created via API (5B7B69P4JY) VS: WildCard Development @@ -111,12 +111,14 @@ + + diff --git a/Template.Maui/wwwroot/index.html b/Template.Maui/wwwroot/index.html index 5432b12..03b681d 100644 --- a/Template.Maui/wwwroot/index.html +++ b/Template.Maui/wwwroot/index.html @@ -10,8 +10,7 @@ - - + diff --git a/Template.Shared/Components/Layout/HeaderLayout.razor b/Template.Shared/Components/Layout/HeaderLayout.razor index 3489ce7..1876b78 100644 --- a/Template.Shared/Components/Layout/HeaderLayout.razor +++ b/Template.Shared/Components/Layout/HeaderLayout.razor @@ -1,14 +1,43 @@ +@inject IJSRuntime JS +
-
-

@Title

- @if (ShowFilter) +
+ @if (Back) { - +
+ @BackTo +
} + +

@Title

+ +
+ @if (ShowFilter) + { + + } + @if (ShowNotifications) + { + + } +
@code{ [Parameter] public string? Title { get; set; } [Parameter] public bool ShowFilter { get; set; } + [Parameter] public bool ShowNotifications { get; set; } = true; + [Parameter] public bool Back { get; set; } + [Parameter] public string BackTo { get; set; } = ""; + + private async Task GoBack() + { + await JS.InvokeVoidAsync("goBack"); + } + } \ No newline at end of file diff --git a/Template.Shared/Components/Layout/HeaderLayout.razor.css b/Template.Shared/Components/Layout/HeaderLayout.razor.css index 7964470..d71b212 100644 --- a/Template.Shared/Components/Layout/HeaderLayout.razor.css +++ b/Template.Shared/Components/Layout/HeaderLayout.razor.css @@ -1,7 +1,29 @@ .header-content { + line-height: normal; display: flex; justify-content: space-between; - color: var(--lighter-color); align-items: center; - padding-top: .5rem; + position: relative; +} + +.header-content.with-back { margin: .6rem 0 0 0; } + +.header-content.with-back .page-title { + position: absolute; + left: 50%; + transform: translateX(-50%); + margin: 0; + font-size: larger; +} + +.left-section ::deep button { + font-size: 1rem; +} + +.left-section ::deep .mud-button-icon-start { + margin-right: 3px !important; +} + +.header-content.no-back .page-title { + margin: 0; } \ No newline at end of file diff --git a/Template.Shared/Components/Layout/MainLayout.razor b/Template.Shared/Components/Layout/MainLayout.razor index 4de1212..a13cd6e 100644 --- a/Template.Shared/Components/Layout/MainLayout.razor +++ b/Template.Shared/Components/Layout/MainLayout.razor @@ -1,4 +1,7 @@ -@inherits LayoutComponentBase +@using Template.Shared.Core.Messages +@inherits LayoutComponentBase +@inject IJSRuntime JS +@inject BackNavigationService BackService @@ -23,8 +26,16 @@ { Primary = "#ABA9BF", Secondary = "#BEB7DF", - Tertiary = "#D4F2D2" + Tertiary = "#B2FDAD" } }; + protected override void OnInitialized() + { + BackService.OnHardwareBack += async () => + { + await JS.InvokeVoidAsync("goBack"); + }; + } + } \ No newline at end of file diff --git a/Template.Shared/Components/Layout/NavMenu.razor.css b/Template.Shared/Components/Layout/NavMenu.razor.css index e2811c9..f8b6660 100644 --- a/Template.Shared/Components/Layout/NavMenu.razor.css +++ b/Template.Shared/Components/Layout/NavMenu.razor.css @@ -3,6 +3,8 @@ position: fixed; bottom: 0; width: 100%; + z-index: 1001; + border-top: 1px solid var(--card-border-color); } .navbar-expand { padding: 0 !important; } diff --git a/Template.Shared/Components/Layout/Spinner/SyncSpinner.razor b/Template.Shared/Components/Layout/Spinner/SyncSpinner.razor new file mode 100644 index 0000000..8f3ba84 --- /dev/null +++ b/Template.Shared/Components/Layout/Spinner/SyncSpinner.razor @@ -0,0 +1,20 @@ +@if (Elements is not null) +{ +
+ Download risorse in corso +
+ @foreach (var element in Elements) + { +
+ @element.Key + +
+ } +
+
+} + +@code +{ + [Parameter] public Dictionary? Elements { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Components/Layout/Spinner/SyncSpinner.razor.css b/Template.Shared/Components/Layout/Spinner/SyncSpinner.razor.css new file mode 100644 index 0000000..751094d --- /dev/null +++ b/Template.Shared/Components/Layout/Spinner/SyncSpinner.razor.css @@ -0,0 +1,27 @@ +.container-loader { + display: flex; + height: 95vh; + flex-direction: column; + justify-content: center; + padding: 0 1rem; + align-items: center; + gap: 5vh; +} + +.container-loader > div { + width: 100%; +} + +.container-loader > span { + font-weight: 900; + font-size: large; + color: var(--mud-palette-primary); +} + +.progress-content > span { + font-weight: 700; +} + +.progress-content:nth-last-child(2) { + margin: 10px 0; +} \ No newline at end of file diff --git a/Template.Shared/Components/Pages/Calendar.razor b/Template.Shared/Components/Pages/Calendar.razor index 01e07e1..75ffe02 100644 --- a/Template.Shared/Components/Pages/Calendar.razor +++ b/Template.Shared/Components/Pages/Calendar.razor @@ -47,14 +47,15 @@
@if (FilterByDay) { - + } else if (FilterByWeek) { + } else if (FilterByMonth) { - + }
diff --git a/Template.Shared/Components/Pages/Calendar.razor.css b/Template.Shared/Components/Pages/Calendar.razor.css index 6bce93c..4c6f06e 100644 --- a/Template.Shared/Components/Pages/Calendar.razor.css +++ b/Template.Shared/Components/Pages/Calendar.razor.css @@ -1,12 +1,13 @@ -.activity-filter { margin-top: .5rem; } +.activity-filter { margin-top: .2rem; } .card-container { - margin-top: .5rem; + margin-top: .2rem; width: 100%; display: flex; flex-direction: column; flex-wrap: nowrap; gap: 1rem; + overflow: hidden; } .date-controller { @@ -14,9 +15,13 @@ align-items: center; } +.content ::deep > .custom-mudButtonGroup { + width: 100%; +} + .content ::deep > .custom-mudButtonGroup .mud-button-root { border-radius: 12px; - padding: .5rem 1.5rem; + padding: .2rem 1.5rem; text-transform: none !important; font-size: .985rem; border: 1px solid var(--mud-palette-gray-light); diff --git a/Template.Shared/Components/Pages/Home.razor b/Template.Shared/Components/Pages/Home.razor index ea71e0a..704bca7 100644 --- a/Template.Shared/Components/Pages/Home.razor +++ b/Template.Shared/Components/Pages/Home.razor @@ -1,6 +1,5 @@ @page "/" @using Template.Shared.Core.Interface -@using Template.Shared.Interfaces @attribute [Authorize] @inject IFormFactor FormFactor @inject INetworkService NetworkService @@ -9,12 +8,11 @@ { protected override Task OnInitializedAsync() { - var lastSyncDate = DateOnly.FromDateTime(LocalStorage.Get("last-sync")); + var lastSyncDate = LocalStorage.Get("last-sync"); - if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate < DateOnly.FromDateTime(DateTime.Now)) + if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue)) { - //NavigationManager.NavigateTo("/sync"); - NavigationManager.NavigateTo("/Calendar"); + NavigationManager.NavigateTo("/sync"); return base.OnInitializedAsync(); } diff --git a/Template.Shared/Components/Pages/Login.razor.css b/Template.Shared/Components/Pages/Login.razor.css index 1c8804f..a2610c3 100644 --- a/Template.Shared/Components/Pages/Login.razor.css +++ b/Template.Shared/Components/Pages/Login.razor.css @@ -57,4 +57,9 @@ .login-footer img { height: 15px; margin-left: 4px; +} + +.container > .bg-white { + box-shadow: var(--card-shadow); + border: 1px solid var(--card-border-color); } \ No newline at end of file diff --git a/Template.Shared/Components/Pages/PersonalInfo.razor b/Template.Shared/Components/Pages/PersonalInfo.razor index 19474c1..59d2b22 100644 --- a/Template.Shared/Components/Pages/PersonalInfo.razor +++ b/Template.Shared/Components/Pages/PersonalInfo.razor @@ -5,7 +5,6 @@ @using Template.Shared.Core.Interface @using Template.Shared.Core.Services @using Template.Shared.Core.Utility -@using Template.Shared.Interfaces @inject AppAuthenticationStateProvider AuthenticationStateProvider @inject INetworkService NetworkService @inject IFormFactor FormFactor @@ -75,16 +74,21 @@
-
- Impostazioni account -
+ Impostazioni
-
- Esci - -
+ Esci @code { @@ -96,11 +100,6 @@ await LoadData(); } - private void Logout() - { - AuthenticationStateProvider.SignOut(); - } - private async Task LoadData() { await Task.Run(() => @@ -112,4 +111,10 @@ StateHasChanged(); } + private void OpenSettings() => + NavigationManager.NavigateTo("/settings/Profilo"); + + private void Logout() => + AuthenticationStateProvider.SignOut(); + } \ No newline at end of file diff --git a/Template.Shared/Components/Pages/PersonalInfo.razor.css b/Template.Shared/Components/Pages/PersonalInfo.razor.css index 9363cb0..39ec9f3 100644 --- a/Template.Shared/Components/Pages/PersonalInfo.razor.css +++ b/Template.Shared/Components/Pages/PersonalInfo.razor.css @@ -9,7 +9,7 @@ flex-direction: column; align-items: center; line-height: normal; - margin: 2rem 0; + margin: .2rem 0 1rem 0; } .info-nome { @@ -59,19 +59,8 @@ font-size: small; } -.user-button { - border: 2px solid var(--card-border-color); - background: transparent; - text-align: center; - border-radius: 6px; - padding: .45rem 2rem; - width: 100%; - font-weight: 700; - line-height: normal; -} - -.user-button.logout { - color: var(--mud-palette-error); +.content ::deep .user-button { + border: 1px solid var(--card-border-color) !important; } .user-button > i { font-size: large; } diff --git a/Template.Shared/Components/Pages/Settings.razor b/Template.Shared/Components/Pages/Settings.razor new file mode 100644 index 0000000..11ad4f5 --- /dev/null +++ b/Template.Shared/Components/Pages/Settings.razor @@ -0,0 +1,28 @@ +@page "/settings" +@page "/settings/{BackTo}" +@using Template.Shared.Components.Layout + + + +
+ Sincronizza +
+ +@code { + [Parameter] public string BackTo { get; set; } = ""; + + private void UpdateDb() + { + var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); + var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null; + + var path = pathAndQuery == null ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : $"/sync/{DateTime.Today:yyyy-MM-dd}?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery); + + NavigationManager.NavigateTo(path); + } +} diff --git a/Template.Shared/Components/Pages/SyncPage.razor b/Template.Shared/Components/Pages/SyncPage.razor new file mode 100644 index 0000000..69607ae --- /dev/null +++ b/Template.Shared/Components/Pages/SyncPage.razor @@ -0,0 +1,57 @@ +@page "/sync" +@page "/sync/{DateFilter}" +@using Template.Shared.Components.Layout.Spinner +@using Template.Shared.Core.Interface +@inject ISyncDbService syncDb + + + +@code { + [Parameter] public string? DateFilter { get; set; } + + private Dictionary Elements { get; set; } = new(); + + protected override async Task OnInitializedAsync() + { + Elements.Add("Attività", false); + Elements.Add("Clienti", false); + Elements.Add("Commesse", false); + StateHasChanged(); + + await Task.WhenAll(SetActivity(), SetClienti(), SetCommesse()); + + LocalStorage.Set("last-sync", DateTime.Now); + + var pathQuery = System.Web.HttpUtility.ParseQueryString(new UriBuilder(NavigationManager.Uri).Query); + var originalPath = pathQuery["path"] ?? null; + var path = originalPath ?? "/Calendar"; + + NavigationManager.NavigateTo(path); + } + + private async Task SetActivity() + { + await syncDb.GetAndSaveActivity(DateFilter); + + Elements["Attività"] = true; + StateHasChanged(); + } + + private async Task SetClienti() + { + await syncDb.GetAndSaveClienti(DateFilter); + await syncDb.GetAndSaveProspect(DateFilter); + + Elements["Clienti"] = true; + StateHasChanged(); + } + + private async Task SetCommesse() + { + await syncDb.GetAndSaveCommesse(DateFilter); + + Elements["Commesse"] = true; + StateHasChanged(); + } + +} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/DayView.razor b/Template.Shared/Components/SingleElements/Calendar/DayView.razor index cf0274f..ae9b44f 100644 --- a/Template.Shared/Components/SingleElements/Calendar/DayView.razor +++ b/Template.Shared/Components/SingleElements/Calendar/DayView.razor @@ -1,6 +1,61 @@ -
- @for (var i = 0; i < 3; i++) +@using ConSegna.Shared.Core.Helpers +@using Template.Shared.Core.Dto +@using Template.Shared.Core.Interface +@inject IManageDataService manageData + +
+ @if (!Activities.IsNullOrEmpty()) { - + @foreach (var activity in Activities!) + { + + } } -
\ No newline at end of file + else + { + + } +
+ + +@code +{ + [Parameter] public required DateTime? Date { get; set; } + [Parameter] public EventCallback DateChanged { get; set; } + + private List? Activities { get; set; } = null; + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await LoadData(); + } + } + + protected override async Task OnParametersSetAsync() + { + await LoadData(); + } + + private async Task LoadData() + { + await Task.Delay(1000); + var refreshActivity = await RefreshActivity(); + Activities = refreshActivity; + StateHasChanged(); + } + + private async Task> RefreshActivity() + { + var activityDto = await Task.Run(async () => + { + return (await manageData.GetActivity(x => + (x.EffectiveDate == null && x.EstimatedDate.Equals(Date)) || x.EffectiveDate.Equals(Date))) + .OrderBy(x => x.EffectiveDate ?? x.EstimatedDate) + .ToList(); + }); + + return activityDto; + } +} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/DayView.razor.css b/Template.Shared/Components/SingleElements/Calendar/DayView.razor.css index a92eed1..bf77308 100644 --- a/Template.Shared/Components/SingleElements/Calendar/DayView.razor.css +++ b/Template.Shared/Components/SingleElements/Calendar/DayView.razor.css @@ -4,4 +4,15 @@ flex-direction: column; flex-wrap: nowrap; gap: 1rem; + overflow-y: auto; + overflow-x: hidden; + padding-bottom: 1rem; } + +.calendar::-webkit-scrollbar { display: none; } + + +.calendar { + -ms-overflow-style: none; + scrollbar-width: none; +} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/MonthView.razor b/Template.Shared/Components/SingleElements/Calendar/MonthView.razor index f573039..dcad647 100644 --- a/Template.Shared/Components/SingleElements/Calendar/MonthView.razor +++ b/Template.Shared/Components/SingleElements/Calendar/MonthView.razor @@ -42,7 +42,6 @@ @code { [Parameter] public required DateTime Date { get; set; } - [Parameter] public EventCallback DateChanged { get; set; } private List Events { get; set; } diff --git a/Template.Shared/Components/SingleElements/Calendar/WeekView.razor b/Template.Shared/Components/SingleElements/Calendar/WeekView.razor new file mode 100644 index 0000000..90cc97e --- /dev/null +++ b/Template.Shared/Components/SingleElements/Calendar/WeekView.razor @@ -0,0 +1,76 @@ +@using ConSegna.Shared.Core.Helpers +@using Template.Shared.Core.Dto +@using Template.Shared.Core.Interface +@inject IManageDataService manageData + +
+ @{ + DateTime? currentDate = null; + } + + @if (!Activities.IsNullOrEmpty()) + { + foreach (var activity in Activities!) + { + var dateToShow = activity.EffectiveDate ?? activity.EstimatedDate; + + if (currentDate != dateToShow?.Date) + { + currentDate = dateToShow?.Date; +
+ @($"{currentDate:D}") +
+ } + + + } + } + else + { + + } +
+ +@code +{ + [Parameter] public required DateRange Date { get; set; } + [Parameter] public EventCallback DateChanged { get; set; } + + private List? Activities { get; set; } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + await LoadData(); + } + } + + protected override async Task OnParametersSetAsync() + { + await LoadData(); + } + + private async Task LoadData() + { + await Task.Delay(1000); + var refreshActivity = await RefreshActivity(); + Activities = refreshActivity; + StateHasChanged(); + } + + private async Task> RefreshActivity() + { + var activityDto = await Task.Run(async () => + { + return Activities = (await manageData.GetActivity(x => + (x.EffectiveDate == null && x.EstimatedDate >= Date.Start && x.EstimatedDate <= Date.End) || + (x.EffectiveDate >= Date.Start && x.EffectiveDate <= Date.End) + )) + .OrderBy(x => x.EffectiveDate ?? x.EstimatedDate) + .ToList(); + }); + + return activityDto; + } +} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/WeekView.razor.css b/Template.Shared/Components/SingleElements/Calendar/WeekView.razor.css new file mode 100644 index 0000000..792ef18 --- /dev/null +++ b/Template.Shared/Components/SingleElements/Calendar/WeekView.razor.css @@ -0,0 +1,26 @@ +.calendar { + width: 100%; + display: flex; + flex-direction: column; + flex-wrap: nowrap; + gap: 1rem; + overflow-y: auto; + overflow-x: hidden; + padding-bottom: 1rem; +} + +.calendar::-webkit-scrollbar { display: none; } + +.calendar { + -ms-overflow-style: none; + scrollbar-width: none; +} + +.week-info { + background: var(--mud-palette-action-disabled-background); + width: 100%; + padding: .3rem .5rem; + border-radius: 8px; + text-transform: capitalize; + font-weight: 700; +} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Card/ActivityCard.razor b/Template.Shared/Components/SingleElements/Card/ActivityCard.razor index 046ca18..b7d0755 100644 --- a/Template.Shared/Components/SingleElements/Card/ActivityCard.razor +++ b/Template.Shared/Components/SingleElements/Card/ActivityCard.razor @@ -1,22 +1,52 @@ -
+@using Template.Shared.Core.Dto + +
- 14:00 - 1h + + @if (Activity.EffectiveTime is null) + { + @($"{Activity.EstimatedTime:t}") + } + else + { + @($"{Activity.EffectiveTime:t}") + } + + @if (Durata != null) + { + @($"{Durata.Value.TotalHours:####}h") + }
- +
- Format - Preparazione preventivo + @Activity.Commessa + @Activity.ActivityDescription
- +
- Completata - GMANCINI + @if (Activity.ActivityResultId != null) + { + @Activity.ActivityResultId + } + @Activity.UserName
@code { - [Parameter] public string Type { get; set; } = ""; + [Parameter] public ActivityDTO Activity { get; set; } = new(); + + private TimeSpan? Durata { get; set; } + private Color ColorStatus { get; set; } + + protected override void OnInitialized() + { + Durata = Activity switch + { + { EffectiveTime: not null, EffectiveEndtime: not null } => Activity.EffectiveEndtime.Value - Activity.EffectiveTime.Value, + { EstimatedTime: not null, EstimatedEndtime: not null } => Activity.EstimatedEndtime.Value - Activity.EstimatedTime.Value, + _ => Durata + }; + } } \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Card/ActivityCard.razor.css b/Template.Shared/Components/SingleElements/Card/ActivityCard.razor.css index 34534eb..d2ad2ad 100644 --- a/Template.Shared/Components/SingleElements/Card/ActivityCard.razor.css +++ b/Template.Shared/Components/SingleElements/Card/ActivityCard.razor.css @@ -40,14 +40,16 @@ flex-direction: column; } -.activity-title { - font-weight: 800; - font-size: medium; +.activity-body-section ::deep > .activity-title { + font-weight: 800 !important; + margin: 0 0 .2rem 0 !important; + line-height: normal !important; } -.activity-subtitle { +.activity-body-section ::deep > .activity-subtitle { font-size: smaller; - color: var(--mud-palette-gray-darker) + color: var(--mud-palette-gray-darker); + line-height: normal !important; } .activity-info-section { width: min-content; } \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/NoDataAvailable.razor b/Template.Shared/Components/SingleElements/NoDataAvailable.razor index 4f7759f..ce1f379 100644 --- a/Template.Shared/Components/SingleElements/NoDataAvailable.razor +++ b/Template.Shared/Components/SingleElements/NoDataAvailable.razor @@ -1,6 +1,5 @@
- +

@Text

diff --git a/Template.Shared/Components/SingleElements/NoDataAvailable.razor.css b/Template.Shared/Components/SingleElements/NoDataAvailable.razor.css index 75bb094..76d1513 100644 --- a/Template.Shared/Components/SingleElements/NoDataAvailable.razor.css +++ b/Template.Shared/Components/SingleElements/NoDataAvailable.razor.css @@ -1,7 +1,7 @@ .no-data { position: fixed; top: 35%; - width: calc(100% - 3rem); /* remove page padding */ + width: calc(100vw - (var(--bs-gutter-x) * .5) * 2); } .no-data img { diff --git a/Template.Shared/Core/Dto/ActivityDTO.cs b/Template.Shared/Core/Dto/ActivityDTO.cs new file mode 100644 index 0000000..29403ce --- /dev/null +++ b/Template.Shared/Core/Dto/ActivityDTO.cs @@ -0,0 +1,10 @@ +using Template.Shared.Core.Entity; +using Template.Shared.Core.Helpers.Enum; + +namespace Template.Shared.Core.Dto; + +public class ActivityDTO : StbActivity +{ + public string? Commessa { get; set; } + public ActivityCategoryEnum Category { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Dto/TaskSyncResponseDTO.cs b/Template.Shared/Core/Dto/TaskSyncResponseDTO.cs new file mode 100644 index 0000000..e724244 --- /dev/null +++ b/Template.Shared/Core/Dto/TaskSyncResponseDTO.cs @@ -0,0 +1,12 @@ +using Template.Shared.Core.Entity; + +namespace Template.Shared.Core.Dto; + +public class TaskSyncResponseDTO +{ + public List? AnagClie { get; set; } + public List? VtbDest { get; set; } + public List? VtbCliePersRif { get; set; } + public List? PtbPros { get; set; } + public List? PtbProsRif { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/AnagClie.cs b/Template.Shared/Core/Entity/AnagClie.cs new file mode 100644 index 0000000..68efca4 --- /dev/null +++ b/Template.Shared/Core/Entity/AnagClie.cs @@ -0,0 +1,83 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("anag_clie")] +public class AnagClie +{ + [PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")] + public string CodAnag { get; set; } + + [Column("cod_vtip"), JsonPropertyName("codVtip")] + public string? CodVtip { get; set; } + + [Column("cod_vage"), JsonPropertyName("codVage")] + public string? CodVage { get; set; } + + [Column("rag_soc"), JsonPropertyName("ragSoc")] + public string RagSoc { get; set; } + + [Column("indirizzo"), JsonPropertyName("indirizzo")] + public string Indirizzo { get; set; } + + [Column("cap"), JsonPropertyName("cap")] + public string Cap { get; set; } + + [Column("citta"), JsonPropertyName("citta")] + public string Citta { get; set; } + + [Column("prov"), JsonPropertyName("prov")] + public string Prov { get; set; } + + [Column("nazione"), JsonPropertyName("nazione")] + public string Nazione { get; set; } + + [Column("telefono"), JsonPropertyName("telefono")] + public string Telefono { get; set; } + + [Column("fax"), JsonPropertyName("fax")] + public string Fax { get; set; } + + [Column("part_iva"), JsonPropertyName("partIva")] + public string PartIva { get; set; } + + [Column("cod_fisc"), JsonPropertyName("codFisc")] + public string CodFisc { get; set; } + + [Column("note"), JsonPropertyName("note")] + public string Note { get; set; } + + [Column("persona_rif"), JsonPropertyName("personaRif")] + public string PersonaRif { get; set; } + + [Column("e_mail"), JsonPropertyName("eMail")] + public string EMail { get; set; } + + [Column("e_mail_pec"), JsonPropertyName("eMailPec")] + public string EMailPec { get; set; } + + [Column("nome"), JsonPropertyName("nome")] + public string Nome { get; set; } + + [Column("data_ins"), JsonPropertyName("dataIns")] + public DateTime? DataIns { get; set; } = DateTime.Now; + + [Column("num_cell"), JsonPropertyName("numCell")] + public string NumCell { get; set; } + + [Column("cognome"), JsonPropertyName("cognome")] + public string Cognome { get; set; } + + [Column("diacod"), JsonPropertyName("diacod")] + public string Diacod { get; set; } + + [Column("lat"), JsonPropertyName("lat")] + public decimal? Lat { get; set; } + + [Column("lng"), JsonPropertyName("lng")] + public decimal? Lng { get; set; } + + [Column("data_mod"), JsonPropertyName("dataMod")] + public DateTime? DataMod { get; set; } = DateTime.Now; +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/JtbComt.cs b/Template.Shared/Core/Entity/JtbComt.cs new file mode 100644 index 0000000..25f4104 --- /dev/null +++ b/Template.Shared/Core/Entity/JtbComt.cs @@ -0,0 +1,110 @@ +using System.Text.Json.Serialization; +using SQLite; + +namespace Template.Shared.Core.Entity; + +[Table("jtb_comt")] +public class JtbComt +{ + [PrimaryKey, Column("cod_jcom"), JsonPropertyName("codJcom")] + public string CodJcom { get; set; } + + [Column("cod_jfas"), JsonPropertyName("codJfas")] + public string CodJfas { get; set; } + + [Column("cod_jflav"), JsonPropertyName("codJflav")] + public string CodJflav { get; set; } + + [Column("descrizione"), JsonPropertyName("descrizione")] + public string Descrizione { get; set; } + + [Column("importo"), JsonPropertyName("importo")] + public decimal Importo { get; set; } = 0; + + [Column("data_inizi_lav"), JsonPropertyName("dataIniziLav")] + public DateTime? DataIniziLav { get; set; } + + [Column("cod_mart"), JsonPropertyName("codMart")] + public string CodMart { get; set; } + + [Column("data_cons"), JsonPropertyName("dataCons")] + public DateTime? DataCons { get; set; } + + [Column("manuali"), JsonPropertyName("manuali")] + public string Manuali { get; set; } + + [Column("note"), JsonPropertyName("note")] + public string Note { get; set; } + + [Column("cod_anag"), JsonPropertyName("codAnag")] + public string CodAnag { get; set; } + + [Column("cod_divi"), JsonPropertyName("codDivi")] + public string CodDivi { get; set; } = "EURO"; + + [Column("cambio_divi"), JsonPropertyName("cambioDivi")] + public decimal CambioDivi { get; set; } = 1; + + [Column("cod_divi_cont"), JsonPropertyName("codDiviCont")] + public string CodDiviCont { get; set; } + + [Column("cambio_divi_cont"), JsonPropertyName("cambioDiviCont")] + public decimal CambioDiviCont { get; set; } + + [Column("responsabile_com"), JsonPropertyName("responsabileCom")] + public string ResponsabileCom { get; set; } + + [Column("stato_commessa"), JsonPropertyName("statoCommessa")] + public string StatoCommessa { get; set; } + + [Column("tipo_commessa"), JsonPropertyName("tipoCommessa")] + public string TipoCommessa { get; set; } + + [Column("descrizione_estesa"), JsonPropertyName("descrizioneEstesa")] + public string DescrizioneEstesa { get; set; } + + [Column("perc_comp"), JsonPropertyName("percComp")] + public decimal PercComp { get; set; } = 0; + + [Column("cod_vdes"), JsonPropertyName("codVdes")] + public string CodVdes { get; set; } + + [Column("gestione"), JsonPropertyName("gestione")] + public string Gestione { get; set; } + + [Column("data_ord"), JsonPropertyName("dataOrd")] + public DateTime? DataOrd { get; set; } + + [Column("num_ord"), JsonPropertyName("numOrd")] + public int? NumOrd { get; set; } + + [Column("matricola"), JsonPropertyName("matricola")] + public string Matricola { get; set; } + + [Column("tipo_anag"), JsonPropertyName("tipoAnag")] + public string TipoAnag { get; set; } + + [Column("flag_pubblica"), JsonPropertyName("flagPubblica")] + public string FlagPubblica { get; set; } = "N"; + + [Column("cig"), JsonPropertyName("cig")] + public string Cig { get; set; } + + [Column("cup"), JsonPropertyName("cup")] + public string Cup { get; set; } + + [Column("indirizzo_ente"), JsonPropertyName("indirizzoEnte")] + public string IndirizzoEnte { get; set; } + + [Column("note_cons"), JsonPropertyName("noteCons")] + public string NoteCons { get; set; } + + [Column("cod_vage"), JsonPropertyName("codVage")] + public string CodVage { get; set; } + + [Column("cod_jflav_tec"), JsonPropertyName("codJflavTec")] + public string CodJflavTec { get; set; } + + [Column("note_tecniche"), JsonPropertyName("noteTecniche")] + public string NoteTecniche { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/PtbPros.cs b/Template.Shared/Core/Entity/PtbPros.cs new file mode 100644 index 0000000..e73dfcc --- /dev/null +++ b/Template.Shared/Core/Entity/PtbPros.cs @@ -0,0 +1,131 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("ptb_pros")] +public class PtbPros +{ + [PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")] + public string CodPpro { get; set; } + + [Column("agenzia_banca"), JsonPropertyName("agenziaBanca")] + public string AgenziaBanca { get; set; } + + [Column("cap"), JsonPropertyName("cap")] + public string Cap { get; set; } + + [Column("citta"), JsonPropertyName("citta")] + public string Citta { get; set; } + + [Column("cod_abi"), JsonPropertyName("codAbi")] + public string CodAbi { get; set; } + + [Column("cod_aliq"), JsonPropertyName("codAliq")] + public string CodAliq { get; set; } + + [Column("cod_anag"), JsonPropertyName("codAnag")] + public string CodAnag { get; set; } + + [Column("cod_banc"), JsonPropertyName("codBanc")] + public string CodBanc { get; set; } + + [Column("cod_cab"), JsonPropertyName("codCab")] + public string CodCab { get; set; } + + [Column("cod_fisc"), JsonPropertyName("codFisc")] + public string CodFisc { get; set; } + + [Column("cod_paga"), JsonPropertyName("codPaga")] + public string CodPaga { get; set; } + + [Column("cod_vage"), JsonPropertyName("codVage")] + public string CodVage { get; set; } + + [Column("cod_vatt"), JsonPropertyName("codVatt")] + public string CodVatt { get; set; } + + [Column("cod_vlis"), JsonPropertyName("codVlis")] + public string CodVlis { get; set; } + + [Column("cod_vseg"), JsonPropertyName("codVseg")] + public string CodVseg { get; set; } + + [Column("cod_vset"), JsonPropertyName("codVset")] + public string CodVset { get; set; } + + [Column("cod_vtip"), JsonPropertyName("codVtip")] + public string CodVtip { get; set; } + + [Column("cod_vzon"), JsonPropertyName("codVzon")] + public string CodVzon { get; set; } + + [Column("data_ins"), JsonPropertyName("dataIns")] + public DateTime? DataIns { get; set; } = DateTime.Now; + + [Column("descrizione_pag"), JsonPropertyName("descrizionePag")] + public string DescrizionePag { get; set; } + + [Column("e_mail"), JsonPropertyName("eMail")] + public string EMail { get; set; } + + [Column("fax"), JsonPropertyName("fax")] + public string Fax { get; set; } + + [Column("flag_riv_clie"), JsonPropertyName("flagRivClie")] + public string FlagRivClie { get; set; } = "C"; + + [Column("fonte"), JsonPropertyName("fonte")] + public string Fonte { get; set; } + + [Column("gg_chiusura"), JsonPropertyName("ggChiusura")] + public string GgChiusura { get; set; } + + [Column("indirizzo"), JsonPropertyName("indirizzo")] + public string Indirizzo { get; set; } + + [Column("nazione"), JsonPropertyName("nazione")] + public string Nazione { get; set; } + + [Column("note"), JsonPropertyName("note")] + public string Note { get; set; } + + [Column("part_iva"), JsonPropertyName("partIva")] + public string PartIva { get; set; } + + [Column("persona_rif"), JsonPropertyName("personaRif")] + public string PersonaRif { get; set; } + + [Column("prov"), JsonPropertyName("prov")] + public string Prov { get; set; } + + [Column("rag_soc"), JsonPropertyName("ragSoc")] + public string RagSoc { get; set; } + + [Column("rag_soc2"), JsonPropertyName("ragSoc2")] + public string RagSoc2 { get; set; } + + [Column("sconto1"), JsonPropertyName("sconto1")] + public decimal Sconto1 { get; set; } = 0; + + [Column("sconto2"), JsonPropertyName("sconto2")] + public decimal Sconto2 { get; set; } = 0; + + [Column("telefono"), JsonPropertyName("telefono")] + public string Telefono { get; set; } + + [Column("cuu_pa"), JsonPropertyName("cuuPa")] + public string CuuPa { get; set; } + + [Column("e_mail_pec"), JsonPropertyName("eMailPec")] + public string EMailPec { get; set; } + + [Column("flag_informativa"), JsonPropertyName("flagInformativa")] + public string FlagInformativa { get; set; } = "N"; + + [Column("flag_consenso"), JsonPropertyName("flagConsenso")] + public string FlagConsenso { get; set; } = "N"; + + [Column("username"), JsonPropertyName("userName")] + public string UserName { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/PtbProsRif.cs b/Template.Shared/Core/Entity/PtbProsRif.cs new file mode 100644 index 0000000..3bae634 --- /dev/null +++ b/Template.Shared/Core/Entity/PtbProsRif.cs @@ -0,0 +1,32 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("ptb_pros_rif")] +public class PtbProsRif +{ + [PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")] + public string CodPpro { get; set; } + + [PrimaryKey, Column("id_pers_rif"), JsonPropertyName("idPersRif")] + public int IdPersRif { get; set; } + + [Column("persona_rif"), JsonPropertyName("personaRif")] + public string PersonaRif { get; set; } + + [Column("e_mail"), JsonPropertyName("eMail")] + public string EMail { get; set; } + + [Column("fax"), JsonPropertyName("fax")] + public string Fax { get; set; } + + [Column("mansione"), JsonPropertyName("mansione")] + public string Mansione { get; set; } + + [Column("num_cellulare"), JsonPropertyName("numCellulare")] + public string NumCellulare { get; set; } + + [Column("telefono"), JsonPropertyName("telefono")] + public string Telefono { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/StbActivity.cs b/Template.Shared/Core/Entity/StbActivity.cs new file mode 100644 index 0000000..95b9bf8 --- /dev/null +++ b/Template.Shared/Core/Entity/StbActivity.cs @@ -0,0 +1,176 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("stb_activity")] +public class StbActivity +{ + [PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")] + public string ActivityId { get; set; } + + [Column("activity_result_id"), JsonPropertyName("activityResultId")] + public string? ActivityResultId { get; set; } + + [Column("activity_type_id"), JsonPropertyName("activityTypeId")] + public string? ActivityTypeId { get; set; } + + [Column("data_ins_act"), JsonPropertyName("dataInsAct")] + public DateTime DataInsAct { get; set; } = DateTime.Now; + + [Column("activity_description"), JsonPropertyName("activityDescription")] + public string? ActivityDescription { get; set; } + + [Column("parent_activity_id"), JsonPropertyName("parentActivityId")] + public string? ParentActivityId { get; set; } + + [Column("tipo_anag"), JsonPropertyName("tipoAnag")] + public string? TipoAnag { get; set; } + + [Column("cod_anag"), JsonPropertyName("codAnag")] + public string? CodAnag { get; set; } + + [Column("cod_jcom"), JsonPropertyName("codJcom")] + public string? CodJcom { get; set; } + + [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; } + + [Column("alarm_date"), JsonPropertyName("alarmDate")] + public DateTime? AlarmDate { get; set; } + + [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; } + + [Column("user_creator"), JsonPropertyName("userCreator")] + public string? UserCreator { get; set; } + + [Column("user_name"), JsonPropertyName("userName")] + public string? UserName { get; set; } + + [Column("perc_comp"), JsonPropertyName("percComp")] + public double? PercComp { get; set; } = 0; + + [Column("estimated_hours"), JsonPropertyName("estimatedHours")] + public double? EstimatedHours { get; set; } = 0; + + [Column("cod_mart"), JsonPropertyName("codMart")] + public string? CodMart { get; set; } + + [Column("partita_mag"), JsonPropertyName("partitaMag")] + public string? PartitaMag { get; set; } + + [Column("matricola"), JsonPropertyName("matricola")] + public string? Matricola { get; set; } + + [Column("priorita"), JsonPropertyName("priorita")] + public int? Priorita { get; set; } = 0; + + [Column("activity_play_counter"), JsonPropertyName("activityPlayCounter")] + public double? ActivityPlayCounter { get; set; } = 0; + + [Column("activity_event"), JsonPropertyName("activityEvent")] + public string? ActivityEvent { get; set; } + + [Column("guarantee"), JsonPropertyName("guarantee")] + public string? Guarantee { get; set; } + + [Column("note"), JsonPropertyName("note")] + public string? Note { get; set; } + + [Column("rfid"), JsonPropertyName("rfid")] + public string? Rfid { get; set; } + + [Column("id_lotto"), JsonPropertyName("idLotto")] + public int? IdLotto { get; set; } + + [Column("persona_rif"), JsonPropertyName("personaRif")] + public string? PersonaRif { get; set; } + + [Column("hr_num"), JsonPropertyName("hrNum")] + public int? HrNum { get; set; } + + [Column("gestione"), JsonPropertyName("gestione")] + public string? Gestione { get; set; } + + [Column("data_ord"), JsonPropertyName("dataOrd")] + public DateTime? DataOrd { get; set; } + + [Column("num_ord"), JsonPropertyName("numOrd")] + public int? NumOrd { get; set; } + + [Column("id_step"), JsonPropertyName("idStep")] + public int? IdStep { get; set; } + + [Column("id_riga"), JsonPropertyName("idRiga")] + public int? IdRiga { get; set; } + + [Column("ora_ins_act"), JsonPropertyName("oraInsAct")] + public DateTime? OraInsAct { get; set; } + + [Column("indice_gradimento"), JsonPropertyName("indiceGradimento")] + public decimal? IndiceGradimento { get; set; } = 0; + + [Column("note_gradimento"), JsonPropertyName("noteGradimento")] + public string? NoteGradimento { get; set; } + + [Column("flag_risolto"), JsonPropertyName("flagRisolto")] + public string? FlagRisolto { get; set; } = "N"; + + [Column("flag_tipologia"), JsonPropertyName("flagTipologia")] + public string? FlagTipologia { get; set; } + + [Ignore, JsonPropertyName("oreRapportino")] + public decimal? OreRapportino { get; set; } + + [Column("user_modifier"), JsonPropertyName("userModifier")] + public string? UserModifier { get; set; } + + [Column("ora_mod_act"), JsonPropertyName("oraModAct")] + public DateTime? OraModAct { get; set; } = DateTime.Now; + + [Column("ora_view_act"), JsonPropertyName("oraViewAct")] + public DateTime? OraViewAct { get; set; } + + [Column("cod_vdes"), JsonPropertyName("codVdes")] + public string? CodVdes { get; set; } + + [Column("cod_cmac"), JsonPropertyName("codCmac")] + public string? CodCmac { get; set; } + + [Column("wrike_id"), JsonPropertyName("wrikeId")] + public string? WrikeId { get; set; } + + [Column("cod_mgrp"), JsonPropertyName("codMgrp")] + public string? CodMgrp { get; set; } + + [Column("plan_id"), JsonPropertyName("planId")] + public long? PlanId { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/VtbCliePersRif.cs b/Template.Shared/Core/Entity/VtbCliePersRif.cs new file mode 100644 index 0000000..c4c6ddd --- /dev/null +++ b/Template.Shared/Core/Entity/VtbCliePersRif.cs @@ -0,0 +1,41 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("vtb_clie_pers_rif")] +public class VtbCliePersRif +{ + [PrimaryKey, Column("id_pers_rif"), JsonPropertyName("idPersRif")] + public int IdPersRif { get; set; } + + [PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")] + public string CodAnag { get; set; } + + [Column("persona_rif"), JsonPropertyName("personaRif")] + public string PersonaRif { get; set; } + + [Column("mansione"), JsonPropertyName("mansione")] + public string Mansione { get; set; } + + [Column("telefono"), JsonPropertyName("telefono")] + public string Telefono { get; set; } + + [Column("fax"), JsonPropertyName("fax")] + public string Fax { get; set; } + + [Column("e_mail"), JsonPropertyName("eMail")] + public string EMail { get; set; } + + [Column("num_cellulare"), JsonPropertyName("numCellulare")] + public string NumCellulare { get; set; } + + [Column("tipo_indirizzo"), JsonPropertyName("tipoIndirizzo")] + public string TipoIndirizzo { get; set; } + + [Column("cod_vdes"), JsonPropertyName("codVdes")] + public string CodVdes { get; set; } + + [Column("data_ult_agg"), JsonPropertyName("dataUltAgg")] + public DateTime? DataUltAgg { get; set; } = DateTime.Now; +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/VtbDest.cs b/Template.Shared/Core/Entity/VtbDest.cs new file mode 100644 index 0000000..4e7310e --- /dev/null +++ b/Template.Shared/Core/Entity/VtbDest.cs @@ -0,0 +1,197 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("vtb_dest")] +public class VtbDest +{ + [PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")] + public string CodAnag { get; set; } + + [PrimaryKey, Column("cod_vdes"), JsonPropertyName("codVdes")] + public string CodVdes { get; set; } + + [Column("destinatario"), JsonPropertyName("destinatario")] + public string Destinatario { get; set; } + + [Column("indirizzo"), JsonPropertyName("indirizzo")] + public string Indirizzo { get; set; } + + [Column("cap"), JsonPropertyName("cap")] + public string Cap { get; set; } + + [Column("citta"), JsonPropertyName("citta")] + public string Citta { get; set; } + + [Column("prov"), JsonPropertyName("prov")] + public string Prov { get; set; } + + [Column("nazione"), JsonPropertyName("nazione")] + public string Nazione { get; set; } + + [Column("tel"), JsonPropertyName("tel")] + public string Tel { get; set; } + + [Column("fax"), JsonPropertyName("fax")] + public string Fax { get; set; } + + [Column("note"), JsonPropertyName("note")] + public string Note { get; set; } + + [Column("fonte"), JsonPropertyName("fonte")] + public string Fonte { get; set; } + + [Column("cod_centro_azi"), JsonPropertyName("codCentroAzi")] + public string CodCentroAzi { get; set; } + + [Column("gg_cons"), JsonPropertyName("ggCons")] + public int GgCons { get; set; } = 0; + + [Column("cod_aliq_out"), JsonPropertyName("codAliqOut")] + public string CodAliqOut { get; set; } + + [Column("cod_aliq_in"), JsonPropertyName("codAliqIn")] + public string CodAliqIn { get; set; } + + [Column("descriz_aliq_out"), JsonPropertyName("descrizAliqOut")] + public string DescrizAliqOut { get; set; } + + [Column("cod_vzon"), JsonPropertyName("codVzon")] + public string CodVzon { get; set; } + + [Column("cod_vlis"), JsonPropertyName("codVlis")] + public string CodVlis { get; set; } + + [Column("cod_vage"), JsonPropertyName("codVage")] + public string CodVage { get; set; } + + [Column("persona_rif"), JsonPropertyName("personaRif")] + public string PersonaRif { get; set; } + + [Column("part_iva"), JsonPropertyName("partIva")] + public string PartIva { get; set; } + + [Column("cod_affiliazione"), JsonPropertyName("codAffiliazione")] + public string CodAffiliazione { get; set; } + + [Column("indirizzo_legale"), JsonPropertyName("indirizzoLegale")] + public string IndirizzoLegale { get; set; } + + [Column("cap_legale"), JsonPropertyName("capLegale")] + public string CapLegale { get; set; } + + [Column("citta_legale"), JsonPropertyName("cittaLegale")] + public string CittaLegale { get; set; } + + [Column("prov_legale"), JsonPropertyName("provLegale")] + public string ProvLegale { get; set; } + + [Column("nazione_legale"), JsonPropertyName("nazioneLegale")] + public string NazioneLegale { get; set; } + + [Column("cod_mdep"), JsonPropertyName("codMdep")] + public string CodMdep { get; set; } + + [Column("flag_domic_riba"), JsonPropertyName("flagDomicRiba")] + public string FlagDomicRiba { get; set; } + + [Column("flag_attivo"), JsonPropertyName("flagAttivo")] + public string FlagAttivo { get; set; } = "S"; + + [Column("flag_esponi"), JsonPropertyName("flagEsponi")] + public string FlagEsponi { get; set; } = "S"; + + [Column("rag_soc_legale"), JsonPropertyName("ragSocLegale")] + public string RagSocLegale { get; set; } + + [Column("cod_alis"), JsonPropertyName("codAlis")] + public string CodAlis { get; set; } + + [Column("cod_vpre"), JsonPropertyName("codVpre")] + public string CodVpre { get; set; } + + [Column("cod_vcom"), JsonPropertyName("codVcom")] + public string CodVcom { get; set; } + + [Column("cod_sco_cli"), JsonPropertyName("codScoCli")] + public string CodScoCli { get; set; } + + [Column("e_mail"), JsonPropertyName("eMail")] + public string EMail { get; set; } + + [Column("data_cessazione"), JsonPropertyName("dataCessazione")] + public DateTime? DataCessazione { get; set; } + + [Column("data_attivazione"), JsonPropertyName("dataAttivazione")] + public DateTime? DataAttivazione { get; set; } + + [Column("cod_vvet"), JsonPropertyName("codVvet")] + public string CodVvet { get; set; } + + [Column("gg_chiusura"), JsonPropertyName("ggChiusura")] + public string GgChiusura { get; set; } + + [Column("tipo_negozio"), JsonPropertyName("tipoNegozio")] + public string TipoNegozio { get; set; } + + [Column("cod_ean"), JsonPropertyName("codEan")] + public string CodEan { get; set; } + + [Column("flag_stampa_prezzi"), JsonPropertyName("flagStampaPrezzi")] + public string FlagStampaPrezzi { get; set; } = "S"; + + [Column("cod_aliq"), JsonPropertyName("codAliq")] + public string CodAliq { get; set; } + + [Column("cod_griglia"), JsonPropertyName("codGriglia")] + public string CodGriglia { get; set; } + + [Column("cod_acc"), JsonPropertyName("codAcc")] + public string CodAcc { get; set; } + + [Column("cod_vtip"), JsonPropertyName("codVtip")] + public string CodVtip { get; set; } + + [Column("cod_vset"), JsonPropertyName("codVset")] + public string CodVset { get; set; } + + [Column("cod_vseg"), JsonPropertyName("codVseg")] + public string CodVseg { get; set; } + + [Column("cod_vatt"), JsonPropertyName("codVatt")] + public string CodVatt { get; set; } + + [Column("cod_fisc"), JsonPropertyName("codFisc")] + public string CodFisc { get; set; } + + [Column("cuu_pa"), JsonPropertyName("cuuPa")] + public string CuuPa { get; set; } + + [Column("e_mail_pec"), JsonPropertyName("eMailPec")] + public string EMailPec { get; set; } + + [Column("flag_stabile_org"), JsonPropertyName("flagStabileOrg")] + public string FlagStabileOrg { get; set; } + + [Column("lat"), JsonPropertyName("lat")] + public decimal? Lat { get; set; } + + [Column("lng"), JsonPropertyName("lng")] + public decimal? Lng { get; set; } + + [Column("term_cons"), JsonPropertyName("termCons")] + public string TermCons { get; set; } + + [Column("itinerario"), JsonPropertyName("itinerario")] + public string Itinerario { get; set; } + + [Column("imp_min_ord"), JsonPropertyName("impMinOrd")] + public decimal ImpMinOrd { get; set; } = 0; + + [Column("part_iva_legale"), JsonPropertyName("partIvaLegale")] + public string PartIvaLegale { get; set; } + + [Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")] + public string CodFiscLegale { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs b/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs new file mode 100644 index 0000000..6267030 --- /dev/null +++ b/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs @@ -0,0 +1,17 @@ +using Template.Shared.Core.Helpers.Enum; + +namespace Template.Shared.Core.Helpers; + +public static class ActivityCategoryHelper +{ + public static string ConvertToHumanReadable(this ActivityCategoryEnum activityType) + { + return activityType switch + { + ActivityCategoryEnum.Memo => "memo", + ActivityCategoryEnum.Interna => "inerna", + ActivityCategoryEnum.Commessa => "commessa", + _ => throw new ArgumentOutOfRangeException(nameof(activityType), activityType, null) + }; + } +} \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/Enum/ActivityCategoryEnum.cs b/Template.Shared/Core/Helpers/Enum/ActivityCategoryEnum.cs new file mode 100644 index 0000000..24ee48b --- /dev/null +++ b/Template.Shared/Core/Helpers/Enum/ActivityCategoryEnum.cs @@ -0,0 +1,8 @@ +namespace Template.Shared.Core.Helpers.Enum; + +public enum ActivityCategoryEnum +{ + Memo = 0, + Interna = 1, + Commessa = 2 +} \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs b/Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs new file mode 100644 index 0000000..e972ec4 --- /dev/null +++ b/Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs @@ -0,0 +1,6 @@ +namespace Template.Shared.Core.Helpers.Enum; + +public enum ActivityStatusEnum +{ + +} \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/MappingProfile.cs b/Template.Shared/Core/Helpers/MappingProfile.cs new file mode 100644 index 0000000..bb1c45c --- /dev/null +++ b/Template.Shared/Core/Helpers/MappingProfile.cs @@ -0,0 +1,13 @@ +using AutoMapper; +using Template.Shared.Core.Dto; +using Template.Shared.Core.Entity; + +namespace Template.Shared.Core.Helpers; + +public class MappingProfile : Profile +{ + public MappingProfile() + { + CreateMap(); + } +} diff --git a/Template.Shared/Core/Helpers/ObjectExtensions.cs b/Template.Shared/Core/Helpers/ObjectExtensions.cs new file mode 100644 index 0000000..9aab993 --- /dev/null +++ b/Template.Shared/Core/Helpers/ObjectExtensions.cs @@ -0,0 +1,13 @@ +using System.Collections; + +namespace ConSegna.Shared.Core.Helpers; + +public static class ObjectExtensions +{ + public static bool IsNullOrEmpty(this IEnumerable? obj) => + obj == null || obj.GetEnumerator().MoveNext() == false; + + + public static bool IsNullOrEmpty(this string? obj) => + string.IsNullOrEmpty(obj); +} diff --git a/Template.Shared/Interfaces/IFormFactor.cs b/Template.Shared/Core/Interface/IFormFactor.cs similarity index 83% rename from Template.Shared/Interfaces/IFormFactor.cs rename to Template.Shared/Core/Interface/IFormFactor.cs index 2c665bc..0459332 100644 --- a/Template.Shared/Interfaces/IFormFactor.cs +++ b/Template.Shared/Core/Interface/IFormFactor.cs @@ -1,4 +1,4 @@ -namespace Template.Shared.Interfaces; +namespace Template.Shared.Core.Interface; public interface IFormFactor { diff --git a/Template.Shared/Core/Interface/IIntegryApiService.cs b/Template.Shared/Core/Interface/IIntegryApiService.cs new file mode 100644 index 0000000..1fbae51 --- /dev/null +++ b/Template.Shared/Core/Interface/IIntegryApiService.cs @@ -0,0 +1,12 @@ +using Template.Shared.Core.Dto; +using Template.Shared.Core.Entity; + +namespace Template.Shared.Core.Interface; + +public interface IIntegryApiService +{ + Task?> GetActivity(string? dateFilter = null); + Task?> GetAllCommesse(string? dateFilter = null); + Task GetAnagClie(string? dateFilter = null); + Task GetProspect(string? dateFilter = null); +} \ No newline at end of file diff --git a/Template.Shared/Core/Interface/IManageDataService.cs b/Template.Shared/Core/Interface/IManageDataService.cs new file mode 100644 index 0000000..3788441 --- /dev/null +++ b/Template.Shared/Core/Interface/IManageDataService.cs @@ -0,0 +1,18 @@ +using System.Linq.Expressions; +using Template.Shared.Core.Dto; +using Template.Shared.Core.Entity; + +namespace Template.Shared.Core.Interface; + +public interface IManageDataService +{ + Task> GetAnagClie(Expression>? whereCond = null); + Task> GetJtbComt(Expression>? whereCond = null); + Task> GetPtbPros(Expression>? whereCond = null); + Task> GetPtbProsRif(Expression>? whereCond = null); + Task> GetStbActivity(Expression>? whereCond = null); + Task> GetVtbCliePersRif(Expression>? whereCond = null); + Task> GetVtbDest(Expression>? whereCond = null); + + Task> GetActivity(Expression>? whereCond = null); +} \ No newline at end of file diff --git a/Template.Shared/Core/Interface/ISyncDbService.cs b/Template.Shared/Core/Interface/ISyncDbService.cs new file mode 100644 index 0000000..fdcce29 --- /dev/null +++ b/Template.Shared/Core/Interface/ISyncDbService.cs @@ -0,0 +1,9 @@ +namespace Template.Shared.Core.Interface; + +public interface ISyncDbService +{ + Task GetAndSaveActivity(string? dateFilter = null); + Task GetAndSaveCommesse(string? dateFilter = null); + Task GetAndSaveProspect(string? dateFilter = null); + Task GetAndSaveClienti(string? dateFilter = null); +} \ No newline at end of file diff --git a/Template.Shared/Core/Messages/BackNavigationService.cs b/Template.Shared/Core/Messages/BackNavigationService.cs new file mode 100644 index 0000000..62b2271 --- /dev/null +++ b/Template.Shared/Core/Messages/BackNavigationService.cs @@ -0,0 +1,16 @@ +using CommunityToolkit.Mvvm.Messaging; + +namespace Template.Shared.Core.Messages; + +public class BackNavigationService +{ + public event Action? OnHardwareBack; + + public BackNavigationService() + { + WeakReferenceMessenger.Default.Register(this, (r, m) => + { + OnHardwareBack?.Invoke(); + }); + } +} diff --git a/Template.Shared/Core/Messages/HardwareBackMessage.cs b/Template.Shared/Core/Messages/HardwareBackMessage.cs new file mode 100644 index 0000000..d4a9ba2 --- /dev/null +++ b/Template.Shared/Core/Messages/HardwareBackMessage.cs @@ -0,0 +1,5 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace Template.Shared.Core.Messages; + +public class HardwareBackMessage(string value) : ValueChangedMessage(value); \ No newline at end of file diff --git a/Template.Shared/Core/Services/IntegryApiService.cs b/Template.Shared/Core/Services/IntegryApiService.cs new file mode 100644 index 0000000..2b71e17 --- /dev/null +++ b/Template.Shared/Core/Services/IntegryApiService.cs @@ -0,0 +1,54 @@ +using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account; +using IntegryApiClient.Core.Domain.RestClient.Contacts; +using Template.Shared.Core.Dto; +using Template.Shared.Core.Entity; +using Template.Shared.Core.Interface; + +namespace Template.Shared.Core.Services; + +public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession) + : IIntegryApiService +{ + public Task?> GetActivity(string? dateFilter) + { + var queryParams = new Dictionary { { "dateFilter", dateFilter ?? "2020-01-01" } }; + + return integryApiRestClient.AuthorizedGet?>("task/getActivity", queryParams); + } + + public Task?> GetAllCommesse(string? dateFilter) + { + var queryParams = new Dictionary(); + + if (dateFilter != null) + { + queryParams.Add("dateFilter", dateFilter); + } + + return integryApiRestClient.AuthorizedGet?>("task/getCommesse", queryParams); + } + + public Task GetAnagClie(string? dateFilter) + { + var queryParams = new Dictionary(); + + if (dateFilter != null) + { + queryParams.Add("dateFilter", dateFilter); + } + + return integryApiRestClient.AuthorizedGet("task/getAnagClie", queryParams)!; + } + + public Task GetProspect(string? dateFilter) + { + var queryParams = new Dictionary(); + + if (dateFilter != null) + { + queryParams.Add("dateFilter", dateFilter); + } + + return integryApiRestClient.AuthorizedGet("task/getProspect", queryParams)!; + } +} \ No newline at end of file diff --git a/Template.Shared/Template.Shared.csproj b/Template.Shared/Template.Shared.csproj index 584bf50..ece56dd 100644 --- a/Template.Shared/Template.Shared.csproj +++ b/Template.Shared/Template.Shared.csproj @@ -11,8 +11,11 @@ + + + @@ -20,7 +23,6 @@ - diff --git a/Template.Shared/wwwroot/css/app.css b/Template.Shared/wwwroot/css/app.css index 4854344..0912dfc 100644 --- a/Template.Shared/wwwroot/css/app.css +++ b/Template.Shared/wwwroot/css/app.css @@ -29,6 +29,7 @@ a, .btn-link { display: flex; align-items: center; flex-direction: column; + height: 84vh; } h1:focus { outline: none; } @@ -71,6 +72,8 @@ h1:focus { outline: none; } .page-title { font-size: x-large; font-weight: 800; + margin: 0; + line-height: normal; color: var(--mud-palette-text-primary); } @@ -105,7 +108,7 @@ h1:focus { outline: none; } display: block; width: 100%; border: 1px solid var(--card-border-color); - margin: 1.5rem 0; + margin: 1rem 0; } @supports (-webkit-touch-callout: none) { diff --git a/Template.Shared/wwwroot/images/undraw_file-search_cbur.svg b/Template.Shared/wwwroot/images/undraw_file-search_cbur.svg new file mode 100644 index 0000000..c7cb8da --- /dev/null +++ b/Template.Shared/wwwroot/images/undraw_file-search_cbur.svg @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Template.Shared/wwwroot/js/main.js b/Template.Shared/wwwroot/js/main.js index 5f28270..b9e553f 100644 --- a/Template.Shared/wwwroot/js/main.js +++ b/Template.Shared/wwwroot/js/main.js @@ -1 +1,3 @@ - \ No newline at end of file +window.goBack = function () { + history.back(); +}; diff --git a/Template.Web/Services/FormFactor.cs b/Template.Web/Core/Services/FormFactor.cs similarity index 72% rename from Template.Web/Services/FormFactor.cs rename to Template.Web/Core/Services/FormFactor.cs index 10c2378..93c017b 100644 --- a/Template.Web/Services/FormFactor.cs +++ b/Template.Web/Core/Services/FormFactor.cs @@ -1,6 +1,6 @@ -using Template.Shared.Interfaces; +using Template.Shared.Core.Interface; -namespace Template.Web.Services; +namespace Template.Web.Core.Services; public class FormFactor : IFormFactor { diff --git a/Template.Web/Core/Services/ManageDataService.cs b/Template.Web/Core/Services/ManageDataService.cs new file mode 100644 index 0000000..189e676 --- /dev/null +++ b/Template.Web/Core/Services/ManageDataService.cs @@ -0,0 +1,49 @@ +using System.Linq.Expressions; +using Template.Shared.Core.Dto; +using Template.Shared.Core.Entity; +using Template.Shared.Core.Interface; + +namespace Template.Web.Core.Services; + +public class ManageDataService : IManageDataService +{ + public Task> GetAnagClie(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetJtbComt(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetPtbPros(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetPtbProsRif(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetStbActivity(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetVtbCliePersRif(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetVtbDest(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } + + public Task> GetActivity(Expression>? whereCond = null) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Template.Web/Services/NetworkService.cs b/Template.Web/Core/Services/NetworkService.cs similarity index 80% rename from Template.Web/Services/NetworkService.cs rename to Template.Web/Core/Services/NetworkService.cs index debe2a6..787ae69 100644 --- a/Template.Web/Services/NetworkService.cs +++ b/Template.Web/Core/Services/NetworkService.cs @@ -1,6 +1,6 @@ using Template.Shared.Core.Interface; -namespace Template.Web.Services; +namespace Template.Web.Core.Services; public class NetworkService : INetworkService { diff --git a/Template.Web/Core/Services/SyncDbService.cs b/Template.Web/Core/Services/SyncDbService.cs new file mode 100644 index 0000000..fb9381f --- /dev/null +++ b/Template.Web/Core/Services/SyncDbService.cs @@ -0,0 +1,26 @@ +using Template.Shared.Core.Interface; + +namespace Template.Web.Core.Services; + +public class SyncDbService : ISyncDbService +{ + public Task GetAndSaveActivity(string? dateFilter = null) + { + throw new NotImplementedException(); + } + + public Task GetAndSaveCommesse(string? dateFilter = null) + { + throw new NotImplementedException(); + } + + public Task GetAndSaveProspect(string? dateFilter = null) + { + throw new NotImplementedException(); + } + + public Task GetAndSaveClienti(string? dateFilter = null) + { + throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/Template.Web/Program.cs b/Template.Web/Program.cs index c81da2b..d7a1efd 100644 --- a/Template.Web/Program.cs +++ b/Template.Web/Program.cs @@ -6,8 +6,7 @@ using MudBlazor.Services; using Template.Shared.Components; using Template.Shared.Core.Interface; using Template.Shared.Core.Services; -using Template.Shared.Interfaces; -using Template.Web.Services; +using Template.Web.Core.Services; var builder = WebAssemblyHostBuilder.CreateDefault(args); @@ -16,6 +15,9 @@ builder.Services.AddAuthorizationCore(); builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(provider => provider.GetRequiredService()); diff --git a/Template.Web/Template.Web.csproj b/Template.Web/Template.Web.csproj index 5d2577e..f8dbb55 100644 --- a/Template.Web/Template.Web.csproj +++ b/Template.Web/Template.Web.csproj @@ -18,6 +18,7 @@ +