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:
efrilm
2026-09-06 23:03:31 +07:00
co-authored by Claude Opus 5
parent 9777f63426
commit 1505a83dd3
72 changed files with 5388 additions and 584 deletions
@@ -55,6 +55,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -77,6 +83,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -102,6 +114,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -128,6 +146,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
} else {
final order = OrderDto.fromJson(
@@ -171,6 +195,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -201,6 +231,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -239,6 +275,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -262,6 +304,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -290,6 +338,12 @@ class OrderRemoteDataProvider {
);
if (response.data['success'] == false) {
// Pesan validasi backend menyebut nama produk, jadi diteruskan apa
// adanya ke kasir alih-alih diganti pesan generik.
final cause = extractApiErrorCause(response.data);
if (cause != null) {
return DC.error(OrderFailure.dynamicErrorMessage(cause));
}
return DC.error(const OrderFailure.unexpectedError());
}
@@ -10,6 +10,7 @@ class AddItemOrderRequestDto with _$AddItemOrderRequestDto {
@JsonKey(name: 'quantity') int? quantity,
@JsonKey(name: 'unit_price') int? unitPrice,
@JsonKey(name: 'notes') String? notes,
@JsonKey(name: 'weight') double? weight,
}) = _AddItemOrderRequestDto;
factory AddItemOrderRequestDto.fromJson(Map<String, dynamic> json) =>
@@ -21,6 +22,7 @@ class AddItemOrderRequestDto with _$AddItemOrderRequestDto {
quantity: quantity ?? 0,
unitPrice: unitPrice ?? 0,
notes: notes ?? '',
weight: weight,
);
factory AddItemOrderRequestDto.fromDomain(
@@ -31,6 +33,7 @@ class AddItemOrderRequestDto with _$AddItemOrderRequestDto {
quantity: addItemOrderRequest.quantity,
unitPrice: addItemOrderRequest.unitPrice,
notes: addItemOrderRequest.notes,
weight: addItemOrderRequest.weight,
);
Map<String, dynamic> toRequest() {
@@ -45,6 +48,11 @@ class AddItemOrderRequestDto with _$AddItemOrderRequestDto {
data['product_variant_id'] = productvariantId;
}
// Produk satuan ditolak backend bila membawa berat.
if (weight != null) {
data['weight'] = weight;
}
return data;
}
}
@@ -118,6 +118,10 @@ class OrderItemDto with _$OrderItemDto {
@JsonKey(name: "paid_quantity") int? paidQuantity,
@JsonKey(name: "category_id") String? categoryId,
@JsonKey(name: "category_name") String? categoryName,
@JsonKey(name: "weight") double? weight,
@JsonKey(name: "unit_id") String? unitId,
@JsonKey(name: "unit_name") String? unitName,
@JsonKey(name: "unit_abbreviation") String? unitAbbreviation,
}) = _OrderItemDto;
factory OrderItemDto.fromJson(Map<String, dynamic> json) =>
@@ -144,6 +148,10 @@ class OrderItemDto with _$OrderItemDto {
paidQuantity: paidQuantity ?? 0,
categoryId: categoryId ?? '',
categoryName: categoryName ?? '',
weight: weight,
unitId: unitId ?? '',
unitName: unitName ?? '',
unitAbbreviation: unitAbbreviation ?? '',
);
factory OrderItemDto.fromDomain(OrderItem orderItem) => OrderItemDto(
@@ -166,5 +174,9 @@ class OrderItemDto with _$OrderItemDto {
paidQuantity: orderItem.paidQuantity,
categoryId: orderItem.categoryId,
categoryName: orderItem.categoryName,
weight: orderItem.weight,
unitId: orderItem.unitId,
unitName: orderItem.unitName,
unitAbbreviation: orderItem.unitAbbreviation,
);
}
@@ -75,6 +75,7 @@ class OrderItemRequestDto with _$OrderItemRequestDto {
@JsonKey(name: "quantity") int? quantity,
@JsonKey(name: "unit_price") int? unitPrice,
@JsonKey(name: "notes") String? notes,
@JsonKey(name: "weight") double? weight,
}) = _OrderItemRequestDto;
factory OrderItemRequestDto.fromJson(Map<String, dynamic> json) =>
@@ -87,6 +88,7 @@ class OrderItemRequestDto with _$OrderItemRequestDto {
quantity: quantity ?? 0,
unitPrice: unitPrice ?? 0,
notes: notes ?? '',
weight: weight,
);
factory OrderItemRequestDto.fromDomain(OrderItemRequest request) =>
@@ -96,6 +98,7 @@ class OrderItemRequestDto with _$OrderItemRequestDto {
quantity: request.quantity,
unitPrice: request.unitPrice,
notes: request.notes,
weight: request.weight,
);
Map<String, dynamic> toRequest() {
@@ -110,6 +113,12 @@ class OrderItemRequestDto with _$OrderItemRequestDto {
data["product_variant_id"] = productVariantId;
}
// Produk satuan ditolak backend bila membawa berat, jadi field ini hanya
// ikut saat memang ada hasil timbangan.
if (weight != null) {
data["weight"] = weight;
}
return data;
}
}
@@ -1177,6 +1177,14 @@ mixin _$OrderItemDto {
String? get categoryId => throw _privateConstructorUsedError;
@JsonKey(name: "category_name")
String? get categoryName => throw _privateConstructorUsedError;
@JsonKey(name: "weight")
double? get weight => throw _privateConstructorUsedError;
@JsonKey(name: "unit_id")
String? get unitId => throw _privateConstructorUsedError;
@JsonKey(name: "unit_name")
String? get unitName => throw _privateConstructorUsedError;
@JsonKey(name: "unit_abbreviation")
String? get unitAbbreviation => throw _privateConstructorUsedError;
/// Serializes this OrderItemDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -1215,6 +1223,10 @@ abstract class $OrderItemDtoCopyWith<$Res> {
@JsonKey(name: "paid_quantity") int? paidQuantity,
@JsonKey(name: "category_id") String? categoryId,
@JsonKey(name: "category_name") String? categoryName,
@JsonKey(name: "weight") double? weight,
@JsonKey(name: "unit_id") String? unitId,
@JsonKey(name: "unit_name") String? unitName,
@JsonKey(name: "unit_abbreviation") String? unitAbbreviation,
});
}
@@ -1252,6 +1264,10 @@ class _$OrderItemDtoCopyWithImpl<$Res, $Val extends OrderItemDto>
Object? paidQuantity = freezed,
Object? categoryId = freezed,
Object? categoryName = freezed,
Object? weight = freezed,
Object? unitId = freezed,
Object? unitName = freezed,
Object? unitAbbreviation = freezed,
}) {
return _then(
_value.copyWith(
@@ -1331,6 +1347,22 @@ class _$OrderItemDtoCopyWithImpl<$Res, $Val extends OrderItemDto>
? _value.categoryName
: categoryName // ignore: cast_nullable_to_non_nullable
as String?,
weight: freezed == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as double?,
unitId: freezed == unitId
? _value.unitId
: unitId // ignore: cast_nullable_to_non_nullable
as String?,
unitName: freezed == unitName
? _value.unitName
: unitName // ignore: cast_nullable_to_non_nullable
as String?,
unitAbbreviation: freezed == unitAbbreviation
? _value.unitAbbreviation
: unitAbbreviation // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
@@ -1366,6 +1398,10 @@ abstract class _$$OrderItemDtoImplCopyWith<$Res>
@JsonKey(name: "paid_quantity") int? paidQuantity,
@JsonKey(name: "category_id") String? categoryId,
@JsonKey(name: "category_name") String? categoryName,
@JsonKey(name: "weight") double? weight,
@JsonKey(name: "unit_id") String? unitId,
@JsonKey(name: "unit_name") String? unitName,
@JsonKey(name: "unit_abbreviation") String? unitAbbreviation,
});
}
@@ -1402,6 +1438,10 @@ class __$$OrderItemDtoImplCopyWithImpl<$Res>
Object? paidQuantity = freezed,
Object? categoryId = freezed,
Object? categoryName = freezed,
Object? weight = freezed,
Object? unitId = freezed,
Object? unitName = freezed,
Object? unitAbbreviation = freezed,
}) {
return _then(
_$OrderItemDtoImpl(
@@ -1481,6 +1521,22 @@ class __$$OrderItemDtoImplCopyWithImpl<$Res>
? _value.categoryName
: categoryName // ignore: cast_nullable_to_non_nullable
as String?,
weight: freezed == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as double?,
unitId: freezed == unitId
? _value.unitId
: unitId // ignore: cast_nullable_to_non_nullable
as String?,
unitName: freezed == unitName
? _value.unitName
: unitName // ignore: cast_nullable_to_non_nullable
as String?,
unitAbbreviation: freezed == unitAbbreviation
? _value.unitAbbreviation
: unitAbbreviation // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
@@ -1509,6 +1565,10 @@ class _$OrderItemDtoImpl extends _OrderItemDto {
@JsonKey(name: "paid_quantity") this.paidQuantity,
@JsonKey(name: "category_id") this.categoryId,
@JsonKey(name: "category_name") this.categoryName,
@JsonKey(name: "weight") this.weight,
@JsonKey(name: "unit_id") this.unitId,
@JsonKey(name: "unit_name") this.unitName,
@JsonKey(name: "unit_abbreviation") this.unitAbbreviation,
}) : _modifiers = modifiers,
super._();
@@ -1580,10 +1640,22 @@ class _$OrderItemDtoImpl extends _OrderItemDto {
@override
@JsonKey(name: "category_name")
final String? categoryName;
@override
@JsonKey(name: "weight")
final double? weight;
@override
@JsonKey(name: "unit_id")
final String? unitId;
@override
@JsonKey(name: "unit_name")
final String? unitName;
@override
@JsonKey(name: "unit_abbreviation")
final String? unitAbbreviation;
@override
String toString() {
return 'OrderItemDto(id: $id, orderId: $orderId, productId: $productId, productName: $productName, productVariantId: $productVariantId, productVariantName: $productVariantName, quantity: $quantity, unitPrice: $unitPrice, totalPrice: $totalPrice, modifiers: $modifiers, notes: $notes, status: $status, createdAt: $createdAt, updatedAt: $updatedAt, printerType: $printerType, printToChecker: $printToChecker, paidQuantity: $paidQuantity, categoryId: $categoryId, categoryName: $categoryName)';
return 'OrderItemDto(id: $id, orderId: $orderId, productId: $productId, productName: $productName, productVariantId: $productVariantId, productVariantName: $productVariantName, quantity: $quantity, unitPrice: $unitPrice, totalPrice: $totalPrice, modifiers: $modifiers, notes: $notes, status: $status, createdAt: $createdAt, updatedAt: $updatedAt, printerType: $printerType, printToChecker: $printToChecker, paidQuantity: $paidQuantity, categoryId: $categoryId, categoryName: $categoryName, weight: $weight, unitId: $unitId, unitName: $unitName, unitAbbreviation: $unitAbbreviation)';
}
@override
@@ -1626,7 +1698,13 @@ class _$OrderItemDtoImpl extends _OrderItemDto {
(identical(other.categoryId, categoryId) ||
other.categoryId == categoryId) &&
(identical(other.categoryName, categoryName) ||
other.categoryName == categoryName));
other.categoryName == categoryName) &&
(identical(other.weight, weight) || other.weight == weight) &&
(identical(other.unitId, unitId) || other.unitId == unitId) &&
(identical(other.unitName, unitName) ||
other.unitName == unitName) &&
(identical(other.unitAbbreviation, unitAbbreviation) ||
other.unitAbbreviation == unitAbbreviation));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -1652,6 +1730,10 @@ class _$OrderItemDtoImpl extends _OrderItemDto {
paidQuantity,
categoryId,
categoryName,
weight,
unitId,
unitName,
unitAbbreviation,
]);
/// Create a copy of OrderItemDto
@@ -1689,6 +1771,10 @@ abstract class _OrderItemDto extends OrderItemDto {
@JsonKey(name: "paid_quantity") final int? paidQuantity,
@JsonKey(name: "category_id") final String? categoryId,
@JsonKey(name: "category_name") final String? categoryName,
@JsonKey(name: "weight") final double? weight,
@JsonKey(name: "unit_id") final String? unitId,
@JsonKey(name: "unit_name") final String? unitName,
@JsonKey(name: "unit_abbreviation") final String? unitAbbreviation,
}) = _$OrderItemDtoImpl;
const _OrderItemDto._() : super._();
@@ -1752,6 +1838,18 @@ abstract class _OrderItemDto extends OrderItemDto {
@override
@JsonKey(name: "category_name")
String? get categoryName;
@override
@JsonKey(name: "weight")
double? get weight;
@override
@JsonKey(name: "unit_id")
String? get unitId;
@override
@JsonKey(name: "unit_name")
String? get unitName;
@override
@JsonKey(name: "unit_abbreviation")
String? get unitAbbreviation;
/// Create a copy of OrderItemDto
/// with the given fields replaced by the non-null parameter values.
@@ -2136,6 +2234,8 @@ mixin _$OrderItemRequestDto {
int? get unitPrice => throw _privateConstructorUsedError;
@JsonKey(name: "notes")
String? get notes => throw _privateConstructorUsedError;
@JsonKey(name: "weight")
double? get weight => throw _privateConstructorUsedError;
/// Serializes this OrderItemRequestDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -2160,6 +2260,7 @@ abstract class $OrderItemRequestDtoCopyWith<$Res> {
@JsonKey(name: "quantity") int? quantity,
@JsonKey(name: "unit_price") int? unitPrice,
@JsonKey(name: "notes") String? notes,
@JsonKey(name: "weight") double? weight,
});
}
@@ -2183,6 +2284,7 @@ class _$OrderItemRequestDtoCopyWithImpl<$Res, $Val extends OrderItemRequestDto>
Object? quantity = freezed,
Object? unitPrice = freezed,
Object? notes = freezed,
Object? weight = freezed,
}) {
return _then(
_value.copyWith(
@@ -2206,6 +2308,10 @@ class _$OrderItemRequestDtoCopyWithImpl<$Res, $Val extends OrderItemRequestDto>
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
as String?,
weight: freezed == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as double?,
)
as $Val,
);
@@ -2227,6 +2333,7 @@ abstract class _$$OrderItemRequestDtoImplCopyWith<$Res>
@JsonKey(name: "quantity") int? quantity,
@JsonKey(name: "unit_price") int? unitPrice,
@JsonKey(name: "notes") String? notes,
@JsonKey(name: "weight") double? weight,
});
}
@@ -2249,6 +2356,7 @@ class __$$OrderItemRequestDtoImplCopyWithImpl<$Res>
Object? quantity = freezed,
Object? unitPrice = freezed,
Object? notes = freezed,
Object? weight = freezed,
}) {
return _then(
_$OrderItemRequestDtoImpl(
@@ -2272,6 +2380,10 @@ class __$$OrderItemRequestDtoImplCopyWithImpl<$Res>
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
as String?,
weight: freezed == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as double?,
),
);
}
@@ -2286,6 +2398,7 @@ class _$OrderItemRequestDtoImpl extends _OrderItemRequestDto {
@JsonKey(name: "quantity") this.quantity,
@JsonKey(name: "unit_price") this.unitPrice,
@JsonKey(name: "notes") this.notes,
@JsonKey(name: "weight") this.weight,
}) : super._();
factory _$OrderItemRequestDtoImpl.fromJson(Map<String, dynamic> json) =>
@@ -2306,10 +2419,13 @@ class _$OrderItemRequestDtoImpl extends _OrderItemRequestDto {
@override
@JsonKey(name: "notes")
final String? notes;
@override
@JsonKey(name: "weight")
final double? weight;
@override
String toString() {
return 'OrderItemRequestDto(productId: $productId, productVariantId: $productVariantId, quantity: $quantity, unitPrice: $unitPrice, notes: $notes)';
return 'OrderItemRequestDto(productId: $productId, productVariantId: $productVariantId, quantity: $quantity, unitPrice: $unitPrice, notes: $notes, weight: $weight)';
}
@override
@@ -2325,7 +2441,8 @@ class _$OrderItemRequestDtoImpl extends _OrderItemRequestDto {
other.quantity == quantity) &&
(identical(other.unitPrice, unitPrice) ||
other.unitPrice == unitPrice) &&
(identical(other.notes, notes) || other.notes == notes));
(identical(other.notes, notes) || other.notes == notes) &&
(identical(other.weight, weight) || other.weight == weight));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -2337,6 +2454,7 @@ class _$OrderItemRequestDtoImpl extends _OrderItemRequestDto {
quantity,
unitPrice,
notes,
weight,
);
/// Create a copy of OrderItemRequestDto
@@ -2363,6 +2481,7 @@ abstract class _OrderItemRequestDto extends OrderItemRequestDto {
@JsonKey(name: "quantity") final int? quantity,
@JsonKey(name: "unit_price") final int? unitPrice,
@JsonKey(name: "notes") final String? notes,
@JsonKey(name: "weight") final double? weight,
}) = _$OrderItemRequestDtoImpl;
const _OrderItemRequestDto._() : super._();
@@ -2384,6 +2503,9 @@ abstract class _OrderItemRequestDto extends OrderItemRequestDto {
@override
@JsonKey(name: "notes")
String? get notes;
@override
@JsonKey(name: "weight")
double? get weight;
/// Create a copy of OrderItemRequestDto
/// with the given fields replaced by the non-null parameter values.
@@ -4025,6 +4147,8 @@ mixin _$AddItemOrderRequestDto {
int? get unitPrice => throw _privateConstructorUsedError;
@JsonKey(name: 'notes')
String? get notes => throw _privateConstructorUsedError;
@JsonKey(name: 'weight')
double? get weight => throw _privateConstructorUsedError;
/// Serializes this AddItemOrderRequestDto to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@@ -4049,6 +4173,7 @@ abstract class $AddItemOrderRequestDtoCopyWith<$Res> {
@JsonKey(name: 'quantity') int? quantity,
@JsonKey(name: 'unit_price') int? unitPrice,
@JsonKey(name: 'notes') String? notes,
@JsonKey(name: 'weight') double? weight,
});
}
@@ -4075,6 +4200,7 @@ class _$AddItemOrderRequestDtoCopyWithImpl<
Object? quantity = freezed,
Object? unitPrice = freezed,
Object? notes = freezed,
Object? weight = freezed,
}) {
return _then(
_value.copyWith(
@@ -4098,6 +4224,10 @@ class _$AddItemOrderRequestDtoCopyWithImpl<
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
as String?,
weight: freezed == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as double?,
)
as $Val,
);
@@ -4119,6 +4249,7 @@ abstract class _$$AddItemOrderRequestDtoImplCopyWith<$Res>
@JsonKey(name: 'quantity') int? quantity,
@JsonKey(name: 'unit_price') int? unitPrice,
@JsonKey(name: 'notes') String? notes,
@JsonKey(name: 'weight') double? weight,
});
}
@@ -4142,6 +4273,7 @@ class __$$AddItemOrderRequestDtoImplCopyWithImpl<$Res>
Object? quantity = freezed,
Object? unitPrice = freezed,
Object? notes = freezed,
Object? weight = freezed,
}) {
return _then(
_$AddItemOrderRequestDtoImpl(
@@ -4165,6 +4297,10 @@ class __$$AddItemOrderRequestDtoImplCopyWithImpl<$Res>
? _value.notes
: notes // ignore: cast_nullable_to_non_nullable
as String?,
weight: freezed == weight
? _value.weight
: weight // ignore: cast_nullable_to_non_nullable
as double?,
),
);
}
@@ -4179,6 +4315,7 @@ class _$AddItemOrderRequestDtoImpl extends _AddItemOrderRequestDto {
@JsonKey(name: 'quantity') this.quantity,
@JsonKey(name: 'unit_price') this.unitPrice,
@JsonKey(name: 'notes') this.notes,
@JsonKey(name: 'weight') this.weight,
}) : super._();
factory _$AddItemOrderRequestDtoImpl.fromJson(Map<String, dynamic> json) =>
@@ -4199,10 +4336,13 @@ class _$AddItemOrderRequestDtoImpl extends _AddItemOrderRequestDto {
@override
@JsonKey(name: 'notes')
final String? notes;
@override
@JsonKey(name: 'weight')
final double? weight;
@override
String toString() {
return 'AddItemOrderRequestDto(productId: $productId, productvariantId: $productvariantId, quantity: $quantity, unitPrice: $unitPrice, notes: $notes)';
return 'AddItemOrderRequestDto(productId: $productId, productvariantId: $productvariantId, quantity: $quantity, unitPrice: $unitPrice, notes: $notes, weight: $weight)';
}
@override
@@ -4218,7 +4358,8 @@ class _$AddItemOrderRequestDtoImpl extends _AddItemOrderRequestDto {
other.quantity == quantity) &&
(identical(other.unitPrice, unitPrice) ||
other.unitPrice == unitPrice) &&
(identical(other.notes, notes) || other.notes == notes));
(identical(other.notes, notes) || other.notes == notes) &&
(identical(other.weight, weight) || other.weight == weight));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -4230,6 +4371,7 @@ class _$AddItemOrderRequestDtoImpl extends _AddItemOrderRequestDto {
quantity,
unitPrice,
notes,
weight,
);
/// Create a copy of AddItemOrderRequestDto
@@ -4257,6 +4399,7 @@ abstract class _AddItemOrderRequestDto extends AddItemOrderRequestDto {
@JsonKey(name: 'quantity') final int? quantity,
@JsonKey(name: 'unit_price') final int? unitPrice,
@JsonKey(name: 'notes') final String? notes,
@JsonKey(name: 'weight') final double? weight,
}) = _$AddItemOrderRequestDtoImpl;
const _AddItemOrderRequestDto._() : super._();
@@ -4278,6 +4421,9 @@ abstract class _AddItemOrderRequestDto extends AddItemOrderRequestDto {
@override
@JsonKey(name: 'notes')
String? get notes;
@override
@JsonKey(name: 'weight')
double? get weight;
/// Create a copy of AddItemOrderRequestDto
/// with the given fields replaced by the non-null parameter values.
@@ -113,6 +113,10 @@ _$OrderItemDtoImpl _$$OrderItemDtoImplFromJson(Map<String, dynamic> json) =>
paidQuantity: (json['paid_quantity'] as num?)?.toInt(),
categoryId: json['category_id'] as String?,
categoryName: json['category_name'] as String?,
weight: (json['weight'] as num?)?.toDouble(),
unitId: json['unit_id'] as String?,
unitName: json['unit_name'] as String?,
unitAbbreviation: json['unit_abbreviation'] as String?,
);
Map<String, dynamic> _$$OrderItemDtoImplToJson(_$OrderItemDtoImpl instance) =>
@@ -136,6 +140,10 @@ Map<String, dynamic> _$$OrderItemDtoImplToJson(_$OrderItemDtoImpl instance) =>
'paid_quantity': instance.paidQuantity,
'category_id': instance.categoryId,
'category_name': instance.categoryName,
'weight': instance.weight,
'unit_id': instance.unitId,
'unit_name': instance.unitName,
'unit_abbreviation': instance.unitAbbreviation,
};
_$OrderRequestDtoImpl _$$OrderRequestDtoImplFromJson(
@@ -174,6 +182,7 @@ _$OrderItemRequestDtoImpl _$$OrderItemRequestDtoImplFromJson(
quantity: (json['quantity'] as num?)?.toInt(),
unitPrice: (json['unit_price'] as num?)?.toInt(),
notes: json['notes'] as String?,
weight: (json['weight'] as num?)?.toDouble(),
);
Map<String, dynamic> _$$OrderItemRequestDtoImplToJson(
@@ -184,6 +193,7 @@ Map<String, dynamic> _$$OrderItemRequestDtoImplToJson(
'quantity': instance.quantity,
'unit_price': instance.unitPrice,
'notes': instance.notes,
'weight': instance.weight,
};
_$PaymentRequestDtoImpl _$$PaymentRequestDtoImplFromJson(
@@ -317,6 +327,7 @@ _$AddItemOrderRequestDtoImpl _$$AddItemOrderRequestDtoImplFromJson(
quantity: (json['quantity'] as num?)?.toInt(),
unitPrice: (json['unit_price'] as num?)?.toInt(),
notes: json['notes'] as String?,
weight: (json['weight'] as num?)?.toDouble(),
);
Map<String, dynamic> _$$AddItemOrderRequestDtoImplToJson(
@@ -327,4 +338,5 @@ Map<String, dynamic> _$$AddItemOrderRequestDtoImplToJson(
'quantity': instance.quantity,
'unit_price': instance.unitPrice,
'notes': instance.notes,
'weight': instance.weight,
};