Added Profile Update Feature for all menu
<UserStory> EMP004 : Update Personal Details </UserStory> <Changes> - Added MenuHelper.cpp and MenuHelper.h and integrated them into project - Moved updateProfile() logic from individual menus into MenuHelper - Added inline updateProfile(shared_ptr<ZenvyController>) to MenuHelper - Updated AdminMenu, EmployeeMenu, HRManagerMenu, FinanceExecutiveMenu, ITExecutiveMenu, TalentExecutiveMenu, TeamExecutiveMenu, and TeamLeadMenu to use centralized updateProfile() - Added getCurrentEmployee() and updateProfile() to ZenvyController - Added corresponding implementations in EmployeeManagementService - Minor layout and option text improvements across all menus </Changes> <Review> Smitha Mohan </Review>
This commit is contained in:
@@ -173,6 +173,7 @@
|
||||
<ClCompile Include="views\FinanceExecutiveMenu.cpp" />
|
||||
<ClCompile Include="views\HRManagerMenu.cpp" />
|
||||
<ClCompile Include="views\ITExecutiveMenu.cpp" />
|
||||
<ClCompile Include="views\MenuHelper.cpp" />
|
||||
<ClCompile Include="views\TalentExecutiveMenu.cpp" />
|
||||
<ClCompile Include="views\TeamExecutiveMenu.cpp" />
|
||||
<ClCompile Include="views\TeamLeadMenu.cpp" />
|
||||
@@ -224,6 +225,7 @@
|
||||
<ClInclude Include="views\FinanceExecutiveMenu.h" />
|
||||
<ClInclude Include="views\HRManagerMenu.h" />
|
||||
<ClInclude Include="views\ITExecutiveMenu.h" />
|
||||
<ClInclude Include="views\MenuHelper.h" />
|
||||
<ClInclude Include="views\TalentExecutiveMenu.h" />
|
||||
<ClInclude Include="views\TeamExecutiveMenu.h" />
|
||||
<ClInclude Include="views\TeamLeadMenu.h" />
|
||||
|
||||
@@ -27,10 +27,19 @@ bool ZenvyController::deactivateEmployee(const std::string& id)
|
||||
return m_employeeManagementService->deactivateEmployee(id);
|
||||
}
|
||||
|
||||
Employees EmployeeManagementService::getEmployees()
|
||||
void ZenvyController::updateProfile(const std::string& name,const std::string& phone)
|
||||
{
|
||||
m_employeeManagementService->updateProfile(name,phone);
|
||||
}
|
||||
|
||||
std::shared_ptr<const Employee> EmployeeManagementService::getEmployee(const std::string& id)
|
||||
std::shared_ptr<const Employee> ZenvyController::getCurrentEmployee()
|
||||
{
|
||||
return m_employeeManagementService->getCurrentEmployee();
|
||||
}
|
||||
|
||||
std::shared_ptr<const Employee> ZenvyController::getEmployee(const std::string& id)
|
||||
{
|
||||
}
|
||||
Employees ZenvyController::getEmployees()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,4 +49,6 @@ public:
|
||||
bool deactivateEmployee(const std::string&);
|
||||
Employees getEmployees();
|
||||
std::shared_ptr<const Employee> getEmployee(const std::string&);
|
||||
std::shared_ptr<const Employee> getCurrentEmployee();
|
||||
void updateProfile(const std::string&,const std::string&);
|
||||
};
|
||||
|
||||
@@ -107,3 +107,15 @@ Employees EmployeeManagementService::getEmployees()
|
||||
std::shared_ptr<const Employee> EmployeeManagementService::getEmployee(const std::string& id)
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<const Employee> EmployeeManagementService::getCurrentEmployee()
|
||||
{
|
||||
return m_dataStore.getAuthenticatedEmployee();
|
||||
}
|
||||
|
||||
void EmployeeManagementService::updateProfile(const std::string& name,const std::string& phone)
|
||||
{
|
||||
std::shared_ptr<Employee> employee = m_dataStore.getAuthenticatedEmployee();
|
||||
employee->setEmployeeName(name);
|
||||
employee->setEmployeePhone(phone);
|
||||
}
|
||||
@@ -16,4 +16,6 @@ public:
|
||||
bool deactivateEmployee(const std::string&);
|
||||
Employees getEmployees();
|
||||
std::shared_ptr<const Employee> getEmployee(const std::string&);
|
||||
void updateProfile(const std::string&,const std::string&);
|
||||
std::shared_ptr<const Employee> getCurrentEmployee();
|
||||
};
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "AdminMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
static Enums::EmployeeType getEmployeeType()
|
||||
{
|
||||
@@ -93,7 +94,7 @@ void AdminMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Admin Menu\n1. Create User\n2. View Employee\n3. Deactivate Employee\n4. Logout\nEnter your Choice: ";
|
||||
std::cout << "Admin Menu\n1. Create User\n2. View Employee\n3. Deactivate Employee\n4. Search Employee\n5. Update Profile\n6. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -121,7 +122,10 @@ bool AdminMenu::handleOperation(int choice)
|
||||
case 3:
|
||||
m_zenvyController.deactivateEmployee();
|
||||
break;*/
|
||||
case 4:
|
||||
case 5:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 6:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "EmployeeMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
void EmployeeMenu::run()
|
||||
{
|
||||
@@ -12,7 +13,7 @@ void EmployeeMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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\n14. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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\n14. Update Profile\n15. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -48,11 +49,11 @@ bool EmployeeMenu::handleOperation(int choice)
|
||||
break;
|
||||
case 6:
|
||||
m_zenvyController.viewTicketHistory();
|
||||
break;
|
||||
case 7:
|
||||
m_zenvyController.viewEmployees();
|
||||
break;
|
||||
case 8:
|
||||
break;*/
|
||||
/*case 7:
|
||||
viewEmployees();
|
||||
break;*/
|
||||
/*case 8:
|
||||
m_zenvyController.searchEmployee();
|
||||
break;
|
||||
case 9:
|
||||
@@ -71,9 +72,15 @@ bool EmployeeMenu::handleOperation(int choice)
|
||||
m_zenvyController.viewAnnouncements();
|
||||
break;*/
|
||||
case 14:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 15:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "FinanceExecutiveMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
void FinanceExecutiveMenu::run()
|
||||
{
|
||||
@@ -12,7 +13,7 @@ void FinanceExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -61,6 +62,9 @@ bool FinanceExecutiveMenu::handleOperation(int choice)
|
||||
case 10:
|
||||
m_zenvyController.updatePayroll();
|
||||
break;*/
|
||||
case 10:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 11:
|
||||
return false;
|
||||
default:
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "HRManagerMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
static Enums::EmployeeType getEmployeeType()
|
||||
{
|
||||
@@ -90,7 +91,7 @@ void HRManagerMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -143,6 +144,9 @@ bool HRManagerMenu::handleOperation(int choice)
|
||||
// m_zenvyController.registercandidateAsEmployee();
|
||||
// break;
|
||||
case 12:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 13:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "ITExecutiveMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
void ITExecutiveMenu::run()
|
||||
{
|
||||
@@ -12,7 +13,7 @@ void ITExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -56,6 +57,9 @@ bool ITExecutiveMenu::handleOperation(int choice)
|
||||
m_zenvyController.resolveTicket();
|
||||
break;*/
|
||||
case 9:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 10:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include "MenuHelper.h"
|
||||
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include"ZenvyController.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
|
||||
inline void updateProfile(std::shared_ptr<ZenvyController> m_zenvyController)
|
||||
{
|
||||
int choice;
|
||||
std::string name, phone;
|
||||
name = m_zenvyController->getCurrentEmployee()->getEmployeeName();
|
||||
phone = m_zenvyController->getCurrentEmployee()->getEmployeePhone();
|
||||
while (true)
|
||||
{
|
||||
util::clear();
|
||||
std::cout << "Please choose the information you want to update:\n"
|
||||
"1. Name\n"
|
||||
"2. Phone Number\n"
|
||||
"3. Exit\n"
|
||||
"Enter your choice: ";
|
||||
util::read(choice);
|
||||
switch (choice)
|
||||
{
|
||||
case 1:
|
||||
std::cout << "Enter your updated Name :";
|
||||
util::read(name);
|
||||
m_zenvyController->updateProfile(name, phone);
|
||||
std::cout << "Profile Updated Successfully\n";
|
||||
break;
|
||||
case 2:
|
||||
std::cout << "Enter your updated phone Number :";
|
||||
util::read(phone);
|
||||
m_zenvyController->updateProfile(name, phone);
|
||||
std::cout << "Profile Updated Successfully\n";
|
||||
break;
|
||||
case 3:
|
||||
return;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "TalentExecutiveMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
void TalentExecutiveMenu::run()
|
||||
{
|
||||
@@ -12,7 +13,7 @@ void TalentExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -68,6 +69,9 @@ bool TalentExecutiveMenu::handleOperation(int choice)
|
||||
// m_zenvyController.viewShortlistedCandidates();
|
||||
// break;
|
||||
case 13:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 14:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "TeamExecutiveMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
void TeamExecutiveMenu::run()
|
||||
{
|
||||
@@ -12,7 +13,7 @@ void TeamExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -71,6 +72,9 @@ bool TeamExecutiveMenu::handleOperation(int choice)
|
||||
// m_zenvyController.viewTeams();
|
||||
// break;
|
||||
case 14:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 15:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <iostream>
|
||||
#include "TeamLeadMenu.h"
|
||||
#include"InputHelper.h"
|
||||
#include"OutputHelper.h"
|
||||
#include "InputHelper.h"
|
||||
#include "OutputHelper.h"
|
||||
#include "MenuHelper.h"
|
||||
|
||||
void TeamLeadMenu::run()
|
||||
{
|
||||
@@ -12,7 +13,7 @@ void TeamLeadMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Zenvy - The HR Management System\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. Logout\nEnter your Choice: ";
|
||||
std::cout << "Zenvy - The HR Management System\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: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -77,6 +78,9 @@ bool TeamLeadMenu::handleOperation(int choice)
|
||||
m_zenvyController.updateLeaveRequest();
|
||||
break;*/
|
||||
case 16:
|
||||
updateProfile(m_zenvyController);
|
||||
break;
|
||||
case 17:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user