Merge branch 'feature-admin-management-menu' into feature-admin-management

This commit is contained in:
Avinash Rajesh
2026-05-21 19:41:39 +05:30
2 changed files with 126 additions and 42 deletions
@@ -12,31 +12,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;
} }
@@ -5,31 +5,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()