77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
/*
|
||
* File: AdminMenu.cpp
|
||
* Description: Handles user-related operations such as creation, authentication, and validation.
|
||
* Author: Trenser
|
||
* Created: 02-Apr-2026
|
||
*/
|
||
|
||
#include <iostream>
|
||
#include "AdminMenu.h"
|
||
#include"InputHelper.h"
|
||
#include"OutputHelper.h"
|
||
|
||
/*
|
||
* Function: AdminMenu::run
|
||
* Description: Starts and manages the administrator menu loop. Continuously displays
|
||
* options to the administrator until logout is selected or an exception occurs.
|
||
* Parameters:
|
||
* None
|
||
* Returns:
|
||
* None
|
||
*/
|
||
void AdminMenu::run()
|
||
{
|
||
bool isMenuActive = true;
|
||
while (isMenuActive)
|
||
{
|
||
try
|
||
{
|
||
int choice;
|
||
util::clear();
|
||
std::cout << "Zenvy - HR Management System\n1. Create HRManager\n2. Create Employee\n3. View Employee\n4. Deactivate Employee\n5. Logout\nEnter your Choice: ";
|
||
util::read(choice);
|
||
if (!handleOperation(choice))
|
||
{
|
||
isMenuActive = false;
|
||
}
|
||
}
|
||
catch (const std::exception& e)
|
||
{
|
||
std::cout << "Exception: " << e.what() << std::endl;
|
||
util::pressEnter();
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* Function: AdminMenu::handleOperation
|
||
* Description: Processes the administrator’s menu choice and executes the corresponding action.
|
||
* Parameters:
|
||
* choice - integer representing the selected menu option
|
||
* Returns:
|
||
* true - if the menu should remain active
|
||
* false - if the administrator chooses to logout
|
||
*/
|
||
bool AdminMenu::handleOperation(int choice)
|
||
{
|
||
switch (choice)
|
||
{
|
||
/*case 1:
|
||
m_zenvyController.createHRManager();
|
||
break;
|
||
case 2:
|
||
m_zenvyController.createEmployee();
|
||
break;
|
||
case 3:
|
||
m_zenvyController.viewEmployee();
|
||
break;
|
||
case 4:
|
||
m_zenvyController.deactivateEmployee();
|
||
break;*/
|
||
case 5:
|
||
return false;
|
||
default:
|
||
std::cout << "Enter a valid choice!" << std::endl;
|
||
}
|
||
return true;
|
||
} |