From 7ca4de628bd9bf5fcc36bc2aa0ee0a4b0867ed46 Mon Sep 17 00:00:00 2001 From: MarcoE Date: Mon, 16 Jun 2025 11:58:49 +0200 Subject: [PATCH] =?UTF-8?q?Completato=20form=20attivit=C3=A0=20e=20filtri?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Template.Maui/Core/Services/LocalDbService.cs | 24 +++ .../Core/Services/ManageDataService.cs | 26 +-- Template.Maui/Core/Services/SyncDbService.cs | 90 +++++---- Template.Maui/wwwroot/index.html | 66 ++++--- .../Layout/BottomSheet/FilterActivity.razor | 151 +++++++++++++++ .../BottomSheet/FilterActivity.razor.css | 56 ++++++ .../Components/Layout/HeaderLayout.razor | 10 +- .../Layout/Overlay/SaveOverlay.razor | 23 +++ .../Layout/Overlay/SaveOverlay.razor.css | 156 ++++++++++++++++ .../Components/Pages/ActivityForm.razor | 131 ------------- .../Components/Pages/ActivityForm.razor.css | 61 ------- .../Components/Pages/Calendar.razor | 91 ++++++++- .../Components/Pages/PersonalInfo.razor.css | 14 +- .../Components/Pages/SyncPage.razor | 37 ++-- .../SingleElements/Calendar/DayView.razor | 73 -------- .../SingleElements/Calendar/DayView.razor.css | 17 -- .../SingleElements/Calendar/MonthView.razor | 150 --------------- .../Calendar/MonthView.razor.css | 101 ---------- .../SingleElements/Calendar/WeekView.razor | 88 --------- .../Calendar/WeekView.razor.css | 26 --- .../SingleElements/Card/ActivityCard.razor | 14 +- .../Card/ActivityCard.razor.css | 2 +- .../SingleElements/Modal/ActivityForm.razor | 172 ++++++++++++++++++ .../Modal/ActivityForm.razor.css | 0 Template.Shared/Core/Dto/ActivityDTO.cs | 161 ++++++++-------- Template.Shared/Core/Dto/ActivityResultDTO.cs | 6 - Template.Shared/Core/Dto/FilterActivityDTO.cs | 20 ++ .../Core/Dto/SettingsResponseDTO.cs | 16 ++ .../Core/Entity/StbActivityResult.cs | 32 ++++ .../Core/Entity/StbActivityType.cs | 41 +++++ Template.Shared/Core/Entity/StbUser.cs | 14 ++ .../Core/Helpers/ActivityCategoryHelper.cs | 13 +- .../Core/Helpers/Enum/ActivityStatusEnum.cs | 6 - Template.Shared/Core/Helpers/ModalHelpers.cs | 12 +- .../Core/Helpers/ObjectExtensions.cs | 8 +- .../Core/Interface/IIntegryApiService.cs | 11 +- .../Core/Interface/IManageDataService.cs | 11 +- .../Core/Interface/ISyncDbService.cs | 1 + .../Core/Services/IntegryApiService.cs | 22 ++- Template.Shared/wwwroot/css/app.css | 87 +++++++++ Template.Shared/wwwroot/css/default-theme.css | 3 +- Template.Shared/wwwroot/css/form.css | 80 ++++++++ .../Core/Services/ManageDataService.cs | 37 +--- Template.Web/Core/Services/SyncDbService.cs | 5 + 44 files changed, 1241 insertions(+), 924 deletions(-) create mode 100644 Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor create mode 100644 Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor.css create mode 100644 Template.Shared/Components/Layout/Overlay/SaveOverlay.razor create mode 100644 Template.Shared/Components/Layout/Overlay/SaveOverlay.razor.css delete mode 100644 Template.Shared/Components/Pages/ActivityForm.razor delete mode 100644 Template.Shared/Components/Pages/ActivityForm.razor.css delete mode 100644 Template.Shared/Components/SingleElements/Calendar/DayView.razor delete mode 100644 Template.Shared/Components/SingleElements/Calendar/DayView.razor.css delete mode 100644 Template.Shared/Components/SingleElements/Calendar/MonthView.razor delete mode 100644 Template.Shared/Components/SingleElements/Calendar/MonthView.razor.css delete mode 100644 Template.Shared/Components/SingleElements/Calendar/WeekView.razor delete mode 100644 Template.Shared/Components/SingleElements/Calendar/WeekView.razor.css create mode 100644 Template.Shared/Components/SingleElements/Modal/ActivityForm.razor create mode 100644 Template.Shared/Components/SingleElements/Modal/ActivityForm.razor.css delete mode 100644 Template.Shared/Core/Dto/ActivityResultDTO.cs create mode 100644 Template.Shared/Core/Dto/FilterActivityDTO.cs create mode 100644 Template.Shared/Core/Dto/SettingsResponseDTO.cs create mode 100644 Template.Shared/Core/Entity/StbActivityResult.cs create mode 100644 Template.Shared/Core/Entity/StbActivityType.cs create mode 100644 Template.Shared/Core/Entity/StbUser.cs delete mode 100644 Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs create mode 100644 Template.Shared/wwwroot/css/form.css diff --git a/Template.Maui/Core/Services/LocalDbService.cs b/Template.Maui/Core/Services/LocalDbService.cs index 903aef2..509dd48 100644 --- a/Template.Maui/Core/Services/LocalDbService.cs +++ b/Template.Maui/Core/Services/LocalDbService.cs @@ -19,10 +19,34 @@ public class LocalDbService _connection.CreateTableAsync(); _connection.CreateTableAsync(); _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + _connection.CreateTableAsync(); + } + + public async Task ResetSettingsDb() + { + try + { + await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_result;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_type;"); + await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_user;"); + + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + await _connection.CreateTableAsync(); + } + catch (Exception ex) + { + Console.WriteLine($"Errore durante il reset del database(settings): {ex.Message}"); + throw; + } } public async Task ResetDb() { + await ResetSettingsDb(); + try { await _connection.ExecuteAsync("DROP TABLE IF EXISTS anag_clie;"); diff --git a/Template.Maui/Core/Services/ManageDataService.cs b/Template.Maui/Core/Services/ManageDataService.cs index 48db38d..1f1b149 100644 --- a/Template.Maui/Core/Services/ManageDataService.cs +++ b/Template.Maui/Core/Services/ManageDataService.cs @@ -9,25 +9,7 @@ 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) => + public Task> GetTable(Expression>? whereCond = null) where T : new() => localDb.Get(whereCond); public async Task> GetActivity(Expression>? whereCond = null) @@ -70,7 +52,8 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage { string? ragSoc; - if (distinctClient.TryGetValue(activity.CodAnag, out ragSoc) || distinctProspect.TryGetValue(activity.CodAnag, out ragSoc)) + if (distinctClient.TryGetValue(activity.CodAnag, out ragSoc) || + distinctProspect.TryGetValue(activity.CodAnag, out ragSoc)) { dto.Cliente = ragSoc; } @@ -86,6 +69,9 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage return returnDto; } + public Task InsertOrUpdate(T objectToSave) => + localDb.InsertOrUpdate([objectToSave]); + public Task ClearDb() => localDb.ResetDb(); } \ No newline at end of file diff --git a/Template.Maui/Core/Services/SyncDbService.cs b/Template.Maui/Core/Services/SyncDbService.cs index fa53add..7019edf 100644 --- a/Template.Maui/Core/Services/SyncDbService.cs +++ b/Template.Maui/Core/Services/SyncDbService.cs @@ -1,4 +1,5 @@ -using Template.Shared.Core.Interface; +using Template.Shared.Core.Helpers; +using Template.Shared.Core.Interface; namespace Template.Maui.Core.Services; @@ -6,65 +7,80 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService { public async Task GetAndSaveActivity(string? dateFilter) { - var allActivity = await integryApiService.GetActivity(dateFilter); + var allActivity = await integryApiService.RetrieveActivity(dateFilter); - if (allActivity is not null) + if (!allActivity.IsNullOrEmpty()) if (dateFilter is null) - await localDb.InsertAll(allActivity); + await localDb.InsertAll(allActivity!); else - await localDb.InsertOrUpdate(allActivity); + await localDb.InsertOrUpdate(allActivity!); } public async Task GetAndSaveCommesse(string? dateFilter) { - var allCommesse = await integryApiService.GetAllCommesse(dateFilter); + var allCommesse = await integryApiService.RetrieveAllCommesse(dateFilter); - if (allCommesse is not null) + if (!allCommesse.IsNullOrEmpty()) if (dateFilter is null) - await localDb.InsertAll(allCommesse); + await localDb.InsertAll(allCommesse!); else - await localDb.InsertOrUpdate(allCommesse); + await localDb.InsertOrUpdate(allCommesse!); } public async Task GetAndSaveProspect(string? dateFilter) { - var tasks = new List(); - var taskSyncResponseDto = await integryApiService.GetProspect(dateFilter); + var taskSyncResponseDto = await integryApiService.RetrieveProspect(dateFilter); - if (taskSyncResponseDto.PtbPros is not null) - tasks.Add(dateFilter is null - ? localDb.InsertAll(taskSyncResponseDto.PtbPros) - : localDb.InsertOrUpdate(taskSyncResponseDto.PtbPros)); + if (!taskSyncResponseDto.PtbPros.IsNullOrEmpty()) + if (dateFilter is null) + await localDb.InsertAll(taskSyncResponseDto.PtbPros!); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.PtbPros!); - if (taskSyncResponseDto.PtbProsRif is not null) - tasks.Add(dateFilter is null - ? localDb.Insert(taskSyncResponseDto.PtbProsRif) - : localDb.InsertOrUpdate(taskSyncResponseDto.PtbProsRif)); - - await Task.WhenAll(tasks.AsEnumerable()); + if (!taskSyncResponseDto.PtbProsRif.IsNullOrEmpty()) + if (dateFilter is null) + await localDb.InsertAll(taskSyncResponseDto.PtbProsRif!); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.PtbProsRif!); } public async Task GetAndSaveClienti(string? dateFilter) { - var tasks = new List(); - var taskSyncResponseDto = await integryApiService.GetAnagClie(dateFilter); + var taskSyncResponseDto = await integryApiService.RetrieveAnagClie(dateFilter); - if (taskSyncResponseDto.AnagClie is not null) - tasks.Add(dateFilter is null - ? localDb.InsertAll(taskSyncResponseDto.AnagClie) - : localDb.InsertOrUpdate(taskSyncResponseDto.AnagClie)); + if (!taskSyncResponseDto.AnagClie.IsNullOrEmpty()) + if (dateFilter is null) + await localDb.InsertAll(taskSyncResponseDto.AnagClie!); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.AnagClie!); - if (taskSyncResponseDto.VtbDest is not null) - tasks.Add(dateFilter is null - ? localDb.Insert(taskSyncResponseDto.VtbDest) - : localDb.InsertOrUpdate(taskSyncResponseDto.VtbDest)); + if (!taskSyncResponseDto.VtbDest.IsNullOrEmpty()) + if (dateFilter is null) + await localDb.InsertAll(taskSyncResponseDto.VtbDest!); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.VtbDest!); - if (taskSyncResponseDto.VtbCliePersRif is not null) - tasks.Add(dateFilter is null - ? localDb.Insert(taskSyncResponseDto.VtbCliePersRif) - : localDb.InsertOrUpdate(taskSyncResponseDto.VtbCliePersRif)); - - await Task.WhenAll(tasks.AsEnumerable()); + if (!taskSyncResponseDto.VtbCliePersRif.IsNullOrEmpty()) + if (dateFilter is null) + await localDb.InsertAll(taskSyncResponseDto.VtbCliePersRif!); + else + await localDb.InsertOrUpdate(taskSyncResponseDto.VtbCliePersRif!); } + public async Task GetAndSaveSettings(string? dateFilter) + { + if (dateFilter is not null) + await localDb.ResetSettingsDb(); + + var settingsResponse = await integryApiService.RetrieveSettings(); + + if (!settingsResponse.ActivityResults.IsNullOrEmpty()) + await localDb.InsertAll(settingsResponse.ActivityResults!); + + if (!settingsResponse.ActivityTypes.IsNullOrEmpty()) + await localDb.InsertAll(settingsResponse.ActivityTypes!); + + if (!settingsResponse.StbUsers.IsNullOrEmpty()) + await localDb.InsertAll(settingsResponse.StbUsers!); + } } \ No newline at end of file diff --git a/Template.Maui/wwwroot/index.html b/Template.Maui/wwwroot/index.html index 16ae979..0da011d 100644 --- a/Template.Maui/wwwroot/index.html +++ b/Template.Maui/wwwroot/index.html @@ -1,51 +1,57 @@ - - + + Template.Maui - + - - - + + + - - - - - + + + + + + -
+
-
Loading...
- -
- An unhandled error has occurred. - Reload - 🗙 +
+
+
+
- - - - - - - - - - - - +
+ An unhandled error has occurred. + Reload + 🗙 +
+ + + + + + + + + + + + + + diff --git a/Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor b/Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor new file mode 100644 index 0000000..239bb11 --- /dev/null +++ b/Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor @@ -0,0 +1,151 @@ +@using Template.Shared.Core.Dto +@using Template.Shared.Core.Entity +@using Template.Shared.Core.Helpers.Enum +@using Template.Shared.Core.Interface +@inject IManageDataService manageData + +
+ +
+
+
+ + Filtri + + +
+ +
+ + + +
+ +
+
+ Assegnata a + + + +
+ +
+ +
+ Tipo + + + @foreach (var type in ActivityType) + { + @type.ActivityTypeId + } + +
+ +
+ +
+ Esito + + + @foreach (var result in ActivityResult) + { + @result.ActivityResultId + } + +
+ +
+ +
+ Categoria + + + @foreach (var category in CategoryList) + { + @category.ConvertToHumanReadable() + } + +
+
+ +
+ Pulisci + Filtra +
+
+
+ +@code { + [Parameter] public bool IsSheetVisible { get; set; } + [Parameter] public EventCallback IsSheetVisibleChanged { get; set; } + + [Parameter] public FilterActivityDTO Filter { get; set; } + [Parameter] public EventCallback FilterChanged { get; set; } + + private List ActivityResult { get; set; } = []; + private List ActivityType { get; set; } = []; + private List Users { get; set; } = []; + private List CategoryList { get; set; } = []; + + protected override async Task OnParametersSetAsync() + { + if (IsSheetVisible) + await LoadData(); + } + + private string GetMultiSelectionUser(List selectedValues) + { + return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}"; + } + + private async Task LoadData() + { + Users = await manageData.GetTable(); + ActivityResult = await manageData.GetTable(); + ActivityType = await manageData.GetTable(x => x.FlagTipologia.Equals("A")); + CategoryList = ActivityCategoryHelper.AllActivityCategory; + + StateHasChanged(); + } + + private void CloseBottomSheet() + { + IsSheetVisible = false; + IsSheetVisibleChanged.InvokeAsync(IsSheetVisible); + } + + private void OnFilterButton() + { + FilterChanged.InvokeAsync(Filter); + CloseBottomSheet(); + } + +} \ No newline at end of file diff --git a/Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor.css b/Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor.css new file mode 100644 index 0000000..104a4f5 --- /dev/null +++ b/Template.Shared/Components/Layout/BottomSheet/FilterActivity.razor.css @@ -0,0 +1,56 @@ +.bottom-sheet-backdrop { + position: fixed; + inset: 0; + background-color: rgba(165, 165, 165, 0.5); + opacity: 0; + pointer-events: none; + transition: opacity 0.3s ease; + z-index: 1002; +} + +.bottom-sheet-backdrop.show { + opacity: 1; + pointer-events: auto; +} + +.bottom-sheet-container { + position: fixed; + bottom: -100%; + left: 0; + right: 0; + transition: bottom 0.3s ease; + z-index: 1003; +} + +.bottom-sheet-container.show { + bottom: 0; +} + +.bottom-sheet { + background-color: var(--mud-palette-surface); + border-top-left-radius: 16px; + border-top-right-radius: 16px; + padding: 4px 16px 16px; + box-shadow: 0 -2px 10px rgba(165, 165, 165, 0.5); +} + +.clearButton ::deep .mud-icon-button { + padding: 4px !important; +} + +.bottom-sheet ::deep .closeIcon .mud-icon-root { + border-radius: 50%; + padding: 2px; + min-width: 15px; + min-height: 15px; + padding: 4px; + background: var(--mud-palette-gray-light); + color: var(--mud-palette-surface); +} + +.button-section { + display: flex; + justify-content: end; + gap: .75rem; + margin-top: 2rem; +} \ No newline at end of file diff --git a/Template.Shared/Components/Layout/HeaderLayout.razor b/Template.Shared/Components/Layout/HeaderLayout.razor index 14135f6..b447692 100644 --- a/Template.Shared/Components/Layout/HeaderLayout.razor +++ b/Template.Shared/Components/Layout/HeaderLayout.razor @@ -22,11 +22,7 @@ { @if (ShowFilter) { - - } - @if (ShowNotifications) - { - @* *@ + } @if (ShowCalendarToggle) { @@ -53,6 +49,8 @@ [Parameter] public bool Back { get; set; } [Parameter] public string BackTo { get; set; } = ""; + [Parameter] public EventCallback OnFilterToggle { get; set; } + [Parameter] public bool Cancel { get; set; } [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public string? LabelSave { get; set; } @@ -76,7 +74,7 @@ } await JS.InvokeVoidAsync("goBack"); - + } } \ No newline at end of file diff --git a/Template.Shared/Components/Layout/Overlay/SaveOverlay.razor b/Template.Shared/Components/Layout/Overlay/SaveOverlay.razor new file mode 100644 index 0000000..9bfd67a --- /dev/null +++ b/Template.Shared/Components/Layout/Overlay/SaveOverlay.razor @@ -0,0 +1,23 @@ +@using Template.Shared.Components.Layout.Spinner + + @if (SuccessAnimation) + { +
+
+ + +
+
+
+
+ } + else + { + + } +
+ +@code { + [Parameter] public required bool SuccessAnimation { get; set; } + [Parameter] public required bool VisibleOverlay { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Components/Layout/Overlay/SaveOverlay.razor.css b/Template.Shared/Components/Layout/Overlay/SaveOverlay.razor.css new file mode 100644 index 0000000..d7d499b --- /dev/null +++ b/Template.Shared/Components/Layout/Overlay/SaveOverlay.razor.css @@ -0,0 +1,156 @@ +.success-checkmark { + width: 80px; + height: 80px; + margin: 0 auto; +} + +.success-checkmark .check-icon { + width: 80px; + height: 80px; + position: relative; + border-radius: 50%; + box-sizing: content-box; + border: 4px solid var(--mud-palette-success); +} + +.success-checkmark .check-icon::before { + top: 3px; + left: -2px; + width: 30px; + transform-origin: 100% 50%; + border-radius: 100px 0 0 100px; +} + +.success-checkmark .check-icon::after { + top: 0; + left: 30px; + width: 60px; + transform-origin: 0 50%; + border-radius: 0 100px 100px 0; + animation: rotate-circle 4.25s ease-in; +} + +.success-checkmark .check-icon::before, +.success-checkmark .check-icon::after { + content: ''; + height: 100px; + position: absolute; + transform: rotate(-45deg); + z-index: 2; +} + +.icon-line { + height: 5px; + background-color: var(--mud-palette-success); + display: block; + border-radius: 2px; + position: absolute; + z-index: 10; +} + +.icon-line.line-tip { + top: 46px; + left: 14px; + width: 25px; + transform: rotate(45deg); + animation: icon-line-tip 0.75s; +} + +.icon-line.line-long { + top: 38px; + right: 8px; + width: 47px; + transform: rotate(-45deg); + animation: icon-line-long 0.75s; +} + + +.icon-circle { + top: -4px; + left: -4px; + z-index: 10; + width: 80px; + height: 80px; + border-radius: 50%; + position: absolute; + box-sizing: content-box; + border: 4px solid var(--mud-palette-success); +} + +.icon-fix { + top: 8px; + width: 5px; + left: 26px; + z-index: 1; + height: 85px; + position: absolute; + transform: rotate(-45deg); +} + +@keyframes rotate-circle { + 0% { transform: rotate(-45deg); } + + 5% { transform: rotate(-45deg); } + + 12% { transform: rotate(-405deg); } + + 100% { transform: rotate(-405deg); } +} + +@keyframes icon-line-tip { + 0% { + width: 0; + left: 1px; + top: 19px; + } + + 54% { + width: 0; + left: 1px; + top: 19px; + } + + 70% { + width: 50px; + left: -8px; + top: 37px; + } + + 84% { + width: 17px; + left: 21px; + top: 48px; + } + + 100% { + width: 25px; + left: 14px; + top: 45px; + } +} + +@keyframes icon-line-long { + 0% { + width: 0; + right: 46px; + top: 54px; + } + + 65% { + width: 0; + right: 46px; + top: 54px; + } + + 84% { + width: 55px; + right: 0px; + top: 35px; + } + + 100% { + width: 47px; + right: 8px; + top: 38px; + } +} \ No newline at end of file diff --git a/Template.Shared/Components/Pages/ActivityForm.razor b/Template.Shared/Components/Pages/ActivityForm.razor deleted file mode 100644 index 67051b1..0000000 --- a/Template.Shared/Components/Pages/ActivityForm.razor +++ /dev/null @@ -1,131 +0,0 @@ -@using Template.Shared.Core.Dto -@using Template.Shared.Components.Layout -@using Template.Shared.Core.Interface -@inject IManageDataService manageData - - - - - -
-
- -
- -
-
- -
- -
- -
- -
-
- -
-
- Inizio - - -
- -
- -
- Fine - - -
- -
- -
- Avviso - - -
-
- -
-
- Assegnata a - - -
- -
- -
- Tipo - - - @foreach (var state in ActivityResult) - { - @state - } - -
- -
- -
- Esito - - - @foreach (var state in ActivityResult) - { - @state - } - -
-
- -
- -
-
-
-
- -@code { - [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } - - [Parameter] public string? Id { get; set; } - - private ActivityDTO OriginalModel { get; set; } = new(); - private ActivityDTO ActivityModel { get; set; } = new(); - private List ActivityResult { get; set; } = []; - - private bool IsNew => Id.IsNullOrEmpty(); - private bool _selectEstimatedTime; - private bool _selectEstimatedEndTime; - - private string? LabelSave { get; set; } - - protected override async Task OnInitializedAsync() - { - LabelSave = IsNew ? "Aggiungi" : null; - - if (!Id.IsNullOrEmpty()) - ActivityModel = (await manageData.GetActivity(x => x.ActivityId.Equals(Id))).Last(); - - if (IsNew) - { - ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour)); - ActivityModel.EstimatedEndtime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour) + TimeSpan.FromHours(1)); - } - - OriginalModel = ActivityModel.Clone(); - } - - private void OnAfterChangeValue() - { - if (OriginalModel.Equals(ActivityModel)) - LabelSave = "Aggiorna"; - - StateHasChanged(); - } - -} \ No newline at end of file diff --git a/Template.Shared/Components/Pages/ActivityForm.razor.css b/Template.Shared/Components/Pages/ActivityForm.razor.css deleted file mode 100644 index 52a8007..0000000 --- a/Template.Shared/Components/Pages/ActivityForm.razor.css +++ /dev/null @@ -1,61 +0,0 @@ -.customDialog-form .content ::deep { - height: calc(100vh - (.6rem + 40px)); - overflow: auto; - -ms-overflow-style: none; - scrollbar-width: none; -} - -.customDialog-form .content::-webkit-scrollbar { - display: none; -} - -.input-card { - width: 100%; - background: var(--mud-palette-background-gray); - border-radius: 9px; - padding: .5rem 1rem; - margin-bottom: 1.5rem; -} - -.input-card ::deep > .divider { margin: 0 !important; } - -.form-container { - display: flex; - justify-content: space-between; - align-items: center; - min-height: 35px; -} - -.form-container > span { - font-weight: 600; - width: 50%; -} - -.dateTime-picker { - display: flex; - gap: .3rem; - flex-direction: row; - align-items: center; -} - -/*Custom mudBlazor*/ - -.form-container ::deep .mud-input.mud-input-underline:before { border-bottom: none !important; } - -.form-container ::deep .mud-input.mud-input-underline:after { border-bottom: none !important; } - -.form-container.text-align-end ::deep .mud-input-slot { text-align: end; } - -.input-card ::deep .mud-input.mud-input-underline:before { border-bottom: none !important; } - -.input-card ::deep .mud-input.mud-input-underline:after { border-bottom: none !important; } - -.form-container ::deep .customIcon-select .mud-icon-root.mud-svg-icon { - rotate: 90deg !important; - font-size: 1.1rem; -} - -.input-card ::deep .mud-input { - width: 100%; - font-weight: 500; -} \ No newline at end of file diff --git a/Template.Shared/Components/Pages/Calendar.razor b/Template.Shared/Components/Pages/Calendar.razor index f523708..ac36db1 100644 --- a/Template.Shared/Components/Pages/Calendar.razor +++ b/Template.Shared/Components/Pages/Calendar.razor @@ -4,13 +4,14 @@ @using Template.Shared.Components.Layout @using Template.Shared.Components.SingleElements @using Template.Shared.Components.Layout.Spinner -@inject IManageDataService manageData -@inject IDialogService Dialog +@using Template.Shared.Components.Layout.BottomSheet +@inject IManageDataService ManageData @inject IJSRuntime JS
@@ -34,7 +35,7 @@ var day = new DateTime(CurrentMonth.Year, CurrentMonth.Month, d); var isSelected = IsSameDay(day, SelectedDate); var isToday = IsSameDay(day, DateTime.Today); - var events = GetEventsForDay(day); + var events = ReturnFilteredActivity(day);
@@ -69,10 +70,10 @@
@day.Day
- @if (GetEventsForDay(day).Any()) + @if (ReturnFilteredActivity(day).Any()) {
- @foreach (var cat in GetEventsForDay(day).Select(x => x.Category).Distinct()) + @foreach (var cat in ReturnFilteredActivity(day).Select(x => x.Category).Distinct()) {
} @@ -92,7 +93,7 @@ else if (FilteredActivities is { Count: > 0 }) { - + } else @@ -101,6 +102,8 @@ }
+ + @code { // Stato UI @@ -124,6 +127,10 @@ private int DaysInMonth => DateTime.DaysInMonth(CurrentMonth.Year, CurrentMonth.Month); private int StartOffset => (int)CurrentMonth.DayOfWeek == 0 ? 6 : (int)CurrentMonth.DayOfWeek - 1; + //Filtri + private bool OpenFilter { get; set; } + private FilterActivityDTO Filter { get; set; } = new(); + private int EndOffset { get @@ -147,10 +154,17 @@ { if (firstRender) { + Filter.User = new HashSet { UserSession.User.Username }; + dotNetHelper = DotNetObjectReference.Create(this); await JS.InvokeVoidAsync("calendarSwipe.register", weekSliderRef, dotNetHelper); _internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1); await LoadMonthData(); + + if (!Expanded) + ApplyFilter(); + + StateHasChanged(); } } @@ -249,7 +263,7 @@ // Carica tutte le attività del mese corrente visualizzato var start = CurrentMonth; var end = start.AddDays(DaysInMonth - 1); - var activities = await manageData.GetActivity(x => + var activities = await ManageData.GetActivity(x => (x.EffectiveDate == null && x.EstimatedDate >= start && x.EstimatedDate <= end) || (x.EffectiveDate >= start && x.EffectiveDate <= end)); MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList(); @@ -272,7 +286,7 @@ await LoadMonthData(); } - FilteredActivities = GetEventsForDay(day); + ApplyFilter(); StateHasChanged(); } @@ -280,7 +294,7 @@ private async Task SelezionaDataDalMese(DateTime day) { SelectedDate = day; - FilteredActivities = GetEventsForDay(day); + ApplyFilter(); // Chiudi la vista mese e passa alla settimana, con animazione SliderAnimation = "collapse-animation"; StateHasChanged(); @@ -306,4 +320,63 @@ { dotNetHelper?.Dispose(); } + + private async Task OnActivityChanged(string activityId) + { + var newActivity = await ManageData.GetActivity(x => x.ActivityId.Equals(activityId)); + var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activityId)); + + if (indexActivity != null && !newActivity.IsNullOrEmpty()) + { + MonthActivities![indexActivity.Value] = newActivity[0]; + } + + ApplyFilter(); + StateHasChanged(); + } + + private void ToggleFilter() + { + OpenFilter = !OpenFilter; + StateHasChanged(); + } + + private void ApplyFilter() + { + FilteredActivities = GetEventsForDay(SelectedDate); + + if (!Filter.ClearFilter) + { + FilteredActivities = GetEventsForDay(SelectedDate)? + .Where(x => + (!Filter.Text.IsNullOrEmpty() && x.ActivityDescription != null && x.ActivityDescription.ContainsIgnoreCase(Filter.Text!)) || + (x.ActivityTypeId != null && !Filter.Type.IsNullOrEmpty() && x.ActivityTypeId.Equals(Filter.Type)) || + (x.ActivityResultId != null && !Filter.Result.IsNullOrEmpty() && x.ActivityResultId.Equals(Filter.Result)) || + (x.UserName != null && !Filter.User.IsNullOrEmpty() && Filter.User!.Contains(x.UserName)) || + (Filter.Category != null && x.Category.Equals(Filter.Category)) + ) + .ToList() ?? []; + } + + StateHasChanged(); + } + + private List ReturnFilteredActivity(DateTime day) + { + if (!Filter.ClearFilter) + { + return GetEventsForDay(day)? + .Where(x => + (!Filter.Text.IsNullOrEmpty() && x.ActivityDescription != null && x.ActivityDescription.ContainsIgnoreCase(Filter.Text!)) || + (x.ActivityTypeId != null && !Filter.Type.IsNullOrEmpty() && x.ActivityTypeId.Equals(Filter.Type)) || + (x.ActivityResultId != null && !Filter.Result.IsNullOrEmpty() && x.ActivityResultId.Equals(Filter.Result)) || + (x.UserName != null && !Filter.User.IsNullOrEmpty() && Filter.User!.Contains(x.UserName)) || + (Filter.Category != null && x.Category.Equals(Filter.Category)) + ) + .ToList() ?? []; + } + + return GetEventsForDay(day); + } + } \ 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 5b36e52..b02f0c8 100644 --- a/Template.Shared/Components/Pages/PersonalInfo.razor.css +++ b/Template.Shared/Components/Pages/PersonalInfo.razor.css @@ -98,17 +98,23 @@ .container-button ::deep .button-settings { border: none !important; } .container-button ::deep .button-settings .mud-icon-root { - border: 1px solid var(--mud-palette-gray-light); border-radius: 6px; padding: 2px; min-width: 25px; min-height: 25px; - box-shadow: inset 0 3px 5px rgba(200, 200, 200, 0.5); } -.container-button ::deep .button-settings.green-icon .mud-icon-root { color: var(--mud-palette-success-darken); } + .container-button ::deep .button-settings.green-icon .mud-icon-root { + border: 1px solid var(--mud-palette-success); + background: hsl(from var(--mud-palette-success-lighten) h s 95%); + color: var(--mud-palette-success-darken); + } -.container-button ::deep .button-settings.red-icon .mud-icon-root { color: var(--mud-palette-error); } + .container-button ::deep .button-settings.red-icon .mud-icon-root { + border: 1px solid var(--mud-palette-error); + background: hsl(from var(--mud-palette-error-lighten) h s 95%); + color: var(--mud-palette-error-darken); + } .container-button ::deep .button-settings .mud-button-label { justify-content: flex-start; diff --git a/Template.Shared/Components/Pages/SyncPage.razor b/Template.Shared/Components/Pages/SyncPage.razor index 031a412..2f85fae 100644 --- a/Template.Shared/Components/Pages/SyncPage.razor +++ b/Template.Shared/Components/Pages/SyncPage.razor @@ -21,6 +21,7 @@ Elements["Commesse"] = false; Elements["Clienti"] = false; Elements["Prospect"] = false; + Elements["Impostazioni"] = false; } protected override async Task OnAfterRenderAsync(bool firstRender) @@ -34,7 +35,13 @@ await manageData.ClearDb(); } - await Task.WhenAll(RunAndTrack(SetActivity), RunAndTrack(SetClienti), RunAndTrack(SetProspect), RunAndTrack(SetCommesse)); + await Task.WhenAll( + RunAndTrack(SetActivity), + RunAndTrack(SetClienti), + RunAndTrack(SetProspect), + RunAndTrack(SetCommesse), + RunAndTrack(SetSettings) + ); } } @@ -57,10 +64,7 @@ private async Task SetActivity() { - await Task.Run(async () => - { - await syncDb.GetAndSaveActivity(DateFilter); - }); + await Task.Run(async () => { await syncDb.GetAndSaveActivity(DateFilter); }); Elements["Attività"] = true; StateHasChanged(); @@ -68,10 +72,7 @@ private async Task SetClienti() { - await Task.Run(async () => - { - await syncDb.GetAndSaveClienti(DateFilter); - }); + await Task.Run(async () => { await syncDb.GetAndSaveClienti(DateFilter); }); Elements["Clienti"] = true; StateHasChanged(); @@ -79,10 +80,7 @@ private async Task SetProspect() { - await Task.Run(async () => - { - await syncDb.GetAndSaveProspect(DateFilter); - }); + await Task.Run(async () => { await syncDb.GetAndSaveProspect(DateFilter); }); Elements["Prospect"] = true; StateHasChanged(); @@ -90,13 +88,18 @@ private async Task SetCommesse() { - await Task.Run(async () => - { - await syncDb.GetAndSaveCommesse(DateFilter); - }); + await Task.Run(async () => { await syncDb.GetAndSaveCommesse(DateFilter); }); Elements["Commesse"] = true; StateHasChanged(); } + private async Task SetSettings() + { + await Task.Run(async () => { await syncDb.GetAndSaveSettings(DateFilter); }); + + Elements["Impostazioni"] = 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 deleted file mode 100644 index 25128b4..0000000 --- a/Template.Shared/Components/SingleElements/Calendar/DayView.razor +++ /dev/null @@ -1,73 +0,0 @@ -@using Template.Shared.Core.Dto -@using Template.Shared.Core.Interface -@using Template.Shared.Components.Layout.Spinner -@inject IManageDataService manageData - -
- @if (Load) - { - - } - else - { - @if (!Activities.IsNullOrEmpty()) - { - @foreach (var activity in Activities!) - { - - } - } - else - { - - } - } -
- - -@code -{ - [Parameter] public required DateTime? Date { get; set; } - [Parameter] public EventCallback DateChanged { get; set; } - - private List? Activities { get; set; } - private bool Load { get; set; } = true; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - await LoadData(); - } - } - - protected override async Task OnParametersSetAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - Load = true; - StateHasChanged(); - - await Task.Delay(500); - var refreshActivity = await RefreshActivity(); - Activities = refreshActivity; - Load = false; - 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 deleted file mode 100644 index 3981df4..0000000 --- a/Template.Shared/Components/SingleElements/Calendar/DayView.razor.css +++ /dev/null @@ -1,17 +0,0 @@ -.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; -} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/MonthView.razor b/Template.Shared/Components/SingleElements/Calendar/MonthView.razor deleted file mode 100644 index 9e1df7d..0000000 --- a/Template.Shared/Components/SingleElements/Calendar/MonthView.razor +++ /dev/null @@ -1,150 +0,0 @@ -@using Template.Shared.Core.Dto -@using Template.Shared.Core.Interface -@inject IManageDataService manageData - -
-
- @foreach (var nomeGiorno in _giorniSettimana) - { -
@nomeGiorno
- } - - @for (var i = 0; i < StartDays; i++) - { -
- } - - @for (var day = 1; day <= DaysInMonth; day++) - { - var currentDate = new DateTime(Date.Year, Date.Month, day); - var events = GetEventsForDay(currentDate); - var daySelected = SelectedDate == currentDate; - var isToday = currentDate == DateTime.Today; - - var topRight = StartDays == 0 ? 7 : 7 - StartDays; - var bottomLeft = DaysInMonth - (6 - EndDays); - - var categoryActivityCount = events.Select(x => x.Category).Distinct().ToList(); - -
- -
- @day - @if (events.Any()) - { -
- @foreach (var activityCategory in categoryActivityCount) - { -
- } -
- } -
-
- } - - @for (var i = 0; i < EndDays; i++) - { -
- } -
- -
- @if (!FilteredActivityList.IsNullOrEmpty()) - { - @foreach (var activity in FilteredActivityList!) - { - - } - } -
-
- -@code -{ - [Parameter] public required DateTime Date { get; set; } - [Parameter] public EventCallback DateChanged { get; set; } - - private List ActivityList { get; set; } = []; - private List FilteredActivityList { get; set; } = []; - private DateTime SelectedDate { get; set; } = DateTime.Today; - - private int DaysInMonth { get; set; } - private int StartDays { get; set; } - private int EndDays { get; set; } - - readonly string[] _giorniSettimana = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"]; - - protected override async Task OnInitializedAsync() - { - await ChangeMonth(); - } - - protected override async Task OnParametersSetAsync() - { - await ChangeMonth(); - } - - private async Task ChangeMonth() - { - var firstDay = Date; - DaysInMonth = DateTime.DaysInMonth(firstDay.Year, firstDay.Month); - - var dayOfWeek = (int)firstDay.DayOfWeek; - StartDays = dayOfWeek == 0 ? 6 : dayOfWeek - 1; - - var tempTotalCell = (int)Math.Ceiling((double)(DaysInMonth + StartDays) / 7); - var totalCell = tempTotalCell * 7; - EndDays = totalCell - (DaysInMonth + StartDays); - - await LoadData(); - } - - private async Task LoadData() - { - // Load = true; - // StateHasChanged(); - - await Task.Delay(500); - var refreshActivity = await RefreshActivity(); - ActivityList = refreshActivity; - // Load = false; - StateHasChanged(); - } - - private async Task> RefreshActivity() - { - var startDate = Date; - var endDate = Date.AddDays(DateTime.DaysInMonth(startDate.Year, startDate.Month) - 1); - - var dateRange = new DateRange(Date, endDate); - - var activityDto = await Task.Run(async () => - { - return (await manageData.GetActivity(x => - (x.EffectiveDate == null && x.EstimatedDate >= dateRange.Start && x.EstimatedDate <= dateRange.End) || - (x.EffectiveDate >= dateRange.Start && x.EffectiveDate <= dateRange.End) - )) - .OrderBy(x => x.EffectiveDate ?? x.EstimatedDate) - .ToList(); - }); - - return activityDto; - } - - private List GetEventsForDay(DateTime day) - { - return ActivityList.IsNullOrEmpty() ? [] : ActivityList.Where(x => (x.EffectiveDate ?? x.EstimatedDate) == day.Date).ToList(); - } - - private void SelectDay(DateTime currentDate) - { - SelectedDate = currentDate; - StateHasChanged(); - FilteredActivityList = GetEventsForDay(currentDate); - } -} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/MonthView.razor.css b/Template.Shared/Components/SingleElements/Calendar/MonthView.razor.css deleted file mode 100644 index 5354ee5..0000000 --- a/Template.Shared/Components/SingleElements/Calendar/MonthView.razor.css +++ /dev/null @@ -1,101 +0,0 @@ -.calendar { - display: grid; - grid-template-columns: repeat(7, 1fr); -} - -.calendar-header, .calendar-day { - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-start; - min-height: 65px; - font-size: 0.85rem; - padding: 4px; -} - -.calendar-day { border: 1px solid var(--mud-palette-gray-light); } - -.calendar-day.disabled { border: 1px solid hsl(from var(--mud-palette-gray-light) h s 88%); } - -.calendar-header { - font-weight: bold; - min-height: 25px; - display: flex; - justify-content: end; -} - -.today > .calendar-day-wrapper > .titleDay { - background-color: var(--mud-palette-primary); - color: var(--mud-palette-appbar-text); - font-weight: 700; -} - -.selectedDay > .calendar-day-wrapper > .titleDay { - border: 1px solid var(--mud-palette-primary); - font-weight: 700; -} - -.calendar-day-wrapper > .titleDay { - padding: 6px; - border-radius: 50%; - position: absolute; - line-height: normal; -} - -.event-dot-container { - position: absolute; - bottom: 0; - width: 100%; - display: flex; - flex-direction: column; - gap: .2rem; -} - -.event-dot { - width: 100%; - height: 6px; - border-radius: 4px; - background-color: var(--mud-palette-secondary); -} - -.event-dot.memo { background-color: var(--mud-palette-info-darken); } - -.event-dot.interna { background-color: var(--mud-palette-success-darken); } - -.event-dot.commessa { background-color: var(--mud-palette-warning); } - -.calendar-day:hover .event-popup { display: block; } - -.calendar-day-wrapper { - position: relative; - width: 100%; - height: 100%; -} - -.radiusTopLeft { border-top-left-radius: 12px; } - -.radiusTopRight { border-top-right-radius: 12px; } - -.radiusBottomLeft { border-bottom-left-radius: 12px; } - -.radiusBottomRight { border-bottom-right-radius: 12px; } - -.activityContainer { margin-top: 1rem; } - -.calendar-activity { - width: 100%; - display: flex; - flex-direction: column; - flex-wrap: nowrap; - gap: 1rem; - overflow-y: auto; - overflow-x: hidden; - padding-bottom: 1rem; -} - -.calendar-activity::-webkit-scrollbar { display: none; } - -.calendar-activity { - -ms-overflow-style: none; - scrollbar-width: none; -} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Calendar/WeekView.razor b/Template.Shared/Components/SingleElements/Calendar/WeekView.razor deleted file mode 100644 index d5fe91a..0000000 --- a/Template.Shared/Components/SingleElements/Calendar/WeekView.razor +++ /dev/null @@ -1,88 +0,0 @@ -@using Template.Shared.Core.Dto -@using Template.Shared.Core.Interface -@using Template.Shared.Components.Layout.Spinner -@inject IManageDataService manageData - -
- @{ - DateTime? currentDate = null; - } - - @if (Load) - { - - } - else - { - @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; } - private bool Load { get; set; } = true; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - if (firstRender) - { - await LoadData(); - } - } - - protected override async Task OnParametersSetAsync() - { - await LoadData(); - } - - private async Task LoadData() - { - Load = true; - StateHasChanged(); - - await Task.Delay(500); - var refreshActivity = await RefreshActivity(); - Activities = refreshActivity; - Load = false; - StateHasChanged(); - } - - private async Task> RefreshActivity() - { - var activityDto = await Task.Run(async () => - { - return (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 deleted file mode 100644 index 792ef18..0000000 --- a/Template.Shared/Components/SingleElements/Calendar/WeekView.razor.css +++ /dev/null @@ -1,26 +0,0 @@ -.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 77cab10..d432a82 100644 --- a/Template.Shared/Components/SingleElements/Card/ActivityCard.razor +++ b/Template.Shared/Components/SingleElements/Card/ActivityCard.razor @@ -1,8 +1,9 @@ @using Template.Shared.Core.Dto +@using Template.Shared.Core.Entity @using Template.Shared.Core.Helpers.Enum @inject IDialogService Dialog -
+
@@ -63,6 +64,7 @@ @code { [Parameter] public ActivityDTO Activity { get; set; } = new(); + [Parameter] public EventCallback ActivityChanged { get; set; } private TimeSpan? Durata { get; set; } @@ -75,4 +77,14 @@ _ => null }; } + + private async Task OpenActivity() + { + var result = await ModalHelpers.OpenActivityForm(Dialog, Activity.ActivityId); + + if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(StbActivity)) + { + await ActivityChanged.InvokeAsync(((StbActivity)result.Data).ActivityId); + } + } } \ 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 ce62208..18487e2 100644 --- a/Template.Shared/Components/SingleElements/Card/ActivityCard.razor.css +++ b/Template.Shared/Components/SingleElements/Card/ActivityCard.razor.css @@ -50,6 +50,6 @@ } .activity-info-section { - width: min-content; display: flex; + flex-wrap: wrap; } \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Modal/ActivityForm.razor b/Template.Shared/Components/SingleElements/Modal/ActivityForm.razor new file mode 100644 index 0000000..da4038d --- /dev/null +++ b/Template.Shared/Components/SingleElements/Modal/ActivityForm.razor @@ -0,0 +1,172 @@ +@using Template.Shared.Core.Dto +@using Template.Shared.Components.Layout +@using Template.Shared.Core.Entity +@using Template.Shared.Core.Interface +@using Template.Shared.Components.Layout.Overlay +@inject IManageDataService ManageData +@inject INetworkService NetworkService +@inject IIntegryApiService IntegryApiService + + + + + +
+
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+ +
+
+ Inizio + + +
+ +
+ +
+ Fine + + +
+ +
+ +
+ Avviso + + +
+
+ +
+
+ Assegnata a + + + @foreach (var user in Users) + { + @user.FullName + } + +
+ +
+ +
+ Tipo + + + @foreach (var type in ActivityType) + { + @type.ActivityTypeId + } + +
+ +
+ +
+ Esito + + + @foreach (var result in ActivityResult) + { + @result.ActivityResultId + } + +
+
+ +
+ +
+
+
+
+ + + +@code { + [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } + + [Parameter] public string? Id { get; set; } + + private ActivityDTO OriginalModel { get; set; } = new(); + private ActivityDTO ActivityModel { get; set; } = new(); + + private List ActivityResult { get; set; } = []; + private List ActivityType { get; set; } = []; + private List Users { get; set; } = []; + + private bool IsNew => Id.IsNullOrEmpty(); + private bool IsView => !IsNew && !NetworkService.IsNetworkAvailable(); + + private string? LabelSave { get; set; } + + //Overlay for save + private bool VisibleOverlay { get; set; } + private bool SuccessAnimation { get; set; } + + protected override async Task OnInitializedAsync() + { + _ = LoadData(); + + LabelSave = IsNew ? "Aggiungi" : null; + + if (!Id.IsNullOrEmpty()) + ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last(); + + if (IsNew) + { + ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour)); + ActivityModel.EstimatedEndtime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour) + TimeSpan.FromHours(1)); + } + + OriginalModel = ActivityModel.Clone(); + } + + private async Task Save() + { + VisibleOverlay = true; + StateHasChanged(); + + var newActivity = await IntegryApiService.SaveActivity(ActivityModel); + await ManageData.InsertOrUpdate(newActivity); + + SuccessAnimation = true; + StateHasChanged(); + + await Task.Delay(1250); + + MudDialog.Close(newActivity); + } + + private async Task LoadData() + { + Users = await ManageData.GetTable(); + ActivityResult = await ManageData.GetTable(); + ActivityType = await ManageData.GetTable(x => x.FlagTipologia.Equals("A")); + } + + private void OnAfterChangeValue() + { + LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null; + + StateHasChanged(); + } + +} \ No newline at end of file diff --git a/Template.Shared/Components/SingleElements/Modal/ActivityForm.razor.css b/Template.Shared/Components/SingleElements/Modal/ActivityForm.razor.css new file mode 100644 index 0000000..e69de29 diff --git a/Template.Shared/Core/Dto/ActivityDTO.cs b/Template.Shared/Core/Dto/ActivityDTO.cs index 3f148e9..1a70690 100644 --- a/Template.Shared/Core/Dto/ActivityDTO.cs +++ b/Template.Shared/Core/Dto/ActivityDTO.cs @@ -10,88 +10,89 @@ public class ActivityDTO : StbActivity public ActivityCategoryEnum Category { get; set; } public bool Complete { get; set; } - private sealed class ActivityDtoEqualityComparer : IEqualityComparer - { - public bool Equals(ActivityDTO? x, ActivityDTO? y) - { - if (ReferenceEquals(x, y)) return true; - if (x is null) return false; - if (y is null) return false; - if (x.GetType() != y.GetType()) return false; - return x.ActivityId == y.ActivityId && x.ActivityResultId == y.ActivityResultId && x.ActivityTypeId == y.ActivityTypeId && x.DataInsAct.Equals(y.DataInsAct) && x.ActivityDescription == y.ActivityDescription && x.ParentActivityId == y.ParentActivityId && x.TipoAnag == y.TipoAnag && x.CodAnag == y.CodAnag && x.CodJcom == y.CodJcom && x.CodJfas == y.CodJfas && Nullable.Equals(x.EstimatedDate, y.EstimatedDate) && Nullable.Equals(x.EstimatedTime, y.EstimatedTime) && Nullable.Equals(x.AlarmDate, y.AlarmDate) && Nullable.Equals(x.AlarmTime, y.AlarmTime) && Nullable.Equals(x.EffectiveDate, y.EffectiveDate) && Nullable.Equals(x.EffectiveTime, y.EffectiveTime) && x.ResultDescription == y.ResultDescription && Nullable.Equals(x.EstimatedEnddate, y.EstimatedEnddate) && Nullable.Equals(x.EstimatedEndtime, y.EstimatedEndtime) && Nullable.Equals(x.EffectiveEnddate, y.EffectiveEnddate) && Nullable.Equals(x.EffectiveEndtime, y.EffectiveEndtime) && x.UserCreator == y.UserCreator && x.UserName == y.UserName && Nullable.Equals(x.PercComp, y.PercComp) && Nullable.Equals(x.EstimatedHours, y.EstimatedHours) && x.CodMart == y.CodMart && x.PartitaMag == y.PartitaMag && x.Matricola == y.Matricola && x.Priorita == y.Priorita && Nullable.Equals(x.ActivityPlayCounter, y.ActivityPlayCounter) && x.ActivityEvent == y.ActivityEvent && x.Guarantee == y.Guarantee && x.Note == y.Note && x.Rfid == y.Rfid && x.IdLotto == y.IdLotto && x.PersonaRif == y.PersonaRif && x.HrNum == y.HrNum && x.Gestione == y.Gestione && Nullable.Equals(x.DataOrd, y.DataOrd) && x.NumOrd == y.NumOrd && x.IdStep == y.IdStep && x.IdRiga == y.IdRiga && Nullable.Equals(x.OraInsAct, y.OraInsAct) && x.IndiceGradimento == y.IndiceGradimento && x.NoteGradimento == y.NoteGradimento && x.FlagRisolto == y.FlagRisolto && x.FlagTipologia == y.FlagTipologia && x.OreRapportino == y.OreRapportino && x.UserModifier == y.UserModifier && Nullable.Equals(x.OraModAct, y.OraModAct) && Nullable.Equals(x.OraViewAct, y.OraViewAct) && x.CodVdes == y.CodVdes && x.CodCmac == y.CodCmac && x.WrikeId == y.WrikeId && x.CodMgrp == y.CodMgrp && x.PlanId == y.PlanId && x.Commessa == y.Commessa && x.Cliente == y.Cliente && x.Category == y.Category && x.Complete == y.Complete; - } - - public int GetHashCode(ActivityDTO obj) - { - var hashCode = new HashCode(); - hashCode.Add(obj.ActivityId); - hashCode.Add(obj.ActivityResultId); - hashCode.Add(obj.ActivityTypeId); - hashCode.Add(obj.DataInsAct); - hashCode.Add(obj.ActivityDescription); - hashCode.Add(obj.ParentActivityId); - hashCode.Add(obj.TipoAnag); - hashCode.Add(obj.CodAnag); - hashCode.Add(obj.CodJcom); - hashCode.Add(obj.CodJfas); - hashCode.Add(obj.EstimatedDate); - hashCode.Add(obj.EstimatedTime); - hashCode.Add(obj.AlarmDate); - hashCode.Add(obj.AlarmTime); - hashCode.Add(obj.EffectiveDate); - hashCode.Add(obj.EffectiveTime); - hashCode.Add(obj.ResultDescription); - hashCode.Add(obj.EstimatedEnddate); - hashCode.Add(obj.EstimatedEndtime); - hashCode.Add(obj.EffectiveEnddate); - hashCode.Add(obj.EffectiveEndtime); - hashCode.Add(obj.UserCreator); - hashCode.Add(obj.UserName); - hashCode.Add(obj.PercComp); - hashCode.Add(obj.EstimatedHours); - hashCode.Add(obj.CodMart); - hashCode.Add(obj.PartitaMag); - hashCode.Add(obj.Matricola); - hashCode.Add(obj.Priorita); - hashCode.Add(obj.ActivityPlayCounter); - hashCode.Add(obj.ActivityEvent); - hashCode.Add(obj.Guarantee); - hashCode.Add(obj.Note); - hashCode.Add(obj.Rfid); - hashCode.Add(obj.IdLotto); - hashCode.Add(obj.PersonaRif); - hashCode.Add(obj.HrNum); - hashCode.Add(obj.Gestione); - hashCode.Add(obj.DataOrd); - hashCode.Add(obj.NumOrd); - hashCode.Add(obj.IdStep); - hashCode.Add(obj.IdRiga); - hashCode.Add(obj.OraInsAct); - hashCode.Add(obj.IndiceGradimento); - hashCode.Add(obj.NoteGradimento); - hashCode.Add(obj.FlagRisolto); - hashCode.Add(obj.FlagTipologia); - hashCode.Add(obj.OreRapportino); - hashCode.Add(obj.UserModifier); - hashCode.Add(obj.OraModAct); - hashCode.Add(obj.OraViewAct); - hashCode.Add(obj.CodVdes); - hashCode.Add(obj.CodCmac); - hashCode.Add(obj.WrikeId); - hashCode.Add(obj.CodMgrp); - hashCode.Add(obj.PlanId); - hashCode.Add(obj.Commessa); - hashCode.Add(obj.Cliente); - hashCode.Add((int)obj.Category); - hashCode.Add(obj.Complete); - return hashCode.ToHashCode(); - } - } - - public static IEqualityComparer ActivityDtoComparer { get; } = new ActivityDtoEqualityComparer(); - public ActivityDTO Clone() { return (ActivityDTO)MemberwiseClone(); } + + private bool Equals(ActivityDTO other) + { + return Commessa == other.Commessa && + Cliente == other.Cliente && + 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; + } + + public override bool Equals(object? obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals((ActivityDTO)obj); + } + + public override int GetHashCode() + { + var hashCode = new HashCode(); + hashCode.Add(ActivityId); + hashCode.Add(ActivityResultId); + hashCode.Add(ActivityTypeId); + hashCode.Add(DataInsAct); + hashCode.Add(ActivityDescription); + hashCode.Add(ParentActivityId); + hashCode.Add(TipoAnag); + 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); + hashCode.Add(PercComp); + hashCode.Add(EstimatedHours); + hashCode.Add(CodMart); + hashCode.Add(PartitaMag); + hashCode.Add(Matricola); + hashCode.Add(Priorita); + hashCode.Add(ActivityPlayCounter); + hashCode.Add(ActivityEvent); + hashCode.Add(Guarantee); + hashCode.Add(Note); + hashCode.Add(Rfid); + hashCode.Add(IdLotto); + hashCode.Add(PersonaRif); + hashCode.Add(HrNum); + hashCode.Add(Gestione); + hashCode.Add(DataOrd); + hashCode.Add(NumOrd); + hashCode.Add(IdStep); + hashCode.Add(IdRiga); + hashCode.Add(OraInsAct); + hashCode.Add(IndiceGradimento); + hashCode.Add(NoteGradimento); + hashCode.Add(FlagRisolto); + hashCode.Add(FlagTipologia); + hashCode.Add(OreRapportino); + hashCode.Add(UserModifier); + hashCode.Add(OraModAct); + hashCode.Add(OraViewAct); + hashCode.Add(CodVdes); + hashCode.Add(CodCmac); + hashCode.Add(WrikeId); + hashCode.Add(CodMgrp); + hashCode.Add(PlanId); + hashCode.Add(Commessa); + hashCode.Add(Cliente); + hashCode.Add(Category); + hashCode.Add(Complete); + return hashCode.ToHashCode(); + } } \ No newline at end of file diff --git a/Template.Shared/Core/Dto/ActivityResultDTO.cs b/Template.Shared/Core/Dto/ActivityResultDTO.cs deleted file mode 100644 index ef5c419..0000000 --- a/Template.Shared/Core/Dto/ActivityResultDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Template.Shared.Core.Dto; - -public class ActivityResultDTO -{ - public string ActivityResultId { get; set; } -} \ No newline at end of file diff --git a/Template.Shared/Core/Dto/FilterActivityDTO.cs b/Template.Shared/Core/Dto/FilterActivityDTO.cs new file mode 100644 index 0000000..ff9f131 --- /dev/null +++ b/Template.Shared/Core/Dto/FilterActivityDTO.cs @@ -0,0 +1,20 @@ +using Template.Shared.Core.Helpers; +using Template.Shared.Core.Helpers.Enum; + +namespace Template.Shared.Core.Dto; + +public class FilterActivityDTO +{ + public string? Text { get; set; } + public IEnumerable? User { get; set; } + public string? Type { get; set; } + public string? Result { get; set; } + public ActivityCategoryEnum? Category { get; set; } + + public bool ClearFilter => + Text.IsNullOrEmpty() && + User.IsNullOrEmpty() && + Type.IsNullOrEmpty() && + Result.IsNullOrEmpty() && + Category == null; +} \ No newline at end of file diff --git a/Template.Shared/Core/Dto/SettingsResponseDTO.cs b/Template.Shared/Core/Dto/SettingsResponseDTO.cs new file mode 100644 index 0000000..77cbc38 --- /dev/null +++ b/Template.Shared/Core/Dto/SettingsResponseDTO.cs @@ -0,0 +1,16 @@ +using System.Text.Json.Serialization; +using Template.Shared.Core.Entity; + +namespace Template.Shared.Core.Dto; + +public class SettingsResponseDTO +{ + [JsonPropertyName("activityTypes")] + public List? ActivityTypes { get; set; } + + [JsonPropertyName("activityResults")] + public List? ActivityResults { get; set; } + + [JsonPropertyName("stbUsers")] + public List? StbUsers { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/StbActivityResult.cs b/Template.Shared/Core/Entity/StbActivityResult.cs new file mode 100644 index 0000000..7b725ad --- /dev/null +++ b/Template.Shared/Core/Entity/StbActivityResult.cs @@ -0,0 +1,32 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("stb_activity_result")] +public class StbActivityResult +{ + [PrimaryKey, Column("activity_result_id"), JsonPropertyName("activityResultId")] + public string ActivityResultId { get; set; } + + [Column("path_icona"), JsonPropertyName("pathIcona")] + public string? PathIcona { get; set; } + + [Column("flag_save_rap_lav"), JsonPropertyName("flagSaveRapLav")] + public string FlagSaveRapLav { get; set; } = "N"; + + [Column("flag_activity_result"), JsonPropertyName("flagActivityResult")] + public int? FlagActivityResult { get; set; } = 1; + + [Column("flag_insert_activity"), JsonPropertyName("flagInsertActivity")] + public string FlagInsertActivity { get; set; } = "N"; + + [Column("flag_attivo"), JsonPropertyName("flagAttivo")] + public string FlagAttivo { get; set; } = "S"; + + [Column("flag_invio_notifica"), JsonPropertyName("flagInvioNotifica")] + public string FlagInvioNotifica { get; set; } = "N"; + + [Column("flag_stato_attivita"), JsonPropertyName("flagStatoAttivita")] + public string FlagStatoAttivita { get; set; } = "N"; +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/StbActivityType.cs b/Template.Shared/Core/Entity/StbActivityType.cs new file mode 100644 index 0000000..308b85c --- /dev/null +++ b/Template.Shared/Core/Entity/StbActivityType.cs @@ -0,0 +1,41 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("stb_activity_type")] +public class StbActivityType +{ + [Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)] + public string ActivityTypeId { get; set; } + + [Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)] + public string FlagTipologia { get; set; } + + [Column("estimated_duration"), JsonPropertyName("estimatedDuration")] + public double? EstimatedDuration { get; set; } = 0; + + [Column("link_gest"), JsonPropertyName("linkGest")] + public string? LinkGest { get; set; } + + [Column("cod_jfas"), JsonPropertyName("codJfas")] + public string? CodJfas { get; set; } + + [Column("user_name"), JsonPropertyName("userName")] + public string? UserName { get; set; } + + [Column("flag_sal"), JsonPropertyName("flagSal")] + public string FlagSal { get; set; } = "N"; + + [Column("flag_set_alarm"), JsonPropertyName("flagSetAlarm")] + public string FlagSetAlarm { get; set; } = "N"; + + [Column("flag_attiva"), JsonPropertyName("flagAttiva")] + public string FlagAttiva { get; set; } = "S"; + + [Column("flag_generate_mov"), JsonPropertyName("flagGenerateMov")] + public string FlagGenerateMov { get; set; } = "S"; + + [Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")] + public bool FlagViewCalendar { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Entity/StbUser.cs b/Template.Shared/Core/Entity/StbUser.cs new file mode 100644 index 0000000..83a4929 --- /dev/null +++ b/Template.Shared/Core/Entity/StbUser.cs @@ -0,0 +1,14 @@ +using SQLite; +using System.Text.Json.Serialization; + +namespace Template.Shared.Core.Entity; + +[Table("stb_user")] +public class StbUser +{ + [PrimaryKey, Column("user_name"), JsonPropertyName("userName")] + public string UserName { get; set; } + + [Column("full_name"), JsonPropertyName("fullName")] + public string FullName { get; set; } +} \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs b/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs index 6036232..4b83a56 100644 --- a/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs +++ b/Template.Shared/Core/Helpers/ActivityCategoryHelper.cs @@ -4,14 +4,21 @@ namespace Template.Shared.Core.Helpers; public static class ActivityCategoryHelper { - public static string ConvertToHumanReadable(this ActivityCategoryEnum activityType) + public static string ConvertToHumanReadable(this ActivityCategoryEnum activityCategory) { - return activityType switch + return activityCategory switch { ActivityCategoryEnum.Memo => "memo", ActivityCategoryEnum.Interna => "interna", ActivityCategoryEnum.Commessa => "commessa", - _ => throw new ArgumentOutOfRangeException(nameof(activityType), activityType, null) + _ => throw new ArgumentOutOfRangeException(nameof(activityCategory), activityCategory, null) }; } + + public static List AllActivityCategory => + [ + ActivityCategoryEnum.Memo, + ActivityCategoryEnum.Interna, + ActivityCategoryEnum.Commessa + ]; } \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs b/Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs deleted file mode 100644 index e972ec4..0000000 --- a/Template.Shared/Core/Helpers/Enum/ActivityStatusEnum.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Template.Shared.Core.Helpers.Enum; - -public enum ActivityStatusEnum -{ - -} \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/ModalHelpers.cs b/Template.Shared/Core/Helpers/ModalHelpers.cs index c23f6ae..633113a 100644 --- a/Template.Shared/Core/Helpers/ModalHelpers.cs +++ b/Template.Shared/Core/Helpers/ModalHelpers.cs @@ -1,16 +1,17 @@ using MudBlazor; -using Template.Shared.Components.Pages; +using Template.Shared.Components.SingleElements.Modal; namespace Template.Shared.Core.Helpers; public class ModalHelpers { - public static Task OpenActivityForm(IDialogService dialog ,string? id = null) => - dialog.ShowAsync( + public static async Task OpenActivityForm(IDialogService dialog, string? id = null) + { + var modal = await dialog.ShowAsync( "Activity form", new DialogParameters { - { x => x.Id, id} + { x => x.Id, id } }, new DialogOptions { @@ -19,4 +20,7 @@ public class ModalHelpers NoHeader = true } ); + + return await modal.Result; + } } \ No newline at end of file diff --git a/Template.Shared/Core/Helpers/ObjectExtensions.cs b/Template.Shared/Core/Helpers/ObjectExtensions.cs index 59ec9e8..81a0e38 100644 --- a/Template.Shared/Core/Helpers/ObjectExtensions.cs +++ b/Template.Shared/Core/Helpers/ObjectExtensions.cs @@ -10,4 +10,10 @@ public static class ObjectExtensions public static bool IsNullOrEmpty(this string? obj) => string.IsNullOrEmpty(obj); -} + + public static bool EqualsIgnoreCase(this string obj, string anotherString) => + string.Equals(obj, anotherString, StringComparison.OrdinalIgnoreCase); + + public static bool ContainsIgnoreCase(this string obj, string anotherString) => + obj.Contains(anotherString, StringComparison.OrdinalIgnoreCase); +} \ No newline at end of file diff --git a/Template.Shared/Core/Interface/IIntegryApiService.cs b/Template.Shared/Core/Interface/IIntegryApiService.cs index 1fbae51..363442c 100644 --- a/Template.Shared/Core/Interface/IIntegryApiService.cs +++ b/Template.Shared/Core/Interface/IIntegryApiService.cs @@ -5,8 +5,11 @@ 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); + Task?> RetrieveActivity(string? dateFilter = null); + Task?> RetrieveAllCommesse(string? dateFilter = null); + Task RetrieveAnagClie(string? dateFilter = null); + Task RetrieveProspect(string? dateFilter = null); + Task RetrieveSettings(); + + Task SaveActivity(ActivityDTO activity); } \ No newline at end of file diff --git a/Template.Shared/Core/Interface/IManageDataService.cs b/Template.Shared/Core/Interface/IManageDataService.cs index 333a46d..629d5fe 100644 --- a/Template.Shared/Core/Interface/IManageDataService.cs +++ b/Template.Shared/Core/Interface/IManageDataService.cs @@ -6,15 +6,10 @@ 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> GetTable(Expression>? whereCond = null) where T : new(); Task> GetActivity(Expression>? whereCond = null); + Task InsertOrUpdate(T objectToSave); + Task ClearDb(); } \ No newline at end of file diff --git a/Template.Shared/Core/Interface/ISyncDbService.cs b/Template.Shared/Core/Interface/ISyncDbService.cs index fdcce29..5bee2f6 100644 --- a/Template.Shared/Core/Interface/ISyncDbService.cs +++ b/Template.Shared/Core/Interface/ISyncDbService.cs @@ -6,4 +6,5 @@ public interface ISyncDbService Task GetAndSaveCommesse(string? dateFilter = null); Task GetAndSaveProspect(string? dateFilter = null); Task GetAndSaveClienti(string? dateFilter = null); + Task GetAndSaveSettings(string? dateFilter = null); } \ No newline at end of file diff --git a/Template.Shared/Core/Services/IntegryApiService.cs b/Template.Shared/Core/Services/IntegryApiService.cs index ed65407..cd621f1 100644 --- a/Template.Shared/Core/Services/IntegryApiService.cs +++ b/Template.Shared/Core/Services/IntegryApiService.cs @@ -9,14 +9,14 @@ namespace Template.Shared.Core.Services; public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession) : IIntegryApiService { - public Task?> GetActivity(string? dateFilter) + public Task?> RetrieveActivity(string? dateFilter) { var queryParams = new Dictionary { { "dateFilter", dateFilter ?? "2020-01-01" } }; - return integryApiRestClient.AuthorizedGet?>("getActivityCrm", queryParams); + return integryApiRestClient.AuthorizedGet?>("crm/retrieveActivity", queryParams); } - public Task?> GetAllCommesse(string? dateFilter) + public Task?> RetrieveAllCommesse(string? dateFilter) { var queryParams = new Dictionary(); @@ -25,10 +25,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser queryParams.Add("dateFilter", dateFilter); } - return integryApiRestClient.AuthorizedGet?>("getCommesseCrm", queryParams); + return integryApiRestClient.AuthorizedGet?>("crm/retrieveCommesse", queryParams); } - public Task GetAnagClie(string? dateFilter) + public Task RetrieveAnagClie(string? dateFilter) { var queryParams = new Dictionary(); @@ -37,10 +37,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser queryParams.Add("dateFilter", dateFilter); } - return integryApiRestClient.AuthorizedGet("getAnagClieCrm", queryParams)!; + return integryApiRestClient.AuthorizedGet("crm/retrieveClienti", queryParams)!; } - public Task GetProspect(string? dateFilter) + public Task RetrieveProspect(string? dateFilter) { var queryParams = new Dictionary(); @@ -49,6 +49,12 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser queryParams.Add("dateFilter", dateFilter); } - return integryApiRestClient.AuthorizedGet("getProspectCrm", queryParams)!; + return integryApiRestClient.AuthorizedGet("crm/retrieveProspect", queryParams)!; } + + public Task RetrieveSettings() => + integryApiRestClient.AuthorizedGet("crm/retrieveSettings", null)!; + + public Task SaveActivity(ActivityDTO activity) => + integryApiRestClient.AuthorizedPost("crm/saveActivity", activity); } \ No newline at end of file diff --git a/Template.Shared/wwwroot/css/app.css b/Template.Shared/wwwroot/css/app.css index b0eeb97..3806bc2 100644 --- a/Template.Shared/wwwroot/css/app.css +++ b/Template.Shared/wwwroot/css/app.css @@ -131,7 +131,54 @@ h1:focus { outline: none; } .flex-column, .navbar-brand { padding-left: env(safe-area-inset-left); } } +/*Spinner*/ + +.spinner-container { + display: flex; + justify-content: center; + height: 100vh; + align-items: center; + color: var(--mud-palette-primary); +} + +.not-fullScreen { + height: auto !important; + padding: 2rem 0 !important; +} + +.loader { + width: 50px; + aspect-ratio: 1; + border-radius: 50%; + border: 8px solid #0000; + border-right-color: var(--mud-palette-secondary); + position: relative; + animation: l24 1s infinite linear; +} + +.loader:before, +.loader:after { + content: ""; + position: absolute; + inset: -8px; + border-radius: 50%; + border: inherit; + animation: inherit; + animation-duration: 2s; +} + +.loader:after { + animation-duration: 4s; +} + +@keyframes l24 { + 100% { + transform: rotate(1turn) + } +} + /*MudBlazor Personalization*/ + .mud-button-group-horizontal:not(.mud-button-group-rtl) > .mud-button-root:not(:last-child), .mud-button-group-horizontal:not(.mud-button-group-rtl) > :not(:last-child) .mud-button-root { border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; @@ -145,4 +192,44 @@ h1:focus { outline: none; } .customDialog-form .mud-dialog-content { padding: 0 .75rem; margin: 0; +} + +.custom-item-select { + padding: 6px 16px; +} + +.custom-item-select .mud-typography-body1 { + font-weight: 600; + font-size: .9rem; +} + +@supports (-webkit-touch-callout: none) { + .status-bar-safe-area { + display: flex; + position: fixed; + top: 0; + height: env(safe-area-inset-top); + background-color: #f7f7f7; + width: 100%; + z-index: 1; + background-color: var(--primary-color); + } + + .modal { + padding-top: env(safe-area-inset-top); + } + + article { + padding-top: 3rem !important; + padding-bottom: calc(7rem + env(safe-area-inset-bottom)) !important; + } + + #app { + padding-top: env(safe-area-inset-top); + height: 100vh; + } + + .flex-column, .navbar-brand { + padding-left: env(safe-area-inset-left); + } } \ No newline at end of file diff --git a/Template.Shared/wwwroot/css/default-theme.css b/Template.Shared/wwwroot/css/default-theme.css index 72fb0b8..2b48cfb 100644 --- a/Template.Shared/wwwroot/css/default-theme.css +++ b/Template.Shared/wwwroot/css/default-theme.css @@ -5,4 +5,5 @@ /*Utility*/ --card-shadow: 5px 5px 10px 0 var(--gray-for-shadow); --custom-box-shadow: 1px 2px 5px rgba(165, 165, 165, 0.5); -} \ No newline at end of file + --mud-default-borderradius: 12px !important; +} diff --git a/Template.Shared/wwwroot/css/form.css b/Template.Shared/wwwroot/css/form.css new file mode 100644 index 0000000..8e60900 --- /dev/null +++ b/Template.Shared/wwwroot/css/form.css @@ -0,0 +1,80 @@ +.title { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 1rem; +} + +.customDialog-form .content { + height: calc(100vh - (.6rem + 40px)); + overflow: auto; + -ms-overflow-style: none; + scrollbar-width: none; +} + +.customDialog-form .header { padding: 0 !important; } + +.customDialog-form .content::-webkit-scrollbar { display: none; } + +.input-card { + width: 100%; + background: var(--mud-palette-background-gray); + border-radius: 9px; + padding: .5rem 1rem; + margin-bottom: 1.5rem; +} + +.input-card.clearButton { + display: flex; + align-items: center; + justify-content: space-between; + padding: .4rem 1rem !important; +} + +.input-card > .divider { margin: 0 !important; } + +.form-container { + display: flex; + justify-content: space-between; + align-items: center; + min-height: 35px; +} + +.form-container > span { + font-weight: 600; + width: 50%; + margin-right: .3rem; +} + +.form-container > .disable-full-width { width: unset !important; } + +.dateTime-picker { + display: flex; + gap: .3rem; + flex-direction: row; + align-items: center; +} + +/*Custom mudBlazor*/ + +.form-container .mud-input.mud-input-underline:before { border-bottom: none !important; } + +.form-container .mud-input.mud-input-underline:after { border-bottom: none !important; } + +.form-container.text-align-end .mud-input-slot { text-align: end; } + +.input-card .mud-input.mud-input-underline:before { border-bottom: none !important; } + +.input-card .mud-input.mud-input-underline:after { border-bottom: none !important; } + +.form-container .customIcon-select .mud-icon-root.mud-svg-icon { + rotate: 90deg !important; + font-size: 1.1rem; +} + +.form-container .customIcon-select .mud-input-slot { text-align: end; } + +.input-card .mud-input { + width: 100%; + font-weight: 500; +} \ No newline at end of file diff --git a/Template.Web/Core/Services/ManageDataService.cs b/Template.Web/Core/Services/ManageDataService.cs index ee4ac82..b8d2cd6 100644 --- a/Template.Web/Core/Services/ManageDataService.cs +++ b/Template.Web/Core/Services/ManageDataService.cs @@ -7,37 +7,7 @@ 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) + public Task> GetTable(Expression>? whereCond = null) where T : new() { throw new NotImplementedException(); } @@ -47,6 +17,11 @@ public class ManageDataService : IManageDataService throw new NotImplementedException(); } + public Task InsertOrUpdate(T objectToSave) + { + throw new NotImplementedException(); + } + public Task ClearDb() { throw new NotImplementedException(); diff --git a/Template.Web/Core/Services/SyncDbService.cs b/Template.Web/Core/Services/SyncDbService.cs index fb9381f..3ff1fda 100644 --- a/Template.Web/Core/Services/SyncDbService.cs +++ b/Template.Web/Core/Services/SyncDbService.cs @@ -23,4 +23,9 @@ public class SyncDbService : ISyncDbService { throw new NotImplementedException(); } + + public Task GetAndSaveSettings(string? dateFilter = null) + { + throw new NotImplementedException(); + } } \ No newline at end of file