Compare commits
10 Commits
b34f6cb213
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| c9d7091355 | |||
| d90a194a4e | |||
| de9d415f04 | |||
| b561405ddc | |||
| c93b0c9bec | |||
| c003c29d83 | |||
| 8dfb163cfa | |||
| 068723f31f | |||
| 8ebc6e3b8f | |||
| 9c69884cc9 |
65
salesbook.Maui/Core/Services/AttachedService.cs
Normal file
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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,6 +28,24 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
|||||||
return contactMapper;
|
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)
|
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
||||||
{
|
{
|
||||||
var activities = await localDb.Get(whereCond);
|
var activities = await localDb.Get(whereCond);
|
||||||
@@ -85,6 +103,9 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
|||||||
return returnDto;
|
return returnDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task InsertOrUpdate<T>(List<T> listToSave) =>
|
||||||
|
localDb.InsertOrUpdate(listToSave);
|
||||||
|
|
||||||
public Task InsertOrUpdate<T>(T objectToSave) =>
|
public Task InsertOrUpdate<T>(T objectToSave) =>
|
||||||
localDb.InsertOrUpdate<T>([objectToSave]);
|
localDb.InsertOrUpdate<T>([objectToSave]);
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ using MudBlazor.Services;
|
|||||||
using MudExtensions.Services;
|
using MudExtensions.Services;
|
||||||
using salesbook.Maui.Core.Services;
|
using salesbook.Maui.Core.Services;
|
||||||
using salesbook.Shared;
|
using salesbook.Shared;
|
||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
using salesbook.Shared.Core.Helpers;
|
using salesbook.Shared.Core.Helpers;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
using salesbook.Shared.Core.Messages.Activity.Copy;
|
using salesbook.Shared.Core.Messages.Activity.Copy;
|
||||||
using salesbook.Shared.Core.Messages.Activity.New;
|
using salesbook.Shared.Core.Messages.Activity.New;
|
||||||
using salesbook.Shared.Core.Messages.Back;
|
using salesbook.Shared.Core.Messages.Back;
|
||||||
|
using salesbook.Shared.Core.Messages.Contact;
|
||||||
using salesbook.Shared.Core.Services;
|
using salesbook.Shared.Core.Services;
|
||||||
|
|
||||||
namespace salesbook.Maui
|
namespace salesbook.Maui
|
||||||
@@ -61,6 +63,7 @@ namespace salesbook.Maui
|
|||||||
builder.Services.AddScoped<NewActivityService>();
|
builder.Services.AddScoped<NewActivityService>();
|
||||||
builder.Services.AddScoped<BackNavigationService>();
|
builder.Services.AddScoped<BackNavigationService>();
|
||||||
builder.Services.AddScoped<CopyActivityService>();
|
builder.Services.AddScoped<CopyActivityService>();
|
||||||
|
builder.Services.AddScoped<NewContactService>();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||||
@@ -68,7 +71,9 @@ namespace salesbook.Maui
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||||
|
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||||
builder.Services.AddSingleton<LocalDbService>();
|
builder.Services.AddSingleton<LocalDbService>();
|
||||||
|
builder.Services.AddSingleton<FilterUserDTO>();
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,7 @@
|
|||||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true"></application>
|
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true"></application>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -35,5 +35,15 @@
|
|||||||
<key>NSAllowsArbitraryLoads</key>
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</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>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>1.0.1</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.1.0</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>4</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
<div class="@(Back ? "" : "container") header">
|
<div class="@(Back ? "" : "container") header">
|
||||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||||
|
@if (!SmallHeader)
|
||||||
|
{
|
||||||
@if (Back)
|
@if (Back)
|
||||||
{
|
{
|
||||||
<div class="left-section">
|
<div class="left-section">
|
||||||
@@ -45,6 +47,16 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="title">
|
||||||
|
<MudText Typo="Typo.h6">
|
||||||
|
<b>@Title</b>
|
||||||
|
</MudText>
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => GoBack()" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -66,6 +78,8 @@
|
|||||||
[Parameter] public bool ShowCalendarToggle { get; set; }
|
[Parameter] public bool ShowCalendarToggle { get; set; }
|
||||||
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public bool SmallHeader { get; set; }
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
Back = !Back ? !Back && Cancel : Back;
|
Back = !Back ? !Back && Cancel : Back;
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
|
.header {
|
||||||
|
min-height: var(--mh-header);
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.header-content {
|
.header-content {
|
||||||
|
width: 100%;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -3,12 +3,13 @@
|
|||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||||
@using salesbook.Shared.Core.Messages.Activity.New
|
@using salesbook.Shared.Core.Messages.Activity.New
|
||||||
|
@using salesbook.Shared.Core.Messages.Contact
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
@inject IMessenger Messenger
|
@inject IMessenger Messenger
|
||||||
@inject CopyActivityService CopyActivityService
|
@inject CopyActivityService CopyActivityService
|
||||||
|
|
||||||
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(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")">
|
<nav class="navbar @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||||
<div class="container-navbar">
|
<div class="container-navbar">
|
||||||
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
{
|
{
|
||||||
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||||
<ActivatorContent>
|
<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>
|
</ActivatorContent>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
<MudMenuItem OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
<MudMenuItem OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
||||||
@@ -96,6 +97,10 @@
|
|||||||
private async Task CreateUser()
|
private async Task CreateUser()
|
||||||
{
|
{
|
||||||
var result = await ModalHelpers.OpenUserForm(Dialog, null);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
@using salesbook.Shared.Core.Entity
|
|
||||||
@using salesbook.Shared.Core.Messages.Activity.New
|
@using salesbook.Shared.Core.Messages.Activity.New
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
@using salesbook.Shared.Core.Interface
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@inject IFormFactor FormFactor
|
@inject IFormFactor FormFactor
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
|
|
||||||
|
<SpinnerLayout FullScreen="true" />
|
||||||
|
|
||||||
@code
|
@code
|
||||||
{
|
{
|
||||||
protected override Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||||
|
|
||||||
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
|
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo("/sync");
|
NavigationManager.NavigateTo("/sync");
|
||||||
return base.OnInitializedAsync();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo("/Calendar");
|
NavigationManager.NavigateTo("/Calendar");
|
||||||
return base.OnInitializedAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject IMapper Mapper
|
@inject IMapper Mapper
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
|
@inject INetworkService NetworkService
|
||||||
|
|
||||||
<HeaderLayout BackTo="Indietro" LabelSave="Modifica" OnSave="() => OpenUserForm(Anag)" Back="true" BackOnTop="true" Title="" ShowProfile="false" />
|
<HeaderLayout BackTo="Indietro" LabelSave="Modifica" OnSave="() => OpenUserForm(Anag)" Back="true" BackOnTop="true" Title="" ShowProfile="false" />
|
||||||
|
|
||||||
@@ -28,9 +29,12 @@ else
|
|||||||
|
|
||||||
<div class="personal-info">
|
<div class="personal-info">
|
||||||
<span class="info-nome">@Anag.RagSoc</span>
|
<span class="info-nome">@Anag.RagSoc</span>
|
||||||
@if (UserSession.User.KeyGroup is not null)
|
@if (Anag.Indirizzo != null)
|
||||||
{
|
{
|
||||||
<span class="info-section">@Anag.Indirizzo</span>
|
<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>
|
<span class="info-section">@($"{Anag.Cap} - {Anag.Citta} ({Anag.Prov})")</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -71,6 +75,16 @@ else
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (Agente != null)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="info-title">Agente</span>
|
||||||
|
<span class="info-text">
|
||||||
|
@Agente.FullName
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -127,6 +141,7 @@ else
|
|||||||
private ContactDTO Anag { get; set; } = new();
|
private ContactDTO Anag { get; set; } = new();
|
||||||
private List<PersRifDTO>? PersRif { get; set; }
|
private List<PersRifDTO>? PersRif { get; set; }
|
||||||
private List<JtbComt> Commesse { get; set; }
|
private List<JtbComt> Commesse { get; set; }
|
||||||
|
private StbUser? Agente { get; set; }
|
||||||
|
|
||||||
private bool IsLoading { get; set; } = true;
|
private bool IsLoading { get; set; } = true;
|
||||||
|
|
||||||
@@ -141,28 +156,48 @@ else
|
|||||||
{
|
{
|
||||||
var clie = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodContact))).Last();
|
var clie = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodContact))).Last();
|
||||||
Anag = Mapper.Map<ContactDTO>(clie);
|
Anag = Mapper.Map<ContactDTO>(clie);
|
||||||
|
|
||||||
var pers = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodContact));
|
|
||||||
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var pros = (await ManageData.GetTable<PtbPros>(x => x.CodPpro.Equals(CodContact))).Last();
|
var pros = (await ManageData.GetTable<PtbPros>(x => x.CodPpro.Equals(CodContact))).Last();
|
||||||
Anag = Mapper.Map<ContactDTO>(pros);
|
Anag = Mapper.Map<ContactDTO>(pros);
|
||||||
|
|
||||||
var pers = await ManageData.GetTable<PtbProsRif>(x => x.CodPpro.Equals(Anag.CodContact));
|
|
||||||
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await LoadPersRif();
|
||||||
|
|
||||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
|
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;
|
IsLoading = false;
|
||||||
StateHasChanged();
|
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()
|
private async Task OpenPersRifForm()
|
||||||
{
|
{
|
||||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, null);
|
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)
|
private async Task OpenUserForm(ContactDTO anag)
|
||||||
|
|||||||
@@ -7,7 +7,10 @@
|
|||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
|
@using salesbook.Shared.Core.Messages.Contact
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
@inject NewContactService NewContact
|
||||||
|
@inject FilterUserDTO Filter
|
||||||
|
|
||||||
<HeaderLayout Title="Contatti"/>
|
<HeaderLayout Title="Contatti"/>
|
||||||
|
|
||||||
@@ -25,7 +28,7 @@
|
|||||||
|
|
||||||
<MudChipSet Class="mt-2" T="string" @bind-SelectedValue="TypeUser" @bind-SelectedValue:after="FilterUsers" SelectionMode="SelectionMode.SingleSelection">
|
<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="@("all")">Tutti</MudChip>
|
||||||
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("contact")">Contatti</MudChip>
|
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("contact")">Clienti</MudChip>
|
||||||
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("prospect")">Prospect</MudChip>
|
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("prospect")">Prospect</MudChip>
|
||||||
</MudChipSet>
|
</MudChipSet>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,9 +65,14 @@
|
|||||||
//Filtri
|
//Filtri
|
||||||
private string? TextToFilter { get; set; }
|
private string? TextToFilter { get; set; }
|
||||||
private bool OpenFilter { get; set; }
|
private bool OpenFilter { get; set; }
|
||||||
private FilterUserDTO Filter { get; set; } = new();
|
|
||||||
private string TypeUser { get; set; } = "all";
|
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)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
@@ -78,11 +86,16 @@
|
|||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
|
if (!Filter.IsInitialized)
|
||||||
|
{
|
||||||
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||||
|
|
||||||
if (loggedUser.UserCode != null)
|
if (loggedUser.UserCode != null)
|
||||||
Filter.Agenti = [loggedUser.UserCode];
|
Filter.Agenti = [loggedUser.UserCode];
|
||||||
|
|
||||||
|
Filter.IsInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
var users = await ManageData.GetContact();
|
var users = await ManageData.GetContact();
|
||||||
|
|
||||||
var sortedUsers = users
|
var sortedUsers = users
|
||||||
@@ -98,7 +111,6 @@
|
|||||||
GroupedUserList = [];
|
GroupedUserList = [];
|
||||||
|
|
||||||
string? lastHeader = null;
|
string? lastHeader = null;
|
||||||
|
|
||||||
foreach (var user in sortedUsers)
|
foreach (var user in sortedUsers)
|
||||||
{
|
{
|
||||||
var firstChar = char.ToUpper(user.RagSoc[0]);
|
var firstChar = char.ToUpper(user.RagSoc[0]);
|
||||||
@@ -121,6 +133,7 @@
|
|||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class UserDisplayItem
|
private class UserDisplayItem
|
||||||
{
|
{
|
||||||
public required ContactDTO User { get; set; }
|
public required ContactDTO User { get; set; }
|
||||||
@@ -151,10 +164,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
var matchesFilter =
|
var matchesFilter =
|
||||||
(Filter.Prov.IsNullOrEmpty() || user.Prov.Equals(Filter.Prov, StringComparison.OrdinalIgnoreCase)) &&
|
(Filter.Prov.IsNullOrEmpty() ||
|
||||||
(Filter.Citta.IsNullOrEmpty() || user.Citta.Contains(Filter.Citta!, StringComparison.OrdinalIgnoreCase)) &&
|
(!string.IsNullOrEmpty(user.Prov) &&
|
||||||
(Filter.Nazione.IsNullOrEmpty() || user.Nazione.Contains(Filter.Nazione!, StringComparison.OrdinalIgnoreCase)) &&
|
user.Prov.Trim().Contains(Filter.Prov!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
|
||||||
(Filter.Indirizzo.IsNullOrEmpty() || user.Indirizzo.Contains(Filter.Indirizzo!, 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.ConAgente || user.CodVage is not null) &&
|
||||||
(!Filter.SenzaAgente || user.CodVage is null) &&
|
(!Filter.SenzaAgente || user.CodVage is null) &&
|
||||||
(Filter.Agenti.IsNullOrEmpty() || (user.CodVage != null && Filter.Agenti!.Contains(user.CodVage)));
|
(Filter.Agenti.IsNullOrEmpty() || (user.CodVage != null && Filter.Agenti!.Contains(user.CodVage)));
|
||||||
@@ -186,6 +207,91 @@
|
|||||||
FilteredGroupedUserList = result;
|
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()
|
private void ToggleFilter()
|
||||||
{
|
{
|
||||||
OpenFilter = !OpenFilter;
|
OpenFilter = !OpenFilter;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
@using salesbook.Shared.Components.Pages
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Dto
|
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject IManageDataService manageData
|
@inject IManageDataService manageData
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Con agente</span>
|
<span class="disable-full-width">Con agente</span>
|
||||||
|
|
||||||
<MudCheckBox @bind-Value="Filter.ConAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeAgente"/>
|
<MudCheckBox @bind-Value="Filter.ConAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeConAgente"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
@@ -27,7 +26,7 @@
|
|||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Senza agente</span>
|
<span class="disable-full-width">Senza agente</span>
|
||||||
|
|
||||||
<MudCheckBox @bind-Value="Filter.SenzaAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeAgente"/>
|
<MudCheckBox @bind-Value="Filter.SenzaAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeSenzaAgente"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
@@ -89,7 +88,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button-section">
|
<div class="button-section">
|
||||||
<MudButton OnClick="() => Filter = new FilterUserDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
<MudButton OnClick="ClearFilters" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -140,16 +139,19 @@
|
|||||||
Filter.SenzaAgente = false;
|
Filter.SenzaAgente = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAfterChangeAgente()
|
private void ClearFilters()
|
||||||
{
|
|
||||||
if (Filter.SenzaAgente)
|
|
||||||
{
|
{
|
||||||
Filter.ConAgente = false;
|
Filter.ConAgente = false;
|
||||||
}
|
|
||||||
else if (Filter.ConAgente)
|
|
||||||
{
|
|
||||||
Filter.SenzaAgente = 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
@using System.Globalization
|
@using System.Globalization
|
||||||
@using System.Text.RegularExpressions
|
@using System.Text.RegularExpressions
|
||||||
@using CommunityToolkit.Mvvm.Messaging
|
@using CommunityToolkit.Mvvm.Messaging
|
||||||
|
@using Java.Util.Jar
|
||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IIntegryApiService IntegryApiService
|
@inject IIntegryApiService IntegryApiService
|
||||||
@inject IMessenger Messenger
|
@inject IMessenger Messenger
|
||||||
|
@inject IDialogService Dialog
|
||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
@@ -117,9 +119,51 @@
|
|||||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.Note" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
<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>
|
||||||
|
|
||||||
|
<div class="container-chip-attached">
|
||||||
|
@if (!AttachedList.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
foreach (var item in AttachedList!.Select((p, index) => new { p, index }))
|
||||||
|
{
|
||||||
|
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
|
||||||
|
{
|
||||||
|
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success" OnClose="() => OnRemoveAttached(item.index)">
|
||||||
|
@item.p.Description
|
||||||
|
</MudChip>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudChip T="string" Color="Color.Default" OnClose="() => OnRemoveAttached(item.index)">
|
||||||
|
@item.p.Name
|
||||||
|
</MudChip>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (ActivityFileList != null)
|
||||||
|
{
|
||||||
|
foreach (var file in ActivityFileList)
|
||||||
|
{
|
||||||
|
<MudChip T="string" Color="Color.Default">
|
||||||
|
@file.FileName
|
||||||
|
</MudChip>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-button">
|
||||||
|
<MudButton Class="button-settings green-icon"
|
||||||
|
FullWidth="true"
|
||||||
|
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||||
|
Size="Size.Medium"
|
||||||
|
OnClick="OpenAddAttached"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
|
Aggiungi allegati
|
||||||
|
</MudButton>
|
||||||
|
|
||||||
@if (!IsNew)
|
@if (!IsNew)
|
||||||
{
|
{
|
||||||
<div class="container-button">
|
<div class="divider"></div>
|
||||||
|
|
||||||
<MudButton Class="button-settings gray-icon"
|
<MudButton Class="button-settings gray-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Filled.ContentCopy"
|
StartIcon="@Icons.Material.Filled.ContentCopy"
|
||||||
@@ -139,9 +183,9 @@
|
|||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Elimina
|
Elimina
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||||
<MessageContent>
|
<MessageContent>
|
||||||
@@ -149,19 +193,31 @@
|
|||||||
</MessageContent>
|
</MessageContent>
|
||||||
<YesButton>
|
<YesButton>
|
||||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||||
StartIcon="@Icons.Material.Rounded.Check">
|
StartIcon="@Icons.Material.Rounded.DeleteForever">
|
||||||
Cancella
|
Cancella
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</YesButton>
|
</YesButton>
|
||||||
</MudMessageBox>
|
</MudMessageBox>
|
||||||
|
|
||||||
|
<MudMessageBox @ref="AddNamePosition" Class="c-messageBox" Title="Nome della posizione" CancelText="Annulla">
|
||||||
|
<MessageContent>
|
||||||
|
<MudTextField @bind-Value="NamePosition" Variant="Variant.Outlined" />
|
||||||
|
</MessageContent>
|
||||||
|
<YesButton>
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Rounded.Check">
|
||||||
|
Salva
|
||||||
|
</MudButton>
|
||||||
|
</YesButton>
|
||||||
|
</MudMessageBox>
|
||||||
|
|
||||||
<MudMessageBox @ref="ConfirmMemo" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
<MudMessageBox @ref="ConfirmMemo" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||||
<MessageContent>
|
<MessageContent>
|
||||||
Vuoi creare un promemoria?
|
Vuoi creare un promemoria?
|
||||||
</MessageContent>
|
</MessageContent>
|
||||||
<YesButton>
|
<YesButton>
|
||||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||||
StartIcon="@Icons.Material.Rounded.DeleteForever">
|
StartIcon="@Icons.Material.Rounded.Check">
|
||||||
Crea
|
Crea
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</YesButton>
|
</YesButton>
|
||||||
@@ -173,7 +229,7 @@
|
|||||||
|
|
||||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeEsito"/>
|
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeEsito"/>
|
||||||
|
|
||||||
<AddMemo @bind-IsSheetVisible="OpenAddMemo" />
|
<AddMemo @bind-IsSheetVisible="OpenAddMemo"/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||||
@@ -190,6 +246,7 @@
|
|||||||
private List<JtbComt> Commesse { get; set; } = [];
|
private List<JtbComt> Commesse { get; set; } = [];
|
||||||
private List<AnagClie> Clienti { get; set; } = [];
|
private List<AnagClie> Clienti { get; set; } = [];
|
||||||
private List<PtbPros> Pros { get; set; } = [];
|
private List<PtbPros> Pros { get; set; } = [];
|
||||||
|
private List<ActivityFileDto>? ActivityFileList { get; set; }
|
||||||
|
|
||||||
private bool IsNew => Id.IsNullOrEmpty();
|
private bool IsNew => Id.IsNullOrEmpty();
|
||||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||||
@@ -206,6 +263,12 @@
|
|||||||
//MessageBox
|
//MessageBox
|
||||||
private MudMessageBox ConfirmDelete { get; set; }
|
private MudMessageBox ConfirmDelete { get; set; }
|
||||||
private MudMessageBox ConfirmMemo { get; set; }
|
private MudMessageBox ConfirmMemo { get; set; }
|
||||||
|
private MudMessageBox AddNamePosition { get; set; }
|
||||||
|
|
||||||
|
//Attached
|
||||||
|
private List<AttachedDTO>? AttachedList { get; set; }
|
||||||
|
private string? NamePosition { get; set; }
|
||||||
|
private bool CanAddPosition { get; set; } = true;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
@@ -242,6 +305,8 @@
|
|||||||
VisibleOverlay = true;
|
VisibleOverlay = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
|
await SavePosition();
|
||||||
|
|
||||||
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
||||||
|
|
||||||
if (response == null)
|
if (response == null)
|
||||||
@@ -251,6 +316,8 @@
|
|||||||
|
|
||||||
await ManageData.InsertOrUpdate(newActivity);
|
await ManageData.InsertOrUpdate(newActivity);
|
||||||
|
|
||||||
|
await SaveAttached(newActivity.ActivityId);
|
||||||
|
|
||||||
SuccessAnimation = true;
|
SuccessAnimation = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
@@ -259,6 +326,40 @@
|
|||||||
MudDialog.Close(newActivity);
|
MudDialog.Close(newActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task SavePosition()
|
||||||
|
{
|
||||||
|
if (AttachedList != null)
|
||||||
|
{
|
||||||
|
foreach (var attached in AttachedList)
|
||||||
|
{
|
||||||
|
if (attached.Type != AttachedDTO.TypeAttached.Position) continue;
|
||||||
|
|
||||||
|
var position = new PositionDTO
|
||||||
|
{
|
||||||
|
Description = attached.Description,
|
||||||
|
Lat = attached.Lat,
|
||||||
|
Lng = attached.Lng
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModel.Position = await IntegryApiService.SavePosition(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveAttached(string activityId)
|
||||||
|
{
|
||||||
|
if (AttachedList != null)
|
||||||
|
{
|
||||||
|
foreach (var attached in AttachedList)
|
||||||
|
{
|
||||||
|
if (attached.FileContent is not null && attached.Type != AttachedDTO.TypeAttached.Position)
|
||||||
|
{
|
||||||
|
await IntegryApiService.UploadFile(activityId, attached.FileContent, attached.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool CheckPreSave()
|
private bool CheckPreSave()
|
||||||
{
|
{
|
||||||
Snackbar.Clear();
|
Snackbar.Clear();
|
||||||
@@ -271,6 +372,11 @@
|
|||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
|
if (!IsNew && Id != null)
|
||||||
|
{
|
||||||
|
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
||||||
|
}
|
||||||
|
|
||||||
Users = await ManageData.GetTable<StbUser>();
|
Users = await ManageData.GetTable<StbUser>();
|
||||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||||
@@ -339,10 +445,10 @@
|
|||||||
{
|
{
|
||||||
OnAfterChangeValue();
|
OnAfterChangeValue();
|
||||||
|
|
||||||
var result = await ConfirmMemo.ShowAsync();
|
// var result = await ConfirmMemo.ShowAsync();
|
||||||
|
|
||||||
if (result is true)
|
// if (result is true)
|
||||||
OpenAddMemo = !OpenAddMemo;
|
// OpenAddMemo = !OpenAddMemo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenSelectEsito()
|
private void OpenSelectEsito()
|
||||||
@@ -390,9 +496,50 @@
|
|||||||
private void Duplica()
|
private void Duplica()
|
||||||
{
|
{
|
||||||
var activityCopy = ActivityModel.Clone();
|
var activityCopy = ActivityModel.Clone();
|
||||||
|
activityCopy.ActivityId = null;
|
||||||
|
|
||||||
MudDialog.Cancel();
|
MudDialog.Cancel();
|
||||||
Messenger.Send(new CopyActivityMessage(activityCopy));
|
Messenger.Send(new CopyActivityMessage(activityCopy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task OpenAddAttached()
|
||||||
|
{
|
||||||
|
var result = await ModalHelpers.OpenAddAttached(Dialog, CanAddPosition);
|
||||||
|
|
||||||
|
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(AttachedDTO))
|
||||||
|
{
|
||||||
|
var attached = (AttachedDTO)result.Data;
|
||||||
|
|
||||||
|
if (attached.Type == AttachedDTO.TypeAttached.Position)
|
||||||
|
{
|
||||||
|
CanAddPosition = false;
|
||||||
|
|
||||||
|
var resultNamePosition = await AddNamePosition.ShowAsync();
|
||||||
|
|
||||||
|
if (resultNamePosition is true)
|
||||||
|
attached.Description = NamePosition;
|
||||||
|
attached.Name = NamePosition!;
|
||||||
|
}
|
||||||
|
|
||||||
|
AttachedList ??= [];
|
||||||
|
AttachedList.Add(attached);
|
||||||
|
|
||||||
|
LabelSave = "Aggiorna";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRemoveAttached(int index)
|
||||||
|
{
|
||||||
|
if (AttachedList is null || index < 0 || index >= AttachedList.Count)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var attached = AttachedList[index];
|
||||||
|
|
||||||
|
if (attached.Type == AttachedDTO.TypeAttached.Position)
|
||||||
|
CanAddPosition = true;
|
||||||
|
|
||||||
|
AttachedList.RemoveAt(index);
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
.container-chip-attached {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.container-button {
|
.container-button {
|
||||||
background: var(--mud-palette-background-gray) !important;
|
background: var(--mud-palette-background-gray) !important;
|
||||||
box-shadow: unset;
|
box-shadow: unset;
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Components.Layout
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
|
@inject IAttachedService AttachedService
|
||||||
|
|
||||||
|
<MudDialog Class="customDialog-form">
|
||||||
|
<DialogContent>
|
||||||
|
<HeaderLayout ShowProfile="false" SmallHeader="true" Cancel="true" OnCancel="() => MudDialog.Cancel()" Title="Aggiungi allegati"/>
|
||||||
|
|
||||||
|
<div style="margin-bottom: 1rem;" class="content attached">
|
||||||
|
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Rounded.Image"
|
||||||
|
Label="Immagini" OnClick="OnImage"/>
|
||||||
|
|
||||||
|
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Rounded.InsertDriveFile"
|
||||||
|
Label="File" OnClick="OnFile"/>
|
||||||
|
|
||||||
|
@if (CanAddPosition)
|
||||||
|
{
|
||||||
|
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Rounded.AddLocationAlt"
|
||||||
|
Label="Posizione" OnClick="OnPosition"/>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</DialogContent>
|
||||||
|
</MudDialog>
|
||||||
|
|
||||||
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public bool CanAddPosition { get; set; }
|
||||||
|
|
||||||
|
//Overlay for save
|
||||||
|
private bool VisibleOverlay { get; set; }
|
||||||
|
private bool SuccessAnimation { get; set; }
|
||||||
|
|
||||||
|
private AttachedDTO? Attached { get; set; }
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
|
|
||||||
|
_ = LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Save()
|
||||||
|
{
|
||||||
|
VisibleOverlay = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
SuccessAnimation = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await Task.Delay(1250);
|
||||||
|
|
||||||
|
MudDialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnImage()
|
||||||
|
{
|
||||||
|
Attached = await AttachedService.SelectImage();
|
||||||
|
MudDialog.Close(Attached);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFile()
|
||||||
|
{
|
||||||
|
Attached = await AttachedService.SelectFile();
|
||||||
|
MudDialog.Close(Attached);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnPosition()
|
||||||
|
{
|
||||||
|
Attached = await AttachedService.SelectPosition();
|
||||||
|
MudDialog.Close(Attached);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
.content.attached {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2rem;
|
||||||
|
padding: 1rem;
|
||||||
|
height: unset;
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Components.Layout.Overlay
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IIntegryApiService IntegryApiService
|
@inject IIntegryApiService IntegryApiService
|
||||||
@@ -25,6 +26,28 @@
|
|||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="input-card">
|
||||||
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Nazione</span>
|
||||||
|
|
||||||
|
@if (Nazioni.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
<span class="warning-text">Nessuna nazione trovata</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Nazioni.IsNullOrEmpty())" T="string?"
|
||||||
|
Variant="Variant.Text" @bind-Value="ContactModel.Nazione" @bind-Value:after="OnAfterChangeValue"
|
||||||
|
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||||
|
@foreach (var nazione in Nazioni)
|
||||||
|
{
|
||||||
|
<MudSelectItemExtended Class="custom-item-select" Value="@nazione.CodNazioneAlpha2">@($"{nazione.Descrizione}")</MudSelectItemExtended>
|
||||||
|
}
|
||||||
|
</MudSelectExtended>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">P. IVA</span>
|
<span class="disable-full-width">P. IVA</span>
|
||||||
@@ -77,6 +100,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (!IsView)
|
||||||
|
{
|
||||||
|
<div class="container-button mb-3">
|
||||||
|
<MudButton Class="button-settings blue-icon"
|
||||||
|
FullWidth="true"
|
||||||
|
StartIcon="@Icons.Material.Rounded.Search"
|
||||||
|
Size="Size.Medium"
|
||||||
|
OnClick="() => OpenSearchAddress = !OpenSearchAddress"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
|
Cerca indirizzo
|
||||||
|
</MudButton>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Indirizzo</span>
|
<span class="disable-full-width">Indirizzo</span>
|
||||||
@@ -137,34 +175,13 @@
|
|||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
Class="customIcon-select"
|
Class="customIcon-select"
|
||||||
|
MaxLength="2"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="ContactModel.Prov"
|
@bind-Value="ContactModel.Prov"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">Nazione</span>
|
|
||||||
|
|
||||||
@if (Nazioni.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
<span class="warning-text">Nessuna nazione trovata</span>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Nazioni.IsNullOrEmpty())" T="string?"
|
|
||||||
Variant="Variant.Text" @bind-Value="ContactModel.Nazione" @bind-Value:after="OnAfterChangeValue"
|
|
||||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
|
||||||
@foreach (var nazione in Nazioni)
|
|
||||||
{
|
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@nazione.CodNazioneAlpha2">@($"{nazione.Descrizione}")</MudSelectItemExtended>
|
|
||||||
}
|
|
||||||
</MudSelectExtended>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
@@ -218,6 +235,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="input-card">
|
||||||
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Agente</span>
|
||||||
|
|
||||||
|
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
|
||||||
|
@bind-Value="ContactModel.CodVage" @bind-Value:after="OnAfterChangeValue"
|
||||||
|
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||||
|
@foreach (var user in Users)
|
||||||
|
{
|
||||||
|
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
|
||||||
|
}
|
||||||
|
</MudSelectExtended>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@if (IsNew)
|
@if (IsNew)
|
||||||
{
|
{
|
||||||
<div class="container-chip-persrif">
|
<div class="container-chip-persrif">
|
||||||
@@ -231,8 +263,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<div class="container-button">
|
<div class="container-button">
|
||||||
|
@if (IsNew)
|
||||||
|
{
|
||||||
<MudButton Class="button-settings gray-icon"
|
<MudButton Class="button-settings gray-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
||||||
@@ -241,8 +276,22 @@
|
|||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Persona di riferimento
|
Persona di riferimento
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@if (NetworkService.IsNetworkAvailable() && !ContactModel.IsContact)
|
||||||
|
{
|
||||||
|
<MudButton Class="button-settings blue-icon"
|
||||||
|
FullWidth="true"
|
||||||
|
StartIcon="@Icons.Material.Rounded.Sync"
|
||||||
|
Size="Size.Medium"
|
||||||
|
OnClick="ConvertProspectToContact"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
|
Converti in cliente
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
|
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
|
||||||
@@ -268,6 +317,8 @@
|
|||||||
|
|
||||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||||
|
|
||||||
|
<SearchAddress Region="@ContactModel.Nazione" @bind-IsSheetVisible="OpenSearchAddress" @bind-Indirizzo="Address" @bind-Indirizzo:after="OnAddressSet"/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||||
|
|
||||||
@@ -277,6 +328,7 @@
|
|||||||
private List<VtbTipi>? VtbTipi { get; set; }
|
private List<VtbTipi>? VtbTipi { get; set; }
|
||||||
private List<PersRifDTO>? PersRifList { get; set; }
|
private List<PersRifDTO>? PersRifList { get; set; }
|
||||||
private List<Nazioni>? Nazioni { get; set; }
|
private List<Nazioni>? Nazioni { get; set; }
|
||||||
|
private List<StbUser> Users { get; set; } = [];
|
||||||
|
|
||||||
private bool IsNew => OriginalModel is null;
|
private bool IsNew => OriginalModel is null;
|
||||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||||
@@ -292,6 +344,10 @@
|
|||||||
private string VatMessage { get; set; } = "";
|
private string VatMessage { get; set; } = "";
|
||||||
private bool VatAlreadyRegistered { get; set; }
|
private bool VatAlreadyRegistered { get; set; }
|
||||||
|
|
||||||
|
//BottomSeath
|
||||||
|
private bool OpenSearchAddress { get; set; }
|
||||||
|
private IndirizzoDTO Address { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
@@ -310,31 +366,56 @@
|
|||||||
{
|
{
|
||||||
TipoAnag = ContactModel.IsContact ? "C" : "P",
|
TipoAnag = ContactModel.IsContact ? "C" : "P",
|
||||||
Cliente = ContactModel,
|
Cliente = ContactModel,
|
||||||
PersRif = PersRifList
|
PersRif = PersRifList,
|
||||||
|
CodVage = ContactModel.CodVage
|
||||||
};
|
};
|
||||||
|
|
||||||
await IntegryApiService.SaveContact(requestDto);
|
var response = await IntegryApiService.SaveContact(requestDto);
|
||||||
|
|
||||||
|
switch (response)
|
||||||
|
{
|
||||||
|
case null:
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
return;
|
||||||
|
case {AnagClie: null, PtbPros: not null}:
|
||||||
|
await ManageData.InsertOrUpdate(response.PtbPros);
|
||||||
|
await ManageData.InsertOrUpdate(response.PtbProsRif);
|
||||||
|
break;
|
||||||
|
case { AnagClie: not null, PtbPros: null }:
|
||||||
|
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||||
|
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SuccessAnimation = true;
|
SuccessAnimation = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
await Task.Delay(1250);
|
await Task.Delay(1250);
|
||||||
|
|
||||||
MudDialog.Close();
|
MudDialog.Close(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
if (IsNew)
|
if (IsNew)
|
||||||
{
|
{
|
||||||
|
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||||
|
|
||||||
ContactModel.IsContact = false;
|
ContactModel.IsContact = false;
|
||||||
ContactModel.Nazione = "IT";
|
ContactModel.Nazione = "IT";
|
||||||
|
ContactModel.CodVage = loggedUser.UserCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ContactModel = OriginalModel!.Clone();
|
ContactModel = OriginalModel!.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Users = await ManageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||||
Nazioni = await ManageData.GetTable<Nazioni>();
|
Nazioni = await ManageData.GetTable<Nazioni>();
|
||||||
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
||||||
}
|
}
|
||||||
@@ -467,4 +548,17 @@
|
|||||||
|
|
||||||
OnAfterChangeValue();
|
OnAfterChangeValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnAddressSet()
|
||||||
|
{
|
||||||
|
ContactModel.Citta = Address.Citta;
|
||||||
|
ContactModel.Indirizzo = Address.Indirizzo;
|
||||||
|
ContactModel.Prov = Address.Prov;
|
||||||
|
ContactModel.Cap = Address.Cap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ConvertProspectToContact()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,3 +7,13 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search-address {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 0.65rem;
|
||||||
|
color: var(--mud-palette-primary);
|
||||||
|
font-weight: 600;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
@@ -112,6 +112,9 @@
|
|||||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||||
|
|
||||||
[Parameter] public PersRifDTO? OriginalModel { get; set; }
|
[Parameter] public PersRifDTO? OriginalModel { get; set; }
|
||||||
|
[Parameter] public ContactDTO? ContactModel { get; set; }
|
||||||
|
[Parameter] public List<PersRifDTO>? PersRifList { get; set; }
|
||||||
|
|
||||||
private PersRifDTO PersRifModel { get; set; } = new();
|
private PersRifDTO PersRifModel { get; set; } = new();
|
||||||
|
|
||||||
private bool IsNew => OriginalModel is null;
|
private bool IsNew => OriginalModel is null;
|
||||||
@@ -137,6 +140,42 @@
|
|||||||
VisibleOverlay = true;
|
VisibleOverlay = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
|
if (ContactModel != null && PersRifList != null)
|
||||||
|
{
|
||||||
|
PersRifList.Add(PersRifModel);
|
||||||
|
|
||||||
|
var requestDto = new CRMCreateContactRequestDTO
|
||||||
|
{
|
||||||
|
TipoAnag = ContactModel.IsContact ? "C" : "P",
|
||||||
|
Cliente = ContactModel,
|
||||||
|
PersRif = PersRifList,
|
||||||
|
CodVage = ContactModel.CodVage,
|
||||||
|
CodAnag = ContactModel.CodContact
|
||||||
|
};
|
||||||
|
|
||||||
|
var response = await IntegryApiService.SaveContact(requestDto);
|
||||||
|
|
||||||
|
switch (response)
|
||||||
|
{
|
||||||
|
case null:
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
return;
|
||||||
|
case {AnagClie: null, PtbPros: not null}:
|
||||||
|
await ManageData.InsertOrUpdate(response.PtbPros);
|
||||||
|
await ManageData.InsertOrUpdate(response.PtbProsRif);
|
||||||
|
break;
|
||||||
|
case { AnagClie: not null, PtbPros: null }:
|
||||||
|
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||||
|
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SuccessAnimation = true;
|
SuccessAnimation = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public class ActivityDTO : StbActivity
|
|||||||
|
|
||||||
public bool Deleted { get; set; }
|
public bool Deleted { get; set; }
|
||||||
|
|
||||||
|
public PositionDTO? Position { get; set; }
|
||||||
|
|
||||||
public ActivityDTO Clone()
|
public ActivityDTO Clone()
|
||||||
{
|
{
|
||||||
return (ActivityDTO)MemberwiseClone();
|
return (ActivityDTO)MemberwiseClone();
|
||||||
|
|||||||
24
salesbook.Shared/Core/Dto/ActivityFileDto.cs
Normal file
24
salesbook.Shared/Core/Dto/ActivityFileDto.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class ActivityFileDto
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("fileName")]
|
||||||
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("originalSize")]
|
||||||
|
public int OriginalSize { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lastUpd")]
|
||||||
|
public DateTime LastUpd { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("descrizione")]
|
||||||
|
public string Descrizione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("modello")]
|
||||||
|
public string Modello { get; set; }
|
||||||
|
}
|
||||||
24
salesbook.Shared/Core/Dto/AttachedDTO.cs
Normal file
24
salesbook.Shared/Core/Dto/AttachedDTO.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class AttachedDTO
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
public string? MimeType { get; set; }
|
||||||
|
public long? DimensionBytes { get; set; }
|
||||||
|
public string? Path { get; set; }
|
||||||
|
public byte[]? FileContent { get; set; }
|
||||||
|
|
||||||
|
public double? Lat { get; set; }
|
||||||
|
public double? Lng { get; set; }
|
||||||
|
|
||||||
|
public TypeAttached Type { get; set; }
|
||||||
|
|
||||||
|
public enum TypeAttached
|
||||||
|
{
|
||||||
|
Image,
|
||||||
|
Document,
|
||||||
|
Position
|
||||||
|
}
|
||||||
|
}
|
||||||
12
salesbook.Shared/Core/Dto/AutoCompleteAddressDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/AutoCompleteAddressDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class AutoCompleteAddressDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("description")]
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("placeId")]
|
||||||
|
public string PlaceId { get; set; }
|
||||||
|
}
|
||||||
@@ -4,9 +4,15 @@ namespace salesbook.Shared.Core.Dto;
|
|||||||
|
|
||||||
public class CRMCreateContactRequestDTO
|
public class CRMCreateContactRequestDTO
|
||||||
{
|
{
|
||||||
|
[JsonPropertyName("codAnag")]
|
||||||
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("codVdes")]
|
[JsonPropertyName("codVdes")]
|
||||||
public string? CodVdes { get; set; }
|
public string? CodVdes { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVage")]
|
||||||
|
public string? CodVage { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("tipoAnag")]
|
[JsonPropertyName("tipoAnag")]
|
||||||
public string TipoAnag { get; set; }
|
public string TipoAnag { get; set; }
|
||||||
|
|
||||||
|
|||||||
19
salesbook.Shared/Core/Dto/CRMCreateContactResponseDTO.cs
Normal file
19
salesbook.Shared/Core/Dto/CRMCreateContactResponseDTO.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMCreateContactResponseDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("anagClie")]
|
||||||
|
public AnagClie? AnagClie { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ptbPros")]
|
||||||
|
public PtbPros? PtbPros { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vtbCliePersRif")]
|
||||||
|
public List<VtbCliePersRif> VtbCliePersRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ptbProsRifs")]
|
||||||
|
public List<PtbProsRif> PtbProsRif { get; set; }
|
||||||
|
}
|
||||||
12
salesbook.Shared/Core/Dto/CRMTransferProspectRequestDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/CRMTransferProspectRequestDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMTransferProspectRequestDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("codAnag")]
|
||||||
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codPpro")]
|
||||||
|
public string? CodPpro { get; set; }
|
||||||
|
}
|
||||||
10
salesbook.Shared/Core/Dto/CRMTransferProspectResponseDTO.cs
Normal file
10
salesbook.Shared/Core/Dto/CRMTransferProspectResponseDTO.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using salesbook.Shared.Core.Entity;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMTransferProspectResponseDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("anagClie")]
|
||||||
|
public AnagClie? AnagClie { get; set; }
|
||||||
|
}
|
||||||
@@ -10,4 +10,6 @@ public class FilterUserDTO
|
|||||||
public string? Citta { get; set; }
|
public string? Citta { get; set; }
|
||||||
public string? Nazione { get; set; }
|
public string? Nazione { get; set; }
|
||||||
public string? Prov { get; set; }
|
public string? Prov { get; set; }
|
||||||
|
|
||||||
|
public bool IsInitialized { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
36
salesbook.Shared/Core/Dto/IndirizzoDTO.cs
Normal file
36
salesbook.Shared/Core/Dto/IndirizzoDTO.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class IndirizzoDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("idPosizione")]
|
||||||
|
public int IdPosizione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("via")]
|
||||||
|
public string? Via { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("numeroCivico")]
|
||||||
|
public string? NumeroCivico { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("indirizzo")]
|
||||||
|
public string? Indirizzo { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("cap")]
|
||||||
|
public string? Cap { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("citta")]
|
||||||
|
public string? Citta { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("prov")]
|
||||||
|
public string? Prov { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("nazione")]
|
||||||
|
public string? Nazione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lat")]
|
||||||
|
public decimal? Lat { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lng")]
|
||||||
|
public decimal? Lng { get; set; }
|
||||||
|
}
|
||||||
18
salesbook.Shared/Core/Dto/PositionDTO.cs
Normal file
18
salesbook.Shared/Core/Dto/PositionDTO.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class PositionDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("description")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lat")]
|
||||||
|
public double? Lat { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lng")]
|
||||||
|
public double? Lng { get; set; }
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
public class AnagClie
|
public class AnagClie
|
||||||
{
|
{
|
||||||
[PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")]
|
[PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")]
|
||||||
public string CodAnag { get; set; }
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
[Column("cod_vtip"), JsonPropertyName("codVtip")]
|
[Column("cod_vtip"), JsonPropertyName("codVtip")]
|
||||||
public string? CodVtip { get; set; }
|
public string? CodVtip { get; set; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
public class PtbPros
|
public class PtbPros
|
||||||
{
|
{
|
||||||
[PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")]
|
[PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")]
|
||||||
public string CodPpro { get; set; }
|
public string? CodPpro { get; set; }
|
||||||
|
|
||||||
[Column("agenzia_banca"), JsonPropertyName("agenziaBanca")]
|
[Column("agenzia_banca"), JsonPropertyName("agenziaBanca")]
|
||||||
public string AgenziaBanca { get; set; }
|
public string AgenziaBanca { get; set; }
|
||||||
|
|||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("ptb_pros_rif")]
|
[Table("ptb_pros_rif")]
|
||||||
public class PtbProsRif
|
public class PtbProsRif
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private string? _codPpro;
|
||||||
|
|
||||||
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
|
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
|
||||||
public string CodPpro { get; set; }
|
public string? CodPpro
|
||||||
|
{
|
||||||
|
get => _codPpro;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codPpro = value;
|
||||||
|
if (_codPpro != null && _idPersRif != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int? _idPersRif;
|
||||||
|
|
||||||
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
|
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
|
||||||
public int IdPersRif { get; set; }
|
public int? IdPersRif
|
||||||
|
{
|
||||||
|
get => _idPersRif;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_idPersRif = value;
|
||||||
|
if (_codPpro != null && _idPersRif != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
||||||
public string PersonaRif { get; set; }
|
public string PersonaRif { get; set; }
|
||||||
@@ -29,4 +54,7 @@ public class PtbProsRif
|
|||||||
|
|
||||||
[Column("telefono"), JsonPropertyName("telefono")]
|
[Column("telefono"), JsonPropertyName("telefono")]
|
||||||
public string Telefono { get; set; }
|
public string Telefono { get; set; }
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{CodPpro}::{IdPersRif}";
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
public class StbActivity
|
public class StbActivity
|
||||||
{
|
{
|
||||||
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
|
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
|
||||||
public string ActivityId { get; set; }
|
public string? ActivityId { get; set; }
|
||||||
|
|
||||||
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
|
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
|
||||||
public string? ActivityResultId { get; set; }
|
public string? ActivityResultId { get; set; }
|
||||||
|
|||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("stb_activity_type")]
|
[Table("stb_activity_type")]
|
||||||
public class StbActivityType
|
public class StbActivityType
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private string? _activityTypeId;
|
||||||
|
|
||||||
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
|
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
|
||||||
public string ActivityTypeId { get; set; }
|
public string? ActivityTypeId
|
||||||
|
{
|
||||||
|
get => _activityTypeId;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_activityTypeId = value;
|
||||||
|
if (_activityTypeId != null && _flagTipologia != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _flagTipologia;
|
||||||
|
|
||||||
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
|
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
|
||||||
public string FlagTipologia { get; set; }
|
public string? FlagTipologia
|
||||||
|
{
|
||||||
|
get => _flagTipologia;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_flagTipologia = value;
|
||||||
|
if (_activityTypeId != null && _flagTipologia != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
|
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
|
||||||
public double? EstimatedDuration { get; set; } = 0;
|
public double? EstimatedDuration { get; set; } = 0;
|
||||||
@@ -38,4 +63,7 @@ public class StbActivityType
|
|||||||
|
|
||||||
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
|
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
|
||||||
public bool FlagViewCalendar { get; set; }
|
public bool FlagViewCalendar { get; set; }
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{ActivityTypeId}::{FlagTipologia}";
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("vtb_clie_pers_rif")]
|
[Table("vtb_clie_pers_rif")]
|
||||||
public class VtbCliePersRif
|
public class VtbCliePersRif
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private int? _idPersRif;
|
||||||
|
|
||||||
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
|
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
|
||||||
public int IdPersRif { get; set; }
|
public int? IdPersRif
|
||||||
|
{
|
||||||
|
get => _idPersRif;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_idPersRif = value;
|
||||||
|
if (_idPersRif != null && _codAnag != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _codAnag;
|
||||||
|
|
||||||
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
|
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
|
||||||
public string CodAnag { get; set; }
|
public string? CodAnag
|
||||||
|
{
|
||||||
|
get => _codAnag;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codAnag = value;
|
||||||
|
if (_idPersRif != null && _codAnag != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
||||||
public string PersonaRif { get; set; }
|
public string PersonaRif { get; set; }
|
||||||
@@ -38,4 +63,7 @@ public class VtbCliePersRif
|
|||||||
|
|
||||||
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
|
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
|
||||||
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
|
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{IdPersRif}::{CodAnag}";
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("vtb_dest")]
|
[Table("vtb_dest")]
|
||||||
public class VtbDest
|
public class VtbDest
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private string? _codAnag;
|
||||||
|
|
||||||
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
|
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
|
||||||
public string CodAnag { get; set; }
|
public string? CodAnag
|
||||||
|
{
|
||||||
|
get => _codAnag;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codAnag = value;
|
||||||
|
if (_codAnag != null && _codVdes != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _codVdes;
|
||||||
|
|
||||||
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
|
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
|
||||||
public string CodVdes { get; set; }
|
public string? CodVdes
|
||||||
|
{
|
||||||
|
get => _codVdes;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codVdes = value;
|
||||||
|
if (_codAnag != null && _codVdes != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("destinatario"), JsonPropertyName("destinatario")]
|
[Column("destinatario"), JsonPropertyName("destinatario")]
|
||||||
public string Destinatario { get; set; }
|
public string Destinatario { get; set; }
|
||||||
@@ -194,4 +219,7 @@ public class VtbDest
|
|||||||
|
|
||||||
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
|
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
|
||||||
public string CodFiscLegale { get; set; }
|
public string CodFiscLegale { get; set; }
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{CodAnag}::{CodVdes}";
|
||||||
}
|
}
|
||||||
@@ -45,13 +45,16 @@ public class ModalHelpers
|
|||||||
return await modal.Result;
|
return await modal.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif)
|
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif,
|
||||||
|
ContactDTO? contactModel = null, List<PersRifDTO>? persRifList = null)
|
||||||
{
|
{
|
||||||
var modal = await dialog.ShowAsync<PersRifForm>(
|
var modal = await dialog.ShowAsync<PersRifForm>(
|
||||||
"Pers rif form",
|
"Pers rif form",
|
||||||
new DialogParameters<PersRifForm>
|
new DialogParameters<PersRifForm>
|
||||||
{
|
{
|
||||||
{ x => x.OriginalModel, persRif }
|
{ x => x.OriginalModel, persRif },
|
||||||
|
{ x => x.ContactModel, contactModel},
|
||||||
|
{ x => x.PersRifList, persRifList }
|
||||||
},
|
},
|
||||||
new DialogOptions
|
new DialogOptions
|
||||||
{
|
{
|
||||||
@@ -63,4 +66,23 @@ public class ModalHelpers
|
|||||||
|
|
||||||
return await modal.Result;
|
return await modal.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<DialogResult?> OpenAddAttached(IDialogService dialog, bool canAddPosition)
|
||||||
|
{
|
||||||
|
var modal = await dialog.ShowAsync<AddAttached>(
|
||||||
|
"Add attached",
|
||||||
|
new DialogParameters<AddAttached>
|
||||||
|
{
|
||||||
|
{ x => x.CanAddPosition, canAddPosition}
|
||||||
|
},
|
||||||
|
new DialogOptions
|
||||||
|
{
|
||||||
|
FullScreen = false,
|
||||||
|
CloseButton = false,
|
||||||
|
NoHeader = true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return await modal.Result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
10
salesbook.Shared/Core/Interface/IAttachedService.cs
Normal file
10
salesbook.Shared/Core/Interface/IAttachedService.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
|
public interface IAttachedService
|
||||||
|
{
|
||||||
|
Task<AttachedDTO?> SelectImage();
|
||||||
|
Task<AttachedDTO?> SelectFile();
|
||||||
|
Task<AttachedDTO?> SelectPosition();
|
||||||
|
}
|
||||||
@@ -14,6 +14,20 @@ public interface IIntegryApiService
|
|||||||
Task DeleteActivity(string activityId);
|
Task DeleteActivity(string activityId);
|
||||||
|
|
||||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||||
Task SaveContact(CRMCreateContactRequestDTO request);
|
Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request);
|
||||||
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||||
|
Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request);
|
||||||
|
|
||||||
|
Task UploadFile(string id, byte[] file, string fileName);
|
||||||
|
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
|
||||||
|
Task<Stream> DownloadFile(string activityId, string fileName);
|
||||||
|
|
||||||
|
//Position
|
||||||
|
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||||
|
Task<PositionDTO> RetrievePosition(string id);
|
||||||
|
|
||||||
|
//Google
|
||||||
|
Task<List<IndirizzoDTO>?> Geocode(string address);
|
||||||
|
Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid);
|
||||||
|
Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid);
|
||||||
}
|
}
|
||||||
@@ -10,8 +10,10 @@ public interface IManageDataService
|
|||||||
|
|
||||||
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
|
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
|
||||||
Task<List<ContactDTO>> GetContact();
|
Task<List<ContactDTO>> GetContact();
|
||||||
|
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
|
||||||
|
|
||||||
Task InsertOrUpdate<T>(T objectToSave);
|
Task InsertOrUpdate<T>(T objectToSave);
|
||||||
|
Task InsertOrUpdate<T>(List<T> listToSave);
|
||||||
|
|
||||||
Task Delete<T>(T objectToDelete);
|
Task Delete<T>(T objectToDelete);
|
||||||
Task DeleteActivity(ActivityDTO activity);
|
Task DeleteActivity(ActivityDTO activity);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Messages.Contact;
|
||||||
|
|
||||||
|
public class NewContactMessage(CRMCreateContactResponseDTO value) : ValueChangedMessage<CRMCreateContactResponseDTO>(value);
|
||||||
17
salesbook.Shared/Core/Messages/Contact/NewContactService.cs
Normal file
17
salesbook.Shared/Core/Messages/Contact/NewContactService.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Messages.Contact;
|
||||||
|
|
||||||
|
public class NewContactService
|
||||||
|
{
|
||||||
|
public event Action<CRMCreateContactResponseDTO>? OnContactCreated;
|
||||||
|
|
||||||
|
public NewContactService(IMessenger messenger)
|
||||||
|
{
|
||||||
|
messenger.Register<NewContactMessage>(this, (_, o) =>
|
||||||
|
{
|
||||||
|
OnContactCreated?.Invoke(o.Value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System.Xml;
|
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
|
||||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Services;
|
namespace salesbook.Shared.Core.Services;
|
||||||
|
|
||||||
@@ -69,9 +69,81 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
|||||||
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
|
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
|
||||||
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
|
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
|
||||||
|
|
||||||
public Task SaveContact(CRMCreateContactRequestDTO request) =>
|
public Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request) =>
|
||||||
integryApiRestClient.AuthorizedPost<object>("crm/createContact", request);
|
integryApiRestClient.AuthorizedPost<CRMCreateContactResponseDTO>("crm/createContact", request);
|
||||||
|
|
||||||
|
public Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request) =>
|
||||||
|
integryApiRestClient.AuthorizedPost<CRMTransferProspectResponseDTO>("crm/transferProspect", request)!;
|
||||||
|
|
||||||
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
|
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
|
||||||
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
|
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
|
||||||
|
|
||||||
|
public Task<List<IndirizzoDTO>?> Geocode(string address)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "address", address },
|
||||||
|
{ "retrieveAll", true }
|
||||||
|
};
|
||||||
|
|
||||||
|
return integryApiRestClient.Get<List<IndirizzoDTO>>("geocode", queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "address", address },
|
||||||
|
{ "language", language },
|
||||||
|
{ "uuid", uuid }
|
||||||
|
};
|
||||||
|
|
||||||
|
return integryApiRestClient.Get<List<AutoCompleteAddressDTO>>("google/places/autoCompleteAddress", queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "placeId", placeId },
|
||||||
|
{ "uuid", uuid }
|
||||||
|
};
|
||||||
|
|
||||||
|
return integryApiRestClient.Get<IndirizzoDTO>("google/places/placeDetails", queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task UploadFile(string activityId, byte[] file, string fileName)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object> { { "activityId", activityId } };
|
||||||
|
|
||||||
|
var content = new MultipartFormDataContent();
|
||||||
|
var fileContent = new ByteArrayContent(file);
|
||||||
|
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
|
||||||
|
content.Add(fileContent, "files", fileName);
|
||||||
|
|
||||||
|
return integryApiRestClient.Post<object>($"uploadStbActivityFileAttachment", content, queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<List<ActivityFileDto>> GetActivityFile(string activityId)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "activityId", activityId }
|
||||||
|
};
|
||||||
|
|
||||||
|
return integryApiRestClient.AuthorizedGet<List<ActivityFileDto>>($"activity/getActivityFile", queryParams)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Stream> DownloadFile(string activityId, string fileName) =>
|
||||||
|
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!;
|
||||||
|
|
||||||
|
public Task<PositionDTO> SavePosition(PositionDTO position) =>
|
||||||
|
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
|
||||||
|
|
||||||
|
public Task<PositionDTO> RetrievePosition(string id)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object> { { "id", id } };
|
||||||
|
|
||||||
|
return integryApiRestClient.Get<PositionDTO>("retrievePosition", queryParams)!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="IntegryApiClient.Core" Version="1.1.6" />
|
<PackageReference Include="IntegryApiClient.Core" Version="1.1.6" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
|
||||||
|
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.81" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.6" />
|
||||||
@@ -38,4 +39,10 @@
|
|||||||
<Folder Include="wwwroot\js\bootstrap\" />
|
<Folder Include="wwwroot\js\bootstrap\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Mono.Android">
|
||||||
|
<HintPath>..\..\..\..\Program Files\dotnet\packs\Microsoft.Android.Ref.35\35.0.78\ref\net9.0\Mono.Android.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
@@ -31,7 +31,7 @@ a, .btn-link {
|
|||||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; }
|
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; }
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
padding-top: 1.1rem;
|
/*padding-top: 1.1rem;*/
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -176,6 +176,7 @@ h1:focus { outline: none; }
|
|||||||
.customDialog-form .mud-dialog-content {
|
.customDialog-form .mud-dialog-content {
|
||||||
padding: 0 .75rem;
|
padding: 0 .75rem;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-item-select { padding: 6px 16px; }
|
.custom-item-select { padding: 6px 16px; }
|
||||||
|
|||||||
@@ -6,5 +6,6 @@
|
|||||||
--exception-box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.3);
|
--exception-box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.3);
|
||||||
--custom-box-shadow: 1px 2px 5px var(--gray-for-shadow);
|
--custom-box-shadow: 1px 2px 5px var(--gray-for-shadow);
|
||||||
--mud-default-borderradius: 12px !important;
|
--mud-default-borderradius: 12px !important;
|
||||||
--m-page-x: 1.25rem;
|
--m-page-x: 1rem;
|
||||||
|
--mh-header: 4rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,12 @@
|
|||||||
color: var(--mud-palette-dark);
|
color: var(--mud-palette-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container-button .button-settings.blue-icon .mud-icon-root {
|
||||||
|
border: 1px solid var(--mud-palette-primary);
|
||||||
|
background: hsl(from var(--mud-palette-primary-lighten) h s 95%);
|
||||||
|
color: var(--mud-palette-primary-darken);
|
||||||
|
}
|
||||||
|
|
||||||
.container-button .button-settings.green-icon .mud-icon-root {
|
.container-button .button-settings.green-icon .mud-icon-root {
|
||||||
border: 1px solid hsl(from var(--mud-palette-success-lighten) h s 95%);
|
border: 1px solid hsl(from var(--mud-palette-success-lighten) h s 95%);
|
||||||
background: hsl(from var(--mud-palette-success-lighten) h s 95%);
|
background: hsl(from var(--mud-palette-success-lighten) h s 95%);
|
||||||
|
|||||||
@@ -22,11 +22,21 @@ public class ManageDataService : IManageDataService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<ContactDTO> GetSpecificContact(string codAnag, bool IsContact)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public Task InsertOrUpdate<T>(T objectToSave)
|
public Task InsertOrUpdate<T>(T objectToSave)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task InsertOrUpdate<T>(List<T> listToSave)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public Task Delete<T>(T objectToDelete)
|
public Task Delete<T>(T objectToDelete)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
Reference in New Issue
Block a user