22 Commits

Author SHA1 Message Date
ddc596ef58 Native navigation 2025-07-02 14:12:39 +02:00
ddbf9c832e Fix searchBox users 2025-07-02 10:32:01 +02:00
201cfd4bc6 Finish v1.0.0(3) 2025-06-30 15:57:41 +02:00
87264cf3aa -> v1.0.0 (3) 2025-06-30 15:57:32 +02:00
dba3cd0357 Fix 2025-06-30 15:56:46 +02:00
516fcca7cb Finish v1.0.0(2) 2025-06-30 15:50:04 +02:00
453e291827 Finish v1.0.0(2) 2025-06-30 15:50:03 +02:00
443ed95013 -> v1.0.0 (2) 2025-06-30 15:49:58 +02:00
a28b8e2f6c Finish v1.0.0(1) 2025-06-30 15:47:47 +02:00
108fa715f0 Finish v1.0.0(1) 2025-06-30 15:47:45 +02:00
3ad3ec23f0 Fix vari 2025-06-30 15:46:11 +02:00
3f2b7a6bb5 Rename salesbook 2025-06-26 10:08:21 +02:00
a34e673cd2 Cancellazione attività 2025-06-26 09:26:50 +02:00
10c1435dba Vario 2025-06-24 10:56:02 +02:00
a97df74ef4 Migliorie form inserimento 2025-06-20 10:58:58 +02:00
6c789a099e Fix filtri 2025-06-20 09:02:17 +02:00
7f8dae7c7d Non si deve poter inserire un esito su un’attività non assegnata all’utente loggato 2025-06-20 08:59:10 +02:00
51a4c7a971 Iniziata creazione pagina contatti 2025-06-20 08:55:30 +02:00
4608c6764b Aggiunta modifica esito 2025-06-17 14:57:21 +02:00
6600660315 Miglioramenti UI 2025-06-17 12:58:12 +02:00
d6c7742501 Vario 2025-06-16 17:38:48 +02:00
3a374baaba Adeguamento ui per ios 2025-06-16 16:04:55 +02:00
193 changed files with 3427 additions and 1545 deletions

View File

@@ -1,15 +0,0 @@
namespace Template.Maui
{
public partial class App : Application
{
public App()
{
InitializeComponent();
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new MainPage());
}
}
}

View File

@@ -1,20 +0,0 @@
using CommunityToolkit.Mvvm.Messaging;
using Template.Shared.Core.Messages;
namespace Template.Maui
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
protected override bool OnBackButtonPressed()
{
WeakReferenceMessenger.Default.Send(new HardwareBackMessage("back"));
return true;
}
}
}

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
</resources>

View File

@@ -1,17 +0,0 @@
using System;
using Microsoft.Maui;
using Microsoft.Maui.Hosting;
namespace Template.Maui
{
internal class Program : MauiApplication
{
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
}

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="8" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="maui-application-id-placeholder" exec="Template.Maui.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>maui-application-title-placeholder</label>
<icon>maui-appicon-placeholder</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/internet</privilege>
</privileges>
<dependencies />
<provides-appdefined-privileges />
</manifest>

View File

@@ -1,8 +0,0 @@
<maui:MauiWinUIApplication
x:Class="Template.Maui.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:Template.Maui.WinUI">
</maui:MauiWinUIApplication>

View File

@@ -1,25 +0,0 @@
using Microsoft.UI.Xaml;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Template.Maui.WinUI
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : MauiWinUIApplication
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}

View File

@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap rescap">
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
<mp:PhoneIdentity PhoneProductId="725421B6-1171-41CC-BE20-94A305E6285E" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
<Properties>
<DisplayName>$placeholder$</DisplayName>
<PublisherDisplayName>User Name</PublisherDisplayName>
<Logo>$placeholder$.png</Logo>
</Properties>
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
<uap:VisualElements
DisplayName="$placeholder$"
Description="$placeholder$"
Square150x150Logo="$placeholder$.png"
Square44x44Logo="$placeholder$.png"
BackgroundColor="transparent">
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
<uap:SplashScreen Image="$placeholder$.png" />
</uap:VisualElements>
</Application>
</Applications>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
</Package>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="Template.Maui.WinUI.app"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect:
1) Per-Monitor for >= Windows 10 Anniversary Update
2) System < Windows 10 Anniversary Update
-->
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>
</assembly>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="456" height="456" fill="#512BD4" />
</svg>

Before

Width:  |  Height:  |  Size: 229 B

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,58 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
<title>Template.Maui</title>
<base href="/"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
<link href="_content/Template.Shared/css/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="_content/Template.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="_content/Template.Shared/css/remixicon/remixicon.css"/>
<link rel="stylesheet" href="_content/Template.Shared/css/app.css"/>
<link rel="stylesheet" href="_content/Template.Shared/css/form.css"/>
<link rel="stylesheet" href="_content/Template.Shared/css/default-theme.css"/>
<link rel="stylesheet" href="Template.Maui.styles.css"/>
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div class="status-bar-safe-area"></div>
<div id="app">
<div class="spinner-container">
<span class="loader"></span>
</div>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webview.js" autostart="false"></script>
<script src="_content/Template.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
<!-- Add chart.js reference if chart components are used in your application. -->
<!--<script src="_content/Template.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
<!--<script src="_content/Template.Shared/js/bootstrap/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
<!-- Add sortable.js reference if SortableList component is used in your application. -->
<!--<script src="_content/Template.Shared/js/bootstrap/Sortable.min.js"></script>-->
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
<script src="_content/Template.Shared/js/main.js"></script>
<script src="_content/Template.Shared/js/calendar.js"></script>
<script src="_content/Template.Shared/js/bottomSheet.js"></script>
</body>
</html>

View File

@@ -1,41 +0,0 @@
@using Template.Shared.Core.Messages
@inherits LayoutComponentBase
@inject IJSRuntime JS
@inject BackNavigationService BackService
<MudThemeProvider Theme="_currentTheme" />
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />
<div class="page">
<NavMenu />
<main>
<article>
@Body
</article>
</main>
</div>
@code {
private readonly MudTheme _currentTheme = new()
{
PaletteLight = new PaletteLight()
{
Primary = "#ABA9BF",
Secondary = "#BEB7DF",
Tertiary = "#B2FDAD"
}
};
protected override void OnInitialized()
{
BackService.OnHardwareBack += async () =>
{
await JS.InvokeVoidAsync("goBack");
};
}
}

View File

@@ -1,75 +0,0 @@
@inject IDialogService Dialog
@if (IsVisible)
{
<nav class="navbar navbar-expand justify-content-center">
<div class="container-navbar">
<ul class="navbar-nav nav-justified align-items-center w-100 text-center">
<li class="nav-item">
<NavLink class="nav-link" href="Users" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-group-line"></i>
@* <span>Contatti</span> *@
</div>
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Calendar" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-calendar-todo-line"></i>
@* <span>Agenda</span> *@
</div>
</NavLink>
</li>
<li class="nav-item plus-button">
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopCenter" TransformOrigin="Origin.BottomCenter">
<ActivatorContent>
<MudFab Class="custom-plus-button" Color="Color.Primary" Size="Size.Medium" IconSize="Size.Medium" StartIcon="@Icons.Material.Filled.Add"/>
</ActivatorContent>
<ChildContent>
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
<MudMenuItem OnClick="() => ModalHelpers.OpenActivityForm(Dialog)">Nuova attivit<69></MudMenuItem>
</ChildContent>
</MudMenu>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Notification" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-notification-4-line"></i>
</div>
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="PersonalInfo" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-user-line"></i>
@* <span>Profilo</span> *@
</div>
</NavLink>
</li>
</ul>
</div>
</nav>
}
@code
{
private bool IsVisible { get; set; } = true;
protected override Task OnInitializedAsync()
{
NavigationManager.LocationChanged += (_, args) =>
{
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
IsVisible = new List<string> { "Calendar", "Users", "PersonalInfo" }
.Contains(location);
StateHasChanged();
};
return Task.CompletedTask;
}
}

View File

@@ -1,382 +0,0 @@
@page "/Calendar"
@using Template.Shared.Core.Dto
@using Template.Shared.Core.Interface
@using Template.Shared.Components.Layout
@using Template.Shared.Components.SingleElements
@using Template.Shared.Components.Layout.Spinner
@using Template.Shared.Components.Layout.BottomSheet
@inject IManageDataService ManageData
@inject IJSRuntime JS
<HeaderLayout Title="@CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper()"
ShowFilter="true"
ShowCalendarToggle="true"
OnFilterToggle="ToggleFilter"
OnCalendarToggle="ToggleExpanded"/>
<div @ref="weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
@if (Expanded)
{
<!-- Vista mensile -->
@foreach (var nomeGiorno in GiorniSettimana)
{
<div class="week-day">
<div>@nomeGiorno</div>
</div>
}
@foreach (var unused in Enumerable.Range(0, StartOffset))
{
<div class="day" style="visibility: hidden"></div>
}
@for (var d = 1; d <= DaysInMonth; d++)
{
var day = new DateTime(CurrentMonth.Year, CurrentMonth.Month, d);
var isSelected = IsSameDay(day, SelectedDate);
var isToday = IsSameDay(day, DateTime.Today);
var events = ReturnFilteredActivity(day);
<div class="day @(isSelected ? "selected" : (isToday ? "today" : ""))"
@onclick="() => SelezionaDataDalMese(day)">
<div>@d</div>
@if (events.Any())
{
<div class="event-dot-container" style="margin-top: 2px;">
@foreach (var cat in events.Select(x => x.Category).Distinct())
{
<div class="event-dot @cat.ConvertToHumanReadable()" title="@cat.ConvertToHumanReadable()"></div>
}
</div>
}
</div>
}
@foreach (var unused in Enumerable.Range(0, EndOffset))
{
<div class="day" style="visibility: hidden"></div>
}
}
else
{
<!-- Vista settimanale -->
@foreach (var day in DaysOfWeek)
{
var isSelected = IsSameDay(day, SelectedDate);
var isToday = IsSameDay(day, DateTime.Today);
<div class="week-day">
<div>@day.ToString("ddd", new System.Globalization.CultureInfo("it-IT"))</div>
<div class="day @(isSelected ? "selected" : (isToday ? "today" : ""))"
@onclick="() => SelezionaData(day)">
<div>@day.Day</div>
@if (ReturnFilteredActivity(day).Any())
{
<div class="event-dot-container" style="margin-top: 2px;">
@foreach (var cat in ReturnFilteredActivity(day).Select(x => x.Category).Distinct())
{
<div class="event-dot @cat.ConvertToHumanReadable()" title="@cat.ConvertToHumanReadable()"></div>
}
</div>
}
</div>
</div>
}
}
</div>
<div class="container appointments">
@if (IsLoading)
{
<SpinnerLayout FullScreen="false"/>
}
else if (FilteredActivities is { Count: > 0 })
{
<Virtualize Items="FilteredActivities" Context="activity">
<ActivityCard Activity="activity" ActivityChanged="OnActivityChanged"/>
</Virtualize>
}
else
{
<NoDataAvailable Text="Nessuna attività trovata" ImageSource="_content/Template.Shared/images/undraw_file-search_cbur.svg"/>
}
</div>
<FilterActivity @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
@code {
// Stato UI
private bool Expanded { get; set; } = false;
private string SliderAnimation { get; set; } = string.Empty;
private ElementReference weekSliderRef;
private DotNetObjectReference<Calendar>? dotNetHelper;
// Stato calendario
private DateTime SelectedDate { get; set; } = DateTime.Today;
private DateTime _internalMonth = DateTime.Today;
private DateTime CurrentMonth => new(_internalMonth.Year, _internalMonth.Month, 1);
// Stato attività
private List<ActivityDTO> MonthActivities { get; set; } = [];
private List<ActivityDTO> FilteredActivities { get; set; } = [];
private bool IsLoading { get; set; } = true;
// Supporto rendering mese
private static readonly string[] GiorniSettimana = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"];
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
{
var totalCells = (int)Math.Ceiling((DaysInMonth + StartOffset) / 7.0) * 7;
return totalCells - (DaysInMonth + StartOffset);
}
}
// Supporto rendering settimana
private IEnumerable<DateTime> DaysOfWeek
{
get
{
var start = GetStartOfWeek(SelectedDate);
return Enumerable.Range(0, 7).Select(i => start.AddDays(i));
}
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
Filter.User = new HashSet<string> { 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();
}
}
[JSInvokable]
public async Task OnSwipeLeft()
{
await CambiaPeriodo(1);
StateHasChanged();
if (Expanded)
{
await LoadMonthData();
}
}
[JSInvokable]
public async Task OnSwipeRight()
{
await CambiaPeriodo(-1);
StateHasChanged();
if (Expanded)
{
await LoadMonthData();
}
}
[JSInvokable]
public async Task OnSwipeDown()
{
if (!Expanded)
ToggleExpanded();
}
[JSInvokable]
public async Task OnSwipeUp()
{
if (Expanded)
ToggleExpanded();
}
// Cambio periodo mese/settimana
private async Task CambiaPeriodo(int direzione)
{
if (Expanded)
{
// Cambio solo il mese visualizzato, NON cambiare SelectedDate
var y = CurrentMonth.Year;
var m = CurrentMonth.Month + direzione;
if (m < 1)
{
y--;
m = 12;
}
if (m > 12)
{
y++;
m = 1;
}
_internalMonth = new DateTime(y, m, 1);
}
else
{
// Cambio settimana: aggiorno anche il giorno selezionato
await SelezionaData(SelectedDate.AddDays(7 * direzione));
_internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
}
}
// Cambio modalità
private void ToggleExpanded()
{
if (Expanded)
{
SliderAnimation = "collapse-animation";
StateHasChanged();
Expanded = false;
}
else
{
Expanded = true;
SliderAnimation = "expand-animation";
StateHasChanged();
}
SliderAnimation = "";
StateHasChanged();
}
// Caricamento attività al cambio mese
private async Task LoadMonthData()
{
IsLoading = true;
StateHasChanged();
// Carica tutte le attività del mese corrente visualizzato
var start = CurrentMonth;
var end = start.AddDays(DaysInMonth - 1);
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();
IsLoading = false;
StateHasChanged();
}
// Selezione giorno in settimana
private async Task SelezionaData(DateTime day)
{
SelectedDate = day;
StateHasChanged();
var cacheInternalMonth = _internalMonth;
_internalMonth = new DateTime(day.Year, day.Month, 1);
if (cacheInternalMonth != _internalMonth)
{
await LoadMonthData();
}
ApplyFilter();
StateHasChanged();
}
// Selezione giorno dal mese (chiude la vista mese!)
private async Task SelezionaDataDalMese(DateTime day)
{
SelectedDate = day;
ApplyFilter();
// Chiudi la vista mese e passa alla settimana, con animazione
SliderAnimation = "collapse-animation";
StateHasChanged();
Expanded = false;
_internalMonth = new DateTime(day.Year, day.Month, 1); // Sync il mese visualizzato
SliderAnimation = "";
StateHasChanged();
}
// Utility
private static bool IsSameDay(DateTime d1, DateTime d2) => d1.Date == d2.Date;
private static DateTime GetStartOfWeek(DateTime date)
{
var day = date.DayOfWeek == DayOfWeek.Sunday ? 7 : (int)date.DayOfWeek;
return date.AddDays(-day + 1).Date;
}
private List<ActivityDTO> GetEventsForDay(DateTime day)
=> MonthActivities?.Where(x => (x.EffectiveDate ?? x.EstimatedDate) == day.Date).ToList() ?? [];
public void Dispose()
{
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<ActivityDTO> 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);
}
}

