11 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
25 changed files with 214 additions and 83 deletions

View File

@@ -4,17 +4,12 @@ namespace salesbook.Maui
{ {
public partial class App : Application public partial class App : Application
{ {
private readonly IMessenger _messenger;
public App(IMessenger messenger) public App(IMessenger messenger)
{ {
InitializeComponent(); InitializeComponent();
_messenger = messenger;
}
protected override Window CreateWindow(IActivationState? activationState) MainPage = new NavigationPage(new MainPage(messenger));
{
return new Window(new MainPage(_messenger));
} }
} }
} }

View File

@@ -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;

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

@@ -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,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:salesbook.Maui"
xmlns:shared="clr-namespace:salesbook.Shared;assembly=salesbook.Shared" xmlns:shared="clr-namespace:salesbook.Shared;assembly=salesbook.Shared"
x:Class="salesbook.Maui.MainPage" x:Class="salesbook.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

@@ -11,6 +11,8 @@ namespace salesbook.Maui
{ {
InitializeComponent(); InitializeComponent();
_messenger = messenger; _messenger = messenger;
Title = "Home";
} }
protected override bool OnBackButtonPressed() protected override bool OnBackButtonPressed()

View File

@@ -9,11 +9,11 @@ using salesbook.Maui.Core.Services;
using salesbook.Shared; using salesbook.Shared;
using salesbook.Shared.Core.Helpers; using salesbook.Shared.Core.Helpers;
using salesbook.Shared.Core.Interface; using salesbook.Shared.Core.Interface;
using salesbook.Shared.Core.Messages.Activity;
using salesbook.Shared.Core.Messages.Activity.Copy; using salesbook.Shared.Core.Messages.Activity.Copy;
using salesbook.Shared.Core.Messages.Activity.New; using salesbook.Shared.Core.Messages.Activity.New;
using salesbook.Shared.Core.Messages.Back; using salesbook.Shared.Core.Messages.Back;
using salesbook.Shared.Core.Services; using salesbook.Shared.Core.Services;
using System.Globalization;
namespace salesbook.Maui namespace salesbook.Maui
{ {
@@ -25,6 +25,9 @@ namespace salesbook.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>()
@@ -62,6 +65,10 @@ namespace salesbook.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,5 +1,6 @@
using Android.App; using Android.App;
using Android.Content.PM; using Android.Content.PM;
using AndroidX.AppCompat.App;
namespace salesbook.Maui namespace salesbook.Maui
{ {
@@ -9,5 +10,9 @@ namespace salesbook.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

@@ -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

@@ -29,8 +29,8 @@
<ApplicationId>it.integry.salesbook</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'">
@@ -55,8 +55,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup <PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(Configuration)' == 'Debug'">
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(Configuration)' == 'Debug'">
<!--these help speed up android builds--> <!--these help speed up android builds-->
<!-- <!--
@@ -66,16 +65,14 @@
--> -->
</PropertyGroup> </PropertyGroup>
<PropertyGroup <PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">
<!--forces the simulator to pickup entitlements--> <!--forces the simulator to pickup entitlements-->
<EnableCodeSigning>true</EnableCodeSigning> <EnableCodeSigning>true</EnableCodeSigning>
<CodesignRequireProvisioningProfile>true</CodesignRequireProvisioningProfile> <CodesignRequireProvisioningProfile>true</CodesignRequireProvisioningProfile>
<DisableCodesignVerification>true</DisableCodesignVerification> <DisableCodesignVerification>true</DisableCodesignVerification>
</PropertyGroup> </PropertyGroup>
<PropertyGroup <PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
<SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
<DefineConstants>$(DefineConstants);APPLE;PLATFORM</DefineConstants> <DefineConstants>$(DefineConstants);APPLE;PLATFORM</DefineConstants>
</PropertyGroup> </PropertyGroup>
@@ -85,8 +82,7 @@
<CodesignProvision>VS: WildCard Development</CodesignProvision> <CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup> </PropertyGroup>
<ItemGroup <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
<!-- <!--
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" /> <BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
@@ -98,7 +94,7 @@
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'"> <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<!-- Android App Icon --> <!-- Android App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65"/> <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'"> <ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
@@ -137,4 +133,16 @@
<ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" /> <ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="PersonalInfo.xaml.cs">
<DependentUpon>PersonalInfo.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="PersonalInfo.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project> </Project>

View File

@@ -1,4 +1,7 @@
@using Microsoft.Maui.Controls
@using salesbook.Shared.Core.Interface
@inject IJSRuntime JS @inject IJSRuntime JS
@inject INavigationService NavigationService
<div class="@(Back ? "" : "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")">
@@ -83,7 +86,9 @@
await JS.InvokeVoidAsync("goBack"); await JS.InvokeVoidAsync("goBack");
} }
private void OpenPersonalInfo() => private async Task OpenPersonalInfo()
NavigationManager.NavigateTo("/PersonalInfo"); {
await NavigationService.NavigateToDetailsAsync();
}
} }

