Implement Customer Menu

* Added Customer Menu display with all customer options
* Added menu choice handling using switch case
* Connected menu options to corresponding customer functions
* Added invalid choice message
* Added logout option handling
This commit is contained in:
2026-05-21 09:37:03 +05:30
parent 56c5c2dc70
commit be306781b1
@@ -4,31 +4,77 @@
void CustomerMenu::showMenu() void CustomerMenu::showMenu()
{ {
bool isMenuActive = true; while (true)
while (isMenuActive) {
{ try
try {
{ int choice;
int choice; util::clear();
util::clear(); std::cout << "Customer Menu"
std::cout << "" << std::endl; << "\n1. Select a service"
util::read(choice); << "\n2. Select a combo package"
if (!handleOperation(choice)) << "\n3. Update Profile"
{ << "\n4. Change Password"
isMenuActive = false; << "\n5. View Service History"
} << "\n6. Complete Payments"
} << "\n7. View Invoices"
catch (const std::exception& e) << "\n8. View Notifications"
{ << "\n9. Configure Notifications"
std::cout << "Exception: " << e.what() << std::endl; << "\n10. Logout"
util::pressEnter(); << "\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 CustomerMenu::handleOperation(int choice) bool CustomerMenu::handleOperation(int choice)
{ {
return false; switch (choice)
{
case 1:
selectService();
break;
case 2:
selectComboPackage();
break;
case 3:
updateDetails();
break;
case 4:
changePassword();
break;
case 5:
viewServiceHistory();
break;
case 6:
completePayments();
break;
case 7:
viewInvoices();
break;
case 8:
viewNotifications();
break;
case 9:
configureNotifications();
break;
case 10:
logout();
return false;
default:
std::cout << "Enter a valid choice!" << std::endl;
util::pressEnter();
}
return true;
} }
void CustomerMenu::logout() void CustomerMenu::logout()
@@ -69,4 +115,4 @@ void CustomerMenu::viewNotifications()
void CustomerMenu::configureNotifications() void CustomerMenu::configureNotifications()
{ {
} }