|
|
|
|
@@ -1,5 +1,4 @@
|
|
|
|
|
@using System.Globalization
|
|
|
|
|
@using Microsoft.VisualBasic
|
|
|
|
|
@using Template.Shared.Core.Dto
|
|
|
|
|
@using Template.Shared.Components.Layout
|
|
|
|
|
@using Template.Shared.Core.Entity
|
|
|
|
|
@@ -12,22 +11,31 @@
|
|
|
|
|
|
|
|
|
|
<MudDialog Class="customDialog-form">
|
|
|
|
|
<DialogContent>
|
|
|
|
|
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuova" : $"{ActivityModel.ActivityId}")" />
|
|
|
|
|
<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" />
|
|
|
|
|
<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">
|
|
|
|
|
<MudInput ReadOnly="IsView" T="string?" Placeholder="Cliente" @bind-Value="ActivityModel.Cliente" @bind-Value:after="OnAfterChangeValue" />
|
|
|
|
|
<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">
|
|
|
|
|
<MudInput ReadOnly="IsView" T="string?" Placeholder="Commessa" @bind-Value="ActivityModel.Commessa" @bind-Value:after="OnAfterChangeValue" />
|
|
|
|
|
<span class="disable-full-width">Commessa</span>
|
|
|
|
|
|
|
|
|
|
<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.Descrizione</MudSelectItemExtended>
|
|
|
|
|
}
|
|
|
|
|
</MudSelectExtended>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@@ -35,7 +43,7 @@
|
|
|
|
|
<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" />
|
|
|
|
|
<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>
|
|
|
|
|
@@ -43,7 +51,7 @@
|
|
|
|
|
<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" />
|
|
|
|
|
<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>
|
|
|
|
|
@@ -51,7 +59,7 @@
|
|
|
|
|
<div class="form-container">
|
|
|
|
|
<span>Avviso</span>
|
|
|
|
|
|
|
|
|
|
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary" />
|
|
|
|
|
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary"/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@@ -95,15 +103,15 @@
|
|
|
|
|
</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" />
|
|
|
|
|
<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>
|
|
|
|
|
</div>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</MudDialog>
|
|
|
|
|
|
|
|
|
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation" />
|
|
|
|
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
|
|
|
|
|
|
|
|
|
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue" />
|
|
|
|
|
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
|
|
|
|
@@ -116,9 +124,12 @@
|
|
|
|
|
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 => !IsNew && !NetworkService.IsNetworkAvailable();
|
|
|
|
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
|
|
|
|
|
|
|
|
|
private string? LabelSave { get; set; }
|
|
|
|
|
|
|
|
|
|
@@ -160,7 +171,7 @@
|
|
|
|
|
var newActivity = response.Last();
|
|
|
|
|
|
|
|
|
|
await ManageData.InsertOrUpdate(newActivity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SuccessAnimation = true;
|
|
|
|
|
StateHasChanged();
|
|
|
|
|
|
|
|
|
|
@@ -173,9 +184,66 @@
|
|
|
|
|
{
|
|
|
|
|
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"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.RagSoc)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
listToReturn.AddRange(
|
|
|
|
|
Pros.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => x.RagSoc)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return listToReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task OnClienteChanged()
|
|
|
|
|
{
|
|
|
|
|
string? codAnag = 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()
|
|
|
|
|
{
|
|
|
|
|
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
|
|
|
|
|
|