make some updates in firebase version and update gradle, finish review order

merge-requests/206/head
mosazaid 4 years ago
parent 4a84483698
commit 359eba2da0

@ -72,9 +72,17 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.google.firebase:firebase-messaging:20.3.0"
/* implementation ("com.google.firebase:firebase-messaging:21.0.0", {
// protobuf-lite that firebase-config and Tink depends on.
exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
// exclude group: 'com.google.protobuf',module: 'protobuf-lite'
})
implementation ('com.google.firebase:firebase-inappmessaging-display:19.1.2',{
// protobuf-lite that firebase-config and Tink depends on.
exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
// exclude group: 'com.google.protobuf',module: 'protobuf-lite'
})*/
implementation 'pub.devrel:easypermissions:0.4.0'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
implementation 'com.google.guava:guava:27.0.1-android'
// Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar'])

@ -8,7 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.gms:google-services:4.3.4'
}
}

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

@ -410,6 +410,7 @@ const GET_PATIENT_ALL_PRES_ORD =
'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const PATIENT_ER_INSERT_PRES_ORDER =
'Services/Patients.svc/REST/PatientER_InsertPresOrder';
const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews';
// External API
const ADD_ADDRESS_INFO =

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
@ -12,21 +11,20 @@ import '../../../locator.dart';
import '../base_view_model.dart';
class OrderModelViewModel extends BaseViewModel {
OrderService _orderService = locator<OrderService>();
List<OrderModel> get order => _orderService.orderList;
OrderDetailsService _orderDetailsService = locator<OrderDetailsService>();
List<OrderModel> get orderDetails => _orderDetailsService.orderDetails;
CancelOrderService _cancelOrderService = locator<CancelOrderService>();
List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList;
List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList;
Future getOrder(customerId, pageID) async {
print("this is customer id"+ customerId);
print("this is customer id" + customerId);
setState(ViewState.Busy);
await _orderService.getOrder(customerId, pageID);
if (_orderService.hasError) {
@ -36,7 +34,6 @@ class OrderModelViewModel extends BaseViewModel {
//order = _orderService.orderList;
setState(ViewState.Idle);
}
}
Future getOrderDetails(orderId) async {
@ -52,7 +49,7 @@ class OrderModelViewModel extends BaseViewModel {
Future getProductReview() async {
setState(ViewState.Busy);
await _orderService.getProductReview();
// await _orderService.getProductReview();
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
@ -63,7 +60,7 @@ class OrderModelViewModel extends BaseViewModel {
}
Future getCanceledOrder(order, context) async {
print("this is order id"+ order);
print("this is order id" + order);
setState(ViewState.Busy);
dynamic res;
await _cancelOrderService.getCanceledOrder(order).then((value) {
@ -71,14 +68,13 @@ class OrderModelViewModel extends BaseViewModel {
print(value['success']['SuccessEndUserMsg']);
AppToast.showSuccessToast(message: "Request Sent Successfully");
// Navigator.pop(context);
});
if (_cancelOrderService.hasError) {
error = _cancelOrderService.error;
setState(ViewState.Error);
AppToast.showErrorToast(message: error);
} else {
setState(ViewState.Idle);
setState(ViewState.Idle);
// AppToast.showSuccessToast(message: "Request Sent Successfully");
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => OrderPage()));
@ -86,7 +82,19 @@ class OrderModelViewModel extends BaseViewModel {
}
return res;
}
}
Future makeReview(Product product, double rating, String reviewText) async {
setState(ViewState.Busy);
await _orderDetailsService.makeReview(product, rating, reviewText);
if (_orderDetailsService.hasError) {
error = _orderDetailsService.error;
setState(ViewState.Error);
AppToast.showErrorToast(message: error);
} else {
setState(ViewState.Idle);
AppToast.showSuccessToast(
message: "Your review has been Submitted successfully");
}
}
}

@ -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()));
}
}
}

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
@ -8,145 +7,133 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
class ProductReviewPage extends StatefulWidget {
final Product product;
ProductReviewPage(this.product);
OrderModel orderModel;
ProductReviewPage({
@required this.orderModel
});
@override
_ProductReviewPageState createState() => _ProductReviewPageState();
}
class _ProductReviewPageState extends State<ProductReviewPage> {
String orderId ="3516";
var pharmacyUser ="";
var product ="";
var CustomerId ="";
String submitTxt ="";
var doctorRating= "";
var reviewObj = {};
AppSharedPreferences sharedPref = AppSharedPreferences();
double currentRating = 0;
String reviewText = "";
TextEditingController _reviewController = new TextEditingController();
bool finishReview = false;
@override
Widget build(BuildContext context) {
double ratingValue = double.parse("${widget.product.approvedRatingSum}");
return BaseView<OrderModelViewModel>(
onModelReady: (model)=>model.getOrderDetails(widget.orderModel.id),
builder: (_,model, wi )=> AppScaffold(
builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).writeReview,
isShowAppBar: true,
isPharmacy:true ,
isPharmacy: true,
body: Container(
color: Colors.white,
child: SingleChildScrollView(
child: !finishReview ? SingleChildScrollView(
child: Column(
children: <Widget> [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount:widget.orderModel.orderItems.length,
itemBuilder: (context, index){
return Container(
margin: EdgeInsets.only(top :15.0, bottom: 15.0),
child: Row(
children:[
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
margin: EdgeInsets.only(left: 10),
child: SvgPicture.asset(
// widget.orderModel.orderItems[index].product.images[index].src.toString(),
'assets/images/al-habib_onlne_pharmacy_bg.png',
fit: BoxFit.cover,
width: 80,
height: 80,
),
),
]
),
],
),
Column(
children: <Widget>[
Row(
children: <Widget>[
Text(widget.orderModel.orderItems[index].product.name.toString(),
style: TextStyle(fontSize: 16.0,
),
children: <Widget>[
Container(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
widget.product.images != null
? flutterImage.Image.network(
widget.product.images[0].src,
fit: BoxFit.cover,
height: 80,
)
: flutterImage.Image.asset(
"assets/images/no_image.png",
fit: BoxFit.cover,
height: 80,
),
Expanded(
child: Container(
child: Column(
children: [
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.product.name,
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.normal),
),
],
),
),
Row(
children: [
Container(
margin: EdgeInsets.only(left: 5),
child: Text(widget.orderModel.orderItems[index].product.price.toString(),
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text(TranslationBase.of(context).sar,
style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
),
),
),
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text:
'${widget.product.price} ${TranslationBase.of(context).sar}',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
],
),
),
Row(
children: [
Container(
margin: EdgeInsets.all(5),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: 3,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
),
Container(
child: Text(widget.orderModel.orderItems[index].product.approvedRatingSum.toString(),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: ratingValue,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
Container(
margin: EdgeInsets.only(left: 5),
child: Text("(" + widget.orderModel.orderItems[index].product.approvedTotalReviews.toString()
+ ' ' + TranslationBase.of(context).review +")",
style: TextStyle(fontSize: 12.0,
),
SizedBox(
width: 20,
),
Container(
child: Align(
child: RichText(
text: TextSpan(
text:
'(${widget.product.approvedTotalReviews} reviews)',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey,
fontSize: 13),
),
),
),
],
),
],
),
]
),
],
),
],
),
);
}
),
]),
),
),
]),
),
Divider(
color: Colors.grey[350],
height: 20,
@ -155,15 +142,13 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
endIndent: 0,
),
Container(
margin: EdgeInsets.only( top: 12.0),
margin: EdgeInsets.only(top: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
RatingBar(
// initialRating:
// this.doctor.actualDoctorRate.toDouble(),
size: 40.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
@ -171,51 +156,79 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
onRatingChanged: (rating) {
currentRating = rating;
},
),
],
),
),
Container(
padding: EdgeInsets.fromLTRB(8.0, 20.0, 8.0,20.0),
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Column(
children:<Widget> [
TextFormField (
children: <Widget>[
TextFormField(
controller: _reviewController,
maxLines: 6,
minLines: 4,
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(vertical: 60.0),
border: InputBorder.none,
hintText: 'Tell us more about product!',
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide: BorderSide(width: 1, color: Colors.grey[400]),
borderSide:
BorderSide(width: 1, color: Colors.grey[400]),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
borderSide: BorderSide(color: Colors.grey[400], width: 1),
borderRadius:
BorderRadius.all(Radius.circular(5.0)),
borderSide:
BorderSide(color: Colors.grey[400], width: 1),
),
),
onChanged: (value) {
setState(() {
reviewText = value;
});
},
textAlign: TextAlign.start,
textAlignVertical: TextAlignVertical.top,
),
],
),
),
InkWell(
onTap: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => ));
},
onTap: reviewText != null && reviewText != ""
? () {
model
.makeReview(
widget.product, ratingValue, reviewText)
.then((value) {
setState(() {
finishReview = true;
});
});
}
: null,
child: Container(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
height: 50.0,
width: 400.0,
color: Colors.transparent,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.yellow[700],
color: _reviewController.value.text != null &&
_reviewController.value.text != ""
? Colors.yellow[700]
: Color(0xFFf5d69c),
style: BorderStyle.solid,
width: 1.0
),
color: Colors.yellow[700],
borderRadius: BorderRadius.circular(5.0)
),
width: 1.0),
color: _reviewController.value.text != null &&
_reviewController.value.text != ""
? Colors.yellow[700]
: Color(0xFFf5d69c),
borderRadius: BorderRadius.circular(5.0)),
child: Center(
child: Text(
TranslationBase.of(context).shareReview,
@ -231,85 +244,89 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
),
],
),
),
),),
) : getReviewedProduct(),
),
),
);
}
//new screen is showing after submitting the review
Widget getReviewedProduct(){
Widget getReviewedProduct() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children:<Widget> [
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/check_icon.svg',
width: 28,
height: 28,),
height: 28,
),
Container(
margin: EdgeInsets.only(left: 10.0),
child: Text(TranslationBase.of(context).reviewSuccessful,
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold,
margin: EdgeInsets.symmetric(horizontal: 8),
child: Text(
TranslationBase.of(context).reviewSuccessful,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
Container(
margin: EdgeInsets.only(top:5.0, bottom: 20.0 ),
child: Text(TranslationBase.of(context).reviewShared,
style: TextStyle(fontSize: 15.0,
margin: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
child: Text(
TranslationBase.of(context).reviewShared,
style: TextStyle(
fontSize: 15.0,
),
),
),
Container(
margin: EdgeInsets.only(bottom: 30.0, top: 30.0 ),
margin: EdgeInsets.only(bottom: 30.0, top: 30.0),
child: SvgPicture.asset(
'assets/images/pharmacy/success_review_icon.svg',
width: 100,
height: 100,),
height: 100,
),
),
Container(
margin: EdgeInsets.only(left: 20.0, right: 20.0),
margin: EdgeInsets.symmetric(horizontal: 16),
child: Column(
children:<Widget> [
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.start,
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/quote_start.svg',
width: 15,
height: 15,),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children:<Widget> [
Text(TranslationBase.of(context).reviewComment,
style: TextStyle(fontSize: 15.0,
),
height: 15,
),
],
),
Text(
TranslationBase.of(context).reviewComment,
style: TextStyle(
fontSize: 15.0,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children:<Widget> [
children: <Widget>[
SvgPicture.asset(
'assets/images/pharmacy/quote_end.svg',
width: 15,
height: 15,),
height: 15,
),
],
),
],
),
),
Container(
margin: EdgeInsets.only(top: 20.0 ),
margin: EdgeInsets.only(top: 20.0),
child: InkWell(
onTap: () {
Navigator.push(
@ -320,17 +337,16 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
);
},
child: Container(
height: 50.0, color: Colors.transparent,
height: 50.0,
color: Colors.transparent,
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange,
style: BorderStyle.solid,
width: 1.0
),
width: 1.0),
color: Colors.transparent,
borderRadius: BorderRadius.circular(5.0)
),
borderRadius: BorderRadius.circular(5.0)),
child: Center(
child: Text(
TranslationBase.of(context).backMyAccount,
@ -348,23 +364,4 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
);
}
// submit(){
// this.orderId.id = "0";
// this.reviewObj.position = 0;
// this.reviewObj.customerId = this.pharmacyUser.CustomerId;
// this.reviewObj.productId = this.product.id;
// this.reviewObj.storeId = 2;
// this.reviewObj.isApproved = false;
// this.reviewObj.title ='';
// this.reviewObj.reviewText = this.submitTxt;
// this.reviewObj.rating = this.doctorRating;
// this.reviewObj.replyText = null;
// this.reviewObj.helpfulYesTotal = 0;
// this.reviewObj.helpfulNoTotal = 0;
// this.reviewObj.createdOnUtc = new Date().toString();
// this.submitProductReview();
// }
submitProductReview(){
}
}
}

