To Add Shortlisted Candidates As Employee
<UserStory> EMP012 : Add Shorlisted Candidates As Employee </UserStory> <Changes> - Added getShorlistedCandidates method in ZenvyController - Added candidateMap to store candidate data in DataStore.h - Added addShortlistedCandidatesAsEmployee method in EmployeeManagementService.h and implemented the logic. </Changes> <Review> Smitha Mohan </Review>
This commit is contained in:
@@ -13,7 +13,7 @@ void AdminMenu::run()
|
||||
{
|
||||
int choice;
|
||||
util::clear();
|
||||
std::cout << "Admin Menu\n1. Create User\n2. View Employees\n3. Deactivate Employee\n4. Search Employee\n5. Update Profile\n6. Update Designation \n7. Logout\nEnter your Choice: ";
|
||||
std::cout << "Admin Menu\n1. Create User\n2. View Employees\n3. Deactivate Employee\n4. Search Employee\n5. Update Profile\n6. Update Designation \n7. Add Shortlisted Candidate As Employee\n8. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -51,6 +51,9 @@ bool AdminMenu::handleOperation(int choice)
|
||||
updateDesignation(m_zenvyController);
|
||||
break;
|
||||
case 7:
|
||||
addShortlistedCandidateAsEmployee(m_zenvyController);
|
||||
break;
|
||||
case 8:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -13,7 +13,7 @@ void HRManagerMenu::run()
|
||||
{
|
||||
int choice;
|
||||
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. View Profile\n15. Update Designation\n16. 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. Update Designation\n16. Add Shortlisted Candidate as Employee\n17. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -54,6 +54,9 @@ bool HRManagerMenu::handleOperation(int choice)
|
||||
updateDesignation(m_zenvyController);
|
||||
break;
|
||||
case 16:
|
||||
addShortlistedCandidateAsEmployee(m_zenvyController);
|
||||
break;
|
||||
case 17:
|
||||
return false;
|
||||
default:
|
||||
std::cout << "Enter a valid choice!" << std::endl;
|
||||
|
||||
@@ -30,12 +30,12 @@ static Enums::EmployeeType getEmployeeType(Enums::EmployeeType employeeType)
|
||||
{ Enums::EmployeeType::TALENT_ACQUISITION, "Talent Executive" },
|
||||
{ Enums::EmployeeType::GENERAL, "General Employee" }
|
||||
};
|
||||
auto it = employeeTypeOptions.find(employeeType);
|
||||
if (it == employeeTypeOptions.end())
|
||||
auto employeeOptionsIterator = employeeTypeOptions.find(employeeType);
|
||||
if (employeeOptionsIterator == employeeTypeOptions.end())
|
||||
{
|
||||
throw std::runtime_error("You do not have the authority to create a new Employee!");
|
||||
}
|
||||
const auto& options = it->second;
|
||||
const auto& options = employeeOptionsIterator->second;
|
||||
std::cout << "Select Employee Type\n";
|
||||
for (int index = 0; index < options.size(); ++index)
|
||||
{
|
||||
@@ -121,4 +121,81 @@ void createEmployee(std::shared_ptr<ZenvyController> controller)
|
||||
std::cout << "Employee not found\n";
|
||||
util::pressEnter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void displayCandidateDetails(const std::vector<std::shared_ptr<Candidate>>& shorlistedCandidates)
|
||||
{
|
||||
std::cout << std::left
|
||||
<< std::setw(10) << "Index"
|
||||
<< std::setw(10) << "ID"
|
||||
<< std::setw(20) << "Name"
|
||||
<< std::setw(15) << "Phone"
|
||||
<< std::setw(15) << "Qualification"
|
||||
<< std::setw(10) << "Status"
|
||||
<< std::endl;
|
||||
int index = 0;
|
||||
for (auto& candidate : shorlistedCandidates)
|
||||
{
|
||||
std::cout << std::left
|
||||
<< std::setw(10) << ++index
|
||||
<< std::setw(10) << candidate->getCandidateId()
|
||||
<< std::setw(20) << candidate->getCandidateName()
|
||||
<< std::setw(15) << candidate->getCandidatePhone()
|
||||
<< std::setw(15) << candidate->getCandidateQualification()
|
||||
<< std::setw(10) << Enums::getCandidateStatusString(candidate->getCandidateStatus())
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void addShortlistedCandidateAsEmployee(const std::shared_ptr<ZenvyController>& controller)
|
||||
{
|
||||
int index;
|
||||
std::string name, email, phone;
|
||||
util::clear();
|
||||
std::vector<std::shared_ptr<Candidate>> shortlistedCandidates = controller->getShorlistedCandidates();
|
||||
if (shortlistedCandidates.empty())
|
||||
{
|
||||
std::cout << "No candidates Found!";
|
||||
util::pressEnter();
|
||||
return;
|
||||
}
|
||||
displayCandidateDetails(shortlistedCandidates);
|
||||
std::cout << "Enter the Index: ";
|
||||
util::read(index);
|
||||
auto currentEmployee = controller->getCurrentEmployee();
|
||||
Enums::EmployeeType employeeType;
|
||||
Enums::EmployeeDesignation employeeDesignation = Enums::EmployeeDesignation::INVALID;
|
||||
if (index > 0 && index < shortlistedCandidates.size())
|
||||
{
|
||||
employeeType = getEmployeeType(currentEmployee->getEmployeeType());
|
||||
std::shared_ptr<Candidate> candidate = shortlistedCandidates[index - 1];
|
||||
switch (employeeType)
|
||||
{
|
||||
case Enums::EmployeeType::INVALID:
|
||||
std::cout << "Invalid Choice";
|
||||
util::pressEnter();
|
||||
return;
|
||||
case Enums::EmployeeType::GENERAL:
|
||||
employeeDesignation = getEmployeeDesignation();
|
||||
if (employeeDesignation == Enums::EmployeeDesignation::INVALID)
|
||||
{
|
||||
std::cout << "Invalid Choice";
|
||||
util::pressEnter();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
std::cout << "Enter email: ";
|
||||
util::read(email);
|
||||
name = candidate->getCandidateName();
|
||||
phone = candidate->getCandidatePhone();
|
||||
controller->createEmployee(employeeType, employeeDesignation, email, name, phone);
|
||||
candidate->setCandidateStatus(Enums::CandidateStatus::HIRED);
|
||||
std::cout << "\nCreated Employee Successfully.";
|
||||
util::pressEnter();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Enter a valid Index.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ inline void viewProfile(std::shared_ptr<ZenvyController> controller)
|
||||
}
|
||||
}
|
||||
|
||||
void displayCandidateDetails(const std::vector<std::shared_ptr<const Candidate>>& shorlistedCandidates);
|
||||
void addShortlistedCandidateAsEmployee(const std::shared_ptr<ZenvyController>& controller);
|
||||
|
||||
inline void updateProfile(std::shared_ptr<ZenvyController> m_zenvyController)
|
||||
{
|
||||
int choice;
|
||||
@@ -223,7 +226,7 @@ inline void viewEmployees(std::shared_ptr<ZenvyController> m_zenvyController)
|
||||
util::pressEnter();
|
||||
}
|
||||
|
||||
inline void searchEmployee(std::shared_ptr<ZenvyController>& m_zenvyController)
|
||||
inline void searchEmployee(std::shared_ptr<ZenvyController> m_zenvyController)
|
||||
{
|
||||
std::string name;
|
||||
util::clear();
|
||||
|
||||
Reference in New Issue
Block a user