initial commit

This commit is contained in:
2026-07-21 14:22:06 +07:00
commit 2d7959f202
572 changed files with 45295 additions and 0 deletions
@@ -0,0 +1,137 @@
@using Indotalent.Features.Organization.Employee
@using Indotalent.Features.Organization.Employee.Cqrs
@using MudBlazor
@inject EmployeeService EmployeeService
@inject ISnackbar Snackbar
<style>
.field-label { font-size: 13px; font-weight: 700; color: #424242; margin-bottom: 4px; display: block; }
.section-header { font-weight: 800; color: #0D47A1; letter-spacing: 0.5px; margin-bottom: 8px; }
</style>
<MudDialog>
<TitleContent>
<MudText Typo="Typo.h6">
<MudIcon Icon="@Icons.Material.Filled.Add" Class="mr-3 mb-n1" />
Add Employee Income
</MudText>
</TitleContent>
<DialogContent>
<MudForm @ref="_form">
<MudStack Spacing="4">
<MudGrid Spacing="3">
<MudItem xs="12"><div class="section-header">INCOME INFORMATION</div><MudDivider /></MudItem>
<MudItem xs="12">
<label class="field-label">Income Component</label>
<MudSelect T="string"
@bind-Value="_model.IncomeId"
Required="true"
Variant="Variant.Outlined"
Margin="Margin.Dense"
Placeholder="Select component"
Dense="true"
AnchorOrigin="Origin.BottomCenter"
TransformOrigin="Origin.TopCenter">
@foreach (var item in _lookupData.Incomes)
{
<MudSelectItem Value="@item.Id">@item.Name (@item.Code)</MudSelectItem>
}
</MudSelect>
</MudItem>
<MudItem xs="12">
<label class="field-label">Amount</label>
<MudNumericField @bind-Value="_model.Amount"
Required="true"
Variant="Variant.Outlined"
Margin="Margin.Dense"
Format="N0"
HideSpinButtons="false"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Payments"
AdornmentColor="Color.Success" />
</MudItem>
<MudItem xs="12">
<label class="field-label">Description</label>
<MudTextField @bind-Value="_model.Description"
Variant="Variant.Outlined"
Margin="Margin.Dense"
Lines="2"
Placeholder="Optional notes..." />
</MudItem>
<MudItem xs="12">
<MudCheckBox @bind-Value="_model.IsActive"
Label="Set as Active Component"
Color="Color.Primary"
Dense="true" />
</MudItem>
</MudGrid>
</MudStack>
</MudForm>
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel" Variant="Variant.Outlined" Style="border: 1px solid #e0e0e0; border-radius: 4px; text-transform: none; font-weight: 700;">Cancel</MudButton>
<MudButton Color="Color.Primary"
Variant="Variant.Filled"
OnClick="Submit"
Disabled="_processing"
Style="border-radius: 4px; text-transform: none; font-weight: 700;">
@if (_processing)
{
<MudProgressCircular Class="ms-n1" Size="Size.Small" Indeterminate="true" />
<MudText Class="ms-2" Typo="Typo.button" Style="text-transform: none !important;">Processing...</MudText>
}
else
{
<MudText>Save Income</MudText>
}
</MudButton>
</DialogActions>
</MudDialog>
@code {
[CascadingParameter] IMudDialogInstance MudDialog { get; set; } = default!;
[Parameter] public string EmployeeId { get; set; } = string.Empty;
private MudForm? _form;
private CreateEmployeeIncomeRequest _model = new() { IsActive = true };
private LookupResponse _lookupData = new();
private bool _processing = false;
protected override async Task OnInitializedAsync()
{
_model.EmployeeId = EmployeeId;
var response = await EmployeeService.GetLookupAsync();
if (response?.IsSuccess == true)
{
_lookupData = response.Value ?? new();
}
}
private async Task Submit()
{
await _form!.Validate();
if (!_form.IsValid) return;
_processing = true;
try
{
var res = await EmployeeService.CreateEmployeeIncomeAsync(_model);
await Task.Delay(500);
if (res?.IsSuccess == true)
{
Snackbar.Add("Income added successfully", Severity.Success);
MudDialog.Close(DialogResult.Ok(true));
}
}
finally
{
_processing = false;
}
}
private void Cancel() => MudDialog.Cancel();
}