|
|
|
|
@ -72,8 +72,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
onModelReady: (model) {
|
|
|
|
|
model.getOrderDetails(widget.orderModel.id).then((value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
isActiveDelivery = (value.orderStatusId == 995 &&
|
|
|
|
|
(value.driverID != null && value.driverID.isNotEmpty));
|
|
|
|
|
isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
@ -111,39 +110,35 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 15.0, right: 10.0),
|
|
|
|
|
padding: EdgeInsets.only(left: 11.0, right: 11.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border.all(
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
|
style: BorderStyle.solid,
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
color: getStatusBackgroundColor(),
|
|
|
|
|
borderRadius: BorderRadius.circular(30.0)),
|
|
|
|
|
child: model.orderListModel[0].orderStatusId == 30 ||
|
|
|
|
|
model.orderListModel[0].orderStatusId == 997 ||
|
|
|
|
|
model.orderListModel[0].orderStatusId == 994
|
|
|
|
|
borderRadius: BorderRadius.circular(30.0)),
|
|
|
|
|
child: model.orderListModel[0].orderStatusId == 30 || model.orderListModel[0].orderStatusId == 997 || model.orderListModel[0].orderStatusId == 994
|
|
|
|
|
// deliveredOrderList[index].orderStatusId == 30
|
|
|
|
|
? Text(
|
|
|
|
|
? Text(
|
|
|
|
|
// deliveredOrderList[0].orderStatus.toString().substring(12),
|
|
|
|
|
TranslationBase.of(context).deliveredOrder,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Text(
|
|
|
|
|
languageID == "ar"
|
|
|
|
|
? model.orderListModel[0].orderStatusn.toString()
|
|
|
|
|
: model.orderListModel[0].orderStatus.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
TranslationBase.of(context).deliveredOrder,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Text(
|
|
|
|
|
languageID == "ar" ? model.orderListModel[0].orderStatusn.toString() : model.orderListModel[0].orderStatus.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
// Text(
|
|
|
|
|
// languageID == "ar"
|
|
|
|
|
// ? model.orderListModel[0].orderStatusn
|
|
|
|
|
@ -155,64 +150,50 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 10.0, top: 13.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
"${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
"${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
model.orderListModel[0].shippingAddress.address1
|
|
|
|
|
.toString()
|
|
|
|
|
,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
model.orderListModel[0].shippingAddress.address1.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.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(
|
|
|
|
|
model.orderListModel[0].shippingAddress.address2
|
|
|
|
|
.toString()
|
|
|
|
|
+
|
|
|
|
|
' ' +
|
|
|
|
|
model.orderListModel[0].shippingAddress
|
|
|
|
|
.country
|
|
|
|
|
.toString() +
|
|
|
|
|
' ' +
|
|
|
|
|
model.orderListModel[0].shippingAddress
|
|
|
|
|
.zipPostalCode
|
|
|
|
|
.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
model.orderListModel[0].shippingAddress.address2.toString() +
|
|
|
|
|
' ' +
|
|
|
|
|
model.orderListModel[0].shippingAddress.country.toString() +
|
|
|
|
|
' ' +
|
|
|
|
|
model.orderListModel[0].shippingAddress.zipPostalCode.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
@ -227,9 +208,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
model.orderListModel[0].shippingAddress
|
|
|
|
|
.phoneNumber
|
|
|
|
|
.toString(),
|
|
|
|
|
model.orderListModel[0].shippingAddress.phoneNumber.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
),
|
|
|
|
|
@ -267,9 +246,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: flutterImage.Image.asset(
|
|
|
|
|
model.orderListModel[0]
|
|
|
|
|
.shippingRateComputationMethodSystemName !=
|
|
|
|
|
"Shipping.Aramex"
|
|
|
|
|
model.orderListModel[0].shippingRateComputationMethodSystemName != "Shipping.Aramex"
|
|
|
|
|
? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
|
|
|
|
|
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
@ -320,8 +297,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
model.orderListModel[0].paymentName
|
|
|
|
|
.toString(),
|
|
|
|
|
model.orderListModel[0].paymentName.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
@ -368,9 +344,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
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: 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,
|
|
|
|
|
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: model.orderListModel[0].orderStatusId,
|
|
|
|
|
product: model.orderListModel[0].orderItems[index].product,
|
|
|
|
|
),
|
|
|
|
|
@ -421,8 +397,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
model.orderListModel[0].orderSubtotalExclTax
|
|
|
|
|
.toString(),
|
|
|
|
|
model.orderListModel[0].orderSubtotalExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
@ -460,8 +435,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
model.orderListModel[0].orderShippingExclTax
|
|
|
|
|
.toString(),
|
|
|
|
|
model.orderListModel[0].orderShippingExclTax.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 13.0,
|
|
|
|
|
),
|
|
|
|
|
@ -555,23 +529,16 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
print(model.orderListModel.toString());
|
|
|
|
|
print("calc = ${5.9 * 3}");
|
|
|
|
|
// TODO MOSA
|
|
|
|
|
openPayment(
|
|
|
|
|
model.orderListModel[0], model.user);
|
|
|
|
|
openPayment(model.orderListModel[0], model.user);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
// margin: EdgeInsets.only(top: 20.0),
|
|
|
|
|
padding: EdgeInsets.only(left: 10.0, right: 10.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)),
|
|
|
|
|
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,
|
|
|
|
|
@ -589,8 +556,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
isCancel
|
|
|
|
|
? InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
presentConfirmDialog(
|
|
|
|
|
model, widget.orderModel.id);
|
|
|
|
|
presentConfirmDialog(model, widget.orderModel.id);
|
|
|
|
|
// model.orderListModel[0].id//(widget.orderModel.id));
|
|
|
|
|
//
|
|
|
|
|
},
|
|
|
|
|
@ -601,10 +567,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).cancelOrder,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.red[900],
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
decoration: TextDecoration.underline),
|
|
|
|
|
style: TextStyle(color: Colors.red[900], fontWeight: FontWeight.bold, decoration: TextDecoration.underline),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -623,12 +586,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.trackDeliveryDriver,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.green[900],
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
decoration: TextDecoration.none),
|
|
|
|
|
TranslationBase.of(context).trackDeliveryDriver,
|
|
|
|
|
style: TextStyle(color: Colors.green[900], fontWeight: FontWeight.normal, decoration: TextDecoration.none),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -646,20 +605,13 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
Color getStatusBackgroundColor() {
|
|
|
|
|
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)
|
|
|
|
|
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 == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCancelOrder(dataIsCancel) {
|
|
|
|
|
@ -693,8 +645,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
confirmMessage: TranslationBase.of(context).confirmCancellation,
|
|
|
|
|
okText: TranslationBase.of(context).confirm,
|
|
|
|
|
cancelText: TranslationBase.of(context).cancel_nocaps,
|
|
|
|
|
okFunction: () =>
|
|
|
|
|
cancelFunction.getCanceledOrder(id, context).then((value) {
|
|
|
|
|
okFunction: () => cancelFunction.getCanceledOrder(id, context).then((value) {
|
|
|
|
|
print(":D");
|
|
|
|
|
print(value);
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
@ -730,20 +681,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
OrderDetailModel order,
|
|
|
|
|
AuthenticatedUser authenticatedUser,
|
|
|
|
|
) {
|
|
|
|
|
browser = new MyInAppBrowser(
|
|
|
|
|
onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
|
|
|
|
|
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
|
|
|
|
|
|
|
|
|
|
browser.openPharmacyPaymentBrowser(
|
|
|
|
|
order,
|
|
|
|
|
order.orderTotal,
|
|
|
|
|
'ePharmacy Order',
|
|
|
|
|
order.id,
|
|
|
|
|
order.billingAddress.email,
|
|
|
|
|
order.customValuesXml,
|
|
|
|
|
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}",
|
|
|
|
|
authenticatedUser.patientID,
|
|
|
|
|
authenticatedUser,
|
|
|
|
|
browser);
|
|
|
|
|
browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml,
|
|
|
|
|
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onBrowserLoadStart(String url) {
|
|
|
|
|
@ -770,14 +711,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
|
|
|
|
|
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
|
|
|
|
|
print("onBrowserExit Called!!!!");
|
|
|
|
|
if (isPaymentMade) {
|
|
|
|
|
AppToast.showSuccessToast(
|
|
|
|
|
message: "شكراً\nPayment status for your order is Paid");
|
|
|
|
|
AppToast.showSuccessToast(message: "شكراً\nPayment status for your order is Paid");
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(
|
|
|
|
|
message:
|
|
|
|
|
"Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
|
|
|
|
|
AppToast.showErrorToast(message: "Transaction Failed!\Your transaction is field to some reason please try again or contact to the administration");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|