fix split bill
This commit is contained in:
@@ -401,3 +401,103 @@ extension OrderItemListExtension on List<OrderItem> {
|
||||
quantity: e.quantity ?? 0,
|
||||
)).toList();
|
||||
}
|
||||
|
||||
extension OrderCopyWith on Order {
|
||||
Order copyWith({
|
||||
String? id,
|
||||
String? orderNumber,
|
||||
String? outletId,
|
||||
String? userId,
|
||||
String? tableNumber,
|
||||
String? orderType,
|
||||
String? status,
|
||||
int? subtotal,
|
||||
int? taxAmount,
|
||||
int? discountAmount,
|
||||
int? totalAmount,
|
||||
num? totalCost,
|
||||
int? remainingAmount,
|
||||
String? paymentStatus,
|
||||
int? refundAmount,
|
||||
bool? isVoid,
|
||||
bool? isRefund,
|
||||
String? notes,
|
||||
Map<String, dynamic>? metadata,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
List<OrderItem>? orderItems,
|
||||
List<Payment>? payments,
|
||||
int? totalPaid,
|
||||
int? paymentCount,
|
||||
String? splitType,
|
||||
}) {
|
||||
return Order(
|
||||
id: id ?? this.id,
|
||||
orderNumber: orderNumber ?? this.orderNumber,
|
||||
outletId: outletId ?? this.outletId,
|
||||
userId: userId ?? this.userId,
|
||||
tableNumber: tableNumber ?? this.tableNumber,
|
||||
orderType: orderType ?? this.orderType,
|
||||
status: status ?? this.status,
|
||||
subtotal: subtotal ?? this.subtotal,
|
||||
taxAmount: taxAmount ?? this.taxAmount,
|
||||
discountAmount: discountAmount ?? this.discountAmount,
|
||||
totalAmount: totalAmount ?? this.totalAmount,
|
||||
totalCost: totalCost ?? this.totalCost,
|
||||
remainingAmount: remainingAmount ?? this.remainingAmount,
|
||||
paymentStatus: paymentStatus ?? this.paymentStatus,
|
||||
refundAmount: refundAmount ?? this.refundAmount,
|
||||
isVoid: isVoid ?? this.isVoid,
|
||||
isRefund: isRefund ?? this.isRefund,
|
||||
notes: notes ?? this.notes,
|
||||
metadata: metadata ?? this.metadata,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
orderItems: orderItems ?? this.orderItems,
|
||||
payments: payments ?? this.payments,
|
||||
totalPaid: totalPaid ?? this.totalPaid,
|
||||
paymentCount: paymentCount ?? this.paymentCount,
|
||||
splitType: splitType ?? this.splitType,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension OrderItemCopyWith on OrderItem {
|
||||
OrderItem copyWith({
|
||||
String? id,
|
||||
String? orderId,
|
||||
String? productId,
|
||||
String? productName,
|
||||
String? productVariantId,
|
||||
String? productVariantName,
|
||||
int? quantity,
|
||||
int? unitPrice,
|
||||
int? totalPrice,
|
||||
List<dynamic>? modifiers,
|
||||
String? notes,
|
||||
String? status,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
String? printerType,
|
||||
int? paidQuantity,
|
||||
}) {
|
||||
return OrderItem(
|
||||
id: id ?? this.id,
|
||||
orderId: orderId ?? this.orderId,
|
||||
productId: productId ?? this.productId,
|
||||
productName: productName ?? this.productName,
|
||||
productVariantId: productVariantId ?? this.productVariantId,
|
||||
productVariantName: productVariantName ?? this.productVariantName,
|
||||
quantity: quantity ?? this.quantity,
|
||||
unitPrice: unitPrice ?? this.unitPrice,
|
||||
totalPrice: totalPrice ?? this.totalPrice,
|
||||
modifiers: modifiers ?? this.modifiers,
|
||||
notes: notes ?? this.notes,
|
||||
status: status ?? this.status,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
printerType: printerType ?? this.printerType,
|
||||
paidQuantity: paidQuantity ?? this.paidQuantity,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user