Files
blazor-hrm/Features/Performance/Evaluation/Components/EvaluationPage.razor
T
2026-07-21 14:08:10 +07:00

46 lines
1.3 KiB
Plaintext

@page "/performance/evaluation"
@using Indotalent.Features.Performance.Evaluation.Components
@using Indotalent.Features.Performance.Evaluation.Cqrs
@using MudBlazor
@if (_currentView == ViewMode.Create)
{
<_EvaluationCreateForm OnCancel="BackToTable" OnSuccess="HandleSuccess" />
}
else if (_currentView == ViewMode.Update || _currentView == ViewMode.View)
{
<_EvaluationUpdateForm Data="_selectedData!" ReadOnly="@(_currentView == ViewMode.View)" OnCancel="BackToTable" OnSuccess="HandleSuccess" />
}
else
{
<_EvaluationDataTable OnAdd="() => ShowCreate()" OnEdit="(item) => ShowUpdate(item, false)" OnView="(item) => ShowUpdate(item, true)" />
}
@code {
private enum ViewMode { Table, Create, Update, View }
private ViewMode _currentView = ViewMode.Table;
private UpdateEvaluationRequest? _selectedData;
private void ShowCreate()
{
_currentView = ViewMode.Create;
}
private void ShowUpdate(UpdateEvaluationRequest data, bool isReadOnly)
{
_selectedData = data;
_currentView = isReadOnly ? ViewMode.View : ViewMode.Update;
}
private void BackToTable()
{
_currentView = ViewMode.Table;
_selectedData = null;
}
private void HandleSuccess()
{
_currentView = ViewMode.Table;
_selectedData = null;
}
}