Commit Graph

137 Commits

Author SHA1 Message Date
Avinash Rajesh ef5125d445 Merged PR 1044: Admin-Management-1560, Inventory-Management-1552
**Admin Management**
**ADM001 - Add Technician:** Allows admins to create technician accounts for job assignments.
**ADM002 - Remove Technician or Customer:** Allows admins to remove technician or customer accounts from the system.
**ADM003 - Login:** Allows admins and technicians to securely log in to access system features.
**ADM004 - Logout:** Allows admins and technicians to securely log out of the system.
**ADM005 - Change Password:** Allows admins and technicians to update their account password for security.
**ADM006 - Create Combo Package:** Allows admins to create discounted combo service packages for customers.
**ADM007 - Remove Combo Package:** Allows admins to remove outdated combo packages from the system.

**Inventory Management**
**INV001 - View Stock Levels:** Allows admins to view current inventory stock levels and track spare part availability.
**INV002 - Add Stock:** Allows admins to add new inventory items or update stock quantities.
**INV003 - Remove Stock:** Allows admins to remove inventory items from the system.
**INV004 - Check Stock Availability:** Allows admins to check the availability of a specific stock item.

Related work items: #1552, #1560, #1573, #1574, #1575, #1576, #1582, #1583, #1584, #1585, #1586, #1587, #1588, #1668, #1669, #1672, #1673
2026-05-25 19:00:53 +05:30
joelthomastrenser 53c768bde9 Merge branch 'feature' into feature-1552-1560 2026-05-25 18:58:55 +05:30
Avinash Rajesh 45d4f693b6 Fix PR review comments and refactor menu helper logic
Changes:

- Added missing include for MenuHelper.h in project and AdminMenu
- Fixed typo in variable name inventoryIems to inventoryItems in Controller.cpp
- Removed stray semicolon from include in Controller.h
- Cleaned up duplicate comments in Controller.cpp description header
- Minor formatting adjustments with blank lines after headers in multiple files
- Updated ServiceManagementService notification message to remove informal wording
- Refactored AdminMenu::changePassword to use changePasswordHelper
- Added util::clear() call at start of viewStockLevels
- Removed redundant helper functions from AdminMenu.cpp and moved to shared helpers
- Fixed bug in removeInventoryItem to use activeItems instead of inventoryItems
- Enhanced createComboPackages to enforce selection of two distinct services
- General comment cleanup and formatting consistency across headers and implementation files
2026-05-25 17:32:17 +05:30
Jissin Mathew 1c717bb9fa Fix PR review comments
Changes:
    1. Added missing include for MenuHelper.h in project, AdminMenu, and CustomerMenu.
    2. Updated PaymentManagementService::completePayment to guard against duplicate completion by checking status before updating.
    3. Enhanced ServiceManagementService::createJobCard with null checks for inventory items and safe stock decrement logic.
    4. Added null check for job card creation in ServiceManagementService and throw runtime error if creation fails.
    5. Refactored ServiceManagementService::removeService to use m_dataStore.getServices() reference instead of getServices() copy.
    6. Renamed helper function hasAllJobCardsinServiceBookingCompleted to hasCompletedAllJobs for clarity and updated usage in completeJob.
    7. Fixed ServiceJobStatus string conversion in Enums.h to correctly return "PENDING" instead of "STARTED".
    8. Added support for parsing "PENDING" string to ServiceJobStatus::PENDING in Enums.h.
    9. Cleaned up AdminMenu.cpp by removing redundant static helper functions (listServiceBookings, selectPendingServiceBookings, listAvailableTechnicians, selectTechnician, selectInventoryItems, selectServicesToRemove).
    10. Replaced removed helpers with shared MenuHelper usage and added util::pressEnter() calls for consistent user flow.
    11. Simplified CustomerMenu.cpp by removing redundant static helpers (selectInvoiceFromUserForPayment, selectPaymentMode, displayInvoices) and moved logic to shared helpers.
    12. General formatting and comment cleanup across AdminMenu.cpp and CustomerMenu.cpp for consistency.
