Implement Admin and Technician Menus

Changes:
  - Added Admin Menu display with menu options
  - Added Technician Menu display with menu options
  - Added menu choice handling using switch case
  - Connected menu options to corresponding functions
  - Added invalid choice message
  - Added logout handling
  - Added missing function declarations in TechnicianMenu header
This commit is contained in:
2026-05-21 10:46:23 +05:30
parent 56c5c2dc70
commit 454af1b4ef
3 changed files with 128 additions and 42 deletions
@@ -4,31 +4,93 @@
void AdminMenu::showMenu()
{
bool isMenuActive = true;
while (isMenuActive)
{
try
{
int choice;
util::clear();
std::cout << "" << std::endl;
util::read(choice);
if (!handleOperation(choice))
{
isMenuActive = false;
}
}
catch (const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
util::pressEnter();
}
}
while (true)
{
try
{
int choice;
util::clear();
std::cout << "Admin Menu"
<< "\n1. View Stock Levels"
<< "\n2. Add Inventory Item"
<< "\n3. Remove Inventory Item"
<< "\n4. Check Stock Availability"
<< "\n5. Assign Job to Technician"
<< "\n6. Add Technician"
<< "\n7. Remove Customer/Technician"
<< "\n8. Create Service"
<< "\n9. Remove Service"
<< "\n10. Create Combo Package"
<< "\n11. Remove Combo Package"
<< "\n12. View Notifications"
<< "\n13. Change Password"
<< "\n14. Logout"
<< "\nEnter a choice: ";
util::read(choice);
if (!handleOperation(choice))
{
break;
}
}
catch (const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
util::pressEnter();
}
}
}
bool AdminMenu::handleOperation(int choice)
{
return false;
switch (choice)
{
case 1:
viewStockLevels();
break;
case 2:
addInventoryItem();
break;
case 3:
removeInventoryItem();
break;
case 4:
checkStockAvailability();
break;
case 5:
assignJob();
break;
case 6:
addTechnician();
break;
case 7:
removeUser();
break;
case 8:
createService();
break;
case 9:
removeService();
break;
case 10:
createComboPackages();
break;
case 11:
removeComboPackage();
break;
case 12:
viewNotifications();
break;
case 13:
changePassword();
break;
case 14:
logout();
return false;
default:
std::cout << "Enter a valid choice!" << std::endl;
util::pressEnter();
}
return true;
}
@@ -4,31 +4,53 @@
void TechnicianMenu::showMenu()
{
bool isMenuActive = true;
while (isMenuActive)
{
try
{
int choice;
util::clear();
std::cout << "" << std::endl;
util::read(choice);
if (!handleOperation(choice))
{
isMenuActive = false;
}
}
catch (const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
util::pressEnter();
}
}
while (true)
{
try
{
int choice;
util::clear();
std::cout << "Technician Menu"
<< "\n1. Mark Job as Completed"
<< "\n2. View Notifications"
<< "\n3. Change Password"
<< "\n4. Logout"
<< "\nEnter a choice: ";
util::read(choice);
if (!handleOperation(choice))
{
break;
}
}
catch (const std::exception& e)
{
std::cout << "Exception: " << e.what() << std::endl;
util::pressEnter();
}
}
}
bool TechnicianMenu::handleOperation(int choice)
{
return false;
switch (choice)
{
case 1:
completeJob();
break;
case 2:
viewNotifications();
break;
case 3:
changePassword();
break;
case 4:
logout();
return false;
default:
std::cout << "Enter a valid choice!" << std::endl;
util::pressEnter();
}
return true;
}
void TechnicianMenu::completeJob()
@@ -10,4 +10,6 @@ public:
void showMenu();
void completeJob();
void viewNotifications();
void changePassword();
void logout();
};