View File

@@ -1,65 +0,0 @@
.center-box {
margin-top: -1.1rem !important; /* remove page padding */
}
.box-area {
width: 930px;
}
.right-box {
padding: 15px 30px 0 30px;
}
::placeholder {
font-size: 16px;
}
.rounded-4 {
border-radius: 20px;
}
.rounded-5 {
border-radius: 30px;
}
.bg-white {
background: var(--mud-palette-surface) !important;
}
.appName {
margin-top: 15px;
font-size: large;
font-weight: 900;
color: var(--mud-palette-primary)
}
.button-login {
text-align: center;
background-color: var(--mud-palette-primary);
border-radius: 6px;
padding: .3rem 2rem;
width: 100%;
font-weight: 700;
color: var(--mud-palette-appbar-text);
}
.login-footer {
display: flex;
align-items: center;
justify-content: flex-end;
}
.login-footer span {
font-size: 9px;
color: var(--mud-palette-gray-darker);
}
.login-footer img {
height: 15px;
margin-left: 4px;
}
.container > .bg-white {
box-shadow: var(--card-shadow);
border: 1px solid var(--card-border-color);
}

View File

@@ -1,155 +0,0 @@
@page "/PersonalInfo"
@attribute [Authorize]
@using Template.Shared.Components.Layout
@using Template.Shared.Core.Authorization.Enum
@using Template.Shared.Core.Interface
@using Template.Shared.Core.Services
@inject AppAuthenticationStateProvider AuthenticationStateProvider
@inject INetworkService NetworkService
@inject IFormFactor FormFactor
<HeaderLayout Title="Profilo"/>
<div class="container content">
<div class="container-primary-info">
<div class="section-primary-info">
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
@UtilityString.ExtractInitials(UserSession.User.Fullname)
</MudAvatar>
<div class="personal-info">
<span class="info-nome">@UserSession.User.Fullname</span>
@if (UserSession.User.KeyGroup is not null)
{
<span class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
}
</div>
</div>
<div class="divider"></div>
<div class="section-info">
<div class="section-personal-info">
<div>
<span class="info-title">Telefono</span>
<span class="info-text">000 0000000</span> @*Todo: to implement*@
</div>
<div>
<span class="info-title">Status</span>
@if (NetworkService.IsNetworkAvailable())
{
<div class="status online">
<i class="ri-wifi-line"></i>
<span>Online</span>
</div>
}
else
{
<div class="status offline">
<i class="ri-wifi-off-line"></i>
<span>Offline</span>
</div>
}
</div>
</div>
<div class="section-personal-info">
<div>
<span class="info-title">E-mail</span>
<span class="info-text">
@if (string.IsNullOrEmpty(UserSession.User.Email))
{
@("Nessuna mail configurata")
}
else
{
@UserSession.User.Email
}
</span>
</div>
<div>
<span class="info-title">Ultima sincronizzazione</span>
<span class="info-text">@LastSync.ToString("g")</span>
</div>
</div>
</div>
</div>
<div class="container-button">
<MudButton Class="button-settings green-icon"
FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium"
OnClick="() => UpdateDb(true)"
Variant="Variant.Outlined">
Sincronizza
</MudButton>
<div class="divider"></div>
<MudButton Class="button-settings red-icon"
FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium"
OnClick="() => UpdateDb()"
Variant="Variant.Outlined">
Ripristina dati
</MudButton>
</div>
<div class="container-button">
<MudButton Class="button-settings exit"
FullWidth="true"
Color="Color.Error"
Size="Size.Medium"
OnClick="Logout"
Variant="Variant.Outlined">
Esci
</MudButton>
</div>
</div>
@code {
private bool Unavailable { get; set; }
private DateTime LastSync { get; set; }
protected override async Task OnInitializedAsync()
{
await LoadData();
}
private async Task LoadData()
{
await Task.Run(() =>
{
Unavailable = FormFactor.IsWeb() || !NetworkService.IsNetworkAvailable();
LastSync = LocalStorage.Get<DateTime>("last-sync");
});
StateHasChanged();
}
private void OpenSettings() =>
NavigationManager.NavigateTo("/settings/Profilo");
private void Logout() =>
AuthenticationStateProvider.SignOut();
private void UpdateDb(bool withData = false)
{
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
string path;
if (withData)
path = pathAndQuery == null ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : $"/sync/{DateTime.Today:yyyy-MM-dd}?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
else
path = pathAndQuery == null ? "/sync" : "/sync?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
NavigationManager.NavigateTo(path, replace: true);
}
}

View File

@@ -1,9 +0,0 @@
@page "/Users"
@attribute [Authorize]
@using Template.Shared.Components.Layout
<HeaderLayout Title="Contatti" />
@code {
}

View File

@@ -1,172 +0,0 @@
@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
<MudDialog Class="customDialog-form">
<DialogContent>
<HeaderLayout Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" ShowNotifications="false" Title="@(IsNew ? "Nuova" : $"{ActivityModel.ActivityId}")" />
<div class="content">
<div class="input-card">
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Descrizione" Variant="Variant.Text" Lines="3" @bind-Value="ActivityModel.ActivityDescription" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
</div>
<div class="input-card">
<div class="form-container">
<MudInput ReadOnly="IsView" T="string?" Placeholder="Cliente" @bind-Value="ActivityModel.Cliente" @bind-Value:after="OnAfterChangeValue" />
</div>
<div class="divider"></div>
<div class="form-container">
<MudInput ReadOnly="IsView" T="string?" Placeholder="Commessa" @bind-Value="ActivityModel.Commessa" @bind-Value:after="OnAfterChangeValue" />
</div>
</div>
<div class="input-card">
<div class="form-container">
<span>Inizio</span>
<MudTextField ReadOnly="IsView" T="DateTime?" Format="yyyy-MM-ddTHH:mm" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedTime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
</div>
<div class="divider"></div>
<div class="form-container">
<span>Fine</span>
<MudTextField ReadOnly="IsView" T="DateTime?" Format="yyyy-MM-ddTHH:mm" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedEndtime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
</div>
<div class="divider"></div>
<div class="form-container">
<span>Avviso</span>
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary" />
</div>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Assegnata a</span>
<MudSelectExtended FullWidth="true" ReadOnly="IsView" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.UserName" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var user in Users)
{
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserName">@user.FullName</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Tipo</span>
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityTypeId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var type in ActivityType)
{
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Esito</span>
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityResultId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var result in ActivityResult)
{
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
</div>
<div class="input-card">
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.Note" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
</div>
</div>
</DialogContent>
</MudDialog>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation" />
@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<StbActivityResult> ActivityResult { get; set; } = [];
private List<StbActivityType> ActivityType { get; set; } = [];
private List<StbUser> 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<StbUser>();
ActivityResult = await ManageData.GetTable<StbActivityResult>();
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
}
private void OnAfterChangeValue()
{
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
StateHasChanged();
}
}

View File

@@ -1,12 +0,0 @@
.no-data {
margin-top: 2rem;
width: calc(100vw - (var(--bs-gutter-x) * .5) * 2);
}
.no-data img {
width: 60%;
}
.no-data p {
font-size: 1.2rem;
}

View File

@@ -1,19 +0,0 @@
namespace Template.Shared.Core.Utility;
public static class UtilityString
{
public static string ExtractInitials(string fullname)
{
return string.Concat(fullname
.Split(' ', StringSplitOptions.RemoveEmptyEntries)
.Select(word => char.ToUpper(word[0])));
}
public static string FirstCharToUpper(this string input) =>
input switch
{
null => throw new ArgumentNullException(nameof(input)),
"" => throw new ArgumentException($"{nameof(input)} cannot be empty", nameof(input)),
_ => input[0].ToString().ToUpper() + input.Substring(1)
};
}

View File

