Merge branch 'pharmacy-Fatima' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into pharmacy-Fatima

# Conflicts:
#	lib/core/viewModels/pharmacyModule/order_model_view_model.dart
#	lib/pages/pharmacy/order/OrderDetails.dart
#	lib/widgets/pharmacy/product_tile.dart
merge-requests/206/head
Fatimah Alshammari 5 years ago
commit e5bf7acc52

@ -72,9 +72,12 @@ flutter {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 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"
// implementation ('com.google.firebase:firebase-inappmessaging-display:19.1.2',{
// exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
// exclude group: 'com.google.protobuf',module: 'protobuf-lite'
// })
implementation 'pub.devrel:easypermissions:0.4.0' 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' implementation 'com.google.guava:guava:27.0.1-android'
// Dependency on local binaries // Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])

@ -8,7 +8,7 @@ buildscript {
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.1' classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 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 distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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'; 'Services/Patients.svc/REST/PatientER_GetPatientAllPresOrders';
const PATIENT_ER_INSERT_PRES_ORDER = const PATIENT_ER_INSERT_PRES_ORDER =
'Services/Patients.svc/REST/PatientER_InsertPresOrder'; 'Services/Patients.svc/REST/PatientER_InsertPresOrder';
const PHARMACY_MAKE_REVIEW = 'epharmacy/api/insertreviews';
// External API // External API
const ADD_ADDRESS_INFO = const ADD_ADDRESS_INFO =

@ -1,6 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart';
List<OrderModel> orderModelFromJson(String str) => List<OrderModel>.from(json.decode(str).map((x) => OrderModel.fromJson(x))); List<OrderModel> orderModelFromJson(String str) => List<OrderModel>.from(json.decode(str).map((x) => OrderModel.fromJson(x)));
String orderModelToJson(List<OrderModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson()))); String orderModelToJson(List<OrderModel> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
@ -855,7 +857,7 @@ class Product {
dynamic storeIds; dynamic storeIds;
dynamic manufacturerIds; dynamic manufacturerIds;
List<Review> reviews; List<Review> reviews;
List<Image> images; List<PharmacyImageObject> images;
dynamic attributes; dynamic attributes;
dynamic specifications; dynamic specifications;
dynamic associatedProductIds; dynamic associatedProductIds;
@ -968,7 +970,7 @@ class Product {
storeIds: json["store_ids"], storeIds: json["store_ids"],
manufacturerIds: json["manufacturer_ids"], manufacturerIds: json["manufacturer_ids"],
reviews: List<Review>.from(json["reviews"].map((x) => Review.fromJson(x))), reviews: List<Review>.from(json["reviews"].map((x) => Review.fromJson(x))),
images: List<Image>.from(json["images"].map((x) => Image.fromJson(x))), images: List<PharmacyImageObject>.from(json["images"].map((x) => PharmacyImageObject.fromJson(x))),
attributes: json["attributes"], attributes: json["attributes"],
specifications: json["specifications"], specifications: json["specifications"],
associatedProductIds: json["associated_product_ids"], associatedProductIds: json["associated_product_ids"],
@ -1092,38 +1094,6 @@ class Product {
}; };
} }
class Image {
Image({
this.id,
this.position,
this.src,
this.thumb,
this.attachment,
});
dynamic id;
dynamic position;
String src;
String thumb;
String attachment;
factory Image.fromJson(Map<String, dynamic> json) => Image(
id: json["id"],
position: json["position"],
src: json["src"],
thumb: json["thumb"],
attachment: json["attachment"],
);
Map<String, dynamic> toJson() => {
"id": id,
"position": position,
"src": src,
"thumb": thumb,
"attachment": attachment,
};
}
enum ProductType { SIMPLE_PRODUCT } enum ProductType { SIMPLE_PRODUCT }
final productTypeValues = EnumValues({ final productTypeValues = EnumValues({

@ -1,4 +1,3 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
@ -17,14 +16,16 @@ import '../../../locator.dart';
import '../base_view_model.dart'; import '../base_view_model.dart';
class OrderModelViewModel extends BaseViewModel { class OrderModelViewModel extends BaseViewModel {
OrderService _orderService = locator<OrderService>(); OrderService _orderService = locator<OrderService>();
List<OrderModel> get order => _orderService.orderList; List<OrderModel> get order => _orderService.orderList;
OrderDetailsService _orderDetailsService = locator<OrderDetailsService>(); OrderDetailsService _orderDetailsService = locator<OrderDetailsService>();
List<OrderModel> get orderDetails => _orderDetailsService.orderDetails; List<OrderModel> get orderDetails => _orderDetailsService.orderDetails;
CancelOrderService _cancelOrderService = locator<CancelOrderService>(); CancelOrderService _cancelOrderService = locator<CancelOrderService>();
List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList; List<OrderModel> get cancelOrder => _cancelOrderService.cancelOrderList;
@ -39,7 +40,7 @@ class OrderModelViewModel extends BaseViewModel {
Future getOrder(customerId, pageID) async { Future getOrder(customerId, pageID) async {
print("this is customer id"+ customerId); print("this is customer id" + customerId);
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderService.getOrder(customerId, pageID); await _orderService.getOrder(customerId, pageID);
if (_orderService.hasError) { if (_orderService.hasError) {
@ -49,7 +50,6 @@ class OrderModelViewModel extends BaseViewModel {
//order = _orderService.orderList; //order = _orderService.orderList;
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
Future getOrderDetails(orderId) async { Future getOrderDetails(orderId) async {
@ -63,9 +63,20 @@ class OrderModelViewModel extends BaseViewModel {
} }
} }
Future getProductReview() async {
setState(ViewState.Busy);
// await _orderService.getProductReview();
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
//order = _orderService.orderList;
setState(ViewState.Idle);
}
}
Future getCanceledOrder(order, context) async { Future getCanceledOrder(order, context) async {
print("this is order id"+ order); print("this is order id" + order);
setState(ViewState.Busy); setState(ViewState.Busy);
dynamic res; dynamic res;
await _cancelOrderService.getCanceledOrder(order).then((value) { await _cancelOrderService.getCanceledOrder(order).then((value) {
@ -73,7 +84,6 @@ class OrderModelViewModel extends BaseViewModel {
print(value['success']['SuccessEndUserMsg']); print(value['success']['SuccessEndUserMsg']);
AppToast.showSuccessToast(message: "Request Sent Successfully"); AppToast.showSuccessToast(message: "Request Sent Successfully");
// Navigator.pop(context); // Navigator.pop(context);
}); });
if (_cancelOrderService.hasError) { if (_cancelOrderService.hasError) {
error = _cancelOrderService.error; error = _cancelOrderService.error;
@ -88,9 +98,21 @@ class OrderModelViewModel extends BaseViewModel {
} }
return res; 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");
}
}
Future makeOrder() async { Future makeOrder() async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _orderServices.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts); await _orderServices.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts);

@ -1,19 +1,18 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; 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:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.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/uitl/app_shared_preferences.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/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -23,27 +22,29 @@ import 'package:provider/provider.dart';
dynamic languageID; dynamic languageID;
class OrderDetailsPage extends StatefulWidget { class OrderDetailsPage extends StatefulWidget {
var languageID;
OrderModel orderModel; OrderModel orderModel;
OrderDetailsPage({
@required this.orderModel OrderDetailsPage({@required this.orderModel});
});
@override @override
_OrderDetailsPageState createState() => _OrderDetailsPageState(); _OrderDetailsPageState createState() => _OrderDetailsPageState();
} }
class _OrderDetailsPageState extends State<OrderDetailsPage> { class _OrderDetailsPageState extends State<OrderDetailsPage> {
getLanguageID() async { getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE); languageID = await sharedPref.getString(APP_LANGUAGE);
} }
// AppSharedPreferences sharedPref = AppSharedPreferences(); // AppSharedPreferences sharedPref = AppSharedPreferences();
String orderId=""; String orderId = "";
String customerId; String customerId;
List <OrderModel> orderList = [] ; List<OrderModel> orderList = [];
List <OrderModel> cancelledOrderList = [];
List<OrderModel> cancelledOrderList = [];
// String orderId="3516"; // String orderId="3516";
var model; var model;
var isCancel = false; var isCancel = false;
@ -51,11 +52,12 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
var dataIsCancel; var dataIsCancel;
var dataIsRefund; var dataIsRefund;
@override @override
void initState() { void initState() {
getLanguageID(); getLanguageID();
super.initState(); super.initState();
print(widget.orderModel.orderItems.length);
getLanguageID();
print(widget.orderModel.orderItems.length); print(widget.orderModel.orderItems.length);
getCancelOrder(widget.orderModel.id); getCancelOrder(widget.orderModel.id);
// cancelOrderDetail(order) // cancelOrderDetail(order)
@ -64,19 +66,19 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<OrderModelViewModel>( return BaseView<OrderModelViewModel>(
onModelReady:(model) => model.getOrderDetails(widget.orderModel.id), onModelReady: (model) => model.getOrderDetails(widget.orderModel.id),
builder: (_,model, wi )=> AppScaffold( builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).orderDetail, appBarTitle: TranslationBase.of(context).orderDetail,
isShowAppBar: true, isShowAppBar: true,
isPharmacy:true , isPharmacy: true,
body: Container( body: Container(
color: Colors.white, color: Colors.white,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children:<Widget> [ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [ children: <Widget>[
Container( Container(
margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0), margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0),
child: Row( child: Row(
@ -84,16 +86,19 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
SvgPicture.asset( SvgPicture.asset(
'assets/images/pharmacy/shipping_mark_icon.svg', 'assets/images/pharmacy/shipping_mark_icon.svg',
width: 28, width: 28,
height: 28,), height: 28,
Text(TranslationBase.of(context).shippingAddress, ),
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, Text(
TranslationBase.of(context).shippingAddress,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
), ),
), ),
], ],
), ),
), ),
Container( Container(
margin: EdgeInsets.only(top: 15.0, right: 10.0), margin: EdgeInsets.only(top: 15.0, right: 10.0),
padding: EdgeInsets.only(left: 11.0, right: 11.0), padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -103,8 +108,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
width: 5.0, width: 5.0,
), ),
color: getStatusBackgroundColor(), color: getStatusBackgroundColor(),
borderRadius: BorderRadius.circular(30.0) borderRadius: BorderRadius.circular(30.0)),
),
child: Text( child: Text(
// widget.orderModel.orderStatus.toString().substring(12), // widget.orderModel.orderStatus.toString().substring(12),
// languageID == "ar" // languageID == "ar"
@ -124,55 +128,75 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
margin: EdgeInsets.only(left: 10.0, top: 13.0), margin: EdgeInsets.only(left: 10.0, top: 13.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [ children: <Widget>[
Text(widget.orderModel.shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9), Text(
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, widget.orderModel.shippingAddress.firstName
), .toString()
.substring(10) +
' ' +
model.order[0].shippingAddress.lastName
.toString()
.substring(9),
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
), ),
]
), ),
]),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(11.0, 5.0, 1.0, 5.0), margin: EdgeInsets.fromLTRB(11.0, 5.0, 1.0, 5.0),
child: Row( child: Text(
crossAxisAlignment: CrossAxisAlignment.start, widget.orderModel.shippingAddress.address1
children:<Widget> [ .toString()
Text(widget.orderModel.shippingAddress.address1.toString().substring(9), .substring(9),
style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.grey, color: Colors.grey,
), ),
), ),
],
),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children:<Widget> [ children: <Widget>[
Text(widget.orderModel.shippingAddress.address2.toString().substring(9) Text(
+ ' ' + widget.orderModel.shippingAddress.country.toString() widget.orderModel.shippingAddress.address2
+ ' ' + widget.orderModel.shippingAddress.zipPostalCode.toString(), .toString()
style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.bold, .substring(9) +
' ' +
widget.orderModel.shippingAddress.country
.toString() +
' ' +
widget.orderModel.shippingAddress.zipPostalCode
.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
color: Colors.grey, color: Colors.grey,
), ),
), ),
] ]),
),
), ),
Container( Container(
child: Row( child: Row(
children:<Widget> [ children: <Widget>[
Container( Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0), margin: EdgeInsets.fromLTRB(10.0, 5.0, 8.0, 5.0),
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/mobile_number_icon.svg', 'assets/images/pharmacy/mobile_number_icon.svg',
height: 13,), height: 13,
),
), ),
Container( Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0), margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Text(widget.orderModel.shippingAddress.phoneNumber.toString(), child: Text(
style: TextStyle(fontSize: 15.0, widget.orderModel.shippingAddress.phoneNumber
.toString(),
style: TextStyle(
fontSize: 15.0,
), ),
), ),
), ),
@ -187,36 +211,54 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
endIndent: 0, endIndent: 0,
), ),
Row( Row(
children:<Widget> [ children: <Widget>[
Container( Container(
margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0), margin: EdgeInsets.fromLTRB(10.0, 10.0, 5.0, 10.0),
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/shipping_truck_icon.svg', 'assets/images/pharmacy/shipping_truck_icon.svg',
height: 20, height: 20,
width: 20,), width: 20,
),
), ),
Container( Container(
margin: EdgeInsets.all(10.0), margin: EdgeInsets.all(10.0),
child:Text(TranslationBase.of(context).shippedMethod, child: Text(
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, TranslationBase.of(context).shippedMethod,
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
),
), ),
), ),
Container(
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( Container(
child: widget.orderModel.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(
'assets/images/pharmacy/hmg_shipping_logo.svg', 'assets/images/pharmacy_module/payment/hmg_shipping_logo.png',
height: 25, height: 25,
width: 25,), width: 25,
),
) )
: 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(
'assets/images/pharmacy/aramex_shipping_logo.svg', 'assets/images/pharmacy_module/payment/aramex_shipping_logo.png',
height: 25, height: 25,
width: 25,), width: 25,
),
), ),
), ),
], ],
@ -229,25 +271,22 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
endIndent: 0, endIndent: 0,
), ),
Row( Row(
children:<Widget> [ 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,),
),
Container( Container(
margin: EdgeInsets.all(10.0), margin: EdgeInsets.all(10.0),
child: SvgPicture.asset( child: SvgPicture.asset(
'assets/images/pharmacy/credit_card_icon.svg', 'assets/images/pharmacy/credit_card_icon.svg',
height: 20, height: 20,
width: 20,), width: 20,
),
), ),
Container( Container(
margin: EdgeInsets.only(bottom: 10.0, top: 10.0), margin: EdgeInsets.only(bottom: 10.0, top: 10.0),
child:Text(widget.orderModel.paymentName.toString().substring(12), child: Text(
style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, widget.orderModel.paymentName.toString().substring(12),
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
@ -266,8 +305,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(TranslationBase.of(context).orderDetail, Text(
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, TranslationBase.of(context).orderDetail,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
), ),
), ),
], ],
@ -291,10 +333,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
widget.orderModel.orderItems[index].product.images.length != 0 widget.orderModel.orderItems[index].product.images.length != 0
? widget.orderModel.orderItems[index].product.images [0].src.toString() ? widget.orderModel.orderItems[index].product.images [0].src.toString()
: null, : null,
status: widget.orderModel.orderStatusId,), status: widget.orderModel.orderStatusId,
); product: widget.orderModel.orderItems[index].product,
}
), ),
);
}),
Container( Container(
padding: EdgeInsets.only(bottom: 10.0), padding: EdgeInsets.only(bottom: 10.0),
@ -302,8 +345,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(TranslationBase.of(context).orderSummary, Text(
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, TranslationBase.of(context).orderSummary,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
), ),
), ),
], ],
@ -311,10 +357,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [ children: <Widget>[
Container( Container(
padding: EdgeInsets.only(bottom: 10.0), 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( child: Text(
TranslationBase.of(context).subtotal, TranslationBase.of(context).subtotal,
style: TextStyle( style: TextStyle(
@ -329,13 +375,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(right: 5.0), margin: EdgeInsets.only(right: 5.0),
child: Text(TranslationBase.of(context).sar, child: Text(
style: TextStyle(fontSize: 13.0, TranslationBase.of(context).sar,
style: TextStyle(
fontSize: 13.0,
), ),
), ),
), ),
Text(widget.orderModel.orderSubtotalExclTax.toString(), Text(
style: TextStyle(fontSize: 13.0, widget.orderModel.orderSubtotalExclTax.toString(),
style: TextStyle(
fontSize: 13.0,
), ),
), ),
], ],
@ -345,10 +395,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [ children: <Widget>[
Container( Container(
padding: EdgeInsets.only(bottom: 10.0), 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( child: Text(
TranslationBase.of(context).shipping, TranslationBase.of(context).shipping,
style: TextStyle( style: TextStyle(
@ -363,13 +413,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(right: 5.0), margin: EdgeInsets.only(right: 5.0),
child: Text(TranslationBase.of(context).sar, child: Text(
style: TextStyle(fontSize: 13.0, TranslationBase.of(context).sar,
style: TextStyle(
fontSize: 13.0,
), ),
), ),
), ),
Text(widget.orderModel.orderShippingExclTax.toString(), Text(
style: TextStyle(fontSize: 13.0, widget.orderModel.orderShippingExclTax.toString(),
style: TextStyle(
fontSize: 13.0,
), ),
), ),
], ],
@ -379,10 +433,10 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [ children: <Widget>[
Container( Container(
padding: EdgeInsets.only(bottom: 10.0), 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( child: Text(
TranslationBase.of(context).vat, TranslationBase.of(context).vat,
style: TextStyle( style: TextStyle(
@ -397,13 +451,17 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(right: 5.0), margin: EdgeInsets.only(right: 5.0),
child: Text(TranslationBase.of(context).sar, child: Text(
style: TextStyle(fontSize: 13.0, TranslationBase.of(context).sar,
style: TextStyle(
fontSize: 13.0,
), ),
), ),
), ),
Text(model.order[0].orderTax.toString(), Text(
style: TextStyle(fontSize: 13.0, model.order[0].orderTax.toString(),
style: TextStyle(
fontSize: 13.0,
), ),
), ),
], ],
@ -413,13 +471,14 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:<Widget> [ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(top: 5.0,left: 10.0 ), margin: EdgeInsets.only(top: 5.0, left: 10.0),
child: Text( child: Text(
TranslationBase.of(context).total, TranslationBase.of(context).total,
style: TextStyle( style: TextStyle(
fontSize: 15.0,fontWeight: FontWeight.bold, fontSize: 15.0,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
@ -429,13 +488,19 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(right: 5.0), margin: EdgeInsets.only(right: 5.0),
child: Text(TranslationBase.of(context).sar, child: Text(
style: TextStyle(fontSize: 15.0,fontWeight: FontWeight.bold, TranslationBase.of(context).sar,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
), ),
), ),
), ),
Text(widget.orderModel.orderTotal.toString(), Text(
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, widget.orderModel.orderTotal.toString(),
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
), ),
), ),
], ],
@ -443,7 +508,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
], ],
), ),
widget.orderModel.orderStatusId == 10 ? InkWell( widget.orderModel.orderStatusId == 10
? InkWell(
onTap: () { onTap: () {
model.makeOrder(); model.makeOrder();
}, },
@ -457,11 +523,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
border: Border.all( border: Border.all(
color: Colors.green, color: Colors.green,
style: BorderStyle.solid, style: BorderStyle.solid,
width: 4.0 width: 4.0),
),
color: Colors.green, color: Colors.green,
borderRadius: BorderRadius.circular(5.0) borderRadius: BorderRadius.circular(5.0)),
),
child: Center( child: Center(
child: Text( child: Text(
TranslationBase.of(context).payOnline, TranslationBase.of(context).payOnline,
@ -473,11 +537,14 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
), ),
), ),
), ),
) : Container(), )
: Container(),
// getCancelOrder(canCancel, canRefund), // getCancelOrder(canCancel, canRefund),
isCancel ? InkWell( isCancel
? InkWell(
onTap: () { onTap: () {
presentConfirmDialog(model,widget.orderModel.id);//(widget.orderModel.id)); presentConfirmDialog(model,
widget.orderModel.id); //(widget.orderModel.id));
// //
}, },
child: Container( child: Container(
@ -490,12 +557,12 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
style: TextStyle( style: TextStyle(
color: Colors.red[900], color: Colors.red[900],
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
decoration: TextDecoration.underline decoration: TextDecoration.underline),
), ),
), ),
), ),
), )
) : Container(), : Container(),
], ],
), ),
), ),
@ -504,90 +571,80 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
); );
} }
Color getStatusBackgroundColor() { Color getStatusBackgroundColor() {
print(widget.orderModel.orderStatusId); print(widget.orderModel.orderStatusId);
// if(orderStatus == 'delivered') // if(orderStatus == 'delivered')
if(widget.orderModel.orderStatusId == 30 ||widget.orderModel.orderStatusId == 997 if (widget.orderModel.orderStatusId == 30 ||
||widget.orderModel.orderStatusId == 994) widget.orderModel.orderStatusId == 997 ||
widget.orderModel.orderStatusId == 994)
return Colors.blue[700]; return Colors.blue[700];
else if (widget.orderModel.orderStatusId == 20 ||widget.orderModel.orderStatusId == 995 else if (widget.orderModel.orderStatusId == 20 ||
||widget.orderModel.orderStatusId == 998 ||widget.orderModel.orderStatusId == 999) widget.orderModel.orderStatusId == 995 ||
widget.orderModel.orderStatusId == 998 ||
widget.orderModel.orderStatusId == 999)
return Colors.green; return Colors.green;
else if (widget.orderModel.orderStatusId == 10) else if (widget.orderModel.orderStatusId == 10)
return Colors.orange[300]; return Colors.orange[300];
else if (widget.orderModel.orderStatusId == 40 ||widget.orderModel.orderStatusId == 996 else if (widget.orderModel.orderStatusId == 40 ||
||widget.orderModel.orderStatusId == 200) widget.orderModel.orderStatusId == 996 ||
return Colors.red[900]; widget.orderModel.orderStatusId == 200) return Colors.red[900];
} }
getCancelOrder(dataIsCancel) {
getCancelOrder(dataIsCancel){ if (widget.orderModel.canCancel && widget.orderModel.canRefund) {
if(widget.orderModel.canCancel && widget.orderModel.canRefund)
{
setState(() { setState(() {
isCancel = true; isCancel = true;
isRefund = false; isRefund = false;
}); });
} } else if (widget.orderModel.canCancel) {
else if (widget.orderModel.canCancel ){
setState(() { setState(() {
isCancel = true; isCancel = true;
isRefund = false; isRefund = false;
}); });
} else if (widget.orderModel.canRefund) {
}
else if (widget.orderModel.canRefund){
setState(() { setState(() {
isCancel = false; isCancel = false;
isRefund = true; isRefund = true;
}); });
} } else {
else {
setState(() { setState(() {
isCancel = false; isCancel = false;
isRefund = false; isRefund = false;
}); });
} }
} }
// .getCanceledOrder // .getCanceledOrder
presentConfirmDialog(cancelFunction, id){ 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: () => cancelFunction.getCanceledOrder(id, context).then((value){ okFunction: () =>
cancelFunction.getCanceledOrder(id, context).then((value) {
print(":D"); print(":D");
print(value); print(value);
// Navigator.pop(context); // Navigator.pop(context);
Navigator.push(context, Navigator.push(
MaterialPageRoute(builder: (context) => context,
OrderPage(customerID: widget.orderModel.customerId.toString())), MaterialPageRoute(
);}), builder: (context) => OrderPage(
customerID: widget.orderModel.customerId.toString())),
cancelFunction: () => {}
); );
}),
cancelFunction: () => {});
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} }
getCanceledOrder(order){ getCanceledOrder(order) {
Navigator.pop(context); Navigator.pop(context);
if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){ if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) {
// getCanceledOrder(order); // getCanceledOrder(order);
// AppToast.showSuccessToast(message: "Request Sent Successfully"); // AppToast.showSuccessToast(message: "Request Sent Successfully");
// Navigator.push(context, // Navigator.push(context,
// MaterialPageRoute(builder: (context) => OrderPage())); // MaterialPageRoute(builder: (context) => OrderPage()));
} }
} }
} }

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

