- Comune/Provincia dropdown in Registrazione
This commit is contained in:
@ -38,7 +38,7 @@
|
||||
<div class="row">
|
||||
<div class="col-4 mb-3">
|
||||
<RadzenFormField Text="Provincia" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown TValue="Guid" @onchange="(args => onProvinciaChanged(args))" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
|
||||
<RadzenDropDown TValue="Guid" @bind-bind-Value="@iscrizione.Provincia" Change="@(args => onProvinciaChanged(args))" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
|
||||
Data="@provList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Provincia)" />
|
||||
@ -51,7 +51,7 @@
|
||||
</div>
|
||||
<div class="col-4 mb-3">
|
||||
<RadzenFormField Text="Comune" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown TValue="Guid" @bind-Value="@iscrizione.Comune" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona il comune"
|
||||
<RadzenDropDown TValue="Guid?" @bind-Value="@iscrizione.Comune" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona il comune"
|
||||
Data="@comuniList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Comune)" />
|
||||
@ -158,9 +158,9 @@
|
||||
private IEnumerable<LookupViewModel<Guid>> tipologiaList { get; set; }
|
||||
private IEnumerable<string> esperienzaList { get; set; }
|
||||
private IEnumerable<LookupViewModel<int>> ruoloList { get; set; }
|
||||
|
||||
|
||||
private List<ProvinciaViewModel> provList { get; set; }
|
||||
private List<ComuneIstatExcelViewModel> comuniList { get; set; }
|
||||
private List<ComuneIstatViewModel> comuniList { get; set; }
|
||||
|
||||
private bool presaVisionePrivacy { get; set; }
|
||||
private bool presaVisioneDatiPersonali { get; set; }
|
||||
@ -192,6 +192,7 @@
|
||||
DestinazioneId = iscrizione.DestinazioneId,
|
||||
TipologiaClienteId = iscrizione.TipologiaClienteId
|
||||
};
|
||||
|
||||
if (invito.EventoId != Guid.Empty && iscrizione.DestinazioneId == Guid.Empty)
|
||||
{
|
||||
_dialogService.Alert("Selezionare una destinazione valida.", "Attenzione");
|
||||
@ -223,10 +224,10 @@
|
||||
destinazioniList = new List<DestinazioneViewModel>() { new DestinazioneViewModel() { RagioneSociale = "--Nessuna" } };
|
||||
}
|
||||
|
||||
private async Task onProvinciaChanged(ChangeEventArgs args)
|
||||
private async Task onProvinciaChanged(object args)
|
||||
{
|
||||
Guid parsed;
|
||||
var guidId = Guid.TryParse(args.Value?.ToString(), out parsed);
|
||||
var guidId = Guid.TryParse(args.ToString(), out parsed);
|
||||
var prov = await _managerService.ProvinciaIstatService.RicercaPer(x => x.Id == parsed);
|
||||
|
||||
if (prov == null)
|
||||
@ -234,10 +235,11 @@
|
||||
await _dialogService.Alert("La provincia indicata non è presente", "Errore", new ConfirmOptions() { OkButtonText = "Ok" });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
iscrizione.Provincia = prov.Id;
|
||||
iscrizione.Comune = null;
|
||||
|
||||
comuniList = (await _managerService.ComuneIstatService.RicercaQueryable(x => x.Provincia == prov.Sigla))
|
||||
.Select(x => (ComuneIstatExcelViewModel)x).ToList();
|
||||
.Select(x => (ComuneIstatViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
31
StandManager/Model/ComuneIstatViewModel.cs
Normal file
31
StandManager/Model/ComuneIstatViewModel.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using StandManager.Domain.Entita;
|
||||
|
||||
namespace StandManager.Model;
|
||||
|
||||
public class ComuneIstatViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Istat { get; set; }
|
||||
public string Comune { get; set; }
|
||||
public string Regione { get; set; }
|
||||
public string Provincia { get; set; }
|
||||
public string Prefisso { get; set; }
|
||||
public string CodFisco { get; set; }
|
||||
public string Info => $"{Comune}";
|
||||
|
||||
public static implicit operator ComuneIstatViewModel(ComuneIstat model)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: new ComuneIstatViewModel()
|
||||
{
|
||||
Id = model.Id,
|
||||
Comune = model.Comune,
|
||||
Istat = model.Istat,
|
||||
Regione = model.Regione,
|
||||
Provincia = model.Provincia,
|
||||
Prefisso = model.Prefisso,
|
||||
CodFisco = model.CodFisco
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -28,7 +28,7 @@ public class IscrizioneEventoViewModel
|
||||
[Required(ErrorMessage = "La provincia è obbigatoria")]
|
||||
public Guid Provincia { get; set; }
|
||||
[Required(ErrorMessage = "Il comune è obbigatorio")]
|
||||
public Guid Comune { get; set; }
|
||||
public Guid? Comune { get; set; }
|
||||
[Required(ErrorMessage = "Il CAP è obbigatorio")]
|
||||
public string Cap { get; set; }
|
||||
[Required(ErrorMessage = "La Ragione Sociale è obbigatoria")]
|
||||
@ -59,6 +59,8 @@ public class IscrizioneEventoViewModel
|
||||
model.EsperienzaConDAC = EsperienzaConDAC;
|
||||
model.PartitaIva = PartitaIva;
|
||||
model.GiornoPresenza = GiornoPresenza.Value;
|
||||
model.ComuneId = Comune.GetValueOrDefault();
|
||||
model.ProvinciaId = Provincia;
|
||||
|
||||
return model;
|
||||
}
|
||||
@ -90,7 +92,7 @@ public class IscrizioneEventoViewModel
|
||||
Ruolo = model.Ruolo,
|
||||
RuoloInt = (int?)model.Ruolo,
|
||||
PartitaIva = model.PartitaIva,
|
||||
GiornoPresenza = model.GiornoPresenza
|
||||
GiornoPresenza = model.GiornoPresenza,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user