2026-05-25 17:31:20 +05:30
joelthomastrenser 5c23c1b9a1 Merged PR 1043: Customer-Management-1551, Notification-Management-1561, File-Management-1708
**Customer Management**
* **CUS001 - Login:** Allows customers to securely log in using valid username and password.
* **CUS002 - Logout:** Allows customers to safely log out of the system.
* **CUS003 - Change Password:** Allows customers to update their account password for security.
* **CUS004 - Customer Registration:** Allows new customers to create an account by entering personal and vehicle details.
* **CUS005 - Update Customer Details:** Allows customers to modify their saved personal information.
* **CUS006 - Select Individual Service:** Allows customers to choose and book a single vehicle service.
* **CUS007 - Select Combo Package:** Allows customers to choose and book a combo package with multiple services.

**Notification Management**
* **NOT001 - View Customer Notifications:** Allows customers to view and manage their notifications for important updates.
* **NOT002 - View Admin Notifications:** Allows admins to view and manage their notifications for important updates.
* **NOT003 - View Technician Notifications:** Allows technicians to view and manage their notifications for important updates.
* **NOT004 - Low Stock Alert:** Sends notifications to admins when inventory stock falls below the threshold.
* **NOT005 - Payment Reminder:** Sends payment reminder notifications to customers for unpaid invoices.
* **NOT006 - Configure Notifications:** Allows customers to manage notification preferences for selected services.

**File Management**
* **File Management:** Handles file-related operations such as storing, retrieving, updating, and managing files within the system.

Related work items: #1551, #1561, #1563, #1564, #1568, #1569, #1570, #1571, #1572, #1592, #1593, #1594, #1595, #1596, #1597, #1624, #1626, #1648, #1649, #1708, #1709
2026-05-25 16:05:40 +05:30
joelthomastrenser 1e8fd2829f Fix PR review comments and refactor menu helper logic
Changes:
- Added name parameter to createTechnician for consistency
- Added function headers for notification-related methods in InventoryManagementService
- Used variables for notification title and message instead of passing strings directly
- Fixed payment reminder notification message formatting
- Moved common helper functions to MenuHelper.h
- Updated CustomerMenu to use shared helper functions instead of duplicate code
- Added missing includes in MenuHelper.h
- Removed redundant helper code from CustomerMenu.cpp
- Minor formatting and comment cleanup
2026-05-25 15:46:11 +05:30
joelthomastrenser 28e4b17c63 Merge branch 'feature-file-management' into feature-1551-1561-1708 2026-05-25 14:24:21 +05:30
Jissin Mathew 6392191c14 Merge branch 'feature-payment-management' into feature-1553-1598 2026-05-25 12:11:20 +05:30
Avinash Rajesh c44b8ffd4e Merge branch 'feature-inventory-management' into feature-1552-1560 2026-05-25 12:02:30 +05:30
joelthomastrenser 72860edd18 Merge branch 'feature-notification-management' into feature-1551-1561-1708 2026-05-25 11:48:25 +05:30
Avinash Rajesh c5f87a0c68 Add standardized documentation headers 2026-05-25 10:54:35 +05:30
Jissin Mathew 014d4eaa0d Align enum string values with actual State names 2026-05-22 17:12:47 +05:30
Jissin Mathew 388e459a5a Add documentation headers across system modules 2026-05-22 16:52:06 +05:30
joelthomastrenser 53713f444b Implement serialization/deserialization and persistent storage across services
- Add serialize/deserialize support for core models
- Add file-based load/save functions in management services
- Introduce FileManager, Config, Utility and helper utilities
- Persist observer IDs for notification services
- Resolve object relationships during load (services, bookings, invoices, job cards)
- Add controller-level loadSystemData/saveSystemData
- Load data at app startup and save on shutdown
2026-05-22 16:50:28 +05:30
Avinash Rajesh 34cb64ab1b Add standardized documentation headers 2026-05-22 13:26:02 +05:30
Jissin Mathew f1d146a37c Add documentation headers across system modules 2026-05-22 13:21:51 +05:30
Jissin Mathew 0519690043 Add documentation headers across system modules 2026-05-22 13:11:11 +05:30
Jissin Mathew 500eb95f12 Add documentation headers across system modules 2026-05-22 12:49:14 +05:30
Avinash Rajesh 6ca659c573 Add standardized documentation headers 2026-05-22 11:27:49 +05:30
Jissin Mathew 340f00deef Merge branch 'feature-notification-management-not006' into feature-notification-management 2026-05-21 21:07:17 +05:30
Jissin Mathew 0933db41a5 Merge branch 'feature-notification-management-not005' into feature-notification-management 2026-05-21 21:00:20 +05:30
Jissin Mathew 8a595a5893 Merge branch 'feature-notification-management-not004' into feature-notification-management 2026-05-21 20:54:20 +05:30
Jissin Mathew a8f934c7c5 Merge branch 'feature-notification-management-not003' into feature-notification-management 2026-05-21 20:48:41 +05:30
Jissin Mathew 166cc02aaa Merge branch 'feature-notification-management-not002' into feature-notification-management 2026-05-21 20:46:02 +05:30
joelthomastrenser b8e87ade0f Implement View Customer Notifications
<UserStory> NOT001: View Customer Notifications </UserStory>

