From f137bd44c0cf1860e9e4028dd6d332a047230e62 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 10 Nov 2020 11:43:20 +0300 Subject: [PATCH] created order and order details UI pages --- android/app/src/main/AndroidManifest.xml | 6 +- assets/images/pharmacy/Group 1206.svg | 14 + assets/images/pharmacy/Group 1207.svg | 17 + .../images/pharmacy/aramex_shipping_logo.svg | 14 + assets/images/pharmacy/arrow_right.svg | 6 + assets/images/pharmacy/credit_card_icon.svg | 6 + assets/images/pharmacy/hmg_shipping_logo.svg | 17 + assets/images/pharmacy/quote_end.svg | 8 + assets/images/pharmacy/quote_start.svg | 8 + assets/images/pharmacy/shipping_mark_icon.svg | 16 + .../images/pharmacy/shipping_truck_icon.svg | 34 + .../images/pharmacy/success_review_icon.svg | 24 + lib/config/config.dart | 7 + lib/config/localized_values.dart | 27 + lib/pages/landing/home_page.dart | 10 +- lib/pages/pharmacy/order/Order.dart | 781 ++++++++++++++++++ lib/pages/pharmacy/order/OrderDetails.dart | 467 +++++++++++ lib/pages/pharmacy/order/ProductReview.dart | 312 +++++++ .../pharmacyAddresses/AddAddress.dart | 142 +++- .../pharmacyAddresses/PharmacyAddresses.dart | 110 ++- .../orderDetails_service.dart | 39 + .../pharmacy_services/order_service.dart | 38 + .../pharmacyAddress_service.dart | 40 + lib/uitl/translations_delegate_base.dart | 27 + lib/widgets/pharmacy/product_tile.dart | 137 ++- pubspec.yaml | 3 + 26 files changed, 2257 insertions(+), 53 deletions(-) create mode 100644 assets/images/pharmacy/Group 1206.svg create mode 100644 assets/images/pharmacy/Group 1207.svg create mode 100644 assets/images/pharmacy/aramex_shipping_logo.svg create mode 100644 assets/images/pharmacy/arrow_right.svg create mode 100644 assets/images/pharmacy/credit_card_icon.svg create mode 100644 assets/images/pharmacy/hmg_shipping_logo.svg create mode 100644 assets/images/pharmacy/quote_end.svg create mode 100644 assets/images/pharmacy/quote_start.svg create mode 100644 assets/images/pharmacy/shipping_mark_icon.svg create mode 100644 assets/images/pharmacy/shipping_truck_icon.svg create mode 100644 assets/images/pharmacy/success_review_icon.svg create mode 100644 lib/pages/pharmacy/order/Order.dart create mode 100644 lib/pages/pharmacy/order/OrderDetails.dart create mode 100644 lib/pages/pharmacy/order/ProductReview.dart create mode 100644 lib/services/pharmacy_services/orderDetails_service.dart create mode 100644 lib/services/pharmacy_services/order_service.dart create mode 100644 lib/services/pharmacy_services/pharmacyAddress_service.dart diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8c32edfd..065f9f47 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -25,6 +25,8 @@ android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true" android:label="diplomaticquarterapp"> + - + + diff --git a/assets/images/pharmacy/Group 1206.svg b/assets/images/pharmacy/Group 1206.svg new file mode 100644 index 00000000..ef8f7473 --- /dev/null +++ b/assets/images/pharmacy/Group 1206.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/Group 1207.svg b/assets/images/pharmacy/Group 1207.svg new file mode 100644 index 00000000..fd2ffd41 --- /dev/null +++ b/assets/images/pharmacy/Group 1207.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/aramex_shipping_logo.svg b/assets/images/pharmacy/aramex_shipping_logo.svg new file mode 100644 index 00000000..30cc03b8 --- /dev/null +++ b/assets/images/pharmacy/aramex_shipping_logo.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/assets/images/pharmacy/arrow_right.svg b/assets/images/pharmacy/arrow_right.svg new file mode 100644 index 00000000..b4243287 --- /dev/null +++ b/assets/images/pharmacy/arrow_right.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/credit_card_icon.svg b/assets/images/pharmacy/credit_card_icon.svg new file mode 100644 index 00000000..9ba6c2bf --- /dev/null +++ b/assets/images/pharmacy/credit_card_icon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/images/pharmacy/hmg_shipping_logo.svg b/assets/images/pharmacy/hmg_shipping_logo.svg new file mode 100644 index 00000000..8e9db3d6 --- /dev/null +++ b/assets/images/pharmacy/hmg_shipping_logo.svg @@ -0,0 +1,17 @@ + + + diff --git a/assets/images/pharmacy/quote_end.svg b/assets/images/pharmacy/quote_end.svg new file mode 100644 index 00000000..083ff39a --- /dev/null +++ b/assets/images/pharmacy/quote_end.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/quote_start.svg b/assets/images/pharmacy/quote_start.svg new file mode 100644 index 00000000..74216f14 --- /dev/null +++ b/assets/images/pharmacy/quote_start.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/assets/images/pharmacy/shipping_mark_icon.svg b/assets/images/pharmacy/shipping_mark_icon.svg new file mode 100644 index 00000000..5cf9606b --- /dev/null +++ b/assets/images/pharmacy/shipping_mark_icon.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/shipping_truck_icon.svg b/assets/images/pharmacy/shipping_truck_icon.svg new file mode 100644 index 00000000..8ffda974 --- /dev/null +++ b/assets/images/pharmacy/shipping_truck_icon.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/pharmacy/success_review_icon.svg b/assets/images/pharmacy/success_review_icon.svg new file mode 100644 index 00000000..f6951456 --- /dev/null +++ b/assets/images/pharmacy/success_review_icon.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/config/config.dart b/lib/config/config.dart index 0e2cb367..dd6e612a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -8,6 +8,8 @@ const MAX_SMALL_SCREEN = 660; const BASE_URL = 'https://hmgwebservices.com/'; +const PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; + const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Doctor @@ -327,6 +329,11 @@ const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; //Pharmacy wishlist const GET_WISHLIST = "http://swd-pharapp-01:7200/api/shopping_cart_items/"; +//Pharmacy address +const GET_ADDRESS = "https://uat.hmgwebservices.com/epharmacy/api/Customers/272843?fields=addresses"; +//order + order details 'orders?customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=' + page_id + '&limit=200&customer_id='+ custmerId, +const GET_ORDER = "https://uat.hmgwebservices.com/epharmacy/api/orders?customer=1,fields=id,order_total,order_status,order_statusn,order_status_id,created_on_utc&page=1&limit=200&customer_id=1367368"; +const GET_ORDER_DETAILS = "https://uat.hmgwebservices.com/epharmacy/api/orders/3584"; const TIMER_MIN = 10; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9affe647..0440addb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -622,4 +622,31 @@ const Map> localizedValues = { "delete": {"en": "Delete", "ar": " حذف"}, "addAddress": {"en": "ADD A NEW ADDRESS", "ar": " اضافة عنوان جديد"}, "addNewAddress": {"en": "Add New Address", "ar": " اضافة عنوان جديد"}, + "order": {"en": "My Order", "ar": " طلباتي"}, + "delivered": {"en": "Delivered", "ar": " تم التوصيل"}, + "pending": {"en": "Pending", "ar": " معلقة "}, + "processing": {"en": "Processing", "ar": " تحت المعالجة"}, + "cancelled": {"en": "Cancelled", "ar": " ملغي"}, + "writeReview": {"en": "Write Review", "ar": " اكتب تقييمك"}, + "shareReview": {"en": "SHARE REVIEW", "ar": " اكتب تقييمك"}, + "backMyAccount": {"en": "BACK TO MY ACCOUNT ", "ar": " الرجوع لحسابي الشخصي"}, + "reviewSuccessful": {"en": "Review Successful", "ar": " تقييم ناجح"}, + "reviewShared": {"en": "Your review has been shared on product review section", "ar": " تمت مشاركة تقييمك في قسم تقييم المنتج"}, + "reviewComment": {"en": "Your reviews help other to choose better product", "ar": " تقييمك سوف يساعد الأخرين في اختيار المنتج الأفضل"}, + "shippingAddress": {"en": "SHIPPING ADDRESS", "ar": " عنوان الشحن"}, + "shippedMethod": {"en": "SHIP BY:", "ar": " الشحن بواسطة:"}, + "orderDetail": {"en": "Order Detail", "ar": " تفاصيل الطلب"}, + "orderSummary": {"en": "Order Summary", "ar": " تفاصيل المنتج"}, + "subtotal": {"en": "Subtotal", "ar": " المجموع"}, + "shipping": {"en": "Shipping", "ar": " الشحن"}, + "vat": {"en": "VAT (15%)", "ar": "(15%) القيمة المضافة"}, + "total": {"en": "TOTAL", "ar": " المجموع الكلي"}, + "sar": {"en": "SAR", "ar": " ر.س "}, + "payOnline": {"en": "PAY ONLINE", "ar": "اتمام عملية الدفع "}, + "cancelOrder": {"en": "CANCEL ORDER", "ar": "الغاء الطلب "}, + "confirmAddress": {"en": "CONFIRM ADDRESS ", "ar": " تأكيد العنوان "}, + "confirmLocation": {"en": "CONFIRM LOCATION ", "ar": " تأكيد الموقع "}, + "confirmDeleteMsg": {"en": "Are you sure! want to delete ", "ar": "هل انت متأكد تريد الحذف "}, + "confirmDelete": {"en": "DELETE", "ar": "حذف"}, + "confirmCancellation": {"en": "Are you sure! want to cancel this order ", "ar": "هل انت متأكد تريد حذف هذا المنتج "}, }; diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index d5493d99..348fec58 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -9,8 +9,12 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/wishlist.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/OrderDetails.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/profile/profile.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; +import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -474,7 +478,7 @@ class _HomePageState extends State { ), DashboardItem( onTap: () => Navigator.push( - context, FadePage(page: PharmacyAddressesPage())), + context, FadePage(page: OrderPage())), child: Center( child: Padding( padding: const EdgeInsets.all(15.0), @@ -501,10 +505,6 @@ class _HomePageState extends State { ), height: MediaQuery.of(context).size.width * 0.4, imageName: 'al-habib_onlne_pharmacy_bg.png', - onTap: () { - Navigator.push( - context, FadePage(page: WishlistPage())); - }, ), DashboardItem( child: Center( diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart new file mode 100644 index 00000000..bfbca83f --- /dev/null +++ b/lib/pages/pharmacy/order/Order.dart @@ -0,0 +1,781 @@ +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/order/OrderDetails.dart'; + +class OrderPage extends StatefulWidget { + + @override + _OrderPageState createState() => _OrderPageState(); +} + +class _OrderPageState extends State with SingleTickerProviderStateMixin{ + TabController _tabController; + AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) => getOrder()); + + super.initState(); + _tabController = new TabController(length: 4, vsync: this,); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text(TranslationBase.of(context).order, style: TextStyle(color:Colors.white)), + backgroundColor: Colors.green, + ), + body: Container( + child: Column( + children: [ + TabBar( + tabs: [ + Tab(text: TranslationBase.of(context).delivered), + Tab(text: TranslationBase.of(context).processing), + Tab(text: TranslationBase.of(context).pending), + Tab(text: TranslationBase.of(context).cancelled), + ], + controller: _tabController, + ), + Divider( + color: Colors.grey[350], + height: 10, + thickness: 6, + indent: 0, + endIndent: 0, + ), + Expanded( + child: new TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + getDeliveredOrder(), + getProcessingOrder(), + getPendingOrder(), + getCancelledOrder(), + ], + controller: _tabController, + ), + ), + ], + ), + ), + ); + } + + Widget getDeliveredOrder(){ + return Container( + width: MediaQuery.of(context).size.width, + child: SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: 2 , + itemBuilder: (context, index){ + return Container( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Order#:', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text('3183', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Date', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text('Aug 12, 2020', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage())); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.blue[700], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.blue[700], + borderRadius: BorderRadius.circular(30.0) + ), + child: Text( + TranslationBase.of(context).delivered, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text('564', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('SAR', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text('12', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('items(s)', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ); + } + ) + ], + ), + ), + ); + } + + Widget getProcessingOrder(){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Order#:', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text('3183', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Date', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text('Aug 12, 2020', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage())); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.green, + borderRadius: BorderRadius.circular(30.0) + ), + child: Text( + TranslationBase.of(context).processing, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text('564', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('SAR', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text('12', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('items(s)', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + ); + } + + Widget getPendingOrder(){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: 2 , + itemBuilder: (context, index){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Order#:', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text('3183', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Date', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text('Aug 12, 2020', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all( 8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage())); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all(8.0), + padding: EdgeInsets.only(left: 13.0, right: 13.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange[300], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.orange[300], + borderRadius: BorderRadius.circular(30.0) + ), + child: Text( + TranslationBase.of(context).pending, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text('564', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('SAR', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text('12', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('items(s)', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + + ); + } + ) + ], + ), + ), + ); + } + + Widget getCancelledOrder(){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount: 2 , + itemBuilder: (context, index){ + return Container( + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.all( 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Order#:', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + child: Text('3183', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + child: Text('Date', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + child: Text('Aug 12, 2020', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.all(8.0), + child: InkWell( + onTap: () { + Navigator.push(context, + MaterialPageRoute(builder: (context) => OrderDetailsPage())); + }, + child: SvgPicture.asset( + 'assets/images/pharmacy/arrow_right.svg', + height: 20, + width: 20,), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + padding: EdgeInsets.only(left: 10.0, right: 10.0), + decoration: BoxDecoration( + border: Border.all( + color: Colors.red[900], + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.red[900], + borderRadius: BorderRadius.circular(30.0) + ), + child: Text( + TranslationBase.of(context).cancelled, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 8, right: 8, top: 1, bottom: 8), + child: Column( +// crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text('564', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('SAR', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + SizedBox( + height: 5,), + Row( + children: [ + Container( + child: Text('12', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('items(s)', + style: TextStyle(fontSize: 14.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + ], + ), + ), + + ); + } + ) + ], + ), + ), + ); + } +} + + +getOrder() { + print("getOrder no4665"); + OrderService service = new OrderService(); + service.getOrder(AppGlobal.context).then((res) { + print(res); + }); + +} + +// filterOrders() { +// for () { +// if (order.order_status_id === 30 || order.order_status_id === 997 || order.order_status_id === 994) { // complete +// this.delivered.push(order); +// } else if (order.order_status_id === 40 || order.order_status_id === 200 || order.order_status_id === 996) { // cancelled & order refunded +// this.cancelled.push(order); +// } else if (order.order_status_id === 10) { // Pending +// this.pending.push(order); +// } else if (order.order_status_id === 20 || order.order_status_id === 995 || order.order_status_id === 998 || order.order_status_id === 999) { // Processing +// this.processing.push(order); +// } else { // Processing & other all other status +// this.other.push(order); +// } +// } +//} + + + diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart new file mode 100644 index 00000000..777ef1dd --- /dev/null +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -0,0 +1,467 @@ + +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.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'; + + + +class OrderDetailsPage extends StatefulWidget { + + @override + _OrderDetailsPageState createState() => _OrderDetailsPageState(); +} + +class _OrderDetailsPageState extends State { + AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) => getOrderDetails()); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text(TranslationBase.of(context).orderDetail, style: TextStyle(color:Colors.white)), + backgroundColor: Colors.green, + ), + body: Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + 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: Colors.blue, + style: BorderStyle.solid, + width: 5.0, + ), + color: Colors.blue, + borderRadius: BorderRadius.circular(30.0) + ), + child: Text( + 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('NAME', + 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('Cloud Solutions', + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, + color: Colors.grey, + ), + ), + ], + ), + ), + Row( + 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,), + ), + Container( + margin: EdgeInsets.only(top: 5.0, bottom: 5.0), + child: Text('588888778', + style: TextStyle(fontSize: 15.0, + ), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 1, + indent: 0, + endIndent: 0, + ), + Row( + 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,), + ), + Container( + margin: EdgeInsets.all(10.0), + child:Text(TranslationBase.of(context).shippedMethod, + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/hmg_shipping_logo.svg', + height: 25, + width: 25,), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + 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,), + ), + Container( + margin: EdgeInsets.all(10.0), + child: SvgPicture.asset( + 'assets/images/pharmacy/credit_card_icon.svg', + height: 20, + width: 20,), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0, top: 10.0), + child:Text('Mada', + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 8, + indent: 0, + endIndent: 0, + ), + Container( + padding: EdgeInsets.only(bottom: 15.0), + margin: EdgeInsets.only(left: 10.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(TranslationBase.of(context).orderDetail, + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Container( + child: productTile(productName: 'Panadol Extra 500 MG', productPrice: '10.00', productRate: 3.00, + productReviews:4, totalPrice: '10.00', qyt: '3',), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(left: 10.0, top: 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(TranslationBase.of(context).orderSummary, + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0 ), + child: Text( + TranslationBase.of(context).subtotal, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 13.0, + ), + ), + ), + Text('343.55', + style: TextStyle(fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0, left: 10.0 ), + child: Text( + TranslationBase.of(context).shipping, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 13.0, + ), + ), + ), + Text('343.55', + style: TextStyle(fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.only(top: 5.0,left: 10.0 ), + child: Text( + TranslationBase.of(context).vat, + style: TextStyle( + fontSize: 13.0, + ), + ), + ), + Container( + padding: EdgeInsets.only(bottom: 10.0), + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 13.0, + ), + ), + ), + Text('343.55', + style: TextStyle(fontSize: 13.0, + ), + ), + ], + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + margin: EdgeInsets.only(top: 5.0,left: 10.0 ), + child: Text( + TranslationBase.of(context).total, + style: TextStyle( + fontSize: 15.0,fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 5.0, 5.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.0), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 15.0,fontWeight: FontWeight.bold, + ), + ), + ), + Text('343.55', + style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ], + ), + InkWell( + onTap: (){ + }, + child: Container( + margin: EdgeInsets.only(top: 20.0), + height: 50.0, + color: Colors.transparent, + child: Container( + 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, + ), + ), + ), + ), + ), + ), + InkWell( + onTap: () { +// confirmDelete(snapshot.data[index]["id"]); + cancelOrder("id"); + }, + child: Container( + 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 + ), + ), + ), + ), + ), + ], + ), + ), + ), + ); + } + cancelOrder(id){ + showDialog( + context: context, + builder: (BuildContext context)=> AlertDialog( + title: Text(TranslationBase.of(context).confirm, + style: TextStyle( + fontWeight: FontWeight.bold, + ),), + content: Text(TranslationBase.of(context).confirmCancellation, + style: TextStyle( + color: Colors.grey, + ),), + actions:[ + FlatButton( + child: Text(TranslationBase.of(context).cancel, + style: TextStyle( + color: Colors.red, + fontWeight: FontWeight.bold, + fontSize: 16, + ),), + onPressed: (){ + Navigator.pop(context); + }, + ), + FlatButton( + child: Text(TranslationBase.of(context).ok, + style: TextStyle( + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 16, + ),), + onPressed: (){ +// http.delete(""https://uat.hmgwebservices.com/epharmacy/api/orders/$id"); + Navigator.push(context, + MaterialPageRoute(builder: (context)=> OrderDetailsPage())); + }, + ), + ], + ) + ); + } +} + + getOrderDetails() { + print("getOrderDetails 5466"); + OrderDetailsService service = new OrderDetailsService(); + service.getOrderDetails(AppGlobal.context).then((res) { + print(res); + }); + } + + + getPayOrder(){ + + } diff --git a/lib/pages/pharmacy/order/ProductReview.dart b/lib/pages/pharmacy/order/ProductReview.dart new file mode 100644 index 00000000..9de67849 --- /dev/null +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -0,0 +1,312 @@ +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/widgets//pharmacy/product_tile.dart'; + +class ProductReviewPage extends StatefulWidget { + + @override + _ProductReviewPageState createState() => _ProductReviewPageState(); +} + +class _ProductReviewPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text(TranslationBase.of(context).writeReview, style: TextStyle(color:Colors.white)), + backgroundColor: Colors.green, + ), + 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: Image( + image: + AssetImage('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('medication name', + style: TextStyle(fontSize: 16.0, + ), + ), + ], + ), + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text('90.00', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('SAR', + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + Row( + children: [ + Container( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + child: RatingBar.readOnly( + initialRating: 3, + size: 15.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ), + ), + Container( + child: Text('4.9', + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, + ), + ), + ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text('10 (reviews)', + style: TextStyle(fontSize: 12.0, + ), + ), + ), + ], + ), + ], + ), + ), + ], + ), + 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, + ), + ], + ), + ), + 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), + ), + ), + ), + ], + ), + ), + InkWell( + onTap: () { + + }, + 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) + ), + child: Center( + child: Text( + TranslationBase.of(context).shareReview, + style: TextStyle( + color: Colors.white, + fontSize: 16.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ], + ), + ), + ), + ); + } + + //new screen is showing after submitting the review + Widget getReviewedProduct(){ + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/check_icon.svg', + width: 28, + height: 28,), + Container( + margin: EdgeInsets.only(left: 10.0), + 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, + ), + ), + ), + Container( + margin: EdgeInsets.only(bottom: 30.0, top: 30.0 ), + child: SvgPicture.asset( + 'assets/images/pharmacy/success_review_icon.svg', + width: 100, + height: 100,), + ), + Container( + margin: EdgeInsets.only(left: 20.0, right: 20.0), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.start, + 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, + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/quote_end.svg', + width: 15, + height: 15,), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 20.0 ), + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return PharmacyProfilePage(); + }), + ); + }, + child: Container( + height: 50.0, color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.orange, + style: BorderStyle.solid, + width: 1.0 + ), + color: Colors.transparent, + borderRadius: BorderRadius.circular(5.0) + ), + child: Center( + child: Text( + TranslationBase.of(context).backMyAccount, + style: TextStyle( + color: Colors.orange, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), + ), + ], + ); + } +} diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index ac4bfb35..bc19e510 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -1,8 +1,8 @@ import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/style.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; class AddAddressPage extends StatefulWidget { @override @@ -10,48 +10,118 @@ class AddAddressPage extends StatefulWidget { } class _AddAddressState extends State { + + void onMapCreated(controller){ + setState(() { + mapController= controller; + }); + } + void _getAddressFromLatLng() {} + _onMapTypeButtonPressed(){} + _onAddMarkerButtonPressed(){} + + LatLng _initialPosition; + GoogleMapController mapController; + @override + void initState() { + // TODO: implement initState + _initialPosition = LatLng(24.662617030, 46.7334844); + super.initState(); + } + + void _onMapCreated(GoogleMapController controller) { + mapController = controller; + } + + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( centerTitle: true, - title: Text(TranslationBase.of(context).addNewAddress, style: TextStyle(color:Colors.white)), - backgroundColor: Colors.green, + title: Text(TranslationBase.of(context).addNewAddress, style: TextStyle(color:Colors.white)), + backgroundColor: Colors.green, ), - body: Container( - child: Column( - children: [ - Container( - - ), - Container( - height: 50.0, - width: 400.0, - color: Colors.transparent, - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.green, - style: BorderStyle.solid, - width: 1.0 - ), - color: Colors.green, - borderRadius: BorderRadius.circular(10.0) - ), - child: Center( - child: Text( - TranslationBase.of(context).save, - style: TextStyle( - color: Colors.white, - fontSize: 20.0, - fontWeight: FontWeight.bold, - ), - ), + body: Stack( + children: [ + GoogleMap( + zoomControlsEnabled: true, + myLocationButtonEnabled: true, + myLocationEnabled: true, + onMapCreated: _onMapCreated, + onCameraMove: (object) { +// widget.currentLat = object.target.latitude; +// widget.currentLong = object.target.longitude; + }, + onCameraIdle: _getAddressFromLatLng, + padding: EdgeInsets.only(bottom: 90.0), + initialCameraPosition: CameraPosition( + target: _initialPosition, + zoom: 13.0, + ), + ), + Align( + alignment: Alignment.topRight, + child: Column( + children: [ + button(_onMapTypeButtonPressed,Icons.map), + SizedBox( + height:16.0, ), - ), + button(_onAddMarkerButtonPressed, Icons.add_location) + ], ), - ], + ), + ] ), - ), + bottomSheet: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return AddAddressPage(); + }), + ); + }, + child: Container( + height: 50.0, + color: Colors.green, + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: Colors.green, + style: BorderStyle.solid, + width: 1.0 + ), + color: Colors.green, + borderRadius: BorderRadius.circular(10.0) + ), + child: Center( + child: Text(TranslationBase.of(context).confirmLocation, + style: TextStyle( + color: Colors.white, + fontSize: 15.0, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), ); - }} \ No newline at end of file + } + + + Widget button(Function function, IconData icon){ + return FloatingActionButton( + onPressed: function, + materialTapTargetSize: MaterialTapTargetSize.padded, + backgroundColor: Colors.red, + child: Icon( + icon, + size: 18.0, + ),); + } + +} + diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 122fd0da..2de45546 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/AddAddress.dart'; - +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/services/pharmacy_services/pharmacyAddress_service.dart'; class PharmacyAddressesPage extends StatefulWidget{ @override @@ -15,8 +17,14 @@ class _PharmacyAddressesState extends State{ int selectedRadio; bool _value = false; + + AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override void initState(){ + WidgetsBinding.instance.addPostFrameCallback((_) => getAllAddress()); + super.initState(); selectedRadio=0; } @@ -41,11 +49,11 @@ class _PharmacyAddressesState extends State{ scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), - itemCount: 2 , + itemCount: 5 , itemBuilder: (context, index){ return Container( child: Padding( - padding:EdgeInsets.only(top:20.0, left:5.0, right:5.0, bottom:5.0,), + padding:EdgeInsets.only(top:10.0, left:5.0, right:5.0, bottom:5.0,), child: Column( children: [ Row( @@ -174,6 +182,10 @@ class _PharmacyAddressesState extends State{ Column( children: [ InkWell( + onTap: () { +// confirmDelete(snapshot.data[index]["id"]); + confirmDelete("address"); + }, child: Row( children: [ Container( @@ -230,6 +242,7 @@ class _PharmacyAddressesState extends State{ ); }, child: Container( + margin: EdgeInsets.only(bottom: 100.0), height: 50.0, color: Colors.transparent, child: Container( @@ -258,8 +271,99 @@ class _PharmacyAddressesState extends State{ ), ), ), + bottomSheet: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return AddAddressPage(); + }), + ); + }, + child: Container( + height: 50.0, + color: Colors.green, + child: Container( + 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).confirmAddress, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + ), ); } + confirmDelete(address){ + showDialog( + context: context, + builder: (BuildContext context)=> AlertDialog( + title: Text(TranslationBase.of(context).confirmDeleteMsg, + style: TextStyle( + fontWeight: FontWeight.bold, + ),), + content: Text("address"), + actions:[ + FlatButton( + child: Text(TranslationBase.of(context).cancel, + style: TextStyle( + color: Colors.red, + fontWeight: FontWeight.bold, + fontSize: 16, + ),), + onPressed: (){ + Navigator.pop(context); + }, + ), + FlatButton( + child: Text(TranslationBase.of(context).confirmDelete, + style: TextStyle( + color: Colors.grey, + fontWeight: FontWeight.bold, + fontSize: 16, + ),), + onPressed: (){ +// http.delete("https://uat.hmgwebservices.com/epharmacy/api/Customers/272843?fields=addresses/$id"); + Navigator.push(context, + MaterialPageRoute(builder: (context)=> PharmacyAddressesPage() )); + }, + ), + ], + ) + ); + } +} + +getAllAddress() { + print("ADDRESSES"); + PharmacyAddressService service = new PharmacyAddressService(); + service.getAddress(AppGlobal.context).then((res) { + print(res); + }); + +} + + + + getConfirmAddress(){ + + } + getEditAddress(){ + + } + getDeleteAddress(){ } diff --git a/lib/services/pharmacy_services/orderDetails_service.dart b/lib/services/pharmacy_services/orderDetails_service.dart new file mode 100644 index 00000000..b8201dc6 --- /dev/null +++ b/lib/services/pharmacy_services/orderDetails_service.dart @@ -0,0 +1,39 @@ + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.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 OrderDetailsService extends BaseService{ + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getOrderDetails(BuildContext context ) async { + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + dynamic localRes; + String URL; + URL = GET_ORDER_DETAILS; + + await baseAppClient.get(URL, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }); + return Future.value(localRes); + } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/order_service.dart b/lib/services/pharmacy_services/order_service.dart new file mode 100644 index 00000000..6e44a18b --- /dev/null +++ b/lib/services/pharmacy_services/order_service.dart @@ -0,0 +1,38 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.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 OrderService extends BaseService{ + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getOrder(BuildContext context ) async { + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + dynamic localRes; + String URL; + URL = GET_ORDER; + + await baseAppClient.get(URL, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }); + return Future.value(localRes); + } +} \ No newline at end of file diff --git a/lib/services/pharmacy_services/pharmacyAddress_service.dart b/lib/services/pharmacy_services/pharmacyAddress_service.dart new file mode 100644 index 00000000..624dd87e --- /dev/null +++ b/lib/services/pharmacy_services/pharmacyAddress_service.dart @@ -0,0 +1,40 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.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 PharmacyAddressService extends BaseService{ + + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getAddress(BuildContext context ) async { + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + dynamic localRes; + String URL; + +// URL = GET_ADDRESS+'272843?fields=addresses'; + URL = GET_ADDRESS; + + await baseAppClient.get(URL, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }); + return Future.value(localRes); + } +} \ No newline at end of file diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 26f7d93e..37aa6732 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -709,6 +709,33 @@ class TranslationBase { String get addAddress => localizedValues['addAddress'][locale.languageCode]; String get addNewAddress => localizedValues['addNewAddress'][locale.languageCode]; + String get order => localizedValues['order'][locale.languageCode]; + String get delivered => localizedValues['delivered'][locale.languageCode]; + String get processing => localizedValues['processing'][locale.languageCode]; + String get pending => localizedValues['pending'][locale.languageCode]; + String get cancelled => localizedValues['cancelled'][locale.languageCode]; + String get writeReview => localizedValues['writeReview'][locale.languageCode]; + String get shareReview => localizedValues['shareReview'][locale.languageCode]; + String get backMyAccount => localizedValues['backMyAccount'][locale.languageCode]; + String get reviewSuccessful => localizedValues['reviewSuccessful'][locale.languageCode]; + String get reviewShared => localizedValues['reviewShared'][locale.languageCode]; + String get reviewComment => localizedValues['reviewComment'][locale.languageCode]; + String get shippingAddress => localizedValues['shippingAddress'][locale.languageCode]; + String get shippedMethod => localizedValues['shippedMethod'][locale.languageCode]; + String get orderDetail => localizedValues['orderDetail'][locale.languageCode]; + String get orderSummary => localizedValues['orderSummary'][locale.languageCode]; + String get subtotal => localizedValues['subtotal'][locale.languageCode]; + String get shipping => localizedValues['shipping'][locale.languageCode]; + String get vat => localizedValues['vat'][locale.languageCode]; + String get total => localizedValues['total'][locale.languageCode]; + String get sar => localizedValues['sar'][locale.languageCode]; + String get payOnline => localizedValues['payOnline'][locale.languageCode]; + String get cancelOrder => localizedValues['cancelOrder'][locale.languageCode]; + String get confirmAddress => localizedValues['confirmAddress'][locale.languageCode]; + String get confirmLocation => localizedValues['confirmLocation'][locale.languageCode]; + String get confirmDeleteMsg => localizedValues['confirmDeleteMsg'][locale.languageCode]; + String get confirmDelete => localizedValues['confirmDelete'][locale.languageCode]; + String get confirmCancellation => localizedValues['confirmCancellation'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index 3fa93363..e0182f08 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -1,7 +1,10 @@ +import 'package:diplomaticquarterapp/pages/pharmacy/order/ProductReview.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_html/style.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:rating_bar/rating_bar.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -9,13 +12,20 @@ class productTile extends StatelessWidget { final String productName; final String productPrice; final double productRate; + final int productReviews; + final String qyt; + final String totalPrice; + final bool isOrderDetails; - productTile({this.productName, this.productPrice, this.productRate}); + + productTile({this.productName, this.productPrice, this.productRate, + this.qyt, this.totalPrice, this.productReviews, + this.isOrderDetails=true}); @override Widget build(BuildContext context) { return Container( - height: 120, + height: 150, width: double.infinity, color: Colors.white, child: Column( @@ -69,7 +79,7 @@ class productTile extends StatelessWidget { ), ), ), - Container( + this.isOrderDetails == false ? Container( margin: EdgeInsets.all(5), child: Align( alignment: Alignment.topLeft, @@ -84,22 +94,135 @@ class productTile extends StatelessWidget { emptyIcon: Icons.star, ), ), - ), + ): Container(), ], ), ), - Expanded( + this.isOrderDetails == false ? Expanded( flex: 1, - child: Column( + child: Column ( children: [ Icon(FontAwesomeIcons.trashAlt, size: 15), SizedBox(height: 50,), Icon(FontAwesomeIcons.shoppingCart, size: 15), ], ), - ), + ) : Container(), ], ), + this.isOrderDetails == true ?Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( +// margin: EdgeInsets.all(5), + child: RichText( + text: TextSpan( + text: 'QYT: $qyt', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.grey, + fontSize: 13), + ), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + TranslationBase.of(context).total, + style: TextStyle( + color: Colors.grey, + fontSize: 13.0, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + RichText( + text: TextSpan( + text: ' $totalPrice SAR', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: 15), + ), + ), + ], + ), + ], + ), + ], + ), + ): Container(), + this.isOrderDetails == true ?Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: EdgeInsets.all(5), + 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( + margin: EdgeInsets.all(5), + child: Align( + alignment: Alignment.topLeft, + 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, + color: Colors.orange, + ), + ), + ), + ), + ], + ) : Container(), ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 846a264c..0c91972c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -138,6 +138,9 @@ dependencies: #google maps places google_maps_place_picker: ^0.10.0 + #google maps places + google_maps_flutter: ^0.5.28+1 + #Dependencies for video call implementation native_device_orientation: ^0.3.0 enum_to_string: ^1.0.9