initial commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
@page "/utilities/program-manager"
|
||||
@using Indotalent.Features.Utilities.ProgramManager.Cqrs
|
||||
@using Indotalent.Features.Utilities.ProgramManager.Components
|
||||
@using MudBlazor
|
||||
|
||||
@if (_currentView == ViewMode.Create)
|
||||
{
|
||||
<_ProgramManagerCreateForm OnCancel="BackToTable" OnSuccess="HandleSuccess" />
|
||||
}
|
||||
else if (_currentView == ViewMode.Update || _currentView == ViewMode.View)
|
||||
{
|
||||
<_ProgramManagerUpdateForm Data="_selectedData!" ReadOnly="@(_currentView == ViewMode.View)" OnCancel="BackToTable" OnSuccess="HandleSuccess" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<_ProgramManagerDataTable 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 UpdateProgramManagerRequest? _selectedData;
|
||||
private void ShowCreate() => _currentView = ViewMode.Create;
|
||||
private void ShowUpdate(UpdateProgramManagerRequest 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user