Files
Training-Team2-Zenvy-Jan26/Trenser.Zenvy/Trenser.Zenvy/views/TeamExecutiveMenu.cpp
T
Jissin Sam Mathew f5adcdea30 Implement View Employee Profile
<UserStory>EMP003: View Employee Profile</UserStory>

<Changes>

- Added `viewProfile` method in MenuHelper to display employee details including ID, name, role, email, phone, team, and payroll.
- Integrated `viewProfile(m_zenvyController)` into all role-specific menus (Employee, Finance Executive, HR Manager, IT Executive, Talent Executive, Team Lead).
- Implemented safe downcasting for `GeneralEmployee` to access designation details.
- Enhanced output formatting with section headers and null checks for team ID and payroll.
- Improved error handling with runtime exception when employee record is missing.

</Changes>

<Review>

Smitha Mohan

</Review>
2026-04-14 13:41:50 +05:30

54 lines
1.2 KiB
C++

#include <iostream>
#include "TeamExecutiveMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "MenuHelper.h"
void TeamExecutiveMenu::run()
{
bool isMenuActive = true;
while (isMenuActive)
{
try
{
int choice;
util::clear();
std::cout << "Team Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notification\n7. View Announcements\n8. Create Team\n9. Update Team\n10. Remove Team\n11. Assign Employee\n12. Unassign Employee\n13. View Teams\n14. Update Profile\n15. View Profile\n16. 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();
}
}
}
bool TeamExecutiveMenu::handleOperation(int choice)
{
switch (choice)
{
case 4:
viewEmployees(m_zenvyController);
break;
case 5:
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;
}