84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
/*
|
||
* File: EmployeeMenu.cpp
|
||
* Description: Implements the EmployeeMenu class functions including menu loop and operation handling.
|
||
* Author: Trenser
|
||
* Created: 02-Apr-2026
|
||
*/
|
||
#include <iostream>
|
||
#include<iomanip>
|
||
#include "EmployeeMenu.h"
|
||
#include "InputHelper.h"
|
||
#include "OutputHelper.h"
|
||
#include "MenuHelper.h"
|
||
|
||
/*
|
||
* Function: EmployeeMenu::run
|
||
* Description: Starts the employee menu loop and displays available options until logout is selected
|
||
* Parameters:
|
||
* None
|
||
* Returns:
|
||
* None
|
||
*/
|
||
void EmployeeMenu::run()
|
||
{
|
||
bool isMenuActive = true;
|
||
while (isMenuActive)
|
||
{
|
||
try
|
||
{
|
||
int choice;
|
||
util::clear();
|
||
std::cout << "Employee Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticket\n5. View Ticket\n6. View Ticket History\n7. View Employees\n8. Search Employee\n9. View Team Members\n10. Book Meeting Room\n11. View Booking History\n12. View Notifications\n13. View Announcements\n14. Update Profile\n15. View Profile\n16. Exit\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: EmployeeMenu::handleOperation
|
||
* Description: Handles the employee’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 employee chooses to logout
|
||
*/
|
||
bool EmployeeMenu::handleOperation(int choice)
|
||
{
|
||
switch (choice)
|
||
{
|
||
case 2:
|
||
viewPayslip(m_zenvyController);
|
||
break;
|
||
case 3:
|
||
viewPayslipHistory(m_zenvyController);
|
||
break;
|
||
case 7:
|
||
viewEmployees(m_zenvyController);
|
||
break;
|
||
case 8:
|
||
searchEmployee(m_zenvyController);
|
||
break;
|
||
case 14:
|
||
updateProfile(m_zenvyController);
|
||
break;
|
||
case 15:
|
||
viewProfile(m_zenvyController);
|
||
break;
|
||
case 16:
|
||
return false;
|
||
default:
|
||
std::cout << "Enter a valid choice!" << std::endl;
|
||
util::pressEnter();
|
||
}
|
||
return true;
|
||
} |