Implement Create Service for admin

<UserStory> SER002: Create Service </UserStory>

<Changes>
    1. Added integration between Controller and ServiceManagementService to support service creation.
    2. Implemented ServiceManagementService::createService with validation for duplicate service IDs and insertion into datastore.
    3. Enhanced AdminMenu with selectInventoryItems helper to display inventory in tabular format, allow selection, and handle exit condition.
    4. Updated AdminMenu::createService to prompt for service name, allow inventory selection, capture labour cost, and create service via Controller.
</Changes>

<Test>

 Acceptance Criteria:
 1. Admin enters new service name.
 2. Admin selects required parts for the services.
 3. Service created and visible to customers.

  Precondition:
  1. Admin is logged into the system.
  2. Inventory contains at least one active item.
  3. Datastore is available for storing services.

  Steps:
  1. Navigate to Admin menu and choose "Create Service".
    - Verify that the system prompts for service name.
  2. Select inventory items from the tabular list.
    - Verify that inactive items are skipped and active items can be added.
  3. Enter labour cost and confirm creation.
    - Verify that the service is created successfully and stored in datastore.
  4. Check customer view.
    - Verify that the newly created service is visible to customers.
</Test>

<Review>
Sreeja Reghukumar, please review
</Review>
This commit is contained in:
Jissin Mathew
2026-05-19 20:29:19 +05:30
parent 56c5c2dc70
commit e7f1b51d05
4 changed files with 102 additions and 1 deletions
@@ -1,4 +1,5 @@
#include "Controller.h"
#include "InventoryItem.h"
bool Controller::login(const std::string& username, const std::string& password)
{
@@ -50,7 +51,6 @@ void Controller::purchaseComboPackage(const std::string& comboPackageID, const s
util::Map<std::string, const InventoryItem*> Controller::getInventoryItems()
{
return util::Map<std::string, const InventoryItem*>();
}
const InventoryItem* Controller::getInventoryItem(const std::string& inventoryItemID)
@@ -92,6 +92,7 @@ void Controller::createJobCard(const std::string& bookingID, const std::string&
void Controller::createService(const std::string& name, const util::Vector<std::string>& inventoryItemIDs, double laborCost)
{
m_serviceManagementService.createService(name, inventoryItemIDs, laborCost);
}
void Controller::removeService(const std::string& serviceID)