1 Commits

Author SHA1 Message Date
ddc596ef58 Native navigation 2025-07-02 14:12:39 +02:00
92 changed files with 418 additions and 2859 deletions

View File

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

View File

@@ -1,65 +0,0 @@
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Interface;
namespace salesbook.Maui.Core.Services;
public class AttachedService : IAttachedService
{
public async Task<AttachedDTO?> SelectImage()
{
var perm = await Permissions.RequestAsync<Permissions.Photos>();
if (perm != PermissionStatus.Granted) return null;
var result = await FilePicker.PickAsync(new PickOptions
{
PickerTitle = "Scegli un'immagine",
FileTypes = FilePickerFileType.Images
});
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
}
public async Task<AttachedDTO?> SelectFile()
{
var perm = await Permissions.RequestAsync<Permissions.StorageRead>();
if (perm != PermissionStatus.Granted) return null;
var result = await FilePicker.PickAsync();
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Document);
}
public async Task<AttachedDTO?> SelectPosition()
{
var perm = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
if (perm != PermissionStatus.Granted) return null;
var loc = await Geolocation.GetLastKnownLocationAsync();
if (loc is null) return null;
return new AttachedDTO
{
Name = "Posizione attuale",
Lat = loc.Latitude,
Lng = loc.Longitude,
Type = AttachedDTO.TypeAttached.Position
};
}
private static async Task<AttachedDTO> ConvertToDto(FileResult file, AttachedDTO.TypeAttached type)
{
var stream = await file.OpenReadAsync();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
return new AttachedDTO
{
Name = file.FileName,
Path = file.FullPath,
MimeType = file.ContentType,
DimensionBytes= ms.Length,
FileContent = ms.ToArray(),
Type = type
};
}
}

View File

@@ -23,8 +23,6 @@ public class LocalDbService
_connection.CreateTableAsync<StbActivityResult>();
_connection.CreateTableAsync<StbActivityType>();
_connection.CreateTableAsync<StbUser>();
_connection.CreateTableAsync<VtbTipi>();
_connection.CreateTableAsync<Nazioni>();
}
public async Task ResetSettingsDb()
@@ -34,14 +32,10 @@ public class LocalDbService
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_result;");
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_type;");
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_user;");
await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_tipi;");
await _connection.ExecuteAsync("DROP TABLE IF EXISTS nazioni;");
await _connection.CreateTableAsync<StbActivityResult>();
await _connection.CreateTableAsync<StbActivityType>();
await _connection.CreateTableAsync<StbUser>();
await _connection.CreateTableAsync<VtbTipi>();
await _connection.CreateTableAsync<Nazioni>();
}
catch (Exception ex)
{

View File

@@ -12,40 +12,6 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
localDb.Get(whereCond);
public async Task<List<ContactDTO>> GetContact()
{
var contactList = await localDb.Get<AnagClie>(x => x.FlagStato.Equals("A"));
var prospectList = await localDb.Get<PtbPros>();
// Mappa i contatti
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
// Mappa i prospects
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
contactMapper.AddRange(prospectMapper);
return contactMapper;
}
public async Task<ContactDTO?> GetSpecificContact(string codAnag, bool isContact)
{
if (isContact)
{
var contact = (await localDb.Get<AnagClie>(x => x.CodAnag != null && x.CodAnag.Equals(codAnag)))
.LastOrDefault();
return contact == null ? null : mapper.Map<ContactDTO>(contact);
}
else
{
var contact = (await localDb.Get<PtbPros>(x => x.CodPpro != null && x.CodPpro.Equals(codAnag)))
.LastOrDefault();
return contact == null ? null : mapper.Map<ContactDTO>(contact);
}
}
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
{
var activities = await localDb.Get(whereCond);
@@ -103,9 +69,6 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
return returnDto;
}
public Task InsertOrUpdate<T>(List<T> listToSave) =>
localDb.InsertOrUpdate(listToSave);
public Task InsertOrUpdate<T>(T objectToSave) =>
localDb.InsertOrUpdate<T>([objectToSave]);

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

@@ -82,11 +82,5 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
if (!settingsResponse.StbUsers.IsNullOrEmpty())
await localDb.InsertAll(settingsResponse.StbUsers!);
if (!settingsResponse.VtbTipi.IsNullOrEmpty())
await localDb.InsertAll(settingsResponse.VtbTipi!);
if (!settingsResponse.Nazioni.IsNullOrEmpty())
await localDb.InsertAll(settingsResponse.Nazioni!);
}
}

View File

@@ -1,12 +1,11 @@
<?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:local="clr-namespace:salesbook.Maui"
xmlns:shared="clr-namespace:salesbook.Shared;assembly=salesbook.Shared"
x:Class="salesbook.Maui.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">
<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
<BlazorWebView HostPage="wwwroot/index.html">
<BlazorWebView.RootComponents>
<RootComponent Selector="#app" ComponentType="{x:Type shared:Components.Routes}" />
</BlazorWebView.RootComponents>

View File

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

View File

@@ -1,4 +1,3 @@
using AutoMapper;
using CommunityToolkit.Maui;
using CommunityToolkit.Mvvm.Messaging;
using IntegryApiClient.MAUI;
@@ -8,14 +7,13 @@ using MudBlazor.Services;
using MudExtensions.Services;
using salesbook.Maui.Core.Services;
using salesbook.Shared;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Helpers;
using salesbook.Shared.Core.Interface;
using salesbook.Shared.Core.Messages.Activity.Copy;
using salesbook.Shared.Core.Messages.Activity.New;
using salesbook.Shared.Core.Messages.Back;
using salesbook.Shared.Core.Messages.Contact;
using salesbook.Shared.Core.Services;
using System.Globalization;
namespace salesbook.Maui
{
@@ -27,20 +25,15 @@ namespace salesbook.Maui
{
InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("it-IT");
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("it-IT");
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseIntegry(appToken: AppToken, useLoginAzienda: true)
.UseMauiCommunityToolkit()
.UseSentry(options =>
{
options.Dsn = "https://453b6b38f94fd67e40e0d5306d6caff8@o4508499810254848.ingest.de.sentry.io/4509605099667536";
#if DEBUG
options.Debug = true;
#endif
options.TracesSampleRate = 1.0;
})
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); })
.UseLoginAzienda(AppToken);
builder.Services.AddMauiBlazorWebView();
builder.Services.AddMudServices();
@@ -63,7 +56,6 @@ namespace salesbook.Maui
builder.Services.AddScoped<NewActivityService>();
builder.Services.AddScoped<BackNavigationService>();
builder.Services.AddScoped<CopyActivityService>();
builder.Services.AddScoped<NewContactService>();
#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
@@ -71,9 +63,11 @@ namespace salesbook.Maui
#endif
builder.Services.AddSingleton<IFormFactor, FormFactor>();
builder.Services.AddSingleton<IAttachedService, AttachedService>();
builder.Services.AddSingleton<LocalDbService>();
builder.Services.AddSingleton<FilterUserDTO>();
builder.Services.AddSingleton<INavigationService, NavigationService>();
builder.Services.AddSingleton<IPageTitleService, PageTitleService>();
builder.Services.AddTransient<PersonalInfo>();
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,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true"></application>
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>
</manifest>

View File

@@ -1,5 +1,6 @@
using Android.App;
using Android.Content.PM;
using AndroidX.AppCompat.App;
namespace salesbook.Maui
{
@@ -9,5 +10,9 @@ namespace salesbook.Maui
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
{
public MainActivity()
{
AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
}
}
}

View File

@@ -3,7 +3,7 @@ using Android.Runtime;
namespace salesbook.Maui
{
[Application(HardwareAccelerated = true)]
[Application]
public class MainApplication : MauiApplication
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)

View File

@@ -36,14 +36,7 @@
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>L'app utilizza la tua posizione per allegarla alle attività.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Consente di selezionare immagini da allegare alle attività.</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Permette all'app di salvare file o immagini nella tua libreria fotografica se necessario.</string>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict>
</plist>

View File

@@ -29,8 +29,8 @@
<ApplicationId>it.integry.salesbook</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.1.0</ApplicationDisplayVersion>
<ApplicationVersion>5</ApplicationVersion>
<ApplicationDisplayVersion>1.0.0</ApplicationDisplayVersion>
<ApplicationVersion>3</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
@@ -78,9 +78,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
<CodesignKey>Apple Distribution: Integry S.r.l. (UNP26J4R89)</CodesignKey>
<CodesignProvision></CodesignProvision>
<ProvisioningType>manual</ProvisioningType>
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
<CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup>
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
@@ -119,15 +118,14 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="12.0.0" />
<PackageReference Include="CommunityToolkit.Maui" Version="11.2.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.6" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.6" />
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.81" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.81" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.81" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.6" />
<PackageReference Include="Sentry.Maui" Version="5.11.2" />
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.5" />
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.70" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.70" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.70" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
</ItemGroup>
@@ -135,4 +133,16 @@
<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>
</Project>

View File

@@ -1,62 +1,53 @@
@using Microsoft.Maui.Controls
@using salesbook.Shared.Core.Interface
@inject IJSRuntime JS
@inject INavigationService NavigationService
<div class="@(Back ? "" : "container") header">
<div class="header-content @(Back ? "with-back" : "no-back")">
@if (!SmallHeader)
@if (Back)
{
@if (Back)
<div class="left-section">
<MudButton StartIcon="@(!Cancel ? Icons.Material.Outlined.ArrowBackIosNew : "")"
OnClick="GoBack"
Color="Color.Info"
Style="text-transform: none"
Variant="Variant.Text">
@BackTo
</MudButton>
</div>
}
<h3 class="page-title">@Title</h3>
<div class="right-section">
@if (LabelSave.IsNullOrEmpty())
{
<div class="left-section">
<MudButton StartIcon="@(!Cancel ? Icons.Material.Outlined.ArrowBackIosNew : "")"
OnClick="GoBack"
Color="Color.Info"
Style="text-transform: none"
Variant="Variant.Text">
@BackTo
</MudButton>
</div>
}
<h3 class="page-title">@Title</h3>
<div class="right-section">
@if (LabelSave.IsNullOrEmpty())
@if (ShowFilter)
{
@if (ShowFilter)
{
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
}
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
}
@* @if (ShowCalendarToggle)
@* @if (ShowCalendarToggle)
{
<MudIconButton OnClick="OnCalendarToggle" Icon="@Icons.Material.Filled.CalendarMonth" Color="Color.Dark"/>
} *@
@if (ShowProfile)
{
<MudIconButton Class="user" OnClick="OpenPersonalInfo" Icon="@Icons.Material.Filled.Person"/>
}
}
else
@if (ShowProfile)
{
<MudButton OnClick="OnSave"
Color="Color.Info"
Style="text-transform: none"
Variant="Variant.Text">
@LabelSave
</MudButton>
<MudIconButton Class="user" OnClick="OpenPersonalInfo" Icon="@Icons.Material.Filled.Person"/>
}
</div>
}
else
{
<div class="title">
<MudText Typo="Typo.h6">
<b>@Title</b>
</MudText>
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => GoBack()" />
</div>
}
}
else
{
<MudButton OnClick="OnSave"
Color="Color.Info"
Style="text-transform: none"
Variant="Variant.Text">
@LabelSave
</MudButton>
}
</div>
</div>
</div>
@@ -78,8 +69,6 @@
[Parameter] public bool ShowCalendarToggle { get; set; }
[Parameter] public EventCallback OnCalendarToggle { get; set; }
[Parameter] public bool SmallHeader { get; set; }
protected override void OnParametersSet()
{
Back = !Back ? !Back && Cancel : Back;
@@ -97,7 +86,9 @@
await JS.InvokeVoidAsync("goBack");
}
private void OpenPersonalInfo() =>
NavigationManager.NavigateTo("/PersonalInfo");
private async Task OpenPersonalInfo()
{
await NavigationService.NavigateToDetailsAsync();
}
}

