@using Indotalent.Features.Payroll.Deduction @using Indotalent.Features.Payroll.Deduction.Cqrs @using Indotalent.Shared.Utils @using MudBlazor @inject DeductionService DeductionService @inject ISnackbar Snackbar Add Deduction Component Define new deduction element for payroll calculation. Component Code Component Name Category Statutory Loan Penalty Internal Tax Treatment Calculation Method Status Active Inactive Description Cancel @if (_processing) { Processing... } else { Create Component } @code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreateDeductionValidator _validator = new(); private CreateDeductionRequest _model = new() { Category = "Statutory", Status = "Active", PreTax = false }; private bool _processing = false; private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { var response = await DeductionService.CreateDeductionAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("Deduction component created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } catch (Exception ex) { Snackbar.Add($"Error: {ex.Message}", Severity.Error); } finally { _processing = false; } } }