03be8f81d2
<SRS> SRS02 : Employee Management </SRS> <Changes> - Removed duplicate employee creation helper functions from AdminMenu and HRManagerMenu - Centralized employee creation flow into MenuHelper.cpp - Updated createEmployee to use current employee type for access control - Fixed parameter order bug in createEmployee (email, name, phone) - Improved menu titles for all roles (removed generic system header) - Added util::pressEnter() for better UX on invalid input across menus - Added newline before pause in InputHelper::pressEnter - Cleaned up minor formatting issues </Changes>
31 lines
606 B
C++
31 lines
606 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <limits>
|
|
#include <string>
|
|
#include <stdexcept>
|
|
|
|
namespace util
|
|
{
|
|
template <typename T>
|
|
inline void read(T& value)
|
|
{
|
|
if (!(std::cin >> value))
|
|
{
|
|
std::cin.clear();
|
|
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
|
throw std::runtime_error("Invalid console input");
|
|
}
|
|
}
|
|
|
|
inline void read(std::string& value)
|
|
{
|
|
std::getline(std::cin >> std::ws, value);
|
|
}
|
|
|
|
inline void pressEnter()
|
|
{
|
|
std::cout << std::endl;
|
|
system("pause");
|
|
}
|
|
} |