Controllo p.Iva
This commit is contained in:
@@ -24,6 +24,7 @@ public class LocalDbService
|
|||||||
_connection.CreateTableAsync<StbActivityType>();
|
_connection.CreateTableAsync<StbActivityType>();
|
||||||
_connection.CreateTableAsync<StbUser>();
|
_connection.CreateTableAsync<StbUser>();
|
||||||
_connection.CreateTableAsync<VtbTipi>();
|
_connection.CreateTableAsync<VtbTipi>();
|
||||||
|
_connection.CreateTableAsync<Nazioni>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ResetSettingsDb()
|
public async Task ResetSettingsDb()
|
||||||
@@ -34,11 +35,13 @@ public class LocalDbService
|
|||||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_type;");
|
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 stb_user;");
|
||||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_tipi;");
|
await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_tipi;");
|
||||||
|
await _connection.ExecuteAsync("DROP TABLE IF EXISTS nazioni;");
|
||||||
|
|
||||||
await _connection.CreateTableAsync<StbActivityResult>();
|
await _connection.CreateTableAsync<StbActivityResult>();
|
||||||
await _connection.CreateTableAsync<StbActivityType>();
|
await _connection.CreateTableAsync<StbActivityType>();
|
||||||
await _connection.CreateTableAsync<StbUser>();
|
await _connection.CreateTableAsync<StbUser>();
|
||||||
await _connection.CreateTableAsync<VtbTipi>();
|
await _connection.CreateTableAsync<VtbTipi>();
|
||||||
|
await _connection.CreateTableAsync<Nazioni>();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,5 +85,8 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
|||||||
|
|
||||||
if (!settingsResponse.VtbTipi.IsNullOrEmpty())
|
if (!settingsResponse.VtbTipi.IsNullOrEmpty())
|
||||||
await localDb.InsertAll(settingsResponse.VtbTipi!);
|
await localDb.InsertAll(settingsResponse.VtbTipi!);
|
||||||
|
|
||||||
|
if (!settingsResponse.Nazioni.IsNullOrEmpty())
|
||||||
|
await localDb.InsertAll(settingsResponse.Nazioni!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
</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.Filled.Check">
|
StartIcon="@Icons.Material.Rounded.Check">
|
||||||
Cancella
|
Cancella
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</YesButton>
|
</YesButton>
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
</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.Filled.DeleteForever">
|
StartIcon="@Icons.Material.Rounded.DeleteForever">
|
||||||
Crea
|
Crea
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</YesButton>
|
</YesButton>
|
||||||
|
|||||||
@@ -13,234 +13,256 @@
|
|||||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
|
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
|
||||||
|
|
||||||
<div class="content">
|
<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"
|
<MudTextField ReadOnly="IsView"
|
||||||
T="string?"
|
T="string?"
|
||||||
Placeholder="Azienda"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="ContactModel.RagSoc"
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
|
@bind-Value="ContactModel.Indirizzo"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-card">
|
<div class="divider"></div>
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">P. IVA</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
<div class="form-container">
|
||||||
T="string?"
|
<span class="disable-full-width">CAP</span>
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.PartIva"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divider"></div>
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
<div class="form-container">
|
Variant="Variant.Text"
|
||||||
<span class="disable-full-width">Cod. Fiscale</span>
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
<MudTextField ReadOnly="IsView"
|
Lines="1"
|
||||||
T="string?"
|
@bind-Value="ContactModel.Cap"
|
||||||
Variant="Variant.Text"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
FullWidth="true"
|
DebounceInterval="500"
|
||||||
Class="customIcon-select"
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.CodFisc"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-card">
|
<div class="divider"></div>
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">Tipo cliente</span>
|
|
||||||
|
|
||||||
@if (VtbTipi.IsNullOrEmpty())
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Città</span>
|
||||||
|
|
||||||
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
|
Lines="1"
|
||||||
|
@bind-Value="ContactModel.Citta"
|
||||||
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
|
DebounceInterval="500"
|
||||||
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Provincia</span>
|
||||||
|
|
||||||
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
|
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">Nessun tipo cliente trovato</span>
|
<span class="warning-text">Nessuna nazione trovata</span>
|
||||||
}
|
}
|
||||||
else
|
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">
|
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Nazioni.IsNullOrEmpty())" T="string?"
|
||||||
@foreach (var tipo in VtbTipi)
|
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="@tipo.CodVtip">@($"{tipo.CodVtip} - {tipo.Descrizione}")</MudSelectItemExtended>
|
<MudSelectItemExtended Class="custom-item-select" Value="@nazione.CodNazioneAlpha2">@($"{nazione.Descrizione}")</MudSelectItemExtended>
|
||||||
}
|
}
|
||||||
</MudSelectExtended>
|
</MudSelectExtended>
|
||||||
}
|
}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-card">
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">Indirizzo</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
Lines="1"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
@bind-Value="ContactModel.Indirizzo"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">CAP</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.Cap"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">Città</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.Citta"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">Provincia</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
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>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.Nazione"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="input-card">
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">PEC</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.EMailPec"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">E-Mail</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.EMail"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<div class="form-container">
|
|
||||||
<span class="disable-full-width">Telefono</span>
|
|
||||||
|
|
||||||
<MudTextField ReadOnly="IsView"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
FullWidth="true"
|
|
||||||
Class="customIcon-select"
|
|
||||||
Lines="1"
|
|
||||||
@bind-Value="ContactModel.Telefono"
|
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
|
||||||
DebounceInterval="500"
|
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@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>
|
</div>
|
||||||
|
|
||||||
|
<div class="input-card">
|
||||||
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">PEC</span>
|
||||||
|
|
||||||
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
|
Lines="1"
|
||||||
|
@bind-Value="ContactModel.EMailPec"
|
||||||
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
|
DebounceInterval="500"
|
||||||
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">E-Mail</span>
|
||||||
|
|
||||||
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
|
Lines="1"
|
||||||
|
@bind-Value="ContactModel.EMail"
|
||||||
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
|
DebounceInterval="500"
|
||||||
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Telefono</span>
|
||||||
|
|
||||||
|
<MudTextField ReadOnly="IsView"
|
||||||
|
T="string?"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
FullWidth="true"
|
||||||
|
Class="customIcon-select"
|
||||||
|
Lines="1"
|
||||||
|
@bind-Value="ContactModel.Telefono"
|
||||||
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
|
DebounceInterval="500"
|
||||||
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@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>
|
</DialogContent>
|
||||||
</MudDialog>
|
</MudDialog>
|
||||||
|
|
||||||
@@ -254,6 +276,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 bool IsNew => OriginalModel is null;
|
private bool IsNew => OriginalModel is null;
|
||||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||||
@@ -264,6 +287,11 @@
|
|||||||
private bool VisibleOverlay { get; set; }
|
private bool VisibleOverlay { get; set; }
|
||||||
private bool SuccessAnimation { 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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
@@ -300,12 +328,14 @@
|
|||||||
if (IsNew)
|
if (IsNew)
|
||||||
{
|
{
|
||||||
ContactModel.IsContact = false;
|
ContactModel.IsContact = false;
|
||||||
|
ContactModel.Nazione = "IT";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ContactModel = OriginalModel!.Clone();
|
ContactModel = OriginalModel!.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Nazioni = await ManageData.GetTable<Nazioni>();
|
||||||
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,4 +373,98 @@
|
|||||||
StateHasChanged();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : "Persona di riferimento")" />
|
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : "")" />
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
|
|||||||
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; }
|
public string? CodVage { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("ragSoc")]
|
[JsonPropertyName("ragSoc")]
|
||||||
public string RagSoc { get; set; }
|
public string? RagSoc { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("indirizzo")]
|
[JsonPropertyName("indirizzo")]
|
||||||
public string Indirizzo { get; set; }
|
public string? Indirizzo { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("cap")]
|
[JsonPropertyName("cap")]
|
||||||
public string Cap { get; set; }
|
public string? Cap { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("citta")]
|
[JsonPropertyName("citta")]
|
||||||
public string Citta { get; set; }
|
public string? Citta { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("prov")]
|
[JsonPropertyName("prov")]
|
||||||
public string Prov { get; set; }
|
public string? Prov { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("nazione")]
|
[JsonPropertyName("nazione")]
|
||||||
public string Nazione { get; set; }
|
public string? Nazione { get; set; }
|
||||||
|
|
||||||
[JsonPropertyName("telefono")]
|
[JsonPropertyName("telefono")]
|
||||||
public string? Telefono { get; set; }
|
public string? Telefono { get; set; }
|
||||||
|
|||||||
@@ -16,4 +16,7 @@ public class SettingsResponseDTO
|
|||||||
|
|
||||||
[JsonPropertyName("vtbTipi")]
|
[JsonPropertyName("vtbTipi")]
|
||||||
public List<VtbTipi>? VtbTipi { get; set; }
|
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; }
|
||||||
|
}
|
||||||
@@ -15,4 +15,5 @@ public interface IIntegryApiService
|
|||||||
|
|
||||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||||
Task SaveContact(CRMCreateContactRequestDTO request);
|
Task SaveContact(CRMCreateContactRequestDTO request);
|
||||||
|
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||||
}
|
}
|
||||||
@@ -71,4 +71,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
|||||||
|
|
||||||
public Task SaveContact(CRMCreateContactRequestDTO request) =>
|
public Task SaveContact(CRMCreateContactRequestDTO request) =>
|
||||||
integryApiRestClient.AuthorizedPost<object>("crm/createContact", request);
|
integryApiRestClient.AuthorizedPost<object>("crm/createContact", request);
|
||||||
|
|
||||||
|
public Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request) =>
|
||||||
|
integryApiRestClient.Post<CheckVatResponseDTO>("checkPartitaIva", request)!;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user