|
|
|
@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
@ -19,11 +20,11 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OrderDetailsPage extends StatefulWidget {
|
|
|
|
class OrderDetailsPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
var languageID ;
|
|
|
|
var languageID ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OrderModel orderModel;
|
|
|
|
OrderModel orderModel;
|
|
|
|
OrderDetailsPage({
|
|
|
|
OrderDetailsPage({
|
|
|
|
@required this.orderModel
|
|
|
|
@required this.orderModel
|
|
|
|
@ -34,10 +35,18 @@ class OrderDetailsPage extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLanguageID() async {
|
|
|
|
|
|
|
|
return await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
String customerId="";
|
|
|
|
String orderId="";
|
|
|
|
String page_id="";
|
|
|
|
|
|
|
|
String orderId="3516";
|
|
|
|
String customerId;
|
|
|
|
|
|
|
|
List <OrderModel> orderList = [] ;
|
|
|
|
|
|
|
|
List <OrderModel> cancelledOrderList = [];
|
|
|
|
|
|
|
|
// String orderId="3516";
|
|
|
|
var model;
|
|
|
|
var model;
|
|
|
|
var isCancel = false;
|
|
|
|
var isCancel = false;
|
|
|
|
var isRefund = false;
|
|
|
|
var isRefund = false;
|
|
|
|
@ -48,10 +57,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
print(widget.orderModel.orderItems.length);
|
|
|
|
getLanguageID();
|
|
|
|
getLanguageID();
|
|
|
|
|
|
|
|
|
|
|
|
getCancelOrder(widget.orderModel.id);
|
|
|
|
getCancelOrder(widget.orderModel.id);
|
|
|
|
// cancelOrderDetail(widget.orderModel.id);
|
|
|
|
// cancelOrderDetail(order)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
@ -98,10 +107,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
borderRadius: BorderRadius.circular(30.0)
|
|
|
|
borderRadius: BorderRadius.circular(30.0)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(widget.orderModel.orderStatus.toString().substring(12),
|
|
|
|
child: Text(
|
|
|
|
// widget.languageID == "ar"
|
|
|
|
// widget.orderModel.orderStatus.toString().substring(12),
|
|
|
|
// ? widget.orderModel.orderStatusn.toString()
|
|
|
|
widget.languageID == "ar"
|
|
|
|
// : widget.orderModel.orderStatus.toString().substring(12) ,
|
|
|
|
? widget.orderModel.orderStatusn.toString()
|
|
|
|
|
|
|
|
: widget.orderModel.orderStatus.toString().substring(12) ,
|
|
|
|
// TranslationBase.of(context).delivered,
|
|
|
|
// TranslationBase.of(context).delivered,
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
@ -117,7 +127,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children:<Widget> [
|
|
|
|
children:<Widget> [
|
|
|
|
Text(model.order[0].shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9),
|
|
|
|
Text(widget.orderModel.shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9),
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -125,12 +135,12 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
|
|
|
|
margin: EdgeInsets.fromLTRB(11.0, 5.0, 1.0, 5.0),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children:<Widget> [
|
|
|
|
children:<Widget> [
|
|
|
|
Text(model.order[0].shippingAddress.address1.toString().substring(9),
|
|
|
|
Text(widget.orderModel.shippingAddress.address1.toString().substring(9),
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(fontSize: 11.0, fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.grey,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -142,8 +152,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children:<Widget> [
|
|
|
|
children:<Widget> [
|
|
|
|
Text(model.order[0].shippingAddress.address2.toString().substring(9),
|
|
|
|
Text(widget.orderModel.shippingAddress.address2.toString().substring(9)
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
+ ' ' + widget.orderModel.shippingAddress.country.toString()
|
|
|
|
|
|
|
|
+ ' ' + widget.orderModel.shippingAddress.zipPostalCode.toString(),
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.bold,
|
|
|
|
color: Colors.grey,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -161,7 +173,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
|
|
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
|
|
child: Text(model.order[0].shippingAddress.phoneNumber.toString(),
|
|
|
|
child: Text(widget.orderModel.shippingAddress.phoneNumber.toString(),
|
|
|
|
style: TextStyle(fontSize: 15.0,
|
|
|
|
style: TextStyle(fontSize: 15.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -193,7 +205,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
child: model.order[0].shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
|
|
|
|
child: widget.orderModel.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
|
|
|
|
? Container(
|
|
|
|
? Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
@ -236,7 +248,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
child:Text(model.order[0].paymentName.toString().substring(12),
|
|
|
|
child:Text(widget.orderModel.paymentName.toString().substring(12),
|
|
|
|
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -274,8 +286,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
productPrice: widget.orderModel.orderItems[index].product.price.toString(),
|
|
|
|
productPrice: widget.orderModel.orderItems[index].product.price.toString(),
|
|
|
|
productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(),
|
|
|
|
productRate: widget.orderModel.orderItems[index].product.approvedRatingSum.toDouble(),
|
|
|
|
productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews,
|
|
|
|
productReviews:widget.orderModel.orderItems[index].product.approvedTotalReviews,
|
|
|
|
totalPrice: widget.orderModel.orderItems[index].priceExclTax.toString(),
|
|
|
|
totalPrice: "${(widget.orderModel.orderItems[index].product.price
|
|
|
|
qyt: widget.orderModel.orderItems[index].quantity.toString(),),
|
|
|
|
* widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}",
|
|
|
|
|
|
|
|
qyt: widget.orderModel.orderItems[index].quantity.toString(),
|
|
|
|
|
|
|
|
img:widget.orderModel.orderItems[index].product.images[0].src.toString(),
|
|
|
|
|
|
|
|
status: widget.orderModel.orderStatusId,),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -318,7 +333,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(model.order[0].orderSubtotalExclTax.toString(),
|
|
|
|
Text(widget.orderModel.orderSubtotalExclTax.toString(),
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -352,7 +367,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(model.order[0].orderShippingExclTax.toString(),
|
|
|
|
Text(widget.orderModel.orderShippingExclTax.toString(),
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -418,7 +433,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(model.order[0].orderTotal.toString(),
|
|
|
|
Text(widget.orderModel.orderTotal.toString(),
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -429,7 +444,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
widget.orderModel.orderStatusId == 10 ? InkWell(
|
|
|
|
widget.orderModel.orderStatusId == 10 ? InkWell(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
// payOnline link
|
|
|
|
// Navigator.push(context,
|
|
|
|
|
|
|
|
// MaterialPageRoute(builder: (context) => InAppBrowser()));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
// margin: EdgeInsets.only(top: 20.0),
|
|
|
|
// margin: EdgeInsets.only(top: 20.0),
|
|
|
|
@ -458,12 +474,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
) : Container(),
|
|
|
|
) : Container(),
|
|
|
|
|
|
|
|
|
|
|
|
// getCancelOrder(canCancel, canRefund),
|
|
|
|
// getCancelOrder(canCancel, canRefund),
|
|
|
|
isCancel ? InkWell(
|
|
|
|
isCancel ? InkWell(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
Navigator.push(context,
|
|
|
|
presentConfirmDialog(model,widget.orderModel.id);//(widget.orderModel.id));
|
|
|
|
MaterialPageRoute(builder: (context) => presentConfirmDialog()));
|
|
|
|
//
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
|
|
|
|
// padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
|
|
|
|
@ -537,37 +552,40 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
presentConfirmDialog(){
|
|
|
|
// .getCanceledOrder
|
|
|
|
|
|
|
|
presentConfirmDialog(cancelFunction, id){
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
confirmMessage: TranslationBase.of(context).confirmCancellation,
|
|
|
|
confirmMessage: TranslationBase.of(context).confirmCancellation,
|
|
|
|
okText: TranslationBase.of(context).confirm,
|
|
|
|
okText: TranslationBase.of(context).confirm,
|
|
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
okFunction: () => {
|
|
|
|
okFunction: () => cancelFunction.getCanceledOrder(id, context).then((value){
|
|
|
|
// cancelOrderDetail(widget.orderModel.id),
|
|
|
|
print(":D");
|
|
|
|
ConfirmDialog.closeAlertDialog(context)
|
|
|
|
print(value);
|
|
|
|
},
|
|
|
|
// Navigator.pop(context);
|
|
|
|
cancelFunction: () => {});
|
|
|
|
Navigator.push(context,
|
|
|
|
|
|
|
|
MaterialPageRoute(builder: (context) =>
|
|
|
|
|
|
|
|
OrderPage(customerID: widget.orderModel.customerId.toString())),
|
|
|
|
|
|
|
|
);}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cancelFunction: () => {}
|
|
|
|
|
|
|
|
);
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// cancelOrderDetail(order){
|
|
|
|
getCanceledOrder(order){
|
|
|
|
// if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){
|
|
|
|
Navigator.pop(context);
|
|
|
|
//// setState(() {
|
|
|
|
if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){
|
|
|
|
// cancelOrderDetail(order);
|
|
|
|
// getCanceledOrder(order);
|
|
|
|
// AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
|
|
// AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
|
|
//// });
|
|
|
|
// Navigator.push(context,
|
|
|
|
//// return OrderPage();
|
|
|
|
// MaterialPageRoute(builder: (context) => OrderPage()));
|
|
|
|
// }
|
|
|
|
|
|
|
|
// else{}
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getLanguageID() async {
|
|
|
|
|
|
|
|
var languageID = await sharedPref.getString(APP_LANGUAGE);
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
widget.languageID = languageID;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|