@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 Indirizzo CAP Città Provincia Nazione Tipo cliente @* @if (Commesse.IsNullOrEmpty()) { Nessuna commessa presente } else { @foreach (var com in Commesse) { @($"{com.CodJcom} - {com.Descrizione}") } } *@ @if (IsNew) { Persona di riferimento } @code { [CascadingParameter] private IMudDialogInstance MudDialog { get; set; } [Parameter] public ContactDTO? OriginalModel { get; set; } private ContactDTO ContactModel { get; set; } = new(); private bool IsNew => OriginalModel is null; 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() { if (!IsNew) ContactModel = OriginalModel!.Clone(); } private void OnAfterChangeValue() { if (!IsNew) { LabelSave = !OriginalModel.Equals(ContactModel) ? "Aggiorna" : null; } } private void NewPersRif() { } }