View File

@@ -1,12 +1,4 @@
.header {
min-height: var(--mh-header);
width: 100%;
display: flex;
align-items: center;
}
.header-content {
width: 100%;
line-height: normal;
display: flex;
justify-content: space-between;

View File

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

View File

@@ -3,13 +3,12 @@
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Messages.Activity.Copy
@using salesbook.Shared.Core.Messages.Activity.New
@using salesbook.Shared.Core.Messages.Contact
@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 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">
@@ -43,10 +42,10 @@
{
<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"/>
<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 OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
<MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
</ChildContent>
</MudMenu>
@@ -93,14 +92,5 @@
Messenger.Send(new NewActivityMessage(((StbActivity)result.Data).ActivityId));
}
}
}
private async Task CreateUser()
{
var result = await ModalHelpers.OpenUserForm(Dialog, null);
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(CRMCreateContactResponseDTO))
{
Messenger.Send(new NewContactMessage((CRMCreateContactResponseDTO)result.Data));
}
}
}

View File

@@ -1,7 +1,6 @@
@page "/Calendar"
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Components.SingleElements.BottomSheet
@@ -9,12 +8,13 @@
@inject IManageDataService ManageData
@inject IJSRuntime JS
@inject NewActivityService NewActivity
@inject IPageTitleService PageTitleService
<HeaderLayout Title="@_headerTitle"
@* <HeaderLayout Title="@_headerTitle"
ShowFilter="true"
ShowCalendarToggle="true"
OnFilterToggle="ToggleFilter"
OnCalendarToggle="ToggleExpanded"/>
OnCalendarToggle="ToggleExpanded"/> *@
<div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
@if (Expanded)
@@ -259,6 +259,8 @@
private void PrepareHeaderTitle()
{
_headerTitle = CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper();
PageTitleService?.SetTitle(_headerTitle);
}
private void PrepareEventsCache()
@@ -371,9 +373,7 @@
filteredActivity = filteredActivity
.Where(x => Filter.Category == null || x.Category.Equals(Filter.Category));
return filteredActivity
.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime)
.ToList();
return filteredActivity.ToList();
}
[JSInvokable]

View File

@@ -1,24 +1,22 @@
@page "/"
@attribute [Authorize]
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Spinner
@attribute [Authorize]
@inject IFormFactor FormFactor
@inject INetworkService NetworkService
<SpinnerLayout FullScreen="true" />
@code
{
protected override async Task OnInitializedAsync()
protected override Task OnInitializedAsync()
{
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
{
NavigationManager.NavigateTo("/sync");
return;
return base.OnInitializedAsync();
}
NavigationManager.NavigateTo("/Calendar");
return base.OnInitializedAsync();
}
}

View File

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

View File

@@ -1,6 +1,5 @@
@page "/PersonalInfo"
@attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Authorization.Enum
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Services
@@ -8,7 +7,7 @@
@inject INetworkService NetworkService
@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)
{

View File

@@ -1,18 +1,12 @@
@page "/User/{CodContact}/{IsContact:bool}"
@page "/User/{CodAnag}"
@attribute [Authorize]
@using AutoMapper
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Components.SingleElements
@inject IManageDataService ManageData
@inject IMapper Mapper
@inject IDialogService Dialog
@inject INetworkService NetworkService
<HeaderLayout BackTo="Indietro" LabelSave="Modifica" OnSave="() => OpenUserForm(Anag)" Back="true" BackOnTop="true" Title="" ShowProfile="false" />
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="" ShowProfile="false"/>
@if (IsLoading)
{
@@ -29,12 +23,9 @@ else
<div class="personal-info">
<span class="info-nome">@Anag.RagSoc</span>
@if (Anag.Indirizzo != null)
@if (UserSession.User.KeyGroup is not null)
{
<span class="info-section">@Anag.Indirizzo</span>
}
@if (Anag is { Citta: not null, Cap: not null, Prov: not null })
{
<span class="info-section">@($"{Anag.Cap} - {Anag.Citta} ({Anag.Prov})")</span>
}
</div>
@@ -44,104 +35,72 @@ else
<div class="section-info">
<div class="section-personal-info">
@if (!string.IsNullOrEmpty(Anag.Telefono))
{
<div>
<span class="info-title">Telefono</span>
<span class="info-text">
<div>
<span class="info-title">Telefono</span>
<span class="info-text">
@if (string.IsNullOrEmpty(Anag.Telefono))
{
@("Nessuna mail configurata")
}
else
{
@Anag.Telefono
</span>
</div>
}
@if (!string.IsNullOrEmpty(Anag.PartIva))
{
<div>
<span class="info-title">P. IVA</span>
<span class="info-text">
@Anag.PartIva
</span>
</div>
}
}
</span>
</div>
</div>
<div class="section-personal-info">
@if (!string.IsNullOrEmpty(Anag.EMail))
{
<div>
<span class="info-title">E-mail</span>
<span class="info-text">
<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>
}
@if (Agente != null)
{
<div>
<span class="info-title">Agente</span>
<span class="info-text">
@Agente.FullName
</span>
</div>
}
}
</span>
</div>
</div>
</div>
</div>
<MudTabs TabPanelClass="custom-tab-panel" Elevation="2" Rounded="true" PanelClass="pt-2" Centered="true">
<MudTabPanel Text="Contatti">
@if (PersRif is { Count: > 0 })
{
<div style="margin-top: 1rem;" 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>
}
@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"
OnClick="OpenPersRifForm"
Variant="Variant.Outlined">
Aggiungi contatto
</MudButton>
</div>
</MudTabPanel>
<MudTabPanel Text="Commesse">
@if (Commesse.IsNullOrEmpty())
{
<NoDataAvailable Text="Nessuna commessa presente"/>
}
else
{
<Virtualize Items="Commesse" Context="commessa">
<CommessaCard Commessa="commessa"/>
</Virtualize>
}
</MudTabPanel>
</MudTabs>
<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 CodContact { get; set; }
[Parameter] public bool IsContact { get; set; }
[Parameter] public string CodAnag { get; set; }
private ContactDTO Anag { get; set; } = new();
private List<PersRifDTO>? PersRif { get; set; }
private List<JtbComt> Commesse { get; set; }
private StbUser? Agente { get; set; }
private AnagClie Anag { get; set; } = new();
private List<VtbCliePersRif>? PersRif { get; set; }
private bool IsLoading { get; set; } = true;
@@ -152,57 +111,11 @@ else
private async Task LoadData()
{
if (IsContact)
{
var clie = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodContact))).Last();
Anag = Mapper.Map<ContactDTO>(clie);
}
else
{
var pros = (await ManageData.GetTable<PtbPros>(x => x.CodPpro.Equals(CodContact))).Last();
Anag = Mapper.Map<ContactDTO>(pros);
}
await LoadPersRif();
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
if (Anag.CodVage != null)
{
Agente = (await ManageData.GetTable<StbUser>(x => x.UserCode != null && x.UserCode.Equals(Anag.CodVage))).LastOrDefault();
}
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();
}
private async Task LoadPersRif()
{
if (IsContact)
{
var pers = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodContact));
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
}
else
{
var pers = await ManageData.GetTable<PtbProsRif>(x => x.CodPpro.Equals(Anag.CodContact));
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
}
}
private async Task OpenPersRifForm()
{
var result = await ModalHelpers.OpenPersRifForm(Dialog, null, Anag, PersRif);
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(PersRifDTO))
{
await LoadPersRif();
}
}
private async Task OpenUserForm(ContactDTO anag)
{
var result = await ModalHelpers.OpenUserForm(Dialog, anag);
}
}

View File

@@ -139,21 +139,9 @@
margin-bottom: 1rem;
box-shadow: var(--custom-box-shadow);
border-radius: 16px;
max-height: 32vh;
overflow: auto;
scrollbar-width: none;
}
.container-pers-rif::-webkit-scrollbar { display: none; }
.container-pers-rif .divider {
margin: 0 0 0 3.5rem;
width: unset;
}
.custom-tab-panel {
width: 100%;
display: flex;
gap: 1rem;
flex-direction: column;
}

View File

