create order
This commit is contained in:
@@ -8,11 +8,7 @@ import 'package:worker/features/products/domain/entities/product.dart';
|
||||
/// Cart Item Data
|
||||
///
|
||||
/// Represents a product in the cart with quantity.
|
||||
class CartItemData {
|
||||
final Product product;
|
||||
final double quantity;
|
||||
final double quantityConverted; // Rounded-up quantity for actual billing
|
||||
final int boxes; // Number of tiles/boxes needed
|
||||
class CartItemData { // Number of tiles/boxes needed
|
||||
|
||||
const CartItemData({
|
||||
required this.product,
|
||||
@@ -20,6 +16,10 @@ class CartItemData {
|
||||
required this.quantityConverted,
|
||||
required this.boxes,
|
||||
});
|
||||
final Product product;
|
||||
final double quantity;
|
||||
final double quantityConverted; // Rounded-up quantity for actual billing
|
||||
final int boxes;
|
||||
|
||||
/// Calculate line total using CONVERTED quantity (important for accurate billing)
|
||||
double get lineTotal => product.basePrice * quantityConverted;
|
||||
@@ -43,19 +43,6 @@ class CartItemData {
|
||||
///
|
||||
/// Represents the complete state of the shopping cart.
|
||||
class CartState {
|
||||
final List<CartItemData> items;
|
||||
final Map<String, bool> selectedItems; // productId -> isSelected
|
||||
final String selectedWarehouse;
|
||||
final String? discountCode;
|
||||
final bool discountCodeApplied;
|
||||
final String memberTier;
|
||||
final double memberDiscountPercent;
|
||||
final double subtotal;
|
||||
final double memberDiscount;
|
||||
final double shippingFee;
|
||||
final double total;
|
||||
final bool isLoading;
|
||||
final String? errorMessage;
|
||||
|
||||
const CartState({
|
||||
required this.items,
|
||||
@@ -88,6 +75,19 @@ class CartState {
|
||||
total: 0.0,
|
||||
);
|
||||
}
|
||||
final List<CartItemData> items;
|
||||
final Map<String, bool> selectedItems; // productId -> isSelected
|
||||
final String selectedWarehouse;
|
||||
final String? discountCode;
|
||||
final bool discountCodeApplied;
|
||||
final String memberTier;
|
||||
final double memberDiscountPercent;
|
||||
final double subtotal;
|
||||
final double memberDiscount;
|
||||
final double shippingFee;
|
||||
final double total;
|
||||
final bool isLoading;
|
||||
final String? errorMessage;
|
||||
|
||||
bool get isEmpty => items.isEmpty;
|
||||
bool get isNotEmpty => items.isNotEmpty;
|
||||
|
||||
Reference in New Issue
Block a user