76 lines
2.3 KiB
Plaintext
76 lines
2.3 KiB
Plaintext
@using Microsoft.EntityFrameworkCore
|
|
@using StandManager.Components.Layout
|
|
@using System.Threading.Tasks
|
|
@using StandManager.Model
|
|
|
|
@page "/RegistrazioneInFiera"
|
|
@layout PublicLayout
|
|
|
|
@rendermode InteractiveServer
|
|
|
|
<PageTitle>Iscrizione Evento</PageTitle>
|
|
<AppHeader />
|
|
<div class="container my-5 py-3">
|
|
<ClienteToggle ValueChanged="onClienteToggleChanged" />
|
|
@if (showCodiceCliente)
|
|
{
|
|
<div class="col-12">
|
|
<div class="row">
|
|
<div class="col-12 mb-3">
|
|
<RadzenFormField Text="Codice cliente o Partita IVA" Variant="Variant.Flat" Style="width: 100%;">
|
|
<RadzenTextBox Style="width: 100%" aria-label="Codice cliente o Partita IVA" Change="(args => onCodiceFornitoChanged(args))" />
|
|
</RadzenFormField>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
@if (showForm)
|
|
{
|
|
<Component_Registrazione invito="invito" @ref="registrazione" />
|
|
}
|
|
|
|
</div>
|
|
|
|
<DacFooter />
|
|
|
|
@code {
|
|
private bool showCodiceCliente { get; set; } = false;
|
|
private bool showForm { get; set; } = false;
|
|
private InvitoEventoViewModel invito { get; set; } = new InvitoEventoViewModel();
|
|
private Component_Registrazione registrazione { get; set; } = new();
|
|
|
|
private string codiceFornito { get; set; }
|
|
|
|
private void onClienteToggleChanged(bool value)
|
|
{
|
|
if (!value)
|
|
registrazione.NoCliente();
|
|
else
|
|
registrazione.HasCliente();
|
|
|
|
showCodiceCliente = value;
|
|
showForm = true;
|
|
}
|
|
|
|
private async Task onCodiceFornitoChanged(string text)
|
|
{
|
|
codiceFornito = text;
|
|
invito.CodiceFornito = codiceFornito;
|
|
|
|
var destinazione = (await _managerService.DestinazioneService.RicercaPer(
|
|
x => x.PartitaIva == codiceFornito || x.CodiceFiscale == codiceFornito || x.Rid == codiceFornito || x.Cliente.Rid == codiceFornito,
|
|
includi: x => x.Include(y => y.Cliente)));
|
|
|
|
if (destinazione != null)
|
|
{
|
|
invito.ClienteId = destinazione.ClienteId;
|
|
invito.DestinazioneId = destinazione.Id;
|
|
invito.CodiceFornito = codiceFornito;
|
|
invito.RagioneSociale = destinazione.Cliente?.RagioneSociale ?? string.Empty;
|
|
await registrazione.SetDatiCliente();
|
|
}
|
|
|
|
showForm = true;
|
|
}
|
|
} |