@@ -1,46 +1,27 @@
@page "/Users"
@attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.SingleElements.BottomSheet
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Messages.Contact
@using salesbook.Shared.Core.Interface
@inject IManageDataService ManageData
@inject NewContactService NewContact
@inject FilterUserDTO Filter
@inject IPageTitleService PageTitleService
<HeaderLayout Title="Contatti"/>
@* <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"/>
<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)"/>
}
<MudIconButton Class="rounded-button" OnClick="ToggleFilter" Icon="@Icons.Material.Rounded.FilterList" Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" />
</div>
<MudChipSet Class="mt-2" T="string" @bind-SelectedValue="TypeUser" @bind-SelectedValue:after="FilterUsers" SelectionMode="SelectionMode.SingleSelection">
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("all")">Tutti</MudChip>
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("contact")">Clienti</MudChip>
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("prospect")">Prospect</MudChip>
</MudChipSet>
</div>
<div class="container users">
@if (IsLoading)
@if (GroupedUserList?.Count > 0)
{
<SpinnerLayout FullScreen="false"/>
}
else if (GroupedUserList?.Count > 0)
{
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
<Virtualize Items="FilteredGroupedUserList" Context="item">
@if (item.ShowHeader)
{
<div class="letter-header">@item.HeaderLetter</div>
@@ -48,29 +29,16 @@
<UserCard User="item.User"/>
</Virtualize>
}
else
{
<NoDataAvailable Text="Nessun contatto trovato"/>
}
</div>
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="FilterUsers"/>
@code {
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
private bool IsLoading { get; set; }
//Filtri
private string? TextToFilter { get; set; }
private bool OpenFilter { get; set; }
private string TypeUser { get; set; } = "all";
protected override void OnInitialized()
{
NewContact.OnContactCreated += async response => await OnUserCreated(response);
Console.WriteLine($"Filter HashCode: {Filter.GetHashCode()} - IsInitialized: {Filter.IsInitialized}");
PageTitleService?.SetTitle("Contatti");
}
protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -78,25 +46,13 @@
if (firstRender)
{
await LoadData();
StateHasChanged();
}
}
private async Task LoadData()
{
IsLoading = true;
StateHasChanged();
if (!Filter.IsInitialized)
{
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
if (loggedUser.UserCode != null)
Filter.Agenti = [loggedUser.UserCode];
Filter.IsInitialized = true;
}
var users = await ManageData.GetContact();
var users = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
var sortedUsers = users
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
@@ -111,6 +67,7 @@
GroupedUserList = [];
string? lastHeader = null;
foreach (var user in sortedUsers)
{
var firstChar = char.ToUpper(user.RagSoc[0]);
@@ -128,15 +85,11 @@
}
FilterUsers();
IsLoading = false;
StateHasChanged();
}
private class UserDisplayItem
{
public required ContactDTO User { get; set; }
public required AnagClie User { get; set; }
public bool ShowHeader { get; set; }
public string? HeaderLetter { get; set; }
}
@@ -148,57 +101,23 @@
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;
switch (TypeUser)
{
case "contact" when !user.IsContact:
case "prospect" when user.IsContact:
continue;
}
var matchesFilter =
(Filter.Prov.IsNullOrEmpty() ||
(!string.IsNullOrEmpty(user.Prov) &&
user.Prov.Trim().Contains(Filter.Prov!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
(Filter.Citta.IsNullOrEmpty() ||
(!string.IsNullOrEmpty(user.Citta) &&
user.Citta.Trim().Contains(Filter.Citta!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
(Filter.Nazione.IsNullOrEmpty() ||
(!string.IsNullOrEmpty(user.Nazione) &&
user.Nazione.Trim().Contains(Filter.Nazione!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
(Filter.Indirizzo.IsNullOrEmpty() ||
(!string.IsNullOrEmpty(user.Indirizzo) &&
user.Indirizzo.Trim().Contains(Filter.Indirizzo!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
(!Filter.ConAgente || user.CodVage is not null) &&
(!Filter.SenzaAgente || user.CodVage is null) &&
(Filter.Agenti.IsNullOrEmpty() || (user.CodVage != null && Filter.Agenti!.Contains(user.CodVage)));
if (!matchesFilter) continue;
if (!string.IsNullOrWhiteSpace(TextToFilter))
{
var filter = TextToFilter.Trim();
var matchesText =
(!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));
if (matchesText)
{
result.Add(item);
}
}
else
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);
}
@@ -207,95 +126,4 @@
FilteredGroupedUserList = result;
}
private async Task OnUserCreated(CRMCreateContactResponseDTO response)
{
IsLoading = true;
string codAnag;
bool isContact;
switch (response)
{
case null:
return;
case { AnagClie: null, PtbPros: not null }:
await ManageData.InsertOrUpdate(response.PtbPros);
isContact = false;
codAnag = response.PtbPros.CodPpro!;
break;
case { AnagClie: not null, PtbPros: null }:
await ManageData.InsertOrUpdate(response.AnagClie);
isContact = true;
codAnag = response.AnagClie.CodAnag!;
break;
default:
return;
}
var contact = await ManageData.GetSpecificContact(codAnag, isContact);
if (contact == null)
{
IsLoading = false;
return;
}
var firstChar = char.ToUpper(contact.RagSoc![0]);
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
var insertIndex = -1;
var foundHeader = false;
for (var i = 0; i < GroupedUserList.Count; i++)
{
var current = GroupedUserList[i];
if (!current.ShowHeader || current.HeaderLetter != currentLetter) continue;
foundHeader = true;
insertIndex = i + 1;
while (insertIndex < GroupedUserList.Count &&
GroupedUserList[insertIndex].HeaderLetter == currentLetter &&
string.Compare(contact.RagSoc, GroupedUserList[insertIndex].User.RagSoc, StringComparison.OrdinalIgnoreCase) > 0)
{
insertIndex++;
}
break;
}
if (!foundHeader)
{
var headerItem = new UserDisplayItem
{
HeaderLetter = currentLetter,
ShowHeader = true,
User = contact
};
GroupedUserList.Add(headerItem);
}
else
{
var newItem = new UserDisplayItem
{
HeaderLetter = currentLetter,
ShowHeader = false,
User = contact
};
GroupedUserList.Insert(insertIndex, newItem);
}
FilterUsers();
IsLoading = false;
}
private void ToggleFilter()
{
OpenFilter = !OpenFilter;
StateHasChanged();
}
}

View File

@@ -28,6 +28,6 @@
padding-bottom: .5rem;
}
.search-box .input-card { margin: 0 !important; }
.search-box .input-card ::deep .rounded-button { border-radius: 50%; }
.search-box .input-card {
margin: 0 !important;
}

View File

@@ -1,4 +1,4 @@
@using salesbook.Shared.Components.SingleElements.Modal.ExceptionModal
@using salesbook.Shared.Components.SingleElements
@inject NavigationManager NavigationManager
<ErrorBoundary @ref="ErrorBoundary">

View File

@@ -1,45 +0,0 @@
<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>Aggiungi un promemoria</b>
</MudText>
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => CloseBottomSheet()"/>
</div>
<div class="input-card">
<div class="form-container">
<span>Data</span>
<MudTextField T="DateTime?" Format="yyyy-MM-dd" InputType="InputType.Date" @bind-Value="Date" />
</div>
</div>
<div class="input-card">
<MudTextField T="string?" Placeholder="Memo" Variant="Variant.Text" Lines="4" @bind-Value="Memo" />
</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; }
private DateTime? Date { get; set; } = DateTime.Today;
private string? Memo { get; set; }
private void CloseBottomSheet(bool save)
{
IsSheetVisible = false;
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
}
private void CloseBottomSheet() => CloseBottomSheet(false);
}

View File

@@ -1,5 +1,6 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Helpers.Enum
@using salesbook.Shared.Core.Interface
@inject IManageDataService manageData
@@ -14,81 +15,89 @@
<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">Con agente</span>
<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"/>
<MudCheckBox @bind-Value="Filter.ConAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeConAgente"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Senza agente</span>
<span class="disable-full-width">Tipo</span>
<MudCheckBox @bind-Value="Filter.SenzaAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeSenzaAgente"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Agente</span>
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
@bind-SelectedValues="Filter.Agenti" @bind-SelectedValues:after="OnAfterChangeAgenti"
MultiSelection="true" MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionAgente))"
SelectAllPosition="SelectAllPosition.NextToSearchBox" SelectAll="true"
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var user in Users)
<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="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
<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="input-card">
<div class="form-container">
<MudTextField T="string?"
Placeholder="Indirizzo"
Variant="Variant.Text"
@bind-Value="Filter.Indirizzo"
DebounceInterval="500"/>
</div>
<div class="divider"></div>
<div class="form-container">
<MudTextField T="string?"
Placeholder="Città"
Variant="Variant.Text"
@bind-Value="Filter.Citta"
DebounceInterval="500"/>
</div>
<div class="divider"></div>
<div class="form-container">
<MudTextField T="string?"
Placeholder="Provincia"
Variant="Variant.Text"
@bind-Value="Filter.Prov"
DebounceInterval="500"/>
</div>
<div class="divider"></div>
<div class="form-container">
<MudTextField T="string?"
Placeholder="Nazione"
Variant="Variant.Text"
@bind-Value="Filter.Nazione"
DebounceInterval="500"/>
</div>
</div>
<div class="button-section">
<MudButton OnClick="ClearFilters" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
<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>
@@ -98,10 +107,13 @@
[Parameter] public bool IsSheetVisible { get; set; }
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
[Parameter] public FilterUserDTO Filter { get; set; }
[Parameter] public EventCallback<FilterUserDTO> FilterChanged { 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()
{
@@ -109,14 +121,19 @@
await LoadData();
}
private async Task LoadData()
private string GetMultiSelectionUser(List<string> selectedValues)
{
Users = await manageData.GetTable<StbUser>(x => x.KeyGroup == 5);
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
}
private string GetMultiSelectionAgente(List<string> selectedValues)
private async Task LoadData()
{
return $"{selectedValues.Count} Agent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
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()
@@ -131,27 +148,4 @@
CloseBottomSheet();
}
private void OnAfterChangeAgenti()
{
if (Filter.Agenti == null || !Filter.Agenti.Any()) return;
Filter.ConAgente = false;
Filter.SenzaAgente = false;
}
private void ClearFilters()
{
Filter.ConAgente = false;
Filter.SenzaAgente = false;
Filter.Agenti = [];
Filter.Indirizzo = null;
Filter.Citta = null;
Filter.Nazione = null;
Filter.Prov = null;
}
private void OnAfterChangeConAgente() => Filter.SenzaAgente = false;
private void OnAfterChangeSenzaAgente() => Filter.ConAgente = false;
}

View File

@@ -1,124 +0,0 @@
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Overlay
@inject IIntegryApiService IntegryApiService
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
<div style="height: 95vh" class="bottom-sheet pb-safe-area">
<div class="title">
<MudText Typo="Typo.h6">
<b>Cerca indirizzo</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="Address" DebounceInterval="500" OnDebounceIntervalElapsed="SearchAllAddress" />
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Address = null" />
</div>
<div>
@if (Loading)
{
<SpinnerLayout />
}
else
{
if (Addresses != null)
{
foreach (var address in Addresses)
{
<b><span @onclick="() => OnSelectAddress(address.PlaceId)">@address.Description</span></b>
<div class="divider"></div>
}
}
else
{
<NoDataAvailable Text="Nessun indirizzo trovato" />
}
}
</div>
</div>
</div>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
@code {
[Parameter] public string Region { get; set; }
[Parameter] public IndirizzoDTO Indirizzo { get; set; }
[Parameter] public EventCallback<IndirizzoDTO> IndirizzoChanged { get; set; }
[Parameter] public bool IsSheetVisible { get; set; }
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
private bool Loading { get; set; }
private string? Address { get; set; }
private List<AutoCompleteAddressDTO>? Addresses { get; set; }
private string? Uuid { get; set; }
//Overlay for save
private bool VisibleOverlay { get; set; }
private bool SuccessAnimation { get; set; }
protected override async Task OnParametersSetAsync()
{
if (IsSheetVisible)
{
Uuid = Guid.NewGuid().ToString();
Address = null;
Addresses = null;
}
}
private void CloseBottomSheet()
{
IsSheetVisible = false;
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
}
private async Task SearchAllAddress()
{
if (Address == null || Uuid == null) return;
Loading = true;
StateHasChanged();
Addresses = await IntegryApiService.AutoCompleteAddress(Address, Region, Uuid);
Loading = false;
StateHasChanged();
}
private async Task OnSelectAddress(string placeId)
{
CloseBottomSheet();
VisibleOverlay = true;
StateHasChanged();
try
{
Indirizzo = await IntegryApiService.PlaceDetails(placeId, Uuid);
await IndirizzoChanged.InvokeAsync(Indirizzo);
}
catch (Exception e)
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
Snackbar.Clear();
Snackbar.Add("Impossibile selezionare questo indirizzo", Severity.Error);
}
VisibleOverlay = false;
StateHasChanged();
}
}

View File

@@ -1,24 +0,0 @@
@using salesbook.Shared.Core.Entity
<div style="margin-top: 1rem;" class="activity-card">
<div class="activity-left-section">
<div class="activity-body-section">
<div class="title-section">
<MudText Class="activity-title" Typo="Typo.body1" HtmlTag="h3">@Commessa.Descrizione</MudText>
<div class="activity-hours-section">
<span class="activity-hours">
@Commessa.CodJcom
</span>
</div>
</div>
</div>
</div>
<div class="activity-info-section">
<MudChip T="string" Icon="@IconConstants.Chip.User" Size="Size.Small">Stato</MudChip>
</div>
</div>
@code {
[Parameter] public JtbComt Commessa { get; set; } = new();
}

View File

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

View File

@@ -1,9 +1,8 @@
@using salesbook.Shared.Core.Dto
@inject IDialogService Dialog
@using salesbook.Shared.Core.Entity
<div class="contact-card" @onclick="OpenPersRifForm">
<div class="contact-card">
<div class="contact-left-section">
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large"/>
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large" />
<div class="contact-body-section">
<div class="title-section">
@@ -19,25 +18,15 @@
<div class="contact-right-section">
@if (!Contact.NumCellulare.IsNullOrEmpty())
{
<a href="@($"tel:{Contact.NumCellulare}")">
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone"/>
</a>
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
}
@if (!Contact.EMail.IsNullOrEmpty())
{
<a href="@($"mailto:{Contact.EMail}")">
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline"/>
</a>
@if (!Contact.EMail.IsNullOrEmpty()){
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
}
</div>
</div>
@code {
[Parameter] public PersRifDTO Contact { get; set; } = new();
private async Task OpenPersRifForm()
{
var result = await ModalHelpers.OpenPersRifForm(Dialog, Contact);
}
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
}

View File

@@ -1,4 +1,3 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@inject IManageDataService ManageData
@@ -7,7 +6,7 @@
<div class="user-card-left-section">
<div class="user-card-body-section">
<div class="title-section">
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
<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">
@@ -48,14 +47,14 @@
</div>
@code {
[Parameter] public ContactDTO User { get; set; } = new();
[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.CodContact}/{User.IsContact}");
NavigationManager.NavigateTo($"/User/{User.CodAnag}");
private async Task ShowCommesse()
{
@@ -63,7 +62,7 @@
if (ShowSectionCommesse)
{
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodContact));
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodAnag));
IsLoading = false;
StateHasChanged();
return;

View File

@@ -1,3 +1,6 @@
@using salesbook.Shared.Core.Services
@inject AppAuthenticationStateProvider AuthenticationStateProvider
<div class="container container-modal">
<div class="c-modal">
<div class="exception-header mb-2">

View File

@@ -1,7 +1,6 @@
@using System.Globalization
@using System.Text.RegularExpressions
@using CommunityToolkit.Mvvm.Messaging
@using Java.Util.Jar
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Entity
@@ -13,7 +12,6 @@
@inject INetworkService NetworkService
@inject IIntegryApiService IntegryApiService
@inject IMessenger Messenger
@inject IDialogService Dialog
<MudDialog Class="customDialog-form">
<DialogContent>
@@ -118,52 +116,10 @@
<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 class="container-chip-attached">
@if (!AttachedList.IsNullOrEmpty())
{
foreach (var item in AttachedList!.Select((p, index) => new { p, index }))
{
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
{
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success" OnClose="() => OnRemoveAttached(item.index)">
@item.p.Description
</MudChip>
}
else
{
<MudChip T="string" Color="Color.Default" OnClose="() => OnRemoveAttached(item.index)">
@item.p.Name
</MudChip>
}
}
}
@if (ActivityFileList != null)
{
foreach (var file in ActivityFileList)
{
<MudChip T="string" Color="Color.Default">
@file.FileName
</MudChip>
}
}
</div>
<div class="container-button">
<MudButton Class="button-settings green-icon"
FullWidth="true"
StartIcon="@Icons.Material.Rounded.AttachFile"
Size="Size.Medium"
OnClick="OpenAddAttached"
Variant="Variant.Outlined">
Aggiungi allegati
</MudButton>
@if (!IsNew)
{
<div class="divider"></div>
@if (!IsNew)
{
<div class="container-button">
<MudButton Class="button-settings gray-icon"
FullWidth="true"
StartIcon="@Icons.Material.Filled.ContentCopy"
@@ -183,53 +139,27 @@
Variant="Variant.Outlined">
Elimina
</MudButton>
}
</div>
</div>
}
</div>
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
<MessageContent>
Confermi la cancellazione dell'attività corrente?
</MessageContent>
<YesButton>
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
StartIcon="@Icons.Material.Rounded.DeleteForever">
StartIcon="@Icons.Material.Filled.DeleteForever">
Cancella
</MudButton>
</YesButton>
</MudMessageBox>
<MudMessageBox @ref="AddNamePosition" Class="c-messageBox" Title="Nome della posizione" CancelText="Annulla">
<MessageContent>
<MudTextField @bind-Value="NamePosition" Variant="Variant.Outlined" />
</MessageContent>
<YesButton>
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
StartIcon="@Icons.Material.Rounded.Check">
Salva
</MudButton>
</YesButton>
</MudMessageBox>
<MudMessageBox @ref="ConfirmMemo" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
<MessageContent>
Vuoi creare un promemoria?
</MessageContent>
<YesButton>
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
StartIcon="@Icons.Material.Rounded.Check">
Crea
</MudButton>
</YesButton>
</MudMessageBox>
</DialogContent>
</MudDialog>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeEsito"/>
<AddMemo @bind-IsSheetVisible="OpenAddMemo"/>
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
@code {
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
@@ -246,7 +176,6 @@
private List<JtbComt> Commesse { get; set; } = [];
private List<AnagClie> Clienti { get; set; } = [];
private List<PtbPros> Pros { get; set; } = [];
private List<ActivityFileDto>? ActivityFileList { get; set; }
private bool IsNew => Id.IsNullOrEmpty();
private bool IsView => !NetworkService.IsNetworkAvailable();
@@ -257,23 +186,12 @@
private bool VisibleOverlay { get; set; }
private bool SuccessAnimation { get; set; }
private bool OpenEsito { get; set; }
private bool OpenAddMemo { get; set; }
private bool OpenEsito { get; set; } = false;
//MessageBox
private MudMessageBox ConfirmDelete { get; set; }
private MudMessageBox ConfirmMemo { get; set; }
private MudMessageBox AddNamePosition { get; set; }
//Attached
private List<AttachedDTO>? AttachedList { get; set; }
private string? NamePosition { get; set; }
private bool CanAddPosition { get; set; } = true;
protected override async Task OnInitializedAsync()
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
_ = LoadData();
LabelSave = IsNew ? "Aggiungi" : null;
@@ -305,8 +223,6 @@
VisibleOverlay = true;
StateHasChanged();
await SavePosition();
var response = await IntegryApiService.SaveActivity(ActivityModel);
if (response == null)
@@ -316,8 +232,6 @@
await ManageData.InsertOrUpdate(newActivity);
await SaveAttached(newActivity.ActivityId);
SuccessAnimation = true;
StateHasChanged();
@@ -326,43 +240,10 @@
MudDialog.Close(newActivity);
}
private async Task SavePosition()
{
if (AttachedList != null)
{
foreach (var attached in AttachedList)
{
if (attached.Type != AttachedDTO.TypeAttached.Position) continue;
var position = new PositionDTO
{
Description = attached.Description,
Lat = attached.Lat,
Lng = attached.Lng
};
ActivityModel.Position = await IntegryApiService.SavePosition(position);
}
}
}
private async Task SaveAttached(string activityId)
{
if (AttachedList != null)
{
foreach (var attached in AttachedList)
{
if (attached.FileContent is not null && attached.Type != AttachedDTO.TypeAttached.Position)
{
await IntegryApiService.UploadFile(activityId, attached.FileContent, attached.Name);
}
}
}
}
private bool CheckPreSave()
{
Snackbar.Clear();
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
Snackbar.Add("Tipo attività obbligatorio!", Severity.Error);
@@ -372,11 +253,6 @@
private async Task LoadData()
{
if (!IsNew && Id != null)
{
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
}
Users = await ManageData.GetTable<StbUser>();
ActivityResult = await ManageData.GetTable<StbActivityResult>();
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
@@ -441,23 +317,9 @@
}
}
private async Task OnAfterChangeEsito()
{
OnAfterChangeValue();
// var result = await ConfirmMemo.ShowAsync();
// if (result is true)
// OpenAddMemo = !OpenAddMemo;
}
private void OpenSelectEsito()
{
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username)))
{
Snackbar.Add("Non puoi inserire un esito per un'attività che non ti è stata assegnata.", Severity.Info);
return;
}
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username))) return;
OpenEsito = !OpenEsito;
StateHasChanged();
@@ -496,50 +358,9 @@
private void Duplica()
{
var activityCopy = ActivityModel.Clone();
activityCopy.ActivityId = null;
MudDialog.Cancel();
Messenger.Send(new CopyActivityMessage(activityCopy));
}
private async Task OpenAddAttached()
{
var result = await ModalHelpers.OpenAddAttached(Dialog, CanAddPosition);
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(AttachedDTO))
{
var attached = (AttachedDTO)result.Data;
if (attached.Type == AttachedDTO.TypeAttached.Position)
{
CanAddPosition = false;
var resultNamePosition = await AddNamePosition.ShowAsync();
if (resultNamePosition is true)
attached.Description = NamePosition;
attached.Name = NamePosition!;
}
AttachedList ??= [];
AttachedList.Add(attached);
LabelSave = "Aggiorna";
}
}
private void OnRemoveAttached(int index)
{
if (AttachedList is null || index < 0 || index >= AttachedList.Count)
return;
var attached = AttachedList[index];
if (attached.Type == AttachedDTO.TypeAttached.Position)
CanAddPosition = true;
AttachedList.RemoveAt(index);
StateHasChanged();
}
}