@@ -1,9 +0,0 @@
:root {
/*Color*/
--card-border-color: hsl(from var(--mud-palette-gray-light) h s 86%);
--gray-for-shadow: hsl(from var(--mud-palette-gray-light) h s 95%);
/*Utility*/
--card-shadow: 5px 5px 10px 0 var(--gray-for-shadow);
--custom-box-shadow: 1px 2px 5px rgba(165, 165, 165, 0.5);
--mud-default-borderradius: 12px !important;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +0,0 @@
window.goBack = function () {
history.back();
};

View File

@@ -3,11 +3,11 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls" xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
android:Application.WindowSoftInputModeAdjust="Resize" android:Application.WindowSoftInputModeAdjust="Resize"
x:Class="Template.Maui.App"> x:Class="salesbook.Maui.App">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<Color x:Key="PageBackgroundColor">#512bdf</Color> <Color x:Key="PageBackgroundColor">#dff2ff</Color>
<Color x:Key="PrimaryTextColor">White</Color> <Color x:Key="PrimaryTextColor">White</Color>
<Style TargetType="Label"> <Style TargetType="Label">
@@ -18,7 +18,7 @@
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> <Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
<Setter Property="FontFamily" Value="OpenSansRegular" /> <Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="BackgroundColor" Value="#2b0b98" /> <Setter Property="BackgroundColor" Value="#dff2ff" />
<Setter Property="Padding" Value="14,10" /> <Setter Property="Padding" Value="14,10" />
</Style> </Style>

View File

@@ -0,0 +1,15 @@
using CommunityToolkit.Mvvm.Messaging;
namespace salesbook.Maui
{
public partial class App : Application
{
public App(IMessenger messenger)
{
InitializeComponent();
MainPage = new NavigationPage(new MainPage(messenger));
}
}
}

View File

@@ -1,6 +1,6 @@
using Template.Shared.Core.Interface; using salesbook.Shared.Core.Interface;
namespace Template.Maui.Core.Services; namespace salesbook.Maui.Core.Services;
public class FormFactor : IFormFactor public class FormFactor : IFormFactor
{ {

View File

@@ -1,7 +1,8 @@
using SQLite; using SQLite;
using System.Linq.Expressions; using System.Linq.Expressions;
using Template.Shared.Core.Entity; using salesbook.Shared.Core.Entity;
namespace Template.Maui.Core.Services;
namespace salesbook.Maui.Core.Services;
public class LocalDbService public class LocalDbService
{ {
@@ -110,4 +111,7 @@ public class LocalDbService
: _connection.Table<T>().Where(whereCond).ToListAsync(); : _connection.Table<T>().Where(whereCond).ToListAsync();
public List<T> Get<T>(string sql) where T : new() => _connection.QueryAsync<T>(sql).Result; public List<T> Get<T>(string sql) where T : new() => _connection.QueryAsync<T>(sql).Result;
public async Task Delete<T>(T entity) =>
await _connection.DeleteAsync(entity);
} }

View File

@@ -1,11 +1,11 @@
using AutoMapper; using AutoMapper;
using System.Linq.Expressions; using System.Linq.Expressions;
using Template.Shared.Core.Dto; using salesbook.Shared.Core.Dto;
using Template.Shared.Core.Entity; using salesbook.Shared.Core.Entity;
using Template.Shared.Core.Helpers.Enum; using salesbook.Shared.Core.Helpers.Enum;
using Template.Shared.Core.Interface; using salesbook.Shared.Core.Interface;
namespace Template.Maui.Core.Services; namespace salesbook.Maui.Core.Services;
public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManageDataService public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManageDataService
{ {
@@ -48,7 +48,7 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo; dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo;
} }
if (dto.Category == ActivityCategoryEnum.Interna && activity.CodAnag != null) if (dto.Category != ActivityCategoryEnum.Memo && activity.CodAnag != null)
{ {
string? ragSoc; string? ragSoc;
@@ -72,6 +72,16 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
public Task InsertOrUpdate<T>(T objectToSave) => public Task InsertOrUpdate<T>(T objectToSave) =>
localDb.InsertOrUpdate<T>([objectToSave]); localDb.InsertOrUpdate<T>([objectToSave]);
public Task Delete<T>(T objectToDelete) =>
localDb.Delete(objectToDelete);
public async Task DeleteActivity(ActivityDTO activity)
{
await localDb.Delete(
(await GetTable<StbActivity>(x => x.ActivityId.Equals(activity.ActivityId))).Last()
);
}
public Task ClearDb() => public Task ClearDb() =>
localDb.ResetDb(); localDb.ResetDb();
} }

View File

@@ -0,0 +1,15 @@
using salesbook.Shared.Core.Interface;
namespace salesbook.Maui.Core.Services;
public class NavigationService(IServiceProvider serviceProvider) : INavigationService
{
public async Task NavigateToDetailsAsync()
{
var detailsPage = serviceProvider.GetService<PersonalInfo>();
if (Application.Current.MainPage is NavigationPage nav && detailsPage != null)
{
await nav.Navigation.PushAsync(detailsPage);
}
}
}

View File

@@ -1,6 +1,6 @@
using Template.Shared.Core.Interface; using salesbook.Shared.Core.Interface;
namespace Template.Maui.Core.Services; namespace salesbook.Maui.Core.Services;
public class NetworkService : INetworkService public class NetworkService : INetworkService
{ {

View File

@@ -0,0 +1,18 @@
using salesbook.Shared.Core.Interface;
namespace salesbook.Maui.Core.Services;
public class PageTitleService(IDispatcher dispatcher) : IPageTitleService
{
public void SetTitle(string title)
{
dispatcher.Dispatch(() =>
{
if (Application.Current?.MainPage is NavigationPage nav &&
nav.CurrentPage is ContentPage cp)
{
cp.Title = title;
}
});
}
}

View File

@@ -1,7 +1,7 @@
using Template.Shared.Core.Helpers; using salesbook.Shared.Core.Helpers;
using Template.Shared.Core.Interface; using salesbook.Shared.Core.Interface;
namespace Template.Maui.Core.Services; namespace salesbook.Maui.Core.Services;
public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService
{ {

View File

@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Template.Maui" xmlns:shared="clr-namespace:salesbook.Shared;assembly=salesbook.Shared"
xmlns:shared="clr-namespace:Template.Shared;assembly=Template.Shared" x:Class="salesbook.Maui.MainPage"
x:Class="Template.Maui.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}"> BackgroundColor="{DynamicResource PageBackgroundColor}">
<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html"> <BlazorWebView HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents> <BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type shared:Components.Routes}" /> <RootComponent Selector="#app" ComponentType="{x:Type shared:Components.Routes}" />
</BlazorWebView.RootComponents> </BlazorWebView.RootComponents>

View File

@@ -0,0 +1,25 @@
using CommunityToolkit.Mvvm.Messaging;
using salesbook.Shared.Core.Messages.Back;
namespace salesbook.Maui
{
public partial class MainPage : ContentPage
{
private readonly IMessenger _messenger;
public MainPage(IMessenger messenger)
{
InitializeComponent();
_messenger = messenger;
Title = "Home";
}
protected override bool OnBackButtonPressed()
{
_messenger.Send(new HardwareBackMessage("back"));
return true;
}
}
}

View File

@@ -1,17 +1,21 @@
using CommunityToolkit.Maui; using CommunityToolkit.Maui;
using CommunityToolkit.Mvvm.Messaging;
using IntegryApiClient.MAUI; using IntegryApiClient.MAUI;
using Microsoft.AspNetCore.Components.Authorization; using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MudBlazor.Services; using MudBlazor.Services;
using MudExtensions.Services; using MudExtensions.Services;
using Template.Maui.Core.Services; using salesbook.Maui.Core.Services;
using Template.Shared; using salesbook.Shared;
using Template.Shared.Core.Helpers; using salesbook.Shared.Core.Helpers;
using Template.Shared.Core.Interface; using salesbook.Shared.Core.Interface;
using Template.Shared.Core.Messages; using salesbook.Shared.Core.Messages.Activity.Copy;
using Template.Shared.Core.Services; using salesbook.Shared.Core.Messages.Activity.New;
using salesbook.Shared.Core.Messages.Back;
using salesbook.Shared.Core.Services;
using System.Globalization;
namespace Template.Maui namespace salesbook.Maui
{ {
public static class MauiProgram public static class MauiProgram
{ {
@@ -21,14 +25,14 @@ namespace Template.Maui
{ {
InteractiveRenderSettings.ConfigureBlazorHybridRenderModes(); InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("it-IT");
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("it-IT");
var builder = MauiApp.CreateBuilder(); var builder = MauiApp.CreateBuilder();
builder builder
.UseMauiApp<App>() .UseMauiApp<App>()
.UseMauiCommunityToolkit() .UseMauiCommunityToolkit()
.ConfigureFonts(fonts => .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); })
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
})
.UseLoginAzienda(AppToken); .UseLoginAzienda(AppToken);
builder.Services.AddMauiBlazorWebView(); builder.Services.AddMauiBlazorWebView();
@@ -46,7 +50,12 @@ namespace Template.Maui
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>(); builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
builder.Services.AddScoped<ISyncDbService, SyncDbService>(); builder.Services.AddScoped<ISyncDbService, SyncDbService>();
builder.Services.AddScoped<IManageDataService, ManageDataService>(); builder.Services.AddScoped<IManageDataService, ManageDataService>();
//Message
builder.Services.AddScoped<IMessenger, WeakReferenceMessenger>();
builder.Services.AddScoped<NewActivityService>();
builder.Services.AddScoped<BackNavigationService>(); builder.Services.AddScoped<BackNavigationService>();
builder.Services.AddScoped<CopyActivityService>();
#if DEBUG #if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools(); builder.Services.AddBlazorWebViewDeveloperTools();
@@ -56,7 +65,11 @@ namespace Template.Maui
builder.Services.AddSingleton<IFormFactor, FormFactor>(); builder.Services.AddSingleton<IFormFactor, FormFactor>();
builder.Services.AddSingleton<LocalDbService>(); builder.Services.AddSingleton<LocalDbService>();
builder.Services.AddSingleton<INavigationService, NavigationService>();
builder.Services.AddSingleton<IPageTitleService, PageTitleService>();
builder.Services.AddTransient<PersonalInfo>();
return builder.Build(); return builder.Build();
} }
} }
} }

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:components="clr-namespace:salesbook.Shared.Components;assembly=salesbook.Shared"
x:Class="salesbook.Maui.PersonalInfo"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<BlazorWebView HostPage="wwwroot/index.html" StartPath="/PersonalInfo">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type components:Routes}" />
</BlazorWebView.RootComponents>
</BlazorWebView>
</ContentPage>

View File

@@ -0,0 +1,11 @@
namespace salesbook.Maui;
public partial class PersonalInfo : ContentPage
{
public PersonalInfo()
{
InitializeComponent();
Title = "Profilo";
}
}

View File

@@ -1,7 +1,8 @@
using Android.App; using Android.App;
using Android.Content.PM; using Android.Content.PM;
using AndroidX.AppCompat.App;
namespace Template.Maui namespace salesbook.Maui
{ {
[Activity(Theme = "@style/Maui.SplashTheme", [Activity(Theme = "@style/Maui.SplashTheme",
MainLauncher = true, MainLauncher = true,
@@ -9,5 +10,9 @@ namespace Template.Maui
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity public class MainActivity : MauiAppCompatActivity
{ {
public MainActivity()
{
AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
}
} }
} }

View File

@@ -1,7 +1,7 @@
using Android.App; using Android.App;
using Android.Runtime; using Android.Runtime;
namespace Template.Maui namespace salesbook.Maui
{ {
[Application] [Application]
public class MainApplication : MauiApplication public class MainApplication : MauiApplication

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#dff2ff</color>
<color name="colorPrimaryDark">#00a0de</color>
<color name="colorAccent">#00a0de</color>
</resources>

View File

@@ -1,7 +1,7 @@
using Foundation; using Foundation;
using Template.Maui; using salesbook.Maui;
namespace Template.Maui namespace salesbook.Maui
{ {
[Register("AppDelegate")] [Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate public class AppDelegate : MauiUIApplicationDelegate

View File

@@ -1,7 +1,7 @@
using ObjCRuntime; using ObjCRuntime;
using UIKit; using UIKit;
namespace Template.Maui namespace salesbook.Maui
{ {
public class Program public class Program
{ {

View File

@@ -1,6 +1,6 @@
using Foundation; using Foundation;
namespace Template.Maui namespace salesbook.Maui
{ {
[Register("AppDelegate")] [Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate public class AppDelegate : MauiUIApplicationDelegate

View File

@@ -35,5 +35,8 @@
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
<true/> <true/>
</dict> </dict>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict> </dict>
</plist> </plist>

View File

@@ -1,6 +1,6 @@
using UIKit; using UIKit;
namespace Template.Maui namespace salesbook.Maui
{ {
public class Program public class Program
{ {

View File

@@ -0,0 +1 @@
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 230" width="230" height="230"><style>.a{fill:#dff2ff}</style><path fill-rule="evenodd" class="a" d="m230 0v230h-230v-230z"/></svg>

After

Width:  |  Height:  |  Size: 201 B

View File

@@ -0,0 +1 @@
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 230" width="230" height="230"><style>.a{fill:none;stroke:#002339;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}.b{fill:none;stroke:#00a0de;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}</style><path fill-rule="evenodd" class="a" d="m119.9 71.4h34.4c20.3 0 36.8 16.5 36.8 36.9v28.3c0 20.4-16.5 36.9-36.8 36.9h-5.1l0.1 32.2-34.7-32.2h-72.2"/><path fill-rule="evenodd" class="b" d="m117.3 24l-77.1 47.4v102.1l77.1-47.4v-102.1z"/></svg>

After

Width:  |  Height:  |  Size: 529 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Livello_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 570.53 425.62">
<defs>
<style>
.cls-1 {
stroke: #002339;
}
.cls-1, .cls-2 {
fill: none;
stroke-linecap: round;
stroke-linejoin: round;
stroke-width: 17px;
}
.cls-3 {
fill: #002339;
}
.cls-2 {
stroke: #00a0de;
}
</style>
</defs>
<g>
<path class="cls-3" d="M71.66,322.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
<path class="cls-3" d="M137.34,316.75c-1.29-1.34-2.78-2.47-4.51-3.36-2.63-1.34-5.57-2.02-8.83-2.02-4.29,0-8.11,1.06-11.48,3.17s-6,4.99-7.92,8.64c-1.92,3.65-2.88,7.78-2.88,12.39s.96,8.64,2.88,12.29c1.92,3.65,4.56,6.53,7.92,8.64,3.36,2.11,7.15,3.17,11.38,3.17,3.33,0,6.32-.67,8.98-2.02,1.73-.87,3.2-1.99,4.46-3.31v4.37h12.68v-46.38h-12.68v4.42ZM134.85,344.5c-2.18,2.37-5.03,3.55-8.55,3.55-2.24,0-4.26-.54-6.05-1.63-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4.03-1.49-6.53s.5-4.58,1.49-6.43c.99-1.86,2.37-3.33,4.13-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.42.53,6.15,1.58c1.73,1.06,3.1,2.54,4.13,4.46,1.02,1.92,1.54,4.1,1.54,6.53,0,3.59-1.09,6.56-3.27,8.93Z"/>
<rect class="cls-3" x="164.81" y="289.28" width="12.58" height="69.43"/>
<path class="cls-3" d="M225.49,314.25c-3.46-1.98-7.36-2.98-11.71-2.98-4.61,0-8.77,1.06-12.48,3.17-3.71,2.11-6.64,4.99-8.79,8.64-2.15,3.65-3.22,7.78-3.22,12.39s1.09,8.83,3.27,12.48c2.18,3.65,5.17,6.53,8.98,8.64,3.81,2.11,8.15,3.17,13.01,3.17,3.78,0,7.26-.67,10.47-2.02,3.2-1.34,5.98-3.36,8.35-6.05l-7.49-7.49c-1.41,1.67-3.07,2.88-4.99,3.65-1.92.77-4.07,1.15-6.43,1.15-2.63,0-4.93-.54-6.91-1.63-1.99-1.09-3.5-2.67-4.56-4.75-.42-.82-.73-1.72-.98-2.65l33.87-.08c.26-1.02.42-1.97.48-2.83.06-.86.1-1.71.1-2.54,0-4.48-.96-8.48-2.88-12-1.92-3.52-4.61-6.27-8.07-8.26ZM207.15,323.47c1.86-1.09,4.03-1.63,6.53-1.63,2.37,0,4.35.48,5.95,1.44,1.6.96,2.85,2.37,3.75,4.23.43.89.76,1.89,1,2.99l-22.38.06c.23-.86.51-1.68.88-2.43.99-2.02,2.42-3.57,4.27-4.66Z"/>
<path class="cls-3" d="M260.64,322.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
<path class="cls-3" d="M331.93,314.54c-3.43-2.11-7.28-3.17-11.57-3.17-3.26,0-6.26.69-8.98,2.06-1.58.8-2.96,1.79-4.18,2.93v-27.08h-12.58v69.43h12.48v-4.15c1.23,1.2,2.62,2.23,4.23,3.05,2.69,1.38,5.7,2.06,9.03,2.06,4.29,0,8.13-1.06,11.52-3.17,3.39-2.11,6.06-4.99,8.02-8.64,1.95-3.65,2.93-7.75,2.93-12.29s-.96-8.74-2.88-12.39c-1.92-3.65-4.59-6.53-8.02-8.64ZM328.38,342c-.99,1.86-2.35,3.33-4.08,4.42-1.73,1.09-3.74,1.63-6.05,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.17-2.56-4.13-4.42-.96-1.86-1.44-4-1.44-6.43s.48-4.67,1.44-6.53c.96-1.86,2.32-3.33,4.08-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.34.54,6.1,1.63c1.76,1.09,3.14,2.58,4.13,4.46.99,1.89,1.49,4.02,1.49,6.39,0,2.5-.5,4.67-1.49,6.53Z"/>
<path class="cls-3" d="M389.26,314.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM387.05,341.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
<path class="cls-3" d="M447.74,314.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM445.53,341.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
<polygon class="cls-3" points="516.64 358.71 497.56 334.39 515.77 312.33 501.18 312.33 484.37 333.58 484.37 289.28 471.79 289.28 471.79 358.71 484.37 358.71 484.37 336.08 501.27 358.71 516.64 358.71"/>
</g>
<g>
<path class="cls-1" d="M288.72,101.41h36.59c21.62,0,39.14,17.52,39.14,39.14v30.15c0,21.62-17.52,39.14-39.14,39.14h-5.37l.07,34.31-36.88-34.31h-77.99"/>
<polygon class="cls-2" points="285.99 51.02 204.08 101.41 204.08 209.84 285.99 159.45 285.99 51.02"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -15,7 +15,7 @@
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> --> <!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>Template.Maui</RootNamespace> <RootNamespace>salesbook.Maui</RootNamespace>
<UseMaui>true</UseMaui> <UseMaui>true</UseMaui>
<SingleProject>true</SingleProject> <SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
@@ -23,14 +23,14 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<!-- Display name --> <!-- Display name -->
<ApplicationTitle>Template.Maui</ApplicationTitle> <ApplicationTitle>salesbook</ApplicationTitle>
<!-- App Identifier --> <!-- App Identifier -->
<ApplicationId>it.integry.template.maui</ApplicationId> <ApplicationId>it.integry.salesbook</ApplicationId>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion> <ApplicationDisplayVersion>1.0.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion> <ApplicationVersion>3</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'"> <!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
@@ -78,8 +78,8 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'"> <PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey> <CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
<CodesignProvision>VS: WildCard Development</CodesignProvision> <CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'"> <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
@@ -92,12 +92,19 @@
--> -->
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<!-- App Icon --> <!-- Android App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" /> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
</ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<!-- ios App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />
</ItemGroup>
<ItemGroup>
<!-- Splash Screen --> <!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" /> <MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#dff2ff" BaseSize="128,128" />
<!-- Images --> <!-- Images -->
<MauiImage Include="Resources\Images\*" /> <MauiImage Include="Resources\Images\*" />
@@ -123,7 +130,19 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Template.Shared\Template.Shared.csproj" /> <ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="PersonalInfo.xaml.cs">
<DependentUpon>PersonalInfo.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="PersonalInfo.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
<title>salesbook.Maui</title>
<base href="/"/>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
<link href="_content/salesbook.Shared/css/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="_content/salesbook.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="_content/salesbook.Shared/css/remixicon/remixicon.css"/>
<link rel="stylesheet" href="_content/salesbook.Shared/css/app.css"/>
<link rel="stylesheet" href="_content/salesbook.Shared/css/form.css"/>
<link rel="stylesheet" href="_content/salesbook.Shared/css/bottomSheet.css"/>
<link rel="stylesheet" href="_content/salesbook.Shared/css/default-theme.css"/>
<link rel="stylesheet" href="salesbook.Maui.styles.css"/>
<link rel="icon" type="image/png" href="favicon.png"/>
</head>
<body>
<div class="status-bar-safe-area"></div>
<div id="app">
<div class="spinner-container">
<span class="loader"></span>
</div>
</div>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.webview.js" autostart="false"></script>
<script src="_content/salesbook.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
<!-- Add chart.js reference if chart components are used in your application. -->
<!--<script src="_content/salesbook.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
<!--<script src="_content/salesbook.Shared/js/bootstrap/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
<!-- Add sortable.js reference if SortableList component is used in your application. -->
<!--<script src="_content/salesbook.Shared/js/bootstrap/Sortable.min.js"></script>-->
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
<script src="_content/salesbook.Shared/js/main.js"></script>
<script src="_content/salesbook.Shared/js/calendar.js"></script>
<script src="_content/salesbook.Shared/js/alphaScroll.js"></script>
</body>
</html>

View File

@@ -1,6 +1,9 @@
@using Microsoft.Maui.Controls
@using salesbook.Shared.Core.Interface
@inject IJSRuntime JS @inject IJSRuntime JS
@inject INavigationService NavigationService
<div class="container header"> <div class="@(Back ? "" : "container") header">
<div class="header-content @(Back ? "with-back" : "no-back")"> <div class="header-content @(Back ? "with-back" : "no-back")">
@if (Back) @if (Back)
{ {
@@ -22,11 +25,17 @@
{ {
@if (ShowFilter) @if (ShowFilter)
{ {
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt" Color="Color.Dark" /> <MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
} }
@if (ShowCalendarToggle)
@* @if (ShowCalendarToggle)
{ {
<MudIconButton OnClick="OnCalendarToggle" Icon="@Icons.Material.Filled.CalendarMonth" Color="Color.Dark"/> <MudIconButton OnClick="OnCalendarToggle" Icon="@Icons.Material.Filled.CalendarMonth" Color="Color.Dark"/>
} *@
@if (ShowProfile)
{
<MudIconButton Class="user" OnClick="OpenPersonalInfo" Icon="@Icons.Material.Filled.Person"/>
} }
} }
else else
@@ -45,8 +54,9 @@
@code{ @code{
[Parameter] public string? Title { get; set; } [Parameter] public string? Title { get; set; }
[Parameter] public bool ShowFilter { get; set; } [Parameter] public bool ShowFilter { get; set; }
[Parameter] public bool ShowNotifications { get; set; } = true; [Parameter] public bool ShowProfile { get; set; } = true;
[Parameter] public bool Back { get; set; } [Parameter] public bool Back { get; set; }
[Parameter] public bool BackOnTop { get; set; }
[Parameter] public string BackTo { get; set; } = ""; [Parameter] public string BackTo { get; set; } = "";
[Parameter] public EventCallback OnFilterToggle { get; set; } [Parameter] public EventCallback OnFilterToggle { get; set; }
@@ -74,7 +84,11 @@
} }
await JS.InvokeVoidAsync("goBack"); await JS.InvokeVoidAsync("goBack");
}
private async Task OpenPersonalInfo()
{
await NavigationService.NavigateToDetailsAsync();
} }
} }

View File

@@ -6,8 +6,6 @@
position: relative; position: relative;
} }
.header-content.with-back { margin: .6rem 0 0 0; }
.header-content.with-back .page-title { .header-content.with-back .page-title {
position: absolute; position: absolute;
left: 50%; left: 50%;
@@ -16,14 +14,8 @@
font-size: larger; font-size: larger;
} }
.left-section ::deep button, .right-section ::deep button { .left-section ::deep button, .right-section ::deep button { font-size: 1.1rem; }
font-size: 1.1rem;
}
.left-section ::deep .mud-button-icon-start { .left-section ::deep .mud-button-icon-start { margin-right: 3px !important; }
margin-right: 3px !important;
}
.header-content.no-back .page-title { .header-content.no-back .page-title { margin: 0; }
margin: 0;
}

View File

@@ -0,0 +1,92 @@
@using System.Globalization
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Messages.Back
@inherits LayoutComponentBase
@inject IJSRuntime JS
@inject BackNavigationService BackService
@inject INavigationService NavigationService
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
<MudPopoverProvider/>
<MudDialogProvider/>
<MudSnackbarProvider/>
<div class="page">
<NavMenu/>
<main>
<article>
@Body
</article>
</main>
</div>
@code {
private MudThemeProvider? _mudThemeProvider;
private bool IsDarkMode { get; set; }
private string _mainContentClass = "";
private readonly MudTheme _currentTheme = new()
{
PaletteLight = new PaletteLight()
{
Primary = "#00a0de",
Secondary = "#002339",
Tertiary = "#dff2ff",
TextPrimary = "#000"
},
PaletteDark = new PaletteDark
{
Primary = "#00a0de",
Secondary = "#002339",
Tertiary = "#dff2ff",
Surface = "#000406",
Background = "#000406",
TextPrimary = "#fff",
GrayDark = "#E0E0E0"
}
};
protected override async Task OnAfterRenderAsync(bool firstRender)
{
// if (firstRender)
// {
// var isDarkMode = LocalStorage.GetString("isDarkMode");
// if (isDarkMode == null && _mudThemeProvider != null)
// {
// IsDarkMode = await _mudThemeProvider.GetSystemPreference();
// await _mudThemeProvider.WatchSystemPreference(OnSystemPreferenceChanged);
// LocalStorage.SetString("isDarkMode", IsDarkMode.ToString());
// StateHasChanged();
// }
// else
// {
// IsDarkMode = bool.Parse(isDarkMode!);
// }
// if (IsDarkMode)
// {
// _mainContentClass += "is-dark";
// StateHasChanged();
// }
// }
}
private async Task OnSystemPreferenceChanged(bool newValue)
{
IsDarkMode = newValue;
}
protected override void OnInitialized()
{
BackService.OnHardwareBack += async () => { await JS.InvokeVoidAsync("goBack"); };
var culture = new CultureInfo("it-IT", false);
CultureInfo.CurrentCulture = culture;
CultureInfo.CurrentUICulture = culture;
}
}

View File

@@ -0,0 +1,96 @@
@using CommunityToolkit.Mvvm.Messaging
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Messages.Activity.Copy
@using salesbook.Shared.Core.Messages.Activity.New
@inject IDialogService Dialog
@inject IMessenger Messenger
@inject CopyActivityService CopyActivityService
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
<nav class="navbar @(IsVisible? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
<div class="container-navbar">
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
<li class="nav-item">
<NavLink class="nav-link" href="Users" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-group-line"></i>
<span>Contatti</span>
</div>
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Calendar" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-calendar-todo-line"></i>
<span>Agenda</span>
</div>
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href="Notifications" Match="NavLinkMatch.All">
<div class="d-flex flex-column">
<i class="ri-notification-4-line"></i>
<span>Notifiche</span>
</div>
</NavLink>
</li>
</ul>
</div>
@if (PlusVisible)
{
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
<ActivatorContent>
<MudFab Class="custom-plus-button" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium" IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add" />
</ActivatorContent>
<ChildContent>
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
<MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
</ChildContent>
</MudMenu>
}
</nav>
</div>
@code
{
private bool IsVisible { get; set; } = true;
private bool PlusVisible { get; set; } = true;
protected override Task OnInitializedAsync()
{
CopyActivityService.OnCopyActivity += async dto => await CreateActivity(dto);
NavigationManager.LocationChanged += (_, args) =>
{
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications" }
.Contains(location);
var newPlusVisible = new List<string> { "Calendar", "Users" }
.Contains(location);
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
IsVisible = newIsVisible;
PlusVisible = newPlusVisible;
StateHasChanged();
};
return Task.CompletedTask;
}
private Task CreateActivity() => CreateActivity(null);
private async Task CreateActivity(ActivityDTO? activity)
{
var result = await ModalHelpers.OpenActivityForm(Dialog, activity, null);
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(StbActivity))
{
Messenger.Send(new NewActivityMessage(((StbActivity)result.Data).ActivityId));
}
}
}

View File

@@ -1,17 +1,41 @@
.navbar { .animated-navbar {
background: transparent; background: transparent;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
z-index: 1001; z-index: 1001;
transition: all 0.3s ease-in-out;
}
.animated-navbar.show-nav { transform: translateY(0); }
.animated-navbar.hide-nav { transform: translateY(100%); }
.animated-navbar.with-plus { margin-left: 30px; }
.navbar {
padding-bottom: 1rem; padding-bottom: 1rem;
padding-top: 0 !important; padding-top: 0 !important;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: end;
transition: all 0.3s ease-in-out;
}
.navbar.with-plus { transform: translateX(-30px); }
.navbar.without-plus {
transform: translateX(0);
justify-content: center;
} }
.container-navbar { .container-navbar {
background: var(--mud-palette-surface); background: var(--mud-palette-surface);
border-radius: 15px; border-radius: 50px;
padding: 0 10px;
box-shadow: var(--custom-box-shadow); box-shadow: var(--custom-box-shadow);
transition: all 0.3s ease-in-out;
} }
.nav-item { font-size: 0.9rem; } .nav-item { font-size: 0.9rem; }
@@ -21,29 +45,33 @@
bottom: 15px; bottom: 15px;
} }
.nav-item ::deep .custom-plus-button .mud-icon-root { .navbar ::deep .custom-plus-button .mud-icon-root {
transition: .513s; transition: .5s;
transform: rotate(0); transform: rotate(0);
font-size: 2rem; font-size: 2rem;
} }
.nav-item ::deep .custom-plus-button:focus .mud-icon-root { .navbar ::deep .custom-plus-button {
transform: rotate(225deg); background: var(--mud-palette-surface);
} box-shadow: var(--custom-box-shadow);
transition: all 0.3s ease-in-out;
}
.navbar ::deep .custom-plus-button:focus .mud-icon-root { transform: rotate(225deg); }
.nav-item ::deep a { .nav-item ::deep a {
display: flex; display: flex;
align-items: center; align-items: center;
line-height: 1.2; line-height: 1.2;
justify-content: center; justify-content: center;
padding-top: .5rem !important; padding-top: .25rem !important;
padding-bottom: .5rem !important; padding-bottom: .25rem !important;
} }
.nav-item ::deep a > div { .nav-item ::deep a > div {
-webkit-transition: all .1s ease-out; -webkit-transition: all .1s ease-out;
transition: all .1s ease-out; transition: all .1s ease-out;
min-width: 60px; min-width: 75px;
} }
.nav-item ::deep a.active > div { color: var(--mud-palette-primary); } .nav-item ::deep a.active > div { color: var(--mud-palette-primary); }
@@ -66,8 +94,4 @@
font-weight: 500; font-weight: 500;
} }
@supports (-webkit-touch-callout: none) { @supports (-webkit-touch-callout: none) { .navbar { padding-bottom: env(safe-area-inset-bottom); } }
.nav-item { padding-bottom: env(safe-area-inset-bottom) !important; }
.nav-item ::deep > .nav-link { padding-bottom: 0 !important; }
}

View File

@@ -1,4 +1,4 @@
@using Template.Shared.Components.Layout.Spinner @using salesbook.Shared.Components.Layout.Spinner
<MudOverlay Visible="VisibleOverlay" LightBackground="true"> <MudOverlay Visible="VisibleOverlay" LightBackground="true">
@if (SuccessAnimation) @if (SuccessAnimation)
{ {

View File

@@ -0,0 +1,626 @@
@page "/Calendar"
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Components.SingleElements.BottomSheet
@using salesbook.Shared.Core.Messages.Activity.New
@inject IManageDataService ManageData
@inject IJSRuntime JS
@inject NewActivityService NewActivity
@inject IPageTitleService PageTitleService
@* <HeaderLayout Title="@_headerTitle"
ShowFilter="true"
ShowCalendarToggle="true"
OnFilterToggle="ToggleFilter"
OnCalendarToggle="ToggleExpanded"/> *@
<div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
@if (Expanded)
{
<!-- Vista mensile -->
@foreach (var nomeGiorno in GiorniSettimana)
{
<div class="week-day">
<div>@nomeGiorno</div>
</div>
}
@foreach (var unused in Enumerable.Range(0, StartOffset))
{
<div class="day" style="visibility: hidden"></div>
}
@if (_isInitialized && _monthDaysData.Length > 0)
{
@for (var d = 1; d <= DaysInMonth; d++)
{
var day = new DateTime(CurrentMonth.Year, CurrentMonth.Month, d);
var dayData = _monthDaysData[d - 1];
<div class="day @dayData.CssClass"
@onclick="() => SelezionaDataDalMese(day)">
<div>@d</div>
@if (dayData.HasEvents)
{
<div class="event-dot-container" style="margin-top: 2px;">
@foreach (var cat in dayData.EventCategories)
{
<div class="event-dot @cat.CssClass" title="@cat.Title"></div>
}
</div>
}
</div>
}
}
else
{
@* Fallback rendering per prima inizializzazione *@
@for (var d = 1; d <= DaysInMonth; d++)
{
var day = new DateTime(CurrentMonth.Year, CurrentMonth.Month, d);
var isSelected = IsSameDay(day, SelectedDate);
var isToday = IsSameDay(day, DateTime.Today);
var events = GetEventsForDay(day);
<div class="day @(isSelected ? "selected" : (isToday ? "today" : ""))"
@onclick="() => SelezionaDataDalMese(day)">
<div>@d</div>
@if (events.Any())
{
<div class="event-dot-container" style="margin-top: 2px;">
@foreach (var cat in events.Select(x => x.Category).Distinct())
{
<div class="event-dot @cat.ConvertToHumanReadable()" title="@cat.ConvertToHumanReadable()"></div>
}
</div>
}
</div>
}
}
@foreach (var unused in Enumerable.Range(0, EndOffset))
{
<div class="day" style="visibility: hidden"></div>
}
}
else
{
<!-- Vista settimanale -->
@if (_isInitialized && _weekDaysData.Length == 7 && _weekDaysData[0].Date != default)
{
@for (int i = 0; i < 7; i++)
{
var dayData = _weekDaysData[i];
var day = dayData.Date;
<div class="week-day">
<div>@dayData.DayName</div>
<div class="day @dayData.CssClass"
@onclick="() => SelezionaData(day)">
<div>@day.Day</div>
@if (dayData.HasEvents)
{
<div class="event-dot-container" style="margin-top: 2px;">
@foreach (var cat in dayData.EventCategories)
{
<div class="event-dot @cat.CssClass" title="@cat.Title"></div>
}
</div>
}
</div>
</div>
}
}
else
{
var start = GetStartOfWeek(SelectedDate);
var culture = new System.Globalization.CultureInfo("it-IT");
for (var i = 0; i < 7; i++)
{
var day = start.AddDays(i);
var isSelected = IsSameDay(day, SelectedDate);
var isToday = IsSameDay(day, DateTime.Today);
var events = GetEventsForDay(day);
<div class="week-day">
<div>@day.ToString("ddd", culture)</div>
<div class="day @(isSelected ? "selected" : (isToday ? "today" : ""))"
@onclick="() => SelezionaData(day)"
aria-label="@day.ToString("dddd d MMMM", culture)">
<div>@day.Day</div>
@if (events.Any())
{
<div class="event-dot-container" style="margin-top: 2px;">
@foreach (var cat in events.Select(x => x.Category).Distinct())
{
<div class="event-dot @cat.ConvertToHumanReadable()" title="@cat.ConvertToHumanReadable()"></div>
}
</div>
}
</div>
</div>
}
}
}
</div>
<div class="container appointments">
@if (IsLoading)
{
<SpinnerLayout FullScreen="false"/>
}
else if (FilteredActivities is { Count: > 0 })
{
<Virtualize Items="FilteredActivities" Context="activity">
<ActivityCard Activity="activity" ActivityChanged="OnActivityChanged" ActivityDeleted="OnActivityDeleted" />
</Virtualize>
}
else
{
<NoDataAvailable Text="Nessuna attività trovata" ImageSource="_content/salesbook.Shared/images/undraw_file-search_cbur.svg"/>
}
</div>
<FilterActivity @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
@code {
// Modelli per ottimizzazione rendering
private record DayData(DateTime Date, string CssClass, bool HasEvents, CategoryData[] EventCategories, string DayName = "");
private record CategoryData(string CssClass, string Title);
// Cache per rendering
private DayData[] _monthDaysData = [];
private readonly DayData[] _weekDaysData = new DayData[7];
private string _headerTitle = string.Empty;
private readonly Dictionary<DateTime, List<ActivityDTO>> _eventsCache = new();
private readonly Dictionary<DateTime, CategoryData[]> _categoriesCache = new();
private bool _isInitialized = false;
// Stato UI
private bool Expanded { get; set; }
private string SliderAnimation { get; set; } = string.Empty;
private ElementReference _weekSliderRef;
private DotNetObjectReference<Calendar>? _dotNetHelper;
// Stato calendario
private DateTime SelectedDate { get; set; } = DateTime.Today;
private DateTime _internalMonth = DateTime.Today;
private DateTime CurrentMonth => new(_internalMonth.Year, _internalMonth.Month, 1);
// Stato attività
private List<ActivityDTO> MonthActivities { get; set; } = [];
private List<ActivityDTO> FilteredActivities { get; set; } = [];
private bool IsLoading { get; set; } = true;
// Supporto rendering mese
private static readonly string[] GiorniSettimana = ["Lu", "Ma", "Me", "Gi", "Ve", "Sa", "Do"];
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
{
var totalCells = (int)Math.Ceiling((DaysInMonth + StartOffset) / 7.0) * 7;
return totalCells - (DaysInMonth + StartOffset);
}
}
protected override void OnInitialized()
{
PrepareRenderingData();
NewActivity.OnActivityCreated += async activityId => await OnActivityCreated(activityId);
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
Filter.User = new HashSet<string> { UserSession.User.Username };
_dotNetHelper = DotNetObjectReference.Create(this);
await JS.InvokeVoidAsync("calendarSwipe.register", _weekSliderRef, _dotNetHelper);
_internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
await LoadMonthData();
_isInitialized = true;
ApplyFilter();
StateHasChanged();
}
}
// Metodo per preparare i dati di rendering una sola volta
private void PrepareRenderingData()
{
PrepareHeaderTitle();
PrepareEventsCache();
if (Expanded)
{
PrepareMonthDaysData();
}
else
{
PrepareWeekDaysData();
}
}
private void PrepareHeaderTitle()
{
_headerTitle = CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper();
PageTitleService?.SetTitle(_headerTitle);
}
private void PrepareEventsCache()
{
_eventsCache.Clear();
_categoriesCache.Clear();
// Raggruppa le attività per data
var activitiesByDate = MonthActivities
.GroupBy(x => (x.EffectiveDate ?? x.EstimatedDate!).Value.Date)
.ToDictionary(g => g.Key, g => g.ToList());
foreach (var (date, activities) in activitiesByDate)
{
_eventsCache[date] = activities;
// Pre-calcola le categorie per ogni giorno
var categories = activities
.Select(x => x.Category)
.Distinct()
.Select(cat => new CategoryData(cat.ConvertToHumanReadable(), cat.ConvertToHumanReadable()))
.ToArray();
_categoriesCache[date] = categories;
}
}
private void PrepareMonthDaysData()
{
_monthDaysData = new DayData[DaysInMonth];
var today = DateTime.Today;
for (var d = 1; d <= DaysInMonth; d++)
{
var day = new DateTime(CurrentMonth.Year, CurrentMonth.Month, d);
var isSelected = day.Date == SelectedDate.Date;
var isToday = day.Date == today;
var cssClass = isSelected ? "selected" : (isToday ? "today" : "");
var hasEvents = _eventsCache.ContainsKey(day.Date);
var eventCategories = hasEvents ? GetFilteredCategoriesForDay(day.Date) : [];
_monthDaysData[d - 1] = new DayData(day, cssClass, eventCategories.Length > 0, eventCategories);
}
}
private void PrepareWeekDaysData()
{
var start = GetStartOfWeek(SelectedDate);
var today = DateTime.Today;
var culture = new System.Globalization.CultureInfo("it-IT");
for (var i = 0; i < 7; i++)
{
var day = start.AddDays(i);
var isSelected = day.Date == SelectedDate.Date;
var isToday = day.Date == today;
var cssClass = isSelected ? "selected" : (isToday ? "today" : "");
var dayName = day.ToString("ddd", culture);
var hasEvents = _eventsCache.ContainsKey(day.Date);
var eventCategories = hasEvents ? GetFilteredCategoriesForDay(day.Date) : [];
_weekDaysData[i] = new DayData(day, cssClass, eventCategories.Length > 0, eventCategories, dayName);
}
}
private CategoryData[] GetFilteredCategoriesForDay(DateTime date)
{
if (!_categoriesCache.TryGetValue(date, out var categories))
return [];
if (Filter.ClearFilter)
return categories;
// Applica i filtri alle categorie
var filteredActivities = GetFilteredActivitiesForDay(date);
if (!filteredActivities.Any())
return [];
return filteredActivities
.Select(x => x.Category)
.Distinct()
.Select(cat => new CategoryData(cat.ConvertToHumanReadable(), cat.ConvertToHumanReadable()))
.ToArray();
}
private List<ActivityDTO> GetFilteredActivitiesForDay(DateTime date)
{
if (!_eventsCache.TryGetValue(date, out var activities))
return [];
if (Filter.ClearFilter)
return activities;
var filteredActivity = activities.AsQueryable();
filteredActivity = filteredActivity
.Where(x => Filter.Text.IsNullOrEmpty() || (x.ActivityDescription != null && x.ActivityDescription.ContainsIgnoreCase(Filter.Text!)));
filteredActivity = filteredActivity
.Where(x => Filter.Type.IsNullOrEmpty() || (x.ActivityTypeId != null && x.ActivityTypeId.Equals(Filter.Type)));
filteredActivity = filteredActivity
.Where(x => Filter.Result.IsNullOrEmpty() || (x.ActivityResultId != null && x.ActivityResultId.Equals(Filter.Result)));
filteredActivity = filteredActivity
.Where(x => Filter.User.IsNullOrEmpty() || (x.UserName != null && Filter.User!.Contains(x.UserName)));
filteredActivity = filteredActivity
.Where(x => Filter.Category == null || x.Category.Equals(Filter.Category));
return filteredActivity.ToList();
}
[JSInvokable]
public async Task OnSwipeLeft()
{
await CambiaPeriodo(1);
PrepareRenderingData();
StateHasChanged();
if (Expanded)
{
await LoadMonthData();
}
}
[JSInvokable]
public async Task OnSwipeRight()
{
await CambiaPeriodo(-1);
PrepareRenderingData();
StateHasChanged();
if (Expanded)
{
await LoadMonthData();
}
}
[JSInvokable]
public async Task OnSwipeDown()
{
if (!Expanded)
ToggleExpanded();
}
[JSInvokable]
public async Task OnSwipeUp()
{
if (Expanded)
ToggleExpanded();
}
// Cambio periodo mese/settimana
private async Task CambiaPeriodo(int direzione)
{
if (Expanded)
{
var y = CurrentMonth.Year;
var m = CurrentMonth.Month + direzione;
if (m < 1)
{
y--;
m = 12;
}
if (m > 12)
{
y++;
m = 1;
}
_internalMonth = new DateTime(y, m, 1);
}
else
{
await SelezionaData(SelectedDate.AddDays(7 * direzione));
_internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
}
}
// Cambio modalità
private void ToggleExpanded()
{
if (Expanded)
{
SliderAnimation = "collapse-animation";
Expanded = false;
}
else
{
Expanded = true;
SliderAnimation = "expand-animation";
}
PrepareRenderingData();
StateHasChanged();
SliderAnimation = "";
StateHasChanged();
}
// Caricamento attività al cambio mese
private async Task LoadMonthData()
{
IsLoading = true;
StateHasChanged();
var start = CurrentMonth;
var end = start.AddDays(DaysInMonth - 1);
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();
PrepareRenderingData();
IsLoading = false;
StateHasChanged();
}
// Selezione giorno in settimana
private async Task SelezionaData(DateTime day)
{
SelectedDate = day;
var cacheInternalMonth = _internalMonth;
_internalMonth = new DateTime(day.Year, day.Month, 1);
if (cacheInternalMonth != _internalMonth)
{
await LoadMonthData();
}
else
{
PrepareRenderingData();
}
ApplyFilter();
StateHasChanged();
}
// Selezione giorno dal mese (chiude la vista mese!)
private async Task SelezionaDataDalMese(DateTime day)
{
SelectedDate = day;
SliderAnimation = "collapse-animation";
Expanded = false;
_internalMonth = new DateTime(day.Year, day.Month, 1);
PrepareRenderingData();
ApplyFilter();
StateHasChanged();
SliderAnimation = "";
StateHasChanged();
}
// Utility
private static bool IsSameDay(DateTime d1, DateTime d2) => d1.Date == d2.Date;
private static DateTime GetStartOfWeek(DateTime date)
{
var day = date.DayOfWeek == DayOfWeek.Sunday ? 7 : (int)date.DayOfWeek;
return date.AddDays(-day + 1).Date;
}
private List<ActivityDTO> GetEventsForDay(DateTime day)
=> _eventsCache.TryGetValue(day.Date, out var events) ? events : [];
public void Dispose()
{
_dotNetHelper?.Dispose();
}
private async Task OnActivityDeleted(ActivityDTO activity)
{
IsLoading = true;
await ManageData.DeleteActivity(activity);
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activity.ActivityId));
if (indexActivity != null)
{
MonthActivities?.RemoveAt(indexActivity.Value);
PrepareRenderingData();
ApplyFilter();
}
IsLoading = false;
}
private async Task OnActivityCreated(string activityId)
{
IsLoading = true;
var activity = (await ManageData.GetActivity(x => x.ActivityId.Equals(activityId))).LastOrDefault();
if (activity == null)
{
IsLoading = false;
return;
}
var date = activity.EffectiveDate ?? activity.EstimatedDate;
if (CurrentMonth.Month != date!.Value.Month)
{
IsLoading = false;
return;
}
MonthActivities.Add(activity);
PrepareRenderingData();
IsLoading = false;
ApplyFilter();
}
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];
PrepareRenderingData(); // Ricalcola i dati di rendering
ApplyFilter();
}
}
private void ToggleFilter()
{
OpenFilter = !OpenFilter;
StateHasChanged();
}
private void ApplyFilter()
{
FilteredActivities = GetFilteredActivitiesForDay(SelectedDate);
// Aggiorna i dati di rendering se il filtro è cambiato
if (Expanded)
{
PrepareMonthDaysData();
}
else
{
PrepareWeekDaysData();
}
StateHasChanged();
}
// Metodo ottimizzato per il rendering dei filtri
private List<ActivityDTO> ReturnFilteredActivity(DateTime day)
{
return GetFilteredActivitiesForDay(day);
}
}

View File

@@ -71,12 +71,12 @@
gap: 0.2rem; gap: 0.2rem;
} }
.week-day > div:first-child { .week-day > div:first-child {
font-size: 0.8rem; font-size: 0.8rem;
color: var(--mud-palette-primary); color: var(--mud-palette-text-primary);
margin-bottom: 0.2rem; margin-bottom: 0.2rem;
font-weight: 500; font-weight: 500;
} }
.day { .day {
background: var(--mud-palette-surface); background: var(--mud-palette-surface);
@@ -85,13 +85,14 @@
cursor: pointer; cursor: pointer;
transition: background 0.3s ease, transform 0.2s ease; transition: background 0.3s ease, transform 0.2s ease;
font-size: 0.95rem; font-size: 0.95rem;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); box-shadow: var(--custom-box-shadow);
width: 38px; width: 38px;
height: 38px; height: 38px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
color: var(--mud-palette-text-primary);
border: 1px solid var(--mud-palette-surface); border: 1px solid var(--mud-palette-surface);
margin: 0 auto; margin: 0 auto;
} }
@@ -107,9 +108,9 @@
} }
.day.selected { .day.selected {
background: var(--mud-palette-secondary); background: var(--mud-palette-tertiary);
border: 1px solid var(--mud-palette-secondary); border: 1px solid var(--mud-palette-tertiary);
color: white; color: var(--mud-palette-secondary);
} }
.day.today { border: 1px solid var(--mud-palette-primary); } .day.today { border: 1px solid var(--mud-palette-primary); }
@@ -119,12 +120,14 @@
gap: 1rem; gap: 1rem;
overflow-y: auto; overflow-y: auto;
flex-direction: column; flex-direction: column;
height: 75vh;
-ms-overflow-style: none; -ms-overflow-style: none;
scrollbar-width: none; scrollbar-width: none;
padding-bottom: 45px; padding-bottom: 70px;
height: calc(100% - 130px);
} }
.appointments.ah-calendar-m { height: calc(100% - 315px) !important; }
.appointments::-webkit-scrollbar { display: none; } .appointments::-webkit-scrollbar { display: none; }
.appointment { .appointment {
@@ -132,13 +135,13 @@
border-radius: 8px; border-radius: 8px;
padding: 0.8rem; padding: 0.8rem;
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); box-shadow: var(--custom-box-shadow);
} }
.toggle-month { .toggle-month {
background: none; background: none;
border: none; border: none;
color: var(--mud-palette-primary); color: var(--mud-palette-text-primary);
font-size: 1rem; font-size: 1rem;
cursor: pointer; cursor: pointer;
} }
@@ -159,4 +162,6 @@
.event-dot.interna { background-color: var(--mud-palette-success-darken); } .event-dot.interna { background-color: var(--mud-palette-success-darken); }
.event-dot.commessa { background-color: var(--mud-palette-warning); } .event-dot.commessa { background-color: var(--mud-palette-warning); }
@supports (-webkit-touch-callout: none) { .appointments { padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important; } }

