|
|
|
@ -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';
|
|
|
|
@ -19,15 +20,15 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dynamic languageID;
|
|
|
|
|
class OrderDetailsPage extends StatefulWidget {
|
|
|
|
|
Orders orderModel;
|
|
|
|
|
OrderModel orderDetails;
|
|
|
|
|
|
|
|
|
|
OrderDetailsPage({@required this.orderModel, this.orderDetails});
|
|
|
|
|
Orders orderModel;
|
|
|
|
|
OrderDetailsPage({@required this.orderModel});
|
|
|
|
|
|
|
|
|
|
// Orders orderModel;
|
|
|
|
|
// OrderModel orderModelDetails;
|
|
|
|
|
// OrderDetailsPage({@required this.orderModel, this.orderModelDetails});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_OrderDetailsPageState createState() => _OrderDetailsPageState();
|
|
|
|
@ -39,9 +40,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
String orderId = "";
|
|
|
|
|
String customerId;
|
|
|
|
|
List<OrderModel> orderList = [];
|
|
|
|
|
List<OrderModel> ordersList = [];
|
|
|
|
|
|
|
|
|
|
List<OrderModel> cancelledOrderList = [];
|
|
|
|
|
|
|
|
|
@ -59,6 +59,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
super.initState();
|
|
|
|
|
// print(widget.orderModel.orderItems.length);
|
|
|
|
|
getCancelOrder(widget.orderModel.id);
|
|
|
|
|
|
|
|
|
|
print("ID is"+widget.orderModel.id);
|
|
|
|
|
// cancelOrderDetail(order)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -110,8 +112,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
borderRadius: BorderRadius.circular(30.0)),
|
|
|
|
|
child: Text(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
? widget.orderModel.orderStatusn.toString():
|
|
|
|
|
widget.orderModel.orderStatus.toString().substring(12) ,
|
|
|
|
|
? model.orderListModel[0].orderStatusn.toString():
|
|
|
|
|
model.orderListModel[0].orderStatus.toString().substring(12) ,
|
|
|
|
|
// TranslationBase.of(context).delivered,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
@ -128,11 +130,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.shippingAddress.firstName
|
|
|
|
|
model.orderListModel[0].shippingAddress.firstName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(10) +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderDetails.shippingAddress.lastName
|
|
|
|
|
model.orderListModel[0].shippingAddress.lastName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -148,7 +150,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.shippingAddress.address1
|
|
|
|
|
|
|
|
|
|
model.orderListModel[0].shippingAddress.address1
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -165,14 +168,14 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.shippingAddress.address2
|
|
|
|
|
model.orderListModel[0].shippingAddress.address2
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9) +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderDetails.shippingAddress.country
|
|
|
|
|
model.orderListModel[0].shippingAddress.country
|
|
|
|
|
.toString() +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderDetails.shippingAddress.zipPostalCode
|
|
|
|
|
model.orderListModel[0].shippingAddress.zipPostalCode
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
@ -195,7 +198,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderDetails.shippingAddress.phoneNumber
|
|
|
|
|
model.orderListModel[0].shippingAddress.phoneNumber
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
@ -234,7 +237,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: flutterImage.Image.asset(
|
|
|
|
|
widget.orderDetails.shippingRateComputationMethodSystemName !=
|
|
|
|
|
model.orderListModel[0].shippingRateComputationMethodSystemName !=
|
|
|
|
|
"Shipping.Aramex"
|
|
|
|
|
? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
|
|
|
|
|
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
|
|
|
@ -286,7 +289,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderDetails.paymentName.toString().substring(12),
|
|
|
|
|
model.orderListModel[0].paymentName.toString().substring(12),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
@ -322,23 +325,23 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
itemCount:widget.orderDetails.orderItems.length,
|
|
|
|
|
itemCount:model.orderListModel[0].orderItems.length,
|
|
|
|
|
itemBuilder: (context, index){
|
|
|
|
|
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(),
|
|
|
|
|
child: productTile(productName: model.orderListModel[0].orderItems[index].product.name.toString(),
|
|
|
|
|
productPrice: model.orderListModel[0].orderItems[index].product.price.toString(),
|
|
|
|
|
productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum.toDouble(),
|
|
|
|
|
productReviews:model.orderListModel[0].orderItems[index].product.approvedTotalReviews,
|
|
|
|
|
totalPrice: "${(model.orderListModel[0].orderItems[index].product.price
|
|
|
|
|
* model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}",
|
|
|
|
|
qyt: model.orderListModel[0].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()
|
|
|
|
|
imgs: model.orderListModel[0].orderItems[index].product.images != null &&
|
|
|
|
|
model.orderListModel[0].orderItems[index].product.images.length != 0
|
|
|
|
|
? model.orderListModel[0].orderItems[index].product.images [0].src.toString()
|
|
|
|
|
: null,
|
|
|
|
|
status: widget.orderDetails.orderStatusId,
|
|
|
|
|
product: widget.orderDetails.orderItems[index].product,
|
|
|
|
|
status: model.orderListModel[0].orderStatusId,
|
|
|
|
|
product: model.orderListModel[0].orderItems[index].product,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
@ -387,7 +390,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.orderSubtotalExclTax.toString(),
|
|
|
|
|
model.orderListModel[0].orderSubtotalExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
@ -425,7 +428,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.orderShippingExclTax.toString(),
|
|
|
|
|
model.orderListModel[0].orderShippingExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
@ -463,7 +466,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderDetails.orderTax.toString(),
|
|
|
|
|
model.orderListModel[0].orderTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
@ -501,7 +504,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderTotal.toString(),
|
|
|
|
|
model.orderListModel[0].orderTotal.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
@ -512,7 +515,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
widget.orderModel.orderStatusId == 10
|
|
|
|
|
model.orderListModel[0].orderStatusId == 10
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
model.makeOrder();
|
|
|
|
@ -548,7 +551,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
presentConfirmDialog(model,
|
|
|
|
|
widget.orderModel.id); //(widget.orderModel.id));
|
|
|
|
|
widget.orderModel.id);
|
|
|
|
|
// model.orderListModel[0].id//(widget.orderModel.id));
|
|
|
|
|
//
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
@ -595,17 +599,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCancelOrder(dataIsCancel) {
|
|
|
|
|
if (widget.orderDetails.canCancel && widget.orderDetails.canRefund) {
|
|
|
|
|
if (widget.orderModel.canCancel && widget.orderModel.canRefund) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
} else if (widget.orderDetails.canCancel) {
|
|
|
|
|
} else if (widget.orderModel.canCancel) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
} else if (widget.orderDetails.canRefund) {
|
|
|
|
|
} else if (widget.orderModel.canRefund) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = false;
|
|
|
|
|
isRefund = true;
|
|
|
|
@ -634,7 +638,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => OrderPage(
|
|
|
|
|
customerID: widget.orderDetails.customerId.toString())),
|
|
|
|
|
// customerID: model.ordersList[0].customerId.toString()
|
|
|
|
|
customerID: widget.orderModel.customerId.toString())),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
@ -643,7 +648,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
getCanceledOrder(order) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if (widget.orderDetails.canCancel && widget.orderDetails.canRefund == false) {
|
|
|
|
|
if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) {
|
|
|
|
|
// getCanceledOrder(order);
|
|
|
|
|
// AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
|
|
|
// Navigator.push(context,
|
|
|
|
@ -651,4 +656,4 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|