View File

@@ -1,8 +1,3 @@
.container-chip-attached {
width: 100%;
margin-bottom: 1rem;
}
.container-button {
background: var(--mud-palette-background-gray) !important;
box-shadow: unset;

View File

@@ -1,85 +0,0 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Overlay
@inject IAttachedService AttachedService
<MudDialog Class="customDialog-form">
<DialogContent>
<HeaderLayout ShowProfile="false" SmallHeader="true" Cancel="true" OnCancel="() => MudDialog.Cancel()" Title="Aggiungi allegati"/>
<div style="margin-bottom: 1rem;" class="content attached">
<MudFab Size="Size.Small" Color="Color.Primary"
StartIcon="@Icons.Material.Rounded.Image"
Label="Immagini" OnClick="OnImage"/>
<MudFab Size="Size.Small" Color="Color.Primary"
StartIcon="@Icons.Material.Rounded.InsertDriveFile"
Label="File" OnClick="OnFile"/>
@if (CanAddPosition)
{
<MudFab Size="Size.Small" Color="Color.Primary"
StartIcon="@Icons.Material.Rounded.AddLocationAlt"
Label="Posizione" OnClick="OnPosition"/>
}
</div>
</DialogContent>
</MudDialog>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
@code {
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
[Parameter] public bool CanAddPosition { get; set; }
//Overlay for save
private bool VisibleOverlay { get; set; }
private bool SuccessAnimation { get; set; }
private AttachedDTO? Attached { get; set; }
protected override async Task OnInitializedAsync()
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
_ = LoadData();
}
private async Task LoadData()
{
}
private async Task Save()
{
VisibleOverlay = true;
StateHasChanged();
SuccessAnimation = true;
StateHasChanged();
await Task.Delay(1250);
MudDialog.Close();
}
private async Task OnImage()
{
Attached = await AttachedService.SelectImage();
MudDialog.Close(Attached);
}
private async Task OnFile()
{
Attached = await AttachedService.SelectFile();
MudDialog.Close(Attached);
}
private async Task OnPosition()
{
Attached = await AttachedService.SelectPosition();
MudDialog.Close(Attached);
}
}

