201 lines
7.9 KiB
Plaintext
201 lines
7.9 KiB
Plaintext
@using salesbook.Shared.Core.Dto
|
|
@using salesbook.Shared.Components.Layout
|
|
@using salesbook.Shared.Core.Interface
|
|
@using salesbook.Shared.Components.Layout.Overlay
|
|
@inject IManageDataService ManageData
|
|
@inject INetworkService NetworkService
|
|
@inject IIntegryApiService IntegryApiService
|
|
|
|
<MudDialog Class="customDialog-form">
|
|
<DialogContent>
|
|
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
|
|
|
|
<div class="content">
|
|
<div class="input-card">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="Azienda"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.RagSoc"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
|
</div>
|
|
|
|
<div class="input-card">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="Partita IVA"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.PartIva"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
|
</div>
|
|
|
|
<div class="input-card">
|
|
<div class="form-container">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="Indirizzo"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.Indirizzo"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div class="form-container">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="CAP"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.Cap"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div class="form-container">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="Città"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.Citta"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div class="form-container">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="Provincia"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.Prov"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
|
</div>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<div class="form-container">
|
|
<MudTextField ReadOnly="IsView"
|
|
T="string?"
|
|
Placeholder="Nazione"
|
|
Variant="Variant.Text"
|
|
Lines="1"
|
|
@bind-Value="ContactModel.Nazione"
|
|
@bind-Value:after="OnAfterChangeValue"
|
|
DebounceInterval="500"
|
|
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="input-card">
|
|
<div class="form-container">
|
|
<span class="disable-full-width">Tipo cliente</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="UserModel.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>
|
|
|
|
@if (IsNew)
|
|
{
|
|
<div class="container-button">
|
|
<MudButton Class="button-settings gray-icon"
|
|
FullWidth="true"
|
|
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
|
Size="Size.Medium"
|
|
OnClick="NewPersRif"
|
|
Variant="Variant.Outlined">
|
|
Persona di riferimento
|
|
</MudButton>
|
|
</div>
|
|
}
|
|
</div>
|
|
</DialogContent>
|
|
</MudDialog>
|
|
|
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
|
|
|
@code {
|
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
|
|
|
[Parameter] public string? CodAnag { get; set; }
|
|
[Parameter] public string? UserType { get; set; }
|
|
|
|
private ContactDTO OriginalModel { get; set; } = new();
|
|
private ContactDTO ContactModel { get; set; } = new();
|
|
|
|
private bool IsNew => CodAnag.IsNullOrEmpty();
|
|
private bool IsView => !NetworkService.IsNetworkAvailable();
|
|
|
|
private string? LabelSave { get; set; }
|
|
|
|
//Overlay for save
|
|
private bool VisibleOverlay { get; set; }
|
|
private bool SuccessAnimation { get; set; }
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
|
|
|
_ = LoadData();
|
|
|
|
LabelSave = IsNew ? "Aggiungi" : null;
|
|
}
|
|
|
|
private async Task Save()
|
|
{
|
|
SuccessAnimation = true;
|
|
StateHasChanged();
|
|
|
|
await Task.Delay(1250);
|
|
|
|
MudDialog.Close();
|
|
}
|
|
|
|
private async Task LoadData()
|
|
{
|
|
|
|
}
|
|
|
|
private void OnAfterChangeValue()
|
|
{
|
|
if (!IsNew)
|
|
{
|
|
LabelSave = !OriginalModel.Equals(ContactModel) ? "Aggiorna" : null;
|
|
}
|
|
}
|
|
|
|
private void NewPersRif()
|
|
{
|
|
|
|
}
|
|
} |