View File

@@ -1,5 +1,5 @@
@page "/" @page "/"
@using Template.Shared.Core.Interface @using salesbook.Shared.Core.Interface
@attribute [Authorize] @attribute [Authorize]
@inject IFormFactor FormFactor @inject IFormFactor FormFactor
@inject INetworkService NetworkService @inject INetworkService NetworkService

View File

@@ -1,6 +1,6 @@
@page "/login" @page "/login"
@using Template.Shared.Components.Layout.Spinner @using salesbook.Shared.Components.Layout.Spinner
@using Template.Shared.Core.Services @using salesbook.Shared.Core.Services
@inject IUserAccountService UserAccountService @inject IUserAccountService UserAccountService
@inject AppAuthenticationStateProvider AuthenticationStateProvider @inject AppAuthenticationStateProvider AuthenticationStateProvider
@@ -10,41 +10,33 @@
} }
else else
{ {
<div class="center-box container d-flex justify-content-center align-items-center min-vh-100"> <div class="login-page">
<div class="row rounded-4 bg-white"> <div class="container container-top-logo">
<img src="_content/salesbook.Shared/images/salesbook-marchio_vers.positiva.svg" class="logo" alt="sales book">
<div class="appName rounded-4 d-flex justify-content-center align-items-center flex-column"> </div>
<span>Nome App</span> <div class="container container-login">
</div> <div class="login-form-container">
<div class="input-group">
<div class="col-md-6 right-box"> <MudTextField @bind-Value="UserData.Username" Label="Username" Variant="Variant.Outlined"/>
<div class="row align-items-center"> </div>
<div class="input-group mb-2"> <div class="input-group">
<MudTextField @bind-Value="UserData.Username" Label="Username" Variant="Variant.Text"/> <MudTextField InputType="@_passwordInput" @bind-Value="UserData.Password" Label="Password" Variant="Variant.Outlined" Adornment="Adornment.End" AdornmentIcon="@_passwordInputIcon" OnAdornmentClick="ShowPassword" AdornmentAriaLabel="Show Password"/>
</div> </div>
<div class="input-group mb-2"> <div class="input-group mb-2">
<MudTextField InputType="@_passwordInput" @bind-Value="UserData.Password" Label="Password" Variant="Variant.Text" Adornment="Adornment.End" AdornmentIcon="@_passwordInputIcon" OnAdornmentClick="ShowPassword" AdornmentAriaLabel="Show Password" /> <MudTextField @bind-Value="UserData.CodHash" Label="Profilo azienda" Variant="Variant.Outlined"/>
</div>
<div class="input-group mb-4">
<MudTextField @bind-Value="UserData.CodHash" Label="Profilo azienda" Variant="Variant.Text"/>
</div>
<div class="input-group">
<div class="button-login" @onclick="SignInUser">
<span>Login</span>
</div>
</div>
</div> </div>
<div class="my-4 login-footer"> <MudButton OnClick="SignInUser" Color="Color.Primary" Variant="Variant.Filled">Login</MudButton>
<span>Powered by</span>
<img src="_content/Template.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
</div>
@if (_attemptFailed) @if (_attemptFailed)
{ {
<MudAlert Class="my-3" Dense="true" Severity="Severity.Error" Variant="Variant.Filled">@ErrorMessage</MudAlert> <MudAlert Class="my-3" Dense="true" Severity="Severity.Error" Variant="Variant.Filled">@ErrorMessage</MudAlert>
} }
</div> </div>
<div class="my-4 login-footer">
<span>Powered by</span>
<img src="_content/salesbook.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
</div>
</div> </div>
</div> </div>
} }

