update order detail

This commit is contained in:
Phuoc Nguyen
2025-11-25 11:57:56 +07:00
parent c3b5653420
commit 039dfb9fb5
22 changed files with 1587 additions and 288 deletions

View File

@@ -28,7 +28,6 @@ class ProductModel extends HiveObject {
this.specifications,
this.itemGroupName,
this.brand,
this.unit,
this.conversionOfSm,
this.introAttributes,
required this.isActive,
@@ -83,10 +82,6 @@ class ProductModel extends HiveObject {
@HiveField(10)
final String? brand;
/// Unit of measurement (m2, box, piece, etc.)
@HiveField(11)
final String? unit;
/// Conversion factor for Square Meter UOM (tiles per m²)
/// Used to calculate: Số viên = Số lượng × conversionOfSm
@HiveField(17)
@@ -204,7 +199,6 @@ class ProductModel extends HiveObject {
: null,
itemGroupName: json['item_group_name'] as String?,
brand: json['brand'] as String?,
unit: json['currency'] as String?, // Use currency as unit for now
conversionOfSm: json['conversion_of_sm'] != null
? (json['conversion_of_sm'] as num).toDouble()
: null,
@@ -260,7 +254,6 @@ class ProductModel extends HiveObject {
specifications: null,
itemGroupName: json['item_group_name'] as String?,
brand: null, // Not provided by wishlist API
unit: json['currency'] as String? ?? '',
conversionOfSm: json['conversion_of_sm'] != null
? (json['conversion_of_sm'] as num).toDouble()
: null,
@@ -291,7 +284,6 @@ class ProductModel extends HiveObject {
: null,
'item_group_name': itemGroupName,
'brand': brand,
'unit': unit,
'conversion_of_sm': conversionOfSm,
'intro_attributes': introAttributes != null
? jsonDecode(introAttributes!)
@@ -406,7 +398,6 @@ class ProductModel extends HiveObject {
String? specifications,
String? itemGroupName,
String? brand,
String? unit,
double? conversionOfSm,
String? introAttributes,
bool? isActive,
@@ -427,7 +418,6 @@ class ProductModel extends HiveObject {
specifications: specifications ?? this.specifications,
itemGroupName: itemGroupName ?? this.itemGroupName,
brand: brand ?? this.brand,
unit: unit ?? this.unit,
conversionOfSm: conversionOfSm ?? this.conversionOfSm,
introAttributes: introAttributes ?? this.introAttributes,
isActive: isActive ?? this.isActive,
@@ -471,7 +461,6 @@ class ProductModel extends HiveObject {
specifications: specificationsMap ?? {},
itemGroupName: itemGroupName,
brand: brand,
unit: unit,
conversionOfSm: conversionOfSm,
introAttributes: introAttributesList,
isActive: isActive,

View File

@@ -28,7 +28,6 @@ class ProductModelAdapter extends TypeAdapter<ProductModel> {
specifications: fields[8] as String?,
itemGroupName: fields[9] as String?,
brand: fields[10] as String?,
unit: fields[11] as String?,
conversionOfSm: (fields[17] as num?)?.toDouble(),
introAttributes: fields[18] as String?,
isActive: fields[12] as bool,
@@ -42,7 +41,7 @@ class ProductModelAdapter extends TypeAdapter<ProductModel> {
@override
void write(BinaryWriter writer, ProductModel obj) {
writer
..writeByte(19)
..writeByte(18)
..writeByte(0)
..write(obj.productId)
..writeByte(1)
@@ -65,8 +64,6 @@ class ProductModelAdapter extends TypeAdapter<ProductModel> {
..write(obj.itemGroupName)
..writeByte(10)
..write(obj.brand)
..writeByte(11)
..write(obj.unit)
..writeByte(12)
..write(obj.isActive)
..writeByte(13)

View File

@@ -22,7 +22,6 @@ class Product {
required this.specifications,
this.itemGroupName,
this.brand,
this.unit,
this.conversionOfSm,
this.introAttributes,
required this.isActive,
@@ -64,9 +63,6 @@ class Product {
/// Brand name
final String? brand;
/// 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;
@@ -154,7 +150,6 @@ class Product {
Map<String, dynamic>? specifications,
String? itemGroupName,
String? brand,
String? unit,
double? conversionOfSm,
List<Map<String, String>>? introAttributes,
bool? isActive,
@@ -175,7 +170,6 @@ class Product {
specifications: specifications ?? this.specifications,
itemGroupName: itemGroupName ?? this.itemGroupName,
brand: brand ?? this.brand,
unit: unit ?? this.unit,
conversionOfSm: conversionOfSm ?? this.conversionOfSm,
introAttributes: introAttributes ?? this.introAttributes,
isActive: isActive ?? this.isActive,
@@ -203,7 +197,6 @@ class Product {
other.basePrice == basePrice &&
other.itemGroupName == itemGroupName &&
other.brand == brand &&
other.unit == unit &&
other.isActive == isActive &&
other.isFeatured == isFeatured &&
other.erpnextItemCode == erpnextItemCode;
@@ -218,7 +211,6 @@ class Product {
basePrice,
itemGroupName,
brand,
unit,
isActive,
isFeatured,
erpnextItemCode,

View File

@@ -156,7 +156,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'Đã thêm $_quantity ${product.unit} ${product.name} vào giỏ hàng!',
'Đã thêm $_quantity ${product.name} vào giỏ hàng!',
),
duration: const Duration(seconds: 2),
action: SnackBarAction(
@@ -246,7 +246,7 @@ class _ProductDetailPageState extends ConsumerState<ProductDetailPage> {
right: 0,
child: StickyActionBar(
quantity: _quantity,
unit: product.unit ?? '',
unit: '',
conversionOfSm: product.conversionOfSm,
uomFromIntroAttributes: product.getIntroAttribute('UOM'),
onIncrease: _increaseQuantity,

View File

@@ -220,7 +220,7 @@ class ProductCard extends ConsumerWidget {
// Price
Text(
'${_formatPrice(product.effectivePrice)}/${product.unit}',
'${_formatPrice(product.effectivePrice)}/',
style: const TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,

View File

@@ -61,7 +61,7 @@ class ProductInfoSection extends StatelessWidget {
children: [
// Current Price
Text(
'${_formatPrice(product.basePrice)}/${product.unit ?? ''}',
'${_formatPrice(product.basePrice)}/',
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w700,