View File

@@ -1,10 +1,10 @@
@using System.Globalization @using System.Globalization
@using CommunityToolkit.Mvvm.Messaging @using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Messages.Back @using salesbook.Shared.Core.Messages.Back
@inherits LayoutComponentBase @inherits LayoutComponentBase
@inject IJSRuntime JS @inject IJSRuntime JS
@inject IMessenger Messenger
@inject BackNavigationService BackService @inject BackNavigationService BackService
@inject INavigationService NavigationService
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" /> <MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
<MudPopoverProvider/> <MudPopoverProvider/>

View File

@@ -46,7 +46,7 @@
</ActivatorContent> </ActivatorContent>
<ChildContent> <ChildContent>
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem> <MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
<MudMenuItem OnClick="CreateActivity">Nuova attivit<69></MudMenuItem> <MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
</ChildContent> </ChildContent>
</MudMenu> </MudMenu>
} }

View File

@@ -1,21 +1,20 @@
@page "/Calendar" @page "/Calendar"
@using salesbook.Shared.Core.Dto @using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Interface @using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Components.SingleElements @using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Components.Layout.Spinner @using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Components.SingleElements.BottomSheet @using salesbook.Shared.Components.SingleElements.BottomSheet
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Messages.Activity.New @using salesbook.Shared.Core.Messages.Activity.New
@inject IManageDataService ManageData @inject IManageDataService ManageData
@inject IJSRuntime JS @inject IJSRuntime JS
@inject NewActivityService NewActivity @inject NewActivityService NewActivity
@inject IPageTitleService PageTitleService
<HeaderLayout Title="@_headerTitle" @* <HeaderLayout Title="@_headerTitle"
ShowFilter="true" ShowFilter="true"
ShowCalendarToggle="true" ShowCalendarToggle="true"
OnFilterToggle="ToggleFilter" OnFilterToggle="ToggleFilter"
OnCalendarToggle="ToggleExpanded"/> OnCalendarToggle="ToggleExpanded"/> *@
<div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)"> <div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
@if (Expanded) @if (Expanded)
@@ -260,6 +259,8 @@
private void PrepareHeaderTitle() private void PrepareHeaderTitle()
{ {
_headerTitle = CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper(); _headerTitle = CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper();
PageTitleService?.SetTitle(_headerTitle);
} }
private void PrepareEventsCache() private void PrepareEventsCache()

View File

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

View File

