Files
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

56 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);
};