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() void AdminMenu::showMenu()
{ {
bool isMenuActive = true; while (true)
while (isMenuActive) {
{ try
try {
{ int choice;
int choice; util::clear();
util::clear(); std::cout << "Admin Menu"
std::cout << "" << std::endl; << "\n1. View Stock Levels"
util::read(choice); << "\n2. Add Inventory Item"
if (!handleOperation(choice)) << "\n3. Remove Inventory Item"
{ << "\n4. Check Stock Availability"
isMenuActive = false; << "\n5. Assign Job to Technician"
} << "\n6. Add Technician"
} << "\n7. Remove Customer/Technician"
catch (const std::exception& e) << "\n8. Create Service"
{ << "\n9. Remove Service"
std::cout << "Exception: " << e.what() << std::endl; << "\n10. Create Combo Package"
util::pressEnter(); << "\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) 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() void TechnicianMenu::showMenu()
{ {
bool isMenuActive = true; while (true)
while (isMenuActive) {
{ try
try {
{ int choice;
int choice; util::clear();
util::clear(); std::cout << "Technician Menu"
std::cout << "" << std::endl; << "\n1. Mark Job as Completed"
util::read(choice); << "\n2. View Notifications"
if (!handleOperation(choice)) << "\n3. Change Password"
{ << "\n4. Logout"
isMenuActive = false; << "\nEnter a choice: ";
} util::read(choice);
} if (!handleOperation(choice))
catch (const std::exception& e) {
{ break;
std::cout << "Exception: " << e.what() << std::endl; }
util::pressEnter(); }
} catch (const std::exception& e)
} {
std::cout << "Exception: " << e.what() << std::endl;
util::pressEnter();
}
}
} }
bool TechnicianMenu::handleOperation(int choice) 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() void TechnicianMenu::completeJob()
@@ -10,4 +10,6 @@ public:
void showMenu(); void showMenu();
void completeJob(); void completeJob();
void viewNotifications(); void viewNotifications();
void changePassword();
void logout();
}; };