Compare commits
3 Commits
8c521dc81e
...
b34f6cb213
| Author | SHA1 | Date | |
|---|---|---|---|
| b34f6cb213 | |||
| 7bcb0581cc | |||
| b2064ad71e |
@@ -23,6 +23,8 @@ public class LocalDbService
|
||||
_connection.CreateTableAsync<StbActivityResult>();
|
||||
_connection.CreateTableAsync<StbActivityType>();
|
||||
_connection.CreateTableAsync<StbUser>();
|
||||
_connection.CreateTableAsync<VtbTipi>();
|
||||
_connection.CreateTableAsync<Nazioni>();
|
||||
}
|
||||
|
||||
public async Task ResetSettingsDb()
|
||||
@@ -32,10 +34,14 @@ public class LocalDbService
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_result;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_type;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_user;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_tipi;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS nazioni;");
|
||||
|
||||
await _connection.CreateTableAsync<StbActivityResult>();
|
||||
await _connection.CreateTableAsync<StbActivityType>();
|
||||
await _connection.CreateTableAsync<StbUser>();
|
||||
await _connection.CreateTableAsync<VtbTipi>();
|
||||
await _connection.CreateTableAsync<Nazioni>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -82,5 +82,11 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
||||
|
||||
if (!settingsResponse.StbUsers.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.StbUsers!);
|
||||
|
||||
if (!settingsResponse.VtbTipi.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.VtbTipi!);
|
||||
|
||||
if (!settingsResponse.Nazioni.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.Nazioni!);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using Android.Runtime;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Application]
|
||||
[Application(HardwareAccelerated = true)]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
@page "/User/{CodAnag}"
|
||||
@page "/User/{CodContact}/{IsContact:bool}"
|
||||
@attribute [Authorize]
|
||||
@using AutoMapper
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@inject IManageDataService ManageData
|
||||
@inject IMapper Mapper
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="" ShowProfile="false"/>
|
||||
<HeaderLayout BackTo="Indietro" LabelSave="Modifica" OnSave="() => OpenUserForm(Anag)" Back="true" BackOnTop="true" Title="" ShowProfile="false" />
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
@@ -45,50 +50,42 @@ else
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
<span class="info-title">P. IVA</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(Anag.PartIva))
|
||||
{
|
||||
@("Nessuna partita iva configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!string.IsNullOrEmpty(Anag.PartIva))
|
||||
{
|
||||
<div>
|
||||
<span class="info-title">P. IVA</span>
|
||||
<span class="info-text">
|
||||
@Anag.PartIva
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(Anag.EMail))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!string.IsNullOrEmpty(Anag.EMail))
|
||||
{
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@Anag.EMail
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MudTabs Elevation="2" Rounded="true" PanelClass="pt-6" Style="width: 100%" Centered="true">
|
||||
<MudTabs TabPanelClass="custom-tab-panel" Elevation="2" Rounded="true" PanelClass="pt-2" Centered="true">
|
||||
<MudTabPanel Text="Contatti">
|
||||
@if (PersRif is { Count: > 0 })
|
||||
{
|
||||
<div class="container-pers-rif">
|
||||
<div style="margin-top: 1rem;" class="container-pers-rif">
|
||||
<Virtualize Items="PersRif" Context="person">
|
||||
@{
|
||||
var index = PersRif.IndexOf(person);
|
||||
var isLast = index == PersRif.Count - 1;
|
||||
}
|
||||
<ContactCard Contact="person" />
|
||||
<ContactCard Contact="person"/>
|
||||
@if (!isLast)
|
||||
{
|
||||
<div class="divider"></div>
|
||||
@@ -101,25 +98,34 @@ else
|
||||
<MudButton Class="button-settings infoText"
|
||||
FullWidth="true"
|
||||
Size="Size.Medium"
|
||||
OnClick="OpenPersRifForm"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi contatto
|
||||
</MudButton>
|
||||
</div>
|
||||
</MudTabPanel>
|
||||
<MudTabPanel Text="Commesse">
|
||||
<Virtualize Items="Commesse" Context="commessa">
|
||||
<CommessaCard Commessa="commessa" />
|
||||
</Virtualize>
|
||||
@if (Commesse.IsNullOrEmpty())
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna commessa presente"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Virtualize Items="Commesse" Context="commessa">
|
||||
<CommessaCard Commessa="commessa"/>
|
||||
</Virtualize>
|
||||
}
|
||||
</MudTabPanel>
|
||||
</MudTabs>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public string CodAnag { get; set; }
|
||||
[Parameter] public string CodContact { get; set; }
|
||||
[Parameter] public bool IsContact { get; set; }
|
||||
|
||||
private AnagClie Anag { get; set; } = new();
|
||||
private List<VtbCliePersRif>? PersRif { get; set; }
|
||||
private ContactDTO Anag { get; set; } = new();
|
||||
private List<PersRifDTO>? PersRif { get; set; }
|
||||
private List<JtbComt> Commesse { get; set; }
|
||||
|
||||
private bool IsLoading { get; set; } = true;
|
||||
@@ -131,12 +137,37 @@ else
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Anag = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodAnag))).Last();
|
||||
PersRif = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodAnag));
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodAnag));
|
||||
if (IsContact)
|
||||
{
|
||||
var clie = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodContact))).Last();
|
||||
Anag = Mapper.Map<ContactDTO>(clie);
|
||||
|
||||
var pers = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodContact));
|
||||
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pros = (await ManageData.GetTable<PtbPros>(x => x.CodPpro.Equals(CodContact))).Last();
|
||||
Anag = Mapper.Map<ContactDTO>(pros);
|
||||
|
||||
var pers = await ManageData.GetTable<PtbProsRif>(x => x.CodPpro.Equals(Anag.CodContact));
|
||||
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
|
||||
}
|
||||
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
|
||||
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OpenPersRifForm()
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, null);
|
||||
}
|
||||
|
||||
private async Task OpenUserForm(ContactDTO anag)
|
||||
{
|
||||
var result = await ModalHelpers.OpenUserForm(Dialog, anag);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -139,9 +139,21 @@
|
||||
margin-bottom: 1rem;
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
border-radius: 16px;
|
||||
max-height: 32vh;
|
||||
overflow: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.container-pers-rif::-webkit-scrollbar { display: none; }
|
||||
|
||||
.container-pers-rif .divider {
|
||||
margin: 0 0 0 3.5rem;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.custom-tab-panel {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
@@ -20,13 +20,13 @@
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
||||
}
|
||||
|
||||
<MudIconButton Class="rounded-button" OnClick="ToggleFilter" Icon="@Icons.Material.Rounded.FilterList" Variant="Variant.Filled" Color="Color.Secondary" Size="Size.Small" />
|
||||
<MudIconButton Class="rounded-button" OnClick="ToggleFilter" Icon="@Icons.Material.Rounded.FilterList" Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" />
|
||||
</div>
|
||||
|
||||
<MudChipSet Class="mt-2" T="string" @bind-SelectedValue="TypeUser" @bind-SelectedValue:after="FilterUsers" SelectionMode="SelectionMode.SingleSelection">
|
||||
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("all")">Tutti</MudChip>
|
||||
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("contact")">Contatti</MudChip>
|
||||
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("prospect")">Prospect</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="@("prospect")">Prospect</MudChip>
|
||||
</MudChipSet>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
else if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
||||
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
|
||||
@if (item.ShowHeader)
|
||||
{
|
||||
<div class="letter-header">@item.HeaderLetter</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@using salesbook.Shared.Core.Entity
|
||||
|
||||
<div class="activity-card">
|
||||
<div style="margin-top: 1rem;" class="activity-card">
|
||||
<div class="activity-left-section">
|
||||
<div class="activity-body-section">
|
||||
<div class="title-section">
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="contact-card">
|
||||
<div class="contact-card" @onclick="OpenPersRifForm">
|
||||
<div class="contact-left-section">
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large" />
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large"/>
|
||||
|
||||
<div class="contact-body-section">
|
||||
<div class="title-section">
|
||||
@@ -18,16 +19,25 @@
|
||||
<div class="contact-right-section">
|
||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||
{
|
||||
<MudIconButton Href="@($"tel:{Contact.NumCellulare}")" Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
|
||||
<a href="@($"tel:{Contact.NumCellulare}")">
|
||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone"/>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (!Contact.EMail.IsNullOrEmpty())
|
||||
{
|
||||
<MudIconButton Href="@($"mailto:{Contact.EMail}")" Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
||||
<a href="@($"mailto:{Contact.EMail}")">
|
||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline"/>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
|
||||
[Parameter] public PersRifDTO Contact { get; set; } = new();
|
||||
|
||||
private async Task OpenPersRifForm()
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, Contact);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<div class="user-card-left-section">
|
||||
<div class="user-card-body-section">
|
||||
<div class="title-section">
|
||||
<MudIcon @onclick="OpenUser" Color="@(User.IsContact? Color.Primary: Color.Secondary)" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
|
||||
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
|
||||
|
||||
<div class="user-card-right-section">
|
||||
<div class="user-card-title">
|
||||
@@ -55,7 +55,7 @@
|
||||
private bool ShowSectionCommesse { get; set; }
|
||||
|
||||
private void OpenUser() =>
|
||||
NavigationManager.NavigateTo($"/User/{User.CodContact}");
|
||||
NavigationManager.NavigateTo($"/User/{User.CodContact}/{User.IsContact}");
|
||||
|
||||
private async Task ShowCommesse()
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
</MessageContent>
|
||||
<YesButton>
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||
StartIcon="@Icons.Material.Filled.Check">
|
||||
StartIcon="@Icons.Material.Rounded.Check">
|
||||
Cancella
|
||||
</MudButton>
|
||||
</YesButton>
|
||||
@@ -161,7 +161,7 @@
|
||||
</MessageContent>
|
||||
<YesButton>
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.DeleteForever">
|
||||
StartIcon="@Icons.Material.Rounded.DeleteForever">
|
||||
Crea
|
||||
</MudButton>
|
||||
</YesButton>
|
||||
|
||||
@@ -2,143 +2,267 @@
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@inject IManageDataService ManageData
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Azienda"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.RagSoc"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">P. IVA</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.PartIva"
|
||||
@bind-Value:after="OnAfterChangePIva"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Cod. Fiscale</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.CodFisc"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo cliente</span>
|
||||
|
||||
@if (VtbTipi.IsNullOrEmpty())
|
||||
{
|
||||
<span class="warning-text">Nessun tipo cliente trovato</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || VtbTipi.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ContactModel.CodVtip" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var tipo in VtbTipi)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@tipo.CodVtip">@($"{tipo.CodVtip} - {tipo.Descrizione}")</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Indirizzo</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Azienda"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.RagSoc"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
@bind-Value="ContactModel.Indirizzo"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">CAP</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Partita IVA"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.PartIva"
|
||||
@bind-Value="ContactModel.Cap"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Indirizzo"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Indirizzo"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="divider"></div>
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Città</span>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="CAP"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Cap"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Città"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Citta"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Provincia"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Prov"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Nazione"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Nazione"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Citta"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo cliente</span>
|
||||
<div class="divider"></div>
|
||||
|
||||
@* @if (Commesse.IsNullOrEmpty())
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Provincia</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Prov"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Nazione</span>
|
||||
|
||||
@if (Nazioni.IsNullOrEmpty())
|
||||
{
|
||||
<span class="warning-text">Nessuna commessa presente</span>
|
||||
<span class="warning-text">Nessuna nazione trovata</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Commesse.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="UserModel.CodJcom" @bind-Value:after="OnCommessaChanged" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var com in Commesse)
|
||||
<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="@com.CodJcom">@($"{com.CodJcom} - {com.Descrizione}")</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@nazione.CodNazioneAlpha2">@($"{nazione.Descrizione}")</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
} *@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">PEC</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.EMailPec"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
@if (IsNew)
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings gray-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
||||
Size="Size.Medium"
|
||||
OnClick="NewPersRif"
|
||||
Variant="Variant.Outlined">
|
||||
Persona di riferimento
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">E-Mail</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.EMail"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Telefono</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Telefono"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (IsNew)
|
||||
{
|
||||
<div class="container-chip-persrif">
|
||||
@if (!PersRifList.IsNullOrEmpty())
|
||||
{
|
||||
foreach (var item in PersRifList!.Select((p, index) => new { p, index }))
|
||||
{
|
||||
<MudChip T="string" Color="Color.Default" OnClick="() => OpenPersRifForm(item.index, item.p)" OnClose="() => OnRemovePersRif(item.index)">
|
||||
@item.p.PersonaRif
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings gray-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
||||
Size="Size.Medium"
|
||||
OnClick="NewPersRif"
|
||||
Variant="Variant.Outlined">
|
||||
Persona di riferimento
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
|
||||
<YesButton>
|
||||
@if (VatAlreadyRegistered)
|
||||
{
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||
StartIcon="@Icons.Material.Rounded.Close">
|
||||
Chiudi
|
||||
</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Check">
|
||||
Aggiungi
|
||||
</MudButton>
|
||||
}
|
||||
</YesButton>
|
||||
</MudMessageBox>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
@@ -147,13 +271,14 @@
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public string? CodAnag { get; set; }
|
||||
[Parameter] public string? UserType { get; set; }
|
||||
|
||||
private ContactDTO OriginalModel { get; set; } = new();
|
||||
[Parameter] public ContactDTO? OriginalModel { get; set; }
|
||||
private ContactDTO ContactModel { get; set; } = new();
|
||||
|
||||
private bool IsNew => CodAnag.IsNullOrEmpty();
|
||||
private List<VtbTipi>? VtbTipi { get; set; }
|
||||
private List<PersRifDTO>? PersRifList { get; set; }
|
||||
private List<Nazioni>? Nazioni { get; set; }
|
||||
|
||||
private bool IsNew => OriginalModel is null;
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
@@ -162,17 +287,34 @@
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
//MessageBox
|
||||
private MudMessageBox CheckVat { get; set; }
|
||||
private string VatMessage { get; set; } = "";
|
||||
private bool VatAlreadyRegistered { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
_ = LoadData();
|
||||
await LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var requestDto = new CRMCreateContactRequestDTO
|
||||
{
|
||||
TipoAnag = ContactModel.IsContact ? "C" : "P",
|
||||
Cliente = ContactModel,
|
||||
PersRif = PersRifList
|
||||
};
|
||||
|
||||
await IntegryApiService.SaveContact(requestDto);
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
@@ -183,7 +325,18 @@
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (IsNew)
|
||||
{
|
||||
ContactModel.IsContact = false;
|
||||
ContactModel.Nazione = "IT";
|
||||
}
|
||||
else
|
||||
{
|
||||
ContactModel = OriginalModel!.Clone();
|
||||
}
|
||||
|
||||
Nazioni = await ManageData.GetTable<Nazioni>();
|
||||
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
@@ -194,8 +347,124 @@
|
||||
}
|
||||
}
|
||||
|
||||
private void NewPersRif()
|
||||
{
|
||||
private Task NewPersRif() => OpenPersRifForm(null, null);
|
||||
|
||||
private async Task OpenPersRifForm(int? index, PersRifDTO? persRif)
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, persRif);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(PersRifDTO))
|
||||
{
|
||||
if (index != null)
|
||||
OnRemovePersRif(index.Value);
|
||||
|
||||
PersRifList ??= [];
|
||||
|
||||
PersRifList.Add((PersRifDTO)result.Data);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRemovePersRif(int index)
|
||||
{
|
||||
if (PersRifList is null || index < 0 || index >= PersRifList.Count)
|
||||
return;
|
||||
|
||||
PersRifList.RemoveAt(index);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnAfterChangePIva()
|
||||
{
|
||||
CheckVatResponseDTO? response = null;
|
||||
var error = false;
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var nazione = Nazioni?.Find(x =>
|
||||
x.CodNazioneAlpha2.Equals(ContactModel.Nazione) ||
|
||||
x.CodNazioneIso.Equals(ContactModel.Nazione) ||
|
||||
x.Nazione.Equals(ContactModel.Nazione)
|
||||
);
|
||||
|
||||
if (nazione == null)
|
||||
return;
|
||||
|
||||
var pIva = ContactModel.PartIva.Trim();
|
||||
|
||||
var clie = (await ManageData.GetTable<AnagClie>(x => x.PartIva.Equals(pIva))).LastOrDefault();
|
||||
|
||||
if (clie == null)
|
||||
{
|
||||
var pros = (await ManageData.GetTable<PtbPros>(x => x.PartIva.Equals(pIva))).LastOrDefault();
|
||||
|
||||
if (pros == null)
|
||||
{
|
||||
if (nazione.ChkPartIva)
|
||||
{
|
||||
if (!IsView)
|
||||
{
|
||||
try
|
||||
{
|
||||
response = await IntegryApiService.CheckVat(new CheckVatRequestDTO
|
||||
{
|
||||
CountryCode = nazione.CodNazioneAlpha2,
|
||||
VatNumber = pIva
|
||||
});
|
||||
|
||||
VatMessage = $"La p.Iva (<b>{pIva}</b>) corrisponde a:<br><br><b>{response.RagSoc}</b><br><b>{response.CompleteAddress}</b><br><br>Si desidera aggiungere questi dati nel form?";
|
||||
VatAlreadyRegistered = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add(e.Message, Severity.Error);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("La ricerca della partita iva non è al momento disponibile", Severity.Warning);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("La ricerca della partita iva non è abilitata per questa nazione", Severity.Warning);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VatMessage = $"Prospect (<b>{pros.CodPpro}</b>) già censito con la p.iva: <b>{pIva} - {pros.RagSoc}</b>";
|
||||
VatAlreadyRegistered = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VatMessage = $"Cliente (<b>{clie.CodAnag}</b>) già censito con la p.iva: <b>{pIva} - {clie.RagSoc}</b>";
|
||||
VatAlreadyRegistered = true;
|
||||
}
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
|
||||
if (!error)
|
||||
{
|
||||
var result = await CheckVat.ShowAsync();
|
||||
|
||||
if (result is true && response != null)
|
||||
{
|
||||
ContactModel.RagSoc = response.RagSoc;
|
||||
ContactModel.Indirizzo = response.Indirizzo;
|
||||
ContactModel.Cap = response.Cap;
|
||||
ContactModel.Citta = response.Citta;
|
||||
ContactModel.Prov = response.Prov;
|
||||
}
|
||||
}
|
||||
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
}
|
||||
@@ -2,3 +2,8 @@
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
}
|
||||
|
||||
.container-chip-persrif {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@inject IManageDataService ManageData
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : "")" />
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Cognome e Nome"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.PersonaRif"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Mansione"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.Mansione"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Email</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.EMail"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Fax</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.Fax"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Cellulare</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.NumCellulare"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Telefono</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.Telefono"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public PersRifDTO? OriginalModel { get; set; }
|
||||
private PersRifDTO PersRifModel { get; set; } = new();
|
||||
|
||||
private bool IsNew => OriginalModel is null;
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(PersRifModel);
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (!IsNew)
|
||||
PersRifModel = OriginalModel!.Clone();
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(PersRifModel) ? "Aggiorna" : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
.container-button {
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
}
|
||||
18
salesbook.Shared/Core/Dto/CRMCreateContactRequestDTO.cs
Normal file
18
salesbook.Shared/Core/Dto/CRMCreateContactRequestDTO.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class CRMCreateContactRequestDTO
|
||||
{
|
||||
[JsonPropertyName("codVdes")]
|
||||
public string? CodVdes { get; set; }
|
||||
|
||||
[JsonPropertyName("tipoAnag")]
|
||||
public string TipoAnag { get; set; }
|
||||
|
||||
[JsonPropertyName("cliente")]
|
||||
public ContactDTO Cliente { get; set; }
|
||||
|
||||
[JsonPropertyName("persRif")]
|
||||
public List<PersRifDTO>? PersRif { get; set; }
|
||||
}
|
||||
12
salesbook.Shared/Core/Dto/CheckVatRequestDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/CheckVatRequestDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class CheckVatRequestDTO
|
||||
{
|
||||
[JsonPropertyName("countryCode")]
|
||||
public string CountryCode { get; set; }
|
||||
|
||||
[JsonPropertyName("vatNumber")]
|
||||
public string VatNumber { get; set; }
|
||||
}
|
||||
39
salesbook.Shared/Core/Dto/CheckVatResponseDTO.cs
Normal file
39
salesbook.Shared/Core/Dto/CheckVatResponseDTO.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class CheckVatResponseDTO
|
||||
{
|
||||
[JsonPropertyName("countryCode")]
|
||||
public string? CountryCode { get; set; }
|
||||
|
||||
[JsonPropertyName("vatNumber ")]
|
||||
public string? VatNumber { get; set; }
|
||||
|
||||
[JsonPropertyName("requestDate")]
|
||||
public string? RequestDate { get; set; }
|
||||
|
||||
[JsonPropertyName("valid")]
|
||||
public bool Valid { get; set; }
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[JsonPropertyName("address")]
|
||||
public string? CompleteAddress { get; set; }
|
||||
|
||||
[JsonPropertyName("ragSoc")]
|
||||
public string? RagSoc { get; set; }
|
||||
|
||||
[JsonPropertyName("indirizzo")]
|
||||
public string? Indirizzo { get; set; }
|
||||
|
||||
[JsonPropertyName("cap")]
|
||||
public string? Cap { get; set; }
|
||||
|
||||
[JsonPropertyName("citta")]
|
||||
public string? Citta { get; set; }
|
||||
|
||||
[JsonPropertyName("prov")]
|
||||
public string? Prov { get; set; }
|
||||
}
|
||||
@@ -17,22 +17,22 @@ public class ContactDTO
|
||||
public string? CodVage { get; set; }
|
||||
|
||||
[JsonPropertyName("ragSoc")]
|
||||
public string RagSoc { get; set; }
|
||||
public string? RagSoc { get; set; }
|
||||
|
||||
[JsonPropertyName("indirizzo")]
|
||||
public string Indirizzo { get; set; }
|
||||
public string? Indirizzo { get; set; }
|
||||
|
||||
[JsonPropertyName("cap")]
|
||||
public string Cap { get; set; }
|
||||
public string? Cap { get; set; }
|
||||
|
||||
[JsonPropertyName("citta")]
|
||||
public string Citta { get; set; }
|
||||
public string? Citta { get; set; }
|
||||
|
||||
[JsonPropertyName("prov")]
|
||||
public string Prov { get; set; }
|
||||
public string? Prov { get; set; }
|
||||
|
||||
[JsonPropertyName("nazione")]
|
||||
public string Nazione { get; set; }
|
||||
public string? Nazione { get; set; }
|
||||
|
||||
[JsonPropertyName("telefono")]
|
||||
public string? Telefono { get; set; }
|
||||
@@ -57,4 +57,9 @@ public class ContactDTO
|
||||
|
||||
[JsonPropertyName("eMailPec")]
|
||||
public string EMailPec { get; set; }
|
||||
|
||||
public ContactDTO Clone()
|
||||
{
|
||||
return (ContactDTO)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
38
salesbook.Shared/Core/Dto/PersRifDTO.cs
Normal file
38
salesbook.Shared/Core/Dto/PersRifDTO.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class PersRifDTO
|
||||
{
|
||||
[JsonPropertyName("codPersRif")]
|
||||
public string CodPersRif { get; set; }
|
||||
|
||||
[JsonPropertyName("idPersRif")]
|
||||
public int IdPersRif { get; set; }
|
||||
|
||||
[JsonPropertyName("personaRif")]
|
||||
public string PersonaRif { get; set; }
|
||||
|
||||
[JsonPropertyName("eMail")]
|
||||
public string EMail { get; set; }
|
||||
|
||||
[JsonPropertyName("fax")]
|
||||
public string Fax { get; set; }
|
||||
|
||||
[JsonPropertyName("mansione")]
|
||||
public string? Mansione { get; set; }
|
||||
|
||||
[JsonPropertyName("numCellulare")]
|
||||
public string NumCellulare { get; set; }
|
||||
|
||||
[JsonPropertyName("telefono")]
|
||||
public string Telefono { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public int TempId { get; set; }
|
||||
|
||||
public PersRifDTO Clone()
|
||||
{
|
||||
return (PersRifDTO)MemberwiseClone();
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,10 @@ public class SettingsResponseDTO
|
||||
|
||||
[JsonPropertyName("stbUsers")]
|
||||
public List<StbUser>? StbUsers { get; set; }
|
||||
|
||||
[JsonPropertyName("vtbTipi")]
|
||||
public List<VtbTipi>? VtbTipi { get; set; }
|
||||
|
||||
[JsonPropertyName("nazioni")]
|
||||
public List<Nazioni>? Nazioni { get; set; }
|
||||
}
|
||||
23
salesbook.Shared/Core/Entity/Nazioni.cs
Normal file
23
salesbook.Shared/Core/Entity/Nazioni.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using SQLite;
|
||||
|
||||
namespace salesbook.Shared.Core.Entity;
|
||||
|
||||
[Table("nazioni")]
|
||||
public class Nazioni
|
||||
{
|
||||
[PrimaryKey, Column("nazione"), JsonPropertyName("nazione")]
|
||||
public string Nazione { get; set; }
|
||||
|
||||
[Column("cod_nazione_iso"), JsonPropertyName("codNazioneIso")]
|
||||
public string CodNazioneIso { get; set; }
|
||||
|
||||
[Column("cod_nazi_alpha_2"), JsonPropertyName("codNazioneAlpha2")]
|
||||
public string CodNazioneAlpha2 { get; set; }
|
||||
|
||||
[Column("descrizione"), JsonPropertyName("descrizione")]
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
[Column("chk_part_iva"), JsonPropertyName("chkPartIva")]
|
||||
public bool ChkPartIva { get; set; }
|
||||
}
|
||||
14
salesbook.Shared/Core/Entity/VtbTipi.cs
Normal file
14
salesbook.Shared/Core/Entity/VtbTipi.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using SQLite;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Entity;
|
||||
|
||||
[Table("vtb_tipi")]
|
||||
public class VtbTipi
|
||||
{
|
||||
[PrimaryKey, Column("cod_vtip"), JsonPropertyName("codVtip")]
|
||||
public string CodVtip { get; set; }
|
||||
|
||||
[Column("descrizione"), JsonPropertyName("descrizione")]
|
||||
public string Descrizione { get; set; }
|
||||
}
|
||||
@@ -19,5 +19,13 @@ public class MappingProfile : Profile
|
||||
CreateMap<PtbPros, ContactDTO>()
|
||||
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodPpro))
|
||||
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => false));
|
||||
|
||||
//Mapping da VtbCliePersRif a PersRifDTO
|
||||
CreateMap<VtbCliePersRif, PersRifDTO>()
|
||||
.ForMember(x => x.CodPersRif, y => y.MapFrom(z => z.CodAnag));
|
||||
|
||||
//Mapping da PtbProsRif a PersRifDTO
|
||||
CreateMap<PtbProsRif, PersRifDTO>()
|
||||
.ForMember(x => x.CodPersRif, y => y.MapFrom(z => z.CodPpro));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,13 +26,32 @@ public class ModalHelpers
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, string? codAnag)
|
||||
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, ContactDTO? anag)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ContactForm>(
|
||||
"User form",
|
||||
new DialogParameters<ContactForm>
|
||||
{
|
||||
{ x => x.CodAnag, codAnag }
|
||||
{ x => x.OriginalModel, anag }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = true,
|
||||
CloseButton = false,
|
||||
NoHeader = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<PersRifForm>(
|
||||
"Pers rif form",
|
||||
new DialogParameters<PersRifForm>
|
||||
{
|
||||
{ x => x.OriginalModel, persRif }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
|
||||
@@ -14,4 +14,6 @@ public interface IIntegryApiService
|
||||
Task DeleteActivity(string activityId);
|
||||
|
||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||
Task SaveContact(CRMCreateContactRequestDTO request);
|
||||
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using System.Xml;
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
@@ -67,4 +68,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
||||
|
||||
public Task<List<StbActivity>?> SaveActivity(ActivityDTO activity) =>
|
||||
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/saveActivity", activity);
|
||||
|
||||
public Task SaveContact(CRMCreateContactRequestDTO request) =>
|
||||
integryApiRestClient.AuthorizedPost<object>("crm/createContact", request);
|
||||
|
||||
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
|
||||
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
|
||||
}
|
||||
@@ -1,31 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="1.1.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.6" />
|
||||
<PackageReference Include="MudBlazor" Version="8.6.0" />
|
||||
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<IsAotCompatible>True</IsAotCompatible>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\css\lineicons\" />
|
||||
<Folder Include="wwwroot\js\bootstrap\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="1.1.6" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.6" />
|
||||
<PackageReference Include="MudBlazor" Version="8.6.0" />
|
||||
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\css\lineicons\" />
|
||||
<Folder Include="wwwroot\js\bootstrap\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -41,20 +41,23 @@
|
||||
}
|
||||
|
||||
.form-container > span {
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
width: 50%;
|
||||
margin-right: .3rem;
|
||||
}
|
||||
|
||||
.form-container > .warning-text {
|
||||
font-weight: 500;
|
||||
font-weight: 700;
|
||||
color: var(--mud-palette-gray-darker);
|
||||
width: unset;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
.form-container > .disable-full-width { width: unset !important; }
|
||||
.form-container > .disable-full-width {
|
||||
width: unset !important;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.dateTime-picker {
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user