View File

@@ -1,7 +0,0 @@
.content.attached {
display: flex;
flex-direction: column;
gap: 2rem;
padding: 1rem;
height: unset;
}

View File

@@ -1,564 +0,0 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Overlay
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Components.SingleElements.BottomSheet
@inject IManageDataService ManageData
@inject INetworkService NetworkService
@inject IIntegryApiService IntegryApiService
@inject IDialogService Dialog
<MudDialog Class="customDialog-form">
<DialogContent>
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
<div class="content">
<div class="input-card">
<MudTextField ReadOnly="IsView"
T="string?"
Placeholder="Azienda"
Variant="Variant.Text"
Lines="1"
@bind-Value="ContactModel.RagSoc"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Nazione</span>
@if (Nazioni.IsNullOrEmpty())
{
<span class="warning-text">Nessuna nazione trovata</span>
}
else
{
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Nazioni.IsNullOrEmpty())" T="string?"
Variant="Variant.Text" @bind-Value="ContactModel.Nazione" @bind-Value:after="OnAfterChangeValue"
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var nazione in Nazioni)
{
<MudSelectItemExtended Class="custom-item-select" Value="@nazione.CodNazioneAlpha2">@($"{nazione.Descrizione}")</MudSelectItemExtended>
}
</MudSelectExtended>
}
</div>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">P. IVA</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.PartIva"
@bind-Value:after="OnAfterChangePIva"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Cod. Fiscale</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.CodFisc"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Tipo cliente</span>
@if (VtbTipi.IsNullOrEmpty())
{
<span class="warning-text">Nessun tipo cliente trovato</span>
}
else
{
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || VtbTipi.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ContactModel.CodVtip" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var tipo in VtbTipi)
{
<MudSelectItemExtended Class="custom-item-select" Value="@tipo.CodVtip">@($"{tipo.CodVtip} - {tipo.Descrizione}")</MudSelectItemExtended>
}
</MudSelectExtended>
}
</div>
</div>
@if (!IsView)
{
<div class="container-button mb-3">
<MudButton Class="button-settings blue-icon"
FullWidth="true"
StartIcon="@Icons.Material.Rounded.Search"
Size="Size.Medium"
OnClick="() => OpenSearchAddress = !OpenSearchAddress"
Variant="Variant.Outlined">
Cerca indirizzo
</MudButton>
</div>
}
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Indirizzo</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
Lines="1"
FullWidth="true"
Class="customIcon-select"
@bind-Value="ContactModel.Indirizzo"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">CAP</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.Cap"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Città</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.Citta"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Provincia</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
MaxLength="2"
Lines="1"
@bind-Value="ContactModel.Prov"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">PEC</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.EMailPec"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">E-Mail</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.EMail"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Telefono</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="ContactModel.Telefono"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Agente</span>
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
@bind-Value="ContactModel.CodVage" @bind-Value:after="OnAfterChangeValue"
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var user in Users)
{
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
}
</MudSelectExtended>
</div>
</div>
@if (IsNew)
{
<div class="container-chip-persrif">
@if (!PersRifList.IsNullOrEmpty())
{
foreach (var item in PersRifList!.Select((p, index) => new { p, index }))
{
<MudChip T="string" Color="Color.Default" OnClick="() => OpenPersRifForm(item.index, item.p)" OnClose="() => OnRemovePersRif(item.index)">
@item.p.PersonaRif
</MudChip>
}
}
</div>
}
<div class="container-button">
@if (IsNew)
{
<MudButton Class="button-settings gray-icon"
FullWidth="true"
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
Size="Size.Medium"
OnClick="NewPersRif"
Variant="Variant.Outlined">
Persona di riferimento
</MudButton>
}
else
{
@if (NetworkService.IsNetworkAvailable() && !ContactModel.IsContact)
{
<MudButton Class="button-settings blue-icon"
FullWidth="true"
StartIcon="@Icons.Material.Rounded.Sync"
Size="Size.Medium"
OnClick="ConvertProspectToContact"
Variant="Variant.Outlined">
Converti in cliente
</MudButton>
}
}
</div>
</div>
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
<YesButton>
@if (VatAlreadyRegistered)
{
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
StartIcon="@Icons.Material.Rounded.Close">
Chiudi
</MudButton>
}
else
{
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
StartIcon="@Icons.Material.Rounded.Check">
Aggiungi
</MudButton>
}
</YesButton>
</MudMessageBox>
</DialogContent>
</MudDialog>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
<SearchAddress Region="@ContactModel.Nazione" @bind-IsSheetVisible="OpenSearchAddress" @bind-Indirizzo="Address" @bind-Indirizzo:after="OnAddressSet"/>
@code {
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
[Parameter] public ContactDTO? OriginalModel { get; set; }
private ContactDTO ContactModel { get; set; } = new();
private List<VtbTipi>? VtbTipi { get; set; }
private List<PersRifDTO>? PersRifList { get; set; }
private List<Nazioni>? Nazioni { get; set; }
private List<StbUser> Users { get; set; } = [];
private bool IsNew => OriginalModel is null;
private bool IsView => !NetworkService.IsNetworkAvailable();
private string? LabelSave { get; set; }
//Overlay for save
private bool VisibleOverlay { get; set; }
private bool SuccessAnimation { get; set; }
//MessageBox
private MudMessageBox CheckVat { get; set; }
private string VatMessage { get; set; } = "";
private bool VatAlreadyRegistered { get; set; }
//BottomSeath
private bool OpenSearchAddress { get; set; }
private IndirizzoDTO Address { get; set; }
protected override async Task OnInitializedAsync()
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
await LoadData();
LabelSave = IsNew ? "Aggiungi" : null;
}
private async Task Save()
{
VisibleOverlay = true;
StateHasChanged();
var requestDto = new CRMCreateContactRequestDTO
{
TipoAnag = ContactModel.IsContact ? "C" : "P",
Cliente = ContactModel,
PersRif = PersRifList,
CodVage = ContactModel.CodVage
};
var response = await IntegryApiService.SaveContact(requestDto);
switch (response)
{
case null:
VisibleOverlay = false;
StateHasChanged();
return;
case {AnagClie: null, PtbPros: not null}:
await ManageData.InsertOrUpdate(response.PtbPros);
await ManageData.InsertOrUpdate(response.PtbProsRif);
break;
case { AnagClie: not null, PtbPros: null }:
await ManageData.InsertOrUpdate(response.AnagClie);
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
break;
default:
VisibleOverlay = false;
StateHasChanged();
return;
}
SuccessAnimation = true;
StateHasChanged();
await Task.Delay(1250);
MudDialog.Close(response);
}
private async Task LoadData()
{
if (IsNew)
{
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
ContactModel.IsContact = false;
ContactModel.Nazione = "IT";
ContactModel.CodVage = loggedUser.UserCode;
}
else
{
ContactModel = OriginalModel!.Clone();
}
Users = await ManageData.GetTable<StbUser>(x => x.KeyGroup == 5);
Nazioni = await ManageData.GetTable<Nazioni>();
VtbTipi = await ManageData.GetTable<VtbTipi>();
}
private void OnAfterChangeValue()
{
if (!IsNew)
{
LabelSave = !OriginalModel.Equals(ContactModel) ? "Aggiorna" : null;
}
}
private Task NewPersRif() => OpenPersRifForm(null, null);
private async Task OpenPersRifForm(int? index, PersRifDTO? persRif)
{
var result = await ModalHelpers.OpenPersRifForm(Dialog, persRif);
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(PersRifDTO))
{
if (index != null)
OnRemovePersRif(index.Value);
PersRifList ??= [];
PersRifList.Add((PersRifDTO)result.Data);
}
}
private void OnRemovePersRif(int index)
{
if (PersRifList is null || index < 0 || index >= PersRifList.Count)
return;
PersRifList.RemoveAt(index);
StateHasChanged();
}
private async Task OnAfterChangePIva()
{
CheckVatResponseDTO? response = null;
var error = false;
VisibleOverlay = true;
StateHasChanged();
var nazione = Nazioni?.Find(x =>
x.CodNazioneAlpha2.Equals(ContactModel.Nazione) ||
x.CodNazioneIso.Equals(ContactModel.Nazione) ||
x.Nazione.Equals(ContactModel.Nazione)
);
if (nazione == null)
return;
var pIva = ContactModel.PartIva.Trim();
var clie = (await ManageData.GetTable<AnagClie>(x => x.PartIva.Equals(pIva))).LastOrDefault();
if (clie == null)
{
var pros = (await ManageData.GetTable<PtbPros>(x => x.PartIva.Equals(pIva))).LastOrDefault();
if (pros == null)
{
if (nazione.ChkPartIva)
{
if (!IsView)
{
try
{
response = await IntegryApiService.CheckVat(new CheckVatRequestDTO
{
CountryCode = nazione.CodNazioneAlpha2,
VatNumber = pIva
});
VatMessage = $"La p.Iva (<b>{pIva}</b>) corrisponde a:<br><br><b>{response.RagSoc}</b><br><b>{response.CompleteAddress}</b><br><br>Si desidera aggiungere questi dati nel form?";
VatAlreadyRegistered = false;
}
catch (Exception e)
{
Snackbar.Clear();
Snackbar.Add(e.Message, Severity.Error);
error = true;
}
}
else
{
Snackbar.Clear();
Snackbar.Add("La ricerca della partita iva non è al momento disponibile", Severity.Warning);
error = true;
}
}
else
{
Snackbar.Clear();
Snackbar.Add("La ricerca della partita iva non è abilitata per questa nazione", Severity.Warning);
error = true;
}
}
else
{
VatMessage = $"Prospect (<b>{pros.CodPpro}</b>) già censito con la p.iva: <b>{pIva} - {pros.RagSoc}</b>";
VatAlreadyRegistered = true;
}
}
else
{
VatMessage = $"Cliente (<b>{clie.CodAnag}</b>) già censito con la p.iva: <b>{pIva} - {clie.RagSoc}</b>";
VatAlreadyRegistered = true;
}
VisibleOverlay = false;
StateHasChanged();
if (!error)
{
var result = await CheckVat.ShowAsync();
if (result is true && response != null)
{
ContactModel.RagSoc = response.RagSoc;
ContactModel.Indirizzo = response.Indirizzo;
ContactModel.Cap = response.Cap;
ContactModel.Citta = response.Citta;
ContactModel.Prov = response.Prov;
}
}
OnAfterChangeValue();
}
private void OnAddressSet()
{
ContactModel.Citta = Address.Citta;
ContactModel.Indirizzo = Address.Indirizzo;
ContactModel.Prov = Address.Prov;
ContactModel.Cap = Address.Cap;
}
private async Task ConvertProspectToContact()
{
}
}

