feat: dukung penjualan produk per timbangan
Produk kini punya cara jual `unit` (cacah) atau `weight` (timbangan), mengikuti kontrak backend di docs/integration-weight-based-products.md. - tipe SellBy, domain/infrastructure unit baru, dan endpoint /api/v1/units - dialog input berat saat produk timbangan ditambahkan ke keranjang - tiap penimbangan jadi baris keranjang sendiri; total baris dihitung berat x harga satuan, sedangkan produk cacah tetap digabung - request ke backend mengirim quantity 1 dan membawa berat - migrasi DB v3: kolom sell_by, unit_id, unit_name, unit_abbreviation di tabel products supaya satuan tetap tampil saat offline - tampilan keranjang, struk, split bill, void, dan refund memakai berat - test/weight_based_products_test.dart menutup perilaku di atas (9 test) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,21 @@ Map<String, dynamic> _$$ListProductDtoImplToJson(
|
||||
'total_pages': instance.totalPages,
|
||||
};
|
||||
|
||||
_$ProductUnitDtoImpl _$$ProductUnitDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ProductUnitDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
name: json['name'] as String?,
|
||||
abbreviation: json['abbreviation'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProductUnitDtoImplToJson(
|
||||
_$ProductUnitDtoImpl instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'abbreviation': instance.abbreviation,
|
||||
};
|
||||
|
||||
_$ProductDtoImpl _$$ProductDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
_$ProductDtoImpl(
|
||||
id: json['id'] as String?,
|
||||
@@ -48,6 +63,13 @@ _$ProductDtoImpl _$$ProductDtoImplFromJson(Map<String, dynamic> json) =>
|
||||
variants: (json['variants'] as List<dynamic>?)
|
||||
?.map((e) => ProductVariantDto.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
sellBy: json['sell_by'] as String?,
|
||||
unitId: json['unit_id'] as String?,
|
||||
unitName: json['unit_name'] as String?,
|
||||
unitAbbreviation: json['unit_abbreviation'] as String?,
|
||||
unit: json['unit'] == null
|
||||
? null
|
||||
: ProductUnitDto.fromJson(json['unit'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$ProductDtoImplToJson(_$ProductDtoImpl instance) =>
|
||||
@@ -69,6 +91,11 @@ Map<String, dynamic> _$$ProductDtoImplToJson(_$ProductDtoImpl instance) =>
|
||||
'created_at': instance.createdAt,
|
||||
'updated_at': instance.updatedAt,
|
||||
'variants': instance.variants,
|
||||
'sell_by': instance.sellBy,
|
||||
'unit_id': instance.unitId,
|
||||
'unit_name': instance.unitName,
|
||||
'unit_abbreviation': instance.unitAbbreviation,
|
||||
'unit': instance.unit,
|
||||
};
|
||||
|
||||
_$ProductVariantDtoImpl _$$ProductVariantDtoImplFromJson(
|
||||
|
||||
Reference in New Issue
Block a user