<Changes>
1. Added shared notification helper functions to display notifications in tabular format, support notification selection, and show full notification details.
2. Implemented notification deletion logic in Controller and UserManagementService to remove notifications for the authenticated user after viewing.
3. Updated CustomerMenu::viewNotifications() to use the shared notification viewing and deletion flow.
</Changes>

<Test>

Precondition:
1. Customer is registered in the system.
2. Customer is logged into the system.
3. Customer has one or more notifications available.

Steps:
1. Navigate to “View Notifications” from the customer menu.
- Verify that the system displays the list of notifications with title and timestamp.

2. Select a notification from the displayed list.
   - Verify that the system displays the full notification details including message.

3. View the selected notification and continue.
   - Verify that the viewed notification is deleted from the system.

4. Navigate to “View Notifications” again.
   - Verify that the previously viewed notification no longer appears in the notification list.

</Test>

<Review>
Sreeja Reghukumar, please review
</Review>
2026-05-21 20:39:13 +05:30
Avinash Rajesh 7e9cc27f1c Merge branch 'feature-inventory-management-inv004' into feature-inventory-management 2026-05-21 20:14:03 +05:30
Avinash Rajesh 1377d5fb39 Merge branch 'feature-inventory-management-inv003' into feature-inventory-management 2026-05-21 20:11:55 +05:30
Avinash Rajesh d33f0aa8dc Merge branch 'feature-inventory-management-inv002' into feature-inventory-management 2026-05-21 20:09:53 +05:30
Avinash Rajesh 337fb00e1f Merge branch 'feature-admin-management-menu' into feature-admin-management 2026-05-21 19:41:39 +05:30
Avinash Rajesh 33a3677f6e Merge branch 'feature-admin-management-adm007' into feature-admin-management 2026-05-21 19:22:52 +05:30
Avinash Rajesh 3a8db0cdae Merge branch 'feature-admin-management-adm006' into feature-admin-management 2026-05-21 19:16:50 +05:30
Avinash Rajesh 7c993521a2 Merge branch 'feature-admin-management-adm005' into feature-admin-management 2026-05-21 19:10:58 +05:30
Avinash Rajesh ef2fa6d521 Merge branch 'feature-admin-management-adm004' into feature-admin-management 2026-05-21 19:06:44 +05:30
Avinash Rajesh c8647eedd9 Merge branch 'feature-admin-management-adm003' into feature-admin-management 2026-05-21 19:02:57 +05:30
Avinash Rajesh 665d9192fa Merge branch 'feature-admin-management-adm002' into feature-admin-management 2026-05-21 18:55:23 +05:30
Jissin Mathew 0adb864329 Merge branch 'feature-service-management-ser005' into feature-service-management 2026-05-21 18:34:12 +05:30
Jissin Mathew a3ad4d2e00 Merge branch 'feature-payment-management-pay003' into feature-payment-management 2026-05-21 18:11:09 +05:30
Jissin Mathew 86fd32bd2b Merge branch 'feature-service-management-ser004' into feature-service-management 2026-05-21 17:26:27 +05:30
Jissin Mathew fceb1cbec6 Merge branch 'feature-service-management-ser003' into feature-service-management 2026-05-21 17:10:53 +05:30
Jissin Mathew 53ff70a85f Merge branch 'feature-service-management-ser002' into feature-service-management 2026-05-21 16:54:07 +05:30
Jissin Mathew 4a4309d585 Merge branch 'feature-payment-management-pay002' into feature-payment-management 2026-05-21 16:20:42 +05:30
Jissin Mathew 61f70a54f6 Implement Generate Invoice
<UserStory> PAY001: Generate Invoice </UserStory>

