@using Indotalent.Features.Thirdparty.CustomerGroup @using Indotalent.Features.Thirdparty.CustomerGroup.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject CustomerGroupService CustomerGroupService @inject ISnackbar Snackbar Add New Customer Group Create a new segment for your customer 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 CreateCustomerGroupValidator _validator = new(); private CreateCustomerGroupRequest _model = new(); private bool _processing = false; private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await CustomerGroupService.CreateCustomerGroupAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Customer group created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } finally { _processing = false; } } }