View File

@@ -0,0 +1,54 @@
.login-page {
height: 100%;
display: flex;
flex-direction: column;
background: var(--mud-palette-surface);
}
.container-top-logo > .logo {
width: 50%;
}
.container-login > span {
font-size: large;
font-weight: 900;
text-align: center;
}
.container-top-logo {
height: 35vh;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
.login-form-container {
display: flex;
flex-direction: column;
gap: 1rem;
}
.container-login {
height: 100%;
display: flex;
flex-direction: column;
padding: 4px 16px 16px;
justify-content: space-between;
}
.login-footer {
width: 100%;
display: flex;
justify-content: center;
}
.login-footer span {
font-size: 9px;
color: var(--mud-palette-gray-darker);
}
.login-footer img {
height: 15px;
margin-left: 4px;
}

View File

@@ -0,0 +1,19 @@
@page "/Notifications"
@attribute [Authorize]
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Interface
@inject IPageTitleService PageTitleService
@* <HeaderLayout Title="Notifiche" /> *@
<div class="container">
<NoDataAvailable Text="Nessuna notifica meno recente" />
</div>
@code {
protected override void OnInitialized()
{
PageTitleService?.SetTitle("Notifiche");
}
}

View File

@@ -0,0 +1,163 @@
@page "/PersonalInfo"
@attribute [Authorize]
@using salesbook.Shared.Core.Authorization.Enum
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Services
@inject AppAuthenticationStateProvider AuthenticationStateProvider
@inject INetworkService NetworkService
@inject IFormFactor FormFactor
@* <HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/> *@
@if (IsLoggedIn)
{
<div class="container content">
<div class="container-primary-info">
<div class="section-primary-info">
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
@UtilityString.ExtractInitials(UserSession.User.Fullname)
</MudAvatar>
<div class="personal-info">
<span class="info-nome">@UserSession.User.Fullname</span>
@if (UserSession.User.KeyGroup is not null)
{
<span class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
}
</div>
</div>
<div class="divider"></div>
<div class="section-info">
<div class="section-personal-info">
<div>
<span class="info-title">Telefono</span>
<span class="info-text">000 0000000</span> @*Todo: to implement*@
</div>
<div>
<span class="info-title">Status</span>
@if (NetworkService.IsNetworkAvailable())
{
<div class="status online">
<i class="ri-wifi-line"></i>
<span>Online</span>
</div>
}
else
{
<div class="status offline">
<i class="ri-wifi-off-line"></i>
<span>Offline</span>
</div>
}
</div>
</div>
<div class="section-personal-info">
<div>
<span class="info-title">E-mail</span>
<span class="info-text">
@if (string.IsNullOrEmpty(UserSession.User.Email))
{
@("Nessuna mail configurata")
}
else
{
@UserSession.User.Email
}
</span>
</div>
<div>
<span class="info-title">Ultima sincronizzazione</span>
<span class="info-text">@LastSync.ToString("g")</span>
</div>
</div>
</div>
</div>
<div class="container-button">
<MudButton Class="button-settings green-icon"
FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium"
OnClick="() => UpdateDb(true)"
Variant="Variant.Outlined">
Sincronizza
</MudButton>
<div class="divider"></div>
<MudButton Class="button-settings red-icon"
FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium"
OnClick="() => UpdateDb()"
Variant="Variant.Outlined">
Ripristina dati
</MudButton>
</div>
<div class="container-button">
<MudButton Class="button-settings exit"
FullWidth="true"
Color="Color.Error"
Size="Size.Medium"
OnClick="Logout"
Variant="Variant.Outlined">
Esci
</MudButton>
</div>
</div>
}
@code {
private bool Unavailable { get; set; }
private bool IsLoggedIn { get; set; }
private DateTime LastSync { get; set; }
protected override async Task OnInitializedAsync()
{
IsLoggedIn = await UserSession.IsLoggedIn();
await LoadData();
}
private async Task LoadData()
{
await Task.Run(() =>
{
Unavailable = FormFactor.IsWeb() || !NetworkService.IsNetworkAvailable();
LastSync = LocalStorage.Get<DateTime>("last-sync");
});
StateHasChanged();
}
private void OpenSettings() =>
NavigationManager.NavigateTo("/settings/Profilo");
private async Task Logout()
{
await AuthenticationStateProvider.SignOut();
IsLoggedIn = await UserSession.IsLoggedIn();
StateHasChanged();
}
private void UpdateDb(bool withData = false)
{
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
string path;
if (withData)
path = pathAndQuery == null ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : $"/sync/{DateTime.Today:yyyy-MM-dd}?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
else
path = pathAndQuery == null ? "/sync" : "/sync?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
NavigationManager.NavigateTo(path, replace: true);
}
}

View File

@@ -0,0 +1,83 @@
.container-primary-info {
box-shadow: var(--custom-box-shadow);
width: 100%;
margin-bottom: 2rem;
border-radius: 12px;
}
.container-primary-info .divider {
margin: 0 0 0 7rem;
width: unset;
}
.section-primary-info {
display: flex;
flex-direction: row;
align-items: center;
gap: 1.5rem;
padding: .8rem 1.2rem .4rem;
}
.personal-info {
display: flex;
flex-direction: column;
align-items: flex-start;
line-height: normal;
}
.info-nome {
color: var(--mud-palette-text-primary);
font-weight: 800;
font-size: x-large;
}
.info-section {
color: var(--mud-palette-gray-default);
font-size: medium;
font-weight: 600;
}
.section-info {
display: flex;
justify-content: space-between;
flex-direction: row;
padding: .4rem 1.2rem .8rem;
}
.section-personal-info {
display: flex;
flex-direction: column;
}
.section-personal-info > div {
display: flex;
flex-direction: column;
line-height: normal;
margin: .25rem 0;
}
.info-title {
color: var(--mud-palette-gray-darker);
font-weight: 800;
}
.info-text {
color: var(--mud-palette-text-secondary);
font-weight: 700;
font-size: small;
}
.content ::deep .user-button { border: 1px solid var(--card-border-color) !important; }
.user-button > i { font-size: large; }
.user-button > span {
font-size: medium;
font-weight: 600;
}
.status { font-weight: 700; }
.status.online { color: var(--mud-palette-success); }
.status.offline { color: var(--mud-palette-error); }

View File

@@ -1,8 +1,8 @@
@page "/settings" @page "/settings"
@page "/settings/{BackTo}" @page "/settings/{BackTo}"
@using Template.Shared.Components.Layout @using salesbook.Shared.Components.Layout
<HeaderLayout BackTo="@BackTo" ShowNotifications="false" Back="true" Title="Impostazioni"/> <HeaderLayout BackTo="@BackTo" Back="true" Title="Impostazioni"/>
<div class="content"> <div class="content">

View File

@@ -1,7 +1,7 @@
@page "/sync" @page "/sync"
@page "/sync/{DateFilter}" @page "/sync/{DateFilter}"
@using Template.Shared.Components.Layout.Spinner @using salesbook.Shared.Components.Layout.Spinner
@using Template.Shared.Core.Interface @using salesbook.Shared.Core.Interface
@inject ISyncDbService syncDb @inject ISyncDbService syncDb
@inject IManageDataService manageData @inject IManageDataService manageData

View File

@@ -0,0 +1,121 @@
@page "/User/{CodAnag}"
@attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Spinner
@inject IManageDataService ManageData
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="" ShowProfile="false"/>
@if (IsLoading)
{
<SpinnerLayout FullScreen="true"/>
}
else
{
<div class="container content">
<div class="container-primary-info">
<div class="section-primary-info">
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
@UtilityString.ExtractInitials(Anag.RagSoc)
</MudAvatar>
<div class="personal-info">
<span class="info-nome">@Anag.RagSoc</span>
@if (UserSession.User.KeyGroup is not null)
{
<span class="info-section">@Anag.Indirizzo</span>
<span class="info-section">@($"{Anag.Cap} - {Anag.Citta} ({Anag.Prov})")</span>
}
</div>
</div>
<div class="divider"></div>
<div class="section-info">
<div class="section-personal-info">
<div>
<span class="info-title">Telefono</span>
<span class="info-text">
@if (string.IsNullOrEmpty(Anag.Telefono))
{
@("Nessuna mail configurata")
}
else
{
@Anag.Telefono
}
</span>
</div>
</div>
<div class="section-personal-info">
<div>
<span class="info-title">E-mail</span>
<span class="info-text">
@if (string.IsNullOrEmpty(Anag.EMail))
{
@("Nessuna mail configurata")
}
else
{
@Anag.EMail
}
</span>
</div>
</div>
</div>
</div>
@if (PersRif is { Count: > 0 })
{
<div class="container-pers-rif">
<Virtualize Items="PersRif" Context="person">
@{
var index = PersRif.IndexOf(person);
var isLast = index == PersRif.Count - 1;
}
<ContactCard Contact="person" />
@if (!isLast)
{
<div class="divider"></div>
}
</Virtualize>
</div>
}
<div class="container-button">
<MudButton Class="button-settings infoText"
FullWidth="true"
Size="Size.Medium"
Variant="Variant.Outlined">
Aggiungi contatto
</MudButton>
</div>
</div>
}
@code {
[Parameter] public string CodAnag { get; set; }
private AnagClie Anag { get; set; } = new();
private List<VtbCliePersRif>? PersRif { get; set; }
private bool IsLoading { get; set; } = true;
protected override async Task OnInitializedAsync()
{
await LoadData();
}
private async Task LoadData()
{
Anag = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodAnag))).Last();
PersRif = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodAnag));
IsLoading = false;
StateHasChanged();
}
}

