Add headers to the views and remove Leave static members
This commit is contained in:
@@ -28,21 +28,6 @@ const std::string& Leave::getLeaveReason() const
|
||||
return m_reason;
|
||||
}
|
||||
|
||||
int Leave::getNumberOfGeneralLeave()
|
||||
{
|
||||
return m_numberOfGeneralLeave;
|
||||
}
|
||||
|
||||
int Leave::getNumberOfRestrictedLeave()
|
||||
{
|
||||
return m_numberOfRestrictedLeave;
|
||||
}
|
||||
|
||||
int Leave::getNumberOfMedicalLeave()
|
||||
{
|
||||
return m_numberOfMedicalLeave;
|
||||
}
|
||||
|
||||
Enums::LeaveType Leave::getLeaveType() const
|
||||
{
|
||||
return m_leaveType;
|
||||
@@ -68,21 +53,6 @@ void Leave::setLeaveReason(const std::string& reason)
|
||||
m_reason = reason;
|
||||
}
|
||||
|
||||
void Leave::setNumberOfGeneralLeave(int value)
|
||||
{
|
||||
m_numberOfGeneralLeave = value;
|
||||
}
|
||||
|
||||
void Leave::setNumberOfRestrictedLeave(int value)
|
||||
{
|
||||
m_numberOfRestrictedLeave = value;
|
||||
}
|
||||
|
||||
void Leave::setNumberOfMedicalLeave(int value)
|
||||
{
|
||||
m_numberOfMedicalLeave = value;
|
||||
}
|
||||
|
||||
void Leave::setLeaveType(Enums::LeaveType type)
|
||||
{
|
||||
m_leaveType = type;
|
||||
|
||||
@@ -17,9 +17,6 @@ private:
|
||||
std::string m_employeeId;
|
||||
util::Timestamp m_timestamp;
|
||||
std::string m_reason;
|
||||
static int m_numberOfGeneralLeave;
|
||||
static int m_numberOfRestrictedLeave;
|
||||
static int m_numberOfMedicalLeave;
|
||||
Enums::LeaveType m_leaveType;
|
||||
public:
|
||||
Leave() : m_id("LV" + std::to_string(++m_uid)), m_employeeId(""), m_timestamp(), m_reason(""), m_leaveType(Enums::LeaveType::GENERAL) {}
|
||||
@@ -32,16 +29,10 @@ public:
|
||||
const std::string& getEmployeeId() const;
|
||||
const util::Timestamp& getTimestamp() const;
|
||||
const std::string& getLeaveReason() const;
|
||||
static int getNumberOfGeneralLeave();
|
||||
static int getNumberOfRestrictedLeave();
|
||||
static int getNumberOfMedicalLeave();
|
||||
Enums::LeaveType getLeaveType() const;
|
||||
void setLeaveId(const std::string& id);
|
||||
void setEmployeeId(const std::string& employeeId);
|
||||
void setTimestamp(const util::Timestamp& timestamp);
|
||||
void setLeaveReason(const std::string& reason);
|
||||
void setNumberOfGeneralLeave(int value);
|
||||
void setNumberOfRestrictedLeave(int value);
|
||||
void setNumberOfMedicalLeave(int value);
|
||||
void setLeaveType(Enums::LeaveType type);
|
||||
};
|
||||
@@ -84,4 +84,4 @@ bool AdminMenu::handleOperation(int choice)
|
||||
util::pressEnter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
AdminMenu() :m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -28,7 +28,7 @@ void EmployeeMenu::run()
|
||||
{
|
||||
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 Notification\n13. View Announcements\n14. Update Profile\n15. View Profile\n16. Exit\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 Notifications\n13. View Announcements\n14. Update Profile\n15. View Profile\n16. Exit\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -81,4 +81,4 @@ bool EmployeeMenu::handleOperation(int choice)
|
||||
util::pressEnter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
EmployeeMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -28,7 +28,7 @@ void FinanceExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
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 Payslips\n10. Update Payroll\n11. Update Profile\n12. View Profile \n13. 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 Notifications\n7. View Announcements\n8. Resolve Ticket\n9. Generate Payslips\n10. Update Payroll\n11. Update Profile\n12. View Profile \n13. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -119,4 +119,4 @@ bool FinanceExecutiveMenu::handleOperation(int choice)
|
||||
util::pressEnter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -21,5 +21,4 @@ public:
|
||||
bool handleOperation(int);
|
||||
void updatePayroll();
|
||||
void generatePayslips();
|
||||
};
|
||||
|
||||
};
|
||||
@@ -27,7 +27,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. Update Profile\n12. Deactivate Employee\n13. View Profile\n14. Update Designation\n15. Add Shortlisted Candidate as Employee\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 Notifications\n7. View Announcements\n8. Create Employee\n9. Regularize Attendance\n10. Update Leave Request\n11. Update Profile\n12. Deactivate Employee\n13. View Profile\n14. Update Designation\n15. Add Shortlisted Candidate as Employee\n16. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -92,4 +92,4 @@ bool HRManagerMenu::handleOperation(int choice)
|
||||
util::pressEnter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
HRManagerMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -27,7 +27,7 @@ void ITExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
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. View Profile\n11. 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 Notifications\n7. View Announcements\n8. Resolve Ticket\n9. Update Profile\n10. View Profile\n11. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
@@ -80,4 +80,4 @@ bool ITExecutiveMenu::handleOperation(int choice)
|
||||
util::pressEnter();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
ITExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -1,6 +1,22 @@
|
||||
/*
|
||||
* File: MenuHelper.cpp
|
||||
* Description: Inline functions and utilities for employee management,
|
||||
* including profile handling, payslip viewing, search,
|
||||
* and employee activation/deactivation.
|
||||
* Author: Trenser
|
||||
* Created: 08-Apr-2026
|
||||
*/
|
||||
#include <stdexcept>
|
||||
#include "MenuHelper.h"
|
||||
|
||||
/*
|
||||
* Function: getEmployeeType
|
||||
* Description: Retrieves a valid employee type based on the authority of the current user
|
||||
* Parameters:
|
||||
* employeeType - the type of the employee requesting to create another employee
|
||||
* Returns:
|
||||
* Enums::EmployeeType - selected employee type or INVALID if choice is invalid
|
||||
*/
|
||||
static Enums::EmployeeType getEmployeeType(Enums::EmployeeType employeeType)
|
||||
{
|
||||
int choice;
|
||||
@@ -50,6 +66,13 @@ static Enums::EmployeeType getEmployeeType(Enums::EmployeeType employeeType)
|
||||
return Enums::EmployeeType::INVALID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: getEmployeeDesignation
|
||||
* Description: Retrieves the designation (Senior or Junior) for a new employee
|
||||
* Parameters: None
|
||||
* Returns:
|
||||
* Enums::EmployeeDesignation - selected designation or INVALID if choice is invalid
|
||||
*/
|
||||
static Enums::EmployeeDesignation getEmployeeDesignation()
|
||||
{
|
||||
int choice;
|
||||
@@ -70,6 +93,13 @@ static Enums::EmployeeDesignation getEmployeeDesignation()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: createEmployee
|
||||
* Description: Creates a new employee record and adds it to the system
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
void createEmployee(ZenvyController* m_zenvyController)
|
||||
{
|
||||
auto currentEmployee = m_zenvyController->getCurrentEmployee();
|
||||
@@ -103,6 +133,13 @@ void createEmployee(ZenvyController* m_zenvyController)
|
||||
util::pressEnter();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: updateDesignation
|
||||
* Description: Updates the designation of an existing employee
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
void updateDesignation(ZenvyController* m_zenvyController)
|
||||
{
|
||||
std::string selectedEmployeeId = selectEmployeeId(m_zenvyController->getEmployees(Enums::EmployeeType::GENERAL));
|
||||
@@ -123,6 +160,13 @@ void createEmployee(ZenvyController* m_zenvyController)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: displayCandidateDetails
|
||||
* Description: Displays details of shortlisted candidates
|
||||
* Parameters:
|
||||
* shorlistedCandidates - vector of candidate pointers to display
|
||||
* Returns: void
|
||||
*/
|
||||
void displayCandidateDetails(const std::vector<Candidate*> shorlistedCandidates)
|
||||
{
|
||||
util::clear();
|
||||
@@ -148,6 +192,13 @@ void displayCandidateDetails(const std::vector<Candidate*> shorlistedCandidates)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: addShortlistedCandidateAsEmployee
|
||||
* Description: Converts a shortlisted candidate into an employee record
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController)
|
||||
{
|
||||
int index;
|
||||
@@ -199,4 +250,4 @@ void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController)
|
||||
{
|
||||
throw std::runtime_error("Enter a valid Index.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,11 @@
|
||||
/*
|
||||
* File: MenuHelper.h
|
||||
* Description: Inline functions and utilities for employee management,
|
||||
* including profile handling, payslip viewing, search,
|
||||
* and employee activation/deactivation.
|
||||
* Author: Trenser
|
||||
* Created: 08-Apr-2026
|
||||
*/
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -19,6 +27,13 @@ void updateDesignation(ZenvyController* m_zenvyController);
|
||||
void displayCandidateDetails(const std::vector<const Candidate*> shorlistedCandidates);
|
||||
void addShortlistedCandidateAsEmployee(const ZenvyController* m_zenvyController);
|
||||
|
||||
/*
|
||||
* Function: viewPayslipHistory
|
||||
* Description: Displays the payslip history of the current employee
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void viewPayslipHistory(ZenvyController* m_zenvyController)
|
||||
{
|
||||
auto& employeePayslips = m_zenvyController->getCurrentEmployee()->getEmployeePayslips();
|
||||
@@ -52,6 +67,13 @@ inline void viewPayslipHistory(ZenvyController* m_zenvyController)
|
||||
util::pressEnter();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: viewProfile
|
||||
* Description: Displays the profile details of the current employee
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void viewProfile(ZenvyController* m_zenvyController)
|
||||
{
|
||||
util::clear();
|
||||
@@ -95,6 +117,13 @@ inline void viewProfile(ZenvyController* m_zenvyController)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: updateProfile
|
||||
* Description: Allows the current employee to update their profile information
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void updateProfile(ZenvyController* m_zenvyController)
|
||||
{
|
||||
int choice;
|
||||
@@ -146,6 +175,14 @@ inline void updateProfile(ZenvyController* m_zenvyController)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: selectEmployeeId
|
||||
* Description: Displays a list of employees and allows selection by index
|
||||
* Parameters:
|
||||
* allEmployees - vector of employee pointers to choose from
|
||||
* Returns:
|
||||
* string - selected employee ID
|
||||
*/
|
||||
inline std::string selectEmployeeId(const std::vector<const Employee*>& allEmployees)
|
||||
{
|
||||
int choice;
|
||||
@@ -207,6 +244,13 @@ inline std::string selectEmployeeId(const std::vector<const Employee*>& allEmplo
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: deactivateEmployee
|
||||
* Description: Deactivates an employee based on selection
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void deactivateEmployee(const ZenvyController* m_zenvyController)
|
||||
{
|
||||
std::string selectedEmployeeId = selectEmployeeId(m_zenvyController->getEmployees());
|
||||
@@ -226,6 +270,13 @@ inline void deactivateEmployee(const ZenvyController* m_zenvyController)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: viewEmployees
|
||||
* Description: Displays a list of all employees in the system
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void viewEmployees(ZenvyController* m_zenvyController)
|
||||
{
|
||||
util::clear();
|
||||
@@ -259,6 +310,13 @@ inline void viewEmployees(ZenvyController* m_zenvyController)
|
||||
util::pressEnter();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: searchEmployee
|
||||
* Description: Searches for employees by name and displays matching results
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void searchEmployee(ZenvyController* m_zenvyController)
|
||||
{
|
||||
std::string name;
|
||||
@@ -331,6 +389,13 @@ inline void searchEmployee(ZenvyController* m_zenvyController)
|
||||
util::pressEnter();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function: viewPayslip
|
||||
* Description: Displays the payslip of the current employee for a given month and year
|
||||
* Parameters:
|
||||
* m_zenvyController - pointer to the ZenvyController managing employees
|
||||
* Returns: void
|
||||
*/
|
||||
inline void viewPayslip(ZenvyController* m_zenvyController)
|
||||
{
|
||||
int year, month;
|
||||
|
||||
@@ -27,7 +27,7 @@ void TalentExecutiveMenu::run()
|
||||
{
|
||||
int choice;
|
||||
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. View Profile\n15. 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 Notifications\n7. View Announcements\n8. Create New Job\n9. View Job Opening\n10. Add Candidate\n11. Update Candidate Status\n12. View Shortlisted Candidate\n13. Update Profile\n14. View Profile\n15. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
TalentExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -27,7 +27,7 @@ void TeamExecutiveMenu::run()
|
||||
{
|
||||
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: ";
|
||||
std::cout << "Team Executive Menu\n1. Apply Leave\n2. View Payslip\n3. View Payslip History\n4. View Employees\n5. Search Employee\n6. View Notifications\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))
|
||||
{
|
||||
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
TeamExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
@@ -27,7 +27,7 @@ void TeamLeadMenu::run()
|
||||
{
|
||||
int choice;
|
||||
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. View Profile\n18. Logout\nEnter your Choice: ";
|
||||
std::cout << "Team Lead 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. Regularize Attendance\n15. Update Leave Request\n16. Update Profile\n17. View Profile\n18. Logout\nEnter your Choice: ";
|
||||
util::read(choice);
|
||||
if (!handleOperation(choice))
|
||||
{
|
||||
|
||||
@@ -15,5 +15,4 @@ public:
|
||||
TeamLeadMenu() : m_zenvyController(new ZenvyController()) {};
|
||||
void run();
|
||||
bool handleOperation(int);
|
||||
};
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user