diff --git a/android/app/build.gradle b/android/app/build.gradle
index 369cb30a..69c137ff 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -72,7 +72,11 @@ 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"
+// 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 'com.google.firebase:firebase-inappmessaging-display:17.2.0'
implementation 'com.google.guava:guava:27.0.1-android'
diff --git a/android/build.gradle b/android/build.gradle
index 8e56476b..433bc8ad 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -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'
}
}
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 5660070d..c935be88 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -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
diff --git a/assets/images/pharmacy/Logo Parmacy-green.png b/assets/images/pharmacy/Logo Parmacy-green.png
new file mode 100644
index 00000000..72862b33
Binary files /dev/null and b/assets/images/pharmacy/Logo Parmacy-green.png differ
diff --git a/assets/images/pharmacy/arrow-left-png.png b/assets/images/pharmacy/arrow-left-png.png
new file mode 100644
index 00000000..18d58c87
Binary files /dev/null and b/assets/images/pharmacy/arrow-left-png.png differ
diff --git a/assets/images/pharmacy/arrow-left.png b/assets/images/pharmacy/arrow-left.png
new file mode 100644
index 00000000..18d58c87
Binary files /dev/null and b/assets/images/pharmacy/arrow-left.png differ
diff --git a/assets/images/pharmacy/arrow-right-png.png b/assets/images/pharmacy/arrow-right-png.png
new file mode 100644
index 00000000..19af7c0b
Binary files /dev/null and b/assets/images/pharmacy/arrow-right-png.png differ
diff --git a/assets/images/pharmacy/arrow.png b/assets/images/pharmacy/arrow.png
new file mode 100644
index 00000000..19af7c0b
Binary files /dev/null and b/assets/images/pharmacy/arrow.png differ
diff --git a/assets/images/pharmacy/arrow_lef.png b/assets/images/pharmacy/arrow_lef.png
new file mode 100644
index 00000000..19af7c0b
Binary files /dev/null and b/assets/images/pharmacy/arrow_lef.png differ
diff --git a/assets/images/pharmacy/arrow_left.svg b/assets/images/pharmacy/arrow_left.svg
new file mode 100644
index 00000000..00fa7556
--- /dev/null
+++ b/assets/images/pharmacy/arrow_left.svg
@@ -0,0 +1,6 @@
+
diff --git a/assets/images/pharmacy/hmg_shipping_greenlogo.svg b/assets/images/pharmacy/hmg_shipping_greenlogo.svg
new file mode 100644
index 00000000..449712a5
--- /dev/null
+++ b/assets/images/pharmacy/hmg_shipping_greenlogo.svg
@@ -0,0 +1,25 @@
+
diff --git a/assets/images/pharmacy/terms.png b/assets/images/pharmacy/terms.png
new file mode 100644
index 00000000..76cfacab
Binary files /dev/null and b/assets/images/pharmacy/terms.png differ
diff --git a/assets/images/pharmacy/user.svg b/assets/images/pharmacy/user.svg
new file mode 100644
index 00000000..8e978105
--- /dev/null
+++ b/assets/images/pharmacy/user.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/pharmacy_module/payment/LogoParmacyGreen.png b/assets/images/pharmacy_module/payment/LogoParmacyGreen.png
new file mode 100644
index 00000000..72862b33
Binary files /dev/null and b/assets/images/pharmacy_module/payment/LogoParmacyGreen.png differ
diff --git a/lib/config/config.dart b/lib/config/config.dart
index 4b591cd8..af925ed1 100644
--- a/lib/config/config.dart
+++ b/lib/config/config.dart
@@ -6,7 +6,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
const MAX_SMALL_SCREEN = 660;
-//const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
//const BASE_PHARMACY_URL = 'http://swd-pharapp-01:7200/api/';
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';
@@ -374,6 +373,7 @@ const EDIT_CUSTOMER_ADDRESS = "epharmacy/api/editcustomeraddress";
const DELETE_CUSTOMER_ADDRESS = "epharmacy/api/deletecustomeraddress";
const GET_ADDRESS = "Customers/";
const GET_Cancel_ORDER = "cancelorder/";
+const WRITE_REVIEW = "Content-Type" + "text/plain; charset=utf-8";
const GET_SHOPPING_CART = "epharmacy/api/shopping_cart_items/";
const GET_SHIPPING_OPTIONS = "epharmacy/api/get_shipping_option/";
const DELETE_SHOPPING_CART = "epharmacy/api/delete_shopping_cart_items/";
@@ -415,6 +415,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';
//Pharmacy wishlist
const GET_WISHLIST = "shopping_cart_items/";
diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart
index c7ac7f74..dea5dd5d 100644
--- a/lib/config/localized_values.dart
+++ b/lib/config/localized_values.dart
@@ -654,10 +654,14 @@ const Map localizedValues = {
"writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"},
"shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"},
"review": {"en": " reviews", "ar": " تقييمات"},
+ "pendingOrder": {"en": " PENDING", "ar": " معلقة"},
"deliveredOrder": {"en": " DELIVERED", "ar": " تم التوصيل"},
+ "processingOrder": {"en": " PROCESSING", "ar": "قيد التنفيذ"},
+ "cancelledOrder": {"en": " CANCELLED", "ar": "ملغي"},
"compare": {"en": " Compare", "ar": "مقارنه"},
- "medicationsRefill": {"en": " Medication Refill", "ar": "اعادة تعبئة الدواء"},
+ "medicationsRefill": {"en": " Medication Refill", "ar": "طلب أعادة صرف"},
"myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"},
+ "quantity": {"en": " QTY ", "ar": "الكمية"},
"backMyAccount": {
"en": "BACK TO MY ACCOUNT ",
"ar": " الرجوع لحسابي الشخصي"
@@ -672,7 +676,7 @@ const Map localizedValues = {
"ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل"
},
"shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"},
- "orderDetail": {"en": "Order Detail", "ar": " تفاصيل الطلب"},
+ "orderDetail": {"en": "Order Details", "ar": " تفاصيل الطلب"},
"orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"},
"subtotal": {"en": "Subtotal", "ar": " المجموع الفرعي"},
"shipping": {"en": "Shipping", "ar": " الشحن"},
@@ -689,6 +693,8 @@ const Map localizedValues = {
"cancelOrder": {"en": "CANCEL ORDER", "ar": "الغاء الطلب "},
"confirmAddress": {"en": "CONFIRM ADDRESS ", "ar": " تأكيد العنوان "},
"confirmLocation": {"en": "CONFIRM LOCATION ", "ar": " تأكيد الموقع "},
+ "conditionsHMG": {"en": "Terms & Conditions ", "ar": "الشروط و الأحكام "},
+ "conditions": {"en": "Terms & Conditions of Lakum", "ar": "شروط و احكام لكم"},
"confirmDeleteMsg": {
"en": "Are you sure! want to delete ",
"ar": "هل انت متأكد تريد الحذف "
@@ -1188,10 +1194,6 @@ const Map localizedValues = {
"ar":"التوفر"
},
- "quantity":{
- "en":"Quantity",
- "ar":"التوفر"
- },
"quantitySize":{
"en":"Quantity",
"ar":"كميه"
diff --git a/lib/core/model/pharmacies/order_model.dart b/lib/core/model/pharmacies/order_model.dart
index a82b8716..027d1f81 100644
--- a/lib/core/model/pharmacies/order_model.dart
+++ b/lib/core/model/pharmacies/order_model.dart
@@ -1,6 +1,8 @@
import 'dart:convert';
+import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyImageObject.dart';
+
List orderModelFromJson(String str) => List.from(json.decode(str).map((x) => OrderModel.fromJson(x)));
String orderModelToJson(List data) => json.encode(List.from(data.map((x) => x.toJson())));
@@ -855,7 +857,7 @@ class Product {
dynamic storeIds;
dynamic manufacturerIds;
List reviews;
- List images;
+ List images;
dynamic attributes;
dynamic specifications;
dynamic associatedProductIds;
@@ -968,7 +970,7 @@ class Product {
storeIds: json["store_ids"],
manufacturerIds: json["manufacturer_ids"],
reviews: List.from(json["reviews"].map((x) => Review.fromJson(x))),
- images: List.from(json["images"].map((x) => Image.fromJson(x))),
+ images: List.from(json["images"].map((x) => PharmacyImageObject.fromJson(x))),
attributes: json["attributes"],
specifications: json["specifications"],
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 json) => Image(
- id: json["id"],
- position: json["position"],
- src: json["src"],
- thumb: json["thumb"],
- attachment: json["attachment"],
- );
-
- Map toJson() => {
- "id": id,
- "position": position,
- "src": src,
- "thumb": thumb,
- "attachment": attachment,
- };
-}
-
enum ProductType { SIMPLE_PRODUCT }
final productTypeValues = EnumValues({
diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart
index 04cbe8e3..b7ddb528 100644
--- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart
+++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart
@@ -1,32 +1,53 @@
-//import 'dart:html';
-
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
+import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart';
+import 'package:diplomaticquarterapp/core/model/pharmacies/LacumAccountInformation.dart';
+import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart';
+import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart';
+import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
+import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
+import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
+import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/orderDetails_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
+import 'package:diplomaticquarterapp/uitl/app_toast.dart';
+import 'package:flutter/material.dart';
import '../../../locator.dart';
import '../base_view_model.dart';
class OrderModelViewModel extends BaseViewModel {
-
OrderService _orderService = locator();
+
List get order => _orderService.orderList;
OrderDetailsService _orderDetailsService = locator();
+
List get orderDetails => _orderDetailsService.orderDetails;
+ CancelOrderService _cancelOrderService = locator();
+ List get cancelOrder => _cancelOrderService.cancelOrderList;
- Future getOrder(id, pageId) async {
+ OrderPreviewService _orderServices = locator();
+ List get addresses => _orderServices.addresses;
+ LacumAccountInformation get lacumInformation =>
+ _orderServices.lacumInformation;
+ ShoppingCartResponse cartResponse = ShoppingCartResponse();
+ PaymentCheckoutData paymentCheckoutData = PaymentCheckoutData();
+ double totalAdditionalShippingCharge = 0;
+
+
+
+ Future getOrder(customerId, pageID) async {
+ print("this is customer id" + customerId);
setState(ViewState.Busy);
- await _orderService.getOrder(id,pageId);
+ await _orderService.getOrder(customerId, pageID);
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
//order = _orderService.orderList;
- print(order.length);
setState(ViewState.Idle);
}
}
@@ -38,23 +59,69 @@ class OrderModelViewModel extends BaseViewModel {
error = _orderDetailsService.error;
setState(ViewState.Error);
} else {
-
+ setState(ViewState.Idle);
}
}
- Future getProductReview(orderId) async {
+ Future getProductReview() async {
setState(ViewState.Busy);
- await _orderService.getProductReview(orderId);
+ // await _orderService.getProductReview();
if (_orderService.hasError) {
error = _orderService.error;
setState(ViewState.Error);
} else {
//order = _orderService.orderList;
- print(order.length);
setState(ViewState.Idle);
}
}
+ Future getCanceledOrder(order, context) async {
+ print("this is order id" + order);
+ setState(ViewState.Busy);
+ dynamic res;
+ await _cancelOrderService.getCanceledOrder(order).then((value) {
+ res = value['success']['SuccessEndUserMsg'];
+ 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);
+// AppToast.showSuccessToast(message: "Request Sent Successfully");
+// Navigator.push(context,
+// MaterialPageRoute(builder: (context) => OrderPage()));
+
+ }
+ 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 {
+ setState(ViewState.Busy);
+ await _orderServices.makeOrder(paymentCheckoutData, cartResponse.shoppingCarts);
+ if (_orderServices.hasError) {
+ error = _orderServices.error;
+ setState(ViewState.Error);
+ } else {
+ setState(ViewState.Idle);
+ }
+ }
-}
\ No newline at end of file
+}
diff --git a/lib/locator.dart b/lib/locator.dart
index 3af8499c..c6ef1b32 100644
--- a/lib/locator.dart
+++ b/lib/locator.dart
@@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/services/pharmacy_services/review_service.d
import 'package:diplomaticquarterapp/services/pharmacy_services/wishList_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/PharmacyAddressesViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
+import 'package:diplomaticquarterapp/services/pharmacy_services/cancelOrder_service.dart';
import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
import 'package:diplomaticquarterapp/uitl/navigation_service.dart';
import 'package:get_it/get_it.dart';
@@ -190,6 +191,7 @@ void setupLocator() {
locator.registerLazySingleton(() => OrderDetailsService());
locator.registerLazySingleton(() => CustomerAddressesService());
locator.registerLazySingleton(() => TermsConditionService());
+ locator.registerLazySingleton(() => CancelOrderService());
/// View Model
locator.registerFactory(() => HospitalViewModel());
diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart
index f46eb08f..576bf2a0 100644
--- a/lib/pages/pharmacy/order/Order.dart
+++ b/lib/pages/pharmacy/order/Order.dart
@@ -1,5 +1,5 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
-import 'package:diplomaticquarterapp/pages/base/base_view.dart';
+import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@@ -10,18 +10,26 @@ import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.da
import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
+import 'package:diplomaticquarterapp/pages/base/base_view.dart';
+dynamic languageID;
class OrderPage extends StatefulWidget {
// orderList({this.customerId, this.pageId});
- var languageID ;
+
+ String customerID;
+
+ OrderPage({@required this.customerID});
+
@override
_OrderPageState createState() => _OrderPageState();
}
class _OrderPageState extends State with SingleTickerProviderStateMixin{
- String customerId="";
- String page_id="";
+
+ String pageID= "1";
+ String customerId = "";
+ String order ="";
List orderList = [] ;
List deliveredOrderList = [] ;
@@ -30,20 +38,25 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
List pendingOrderList = [];
TabController _tabController;
- AppSharedPreferences sharedPref = AppSharedPreferences();
+// AppSharedPreferences sharedPref = AppSharedPreferences();
+ getLanguageID() async {
+ languageID = await sharedPref.getString(APP_LANGUAGE);
+ }
@override
void initState() {
-// WidgetsBinding.instance.addPostFrameCallback((_) => getOrder());
getLanguageID();
super.initState();
+
+
_tabController = new TabController(length: 4, vsync: this,);
}
@override
Widget build(BuildContext context) {
+ print( "customerID" + widget.customerID);
return BaseView(
- onModelReady: (model) => model.getOrder(customerId, page_id),
+ onModelReady: (model) => model.getOrder(widget.customerID, pageID),
builder: (_,model, wi )=> AppScaffold(
appBarTitle:TranslationBase.of(context).order,
baseViewModel: model,
@@ -167,7 +180,9 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:deliveredOrderList[index])));
},
child: SvgPicture.asset(
- 'assets/images/pharmacy/arrow_right.svg',
+ languageID == "ar"
+ ? 'assets/images/pharmacy/arrow_left.svg'
+ :'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
@@ -181,7 +196,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
indent: 0,
endIndent: 0,
),
- Row(
+ Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
@@ -196,7 +211,8 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
color: Colors.blue[700],
borderRadius: BorderRadius.circular(30.0)
),
- child: Text(
+ child: deliveredOrderList[index].orderStatusId == 30
+ ? Text(
// deliveredOrderList[0].orderStatus.toString().substring(12),
TranslationBase.of(context).deliveredOrder,
style: TextStyle(
@@ -204,7 +220,17 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
- ),
+ )
+ : Text(
+ languageID == "ar"
+ ? deliveredOrderList[index].orderStatusn.toString():
+ deliveredOrderList[index].orderStatus.toString(),
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
@@ -367,7 +393,9 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:processingOrderList[index])));
},
child: SvgPicture.asset(
- 'assets/images/pharmacy/arrow_right.svg',
+ languageID == "ar"
+ ? 'assets/images/pharmacy/arrow_left.svg'
+ :'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
@@ -396,14 +424,26 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
color: Colors.green,
borderRadius: BorderRadius.circular(30.0)
),
- child: Text(
- processingOrderList[index].orderStatus.toString().substring(12),
- style: TextStyle(
- color: Colors.white,
- fontSize: 15.0,
- fontWeight: FontWeight.bold,
- ),
- ),
+ child: processingOrderList[index].orderStatusId == 20
+ ? Text(
+// deliveredOrderList[0].orderStatus.toString().substring(12),
+ TranslationBase.of(context).processingOrder,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
+ : Text(
+ languageID == "ar"
+ ? processingOrderList[index].orderStatusn.toString():
+ processingOrderList[index].orderStatus.toString(),
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
@@ -744,7 +784,9 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:pendingOrderList[index])));
},
child: SvgPicture.asset(
- 'assets/images/pharmacy/arrow_right.svg',
+ languageID == "ar"
+ ? 'assets/images/pharmacy/arrow_left.svg'
+ :'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
@@ -773,16 +815,26 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
color: Colors.orange[300],
borderRadius: BorderRadius.circular(30.0)
),
- child: Text(
- widget.languageID == "ar"
- ? pendingOrderList[index].orderStatusn.toString()
- : pendingOrderList[index].orderStatus.toString().substring(12),
- style: TextStyle(
- color: Colors.white,
- fontSize: 15.0,
- fontWeight: FontWeight.bold,
- ),
- ),
+ child: pendingOrderList[index].orderStatusId == 10
+ ? Text(
+// deliveredOrderList[0].orderStatus.toString().substring(12),
+ TranslationBase.of(context).pendingOrder,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
+ : Text(
+ languageID == "ar"
+ ? pendingOrderList[index].orderStatusn.toString():
+ pendingOrderList[index].orderStatus.toString(),
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
),
Container(
margin: EdgeInsets.all(8.0),
@@ -948,7 +1000,9 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
MaterialPageRoute(builder: (context) => OrderDetailsPage(orderModel:cancelledOrderList[index])));
},
child: SvgPicture.asset(
- 'assets/images/pharmacy/arrow_right.svg',
+ languageID == "ar"
+ ? 'assets/images/pharmacy/arrow_left.svg'
+ :'assets/images/pharmacy/arrow_right.svg',
height: 20,
width: 20,),
),
@@ -977,15 +1031,26 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
color: Colors.red[900],
borderRadius: BorderRadius.circular(30.0)
),
- child: Text( widget.languageID == "ar"
- ? cancelledOrderList[index].orderStatusn.toString()
- : cancelledOrderList[index].orderStatus.toString().substring(12),
- style: TextStyle(
- color: Colors.white,
- fontSize: 15.0,
- fontWeight: FontWeight.bold,
- ),
- ),
+ child: cancelledOrderList[index].orderStatusId == 40
+ ? Text(
+// deliveredOrderList[0].orderStatus.toString().substring(12),
+ TranslationBase.of(context).cancelledOrder,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
+ : Text(
+ languageID == "ar"
+ ? cancelledOrderList[index].orderStatusn.toString():
+ cancelledOrderList[index].orderStatus.toString(),
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ )
),
Container(
margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8),
@@ -1073,12 +1138,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix
);
}
- getLanguageID() async {
- var languageID = await sharedPref.getString(APP_LANGUAGE);
- setState(() {
- widget.languageID = languageID;
- });
- }
+
}
diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart
index 94b1aba2..1e4c5bb3 100644
--- a/lib/pages/pharmacy/order/OrderDetails.dart
+++ b/lib/pages/pharmacy/order/OrderDetails.dart
@@ -1,168 +1,200 @@
-
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/data_display/text.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: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:flutter/src/widgets/image.dart' as flutterImage;
+
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
+import 'package:provider/provider.dart';
+dynamic languageID;
class OrderDetailsPage extends StatefulWidget {
-
- var languageID ;
-
-
OrderModel orderModel;
- OrderDetailsPage({
- @required this.orderModel
-});
+
+ OrderDetailsPage({@required this.orderModel});
@override
_OrderDetailsPageState createState() => _OrderDetailsPageState();
}
class _OrderDetailsPageState extends State {
- AppSharedPreferences sharedPref = AppSharedPreferences();
- String customerId="";
- String page_id="";
- String orderId="3516";
+ getLanguageID() async {
+ languageID = await sharedPref.getString(APP_LANGUAGE);
+ }
+
+// AppSharedPreferences sharedPref = AppSharedPreferences();
+ String orderId = "";
+ String customerId;
+ List orderList = [];
+
+ List cancelledOrderList = [];
+
+// String orderId="3516";
var model;
var isCancel = false;
var isRefund = false;
var dataIsCancel;
var dataIsRefund;
-
@override
void initState() {
- super.initState();
getLanguageID();
-
+ super.initState();
+ print(widget.orderModel.orderItems.length);
getCancelOrder(widget.orderModel.id);
-// cancelOrderDetail(widget.orderModel.id);
+// cancelOrderDetail(order)
}
@override
Widget build(BuildContext context) {
return BaseView(
- 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: [
+ children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0),
- child: Row(
- children: [
- 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: [
+ Container(
+ margin: EdgeInsets.fromLTRB(10.0, 15.0, 1.0, 5.0),
+ child: Row(
+ children: [
+ 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(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: BorderStyle.solid,
+ width: 5.0,
),
+ color: getStatusBackgroundColor(),
+ borderRadius: BorderRadius.circular(30.0)),
+ child: Text(
+ 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,
),
),
+ ),
],
),
Container(
margin: EdgeInsets.only(left: 10.0, top: 13.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(model.order[0].shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9),
- style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
- ),
- ),
- ]
- ),
+ children: [
+ Text(
+ widget.orderModel.shippingAddress.firstName
+ .toString()
+ .substring(10) +
+ ' ' +
+ widget.orderModel.shippingAddress.lastName
+ .toString()
+ .substring(9),
+ style: TextStyle(
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ]),
),
Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(model.order[0].shippingAddress.address1.toString().substring(9),
- style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
- color: Colors.grey,
- ),
+ children: [
+ Text(
+ widget.orderModel.shippingAddress.address1
+ .toString()
+ .substring(9),
+ style: TextStyle(
+ fontSize: 10.0,
+ fontWeight: FontWeight.bold,
+ color: Colors.grey,
),
- ],
+ ),]
),
),
Container(
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(model.order[0].shippingAddress.address2.toString().substring(9),
- style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
- color: Colors.grey,
- ),
- ),
- ]
- ),
+ children: [
+ 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: [
+ children: [
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(model.order[0].shippingAddress.phoneNumber.toString(),
- style: TextStyle(fontSize: 15.0,
+ child: Text(
+ widget.orderModel.shippingAddress.phoneNumber
+ .toString(),
+ style: TextStyle(
+ fontSize: 15.0,
),
),
),
@@ -177,38 +209,57 @@ class _OrderDetailsPageState extends State {
endIndent: 0,
),
Row(
- children: [
+ children: [
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: model.order[0].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.Aramex"
+ ? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
+ : "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
+ fit: BoxFit.contain,
+// height: 100,
+ width: 100,
),
),
+// 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(
@@ -219,25 +270,22 @@ class _OrderDetailsPageState extends State {
endIndent: 0,
),
Row(
- children: [
- 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: [
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(model.order[0].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,
),
),
),
@@ -256,10 +304,13 @@ class _OrderDetailsPageState extends State {
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,
),
+ ),
],
),
),
@@ -274,11 +325,18 @@ class _OrderDetailsPageState extends State {
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].priceExclTax.toString(),
- qyt: widget.orderModel.orderItems[index].quantity.toString(),),
- );
- }
- ),
+ totalPrice: "${(widget.orderModel.orderItems[index].product.price
+ * widget.orderModel.orderItems[index].quantity).toStringAsFixed(2)}",
+ qyt: widget.orderModel.orderItems[index].quantity.toString(),
+ imgs: widget.orderModel.orderItems[index].product.images != null &&
+ widget.orderModel.orderItems[index].product.images.length != 0
+ ? widget.orderModel.orderItems[index].product.images [0].src.toString()
+ : null,
+ status: widget.orderModel.orderStatusId,
+ product: widget.orderModel.orderItems[index].product,
+ ),
+ );
+ }),
Container(
padding: EdgeInsets.only(bottom: 10.0),
@@ -286,19 +344,22 @@ class _OrderDetailsPageState extends State {
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: [
+ children: [
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(
@@ -313,13 +374,17 @@ class _OrderDetailsPageState extends State {
children: [
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].orderSubtotalExclTax.toString(),
- style: TextStyle(fontSize: 13.0,
+ Text(
+ widget.orderModel.orderSubtotalExclTax.toString(),
+ style: TextStyle(
+ fontSize: 13.0,
),
),
],
@@ -329,10 +394,10 @@ class _OrderDetailsPageState extends State {
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
+ children: [
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(
@@ -347,13 +412,17 @@ class _OrderDetailsPageState extends State {
children: [
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].orderShippingExclTax.toString(),
- style: TextStyle(fontSize: 13.0,
+ Text(
+ widget.orderModel.orderShippingExclTax.toString(),
+ style: TextStyle(
+ fontSize: 13.0,
),
),
],
@@ -363,10 +432,10 @@ class _OrderDetailsPageState extends State {
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
+ children: [
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(
@@ -381,13 +450,17 @@ class _OrderDetailsPageState extends State {
children: [
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(
+ widget.orderModel.orderTax.toString(),
+ style: TextStyle(
+ fontSize: 13.0,
),
),
],
@@ -397,13 +470,14 @@ class _OrderDetailsPageState extends State {
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
+ children: [
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,
),
),
),
@@ -413,13 +487,19 @@ class _OrderDetailsPageState extends State {
children: [
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(model.order[0].orderTotal.toString(),
- style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold,
+ Text(
+ widget.orderModel.orderTotal.toString(),
+ style: TextStyle(
+ fontSize: 15.0,
+ fontWeight: FontWeight.bold,
),
),
],
@@ -427,60 +507,61 @@ class _OrderDetailsPageState extends State {
),
],
),
- widget.orderModel.orderStatusId == 10 ? InkWell(
- onTap: (){
- // payOnline link
- },
- child: Container(
+ widget.orderModel.orderStatusId == 10
+ ? InkWell(
+ onTap: () {
+ model.makeOrder();
+ },
+ 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: 130.0, right: 130.0),
+ decoration: BoxDecoration(
+ border: Border.all(
+ color: Colors.green,
+ style: BorderStyle.solid,
+ width: 4.0),
+ color: Colors.green,
+ borderRadius: BorderRadius.circular(5.0)),
+ child: Center(
+ child: Text(
+ TranslationBase.of(context).payOnline,
+ style: TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
),
),
- ),
- ),
- ),
- ) : Container(),
-
+ )
+ : Container(),
// getCancelOrder(canCancel, canRefund),
- isCancel ? InkWell(
- onTap: () {
- Navigator.push(context,
- MaterialPageRoute(builder: (context) => presentConfirmDialog()));
- },
- child: Container(
+ isCancel
+ ? InkWell(
+ onTap: () {
+ presentConfirmDialog(model,
+ widget.orderModel.id); //(widget.orderModel.id));
+//
+ },
+ 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(),
],
),
),
@@ -489,87 +570,80 @@ class _OrderDetailsPageState extends State {
);
}
-
-
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;
- });
- }
-}
-
- presentConfirmDialog(){
+// .getCanceledOrder
+ 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: () => {
-// cancelOrderDetail(widget.orderModel.id),
- ConfirmDialog.closeAlertDialog(context)
- },
+ 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: () => {});
dialog.showAlertDialog(context);
}
-// cancelOrderDetail(order){
-// if(widget.orderModel.canCancel && widget.orderModel.canRefund == false){
-//// setState(() {
-// cancelOrderDetail(order);
+ getCanceledOrder(order) {
+ Navigator.pop(context);
+ if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) {
+// getCanceledOrder(order);
// AppToast.showSuccessToast(message: "Request Sent Successfully");
-//// });
-//// return OrderPage();
-// }
-// else{}
-// }
+// Navigator.push(context,
+// MaterialPageRoute(builder: (context) => OrderPage()));
- getLanguageID() async {
- var languageID = await sharedPref.getString(APP_LANGUAGE);
- setState(() {
- widget.languageID = languageID;
- });
+ }
}
}
-
-
-
-
diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart
index 0f9217b7..4d09191c 100644
--- a/lib/pages/pharmacy/order/ProductReview.dart
+++ b/lib/pages/pharmacy/order/ProductReview.dart
@@ -1,294 +1,332 @@
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';
+import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
+import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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:flutter_svg/flutter_svg.dart';
-import 'package:diplomaticquarterapp/config/config.dart';
-import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
-import 'package:diplomaticquarterapp/services/pharmacy_services/order_service.dart';
-import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart';
-import 'package:rating_bar/rating_bar.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
-import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.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);
@override
_ProductReviewPageState createState() => _ProductReviewPageState();
}
class _ProductReviewPageState extends State {
- 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(
- onModelReady: (model)=>model.getProductReview(orderId),
- builder: (_,model, wi )=> AppScaffold(
+ builder: (_, model, wi) => AppScaffold(
appBarTitle: TranslationBase.of(context).writeReview,
isShowAppBar: true,
- isPharmacy:true ,
- body: Container(
- color: Colors.white,
- child: SingleChildScrollView(
- child: Column(
- children: [
-// Container(
-// child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00,
-// productReviews:4, ),
-// ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Container(
- margin: EdgeInsets.only(left: 10),
- child: SvgPicture.asset(
-// model.order[0].orderItems[0].product.images[0].src.toString(),
- 'assets/images/al-habib_onlne_pharmacy_bg.png',
- fit: BoxFit.cover,
- width: 80,
- height: 80,
- ),
- ),]
- ),
- Container(
- margin: EdgeInsets.only(top :15.0, bottom: 15.0),
- child: Column(
- children: [
- Row(
- children: [
- Text(model.order[0].orderItems[0].product.name.toString(),
- style: TextStyle(fontSize: 16.0,
- ),
- ),
- ],
+ isPharmacy: true,
+ body: Container(
+ color: Colors.white,
+ child: !finishReview ? SingleChildScrollView(
+ child: Column(
+ children: [
+ 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,
),
- Row(
- children: [
- Container(
- margin: EdgeInsets.only(left: 5),
- child: Text(model.order[0].orderItems[0].product.price.toString(),
- style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold,
+ 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),
),
),
),
- 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,
+ ),
+ 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(
- child: Text(model.order[0].orderItems[0].product.approvedRatingSum.toString(),
- style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold,
- ),
+ SizedBox(
+ width: 20,
),
- ),
- Container(
- margin: EdgeInsets.only(left: 5),
- child: Text("(" + model.order[0].orderItems[0].product.approvedTotalReviews.toString()
- + ' ' + TranslationBase.of(context).review +")",
- style: TextStyle(fontSize: 12.0,
+ 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,
- thickness: 8,
- indent: 0,
- endIndent: 0,
- ),
- Container(
- margin: EdgeInsets.only( top: 12.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- mainAxisSize: MainAxisSize.max,
- children: [
- RatingBar(
- // initialRating:
- // this.doctor.actualDoctorRate.toDouble(),
- size: 40.0,
- filledColor: Colors.yellow[700],
- emptyColor: Colors.grey[500],
- isHalfAllowed: true,
- halfFilledIcon: Icons.star_half,
- filledIcon: Icons.star,
- emptyIcon: Icons.star,
- ),
- ],
+ ]),
+ ),
+ Divider(
+ color: Colors.grey[350],
+ height: 20,
+ thickness: 8,
+ indent: 0,
+ endIndent: 0,
+ ),
+ Container(
+ margin: EdgeInsets.only(top: 12.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.center,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ mainAxisSize: MainAxisSize.max,
+ children: [
+ RatingBar(
+ size: 40.0,
+ filledColor: Colors.yellow[700],
+ emptyColor: Colors.grey[500],
+ isHalfAllowed: true,
+ 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),
- child: Column(
- children: [
- TextFormField (
- 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]),
- ),
- enabledBorder: OutlineInputBorder(
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- borderSide: BorderSide(color: Colors.grey[400], width: 1),
- ),
- ),
+ ],
+ ),
+ ),
+ Container(
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
+ child: Column(
+ children: [
+ TextFormField(
+ controller: _reviewController,
+ maxLines: 6,
+ minLines: 4,
+ decoration: InputDecoration(
+ border: InputBorder.none,
+ hintText: 'Tell us more about product!',
+ focusedBorder: OutlineInputBorder(
+ borderRadius: BorderRadius.circular(5.0),
+ borderSide:
+ BorderSide(width: 1, color: Colors.grey[400]),
),
- ],
- ),
- ),
- InkWell(
- onTap: () {
-// Navigator.push(context,
-// MaterialPageRoute(builder: (context) => ));
- },
- child: Container(
- height: 50.0,
- width: 400.0,
- color: Colors.transparent,
- child: Container(
- decoration: BoxDecoration(
- border: Border.all(
- color: Colors.yellow[700],
- style: BorderStyle.solid,
- width: 1.0
- ),
- color: Colors.yellow[700],
- borderRadius: BorderRadius.circular(5.0)
+ enabledBorder: OutlineInputBorder(
+ borderRadius:
+ BorderRadius.all(Radius.circular(5.0)),
+ borderSide:
+ BorderSide(color: Colors.grey[400], width: 1),
),
- child: Center(
- child: Text(
- TranslationBase.of(context).shareReview,
- style: TextStyle(
- color: Colors.white,
- fontSize: 16.0,
- fontWeight: FontWeight.bold,
- ),
- ),
+ ),
+ onChanged: (value) {
+ setState(() {
+ reviewText = value;
+ });
+ },
+ textAlign: TextAlign.start,
+ textAlignVertical: TextAlignVertical.top,
+ ),
+ ],
+ ),
+ ),
+ InkWell(
+ 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: _reviewController.value.text != null &&
+ _reviewController.value.text != ""
+ ? Colors.yellow[700]
+ : Color(0xFFf5d69c),
+ style: BorderStyle.solid,
+ 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,
+ style: TextStyle(
+ color: Colors.white,
+ fontSize: 16.0,
+ fontWeight: FontWeight.bold,
),
),
),
),
- ],
- ),
+ ),
),
- ),),
- );
+ ],
+ ),
+ ) : getReviewedProduct(),
+ ),
+ ),
+ );
}
-
-
-
//new screen is showing after submitting the review
- Widget getReviewedProduct(){
+ Widget getReviewedProduct() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
- children: [
+ children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
- children: [
+ children: [
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: [
+ children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
- children: [
+ children: [
SvgPicture.asset(
'assets/images/pharmacy/quote_start.svg',
width: 15,
- height: 15,),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- 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: [
+ children: [
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(
@@ -299,17 +337,16 @@ class _ProductReviewPageState extends State {
);
},
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,
@@ -327,23 +364,4 @@ class _ProductReviewPageState extends State {
);
}
-// 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(){
-
- }
}
diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart
index 0dc5bee6..6e2f2a7c 100644
--- a/lib/pages/pharmacy/profile/profile.dart
+++ b/lib/pages/pharmacy/profile/profile.dart
@@ -1,16 +1,25 @@
+import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
+import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
+import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/LiveChat/livechat_page.dart';
import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
+import 'package:diplomaticquarterapp/pages/login/welcome.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart';
+import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-page.dart';
+import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-terms-conditions-page.dart';
+import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart';
+import 'package:diplomaticquarterapp/uitl/app_toast.dart';
+import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
+import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
-import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
-import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
+
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
@@ -18,6 +27,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/my_reviews.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare.dart';
+dynamic languageID ;
class PharmacyProfilePage extends StatefulWidget {
@override
_ProfilePageState createState() => _ProfilePageState();
@@ -25,9 +35,56 @@ class PharmacyProfilePage extends StatefulWidget {
class _ProfilePageState extends State {
AppSharedPreferences sharedPref = AppSharedPreferences();
- String customerId = "";
String page_id = "";
+ AuthenticatedUser user;
+ bool isLogin = false;
+ String firstName;
+ String customerId;
+ String lastName, mobileNo, identificationNo;
+ int languageId;
+
+ _ProfilePageState({this.customerId });
+
+ getLanguageID() async {
+ languageID = await sharedPref.getString(APP_LANGUAGE);
+ }
+ getCustomer() async {
+ String custID;
+ custID = await sharedPref.getString(PHARMACY_CUSTOMER_ID);
+ setState(() {
+ customerId = custID;
+ });
+ print("customer Id is"+ customerId);
+ return customerId;
+ }
+
+ getUser() async {
+ var userData = await sharedPref.getObject(USER_PROFILE);
+ if (userData != null){ user = AuthenticatedUser.fromJson(userData);
+ setState(() {
+ firstName = user.firstName.toString();
+ print("this is user" + user.firstName.toString());
+ print("this is user" + user.firstNameN.toString());
+ });
+ } else{
+ if(userData == null){
+ Navigator.push(context,
+ MaterialPageRoute(builder: (context) =>
+ WelcomeLogin()),
+ );
+ }
+ }
+
+// this.isLogin = user != null;
+ }
+ void initState() {
+ getCustomer();
+ getLanguageID();
+ super.initState();
+ getUser();
+ }
+
@override
Widget build(BuildContext context) {
return BaseView(
@@ -60,433 +117,509 @@ class _ProfilePageState extends State {
children: [
Text(
TranslationBase.of(context).welcome,
- style: TextStyle(
- fontSize: 14.0,
+ style: TextStyle(fontSize: 14.0,
fontWeight: FontWeight.bold,
- color: Colors.grey),
- ),
- Text(
- "Name",
-// model.order[0].customer.firstName.toString(),
- style: TextStyle(
- fontSize: 16.0, fontWeight: FontWeight.bold),
- ),
- ],
- ),
- )
- ],
- ),
- ),
- Divider(
- color: Colors.grey[350],
- height: 20,
- thickness: 5,
- indent: 0,
- endIndent: 0,
- ),
- SizedBox(
- height: 15,
- ),
- Container(
- child: Row(
- children: [
- Expanded(
- child: InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => OrderPage()));
- },
- child: Column(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/orders_icon.svg',
- width: 50,
- height: 50,
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- TranslationBase.of(context).orders,
- style: TextStyle(
- fontSize: 13.0,
- fontWeight: FontWeight.bold,
+ color:Colors.grey
),
),
- ],
- ),
- ),
- ),
- Expanded(
- child: InkWell(
- child: Column(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/lakum_icon.svg',
- width: 50,
- height: 50,
- ),
- SizedBox(
- height: 5,
- ),
Text(
- TranslationBase.of(context).lakum,
+ languageID == "ar"
+ ? user.firstNameN.toString()+ " " + user.lastNameN.toString()
+ : user.firstName.toString()+ " " + user.lastName.toString(),
style: TextStyle(
- fontSize: 13.0, fontWeight: FontWeight.bold),
+ fontSize: 14.0, fontWeight: FontWeight.bold),
),
],
),
+
+ )
+ ],
+ ),
+ ),
+ Divider(
+ color: Colors.grey[350],
+ height: 20,
+ thickness: 5,
+ indent: 0,
+ endIndent: 0,
+ ),
+ SizedBox(
+ height: 15,
+ ),
+ Container(
+ child: Row(
+ children: [
+ Expanded(
+ child: InkWell(
+ onTap: () {
+ if(customerId == null){
+ AppToast.showErrorToast(message: "Customer not found");
+ return;
+ }
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => OrderPage(customerID: customerId)));
+ },
+ child: Column(
+ children: [
+// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')),
+ SvgPicture.asset(
+ 'assets/images/pharmacy/orders_icon.svg',
+ width: 50,
+ height: 50,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Text(
+ TranslationBase.of(context).orders,
+ style: TextStyle(
+ fontSize: 13.0,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ],
),
),
- Expanded(
- child: InkWell(
- onTap: () {
+ ),
+ Expanded(
+ child: InkWell(
+ onTap: () {
Navigator.push(
context,
- MaterialPageRoute(
- builder: (context) => WishlistPage()));
- },
- child: Column(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/wishlist_icon.svg',
- width: 50,
- height: 50,
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- TranslationBase.of(context).wishlist,
- style: TextStyle(
- fontSize: 13.0,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
+ MaterialPageRoute(
+ builder: (context) => LakumMainPage()));
+ },
+ child: Column(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/lakum_icon.svg',
+ width: 50,
+ height: 50,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Text(
+ TranslationBase.of(context).lakum,
+ style: TextStyle(
+ fontSize: 13.0, fontWeight: FontWeight.bold),
+ ),
+ ],
),
),
- Expanded(
- child: InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => MyReviewsPage()));
- },
- child: Column(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/review_icon.svg',
- width: 50,
- height: 50,
- ),
- SizedBox(
- height: 5,
- ),
- Text(
- TranslationBase.of(context).reviews,
- style: TextStyle(
- fontSize: 13.0,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
+ ),
+ Expanded(
+ child: InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => WishlistPage()));
+ },
+ child: Column(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/wishlist_icon.svg',
+ width: 50,
+ height: 50,
+
+ ),SizedBox(
+ height: 5,
+ ),
+ Text(
+ TranslationBase.of(context).wishlist,
+ style: TextStyle(
+ fontSize: 13.0,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ],
),
),
- ],
- )),
- SizedBox(
- height: 15,
- ),
- Divider(
- color: Colors.grey[350],
- height: 20,
- thickness: 5,
- indent: 0,
- endIndent: 0,
- ),
- SizedBox(
- height: 10,
- ),
- Container(
- padding: EdgeInsets.only(left: 10.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- TranslationBase.of(context).myAccount,
- style: TextStyle(
- fontSize: 16.0, fontWeight: FontWeight.bold),
- ),
- SizedBox(
- height: 10,
- ),
- Divider(
- color: Colors.grey,
- height: 20,
- ),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- HomePrescriptionsPage()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/my_prescription_icon.svg',
- width: 28,
- height: 28,
- ),
- SizedBox(
- width: 15,
- ),
- Text(
- TranslationBase.of(context).myPrescription,
- style: TextStyle(
- fontSize: 13.0,
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 5,
- ),
- Divider(
- color: Colors.grey,
- height: 20,
- ),
- InkWell(
- onTap: () {
+ ),
+ Expanded(
+ child: InkWell(
+ onTap: () {
Navigator.push(
context,
MaterialPageRoute(
- builder: (context) => ComparePage()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/compare.png',
- width: 28,
- height: 28,
- ),
- SizedBox(
- width: 15,
- ),
- Text(
- TranslationBase.of(context).compare,
- style: TextStyle(
- fontSize: 13.0,
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 5,
- ),
- Divider(
- color: Colors.grey,
- height: 20,
+ builder: (context) => MyReviewsPage()));
+ },child: Column(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/review_icon.svg',
+ width: 50,
+ height: 50,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Text(
+ TranslationBase.of(context).reviews,
+ style: TextStyle(
+ fontSize: 13.0,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ],
),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- HomePrescriptionsPage()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/medication_refill_icon.svg',
- width: 30,
- height: 30,
- ),
- SizedBox(
- width: 20,
- ),
- Text(
- TranslationBase.of(context).medicationsRefill,
- style: TextStyle(
- fontSize: 13.0,
- ),
- ),
- ],
- ),
+ ),
+ ),
+ ],
+ )),
+ SizedBox(
+ height: 15,
+ ),
+ Divider(
+ color: Colors.grey[350],
+ height: 20,
+ thickness: 5,
+ indent: 0,
+ endIndent: 0,
+ ),
+ SizedBox(
+ height: 10,
+ ),
+ Container(
+ padding: EdgeInsets.only(left: 10.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ TranslationBase.of(context).myAccount,
+ style: TextStyle(
+ fontSize: 16.0, fontWeight: FontWeight.bold),
+ ),
+ SizedBox(
+ height: 10,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => HomePrescriptionsPage()));
+ },
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/my_prescription_icon.svg',
+ width: 28,
+ height: 28,
+ ),
+ SizedBox(
+ width: 15,
+ ),
+ Text(
+ TranslationBase.of(context).myPrescription,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- SizedBox(
- height: 5,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => ComparePage()));
+ },
+ child: Row(
+ children: [
+ Image.asset('assets/images/pharmacy/compare.png',
+ width: 35, height: 35),
+ SizedBox(
+ width: 15,
+ ),
+ Text(
+ TranslationBase.of(context).compare,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- Divider(
- color: Colors.grey,
- height: 20,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => HomePrescriptionsPage()));
+ },
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/medication_refill_icon.svg',
+ width: 30,
+ height: 30,
+ ),
+ SizedBox(
+ width: 20,
+ ),
+ Text(
+ TranslationBase.of(context).medicationsRefill,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => MyFamily()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/my_family_icon.svg',
- width: 20,
- height: 20,
- ),
- SizedBox(
- width: 20,
- ),
- Text(
- TranslationBase.of(context).family,
- style: TextStyle(
- fontSize: 13.0,
- ),
- ),
- ],
- ),
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => MyFamily()));
+ },
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/my_family_icon.svg',
+ width: 20,
+ height: 20,
+ ),
+ SizedBox(
+ width: 20,
+ ),
+ Text(
+ TranslationBase.of(context).family,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- SizedBox(
- height: 5,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => PharmacyAddressesPage()));
+ },
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/shipping_addresses_icon.svg',
+ width: 30,
+ height: 30,
+ ),
+ SizedBox(
+ width: 20,
+ ),
+ Text(
+ TranslationBase.of(context).shippingAddresses,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- Divider(
- color: Colors.grey,
- height: 20,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => PharmacyTermsConditions()));
+ },
+ child: Row(
+ children: [
+ Image.asset('assets/images/pharmacy/terms.png',
+ width: 25,
+ height: 25,
+ ),
+
+ SizedBox(
+ width: 10,
+ ),
+ Text(
+ TranslationBase.of(context).conditionsHMG,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) =>
- PharmacyAddressesPage()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/shipping_addresses_icon.svg',
- width: 30,
- height: 30,
- ),
- SizedBox(
- width: 20,
- ),
- Text(
- TranslationBase.of(context).shippingAddresses,
- style: TextStyle(
- fontSize: 13.0,
- ),
- ),
- ],
- ),
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => LakumTermsConditions(this.identificationNo, this.firstName, this.lastName,
+ this.mobileNo, this.languageId)));
+ },
+ child: Row(
+ children: [
+ Image.asset('assets/images/pharmacy/terms.png',
+ width: 25,
+ height: 25,
+ ),
+// IconButton(icon: Icon(Icons.error_outline), iconSize: 30,
+// color: Colors.black,),
+ SizedBox(
+ width: 10,
+ ),
+ Text(
+ TranslationBase.of(context).conditions,
+ style: TextStyle(
+ fontSize: 13.0,
+ ),
+ ),
+ ],
),
- ],
- ),
- ),
- SizedBox(
- height: 10,
- ),
- Divider(
- color: Colors.grey[350],
- height: 20,
- thickness: 5,
- indent: 0,
- endIndent: 0,
- ),
- SizedBox(
- height: 10,
+ ),
+ ],
),
- Container(
- padding: EdgeInsets.only(left: 10.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- TranslationBase.of(context).reachUs,
- style: TextStyle(
- fontSize: 16.0, fontWeight: FontWeight.bold),
- ),
- SizedBox(
- height: 5,
- ),
- Divider(
- color: Colors.grey,
- height: 20,
- ),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => LiveChatPage()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/contact_us_icon.svg',
- width: 20,
- height: 20,
- ),
- SizedBox(
- width: 20,
- ),
- Text(
- TranslationBase.of(context).contactUs,
- style: TextStyle(fontSize: 13.0),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 5,
+ ),
+ SizedBox(
+ height: 10,
+ ),
+ Divider(
+ color: Colors.grey[350],
+ height: 20,
+ thickness: 5,
+ indent: 0,
+ endIndent: 0,
+ ),
+ SizedBox(
+ height: 10,
+ ),
+ Container(
+ padding: EdgeInsets.only(left: 10.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ TranslationBase.of(context).reachUs,
+ style: TextStyle(
+ fontSize: 16.0, fontWeight: FontWeight.bold),
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => LiveChatPage()));
+ },
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/contact_us_icon.svg',
+ width: 20,
+ height: 20,
+ ),
+ SizedBox(
+ width: 20,
+ ),
+ Text(
+ TranslationBase.of(context).contactUs,
+ style: TextStyle(fontSize: 13.0),
+ ),
+ ],
),
- Divider(
- color: Colors.grey,
- height: 20,
+ ),
+ SizedBox(
+ height: 5,
+ ),
+ Divider(
+ color: Colors.grey,
+ height: 20,
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => FindUsPage()));
+ },
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ 'assets/images/pharmacy/our_locations_icon.svg',
+ width: 30,
+ height: 30,
+ ),
+ SizedBox(
+ width: 20,
+ ),
+ Text(
+ TranslationBase.of(context).ourLocations,
+ style: TextStyle(fontSize: 13.0),
+ ),
+ ],
),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => FindUsPage()));
- },
- child: Row(
- children: [
- SvgPicture.asset(
- 'assets/images/pharmacy/our_locations_icon.svg',
- width: 30,
- height: 30,
- ),
- SizedBox(
- width: 20,
- ),
- Text(
- TranslationBase.of(context).ourLocations,
- style: TextStyle(fontSize: 13.0),
- ),
- ],
- ),
- )
- ],
- ),
- )
- ],
- ),
+ )
+ ],
+ ),
+ )
+ ],
),
),
),
- );
- }
-}
+ ));
+ }}
+
+
+
+
diff --git a/lib/services/pharmacy_services/cancelOrder_service.dart b/lib/services/pharmacy_services/cancelOrder_service.dart
index de80a473..f848c2ff 100644
--- a/lib/services/pharmacy_services/cancelOrder_service.dart
+++ b/lib/services/pharmacy_services/cancelOrder_service.dart
@@ -16,24 +16,29 @@ class CancelOrderService extends BaseService{
AuthenticatedUser authUser = new AuthenticatedUser();
AuthProvider authProvider = new AuthProvider();
- List get orderDetails => orderDetails;
- List _orderList = List();
- List get orderList => _orderList;
+ List _cancelOrderList = List();
+ List get cancelOrderList => _cancelOrderList;
String url ="";
- Future cancelOrderDetail(order) async {
+ Future getCanceledOrder(order) async {
print("step 1");
hasError = false;
+
+ dynamic res;
+
await baseAppClient.getPharmacy(GET_Cancel_ORDER+order,
onSuccess: (dynamic response, int statusCode) {
- _orderList.clear();
- response['orders'].forEach((item) {
- _orderList.add(OrderModel.fromJson(item));
- });
+ res = response;
+ print(res);
+// _cancelOrderList.clear();
+// response['success'].forEach((item) {
+// _cancelOrderList.add(OrderModel.fromJson(item));
+// });
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
});
+ return res;
}
}
\ No newline at end of file
diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart
index fb58097f..a3bb9976 100644
--- a/lib/services/pharmacy_services/orderDetails_service.dart
+++ b/lib/services/pharmacy_services/orderDetails_service.dart
@@ -23,7 +23,7 @@ class OrderDetailsService extends BaseService{
Future getOrderDetails(orderId) async {
- print("step 1");
+ print("step 2" + orderId);
hasError = false;
await baseAppClient.getPharmacy(GET_ORDER_DETAILS+orderId,
onSuccess: (dynamic response, int statusCode) {
@@ -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 body = Map();
+ Map 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);
+ }
}
\ No newline at end of file
diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart
index 70523da1..e426b801 100644
--- a/lib/services/pharmacy_services/order_service.dart
+++ b/lib/services/pharmacy_services/order_service.dart
@@ -18,12 +18,12 @@ class OrderService extends BaseService{
List get orderList => _orderList;
String url ="";
- Future getOrder(custmerId, page_id) async {
- print("step 1");
+ Future getOrder(customerId, pageId) async {
hasError = false;
- url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368";
-// url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$page_id&limit=200&customer_id=$custmerId";
+ // url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368";
+ url =GET_ORDER+"customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=$pageId&limit=200&customer_id=$customerId";
print(url);
+
await baseAppClient.getPharmacy(url,
onSuccess: (dynamic response, int statusCode) {
_orderList.clear();
diff --git a/lib/services/pharmacy_services/writeReview_service.dart b/lib/services/pharmacy_services/writeReview_service.dart
new file mode 100644
index 00000000..573095eb
--- /dev/null
+++ b/lib/services/pharmacy_services/writeReview_service.dart
@@ -0,0 +1,40 @@
+
+import 'package:diplomaticquarterapp/config/config.dart';
+import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
+import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
+import 'package:diplomaticquarterapp/core/service/base_service.dart';
+import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
+import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
+import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
+import 'package:flutter/material.dart';
+
+
+class writeReviewService extends BaseService{
+
+
+
+ AppSharedPreferences sharedPref = AppSharedPreferences();
+ AppGlobal appGlobal = new AppGlobal();
+
+ AuthenticatedUser authUser = new AuthenticatedUser();
+ AuthProvider authProvider = new AuthProvider();
+
+ List get writeReview => writeReview;
+ List _writeReviewList = List();
+ List get orderList => _writeReviewList;
+
+
+ Future getProductReview() async {
+ hasError = false;
+ await baseAppClient.getPharmacy(WRITE_REVIEW,
+ onSuccess: (dynamic response, int statusCode) {
+ _writeReviewList.clear();
+ response[''].forEach((item) {
+ _writeReviewList.add(OrderModel.fromJson(item));
+ });
+ }, onFailure: (String error, int statusCode) {
+ hasError = true;
+ super.error = error;
+ });
+ }
+}
\ No newline at end of file
diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart
index 232bd99a..65be2d3e 100644
--- a/lib/uitl/translations_delegate_base.dart
+++ b/lib/uitl/translations_delegate_base.dart
@@ -777,9 +777,15 @@ class TranslationBase {
String get noOrder => localizedValues['noOrder'][locale.languageCode];
String get review => localizedValues['review'][locale.languageCode];
String get deliveredOrder => localizedValues['deliveredOrder'][locale.languageCode];
+ String get pendingOrder => localizedValues['pendingOrder'][locale.languageCode];
+ String get processingOrder => localizedValues['processingOrder'][locale.languageCode];
+ String get cancelledOrder => localizedValues['cancelledOrder'][locale.languageCode];
String get compare => localizedValues['compare'][locale.languageCode];
String get medicationsRefill => localizedValues['medicationsRefill'][locale.languageCode];
String get myPrescription => localizedValues['myPrescription'][locale.languageCode];
+ String get quantity => localizedValues['quantity'][locale.languageCode];
+ String get conditionsHMG => localizedValues['conditionsHMG'][locale.languageCode];
+ String get conditions => localizedValues['conditions'][locale.languageCode];
// pharmacy module
@@ -1077,7 +1083,6 @@ class TranslationBase {
String get specification => localizedValues['specification'][locale.languageCode];
String get details => localizedValues['details'][locale.languageCode];
String get availability => localizedValues['availability'][locale.languageCode];
- String get quantity => localizedValues['quantity'][locale.languageCode];
String get quantitySize => localizedValues['quantitySize'][locale.languageCode];
String get addToCart => localizedValues['addToCart'][locale.languageCode];
String get buyNow => localizedValues['buyNow'][locale.languageCode];
diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart
index 42a25aff..169decb0 100644
--- a/lib/widgets/pharmacy/product_tile.dart
+++ b/lib/widgets/pharmacy/product_tile.dart
@@ -1,12 +1,12 @@
+import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-order-page.dart';
import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart';
+import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_html/style.dart';
-
+import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:rating_bar/rating_bar.dart';
-import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
class productTile extends StatelessWidget {
final String productName;
@@ -18,18 +18,26 @@ class productTile extends StatelessWidget {
final bool isOrderDetails;
final String productImage;
final bool showLine;
+ final String img;
+ final String imgs;
+ final int status;
+ final Product product;
final dynamic productID;
productTile(
{this.productName,
this.productPrice,
this.productRate,
+ this.productReviews,
this.qyt,
this.totalPrice,
- this.productReviews,
this.isOrderDetails = false,
this.productImage,
this.showLine = true,
+ this.img,
+ this.imgs,
+ this.status,
+ this.product,
this.productID,
});
@@ -45,15 +53,26 @@ class productTile extends StatelessWidget {
children: [
Row(
children: [
- Container(
- margin: EdgeInsets.only(left: 10),
- child: Image.network(
- productImage.trim(),
- fit: BoxFit.cover,
- width: 80,
- height: 80,
- ),
- ),
+ this.imgs != null && this.imgs.length > 0
+ ? Container(
+ margin: EdgeInsets.only(left: 10),
+ child: Image.network(
+ imgs,
+// productImage.trim(),
+ fit: BoxFit.cover,
+ width: 80,
+ height: 80,
+ ),
+ )
+ : Container(
+ margin: EdgeInsets.only(left: 10),
+ child: Image.asset(
+ "assets/images/no_image.png",
+ width: 80,
+ height: 80,
+ )
+// fit: BoxFit.cover,
+ ),
Expanded(
flex: 5,
child: Column(
@@ -155,7 +174,9 @@ class productTile extends StatelessWidget {
margin: EdgeInsets.only(bottom: 5.0),
child: RichText(
text: TextSpan(
- text: 'QYT: $qyt',
+ text: TranslationBase.of(context).quantity +
+ "" +
+ '$qyt',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.grey,
@@ -200,88 +221,92 @@ class productTile extends StatelessWidget {
)
: Container(),
// this.isOrderDetails == true && model.order[0].orderStatusId == 30?
- this.isOrderDetails == true
- ? Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Container(
+
+ if (status == 30 && this.isOrderDetails == true)
+ Expanded(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Container(
// margin: EdgeInsets.all(5.0),
- child: Align(
- alignment: Alignment.topLeft,
- child: RatingBar.readOnly(
- initialRating: productRate,
- size: 15.0,
- filledColor: Colors.yellow[700],
- emptyColor: Colors.grey[500],
- isHalfAllowed: true,
- halfFilledIcon: Icons.star_half,
- filledIcon: Icons.star,
- emptyIcon: Icons.star,
- ),
- ),
+ child: Align(
+ alignment: Alignment.topLeft,
+ child: RatingBar.readOnly(
+ initialRating: productRate,
+ size: 15.0,
+ filledColor: Colors.yellow[700],
+ emptyColor: Colors.grey[500],
+ isHalfAllowed: true,
+ halfFilledIcon: Icons.star_half,
+ filledIcon: Icons.star,
+ emptyIcon: Icons.star,
),
- Container(
+ ),
+ ),
+ Container(
// margin: EdgeInsets.all(5),
- child: Align(
+ child: Align(
// alignment: Alignment.topLeft,
- child: RichText(
- text: TextSpan(
- text: '($productReviews reviews)',
- style: TextStyle(
- fontWeight: FontWeight.bold,
- color: Colors.grey,
- fontSize: 13),
- ),
- ),
+ child: RichText(
+ text: TextSpan(
+ text: '($productReviews reviews)',
+ style: TextStyle(
+ fontWeight: FontWeight.bold,
+ color: Colors.grey,
+ fontSize: 13),
),
),
- InkWell(
- onTap: () {
- Navigator.push(
- context,
- MaterialPageRoute(
- builder: (context) => ProductReviewPage()));
- },
- child: Container(
- padding: EdgeInsets.only(
- left: 13.0, right: 13.0, top: 5.0),
- height: 30.0,
- decoration: BoxDecoration(
- border: Border.all(
- color: Colors.orange,
- style: BorderStyle.solid,
- width: 1.0),
- color: Colors.transparent,
- borderRadius: BorderRadius.circular(5.0)),
- child: Text(
- TranslationBase.of(context).writeReview,
- style: TextStyle(
- fontSize: 12,
+ ),
+ ),
+ InkWell(
+ onTap: () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) =>
+ ProductReviewPage(product)));
+ },
+ child: Container(
+ padding:
+ EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0),
+ height: 30.0,
+ decoration: BoxDecoration(
+ border: Border.all(
color: Colors.orange,
- ),
- ),
+ style: BorderStyle.solid,
+ width: 1.0),
+ color: Colors.transparent,
+ borderRadius: BorderRadius.circular(5.0)),
+ child: Text(
+ TranslationBase.of(context).writeReview,
+ style: TextStyle(
+ fontSize: 12,
+ color: Colors.orange,
),
),
- ],
+ ),
),
- )
- : Container(),
+ ],
+ ),
+ ),
+ /*Container(
+
+ ),*/
],
),
);
}
-}
+ deleteFromWishlistFunction(itemID) async {
+ ProductDetailViewModel x = new ProductDetailViewModel();
+ await x.deletWishlistData(itemID);
+ }
-deleteFromWishlistFunction(itemID) async {
- ProductDetailViewModel x = new ProductDetailViewModel();
- await x.deletWishlistData(itemID);
-}
+ addToCartFunction(quantity, itemID) async {
+ ProductDetailViewModel x = new ProductDetailViewModel();
+ await x.addToCartData(quantity, itemID);
+ }
+}
-addToCartFunction(quantity, itemID) async {
- ProductDetailViewModel x = new ProductDetailViewModel();
- await x.addToCartData(quantity, itemID);
-}
\ No newline at end of file
diff --git a/pubspec.yaml b/pubspec.yaml
index dee882e6..18a8330a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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