- Comune/Provincia dropdown in Registrazione
This commit is contained in:
@ -38,7 +38,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4 mb-3">
|
<div class="col-4 mb-3">
|
||||||
<RadzenFormField Text="Provincia" Variant="Variant.Flat" Style="width: 100%;">
|
<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" />
|
Data="@provList" Size="ButtonSize.Small" />
|
||||||
</RadzenFormField>
|
</RadzenFormField>
|
||||||
<ValidationMessage For="@(() => iscrizione.Provincia)" />
|
<ValidationMessage For="@(() => iscrizione.Provincia)" />
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-4 mb-3">
|
<div class="col-4 mb-3">
|
||||||
<RadzenFormField Text="Comune" Variant="Variant.Flat" Style="width: 100%;">
|
<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" />
|
Data="@comuniList" Size="ButtonSize.Small" />
|
||||||
</RadzenFormField>
|
</RadzenFormField>
|
||||||
<ValidationMessage For="@(() => iscrizione.Comune)" />
|
<ValidationMessage For="@(() => iscrizione.Comune)" />
|
||||||
@ -160,7 +160,7 @@
|
|||||||
private IEnumerable<LookupViewModel<int>> ruoloList { get; set; }
|
private IEnumerable<LookupViewModel<int>> ruoloList { get; set; }
|
||||||
|
|
||||||
private List<ProvinciaViewModel> provList { 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 presaVisionePrivacy { get; set; }
|
||||||
private bool presaVisioneDatiPersonali { get; set; }
|
private bool presaVisioneDatiPersonali { get; set; }
|
||||||
@ -192,6 +192,7 @@
|
|||||||
DestinazioneId = iscrizione.DestinazioneId,
|
DestinazioneId = iscrizione.DestinazioneId,
|
||||||
TipologiaClienteId = iscrizione.TipologiaClienteId
|
TipologiaClienteId = iscrizione.TipologiaClienteId
|
||||||
};
|
};
|
||||||
|
|
||||||
if (invito.EventoId != Guid.Empty && iscrizione.DestinazioneId == Guid.Empty)
|
if (invito.EventoId != Guid.Empty && iscrizione.DestinazioneId == Guid.Empty)
|
||||||
{
|
{
|
||||||
_dialogService.Alert("Selezionare una destinazione valida.", "Attenzione");
|
_dialogService.Alert("Selezionare una destinazione valida.", "Attenzione");
|
||||||
@ -223,10 +224,10 @@
|
|||||||
destinazioniList = new List<DestinazioneViewModel>() { new DestinazioneViewModel() { RagioneSociale = "--Nessuna" } };
|
destinazioniList = new List<DestinazioneViewModel>() { new DestinazioneViewModel() { RagioneSociale = "--Nessuna" } };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task onProvinciaChanged(ChangeEventArgs args)
|
private async Task onProvinciaChanged(object args)
|
||||||
{
|
{
|
||||||
Guid parsed;
|
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);
|
var prov = await _managerService.ProvinciaIstatService.RicercaPer(x => x.Id == parsed);
|
||||||
|
|
||||||
if (prov == null)
|
if (prov == null)
|
||||||
@ -236,8 +237,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
iscrizione.Provincia = prov.Id;
|
iscrizione.Provincia = prov.Id;
|
||||||
|
iscrizione.Comune = null;
|
||||||
|
|
||||||
comuniList = (await _managerService.ComuneIstatService.RicercaQueryable(x => x.Provincia == prov.Sigla))
|
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")]
|
[Required(ErrorMessage = "La provincia è obbigatoria")]
|
||||||
public Guid Provincia { get; set; }
|
public Guid Provincia { get; set; }
|
||||||
[Required(ErrorMessage = "Il comune è obbigatorio")]
|
[Required(ErrorMessage = "Il comune è obbigatorio")]
|
||||||
public Guid Comune { get; set; }
|
public Guid? Comune { get; set; }
|
||||||
[Required(ErrorMessage = "Il CAP è obbigatorio")]
|
[Required(ErrorMessage = "Il CAP è obbigatorio")]
|
||||||
public string Cap { get; set; }
|
public string Cap { get; set; }
|
||||||
[Required(ErrorMessage = "La Ragione Sociale è obbigatoria")]
|
[Required(ErrorMessage = "La Ragione Sociale è obbigatoria")]
|
||||||
@ -59,6 +59,8 @@ public class IscrizioneEventoViewModel
|
|||||||
model.EsperienzaConDAC = EsperienzaConDAC;
|
model.EsperienzaConDAC = EsperienzaConDAC;
|
||||||
model.PartitaIva = PartitaIva;
|
model.PartitaIva = PartitaIva;
|
||||||
model.GiornoPresenza = GiornoPresenza.Value;
|
model.GiornoPresenza = GiornoPresenza.Value;
|
||||||
|
model.ComuneId = Comune.GetValueOrDefault();
|
||||||
|
model.ProvinciaId = Provincia;
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
@ -90,7 +92,7 @@ public class IscrizioneEventoViewModel
|
|||||||
Ruolo = model.Ruolo,
|
Ruolo = model.Ruolo,
|
||||||
RuoloInt = (int?)model.Ruolo,
|
RuoloInt = (int?)model.Ruolo,
|
||||||
PartitaIva = model.PartitaIva,
|
PartitaIva = model.PartitaIva,
|
||||||
GiornoPresenza = model.GiornoPresenza
|
GiornoPresenza = model.GiornoPresenza,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user