@using Indotalent.Features.Thirdparty.Patient @using Indotalent.Features.Thirdparty.Patient.Cqrs @using MudBlazor @using Features.Root.Shared @inject PatientService PatientService @inject IDialogService DialogService @inject ISnackbar Snackbar
Patient Contacts @if (!ReadOnly) { Add Contact }
Name Title Contact Info Description @if (!ReadOnly) { Actions }
@context.Name @context.AutoNumber
@context.Title
@context.EmailAddress @context.PhoneNumber
@context.Description @if (!ReadOnly) { }
@code { [Parameter] public string PatientId { get; set; } = string.Empty; [Parameter] public List Contacts { get; set; } = new(); [Parameter] public bool ReadOnly { get; set; } = false; [Parameter] public EventCallback OnChanged { get; set; } private async Task OnAddClick() { var parameters = new DialogParameters { ["PatientId"] = PatientId }; var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = await DialogService.ShowAsync<_PatientContactCreateForm>("Add Patient Contact", parameters, options); var result = await dialog.Result; if (result != null && !result.Canceled) await OnChanged.InvokeAsync(); } private async Task OnEditClick(PatientContactItemResponse item) { var parameters = new DialogParameters { ["Data"] = item }; var options = new DialogOptions { MaxWidth = MaxWidth.Small, FullWidth = true, CloseButton = true }; var dialog = await DialogService.ShowAsync<_PatientContactUpdateForm>("Edit Patient Contact", parameters, options); var result = await dialog.Result; if (result != null && !result.Canceled) await OnChanged.InvokeAsync(); } private async Task OnDeleteClick(PatientContactItemResponse item) { var parameters = new DialogParameters { ["ContentText"] = $"Are you sure you want to remove {item.Name} from contacts?" }; var dialog = await DialogService.ShowAsync<_DeleteConfirmation>("Delete Confirmation", parameters, new DialogOptions { MaxWidth = MaxWidth.ExtraSmall, FullWidth = true }); var result = await dialog.Result; if (result != null && !result.Canceled) { var success = await PatientService.DeletePatientContactAsync(item.Id!); if (success) { Snackbar.Add("Contact removed successfully", Severity.Success); await OnChanged.InvokeAsync(); } } } }