2ea77bf9b6
<UserStory> SER1798: Update Job Status </UserStory>
<Changes>
1. Renamed Controller and ServiceManagementService methods from completeJob to updateJobStatus for clarity and flexibility.
2. Enhanced ServiceManagementService::updateJobStatus to support transitions:
- STARTED → INPROGRESS
- INPROGRESS → COMPLETED (with invoice generation and customer notification).
3. Added INPROGRESS state to ServiceJobStatus enum and updated string conversion utilities.
4. Introduced filterJobCards helper to generalize job filtering by status.
5. Updated TechnicianMenu to allow technicians to select job type (Started/Inprogress) and update status accordingly.
6. Improved job display to show current status and truncated service names for readability.
</Changes>
<Test>
Acceptance Criteria:
1. Technician can select a job with status STARTED and update it to INPROGRESS.
2. Technician can select a job with status INPROGRESS and update it to COMPLETED.
3. Completed bookings automatically generate invoices and send notifications to customers.
4. Job status updates are reflected in the technician’s job list and customer view.
Precondition:
1. Technician is logged into the system.
2. Assigned job cards exist with valid statuses (STARTED or INPROGRESS).
3. Datastore and payment service are available.
Steps:
1. Navigate to Technician menu and choose "Update Job Status".
- Verify that the system prompts for job type selection (Started/Inprogress).
2. Select a job card from the filtered list.
- Verify that the job card details are displayed with status.
3. Confirm update.
- Verify that the job status changes correctly.
4. For jobs updated to COMPLETED:
- Verify that the booking status is updated, invoice is generated, and notification is sent.
</Test>
<Review>
Sreeja Reghukumar, please review
</Review>
#1798
59 lines
2.6 KiB
C++
59 lines
2.6 KiB
C++
/*
|
|
File: ServiceManagementService.h
|
|
Description: Header file declaring the ServiceManagementService class, which manages
|
|
services, combo packages, job cards, and service bookings. Inherits from
|
|
NotificationManagementService to handle notifications.
|
|
Author: Trenser
|
|
Date:19-May-2026
|
|
*/
|
|
|
|
#pragma once
|
|
#include <string>
|
|
#include "Map.h"
|
|
#include "NotificationManagementService.h"
|
|
#include "DataStore.h"
|
|
|
|
class Service;
|
|
class ComboPackage;
|
|
class ServiceBooking;
|
|
class JobCard;
|
|
|
|
class ServiceManagementService : public NotificationManagementService
|
|
{
|
|
private:
|
|
DataStore& m_dataStore;
|
|
static util::Map<std::string, User*> m_observers;
|
|
util::Vector<std::string> getObserverIDs() override;
|
|
public:
|
|
ServiceManagementService() : m_dataStore(DataStore::getInstance()) {}
|
|
util::Map<std::string, Service*> getServices();
|
|
util::Map<std::string, ComboPackage*> getComboPackages();
|
|
void purchaseService(const util::Vector<std::string>& serviceIDs, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel);
|
|
void purchaseComboPackage(const std::string& comboPackageID, const std::string& vehicleNumber, const std::string& vehicleBrand, const std::string& vehicleModel);
|
|
util::Map<std::string, ServiceBooking*> getServiceBookings();
|
|
util::Map<std::string, ServiceBooking*> getServiceBookings(const std::string& customerID);
|
|
ServiceBooking* getServiceBooking(const std::string& serviceID);
|
|
void createJobCard(const std::string& bookingID, const std::string& technicianID, const std::string& serviceID);
|
|
void createService(const std::string& name, const util::Vector<std::string>& inventoryItemIDs, double laborCost);
|
|
void removeService(const std::string& serviceID);
|
|
util::Map<std::string, JobCard*> getJobCards(const std::string& technicianID);
|
|
void updateJobStatus(const std::string& jobID);
|
|
void cancelCustomerServiceBookings(const std::string& customerID);
|
|
void cancelTechnicianJobs(const std::string& technicianID);
|
|
void createComboPackage(const std::string& packageName, const util::Vector<std::string>& serviceIDs, double discountPercentage);
|
|
void removeComboPackage(const std::string& comboPackageID);
|
|
void sendNotification(User* user, const std::string& title, const std::string& message) override;
|
|
void attach(User* user) override;
|
|
void detach(User* user) override;
|
|
void loadServices();
|
|
void saveServices();
|
|
void loadComboPackages();
|
|
void saveComboPackages();
|
|
void loadServiceBookings();
|
|
void saveServiceBookings();
|
|
void loadJobCards();
|
|
void saveJobCards();
|
|
void loadObservers();
|
|
void saveObservers();
|
|
};
|