8162a2fe3d
<UserStory> SER005: Update Service Status </UserStory>
<Changes>
1. Integrated Controller with ServiceManagementService to support job completion workflow.
2. Implemented ServiceManagementService::completeJob with validation for technician assignment, job existence, and status transition.
3. Enhanced TechnicianMenu with job selection helper to display assigned jobs, allow index-based selection, and handle invalid choices.
4. Updated TechnicianMenu::completeJob to mark job as completed via Controller and provide user feedback.
5. Added logic to check if all jobs in a booking are completed, triggering invoice generation and customer notification.
</Changes>
<Test>
Acceptance Criteria:
1. Status updates are visible to customers immediately after technician marks job as completed.
Precondition:
1. Technician is logged into the system.
2. At least one active job card is assigned to the technician.
3. Datastore contains valid service bookings linked to jobs.
Steps:
1. Navigate to Technician menu and choose "Complete Job".
- Verify that the system lists active jobs with index-based selection.
2. Select a job card by index.
- Verify that the job status changes from STARTED to COMPLETED.
3. Check customer view.
- Verify that the updated status is reflected in the customer’s booking history.
4. If all jobs in the booking are completed:
- Verify that an invoice is generated and a notification is sent to the customer.
</Test>
<Review>
Sreeja Reghukumar, please review
</Review>
57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
#pragma once
|
|
#include <string>
|
|
#include "Timestamp.h"
|
|
#include "Enums.h"
|
|
|
|
class ServiceBooking;
|
|
class Service;
|
|
class User;
|
|
|
|
class JobCard
|
|
{
|
|
private:
|
|
static int m_uid;
|
|
std::string m_id;
|
|
std::string m_bookingId;
|
|
ServiceBooking* m_booking;
|
|
Service* m_service;
|
|
std::string m_serviceId;
|
|
std::string m_technicianId;
|
|
User* m_technician;
|
|
util::Timestamp m_assignedDate;
|
|
util::ServiceJobStatus m_status;
|
|
util::Timestamp m_completionDate;
|
|
|
|
public:
|
|
JobCard();
|
|
JobCard(const std::string& bookingId,
|
|
ServiceBooking* booking,
|
|
Service* service,
|
|
const std::string& serviceId,
|
|
const std::string& technicianId,
|
|
User* technician,
|
|
const util::Timestamp& assignedDate,
|
|
util::ServiceJobStatus status,
|
|
const util::Timestamp& completionDate
|
|
);
|
|
const std::string& getId() const;
|
|
const std::string& getBookingId() const;
|
|
ServiceBooking* getBooking() const;
|
|
Service* getService() const;
|
|
const std::string& getServiceId() const;
|
|
const std::string& getTechnicianId() const;
|
|
User* getTechnician() const;
|
|
const util::Timestamp& getAssignedDate() const;
|
|
util::ServiceJobStatus getStatus() const;
|
|
const util::Timestamp& getCompletionDate() const;
|
|
void setId(const std::string& id);
|
|
void setBookingId(const std::string& bookingId);
|
|
void setBooking(ServiceBooking* booking);
|
|
void setService(Service* service);
|
|
void setServiceId(const std::string& serviceId);
|
|
void setTechnicianId(const std::string& technicianId);
|
|
void setTechnician(User* technician);
|
|
void setAssignedDate(const util::Timestamp& assignedDate);
|
|
void setStatus(util::ServiceJobStatus status);
|
|
void setCompletionDate(const util::Timestamp& completionDate);
|
|
}; |