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/lib/config/config.dart b/lib/config/config.dart index 52cdd95c..d3fda732 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -368,6 +368,7 @@ const GET_ORDER = "orders?"; const GET_ORDER_DETAILS = "epharmacy/api/orders/"; 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/"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index c3962b5b..c52739f2 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -658,6 +658,7 @@ const Map localizedValues = { "compare": {"en": " Compare", "ar": "مقارنه"}, "medicationsRefill": {"en": " Medication Refill", "ar": "اعادة تعبئة الدواء"}, "myPrescription": {"en": " My Prescriptions", "ar": "وصفاتي"}, + "quantity": {"en": " QTY ", "ar": "الكمية"}, "backMyAccount": { "en": "BACK TO MY ACCOUNT ", "ar": " الرجوع لحسابي الشخصي" @@ -672,7 +673,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": " الشحن"}, diff --git a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart index 04cbe8e3..f3262ba3 100644 --- a/lib/core/viewModels/pharmacyModule/order_model_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/order_model_view_model.dart @@ -1,9 +1,13 @@ -//import 'dart:html'; import 'package:diplomaticquarterapp/core/enum/viewstate.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'; @@ -15,20 +19,24 @@ class OrderModelViewModel extends BaseViewModel { OrderDetailsService _orderDetailsService = locator(); List get orderDetails => _orderDetailsService.orderDetails; + CancelOrderService _cancelOrderService = locator(); + List get cancelOrder => _cancelOrderService.cancelOrderList; - Future getOrder(id, pageId) async { + + 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); } + } Future getOrderDetails(orderId) async { @@ -38,23 +46,47 @@ 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; + } } \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 6d2375e7..c9ecdb06 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/home_ import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.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'; @@ -173,6 +174,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..f153dd35 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; @@ -11,17 +12,24 @@ 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'; + 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 = [] ; @@ -31,19 +39,23 @@ class _OrderPageState extends State with SingleTickerProviderStateMix TabController _tabController; AppSharedPreferences sharedPref = AppSharedPreferences(); + getLanguageID() async { + return await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + } @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, @@ -181,7 +193,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix indent: 0, endIndent: 0, ), - Row( + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( @@ -196,7 +208,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 +217,15 @@ class _OrderPageState extends State with SingleTickerProviderStateMix fontSize: 15.0, fontWeight: FontWeight.bold, ), - ), + ) + : Text( + deliveredOrderList[index].orderStatus.toString().substring(12), + 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 +1094,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..57cddeca 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:diplomaticquarterapp/widgets//pharmacy/product_tile.dart'; import 'package:diplomaticquarterapp/config/config.dart'; @@ -19,11 +20,11 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart'; + class OrderDetailsPage extends StatefulWidget { var languageID ; - OrderModel orderModel; OrderDetailsPage({ @required this.orderModel @@ -34,10 +35,18 @@ class OrderDetailsPage extends StatefulWidget { } class _OrderDetailsPageState extends State { + + getLanguageID() async { + return await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + } + AppSharedPreferences sharedPref = AppSharedPreferences(); - String customerId=""; - String page_id=""; - String orderId="3516"; + String orderId=""; + + String customerId; + List orderList = [] ; + List cancelledOrderList = []; +// String orderId="3516"; var model; var isCancel = false; var isRefund = false; @@ -48,10 +57,10 @@ class _OrderDetailsPageState extends State { @override void initState() { super.initState(); + print(widget.orderModel.orderItems.length); getLanguageID(); - getCancelOrder(widget.orderModel.id); -// cancelOrderDetail(widget.orderModel.id); +// cancelOrderDetail(order) } @override @@ -98,10 +107,11 @@ class _OrderDetailsPageState extends State { 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) , + 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, @@ -117,7 +127,7 @@ class _OrderDetailsPageState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(model.order[0].shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9), + Text(widget.orderModel.shippingAddress.firstName.toString().substring(10) + ' ' +model.order[0].shippingAddress.lastName.toString().substring(9), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, ), ), @@ -125,12 +135,12 @@ class _OrderDetailsPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0), + margin: EdgeInsets.fromLTRB(11.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, + Text(widget.orderModel.shippingAddress.address1.toString().substring(9), + style: TextStyle(fontSize: 11.0, fontWeight: FontWeight.bold, color: Colors.grey, ), ), @@ -142,8 +152,10 @@ class _OrderDetailsPageState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(model.order[0].shippingAddress.address2.toString().substring(9), - style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, + 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, ), ), @@ -161,7 +173,7 @@ class _OrderDetailsPageState extends State { ), Container( margin: EdgeInsets.only(top: 5.0, bottom: 5.0), - child: Text(model.order[0].shippingAddress.phoneNumber.toString(), + child: Text(widget.orderModel.shippingAddress.phoneNumber.toString(), style: TextStyle(fontSize: 15.0, ), ), @@ -193,7 +205,7 @@ class _OrderDetailsPageState extends State { ), ), Container( - child: model.order[0].shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" + child: widget.orderModel.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight" ? Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), child: SvgPicture.asset( @@ -236,7 +248,7 @@ class _OrderDetailsPageState extends State { ), Container( margin: EdgeInsets.only(bottom: 10.0, top: 10.0), - child:Text(model.order[0].paymentName.toString().substring(12), + child:Text(widget.orderModel.paymentName.toString().substring(12), style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold, ), ), @@ -274,8 +286,11 @@ 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(), + img:widget.orderModel.orderItems[index].product.images[0].src.toString(), + status: widget.orderModel.orderStatusId,), ); } ), @@ -318,7 +333,7 @@ class _OrderDetailsPageState extends State { ), ), ), - Text(model.order[0].orderSubtotalExclTax.toString(), + Text(widget.orderModel.orderSubtotalExclTax.toString(), style: TextStyle(fontSize: 13.0, ), ), @@ -352,7 +367,7 @@ class _OrderDetailsPageState extends State { ), ), ), - Text(model.order[0].orderShippingExclTax.toString(), + Text(widget.orderModel.orderShippingExclTax.toString(), style: TextStyle(fontSize: 13.0, ), ), @@ -418,7 +433,7 @@ class _OrderDetailsPageState extends State { ), ), ), - Text(model.order[0].orderTotal.toString(), + Text(widget.orderModel.orderTotal.toString(), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, ), ), @@ -428,8 +443,9 @@ class _OrderDetailsPageState extends State { ], ), widget.orderModel.orderStatusId == 10 ? InkWell( - onTap: (){ - // payOnline link + onTap: () { +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => InAppBrowser())); }, child: Container( // margin: EdgeInsets.only(top: 20.0), @@ -458,12 +474,11 @@ class _OrderDetailsPageState extends State { ), ), ) : Container(), - // getCancelOrder(canCancel, canRefund), isCancel ? InkWell( onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => presentConfirmDialog())); + presentConfirmDialog(model,widget.orderModel.id);//(widget.orderModel.id)); +// }, child: Container( // padding: EdgeInsets.only(left: 13.0, right: 13.0, top: 5.0), @@ -537,37 +552,40 @@ class _OrderDetailsPageState extends State { } } - 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) - }, - cancelFunction: () => {}); + 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..37ede97c 100644 --- a/lib/pages/pharmacy/order/ProductReview.dart +++ b/lib/pages/pharmacy/order/ProductReview.dart @@ -1,19 +1,21 @@ + 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:rating_bar/rating_bar.dart'; class ProductReviewPage extends StatefulWidget { + OrderModel orderModel; + ProductReviewPage({ + @required this.orderModel + }); @override _ProductReviewPageState createState() => _ProductReviewPageState(); } @@ -26,193 +28,212 @@ class _ProductReviewPageState extends State { String submitTxt =""; var doctorRating= ""; var reviewObj = {}; + AppSharedPreferences sharedPref = AppSharedPreferences(); @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model)=>model.getProductReview(orderId), + onModelReady: (model)=>model.getOrderDetails(widget.orderModel.id), 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(), + body: Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + itemCount:widget.orderModel.orderItems.length, + itemBuilder: (context, index){ + return Container( + margin: EdgeInsets.only(top :15.0, bottom: 15.0), + child: Row( + children:[ + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Container( + margin: EdgeInsets.only(left: 10), + child: SvgPicture.asset( +// widget.orderModel.orderItems[index].product.images[index].src.toString(), 'assets/images/al-habib_onlne_pharmacy_bg.png', - fit: BoxFit.cover, - width: 80, - height: 80, + 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, + ), + ] ), - ), - ], - ), - 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, + ], + ), + Column( + children: [ + Row( + children: [ + Text(widget.orderModel.orderItems[index].product.name.toString(), + style: TextStyle(fontSize: 16.0, + ), ), - ), + ], ), - Container( - margin: EdgeInsets.only(left: 5), - child: Text(TranslationBase.of(context).sar, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + Row( + children: [ + Container( + margin: EdgeInsets.only(left: 5), + child: Text(widget.orderModel.orderItems[index].product.price.toString(), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), ), - ), - ), - ], - ), - 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( + margin: EdgeInsets.only(left: 5), + child: Text(TranslationBase.of(context).sar, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, + ), + ), ), - ), + ], ), - Container( - child: Text(model.order[0].orderItems[0].product.approvedRatingSum.toString(), - style: TextStyle(fontSize: 14.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( - 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: Text(widget.orderModel.orderItems[index].product.approvedRatingSum.toString(), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, + ), + ), ), - ), + Container( + margin: EdgeInsets.only(left: 5), + child: Text("(" + widget.orderModel.orderItems[index].product.approvedTotalReviews.toString() + + ' ' + TranslationBase.of(context).review +")", + 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, - ), - ], + ]), + + 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), - ), - ), + ], + ), + ), + 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: () { + ], + ), + ), + 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 - ), + }, + child: Container( + height: 50.0, + width: 400.0, + color: Colors.transparent, + child: Container( + decoration: BoxDecoration( + border: Border.all( color: Colors.yellow[700], - borderRadius: BorderRadius.circular(5.0) + style: BorderStyle.solid, + width: 1.0 ), - child: Center( - child: Text( - TranslationBase.of(context).shareReview, - style: TextStyle( - color: Colors.white, - fontSize: 16.0, - fontWeight: FontWeight.bold, - ), - ), + 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, ), ), ), ), - ], - ), + ), ), - ),), - ); + ], + ), + ), + ),), + ); } @@ -346,4 +367,4 @@ class _ProductReviewPageState extends State { submitProductReview(){ } -} +} \ No newline at end of file diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 0336370c..e52d059b 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -1,21 +1,18 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.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/medical/prescriptions/prescriptions_home_page.dart'; +import 'package:diplomaticquarterapp/pages/pharmacies/screens/lakum-main-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/widgets/avatar/large_avatar.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.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'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; - +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; class PharmacyProfilePage extends StatefulWidget { @override @@ -24,416 +21,501 @@ 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; + _ProfilePageState({this.customerId}); + + 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()); + }); +// this.isLogin = user != null; + } + void initState() { + getCustomer(); + super.initState(); + getUser(); + } @override Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) => model.getOrder(customerId, page_id), - builder: (_,model, wi )=> AppScaffold( - appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: true, - isPharmacy:true , - body: Container( - child:SingleChildScrollView( - child: Column( - children:[ - Container( - child:Row( - children: [ - Container( - padding:EdgeInsets.only(top:20.0, left:10.0, right:10.0, bottom:10.0,), - child: LargeAvatar(name: "profile", url:'' ,), - ), - Container( - child: Column( + return AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar: true, + isPharmacy: true, + body: Container( + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Row( + children: [ +// Container( +// padding:EdgeInsets.only(top:20.0, left:10.0, right:10.0, bottom:10.0,), +// child: LargeAvatar( +// name: "", +// url: "" ,), +// ), + Row( + children: [ + Column( + children: [ + Container( + padding:EdgeInsets.only(top:10.0, left:10.0, right:10.0, bottom:15.0,), + child: SvgPicture.asset( + 'assets/images/pharmacy/user.svg', + width: 60, + height: 60, + ), + ),] + ), + Column( + crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( TranslationBase.of(context).welcome, - style: TextStyle(fontSize: 14.0, + style: TextStyle( + fontSize: 14.0, fontWeight: FontWeight.bold, - color:Colors.grey - ), + color: Colors.grey), ), - Text("Name", -// model.order[0].customer.firstName.toString(), + Text( + user.firstName.toString()+ " " + user.lastName.toString(), style: TextStyle( - fontSize: 16.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: () { - 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,), - ), - ], - ), + ), + 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(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, ), - ), - 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, - 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: 5, ), - ), - Expanded( - child: InkWell( - 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,), - ), - ], + Text( + TranslationBase.of(context).orders, + 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())); + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LakumMainPage())); }, - 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, + 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), + ), + ], ), - InkWell( - onTap: () { - Navigator.push(context, - MaterialPageRoute(builder: (context) => MyFamily())); - }, - 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, - ), + ), + ), + 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: 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, - ), + ), + ), + Expanded( + child: InkWell( + 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, ), - ], - ), - ), - 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: 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) => MyFamily())); + }, + 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) => PharmacyAddressesPage())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/shipping_addresses_icon.svg', - width: 30, - height: 30,), - SizedBox( - width: 20, + ), + 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, ), - 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) => 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: 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), - ), - ], - ), - ) - ], - ), - ) - ], - ), + ) + ], + ), + ) + ], ), ), ), ); - }} - - - - + } +// getUser() async { +// var userData = await sharedPref.getObject(USER_PROFILE); +// if (userData != null) user = AuthenticatedUser.fromJson(userData); +// } +} 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..5adbbc24 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) { 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 7be0a051..d10cb542 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -773,6 +773,7 @@ class TranslationBase { 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]; // pharmacy module diff --git a/lib/widgets/pharmacy/product_tile.dart b/lib/widgets/pharmacy/product_tile.dart index f16ff7e5..b56fc625 100644 --- a/lib/widgets/pharmacy/product_tile.dart +++ b/lib/widgets/pharmacy/product_tile.dart @@ -17,11 +17,14 @@ class productTile extends StatelessWidget { final String qyt; final String totalPrice; final bool isOrderDetails; + final String img; + final int status; productTile({this.productName, this.productPrice, this.productRate, - this.qyt, this.totalPrice, this.productReviews, - this.isOrderDetails=true}); + this.qyt, this.totalPrice, this.productReviews, this.img, + this.isOrderDetails=true, this.status}); + @override Widget build(BuildContext context) { @@ -37,13 +40,10 @@ class productTile extends StatelessWidget { 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, - ), + child: Image.network(img), +// fit: BoxFit.cover, + width: 80, + height: 80, ), Expanded( flex: 5, @@ -119,7 +119,7 @@ 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, @@ -163,8 +163,8 @@ class productTile extends StatelessWidget { ), ): Container(), // this.isOrderDetails == true && model.order[0].orderStatusId == 30? - this.isOrderDetails == true? - Expanded( + + if(status ==30 && this.isOrderDetails == true ) Expanded( child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ @@ -227,7 +227,7 @@ class productTile extends StatelessWidget { ), ], ), - ) : Container(), + ), ], ), );