update cart
This commit is contained in:
@@ -9,6 +9,27 @@ library;
|
||||
/// Represents a tile/construction product in the application.
|
||||
/// Used across all layers but originates in the domain layer.
|
||||
class Product {
|
||||
|
||||
const Product({
|
||||
required this.productId,
|
||||
required this.name,
|
||||
this.description,
|
||||
required this.basePrice,
|
||||
required this.images,
|
||||
required this.thumbnail,
|
||||
required this.imageCaptions,
|
||||
this.customLink360,
|
||||
required this.specifications,
|
||||
this.category,
|
||||
this.brand,
|
||||
this.unit,
|
||||
this.conversionOfSm,
|
||||
required this.isActive,
|
||||
required this.isFeatured,
|
||||
this.erpnextItemCode,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
/// Unique identifier
|
||||
final String productId;
|
||||
|
||||
@@ -25,7 +46,7 @@ class Product {
|
||||
final List<String> images;
|
||||
|
||||
/// Thumbnail image URL
|
||||
final String? thumbnail;
|
||||
final String thumbnail;
|
||||
|
||||
/// Image captions
|
||||
final Map<String, String> imageCaptions;
|
||||
@@ -45,6 +66,10 @@ class Product {
|
||||
/// Unit of measurement (e.g., "m²", "viên", "hộp")
|
||||
final String? unit;
|
||||
|
||||
/// Conversion factor for Square Meter UOM (tiles per m²)
|
||||
/// Used to calculate: Số viên = Số lượng × conversionOfSm
|
||||
final double? conversionOfSm;
|
||||
|
||||
/// Product is active
|
||||
final bool isActive;
|
||||
|
||||
@@ -60,26 +85,6 @@ class Product {
|
||||
/// Last updated date
|
||||
final DateTime updatedAt;
|
||||
|
||||
const Product({
|
||||
required this.productId,
|
||||
required this.name,
|
||||
this.description,
|
||||
required this.basePrice,
|
||||
required this.images,
|
||||
this.thumbnail,
|
||||
required this.imageCaptions,
|
||||
this.customLink360,
|
||||
required this.specifications,
|
||||
this.category,
|
||||
this.brand,
|
||||
this.unit,
|
||||
required this.isActive,
|
||||
required this.isFeatured,
|
||||
this.erpnextItemCode,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
/// Get primary image URL
|
||||
String? get primaryImage => images.isNotEmpty ? images.first : null;
|
||||
|
||||
@@ -134,6 +139,7 @@ class Product {
|
||||
String? category,
|
||||
String? brand,
|
||||
String? unit,
|
||||
double? conversionOfSm,
|
||||
bool? isActive,
|
||||
bool? isFeatured,
|
||||
String? erpnextItemCode,
|
||||
@@ -153,6 +159,7 @@ class Product {
|
||||
category: category ?? this.category,
|
||||
brand: brand ?? this.brand,
|
||||
unit: unit ?? this.unit,
|
||||
conversionOfSm: conversionOfSm ?? this.conversionOfSm,
|
||||
isActive: isActive ?? this.isActive,
|
||||
isFeatured: isFeatured ?? this.isFeatured,
|
||||
erpnextItemCode: erpnextItemCode ?? this.erpnextItemCode,
|
||||
|
||||
Reference in New Issue
Block a user