View File

@@ -2,7 +2,7 @@
box-shadow: var(--custom-box-shadow); box-shadow: var(--custom-box-shadow);
width: 100%; width: 100%;
margin-bottom: 2rem; margin-bottom: 2rem;
border-radius: 12px; border-radius: 16px;
} }
.container-primary-info .divider { .container-primary-info .divider {
@@ -28,12 +28,12 @@
.info-nome { .info-nome {
color: var(--mud-palette-text-primary); color: var(--mud-palette-text-primary);
font-weight: 800; font-weight: 800;
font-size: x-large; font-size: medium;
} }
.info-section { .info-section {
color: var(--mud-palette-gray-default); color: var(--mud-palette-gray-default);
font-size: medium; font-size: small;
font-weight: 600; font-weight: 600;
} }
@@ -85,9 +85,8 @@
.container-button { .container-button {
width: 100%; width: 100%;
box-shadow: var(--custom-box-shadow); box-shadow: var(--custom-box-shadow);
padding: .5rem 0; padding: .25rem 0;
border-radius: 12px; border-radius: 16px;
margin-bottom: 2rem;
} }
.container-button .divider { .container-button .divider {
@@ -104,17 +103,19 @@
min-height: 25px; min-height: 25px;
} }
.container-button ::deep .button-settings.green-icon .mud-icon-root { .container-button ::deep .button-settings.infoText { color: var(--mud-palette-info); }
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 { .container-button ::deep .button-settings.green-icon .mud-icon-root {
border: 1px solid var(--mud-palette-error); border: 1px solid var(--mud-palette-success);
background: hsl(from var(--mud-palette-error-lighten) h s 95%); background: hsl(from var(--mud-palette-success-lighten) h s 95%);
color: var(--mud-palette-error-darken); color: var(--mud-palette-success-darken);
} }
.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 { .container-button ::deep .button-settings .mud-button-label {
justify-content: flex-start; justify-content: flex-start;
@@ -128,4 +129,19 @@
justify-content: center; justify-content: center;
font-size: 1.1rem; font-size: 1.1rem;
line-height: normal; line-height: normal;
}
.container-pers-rif {
width: 100%;
display: flex;
flex-direction: column;
gap: 1rem;
margin-bottom: 1rem;
box-shadow: var(--custom-box-shadow);
border-radius: 16px;
}
.container-pers-rif .divider {
margin: 0 0 0 3.5rem;
width: unset;
} }

View File

@@ -0,0 +1,129 @@
@page "/Users"
@attribute [Authorize]
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@inject IManageDataService ManageData
@inject IPageTitleService PageTitleService
@* <HeaderLayout Title="Contatti"/> *@
<div class="container search-box">
<div class="input-card clearButton">
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500" />
@if (!TextToFilter.IsNullOrEmpty())
{
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
}
</div>
</div>
<div class="container users">
@if (GroupedUserList?.Count > 0)
{
<Virtualize Items="FilteredGroupedUserList" Context="item">
@if (item.ShowHeader)
{
<div class="letter-header">@item.HeaderLetter</div>
}
<UserCard User="item.User"/>
</Virtualize>
}
</div>
@code {
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
private string? TextToFilter { get; set; }
protected override void OnInitialized()
{
PageTitleService?.SetTitle("Contatti");
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await LoadData();
StateHasChanged();
}
}
private async Task LoadData()
{
var users = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
var sortedUsers = users
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
.OrderBy(u =>
{
var firstChar = char.ToUpper(u.RagSoc[0]);
return char.IsLetter(firstChar) ? firstChar.ToString() : "ZZZ";
})
.ThenBy(u => u.RagSoc)
.ToList();
GroupedUserList = [];
string? lastHeader = null;
foreach (var user in sortedUsers)
{
var firstChar = char.ToUpper(user.RagSoc[0]);
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
var showHeader = currentLetter != lastHeader;
lastHeader = currentLetter;
GroupedUserList.Add(new UserDisplayItem
{
User = user,
ShowHeader = showHeader,
HeaderLetter = currentLetter
});
}
FilterUsers();
}
private class UserDisplayItem
{
public required AnagClie User { get; set; }
public bool ShowHeader { get; set; }
public string? HeaderLetter { get; set; }
}
private void FilterUsers() => FilterUsers(false);
private void FilterUsers(bool clearFilter)
{
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
{
TextToFilter = null;
FilteredGroupedUserList = GroupedUserList;
return;
}
var filter = TextToFilter.Trim();
var result = new List<UserDisplayItem>();
foreach (var item in GroupedUserList)
{
var user = item.User;
if (
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase))
)
{
result.Add(item);
}
}
FilteredGroupedUserList = result;
}
}