<Changes>
    1. Added Utility.h to project configuration for supporting invoice generation utilities.
    2. Updated Invoice model to use string-based keys for parts mapping instead of integer keys.
    3. Implemented PaymentManagementService::generateInvoice to aggregate labour cost, parts cost, and apply discounts.
    4. Integrated invoice creation with Factory to instantiate Invoice objects and persist them into datastore.
    5. Enhanced Enums with PaymentMode::NOTSET to handle default invoice state.
</Changes>

<Test>

 Acceptance Criteria:
 1. Invoice auto-generates for each service booking once jobs are completed.
 2. Invoice shows a clear breakdown of charges including labour cost, parts cost, discount, and total amount.

 Precondition:
  1. Service booking exists with at least one service and required inventory items.
  2. Datastore is available for storing invoices.
  3. Payment mode and status enums are properly configured.

 Steps:
  1. Complete all jobs in a service booking.
    - Verify that PaymentManagementService::generateInvoice is triggered.
  2. Check datastore for newly created invoice.
    - Verify that invoice contains booking ID, labour cost, parts cost, discount, and total amount.
  3. Inspect invoice details.
    - Verify that breakdown of charges is accurate and discount is applied correctly.
  4. Confirm invoice status.
    - Verify that invoice is created with PaymentMode::NOTSET and PaymentStatus::PENDING.
</Test>

<Review>
Sreeja Reghukumar, please review
</Review>
2026-05-21 16:05:10 +05:30
Avinash Rajesh d161ac313c Implement Change Password Functionality
<UserStory> ADM005: Change Password </UserStory>

<Changes>
    1. Added AuthenticationManagementService::changePassword to update the authenticated user’s password with validation.
    2. Integrated Controller::changePassword to delegate password update requests to AuthenticationManagementService.
    3. Enhanced AdminMenu::changePassword to prompt for new password, validate strength using Validator, and confirm update.
    4. Added error handling to prevent password change when no user is logged in.
    5. Provided user feedback messages for invalid password attempts and successful updates.
</Changes>

<Test>

  Precondition:
  1. Admin is logged into the system.
  2. AuthenticationManagementService maintains active session.
  3. Validator is available for password strength checks.

  Steps:
  1. Navigate to Admin Menu and select "Change Password".
  2. Enter old password incorrectly.
    - Verify that system rejects the attempt and displays error.
  3. Enter new password that fails validation (length/complexity).
    - Verify that system rejects with "Error: Password is not strong enough!".
  4. Enter valid old password and strong new password.
    - Verify that system confirms "Password changed successfully" and updates the user’s password.
</Test>

<Review>
Sreeja Reghukumar
</Review>
2026-05-21 15:12:16 +05:30
Jissin Mathew 461857f971 Implement View Invoices for Customer
<UserStory> PAY003: View Invoices </UserStory>

<Changes>
    1. Added CustomerMenu::viewInvoices to fetch invoices via Controller and display them to the customer.
    2. Implemented displayInvoices helper to show invoice details including booking, vehicle, technician, discount, total amount, invoice date, and payment status.
    3. Enhanced invoice display to include a tabular breakdown of inventory items (ItemName, Quantity, Price) used in the service.
    4. Updated ServiceBooking to store assigned technician as a const User* for richer technician details in invoice output.
</Changes>

<Test>

 Acceptance Criteria:
 1. Invoice details should show total cost and discounts.
 2. Invoice details should show list of parts used.

 Precondition:
  1. Customer is logged into the system.
  2. At least one invoice exists for the customer in the datastore.
  3. Inventory items are linked to the invoice.

 Steps:
  1. Navigate to Customer menu and choose "View Invoices".
    - Verify that the system lists invoice details including booking ID, vehicle info, technician, discount, total amount, invoice date, and payment status.
  2. Check the parts list under each invoice.
    - Verify that inventory items are displayed in tabular form with ItemName, Quantity, and Price.
  3. Confirm that discounts and total cost are shown correctly.
</Test>

