From 2ab20a1150a0279d37e90d3cf14ef4d9d311c7ae Mon Sep 17 00:00:00 2001 From: Efril Date: Thu, 28 May 2026 18:11:02 +0700 Subject: [PATCH] add printer checker checks --- .../void/void_form/void_form_bloc.dart | 1 + lib/domain/order/entities/order_entity.dart | 6 ++++ lib/domain/order/order.freezed.dart | 28 +++++++++++++++-- .../product/entities/product_entity.dart | 2 ++ lib/domain/product/product.freezed.dart | 25 ++++++++++++++- lib/infrastructure/order/dtos/order_dto.dart | 3 ++ .../order/order_dtos.freezed.dart | 31 +++++++++++++++++-- lib/infrastructure/order/order_dtos.g.dart | 2 ++ .../product/dtos/product_dto.dart | 7 +++++ .../product/product_dtos.freezed.dart | 27 +++++++++++++++- .../product/product_dtos.g.dart | 2 ++ .../components/print/print_ui.dart | 2 +- pubspec.yaml | 2 +- 13 files changed, 128 insertions(+), 10 deletions(-) diff --git a/lib/application/void/void_form/void_form_bloc.dart b/lib/application/void/void_form/void_form_bloc.dart index c7bedbb..545d350 100644 --- a/lib/application/void/void_form/void_form_bloc.dart +++ b/lib/application/void/void_form/void_form_bloc.dart @@ -99,6 +99,7 @@ class VoidFormBloc extends Bloc { updatedAt: originalItem.updatedAt, printerType: originalItem.printerType, paidQuantity: originalItem.paidQuantity, + printToChecker: originalItem.printToChecker, ), ); }); diff --git a/lib/domain/order/entities/order_entity.dart b/lib/domain/order/entities/order_entity.dart index 5b8df84..a6433bb 100644 --- a/lib/domain/order/entities/order_entity.dart +++ b/lib/domain/order/entities/order_entity.dart @@ -125,6 +125,7 @@ class Order with _$Order { createdAt: DateTime.now().subtract(const Duration(hours: 1)), updatedAt: DateTime.now(), printerType: 'Barista', + printToChecker: false, paidQuantity: 2, categoryId: 'CAT-001', categoryName: 'Minuman', @@ -145,6 +146,7 @@ class Order with _$Order { createdAt: DateTime.now().subtract(const Duration(hours: 1)), updatedAt: DateTime.now(), printerType: 'Kitchen', + printToChecker: false, paidQuantity: 1, categoryId: 'CAT-002', categoryName: 'Makanan', @@ -165,6 +167,7 @@ class Order with _$Order { createdAt: DateTime.now().subtract(const Duration(hours: 1)), updatedAt: DateTime.now(), printerType: 'Kitchen', + printToChecker: false, paidQuantity: 1, categoryId: 'CAT-002', categoryName: 'Makanan', @@ -230,6 +233,7 @@ class OrderItem with _$OrderItem { required DateTime createdAt, required DateTime updatedAt, required String printerType, + required bool printToChecker, required int paidQuantity, required String categoryId, required String categoryName, @@ -251,6 +255,7 @@ class OrderItem with _$OrderItem { createdAt: DateTime(1970), updatedAt: DateTime(1970), printerType: '', + printToChecker: false, paidQuantity: 0, categoryId: '', categoryName: '', @@ -274,6 +279,7 @@ class OrderItem with _$OrderItem { createdAt: DateTime.now(), updatedAt: DateTime.now(), printerType: productQuantity.product.printerType, + printToChecker: productQuantity.product.printToChecker, paidQuantity: 0, categoryId: '', categoryName: '', diff --git a/lib/domain/order/order.freezed.dart b/lib/domain/order/order.freezed.dart index 62847f8..5e45d5e 100644 --- a/lib/domain/order/order.freezed.dart +++ b/lib/domain/order/order.freezed.dart @@ -1002,6 +1002,7 @@ mixin _$OrderItem { DateTime get createdAt => throw _privateConstructorUsedError; DateTime get updatedAt => throw _privateConstructorUsedError; String get printerType => throw _privateConstructorUsedError; + bool get printToChecker => throw _privateConstructorUsedError; int get paidQuantity => throw _privateConstructorUsedError; String get categoryId => throw _privateConstructorUsedError; String get categoryName => throw _privateConstructorUsedError; @@ -1034,6 +1035,7 @@ abstract class $OrderItemCopyWith<$Res> { DateTime createdAt, DateTime updatedAt, String printerType, + bool printToChecker, int paidQuantity, String categoryId, String categoryName, @@ -1070,6 +1072,7 @@ class _$OrderItemCopyWithImpl<$Res, $Val extends OrderItem> Object? createdAt = null, Object? updatedAt = null, Object? printerType = null, + Object? printToChecker = null, Object? paidQuantity = null, Object? categoryId = null, Object? categoryName = null, @@ -1136,6 +1139,10 @@ class _$OrderItemCopyWithImpl<$Res, $Val extends OrderItem> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String, + printToChecker: null == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool, paidQuantity: null == paidQuantity ? _value.paidQuantity : paidQuantity // ignore: cast_nullable_to_non_nullable @@ -1179,6 +1186,7 @@ abstract class _$$OrderItemImplCopyWith<$Res> DateTime createdAt, DateTime updatedAt, String printerType, + bool printToChecker, int paidQuantity, String categoryId, String categoryName, @@ -1214,6 +1222,7 @@ class __$$OrderItemImplCopyWithImpl<$Res> Object? createdAt = null, Object? updatedAt = null, Object? printerType = null, + Object? printToChecker = null, Object? paidQuantity = null, Object? categoryId = null, Object? categoryName = null, @@ -1280,6 +1289,10 @@ class __$$OrderItemImplCopyWithImpl<$Res> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String, + printToChecker: null == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool, paidQuantity: null == paidQuantity ? _value.paidQuantity : paidQuantity // ignore: cast_nullable_to_non_nullable @@ -1316,6 +1329,7 @@ class _$OrderItemImpl implements _OrderItem { required this.createdAt, required this.updatedAt, required this.printerType, + required this.printToChecker, required this.paidQuantity, required this.categoryId, required this.categoryName, @@ -1358,6 +1372,8 @@ class _$OrderItemImpl implements _OrderItem { @override final String printerType; @override + final bool printToChecker; + @override final int paidQuantity; @override final String categoryId; @@ -1366,7 +1382,7 @@ class _$OrderItemImpl implements _OrderItem { @override String toString() { - return 'OrderItem(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, paidQuantity: $paidQuantity, categoryId: $categoryId, categoryName: $categoryName)'; + return 'OrderItem(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)'; } @override @@ -1402,6 +1418,8 @@ class _$OrderItemImpl implements _OrderItem { other.updatedAt == updatedAt) && (identical(other.printerType, printerType) || other.printerType == printerType) && + (identical(other.printToChecker, printToChecker) || + other.printToChecker == printToChecker) && (identical(other.paidQuantity, paidQuantity) || other.paidQuantity == paidQuantity) && (identical(other.categoryId, categoryId) || @@ -1411,7 +1429,7 @@ class _$OrderItemImpl implements _OrderItem { } @override - int get hashCode => Object.hash( + int get hashCode => Object.hashAll([ runtimeType, id, orderId, @@ -1428,10 +1446,11 @@ class _$OrderItemImpl implements _OrderItem { createdAt, updatedAt, printerType, + printToChecker, paidQuantity, categoryId, categoryName, - ); + ]); /// Create a copy of OrderItem /// with the given fields replaced by the non-null parameter values. @@ -1459,6 +1478,7 @@ abstract class _OrderItem implements OrderItem { required final DateTime createdAt, required final DateTime updatedAt, required final String printerType, + required final bool printToChecker, required final int paidQuantity, required final String categoryId, required final String categoryName, @@ -1495,6 +1515,8 @@ abstract class _OrderItem implements OrderItem { @override String get printerType; @override + bool get printToChecker; + @override int get paidQuantity; @override String get categoryId; diff --git a/lib/domain/product/entities/product_entity.dart b/lib/domain/product/entities/product_entity.dart index 3869c73..f31dd08 100644 --- a/lib/domain/product/entities/product_entity.dart +++ b/lib/domain/product/entities/product_entity.dart @@ -33,6 +33,7 @@ class Product with _$Product { required String businessType, required String imageUrl, required String printerType, + required bool printToChecker, required Map metadata, required bool isActive, required String createdAt, @@ -52,6 +53,7 @@ class Product with _$Product { businessType: '', imageUrl: '', printerType: '', + printToChecker: false, metadata: {}, isActive: false, createdAt: '', diff --git a/lib/domain/product/product.freezed.dart b/lib/domain/product/product.freezed.dart index 2f9192c..cbe9d66 100644 --- a/lib/domain/product/product.freezed.dart +++ b/lib/domain/product/product.freezed.dart @@ -279,6 +279,7 @@ mixin _$Product { String get businessType => throw _privateConstructorUsedError; String get imageUrl => throw _privateConstructorUsedError; String get printerType => throw _privateConstructorUsedError; + bool get printToChecker => throw _privateConstructorUsedError; Map get metadata => throw _privateConstructorUsedError; bool get isActive => throw _privateConstructorUsedError; String get createdAt => throw _privateConstructorUsedError; @@ -308,6 +309,7 @@ abstract class $ProductCopyWith<$Res> { String businessType, String imageUrl, String printerType, + bool printToChecker, Map metadata, bool isActive, String createdAt, @@ -342,6 +344,7 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product> Object? businessType = null, Object? imageUrl = null, Object? printerType = null, + Object? printToChecker = null, Object? metadata = null, Object? isActive = null, Object? createdAt = null, @@ -394,6 +397,10 @@ class _$ProductCopyWithImpl<$Res, $Val extends Product> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String, + printToChecker: null == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool, metadata: null == metadata ? _value.metadata : metadata // ignore: cast_nullable_to_non_nullable @@ -440,6 +447,7 @@ abstract class _$$ProductImplCopyWith<$Res> implements $ProductCopyWith<$Res> { String businessType, String imageUrl, String printerType, + bool printToChecker, Map metadata, bool isActive, String createdAt, @@ -473,6 +481,7 @@ class __$$ProductImplCopyWithImpl<$Res> Object? businessType = null, Object? imageUrl = null, Object? printerType = null, + Object? printToChecker = null, Object? metadata = null, Object? isActive = null, Object? createdAt = null, @@ -525,6 +534,10 @@ class __$$ProductImplCopyWithImpl<$Res> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String, + printToChecker: null == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool, metadata: null == metadata ? _value._metadata : metadata // ignore: cast_nullable_to_non_nullable @@ -565,6 +578,7 @@ class _$ProductImpl with DiagnosticableTreeMixin implements _Product { required this.businessType, required this.imageUrl, required this.printerType, + required this.printToChecker, required final Map metadata, required this.isActive, required this.createdAt, @@ -595,6 +609,8 @@ class _$ProductImpl with DiagnosticableTreeMixin implements _Product { final String imageUrl; @override final String printerType; + @override + final bool printToChecker; final Map _metadata; @override Map get metadata { @@ -619,7 +635,7 @@ class _$ProductImpl with DiagnosticableTreeMixin implements _Product { @override String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) { - return 'Product(id: $id, organizationId: $organizationId, categoryId: $categoryId, sku: $sku, name: $name, description: $description, price: $price, cost: $cost, businessType: $businessType, imageUrl: $imageUrl, printerType: $printerType, metadata: $metadata, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, variants: $variants)'; + return 'Product(id: $id, organizationId: $organizationId, categoryId: $categoryId, sku: $sku, name: $name, description: $description, price: $price, cost: $cost, businessType: $businessType, imageUrl: $imageUrl, printerType: $printerType, printToChecker: $printToChecker, metadata: $metadata, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, variants: $variants)'; } @override @@ -638,6 +654,7 @@ class _$ProductImpl with DiagnosticableTreeMixin implements _Product { ..add(DiagnosticsProperty('businessType', businessType)) ..add(DiagnosticsProperty('imageUrl', imageUrl)) ..add(DiagnosticsProperty('printerType', printerType)) + ..add(DiagnosticsProperty('printToChecker', printToChecker)) ..add(DiagnosticsProperty('metadata', metadata)) ..add(DiagnosticsProperty('isActive', isActive)) ..add(DiagnosticsProperty('createdAt', createdAt)) @@ -667,6 +684,8 @@ class _$ProductImpl with DiagnosticableTreeMixin implements _Product { other.imageUrl == imageUrl) && (identical(other.printerType, printerType) || other.printerType == printerType) && + (identical(other.printToChecker, printToChecker) || + other.printToChecker == printToChecker) && const DeepCollectionEquality().equals(other._metadata, _metadata) && (identical(other.isActive, isActive) || other.isActive == isActive) && @@ -691,6 +710,7 @@ class _$ProductImpl with DiagnosticableTreeMixin implements _Product { businessType, imageUrl, printerType, + printToChecker, const DeepCollectionEquality().hash(_metadata), isActive, createdAt, @@ -720,6 +740,7 @@ abstract class _Product implements Product { required final String businessType, required final String imageUrl, required final String printerType, + required final bool printToChecker, required final Map metadata, required final bool isActive, required final String createdAt, @@ -750,6 +771,8 @@ abstract class _Product implements Product { @override String get printerType; @override + bool get printToChecker; + @override Map get metadata; @override bool get isActive; diff --git a/lib/infrastructure/order/dtos/order_dto.dart b/lib/infrastructure/order/dtos/order_dto.dart index 9bfb2d7..cdba3b1 100644 --- a/lib/infrastructure/order/dtos/order_dto.dart +++ b/lib/infrastructure/order/dtos/order_dto.dart @@ -114,6 +114,7 @@ class OrderItemDto with _$OrderItemDto { @JsonKey(name: "created_at") String? createdAt, @JsonKey(name: "updated_at") String? updatedAt, @JsonKey(name: "printer_type") String? printerType, + @JsonKey(name: "print_to_checker") bool? printToChecker, @JsonKey(name: "paid_quantity") int? paidQuantity, @JsonKey(name: "category_id") String? categoryId, @JsonKey(name: "category_name") String? categoryName, @@ -139,6 +140,7 @@ class OrderItemDto with _$OrderItemDto { createdAt: createdAt != null ? DateTime.parse(createdAt!) : DateTime(1970), updatedAt: updatedAt != null ? DateTime.parse(updatedAt!) : DateTime(1970), printerType: printerType ?? '', + printToChecker: printToChecker ?? false, paidQuantity: paidQuantity ?? 0, categoryId: categoryId ?? '', categoryName: categoryName ?? '', @@ -160,6 +162,7 @@ class OrderItemDto with _$OrderItemDto { createdAt: orderItem.createdAt.toIso8601String(), updatedAt: orderItem.updatedAt.toIso8601String(), printerType: orderItem.printerType, + printToChecker: orderItem.printToChecker, paidQuantity: orderItem.paidQuantity, categoryId: orderItem.categoryId, categoryName: orderItem.categoryName, diff --git a/lib/infrastructure/order/order_dtos.freezed.dart b/lib/infrastructure/order/order_dtos.freezed.dart index b4cab88..6131e12 100644 --- a/lib/infrastructure/order/order_dtos.freezed.dart +++ b/lib/infrastructure/order/order_dtos.freezed.dart @@ -1169,6 +1169,8 @@ mixin _$OrderItemDto { String? get updatedAt => throw _privateConstructorUsedError; @JsonKey(name: "printer_type") String? get printerType => throw _privateConstructorUsedError; + @JsonKey(name: "print_to_checker") + bool? get printToChecker => throw _privateConstructorUsedError; @JsonKey(name: "paid_quantity") int? get paidQuantity => throw _privateConstructorUsedError; @JsonKey(name: "category_id") @@ -1209,6 +1211,7 @@ abstract class $OrderItemDtoCopyWith<$Res> { @JsonKey(name: "created_at") String? createdAt, @JsonKey(name: "updated_at") String? updatedAt, @JsonKey(name: "printer_type") String? printerType, + @JsonKey(name: "print_to_checker") bool? printToChecker, @JsonKey(name: "paid_quantity") int? paidQuantity, @JsonKey(name: "category_id") String? categoryId, @JsonKey(name: "category_name") String? categoryName, @@ -1245,6 +1248,7 @@ class _$OrderItemDtoCopyWithImpl<$Res, $Val extends OrderItemDto> Object? createdAt = freezed, Object? updatedAt = freezed, Object? printerType = freezed, + Object? printToChecker = freezed, Object? paidQuantity = freezed, Object? categoryId = freezed, Object? categoryName = freezed, @@ -1311,6 +1315,10 @@ class _$OrderItemDtoCopyWithImpl<$Res, $Val extends OrderItemDto> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String?, + printToChecker: freezed == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool?, paidQuantity: freezed == paidQuantity ? _value.paidQuantity : paidQuantity // ignore: cast_nullable_to_non_nullable @@ -1354,6 +1362,7 @@ abstract class _$$OrderItemDtoImplCopyWith<$Res> @JsonKey(name: "created_at") String? createdAt, @JsonKey(name: "updated_at") String? updatedAt, @JsonKey(name: "printer_type") String? printerType, + @JsonKey(name: "print_to_checker") bool? printToChecker, @JsonKey(name: "paid_quantity") int? paidQuantity, @JsonKey(name: "category_id") String? categoryId, @JsonKey(name: "category_name") String? categoryName, @@ -1389,6 +1398,7 @@ class __$$OrderItemDtoImplCopyWithImpl<$Res> Object? createdAt = freezed, Object? updatedAt = freezed, Object? printerType = freezed, + Object? printToChecker = freezed, Object? paidQuantity = freezed, Object? categoryId = freezed, Object? categoryName = freezed, @@ -1455,6 +1465,10 @@ class __$$OrderItemDtoImplCopyWithImpl<$Res> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String?, + printToChecker: freezed == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool?, paidQuantity: freezed == paidQuantity ? _value.paidQuantity : paidQuantity // ignore: cast_nullable_to_non_nullable @@ -1491,6 +1505,7 @@ class _$OrderItemDtoImpl extends _OrderItemDto { @JsonKey(name: "created_at") this.createdAt, @JsonKey(name: "updated_at") this.updatedAt, @JsonKey(name: "printer_type") this.printerType, + @JsonKey(name: "print_to_checker") this.printToChecker, @JsonKey(name: "paid_quantity") this.paidQuantity, @JsonKey(name: "category_id") this.categoryId, @JsonKey(name: "category_name") this.categoryName, @@ -1554,6 +1569,9 @@ class _$OrderItemDtoImpl extends _OrderItemDto { @JsonKey(name: "printer_type") final String? printerType; @override + @JsonKey(name: "print_to_checker") + final bool? printToChecker; + @override @JsonKey(name: "paid_quantity") final int? paidQuantity; @override @@ -1565,7 +1583,7 @@ class _$OrderItemDtoImpl extends _OrderItemDto { @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, 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)'; } @override @@ -1601,6 +1619,8 @@ class _$OrderItemDtoImpl extends _OrderItemDto { other.updatedAt == updatedAt) && (identical(other.printerType, printerType) || other.printerType == printerType) && + (identical(other.printToChecker, printToChecker) || + other.printToChecker == printToChecker) && (identical(other.paidQuantity, paidQuantity) || other.paidQuantity == paidQuantity) && (identical(other.categoryId, categoryId) || @@ -1611,7 +1631,7 @@ class _$OrderItemDtoImpl extends _OrderItemDto { @JsonKey(includeFromJson: false, includeToJson: false) @override - int get hashCode => Object.hash( + int get hashCode => Object.hashAll([ runtimeType, id, orderId, @@ -1628,10 +1648,11 @@ class _$OrderItemDtoImpl extends _OrderItemDto { createdAt, updatedAt, printerType, + printToChecker, paidQuantity, categoryId, categoryName, - ); + ]); /// Create a copy of OrderItemDto /// with the given fields replaced by the non-null parameter values. @@ -1664,6 +1685,7 @@ abstract class _OrderItemDto extends OrderItemDto { @JsonKey(name: "created_at") final String? createdAt, @JsonKey(name: "updated_at") final String? updatedAt, @JsonKey(name: "printer_type") final String? printerType, + @JsonKey(name: "print_to_checker") final bool? printToChecker, @JsonKey(name: "paid_quantity") final int? paidQuantity, @JsonKey(name: "category_id") final String? categoryId, @JsonKey(name: "category_name") final String? categoryName, @@ -1719,6 +1741,9 @@ abstract class _OrderItemDto extends OrderItemDto { @JsonKey(name: "printer_type") String? get printerType; @override + @JsonKey(name: "print_to_checker") + bool? get printToChecker; + @override @JsonKey(name: "paid_quantity") int? get paidQuantity; @override diff --git a/lib/infrastructure/order/order_dtos.g.dart b/lib/infrastructure/order/order_dtos.g.dart index f577a9d..d4c2548 100644 --- a/lib/infrastructure/order/order_dtos.g.dart +++ b/lib/infrastructure/order/order_dtos.g.dart @@ -109,6 +109,7 @@ _$OrderItemDtoImpl _$$OrderItemDtoImplFromJson(Map json) => createdAt: json['created_at'] as String?, updatedAt: json['updated_at'] as String?, printerType: json['printer_type'] as String?, + printToChecker: json['print_to_checker'] as bool?, paidQuantity: (json['paid_quantity'] as num?)?.toInt(), categoryId: json['category_id'] as String?, categoryName: json['category_name'] as String?, @@ -131,6 +132,7 @@ Map _$$OrderItemDtoImplToJson(_$OrderItemDtoImpl instance) => 'created_at': instance.createdAt, 'updated_at': instance.updatedAt, 'printer_type': instance.printerType, + 'print_to_checker': instance.printToChecker, 'paid_quantity': instance.paidQuantity, 'category_id': instance.categoryId, 'category_name': instance.categoryName, diff --git a/lib/infrastructure/product/dtos/product_dto.dart b/lib/infrastructure/product/dtos/product_dto.dart index ad9f452..02ac822 100644 --- a/lib/infrastructure/product/dtos/product_dto.dart +++ b/lib/infrastructure/product/dtos/product_dto.dart @@ -40,6 +40,7 @@ class ProductDto with _$ProductDto { @JsonKey(name: "business_type") String? businessType, @JsonKey(name: "image_url") String? imageUrl, @JsonKey(name: "printer_type") String? printerType, + @JsonKey(name: "print_to_checker") bool? printToChecker, @JsonKey(name: "metadata") Map? metadata, @JsonKey(name: "is_active") bool? isActive, @JsonKey(name: "created_at") String? createdAt, @@ -63,6 +64,7 @@ class ProductDto with _$ProductDto { businessType: businessType ?? '', imageUrl: imageUrl ?? '', printerType: printerType ?? '', + printToChecker: printToChecker ?? false, metadata: metadata ?? {}, isActive: isActive ?? false, createdAt: createdAt ?? '', @@ -82,6 +84,7 @@ class ProductDto with _$ProductDto { 'business_type': businessType, 'image_url': imageUrl, 'printer_type': printerType, + 'print_to_checker': printToChecker == true ? 1 : 0, 'metadata': metadata != null ? jsonEncode(metadata) : null, 'is_active': isActive == true ? 1 : 0, 'created_at': createdAt, @@ -103,6 +106,9 @@ class ProductDto with _$ProductDto { businessType: map['business_type'] as String?, imageUrl: map['image_url'] as String?, printerType: map['printer_type'] as String?, + printToChecker: map['print_to_checker'] != null + ? (map['print_to_checker'] as int) == 1 + : null, metadata: map['metadata'] != null ? jsonDecode(map['metadata'] as String) as Map : null, @@ -125,6 +131,7 @@ class ProductDto with _$ProductDto { businessType: product.businessType, imageUrl: product.imageUrl, printerType: product.printerType, + printToChecker: product.printToChecker, metadata: product.metadata, isActive: product.isActive, createdAt: product.createdAt, diff --git a/lib/infrastructure/product/product_dtos.freezed.dart b/lib/infrastructure/product/product_dtos.freezed.dart index 55271d3..b1707f0 100644 --- a/lib/infrastructure/product/product_dtos.freezed.dart +++ b/lib/infrastructure/product/product_dtos.freezed.dart @@ -321,6 +321,8 @@ mixin _$ProductDto { String? get imageUrl => throw _privateConstructorUsedError; @JsonKey(name: "printer_type") String? get printerType => throw _privateConstructorUsedError; + @JsonKey(name: "print_to_checker") + bool? get printToChecker => throw _privateConstructorUsedError; @JsonKey(name: "metadata") Map? get metadata => throw _privateConstructorUsedError; @JsonKey(name: "is_active") @@ -361,6 +363,7 @@ abstract class $ProductDtoCopyWith<$Res> { @JsonKey(name: "business_type") String? businessType, @JsonKey(name: "image_url") String? imageUrl, @JsonKey(name: "printer_type") String? printerType, + @JsonKey(name: "print_to_checker") bool? printToChecker, @JsonKey(name: "metadata") Map? metadata, @JsonKey(name: "is_active") bool? isActive, @JsonKey(name: "created_at") String? createdAt, @@ -395,6 +398,7 @@ class _$ProductDtoCopyWithImpl<$Res, $Val extends ProductDto> Object? businessType = freezed, Object? imageUrl = freezed, Object? printerType = freezed, + Object? printToChecker = freezed, Object? metadata = freezed, Object? isActive = freezed, Object? createdAt = freezed, @@ -447,6 +451,10 @@ class _$ProductDtoCopyWithImpl<$Res, $Val extends ProductDto> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String?, + printToChecker: freezed == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool?, metadata: freezed == metadata ? _value.metadata : metadata // ignore: cast_nullable_to_non_nullable @@ -494,6 +502,7 @@ abstract class _$$ProductDtoImplCopyWith<$Res> @JsonKey(name: "business_type") String? businessType, @JsonKey(name: "image_url") String? imageUrl, @JsonKey(name: "printer_type") String? printerType, + @JsonKey(name: "print_to_checker") bool? printToChecker, @JsonKey(name: "metadata") Map? metadata, @JsonKey(name: "is_active") bool? isActive, @JsonKey(name: "created_at") String? createdAt, @@ -527,6 +536,7 @@ class __$$ProductDtoImplCopyWithImpl<$Res> Object? businessType = freezed, Object? imageUrl = freezed, Object? printerType = freezed, + Object? printToChecker = freezed, Object? metadata = freezed, Object? isActive = freezed, Object? createdAt = freezed, @@ -579,6 +589,10 @@ class __$$ProductDtoImplCopyWithImpl<$Res> ? _value.printerType : printerType // ignore: cast_nullable_to_non_nullable as String?, + printToChecker: freezed == printToChecker + ? _value.printToChecker + : printToChecker // ignore: cast_nullable_to_non_nullable + as bool?, metadata: freezed == metadata ? _value._metadata : metadata // ignore: cast_nullable_to_non_nullable @@ -619,6 +633,7 @@ class _$ProductDtoImpl extends _ProductDto { @JsonKey(name: "business_type") this.businessType, @JsonKey(name: "image_url") this.imageUrl, @JsonKey(name: "printer_type") this.printerType, + @JsonKey(name: "print_to_checker") this.printToChecker, @JsonKey(name: "metadata") final Map? metadata, @JsonKey(name: "is_active") this.isActive, @JsonKey(name: "created_at") this.createdAt, @@ -664,6 +679,9 @@ class _$ProductDtoImpl extends _ProductDto { @override @JsonKey(name: "printer_type") final String? printerType; + @override + @JsonKey(name: "print_to_checker") + final bool? printToChecker; final Map? _metadata; @override @JsonKey(name: "metadata") @@ -697,7 +715,7 @@ class _$ProductDtoImpl extends _ProductDto { @override String toString() { - return 'ProductDto(id: $id, organizationId: $organizationId, categoryId: $categoryId, sku: $sku, name: $name, description: $description, price: $price, cost: $cost, businessType: $businessType, imageUrl: $imageUrl, printerType: $printerType, metadata: $metadata, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, variants: $variants)'; + return 'ProductDto(id: $id, organizationId: $organizationId, categoryId: $categoryId, sku: $sku, name: $name, description: $description, price: $price, cost: $cost, businessType: $businessType, imageUrl: $imageUrl, printerType: $printerType, printToChecker: $printToChecker, metadata: $metadata, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt, variants: $variants)'; } @override @@ -722,6 +740,8 @@ class _$ProductDtoImpl extends _ProductDto { other.imageUrl == imageUrl) && (identical(other.printerType, printerType) || other.printerType == printerType) && + (identical(other.printToChecker, printToChecker) || + other.printToChecker == printToChecker) && const DeepCollectionEquality().equals(other._metadata, _metadata) && (identical(other.isActive, isActive) || other.isActive == isActive) && @@ -747,6 +767,7 @@ class _$ProductDtoImpl extends _ProductDto { businessType, imageUrl, printerType, + printToChecker, const DeepCollectionEquality().hash(_metadata), isActive, createdAt, @@ -781,6 +802,7 @@ abstract class _ProductDto extends ProductDto { @JsonKey(name: "business_type") final String? businessType, @JsonKey(name: "image_url") final String? imageUrl, @JsonKey(name: "printer_type") final String? printerType, + @JsonKey(name: "print_to_checker") final bool? printToChecker, @JsonKey(name: "metadata") final Map? metadata, @JsonKey(name: "is_active") final bool? isActive, @JsonKey(name: "created_at") final String? createdAt, @@ -826,6 +848,9 @@ abstract class _ProductDto extends ProductDto { @JsonKey(name: "printer_type") String? get printerType; @override + @JsonKey(name: "print_to_checker") + bool? get printToChecker; + @override @JsonKey(name: "metadata") Map? get metadata; @override diff --git a/lib/infrastructure/product/product_dtos.g.dart b/lib/infrastructure/product/product_dtos.g.dart index 6cb8f4a..a25eb29 100644 --- a/lib/infrastructure/product/product_dtos.g.dart +++ b/lib/infrastructure/product/product_dtos.g.dart @@ -40,6 +40,7 @@ _$ProductDtoImpl _$$ProductDtoImplFromJson(Map json) => businessType: json['business_type'] as String?, imageUrl: json['image_url'] as String?, printerType: json['printer_type'] as String?, + printToChecker: json['print_to_checker'] as bool?, metadata: json['metadata'] as Map?, isActive: json['is_active'] as bool?, createdAt: json['created_at'] as String?, @@ -62,6 +63,7 @@ Map _$$ProductDtoImplToJson(_$ProductDtoImpl instance) => 'business_type': instance.businessType, 'image_url': instance.imageUrl, 'printer_type': instance.printerType, + 'print_to_checker': instance.printToChecker, 'metadata': instance.metadata, 'is_active': instance.isActive, 'created_at': instance.createdAt, diff --git a/lib/presentation/components/print/print_ui.dart b/lib/presentation/components/print/print_ui.dart index dcd8985..1fe4fc1 100644 --- a/lib/presentation/components/print/print_ui.dart +++ b/lib/presentation/components/print/print_ui.dart @@ -117,7 +117,7 @@ class PrintUi { bytes += builder.separator(); // Items — qty NAMA (uppercase), variant indent - for (final item in order.orderItems) { + for (final item in order.orderItems.where((e) => e.printToChecker)) { final name = item.productName.toUpperCase(); bytes += builder.itemText('${item.quantity} $name'); if (item.productVariantName.isNotEmpty) { diff --git a/pubspec.yaml b/pubspec.yaml index 4a4130d..6f90891 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: "A new Flutter project." publish_to: "none" -version: 1.0.8+14 +version: 1.0.9+15 environment: sdk: ^3.8.1