@ -36,4 +36,40 @@ class OrderDetailsService extends BaseService{
super.error = error;
});
}
Future makeReview(Product product, double rating, String reviewText) async {
hasError = false;
super.error = "";
var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
Map<String, dynamic> body = Map();
Map<String, dynamic> reviewBody = Map();
reviewBody["created_on_utc"] = DateTime.now().toString();
reviewBody["customer_id"] = customerId;
reviewBody["helpful_no_total"] = 0;
reviewBody["helpful_yes_total"] = 0;
reviewBody["id"] = 0;
reviewBody["is_approved"] = false;
reviewBody["position"] = 0;
reviewBody["product_id"] = product.id;
reviewBody["rating"] = rating;
reviewBody["reply_text"] = reviewText;
reviewBody["store_id"] = 2;
reviewBody["title"] = "";
body['review'] = reviewBody;
await baseAppClient.post("$PHARMACY_MAKE_REVIEW",
onSuccess: (response, statusCode) async {
/*
"success": {
"SuccessEndUserMsg": "Your request has been completed successfuly.",
"SuccessEndUserMsgN": "تمت العملية بنجاح"
}
*/
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/style.dart';
@ -5,7 +6,7 @@ import 'package:flutter_html/style.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
@ -19,11 +20,11 @@ class productTile extends StatelessWidget {
final bool isOrderDetails;
final String img;
final int status;
final Product product;
productTile({this.productName, this.productPrice, this.productRate,
this.qyt, this.totalPrice, this.productReviews, this.img,
this.isOrderDetails=true, this.status});
this.isOrderDetails=true, this.status, this.product});
@override
@ -40,7 +41,7 @@ class productTile extends StatelessWidget {
children: [
Container(
margin: EdgeInsets.only(left: 10),
child: Image.network(img),
child: flutterImage.Image.network(img),
// fit: BoxFit.cover,
width: 80,
height: 80,
@ -202,7 +203,7 @@ class productTile extends StatelessWidget {
InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => ProductReviewPage()));
MaterialPageRoute(builder: (context) => ProductReviewPage(product)));
},
child: Container(
padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),

@ -45,7 +45,7 @@ dependencies:
url_launcher: ^5.5.0
shared_preferences: ^0.5.8
flutter_flexible_toast: ^0.1.4
firebase_messaging: ^7.0.0
firebase_messaging: ^7.0.3
android_intent: ^0.3.7+7
# Progress bar
progress_hud_v2: ^2.0.0

Loading…
Cancel
Save