|
|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/orders_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
|
|
|
|
|
@ -22,9 +23,11 @@ import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
dynamic languageID;
|
|
|
|
|
class OrderDetailsPage extends StatefulWidget {
|
|
|
|
|
OrderModel orderModel;
|
|
|
|
|
Orders orderModel;
|
|
|
|
|
OrderModel orderDetails;
|
|
|
|
|
|
|
|
|
|
OrderDetailsPage({@required this.orderModel, this.orderDetails});
|
|
|
|
|
|
|
|
|
|
OrderDetailsPage({@required this.orderModel});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_OrderDetailsPageState createState() => _OrderDetailsPageState();
|
|
|
|
|
@ -51,9 +54,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
|
|
getLanguageID();
|
|
|
|
|
super.initState();
|
|
|
|
|
print(widget.orderModel.orderItems.length);
|
|
|
|
|
// print(widget.orderModel.orderItems.length);
|
|
|
|
|
getCancelOrder(widget.orderModel.id);
|
|
|
|
|
// cancelOrderDetail(order)
|
|
|
|
|
}
|
|
|
|
|
@ -105,9 +109,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
|
borderRadius: BorderRadius.circular(30.0)),
|
|
|
|
|
child: Text(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
? widget.orderModel.orderStatusn.toString():
|
|
|
|
|
widget.orderModel.orderStatus.toString().substring(12) ,
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
? widget.orderModel.orderStatusn.toString():
|
|
|
|
|
widget.orderModel.orderStatus.toString().substring(12) ,
|
|
|
|
|
// TranslationBase.of(context).delivered,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
@ -124,11 +128,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.shippingAddress.firstName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(10) +
|
|
|
|
|
widget.orderDetails.shippingAddress.firstName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(10) +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderModel.shippingAddress.lastName
|
|
|
|
|
widget.orderDetails.shippingAddress.lastName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
@ -141,18 +145,18 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.shippingAddress.address1
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),]
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.shippingAddress.address1
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),]
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
@ -161,14 +165,14 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.shippingAddress.address2
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9) +
|
|
|
|
|
widget.orderDetails.shippingAddress.address2
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9) +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderModel.shippingAddress.country
|
|
|
|
|
widget.orderDetails.shippingAddress.country
|
|
|
|
|
.toString() +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderModel.shippingAddress.zipPostalCode
|
|
|
|
|
widget.orderDetails.shippingAddress.zipPostalCode
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
@ -191,7 +195,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderModel.shippingAddress.phoneNumber
|
|
|
|
|
widget.orderDetails.shippingAddress.phoneNumber
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
@ -230,8 +234,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: flutterImage.Image.asset(
|
|
|
|
|
widget.orderModel.shippingRateComputationMethodSystemName !=
|
|
|
|
|
"Shipping.Aramex"
|
|
|
|
|
widget.orderDetails.shippingRateComputationMethodSystemName !=
|
|
|
|
|
"Shipping.Aramex"
|
|
|
|
|
? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
|
|
|
|
|
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
@ -282,7 +286,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderModel.paymentName.toString().substring(12),
|
|
|
|
|
widget.orderDetails.paymentName.toString().substring(12),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
@ -318,23 +322,23 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
itemCount:widget.orderModel.orderItems.length,
|
|
|
|
|
itemCount:widget.orderDetails.orderItems.length,
|
|
|
|
|
itemBuilder: (context, index){
|
|
|
|
|
return Container(
|
|
|
|
|
child: productTile(productName: widget.orderModel.orderItems[index].product.name.toString(),
|
|
|
|
|
productPrice: widget.orderModel.orderItems[index].product.price.toString(),
|
|
|
|
|
productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(),
|
|
|
|
|
productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews,
|
|
|
|
|
totalPrice: "${(widget.orderModel.orderItems[index].product.price
|
|
|
|
|
* widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}",
|
|
|
|
|
qyt: widget.orderModel.orderItems[index].quantity.toString(),
|
|
|
|
|
isOrderDetails:true,
|
|
|
|
|
imgs: widget.orderModel.orderItems[index].product.images != null &&
|
|
|
|
|
widget.orderModel.orderItems[index].product.images.length != 0
|
|
|
|
|
? widget.orderModel.orderItems[index].product.images [0].src.toString()
|
|
|
|
|
: null,
|
|
|
|
|
status: widget.orderModel.orderStatusId,
|
|
|
|
|
product: widget.orderModel.orderItems[index].product,
|
|
|
|
|
return Container(
|
|
|
|
|
child: productTile(productName: widget.orderDetails.orderItems[index].product.name.toString(),
|
|
|
|
|
productPrice: widget.orderDetails.orderItems[index].product.price.toString(),
|
|
|
|
|
productRate: widget.orderDetails.orderItems[index].product.approvedRatingSum.toDouble(),
|
|
|
|
|
productReviews:widget.orderDetails.orderItems[index].product.approvedTotalReviews,
|
|
|
|
|
totalPrice: "${(widget.orderDetails.orderItems[index].product.price
|
|
|
|
|
* widget.orderDetails.orderItems[index].quantity).toStringAsFixed(2)}",
|
|
|
|
|
qyt: widget.orderDetails.orderItems[index].quantity.toString(),
|
|
|
|
|
isOrderDetails:true,
|
|
|
|
|
imgs: widget.orderDetails.orderItems[index].product.images != null &&
|
|
|
|
|
widget.orderDetails.orderItems[index].product.images.length != 0
|
|
|
|
|
? widget.orderDetails.orderItems[index].product.images [0].src.toString()
|
|
|
|
|
: null,
|
|
|
|
|
status: widget.orderDetails.orderStatusId,
|
|
|
|
|
product: widget.orderDetails.orderItems[index].product,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
@ -383,7 +387,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderSubtotalExclTax.toString(),
|
|
|
|
|
widget.orderDetails.orderSubtotalExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
@ -421,7 +425,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderShippingExclTax.toString(),
|
|
|
|
|
widget.orderDetails.orderShippingExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
@ -459,7 +463,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderTax.toString(),
|
|
|
|
|
widget.orderDetails.orderTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
@ -510,58 +514,58 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
widget.orderModel.orderStatusId == 10
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
model.makeOrder();
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
onTap: () {
|
|
|
|
|
model.makeOrder();
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(top: 20.0),
|
|
|
|
|
height: 50.0,
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 130.0, right: 130.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 4.0),
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0)),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).payOnline,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
height: 50.0,
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 130.0, right: 130.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 4.0),
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0)),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).payOnline,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
// getCancelOrder(canCancel, canRefund),
|
|
|
|
|
isCancel
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
presentConfirmDialog(model,
|
|
|
|
|
widget.orderModel.id); //(widget.orderModel.id));
|
|
|
|
|
onTap: () {
|
|
|
|
|
presentConfirmDialog(model,
|
|
|
|
|
widget.orderModel.id); //(widget.orderModel.id));
|
|
|
|
|
//
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
|
|
|
|
|
height: 50.0,
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).cancelOrder,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.red[900],
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
height: 50.0,
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).cancelOrder,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.red[900],
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -591,17 +595,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCancelOrder(dataIsCancel) {
|
|
|
|
|
if (widget.orderModel.canCancel && widget.orderModel.canRefund) {
|
|
|
|
|
if (widget.orderDetails.canCancel && widget.orderDetails.canRefund) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
} else if (widget.orderModel.canCancel) {
|
|
|
|
|
} else if (widget.orderDetails.canCancel) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
} else if (widget.orderModel.canRefund) {
|
|
|
|
|
} else if (widget.orderDetails.canRefund) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = false;
|
|
|
|
|
isRefund = true;
|
|
|
|
|
@ -630,7 +634,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => OrderPage(
|
|
|
|
|
customerID: widget.orderModel.customerId.toString())),
|
|
|
|
|
customerID: widget.orderDetails.customerId.toString())),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
@ -639,7 +643,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
getCanceledOrder(order) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) {
|
|
|
|
|
if (widget.orderDetails.canCancel && widget.orderDetails.canRefund == false) {
|
|
|
|
|
// getCanceledOrder(order);
|
|
|
|
|
// AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
|
|
|
// Navigator.push(context,
|
|
|
|
|
@ -647,4 +651,4 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|