Compare commits
35 Commits
10c1435dba
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| c9d7091355 | |||
| d90a194a4e | |||
| de9d415f04 | |||
| b561405ddc | |||
| c93b0c9bec | |||
| c003c29d83 | |||
| 8dfb163cfa | |||
| 068723f31f | |||
| 8ebc6e3b8f | |||
| 9c69884cc9 | |||
| b34f6cb213 | |||
| 7bcb0581cc | |||
| b2064ad71e | |||
| 8c521dc81e | |||
| 65e48777e6 | |||
| bf2e1b65f0 | |||
| 691c132fb6 | |||
| 5d292a12ef | |||
| 60f7d14a72 | |||
| 5fe41f9445 | |||
| e614c83a5b | |||
| c2da42a51b | |||
| ca6be0c0a8 | |||
| ddbf9c832e | |||
| 201cfd4bc6 | |||
| 87264cf3aa | |||
| dba3cd0357 | |||
| 516fcca7cb | |||
| 453e291827 | |||
| 443ed95013 | |||
| a28b8e2f6c | |||
| 108fa715f0 | |||
| 3ad3ec23f0 | |||
| 3f2b7a6bb5 | |||
| a34e673cd2 |
@@ -1,15 +0,0 @@
|
||||
namespace Template.Maui
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
{
|
||||
return new Window(new MainPage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Template.Shared.Core.Messages;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new HardwareBackMessage("back"));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?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>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@@ -1,8 +0,0 @@
|
||||
<maui:MauiWinUIApplication
|
||||
x:Class="Template.Maui.WinUI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:maui="using:Microsoft.Maui"
|
||||
xmlns:local="using:Template.Maui.WinUI">
|
||||
|
||||
</maui:MauiWinUIApplication>
|
||||
@@ -1,25 +0,0 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace Template.Maui.WinUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
public partial class App : MauiWinUIApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="725421B6-1171-41CC-BE20-94A305E6285E" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>$placeholder$</DisplayName>
|
||||
<PublisherDisplayName>User Name</PublisherDisplayName>
|
||||
<Logo>$placeholder$.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
|
||||
<uap:VisualElements
|
||||
DisplayName="$placeholder$"
|
||||
Description="$placeholder$"
|
||||
Square150x150Logo="$placeholder$.png"
|
||||
Square44x44Logo="$placeholder$.png"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
|
||||
<uap:SplashScreen Image="$placeholder$.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
|
||||
</Package>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="Template.Maui.WinUI.app"/>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- The combination of below two tags have the following effect:
|
||||
1) Per-Monitor for >= Windows 10 Anniversary Update
|
||||
2) System < Windows 10 Anniversary Update
|
||||
-->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
@@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
|
||||
<title>Template.Maui</title>
|
||||
<base href="/"/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
|
||||
|
||||
<link href="_content/Template.Shared/css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="_content/Template.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
|
||||
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/remixicon/remixicon.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/app.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/form.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/bottomSheet.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/default-theme.css"/>
|
||||
<link rel="stylesheet" href="Template.Maui.styles.css"/>
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="status-bar-safe-area"></div>
|
||||
|
||||
<div id="app">
|
||||
<div class="spinner-container">
|
||||
<span class="loader"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.webview.js" autostart="false"></script>
|
||||
<script src="_content/Template.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/Sortable.min.js"></script>-->
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
|
||||
<script src="_content/Template.Shared/js/main.js"></script>
|
||||
<script src="_content/Template.Shared/js/calendar.js"></script>
|
||||
<script src="_content/Template.Shared/js/alphaScroll.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,89 +0,0 @@
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-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())
|
||||
{
|
||||
@if (ShowFilter)
|
||||
{
|
||||
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
|
||||
}
|
||||
|
||||
@* @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
|
||||
{
|
||||
<MudButton OnClick="OnSave"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@LabelSave
|
||||
</MudButton>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code{
|
||||
[Parameter] public string? Title { get; set; }
|
||||
[Parameter] public bool ShowFilter { get; set; }
|
||||
[Parameter] public bool ShowProfile { get; set; } = true;
|
||||
[Parameter] public bool Back { get; set; }
|
||||
[Parameter] public bool BackOnTop { get; set; }
|
||||
[Parameter] public string BackTo { get; set; } = "";
|
||||
|
||||
[Parameter] public EventCallback OnFilterToggle { get; set; }
|
||||
|
||||
[Parameter] public bool Cancel { get; set; }
|
||||
[Parameter] public EventCallback OnCancel { get; set; }
|
||||
[Parameter] public string? LabelSave { get; set; }
|
||||
[Parameter] public EventCallback OnSave { get; set; }
|
||||
|
||||
[Parameter] public bool ShowCalendarToggle { get; set; }
|
||||
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Back = !Back ? !Back && Cancel : Back;
|
||||
BackTo = Cancel ? "Annulla" : BackTo;
|
||||
}
|
||||
|
||||
private async Task GoBack()
|
||||
{
|
||||
if (Cancel)
|
||||
{
|
||||
await OnCancel.InvokeAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
}
|
||||
|
||||
private void OpenPersonalInfo() =>
|
||||
NavigationManager.NavigateTo("/PersonalInfo");
|
||||
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
@page "/User/{CodAnag}"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Components.Layout.Spinner
|
||||
@inject IManageDataService ManageData
|
||||
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="" ShowProfile="false"/>
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
<SpinnerLayout FullScreen="true"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="container content">
|
||||
<div class="container-primary-info">
|
||||
<div class="section-primary-info">
|
||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
||||
@UtilityString.ExtractInitials(Anag.RagSoc)
|
||||
</MudAvatar>
|
||||
|
||||
<div class="personal-info">
|
||||
<span class="info-nome">@Anag.RagSoc</span>
|
||||
@if (UserSession.User.KeyGroup is not null)
|
||||
{
|
||||
<span class="info-section">@Anag.Indirizzo</span>
|
||||
<span class="info-section">@($"{Anag.Cap} - {Anag.Citta} ({Anag.Prov})")</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="section-info">
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">Telefono</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(Anag.Telefono))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@Anag.Telefono
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(Anag.EMail))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@Anag.EMail
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (PersRif is { Count: > 0 })
|
||||
{
|
||||
<div class="container-pers-rif">
|
||||
<Virtualize Items="PersRif" Context="person">
|
||||
@{
|
||||
var index = PersRif.IndexOf(person);
|
||||
var isLast = index == PersRif.Count - 1;
|
||||
}
|
||||
<ContactCard Contact="person" />
|
||||
@if (!isLast)
|
||||
{
|
||||
<div class="divider"></div>
|
||||
}
|
||||
</Virtualize>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings infoText"
|
||||
FullWidth="true"
|
||||
Size="Size.Medium"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi contatto
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public string CodAnag { get; set; }
|
||||
|
||||
private AnagClie Anag { get; set; } = new();
|
||||
private List<VtbCliePersRif>? PersRif { get; set; }
|
||||
|
||||
private bool IsLoading { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Anag = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodAnag))).Last();
|
||||
PersRif = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodAnag));
|
||||
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
@page "/Users"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
|
||||
<HeaderLayout Title="Contatti"/>
|
||||
|
||||
<div class="container search-box">
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="FilterUsers" DebounceInterval="500"/>
|
||||
|
||||
@if (!TextToFilter.IsNullOrEmpty())
|
||||
{
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container users">
|
||||
@if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
||||
@if (item.ShowHeader)
|
||||
{
|
||||
<div class="letter-header">@item.HeaderLetter</div>
|
||||
}
|
||||
<UserCard User="item.User"/>
|
||||
</Virtualize>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
||||
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
||||
private string? TextToFilter { get; set; }
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadData();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
var users = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
|
||||
var sortedUsers = users
|
||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||
.OrderBy(u =>
|
||||
{
|
||||
var firstChar = char.ToUpper(u.RagSoc[0]);
|
||||
return char.IsLetter(firstChar) ? firstChar.ToString() : "ZZZ";
|
||||
})
|
||||
.ThenBy(u => u.RagSoc)
|
||||
.ToList();
|
||||
|
||||
GroupedUserList = [];
|
||||
|
||||
string? lastHeader = null;
|
||||
|
||||
foreach (var user in sortedUsers)
|
||||
{
|
||||
var firstChar = char.ToUpper(user.RagSoc[0]);
|
||||
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
|
||||
|
||||
var showHeader = currentLetter != lastHeader;
|
||||
lastHeader = currentLetter;
|
||||
|
||||
GroupedUserList.Add(new UserDisplayItem
|
||||
{
|
||||
User = user,
|
||||
ShowHeader = showHeader,
|
||||
HeaderLetter = currentLetter
|
||||
});
|
||||
}
|
||||
|
||||
FilterUsers(true);
|
||||
}
|
||||
|
||||
private class UserDisplayItem
|
||||
{
|
||||
public required AnagClie User { get; set; }
|
||||
public bool ShowHeader { get; set; }
|
||||
public string? HeaderLetter { get; set; }
|
||||
}
|
||||
|
||||
private void FilterUsers() => FilterUsers(false);
|
||||
|
||||
private void FilterUsers(bool clearFilter)
|
||||
{
|
||||
if (clearFilter)
|
||||
{
|
||||
TextToFilter = null;
|
||||
FilteredGroupedUserList = GroupedUserList;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextToFilter == null) return;
|
||||
|
||||
FilteredGroupedUserList = GroupedUserList.FindAll(x =>
|
||||
x.User.RagSoc.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase) ||
|
||||
x.User.Indirizzo.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase) ||
|
||||
(x.User.Telefono != null && x.User.Telefono.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(x.User.EMail != null && x.User.EMail.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
x.User.PartIva.Contains(TextToFilter, StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Helpers.Enum
|
||||
@using Template.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Filtri</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Filter.Text" DebounceInterval="500"/>
|
||||
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Filter.Text = null"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Assegnata a</span>
|
||||
|
||||
<MudSelectExtended SearchBox="true"
|
||||
ItemCollection="Users.Select(x => x.UserName).ToList()"
|
||||
SelectAllPosition="SelectAllPosition.NextToSearchBox"
|
||||
SelectAll="true"
|
||||
NoWrap="true"
|
||||
MultiSelection="true"
|
||||
MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionUser))"
|
||||
FullWidth="true" T="string"
|
||||
Variant="Variant.Text"
|
||||
Virtualize="true"
|
||||
@bind-SelectedValues="Filter.User"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Type"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var type in ActivityType)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Result"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Categoria</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="ActivityCategoryEnum?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Category"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var category in CategoryList)
|
||||
{
|
||||
<MudSelectItemExtended T="ActivityCategoryEnum?" Class="custom-item-select" Value="@category">@category.ConvertToHumanReadable()</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton OnClick="() => Filter = new FilterActivityDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
[Parameter] public FilterActivityDTO Filter { get; set; }
|
||||
[Parameter] public EventCallback<FilterActivityDTO> FilterChanged { get; set; }
|
||||
|
||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
private List<ActivityCategoryEnum> CategoryList { get; set; } = [];
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (IsSheetVisible)
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private string GetMultiSelectionUser(List<string> selectedValues)
|
||||
{
|
||||
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Users = await manageData.GetTable<StbUser>();
|
||||
ActivityResult = await manageData.GetTable<StbActivityResult>();
|
||||
ActivityType = await manageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
CategoryList = ActivityCategoryHelper.AllActivityCategory;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
{
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
}
|
||||
|
||||
private void OnFilterButton()
|
||||
{
|
||||
FilterChanged.InvokeAsync(Filter);
|
||||
CloseBottomSheet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
@using Template.Shared.Core.Entity
|
||||
|
||||
<div class="contact-card">
|
||||
<div class="contact-left-section">
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large" />
|
||||
|
||||
<div class="contact-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="contact-title" Typo="Typo.body1" HtmlTag="h3">@UtilityString.FormatString(Contact.PersonaRif).TitleCase</MudText>
|
||||
</div>
|
||||
|
||||
@if (Contact.Mansione is not null)
|
||||
{
|
||||
<MudText Class="contact-subtitle" Typo="Typo.body1" HtmlTag="p">@UtilityString.FormatString(Contact.Mansione).SentenceCase</MudText>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-right-section">
|
||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||
{
|
||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
|
||||
}
|
||||
|
||||
@if (!Contact.EMail.IsNullOrEmpty()){
|
||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
|
||||
}
|
||||
@@ -1,281 +0,0 @@
|
||||
@using System.Globalization
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Components.Layout.Overlay
|
||||
@using Template.Shared.Components.SingleElements.BottomSheet
|
||||
@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 ? "Nuova" : $"{ActivityModel.ActivityId}")"/>
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Descrizione" Variant="Variant.Text" Lines="3" @bind-Value="ActivityModel.ActivityDescription" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<MudAutocomplete ReadOnly="IsView" T="string?" Placeholder="Cliente"
|
||||
SearchFunc="@SearchCliente" @bind-Value="ActivityModel.Cliente" @bind-Value:after="OnClienteChanged"
|
||||
CoerceValue="true"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Commessa</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Commesse.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.CodJcom" @bind-Value:after="OnCommessaChanged" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var com in Commesse)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@com.CodJcom">@($"{com.CodJcom} - {com.Descrizione}")</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span>Inizio</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedTime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Fine</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedEndtime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Avviso</span>
|
||||
|
||||
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Assegnata a</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="IsView" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.UserName" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var user in Users)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserName">@user.FullName</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityTypeId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var type in ActivityType)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container" @onclick="OpenSelectEsito">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended ReadOnly="true" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityResultId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.Note" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public string? Id { get; set; }
|
||||
|
||||
private ActivityDTO OriginalModel { get; set; } = new();
|
||||
private ActivityDTO ActivityModel { get; set; } = new();
|
||||
|
||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
private List<JtbComt> Commesse { get; set; } = [];
|
||||
private List<AnagClie> Clienti { get; set; } = [];
|
||||
private List<PtbPros> Pros { get; set; } = [];
|
||||
|
||||
private bool IsNew => Id.IsNullOrEmpty();
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private bool OpenEsito { get; set; } = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
|
||||
if (!Id.IsNullOrEmpty())
|
||||
ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last();
|
||||
|
||||
if (IsNew)
|
||||
{
|
||||
ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour));
|
||||
ActivityModel.EstimatedEndtime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour) + TimeSpan.FromHours(1));
|
||||
ActivityModel.UserName = UserSession.User.Username;
|
||||
}
|
||||
|
||||
OriginalModel = ActivityModel.Clone();
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
if (!CheckPreSave()) return;
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
||||
|
||||
if (response == null)
|
||||
return;
|
||||
|
||||
var newActivity = response.Last();
|
||||
|
||||
await ManageData.InsertOrUpdate(newActivity);
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(newActivity);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
Pros = await ManageData.GetTable<PtbPros>();
|
||||
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
|
||||
if (IsNew)
|
||||
{
|
||||
await LoadCommesse();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadCommesse() =>
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(ActivityModel.CodAnag));
|
||||
|
||||
private async Task<IEnumerable<string>?> SearchCliente(string value, CancellationToken token)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return null;
|
||||
|
||||
var listToReturn = new List<string>();
|
||||
|
||||
listToReturn.AddRange(
|
||||
Clienti.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => x.RagSoc)
|
||||
);
|
||||
|
||||
listToReturn.AddRange(
|
||||
Pros.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => x.RagSoc)
|
||||
);
|
||||
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
private async Task OnClienteChanged()
|
||||
{
|
||||
string? codAnag = null;
|
||||
|
||||
var cliente = Clienti.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
|
||||
if (cliente is null)
|
||||
{
|
||||
var pros = Pros.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (pros is not null)
|
||||
{
|
||||
codAnag = pros.CodAnag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
codAnag = cliente.CodAnag;
|
||||
}
|
||||
|
||||
|
||||
if (codAnag is not null)
|
||||
{
|
||||
ActivityModel.CodAnag = codAnag;
|
||||
await LoadCommesse();
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnCommessaChanged()
|
||||
{
|
||||
ActivityModel.Commessa = (await ManageData.GetTable<JtbComt>(x => x.CodJcom.Equals(ActivityModel.CodJcom))).Last().Descrizione;
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSelectEsito()
|
||||
{
|
||||
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username))) return;
|
||||
|
||||
OpenEsito = !OpenEsito;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using AutoMapper;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.Shared.Core.Helpers;
|
||||
|
||||
public class MappingProfile : Profile
|
||||
{
|
||||
public MappingProfile()
|
||||
{
|
||||
CreateMap<StbActivity, ActivityDTO>();
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using MudBlazor;
|
||||
using Template.Shared.Components.SingleElements.Modal;
|
||||
|
||||
namespace Template.Shared.Core.Helpers;
|
||||
|
||||
public class ModalHelpers
|
||||
{
|
||||
public static async Task<DialogResult?> OpenActivityForm(IDialogService dialog, string? id = null)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ActivityForm>(
|
||||
"Activity form",
|
||||
new DialogParameters<ActivityForm>
|
||||
{
|
||||
{ x => x.Id, id }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = true,
|
||||
CloseButton = false,
|
||||
NoHeader = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.Shared.Core.Interface;
|
||||
|
||||
public interface IIntegryApiService
|
||||
{
|
||||
Task<List<StbActivity>?> RetrieveActivity(string? dateFilter = null);
|
||||
Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter = null);
|
||||
Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter = null);
|
||||
Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter = null);
|
||||
Task<SettingsResponseDTO> RetrieveSettings();
|
||||
|
||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.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 InsertOrUpdate<T>(T objectToSave);
|
||||
|
||||
Task ClearDb();
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Shared.Core.Services;
|
||||
|
||||
public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession)
|
||||
: IIntegryApiService
|
||||
{
|
||||
public Task<List<StbActivity>?> RetrieveActivity(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "dateFilter", dateFilter ?? "2020-01-01" } };
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<List<StbActivity>?>("crm/retrieveActivity", queryParams);
|
||||
}
|
||||
|
||||
public Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>();
|
||||
|
||||
if (dateFilter != null)
|
||||
{
|
||||
queryParams.Add("dateFilter", dateFilter);
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
|
||||
}
|
||||
|
||||
public Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>();
|
||||
|
||||
if (dateFilter != null)
|
||||
{
|
||||
queryParams.Add("dateFilter", dateFilter);
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveClienti", queryParams)!;
|
||||
}
|
||||
|
||||
public Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>();
|
||||
|
||||
if (dateFilter != null)
|
||||
{
|
||||
queryParams.Add("dateFilter", dateFilter);
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveProspect", queryParams)!;
|
||||
}
|
||||
|
||||
public Task<SettingsResponseDTO> RetrieveSettings() =>
|
||||
integryApiRestClient.AuthorizedGet<SettingsResponseDTO>("crm/retrieveSettings", null)!;
|
||||
|
||||
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
|
||||
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<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.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.5" />
|
||||
<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>
|
||||
<Folder Include="wwwroot\css\lineicons\" />
|
||||
<Folder Include="wwwroot\js\bootstrap\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,80 +0,0 @@
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.customDialog-form .content {
|
||||
height: calc(100vh - (.6rem + 40px));
|
||||
overflow: auto;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.customDialog-form .header { padding: 0 !important; }
|
||||
|
||||
.customDialog-form .content::-webkit-scrollbar { display: none; }
|
||||
|
||||
.input-card {
|
||||
width: 100%;
|
||||
background: var(--mud-palette-background-gray);
|
||||
border-radius: 9px;
|
||||
padding: .5rem 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.input-card.clearButton {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: .4rem 1rem !important;
|
||||
}
|
||||
|
||||
.input-card > .divider { margin: 0 !important; }
|
||||
|
||||
.form-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
min-height: 35px;
|
||||
}
|
||||
|
||||
.form-container > span {
|
||||
font-weight: 600;
|
||||
width: 50%;
|
||||
margin-right: .3rem;
|
||||
}
|
||||
|
||||
.form-container > .disable-full-width { width: unset !important; }
|
||||
|
||||
.dateTime-picker {
|
||||
display: flex;
|
||||
gap: .3rem;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/*Custom mudBlazor*/
|
||||
|
||||
.form-container .mud-input.mud-input-underline:before { border-bottom: none !important; }
|
||||
|
||||
.form-container .mud-input.mud-input-underline:after { border-bottom: none !important; }
|
||||
|
||||
.form-container.text-align-end .mud-input-slot { text-align: end; }
|
||||
|
||||
.input-card .mud-input.mud-input-underline:before { border-bottom: none !important; }
|
||||
|
||||
.input-card .mud-input.mud-input-underline:after { border-bottom: none !important; }
|
||||
|
||||
.form-container .customIcon-select .mud-icon-root.mud-svg-icon {
|
||||
rotate: 90deg !important;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.form-container .customIcon-select .mud-input-slot { text-align: end; }
|
||||
|
||||
.input-card .mud-input {
|
||||
width: 100%;
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Web.Core.Services;
|
||||
|
||||
public class ManageDataService : IManageDataService
|
||||
{
|
||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(T objectToSave)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task ClearDb()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
|
||||
android:Application.WindowSoftInputModeAdjust="Resize"
|
||||
x:Class="Template.Maui.App">
|
||||
x:Class="salesbook.Maui.App">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
20
salesbook.Maui/App.xaml.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
65
salesbook.Maui/Core/Services/AttachedService.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Template.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class FormFactor : IFormFactor
|
||||
{
|
||||
@@ -1,7 +1,8 @@
|
||||
using SQLite;
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Entity;
|
||||
namespace Template.Maui.Core.Services;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class LocalDbService
|
||||
{
|
||||
@@ -22,6 +23,8 @@ public class LocalDbService
|
||||
_connection.CreateTableAsync<StbActivityResult>();
|
||||
_connection.CreateTableAsync<StbActivityType>();
|
||||
_connection.CreateTableAsync<StbUser>();
|
||||
_connection.CreateTableAsync<VtbTipi>();
|
||||
_connection.CreateTableAsync<Nazioni>();
|
||||
}
|
||||
|
||||
public async Task ResetSettingsDb()
|
||||
@@ -31,10 +34,14 @@ 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)
|
||||
{
|
||||
@@ -110,4 +117,7 @@ public class LocalDbService
|
||||
: _connection.Table<T>().Where(whereCond).ToListAsync();
|
||||
|
||||
public List<T> Get<T>(string sql) where T : new() => _connection.QueryAsync<T>(sql).Result;
|
||||
|
||||
public async Task Delete<T>(T entity) =>
|
||||
await _connection.DeleteAsync(entity);
|
||||
}
|
||||
@@ -1,17 +1,51 @@
|
||||
using AutoMapper;
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
using Template.Shared.Core.Helpers.Enum;
|
||||
using Template.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Helpers.Enum;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManageDataService
|
||||
{
|
||||
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);
|
||||
@@ -48,7 +82,7 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
||||
dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo;
|
||||
}
|
||||
|
||||
if (dto.Category == ActivityCategoryEnum.Interna && activity.CodAnag != null)
|
||||
if (dto.Category != ActivityCategoryEnum.Memo && activity.CodAnag != null)
|
||||
{
|
||||
string? ragSoc;
|
||||
|
||||
@@ -69,9 +103,22 @@ 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]);
|
||||
|
||||
public Task Delete<T>(T objectToDelete) =>
|
||||
localDb.Delete(objectToDelete);
|
||||
|
||||
public async Task DeleteActivity(ActivityDTO activity)
|
||||
{
|
||||
await localDb.Delete(
|
||||
(await GetTable<StbActivity>(x => x.ActivityId.Equals(activity.ActivityId))).Last()
|
||||
);
|
||||
}
|
||||
|
||||
public Task ClearDb() =>
|
||||
localDb.ResetDb();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Template.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class NetworkService : INetworkService
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using Template.Shared.Core.Helpers;
|
||||
using Template.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService
|
||||
{
|
||||
@@ -82,5 +82,11 @@ 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!);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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:Template.Maui"
|
||||
xmlns:shared="clr-namespace:Template.Shared;assembly=Template.Shared"
|
||||
x:Class="Template.Maui.MainPage"
|
||||
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">
|
||||
23
salesbook.Maui/MainPage.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using salesbook.Shared.Core.Messages.Back;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
private readonly IMessenger _messenger;
|
||||
|
||||
public MainPage(IMessenger messenger)
|
||||
{
|
||||
InitializeComponent();
|
||||
_messenger = messenger;
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
_messenger.Send(new HardwareBackMessage("back"));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
using AutoMapper;
|
||||
using CommunityToolkit.Maui;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using IntegryApiClient.MAUI;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MudBlazor.Services;
|
||||
using MudExtensions.Services;
|
||||
using Template.Maui.Core.Services;
|
||||
using Template.Shared;
|
||||
using Template.Shared.Core.Helpers;
|
||||
using Template.Shared.Core.Interface;
|
||||
using Template.Shared.Core.Messages;
|
||||
using Template.Shared.Core.Services;
|
||||
using 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;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public static class MauiProgram
|
||||
{
|
||||
@@ -24,12 +30,17 @@ namespace Template.Maui
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
.UseIntegry(appToken: AppToken, useLoginAzienda: true)
|
||||
.UseMauiCommunityToolkit()
|
||||
.ConfigureFonts(fonts =>
|
||||
.UseSentry(options =>
|
||||
{
|
||||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||
options.Dsn = "https://453b6b38f94fd67e40e0d5306d6caff8@o4508499810254848.ingest.de.sentry.io/4509605099667536";
|
||||
#if DEBUG
|
||||
options.Debug = true;
|
||||
#endif
|
||||
options.TracesSampleRate = 1.0;
|
||||
})
|
||||
.UseLoginAzienda(AppToken);
|
||||
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
builder.Services.AddMudServices();
|
||||
@@ -46,7 +57,13 @@ namespace Template.Maui
|
||||
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
|
||||
builder.Services.AddScoped<ISyncDbService, SyncDbService>();
|
||||
builder.Services.AddScoped<IManageDataService, ManageDataService>();
|
||||
|
||||
//Message
|
||||
builder.Services.AddScoped<IMessenger, WeakReferenceMessenger>();
|
||||
builder.Services.AddScoped<NewActivityService>();
|
||||
builder.Services.AddScoped<BackNavigationService>();
|
||||
builder.Services.AddScoped<CopyActivityService>();
|
||||
builder.Services.AddScoped<NewContactService>();
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
@@ -54,7 +71,9 @@ namespace Template.Maui
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||
builder.Services.AddSingleton<LocalDbService>();
|
||||
builder.Services.AddSingleton<FilterUserDTO>();
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
9
salesbook.Maui/Platforms/Android/AndroidManifest.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?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>
|
||||
<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>
|
||||
@@ -1,7 +1,7 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Activity(Theme = "@style/Maui.SplashTheme",
|
||||
MainLauncher = true,
|
||||
@@ -1,9 +1,9 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Application]
|
||||
[Application(HardwareAccelerated = true)]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
@@ -1,7 +1,7 @@
|
||||
using Foundation;
|
||||
using Template.Maui;
|
||||
using salesbook.Maui;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
@@ -1,7 +1,7 @@
|
||||
using ObjCRuntime;
|
||||
using UIKit;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Foundation;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
@@ -35,5 +35,15 @@
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<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>
|
||||
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,6 +1,6 @@
|
||||
using UIKit;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
@@ -1 +1 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 230" width="230" height="230"><style>.a{fill:none;stroke:#002339;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}.b{fill:none;stroke:#00a0de;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}</style><path fill-rule="evenodd" class="a" d="m118.3 86.2h22.9c13.5 0 24.4 11.1 24.4 24.6v18.9c0 13.5-10.9 24.5-24.4 24.5h-3.5l0.1 21.4-23.1-21.4h-48"/><path fill-rule="evenodd" class="b" d="m116.5 54.8l-51.2 31.4v68l51.2-31.5z"/></svg>
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 230" width="230" height="230"><style>.a{fill:none;stroke:#002339;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}.b{fill:none;stroke:#00a0de;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}</style><path fill-rule="evenodd" class="a" d="m119.9 71.4h34.4c20.3 0 36.8 16.5 36.8 36.9v28.3c0 20.4-16.5 36.9-36.8 36.9h-5.1l0.1 32.2-34.7-32.2h-72.2"/><path fill-rule="evenodd" class="b" d="m117.3 24l-77.1 47.4v102.1l77.1-47.4v-102.1z"/></svg>
|
||||
|
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -23,18 +23,18 @@
|
||||
</style>
|
||||
</defs>
|
||||
<g>
|
||||
<path class="cls-3" d="M60.57,323.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
|
||||
<path class="cls-3" d="M125.87,317.75c-1.29-1.34-2.78-2.47-4.51-3.36-2.63-1.34-5.57-2.02-8.83-2.02-4.29,0-8.11,1.06-11.48,3.17s-6,4.99-7.92,8.64c-1.92,3.65-2.88,7.78-2.88,12.39s.96,8.64,2.88,12.29c1.92,3.65,4.56,6.53,7.92,8.64,3.36,2.11,7.15,3.17,11.38,3.17,3.33,0,6.32-.67,8.98-2.02,1.73-.87,3.2-1.99,4.46-3.31v4.37h12.68v-46.38h-12.68v4.42ZM123.37,345.5c-2.18,2.37-5.03,3.55-8.55,3.55-2.24,0-4.26-.54-6.05-1.63-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4.03-1.49-6.53s.5-4.58,1.49-6.43c.99-1.86,2.37-3.33,4.13-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.42.53,6.15,1.58c1.73,1.06,3.1,2.54,4.13,4.46,1.02,1.92,1.54,4.1,1.54,6.53,0,3.59-1.09,6.56-3.27,8.93Z"/>
|
||||
<rect class="cls-3" x="153.33" y="290.28" width="12.58" height="69.43"/>
|
||||
<path class="cls-3" d="M214.02,315.25c-3.46-1.98-7.36-2.98-11.71-2.98-4.61,0-8.77,1.06-12.48,3.17-3.71,2.11-6.64,4.99-8.79,8.64-2.15,3.65-3.22,7.78-3.22,12.39s1.09,8.83,3.27,12.48c2.18,3.65,5.17,6.53,8.98,8.64,3.81,2.11,8.15,3.17,13.01,3.17,3.78,0,7.26-.67,10.47-2.02,3.2-1.34,5.98-3.36,8.35-6.05l-7.49-7.49c-1.41,1.67-3.07,2.88-4.99,3.65-1.92.77-4.07,1.15-6.43,1.15-2.63,0-4.93-.54-6.91-1.63-1.99-1.09-3.5-2.67-4.56-4.75-.42-.82-.73-1.72-.98-2.65l33.87-.08c.26-1.02.42-1.97.48-2.83.06-.86.1-1.71.1-2.54,0-4.48-.96-8.48-2.88-12-1.92-3.52-4.61-6.27-8.07-8.26ZM195.68,324.47c1.86-1.09,4.03-1.63,6.53-1.63,2.37,0,4.35.48,5.95,1.44,1.6.96,2.85,2.37,3.75,4.23.43.89.76,1.89,1,2.99l-22.38.06c.23-.86.51-1.68.88-2.43.99-2.02,2.42-3.57,4.27-4.66Z"/>
|
||||
<path class="cls-3" d="M249.16,323.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
|
||||
<path class="cls-3" d="M343.03,315.54c-3.43-2.11-7.28-3.17-11.57-3.17-3.26,0-6.26.69-8.98,2.06-1.58.8-2.96,1.79-4.18,2.93v-27.08h-12.58v69.43h12.48v-4.15c1.23,1.2,2.62,2.23,4.23,3.05,2.69,1.38,5.7,2.06,9.03,2.06,4.29,0,8.13-1.06,11.52-3.17,3.39-2.11,6.06-4.99,8.02-8.64,1.95-3.65,2.93-7.75,2.93-12.29s-.96-8.74-2.88-12.39c-1.92-3.65-4.59-6.53-8.02-8.64ZM339.47,343c-.99,1.86-2.35,3.33-4.08,4.42-1.73,1.09-3.74,1.63-6.05,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.17-2.56-4.13-4.42-.96-1.86-1.44-4-1.44-6.43s.48-4.67,1.44-6.53c.96-1.86,2.32-3.33,4.08-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.34.54,6.1,1.63c1.76,1.09,3.14,2.58,4.13,4.46.99,1.89,1.49,4.02,1.49,6.39,0,2.5-.5,4.67-1.49,6.53Z"/>
|
||||
<path class="cls-3" d="M400.35,315.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM398.14,342.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
|
||||
<path class="cls-3" d="M458.83,315.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM456.62,342.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
|
||||
<polygon class="cls-3" points="527.73 359.71 508.65 335.39 526.86 313.33 512.27 313.33 495.46 334.58 495.46 290.28 482.88 290.28 482.88 359.71 495.46 359.71 495.46 337.08 512.36 359.71 527.73 359.71"/>
|
||||
<path class="cls-3" d="M71.66,322.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
|
||||
<path class="cls-3" d="M137.34,316.75c-1.29-1.34-2.78-2.47-4.51-3.36-2.63-1.34-5.57-2.02-8.83-2.02-4.29,0-8.11,1.06-11.48,3.17s-6,4.99-7.92,8.64c-1.92,3.65-2.88,7.78-2.88,12.39s.96,8.64,2.88,12.29c1.92,3.65,4.56,6.53,7.92,8.64,3.36,2.11,7.15,3.17,11.38,3.17,3.33,0,6.32-.67,8.98-2.02,1.73-.87,3.2-1.99,4.46-3.31v4.37h12.68v-46.38h-12.68v4.42ZM134.85,344.5c-2.18,2.37-5.03,3.55-8.55,3.55-2.24,0-4.26-.54-6.05-1.63-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4.03-1.49-6.53s.5-4.58,1.49-6.43c.99-1.86,2.37-3.33,4.13-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.42.53,6.15,1.58c1.73,1.06,3.1,2.54,4.13,4.46,1.02,1.92,1.54,4.1,1.54,6.53,0,3.59-1.09,6.56-3.27,8.93Z"/>
|
||||
<rect class="cls-3" x="164.81" y="289.28" width="12.58" height="69.43"/>
|
||||
<path class="cls-3" d="M225.49,314.25c-3.46-1.98-7.36-2.98-11.71-2.98-4.61,0-8.77,1.06-12.48,3.17-3.71,2.11-6.64,4.99-8.79,8.64-2.15,3.65-3.22,7.78-3.22,12.39s1.09,8.83,3.27,12.48c2.18,3.65,5.17,6.53,8.98,8.64,3.81,2.11,8.15,3.17,13.01,3.17,3.78,0,7.26-.67,10.47-2.02,3.2-1.34,5.98-3.36,8.35-6.05l-7.49-7.49c-1.41,1.67-3.07,2.88-4.99,3.65-1.92.77-4.07,1.15-6.43,1.15-2.63,0-4.93-.54-6.91-1.63-1.99-1.09-3.5-2.67-4.56-4.75-.42-.82-.73-1.72-.98-2.65l33.87-.08c.26-1.02.42-1.97.48-2.83.06-.86.1-1.71.1-2.54,0-4.48-.96-8.48-2.88-12-1.92-3.52-4.61-6.27-8.07-8.26ZM207.15,323.47c1.86-1.09,4.03-1.63,6.53-1.63,2.37,0,4.35.48,5.95,1.44,1.6.96,2.85,2.37,3.75,4.23.43.89.76,1.89,1,2.99l-22.38.06c.23-.86.51-1.68.88-2.43.99-2.02,2.42-3.57,4.27-4.66Z"/>
|
||||
<path class="cls-3" d="M260.64,322.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
|
||||
<path class="cls-3" d="M331.93,314.54c-3.43-2.11-7.28-3.17-11.57-3.17-3.26,0-6.26.69-8.98,2.06-1.58.8-2.96,1.79-4.18,2.93v-27.08h-12.58v69.43h12.48v-4.15c1.23,1.2,2.62,2.23,4.23,3.05,2.69,1.38,5.7,2.06,9.03,2.06,4.29,0,8.13-1.06,11.52-3.17,3.39-2.11,6.06-4.99,8.02-8.64,1.95-3.65,2.93-7.75,2.93-12.29s-.96-8.74-2.88-12.39c-1.92-3.65-4.59-6.53-8.02-8.64ZM328.38,342c-.99,1.86-2.35,3.33-4.08,4.42-1.73,1.09-3.74,1.63-6.05,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.17-2.56-4.13-4.42-.96-1.86-1.44-4-1.44-6.43s.48-4.67,1.44-6.53c.96-1.86,2.32-3.33,4.08-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.34.54,6.1,1.63c1.76,1.09,3.14,2.58,4.13,4.46.99,1.89,1.49,4.02,1.49,6.39,0,2.5-.5,4.67-1.49,6.53Z"/>
|
||||
<path class="cls-3" d="M389.26,314.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM387.05,341.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
|
||||
<path class="cls-3" d="M447.74,314.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM445.53,341.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
|
||||
<polygon class="cls-3" points="516.64 358.71 497.56 334.39 515.77 312.33 501.18 312.33 484.37 333.58 484.37 289.28 471.79 289.28 471.79 358.71 484.37 358.71 484.37 336.08 501.27 358.71 516.64 358.71"/>
|
||||
</g>
|
||||
<g>
|
||||
<path class="cls-1" d="M278.9,101.41h36.59c21.62,0,39.14,17.52,39.14,39.14v30.15c0,21.62-17.52,39.14-39.14,39.14h-5.37l.07,34.31-36.88-34.31h-77.99"/>
|
||||
<polygon class="cls-2" points="276.17 51.02 194.26 101.41 194.26 209.84 276.17 159.45 276.17 51.02"/>
|
||||
<path class="cls-1" d="M288.72,101.41h36.59c21.62,0,39.14,17.52,39.14,39.14v30.15c0,21.62-17.52,39.14-39.14,39.14h-5.37l.07,34.31-36.88-34.31h-77.99"/>
|
||||
<polygon class="cls-2" points="285.99 51.02 204.08 101.41 204.08 209.84 285.99 159.45 285.99 51.02"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
@@ -15,7 +15,7 @@
|
||||
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
|
||||
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Template.Maui</RootNamespace>
|
||||
<RootNamespace>salesbook.Maui</RootNamespace>
|
||||
<UseMaui>true</UseMaui>
|
||||
<SingleProject>true</SingleProject>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
@@ -23,14 +23,14 @@
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<!-- Display name -->
|
||||
<ApplicationTitle>sales book</ApplicationTitle>
|
||||
<ApplicationTitle>salesbook</ApplicationTitle>
|
||||
|
||||
<!-- App Identifier -->
|
||||
<ApplicationId>it.integry.template.maui</ApplicationId>
|
||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.1.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>5</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
@@ -78,8 +78,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
||||
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
|
||||
<CodesignProvision>VS: WildCard Development</CodesignProvision>
|
||||
<CodesignKey>Apple Distribution: Integry S.r.l. (UNP26J4R89)</CodesignKey>
|
||||
<CodesignProvision></CodesignProvision>
|
||||
<ProvisioningType>manual</ProvisioningType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
@@ -92,10 +93,17 @@
|
||||
-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||
<!-- Android App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
|
||||
<!-- ios App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Splash Screen -->
|
||||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#dff2ff" BaseSize="128,128" />
|
||||
|
||||
@@ -111,19 +119,20 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="11.2.0" />
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="12.0.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<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="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="sqlite-net-pcl" Version="1.9.172" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Template.Shared\Template.Shared.csproj" />
|
||||
<ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
59
salesbook.Maui/wwwroot/index.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
|
||||
<title>salesbook.Maui</title>
|
||||
<base href="/"/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
|
||||
|
||||
<link href="_content/salesbook.Shared/css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="_content/salesbook.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
|
||||
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/remixicon/remixicon.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/app.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/form.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/bottomSheet.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/default-theme.css"/>
|
||||
<link rel="stylesheet" href="salesbook.Maui.styles.css"/>
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="status-bar-safe-area"></div>
|
||||
|
||||
<div id="app">
|
||||
<div class="spinner-container">
|
||||
<span class="loader"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.webview.js" autostart="false"></script>
|
||||
<script src="_content/salesbook.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<!--<script src="_content/salesbook.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<!--<script src="_content/salesbook.Shared/js/bootstrap/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<!--<script src="_content/salesbook.Shared/js/bootstrap/Sortable.min.js"></script>-->
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/main.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/calendar.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/alphaScroll.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
103
salesbook.Shared/Components/Layout/HeaderLayout.razor
Normal file
@@ -0,0 +1,103 @@
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||
@if (!SmallHeader)
|
||||
{
|
||||
@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())
|
||||
{
|
||||
@if (ShowFilter)
|
||||
{
|
||||
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
|
||||
}
|
||||
|
||||
@* @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
|
||||
{
|
||||
<MudButton OnClick="OnSave"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@LabelSave
|
||||
</MudButton>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>@Title</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => GoBack()" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code{
|
||||
[Parameter] public string? Title { get; set; }
|
||||
[Parameter] public bool ShowFilter { get; set; }
|
||||
[Parameter] public bool ShowProfile { get; set; } = true;
|
||||
[Parameter] public bool Back { get; set; }
|
||||
[Parameter] public bool BackOnTop { get; set; }
|
||||
[Parameter] public string BackTo { get; set; } = "";
|
||||
|
||||
[Parameter] public EventCallback OnFilterToggle { get; set; }
|
||||
|
||||
[Parameter] public bool Cancel { get; set; }
|
||||
[Parameter] public EventCallback OnCancel { get; set; }
|
||||
[Parameter] public string? LabelSave { get; set; }
|
||||
[Parameter] public EventCallback OnSave { get; set; }
|
||||
|
||||
[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;
|
||||
BackTo = Cancel ? "Annulla" : BackTo;
|
||||
}
|
||||
|
||||
private async Task GoBack()
|
||||
{
|
||||
if (Cancel)
|
||||
{
|
||||
await OnCancel.InvokeAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
}
|
||||
|
||||
private void OpenPersonalInfo() =>
|
||||
NavigationManager.NavigateTo("/PersonalInfo");
|
||||
|
||||
}
|
||||
@@ -1,4 +1,12 @@
|
||||
.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;
|
||||
@@ -1,7 +1,9 @@
|
||||
@using System.Globalization
|
||||
@using Template.Shared.Core.Messages
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Core.Messages.Back
|
||||
@inherits LayoutComponentBase
|
||||
@inject IJSRuntime JS
|
||||
@inject IMessenger Messenger
|
||||
@inject BackNavigationService BackService
|
||||
|
||||
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
|
||||
@@ -1,7 +1,15 @@
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||
@using salesbook.Shared.Core.Messages.Activity.New
|
||||
@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">
|
||||
@@ -35,11 +43,11 @@
|
||||
{
|
||||
<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 Disabled="true">Nuovo contatto</MudMenuItem>
|
||||
<MudMenuItem OnClick="() => ModalHelpers.OpenActivityForm(Dialog)">Nuova attivitŕ</MudMenuItem>
|
||||
<MudMenuItem OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
||||
<MudMenuItem OnClick="() => CreateActivity()">Nuova attività</MudMenuItem>
|
||||
</ChildContent>
|
||||
</MudMenu>
|
||||
}
|
||||
@@ -53,6 +61,8 @@
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
CopyActivityService.OnCopyActivity += async dto => await CreateActivity(dto);
|
||||
|
||||
NavigationManager.LocationChanged += (_, args) =>
|
||||
{
|
||||
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
||||
@@ -71,5 +81,26 @@
|
||||
};
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
private Task CreateActivity() => CreateActivity(null);
|
||||
|
||||
private async Task CreateActivity(ActivityDTO? activity)
|
||||
{
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, activity, null);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(StbActivity))
|
||||
{
|
||||
Messenger.Send(new NewActivityMessage(((StbActivity)result.Data).ActivityId));
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@using Template.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
<MudOverlay Visible="VisibleOverlay" LightBackground="true">
|
||||
@if (SuccessAnimation)
|
||||
{
|
||||
@@ -1,12 +1,14 @@
|
||||
@page "/Calendar"
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Components.SingleElements
|
||||
@using Template.Shared.Components.Layout.Spinner
|
||||
@using Template.Shared.Components.SingleElements.BottomSheet
|
||||
@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
|
||||
@using salesbook.Shared.Core.Messages.Activity.New
|
||||
@inject IManageDataService ManageData
|
||||
@inject IJSRuntime JS
|
||||
@inject NewActivityService NewActivity
|
||||
|
||||
<HeaderLayout Title="@_headerTitle"
|
||||
ShowFilter="true"
|
||||
@@ -14,7 +16,7 @@
|
||||
OnFilterToggle="ToggleFilter"
|
||||
OnCalendarToggle="ToggleExpanded"/>
|
||||
|
||||
<div @ref="weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
|
||||
<div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
|
||||
@if (Expanded)
|
||||
{
|
||||
<!-- Vista mensile -->
|
||||
@@ -154,12 +156,12 @@
|
||||
else if (FilteredActivities is { Count: > 0 })
|
||||
{
|
||||
<Virtualize Items="FilteredActivities" Context="activity">
|
||||
<ActivityCard Activity="activity" ActivityChanged="OnActivityChanged"/>
|
||||
<ActivityCard Activity="activity" ActivityChanged="OnActivityChanged" ActivityDeleted="OnActivityDeleted" />
|
||||
</Virtualize>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna attività trovata" ImageSource="_content/Template.Shared/images/undraw_file-search_cbur.svg"/>
|
||||
<NoDataAvailable Text="Nessuna attività trovata" ImageSource="_content/salesbook.Shared/images/undraw_file-search_cbur.svg"/>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -173,7 +175,7 @@
|
||||
private record CategoryData(string CssClass, string Title);
|
||||
|
||||
// Cache per rendering
|
||||
private DayData[] _monthDaysData = Array.Empty<DayData>();
|
||||
private DayData[] _monthDaysData = [];
|
||||
private readonly DayData[] _weekDaysData = new DayData[7];
|
||||
private string _headerTitle = string.Empty;
|
||||
private readonly Dictionary<DateTime, List<ActivityDTO>> _eventsCache = new();
|
||||
@@ -181,10 +183,10 @@
|
||||
private bool _isInitialized = false;
|
||||
|
||||
// Stato UI
|
||||
private bool Expanded { get; set; } = false;
|
||||
private bool Expanded { get; set; }
|
||||
private string SliderAnimation { get; set; } = string.Empty;
|
||||
private ElementReference weekSliderRef;
|
||||
private DotNetObjectReference<Calendar>? dotNetHelper;
|
||||
private ElementReference _weekSliderRef;
|
||||
private DotNetObjectReference<Calendar>? _dotNetHelper;
|
||||
|
||||
// Stato calendario
|
||||
private DateTime SelectedDate { get; set; } = DateTime.Today;
|
||||
@@ -217,6 +219,8 @@
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
PrepareRenderingData();
|
||||
|
||||
NewActivity.OnActivityCreated += async activityId => await OnActivityCreated(activityId);
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
@@ -225,8 +229,8 @@
|
||||
{
|
||||
Filter.User = new HashSet<string> { UserSession.User.Username };
|
||||
|
||||
dotNetHelper = DotNetObjectReference.Create(this);
|
||||
await JS.InvokeVoidAsync("calendarSwipe.register", weekSliderRef, dotNetHelper);
|
||||
_dotNetHelper = DotNetObjectReference.Create(this);
|
||||
await JS.InvokeVoidAsync("calendarSwipe.register", _weekSliderRef, _dotNetHelper);
|
||||
_internalMonth = new DateTime(SelectedDate.Year, SelectedDate.Month, 1);
|
||||
await LoadMonthData();
|
||||
|
||||
@@ -367,7 +371,9 @@
|
||||
filteredActivity = filteredActivity
|
||||
.Where(x => Filter.Category == null || x.Category.Equals(Filter.Category));
|
||||
|
||||
return filteredActivity.ToList();
|
||||
return filteredActivity
|
||||
.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
[JSInvokable]
|
||||
@@ -526,7 +532,53 @@
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
dotNetHelper?.Dispose();
|
||||
_dotNetHelper?.Dispose();
|
||||
}
|
||||
|
||||
private async Task OnActivityDeleted(ActivityDTO activity)
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
await ManageData.DeleteActivity(activity);
|
||||
|
||||
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activity.ActivityId));
|
||||
|
||||
if (indexActivity != null)
|
||||
{
|
||||
MonthActivities?.RemoveAt(indexActivity.Value);
|
||||
PrepareRenderingData();
|
||||
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
private async Task OnActivityCreated(string activityId)
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
var activity = (await ManageData.GetActivity(x => x.ActivityId.Equals(activityId))).LastOrDefault();
|
||||
|
||||
if (activity == null)
|
||||
{
|
||||
IsLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var date = activity.EffectiveDate ?? activity.EstimatedDate;
|
||||
|
||||
if (CurrentMonth.Month != date!.Value.Month)
|
||||
{
|
||||
IsLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
MonthActivities.Add(activity);
|
||||
PrepareRenderingData();
|
||||
IsLoading = false;
|
||||
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
private async Task OnActivityChanged(string activityId)
|
||||
@@ -538,10 +590,8 @@
|
||||
{
|
||||
MonthActivities![indexActivity.Value] = newActivity[0];
|
||||
PrepareRenderingData(); // Ricalcola i dati di rendering
|
||||
ApplyFilter();
|
||||
}
|
||||
|
||||
ApplyFilter();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void ToggleFilter()
|
||||
@@ -1,22 +1,24 @@
|
||||
@page "/"
|
||||
@using Template.Shared.Core.Interface
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@inject IFormFactor FormFactor
|
||||
@inject INetworkService NetworkService
|
||||
|
||||
<SpinnerLayout FullScreen="true" />
|
||||
|
||||
@code
|
||||
{
|
||||
protected override Task OnInitializedAsync()
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||
|
||||
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
|
||||
{
|
||||
NavigationManager.NavigateTo("/sync");
|
||||
return base.OnInitializedAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo("/Calendar");
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
@page "/login"
|
||||
@using Template.Shared.Components.Layout.Spinner
|
||||
@using Template.Shared.Core.Services
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject IUserAccountService UserAccountService
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
@@ -12,7 +12,7 @@ else
|
||||
{
|
||||
<div class="login-page">
|
||||
<div class="container container-top-logo">
|
||||
<img src="_content/Template.Shared/images/salesbook-marchio_vers.positiva.svg" class="logo" alt="sales book">
|
||||
<img src="_content/salesbook.Shared/images/salesbook-marchio_vers.positiva.svg" class="logo" alt="sales book">
|
||||
</div>
|
||||
<div class="container container-login">
|
||||
<div class="login-form-container">
|
||||
@@ -35,7 +35,7 @@ else
|
||||
|
||||
<div class="my-4 login-footer">
|
||||
<span>Powered by</span>
|
||||
<img src="_content/Template.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
|
||||
<img src="_content/salesbook.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
@page "/Notifications"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
|
||||
<HeaderLayout Title="Notifiche" />
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
@page "/PersonalInfo"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Authorization.Enum
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Core.Services
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Authorization.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFormFactor FormFactor
|
||||
@@ -81,51 +81,3 @@
|
||||
.status.online { color: var(--mud-palette-success); }
|
||||
|
||||
.status.offline { color: var(--mud-palette-error); }
|
||||
|
||||
.container-button {
|
||||
width: 100%;
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
padding: .5rem 0;
|
||||
border-radius: 12px;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.container-button .divider {
|
||||
margin: .5rem 0 .5rem 3rem;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.container-button ::deep .button-settings { border: none !important; }
|
||||
|
||||
.container-button ::deep .button-settings .mud-icon-root {
|
||||
border-radius: 6px;
|
||||
padding: 2px;
|
||||
min-width: 25px;
|
||||
min-height: 25px;
|
||||
}
|
||||
|
||||
.container-button ::deep .button-settings.green-icon .mud-icon-root {
|
||||
border: 1px solid var(--mud-palette-success);
|
||||
background: hsl(from var(--mud-palette-success-lighten) h s 95%);
|
||||
color: var(--mud-palette-success-darken);
|
||||
}
|
||||
|
||||
.container-button ::deep .button-settings.red-icon .mud-icon-root {
|
||||
border: 1px solid var(--mud-palette-error);
|
||||
background: hsl(from var(--mud-palette-error-lighten) h s 95%);
|
||||
color: var(--mud-palette-error-darken);
|
||||
}
|
||||
|
||||
.container-button ::deep .button-settings .mud-button-label {
|
||||
justify-content: flex-start;
|
||||
text-transform: capitalize;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.container-button ::deep .button-settings.exit { padding: 0; }
|
||||
|
||||
.container-button ::deep .button-settings.exit .mud-button-label {
|
||||
justify-content: center;
|
||||
font-size: 1.1rem;
|
||||
line-height: normal;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
@page "/settings"
|
||||
@page "/settings/{BackTo}"
|
||||
@using Template.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.Layout
|
||||
|
||||
<HeaderLayout BackTo="@BackTo" Back="true" Title="Impostazioni"/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@page "/sync"
|
||||
@page "/sync/{DateFilter}"
|
||||
@using Template.Shared.Components.Layout.Spinner
|
||||
@using Template.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject ISyncDbService syncDb
|
||||
@inject IManageDataService manageData
|
||||
|
||||
208
salesbook.Shared/Components/Pages/User.razor
Normal file
@@ -0,0 +1,208 @@
|
||||
@page "/User/{CodContact}/{IsContact:bool}"
|
||||
@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" />
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
<SpinnerLayout FullScreen="true"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="container content">
|
||||
<div class="container-primary-info">
|
||||
<div class="section-primary-info">
|
||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
||||
@UtilityString.ExtractInitials(Anag.RagSoc)
|
||||
</MudAvatar>
|
||||
|
||||
<div class="personal-info">
|
||||
<span class="info-nome">@Anag.RagSoc</span>
|
||||
@if (Anag.Indirizzo != 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>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<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">
|
||||
@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>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="section-personal-info">
|
||||
@if (!string.IsNullOrEmpty(Anag.EMail))
|
||||
{
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@Anag.EMail
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Agente != null)
|
||||
{
|
||||
<div>
|
||||
<span class="info-title">Agente</span>
|
||||
<span class="info-text">
|
||||
@Agente.FullName
|
||||
</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>
|
||||
}
|
||||
|
||||
<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>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public string CodContact { get; set; }
|
||||
[Parameter] public bool IsContact { 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 bool IsLoading { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -139,9 +139,21 @@
|
||||
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;
|
||||
}
|
||||
301
salesbook.Shared/Components/Pages/Users.razor
Normal file
@@ -0,0 +1,301 @@
|
||||
@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
|
||||
@inject IManageDataService ManageData
|
||||
@inject NewContactService NewContact
|
||||
@inject FilterUserDTO Filter
|
||||
|
||||
<HeaderLayout Title="Contatti"/>
|
||||
|
||||
<div class="container search-box">
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500"/>
|
||||
|
||||
@if (!TextToFilter.IsNullOrEmpty())
|
||||
{
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
||||
}
|
||||
|
||||
<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)
|
||||
{
|
||||
<SpinnerLayout FullScreen="false"/>
|
||||
}
|
||||
else if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
|
||||
@if (item.ShowHeader)
|
||||
{
|
||||
<div class="letter-header">@item.HeaderLetter</div>
|
||||
}
|
||||
<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}");
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
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 sortedUsers = users
|
||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||
.OrderBy(u =>
|
||||
{
|
||||
var firstChar = char.ToUpper(u.RagSoc[0]);
|
||||
return char.IsLetter(firstChar) ? firstChar.ToString() : "ZZZ";
|
||||
})
|
||||
.ThenBy(u => u.RagSoc)
|
||||
.ToList();
|
||||
|
||||
GroupedUserList = [];
|
||||
|
||||
string? lastHeader = null;
|
||||
foreach (var user in sortedUsers)
|
||||
{
|
||||
var firstChar = char.ToUpper(user.RagSoc[0]);
|
||||
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
|
||||
|
||||
var showHeader = currentLetter != lastHeader;
|
||||
lastHeader = currentLetter;
|
||||
|
||||
GroupedUserList.Add(new UserDisplayItem
|
||||
{
|
||||
User = user,
|
||||
ShowHeader = showHeader,
|
||||
HeaderLetter = currentLetter
|
||||
});
|
||||
}
|
||||
|
||||
FilterUsers();
|
||||
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
private class UserDisplayItem
|
||||
{
|
||||
public required ContactDTO User { get; set; }
|
||||
public bool ShowHeader { get; set; }
|
||||
public string? HeaderLetter { get; set; }
|
||||
}
|
||||
|
||||
private void FilterUsers() => FilterUsers(false);
|
||||
|
||||
private void FilterUsers(bool clearFilter)
|
||||
{
|
||||
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
||||
{
|
||||
TextToFilter = null;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,6 @@
|
||||
padding-bottom: .5rem;
|
||||
}
|
||||
|
||||
.search-box .input-card {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.search-box .input-card { margin: 0 !important; }
|
||||
|
||||
.search-box .input-card ::deep .rounded-button { border-radius: 50%; }
|
||||
@@ -1,4 +1,4 @@
|
||||
@using Template.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Components.SingleElements.Modal.ExceptionModal
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<ErrorBoundary @ref="ErrorBoundary">
|
||||
@@ -0,0 +1,45 @@
|
||||
<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);
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Helpers.Enum
|
||||
@using Template.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
@@ -0,0 +1,157 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Filtri</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Con agente</span>
|
||||
|
||||
<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>
|
||||
|
||||
<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)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</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 Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
[Parameter] public FilterUserDTO Filter { get; set; }
|
||||
[Parameter] public EventCallback<FilterUserDTO> FilterChanged { get; set; }
|
||||
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (IsSheetVisible)
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Users = await manageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||
}
|
||||
|
||||
private string GetMultiSelectionAgente(List<string> selectedValues)
|
||||
{
|
||||
return $"{selectedValues.Count} Agent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
{
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
}
|
||||
|
||||
private void OnFilterButton()
|
||||
{
|
||||
FilterChanged.InvokeAsync(Filter);
|
||||
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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
@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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
@@ -11,7 +11,7 @@
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Esito</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => CloseBottomSheet()"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
@@ -26,7 +26,7 @@
|
||||
<div class="form-container">
|
||||
<span>Inizio</span>
|
||||
|
||||
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveTime" />
|
||||
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveTime" @bind-Value:after="OnAfterChangeTime"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="form-container">
|
||||
<span>Fine</span>
|
||||
|
||||
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveEndTime" />
|
||||
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveEndTime" @bind-Value:after="OnAfterChangeTime" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="CloseBottomSheet">Salva</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="() => CloseBottomSheet(true)">Salva</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -90,20 +90,44 @@
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
private void CloseBottomSheet(bool save)
|
||||
{
|
||||
if (EffectiveDate != null)
|
||||
if (save)
|
||||
{
|
||||
ActivityModel.EffectiveTime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
|
||||
EffectiveTime.Hours, EffectiveTime.Minutes, EffectiveTime.Seconds);
|
||||
if (EffectiveDate != null)
|
||||
{
|
||||
ActivityModel.EffectiveTime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
|
||||
EffectiveTime.Hours, EffectiveTime.Minutes, EffectiveTime.Seconds);
|
||||
|
||||
ActivityModel.EffectiveEndtime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
|
||||
EffectiveEndTime.Hours, EffectiveEndTime.Minutes, EffectiveEndTime.Seconds);
|
||||
ActivityModel.EffectiveEndtime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
|
||||
EffectiveEndTime.Hours, EffectiveEndTime.Minutes, EffectiveEndTime.Seconds);
|
||||
}
|
||||
|
||||
if (ActivityModel.ActivityResultId.IsNullOrEmpty())
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
Snackbar.Add("Esito obbligatorio!", Severity.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
ActivityModelChanged.InvokeAsync(ActivityModel);
|
||||
|
||||
if (save)
|
||||
{
|
||||
ActivityModelChanged.InvokeAsync(ActivityModel);
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseBottomSheet() => CloseBottomSheet(false);
|
||||
|
||||
private void OnAfterChangeTime()
|
||||
{
|
||||
if (EffectiveEndTime < EffectiveTime)
|
||||
EffectiveEndTime = EffectiveTime + TimeSpan.FromHours(1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="activity-card @Activity.Category.ConvertToHumanReadable()" @onclick="OpenActivity">
|
||||
@@ -65,10 +65,11 @@
|
||||
@code {
|
||||
[Parameter] public ActivityDTO Activity { get; set; } = new();
|
||||
[Parameter] public EventCallback<string> ActivityChanged { get; set; }
|
||||
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
|
||||
|
||||
private TimeSpan? Durata { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Durata = Activity switch
|
||||
{
|
||||
@@ -80,11 +81,16 @@
|
||||
|
||||
private async Task OpenActivity()
|
||||
{
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, Activity.ActivityId);
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, null, Activity.ActivityId);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(StbActivity))
|
||||
switch (result)
|
||||
{
|
||||
await ActivityChanged.InvokeAsync(((StbActivity)result.Data).ActivityId);
|
||||
case { Canceled: false, Data: not null } when result.Data.GetType() == typeof(StbActivity):
|
||||
await ActivityChanged.InvokeAsync(((StbActivity)result.Data).ActivityId);
|
||||
break;
|
||||
case { Canceled: false, Data: not null } when result.Data.GetType() == typeof(ActivityDTO):
|
||||
await ActivityDeleted.InvokeAsync((ActivityDTO)result.Data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
@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();
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
.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;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="contact-card" @onclick="OpenPersRifForm">
|
||||
<div class="contact-left-section">
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large"/>
|
||||
|
||||
<div class="contact-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="contact-title" Typo="Typo.body1" HtmlTag="h3">@UtilityString.FormatString(Contact.PersonaRif).TitleCase</MudText>
|
||||
</div>
|
||||
|
||||
@if (Contact.Mansione is not null)
|
||||
{
|
||||
<MudText Class="contact-subtitle" Typo="Typo.body1" HtmlTag="p">@UtilityString.FormatString(Contact.Mansione).SentenceCase</MudText>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-right-section">
|
||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||
{
|
||||
<a href="@($"tel:{Contact.NumCellulare}")">
|
||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone"/>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (!Contact.EMail.IsNullOrEmpty())
|
||||
{
|
||||
<a href="@($"mailto:{Contact.EMail}")">
|
||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline"/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public PersRifDTO Contact { get; set; } = new();
|
||||
|
||||
private async Task OpenPersRifForm()
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, Contact);
|
||||
}
|
||||
}
|
||||