|
|
|
@ -1,51 +1,41 @@
|
|
|
|
|
|
|
|
|
|
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';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/src/widgets/image.dart' as flutterImage;
|
|
|
|
|
|
|
|
|
|
class OrderDetailsPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
var languageID ;
|
|
|
|
|
var languageID;
|
|
|
|
|
|
|
|
|
|
OrderModel orderModel;
|
|
|
|
|
OrderDetailsPage({
|
|
|
|
|
@required this.orderModel
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
OrderDetailsPage({@required this.orderModel});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_OrderDetailsPageState createState() => _OrderDetailsPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
|
|
|
|
|
getLanguageID() async {
|
|
|
|
|
return await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AppSharedPreferences sharedPref = AppSharedPreferences();
|
|
|
|
|
String orderId="";
|
|
|
|
|
String orderId = "";
|
|
|
|
|
|
|
|
|
|
String customerId;
|
|
|
|
|
List <OrderModel> orderList = [] ;
|
|
|
|
|
List <OrderModel> cancelledOrderList = [];
|
|
|
|
|
List<OrderModel> orderList = [];
|
|
|
|
|
|
|
|
|
|
List<OrderModel> cancelledOrderList = [];
|
|
|
|
|
|
|
|
|
|
// String orderId="3516";
|
|
|
|
|
var model;
|
|
|
|
|
var isCancel = false;
|
|
|
|
@ -53,11 +43,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
var dataIsCancel;
|
|
|
|
|
var dataIsRefund;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
print(widget.orderModel.orderItems.length);
|
|
|
|
|
print(widget.orderModel.orderItems.length);
|
|
|
|
|
getLanguageID();
|
|
|
|
|
getCancelOrder(widget.orderModel.id);
|
|
|
|
|
// cancelOrderDetail(order)
|
|
|
|
@ -66,115 +55,139 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<OrderModelViewModel>(
|
|
|
|
|
onModelReady:(model) => model.getOrderDetails(widget.orderModel.id),
|
|
|
|
|
builder: (_,model, wi )=> AppScaffold(
|
|
|
|
|
onModelReady: (model) => model.getOrderDetails(widget.orderModel.id),
|
|
|
|
|
builder: (_, model, wi) => AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).orderDetail,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isPharmacy:true ,
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
body: Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/shipping_mark_icon.svg',
|
|
|
|
|
width: 28,
|
|
|
|
|
height: 28,),
|
|
|
|
|
Text(TranslationBase.of(context).shippingAddress,
|
|
|
|
|
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(top: 15.0, right: 10.0),
|
|
|
|
|
padding: EdgeInsets.only(left: 11.0, right: 11.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 5.0,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/shipping_mark_icon.svg',
|
|
|
|
|
width: 28,
|
|
|
|
|
height: 28,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).shippingAddress,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15.0, right: 10.0),
|
|
|
|
|
padding: EdgeInsets.only(left: 11.0, right: 11.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
|
borderRadius: BorderRadius.circular(30.0)
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
|
borderRadius: BorderRadius.circular(30.0)),
|
|
|
|
|
child: Text(
|
|
|
|
|
// widget.orderModel.orderStatus.toString().substring(12),
|
|
|
|
|
widget.languageID == "ar"
|
|
|
|
|
? widget.orderModel.orderStatusn.toString()
|
|
|
|
|
: widget.orderModel.orderStatus.toString().substring(12) ,
|
|
|
|
|
widget.languageID == "ar"
|
|
|
|
|
? widget.orderModel.orderStatusn.toString()
|
|
|
|
|
: widget.orderModel.orderStatus
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(12),
|
|
|
|
|
// TranslationBase.of(context).delivered,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 10.0, top: 13.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
Text(widget.orderModel.shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9),
|
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.shippingAddress.firstName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(10) +
|
|
|
|
|
' ' +
|
|
|
|
|
model.order[0].shippingAddress.lastName
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(11.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: 11.0, fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderModel.shippingAddress.address1
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
Text(widget.orderModel.shippingAddress.address2.toString().substring(9)
|
|
|
|
|
+ ' ' + widget.orderModel.shippingAddress.country.toString()
|
|
|
|
|
+ ' ' + widget.orderModel.shippingAddress.zipPostalCode.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.shippingAddress.address2
|
|
|
|
|
.toString()
|
|
|
|
|
.substring(9) +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderModel.shippingAddress.country
|
|
|
|
|
.toString() +
|
|
|
|
|
' ' +
|
|
|
|
|
widget.orderModel.shippingAddress.zipPostalCode
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/mobile_number_icon.svg',
|
|
|
|
|
height: 13,),
|
|
|
|
|
height: 13,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
|
|
|
child: Text(widget.orderModel.shippingAddress.phoneNumber.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 15.0,
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderModel.shippingAddress.phoneNumber
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -189,38 +202,56 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/shipping_truck_icon.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
width: 20,),
|
|
|
|
|
width: 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(10.0),
|
|
|
|
|
child:Text(TranslationBase.of(context).shippedMethod,
|
|
|
|
|
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).shippedMethod,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: widget.orderModel.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
|
|
|
|
|
? Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/hmg_shipping_logo.svg',
|
|
|
|
|
height: 25,
|
|
|
|
|
width: 25,),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/aramex_shipping_logo.svg',
|
|
|
|
|
height: 25,
|
|
|
|
|
width: 25,),
|
|
|
|
|
child: flutterImage.Image.asset(
|
|
|
|
|
widget.orderModel
|
|
|
|
|
.shippingRateComputationMethodSystemName ==
|
|
|
|
|
"Shipping.FixedOrByWeight"
|
|
|
|
|
? "assets/images/pharmacy_module/payment/hmg_shipping_logo.png"
|
|
|
|
|
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: widget.orderModel
|
|
|
|
|
.shippingRateComputationMethodSystemName ==
|
|
|
|
|
"Shipping.FixedOrByWeight"
|
|
|
|
|
? Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy_module/payment/hmg_shipping_logo.png',
|
|
|
|
|
height: 25,
|
|
|
|
|
width: 25,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy_module/payment/aramex_shipping_logo.png',
|
|
|
|
|
height: 25,
|
|
|
|
|
width: 25,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Divider(
|
|
|
|
@ -231,25 +262,22 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
endIndent: 0,
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 10.0, 1.0, 10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/credit_card_icon.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
width: 20,),
|
|
|
|
|
),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(10.0),
|
|
|
|
|
child: SvgPicture.asset(
|
|
|
|
|
'assets/images/pharmacy/credit_card_icon.svg',
|
|
|
|
|
height: 20,
|
|
|
|
|
width: 20,),
|
|
|
|
|
width: 20,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child:Text(widget.orderModel.paymentName.toString().substring(12),
|
|
|
|
|
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold,
|
|
|
|
|
child: Text(
|
|
|
|
|
widget.orderModel.paymentName.toString().substring(12),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -268,10 +296,13 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(TranslationBase.of(context).orderDetail,
|
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).orderDetail,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -279,21 +310,33 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: ScrollPhysics(),
|
|
|
|
|
itemCount:widget.orderModel.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(),
|
|
|
|
|
img:widget.orderModel.orderItems[index].product.images[0].src.toString(),
|
|
|
|
|
status: widget.orderModel.orderStatusId,),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
itemCount: widget.orderModel.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(),
|
|
|
|
|
img: widget.orderModel.orderItems[index].product
|
|
|
|
|
.images[0].src
|
|
|
|
|
.toString(),
|
|
|
|
|
status: widget.orderModel.orderStatusId,
|
|
|
|
|
product: widget.orderModel.orderItems[index].product,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 10.0),
|
|
|
|
@ -301,19 +344,22 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(TranslationBase.of(context).orderSummary,
|
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
TranslationBase.of(context).orderSummary,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 10.0),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, left: 10.0 ),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, left: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).subtotal,
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -328,13 +374,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(widget.orderModel.orderSubtotalExclTax.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderSubtotalExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -344,10 +394,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 10.0),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, left: 10.0 ),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, left: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).shipping,
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -362,13 +412,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(widget.orderModel.orderShippingExclTax.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderShippingExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -378,10 +432,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(bottom: 10.0),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0,left: 10.0 ),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, left: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).vat,
|
|
|
|
|
style: TextStyle(
|
|
|
|
@ -396,13 +450,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(model.order[0].orderTax.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 13.0,
|
|
|
|
|
Text(
|
|
|
|
|
model.order[0].orderTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -412,13 +470,14 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children:<Widget> [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0,left: 10.0 ),
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, left: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).total,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -428,13 +487,19 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(right: 5.0),
|
|
|
|
|
child: Text(TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(fontSize: 15.0,fontWeight: FontWeight.bold,
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).sar,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(widget.orderModel.orderTotal.toString(),
|
|
|
|
|
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
|
|
|
|
|
Text(
|
|
|
|
|
widget.orderModel.orderTotal.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
@ -442,60 +507,62 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
widget.orderModel.orderStatusId == 10 ? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
widget.orderModel.orderStatusId == 10
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
// Navigator.push(context,
|
|
|
|
|
// MaterialPageRoute(builder: (context) => InAppBrowser()));
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(top: 20.0),
|
|
|
|
|
height: 50.0,
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 150.0, right: 150.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 1.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: 150.0, right: 150.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.green,
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 1.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(),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
// getCancelOrder(canCancel, canRefund),
|
|
|
|
|
isCancel ? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
presentConfirmDialog(model,widget.orderModel.id);//(widget.orderModel.id));
|
|
|
|
|
isCancel
|
|
|
|
|
? InkWell(
|
|
|
|
|
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(),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -504,90 +571,80 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Color getStatusBackgroundColor() {
|
|
|
|
|
print(widget.orderModel.orderStatusId);
|
|
|
|
|
print(widget.orderModel.orderStatusId);
|
|
|
|
|
// if(orderStatus == 'delivered')
|
|
|
|
|
if(widget.orderModel.orderStatusId == 30 ||widget.orderModel.orderStatusId == 997
|
|
|
|
|
||widget.orderModel.orderStatusId == 994)
|
|
|
|
|
if (widget.orderModel.orderStatusId == 30 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 997 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 994)
|
|
|
|
|
return Colors.blue[700];
|
|
|
|
|
else if (widget.orderModel.orderStatusId == 20 ||widget.orderModel.orderStatusId == 995
|
|
|
|
|
||widget.orderModel.orderStatusId == 998 ||widget.orderModel.orderStatusId == 999)
|
|
|
|
|
return Colors.green;
|
|
|
|
|
else if (widget.orderModel.orderStatusId == 10)
|
|
|
|
|
return Colors.orange[300];
|
|
|
|
|
else if (widget.orderModel.orderStatusId == 40 ||widget.orderModel.orderStatusId == 996
|
|
|
|
|
||widget.orderModel.orderStatusId == 200)
|
|
|
|
|
return Colors.red[900];
|
|
|
|
|
else if (widget.orderModel.orderStatusId == 20 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 995 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 998 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 999)
|
|
|
|
|
return Colors.green;
|
|
|
|
|
else if (widget.orderModel.orderStatusId == 10)
|
|
|
|
|
return Colors.orange[300];
|
|
|
|
|
else if (widget.orderModel.orderStatusId == 40 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 996 ||
|
|
|
|
|
widget.orderModel.orderStatusId == 200) return Colors.red[900];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getCancelOrder(dataIsCancel){
|
|
|
|
|
if(widget.orderModel.canCancel && widget.orderModel.canRefund)
|
|
|
|
|
{
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (widget.orderModel.canCancel ){
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (widget.orderModel.canRefund){
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = false;
|
|
|
|
|
isRefund = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = false;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getCancelOrder(dataIsCancel) {
|
|
|
|
|
if (widget.orderModel.canCancel && widget.orderModel.canRefund) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
} else if (widget.orderModel.canCancel) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = true;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
} else if (widget.orderModel.canRefund) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = false;
|
|
|
|
|
isRefund = true;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
isCancel = false;
|
|
|
|
|
isRefund = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// .getCanceledOrder
|
|
|
|
|
presentConfirmDialog(cancelFunction, id){
|
|
|
|
|
presentConfirmDialog(cancelFunction, id) {
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: TranslationBase.of(context).confirmCancellation,
|
|
|
|
|
okText: TranslationBase.of(context).confirm,
|
|
|
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
|
okFunction: () => cancelFunction.getCanceledOrder(id, context).then((value){
|
|
|
|
|
print(":D");
|
|
|
|
|
print(value);
|
|
|
|
|
okFunction: () =>
|
|
|
|
|
cancelFunction.getCanceledOrder(id, context).then((value) {
|
|
|
|
|
print(":D");
|
|
|
|
|
print(value);
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
Navigator.push(context,
|
|
|
|
|
MaterialPageRoute(builder: (context) =>
|
|
|
|
|
OrderPage(customerID: widget.orderModel.customerId.toString())),
|
|
|
|
|
);}),
|
|
|
|
|
|
|
|
|
|
cancelFunction: () => {}
|
|
|
|
|
);
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => OrderPage(
|
|
|
|
|
customerID: widget.orderModel.customerId.toString())),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCanceledOrder(order){
|
|
|
|
|
getCanceledOrder(order) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){
|
|
|
|
|
if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) {
|
|
|
|
|
// getCanceledOrder(order);
|
|
|
|
|
// AppToast.showSuccessToast(message: "Request Sent Successfully");
|
|
|
|
|
// Navigator.push(context,
|
|
|
|
|
// MaterialPageRoute(builder: (context) => OrderPage()));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|