Add state tracking for models and menu loop setup
<Changes>
1. Added State enum with ACTIVE and INACTIVE values in Enums.h.
2. Added state member, getter, and setter in User, Service, InventoryItem, and ComboPackage models.
3. Updated constructors to initialize model objects with ACTIVE state by default.
4. Added state string conversion helper functions in Enums.h.
5. Added default return values in Controller getter methods to complete stub implementations.
6. Added basic menu loop implementation in CustomerMenu and TechnicianMenu for handling user input.
</Changes>
This commit is contained in:
@@ -5,12 +5,14 @@ int InventoryItem::m_uid = 0;
|
||||
InventoryItem::InventoryItem()
|
||||
: m_id("IIM" + std::to_string(++m_uid)),
|
||||
m_quantity(0),
|
||||
m_status(util::State::ACTIVE),
|
||||
m_price(0.0) {}
|
||||
|
||||
InventoryItem::InventoryItem(const std::string& partName, int quantity, double price)
|
||||
: m_id("IIM" + std::to_string(++m_uid)),
|
||||
m_partName(partName),
|
||||
m_quantity(quantity),
|
||||
m_status(util::State::ACTIVE),
|
||||
m_price(price) {}
|
||||
|
||||
const std::string& InventoryItem::getId() const
|
||||
@@ -33,6 +35,11 @@ double InventoryItem::getPrice() const
|
||||
return m_price;
|
||||
}
|
||||
|
||||
util::State InventoryItem::getState() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
void InventoryItem::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
@@ -51,4 +58,9 @@ void InventoryItem::setQuantity(int quantity)
|
||||
void InventoryItem::setPrice(double price)
|
||||
{
|
||||
m_price = price;
|
||||
}
|
||||
|
||||
void InventoryItem::setState(util::State status)
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
Reference in New Issue
Block a user