Gestito elenco clienti e prospect in lista contatti
This commit is contained in:
@@ -12,6 +12,22 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
|||||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
||||||
localDb.Get(whereCond);
|
localDb.Get(whereCond);
|
||||||
|
|
||||||
|
public async Task<List<ContactDTO>> GetContact()
|
||||||
|
{
|
||||||
|
var contactList = await localDb.Get<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||||
|
var prospectList = await localDb.Get<PtbPros>();
|
||||||
|
|
||||||
|
// Mappa i contatti
|
||||||
|
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
||||||
|
|
||||||
|
// Mappa i prospects
|
||||||
|
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
||||||
|
|
||||||
|
contactMapper.AddRange(prospectMapper);
|
||||||
|
|
||||||
|
return contactMapper;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
||||||
{
|
{
|
||||||
var activities = await localDb.Get(whereCond);
|
var activities = await localDb.Get(whereCond);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using AutoMapper;
|
||||||
using CommunityToolkit.Maui;
|
using CommunityToolkit.Maui;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using IntegryApiClient.MAUI;
|
using IntegryApiClient.MAUI;
|
||||||
|
|||||||
@@ -2,26 +2,40 @@
|
|||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Entity
|
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Components.SingleElements
|
||||||
|
@using salesbook.Shared.Core.Entity
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
|
||||||
<HeaderLayout Title="Contatti" ShowFilter="true" OnFilterToggle="ToggleFilter" />
|
<HeaderLayout Title="Contatti"/>
|
||||||
|
|
||||||
<div class="container search-box">
|
<div class="container search-box">
|
||||||
<div class="input-card clearButton">
|
<div class="input-card clearButton">
|
||||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500" />
|
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500"/>
|
||||||
|
|
||||||
@if (!TextToFilter.IsNullOrEmpty())
|
@if (!TextToFilter.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<MudIconButton Class="rounded-button" OnClick="ToggleFilter" Icon="@Icons.Material.Rounded.FilterList" Variant="Variant.Filled" Color="Color.Secondary" Size="Size.Small" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<MudChipSet Class="mt-2" T="string" @bind-SelectedValue="TypeUser" @bind-SelectedValue:after="FilterUsers" SelectionMode="SelectionMode.SingleSelection">
|
||||||
|
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("all")">Tutti</MudChip>
|
||||||
|
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("contact")">Contatti</MudChip>
|
||||||
|
<MudChip Color="Color.Secondary" Variant="Variant.Text" Value="@("prospect")">Prospect</MudChip>
|
||||||
|
</MudChipSet>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container users">
|
<div class="container users">
|
||||||
@if (GroupedUserList?.Count > 0)
|
@if (IsLoading)
|
||||||
|
{
|
||||||
|
<SpinnerLayout FullScreen="false"/>
|
||||||
|
}
|
||||||
|
else if (GroupedUserList?.Count > 0)
|
||||||
{
|
{
|
||||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
||||||
@if (item.ShowHeader)
|
@if (item.ShowHeader)
|
||||||
@@ -31,31 +45,45 @@
|
|||||||
<UserCard User="item.User"/>
|
<UserCard User="item.User"/>
|
||||||
</Virtualize>
|
</Virtualize>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<NoDataAvailable Text="Nessun contatto trovato"/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
|
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="FilterUsers"/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
||||||
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
||||||
private string? TextToFilter { get; set; }
|
|
||||||
|
private bool IsLoading { get; set; }
|
||||||
|
|
||||||
//Filtri
|
//Filtri
|
||||||
|
private string? TextToFilter { get; set; }
|
||||||
private bool OpenFilter { get; set; }
|
private bool OpenFilter { get; set; }
|
||||||
private FilterUserDTO Filter { get; set; } = new();
|
private FilterUserDTO Filter { get; set; } = new();
|
||||||
|
private string TypeUser { get; set; } = "all";
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
await LoadData();
|
await LoadData();
|
||||||
StateHasChanged();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
var users = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
IsLoading = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||||
|
|
||||||
|
if (loggedUser.UserCode != null)
|
||||||
|
Filter.Agenti = [loggedUser.UserCode];
|
||||||
|
|
||||||
|
var users = await ManageData.GetContact();
|
||||||
|
|
||||||
var sortedUsers = users
|
var sortedUsers = users
|
||||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||||
@@ -88,11 +116,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
FilterUsers();
|
FilterUsers();
|
||||||
|
|
||||||
|
IsLoading = false;
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UserDisplayItem
|
private class UserDisplayItem
|
||||||
{
|
{
|
||||||
public required AnagClie User { get; set; }
|
public required ContactDTO User { get; set; }
|
||||||
public bool ShowHeader { get; set; }
|
public bool ShowHeader { get; set; }
|
||||||
public string? HeaderLetter { get; set; }
|
public string? HeaderLetter { get; set; }
|
||||||
}
|
}
|
||||||
@@ -104,23 +135,49 @@
|
|||||||
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
||||||
{
|
{
|
||||||
TextToFilter = null;
|
TextToFilter = null;
|
||||||
FilteredGroupedUserList = GroupedUserList;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var filter = TextToFilter.Trim();
|
|
||||||
var result = new List<UserDisplayItem>();
|
var result = new List<UserDisplayItem>();
|
||||||
|
|
||||||
foreach (var item in GroupedUserList)
|
foreach (var item in GroupedUserList)
|
||||||
{
|
{
|
||||||
var user = item.User;
|
var user = item.User;
|
||||||
if (
|
|
||||||
|
switch (TypeUser)
|
||||||
|
{
|
||||||
|
case "contact" when !user.IsContact:
|
||||||
|
case "prospect" when user.IsContact:
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var matchesFilter =
|
||||||
|
(Filter.Prov.IsNullOrEmpty() || user.Prov.Equals(Filter.Prov, StringComparison.OrdinalIgnoreCase)) &&
|
||||||
|
(Filter.Citta.IsNullOrEmpty() || user.Citta.Contains(Filter.Citta!, StringComparison.OrdinalIgnoreCase)) &&
|
||||||
|
(Filter.Nazione.IsNullOrEmpty() || user.Nazione.Contains(Filter.Nazione!, StringComparison.OrdinalIgnoreCase)) &&
|
||||||
|
(Filter.Indirizzo.IsNullOrEmpty() || user.Indirizzo.Contains(Filter.Indirizzo!, StringComparison.OrdinalIgnoreCase)) &&
|
||||||
|
(!Filter.ConAgente || user.CodVage is not null) &&
|
||||||
|
(!Filter.SenzaAgente || user.CodVage is null) &&
|
||||||
|
(Filter.Agenti.IsNullOrEmpty() || (user.CodVage != null && Filter.Agenti!.Contains(user.CodVage)));
|
||||||
|
|
||||||
|
if (!matchesFilter) continue;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(TextToFilter))
|
||||||
|
{
|
||||||
|
var filter = TextToFilter.Trim();
|
||||||
|
|
||||||
|
var matchesText =
|
||||||
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase))
|
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase));
|
||||||
)
|
|
||||||
|
if (matchesText)
|
||||||
|
{
|
||||||
|
result.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
result.Add(item);
|
result.Add(item);
|
||||||
}
|
}
|
||||||
@@ -135,9 +192,4 @@
|
|||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyFilter()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,6 @@
|
|||||||
padding-bottom: .5rem;
|
padding-bottom: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-box .input-card {
|
.search-box .input-card { margin: 0 !important; }
|
||||||
margin: 0 !important;
|
|
||||||
}
|
.search-box .input-card ::deep .rounded-button { border-radius: 50%; }
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Components.Pages
|
||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Helpers.Enum
|
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject IManageDataService manageData
|
@inject IManageDataService manageData
|
||||||
|
|
||||||
@@ -17,76 +17,74 @@
|
|||||||
|
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Assegnata a</span>
|
<span class="disable-full-width">Con agente</span>
|
||||||
|
|
||||||
<MudSelectExtended SearchBox="true"
|
|
||||||
ItemCollection="Users.Select(x => x.UserName).ToList()"
|
|
||||||
SelectAllPosition="SelectAllPosition.NextToSearchBox"
|
|
||||||
SelectAll="true"
|
|
||||||
NoWrap="true"
|
|
||||||
MultiSelection="true"
|
|
||||||
MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionUser))"
|
|
||||||
FullWidth="true" T="string"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
Virtualize="true"
|
|
||||||
@bind-SelectedValues="FilterActivity.User"
|
|
||||||
Class="customIcon-select"
|
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
|
||||||
|
|
||||||
|
<MudCheckBox @bind-Value="Filter.ConAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeAgente"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Tipo</span>
|
<span class="disable-full-width">Senza agente</span>
|
||||||
|
|
||||||
<MudSelectExtended FullWidth="true"
|
<MudCheckBox @bind-Value="Filter.SenzaAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeAgente"/>
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
|
||||||
@bind-Value="FilterActivity.Type"
|
|
||||||
Class="customIcon-select"
|
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
|
||||||
@foreach (var type in ActivityType)
|
|
||||||
{
|
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
|
||||||
}
|
|
||||||
</MudSelectExtended>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Esito</span>
|
<span class="disable-full-width">Agente</span>
|
||||||
|
|
||||||
<MudSelectExtended FullWidth="true"
|
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
|
||||||
T="string?"
|
@bind-SelectedValues="Filter.Agenti" @bind-SelectedValues:after="OnAfterChangeAgenti"
|
||||||
Variant="Variant.Text"
|
MultiSelection="true" MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionAgente))"
|
||||||
@bind-Value="FilterActivity.Result"
|
SelectAllPosition="SelectAllPosition.NextToSearchBox" SelectAll="true"
|
||||||
Class="customIcon-select"
|
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
@foreach (var user in Users)
|
||||||
@foreach (var result in ActivityResult)
|
|
||||||
{
|
{
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
|
||||||
}
|
}
|
||||||
</MudSelectExtended>
|
</MudSelectExtended>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="input-card">
|
||||||
|
<div class="form-container">
|
||||||
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Indirizzo"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
@bind-Value="Filter.Indirizzo"
|
||||||
|
DebounceInterval="500"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Categoria</span>
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Città"
|
||||||
<MudSelectExtended FullWidth="true"
|
|
||||||
T="ActivityCategoryEnum?"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
@bind-Value="FilterActivity.Category"
|
@bind-Value="Filter.Citta"
|
||||||
Class="customIcon-select"
|
DebounceInterval="500"/>
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
</div>
|
||||||
@foreach (var category in CategoryList)
|
|
||||||
{
|
<div class="divider"></div>
|
||||||
<MudSelectItemExtended T="ActivityCategoryEnum?" Class="custom-item-select" Value="@category">@category.ConvertToHumanReadable()</MudSelectItemExtended>
|
|
||||||
}
|
<div class="form-container">
|
||||||
</MudSelectExtended>
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Provincia"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
@bind-Value="Filter.Prov"
|
||||||
|
DebounceInterval="500"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<div class="form-container">
|
||||||
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Nazione"
|
||||||
|
Variant="Variant.Text"
|
||||||
|
@bind-Value="Filter.Nazione"
|
||||||
|
DebounceInterval="500"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -104,12 +102,7 @@
|
|||||||
[Parameter] public FilterUserDTO Filter { get; set; }
|
[Parameter] public FilterUserDTO Filter { get; set; }
|
||||||
[Parameter] public EventCallback<FilterUserDTO> FilterChanged { get; set; }
|
[Parameter] public EventCallback<FilterUserDTO> FilterChanged { get; set; }
|
||||||
|
|
||||||
private FilterActivityDTO FilterActivity { get; set; } = new();
|
|
||||||
|
|
||||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
|
||||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
|
||||||
private List<StbUser> Users { get; set; } = [];
|
private List<StbUser> Users { get; set; } = [];
|
||||||
private List<ActivityCategoryEnum> CategoryList { get; set; } = [];
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
@@ -117,19 +110,14 @@
|
|||||||
await LoadData();
|
await LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetMultiSelectionUser(List<string> selectedValues)
|
|
||||||
{
|
|
||||||
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
Users = await manageData.GetTable<StbUser>();
|
Users = await manageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||||
ActivityResult = await manageData.GetTable<StbActivityResult>();
|
}
|
||||||
ActivityType = await manageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
|
||||||
CategoryList = ActivityCategoryHelper.AllActivityCategory;
|
|
||||||
|
|
||||||
StateHasChanged();
|
private string GetMultiSelectionAgente(List<string> selectedValues)
|
||||||
|
{
|
||||||
|
return $"{selectedValues.Count} Agent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseBottomSheet()
|
private void CloseBottomSheet()
|
||||||
@@ -144,4 +132,24 @@
|
|||||||
CloseBottomSheet();
|
CloseBottomSheet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnAfterChangeAgenti()
|
||||||
|
{
|
||||||
|
if (Filter.Agenti == null || !Filter.Agenti.Any()) return;
|
||||||
|
|
||||||
|
Filter.ConAgente = false;
|
||||||
|
Filter.SenzaAgente = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAfterChangeAgente()
|
||||||
|
{
|
||||||
|
if (Filter.SenzaAgente)
|
||||||
|
{
|
||||||
|
Filter.ConAgente = false;
|
||||||
|
}
|
||||||
|
else if (Filter.ConAgente)
|
||||||
|
{
|
||||||
|
Filter.SenzaAgente = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -18,11 +18,12 @@
|
|||||||
<div class="contact-right-section">
|
<div class="contact-right-section">
|
||||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
|
<MudIconButton Href="@($"tel:{Contact.NumCellulare}")" Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!Contact.EMail.IsNullOrEmpty()){
|
@if (!Contact.EMail.IsNullOrEmpty())
|
||||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
{
|
||||||
|
<MudIconButton Href="@($"mailto:{Contact.EMail}")" Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@@ -6,7 +7,7 @@
|
|||||||
<div class="user-card-left-section">
|
<div class="user-card-left-section">
|
||||||
<div class="user-card-body-section">
|
<div class="user-card-body-section">
|
||||||
<div class="title-section">
|
<div class="title-section">
|
||||||
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@Icons.Material.Filled.Person" Size="Size.Large" />
|
<MudIcon @onclick="OpenUser" Color="@(User.IsContact? Color.Primary: Color.Secondary)" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
|
||||||
|
|
||||||
<div class="user-card-right-section">
|
<div class="user-card-right-section">
|
||||||
<div class="user-card-title">
|
<div class="user-card-title">
|
||||||
@@ -47,14 +48,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public AnagClie User { get; set; } = new();
|
[Parameter] public ContactDTO User { get; set; } = new();
|
||||||
|
|
||||||
private List<JtbComt>? Commesse { get; set; }
|
private List<JtbComt>? Commesse { get; set; }
|
||||||
private bool IsLoading { get; set; } = true;
|
private bool IsLoading { get; set; } = true;
|
||||||
private bool ShowSectionCommesse { get; set; }
|
private bool ShowSectionCommesse { get; set; }
|
||||||
|
|
||||||
private void OpenUser() =>
|
private void OpenUser() =>
|
||||||
NavigationManager.NavigateTo($"/User/{User.CodAnag}");
|
NavigationManager.NavigateTo($"/User/{User.CodContact}");
|
||||||
|
|
||||||
private async Task ShowCommesse()
|
private async Task ShowCommesse()
|
||||||
{
|
{
|
||||||
@@ -62,7 +63,7 @@
|
|||||||
|
|
||||||
if (ShowSectionCommesse)
|
if (ShowSectionCommesse)
|
||||||
{
|
{
|
||||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodAnag));
|
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodContact));
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
@using System.Text.RegularExpressions
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Dto
|
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Entity
|
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Components.Layout.Overlay
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@@ -10,7 +8,7 @@
|
|||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{UserModel.CodAnag}")"/>
|
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
@@ -19,7 +17,7 @@
|
|||||||
Placeholder="Azienda"
|
Placeholder="Azienda"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.RagSoc"
|
@bind-Value="ContactModel.RagSoc"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||||
@@ -31,7 +29,7 @@
|
|||||||
Placeholder="Partita IVA"
|
Placeholder="Partita IVA"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.PartIva"
|
@bind-Value="ContactModel.PartIva"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||||
@@ -44,7 +42,7 @@
|
|||||||
Placeholder="Indirizzo"
|
Placeholder="Indirizzo"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.Indirizzo"
|
@bind-Value="ContactModel.Indirizzo"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||||
@@ -58,7 +56,7 @@
|
|||||||
Placeholder="CAP"
|
Placeholder="CAP"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.Cap"
|
@bind-Value="ContactModel.Cap"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||||
@@ -72,7 +70,7 @@
|
|||||||
Placeholder="Città"
|
Placeholder="Città"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.Citta"
|
@bind-Value="ContactModel.Citta"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||||
@@ -86,7 +84,7 @@
|
|||||||
Placeholder="Provincia"
|
Placeholder="Provincia"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.Prov"
|
@bind-Value="ContactModel.Prov"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||||
@@ -100,7 +98,7 @@
|
|||||||
Placeholder="Nazione"
|
Placeholder="Nazione"
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
Lines="1"
|
Lines="1"
|
||||||
@bind-Value="UserModel.Nazione"
|
@bind-Value="ContactModel.Nazione"
|
||||||
@bind-Value:after="OnAfterChangeValue"
|
@bind-Value:after="OnAfterChangeValue"
|
||||||
DebounceInterval="500"
|
DebounceInterval="500"
|
||||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||||
@@ -152,15 +150,8 @@
|
|||||||
[Parameter] public string? CodAnag { get; set; }
|
[Parameter] public string? CodAnag { get; set; }
|
||||||
[Parameter] public string? UserType { get; set; }
|
[Parameter] public string? UserType { get; set; }
|
||||||
|
|
||||||
private UserDTO OriginalModel { get; set; } = new();
|
private ContactDTO OriginalModel { get; set; } = new();
|
||||||
private UserDTO UserModel { get; set; } = new();
|
private ContactDTO ContactModel { get; set; } = new();
|
||||||
|
|
||||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
|
||||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
|
||||||
private List<StbUser> Users { get; set; } = [];
|
|
||||||
private List<JtbComt> Commesse { get; set; } = [];
|
|
||||||
private List<AnagClie> Clienti { get; set; } = [];
|
|
||||||
private List<PtbPros> Pros { get; set; } = [];
|
|
||||||
|
|
||||||
private bool IsNew => CodAnag.IsNullOrEmpty();
|
private bool IsNew => CodAnag.IsNullOrEmpty();
|
||||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||||
@@ -199,7 +190,7 @@
|
|||||||
{
|
{
|
||||||
if (!IsNew)
|
if (!IsNew)
|
||||||
{
|
{
|
||||||
LabelSave = !OriginalModel.Equals(UserModel) ? "Aggiorna" : null;
|
LabelSave = !OriginalModel.Equals(ContactModel) ? "Aggiorna" : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
60
salesbook.Shared/Core/Dto/ContactDTO.cs
Normal file
60
salesbook.Shared/Core/Dto/ContactDTO.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class ContactDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("codContact")]
|
||||||
|
public string CodContact { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("isContact")]
|
||||||
|
public bool IsContact { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVtip")]
|
||||||
|
public string? CodVtip { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVage")]
|
||||||
|
public string? CodVage { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ragSoc")]
|
||||||
|
public string RagSoc { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("indirizzo")]
|
||||||
|
public string Indirizzo { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("cap")]
|
||||||
|
public string Cap { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("citta")]
|
||||||
|
public string Citta { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("prov")]
|
||||||
|
public string Prov { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("nazione")]
|
||||||
|
public string Nazione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("telefono")]
|
||||||
|
public string? Telefono { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("fax")]
|
||||||
|
public string Fax { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("partIva")]
|
||||||
|
public string PartIva { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codFisc")]
|
||||||
|
public string CodFisc { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("note")]
|
||||||
|
public string Note { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("personaRif")]
|
||||||
|
public string PersonaRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("eMail")]
|
||||||
|
public string? EMail { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("eMailPec")]
|
||||||
|
public string EMailPec { get; set; }
|
||||||
|
}
|
||||||
@@ -2,4 +2,12 @@
|
|||||||
|
|
||||||
public class FilterUserDTO
|
public class FilterUserDTO
|
||||||
{
|
{
|
||||||
|
public bool ConAgente { get; set; }
|
||||||
|
public bool SenzaAgente { get; set; }
|
||||||
|
public IEnumerable<string>? Agenti { get; set; }
|
||||||
|
|
||||||
|
public string? Indirizzo { get; set; }
|
||||||
|
public string? Citta { get; set; }
|
||||||
|
public string? Nazione { get; set; }
|
||||||
|
public string? Prov { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
namespace salesbook.Shared.Core.Dto;
|
|
||||||
|
|
||||||
public class UserDTO
|
|
||||||
{
|
|
||||||
public string? CodAnag { get; set; }
|
|
||||||
public string? RagSoc { get; set; }
|
|
||||||
public string? Indirizzo { get; set; }
|
|
||||||
public string? Cap { get; set; }
|
|
||||||
public string? Citta { get; set; }
|
|
||||||
public string? Prov { get; set; }
|
|
||||||
public string? Nazione { get; set; }
|
|
||||||
public string? PartIva { get; set; }
|
|
||||||
}
|
|
||||||
@@ -11,4 +11,10 @@ public class StbUser
|
|||||||
|
|
||||||
[Column("full_name"), JsonPropertyName("fullName")]
|
[Column("full_name"), JsonPropertyName("fullName")]
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
|
|
||||||
|
[Column("key_group"), JsonPropertyName("keyGroup")]
|
||||||
|
public int KeyGroup { get; set; }
|
||||||
|
|
||||||
|
[Column("user_code"), JsonPropertyName("userCode")]
|
||||||
|
public string? UserCode { get; set; }
|
||||||
}
|
}
|
||||||
@@ -9,5 +9,15 @@ public class MappingProfile : Profile
|
|||||||
public MappingProfile()
|
public MappingProfile()
|
||||||
{
|
{
|
||||||
CreateMap<StbActivity, ActivityDTO>();
|
CreateMap<StbActivity, ActivityDTO>();
|
||||||
|
|
||||||
|
// Mapping da AnagClie a ContactDTO
|
||||||
|
CreateMap<AnagClie, ContactDTO>()
|
||||||
|
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodAnag))
|
||||||
|
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => true));
|
||||||
|
|
||||||
|
// Mapping da PtbPros a ContactDTO
|
||||||
|
CreateMap<PtbPros, ContactDTO>()
|
||||||
|
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodPpro))
|
||||||
|
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,9 @@ public class ModalHelpers
|
|||||||
|
|
||||||
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, string? codAnag)
|
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, string? codAnag)
|
||||||
{
|
{
|
||||||
var modal = await dialog.ShowAsync<UserForm>(
|
var modal = await dialog.ShowAsync<ContactForm>(
|
||||||
"User form",
|
"User form",
|
||||||
new DialogParameters<UserForm>
|
new DialogParameters<ContactForm>
|
||||||
{
|
{
|
||||||
{ x => x.CodAnag, codAnag }
|
{ x => x.CodAnag, codAnag }
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,9 @@ namespace salesbook.Shared.Core.Interface;
|
|||||||
public interface IManageDataService
|
public interface IManageDataService
|
||||||
{
|
{
|
||||||
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
|
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
|
||||||
|
|
||||||
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
|
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
|
||||||
|
Task<List<ContactDTO>> GetContact();
|
||||||
|
|
||||||
Task InsertOrUpdate<T>(T objectToSave);
|
Task InsertOrUpdate<T>(T objectToSave);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ public class ManageDataService : IManageDataService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<List<ContactDTO>> GetContact()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public Task InsertOrUpdate<T>(T objectToSave)
|
public Task InsertOrUpdate<T>(T objectToSave)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
Reference in New Issue
Block a user