fix split bill
This commit is contained in:
@@ -12,6 +12,7 @@ import 'package:enaklo_pos/presentation/home/bloc/payment_methods/payment_method
|
||||
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:enaklo_pos/presentation/success/pages/success_split_bill_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
@@ -370,23 +371,43 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
state.maybeWhen(
|
||||
orElse: () {},
|
||||
success: (data) {
|
||||
context.pushReplacement(SuccessPaymentPage(
|
||||
productQuantity: getOrderItemPending()
|
||||
.map(
|
||||
(item) => ProductQuantity(
|
||||
product: Product(
|
||||
name: item.productName,
|
||||
price: item.unitPrice,
|
||||
),
|
||||
quantity: item.quantity ?? 0,
|
||||
if (widget.isSplit) {
|
||||
context.pushReplacement(SuccessSplitBillPage(
|
||||
productQuantity: getOrderItemPending()
|
||||
.map(
|
||||
(item) => ProductQuantity(
|
||||
product: Product(
|
||||
name: item.productName,
|
||||
price: item.unitPrice,
|
||||
),
|
||||
)
|
||||
.toList() ??
|
||||
[],
|
||||
payment: data,
|
||||
paymentMethod: selectedPaymentMethod?.name ?? '',
|
||||
nominalBayar: totalPriceController.text.toIntegerFromText,
|
||||
));
|
||||
quantity: item.quantity ?? 0,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
payment: data,
|
||||
paymentMethod: selectedPaymentMethod?.name ?? '',
|
||||
nominalBayar:
|
||||
totalPriceController.text.toIntegerFromText,
|
||||
));
|
||||
} else {
|
||||
context.pushReplacement(SuccessPaymentPage(
|
||||
productQuantity: getOrderItemPending()
|
||||
.map(
|
||||
(item) => ProductQuantity(
|
||||
product: Product(
|
||||
name: item.productName,
|
||||
price: item.unitPrice,
|
||||
),
|
||||
quantity: item.quantity ?? 0,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
payment: data,
|
||||
paymentMethod: selectedPaymentMethod?.name ?? '',
|
||||
nominalBayar:
|
||||
totalPriceController.text.toIntegerFromText,
|
||||
));
|
||||
}
|
||||
},
|
||||
error: (message) {
|
||||
AppFlushbar.showError(context, message);
|
||||
|
||||
Reference in New Issue
Block a user