66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
@page "/payroll/payrolls"
|
|
@using Indotalent.Features.Payroll.Payrolls
|
|
@using Indotalent.Features.Payroll.Payrolls.Cqrs
|
|
@using MudBlazor
|
|
|
|
@if (_currentView == ViewMode.Table)
|
|
{
|
|
<_PayrollProcessDataTable OnAdd="ShowCalculate"
|
|
OnEdit="ShowUpdate"
|
|
OnView="ShowDetails" />
|
|
}
|
|
else if (_currentView == ViewMode.Calculate)
|
|
{
|
|
<_PayrollCalculateForm OnCancel="BackToTable"
|
|
OnSuccess="HandleSuccess" />
|
|
}
|
|
else if (_currentView == ViewMode.Update && _selectedUpdateData != null)
|
|
{
|
|
<_PayrollUpdateForm Data="_selectedUpdateData"
|
|
OnCancel="BackToTable"
|
|
OnSuccess="HandleSuccess" />
|
|
}
|
|
else if (_currentView == ViewMode.Details && _selectedProcess != null)
|
|
{
|
|
<_PayrollDetailGrid ProcessId="@_selectedProcess.Id"
|
|
PeriodName="@_selectedProcess.PeriodName"
|
|
OnBack="BackToTable" />
|
|
}
|
|
|
|
@code {
|
|
private enum ViewMode { Table, Calculate, Details, Update }
|
|
private ViewMode _currentView = ViewMode.Table;
|
|
private GetPayrollProcessListResponse? _selectedProcess;
|
|
private UpdatePayrollProcessRequest? _selectedUpdateData;
|
|
|
|
private void ShowCalculate()
|
|
{
|
|
_currentView = ViewMode.Calculate;
|
|
}
|
|
|
|
private void ShowUpdate(UpdatePayrollProcessRequest data)
|
|
{
|
|
_selectedUpdateData = data;
|
|
_currentView = ViewMode.Update;
|
|
}
|
|
|
|
private void ShowDetails(GetPayrollProcessListResponse data)
|
|
{
|
|
_selectedProcess = data;
|
|
_currentView = ViewMode.Details;
|
|
}
|
|
|
|
private void BackToTable()
|
|
{
|
|
_currentView = ViewMode.Table;
|
|
_selectedProcess = null;
|
|
_selectedUpdateData = null;
|
|
}
|
|
|
|
private void HandleSuccess()
|
|
{
|
|
_currentView = ViewMode.Table;
|
|
_selectedProcess = null;
|
|
_selectedUpdateData = null;
|
|
}
|
|
} |