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() =>
|
||||
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)
|
||||
{
|
||||
var activities = await localDb.Get(whereCond);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using AutoMapper;
|
||||
using CommunityToolkit.Maui;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using IntegryApiClient.MAUI;
|
||||
|
||||
@@ -2,26 +2,40 @@
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@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
|
||||
|
||||
<HeaderLayout Title="Contatti" ShowFilter="true" OnFilterToggle="ToggleFilter" />
|
||||
<HeaderLayout Title="Contatti"/>
|
||||
|
||||
<div class="container search-box">
|
||||
<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())
|
||||
{
|
||||
<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>
|
||||
|
||||
<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 class="container users">
|
||||
@if (GroupedUserList?.Count > 0)
|
||||
@if (IsLoading)
|
||||
{
|
||||
<SpinnerLayout FullScreen="false"/>
|
||||
}
|
||||
else if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
||||
@if (item.ShowHeader)
|
||||
@@ -31,31 +45,45 @@
|
||||
<UserCard User="item.User"/>
|
||||
</Virtualize>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessun contatto trovato"/>
|
||||
}
|
||||
</div>
|
||||
|
||||
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
|
||||
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="FilterUsers"/>
|
||||
|
||||
@code {
|
||||
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
||||
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
||||
private string? TextToFilter { get; set; }
|
||||
|
||||
private bool IsLoading { get; set; }
|
||||
|
||||
//Filtri
|
||||
private string? TextToFilter { get; set; }
|
||||
private bool OpenFilter { get; set; }
|
||||
private FilterUserDTO Filter { get; set; } = new();
|
||||
private string TypeUser { get; set; } = "all";
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadData();
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||
@@ -88,11 +116,14 @@
|
||||
}
|
||||
|
||||
FilterUsers();
|
||||
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private class UserDisplayItem
|
||||
{
|
||||
public required AnagClie User { get; set; }
|
||||
public required ContactDTO User { get; set; }
|
||||
public bool ShowHeader { get; set; }
|
||||
public string? HeaderLetter { get; set; }
|
||||
}
|
||||
@@ -104,23 +135,49 @@
|
||||
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
||||
{
|
||||
TextToFilter = null;
|
||||
FilteredGroupedUserList = GroupedUserList;
|
||||
return;
|
||||
}
|
||||
|
||||
var filter = TextToFilter.Trim();
|
||||
var result = new List<UserDisplayItem>();
|
||||
|
||||
foreach (var item in GroupedUserList)
|
||||
{
|
||||
var user = item.User;
|
||||
if (
|
||||
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.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.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase))
|
||||
)
|
||||
|
||||
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.Indirizzo) && user.Indirizzo.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.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (matchesText)
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
@@ -135,9 +192,4 @@
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void ApplyFilter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,6 +28,6 @@
|
||||
padding-bottom: .5rem;
|
||||
}
|
||||
|
||||
.search-box .input-card {
|
||||
margin: 0 !important;
|
||||
}
|
||||
.search-box .input-card { 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.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
@@ -17,76 +17,74 @@
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Assegnata a</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"/>
|
||||
<span class="disable-full-width">Con agente</span>
|
||||
|
||||
<MudCheckBox @bind-Value="Filter.ConAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeAgente"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
<span class="disable-full-width">Senza agente</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
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>
|
||||
<MudCheckBox @bind-Value="Filter.SenzaAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeAgente"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
<span class="disable-full-width">Agente</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="FilterActivity.Result"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
|
||||
@bind-SelectedValues="Filter.Agenti" @bind-SelectedValues:after="OnAfterChangeAgenti"
|
||||
MultiSelection="true" MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionAgente))"
|
||||
SelectAllPosition="SelectAllPosition.NextToSearchBox" SelectAll="true"
|
||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var user in Users)
|
||||
{
|
||||
<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>
|
||||
</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="form-container">
|
||||
<span class="disable-full-width">Categoria</span>
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Città"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Citta"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="ActivityCategoryEnum?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="FilterActivity.Category"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var category in CategoryList)
|
||||
{
|
||||
<MudSelectItemExtended T="ActivityCategoryEnum?" Class="custom-item-select" Value="@category">@category.ConvertToHumanReadable()</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<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>
|
||||
|
||||
@@ -104,12 +102,7 @@
|
||||
[Parameter] public FilterUserDTO Filter { 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<ActivityCategoryEnum> CategoryList { get; set; } = [];
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
@@ -117,19 +110,14 @@
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private string GetMultiSelectionUser(List<string> selectedValues)
|
||||
{
|
||||
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Users = await manageData.GetTable<StbUser>();
|
||||
ActivityResult = await manageData.GetTable<StbActivityResult>();
|
||||
ActivityType = await manageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
CategoryList = ActivityCategoryHelper.AllActivityCategory;
|
||||
Users = await manageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
private string GetMultiSelectionAgente(List<string> selectedValues)
|
||||
{
|
||||
return $"{selectedValues.Count} Agent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
@@ -144,4 +132,24 @@
|
||||
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">
|
||||
@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()){
|
||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
||||
@if (!Contact.EMail.IsNullOrEmpty())
|
||||
{
|
||||
<MudIconButton Href="@($"mailto:{Contact.EMail}")" Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
@@ -6,7 +7,7 @@
|
||||
<div class="user-card-left-section">
|
||||
<div class="user-card-body-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-title">
|
||||
@@ -47,14 +48,14 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public AnagClie User { get; set; } = new();
|
||||
[Parameter] public ContactDTO User { get; set; } = new();
|
||||
|
||||
private List<JtbComt>? Commesse { get; set; }
|
||||
private bool IsLoading { get; set; } = true;
|
||||
private bool ShowSectionCommesse { get; set; }
|
||||
|
||||
private void OpenUser() =>
|
||||
NavigationManager.NavigateTo($"/User/{User.CodAnag}");
|
||||
NavigationManager.NavigateTo($"/User/{User.CodContact}");
|
||||
|
||||
private async Task ShowCommesse()
|
||||
{
|
||||
@@ -62,7 +63,7 @@
|
||||
|
||||
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;
|
||||
StateHasChanged();
|
||||
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.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@inject IManageDataService ManageData
|
||||
@@ -10,7 +8,7 @@
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<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="input-card">
|
||||
@@ -19,7 +17,7 @@
|
||||
Placeholder="Azienda"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.RagSoc"
|
||||
@bind-Value="ContactModel.RagSoc"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
@@ -31,7 +29,7 @@
|
||||
Placeholder="Partita IVA"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.PartIva"
|
||||
@bind-Value="ContactModel.PartIva"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
@@ -44,7 +42,7 @@
|
||||
Placeholder="Indirizzo"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.Indirizzo"
|
||||
@bind-Value="ContactModel.Indirizzo"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
@@ -58,7 +56,7 @@
|
||||
Placeholder="CAP"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.Cap"
|
||||
@bind-Value="ContactModel.Cap"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
@@ -72,7 +70,7 @@
|
||||
Placeholder="Città"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.Citta"
|
||||
@bind-Value="ContactModel.Citta"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
@@ -86,7 +84,7 @@
|
||||
Placeholder="Provincia"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.Prov"
|
||||
@bind-Value="ContactModel.Prov"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
@@ -100,7 +98,7 @@
|
||||
Placeholder="Nazione"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="UserModel.Nazione"
|
||||
@bind-Value="ContactModel.Nazione"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
@@ -152,15 +150,8 @@
|
||||
[Parameter] public string? CodAnag { get; set; }
|
||||
[Parameter] public string? UserType { get; set; }
|
||||
|
||||
private UserDTO OriginalModel { get; set; } = new();
|
||||
private UserDTO UserModel { 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 ContactDTO OriginalModel { get; set; } = new();
|
||||
private ContactDTO ContactModel { get; set; } = new();
|
||||
|
||||
private bool IsNew => CodAnag.IsNullOrEmpty();
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
@@ -199,7 +190,7 @@
|
||||
{
|
||||
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 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")]
|
||||
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()
|
||||
{
|
||||
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)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<UserForm>(
|
||||
var modal = await dialog.ShowAsync<ContactForm>(
|
||||
"User form",
|
||||
new DialogParameters<UserForm>
|
||||
new DialogParameters<ContactForm>
|
||||
{
|
||||
{ x => x.CodAnag, codAnag }
|
||||
},
|
||||
|
||||
@@ -7,7 +7,9 @@ namespace salesbook.Shared.Core.Interface;
|
||||
public interface IManageDataService
|
||||
{
|
||||
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<ContactDTO>> GetContact();
|
||||
|
||||
Task InsertOrUpdate<T>(T objectToSave);
|
||||
|
||||
|
||||
@@ -17,6 +17,11 @@ public class ManageDataService : IManageDataService
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<ContactDTO>> GetContact()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(T objectToSave)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
Reference in New Issue
Block a user