View File

@@ -1,19 +0,0 @@
.container-button {
background: var(--mud-palette-background-gray) !important;
box-shadow: unset;
}
.container-chip-persrif {
width: 100%;
margin-bottom: 1rem;
}
.search-address {
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 0.65rem;
color: var(--mud-palette-primary);
font-weight: 600;
align-items: center;
}

View File

@@ -1,200 +0,0 @@
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Components.Layout.Overlay
@inject IManageDataService ManageData
@inject INetworkService NetworkService
@inject IIntegryApiService IntegryApiService
<MudDialog Class="customDialog-form">
<DialogContent>
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : "")" />
<div class="content">
<div class="input-card">
<MudTextField ReadOnly="IsView"
T="string?"
Placeholder="Cognome e Nome"
Variant="Variant.Text"
Lines="1"
@bind-Value="PersRifModel.PersonaRif"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="input-card">
<MudTextField ReadOnly="IsView"
T="string?"
Placeholder="Mansione"
Variant="Variant.Text"
Lines="1"
@bind-Value="PersRifModel.Mansione"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue" />
</div>
<div class="input-card">
<div class="form-container">
<span class="disable-full-width">Email</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="PersRifModel.EMail"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Fax</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="PersRifModel.Fax"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Cellulare</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="PersRifModel.NumCellulare"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
</div>
<div class="divider"></div>
<div class="form-container">
<span class="disable-full-width">Telefono</span>
<MudTextField ReadOnly="IsView"
T="string?"
Variant="Variant.Text"
FullWidth="true"
Class="customIcon-select"
Lines="1"
@bind-Value="PersRifModel.Telefono"
@bind-Value:after="OnAfterChangeValue"
DebounceInterval="500"
OnDebounceIntervalElapsed="OnAfterChangeValue" />
</div>
</div>
</div>
</DialogContent>
</MudDialog>
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
@code {
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
[Parameter] public PersRifDTO? OriginalModel { get; set; }
[Parameter] public ContactDTO? ContactModel { get; set; }
[Parameter] public List<PersRifDTO>? PersRifList { get; set; }
private PersRifDTO PersRifModel { get; set; } = new();
private bool IsNew => OriginalModel is null;
private bool IsView => !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()
{
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
_ = LoadData();
LabelSave = IsNew ? "Aggiungi" : null;
}
private async Task Save()
{
VisibleOverlay = true;
StateHasChanged();
if (ContactModel != null && PersRifList != null)
{
PersRifList.Add(PersRifModel);
var requestDto = new CRMCreateContactRequestDTO
{
TipoAnag = ContactModel.IsContact ? "C" : "P",
Cliente = ContactModel,
PersRif = PersRifList,
CodVage = ContactModel.CodVage,
CodAnag = ContactModel.CodContact
};
var response = await IntegryApiService.SaveContact(requestDto);
switch (response)
{
case null:
VisibleOverlay = false;
StateHasChanged();
return;
case {AnagClie: null, PtbPros: not null}:
await ManageData.InsertOrUpdate(response.PtbPros);
await ManageData.InsertOrUpdate(response.PtbProsRif);
break;
case { AnagClie: not null, PtbPros: null }:
await ManageData.InsertOrUpdate(response.AnagClie);
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
break;
default:
VisibleOverlay = false;
StateHasChanged();
return;
}
}
SuccessAnimation = true;
StateHasChanged();
await Task.Delay(1250);
MudDialog.Close(PersRifModel);
}
private async Task LoadData()
{
if (!IsNew)
PersRifModel = OriginalModel!.Clone();
}
private void OnAfterChangeValue()
{
if (!IsNew)
{
LabelSave = !OriginalModel.Equals(PersRifModel) ? "Aggiorna" : null;
}
}
}

View File

@@ -1,4 +0,0 @@
.container-button {
background: var(--mud-palette-background-gray) !important;
box-shadow: unset;
}

View File

@@ -11,8 +11,6 @@ public class ActivityDTO : StbActivity
public bool Complete { get; set; }
public bool Deleted { get; set; }
public PositionDTO? Position { get; set; }
public ActivityDTO Clone()
{

View File

@@ -1,24 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class ActivityFileDto
{
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("fileName")]
public string FileName { get; set; }
[JsonPropertyName("originalSize")]
public int OriginalSize { get; set; }
[JsonPropertyName("lastUpd")]
public DateTime LastUpd { get; set; }
[JsonPropertyName("descrizione")]
public string Descrizione { get; set; }
[JsonPropertyName("modello")]
public string Modello { get; set; }
}

View File

@@ -1,24 +0,0 @@
namespace salesbook.Shared.Core.Dto;
public class AttachedDTO
{
public string Name { get; set; }
public string? Description { get; set; }
public string? MimeType { get; set; }
public long? DimensionBytes { get; set; }
public string? Path { get; set; }
public byte[]? FileContent { get; set; }
public double? Lat { get; set; }
public double? Lng { get; set; }
public TypeAttached Type { get; set; }
public enum TypeAttached
{
Image,
Document,
Position
}
}

View File

@@ -1,12 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class AutoCompleteAddressDTO
{
[JsonPropertyName("description")]
public string Description { get; set; }
[JsonPropertyName("placeId")]
public string PlaceId { get; set; }
}

View File

@@ -1,24 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class CRMCreateContactRequestDTO
{
[JsonPropertyName("codAnag")]
public string? CodAnag { get; set; }
[JsonPropertyName("codVdes")]
public string? CodVdes { get; set; }
[JsonPropertyName("codVage")]
public string? CodVage { get; set; }
[JsonPropertyName("tipoAnag")]
public string TipoAnag { get; set; }
[JsonPropertyName("cliente")]
public ContactDTO Cliente { get; set; }
[JsonPropertyName("persRif")]
public List<PersRifDTO>? PersRif { get; set; }
}

View File

@@ -1,19 +0,0 @@
using System.Text.Json.Serialization;
using salesbook.Shared.Core.Entity;
namespace salesbook.Shared.Core.Dto;
public class CRMCreateContactResponseDTO
{
[JsonPropertyName("anagClie")]
public AnagClie? AnagClie { get; set; }
[JsonPropertyName("ptbPros")]
public PtbPros? PtbPros { get; set; }
[JsonPropertyName("vtbCliePersRif")]
public List<VtbCliePersRif> VtbCliePersRif { get; set; }
[JsonPropertyName("ptbProsRifs")]
public List<PtbProsRif> PtbProsRif { get; set; }
}

View File

@@ -1,12 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class CRMTransferProspectRequestDTO
{
[JsonPropertyName("codAnag")]
public string? CodAnag { get; set; }
[JsonPropertyName("codPpro")]
public string? CodPpro { get; set; }
}

View File

@@ -1,10 +0,0 @@
using salesbook.Shared.Core.Entity;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class CRMTransferProspectResponseDTO
{
[JsonPropertyName("anagClie")]
public AnagClie? AnagClie { get; set; }
}

View File

@@ -1,12 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class CheckVatRequestDTO
{
[JsonPropertyName("countryCode")]
public string CountryCode { get; set; }
[JsonPropertyName("vatNumber")]
public string VatNumber { get; set; }
}

View File

@@ -1,39 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class CheckVatResponseDTO
{
[JsonPropertyName("countryCode")]
public string? CountryCode { get; set; }
[JsonPropertyName("vatNumber ")]
public string? VatNumber { get; set; }
[JsonPropertyName("requestDate")]
public string? RequestDate { get; set; }
[JsonPropertyName("valid")]
public bool Valid { get; set; }
[JsonPropertyName("name")]
public string? Name { get; set; }
[JsonPropertyName("address")]
public string? CompleteAddress { get; set; }
[JsonPropertyName("ragSoc")]
public string? RagSoc { get; set; }
[JsonPropertyName("indirizzo")]
public string? Indirizzo { get; set; }
[JsonPropertyName("cap")]
public string? Cap { get; set; }
[JsonPropertyName("citta")]
public string? Citta { get; set; }
[JsonPropertyName("prov")]
public string? Prov { get; set; }
}