@ -2,10 +2,11 @@
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:rating_bar/rating_bar.dart'; import 'package:rating_bar/rating_bar.dart';
@ -20,11 +21,11 @@ class productTile extends StatelessWidget {
final String img; final String img;
final String imgs; final String imgs;
final int status; final int status;
final Product product;
productTile({this.productName, this.productPrice, this.productRate, productTile({this.productName, this.productPrice, this.productRate,
this.qyt, this.totalPrice, this.productReviews, this.img, this.qyt, this.totalPrice, this.productReviews, this.img,
this.isOrderDetails=true, this.status, this.imgs}); this.isOrderDetails=true, this.status, this.product ,this.imgs});
@override @override
@ -42,7 +43,7 @@ class productTile extends StatelessWidget {
this.imgs != null && this.imgs.length > 0 this.imgs != null && this.imgs.length > 0
? Container( ? Container(
margin: EdgeInsets.only(left: 10), margin: EdgeInsets.only(left: 10),
child: Image.network(imgs), child: flutterImage.Image.network(imgs),
// fit: BoxFit.cover, // fit: BoxFit.cover,
width: 80, width: 80,
height: 80, height: 80,
@ -213,7 +214,7 @@ class productTile extends StatelessWidget {
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(context,
MaterialPageRoute(builder: (context) => ProductReviewPage())); MaterialPageRoute(builder: (context) => ProductReviewPage(product)));
}, },
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),

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

Loading…
Cancel
Save