Migliorati form Cliente e PersonaRif
This commit is contained in:
@@ -3,7 +3,7 @@ using Android.Runtime;
|
|||||||
|
|
||||||
namespace salesbook.Maui
|
namespace salesbook.Maui
|
||||||
{
|
{
|
||||||
[Application]
|
[Application(HardwareAccelerated = true)]
|
||||||
public class MainApplication : MauiApplication
|
public class MainApplication : MauiApplication
|
||||||
{
|
{
|
||||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
@page "/User/{CodAnag}"
|
@page "/User/{CodContact}/{IsContact:bool}"
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
@using AutoMapper
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@inject IManageDataService ManageData
|
@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)
|
@if (IsLoading)
|
||||||
{
|
{
|
||||||
@@ -45,50 +50,42 @@ else
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div>
|
@if (!string.IsNullOrEmpty(Anag.PartIva))
|
||||||
<span class="info-title">P. IVA</span>
|
{
|
||||||
<span class="info-text">
|
<div>
|
||||||
@if (string.IsNullOrEmpty(Anag.PartIva))
|
<span class="info-title">P. IVA</span>
|
||||||
{
|
<span class="info-text">
|
||||||
@("Nessuna partita iva configurata")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@Anag.PartIva
|
@Anag.PartIva
|
||||||
}
|
</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section-personal-info">
|
<div class="section-personal-info">
|
||||||
<div>
|
@if (!string.IsNullOrEmpty(Anag.EMail))
|
||||||
<span class="info-title">E-mail</span>
|
{
|
||||||
<span class="info-text">
|
<div>
|
||||||
@if (string.IsNullOrEmpty(Anag.EMail))
|
<span class="info-title">E-mail</span>
|
||||||
{
|
<span class="info-text">
|
||||||
@("Nessuna mail configurata")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@Anag.EMail
|
@Anag.EMail
|
||||||
}
|
</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
}
|
||||||
</div>
|
</div>
|
||||||
</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">
|
<MudTabPanel Text="Contatti">
|
||||||
@if (PersRif is { Count: > 0 })
|
@if (PersRif is { Count: > 0 })
|
||||||
{
|
{
|
||||||
<div class="container-pers-rif">
|
<div style="margin-top: 1rem;" class="container-pers-rif">
|
||||||
<Virtualize Items="PersRif" Context="person">
|
<Virtualize Items="PersRif" Context="person">
|
||||||
@{
|
@{
|
||||||
var index = PersRif.IndexOf(person);
|
var index = PersRif.IndexOf(person);
|
||||||
var isLast = index == PersRif.Count - 1;
|
var isLast = index == PersRif.Count - 1;
|
||||||
}
|
}
|
||||||
<ContactCard Contact="person" />
|
<ContactCard Contact="person"/>
|
||||||
@if (!isLast)
|
@if (!isLast)
|
||||||
{
|
{
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
@@ -101,25 +98,34 @@ else
|
|||||||
<MudButton Class="button-settings infoText"
|
<MudButton Class="button-settings infoText"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
Size="Size.Medium"
|
Size="Size.Medium"
|
||||||
|
OnClick="OpenPersRifForm"
|
||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Aggiungi contatto
|
Aggiungi contatto
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
</div>
|
||||||
</MudTabPanel>
|
</MudTabPanel>
|
||||||
<MudTabPanel Text="Commesse">
|
<MudTabPanel Text="Commesse">
|
||||||
<Virtualize Items="Commesse" Context="commessa">
|
@if (Commesse.IsNullOrEmpty())
|
||||||
<CommessaCard Commessa="commessa" />
|
{
|
||||||
</Virtualize>
|
<NoDataAvailable Text="Nessuna commessa presente"/>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<Virtualize Items="Commesse" Context="commessa">
|
||||||
|
<CommessaCard Commessa="commessa"/>
|
||||||
|
</Virtualize>
|
||||||
|
}
|
||||||
</MudTabPanel>
|
</MudTabPanel>
|
||||||
</MudTabs>
|
</MudTabs>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@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 ContactDTO Anag { get; set; } = new();
|
||||||
private List<VtbCliePersRif>? PersRif { get; set; }
|
private List<PersRifDTO>? PersRif { get; set; }
|
||||||
private List<JtbComt> Commesse { get; set; }
|
private List<JtbComt> Commesse { get; set; }
|
||||||
|
|
||||||
private bool IsLoading { get; set; } = true;
|
private bool IsLoading { get; set; } = true;
|
||||||
@@ -131,12 +137,37 @@ else
|
|||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
Anag = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodAnag))).Last();
|
if (IsContact)
|
||||||
PersRif = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodAnag));
|
{
|
||||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodAnag));
|
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;
|
IsLoading = false;
|
||||||
StateHasChanged();
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -144,4 +144,11 @@
|
|||||||
.container-pers-rif .divider {
|
.container-pers-rif .divider {
|
||||||
margin: 0 0 0 3.5rem;
|
margin: 0 0 0 3.5rem;
|
||||||
width: unset;
|
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="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>
|
</div>
|
||||||
|
|
||||||
<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.Secondary" Variant="Variant.Text" Value="@("all")">Tutti</MudChip>
|
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("all")">Tutti</MudChip>
|
||||||
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("contact")">Contatti</MudChip>
|
<MudChip Color="Color.Primary" 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="@("prospect")">Prospect</MudChip>
|
||||||
</MudChipSet>
|
</MudChipSet>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
}
|
}
|
||||||
else if (GroupedUserList?.Count > 0)
|
else if (GroupedUserList?.Count > 0)
|
||||||
{
|
{
|
||||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
|
||||||
@if (item.ShowHeader)
|
@if (item.ShowHeader)
|
||||||
{
|
{
|
||||||
<div class="letter-header">@item.HeaderLetter</div>
|
<div class="letter-header">@item.HeaderLetter</div>
|
||||||
|
|||||||
@@ -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">
|
<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="contact-body-section">
|
||||||
<div class="title-section">
|
<div class="title-section">
|
||||||
@@ -18,16 +19,25 @@
|
|||||||
<div class="contact-right-section">
|
<div class="contact-right-section">
|
||||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
@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())
|
@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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@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-left-section">
|
||||||
<div class="user-card-body-section">
|
<div class="user-card-body-section">
|
||||||
<div class="title-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-right-section">
|
||||||
<div class="user-card-title">
|
<div class="user-card-title">
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
private bool ShowSectionCommesse { get; set; }
|
private bool ShowSectionCommesse { get; set; }
|
||||||
|
|
||||||
private void OpenUser() =>
|
private void OpenUser() =>
|
||||||
NavigationManager.NavigateTo($"/User/{User.CodContact}");
|
NavigationManager.NavigateTo($"/User/{User.CodContact}/{User.IsContact}");
|
||||||
|
|
||||||
private async Task ShowCommesse()
|
private async Task ShowCommesse()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,71 +37,76 @@
|
|||||||
|
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Indirizzo</span>
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
<MudTextField ReadOnly="IsView"
|
||||||
T="string?"
|
T="string?"
|
||||||
Placeholder="Indirizzo"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="ContactModel.Indirizzo"
|
@bind-Value="ContactModel.Indirizzo"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">CAP</span>
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
<MudTextField ReadOnly="IsView"
|
||||||
T="string?"
|
T="string?"
|
||||||
Placeholder="CAP"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="ContactModel.Cap"
|
@bind-Value="ContactModel.Cap"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Città</span>
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
<MudTextField ReadOnly="IsView"
|
||||||
T="string?"
|
T="string?"
|
||||||
Placeholder="Città"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="ContactModel.Citta"
|
@bind-Value="ContactModel.Citta"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Provincia</span>
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
<MudTextField ReadOnly="IsView"
|
||||||
T="string?"
|
T="string?"
|
||||||
Placeholder="Provincia"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
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="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Nazione</span>
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
<MudTextField ReadOnly="IsView"
|
||||||
T="string?"
|
T="string?"
|
||||||
Placeholder="Nazione"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="ContactModel.Nazione"
|
@bind-Value="ContactModel.Nazione"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -147,13 +152,10 @@
|
|||||||
@code {
|
@code {
|
||||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||||
|
|
||||||
[Parameter] public string? CodAnag { get; set; }
|
[Parameter] public ContactDTO? OriginalModel { get; set; }
|
||||||
[Parameter] public string? UserType { get; set; }
|
|
||||||
|
|
||||||
private ContactDTO OriginalModel { get; set; } = new();
|
|
||||||
private ContactDTO ContactModel { get; set; } = new();
|
private ContactDTO ContactModel { get; set; } = new();
|
||||||
|
|
||||||
private bool IsNew => CodAnag.IsNullOrEmpty();
|
private bool IsNew => OriginalModel is null;
|
||||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||||
|
|
||||||
private string? LabelSave { get; set; }
|
private string? LabelSave { get; set; }
|
||||||
@@ -183,7 +185,8 @@
|
|||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
|
if (!IsNew)
|
||||||
|
ContactModel = OriginalModel!.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAfterChangeValue()
|
private void OnAfterChangeValue()
|
||||||
|
|||||||
@@ -0,0 +1,155 @@
|
|||||||
|
@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" : $"{PersRifModel.CodPersRif}")" />
|
||||||
|
|
||||||
|
<div class="content">
|
||||||
|
<div class="input-card">
|
||||||
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
|
Placeholder="Persona di riferimento"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
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"
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
SuccessAnimation = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await Task.Delay(1250);
|
||||||
|
|
||||||
|
MudDialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadData()
|
||||||
|
{
|
||||||
|
if (!IsNew)
|
||||||
|
PersRifModel = OriginalModel!.Clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAfterChangeValue()
|
||||||
|
{
|
||||||
|
if (!IsNew)
|
||||||
|
{
|
||||||
|
LabelSave = !OriginalModel.Equals(PersRifModel) ? "Aggiorna" : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NewPersRif()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
.container-button {
|
||||||
|
background: var(--mud-palette-background-gray) !important;
|
||||||
|
box-shadow: unset;
|
||||||
|
}
|
||||||
@@ -57,4 +57,9 @@ public class ContactDTO
|
|||||||
|
|
||||||
[JsonPropertyName("eMailPec")]
|
[JsonPropertyName("eMailPec")]
|
||||||
public string EMailPec { get; set; }
|
public string EMailPec { get; set; }
|
||||||
|
|
||||||
|
public ContactDTO Clone()
|
||||||
|
{
|
||||||
|
return (ContactDTO)MemberwiseClone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
35
salesbook.Shared/Core/Dto/PersRifDTO.cs
Normal file
35
salesbook.Shared/Core/Dto/PersRifDTO.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
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; }
|
||||||
|
|
||||||
|
public PersRifDTO Clone()
|
||||||
|
{
|
||||||
|
return (PersRifDTO)MemberwiseClone();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,5 +19,13 @@ public class MappingProfile : Profile
|
|||||||
CreateMap<PtbPros, ContactDTO>()
|
CreateMap<PtbPros, ContactDTO>()
|
||||||
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodPpro))
|
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodPpro))
|
||||||
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => false));
|
.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;
|
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>(
|
var modal = await dialog.ShowAsync<ContactForm>(
|
||||||
"User form",
|
"User form",
|
||||||
new DialogParameters<ContactForm>
|
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
|
new DialogOptions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,31 +1,41 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<SupportedPlatform Include="browser" />
|
<IsAotCompatible>True</IsAotCompatible>
|
||||||
</ItemGroup>
|
<RunAOTCompilation>true</RunAOTCompilation>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
<IsAotCompatible>True</IsAotCompatible>
|
||||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
<RunAOTCompilation>true</RunAOTCompilation>
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
</PropertyGroup>
|
||||||
<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>
|
<ItemGroup>
|
||||||
<Folder Include="wwwroot\css\lineicons\" />
|
<SupportedPlatform Include="browser" />
|
||||||
<Folder Include="wwwroot\js\bootstrap\" />
|
</ItemGroup>
|
||||||
</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>
|
</Project>
|
||||||
Reference in New Issue
Block a user