View File

@@ -0,0 +1,33 @@
.users {
display: flex;
gap: 1rem;
overflow-y: auto;
flex-direction: column;
-ms-overflow-style: none;
scrollbar-width: none;
padding-bottom: 70px;
height: 100%;
}
.users .divider {
margin: .1rem 0;
margin-left: 3rem;
}
.users .input-card { margin: 0 !important; }
.letter-header {
border-bottom: 1px solid var(--card-border-color);
font-weight: bolder;
}
.search-box {
position: sticky;
top: 0;
background: var(--mud-palette-surface);
padding-bottom: .5rem;
}
.search-box .input-card {
margin: 0 !important;
}

View File

@@ -1,3 +1,4 @@
@using salesbook.Shared.Components.SingleElements
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
<ErrorBoundary @ref="ErrorBoundary"> <ErrorBoundary @ref="ErrorBoundary">
@@ -33,14 +34,15 @@
</ChildContent> </ChildContent>
<ErrorContent> <ErrorContent>
@* <ExceptionModal @ref="ExceptionModal" <ExceptionModal @ref="ExceptionModal"
Exception="@context" Exception="@context"
ErrorBoundary="@ErrorBoundary" ErrorBoundary="@ErrorBoundary"
OnRetry="() => ErrorBoundary?.Recover()"/> *@ OnRetry="() => ErrorBoundary?.Recover()"/>
</ErrorContent> </ErrorContent>
</ErrorBoundary> </ErrorBoundary>
@code { @code {
private ErrorBoundary? ErrorBoundary { get; set; } private ErrorBoundary? ErrorBoundary { get; set; }
// private ExceptionModal ExceptionModal { get; set; } private ExceptionModal ExceptionModal { get; set; }
} }

