Compare commits
9 Commits
1f3e6f66bf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 85d099e372 | |||
| b24dbc8fc3 | |||
| ef2c779f83 | |||
| 2e40d48a9a | |||
| 3f474c4d39 | |||
| 4ddf71f465 | |||
| 932299c98f | |||
| 2b3bab6acb | |||
| 6d06c04a57 |
6
.idea/.idea.StandManager/.idea/sqldialects.xml
generated
6
.idea/.idea.StandManager/.idea/sqldialects.xml
generated
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/.idea/.idea.StandManager/.idea/queries/Query.sql" dialect="TSQL" />
|
||||
</component>
|
||||
</project>
|
||||
@ -44,6 +44,14 @@ public class IscrizioneEvento : EntitaBase
|
||||
public RuoloTipo Ruolo { get; set; }
|
||||
public string? PartitaIva { get; set; }
|
||||
public DateTime GiornoPresenza { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Agente))]
|
||||
public Guid? AgenteId { get; set; }
|
||||
public Utente Agente { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Capoarea))]
|
||||
public Guid? CapoareaId { get; set; }
|
||||
public Utente Capoarea { get; set; }
|
||||
}
|
||||
|
||||
public enum RuoloTipo
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using StandManager.Domain.Entita.Base;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace StandManager.Domain.Entita;
|
||||
|
||||
@ -6,4 +7,10 @@ public class ProvinciaIstat : EntitaBase
|
||||
{
|
||||
public string Sigla { get; set; }
|
||||
public string Provincia { get; set; }
|
||||
|
||||
public bool CapoareaDaVerificare { get; set; }
|
||||
|
||||
[ForeignKey(nameof(Capoarea))]
|
||||
public Guid? CapoareaId { get; set; }
|
||||
public Utente Capoarea { get; set; }
|
||||
}
|
||||
@ -16,4 +16,5 @@ public class Ruolo : EntitaBase
|
||||
|
||||
[InverseProperty(nameof(Permission.Ruolo))]
|
||||
public virtual List<Permission> Permessi { get; set; }
|
||||
public virtual bool Default { get; set; }
|
||||
}
|
||||
|
||||
1316
StandManager.Infrastructure/Migrations/20260204162205_CapiareaAgentiInIscrizioneEvento.Designer.cs
generated
Normal file
1316
StandManager.Infrastructure/Migrations/20260204162205_CapiareaAgentiInIscrizioneEvento.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StandManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CapiareaAgentiInIscrizioneEvento : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "AgenteId",
|
||||
table: "IscrizioneEvento",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "CapoareaId",
|
||||
table: "IscrizioneEvento",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Utente_ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
column: "ProvinciaIstatId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_IscrizioneEvento_AgenteId",
|
||||
table: "IscrizioneEvento",
|
||||
column: "AgenteId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_IscrizioneEvento_CapoareaId",
|
||||
table: "IscrizioneEvento",
|
||||
column: "CapoareaId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_IscrizioneEvento_Utente_AgenteId",
|
||||
table: "IscrizioneEvento",
|
||||
column: "AgenteId",
|
||||
principalTable: "Utente",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_IscrizioneEvento_Utente_CapoareaId",
|
||||
table: "IscrizioneEvento",
|
||||
column: "CapoareaId",
|
||||
principalTable: "Utente",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Utente_Province_ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
column: "ProvinciaIstatId",
|
||||
principalTable: "Province",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_IscrizioneEvento_Utente_AgenteId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_IscrizioneEvento_Utente_CapoareaId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Utente_Province_ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Utente_ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_IscrizioneEvento_AgenteId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_IscrizioneEvento_CapoareaId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AgenteId",
|
||||
table: "IscrizioneEvento");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CapoareaId",
|
||||
table: "IscrizioneEvento");
|
||||
}
|
||||
}
|
||||
}
|
||||
1319
StandManager.Infrastructure/Migrations/20260205095709_CapoareaDaVerificareInProvincia.Designer.cs
generated
Normal file
1319
StandManager.Infrastructure/Migrations/20260205095709_CapoareaDaVerificareInProvincia.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StandManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CapoareaDaVerificareInProvincia : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "CapoareaDaVerificare",
|
||||
table: "Province",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CapoareaDaVerificare",
|
||||
table: "Province");
|
||||
}
|
||||
}
|
||||
}
|
||||
1314
StandManager.Infrastructure/Migrations/20260206070903_CapoareaSuProvIstat.Designer.cs
generated
Normal file
1314
StandManager.Infrastructure/Migrations/20260206070903_CapoareaSuProvIstat.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StandManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CapoareaSuProvIstat : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Utente_Province_ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Utente_ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ProvinciaIstatId",
|
||||
table: "Utente");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "CapoareaId",
|
||||
table: "Province",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Province_CapoareaId",
|
||||
table: "Province",
|
||||
column: "CapoareaId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Province_Utente_CapoareaId",
|
||||
table: "Province",
|
||||
column: "CapoareaId",
|
||||
principalTable: "Utente",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Province_Utente_CapoareaId",
|
||||
table: "Province");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Province_CapoareaId",
|
||||
table: "Province");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CapoareaId",
|
||||
table: "Province");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
type: "uniqueidentifier",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Utente_ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
column: "ProvinciaIstatId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Utente_Province_ProvinciaIstatId",
|
||||
table: "Utente",
|
||||
column: "ProvinciaIstatId",
|
||||
principalTable: "Province",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
1317
StandManager.Infrastructure/Migrations/20260206201218_RuoloDiDefault.Designer.cs
generated
Normal file
1317
StandManager.Infrastructure/Migrations/20260206201218_RuoloDiDefault.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace StandManager.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RuoloDiDefault : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Default",
|
||||
table: "Ruolo",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Default",
|
||||
table: "Ruolo");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -407,9 +407,15 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("AgenteId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Cap")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid?>("CapoareaId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid?>("ClienteId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
@ -487,6 +493,10 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AgenteId");
|
||||
|
||||
b.HasIndex("CapoareaId");
|
||||
|
||||
b.HasIndex("ClienteId");
|
||||
|
||||
b.HasIndex("ComuneId");
|
||||
@ -608,6 +618,12 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("CapoareaDaVerificare")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid?>("CapoareaId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DataCreazione")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@ -633,6 +649,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CapoareaId");
|
||||
|
||||
b.HasIndex("IdUtenteCreazione");
|
||||
|
||||
b.HasIndex("IdUtenteModifica");
|
||||
@ -710,6 +728,9 @@ namespace StandManager.Infrastructure.Migrations
|
||||
b.Property<DateTime?>("DataModifica")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("Default")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("Eliminato")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@ -1029,6 +1050,14 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
modelBuilder.Entity("StandManager.Domain.Entita.IscrizioneEvento", b =>
|
||||
{
|
||||
b.HasOne("StandManager.Domain.Entita.Utente", "Agente")
|
||||
.WithMany()
|
||||
.HasForeignKey("AgenteId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.Utente", "Capoarea")
|
||||
.WithMany()
|
||||
.HasForeignKey("CapoareaId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.Cliente", "Cliente")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClienteId");
|
||||
@ -1065,6 +1094,10 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("TipologiaClienteId");
|
||||
|
||||
b.Navigation("Agente");
|
||||
|
||||
b.Navigation("Capoarea");
|
||||
|
||||
b.Navigation("Cliente");
|
||||
|
||||
b.Navigation("Comune");
|
||||
@ -1130,6 +1163,10 @@ namespace StandManager.Infrastructure.Migrations
|
||||
|
||||
modelBuilder.Entity("StandManager.Domain.Entita.ProvinciaIstat", b =>
|
||||
{
|
||||
b.HasOne("StandManager.Domain.Entita.Utente", "Capoarea")
|
||||
.WithMany()
|
||||
.HasForeignKey("CapoareaId");
|
||||
|
||||
b.HasOne("StandManager.Domain.Entita.Utente", "UtenteCreazione")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUtenteCreazione");
|
||||
@ -1138,6 +1175,8 @@ namespace StandManager.Infrastructure.Migrations
|
||||
.WithMany()
|
||||
.HasForeignKey("IdUtenteModifica");
|
||||
|
||||
b.Navigation("Capoarea");
|
||||
|
||||
b.Navigation("UtenteCreazione");
|
||||
|
||||
b.Navigation("UtenteModifica");
|
||||
|
||||
@ -20,8 +20,8 @@ public class IscrizioneEventoService : TService<IscrizioneEvento>, IIscrizioneEv
|
||||
|
||||
entita.DataCreazione = isNuovaEntita ? DateTime.Now : entita.DataCreazione;
|
||||
entita.DataModifica = isNuovaEntita == false ? DateTime.Now : null;
|
||||
entita.IdUtenteCreazione = isNuovaEntita ? null : entita.IdUtenteCreazione;
|
||||
entita.IdUtenteModifica = isNuovaEntita == false ? null : null;
|
||||
entita.IdUtenteCreazione = entita.IdUtenteCreazione;
|
||||
entita.IdUtenteModifica = isNuovaEntita == false ? entita.IdUtenteModifica : null;
|
||||
|
||||
if (isNuovaEntita)
|
||||
await _unitOfWork.GetRepository<IscrizioneEvento>().Put(entita);
|
||||
|
||||
@ -47,10 +47,27 @@
|
||||
<!-- BEGIN NAVBAR MENU -->
|
||||
<ul class="navbar-nav">
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management" destination="/management" iconName="fa-home" title="Home"/>
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Utenti" destination="/management/Utenti" iconName="fa-user" title="Utenti"/>
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Clienti" destination="/management/Clienti" iconName="fa-address-card" title="Clienti"/>
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Eventi" destination="/management/Eventi" iconName="fa-calendar" title="Eventi"/>
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Ruoli" destination="/management/Ruoli" iconName="fa-lock" title="Ruoli"/>
|
||||
|
||||
@if (canSeeUser)
|
||||
{
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Utenti" destination="/management/Utenti" iconName="fa-user" title="Utenti"/>
|
||||
}
|
||||
@if (canSeeClienti)
|
||||
{
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Clienti" destination="/management/Clienti" iconName="fa-address-card" title="Clienti"/>
|
||||
}
|
||||
@if (canSeeEventi)
|
||||
{
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Eventi" destination="/management/Eventi" iconName="fa-calendar" title="Eventi"/>
|
||||
}
|
||||
@if (canSeeRuoli)
|
||||
{
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Ruoli" destination="/management/Ruoli" iconName="fa-lock" title="Ruoli"/>
|
||||
}
|
||||
@if (canSeeIscrizioni)
|
||||
{
|
||||
<NavigationItem currentUrl="@currentUrl" requiredUrl="/management/Iscrizioni" destination="/management/Iscrizioni" iconName="fa-lock" title="Iscrizioni"/>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -67,10 +84,23 @@
|
||||
public HttpContext? httpContext { get; set; }
|
||||
|
||||
private string currentUrl = string.Empty;
|
||||
|
||||
private MembershipUtilsPermission _permission { get; set; }
|
||||
|
||||
private bool canSeeUser = false;
|
||||
private bool canSeeClienti = false;
|
||||
private bool canSeeEventi = false;
|
||||
private bool canSeeRuoli = false;
|
||||
private bool canSeeIscrizioni = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
base.OnInitializedAsync();
|
||||
currentUrl = NavManager.ToBaseRelativePath(NavManager.Uri);
|
||||
_permission = new MembershipUtilsPermission(_managerService, _auth);
|
||||
canSeeUser = await _permission.CheckPermission("InsertUser");
|
||||
canSeeClienti = await _permission.CheckPermission("InsertCustomer");
|
||||
canSeeEventi = await _permission.CheckPermission("InsertEvent");
|
||||
canSeeRuoli = await _permission.CheckPermission("InsertRole");
|
||||
canSeeIscrizioni = await _permission.CheckPermission("SeeRegistration");
|
||||
}
|
||||
}
|
||||
@ -48,6 +48,9 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
public string? ReturnUrl { get; set; }
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
private LoginModel? model { get; set; }
|
||||
|
||||
@ -56,7 +59,10 @@
|
||||
[CascadingParameter]
|
||||
public HttpContext? httpContext { get; set; }
|
||||
|
||||
protected override void OnInitialized() => model ??= new();
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
model ??= new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestisce il login: controlla le credenziali, crea i claim dell’utente,
|
||||
@ -87,6 +93,13 @@
|
||||
var identity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
var principal = new ClaimsPrincipal(identity);
|
||||
await httpContext.SignInAsync(principal);
|
||||
_navManager.NavigateTo("/management");
|
||||
if (!string.IsNullOrWhiteSpace(ReturnUrl))
|
||||
{
|
||||
_navManager.NavigateTo(ReturnUrl, forceLoad: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_navManager.NavigateTo("/management");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,20 @@
|
||||
@using StandManager.Model
|
||||
@using Microsoft.EntityFrameworkCore;
|
||||
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<EditForm Model="iscrizione" OnValidSubmit="onIscrizioneSave" FormName="iscrizioneForm">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
<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" @bind-Value="@iscrizione.PartitaIva" Change="@(args => onCodiceFornitoChanged(args))" />
|
||||
</RadzenFormField>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 mb-3">
|
||||
<RadzenFormField Text="Nome" Variant="Variant.Flat" Style="width: 100%;">
|
||||
@ -38,23 +48,22 @@
|
||||
<div class="row">
|
||||
<div class="col-4 mb-3">
|
||||
<RadzenFormField Text="Provincia" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown TValue="Guid ?" @bind-bind-Value="@iscrizione.Provincia" Change="@(args => onProvinciaChanged(args))" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona la provincia"
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
TValue="Guid ?" @bind-Value="@iscrizione.ProvinciaId" 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)" />
|
||||
</div>
|
||||
<div class="col-4 mb-3">
|
||||
<RadzenFormField Text="CAP" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenTextBox Style="width: 100%" aria-label="Cap" @bind-Value="@iscrizione.Cap" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Cap)" />
|
||||
</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 FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
TValue="Guid ?" @bind-Value="@iscrizione.ComuneId" Style="width: 100%" TextProperty="Info" ValueProperty="Id" Placeholder="Seleziona il comune"
|
||||
Data="@comuniList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
<ValidationMessage For="@(() => iscrizione.Comune)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -102,16 +111,17 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@if (hasCliente)
|
||||
@if (cliente)
|
||||
{
|
||||
<div class="col-6 mb-3">
|
||||
<RadzenFormField Text="Destinazione" Variant="Variant.Flat" Style="width: 100%;">
|
||||
<RadzenDropDown @bind-Value="@iscrizione.DestinazioneId" TValue="Guid?" Style="width: 100%" ValueProperty="Id" TextProperty="Info" Placeholder="Seleziona la destinazione"
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
@bind-Value="@iscrizione.DestinazioneId" TValue="Guid ?" Style="width: 100%" ValueProperty="Id" TextProperty="Info" Placeholder="Seleziona la destinazione"
|
||||
Data="@destinazioniList" Size="ButtonSize.Small" />
|
||||
</RadzenFormField>
|
||||
</div>
|
||||
}
|
||||
<div class=@(hasCliente ? "col-6 mb-3" : "col-12 mb-3")>
|
||||
<div class=@(cliente ? "col-6 mb-3" : "col-12 mb-3")>
|
||||
<RadzenFormField Text="Note" Variant="Variant.Flat" Style="width: 100%; border: none !important; box-shadow: none !important; background-color: transparent !important;">
|
||||
<RadzenTextArea @bind-Value="@iscrizione.Note" Style="width: 100%;" Rows="1" />
|
||||
</RadzenFormField>
|
||||
@ -131,8 +141,7 @@
|
||||
<div class="d-flex align-items-center">
|
||||
<RadzenCheckBox class="form-check-input" @bind-Value="presaVisioneDatiPersonali" Name="presaVisioneDatiPersonali" TValue="bool" />
|
||||
<label class="rz-ms-2" for="presaVisioneDatiPersonali" style="cursor: pointer;">
|
||||
Autorizzazione al trattamento dati*<br/>
|
||||
I dati forniti saranno utilizzati esclusivamente per l’invio del biglietto. (<a href="https://www.gruppodac.eu/tutela-e-privacy/" target="_blank">leggi</a>)
|
||||
Autorizzazione al trattamento dati*. (<a href="https://www.gruppodac.eu/tutela-e-privacy/" target="_blank">leggi</a>)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -150,7 +159,8 @@
|
||||
|
||||
@code {
|
||||
[Parameter] public InvitoEventoViewModel invito { get; set; }
|
||||
[Parameter] public bool hasCliente { get; set; }
|
||||
[Parameter] public string ReturnUrl { get; set; }
|
||||
[Parameter] public bool cliente { get; set; }
|
||||
|
||||
[Parameter] public Func<object?, IscrizioneEvento, Task>? OnSubmitCompletedAsync { get; set; }
|
||||
|
||||
@ -190,37 +200,61 @@
|
||||
? await _managerService.EventoService.RicercaPer(x => x.Id == invito.EventoId)
|
||||
: (await _managerService.EventoService.RicercaQueryable(x => x.DataA > DateTime.Now,
|
||||
ordinamento: y => y.OrderBy(z => z.DataA))).FirstOrDefault();
|
||||
|
||||
inizioEvento = evento?.DataDa ?? DateTime.Now.AddDays(-7);
|
||||
fineEvento = evento?.DataA ?? DateTime.Now.AddDays(7);
|
||||
|
||||
if (!cliente)
|
||||
NoCliente();
|
||||
else
|
||||
GiaCliente();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Funzione di salvataggio, mappa i dati e aggiunge gli ids per le FK
|
||||
/// </summary>
|
||||
private async Task onIscrizioneSave()
|
||||
{
|
||||
var model = new IscrizioneEvento()
|
||||
try
|
||||
{
|
||||
EventoId = invito.EventoId,
|
||||
InvitoEventoId = invito.Id,
|
||||
ClienteId = invito.ClienteId,
|
||||
DestinazioneId = iscrizione.DestinazioneId,
|
||||
TipologiaClienteId = iscrizione.TipologiaClienteId
|
||||
};
|
||||
var userId = await MembershipUtils.GetUserId(_auth);
|
||||
|
||||
/*if (invito.EventoId != Guid.Empty && iscrizione.DestinazioneId == Guid.Empty)
|
||||
{
|
||||
_dialogService.Alert("Selezionare una destinazione valida.", "Attenzione");
|
||||
return;
|
||||
}*/
|
||||
if (!cliente)
|
||||
{
|
||||
if (iscrizione.ProvinciaId.GetValueOrDefault() == Guid.Empty) throw new Exception("La provincia è obbligatoria");
|
||||
if (string.IsNullOrEmpty(iscrizione.Cap)) throw new Exception("Il CAP è obbligatorio");
|
||||
if (iscrizione.ComuneId.GetValueOrDefault() == Guid.Empty) throw new Exception("Il comune è obbligatoria");
|
||||
}
|
||||
|
||||
var model = new IscrizioneEvento()
|
||||
{
|
||||
EventoId = invito.EventoId,
|
||||
InvitoEventoId = invito.Id,
|
||||
ClienteId = invito.ClienteId,
|
||||
DestinazioneId = iscrizione.DestinazioneId,
|
||||
TipologiaClienteId = iscrizione.TipologiaClienteId,
|
||||
//IdUtenteCreazione = userId != Guid.Empty ? userId : null
|
||||
};
|
||||
|
||||
model = iscrizione.Map(model);
|
||||
model = iscrizione.Map(model);
|
||||
|
||||
var saved = await _managerService.IscrizioneEventoService.Salva(model);
|
||||
if (OnSubmitCompletedAsync is not null)
|
||||
{
|
||||
await OnSubmitCompletedAsync(this, saved);
|
||||
var saved = await _managerService.IscrizioneEventoService.Salva(model);
|
||||
if (OnSubmitCompletedAsync is not null)
|
||||
{
|
||||
await OnSubmitCompletedAsync(this, saved);
|
||||
}
|
||||
var returnUrl = Uri.EscapeDataString(ReturnUrl ?? "/");
|
||||
_navManager.NavigateTo($"/Grazie?ReturnUrl={returnUrl}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _dialogService.Alert(ex.Message, "Errore");
|
||||
}
|
||||
_navManager.NavigateTo($"/Grazie");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposta i dati cliente al cambio della Partita IVA
|
||||
/// </summary>
|
||||
public async Task SetDatiCliente()
|
||||
{
|
||||
iscrizione.DestinazioneId = invito.DestinazioneId;
|
||||
@ -238,13 +272,17 @@
|
||||
{
|
||||
destinazioniList = new List<DestinazioneViewModel>() { new() { RagioneSociale = "--Nessuna" } };
|
||||
iscrizione.EsperienzaConDAC = "No";
|
||||
|
||||
}
|
||||
|
||||
public void HasCliente()
|
||||
public void GiaCliente()
|
||||
{
|
||||
iscrizione.EsperienzaConDAC = "Si";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna i comuni in base alla provincia selezionata
|
||||
/// </summary>
|
||||
private async Task onProvinciaChanged(object args)
|
||||
{
|
||||
Guid parsed;
|
||||
@ -257,10 +295,40 @@
|
||||
return;
|
||||
}
|
||||
|
||||
iscrizione.Provincia = prov.Id;
|
||||
iscrizione.Comune = null;
|
||||
iscrizione.ProvinciaId = prov.Id;
|
||||
iscrizione.ComuneId = null;
|
||||
|
||||
comuniList = (await _managerService.ComuneIstatService.RicercaQueryable(x => x.Provincia == prov.Sigla))
|
||||
.Select(x => (ComuneIstatViewModel)x).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serve per aggiornare i dati del form se ci troviamo nella situazione in cui il cliente è salvato a db
|
||||
/// Attiva la compilazione solo se siamo nel form e da UI chi compila ci dice che è già stato cliente
|
||||
/// </summary>
|
||||
private async Task onCodiceFornitoChanged(string text)
|
||||
{
|
||||
if (!cliente) return;
|
||||
|
||||
var 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 || string.IsNullOrEmpty(text))
|
||||
{
|
||||
var msg = new NotificationMessage { Severity = NotificationSeverity.Warning, Summary = "Non trovato", Detail = "Non è stato possibile trovare il Codice Cliente o la Partita IVA indicati.", Duration = 4000 };
|
||||
_notificationService.Notify(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
invito.ClienteId = destinazione.ClienteId;
|
||||
invito.DestinazioneId = destinazione.Id;
|
||||
invito.CodiceFornito = codiceFornito;
|
||||
invito.RagioneSociale = destinazione.Cliente?.RagioneSociale ?? string.Empty;
|
||||
await SetDatiCliente();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,8 +59,18 @@
|
||||
</style>
|
||||
|
||||
@code {
|
||||
[SupplyParameterFromQuery]
|
||||
public string? ReturnUrl { get; set; }
|
||||
|
||||
private void goToHome()
|
||||
{
|
||||
_navManager.NavigateTo("/registrazione");
|
||||
if (!string.IsNullOrWhiteSpace(ReturnUrl) && ReturnUrl.StartsWith("/"))
|
||||
{
|
||||
_navManager.NavigateTo(ReturnUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
_navManager.NavigateTo("/registrazione");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -21,15 +21,15 @@
|
||||
</div>
|
||||
<div class="col-auto ms-auto">
|
||||
<div class="btn-list">
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUpload ChooseText="Importa da excel" />
|
||||
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUploadComuni ChooseText="Importa comuni da excel" />
|
||||
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUploadProvince ChooseText="Importa province da excel" />
|
||||
|
||||
<a href="/management/Clienti/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo cliente
|
||||
</a>
|
||||
@if (canAdd)
|
||||
{
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUpload ChooseText="Importa da excel"/>
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUploadComuni ChooseText="Importa comuni da excel"/>
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUploadProvince ChooseText="Importa province da excel"/>
|
||||
<a href="/management/Clienti/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo cliente
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
@ -46,8 +46,8 @@
|
||||
|
||||
<RadzenDataGridColumn Context="cliente" Filterable="false" Sortable="false" TextAlign="TextAlign.Right" Width="250px">
|
||||
<Template Context="cliente">
|
||||
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(cliente))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(cliente))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Icon="edit" Visible="canEdit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(cliente))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Icon="delete" Visible="canDelete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(cliente))" @onclick:stopPropagation="true" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
</Columns>
|
||||
@ -64,6 +64,10 @@
|
||||
List<Cliente> clienti;
|
||||
RadzenDataGrid<Cliente> clientiGrid;
|
||||
|
||||
private bool canAdd = false;
|
||||
private bool canEdit = false;
|
||||
private bool canDelete = false;
|
||||
|
||||
/// <summary>
|
||||
/// Carica l’elenco dei clienti non eliminati, includendo l’agente,
|
||||
/// e prepara i dati per la visualizzazione in pagina.
|
||||
@ -77,6 +81,10 @@
|
||||
includi: x => x.Include(y => y.Agente).Include(y => y.Capoarea),
|
||||
ordinamento: x => x.OrderBy(y => y.RagioneSociale)))
|
||||
.ToList();
|
||||
var permissionUtils = new MembershipUtilsPermission(_managerService, _auth);
|
||||
canAdd = await permissionUtils.CheckPermission("InsertUser");
|
||||
canEdit = await permissionUtils.CheckPermission("EditCustomer");
|
||||
canDelete = await permissionUtils.CheckPermission("DeleteCustomer");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -84,6 +92,8 @@
|
||||
/// </summary>
|
||||
private async Task EditRow(ClienteViewModel cliente)
|
||||
{
|
||||
if (!canEdit)
|
||||
return;
|
||||
_navManager.NavigateTo($"/management/Clienti/Modifica/{cliente.Id}");
|
||||
}
|
||||
|
||||
@ -93,6 +103,9 @@
|
||||
/// </summary>
|
||||
private async Task DeleteRow(ClienteViewModel cliente)
|
||||
{
|
||||
|
||||
if (!canDelete)
|
||||
return;
|
||||
var ok = await _dialogService.Confirm($"Vuoi davvero eliminare il cliente {cliente.RagioneSociale}?", "Conferma eliminazione", new ConfirmOptions { OkButtonText = "Sì", CancelButtonText = "No", Width = "400px" });
|
||||
|
||||
if (ok == true)
|
||||
@ -105,6 +118,8 @@
|
||||
|
||||
private async Task onUpload(UploadChangeEventArgs args)
|
||||
{
|
||||
if(!canAdd)
|
||||
return;
|
||||
var file = args.Files.FirstOrDefault();
|
||||
if (file == null ||
|
||||
!file.Name.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||
@ -126,6 +141,8 @@
|
||||
|
||||
private async Task onUploadComuni(UploadChangeEventArgs args)
|
||||
{
|
||||
if(!canAdd)
|
||||
return;
|
||||
var file = args.Files.FirstOrDefault();
|
||||
if (file == null ||
|
||||
!file.Name.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||
@ -147,6 +164,8 @@
|
||||
|
||||
private async Task onUploadProvince(UploadChangeEventArgs args)
|
||||
{
|
||||
if(!canAdd)
|
||||
return;
|
||||
var file = args.Files.FirstOrDefault();
|
||||
if (file == null ||
|
||||
!file.Name.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
@ -84,12 +84,14 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Agente</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid ?" @bind-Value=@cliente.AgenteId Data=@agenti TextProperty="Info" ValueProperty="Id" Name="agenteDrop" Disabled="@(!(cliente.CapoareaId == idClaim) && !isAdmin)" />
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Capoarea</RadzenText>
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
Style="width: 100%" TValue="Guid ?" @bind-Value=@cliente.CapoareaId Data=@capiarea TextProperty="Info" ValueProperty="Id" Name="capoareaDrop" Disabled="!isAdmin" Change="(x => OnCapoareaChange(x))" />
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Capoarea</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid ?" @bind-Value=@cliente.CapoareaId Data=@capiarea TextProperty="Info" ValueProperty="Id" Name="capoareaDrop" Disabled="!isAdmin" Change="(x => OnCapoareaChange(x))" />
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Agente</RadzenText>
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
Style="width: 100%" TValue="Guid ?" @bind-Value=@cliente.AgenteId Data=@agenti TextProperty="Info" ValueProperty="Id" Name="agenteDrop" Disabled="@(!(cliente.CapoareaId == idClaim) && !isAdmin)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -196,7 +198,7 @@
|
||||
var idRuolo = await MembershipUtils.GetRoleId(auth);
|
||||
var ruolo = await _managerService.RuoloService.RicercaPer(
|
||||
x => x.Id == idRuolo && x.Permessi.Any(y => y.Feature.Type == FeatureType.Capoarea || y.Feature.Type == FeatureType.AdminGlobal),
|
||||
includi:x => x.Include(y => y.Permessi).ThenInclude(z => z.Feature));
|
||||
includi: x => x.Include(y => y.Permessi).ThenInclude(z => z.Feature));
|
||||
|
||||
isAdmin = ruolo?.Permessi.Where(x => x.Eliminato == false)?.Any(x => x.Feature.Type == FeatureType.AdminGlobal) ?? false;
|
||||
|
||||
|
||||
@ -21,9 +21,12 @@
|
||||
</div>
|
||||
<div class="col-auto ms-auto">
|
||||
<div class="btn-list">
|
||||
<a href="/management/Eventi/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo evento
|
||||
</a>
|
||||
@if (canAdd)
|
||||
{
|
||||
<a href="/management/Eventi/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo evento
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
@ -39,9 +42,9 @@
|
||||
|
||||
<RadzenDataGridColumn Context="evento" Filterable="false" Sortable="false" TextAlign="TextAlign.Right" Width="250px">
|
||||
<Template Context="evento">
|
||||
<RadzenButton Icon="calendar_clock" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => SendInvitation(evento))" @onclick:stopPropagation="true" MouseEnter="@(args => ShowTooltip(args, new TooltipOptions() { Text = "Invia invito" }))" />
|
||||
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(evento))" @onclick:stopPropagation="true" MouseEnter="@(args => ShowTooltip(args, new TooltipOptions() { Text = "Modifica evento" }))" />
|
||||
<RadzenButton Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(evento))" @onclick:stopPropagation="true" MouseEnter="@(args => ShowTooltip(args, new TooltipOptions() { Text = "Rimuovi evento" }))" />
|
||||
<RadzenButton Visible="canEdit" Icon="calendar_clock" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => SendInvitation(evento))" @onclick:stopPropagation="true" MouseEnter="@(args => ShowTooltip(args, new TooltipOptions() { Text = "Invia invito" }))" />
|
||||
<RadzenButton Visible="canEdit" Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(evento))" @onclick:stopPropagation="true" MouseEnter="@(args => ShowTooltip(args, new TooltipOptions() { Text = "Modifica evento" }))" />
|
||||
<RadzenButton Visible="canDelete" Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(evento))" @onclick:stopPropagation="true" MouseEnter="@(args => ShowTooltip(args, new TooltipOptions() { Text = "Rimuovi evento" }))" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
</Columns>
|
||||
@ -58,20 +61,32 @@
|
||||
List<EventoViewModel> eventi;
|
||||
RadzenDataGrid<EventoViewModel> eventiGrid;
|
||||
|
||||
private bool canAdd = false;
|
||||
private bool canEdit = false;
|
||||
private bool canDelete = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
eventi = (await _managerService.EventoService.RicercaQueryable(x => x.Eliminato == false)).Select(x => (EventoViewModel)x).ToList();
|
||||
var permissionUtils = new MembershipUtilsPermission(_managerService, _auth);
|
||||
canAdd = await permissionUtils.CheckPermission("InsertEvent");
|
||||
canEdit = await permissionUtils.CheckPermission("EditEvent");
|
||||
canDelete = await permissionUtils.CheckPermission("DeleteEvent");
|
||||
}
|
||||
|
||||
private async Task EditRow(EventoViewModel evento)
|
||||
{
|
||||
if(!canEdit)
|
||||
return;
|
||||
_navManager.NavigateTo($"/management/Eventi/Modifica/{evento.Id}");
|
||||
}
|
||||
|
||||
private async Task DeleteRow(EventoViewModel evento)
|
||||
{
|
||||
if(!canDelete)
|
||||
return;
|
||||
var ok = await _dialogService.Confirm($"Vuoi davvero eliminare l'evento {evento.Titolo}?", "Conferma eliminazione", new ConfirmOptions { OkButtonText = "Sì", CancelButtonText = "No", Width = "400px" });
|
||||
|
||||
if (ok == true)
|
||||
|
||||
86
StandManager/Components/Pages/Management/Iscrizioni.razor
Normal file
86
StandManager/Components/Pages/Management/Iscrizioni.razor
Normal file
@ -0,0 +1,86 @@
|
||||
@page "/management/Iscrizioni"
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using StandManager.Model
|
||||
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@inject AuthenticationStateProvider auth
|
||||
|
||||
<PageTitle>Iscrizioni</PageTitle>
|
||||
|
||||
<div class="page-wrapper">
|
||||
<!-- BEGIN PAGE BODY -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="row row-cards">
|
||||
<div class="col">
|
||||
<!-- Page pre-title -->
|
||||
<div class="page-pretitle">Overview</div>
|
||||
<h2 class="page-title">Iscrizioni</h2>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="table-responsive">
|
||||
<RadzenDataGrid @ref="iscrizioniGrid" AllowFiltering="true" AllowColumnResize="true" AllowAlternatingRows="false" FilterMode="FilterMode.CheckBoxList" AllowSorting="true" PageSize="25"
|
||||
AllowPaging="true" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" RowRender="@(RowRender)"
|
||||
Data="@iscrizioni" LogicalFilterOperator="LogicalFilterOperator.Or" SelectionMode="DataGridSelectionMode.Single">
|
||||
<Columns>
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.RagioneSociale)" Title="Ragione sociale" Width="250px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.PartitaIva)" Title="Partita IVA" Width="200px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.GiornoPresenza)" Title="Giorno presenza" Width="150px" FormatString="{0:dd/MM/yyyy}" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.CapoareaInfo)" Title="Capoarea" Width="200px" />
|
||||
<RadzenDataGridColumn Property="@nameof(IscrizioneEventoViewModel.AgenteInfo)" Title="Agente" Width="200px" />
|
||||
|
||||
<RadzenDataGridColumn Context="iscrizioni" Filterable="false" Sortable="false" TextAlign="TextAlign.Right" Width="250px">
|
||||
<Template Context="iscrizioni">
|
||||
<RadzenButton Visible="canEdit" Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(iscrizioni))" @onclick:stopPropagation="true" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
</Columns>
|
||||
</RadzenDataGrid>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
List<IscrizioneEventoViewModel> iscrizioni;
|
||||
RadzenDataGrid<IscrizioneEventoViewModel> iscrizioniGrid;
|
||||
|
||||
|
||||
private bool canSee = false;
|
||||
private bool canEdit = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
|
||||
iscrizioni = (await _managerService.IscrizioneEventoService.RicercaQueryable(
|
||||
x => x.Eliminato == false,
|
||||
includi:x => x.Include(x => x.Provincia).Include(x => x.Comune).Include(y => y.Cliente)
|
||||
.Include(y => y.Evento).Include(y => y.InvitoEvento).Include(y => y.Agente).Include(y => y.Capoarea),
|
||||
ordinamento: x => x.OrderByDescending(y => y.DataCreazione)))
|
||||
.Select(x => (IscrizioneEventoViewModel)x).ToList();
|
||||
|
||||
var permissionUtils = new MembershipUtilsPermission(_managerService, _auth);
|
||||
canSee = await permissionUtils.CheckPermission("SeeRegistration");
|
||||
canEdit = await permissionUtils.CheckPermission("EditRegistration");
|
||||
if (!canSee)
|
||||
_navManager.NavigateTo("/management");
|
||||
}
|
||||
|
||||
private void RowRender(RowRenderEventArgs<IscrizioneEventoViewModel> args)
|
||||
{
|
||||
if (args.Data.Provincia?.CapoareaDaVerificare == true && (args.Data.CapoareaId.GetValueOrDefault() == Guid.Empty))
|
||||
args.Attributes.Add("style", "background-color: var(--tblr-red-lt);");
|
||||
}
|
||||
|
||||
private async Task EditRow(IscrizioneEventoViewModel iscrizioneEvento)
|
||||
{
|
||||
_navManager.NavigateTo($"/management/Iscrizioni/Modifica/{iscrizioneEvento.Id}");
|
||||
}
|
||||
}
|
||||
257
StandManager/Components/Pages/Management/Iscrizioni_Edit.razor
Normal file
257
StandManager/Components/Pages/Management/Iscrizioni_Edit.razor
Normal file
@ -0,0 +1,257 @@
|
||||
@attribute [Authorize]
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@page "/management/Iscrizioni/Modifica/{IscrizioneId:guid}"
|
||||
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using StandManager.Model
|
||||
|
||||
@inject AuthenticationStateProvider auth
|
||||
|
||||
<PageTitle>@pageTitle</PageTitle>
|
||||
|
||||
<div class="page-wrapper">
|
||||
<!-- BEGIN PAGE HEADER -->
|
||||
<div class="page-header d-print-none" aria-label="Page header">
|
||||
<div class="container-xl">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col">
|
||||
<h2 class="page-title">@pageTitle</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END PAGE HEADER -->
|
||||
<!-- BEGIN PAGE BODY -->
|
||||
<div class="page-body">
|
||||
<div class="container-xl">
|
||||
<div class="row row-cards">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Anagrafica
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-5">
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Nome</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Nome" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Cognome</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Cognome" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Email</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Email" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Numero di Telefono</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.NumeroTelefono" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Provincia</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.ProvinciaInfo" />
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">CAP</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Cap" />
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Comune</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.ComuneInfo" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ragione Sociale</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.RagioneSociale" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Partita Iva</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.PartitaIva" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Tipologia Cliente</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.TipologiaClienteInfo" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ha già avuto esperienza con DAC?</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.EsperienzaConDAC" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Destinazione</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.DestinazioneInfo" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Note</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.Note" />
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ruolo</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.RuoloInfo" />
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Giorno presenza</RadzenText>
|
||||
<RadzenLabel Style="width: 100%" aria-label="NumeroTelefono" Text="@iscrizione.GiornoPresenzaInfo" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Capoarea</RadzenText>
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
Style="width: 100%" TValue="Guid ?" @bind-Value=@iscrizione.CapoareaId Data=@capiarea TextProperty="Info" ValueProperty="Id" Name="capoareaDrop" Change="(x => OnCapoareaChange(x))" />
|
||||
<RadzenAlert AlertStyle="AlertStyle.Danger" ShowIcon="false" Variant="Variant.Flat" Shade="Shade.Lighter" Visible="capoareaDaConfermare" AllowClose="false">
|
||||
Capoarea da confermare
|
||||
</RadzenAlert>
|
||||
</div>
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Agente</RadzenText>
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
Style="width: 100%" TValue="Guid ?" @bind-Value=@iscrizione.AgenteId Data=@agenti TextProperty="Info" ValueProperty="Id" Name="agenteDrop" Disabled="@(agenti.Count() == 0)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-3 mb-3">
|
||||
<button type="button" class="btn btn-default w-100" @onclick="backToHome">
|
||||
Annulla
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<button type="submit" class="btn btn-primary w-100" @onclick="onIscrizioneSave">
|
||||
Salva
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public Guid? IscrizioneId { get; set; }
|
||||
public Guid idClaim { get; set; }
|
||||
|
||||
[SupplyParameterFromForm]
|
||||
private IscrizioneEventoViewModel iscrizione { get; set; } = new();
|
||||
|
||||
private IEnumerable<UtenteViewModel> agenti { get; set; } = new List<UtenteViewModel>();
|
||||
private IEnumerable<UtenteViewModel> capiarea { get; set; } = new List<UtenteViewModel>();
|
||||
|
||||
private string pageTitle => $"Iscrizione {iscrizione?.RagioneSociale}";
|
||||
private bool capoareaDaConfermare { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Creo tutte le drop necessarie per il form
|
||||
/// Controllo se l'utente è admin per permettergli la modifica dei capiarea
|
||||
/// Controllo se l'utente è capoarea o admin per permettergli la modifica degli agenti
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
idClaim = await MembershipUtils.GetUserId(auth);
|
||||
|
||||
iscrizione = await _managerService.IscrizioneEventoService.RicercaPer(
|
||||
x => x.Id == IscrizioneId,
|
||||
includi: x => x
|
||||
.Include(x => x.Comune)
|
||||
.Include(x => x.Provincia)
|
||||
.Include(y => y.Cliente)
|
||||
.Include(y => y.Evento)
|
||||
.Include(y => y.InvitoEvento));
|
||||
|
||||
capiarea = (await _managerService.UtenteService.RicercaQueryable(
|
||||
x => x.Eliminato == false && x.IsCapoarea,
|
||||
ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
|
||||
if (iscrizione.ProvinciaId.GetValueOrDefault() != Guid.Empty && iscrizione.CapoareaId.GetValueOrDefault() == Guid.Empty)
|
||||
{
|
||||
capoareaDaConfermare = true;
|
||||
var dbProv = await _managerService.ProvinciaIstatService.RicercaPer(x => x.Id == iscrizione.ProvinciaId);
|
||||
iscrizione.CapoareaId = dbProv.CapoareaId;
|
||||
}
|
||||
|
||||
if (iscrizione.CapoareaId.GetValueOrDefault() != Guid.Empty)
|
||||
{
|
||||
agenti = (await _managerService.UtenteService.RicercaQueryable(x => x.CapoareaId == iscrizione.CapoareaId,
|
||||
ordinamento:x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task onIscrizioneSave()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (iscrizione.CapoareaId.GetValueOrDefault() == Guid.Empty || iscrizione.AgenteId.GetValueOrDefault() == Guid.Empty)
|
||||
throw new Exception("Selezionare un capoarea e un agente");
|
||||
|
||||
var model = await _managerService.IscrizioneEventoService.RicercaPer(x => x.Id == iscrizione.Id, solaLettura: false);
|
||||
if (model == null)
|
||||
throw new Exception("Si è verificato un errore");
|
||||
|
||||
model.AgenteId = iscrizione.AgenteId;
|
||||
model.CapoareaId = iscrizione.CapoareaId;
|
||||
|
||||
await _managerService.IscrizioneEventoService.Salva(model, idClaim);
|
||||
_navManager.NavigateTo("/management/Iscrizioni");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _dialogService.Alert(ex.Message, "Errore");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Torna alla pagina di elenco clienti senza salvare altre modifiche.
|
||||
/// </summary>
|
||||
private void backToHome()
|
||||
{
|
||||
_navManager.NavigateTo("/management/Iscrizioni");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorna la drop di agenti in base al valore di capoarea
|
||||
/// </summary>
|
||||
private async Task OnCapoareaChange(object value)
|
||||
{
|
||||
var capoId = Guid.Empty;
|
||||
capoareaDaConfermare = false;
|
||||
|
||||
if (Guid.TryParse(value.ToString(), out capoId))
|
||||
{
|
||||
iscrizione.AgenteId = null;
|
||||
|
||||
agenti = (await _managerService.UtenteService.RicercaQueryable(x => x.CapoareaId == capoId,
|
||||
ordinamento:x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
@using System.Globalization
|
||||
@using System.IO
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using StandManager.Model
|
||||
@attribute [Authorize]
|
||||
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@inject AuthenticationStateProvider auth
|
||||
|
||||
<RadzenStack Gap="1rem" class="rz-m-12">
|
||||
<RadzenProgressBar Value="@counter" Max="@utentiTotali" Unit="@counterLabel" AriaLabel="" />
|
||||
</RadzenStack>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private Dialog _dialog { get; set; }
|
||||
[Parameter] public UploadChangeEventArgs args { get; set; }
|
||||
|
||||
private int utentiTotali { get; set; } = 0;
|
||||
private int counter { get; set; } = 0;
|
||||
private string counterLabel { get; set; } = string.Empty;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
base.OnInitializedAsync();
|
||||
var file = args.Files.FirstOrDefault();
|
||||
await using var uploadStream = file.OpenReadStream(10_000_000);
|
||||
var idClaim = await MembershipUtils.GetUserId(auth);
|
||||
|
||||
await using var ms = new MemoryStream();
|
||||
await uploadStream.CopyToAsync(ms);
|
||||
ms.Position = 0;
|
||||
|
||||
using var reader = new StreamReader(ms, System.Text.Encoding.UTF8);
|
||||
|
||||
var mailDictionary = new Dictionary<string, string>();
|
||||
|
||||
bool isHeader = true;
|
||||
string line;
|
||||
|
||||
while ((line = await reader.ReadLineAsync()) != null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||
|
||||
if (isHeader)
|
||||
{
|
||||
isHeader = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
var parts = line.Split(',');
|
||||
|
||||
if (parts.Length >= 2)
|
||||
{
|
||||
var code = parts[0];
|
||||
var mail = parts[1];
|
||||
|
||||
if (!string.IsNullOrEmpty(code) && !mailDictionary.ContainsKey(code))
|
||||
{
|
||||
mailDictionary.Add(code, mail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var listaUtenti = await (await _managerService.UtenteService.RicercaQueryable(x => !x.Eliminato, solaLettura: false)).ToListAsync();
|
||||
|
||||
utentiTotali = listaUtenti.Count;
|
||||
counterLabel = " utenti analizzati";
|
||||
|
||||
foreach (var utente in listaUtenti)
|
||||
{
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(utente.CodiceAgente) && mailDictionary.TryGetValue(utente.CodiceAgente, out string nuovaMail) && !string.IsNullOrWhiteSpace(nuovaMail) && utente.Email != nuovaMail)
|
||||
{
|
||||
utente.Email = nuovaMail;
|
||||
await _managerService.UtenteService.Salva(utente, idClaim);
|
||||
}
|
||||
|
||||
counter++;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
ms.Close();
|
||||
_dialogService.Close();
|
||||
}
|
||||
|
||||
// Classe per mappare le colonne del CSV
|
||||
private class CSVMail
|
||||
{
|
||||
public string Code { get; set; }
|
||||
public string Mail { get; set; }
|
||||
}
|
||||
}
|
||||
@ -18,9 +18,12 @@
|
||||
</div>
|
||||
<div class="col-auto ms-auto">
|
||||
<div class="btn-list">
|
||||
<a href="/management/Ruoli/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo ruolo
|
||||
</a>
|
||||
@if (canAdd)
|
||||
{
|
||||
<a href="/management/Ruoli/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo ruolo
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
@ -34,8 +37,8 @@
|
||||
|
||||
<RadzenDataGridColumn Context="ruolo" Filterable="false" Sortable="false" TextAlign="TextAlign.Right" Width="250px">
|
||||
<Template Context="ruolo">
|
||||
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(ruolo))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(ruolo))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Visible="canEdit" Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(ruolo))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Visible="canDelete" Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(ruolo))" @onclick:stopPropagation="true" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
</Columns>
|
||||
@ -51,6 +54,9 @@
|
||||
@code {
|
||||
List<RuoloViewModel> ruoli;
|
||||
|
||||
private bool canAdd = false;
|
||||
private bool canEdit = false;
|
||||
private bool canDelete = false;
|
||||
/// <summary>
|
||||
/// Carica l’elenco dei clienti non eliminati, includendo l’agente,
|
||||
/// e prepara i dati per la visualizzazione in pagina.
|
||||
@ -63,6 +69,11 @@
|
||||
x => x.Eliminato == false,
|
||||
ordinamento: x => x.OrderBy(y => y.Nome)))
|
||||
.Select(x => (RuoloViewModel)x).ToList();
|
||||
|
||||
var permissionUtils = new MembershipUtilsPermission(_managerService, _auth);
|
||||
canAdd = await permissionUtils.CheckPermission("InsertRole");
|
||||
canEdit = await permissionUtils.CheckPermission("EditRole");
|
||||
canDelete = await permissionUtils.CheckPermission("DeleteRole");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -20,9 +20,15 @@
|
||||
</div>
|
||||
<div class="col-auto ms-auto">
|
||||
<div class="btn-list">
|
||||
<a href="/management/Utenti/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo utente
|
||||
</a>
|
||||
|
||||
<RadzenUpload class="btn-5 d-none d-sm-inline-block" Change=@onUpload ChooseText="Importa mail utenti da CSV" />
|
||||
|
||||
@if (canAdd)
|
||||
{
|
||||
<a href="/management/Utenti/Modifica" class="btn btn-primary btn-5 d-none d-sm-inline-block">
|
||||
Nuovo utente
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12">
|
||||
@ -40,8 +46,8 @@
|
||||
|
||||
<RadzenDataGridColumn Context="order" Filterable="false" Sortable="false" TextAlign="TextAlign.Right" Width="200px">
|
||||
<Template Context="user">
|
||||
<RadzenButton Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(user))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(user))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Visible="canEdit" Icon="edit" ButtonStyle="ButtonStyle.Light" Variant="Variant.Flat" Size="ButtonSize.Medium" class="rz-my-1 rz-ms-1" Click="@(args => EditRow(user))" @onclick:stopPropagation="true" />
|
||||
<RadzenButton Visible="canDelete" Icon="delete" ButtonStyle="ButtonStyle.Danger" Variant="Variant.Flat" Size="ButtonSize.Medium" Shade="Shade.Lighter" class="rz-my-1 rz-ms-1" Click="@(args => DeleteRow(user))" @onclick:stopPropagation="true" />
|
||||
</Template>
|
||||
</RadzenDataGridColumn>
|
||||
</Columns>
|
||||
@ -57,6 +63,12 @@
|
||||
@code {
|
||||
IQueryable<Utente> utenti;
|
||||
RadzenDataGrid<Utente> userGrid;
|
||||
private Ruolo? ruolo;
|
||||
|
||||
|
||||
private bool canAdd = false;
|
||||
private bool canEdit = false;
|
||||
private bool canDelete = false;
|
||||
|
||||
/// <summary>
|
||||
/// Carica la lista degli utenti non eliminati, ordinandoli per cognome e nome.
|
||||
@ -69,6 +81,11 @@
|
||||
x => x.Eliminato == false,
|
||||
includi: x => x.Include(y => y.Ruolo).Include(y => y.Capoarea),
|
||||
ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome));
|
||||
|
||||
var permissionUtils = new MembershipUtilsPermission(_managerService, _auth);
|
||||
canAdd = await permissionUtils.CheckPermission("InsertUser");
|
||||
canEdit = await permissionUtils.CheckPermission("EditUser");
|
||||
canDelete = await permissionUtils.CheckPermission("DeleteUser");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -96,4 +113,25 @@
|
||||
ordinamento: x => x.OrderBy(y => y.Cognome).ThenBy(z => z.Nome));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task onUpload(UploadChangeEventArgs args)
|
||||
{
|
||||
var file = args.Files.FirstOrDefault();
|
||||
if (file == null ||
|
||||
!file.Name.EndsWith(".csv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
await _dialogService.Alert("Sono supportati solo file CSV .csv", "Errore");
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
// await using var uploadStream = file.OpenReadStream(10_000_000);
|
||||
await _dialogService.OpenAsync<Mail_Utenti_Import>("Importazione mail per utenti", new Dictionary<string, object>() { { "args", args } });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var er = ex.Message;
|
||||
await _dialogService.Alert("Si è verificato un errore durante l'importazione del file.", "Errore");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,10 +53,10 @@
|
||||
<RadzenTextBox Style="width: 100%" aria-label="Email" @bind-Value="@utente.Email" />
|
||||
<ValidationMessage For="@(() => utente.Email)" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Ruolo</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid" @bind-Value=@utente.RuoloId Data=@ruoli TextProperty="Nome" ValueProperty="Id" Name="ruoliDrop" />
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid?" @bind-Value=@utente.RuoloId Data=@ruoli TextProperty="Nome" ValueProperty="Id" Name="ruoliDrop" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -67,12 +67,13 @@
|
||||
</div>
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Capoarea</RadzenText>
|
||||
<RadzenDropDown Style="width: 100%" TValue="Guid" @bind-Value=@utente.CapoareaId Data=@capoareaList TextProperty="Nome" ValueProperty="Id" Name="capoareaDrop\" />
|
||||
<RadzenDropDown FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive" FilterOperator="StringFilterOperator.Contains" AllowFiltering="true"
|
||||
Style="width: 100%" TValue="Guid?" @bind-Value=@utente.CapoareaId Data=@capoareaList TextProperty="Nome" ValueProperty="Id" Name="capoareaDrop\" />
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-3 mb-3">
|
||||
<RadzenText TextStyle="TextStyle.Subtitle2" TagName="TagName.H3">Password</RadzenText>
|
||||
<RadzenPassword Style="width: 100%" aria-label="Password" @bind-Value="@utente.Password"/>
|
||||
<RadzenPassword Style="width: 100%" aria-label="Password" @bind-Value="@utente.Password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -118,20 +119,20 @@
|
||||
{
|
||||
if (UserId.GetValueOrDefault() != Guid.Empty)
|
||||
utente = await _managerService.UtenteService.RicercaPer(
|
||||
x => x.Id == UserId,
|
||||
includi:x => x.Include(y => y.Ruolo).Include(y => y.Capoarea));
|
||||
x => x.Id == UserId,
|
||||
includi: x => x.Include(y => y.Ruolo).Include(y => y.Capoarea));
|
||||
else
|
||||
utente = new UtenteViewModel();
|
||||
|
||||
ruoli = (await _managerService.RuoloService.RicercaQueryable(x => x.Eliminato == false))
|
||||
.Select(x => (RuoloViewModel)x).ToList();
|
||||
|
||||
var ruoliCapoarea = await _managerService.RuoloService.RicercaQueryable(
|
||||
x => x.Permessi.Any(y => y.Feature.Type == FeatureType.AdminGlobal || y.Feature.Type == FeatureType.Capoarea),
|
||||
includi:x => x.Include(y => y.Permessi).ThenInclude(z => z.Feature));
|
||||
capoareaList = (await _managerService.UtenteService.RicercaQueryable(
|
||||
u => ruoliCapoarea.Any(r => r.Id == u.RuoloId)
|
||||
)).Select(x => (UtenteViewModel)x).ToList();
|
||||
capoareaList = (await _managerService.UtenteService.RicercaQueryable(x => x.IsCapoarea,
|
||||
ordinamento:y => y.OrderBy(z => z.Nome).ThenBy(w => w.Cognome)))
|
||||
.Select(x => (UtenteViewModel)x).ToList();
|
||||
|
||||
if (utente.Id == Guid.Empty)
|
||||
utente.RuoloId = ruoli.FirstOrDefault(x => x.Default)?.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -46,8 +46,7 @@
|
||||
<div class="d-flex align-items-center">
|
||||
<RadzenCheckBox class="form-check-input" @bind-Value="PresaVisioneDatiPersonali" Name="presaVisioneDatiPersonali" TValue="bool"/>
|
||||
<label class="rz-ms-2" for="presaVisioneDatiPersonali" style="cursor: pointer;">
|
||||
Autorizzazione al trattamento dati*<br/>
|
||||
I dati forniti saranno utilizzati esclusivamente per l’invio del biglietto. (<a href="https://www.gruppodac.eu/tutela-e-privacy/" target="_blank">leggi</a>)
|
||||
Autorizzazione al trattamento dati* (<a href="https://www.gruppodac.eu/tutela-e-privacy/" target="_blank">leggi</a>)
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -9,28 +9,16 @@
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Iscrizione Evento</PageTitle>
|
||||
<AppHeader ShowNavigation="false"/>
|
||||
<AppHeader ShowNavigation="false" />
|
||||
|
||||
<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" hasCliente="hasCliente" @ref="registrazione" />
|
||||
<Component_Registrazione invito="invito" cliente="cliente" @ref="registrazione" ReturnUrl="/registrazioneInFiera" />
|
||||
}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<DacFooter />
|
||||
@ -40,45 +28,23 @@
|
||||
private bool showForm { get; set; } = false;
|
||||
private InvitoEventoViewModel invito { get; set; } = new InvitoEventoViewModel();
|
||||
private Component_Registrazione registrazione { get; set; } = new();
|
||||
private bool hasCliente { get; set; }
|
||||
|
||||
private string codiceFornito { get; set; }
|
||||
private bool cliente { get; set; }
|
||||
|
||||
private void onClienteToggleChanged(bool value)
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
hasCliente = false;
|
||||
cliente = false;
|
||||
registrazione.NoCliente();
|
||||
}
|
||||
else
|
||||
{
|
||||
hasCliente = true;
|
||||
registrazione.HasCliente();
|
||||
cliente = true;
|
||||
registrazione.GiaCliente();
|
||||
}
|
||||
|
||||
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;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
@ -14,9 +14,10 @@
|
||||
<div class="container my-5 py-3">
|
||||
<Component_Registrazione
|
||||
invito="invito"
|
||||
hasCliente="hasCliente"
|
||||
cliente="cliente"
|
||||
@ref="registrazione"
|
||||
OnSubmitCompletedAsync="@((sender, model) => onSubmitCompleted(model))"/>
|
||||
OnSubmitCompletedAsync="@((sender, model) => onSubmitCompleted(model))"
|
||||
ReturnUrl="/registrazione-campagna-socialmedia-dac-expo-tecnocom-2026"/>
|
||||
</div>
|
||||
|
||||
<DacFooter />
|
||||
@ -26,47 +27,7 @@
|
||||
private bool showForm { get; set; } = false;
|
||||
private InvitoEventoViewModel invito { get; set; } = new InvitoEventoViewModel();
|
||||
private Component_Registrazione registrazione { get; set; } = new();
|
||||
private bool hasCliente { get; set; }
|
||||
|
||||
private string codiceFornito { get; set; }
|
||||
|
||||
private void onClienteToggleChanged(bool value)
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
hasCliente = false;
|
||||
registrazione.NoCliente();
|
||||
}
|
||||
else
|
||||
{
|
||||
hasCliente = true;
|
||||
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;
|
||||
}
|
||||
private bool cliente { get; set; }
|
||||
|
||||
private async Task onSubmitCompleted(IscrizioneEvento model)
|
||||
{
|
||||
|
||||
@ -20,5 +20,6 @@
|
||||
@inject IManagerService _managerService
|
||||
|
||||
@inject DialogService _dialogService
|
||||
@inject NotificationService _notificationService
|
||||
@inject NavigationManager _navManager
|
||||
@inject AuthenticationStateProvider _auth
|
||||
@ -92,21 +92,4 @@ public class ClienteViewModel
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
||||
public class TipologiaClienteViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Nome { get; set; }
|
||||
|
||||
public static implicit operator TipologiaClienteViewModel(TipologiaCliente model)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: new TipologiaClienteViewModel()
|
||||
{
|
||||
Id = model.Id,
|
||||
Nome = model.Nome
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ public class IscrizioneEventoViewModel
|
||||
public InvitoEvento InvitoEvento { get; set; }
|
||||
public ClienteViewModel Cliente { get; set; }
|
||||
public Guid? ClienteId { get; set; }
|
||||
public DestinazioneViewModel Destinazione { get; set; }
|
||||
public Guid? DestinazioneId { get; set; }
|
||||
/*[Range(1, int.MaxValue, ErrorMessage = "Inserire un numero di partecipanti valido")]*/
|
||||
public int Partecipanti { get; set; }
|
||||
@ -28,16 +29,20 @@ public class IscrizioneEventoViewModel
|
||||
public string Email { get; set; }
|
||||
[Required(ErrorMessage = "Il numero di telefono è obbigatorio")]
|
||||
public string NumeroTelefono { get; set; }
|
||||
[Required(ErrorMessage = "La provincia è obbigatoria")]
|
||||
public Guid? Provincia { get; set; }
|
||||
[Required(ErrorMessage = "Il comune è obbigatorio")]
|
||||
public Guid? Comune { get; set; }
|
||||
[Required(ErrorMessage = "Il CAP è obbigatorio")]
|
||||
/*[Required(ErrorMessage = "La provincia è obbigatoria")]*/
|
||||
public Guid? ProvinciaId { get; set; }
|
||||
public ProvinciaViewModel Provincia { get; set; }
|
||||
/*[Required(ErrorMessage = "Il comune è obbigatorio")]*/
|
||||
public Guid? ComuneId { get; set; }
|
||||
public ComuneIstatViewModel Comune { get; set; }
|
||||
/*[Required(ErrorMessage = "Il CAP è obbigatorio")]*/
|
||||
public string Cap { get; set; }
|
||||
[Required(ErrorMessage = "La Ragione Sociale è obbigatoria")]
|
||||
public string RagioneSociale { get; set; }
|
||||
[Required(ErrorMessage = "Il campo è obbigatorio")]
|
||||
public string EsperienzaConDAC { get; set; }
|
||||
|
||||
public TipologiaClienteViewModel TipologiaCliente { get; set; }
|
||||
[Required(ErrorMessage = "La tipologia è obbigatoria")]
|
||||
public Guid? TipologiaClienteId { get; set; }
|
||||
public RuoloTipo Ruolo { get; set; }
|
||||
@ -46,13 +51,23 @@ public class IscrizioneEventoViewModel
|
||||
public string? PartitaIva { get; set; }
|
||||
[Required(ErrorMessage = "E' necessario indicare la data di partecipazione")]
|
||||
public DateTime? GiornoPresenza { get; set; }
|
||||
public UtenteViewModel Agente { get; set; }
|
||||
public Guid? AgenteId { get; set; }
|
||||
public UtenteViewModel Capoarea { get; set; }
|
||||
public Guid? CapoareaId { get; set; }
|
||||
|
||||
public string ProvinciaInfo => $"{Provincia?.Provincia ?? "--Non indicato"}";
|
||||
public string ComuneInfo => $"{Comune?.Comune ?? "--Non indicato"}";
|
||||
public string TipologiaClienteInfo => $"{TipologiaCliente?.Nome ?? "--Non indicato"}";
|
||||
public string DestinazioneInfo => $"{Destinazione?.RagioneSociale ?? "--Non indicato"}";
|
||||
public string RuoloInfo => $"{new EnumUtils().GetDescription(Ruolo)}";
|
||||
public string GiornoPresenzaInfo => $"{GiornoPresenza.GetValueOrDefault():dd/MM/yyyy}";
|
||||
public string AgenteInfo => $"{Agente?.Info ?? "--Non indicato"}";
|
||||
public string CapoareaInfo => $"{Capoarea?.Info ?? "--Non indicato"}";
|
||||
|
||||
public IscrizioneEvento Map(IscrizioneEvento model)
|
||||
{
|
||||
model.Partecipanti = Partecipanti;
|
||||
model.Note = Note;
|
||||
model.ScanCompleto = ScanCompleto;
|
||||
model.DataScan = DataScan;
|
||||
model.Nome = Nome;
|
||||
model.Cognome = Cognome;
|
||||
model.Email = Email;
|
||||
@ -62,8 +77,14 @@ public class IscrizioneEventoViewModel
|
||||
model.EsperienzaConDAC = EsperienzaConDAC;
|
||||
model.PartitaIva = PartitaIva;
|
||||
model.GiornoPresenza = GiornoPresenza.Value;
|
||||
model.ComuneId = Comune.GetValueOrDefault();
|
||||
model.ProvinciaId = Provincia.GetValueOrDefault();
|
||||
model.Ruolo = (RuoloTipo)RuoloInt;
|
||||
model.TipologiaClienteId = TipologiaClienteId;
|
||||
if (model.ComuneId.GetValueOrDefault() != Guid.Empty)
|
||||
model.ComuneId = ComuneId.GetValueOrDefault();
|
||||
if (model.ProvinciaId.GetValueOrDefault() != Guid.Empty)
|
||||
model.ProvinciaId = ProvinciaId.GetValueOrDefault();
|
||||
model.AgenteId = AgenteId;
|
||||
model.CapoareaId = CapoareaId;
|
||||
|
||||
return model;
|
||||
}
|
||||
@ -86,8 +107,10 @@ public class IscrizioneEventoViewModel
|
||||
Cognome = model.Cognome,
|
||||
Email = model.Email,
|
||||
NumeroTelefono = model.NumeroTelefono,
|
||||
Provincia = model.Provincia?.Id ?? Guid.Empty,
|
||||
Comune = model.Comune?.Id ?? Guid.Empty,
|
||||
ProvinciaId = model.Provincia?.Id ?? Guid.Empty,
|
||||
Provincia = model.Provincia,
|
||||
ComuneId = model.Comune?.Id ?? Guid.Empty,
|
||||
Comune = model.Comune,
|
||||
Cap = model.Cap,
|
||||
RagioneSociale = model.RagioneSociale,
|
||||
EsperienzaConDAC = model.EsperienzaConDAC,
|
||||
@ -96,6 +119,11 @@ public class IscrizioneEventoViewModel
|
||||
RuoloInt = (int?)model.Ruolo,
|
||||
PartitaIva = model.PartitaIva,
|
||||
GiornoPresenza = model.GiornoPresenza,
|
||||
CapoareaId = model.CapoareaId,
|
||||
AgenteId = model.AgenteId,
|
||||
TipologiaCliente = model.TipologiaCliente,
|
||||
Agente = model.Agente,
|
||||
Capoarea = model.Capoarea
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ public class ProvinciaViewModel
|
||||
public Guid Id { get; set; }
|
||||
public string Sigla { get; set; }
|
||||
public string Provincia { get; set; }
|
||||
public bool CapoareaDaVerificare { get; set; }
|
||||
public string Info => $"{Sigla} - {Provincia}";
|
||||
|
||||
public static implicit operator ProvinciaViewModel(ProvinciaIstat model)
|
||||
@ -17,6 +18,7 @@ public class ProvinciaViewModel
|
||||
{
|
||||
Provincia = model.Provincia,
|
||||
Sigla = model.Sigla,
|
||||
CapoareaDaVerificare = model.CapoareaDaVerificare,
|
||||
Id = model.Id
|
||||
};
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ public class RuoloViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Nome { get; set; }
|
||||
public bool Default { get; set; }
|
||||
|
||||
public static implicit operator RuoloViewModel(Ruolo model)
|
||||
{
|
||||
@ -14,7 +15,8 @@ public class RuoloViewModel
|
||||
: new RuoloViewModel()
|
||||
{
|
||||
Nome = model.Nome,
|
||||
Id = model.Id
|
||||
Id = model.Id,
|
||||
Default = model.Default
|
||||
};
|
||||
}
|
||||
}
|
||||
20
StandManager/Model/TipologiaClienteViewModel.cs
Normal file
20
StandManager/Model/TipologiaClienteViewModel.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using StandManager.Domain.Entita;
|
||||
|
||||
namespace StandManager.Model;
|
||||
|
||||
public class TipologiaClienteViewModel
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Nome { get; set; }
|
||||
|
||||
public static implicit operator TipologiaClienteViewModel(TipologiaCliente model)
|
||||
{
|
||||
return model == null
|
||||
? null
|
||||
: new TipologiaClienteViewModel()
|
||||
{
|
||||
Id = model.Id,
|
||||
Nome = model.Nome
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -16,8 +16,8 @@ public class UtenteViewModel
|
||||
public string Nome { get; set; }
|
||||
[Required(ErrorMessage = "Il cognome è obbligatorio")]
|
||||
public string Cognome { get; set; }
|
||||
public Guid RuoloId { get; set; }
|
||||
public Guid CapoareaId { get; set; }
|
||||
public Guid? RuoloId { get; set; }
|
||||
public Guid? CapoareaId { get; set; }
|
||||
public bool IsCapoarea { get; set; }
|
||||
public string Info => $"{Nome} {Cognome}";
|
||||
|
||||
@ -30,8 +30,8 @@ public class UtenteViewModel
|
||||
Email = model.Email,
|
||||
Nome = model.Nome,
|
||||
Cognome = model.Cognome,
|
||||
RuoloId = model.Ruolo?.Id ?? Guid.Empty,
|
||||
CapoareaId = model.Capoarea?.Id ?? Guid.Empty,
|
||||
RuoloId = model.Ruolo?.Id,
|
||||
CapoareaId = model.Capoarea?.Id,
|
||||
IsCapoarea = model.IsCapoarea
|
||||
};
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using StandManager.Service.Interfaces;
|
||||
|
||||
namespace StandManager.Utils;
|
||||
|
||||
@ -20,3 +21,27 @@ public static class MembershipUtils
|
||||
return Guid.Parse(idClaim ?? Guid.Empty.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public partial class MembershipUtilsPermission
|
||||
{
|
||||
private readonly IManagerService _managerService;
|
||||
private readonly AuthenticationStateProvider _auth;
|
||||
|
||||
public MembershipUtilsPermission(IManagerService managerService, AuthenticationStateProvider auth)
|
||||
{
|
||||
_managerService = managerService;
|
||||
_auth = auth;
|
||||
}
|
||||
|
||||
public async Task<bool> CheckPermission(string featureName)
|
||||
{
|
||||
var state = await _auth.GetAuthenticationStateAsync();
|
||||
var idClaim = state.User.FindFirst("RoleId")?.Value;
|
||||
|
||||
var parsed = Guid.Parse(idClaim ?? Guid.Empty.ToString());
|
||||
|
||||
var perm = await _managerService.RuoloService.RicercaPer(x =>
|
||||
x.Id == parsed && x.Permessi.Any(y => y.Feature.Nome == featureName && y.Eliminato == false) && x.Eliminato == false);
|
||||
return perm != null;
|
||||
}
|
||||
}
|
||||
|
||||
7
Writerside.iml
Normal file
7
Writerside.iml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$/Writerside" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
84
script.sql
84
script.sql
@ -1,51 +1,55 @@
|
||||
BEGIN TRANSACTION;
|
||||
CREATE TABLE [MailQueue] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Subject] nvarchar(max) NOT NULL,
|
||||
[Body] nvarchar(max) NOT NULL,
|
||||
[ToList] nvarchar(max) NOT NULL,
|
||||
[Args] nvarchar(max) NULL,
|
||||
[From] int NOT NULL,
|
||||
[Sent] bit NOT NULL,
|
||||
[Error] nvarchar(max) NULL,
|
||||
[DataCreazione] datetime2 NOT NULL,
|
||||
[DataModifica] datetime2 NULL,
|
||||
[Eliminato] bit NOT NULL,
|
||||
[IdUtenteCreazione] uniqueidentifier NULL,
|
||||
[IdUtenteModifica] uniqueidentifier NULL,
|
||||
CONSTRAINT [PK_MailQueue] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_MailQueue_Utente_IdUtenteCreazione] FOREIGN KEY ([IdUtenteCreazione]) REFERENCES [Utente] ([Id]),
|
||||
CONSTRAINT [FK_MailQueue_Utente_IdUtenteModifica] FOREIGN KEY ([IdUtenteModifica]) REFERENCES [Utente] ([Id])
|
||||
);
|
||||
|
||||
CREATE INDEX [IX_MailQueue_IdUtenteCreazione] ON [MailQueue] ([IdUtenteCreazione]);
|
||||
|
||||
CREATE INDEX [IX_MailQueue_IdUtenteModifica] ON [MailQueue] ([IdUtenteModifica]);
|
||||
DROP TABLE [IscrizioneEventoPerMail];
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260109133732_MailQueue', N'9.0.11');
|
||||
VALUES (N'20260122105724_Rimozione_IscrizioneEventoPerMail', N'9.0.11');
|
||||
|
||||
CREATE TABLE [IscrizioneEventoPerMail] (
|
||||
[Id] uniqueidentifier NOT NULL,
|
||||
[Mail] nvarchar(max) NOT NULL,
|
||||
[Processata] bit NOT NULL,
|
||||
[Inviata] bit NOT NULL,
|
||||
[DataCreazione] datetime2 NOT NULL,
|
||||
[DataModifica] datetime2 NULL,
|
||||
[Eliminato] bit NOT NULL,
|
||||
[IdUtenteCreazione] uniqueidentifier NULL,
|
||||
[IdUtenteModifica] uniqueidentifier NULL,
|
||||
CONSTRAINT [PK_IscrizioneEventoPerMail] PRIMARY KEY ([Id]),
|
||||
CONSTRAINT [FK_IscrizioneEventoPerMail_Utente_IdUtenteCreazione] FOREIGN KEY ([IdUtenteCreazione]) REFERENCES [Utente] ([Id]),
|
||||
CONSTRAINT [FK_IscrizioneEventoPerMail_Utente_IdUtenteModifica] FOREIGN KEY ([IdUtenteModifica]) REFERENCES [Utente] ([Id])
|
||||
);
|
||||
ALTER TABLE [Utente] ADD [ProvinciaIstatId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEventoPerMail_IdUtenteCreazione] ON [IscrizioneEventoPerMail] ([IdUtenteCreazione]);
|
||||
ALTER TABLE [IscrizioneEvento] ADD [AgenteId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEventoPerMail_IdUtenteModifica] ON [IscrizioneEventoPerMail] ([IdUtenteModifica]);
|
||||
ALTER TABLE [IscrizioneEvento] ADD [CapoareaId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_Utente_ProvinciaIstatId] ON [Utente] ([ProvinciaIstatId]);
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEvento_AgenteId] ON [IscrizioneEvento] ([AgenteId]);
|
||||
|
||||
CREATE INDEX [IX_IscrizioneEvento_CapoareaId] ON [IscrizioneEvento] ([CapoareaId]);
|
||||
|
||||
ALTER TABLE [IscrizioneEvento] ADD CONSTRAINT [FK_IscrizioneEvento_Utente_AgenteId] FOREIGN KEY ([AgenteId]) REFERENCES [Utente] ([Id]);
|
||||
|
||||
ALTER TABLE [IscrizioneEvento] ADD CONSTRAINT [FK_IscrizioneEvento_Utente_CapoareaId] FOREIGN KEY ([CapoareaId]) REFERENCES [Utente] ([Id]);
|
||||
|
||||
ALTER TABLE [Utente] ADD CONSTRAINT [FK_Utente_Province_ProvinciaIstatId] FOREIGN KEY ([ProvinciaIstatId]) REFERENCES [Province] ([Id]);
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260120130758_IscrizioneEventoPerMail', N'9.0.11');
|
||||
VALUES (N'20260204162205_CapiareaAgentiInIscrizioneEvento', N'9.0.11');
|
||||
|
||||
ALTER TABLE [Province] ADD [CapoareaDaVerificare] bit NOT NULL DEFAULT CAST(0 AS bit);
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260205095709_CapoareaDaVerificareInProvincia', N'9.0.11');
|
||||
|
||||
ALTER TABLE [Utente] DROP CONSTRAINT [FK_Utente_Province_ProvinciaIstatId];
|
||||
|
||||
DROP INDEX [IX_Utente_ProvinciaIstatId] ON [Utente];
|
||||
|
||||
DECLARE @var sysname;
|
||||
SELECT @var = [d].[name]
|
||||
FROM [sys].[default_constraints] [d]
|
||||
INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
|
||||
WHERE ([d].[parent_object_id] = OBJECT_ID(N'[Utente]') AND [c].[name] = N'ProvinciaIstatId');
|
||||
IF @var IS NOT NULL EXEC(N'ALTER TABLE [Utente] DROP CONSTRAINT [' + @var + '];');
|
||||
ALTER TABLE [Utente] DROP COLUMN [ProvinciaIstatId];
|
||||
|
||||
ALTER TABLE [Province] ADD [CapoareaId] uniqueidentifier NULL;
|
||||
|
||||
CREATE INDEX [IX_Province_CapoareaId] ON [Province] ([CapoareaId]);
|
||||
|
||||
ALTER TABLE [Province] ADD CONSTRAINT [FK_Province_Utente_CapoareaId] FOREIGN KEY ([CapoareaId]) REFERENCES [Utente] ([Id]);
|
||||
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260206070903_CapoareaSuProvIstat', N'9.0.11');
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
Reference in New Issue
Block a user