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,18 +12,32 @@
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 << "" << std::endl; 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); util::read(choice);
if (!handleOperation(choice)) if (!handleOperation(choice))
{ {
isMenuActive = false; break;
} }
} }
catch (const std::exception& e) catch (const std::exception& e)
@@ -36,7 +50,55 @@ void AdminMenu::showMenu()
bool AdminMenu::handleOperation(int choice) bool AdminMenu::handleOperation(int choice)
{ {
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; return false;
default:
std::cout << "Enter a valid choice!" << std::endl;
util::pressEnter();
}
return true;
} }
@@ -5,18 +5,22 @@
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 << "" << std::endl; std::cout << "Technician Menu"
<< "\n1. Mark Job as Completed"
<< "\n2. View Notifications"
<< "\n3. Change Password"
<< "\n4. Logout"
<< "\nEnter a choice: ";
util::read(choice); util::read(choice);
if (!handleOperation(choice)) if (!handleOperation(choice))
{ {
isMenuActive = false; break;
} }
} }
catch (const std::exception& e) catch (const std::exception& e)
@@ -29,7 +33,25 @@ void TechnicianMenu::showMenu()
bool TechnicianMenu::handleOperation(int choice) bool TechnicianMenu::handleOperation(int choice)
{ {
switch (choice)
{
case 1:
completeJob();
break;
case 2:
viewNotifications();
break;
case 3:
changePassword();
break;
case 4:
logout();
return false; return false;
default:
std::cout << "Enter a valid choice!" << std::endl;
util::pressEnter();
}
return true;
} }
void TechnicianMenu::completeJob() void TechnicianMenu::completeJob()