feat: update success order

This commit is contained in:
efrilm
2025-08-04 12:38:33 +07:00
parent 00cd5bbeb8
commit cd071db0cb
11 changed files with 930 additions and 385 deletions
@@ -23,5 +23,14 @@ class OrderLoaderBloc extends Bloc<OrderLoaderEvent, OrderLoaderState> {
)),
);
});
on<_GetById>((event, emit) async {
emit(const _Loading());
final result =
await _orderRemoteDatasource.getOrderById(orderId: event.id);
result.fold(
(l) => emit(_Error(l)),
(r) => emit(_LoadedDetail(r.data!)),
);
});
}
}
@@ -16,45 +16,44 @@ final _privateConstructorUsedError = UnsupportedError(
/// @nodoc
mixin _$OrderLoaderEvent {
String get status => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String status) getByStatus,
required TResult Function(String id) getById,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String status)? getByStatus,
TResult? Function(String id)? getById,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String status)? getByStatus,
TResult Function(String id)? getById,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_GetByStatus value) getByStatus,
required TResult Function(_GetById value) getById,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_GetByStatus value)? getByStatus,
TResult? Function(_GetById value)? getById,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_GetByStatus value)? getByStatus,
TResult Function(_GetById value)? getById,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$OrderLoaderEventCopyWith<OrderLoaderEvent> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
@@ -62,8 +61,6 @@ abstract class $OrderLoaderEventCopyWith<$Res> {
factory $OrderLoaderEventCopyWith(
OrderLoaderEvent value, $Res Function(OrderLoaderEvent) then) =
_$OrderLoaderEventCopyWithImpl<$Res, OrderLoaderEvent>;
@useResult
$Res call({String status});
}
/// @nodoc
@@ -78,27 +75,13 @@ class _$OrderLoaderEventCopyWithImpl<$Res, $Val extends OrderLoaderEvent>
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? status = null,
}) {
return _then(_value.copyWith(
status: null == status
? _value.status
: status // ignore: cast_nullable_to_non_nullable
as String,
) as $Val);
}
}
/// @nodoc
abstract class _$$GetByStatusImplCopyWith<$Res>
implements $OrderLoaderEventCopyWith<$Res> {
abstract class _$$GetByStatusImplCopyWith<$Res> {
factory _$$GetByStatusImplCopyWith(
_$GetByStatusImpl value, $Res Function(_$GetByStatusImpl) then) =
__$$GetByStatusImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({String status});
}
@@ -163,6 +146,7 @@ class _$GetByStatusImpl implements _GetByStatus {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String status) getByStatus,
required TResult Function(String id) getById,
}) {
return getByStatus(status);
}
@@ -171,6 +155,7 @@ class _$GetByStatusImpl implements _GetByStatus {
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String status)? getByStatus,
TResult? Function(String id)? getById,
}) {
return getByStatus?.call(status);
}
@@ -179,6 +164,7 @@ class _$GetByStatusImpl implements _GetByStatus {
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String status)? getByStatus,
TResult Function(String id)? getById,
required TResult orElse(),
}) {
if (getByStatus != null) {
@@ -191,6 +177,7 @@ class _$GetByStatusImpl implements _GetByStatus {
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_GetByStatus value) getByStatus,
required TResult Function(_GetById value) getById,
}) {
return getByStatus(this);
}
@@ -199,6 +186,7 @@ class _$GetByStatusImpl implements _GetByStatus {
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_GetByStatus value)? getByStatus,
TResult? Function(_GetById value)? getById,
}) {
return getByStatus?.call(this);
}
@@ -207,6 +195,7 @@ class _$GetByStatusImpl implements _GetByStatus {
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_GetByStatus value)? getByStatus,
TResult Function(_GetById value)? getById,
required TResult orElse(),
}) {
if (getByStatus != null) {
@@ -219,17 +208,155 @@ class _$GetByStatusImpl implements _GetByStatus {
abstract class _GetByStatus implements OrderLoaderEvent {
const factory _GetByStatus(final String status) = _$GetByStatusImpl;
@override
String get status;
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$GetByStatusImplCopyWith<_$GetByStatusImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$GetByIdImplCopyWith<$Res> {
factory _$$GetByIdImplCopyWith(
_$GetByIdImpl value, $Res Function(_$GetByIdImpl) then) =
__$$GetByIdImplCopyWithImpl<$Res>;
@useResult
$Res call({String id});
}
/// @nodoc
class __$$GetByIdImplCopyWithImpl<$Res>
extends _$OrderLoaderEventCopyWithImpl<$Res, _$GetByIdImpl>
implements _$$GetByIdImplCopyWith<$Res> {
__$$GetByIdImplCopyWithImpl(
_$GetByIdImpl _value, $Res Function(_$GetByIdImpl) _then)
: super(_value, _then);
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? id = null,
}) {
return _then(_$GetByIdImpl(
null == id
? _value.id
: id // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
class _$GetByIdImpl implements _GetById {
const _$GetByIdImpl(this.id);
@override
final String id;
@override
String toString() {
return 'OrderLoaderEvent.getById(id: $id)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$GetByIdImpl &&
(identical(other.id, id) || other.id == id));
}
@override
int get hashCode => Object.hash(runtimeType, id);
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$GetByIdImplCopyWith<_$GetByIdImpl> get copyWith =>
__$$GetByIdImplCopyWithImpl<_$GetByIdImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String status) getByStatus,
required TResult Function(String id) getById,
}) {
return getById(id);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String status)? getByStatus,
TResult? Function(String id)? getById,
}) {
return getById?.call(id);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String status)? getByStatus,
TResult Function(String id)? getById,
required TResult orElse(),
}) {
if (getById != null) {
return getById(id);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_GetByStatus value) getByStatus,
required TResult Function(_GetById value) getById,
}) {
return getById(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_GetByStatus value)? getByStatus,
TResult? Function(_GetById value)? getById,
}) {
return getById?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_GetByStatus value)? getByStatus,
TResult Function(_GetById value)? getById,
required TResult orElse(),
}) {
if (getById != null) {
return getById(this);
}
return orElse();
}
}
abstract class _GetById implements OrderLoaderEvent {
const factory _GetById(final String id) = _$GetByIdImpl;
String get id;
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$GetByIdImplCopyWith<_$GetByIdImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$OrderLoaderState {
@optionalTypeArgs
@@ -238,6 +365,7 @@ mixin _$OrderLoaderState {
required TResult Function() loading,
required TResult Function(List<Order> orders, int totalOrder) loaded,
required TResult Function(String message) error,
required TResult Function(Order order) loadedDetail,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -246,6 +374,7 @@ mixin _$OrderLoaderState {
TResult? Function()? loading,
TResult? Function(List<Order> orders, int totalOrder)? loaded,
TResult? Function(String message)? error,
TResult? Function(Order order)? loadedDetail,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -254,6 +383,7 @@ mixin _$OrderLoaderState {
TResult Function()? loading,
TResult Function(List<Order> orders, int totalOrder)? loaded,
TResult Function(String message)? error,
TResult Function(Order order)? loadedDetail,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@@ -263,6 +393,7 @@ mixin _$OrderLoaderState {
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
required TResult Function(_LoadedDetail value) loadedDetail,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -271,6 +402,7 @@ mixin _$OrderLoaderState {
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
TResult? Function(_LoadedDetail value)? loadedDetail,
}) =>
throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -279,6 +411,7 @@ mixin _$OrderLoaderState {
TResult Function(_Loading value)? loading,
TResult Function(_Loaded value)? loaded,
TResult Function(_Error value)? error,
TResult Function(_LoadedDetail value)? loadedDetail,
required TResult orElse(),
}) =>
throw _privateConstructorUsedError;
@@ -350,6 +483,7 @@ class _$InitialImpl implements _Initial {
required TResult Function() loading,
required TResult Function(List<Order> orders, int totalOrder) loaded,
required TResult Function(String message) error,
required TResult Function(Order order) loadedDetail,
}) {
return initial();
}
@@ -361,6 +495,7 @@ class _$InitialImpl implements _Initial {
TResult? Function()? loading,
TResult? Function(List<Order> orders, int totalOrder)? loaded,
TResult? Function(String message)? error,
TResult? Function(Order order)? loadedDetail,
}) {
return initial?.call();
}
@@ -372,6 +507,7 @@ class _$InitialImpl implements _Initial {
TResult Function()? loading,
TResult Function(List<Order> orders, int totalOrder)? loaded,
TResult Function(String message)? error,
TResult Function(Order order)? loadedDetail,
required TResult orElse(),
}) {
if (initial != null) {
@@ -387,6 +523,7 @@ class _$InitialImpl implements _Initial {
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
required TResult Function(_LoadedDetail value) loadedDetail,
}) {
return initial(this);
}
@@ -398,6 +535,7 @@ class _$InitialImpl implements _Initial {
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
TResult? Function(_LoadedDetail value)? loadedDetail,
}) {
return initial?.call(this);
}
@@ -409,6 +547,7 @@ class _$InitialImpl implements _Initial {
TResult Function(_Loading value)? loading,
TResult Function(_Loaded value)? loaded,
TResult Function(_Error value)? error,
TResult Function(_LoadedDetail value)? loadedDetail,
required TResult orElse(),
}) {
if (initial != null) {
@@ -467,6 +606,7 @@ class _$LoadingImpl implements _Loading {
required TResult Function() loading,
required TResult Function(List<Order> orders, int totalOrder) loaded,
required TResult Function(String message) error,
required TResult Function(Order order) loadedDetail,
}) {
return loading();
}
@@ -478,6 +618,7 @@ class _$LoadingImpl implements _Loading {
TResult? Function()? loading,
TResult? Function(List<Order> orders, int totalOrder)? loaded,
TResult? Function(String message)? error,
TResult? Function(Order order)? loadedDetail,
}) {
return loading?.call();
}
@@ -489,6 +630,7 @@ class _$LoadingImpl implements _Loading {
TResult Function()? loading,
TResult Function(List<Order> orders, int totalOrder)? loaded,
TResult Function(String message)? error,
TResult Function(Order order)? loadedDetail,
required TResult orElse(),
}) {
if (loading != null) {
@@ -504,6 +646,7 @@ class _$LoadingImpl implements _Loading {
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
required TResult Function(_LoadedDetail value) loadedDetail,
}) {
return loading(this);
}
@@ -515,6 +658,7 @@ class _$LoadingImpl implements _Loading {
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
TResult? Function(_LoadedDetail value)? loadedDetail,
}) {
return loading?.call(this);
}
@@ -526,6 +670,7 @@ class _$LoadingImpl implements _Loading {
TResult Function(_Loading value)? loading,
TResult Function(_Loaded value)? loaded,
TResult Function(_Error value)? error,
TResult Function(_LoadedDetail value)? loadedDetail,
required TResult orElse(),
}) {
if (loading != null) {
@@ -628,6 +773,7 @@ class _$LoadedImpl implements _Loaded {
required TResult Function() loading,
required TResult Function(List<Order> orders, int totalOrder) loaded,
required TResult Function(String message) error,
required TResult Function(Order order) loadedDetail,
}) {
return loaded(orders, totalOrder);
}
@@ -639,6 +785,7 @@ class _$LoadedImpl implements _Loaded {
TResult? Function()? loading,
TResult? Function(List<Order> orders, int totalOrder)? loaded,
TResult? Function(String message)? error,
TResult? Function(Order order)? loadedDetail,
}) {
return loaded?.call(orders, totalOrder);
}
@@ -650,6 +797,7 @@ class _$LoadedImpl implements _Loaded {
TResult Function()? loading,
TResult Function(List<Order> orders, int totalOrder)? loaded,
TResult Function(String message)? error,
TResult Function(Order order)? loadedDetail,
required TResult orElse(),
}) {
if (loaded != null) {
@@ -665,6 +813,7 @@ class _$LoadedImpl implements _Loaded {
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
required TResult Function(_LoadedDetail value) loadedDetail,
}) {
return loaded(this);
}
@@ -676,6 +825,7 @@ class _$LoadedImpl implements _Loaded {
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
TResult? Function(_LoadedDetail value)? loadedDetail,
}) {
return loaded?.call(this);
}
@@ -687,6 +837,7 @@ class _$LoadedImpl implements _Loaded {
TResult Function(_Loading value)? loading,
TResult Function(_Loaded value)? loaded,
TResult Function(_Error value)? error,
TResult Function(_LoadedDetail value)? loadedDetail,
required TResult orElse(),
}) {
if (loaded != null) {
@@ -782,6 +933,7 @@ class _$ErrorImpl implements _Error {
required TResult Function() loading,
required TResult Function(List<Order> orders, int totalOrder) loaded,
required TResult Function(String message) error,
required TResult Function(Order order) loadedDetail,
}) {
return error(message);
}
@@ -793,6 +945,7 @@ class _$ErrorImpl implements _Error {
TResult? Function()? loading,
TResult? Function(List<Order> orders, int totalOrder)? loaded,
TResult? Function(String message)? error,
TResult? Function(Order order)? loadedDetail,
}) {
return error?.call(message);
}
@@ -804,6 +957,7 @@ class _$ErrorImpl implements _Error {
TResult Function()? loading,
TResult Function(List<Order> orders, int totalOrder)? loaded,
TResult Function(String message)? error,
TResult Function(Order order)? loadedDetail,
required TResult orElse(),
}) {
if (error != null) {
@@ -819,6 +973,7 @@ class _$ErrorImpl implements _Error {
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
required TResult Function(_LoadedDetail value) loadedDetail,
}) {
return error(this);
}
@@ -830,6 +985,7 @@ class _$ErrorImpl implements _Error {
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
TResult? Function(_LoadedDetail value)? loadedDetail,
}) {
return error?.call(this);
}
@@ -841,6 +997,7 @@ class _$ErrorImpl implements _Error {
TResult Function(_Loading value)? loading,
TResult Function(_Loaded value)? loaded,
TResult Function(_Error value)? error,
TResult Function(_LoadedDetail value)? loadedDetail,
required TResult orElse(),
}) {
if (error != null) {
@@ -861,3 +1018,161 @@ abstract class _Error implements OrderLoaderState {
_$$ErrorImplCopyWith<_$ErrorImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$LoadedDetailImplCopyWith<$Res> {
factory _$$LoadedDetailImplCopyWith(
_$LoadedDetailImpl value, $Res Function(_$LoadedDetailImpl) then) =
__$$LoadedDetailImplCopyWithImpl<$Res>;
@useResult
$Res call({Order order});
}
/// @nodoc
class __$$LoadedDetailImplCopyWithImpl<$Res>
extends _$OrderLoaderStateCopyWithImpl<$Res, _$LoadedDetailImpl>
implements _$$LoadedDetailImplCopyWith<$Res> {
__$$LoadedDetailImplCopyWithImpl(
_$LoadedDetailImpl _value, $Res Function(_$LoadedDetailImpl) _then)
: super(_value, _then);
/// Create a copy of OrderLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? order = null,
}) {
return _then(_$LoadedDetailImpl(
null == order
? _value.order
: order // ignore: cast_nullable_to_non_nullable
as Order,
));
}
}
/// @nodoc
class _$LoadedDetailImpl implements _LoadedDetail {
const _$LoadedDetailImpl(this.order);
@override
final Order order;
@override
String toString() {
return 'OrderLoaderState.loadedDetail(order: $order)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$LoadedDetailImpl &&
(identical(other.order, order) || other.order == order));
}
@override
int get hashCode => Object.hash(runtimeType, order);
/// Create a copy of OrderLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$LoadedDetailImplCopyWith<_$LoadedDetailImpl> get copyWith =>
__$$LoadedDetailImplCopyWithImpl<_$LoadedDetailImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() initial,
required TResult Function() loading,
required TResult Function(List<Order> orders, int totalOrder) loaded,
required TResult Function(String message) error,
required TResult Function(Order order) loadedDetail,
}) {
return loadedDetail(order);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? initial,
TResult? Function()? loading,
TResult? Function(List<Order> orders, int totalOrder)? loaded,
TResult? Function(String message)? error,
TResult? Function(Order order)? loadedDetail,
}) {
return loadedDetail?.call(order);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? initial,
TResult Function()? loading,
TResult Function(List<Order> orders, int totalOrder)? loaded,
TResult Function(String message)? error,
TResult Function(Order order)? loadedDetail,
required TResult orElse(),
}) {
if (loadedDetail != null) {
return loadedDetail(order);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Initial value) initial,
required TResult Function(_Loading value) loading,
required TResult Function(_Loaded value) loaded,
required TResult Function(_Error value) error,
required TResult Function(_LoadedDetail value) loadedDetail,
}) {
return loadedDetail(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Initial value)? initial,
TResult? Function(_Loading value)? loading,
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Error value)? error,
TResult? Function(_LoadedDetail value)? loadedDetail,
}) {
return loadedDetail?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Initial value)? initial,
TResult Function(_Loading value)? loading,
TResult Function(_Loaded value)? loaded,
TResult Function(_Error value)? error,
TResult Function(_LoadedDetail value)? loadedDetail,
required TResult orElse(),
}) {
if (loadedDetail != null) {
return loadedDetail(this);
}
return orElse();
}
}
abstract class _LoadedDetail implements OrderLoaderState {
const factory _LoadedDetail(final Order order) = _$LoadedDetailImpl;
Order get order;
/// Create a copy of OrderLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$LoadedDetailImplCopyWith<_$LoadedDetailImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -3,4 +3,5 @@ part of 'order_loader_bloc.dart';
@freezed
class OrderLoaderEvent with _$OrderLoaderEvent {
const factory OrderLoaderEvent.getByStatus(String status) = _GetByStatus;
const factory OrderLoaderEvent.getById(String id) = _GetById;
}
@@ -7,4 +7,5 @@ class OrderLoaderState with _$OrderLoaderState {
const factory OrderLoaderState.loaded(List<Order> orders, int totalOrder) =
_Loaded;
const factory OrderLoaderState.error(String message) = _Error;
const factory OrderLoaderState.loadedDetail(Order order) = _LoadedDetail;
}
@@ -11,7 +11,9 @@ import 'package:enaklo_pos/core/extensions/string_ext.dart';
import 'package:enaklo_pos/data/models/request/payment_request.dart';
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
import 'package:enaklo_pos/data/models/response/payment_methods_response_model.dart';
import 'package:enaklo_pos/data/models/response/product_response_model.dart';
import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_methods_bloc.dart';
import 'package:enaklo_pos/presentation/home/models/product_quantity.dart';
import 'package:enaklo_pos/presentation/sales/blocs/payment_form/payment_form_bloc.dart';
import 'package:enaklo_pos/presentation/success/pages/success_payment_page.dart';
import 'package:flutter/material.dart';
@@ -328,6 +330,18 @@ class _PaymentDialogState extends State<PaymentDialog> {
orElse: () {},
success: (data) {
context.pushReplacement(SuccessPaymentPage(
productQuantity: widget.order.orderItems
?.map(
(item) => ProductQuantity(
product: Product(
name: item.productName,
price: item.unitPrice,
),
quantity: item.quantity ?? 0,
),
)
.toList() ??
[],
payment: data,
));
},