split bill
This commit is contained in:
@@ -5,6 +5,7 @@ import '../../../../application/payment/payment_form/payment_form_bloc.dart';
|
||||
import '../../../../application/payment_method/payment_method_loader/payment_method_loader_bloc.dart';
|
||||
import '../../../../common/extension/extension.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../../common/types/split_type.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import '../../../components/card/payment_card.dart';
|
||||
import '../../../components/error/payment_method_error_state_widget.dart';
|
||||
@@ -15,7 +16,18 @@ import '../../../components/toast/flushbar.dart';
|
||||
|
||||
class PaymentRightPanel extends StatefulWidget {
|
||||
final PaymentFormState state;
|
||||
const PaymentRightPanel({super.key, required this.state});
|
||||
final bool isSplit;
|
||||
final SplitType splitType;
|
||||
final String? customerId;
|
||||
final String? customerName;
|
||||
const PaymentRightPanel({
|
||||
super.key,
|
||||
required this.state,
|
||||
required this.isSplit,
|
||||
this.customerId,
|
||||
required this.splitType,
|
||||
this.customerName,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PaymentRightPanel> createState() => _PaymentRightPanelState();
|
||||
@@ -211,9 +223,18 @@ class _PaymentRightPanelState extends State<PaymentRightPanel> {
|
||||
}
|
||||
|
||||
if (!widget.state.isSubmitting) {
|
||||
context.read<PaymentFormBloc>().add(
|
||||
PaymentFormEvent.submitted(),
|
||||
);
|
||||
if (widget.isSplit) {
|
||||
context.read<PaymentFormBloc>().add(
|
||||
PaymentFormEvent.submittedSplitBill(
|
||||
customerId: widget.customerId,
|
||||
splitType: widget.splitType,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
context.read<PaymentFormBloc>().add(
|
||||
PaymentFormEvent.submitted(),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
label: 'Bayar',
|
||||
|
||||
Reference in New Issue
Block a user