9b7d9cf7c1
<UserStory> SER001: Assign job to technician </UserStory>
<Changes>
1. Added ServiceManagementService logic to retrieve service bookings and create job cards for assigned technicians.
2. Added UserManagementService support to retrieve technicians by user type and fetch technician details by ID.
3. Connected Controller methods with ServiceManagementService and UserManagementService for service booking retrieval, technician listing, and job card creation.
4. Updated JobCard model to use util::ServiceJobStatus consistently and simplified constructor initialization for assigned and completion timestamps.
5. Added PENDING status in ServiceJobStatus enum for identifying unassigned service bookings.
6. Implemented AdminMenu job assignment flow to list pending service bookings, display available technicians, allow technician selection, and assign jobs for services in the booking.
7. Added notification trigger during job card creation for assigned technicians.
</Changes>
<Test>
Job assignment functionality validation
Precondition:
1. System is running.
2. Pending service bookings are available in the system.
3. Technician users are available in the system.
4. Admin user is logged in and admin menu is active.
Steps:
1. Launch the application and log in as an admin.
2. Select the Assign Job option from the admin menu.
3. View the list of available pending service bookings.
- Verify that pending bookings are displayed.
4. Select a valid service booking.
5. View the list of available technicians.
- Verify that technicians are listed for selection.
6. Select a technician to assign the job.
- Verify that job cards are created for services in the booking.
- Verify that assigned jobs are visible in the technician’s menu.
- Verify that a confirmation message is shown.
- Verify that a confirmation notification is sent to the assigned technician.
</Test>
<Review>
Sreeja Reghukumar, please review
</Review>
146 lines
3.1 KiB
C++
146 lines
3.1 KiB
C++
#include "ServiceBooking.h"
|
|
|
|
int ServiceBooking::m_uid = 0;
|
|
|
|
ServiceBooking::ServiceBooking()
|
|
: m_id("SRV" + std::to_string(++m_uid)),
|
|
m_customer(nullptr),
|
|
m_discountPercentage(0.0) {}
|
|
|
|
ServiceBooking::ServiceBooking(
|
|
const std::string& id,
|
|
util::ServiceJobStatus status,
|
|
const util::Map<std::string,
|
|
Service*>& services,
|
|
const std::string& customerId,
|
|
User* customer,
|
|
const std::string& vehicleNumber,
|
|
const std::string& vehicleBrand,
|
|
const std::string& vehicleModel,
|
|
const std::string& assignedTechnicianId,
|
|
const User* assignedTechnician,
|
|
double discountPercentage
|
|
)
|
|
: m_id("SRV" + std::to_string(++m_uid)),
|
|
m_status(status),
|
|
m_services(services),
|
|
m_customerId(customerId),
|
|
m_customer(customer),
|
|
m_vehicleNumber(vehicleNumber),
|
|
m_vehicleBrand(vehicleBrand),
|
|
m_vehicleModel(vehicleModel),
|
|
m_assignedTechnicianId(assignedTechnicianId),
|
|
m_assignedTechnician(assignedTechnician),
|
|
m_discountPercentage(discountPercentage)
|
|
{
|
|
}
|
|
|
|
const std::string& ServiceBooking::getId() const
|
|
{
|
|
return m_id;
|
|
}
|
|
|
|
util::ServiceJobStatus ServiceBooking::getStatus() const
|
|
{
|
|
return m_status;
|
|
}
|
|
|
|
const util::Map<std::string, Service*>& ServiceBooking::getServices() const
|
|
{
|
|
return m_services;
|
|
}
|
|
|
|
const std::string& ServiceBooking::getCustomerId() const
|
|
{
|
|
return m_customerId;
|
|
}
|
|
|
|
User* ServiceBooking::getCustomer() const
|
|
{
|
|
return m_customer;
|
|
}
|
|
|
|
const std::string& ServiceBooking::getVehicleNumber() const
|
|
{
|
|
return m_vehicleNumber;
|
|
}
|
|
|
|
const std::string& ServiceBooking::getVehicleBrand() const
|
|
{
|
|
return m_vehicleBrand;
|
|
}
|
|
|
|
const std::string& ServiceBooking::getVehicleModel() const
|
|
{
|
|
return m_vehicleModel;
|
|
}
|
|
|
|
const std::string& ServiceBooking::getAssignedTechnicianId() const
|
|
{
|
|
return m_assignedTechnicianId;
|
|
}
|
|
|
|
const User* ServiceBooking::getAssignedTechnician() const
|
|
{
|
|
return m_assignedTechnician;
|
|
}
|
|
|
|
double ServiceBooking::getDiscountPercentage() const
|
|
{
|
|
return m_discountPercentage;
|
|
}
|
|
|
|
void ServiceBooking::setId(const std::string& id)
|
|
{
|
|
m_id = id;
|
|
}
|
|
|
|
void ServiceBooking::setStatus(const util::ServiceJobStatus& status)
|
|
{
|
|
m_status = status;
|
|
}
|
|
|
|
void ServiceBooking::setServices(const util::Map<std::string, Service*>& services)
|
|
{
|
|
m_services = services;
|
|
}
|
|
|
|
void ServiceBooking::setCustomerId(const std::string& customerId)
|
|
{
|
|
m_customerId = customerId;
|
|
}
|
|
|
|
void ServiceBooking::setCustomer(User* customer)
|
|
{
|
|
m_customer = customer;
|
|
}
|
|
|
|
void ServiceBooking::setVehicleNumber(const std::string& vehicleNumber)
|
|
{
|
|
m_vehicleNumber = vehicleNumber;
|
|
}
|
|
|
|
void ServiceBooking::setVehicleBrand(const std::string& vehicleBrand)
|
|
{
|
|
m_vehicleBrand = vehicleBrand;
|
|
}
|
|
|
|
void ServiceBooking::setVehicleModel(const std::string& vehicleModel)
|
|
{
|
|
m_vehicleModel = vehicleModel;
|
|
}
|
|
|
|
void ServiceBooking::setAssignedTechnicianId(const std::string& assignedTechnicianId)
|
|
{
|
|
m_assignedTechnicianId = assignedTechnicianId;
|
|
}
|
|
|
|
void ServiceBooking::setAssignedTechnician(const User* assignedTechnician)
|
|
{
|
|
m_assignedTechnician = assignedTechnician;
|
|
}
|
|
|
|
void ServiceBooking::setDiscountPercentage(double discountPercentage)
|
|
{
|
|
m_discountPercentage = discountPercentage;
|
|
} |