View File

@@ -1,65 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class ContactDTO
{
[JsonPropertyName("codContact")]
public string CodContact { get; set; }
[JsonPropertyName("isContact")]
public bool IsContact { get; set; }
[JsonPropertyName("codVtip")]
public string? CodVtip { get; set; }
[JsonPropertyName("codVage")]
public string? CodVage { get; set; }
[JsonPropertyName("ragSoc")]
public string? RagSoc { get; set; }
[JsonPropertyName("indirizzo")]
public string? Indirizzo { get; set; }
[JsonPropertyName("cap")]
public string? Cap { get; set; }
[JsonPropertyName("citta")]
public string? Citta { get; set; }
[JsonPropertyName("prov")]
public string? Prov { get; set; }
[JsonPropertyName("nazione")]
public string? Nazione { get; set; }
[JsonPropertyName("telefono")]
public string? Telefono { get; set; }
[JsonPropertyName("fax")]
public string Fax { get; set; }
[JsonPropertyName("partIva")]
public string PartIva { get; set; }
[JsonPropertyName("codFisc")]
public string CodFisc { get; set; }
[JsonPropertyName("note")]
public string Note { get; set; }
[JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[JsonPropertyName("eMail")]
public string? EMail { get; set; }
[JsonPropertyName("eMailPec")]
public string EMailPec { get; set; }
public ContactDTO Clone()
{
return (ContactDTO)MemberwiseClone();
}
}

View File

@@ -1,15 +0,0 @@
namespace salesbook.Shared.Core.Dto;
public class FilterUserDTO
{
public bool ConAgente { get; set; }
public bool SenzaAgente { get; set; }
public IEnumerable<string>? Agenti { get; set; }
public string? Indirizzo { get; set; }
public string? Citta { get; set; }
public string? Nazione { get; set; }
public string? Prov { get; set; }
public bool IsInitialized { get; set; }
}

View File

@@ -1,36 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class IndirizzoDTO
{
[JsonPropertyName("idPosizione")]
public int IdPosizione { get; set; }
[JsonPropertyName("via")]
public string? Via { get; set; }
[JsonPropertyName("numeroCivico")]
public string? NumeroCivico { get; set; }
[JsonPropertyName("indirizzo")]
public string? Indirizzo { get; set; }
[JsonPropertyName("cap")]
public string? Cap { get; set; }
[JsonPropertyName("citta")]
public string? Citta { get; set; }
[JsonPropertyName("prov")]
public string? Prov { get; set; }
[JsonPropertyName("nazione")]
public string? Nazione { get; set; }
[JsonPropertyName("lat")]
public decimal? Lat { get; set; }
[JsonPropertyName("lng")]
public decimal? Lng { get; set; }
}

View File

@@ -1,38 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class PersRifDTO
{
[JsonPropertyName("codPersRif")]
public string CodPersRif { get; set; }
[JsonPropertyName("idPersRif")]
public int IdPersRif { get; set; }
[JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
[JsonPropertyName("eMail")]
public string EMail { get; set; }
[JsonPropertyName("fax")]
public string Fax { get; set; }
[JsonPropertyName("mansione")]
public string? Mansione { get; set; }
[JsonPropertyName("numCellulare")]
public string NumCellulare { get; set; }
[JsonPropertyName("telefono")]
public string Telefono { get; set; }
[JsonIgnore]
public int TempId { get; set; }
public PersRifDTO Clone()
{
return (PersRifDTO)MemberwiseClone();
}
}

View File

@@ -1,18 +0,0 @@
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Dto;
public class PositionDTO
{
[JsonPropertyName("id")]
public long? Id { get; set; }
[JsonPropertyName("description")]
public string? Description { get; set; }
[JsonPropertyName("lat")]
public double? Lat { get; set; }
[JsonPropertyName("lng")]
public double? Lng { get; set; }
}

View File

@@ -13,10 +13,4 @@ public class SettingsResponseDTO
[JsonPropertyName("stbUsers")]
public List<StbUser>? StbUsers { get; set; }
[JsonPropertyName("vtbTipi")]
public List<VtbTipi>? VtbTipi { get; set; }
[JsonPropertyName("nazioni")]
public List<Nazioni>? Nazioni { get; set; }
}

View File

@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
public class AnagClie
{
[PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")]
public string? CodAnag { get; set; }
public string CodAnag { get; set; }
[Column("cod_vtip"), JsonPropertyName("codVtip")]
public string? CodVtip { get; set; }

View File

@@ -1,23 +0,0 @@
using System.Text.Json.Serialization;
using SQLite;
namespace salesbook.Shared.Core.Entity;
[Table("nazioni")]
public class Nazioni
{
[PrimaryKey, Column("nazione"), JsonPropertyName("nazione")]
public string Nazione { get; set; }
[Column("cod_nazione_iso"), JsonPropertyName("codNazioneIso")]
public string CodNazioneIso { get; set; }
[Column("cod_nazi_alpha_2"), JsonPropertyName("codNazioneAlpha2")]
public string CodNazioneAlpha2 { get; set; }
[Column("descrizione"), JsonPropertyName("descrizione")]
public string Descrizione { get; set; }
[Column("chk_part_iva"), JsonPropertyName("chkPartIva")]
public bool ChkPartIva { get; set; }
}

View File

@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
public class PtbPros
{
[PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")]
public string? CodPpro { get; set; }
public string CodPpro { get; set; }
[Column("agenzia_banca"), JsonPropertyName("agenziaBanca")]
public string AgenziaBanca { get; set; }

View File

@@ -6,36 +6,11 @@ namespace salesbook.Shared.Core.Entity;
[Table("ptb_pros_rif")]
public class PtbProsRif
{
[PrimaryKey, Column("composite_key")]
public string CompositeKey { get; set; }
private string? _codPpro;
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
public string? CodPpro
{
get => _codPpro;
set
{
_codPpro = value;
if (_codPpro != null && _idPersRif != null)
UpdateCompositeKey();
}
}
private int? _idPersRif;
public string CodPpro { get; set; }
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
public int? IdPersRif
{
get => _idPersRif;
set
{
_idPersRif = value;
if (_codPpro != null && _idPersRif != null)
UpdateCompositeKey();
}
}
public int IdPersRif { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
@@ -54,7 +29,4 @@ public class PtbProsRif
[Column("telefono"), JsonPropertyName("telefono")]
public string Telefono { get; set; }
private void UpdateCompositeKey() =>
CompositeKey = $"{CodPpro}::{IdPersRif}";
}

View File

@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
public class StbActivity
{
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
public string? ActivityId { get; set; }
public string ActivityId { get; set; }
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
public string? ActivityResultId { get; set; }

View File

@@ -6,36 +6,11 @@ namespace salesbook.Shared.Core.Entity;
[Table("stb_activity_type")]
public class StbActivityType
{
[PrimaryKey, Column("composite_key")]
public string CompositeKey { get; set; }
private string? _activityTypeId;
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
public string? ActivityTypeId
{
get => _activityTypeId;
set
{
_activityTypeId = value;
if (_activityTypeId != null && _flagTipologia != null)
UpdateCompositeKey();
}
}
private string? _flagTipologia;
public string ActivityTypeId { get; set; }
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
public string? FlagTipologia
{
get => _flagTipologia;
set
{
_flagTipologia = value;
if (_activityTypeId != null && _flagTipologia != null)
UpdateCompositeKey();
}
}
public string FlagTipologia { get; set; }
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
public double? EstimatedDuration { get; set; } = 0;
@@ -63,7 +38,4 @@ public class StbActivityType
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
public bool FlagViewCalendar { get; set; }
private void UpdateCompositeKey() =>
CompositeKey = $"{ActivityTypeId}::{FlagTipologia}";
}

View File

@@ -11,10 +11,4 @@ public class StbUser
[Column("full_name"), JsonPropertyName("fullName")]
public string FullName { get; set; }
[Column("key_group"), JsonPropertyName("keyGroup")]
public int KeyGroup { get; set; }
[Column("user_code"), JsonPropertyName("userCode")]
public string? UserCode { get; set; }
}

View File

@@ -6,36 +6,11 @@ namespace salesbook.Shared.Core.Entity;
[Table("vtb_clie_pers_rif")]
public class VtbCliePersRif
{
[PrimaryKey, Column("composite_key")]
public string CompositeKey { get; set; }
private int? _idPersRif;
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
public int? IdPersRif
{
get => _idPersRif;
set
{
_idPersRif = value;
if (_idPersRif != null && _codAnag != null)
UpdateCompositeKey();
}
}
private string? _codAnag;
public int IdPersRif { get; set; }
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
public string? CodAnag
{
get => _codAnag;
set
{
_codAnag = value;
if (_idPersRif != null && _codAnag != null)
UpdateCompositeKey();
}
}
public string CodAnag { get; set; }
[Column("persona_rif"), JsonPropertyName("personaRif")]
public string PersonaRif { get; set; }
@@ -63,7 +38,4 @@ public class VtbCliePersRif
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
private void UpdateCompositeKey() =>
CompositeKey = $"{IdPersRif}::{CodAnag}";
}

View File

@@ -6,36 +6,11 @@ namespace salesbook.Shared.Core.Entity;
[Table("vtb_dest")]
public class VtbDest
{
[PrimaryKey, Column("composite_key")]
public string CompositeKey { get; set; }
private string? _codAnag;
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
public string? CodAnag
{
get => _codAnag;
set
{
_codAnag = value;
if (_codAnag != null && _codVdes != null)
UpdateCompositeKey();
}
}
private string? _codVdes;
public string CodAnag { get; set; }
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
public string? CodVdes
{
get => _codVdes;
set
{
_codVdes = value;
if (_codAnag != null && _codVdes != null)
UpdateCompositeKey();
}
}
public string CodVdes { get; set; }
[Column("destinatario"), JsonPropertyName("destinatario")]
public string Destinatario { get; set; }
@@ -219,7 +194,4 @@ public class VtbDest
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
public string CodFiscLegale { get; set; }
private void UpdateCompositeKey() =>
CompositeKey = $"{CodAnag}::{CodVdes}";
}

View File

@@ -1,14 +0,0 @@
using SQLite;
using System.Text.Json.Serialization;
namespace salesbook.Shared.Core.Entity;
[Table("vtb_tipi")]
public class VtbTipi
{
[PrimaryKey, Column("cod_vtip"), JsonPropertyName("codVtip")]
public string CodVtip { get; set; }
[Column("descrizione"), JsonPropertyName("descrizione")]
public string Descrizione { get; set; }
}

View File

@@ -9,23 +9,5 @@ public class MappingProfile : Profile
public MappingProfile()
{
CreateMap<StbActivity, ActivityDTO>();
// Mapping da AnagClie a ContactDTO
CreateMap<AnagClie, ContactDTO>()
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodAnag))
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => true));
// Mapping da PtbPros a ContactDTO
CreateMap<PtbPros, ContactDTO>()
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodPpro))
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => false));
//Mapping da VtbCliePersRif a PersRifDTO
CreateMap<VtbCliePersRif, PersRifDTO>()
.ForMember(x => x.CodPersRif, y => y.MapFrom(z => z.CodAnag));
//Mapping da PtbProsRif a PersRifDTO
CreateMap<PtbProsRif, PersRifDTO>()
.ForMember(x => x.CodPersRif, y => y.MapFrom(z => z.CodPpro));
}
}