View File

@@ -1,13 +1,13 @@
@using Template.Shared.Core.Dto @using salesbook.Shared.Core.Dto
@using Template.Shared.Core.Entity @using salesbook.Shared.Core.Entity
@using Template.Shared.Core.Helpers.Enum @using salesbook.Shared.Core.Helpers.Enum
@using Template.Shared.Core.Interface @using salesbook.Shared.Core.Interface
@inject IManageDataService manageData @inject IManageDataService manageData
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div> <div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")"> <div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
<div class="bottom-sheet"> <div class="bottom-sheet pb-safe-area">
<div class="title"> <div class="title">
<MudText Typo="Typo.h6"> <MudText Typo="Typo.h6">
<b>Filtri</b> <b>Filtri</b>

View File

@@ -0,0 +1,151 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Helpers.Enum
@using salesbook.Shared.Core.Interface
@inject IManageDataService manageData
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
<div class="bottom-sheet pb-safe-area">
<div class="title">
<MudText Typo="Typo.h6">
<b>Filtri</b>
</MudText>
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
</div>
<div class="input-card clearButton">
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Filter.Text" DebounceInterval="500"/>
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Filter.Text = null"/>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Assegnata a</span>
<MudSelectExtended SearchBox="true"
ItemCollection="Users.Select(x => x.UserName).ToList()"
SelectAllPosition="SelectAllPosition.NextToSearchBox"
SelectAll="true"
NoWrap="true"
MultiSelection="true"
MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionUser))"
FullWidth="true" T="string"
Variant="Variant.Text"
Virtualize="true"
@bind-SelectedValues="Filter.User"
Class="customIcon-select"
AdornmentIcon="@Icons.Material.Filled.Code"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Tipo</span>
<MudSelectExtended FullWidth="true"
T="string?"
Variant="Variant.Text"
@bind-Value="Filter.Type"
Class="customIcon-select"
AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var type in ActivityType)
{
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Esito</span>
<MudSelectExtended FullWidth="true"
T="string?"
Variant="Variant.Text"
@bind-Value="Filter.Result"
Class="customIcon-select"
AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var result in ActivityResult)
{
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Categoria</span>
<MudSelectExtended FullWidth="true"
T="ActivityCategoryEnum?"
Variant="Variant.Text"
@bind-Value="Filter.Category"
Class="customIcon-select"
AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var category in CategoryList)
{
<MudSelectItemExtended T="ActivityCategoryEnum?" Class="custom-item-select" Value="@category">@category.ConvertToHumanReadable()</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
</div>
<div class="button-section">
<MudButton OnClick="() => Filter = new FilterActivityDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
</div>
</div>
</div>
@code {
[Parameter] public bool IsSheetVisible { get; set; }
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
[Parameter] public FilterActivityDTO Filter { get; set; }
[Parameter] public EventCallback<FilterActivityDTO> FilterChanged { get; set; }
private List<StbActivityResult> ActivityResult { get; set; } = [];
private List<StbActivityType> ActivityType { get; set; } = [];
private List<StbUser> Users { get; set; } = [];
private List<ActivityCategoryEnum> CategoryList { get; set; } = [];
protected override async Task OnParametersSetAsync()
{
if (IsSheetVisible)
await LoadData();
}
private string GetMultiSelectionUser(List<string> selectedValues)
{
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
}
private async Task LoadData()
{
Users = await manageData.GetTable<StbUser>();
ActivityResult = await manageData.GetTable<StbActivityResult>();
ActivityType = await manageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
CategoryList = ActivityCategoryHelper.AllActivityCategory;
StateHasChanged();
}
private void CloseBottomSheet()
{
IsSheetVisible = false;
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
}
private void OnFilterButton()
{
FilterChanged.InvokeAsync(Filter);
CloseBottomSheet();
}
}

View File

@@ -0,0 +1,133 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@inject IManageDataService ManageData
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
<div class="bottom-sheet pb-safe-area">
<div class="title">
<MudText Typo="Typo.h6">
<b>Esito</b>
</MudText>
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => CloseBottomSheet()"/>
</div>
<div class="input-card">
<div class="form-container">
<span>Data effettiva</span>
<MudTextField T="DateTime?" Format="yyyy-MM-dd" InputType="InputType.Date" @bind-Value="EffectiveDate" />
</div>
<div class="divider"></div>
<div class="form-container">
<span>Inizio</span>
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveTime" @bind-Value:after="OnAfterChangeTime"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span>Fine</span>
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveEndTime" @bind-Value:after="OnAfterChangeTime" />
</div>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Esito</span>
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityResultId" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var result in ActivityResult)
{
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
</div>
<div class="input-card">
<MudTextField T="string?" Placeholder="Descrizione esito" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.ResultDescription" />
</div>
<div class="button-section">
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="() => CloseBottomSheet(true)">Salva</MudButton>
</div>
</div>
</div>
@code {
[Parameter] public bool IsSheetVisible { get; set; }
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
[Parameter] public ActivityDTO ActivityModel { get; set; }
[Parameter] public EventCallback<ActivityDTO> ActivityModelChanged { get; set; }
private List<StbActivityResult> ActivityResult { get; set; } = [];
private DateTime? EffectiveDate { get; set; } = DateTime.Today;
private TimeSpan EffectiveTime { get; set; }
private TimeSpan EffectiveEndTime { get; set; }
protected override async Task OnParametersSetAsync()
{
if (IsSheetVisible)
await LoadData();
}
private async Task LoadData()
{
ActivityResult = await ManageData.GetTable<StbActivityResult>();
EffectiveTime = ActivityModel.EffectiveTime?.TimeOfDay ?? TimeSpan.Zero;
EffectiveEndTime = ActivityModel.EffectiveEndtime?.TimeOfDay ?? TimeSpan.Zero;
StateHasChanged();
}
private void CloseBottomSheet(bool save)
{
if (save)
{
if (EffectiveDate != null)
{
ActivityModel.EffectiveTime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
EffectiveTime.Hours, EffectiveTime.Minutes, EffectiveTime.Seconds);
ActivityModel.EffectiveEndtime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
EffectiveEndTime.Hours, EffectiveEndTime.Minutes, EffectiveEndTime.Seconds);
}
if (ActivityModel.ActivityResultId.IsNullOrEmpty())
{
Snackbar.Clear();
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
Snackbar.Add("Esito obbligatorio!", Severity.Error);
return;
}
}
IsSheetVisible = false;
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
if (save)
{
ActivityModelChanged.InvokeAsync(ActivityModel);
}
}
private void CloseBottomSheet() => CloseBottomSheet(false);
private void OnAfterChangeTime()
{
if (EffectiveEndTime < EffectiveTime)
EffectiveEndTime = EffectiveTime + TimeSpan.FromHours(1);
}
}

View File

@@ -1,6 +1,6 @@
@using Template.Shared.Core.Dto @using salesbook.Shared.Core.Dto
@using Template.Shared.Core.Entity @using salesbook.Shared.Core.Entity
@using Template.Shared.Core.Helpers.Enum @using salesbook.Shared.Core.Helpers.Enum
@inject IDialogService Dialog @inject IDialogService Dialog
<div class="activity-card @Activity.Category.ConvertToHumanReadable()" @onclick="OpenActivity"> <div class="activity-card @Activity.Category.ConvertToHumanReadable()" @onclick="OpenActivity">
@@ -65,10 +65,11 @@
@code { @code {
[Parameter] public ActivityDTO Activity { get; set; } = new(); [Parameter] public ActivityDTO Activity { get; set; } = new();
[Parameter] public EventCallback<string> ActivityChanged { get; set; } [Parameter] public EventCallback<string> ActivityChanged { get; set; }
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
private TimeSpan? Durata { get; set; } private TimeSpan? Durata { get; set; }
protected override void OnInitialized() protected override void OnParametersSet()
{ {
Durata = Activity switch Durata = Activity switch
{ {
@@ -80,11 +81,16 @@
private async Task OpenActivity() private async Task OpenActivity()
{ {
var result = await ModalHelpers.OpenActivityForm(Dialog, Activity.ActivityId); var result = await ModalHelpers.OpenActivityForm(Dialog, null, Activity.ActivityId);
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(StbActivity)) switch (result)
{ {
await ActivityChanged.InvokeAsync(((StbActivity)result.Data).ActivityId); case { Canceled: false, Data: not null } when result.Data.GetType() == typeof(StbActivity):
await ActivityChanged.InvokeAsync(((StbActivity)result.Data).ActivityId);
break;
case { Canceled: false, Data: not null } when result.Data.GetType() == typeof(ActivityDTO):
await ActivityDeleted.InvokeAsync((ActivityDTO)result.Data);
break;
} }
} }
} }

View File

@@ -27,7 +27,10 @@
width: 100%; width: 100%;
} }
.activity-hours { font-weight: 700; } .activity-hours {
font-weight: 700;
color: var(--mud-palette-text-primary);
}
.activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; } .activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
@@ -41,6 +44,7 @@
font-weight: 800 !important; font-weight: 800 !important;
margin: 0 !important; margin: 0 !important;
line-height: normal !important; line-height: normal !important;
color: var(--mud-palette-text-primary);
} }
.activity-body-section ::deep > .activity-subtitle { .activity-body-section ::deep > .activity-subtitle {

View File

@@ -0,0 +1,32 @@
@using salesbook.Shared.Core.Entity
<div class="contact-card">
<div class="contact-left-section">
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large" />
<div class="contact-body-section">
<div class="title-section">
<MudText Class="contact-title" Typo="Typo.body1" HtmlTag="h3">@UtilityString.FormatString(Contact.PersonaRif).TitleCase</MudText>
</div>
@if (Contact.Mansione is not null)
{
<MudText Class="contact-subtitle" Typo="Typo.body1" HtmlTag="p">@UtilityString.FormatString(Contact.Mansione).SentenceCase</MudText>
}
</div>
</div>
<div class="contact-right-section">
@if (!Contact.NumCellulare.IsNullOrEmpty())
{
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
}
@if (!Contact.EMail.IsNullOrEmpty()){
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
}
</div>
</div>
@code {
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
}

View File

@@ -0,0 +1,62 @@
.contact-card {
width: 100%;
display: flex;
flex-direction: row;
padding: 0 .75rem;
border-radius: 16px;
line-height: normal;
justify-content: space-between;
align-items: center;
}
.contact-card.memo { border-left: 5px solid var(--mud-palette-info-darken); }
.contact-card.interna { border-left: 5px solid var(--mud-palette-success-darken); }
.contact-card.commessa { border-left: 5px solid var(--mud-palette-warning); }
.contact-left-section {
display: flex;
align-items: center;
gap: 1rem;
}
.title-section {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 100%;
}
.contact-hours { font-weight: 700; }
.contact-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
.contact-body-section {
width: 100%;
display: flex;
flex-direction: column;
}
.title-section ::deep > .contact-title {
font-weight: 700 !important;
margin: 0 !important;
line-height: normal !important;
}
.contact-body-section ::deep > .contact-subtitle {
color: var(--mud-palette-gray-darker);
margin: .2rem 0 !important;
line-height: normal !important;
}
.contact-info-section {
display: flex;
flex-wrap: wrap;
}
.contact-right-section {
display: flex;
flex-direction: row;
gap: 1rem;
}

View File

@@ -0,0 +1,74 @@
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@inject IManageDataService ManageData
<div class="user-card-card">
<div class="user-card-left-section">
<div class="user-card-body-section">
<div class="title-section">
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@Icons.Material.Filled.Person" Size="Size.Large" />
<div class="user-card-right-section">
<div class="user-card-title">
<MudText Typo="Typo.body1" @onclick="OpenUser" HtmlTag="h3">@User.RagSoc</MudText>
<MudIcon @onclick="ShowCommesse" Color="Color.Info" Icon="@Icons.Material.Outlined.Info" Size="Size.Medium"/>
</div>
<div class="user-card-subtitle @(ShowSectionCommesse ? "show" : "")">
@if (ShowSectionCommesse && IsLoading)
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
}
else
{
@if (!Commesse.IsNullOrEmpty())
{
<div @onclick="OpenUser" class="container-commesse">
@foreach (var commessa in Commesse!)
{
<div class="commessa">
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
</div>
}
</div>
}
else
{
<div class="commessa">
<span>Nessuna commessa presente</span>
</div>
}
}
</div>
</div>
</div>
</div>
</div>
</div>
@code {
[Parameter] public AnagClie User { get; set; } = new();
private List<JtbComt>? Commesse { get; set; }
private bool IsLoading { get; set; } = true;
private bool ShowSectionCommesse { get; set; }
private void OpenUser() =>
NavigationManager.NavigateTo($"/User/{User.CodAnag}");
private async Task ShowCommesse()
{
ShowSectionCommesse = !ShowSectionCommesse;
if (ShowSectionCommesse)
{
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodAnag));
IsLoading = false;
StateHasChanged();
return;
}
IsLoading = true;
}
}

Some files were not shown because too many files have changed in this diff Show More