<Review>
Sreeja Reghukumar, please review
</Review>
2026-05-21 15:09:16 +05:30
Avinash Rajesh fa08d4a90f Implement Login Functionality
<UserStory> ADM003: Login </UserStory>

<Changes>
    1. Added credential input handling in UserInterface::login with username and password prompts.
    2. Integrated Controller::login to validate credentials and retrieve authenticated user.
    3. Implemented role-based menu navigation: Admin → AdminMenu, Technician → TechnicianMenu, Customer → CustomerMenu.
    4. Added error handling for invalid credentials and unknown user types with clear feedback messages.
    5. Included util::clear for screen refresh and structured output formatting during login.
</Changes>

<Test>

  Precondition:
  1. Valid user accounts exist in the system (Admin, Technician, Customer).
  2. Controller is connected to UserManagementService for authentication.
  3. UserInterface is initialized with role-specific menus.

  Steps:
  1. Launch UserInterface and select "Login".
  2. Enter incorrect username or password.
    - Verify that system displays "Error: Invalid Username or Password".
  3. Enter valid admin credentials.
    - Verify that AdminMenu is displayed successfully.
  4. Enter valid technician or customer credentials.
    - Verify that TechnicianMenu or CustomerMenu is displayed accordingly.
</Test>

<Review>
Sreeja Reghukumar
</Review>
2026-05-21 15:09:04 +05:30
Jissin Mathew cb3bed4050 Implement Complete Payments
<UserStory> PAY002: Complete Payments </UserStory>

<Changes>
    1. Integrated Controller with PaymentManagementService to support payment completion workflow.
    2. Implemented PaymentManagementService::completePayment with validation for invoice ID, payment mode, and status update.
    3. Enhanced CustomerMenu with helper functions to display pending invoices in tabular format and allow index-based selection.
    4. Added CustomerMenu::selectPaymentMode to capture payment mode choice (OFFLINE/ONLINE).
    5. Updated CustomerMenu::completePayments to handle invoice selection, payment mode input, and trigger payment completion via Controller.
    6. Implemented notification logic to send confirmation to customers upon successful payment.
</Changes>

<Test>

 Acceptance Criteria:
 1. Payment status marked completed.
 2. Confirmation message shown.
 3. Confirmation notification sent.

 Precondition:
  1. Customer is logged into the system.
  2. At least one pending invoice exists for the customer.
  3. Datastore is available for storing invoices and updating payment status.

 Steps:
  1. Navigate to Customer menu and choose "Complete Payments".
    - Verify that the system lists pending invoices with tabular details.
  2. Select an invoice by index.
    - Verify that the chosen invoice is retrieved correctly.
  3. Enter payment mode (OFFLINE/ONLINE).
    - Verify that the selected mode is applied to the invoice.
  4. Confirm payment completion.
    - Verify that the invoice status changes to COMPLETED.
    - Verify that a confirmation message is displayed.
    - Verify that a notification is sent to the customer.
</Test>

<Review>
Sreeja Reghukumar, please review
</Review>
2026-05-21 15:08:25 +05:30
Avinash Rajesh b230e3062c Implement Remove Customer or Technician Functionality
<UserStory> ADM002: Remove Technician or Customer </UserStory>

<Changes>
    1. Integrated UserManagementService and ServiceManagementService into Controller for user removal operations.
    2. Added Controller::removeUser to validate user existence, cancel related service bookings and technician jobs, and mark user inactive.
    3. Updated JobCard and ServiceBooking models to use util::ServiceJobStatus consistently and store technician references as User* instead of strings.
    4. Extended util::ServiceJobStatus enum with PENDING and CANCELLED states, including string conversion support.
    5. Implemented ServiceManagementService methods to cancel customer service bookings and technician jobs, with inventory restocking and notifications.
    6. Enhanced AdminMenu::removeUser to list active users, validate index input, confirm deletion, and invoke Controller::removeUser.
    7. Added helper functions in AdminMenu to filter active users and display them with formatted output including user type.
</Changes>

<Test>

  Precondition:
  1. Admin is logged into the system.
  2. Technician accounts exist in the system.
  3. Technician has active job assignments.

  Steps:
  1. Navigate to Admin Menu and select "Remove User".
  2. System displays list of active users with IDs, usernames, and user types.
    - Verify that inactive users are excluded from the list.
  3. Admin selects technician ID for removal.
    - Verify that system confirms deletion before proceeding.
  4. Technician is removed from job assignment list.
    - Verify that associated jobs are cancelled, inventory is restocked, and notifications are sent.
