Merged PR 962: Implement View Employee Profile
Related work items: #947
This commit is contained in:
@@ -14,7 +14,7 @@ void EmployeeMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
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 Notification\n13. View Announcements\n14. Update Profile\n15. Logout\nEnter your Choice: ";
|
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 Notification\n13. View Announcements\n14. Update Profile\n15. View Profile\n16. Exit\nEnter your Choice: ";
|
||||||
util::read(choice);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -62,6 +62,9 @@ bool EmployeeMenu::handleOperation(int choice)
|
|||||||
updateProfile(m_zenvyController);
|
updateProfile(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void FinanceExecutiveMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
util::clear();
|
||||||
std::cout << "Finance 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. Resolve Ticket\n9. Generate Payslip\n10. Update Payroll\n11. Update Profile\n12. Logout\nEnter your Choice: ";
|
std::cout << "Finance 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. Resolve Ticket\n9. Generate Payslip\n10. Update Payroll\n11. Update Profile\n12. View Profile \n13. Logout\nEnter your Choice: ";
|
||||||
util::read(choice);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -68,6 +68,9 @@ bool FinanceExecutiveMenu::handleOperation(int choice)
|
|||||||
updateProfile(m_zenvyController);
|
updateProfile(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void HRManagerMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
util::clear();
|
||||||
std::cout << "HR Manager 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 Employee\n9. Regularize Attendance\n10. Update Leave Request\n11. Register CandidateAsEmployee\n12. Update Profile\n13. Deactivate Employee\n14. Logout\nEnter your Choice: ";
|
std::cout << "HR Manager 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 Employee\n9. Regularize Attendance\n10. Update Leave Request\n11. Register CandidateAsEmployee\n12. Update Profile\n13. Deactivate Employee\n14. View Profile\n15. Logout\nEnter your Choice: ";
|
||||||
util::read(choice);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -48,6 +48,9 @@ bool HRManagerMenu::handleOperation(int choice)
|
|||||||
deactivateEmployee(m_zenvyController);
|
deactivateEmployee(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void ITExecutiveMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
util::clear();
|
||||||
std::cout << "IT 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. Resolve Ticket\n9. Update Profile\n10. Logout\nEnter your Choice: ";
|
std::cout << "IT 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. Resolve Ticket\n9. Update Profile\n10. View Profile\n11. Logout\nEnter your Choice: ";
|
||||||
util::read(choice);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -42,6 +42,9 @@ bool ITExecutiveMenu::handleOperation(int choice)
|
|||||||
updateProfile(m_zenvyController);
|
updateProfile(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
@@ -15,6 +15,49 @@
|
|||||||
|
|
||||||
void createEmployee(std::shared_ptr<ZenvyController> controller);
|
void createEmployee(std::shared_ptr<ZenvyController> controller);
|
||||||
|
|
||||||
|
inline void viewProfile(std::shared_ptr<ZenvyController> controller)
|
||||||
|
{
|
||||||
|
util::clear();
|
||||||
|
std::shared_ptr<const Employee> currentEmployee = controller->getCurrentEmployee();
|
||||||
|
if (currentEmployee)
|
||||||
|
{
|
||||||
|
std::cout << std::left
|
||||||
|
<< "Employee ID: " << currentEmployee->getId() << std::endl
|
||||||
|
<< "Name: " << currentEmployee->getEmployeeName() << std::endl
|
||||||
|
<< "Role: " << Enums::getEmployeeTypeString(currentEmployee->getEmployeeType()) << std::endl
|
||||||
|
<< "Email: " << currentEmployee->getEmployeeEmail() << std::endl
|
||||||
|
<< "Phone: " << currentEmployee->getEmployeePhone() << std::endl;
|
||||||
|
if (currentEmployee->getEmployeeType() == Enums::EmployeeType::GENERAL) {
|
||||||
|
if (auto generalEmployee = std::dynamic_pointer_cast<const GeneralEmployee>(currentEmployee))
|
||||||
|
{
|
||||||
|
std::cout << "Designation: " << Enums::getEmployeeDesignationString(generalEmployee->getDesignation()) << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout << "Team ID: " << (currentEmployee->getEmployeeTeamId().empty() ? "NULL " : (currentEmployee->getEmployeeTeamId())) << std::endl
|
||||||
|
<< "Team Status: " << Enums::getTeamStatusString(currentEmployee->getEmployeeTeamStatus()) << std::endl;
|
||||||
|
if (const auto& payroll = currentEmployee->getPayroll())
|
||||||
|
{
|
||||||
|
std::cout << std::endl
|
||||||
|
<< "Payroll Details" << std::endl
|
||||||
|
<< "Payroll ID: " << payroll->getId() << std::endl
|
||||||
|
<< "Basic Salary: " << payroll->getBasicSalary() << std::endl
|
||||||
|
<< "Employee PF Contribution: " << payroll->getEmployeePFContribution() << std::endl
|
||||||
|
<< "Employer PF Contribution: " << payroll->getEmployerPFContribution() << std::endl
|
||||||
|
<< "Food Allowance: " << payroll->getFoodAllowance() << std::endl
|
||||||
|
<< "House Rent Allowance: " << payroll->getHouseRentAllowance() << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Unable to fetch the payroll details\n";
|
||||||
|
}
|
||||||
|
util::pressEnter();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Unexpected Error Occured");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline void updateProfile(std::shared_ptr<ZenvyController> m_zenvyController)
|
inline void updateProfile(std::shared_ptr<ZenvyController> m_zenvyController)
|
||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void TalentExecutiveMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
util::clear();
|
||||||
std::cout << "Talent 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 New Job\n9. View Job Opening\n10. Add Candidate\n11. UpdateCandidate Status\n12. View Shortlisted Candidate\n13. Update Profile\n14. Logout\nEnter your Choice: ";
|
std::cout << "Talent 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 New Job\n9. View Job Opening\n10. Add Candidate\n11. UpdateCandidate Status\n12. View Shortlisted Candidate\n13. Update Profile\n14. View Profile\n15. Logout\nEnter your Choice: ";
|
||||||
util::read(choice);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -42,6 +42,9 @@ bool TalentExecutiveMenu::handleOperation(int choice)
|
|||||||
updateProfile(m_zenvyController);
|
updateProfile(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void TeamExecutiveMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
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. Logout\nEnter your Choice: ";
|
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);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -42,6 +42,9 @@ bool TeamExecutiveMenu::handleOperation(int choice)
|
|||||||
updateProfile(m_zenvyController);
|
updateProfile(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void TeamLeadMenu::run()
|
|||||||
{
|
{
|
||||||
int choice;
|
int choice;
|
||||||
util::clear();
|
util::clear();
|
||||||
std::cout << "Team Lead Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticke\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 Notification\n13. View Announcements\n4. Regularize Attendance\n15. Update Leave Request\n16. Update Profile\n17. Logout\nEnter your Choice: ";
|
std::cout << "Team Lead Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. Raise Ticke\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 Notification\n13. View Announcements\n4. Regularize Attendance\n15. Update Leave Request\n16. Update Profile\n17. View Profile\n18. Logout\nEnter your Choice: ";
|
||||||
util::read(choice);
|
util::read(choice);
|
||||||
if (!handleOperation(choice))
|
if (!handleOperation(choice))
|
||||||
{
|
{
|
||||||
@@ -42,6 +42,9 @@ bool TeamLeadMenu::handleOperation(int choice)
|
|||||||
updateProfile(m_zenvyController);
|
updateProfile(m_zenvyController);
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
|
viewProfile(m_zenvyController);
|
||||||
|
break;
|
||||||
|
case 18:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
std::cout << "Enter a valid choice!" << std::endl;
|
std::cout << "Enter a valid choice!" << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user