From be306781b1e392cb43d0d7c2d9212f4a75a4afa2 Mon Sep 17 00:00:00 2001 From: Joel Thomas Date: Thu, 21 May 2026 09:37:03 +0530 Subject: [PATCH] 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 --- .../views/CustomerMenu.cpp | 90 ++++++++++++++----- 1 file changed, 68 insertions(+), 22 deletions(-) diff --git a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp index 047f471..ee467d9 100644 --- a/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp +++ b/Trenser.VehicleServiceSystem/Trenser.VehicleServiceSystem/views/CustomerMenu.cpp @@ -4,31 +4,77 @@ void CustomerMenu::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 << "Customer Menu" + << "\n1. Select a service" + << "\n2. Select a combo package" + << "\n3. Update Profile" + << "\n4. Change Password" + << "\n5. View Service History" + << "\n6. Complete Payments" + << "\n7. View Invoices" + << "\n8. View Notifications" + << "\n9. Configure Notifications" + << "\n10. 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 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() @@ -69,4 +115,4 @@ void CustomerMenu::viewNotifications() void CustomerMenu::configureNotifications() { -} +} \ No newline at end of file