dev #1
@ -121,17 +121,17 @@ class PaymentSplitBillRequest {
|
||||
|
||||
class SplitItem {
|
||||
final String orderItemId;
|
||||
final int amount;
|
||||
final int quantity;
|
||||
|
||||
SplitItem({
|
||||
required this.orderItemId,
|
||||
required this.amount,
|
||||
required this.quantity,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'order_item_id': orderItemId,
|
||||
'amount': amount,
|
||||
'quantity': quantity,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,6 +244,7 @@ class OrderItem {
|
||||
DateTime? createdAt;
|
||||
DateTime? updatedAt;
|
||||
String? printerType;
|
||||
int? paidQuantity;
|
||||
|
||||
OrderItem({
|
||||
this.id,
|
||||
@ -261,6 +262,7 @@ class OrderItem {
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
this.printerType,
|
||||
this.paidQuantity,
|
||||
});
|
||||
|
||||
factory OrderItem.fromMap(Map<String, dynamic> map) {
|
||||
@ -281,6 +283,7 @@ class OrderItem {
|
||||
createdAt: DateTime.parse(map['created_at']),
|
||||
updatedAt: DateTime.parse(map['updated_at']),
|
||||
printerType: map['printer_type'],
|
||||
paidQuantity: map['paid_quantity'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -301,6 +304,7 @@ class OrderItem {
|
||||
'created_at': createdAt?.toIso8601String(),
|
||||
'updated_at': updatedAt?.toIso8601String(),
|
||||
'printer_type': printerType,
|
||||
'paid_quantity': paidQuantity,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ class _PaymentPageState extends State<PaymentPage> {
|
||||
items: itemPending
|
||||
?.map((item) => SplitItem(
|
||||
orderItemId: item.id ?? "",
|
||||
amount: item.unitPrice ?? 0,
|
||||
quantity: item.quantity ?? 0,
|
||||
))
|
||||
.toList() ??
|
||||
[],
|
||||
|
||||
@ -271,6 +271,57 @@ class SalesListOrder extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (order?.splitType == 'ITEM' && order?.status == 'pending') ...[
|
||||
SpaceHeight(6),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColors.primary),
|
||||
),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '${product.paidQuantity} ',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'dari ',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: '${product.quantity} ',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'kuantiti telah dibayar.',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:enaklo_pos/core/components/flushbar.dart';
|
||||
import 'package:enaklo_pos/core/components/spaces.dart';
|
||||
import 'package:enaklo_pos/core/extensions/build_context_ext.dart';
|
||||
import 'package:enaklo_pos/data/models/response/customer_response_model.dart';
|
||||
import 'package:enaklo_pos/data/models/response/order_response_model.dart';
|
||||
@ -176,6 +177,50 @@ class _SplitBillPageState extends State<SplitBillPage> {
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
],
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Total terbayar',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColorSplitBill.textPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Rp ${_formatCurrency(widget.order.totalPaid ?? 0)}',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColorSplitBill.textPrimary,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Sisa Tagihan',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Rp ${_formatCurrency(widget.order.remainingAmount ?? 0)}',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -313,7 +358,9 @@ class _SplitBillPageState extends State<SplitBillPage> {
|
||||
Widget _buildOrderItem(OrderItem item) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
@ -357,6 +404,59 @@ class _SplitBillPageState extends State<SplitBillPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if ((item.paidQuantity ?? 0) > 1) ...[
|
||||
SpaceHeight(6),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColorSplitBill.primary.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: AppColorSplitBill.primary),
|
||||
),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '${item.paidQuantity} ',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColorSplitBill.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'dari ',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColorSplitBill.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: '${item.quantity} ',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColorSplitBill.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: 'kuantiti telah dibayar.',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColorSplitBill.primary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -468,7 +568,7 @@ class _SplitBillPageState extends State<SplitBillPage> {
|
||||
|
||||
Widget _buildProductSplitItem(OrderItem item) {
|
||||
int selectedQty = selectedProducts[item.id] ?? 0;
|
||||
int maxQty = item.quantity ?? 0;
|
||||
int maxQty = (item.quantity ?? 0) - (item.paidQuantity ?? 0);
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 12),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user