@using Indotalent.Features.Thirdparty.PatientContact @using Indotalent.Features.Thirdparty.PatientContact.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject PatientContactService PatientContactService @inject ISnackbar Snackbar
Add New Contact Register a new contact person for your patients.
Contact Information Contact Name Patient @foreach (var item in _lookupData.Patients) { @item.Name } Title Phone Number Email Address Description / Notes
Cancel @if (_processing) { Processing... } else { Create Contact }
@code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreatePatientContactValidator _validator = new(); private CreatePatientContactRequest _model = new(); private LookupPatientContactResponse _lookupData = new(); private bool _processing = false; protected override async Task OnInitializedAsync() { var response = await PatientContactService.GetPatientContactLookupAsync(); if (response != null && response.IsSuccess) { _lookupData = response.Value!; } } private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await PatientContactService.CreatePatientContactAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Contact created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } finally { _processing = false; } } }