@using Indotalent.Features.Payroll.Grade @using Indotalent.Features.Payroll.Grade.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject GradeService GradeService @inject ISnackbar Snackbar Add New Grade Set up salary structure and overtime eligibility for a new pay grade. Grade Code Grade Name Salary From (Monthly) Salary To (Monthly) Overtime Eligibility Status Active Inactive Description Cancel @if (_processing) { Processing... } else { Create Grade } @code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreateGradeValidator _validator = new(); private CreateGradeRequest _model = new() { Status = "Active", IsOverTimeEligible = true }; private bool _processing = false; private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await GradeService.CreateGradeAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Grade created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } catch (Exception ex) { Snackbar.Add($"Error: {ex.Message}", Severity.Error); } finally { _processing = false; } } }