</Test>

<Review>
Sreeja Reghukumar
</Review>
2026-05-21 15:07:25 +05:30
Avinash Rajesh 2bdf0eb741 Implement Add Technician Functionality
<UserStory> ADM001: Add Technician </UserStory>

<Changes>
    1. Added UserManagementService integration in Controller to support technician account creation.
    2. Updated Controller::createTechnician method to call createUser with util::UserType::TECHNICIAN.
    3. Renamed parameter from 'phone' to 'phoneNumber' for clarity and consistency.
    4. Enhanced AdminMenu::addTechnician with input validation for password, email, and phone number.
    5. Added success and error handling messages in AdminMenu for technician creation workflow.
</Changes>

<Test>

  Precondition:
  1. Admin is logged into the system.
  2. UserManagementService is available and connected.
  3. No existing technician account with the same username/email.

  Steps:
  1. Navigate to Admin Menu and select "Add Technician".
  2. Enter technician details (username, password, email, phone number).
    - Verify that invalid password/email/phone inputs are rejected with error messages.
  3. Enter valid technician details.
    - Verify that uniqueness is checked and duplicate accounts are not created.
  4. Submit valid details.
    - Verify that technician account is created successfully and confirmation message is displayed.
</Test>

<Review>
Sreeja Reghukumar
</Review>
2026-05-21 15:06:32 +05:30
Avinash Rajesh ef41fec208 Implement Check Availability Status Functionality
<UserStory> INV004: Check Availability Status </UserStory>

<Changes>
    1. Updated Controller to delegate getInventoryItem calls to InventoryManagementService.
    2. Implemented InventoryManagementService::getInventoryItem to fetch items from datastore by ID.
    3. Enhanced AdminMenu with checkStockAvailability function:
       - Accepts part ID as input.
       - Retrieves item details from Controller.
       - Displays item information (ID, part name, quantity) if found and active.
       - Handles inactive or missing items gracefully.
</Changes>

<Test>

  Precondition:
  1. Admin user is logged into the system.
  2. Inventory contains multiple items with unique IDs.
  3. DataStore is initialized and accessible.

  Steps:
  1. Navigate to Admin Menu and select "Check Stock Availability".
    - Verify that the system prompts for an Item ID.
  2. Enter a valid Item ID for an active item.
    - Verify that the system displays the item’s details including current quantity.
  3. Enter an Item ID that does not exist.
    - Verify that the system displays “Item not found”.
  4. Enter an Item ID for an inactive item.
    - Verify that the system does not display details and indicates the item is inactive.
</Test>

<Review>
Sreeja Reghukumar
</Review>
2026-05-21 15:04:37 +05:30
Avinash Rajesh 3594fa4f26 Implement Remove Stock Functionality
<UserStory> INV003: Remove Stock </UserStory>

<Changes>
    1. Integrated InventoryManagementService into Controller to handle removal of inventory items.
    2. Implemented InventoryManagementService::removeInventoryItem to mark items as INACTIVE in the datastore.
    3. Enhanced AdminMenu with removeInventoryItem workflow:
       - Displays inventory list with index, ID, part name, quantity, and price.
       - Allows admin to select item by index for removal.
       - Provides confirmation message after successful deletion.
    4. Added static helper function displayInventoryWithItems in AdminMenu for modularized inventory display.
</Changes>

<Test>

  Precondition:
  1. Admin user is logged into the system.
  2. Inventory contains multiple items with unique IDs.
  3. DataStore is initialized and accessible.

  Steps:
  1. Navigate to Admin Menu and select "Remove Inventory Item".
    - Verify that the system displays all inventory items with ID, part name, quantity, and price.
  2. Select an item by entering its index.
    - Verify that the system removes the item and displays a confirmation message.
  3. Attempt to remove an item with an invalid index.
    - Verify that the system rejects the input and shows an error message.
  4. Navigate to "View Stock Levels".
    - Verify that the removed item no longer appears in the inventory list.
</Test>

<Review>
Sreeja Reghukumar
</Review>
2026-05-21 15:03:03 +05:30