Merge branch 'feature' into feature-employee-management-native-pointers

This commit is contained in:
2026-04-16 16:57:18 +05:30
98 changed files with 1302 additions and 150 deletions
@@ -1,9 +1,25 @@
/*
* File: AdminMenu.cpp
* Description: Handles user-related operations such as creation, authentication, and validation.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "AdminMenu.h"
#include"InputHelper.h"
#include"OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: AdminMenu::run
* Description: Starts and manages the administrator menu loop. Continuously displays
* options to the administrator until logout is selected or an exception occurs.
* Parameters:
* None
* Returns:
* None
*/
void AdminMenu::run()
{
bool isMenuActive = true;
@@ -28,6 +44,15 @@ void AdminMenu::run()
}
}
/*
* Function: AdminMenu::handleOperation
* Description: Processes the administrators menu choice and executes the corresponding action.
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the administrator chooses to logout
*/
bool AdminMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: AdminMenu.h
* Description: Declaration of the AdminMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class AdminMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
AdminMenu() :m_zenvyController(std::make_shared<ZenvyController>()) {};
AdminMenu() :m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,3 +1,10 @@
/*
* File: EmployeeMenu.cpp
* Description: Implements the EmployeeMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include<iomanip>
#include "EmployeeMenu.h"
@@ -5,6 +12,14 @@
#include "OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: EmployeeMenu::run
* Description: Starts the employee menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void EmployeeMenu::run()
{
bool isMenuActive = true;
@@ -29,6 +44,15 @@ void EmployeeMenu::run()
}
}
/*
* Function: EmployeeMenu::handleOperation
* Description: Handles the employees menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the employee chooses to logout
*/
bool EmployeeMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: EmployeeMenu.h
* Description: Declaration of the EmployeeMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class EmployeeMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController m_zenvyController;
public:
EmployeeMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
EmployeeMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,3 +1,10 @@
/*
* File: FinanceExecutiveMenu.cpp
* Description: Implements the FinanceExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "FinanceExecutiveMenu.h"
#include "InputHelper.h"
@@ -5,6 +12,14 @@
#include "MenuHelper.h"
#include "Timestamp.h"
/*
* Function: FinanceExecutiveMenu::run
* Description: Starts the finance executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void FinanceExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -52,15 +67,15 @@ void FinanceExecutiveMenu::updatePayroll()
}
}
void FinanceExecutiveMenu::generatePayslips()
{
util::Timestamp currentTimestamp;
util::clear();
m_zenvyController->generatePayslips();
std::cout << "Generated payslips for the month of " << currentTimestamp.getMonth() << "-" << currentTimestamp.getYear() << " successfully.";
util::pressEnter();
}
/*
* Function: FinanceExecutiveMenu::handleOperation
* Description: Handles the finance executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the finance executive chooses to logout
*/
bool FinanceExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,3 +1,10 @@
/*
* File: FinanceExecutiveMenu.h
* Description: Declaration of the FinanceExecutiveMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include<iostream>
@@ -8,9 +15,9 @@
class FinanceExecutiveMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
FinanceExecutiveMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
FinanceExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
void updatePayroll();
@@ -1,9 +1,24 @@
/*
* File: HRManagerMenu.cpp
* Description: Implements the HRManagerMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "HRManagerMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: HRManagerMenu::run
* Description: Starts the HR manager menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void HRManagerMenu::run()
{
bool isMenuActive = true;
@@ -28,6 +43,15 @@ void HRManagerMenu::run()
}
}
/*
* Function: HRManagerMenu::handleOperation
* Description: Handles the HR managers menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the HR manager chooses to logout
*/
bool HRManagerMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: HRManagerMenu.h
* Description: Declaration of the EmployeeMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class HRManagerMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
HRManagerMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
HRManagerMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,9 +1,24 @@
/*
* File: ITExecutiveMenu.cpp
* Description: Implements the ITExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "ITExecutiveMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: ITExecutiveMenu::run
* Description: Starts the IT executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void ITExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -28,6 +43,15 @@ void ITExecutiveMenu::run()
}
}
/*
* Function: ITExecutiveMenu::handleOperation
* Description: Handles the IT executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the IT executive chooses to logout
*/
bool ITExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: ITExecutiveMenu.h
* Description: Declaration of the ITExecutiveMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class ITExecutiveMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
ITExecutiveMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
ITExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,9 +1,24 @@
/*
* File: TalentExecutiveMenu.cpp
* Description: Implements the TalentExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "TalentExecutiveMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: TalentExecutiveMenu::run
* Description: Starts the talent executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void TalentExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -28,6 +43,15 @@ void TalentExecutiveMenu::run()
}
}
/*
* Function: TalentExecutiveMenu::handleOperation
* Description: Handles the talent executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the talent executive chooses to logout
*/
bool TalentExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: TalentExecutiveMenu.h
* Description: Declaration of the TalentExecutiveMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class TalentExecutiveMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
TalentExecutiveMenu() : m_zenvyController(std::make_shared < ZenvyController>()) {};
TalentExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,9 +1,24 @@
/*
* File: TeamExecutiveMenu.cpp
* Description: Implements the TeamExecutiveMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "TeamExecutiveMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: TeamExecutiveMenu::run
* Description: Starts the team executive menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void TeamExecutiveMenu::run()
{
bool isMenuActive = true;
@@ -28,6 +43,15 @@ void TeamExecutiveMenu::run()
}
}
/*
* Function: TeamExecutiveMenu::handleOperation
* Description: Handles the team executives menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the team executive chooses to logout
*/
bool TeamExecutiveMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: TeamExecutiveMenu.h
* Description: Declaration of the TeamExecutiveMenu and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class TeamExecutiveMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
TeamExecutiveMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
TeamExecutiveMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,9 +1,24 @@
/*
* File: TeamLeadMenu.cpp
* Description: Implements the TeamLeadMenu class functions including menu loop and operation handling.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include "TeamLeadMenu.h"
#include "InputHelper.h"
#include "OutputHelper.h"
#include "MenuHelper.h"
/*
* Function: TeamLeadMenu::run
* Description: Starts the team lead menu loop and displays available options until logout is selected
* Parameters:
* None
* Returns:
* None
*/
void TeamLeadMenu::run()
{
bool isMenuActive = true;
@@ -28,6 +43,15 @@ void TeamLeadMenu::run()
}
}
/*
* Function: TeamLeadMenu::handleOperation
* Description: Handles the team leads menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the menu should remain active
* false - if the team lead chooses to logout
*/
bool TeamLeadMenu::handleOperation(int choice)
{
switch (choice)
@@ -1,13 +1,19 @@
/*
* File: TeamLeadMenu.h
* Description: Declaration of the TeamLeadMenu class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include<memory>
#include"ZenvyController.h"
class TeamLeadMenu
{
private:
std::shared_ptr<ZenvyController> m_zenvyController;
ZenvyController* m_zenvyController;
public:
TeamLeadMenu() : m_zenvyController(std::make_shared<ZenvyController>()) {};
TeamLeadMenu() : m_zenvyController(new ZenvyController()) {};
void run();
bool handleOperation(int);
};
@@ -1,6 +1,12 @@
/*
* File: UserInterface.cpp
* Description: Implements the UserInterface class functions including menu loop, login handling, and routing to appropriate role-based menus.
* Author: Trenser
* Created: 02-Apr-2026
*/
#include <iostream>
#include <utility>
#include <memory>
#include <stdexcept>
#include "UserInterface.h"
#include "AdminMenu.h"
@@ -16,6 +22,14 @@
#include "OutputHelper.h"
#include "Validator.h"
/*
* Function: UserInterface::run
* Description: Starts the user interface loop and displays login/exit options until exit is selected
* Parameters:
* None
* Returns:
* None
*/
void UserInterface::run()
{
bool isMenuActive = true;
@@ -58,6 +72,15 @@ void UserInterface::run()
}
}
/*
* Function: UserInterface::handleOperation
* Description: Handles the users menu choice and executes the corresponding action
* Parameters:
* choice - integer representing the selected menu option
* Returns:
* true - if the interface should remain active
* false - if the user chooses to exit
*/
bool UserInterface::handleOperation(int choice)
{
switch (choice)
@@ -75,6 +98,14 @@ bool UserInterface::handleOperation(int choice)
return true;
}
/*
* Function: UserInterface::login
* Description: Authenticates the user by email and password, validates login status, and routes to the appropriate menu
* Parameters:
* None
* Returns:
* None
*/
void UserInterface::login()
{
std::string email, password;
@@ -118,7 +149,6 @@ void UserInterface::login()
}
}
util::clear();
// Route to appropriate menu
switch (employeeType)
{
case Enums::EmployeeType::ADMIN:
@@ -177,4 +207,17 @@ void UserInterface::login()
break;
}
m_controller->logout();
}
UserInterface::~UserInterface()
{
delete m_controller;
delete m_employeeMenu;
delete m_adminMenu;
delete m_financeExecutiveMenu;
delete m_hrManagerMenu;
delete m_itExecutiveMenu;
delete m_talentExecutiveMenu;
delete m_teamExecutiveMenu;
delete m_teamLeadMenu;
}
@@ -1,5 +1,11 @@
/*
* File: UserInterface.h
* Description: Declaration of the UserInterface class and related functions.
* Author: Trenser
* Created: 02-Apr-2026
*/
#pragma once
#include <memory>
#include <utility>
#include "AdminMenu.h"
#include "EmployeeMenu.h"
@@ -14,27 +20,28 @@
class UserInterface
{
private:
std::shared_ptr<ZenvyController> m_controller;
std::shared_ptr<EmployeeMenu> m_employeeMenu;
std::shared_ptr<AdminMenu> m_adminMenu;
std::shared_ptr<FinanceExecutiveMenu> m_financeExecutiveMenu;
std::shared_ptr<HRManagerMenu> m_hrManagerMenu;
std::shared_ptr<ITExecutiveMenu> m_itExecutiveMenu;
std::shared_ptr<TalentExecutiveMenu> m_talentExecutiveMenu;
std::shared_ptr<TeamExecutiveMenu> m_teamExecutiveMenu;
std::shared_ptr<TeamLeadMenu> m_teamLeadMenu;
ZenvyController* m_controller;
EmployeeMenu* m_employeeMenu;
AdminMenu* m_adminMenu;
FinanceExecutiveMenu* m_financeExecutiveMenu;
HRManagerMenu* m_hrManagerMenu;
ITExecutiveMenu* m_itExecutiveMenu;
TalentExecutiveMenu* m_talentExecutiveMenu;
TeamExecutiveMenu* m_teamExecutiveMenu;
TeamLeadMenu* m_teamLeadMenu;
public:
UserInterface() : m_controller(std::make_shared<ZenvyController>()),
m_employeeMenu(std::make_shared<EmployeeMenu>()),
m_adminMenu(std::make_shared<AdminMenu>()),
m_financeExecutiveMenu(std::make_shared<FinanceExecutiveMenu>()),
m_hrManagerMenu(std::make_shared<HRManagerMenu>()),
m_itExecutiveMenu(std::make_shared<ITExecutiveMenu>()),
m_talentExecutiveMenu(std::make_shared<TalentExecutiveMenu>()),
m_teamExecutiveMenu(std::make_shared<TeamExecutiveMenu>()),
m_teamLeadMenu(std::make_shared<TeamLeadMenu>()) {};
void run();
bool handleOperation(int choice);
void login();
};
UserInterface() :
m_controller(new ZenvyController()),
m_employeeMenu(new EmployeeMenu()),
m_adminMenu(new AdminMenu()),
m_financeExecutiveMenu(new FinanceExecutiveMenu()),
m_hrManagerMenu(new HRManagerMenu()),
m_itExecutiveMenu(new ITExecutiveMenu()),
m_talentExecutiveMenu(new TalentExecutiveMenu()),
m_teamExecutiveMenu(new TeamExecutiveMenu()),
m_teamLeadMenu(new TeamLeadMenu()) {};
void run();
bool handleOperation(int choice);
void login();
~UserInterface();
};