@@ -1,6 +1,5 @@
@page "/PersonalInfo" @page "/PersonalInfo"
@attribute [Authorize] @attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Authorization.Enum @using salesbook.Shared.Core.Authorization.Enum
@using salesbook.Shared.Core.Interface @using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Services @using salesbook.Shared.Core.Services
@@ -8,7 +7,7 @@
@inject INetworkService NetworkService @inject INetworkService NetworkService
@inject IFormFactor FormFactor @inject IFormFactor FormFactor
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/> @* <HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/> *@
@if (IsLoggedIn) @if (IsLoggedIn)
{ {

View File

@@ -1,15 +1,15 @@
@page "/Users" @page "/Users"
@attribute [Authorize] @attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Entity @using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface @using salesbook.Shared.Core.Interface
@inject IManageDataService ManageData @inject IManageDataService ManageData
@inject IPageTitleService PageTitleService
<HeaderLayout Title="Contatti"/> @* <HeaderLayout Title="Contatti"/> *@
<div class="container search-box"> <div class="container search-box">
<div class="input-card clearButton"> <div class="input-card clearButton">
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="FilterUsers" DebounceInterval="500"/> <MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500" />
@if (!TextToFilter.IsNullOrEmpty()) @if (!TextToFilter.IsNullOrEmpty())
{ {
@@ -36,6 +36,11 @@
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = []; private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
private string? TextToFilter { get; set; } private string? TextToFilter { get; set; }
protected override void OnInitialized()
{
PageTitleService?.SetTitle("Contatti");
}
protected override async Task OnAfterRenderAsync(bool firstRender) protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
if (firstRender) if (firstRender)
@@ -79,7 +84,7 @@
}); });
} }
FilterUsers(true); FilterUsers();
} }
private class UserDisplayItem private class UserDisplayItem
@@ -93,25 +98,32 @@
private void FilterUsers(bool clearFilter) private void FilterUsers(bool clearFilter)
{ {
if (clearFilter) if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
{ {
TextToFilter = null; TextToFilter = null;
FilteredGroupedUserList = GroupedUserList; FilteredGroupedUserList = GroupedUserList;
StateHasChanged();
return; return;
} }
if (TextToFilter == null) return; var filter = TextToFilter.Trim();
var result = new List<UserDisplayItem>();
FilteredGroupedUserList = GroupedUserList.FindAll(x => foreach (var item in GroupedUserList)
x.User.RagSoc.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase) || {
x.User.Indirizzo.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase) || var user = item.User;
(x.User.Telefono != null && x.User.Telefono.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase)) || if (
(x.User.EMail != null && x.User.EMail.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase)) || (!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
x.User.PartIva.Contains(TextToFilter, 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);
}
}
StateHasChanged(); FilteredGroupedUserList = result;
} }
} }

View File

@@ -11,7 +11,7 @@
<MudText Typo="Typo.h6"> <MudText Typo="Typo.h6">
<b>Esito</b> <b>Esito</b>
</MudText> </MudText>
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/> <MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => CloseBottomSheet()"/>
</div> </div>
<div class="input-card"> <div class="input-card">
@@ -26,7 +26,7 @@
<div class="form-container"> <div class="form-container">
<span>Inizio</span> <span>Inizio</span>
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveTime" /> <MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveTime" @bind-Value:after="OnAfterChangeTime"/>
</div> </div>
<div class="divider"></div> <div class="divider"></div>
@@ -34,7 +34,7 @@
<div class="form-container"> <div class="form-container">
<span>Fine</span> <span>Fine</span>
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveEndTime" /> <MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveEndTime" @bind-Value:after="OnAfterChangeTime" />
</div> </div>
</div> </div>
@@ -56,7 +56,7 @@
</div> </div>
<div class="button-section"> <div class="button-section">
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="CloseBottomSheet">Salva</MudButton> <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="() => CloseBottomSheet(true)">Salva</MudButton>
</div> </div>
</div> </div>
</div> </div>
@@ -90,20 +90,44 @@
StateHasChanged(); StateHasChanged();
} }
private void CloseBottomSheet() private void CloseBottomSheet(bool save)
{ {
if (EffectiveDate != null) if (save)
{ {
ActivityModel.EffectiveTime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day, if (EffectiveDate != null)
EffectiveTime.Hours, EffectiveTime.Minutes, EffectiveTime.Seconds); {
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, ActivityModel.EffectiveEndtime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
EffectiveEndTime.Hours, EffectiveEndTime.Minutes, EffectiveEndTime.Seconds); 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; IsSheetVisible = false;
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible); IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
ActivityModelChanged.InvokeAsync(ActivityModel);
if (save)
{
ActivityModelChanged.InvokeAsync(ActivityModel);
}
}
private void CloseBottomSheet() => CloseBottomSheet(false);
private void OnAfterChangeTime()
{
if (EffectiveEndTime < EffectiveTime)
EffectiveEndTime = EffectiveTime + TimeSpan.FromHours(1);
} }
} }

