@using Indotalent.Features.Thirdparty.PatientGroup @using Indotalent.Features.Thirdparty.PatientGroup.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject PatientGroupService PatientGroupService @inject ISnackbar Snackbar Add New Patient Group Create a new segment for your patient base. Group Name Description Cancel @if (_processing) { Processing... } else { Create Group } @code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreatePatientGroupValidator _validator = new(); private CreatePatientGroupRequest _model = new(); private bool _processing = false; private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await PatientGroupService.CreatePatientGroupAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Patient group created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } finally { _processing = false; } } }