Merged PR 1069: fix: cleanup and small improvements
fix: cleanup and small improvements - added empty check in inventory alerts - corrected parts cost calculation - removed unused getUser method - updated default admin password - fixed missing includes in menus - cleaned up MenuHelper comments
This commit is contained in:
+4
@@ -59,6 +59,10 @@ Returns:
|
|||||||
void InventoryManagementService::sendLowStockAlerts()
|
void InventoryManagementService::sendLowStockAlerts()
|
||||||
{
|
{
|
||||||
auto& inventoryItems = m_dataStore.getInventoryItems();
|
auto& inventoryItems = m_dataStore.getInventoryItems();
|
||||||
|
if (inventoryItems.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
int inventoryItemsSize = inventoryItems.getSize();
|
int inventoryItemsSize = inventoryItems.getSize();
|
||||||
auto& usersMap = m_dataStore.getUsers();
|
auto& usersMap = m_dataStore.getUsers();
|
||||||
int usersMapSize = usersMap.getSize();
|
int usersMapSize = usersMap.getSize();
|
||||||
|
|||||||
+1
-1
@@ -315,7 +315,7 @@ void PaymentManagementService::generateInvoice(ServiceBooking* booking)
|
|||||||
{
|
{
|
||||||
createInventoryItemsMap(completeInventoryItemMapOfBooking, currentService);
|
createInventoryItemsMap(completeInventoryItemMapOfBooking, currentService);
|
||||||
totalLabourCost += currentService->getLaborCost();
|
totalLabourCost += currentService->getLaborCost();
|
||||||
totalPartsCost += calculatePartsCost(currentService);
|
totalPartsCost += util::calculatePartsCost(currentService);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
totalServiceCost = totalLabourCost + totalPartsCost;
|
totalServiceCost = totalLabourCost + totalPartsCost;
|
||||||
|
|||||||
-14
@@ -306,17 +306,3 @@ util::Map<std::string, User*> UserManagementService::getUsers(util::UserType typ
|
|||||||
}
|
}
|
||||||
return filteredUsersMap;
|
return filteredUsersMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
User* UserManagementService::getUser(const std::string& userID)
|
|
||||||
{
|
|
||||||
util::Map<std::string, User*>& currentUsers = m_dataStore.getUsers();
|
|
||||||
for (int iterator = 0; iterator < currentUsers.getSize(); iterator++)
|
|
||||||
{
|
|
||||||
User* currentUser = currentUsers.getValueAt(iterator);
|
|
||||||
if (currentUser->getId() == userID)
|
|
||||||
{
|
|
||||||
return currentUser;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace config
|
|||||||
{
|
{
|
||||||
constexpr const char* DEFAULT_ADMIN_USERNAME = "admin";
|
constexpr const char* DEFAULT_ADMIN_USERNAME = "admin";
|
||||||
constexpr const char* DEFAULT_ADMIN_NAME = "admin";
|
constexpr const char* DEFAULT_ADMIN_NAME = "admin";
|
||||||
constexpr const char* DEFAULT_ADMIN_PASSWORD = "";
|
constexpr const char* DEFAULT_ADMIN_PASSWORD = "admin";
|
||||||
constexpr const char* DEFAULT_ADMIN_EMAIL = "admin@vss";
|
constexpr const char* DEFAULT_ADMIN_EMAIL = "admin@vss";
|
||||||
constexpr const char* DEFAULT_ADMIN_PHONE = "0000000000";
|
constexpr const char* DEFAULT_ADMIN_PHONE = "0000000000";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ Date: 19-May-2026
|
|||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include "AdminMenu.h"
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
#include "InputHelper.h"
|
#include "InputHelper.h"
|
||||||
#include "InventoryItem.h"
|
#include "InventoryItem.h"
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ Date:19-May-2026
|
|||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include "ComboPackage.h"
|
#include "ComboPackage.h"
|
||||||
#include "CustomerMenu.h"
|
#include "CustomerMenu.h"
|
||||||
|
#include "MenuHelper.h"
|
||||||
#include "Enums.h"
|
#include "Enums.h"
|
||||||
#include "InputHelper.h"
|
#include "InputHelper.h"
|
||||||
|
#include "OutputHelper.h"
|
||||||
#include "InventoryItem.h"
|
#include "InventoryItem.h"
|
||||||
#include "Invoice.h"
|
#include "Invoice.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
|
|||||||
@@ -29,9 +29,8 @@ Date: 21-May-2026
|
|||||||
#include "Validator.h"
|
#include "Validator.h"
|
||||||
#include "Vector.h"
|
#include "Vector.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectServicesToRemove (static helper)
|
Function: selectServicesToRemove
|
||||||
Description: Allows selection of a service to remove by index.
|
Description: Allows selection of a service to remove by index.
|
||||||
Parameters:
|
Parameters:
|
||||||
- currentServices: util::Map<std::string, const Service*>, available services
|
- currentServices: util::Map<std::string, const Service*>, available services
|
||||||
@@ -84,7 +83,7 @@ inline std::string selectServicesToRemove(util::Map<std::string, const Service*>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectInventoryItems (static helper)
|
Function: selectInventoryItems
|
||||||
Description: Allows selection of inventory items by index for creating a service.
|
Description: Allows selection of inventory items by index for creating a service.
|
||||||
Parameters:
|
Parameters:
|
||||||
- currentInventoryItems: util::Map<std::string, const InventoryItem*>&, available inventory items
|
- currentInventoryItems: util::Map<std::string, const InventoryItem*>&, available inventory items
|
||||||
@@ -158,7 +157,7 @@ static void selectInventoryItems(util::Map<std::string, const InventoryItem*>& c
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: listServiceBookings (static helper)
|
Function: listServiceBookings
|
||||||
Description: Lists all pending service bookings and maps them to indices for selection.
|
Description: Lists all pending service bookings and maps them to indices for selection.
|
||||||
Parameters:
|
Parameters:
|
||||||
- currentBookings: util::Map<std::string, const ServiceBooking*>&, current bookings
|
- currentBookings: util::Map<std::string, const ServiceBooking*>&, current bookings
|
||||||
@@ -214,7 +213,7 @@ static bool listServiceBookings(util::Map<std::string, const ServiceBooking*>& c
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectPendingServiceBookings (static helper)
|
Function: selectPendingServiceBookings
|
||||||
Description: Allows selection of a pending service booking by index.
|
Description: Allows selection of a pending service booking by index.
|
||||||
Parameters:
|
Parameters:
|
||||||
- serviceBookingsMap: util::Map<int, const ServiceBooking*>&, map of indexed bookings
|
- serviceBookingsMap: util::Map<int, const ServiceBooking*>&, map of indexed bookings
|
||||||
@@ -238,7 +237,7 @@ static const ServiceBooking* selectPendingServiceBookings(util::Map<int, const S
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: listAvailableTechnicians (static helper)
|
Function: listAvailableTechnicians
|
||||||
Description: Lists all available technicians and maps them to indices for selection.
|
Description: Lists all available technicians and maps them to indices for selection.
|
||||||
Parameters:
|
Parameters:
|
||||||
- currentAvailableTechnicians: util::Map<std::string, const User*>, available technicians
|
- currentAvailableTechnicians: util::Map<std::string, const User*>, available technicians
|
||||||
@@ -278,7 +277,7 @@ static void listAvailableTechnicians(util::Map<std::string, const User*> current
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectTechnician (static helper)
|
Function: selectTechnician
|
||||||
Description: Allows selection of a technician by index.
|
Description: Allows selection of a technician by index.
|
||||||
Parameters:
|
Parameters:
|
||||||
- currentAvailableTechniciansMap: util::Map<int, const User*>&, map of indexed technicians
|
- currentAvailableTechniciansMap: util::Map<int, const User*>&, map of indexed technicians
|
||||||
@@ -301,7 +300,7 @@ static const User* selectTechnician(util::Map<int, const User*>& currentAvailabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectInvoiceFromUserForPayment (static helper)
|
Function: selectInvoiceFromUserForPayment
|
||||||
Description: Lists all pending invoices for the customer and allows selection by index.
|
Description: Lists all pending invoices for the customer and allows selection by index.
|
||||||
Parameters:
|
Parameters:
|
||||||
- currentInvoices: util::Map<std::string, const Invoice*>&, map of customer invoices
|
- currentInvoices: util::Map<std::string, const Invoice*>&, map of customer invoices
|
||||||
@@ -366,7 +365,7 @@ static std::string selectInvoiceFromUserForPayment(const util::Map<std::string,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectPaymentMode (static helper)
|
Function: selectPaymentMode
|
||||||
Description: Allows the customer to select a payment mode (ONLINE or OFFLINE).
|
Description: Allows the customer to select a payment mode (ONLINE or OFFLINE).
|
||||||
Parameters:
|
Parameters:
|
||||||
- None
|
- None
|
||||||
@@ -396,7 +395,7 @@ static util::PaymentMode selectPaymentMode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: displayInvoices (static helper)
|
Function: displayInvoices
|
||||||
Description: Displays detailed information for all invoices associated with the customer,
|
Description: Displays detailed information for all invoices associated with the customer,
|
||||||
including booking details, technician, discount, total amount, payment status, and items used.
|
including booking details, technician, discount, total amount, payment status, and items used.
|
||||||
Parameters:
|
Parameters:
|
||||||
@@ -464,7 +463,7 @@ static void displayInvoices(util::Map<std::string, const Invoice*> currentUserIn
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: selectJobCardToComplete (static helper)
|
Function: selectJobCardToComplete
|
||||||
Description: Lists all incomplete job cards assigned to the technician and allows selection by index.
|
Description: Lists all incomplete job cards assigned to the technician and allows selection by index.
|
||||||
Parameters:
|
Parameters:
|
||||||
- assignedJobCards: util::Map<std::string, const JobCard*>&, job cards assigned to the technician
|
- assignedJobCards: util::Map<std::string, const JobCard*>&, job cards assigned to the technician
|
||||||
@@ -801,18 +800,7 @@ inline const ComboPackage* selectComboPackageFromPackages(const util::Map<std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function: sendLowStockAlertsToAdmins (static helper)
|
Function: getNotificationPreference
|
||||||
Description: Sends low stock alert notifications to all admin users for a given inventory item.
|
|
||||||
Parameters:
|
|
||||||
- inventoryManagementService: InventoryManagementService&, service used to send notifications
|
|
||||||
- inventoryItem: const InventoryItem*, pointer to the low-stock inventory item
|
|
||||||
- adminUsers: const util::Vector<User*>&, list of admin users to notify
|
|
||||||
Returns:
|
|
||||||
- None
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Function: getNotificationPreference (static helper)
|
|
||||||
Description: Helper function to configure notification preferences for a specific service.
|
Description: Helper function to configure notification preferences for a specific service.
|
||||||
Parameters:
|
Parameters:
|
||||||
- serviceName: Name of the service for which notifications are being configured.
|
- serviceName: Name of the service for which notifications are being configured.
|
||||||
|
|||||||
Reference in New Issue
Block a user