View File

@@ -25,64 +25,4 @@ public class ModalHelpers
return await modal.Result;
}
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, ContactDTO? anag)
{
var modal = await dialog.ShowAsync<ContactForm>(
"User form",
new DialogParameters<ContactForm>
{
{ x => x.OriginalModel, anag }
},
new DialogOptions
{
FullScreen = true,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif,
ContactDTO? contactModel = null, List<PersRifDTO>? persRifList = null)
{
var modal = await dialog.ShowAsync<PersRifForm>(
"Pers rif form",
new DialogParameters<PersRifForm>
{
{ x => x.OriginalModel, persRif },
{ x => x.ContactModel, contactModel},
{ x => x.PersRifList, persRifList }
},
new DialogOptions
{
FullScreen = true,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
public static async Task<DialogResult?> OpenAddAttached(IDialogService dialog, bool canAddPosition)
{
var modal = await dialog.ShowAsync<AddAttached>(
"Add attached",
new DialogParameters<AddAttached>
{
{ x => x.CanAddPosition, canAddPosition}
},
new DialogOptions
{
FullScreen = false,
CloseButton = false,
NoHeader = true
}
);
return await modal.Result;
}
}

View File

@@ -1,10 +0,0 @@
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Interface;
public interface IAttachedService
{
Task<AttachedDTO?> SelectImage();
Task<AttachedDTO?> SelectFile();
Task<AttachedDTO?> SelectPosition();
}

View File

@@ -14,20 +14,4 @@ public interface IIntegryApiService
Task DeleteActivity(string activityId);
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request);
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request);
Task UploadFile(string id, byte[] file, string fileName);
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
Task<Stream> DownloadFile(string activityId, string fileName);
//Position
Task<PositionDTO> SavePosition(PositionDTO position);
Task<PositionDTO> RetrievePosition(string id);
//Google
Task<List<IndirizzoDTO>?> Geocode(string address);
Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid);
Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid);
}

View File

@@ -7,13 +7,9 @@ namespace salesbook.Shared.Core.Interface;
public interface IManageDataService
{
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
Task<List<ContactDTO>> GetContact();
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
Task InsertOrUpdate<T>(T objectToSave);
Task InsertOrUpdate<T>(List<T> listToSave);
Task Delete<T>(T objectToDelete);
Task DeleteActivity(ActivityDTO activity);

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

@@ -1,6 +0,0 @@
using CommunityToolkit.Mvvm.Messaging.Messages;
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Messages.Contact;
public class NewContactMessage(CRMCreateContactResponseDTO value) : ValueChangedMessage<CRMCreateContactResponseDTO>(value);

View File

@@ -1,17 +0,0 @@
using CommunityToolkit.Mvvm.Messaging;
using salesbook.Shared.Core.Dto;
namespace salesbook.Shared.Core.Messages.Contact;
public class NewContactService
{
public event Action<CRMCreateContactResponseDTO>? OnContactCreated;
public NewContactService(IMessenger messenger)
{
messenger.Register<NewContactMessage>(this, (_, o) =>
{
OnContactCreated?.Invoke(o.Value);
});
}
}

View File

@@ -3,7 +3,6 @@ using IntegryApiClient.Core.Domain.RestClient.Contacts;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Entity;
using salesbook.Shared.Core.Interface;
using System.Net.Http.Headers;
namespace salesbook.Shared.Core.Services;
@@ -68,82 +67,4 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
public Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request) =>
integryApiRestClient.AuthorizedPost<CRMCreateContactResponseDTO>("crm/createContact", request);
public Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request) =>
integryApiRestClient.AuthorizedPost<CRMTransferProspectResponseDTO>("crm/transferProspect", request)!;
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
public Task<List<IndirizzoDTO>?> Geocode(string address)
{
var queryParams = new Dictionary<string, object>
{
{ "address", address },
{ "retrieveAll", true }
};
return integryApiRestClient.Get<List<IndirizzoDTO>>("geocode", queryParams);
}
public Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid)
{
var queryParams = new Dictionary<string, object>
{
{ "address", address },
{ "language", language },
{ "uuid", uuid }
};
return integryApiRestClient.Get<List<AutoCompleteAddressDTO>>("google/places/autoCompleteAddress", queryParams);
}
public Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid)
{
var queryParams = new Dictionary<string, object>
{
{ "placeId", placeId },
{ "uuid", uuid }
};
return integryApiRestClient.Get<IndirizzoDTO>("google/places/placeDetails", queryParams);
}
public Task UploadFile(string activityId, byte[] file, string fileName)
{
var queryParams = new Dictionary<string, object> { { "activityId", activityId } };
var content = new MultipartFormDataContent();
var fileContent = new ByteArrayContent(file);
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
content.Add(fileContent, "files", fileName);
return integryApiRestClient.Post<object>($"uploadStbActivityFileAttachment", content, queryParams);
}
public Task<List<ActivityFileDto>> GetActivityFile(string activityId)
{
var queryParams = new Dictionary<string, object>
{
{ "activityId", activityId }
};
return integryApiRestClient.AuthorizedGet<List<ActivityFileDto>>($"activity/getActivityFile", queryParams)!;
}
public Task<Stream> DownloadFile(string activityId, string fileName) =>
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!;
public Task<PositionDTO> SavePosition(PositionDTO position) =>
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
public Task<PositionDTO> RetrievePosition(string id)
{
var queryParams = new Dictionary<string, object> { { "id", id } };
return integryApiRestClient.Get<PositionDTO>("retrievePosition", queryParams)!;
}
}

View File

@@ -1,48 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<IsAotCompatible>True</IsAotCompatible>
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="IntegryApiClient.Core" Version="1.1.4" />
<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="System.IdentityModel.Tokens.Jwt" Version="8.11.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.5" />
<PackageReference Include="MudBlazor" Version="8.6.0" />
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="14.0.0" />
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
<PackageReference Include="IntegryApiClient.Core" Version="1.1.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.81" />
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.6" />
<PackageReference Include="MudBlazor" Version="8.6.0" />
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\css\lineicons\" />
<Folder Include="wwwroot\js\bootstrap\" />
</ItemGroup>
<ItemGroup>
<Reference Include="Mono.Android">
<HintPath>..\..\..\..\Program Files\dotnet\packs\Microsoft.Android.Ref.35\35.0.78\ref\net9.0\Mono.Android.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\css\lineicons\" />
<Folder Include="wwwroot\js\bootstrap\" />
</ItemGroup>
</Project>

View File

@@ -31,7 +31,7 @@ a, .btn-link {
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; }
.content {
/*padding-top: 1.1rem;*/
padding-top: 1.1rem;
display: flex;
align-items: center;
flex-direction: column;
@@ -176,7 +176,6 @@ h1:focus { outline: none; }
.customDialog-form .mud-dialog-content {
padding: 0 .75rem;
margin: 0;
overflow: hidden;
}
.custom-item-select { padding: 6px 16px; }

View File

@@ -6,6 +6,5 @@
--exception-box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.3);
--custom-box-shadow: 1px 2px 5px var(--gray-for-shadow);
--mud-default-borderradius: 12px !important;
--m-page-x: 1rem;
--mh-header: 4rem;
--m-page-x: 1.25rem;
}

View File

@@ -41,23 +41,20 @@
}
.form-container > span {
font-weight: 700;
font-weight: 600;
width: 50%;
margin-right: .3rem;
}
.form-container > .warning-text {
font-weight: 700;
font-weight: 500;
color: var(--mud-palette-gray-darker);
width: unset;
margin: 0;
}
.form-container > .disable-full-width {
width: unset !important;
white-space: nowrap;
}
.form-container > .disable-full-width { width: unset !important; }
.dateTime-picker {
display: flex;
@@ -123,12 +120,6 @@
color: var(--mud-palette-dark);
}
.container-button .button-settings.blue-icon .mud-icon-root {
border: 1px solid var(--mud-palette-primary);
background: hsl(from var(--mud-palette-primary-lighten) h s 95%);
color: var(--mud-palette-primary-darken);
}
.container-button .button-settings.green-icon .mud-icon-root {
border: 1px solid hsl(from var(--mud-palette-success-lighten) h s 95%);
background: hsl(from var(--mud-palette-success-lighten) h s 95%);

View File

@@ -17,26 +17,11 @@ public class ManageDataService : IManageDataService
throw new NotImplementedException();
}
public Task<List<ContactDTO>> GetContact()
{
throw new NotImplementedException();
}
public Task<ContactDTO> GetSpecificContact(string codAnag, bool IsContact)
{
throw new NotImplementedException();
}
public Task InsertOrUpdate<T>(T objectToSave)
{
throw new NotImplementedException();
}
public Task InsertOrUpdate<T>(List<T> listToSave)
{
throw new NotImplementedException();
}
public Task Delete<T>(T objectToDelete)
{
throw new NotImplementedException();

View File

@@ -22,8 +22,7 @@ builder.Services.AddScoped<IManageDataService, ManageDataService>();
builder.Services.AddScoped<AppAuthenticationStateProvider>();
builder.Services.AddScoped<AuthenticationStateProvider>(provider => provider.GetRequiredService<AppAuthenticationStateProvider>());
const string appToken = "f0484398-1f8b-42f5-ab79-5282c164e1d8";
builder.Services.UseIntegry(appToken: appToken, useLoginAzienda: true);
builder.Services.UseLoginAzienda("f0484398-1f8b-42f5-ab79-5282c164e1d8");
builder.RootComponents.Add<Routes>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

View File

@@ -16,10 +16,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="IntegryApiClient.Blazor" Version="1.1.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.6" />
<PackageReference Include="IntegryApiClient.Blazor" Version="1.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.5" />
</ItemGroup>
<ItemGroup>