Rename salesbook
This commit is contained in:
@@ -0,0 +1,151 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Filtri</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Filter.Text" DebounceInterval="500"/>
|
||||
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Filter.Text = null"/>
|
||||
</div>
|
||||
|
||||
<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="Filter.User"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.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 class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Result"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Categoria</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="ActivityCategoryEnum?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.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>
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton OnClick="() => Filter = new FilterActivityDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
[Parameter] public FilterActivityDTO Filter { get; set; }
|
||||
[Parameter] public EventCallback<FilterActivityDTO> FilterChanged { get; set; }
|
||||
|
||||
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()
|
||||
{
|
||||
if (IsSheetVisible)
|
||||
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;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
{
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
}
|
||||
|
||||
private void OnFilterButton()
|
||||
{
|
||||
FilterChanged.InvokeAsync(Filter);
|
||||
CloseBottomSheet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Filtri</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Filter.Text" DebounceInterval="500"/>
|
||||
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Filter.Text = null"/>
|
||||
</div>
|
||||
|
||||
<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="Filter.User"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.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 class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Result"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Categoria</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="ActivityCategoryEnum?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.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>
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton OnClick="() => Filter = new FilterActivityDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
[Parameter] public FilterActivityDTO Filter { get; set; }
|
||||
[Parameter] public EventCallback<FilterActivityDTO> FilterChanged { get; set; }
|
||||
|
||||
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()
|
||||
{
|
||||
if (IsSheetVisible)
|
||||
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;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
{
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
}
|
||||
|
||||
private void OnFilterButton()
|
||||
{
|
||||
FilterChanged.InvokeAsync(Filter);
|
||||
CloseBottomSheet();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Esito</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span>Data effettiva</span>
|
||||
|
||||
<MudTextField T="DateTime?" Format="yyyy-MM-dd" InputType="InputType.Date" @bind-Value="EffectiveDate" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Inizio</span>
|
||||
|
||||
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveTime" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Fine</span>
|
||||
|
||||
<MudTextField T="TimeSpan" InputType="InputType.Time" @bind-Value="EffectiveEndTime" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityResultId" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField T="string?" Placeholder="Descrizione esito" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.ResultDescription" />
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="CloseBottomSheet">Salva</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
[Parameter] public ActivityDTO ActivityModel { get; set; }
|
||||
[Parameter] public EventCallback<ActivityDTO> ActivityModelChanged { get; set; }
|
||||
|
||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
||||
|
||||
private DateTime? EffectiveDate { get; set; } = DateTime.Today;
|
||||
|
||||
private TimeSpan EffectiveTime { get; set; }
|
||||
private TimeSpan EffectiveEndTime { get; set; }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (IsSheetVisible)
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
|
||||
EffectiveTime = ActivityModel.EffectiveTime?.TimeOfDay ?? TimeSpan.Zero;
|
||||
EffectiveEndTime = ActivityModel.EffectiveEndtime?.TimeOfDay ?? TimeSpan.Zero;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
{
|
||||
if (EffectiveDate != null)
|
||||
{
|
||||
ActivityModel.EffectiveTime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
|
||||
EffectiveTime.Hours, EffectiveTime.Minutes, EffectiveTime.Seconds);
|
||||
|
||||
ActivityModel.EffectiveEndtime = new DateTime(EffectiveDate!.Value.Year, EffectiveDate!.Value.Month, EffectiveDate!.Value.Day,
|
||||
EffectiveEndTime.Hours, EffectiveEndTime.Minutes, EffectiveEndTime.Seconds);
|
||||
}
|
||||
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
ActivityModelChanged.InvokeAsync(ActivityModel);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="activity-card @Activity.Category.ConvertToHumanReadable()" @onclick="OpenActivity">
|
||||
<div class="activity-left-section">
|
||||
<div class="activity-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="activity-title" Typo="Typo.body1" HtmlTag="h3">
|
||||
@switch (Activity.Category)
|
||||
{
|
||||
case ActivityCategoryEnum.Commessa:
|
||||
@Activity.Commessa
|
||||
break;
|
||||
case ActivityCategoryEnum.Interna:
|
||||
@Activity.Cliente
|
||||
break;
|
||||
case ActivityCategoryEnum.Memo:
|
||||
@Activity.ActivityDescription
|
||||
break;
|
||||
default:
|
||||
@("")
|
||||
break;
|
||||
}
|
||||
</MudText>
|
||||
<div class="activity-hours-section">
|
||||
<span class="activity-hours">
|
||||
@if (Activity.EffectiveTime is null)
|
||||
{
|
||||
@($"{Activity.EstimatedTime:t}")
|
||||
}
|
||||
else
|
||||
{
|
||||
@($"{Activity.EffectiveTime:t}")
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@if (Activity.Category != ActivityCategoryEnum.Memo)
|
||||
{
|
||||
<MudText Class="activity-subtitle" Typo="Typo.body1" HtmlTag="p">@Activity.ActivityDescription</MudText>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="activity-info-section">
|
||||
@if (Durata != null && (Durata.Value.TotalHours > 0 || Durata.Value.Minutes > 0))
|
||||
{
|
||||
var ore = (int)Durata.Value.TotalHours;
|
||||
var minuti = Durata.Value.Minutes;
|
||||
|
||||
<MudChip T="string" Icon="@IconConstants.Chip.Time" Color="Color.Dark" Size="Size.Small">
|
||||
@(ore > 0 ? $"{ore}h{(minuti > 0 ? $" {minuti}m" : "")}" : $"{minuti}m")
|
||||
</MudChip>
|
||||
}
|
||||
@if (Activity.ActivityResultId != null)
|
||||
{
|
||||
<MudChip T="string" Icon="@IconConstants.Chip.Stato" Size="Size.Small" Color="Color.Success">@Activity.ActivityResultId</MudChip>
|
||||
}
|
||||
<MudChip T="string" Icon="@IconConstants.Chip.User" Size="Size.Small">@Activity.UserName</MudChip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public ActivityDTO Activity { get; set; } = new();
|
||||
[Parameter] public EventCallback<string> ActivityChanged { get; set; }
|
||||
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
|
||||
|
||||
private TimeSpan? Durata { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Durata = Activity switch
|
||||
{
|
||||
{ EffectiveTime: not null, EffectiveEndtime: not null } => Activity.EffectiveEndtime.Value - Activity.EffectiveTime.Value,
|
||||
{ EstimatedTime: not null, EstimatedEndtime: not null } => Activity.EstimatedEndtime.Value - Activity.EstimatedTime.Value,
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
private async Task OpenActivity()
|
||||
{
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, null, Activity.ActivityId);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case { Canceled: false, Data: not null } when result.Data.GetType() == typeof(StbActivity):
|
||||
await ActivityChanged.InvokeAsync(((StbActivity)result.Data).ActivityId);
|
||||
break;
|
||||
case { Canceled: false, Data: not null } when result.Data.GetType() == typeof(ActivityDTO):
|
||||
await ActivityDeleted.InvokeAsync((ActivityDTO)result.Data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
.activity-card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: .5rem .5rem;
|
||||
border-radius: 12px;
|
||||
line-height: normal;
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
}
|
||||
|
||||
.activity-card.memo { border-left: 5px solid var(--mud-palette-info-darken); }
|
||||
|
||||
.activity-card.interna { border-left: 5px solid var(--mud-palette-success-darken); }
|
||||
|
||||
.activity-card.commessa { border-left: 5px solid var(--mud-palette-warning); }
|
||||
|
||||
.activity-left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activity-hours {
|
||||
font-weight: 700;
|
||||
color: var(--mud-palette-text-primary);
|
||||
}
|
||||
|
||||
.activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
||||
|
||||
.activity-body-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title-section ::deep > .activity-title {
|
||||
font-weight: 800 !important;
|
||||
margin: 0 !important;
|
||||
line-height: normal !important;
|
||||
color: var(--mud-palette-text-primary);
|
||||
}
|
||||
|
||||
.activity-body-section ::deep > .activity-subtitle {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
margin: .2rem 0 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.activity-info-section {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
@using salesbook.Shared.Core.Entity
|
||||
|
||||
<div class="contact-card">
|
||||
<div class="contact-left-section">
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large" />
|
||||
|
||||
<div class="contact-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="contact-title" Typo="Typo.body1" HtmlTag="h3">@UtilityString.FormatString(Contact.PersonaRif).TitleCase</MudText>
|
||||
</div>
|
||||
|
||||
@if (Contact.Mansione is not null)
|
||||
{
|
||||
<MudText Class="contact-subtitle" Typo="Typo.body1" HtmlTag="p">@UtilityString.FormatString(Contact.Mansione).SentenceCase</MudText>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-right-section">
|
||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||
{
|
||||
<MudIcon 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" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
.contact-card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 0 .75rem;
|
||||
border-radius: 16px;
|
||||
line-height: normal;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.contact-card.memo { border-left: 5px solid var(--mud-palette-info-darken); }
|
||||
|
||||
.contact-card.interna { border-left: 5px solid var(--mud-palette-success-darken); }
|
||||
|
||||
.contact-card.commessa { border-left: 5px solid var(--mud-palette-warning); }
|
||||
|
||||
.contact-left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.contact-hours { font-weight: 700; }
|
||||
|
||||
.contact-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
||||
|
||||
.contact-body-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title-section ::deep > .contact-title {
|
||||
font-weight: 700 !important;
|
||||
margin: 0 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.contact-body-section ::deep > .contact-subtitle {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
margin: .2rem 0 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.contact-info-section {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.contact-right-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
|
||||
<div class="user-card-card">
|
||||
<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" />
|
||||
|
||||
<div class="user-card-right-section">
|
||||
<div class="user-card-title">
|
||||
<MudText Typo="Typo.body1" @onclick="OpenUser" HtmlTag="h3">@User.RagSoc</MudText>
|
||||
<MudIcon @onclick="ShowCommesse" Color="Color.Info" Icon="@Icons.Material.Outlined.Info" Size="Size.Medium"/>
|
||||
</div>
|
||||
|
||||
<div class="user-card-subtitle @(ShowSectionCommesse ? "show" : "")">
|
||||
@if (ShowSectionCommesse && IsLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!Commesse.IsNullOrEmpty())
|
||||
{
|
||||
<div @onclick="OpenUser" class="container-commesse">
|
||||
@foreach (var commessa in Commesse!)
|
||||
{
|
||||
<div class="commessa">
|
||||
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="commessa">
|
||||
<span>Nessuna commessa presente</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public AnagClie 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}");
|
||||
|
||||
private async Task ShowCommesse()
|
||||
{
|
||||
ShowSectionCommesse = !ShowSectionCommesse;
|
||||
|
||||
if (ShowSectionCommesse)
|
||||
{
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodAnag));
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
IsLoading = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
.user-card-card { width: 100%; }
|
||||
|
||||
.user-card-card.memo { border-left: 5px solid var(--mud-palette-info-darken); }
|
||||
|
||||
.user-card-card.interna { border-left: 5px solid var(--mud-palette-success-darken); }
|
||||
|
||||
.user-card-card.commessa { border-left: 5px solid var(--mud-palette-warning); }
|
||||
|
||||
.user-card-left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
gap: .75rem;
|
||||
}
|
||||
|
||||
.user-card-hours { font-weight: 700; }
|
||||
|
||||
.user-card-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
||||
|
||||
.user-card-body-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.user-card-right-section {
|
||||
width: 100%;
|
||||
border-bottom: 1px solid var(--card-border-color);
|
||||
}
|
||||
|
||||
.user-card-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 32px;
|
||||
padding-left: .25rem;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.user-card-title ::deep > h3 {
|
||||
font-weight: 700 !important;
|
||||
margin: 0 !important;
|
||||
line-height: normal !important;
|
||||
font-size: .85rem;
|
||||
}
|
||||
|
||||
.user-card-body-section ::deep > .user-card-subtitle {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
margin: .2rem 0 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.user-card-info-section {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.title-section ::deep > .mud-icon-root {
|
||||
background: var(--mud-palette-gray-lighter);
|
||||
padding: .25rem;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.user-card-subtitle {
|
||||
overflow: hidden;
|
||||
max-height: 0;
|
||||
opacity: 0;
|
||||
transition: max-height 0.4s ease, opacity 0.4s ease;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.user-card-subtitle.show {
|
||||
max-height: 250px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.container-commesse {
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
.commessa {
|
||||
color: var(--mud-palette-text-secondary);
|
||||
font-weight: 700;
|
||||
font-size: small;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<div class="container container-modal">
|
||||
<div class="c-modal">
|
||||
<div class="exception-header mb-2">
|
||||
<i class="ri-emotion-unhappy-line"></i>
|
||||
<span>Ops</span>
|
||||
</div>
|
||||
<div class="text">
|
||||
@if (Exception != null)
|
||||
{
|
||||
<code>@Message</code>
|
||||
}
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<div @onclick="OnRetryClick" class="card-button">
|
||||
<span>Riprova</span>
|
||||
</div>
|
||||
|
||||
<div @onclick="OnContinueClick" class="card-button">
|
||||
<span>Continua</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public Exception? Exception { get; set; }
|
||||
[Parameter] public EventCallback OnRetry { get; set; }
|
||||
[Parameter] public ErrorBoundary? ErrorBoundary { get; set; }
|
||||
|
||||
private string Message { get; set; } = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (Exception == null) return;
|
||||
|
||||
if (Exception.Message.Contains("Failed to connect to"))
|
||||
{
|
||||
var ipPort = Exception.Message.Split("to /")[1];
|
||||
|
||||
Message = $"Impossibile collegarsi al server ({ipPort})";
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = Exception.Message;
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnRetryClick()
|
||||
{
|
||||
await OnRetry.InvokeAsync();
|
||||
}
|
||||
|
||||
private async Task OnContinueClick()
|
||||
{
|
||||
NavigationManager.NavigateTo("/");
|
||||
await OnRetry.InvokeAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
.container-modal {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.c-modal {
|
||||
border-radius: 16px;
|
||||
box-shadow: var(--exception-box-shadow);
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.button-container {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
margin: 1.5rem 0 0 0;
|
||||
}
|
||||
|
||||
.text {
|
||||
font-size: medium;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card-button {
|
||||
text-align: center;
|
||||
background-color: transparent;
|
||||
padding: .3rem 1rem;
|
||||
font-weight: 700;
|
||||
color: var(--bs-primary-text-emphasis);
|
||||
}
|
||||
|
||||
.exception-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.exception-header > i {
|
||||
font-size: 3rem;
|
||||
line-height: normal;
|
||||
color: var(--bs-danger);
|
||||
}
|
||||
|
||||
.exception-header > span {
|
||||
font-size: x-large;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
code {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
color: var(--bs-gray-dark);
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
@using System.Globalization
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@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
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||
@inject IManageDataService ManageData
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IMessenger Messenger
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuova" : $"{ActivityModel.ActivityId}")"/>
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Descrizione" Variant="Variant.Text" Lines="3" @bind-Value="ActivityModel.ActivityDescription" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<MudAutocomplete ReadOnly="IsView" T="string?" Placeholder="Cliente"
|
||||
SearchFunc="@SearchCliente" @bind-Value="ActivityModel.Cliente" @bind-Value:after="OnClienteChanged"
|
||||
CoerceValue="true"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Commessa</span>
|
||||
|
||||
@if (Commesse.IsNullOrEmpty())
|
||||
{
|
||||
<span class="warning-text">Nessuna commessa presente</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Commesse.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.CodJcom" @bind-Value:after="OnCommessaChanged" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var com in Commesse)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@com.CodJcom">@($"{com.CodJcom} - {com.Descrizione}")</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span>Inizio</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedTime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Fine</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedEndtime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Avviso</span>
|
||||
|
||||
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Assegnata a</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="IsView" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.UserName" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var user in Users)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserName">@user.FullName</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityTypeId" @bind-Value:after="OnAfterChangeValue" 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 class="divider"></div>
|
||||
|
||||
<div class="form-container" @onclick="OpenSelectEsito">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended ReadOnly="true" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityResultId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.Note" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
@if (!IsNew)
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings gray-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.ContentCopy"
|
||||
Size="Size.Medium"
|
||||
OnClick="Duplica"
|
||||
Variant="Variant.Outlined">
|
||||
Duplica
|
||||
</MudButton>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<MudButton Class="button-settings red-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Delete"
|
||||
Size="Size.Medium"
|
||||
OnClick="DeleteActivity"
|
||||
Variant="Variant.Outlined">
|
||||
Elimina
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||
<MessageContent>
|
||||
Confermi la cancellazione dell'attività corrente?
|
||||
</MessageContent>
|
||||
<YesButton>
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||
StartIcon="@Icons.Material.Filled.DeleteForever">
|
||||
Cancella
|
||||
</MudButton>
|
||||
</YesButton>
|
||||
</MudMessageBox>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public string? Id { get; set; }
|
||||
[Parameter] public ActivityDTO? ActivityCopied { get; set; }
|
||||
|
||||
private ActivityDTO OriginalModel { get; set; } = new();
|
||||
private ActivityDTO ActivityModel { 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 => Id.IsNullOrEmpty();
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private bool OpenEsito { get; set; } = false;
|
||||
|
||||
private MudMessageBox ConfirmDelete { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
|
||||
if (!Id.IsNullOrEmpty())
|
||||
ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last();
|
||||
|
||||
if (ActivityCopied != null)
|
||||
{
|
||||
ActivityModel = ActivityCopied.Clone();
|
||||
}
|
||||
|
||||
if (IsNew)
|
||||
{
|
||||
ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour));
|
||||
ActivityModel.EstimatedEndtime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour) + TimeSpan.FromHours(1));
|
||||
ActivityModel.UserName = UserSession.User.Username;
|
||||
}
|
||||
|
||||
OriginalModel = ActivityModel.Clone();
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
if (!CheckPreSave()) return;
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
||||
|
||||
if (response == null)
|
||||
return;
|
||||
|
||||
var newActivity = response.Last();
|
||||
|
||||
await ManageData.InsertOrUpdate(newActivity);
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(newActivity);
|
||||
}
|
||||
|
||||
private bool CheckPreSave()
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
|
||||
Snackbar.Add("Tipo attività obbligatorio!", Severity.Error);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
Pros = await ManageData.GetTable<PtbPros>();
|
||||
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
await LoadCommesse();
|
||||
}
|
||||
|
||||
private async Task LoadCommesse() =>
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(ActivityModel.CodAnag));
|
||||
|
||||
private async Task<IEnumerable<string>?> SearchCliente(string value, CancellationToken token)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return null;
|
||||
|
||||
var listToReturn = new List<string>();
|
||||
|
||||
listToReturn.AddRange(
|
||||
Clienti.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => $"{x.CodAnag} - {x.RagSoc}")
|
||||
);
|
||||
|
||||
listToReturn.AddRange(
|
||||
Pros.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => $"{x.CodPpro} - {x.RagSoc}")
|
||||
);
|
||||
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
private async Task OnClienteChanged()
|
||||
{
|
||||
string? codAnag = null;
|
||||
ActivityModel.CodJcom = null;
|
||||
|
||||
var cliente = Clienti.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
|
||||
if (cliente is null)
|
||||
{
|
||||
var pros = Pros.LastOrDefault(x => ActivityModel.Cliente != null && x.RagSoc.Contains(ActivityModel.Cliente, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (pros is not null)
|
||||
{
|
||||
codAnag = pros.CodAnag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
codAnag = cliente.CodAnag;
|
||||
}
|
||||
|
||||
|
||||
if (codAnag is not null)
|
||||
{
|
||||
ActivityModel.CodAnag = codAnag;
|
||||
await LoadCommesse();
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnCommessaChanged()
|
||||
{
|
||||
ActivityModel.Commessa = (await ManageData.GetTable<JtbComt>(x => x.CodJcom.Equals(ActivityModel.CodJcom))).Last().Descrizione;
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenSelectEsito()
|
||||
{
|
||||
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username))) return;
|
||||
|
||||
OpenEsito = !OpenEsito;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task DeleteActivity()
|
||||
{
|
||||
var result = await ConfirmDelete.ShowAsync();
|
||||
|
||||
if (result is true)
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
try
|
||||
{
|
||||
await IntegryApiService.DeleteActivity(ActivityModel.ActivityId);
|
||||
ActivityModel.Deleted = true;
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(ActivityModel);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
Snackbar.Add("Impossibile cancellare l'attività", Severity.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Duplica()
|
||||
{
|
||||
var activityCopy = ActivityModel.Clone();
|
||||
|
||||
MudDialog.Cancel();
|
||||
Messenger.Send(new CopyActivityMessage(activityCopy));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
.container-button {
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="no-data opacity-75 d-flex flex-column align-items-center">
|
||||
<img src="@ImageSource"/>
|
||||
|
||||
<p class="mt-3">@Text</p>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string ImageSource { get; set; } = string.Empty;
|
||||
[Parameter] public string Text { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
.no-data { margin-top: 2rem; }
|
||||
|
||||
.no-data img { width: 60%; }
|
||||
|
||||
.no-data p { font-size: 1.2rem; }
|
||||
Reference in New Issue
Block a user