@using Indotalent.Features.Utilities.BookingGroup @using Indotalent.Features.Utilities.BookingGroup.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject BookingGroupService BookingGroupService @inject ISnackbar Snackbar Add New Booking Group Enter details for the new booking group classification. Group Name Description Cancel @if (_processing) { Processing... } else { Create Booking Group } @code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreateBookingGroupValidator _validator = new(); private CreateBookingGroupRequest _model = new(); private bool _processing = false; private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await BookingGroupService.CreateBookingGroupAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Booking group created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } catch (Exception ex) { Snackbar.Add($"Error: {ex.Message}", Severity.Error); } finally { _processing = false; } } }