View File

@@ -69,7 +69,7 @@
private TimeSpan? Durata { get; set; } private TimeSpan? Durata { get; set; }
protected override void OnInitialized() protected override void OnParametersSet()
{ {
Durata = Activity switch Durata = Activity switch
{ {

View File

@@ -1,4 +1,5 @@
@using System.Globalization @using System.Globalization
@using System.Text.RegularExpressions
@using CommunityToolkit.Mvvm.Messaging @using CommunityToolkit.Mvvm.Messaging
@using salesbook.Shared.Core.Dto @using salesbook.Shared.Core.Dto
@using salesbook.Shared.Components.Layout @using salesbook.Shared.Components.Layout
@@ -203,6 +204,8 @@
ActivityModel = ActivityCopied.Clone(); ActivityModel = ActivityCopied.Clone();
} }
await LoadCommesse();
if (IsNew) if (IsNew)
{ {
ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour)); ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour));
@@ -255,7 +258,6 @@
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A")); Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
Pros = await ManageData.GetTable<PtbPros>(); Pros = await ManageData.GetTable<PtbPros>();
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A")); ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
await LoadCommesse();
} }
private async Task LoadCommesse() => private async Task LoadCommesse() =>
@@ -281,31 +283,19 @@
private async Task OnClienteChanged() private async Task OnClienteChanged()
{ {
string? codAnag = null;
ActivityModel.CodJcom = null; ActivityModel.CodJcom = null;
var cliente = Clienti.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase)); if (ActivityModel.Cliente.IsNullOrEmpty()) return;
if (cliente is null)
{
var pros = Pros.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
if (pros is not null) var match = Regex.Match(ActivityModel.Cliente!, @"^\s*(\S+)\s*-\s*(.*)$");
{ if (!match.Success)
codAnag = pros.CodAnag; return;
}
}
else
{
codAnag = cliente.CodAnag;
}
ActivityModel.CodAnag = match.Groups[1].Value;
ActivityModel.Cliente = match.Groups[2].Value;
if (codAnag is not null) await LoadCommesse();
{ OnAfterChangeValue();
ActivityModel.CodAnag = codAnag;
await LoadCommesse();
OnAfterChangeValue();
}
} }
private async Task OnCommessaChanged() private async Task OnCommessaChanged()
@@ -320,6 +310,11 @@
{ {
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null; LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
} }
if (ActivityModel.EstimatedEndtime <= ActivityModel.EstimatedTime)
{
ActivityModel.EstimatedEndtime = ActivityModel.EstimatedTime.Value.AddHours(1);
}
} }
private void OpenSelectEsito() private void OpenSelectEsito()

View File

@@ -0,0 +1,6 @@
namespace salesbook.Shared.Core.Interface;
public interface INavigationService
{
Task NavigateToDetailsAsync();
}

View File

@@ -0,0 +1,6 @@
namespace salesbook.Shared.Core.Interface;
public interface IPageTitleService
{
void SetTitle(string title);
}

View File

@@ -16,6 +16,7 @@
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="IntegryApiClient.Core" Version="1.1.4" /> <PackageReference Include="IntegryApiClient.Core" Version="1.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.5" />
<PackageReference Include="Microsoft.Maui.Controls.Core" Version="9.0.70" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" /> <PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.11.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.5" /> <PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.5" />