From 777d88be3078f0f26716e7825e08a6166d896a50 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 14 Nov 2021 15:49:25 +0300 Subject: [PATCH 01/15] updates --- lib/pages/landing/landing_page_pharmcy.dart | 2 +- lib/pages/pharmacy/order/Order.dart | 6 +- lib/pages/pharmacy/profile/profile.dart | 100 ++++++------------ .../product_detail_service.dart | 4 +- 4 files changed, 37 insertions(+), 75 deletions(-) diff --git a/lib/pages/landing/landing_page_pharmcy.dart b/lib/pages/landing/landing_page_pharmcy.dart index 9e650966..c90a317a 100644 --- a/lib/pages/landing/landing_page_pharmcy.dart +++ b/lib/pages/landing/landing_page_pharmcy.dart @@ -76,7 +76,7 @@ class _LandingPagePharmacyState extends State { children: [ PharmacyPage(), PharmacyCategorisePage(), - PharmacyProfilePage(), + PharmacyProfilePage(moveToOrder: false), CartOrderPage(changeTab: changeCurrentTab), ], ), diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 4a5e92f5..a9ef2d1f 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -1009,11 +1009,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix children: [ InkWell( onTap: () { - Navigator.push(context, FadePage(page: OrderDetailsPage(orderModel: cancelledOrderList[index]))).then((value) { - model.getOrder(widget.customerID, widget.customerGUID, pageID).then((value) { - getCancelledOrder(model); - }); - }); + Navigator.push(context, FadePage(page: OrderDetailsPage(orderModel: cancelledOrderList[index]))); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index ad3014e6..74f4662d 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -29,6 +29,10 @@ import 'package:flutter_svg/flutter_svg.dart'; dynamic languageID; class PharmacyProfilePage extends StatefulWidget { + final bool moveToOrder; + + PharmacyProfilePage({@required this.moveToOrder}); + @override _ProfilePageState createState() => _ProfilePageState(); } @@ -89,17 +93,20 @@ class _ProfilePageState extends State { getLanguageID(); super.initState(); getUser(); + if (widget.moveToOrder) { + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + } } @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); - GifLoaderDialogUtils.showMyDialog(context); - model.getOrder(customerId, customerGUID, page_id); - GifLoaderDialogUtils.hideDialog(context); + // var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + // var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + // GifLoaderDialogUtils.showMyDialog(context); + // model.getOrder(customerId, customerGUID, page_id); + // GifLoaderDialogUtils.hideDialog(context); }, builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).myAccount, @@ -220,9 +227,7 @@ class _ProfilePageState extends State { ), Text( TranslationBase.of(context).lakum, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), ), ], ), @@ -231,8 +236,7 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: WishlistPage())); + Navigator.push(context, FadePage(page: WishlistPage())); }, child: Column( children: [ @@ -258,8 +262,7 @@ class _ProfilePageState extends State { Expanded( child: InkWell( onTap: () { - Navigator.push(context, - FadePage(page: MyReviewsPage())); + Navigator.push(context, FadePage(page: MyReviewsPage())); }, child: Column( children: [ @@ -304,9 +307,7 @@ class _ProfilePageState extends State { children: [ Text( TranslationBase.of(context).myAccount, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), ), SizedBox( height: 10, @@ -317,10 +318,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage())); + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); }, child: Row( children: [ @@ -333,8 +331,7 @@ class _ProfilePageState extends State { width: 15, ), Text( - TranslationBase.of(context) - .myPrescription, + TranslationBase.of(context).myPrescription, style: TextStyle( fontSize: 13.0, ), @@ -351,15 +348,11 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, - FadePage(page: ComparePage())); + Navigator.push(context, FadePage(page: ComparePage())); }, child: Row( children: [ - Image.asset( - 'assets/images/pharmacy/compare.png', - width: 35, - height: 35), + Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), SizedBox( width: 15, ), @@ -381,10 +374,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage())); + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); }, child: Row( children: [ @@ -397,8 +387,7 @@ class _ProfilePageState extends State { width: 20, ), Text( - TranslationBase.of(context) - .medicationsRefill, + TranslationBase.of(context).medicationsRefill, style: TextStyle( fontSize: 13.0, ), @@ -415,8 +404,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, FadePage(page: MyFamily())); + Navigator.push(context, FadePage(page: MyFamily())); }, child: Row( children: [ @@ -446,10 +434,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyAddressesPage())); + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); }, child: Row( children: [ @@ -462,8 +447,7 @@ class _ProfilePageState extends State { width: 20, ), Text( - TranslationBase.of(context) - .shippingAddresses, + TranslationBase.of(context).shippingAddresses, style: TextStyle( fontSize: 13.0, ), @@ -480,10 +464,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: PharmacyTermsConditions())); + Navigator.push(context, FadePage(page: PharmacyTermsConditions())); }, child: Row( children: [ @@ -496,8 +477,7 @@ class _ProfilePageState extends State { width: 10, ), Text( - TranslationBase.of(context) - .conditionsHMG, + TranslationBase.of(context).conditionsHMG, style: TextStyle( fontSize: 13.0, ), @@ -514,15 +494,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push( - context, - FadePage( - page: LakumTermsConditions( - this.identificationNo, - this.firstName, - this.lastName, - this.mobileNo, - this.languageId))); + Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId))); }, child: Row( children: [ @@ -537,8 +509,7 @@ class _ProfilePageState extends State { width: 10, ), Text( - TranslationBase.of(context) - .conditions, + TranslationBase.of(context).conditions, style: TextStyle( fontSize: 13.0, ), @@ -569,9 +540,7 @@ class _ProfilePageState extends State { children: [ Text( TranslationBase.of(context).reachUs, - style: TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), ), SizedBox( height: 5, @@ -582,8 +551,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, - FadePage(page: LiveChatPage())); + Navigator.push(context, FadePage(page: LiveChatPage())); }, child: Row( children: [ @@ -611,8 +579,7 @@ class _ProfilePageState extends State { ), InkWell( onTap: () { - Navigator.push(context, - FadePage(page: FindUsPage())); + Navigator.push(context, FadePage(page: FindUsPage())); }, child: Row( children: [ @@ -625,8 +592,7 @@ class _ProfilePageState extends State { width: 20, ), Text( - TranslationBase.of(context) - .ourLocations, + TranslationBase.of(context).ourLocations, style: TextStyle(fontSize: 13.0), ), ], diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index e3e0fb7f..5599fc87 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -58,8 +58,8 @@ class ProductDetailService extends BaseService { _stockAvailability = response['products'][0]['stock_availability']; _stockAvailabilityn = response['products'][0]['stock_availabilityn']; - // _isStockAvailable = response['products'][0]['IsStockAvailable']; - _isStockAvailable = _stockAvailability == "In stock" ? true : false; + _isStockAvailable = response['products'][0]['IsStockAvailable']; + // _isStockAvailable = _stockAvailability == "In stock" ? true : false; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; From 69b1dd65337b9b9929eeba3ac8c33249b481d3da Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Mon, 15 Nov 2021 09:57:28 +0300 Subject: [PATCH 02/15] Medical Reminder --- lib/config/config.dart | 4 +- .../prescription_details_page.dart | 84 +++++++++---------- lib/uitl/LocalNotification.dart | 30 +++---- 3 files changed, 58 insertions(+), 60 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 75de78f4..ceccdc44 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -15,8 +15,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 5a47ec3b..ca17947a 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -32,7 +33,6 @@ class PrescriptionDetailsPage extends StatelessWidget { return AppScaffold( isShowAppBar: true, showNewAppBar: true, - backgroundColor: Color(0xffF8F8F8), showNewAppBarTitle: true, appBarTitle: TranslationBase.of(context).prescriptions, body: Column( @@ -197,49 +197,24 @@ class PrescriptionDetailsPage extends StatelessWidget { child: DefaultButton( TranslationBase.of(context).addReminder, () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - - showReminderDialog( - context, - endDate, - "", - prescriptionReport.itemID.toString(), - "", - "", - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - onSuccess: () { - AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - }, - ); - return; - - showGeneralDialog( - barrierColor: Colors.black.withOpacity(0.5), - transitionBuilder: (context, a1, a2, widget) { - final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; - return Transform( - transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), - child: Opacity( - opacity: a1.value, - child: PrescriptionReminderDialog( - eventId: prescriptionReport.itemID.toString(), - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - startDate: startDate, - endDate: endDate, - location: prescriptionReport.remarks, - days: 1, - ), - ), - ); - }, - transitionDuration: Duration(milliseconds: 500), - barrierDismissible: true, - barrierLabel: '', - context: context, - pageBuilder: (context, animation1, animation2) {}); + setTheNotificatoin(context); + // DateTime startDate = DateTime.now(); + // DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); + // + // showReminderDialog( + // context, + // endDate, + // "", + // prescriptionReport.itemID.toString(), + // "", + // "", + // title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + // description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + // onSuccess: () { + // AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + // }, + // ); + // return; }, iconData: Icons.notifications_active, color: Color(0xffD02127), @@ -253,4 +228,25 @@ class PrescriptionDetailsPage extends StatelessWidget { ), ); } + + setTheNotificatoin(BuildContext context) { + DateTime startDate = DateUtil.convertStringToDate(prescriptionReport.startDate); + DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); + if(prescriptionReport?.frequencyNumber==null) + prescriptionReport.frequencyNumber=2; + + for (int i = 0; i < prescriptionReport.days; i++) { + for (int j = 0; j < prescriptionReport.frequencyNumber??2; j++) { + if (j != 0) { + actualDate.add(new Duration(hours: 8)); + } + LocalNotification.getInstance().scheduleNotification( + scheduledNotificationDateTime: actualDate, + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} "); + } + actualDate.add(new Duration(days: i + 1)); + } + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + } } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index f1c6442f..5488d39b 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -10,15 +10,17 @@ final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterL class LocalNotification { Function(String payload) _onNotificationClick; static LocalNotification _instance; - static LocalNotification getInstance(){ + + static LocalNotification getInstance() { return _instance; } - static init({Function(String payload) onNotificationClick}){ - if(_instance == null){ + + static init({Function(String payload) onNotificationClick}) { + if (_instance == null) { _instance = LocalNotification(); _instance._onNotificationClick = onNotificationClick; _instance._initialize(); - }else{ + } else { // assert(false,(){ // //TODO fix it // "LocalNotification Already Initialized"; @@ -26,7 +28,7 @@ class LocalNotification { } } - _initialize(){ + _initialize() { var initializationSettingsAndroid = new AndroidInitializationSettings('app_icon'); var initializationSettingsIOS = IOSInitializationSettings(onDidReceiveLocalNotification: null); var initializationSettings = InitializationSettings(initializationSettingsAndroid, initializationSettingsIOS); @@ -34,11 +36,12 @@ class LocalNotification { } var _random = new Random(); - _randomNumber({int from = 100000}){ + + _randomNumber({int from = 100000}) { return _random.nextInt(from); } - _vibrationPattern(){ + _vibrationPattern() { var vibrationPattern = Int64List(4); vibrationPattern[0] = 0; vibrationPattern[1] = 1000; @@ -50,10 +53,11 @@ class LocalNotification { Future showNow({@required String title, @required String subtitle, String payload}) { Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); + var androidPlatformChannelSpecifics = + AndroidNotificationDetails('com.hmg.local_notification', 'HMG', 'HMG', importance: Importance.Max, priority: Priority.High, ticker: 'ticker', vibrationPattern: _vibrationPattern()); var iOSPlatformChannelSpecifics = IOSNotificationDetails(); var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err){ + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { print(err); }); }); @@ -81,11 +85,9 @@ class LocalNotification { ledOffMs: 500); var iOSPlatformChannelSpecifics = IOSNotificationDetails(sound: 'slow_spring_board.aiff'); - ///change it to be as ionic - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.schedule(0, title, description, - // scheduledNotificationDateTime, platformChannelSpecifics); + // /change it to be as ionic + var platformChannelSpecifics = NotificationDetails(androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); } ///Repeat notification every day at approximately 10:00:00 am From 61a406085b04182ef939b1598998184dfbef1536 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 15 Nov 2021 10:52:01 +0300 Subject: [PATCH 03/15] lakum fixes --- .../pharmacyModule/lacum-viewmodel.dart | 6 +-- .../pharmacies/screens/lakum-main-page.dart | 29 +++++------ .../screens/payment-method-select-page.dart | 52 +++++++------------ .../widgets/lacum-banner-widget.dart | 16 +++--- lib/pages/pharmacy/order/Order.dart | 42 ++++++--------- .../pharmacyAddresses/AddAddress.dart | 2 +- 6 files changed, 63 insertions(+), 84 deletions(-) diff --git a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart index c03e8e87..1bd0d542 100644 --- a/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart +++ b/lib/core/viewModels/pharmacyModule/lacum-viewmodel.dart @@ -1,5 +1,5 @@ import 'dart:async'; -import 'dart:convert' as convert; +import 'dart:convert'; import 'dart:typed_data'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; @@ -92,8 +92,8 @@ class LacumViewModel extends BaseViewModel { Uint8List convertBase64ToBarCodeImage() { try { - final _byteImage = convert.base64Decode( - lacumGroupInformation.lakumInquiryInformationObjVersion.barCode); + final _byteImage = base64Decode( + lacumGroupInformation.lakumInquiryInformationObjVersion.barCode.split(',').last); return _byteImage; } catch (e) { print(e); diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index c4415852..dcee8398 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -69,16 +69,15 @@ class LakumMainPage extends StatelessWidget { ], ), SizedBox( - width: 8, + height: 12, ), - LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear), + LakumHomeButtons(mediaQuery, model), SizedBox( - height: 20, + height: 12, ), Container( - height: 125, - margin: EdgeInsets.symmetric(horizontal: 16), + height: 100, + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 12.0), child: ListView( scrollDirection: Axis.horizontal, children: [ @@ -109,15 +108,15 @@ class LakumMainPage extends StatelessWidget { ], ), ), - LacumPointsWidget( - mediaQuery, - 3, - TranslationBase.of(context).consumed, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null - ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) - : 0, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, - model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), + // LacumPointsWidget( + // mediaQuery, + // 3, + // TranslationBase.of(context).consumed, + // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null + // ? int.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount) + // : 0, + // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints, + // model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear), SizedBox( width: 8, ), diff --git a/lib/pages/pharmacies/screens/payment-method-select-page.dart b/lib/pages/pharmacies/screens/payment-method-select-page.dart index 978afae3..53b0357e 100644 --- a/lib/pages/pharmacies/screens/payment-method-select-page.dart +++ b/lib/pages/pharmacies/screens/payment-method-select-page.dart @@ -16,13 +16,10 @@ class PaymentMethodSelectPage extends StatefulWidget { final bool isUpdating; final Function changeMainState; - const PaymentMethodSelectPage( - {Key key, this.model, this.isUpdating = false, this.changeMainState}) - : super(key: key); + const PaymentMethodSelectPage({Key key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key); @override - _PaymentMethodSelectPageState createState() => - _PaymentMethodSelectPageState(); + _PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState(); } class _PaymentMethodSelectPageState extends State { @@ -85,16 +82,17 @@ class _PaymentMethodSelectPageState extends State { selectedPaymentOption = PaymentOption.mastercard; }) }), - PaymentMethodCard( - cardWidth, - selectedPaymentOption, - PaymentOption.installments, - () => { - setState(() { - selectedPaymentOption = - PaymentOption.installments; - }) - }), + widget.model.cartResponse.totalAmount > 1000 + ? PaymentMethodCard( + cardWidth, + selectedPaymentOption, + PaymentOption.installments, + () => { + setState(() { + selectedPaymentOption = PaymentOption.installments; + }) + }) + : Container(), if (Platform.isIOS) PaymentMethodCard( cardWidth, @@ -118,8 +116,7 @@ class _PaymentMethodSelectPageState extends State { TranslationBase.of(context).next, selectedPaymentOption != null ? () { - widget.model.paymentCheckoutData.paymentOption = - selectedPaymentOption; + widget.model.paymentCheckoutData.paymentOption = selectedPaymentOption; if (widget.isUpdating) { widget.changeMainState(); Navigator.pop(context); @@ -150,14 +147,12 @@ class PaymentMethodCard extends StatelessWidget { final PaymentOption paymentOption; final Function selectMethod; - PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, - this.paymentOption, this.selectMethod); + PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod); @override Widget build(BuildContext context) { bool isSelected = false; - if (selectedPaymentOption != null && - selectedPaymentOption == paymentOption) { + if (selectedPaymentOption != null && selectedPaymentOption == paymentOption) { isSelected = true; } @@ -171,9 +166,7 @@ class PaymentMethodCard extends StatelessWidget { color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), - side: isSelected - ? BorderSide(color: Colors.green, width: 2.0) - : BorderSide(color: Colors.transparent, width: 0.0), + side: isSelected ? BorderSide(color: Colors.green, width: 2.0) : BorderSide(color: Colors.transparent, width: 0.0), ), child: Padding( padding: const EdgeInsets.all(12.0), @@ -182,13 +175,7 @@ class PaymentMethodCard extends StatelessWidget { Container( width: 24, height: 24, - decoration: containerColorRadiusBorderWidth( - isSelected - ? CustomColors.accentColor - : Colors.transparent, - 100, - Colors.grey, - 0.5), + decoration: containerColorRadiusBorderWidth(isSelected ? CustomColors.accentColor : Colors.transparent, 100, Colors.grey, 0.5), ), mWidth(12), Container( @@ -200,8 +187,7 @@ class PaymentMethodCard extends StatelessWidget { if (isSelected) Container( decoration: containerRadius(CustomColors.green, 200), - padding: - EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), + padding: EdgeInsets.only(top: 6, bottom: 6, left: 12, right: 12), child: Text( TranslationBase.of(context).paymentSelected, style: TextStyle( diff --git a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart index 7d10b886..60ca4693 100644 --- a/lib/pages/pharmacies/widgets/lacum-banner-widget.dart +++ b/lib/pages/pharmacies/widgets/lacum-banner-widget.dart @@ -229,13 +229,15 @@ class _LakumBannerWidgetState extends State { width: widget.mediaQuery.size.width * 1.0, height: widget.mediaQuery.size.width * 1.0, ), - Container( - margin: EdgeInsets.fromLTRB(12, 70, 12, 4), - child: widget.model.convertBase64ToBarCodeImage() != - null - ? Image.memory( - widget.model.convertBase64ToBarCodeImage()) - : Container(), + Center( + child: Container( + margin: EdgeInsets.fromLTRB(12, 70, 12, 4), + child: widget.model.convertBase64ToBarCodeImage() != + null + ? Image.memory( + widget.model.convertBase64ToBarCodeImage()) + : Container(), + ), ), ], ), diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index d1afd5a8..e859752a 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -217,12 +217,10 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - projectViewModel.isArabic - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -503,12 +501,10 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - projectViewModel.isArabic - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -969,12 +965,10 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - projectViewModel.isArabic - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], @@ -1139,7 +1133,7 @@ class _OrderPageState extends State with SingleTickerProviderStateMix cancelledOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 40 || - model.orders[i].orderStatus == 996 || + model.orders[i].orderStatusId == 996 || model.orders[i].orderStatusId == 200) { cancelledOrderList.add(model.orders[i]); } @@ -1243,12 +1237,10 @@ class _OrderPageState extends State with SingleTickerProviderStateMix ), Container( margin: EdgeInsets.all(8.0), - child: SvgPicture.asset( - projectViewModel.isArabic - ? 'assets/images/pharmacy/arrow_left.svg' - : 'assets/images/pharmacy/arrow_right.svg', - height: 20, - width: 20, + child: Icon( + Icons.arrow_forward, + size: 18, + color: Colors.grey[500], ), ), ], diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 514ea1a5..5e55d537 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -62,7 +62,7 @@ class _AddAddressPageState extends State { return BaseView( builder: (_, model, wi) => AppScaffold( appBarTitle: TranslationBase.of(context).changeAddress, - isShowAppBar: true, + isShowAppBar: false, isPharmacy: true, backgroundColor: Colors.white, body: Container( From 7f8a0320a7725c9938c380b5ec72a9377f66c462 Mon Sep 17 00:00:00 2001 From: devmirza121 Date: Mon, 15 Nov 2021 13:25:36 +0300 Subject: [PATCH 04/15] Medical Reminder 1.0 --- .../widgets/reminder_dialog.dart | 50 +++++--- .../prescription_details_page.dart | 110 +++++++++++++----- 2 files changed, 113 insertions(+), 47 deletions(-) diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 43038658..723bf538 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -14,13 +14,15 @@ Future> requestPermissions() async { } showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {Function onSuccess, String title, String description}) async { + {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { if (await Permission.calendar.request().isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } else { requestPermissions().then((results) { if (results[Permission.calendar].isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, onSuccess: onSuccess, title: title, description: description); + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess); } }); } @@ -29,7 +31,7 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S final CalendarPlugin _myPlugin = CalendarPlugin(); Future _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, - {Function onSuccess, String title, String description}) async { + {Function onSuccess, String title, String description, Function(int) onMultiDateSuccess}) async { return showDialog( context: context, barrierDismissible: true, // user must tap button! @@ -56,16 +58,20 @@ Future _showReminderDialog(BuildContext context, DateTime dateTime, String // dateTime.add(new Duration(minutes: -120)); dateTime = Jiffy(dateTime).subtract(hours: 2); } - CalendarUtils calendarUtils = await CalendarUtils.getInstance(); - calendarUtils - .createOrUpdateEvent( - title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, - description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, - scheduleDateTime: dateTime, - eventId: eventId) - .then((value) {}); + if (onMultiDateSuccess == null) { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + calendarUtils + .createOrUpdateEvent( + title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName, + description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, + scheduleDateTime: dateTime, + eventId: eventId) + .then((value) {}); - onSuccess(); + onSuccess(); + } else { + onMultiDateSuccess(i); + } }, ), ); @@ -144,12 +150,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder30, + Text( + TranslationBase.of(context).appoReminder30, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( @@ -163,12 +171,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder60, + Text( + TranslationBase.of(context).appoReminder60, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( @@ -182,12 +192,14 @@ class _ReminderDialogState extends State { }); }, ), - Text(TranslationBase.of(context).appoReminder90, + Text( + TranslationBase.of(context).appoReminder90, style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, letterSpacing: -0.48, - ),), + ), + ), ], ), Row( diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index ca17947a..d20fbe87 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; +import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; @@ -19,6 +20,7 @@ import 'package:diplomaticquarterapp/widgets/show_zoom_image_dialog.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:jiffy/jiffy.dart'; import 'package:provider/provider.dart'; class PrescriptionDetailsPage extends StatelessWidget { @@ -197,24 +199,26 @@ class PrescriptionDetailsPage extends StatelessWidget { child: DefaultButton( TranslationBase.of(context).addReminder, () { - setTheNotificatoin(context); - // DateTime startDate = DateTime.now(); - // DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - // - // showReminderDialog( - // context, - // endDate, - // "", - // prescriptionReport.itemID.toString(), - // "", - // "", - // title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - // description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - // onSuccess: () { - // AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - // }, - // ); - // return; + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); + + showReminderDialog( + context, + endDate, + "", + prescriptionReport.itemID.toString(), + "", + "", + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + onMultiDateSuccess: (int selectedIndex) { + setCalender(context, prescriptionReport.itemID.toString(), selectedIndex); + }, + ); + return; }, iconData: Icons.notifications_active, color: Color(0xffD02127), @@ -229,24 +233,74 @@ class PrescriptionDetailsPage extends StatelessWidget { ); } - setTheNotificatoin(BuildContext context) { + setCalender(BuildContext context, String eventId, int reminderIndex) async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + DateTime startDate = DateUtil.convertStringToDate(prescriptionReport.startDate); - DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); - if(prescriptionReport?.frequencyNumber==null) - prescriptionReport.frequencyNumber=2; + DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); //Time will start at 8:00 AM from starting date + if (prescriptionReport?.frequencyNumber == null) prescriptionReport.frequencyNumber = 2; //Some time frequency number is null so by default will be 2 for (int i = 0; i < prescriptionReport.days; i++) { - for (int j = 0; j < prescriptionReport.frequencyNumber??2; j++) { + //event for number of days. + for (int j = 0; j < prescriptionReport.frequencyNumber ?? 2; j++) { + // event for number of times per day. + if (j != 0) { - actualDate.add(new Duration(hours: 8)); + actualDate.add(new Duration(hours: 8)); // 8 hours addition for daily dose. + } + + //Time subtraction from actual reminder time. like before 30, or 1 hour. + if (reminderIndex == 0) { + // Before 30 mints + actualDate = Jiffy(actualDate).subtract(minutes: 30); + // dateTime.add(new Duration(minutes: -30)); + } else if (reminderIndex == 1) { + // Before 1 hour + // dateTime.add(new Duration(minutes: -60)); + actualDate = Jiffy(actualDate).subtract(hours: 1); + } else if (reminderIndex == 2) { + // Before 1 hour and 30 mints + // dateTime.add(new Duration(minutes: -90)); + actualDate = Jiffy(actualDate).subtract(hours: 1, minutes: 30); + } else if (reminderIndex == 3) { + // Before 2 hours + // dateTime.add(new Duration(minutes: -120)); + actualDate = Jiffy(actualDate).subtract(hours: 2); } - LocalNotification.getInstance().scheduleNotification( - scheduledNotificationDateTime: actualDate, - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} "); + calendarUtils + .createOrUpdateEvent( + title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + scheduleDateTime: actualDate, + eventId: eventId + (i.toString() + j.toString()), //event id with varitions + ) + .then( + (value) {}, + ); } actualDate.add(new Duration(days: i + 1)); } AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); } + + //schedual local notifications + // setTheNotificatoin(BuildContext context) { + // DateTime startDate = DateUtil.convertStringToDate(prescriptionReport.startDate); + // DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); + // if (prescriptionReport?.frequencyNumber == null) prescriptionReport.frequencyNumber = 2; + // + // for (int i = 0; i < prescriptionReport.days; i++) { + // for (int j = 0; j < prescriptionReport.frequencyNumber ?? 2; j++) { + // if (j != 0) { + // actualDate.add(new Duration(hours: 8)); + // } + // LocalNotification.getInstance().scheduleNotification( + // scheduledNotificationDateTime: actualDate, + // title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", + // description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} "); + // } + // actualDate.add(new Duration(days: i + 1)); + // } + // AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + // } } From 68294690a1aa7df3e01f90091b2a737dbd9c52f6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 15 Nov 2021 16:20:43 +0300 Subject: [PATCH 05/15] prescription reminders added --- lib/config/localized_values.dart | 2 + lib/core/service/client/base_app_client.dart | 8 +- .../prescription_details_page.dart | 198 +++++++++++------- lib/uitl/translations_delegate_base.dart | 3 +- 4 files changed, 130 insertions(+), 81 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 56113044..b52db706 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -171,6 +171,7 @@ const Map localizedValues = { "minute": {"en": "Minutes", "ar": "دقيقة"}, "hour": {"en": "Hour", "ar": "ساعة"}, "reminderSuccess": {"en": "The reminder has been added successfully", "ar": "تمت إضافة التذكير بنجاح"}, + "reminderCancelSuccess": {"en": "The reminder has been cancelled successfully", "ar": "تم إلغاء التذكير بنجاح"}, "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, @@ -449,6 +450,7 @@ const Map localizedValues = { "Frequency": {"en": "Frequency", "ar": "المعدل"}, "DailyQuantity": {"en": "Daily Quantity :", "ar": "جرعات يومية"}, "AddReminder": {"en": "Add Reminder", "ar": "إضافة تذكير"}, + "CancelReminder": {"en": "Cancel Reminder", "ar": "إلغاء تذكير"}, "reminderDes": { "en": "Please select treatment start day and time to be notified when it\'s time to take the medicine", "ar": "يرجى تحديد يوم بدء العلاج والوقت ليتم ارسال تنبيه عندما يحين الوقت لتناول الدواء" diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 1f6ca580..9603605c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -122,10 +122,10 @@ class BaseAppClient { } } - // body['IdentificationNo'] = 1009199553; - // body['MobileNo'] = "966545156035"; - // body['PatientID'] = 1018977; //3844083 - // body['TokenID'] = "@dm!n"; + body['IdentificationNo'] = 1009199553; + body['MobileNo'] = "966545156035"; + body['PatientID'] = 1018977; //3844083 + body['TokenID'] = "@dm!n"; body.removeWhere((key, value) => key == null || value == null); diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index d20fbe87..6460e87c 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -1,15 +1,17 @@ +import 'dart:collection'; + +import 'package:device_calendar/device_calendar.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/reminder_dialog.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog_prescription.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/pharmacy_for_prescriptions_page.dart'; import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart'; -import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -23,12 +25,25 @@ import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; import 'package:provider/provider.dart'; -class PrescriptionDetailsPage extends StatelessWidget { +class PrescriptionDetailsPage extends StatefulWidget { final PrescriptionReport prescriptionReport; final Prescriptions prescriptions; PrescriptionDetailsPage({Key key, this.prescriptionReport, this.prescriptions}); + @override + _PrescriptionDetailsPageState createState() => _PrescriptionDetailsPageState(); +} + +class _PrescriptionDetailsPageState extends State { + bool hasReminder = false; + + @override + void initState() { + checkIfHasReminder(); + super.initState(); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -42,18 +57,18 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ DoctorHeader( headerModel: HeaderModel( - prescriptions.doctorName, - prescriptions.doctorID, - prescriptions.doctorImageURL, - prescriptions.speciality, + widget.prescriptions.doctorName, + widget.prescriptions.doctorID, + widget.prescriptions.doctorImageURL, + widget.prescriptions.speciality, "", - prescriptions.name, - DateUtil.convertStringToDate(prescriptions.appointmentDate), - DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate)), - prescriptions.nationalityFlagURL, - prescriptions.doctorRate, - prescriptions.actualDoctorRate, - prescriptions.noOfPatientsRate, + widget.prescriptions.name, + DateUtil.convertStringToDate(widget.prescriptions.appointmentDate), + DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.prescriptions.appointmentDate)), + widget.prescriptions.nationalityFlagURL, + widget.prescriptions.doctorRate, + widget.prescriptions.actualDoctorRate, + widget.prescriptions.noOfPatientsRate, "", ), isNeedToShowButton: false, @@ -104,7 +119,7 @@ class PrescriptionDetailsPage extends StatelessWidget { children: [ Container( child: Image.network( - prescriptionReport.imageSRCUrl, + widget.prescriptionReport.imageSRCUrl, fit: BoxFit.cover, width: 48, height: 49, @@ -125,13 +140,15 @@ class PrescriptionDetailsPage extends StatelessWidget { ], ), onTap: () { - showZoomImageDialog(context, prescriptionReport.imageSRCUrl); + showZoomImageDialog(context, widget.prescriptionReport.imageSRCUrl); }, ), SizedBox(width: 12), Expanded( child: Text( - (prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? '').toLowerCase().capitalizeFirstofEach, + (widget.prescriptionReport.itemDescription.isNotEmpty ? widget.prescriptionReport.itemDescription : widget.prescriptionReport.itemDescriptionN ?? '') + .toLowerCase() + .capitalizeFirstofEach, style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64), ), ) @@ -149,10 +166,10 @@ class PrescriptionDetailsPage extends StatelessWidget { ), TableRow( children: [ - Utils.tableColumnValue(prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), - Utils.tableColumnValue(prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.routeN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.frequencyN ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.doseDailyQuantity.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), + Utils.tableColumnValue(widget.prescriptionReport?.days.toString() ?? '', isLast: true, mProjectViewModel: projectViewModel), ], ), ]), @@ -161,7 +178,7 @@ class PrescriptionDetailsPage extends StatelessWidget { style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48), ), Text( - prescriptionReport.remarks, + widget.prescriptionReport.remarks, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), ], @@ -184,8 +201,8 @@ class PrescriptionDetailsPage extends StatelessWidget { context, FadePage( page: PharmacyForPrescriptionsPage( - itemID: prescriptionReport.itemID, - prescriptionReport: prescriptionReport, + itemID: widget.prescriptionReport.itemID, + prescriptionReport: widget.prescriptionReport, ), ), ); @@ -197,31 +214,35 @@ class PrescriptionDetailsPage extends StatelessWidget { SizedBox(width: 10), Expanded( child: DefaultButton( - TranslationBase.of(context).addReminder, + hasReminder ? TranslationBase.of(context).cancelReminder : TranslationBase.of(context).addReminder, () { - DateTime startDate = DateTime.now(); - DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + prescriptionReport.days); - - showReminderDialog( - context, - endDate, - "", - prescriptionReport.itemID.toString(), - "", - "", - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", - onSuccess: () { - AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - }, - onMultiDateSuccess: (int selectedIndex) { - setCalender(context, prescriptionReport.itemID.toString(), selectedIndex); - }, - ); - return; + if (hasReminder) { + cancelReminders(); + } else { + DateTime startDate = DateTime.now(); + DateTime endDate = DateTime(startDate.year, startDate.month, startDate.day + widget.prescriptionReport.days); + showReminderDialog( + context, + endDate, + "", + widget.prescriptionReport.itemID.toString(), + "", + "", + title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ", + onSuccess: () { + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + }, + onMultiDateSuccess: (int selectedIndex) { + setCalender(context, widget.prescriptionReport.itemID.toString(), selectedIndex); + }, + ); + return; + } }, iconData: Icons.notifications_active, color: Color(0xffD02127), + fontSize: 13.0, //textColor: Color(0xff2B353E), ), ), @@ -233,16 +254,58 @@ class PrescriptionDetailsPage extends StatelessWidget { ); } + checkIfHasReminder() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30); + DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120); + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) + setState(() { + hasReminder = true; + }); + }); + }); + print("Has Reminder: " + hasReminder.toString()); + } + + cancelReminders() async { + CalendarUtils calendarUtils = await CalendarUtils.getInstance(); + + DateTime startEventsDate = Jiffy(DateTime.now()).subtract(days: 30); + DateTime endEventsDate = Jiffy(DateTime.now()).add(days: 120); + + RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate); + + await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) { + Result> events = value; + events.data.forEach((element) { + if (element.title.contains(widget.prescriptionReport.itemDescriptionN)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element); + }); + }); + AppToast.showSuccessToast(message: TranslationBase.of(context).reminderCancelSuccess); + setState(() { + hasReminder = false; + }); + } + setCalender(BuildContext context, String eventId, int reminderIndex) async { CalendarUtils calendarUtils = await CalendarUtils.getInstance(); - DateTime startDate = DateUtil.convertStringToDate(prescriptionReport.startDate); + DateTime startDate = DateUtil.convertStringToDate(widget.prescriptionReport.startDate); DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); //Time will start at 8:00 AM from starting date - if (prescriptionReport?.frequencyNumber == null) prescriptionReport.frequencyNumber = 2; //Some time frequency number is null so by default will be 2 + if (widget.prescriptionReport?.frequencyNumber == null) widget.prescriptionReport.frequencyNumber = 1; //Some time frequency number is null so by default will be 2 + + GifLoaderDialogUtils.showMyDialog(context); - for (int i = 0; i < prescriptionReport.days; i++) { + for (int i = 0; i < widget.prescriptionReport.days; i++) { //event for number of days. - for (int j = 0; j < prescriptionReport.frequencyNumber ?? 2; j++) { + for (int j = 0; j < widget.prescriptionReport.frequencyNumber ?? 1; j++) { // event for number of times per day. if (j != 0) { @@ -269,38 +332,21 @@ class PrescriptionDetailsPage extends StatelessWidget { } calendarUtils .createOrUpdateEvent( - title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} ", + title: "${widget.prescriptionReport.itemDescriptionN} Prescription Reminder", + description: "${widget.prescriptionReport.itemDescriptionN} ${widget.prescriptionReport.frequencyN} ${widget.prescriptionReport.routeN} ", scheduleDateTime: actualDate, eventId: eventId + (i.toString() + j.toString()), //event id with varitions ) - .then( - (value) {}, - ); + .then((value) {}); + actualDate = DateTime(actualDate.year, actualDate.month, actualDate.day, 8, 0); } - actualDate.add(new Duration(days: i + 1)); + actualDate = Jiffy(actualDate).add(days: 1); + print(actualDate); } AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); + GifLoaderDialogUtils.hideDialog(context); + setState(() { + hasReminder = true; + }); } - - //schedual local notifications - // setTheNotificatoin(BuildContext context) { - // DateTime startDate = DateUtil.convertStringToDate(prescriptionReport.startDate); - // DateTime actualDate = DateTime(startDate.year, startDate.month, startDate.day, 8, 0); - // if (prescriptionReport?.frequencyNumber == null) prescriptionReport.frequencyNumber = 2; - // - // for (int i = 0; i < prescriptionReport.days; i++) { - // for (int j = 0; j < prescriptionReport.frequencyNumber ?? 2; j++) { - // if (j != 0) { - // actualDate.add(new Duration(hours: 8)); - // } - // LocalNotification.getInstance().scheduleNotification( - // scheduledNotificationDateTime: actualDate, - // title: "${prescriptionReport.itemDescriptionN} Prescription Reminder", - // description: "${prescriptionReport.itemDescriptionN} ${prescriptionReport.frequencyN} ${prescriptionReport.routeN} "); - // } - // actualDate.add(new Duration(days: i + 1)); - // } - // AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess); - // } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index fb13232b..b04cbd93 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2789,8 +2789,9 @@ class TranslationBase { String get gr => localizedValues["gr"][locale.languageCode]; String get gramsPerMeal => localizedValues["gramsPerMeal"][locale.languageCode]; + String get cancelReminder => localizedValues["CancelReminder"][locale.languageCode]; - + String get reminderCancelSuccess => localizedValues["reminderCancelSuccess"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From ab7162f16401a13271d34ca851e1a46bcf6e401b Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 15 Nov 2021 16:21:36 +0300 Subject: [PATCH 06/15] Base app client updates --- lib/core/service/client/base_app_client.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 9603605c..1f6ca580 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -122,10 +122,10 @@ class BaseAppClient { } } - body['IdentificationNo'] = 1009199553; - body['MobileNo'] = "966545156035"; - body['PatientID'] = 1018977; //3844083 - body['TokenID'] = "@dm!n"; + // body['IdentificationNo'] = 1009199553; + // body['MobileNo'] = "966545156035"; + // body['PatientID'] = 1018977; //3844083 + // body['TokenID'] = "@dm!n"; body.removeWhere((key, value) => key == null || value == null); From ae3bb1bb2d24137741fa7254c452a8b949cecdb3 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Mon, 15 Nov 2021 17:18:21 +0300 Subject: [PATCH 07/15] fix issues --- .../screens/cart-page/cart-order-page.dart | 3 +- .../product-details/product-detail.dart | 29 ++++++++++--------- .../screens/product-details/reviews_info.dart | 22 ++++++++------ lib/pages/pharmacy/order/Order.dart | 10 +++---- lib/pages/pharmacy/order/OrderDetails.dart | 4 +-- 5 files changed, 37 insertions(+), 31 deletions(-) diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index d217e3da..26d014a0 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -96,7 +96,8 @@ class _CartOrderPageState extends State { model.cartResponse.shoppingCarts.length, scrollDirection: Axis.vertical, shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics(), + physics: ScrollPhysics(), + // physics: const AlwaysScrollableScrollPhysics(), itemBuilder: (context, index) { return ProductOrderItem( item: model.cartResponse.shoppingCarts[index], diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index ad802349..5e226fa8 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -185,7 +185,8 @@ class __ProductDetailPageState extends State { ), Container( // width: 500, - margin: EdgeInsets.only(bottom: 6), + margin: EdgeInsets.only(bottom: 10), + padding: EdgeInsets.only(bottom: 10), color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -255,7 +256,7 @@ class __ProductDetailPageState extends State { GifLoaderDialogUtils.showMyDialog(context); await model.getProductLocationData(widget.product.sku); GifLoaderDialogUtils.hideDialog(context); - +// setState(() { isDetails = false; isReviews = false; @@ -289,7 +290,7 @@ class __ProductDetailPageState extends State { ) : isAvailability ? AvailabilityInfo( - previousModel: model, + previousModel: model ) : Container(), ], @@ -298,17 +299,17 @@ class __ProductDetailPageState extends State { SizedBox( height: 10, ), - if (projectViewModel.isLogin) - RecommendedProducts( - product: widget.product, - productDetailViewModel: model, - addToWishlistFunction: (itemID) async { - await addToWishlistFunction(itemID: itemID, model: model); - }, - deleteFromWishlistFunction: (itemID) async { - await deleteFromWishlistFunction(itemID: itemID, model: model); - }, - ) +// if (projectViewModel.isLogin) +// RecommendedProducts( +// product: widget.product, +// productDetailViewModel: model, +// addToWishlistFunction: (itemID) async { +// await addToWishlistFunction(itemID: itemID, model: model); +// }, +// deleteFromWishlistFunction: (itemID) async { +// await deleteFromWishlistFunction(itemID: itemID, model: model); +// }, +// ) ], ), ), diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index 64336d85..8beefed4 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -30,15 +30,19 @@ class ReviewsInfo extends StatelessWidget { Container( child: Row( children: [ - Container( - child: Text( - previousModel.productDetailService[0] - .reviews[index].customerId - .toString(), - style: TextStyle( - fontSize: 17, - color: Colors.grey, - fontWeight: FontWeight.w600), + Expanded( + child: Container( + child: Text( + previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " + + previousModel.productDetailService[0].reviews[index].customer.lastName.toString(), +// previousModel.productDetailService[0] +// .reviews[index].customerId +// .toString(), + style: TextStyle( + fontSize: 17, + color: Colors.grey, + fontWeight: FontWeight.w600), + ), ), ), Container( diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index 85a456bd..19a6a22b 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -249,11 +249,11 @@ class _OrderPageState extends State left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.blue[700], + color: Color(0xFF4CAF50), style: BorderStyle.solid, width: 5.0, ), - color: Colors.blue[700], + color: Color(0xFF4CAF50), borderRadius: BorderRadius.circular( 30.0)), child: deliveredOrderList[ @@ -535,11 +535,11 @@ class _OrderPageState extends State left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.green, + color: Colors.grey[700], style: BorderStyle.solid, width: 5.0, ), - color: Colors.green, + color: Colors.grey[700], borderRadius: BorderRadius.circular( 30.0)), child: processingOrderList[ @@ -1142,7 +1142,7 @@ class _OrderPageState extends State cancelledOrderList.clear(); for (int i = 0; i < model.orders.length; i++) { if (model.orders[i].orderStatusId == 40 || - model.orders[i].orderStatus == 996 || + model.orders[i].orderStatusId == 996 || model.orders[i].orderStatusId == 200) { cancelledOrderList.add(model.orders[i]); } diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index eb08584a..23f39785 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -604,9 +604,9 @@ class _OrderDetailsPageState extends State { print(widget.orderModel.orderStatusId); // if(orderStatus == 'delivered') if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994) - return Colors.blue[700]; + return Color(0xFF4CAF50); else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999) - return Colors.green; + return Colors.grey[700]; else if (widget.orderModel.orderStatusId == 10) return Colors.orange[300]; else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900]; From 7ffc467552f2064c6ab3b756bcd2e915fff4d0da Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 15 Nov 2021 17:52:13 +0300 Subject: [PATCH 08/15] Lakum fixes --- .../LakumInquiryInformationObjVersion.dart | 20 ++--- .../model/pharmacies/PointsAmountPerYear.dart | 6 +- .../pharmacies/payment-checkout-data.dart | 2 +- .../prescription_details_page.dart | 1 - .../screens/cart-page/lakum_widget.dart | 83 ++++--------------- .../pharmacies/screens/lakum-main-page.dart | 4 +- 6 files changed, 30 insertions(+), 86 deletions(-) diff --git a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart index c609fa0b..e7948d7d 100644 --- a/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart +++ b/lib/core/model/pharmacies/LakumInquiryInformationObjVersion.dart @@ -2,35 +2,35 @@ import 'PointsAmountPerYear.dart'; import 'PointsDetails.dart'; class LakumInquiryInformationObjVersion { - int accountNumber; + num accountNumber; String accountStatus; String barCode; - int consumedPoints; + num consumedPoints; String consumedPointsAmount; List consumedPointsAmountPerYear; List consumedPointsDetails; String createdDate; - int expiredPoints; + num expiredPoints; String expiryDate; - int gainedPoints; + num gainedPoints; List gainedPointsAmountPerYear; List gainedPointsDetails; String lakumMessageStatus; String memberName; String memberUniversalId; String mobileNumber; - int pointsBalance; - int pointsBalanceAmount; - int pointsWillBeExpired; + num pointsBalance; + num pointsBalanceAmount; + num pointsWillBeExpired; String prefLang; - int statusCode; - int transferPoints; + num statusCode; + num transferPoints; List transferPointsAmountPerYear; List transferPointsDetails; dynamic waitingPoints; dynamic loyalityAmount; dynamic loyalityPoints; - int purchaseRate; + num purchaseRate; LakumInquiryInformationObjVersion( {this.accountNumber, diff --git a/lib/core/model/pharmacies/PointsAmountPerYear.dart b/lib/core/model/pharmacies/PointsAmountPerYear.dart index eef74064..2d25855f 100644 --- a/lib/core/model/pharmacies/PointsAmountPerYear.dart +++ b/lib/core/model/pharmacies/PointsAmountPerYear.dart @@ -1,10 +1,10 @@ import 'PointsAmountPerMonth.dart'; class PointsAmountPerYear { - int amountPerYear; + num amountPerYear; List pointsAmountPerMonth; - int pointsPerYear; - int year; + num pointsPerYear; + num year; PointsAmountPerYear( {this.amountPerYear, diff --git a/lib/core/model/pharmacies/payment-checkout-data.dart b/lib/core/model/pharmacies/payment-checkout-data.dart index 5d91c829..f6f93fa2 100644 --- a/lib/core/model/pharmacies/payment-checkout-data.dart +++ b/lib/core/model/pharmacies/payment-checkout-data.dart @@ -11,7 +11,7 @@ class PaymentCheckoutData { LacumAccountInformation lacumInformation; bool cartDataVisible; ShippingOption shippingOption; - int usedLakumPoints; + num usedLakumPoints; PaymentCheckoutData({this.address, this.paymentOption, this.lacumInformation, this.cartDataVisible = false, this.shippingOption, this.usedLakumPoints = 0}); diff --git a/lib/pages/medical/prescriptions/prescription_details_page.dart b/lib/pages/medical/prescriptions/prescription_details_page.dart index 6460e87c..479f37c0 100644 --- a/lib/pages/medical/prescriptions/prescription_details_page.dart +++ b/lib/pages/medical/prescriptions/prescription_details_page.dart @@ -271,7 +271,6 @@ class _PrescriptionDetailsPageState extends State { }); }); }); - print("Has Reminder: " + hasReminder.toString()); } cancelReminders() async { diff --git a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart index cdd26ddc..89db5d89 100644 --- a/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart +++ b/lib/pages/pharmacies/screens/cart-page/lakum_widget.dart @@ -1,24 +1,7 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/order_detail.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/payment-checkout-data.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; -import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/order_model_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/payment_bottom_widget.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/payment-method-select-page.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderPreviewItem.dart'; -import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -37,6 +20,7 @@ class _LakumWidgetState extends State { @override Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); + _pointsController.text = widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString(); return Container( color: Colors.white, @@ -80,74 +64,39 @@ class _LakumWidgetState extends State { fontWeight: FontWeight.bold, ), Container( - margin: projectProvider.isArabic - ? EdgeInsets.only(right: 4) - : EdgeInsets.only(left: 4), + margin: projectProvider.isArabic ? EdgeInsets.only(right: 4) : EdgeInsets.only(left: 4), width: 60, height: 50, child: TextField( decoration: InputDecoration( border: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.2), + borderSide: BorderSide(color: Colors.black, width: 0.2), gapPadding: 0, borderRadius: projectProvider.isArabic - ? BorderRadius.only( - topRight: Radius.circular(8), - bottomRight: Radius.circular(8)) - : BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), + ? BorderRadius.only(topRight: Radius.circular(8), bottomRight: Radius.circular(8)) + : BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)), ), disabledBorder: OutlineInputBorder( - borderSide: - BorderSide(color: Colors.black, width: 0.4), + borderSide: BorderSide(color: Colors.black, width: 0.4), gapPadding: 0, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8)), + borderRadius: BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)), ), ), controller: _pointsController, keyboardType: TextInputType.number, style: TextStyle( fontSize: 14, - color: widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount > - 0 - ? Colors.black - : Colors.grey, + color: widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount > 0 ? Colors.black : Colors.grey, ), - enabled: widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount == - 0 - ? false - : true, + enabled: widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount == 0 ? false : true, onChanged: (val) { var value = int.tryParse(val); - if (value != null && - value <= - widget - .model - .paymentCheckoutData - .lacumInformation - .lakumInquiryInformationObjVersion - .pointsBalanceAmount) { - widget.model.paymentCheckoutData.usedLakumPoints = - value; + if (value != null && value <= widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount) { + widget.model.paymentCheckoutData.usedLakumPoints = value; } else { widget.model.paymentCheckoutData.usedLakumPoints = 0; } - _pointsController.text = - "${widget.model.paymentCheckoutData.usedLakumPoints}"; + _pointsController.text = "${widget.model.paymentCheckoutData.usedLakumPoints}"; }, ), ), @@ -158,12 +107,8 @@ class _LakumWidgetState extends State { color: Color(0xff3666E0), shape: BoxShape.rectangle, borderRadius: projectProvider.isArabic - ? BorderRadius.only( - topLeft: Radius.circular(6), - bottomLeft: Radius.circular(6)) - : BorderRadius.only( - topRight: Radius.circular(6), - bottomRight: Radius.circular(6)), + ? BorderRadius.only(topLeft: Radius.circular(6), bottomLeft: Radius.circular(6)) + : BorderRadius.only(topRight: Radius.circular(6), bottomRight: Radius.circular(6)), border: Border.fromBorderSide(BorderSide( color: Color(0xff3666E0), width: 0.8, diff --git a/lib/pages/pharmacies/screens/lakum-main-page.dart b/lib/pages/pharmacies/screens/lakum-main-page.dart index dcee8398..4e50cecc 100644 --- a/lib/pages/pharmacies/screens/lakum-main-page.dart +++ b/lib/pages/pharmacies/screens/lakum-main-page.dart @@ -370,8 +370,8 @@ class LacumPointsWidget extends StatelessWidget { final MediaQueryData mediaQuery; final int pointType; // 1. balance, 2. gained, 3. consume, 4. transfer final String title; - final int riyal; - final int point; + final num riyal; + final num point; Color titleColor; final List pointsAmountPerYear; From 468d64a1e086f2fdf0db4914f685b52cc257b557 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Tue, 16 Nov 2021 09:54:01 +0300 Subject: [PATCH 09/15] fix design issue --- .../pharmacies/screens/product-details/reviews_info.dart | 3 ++- lib/pages/pharmacy/order/Order.dart | 4 ++-- lib/pages/pharmacy/order/OrderDetails.dart | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index 8beefed4..bc1e865c 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -83,7 +83,8 @@ class ReviewsInfo extends StatelessWidget { }, ) : Container( - padding: EdgeInsets.all(15), + padding: EdgeInsets.fromLTRB(15,15,15,20), + margin: EdgeInsets.only(bottom: 20), alignment: Alignment.center, child: Text( TranslationBase.of(context).noReviewsAvailable, diff --git a/lib/pages/pharmacy/order/Order.dart b/lib/pages/pharmacy/order/Order.dart index c8ee395f..40725423 100644 --- a/lib/pages/pharmacy/order/Order.dart +++ b/lib/pages/pharmacy/order/Order.dart @@ -528,11 +528,11 @@ class _OrderPageState extends State with SingleTickerProviderStateMix left: 13.0, right: 13.0), decoration: BoxDecoration( border: Border.all( - color: Colors.grey[700], + color: Colors.grey[500], style: BorderStyle.solid, width: 5.0, ), - color: Colors.grey[700], + color: Colors.grey[500], borderRadius: BorderRadius.circular( 30.0)), child: processingOrderList[ diff --git a/lib/pages/pharmacy/order/OrderDetails.dart b/lib/pages/pharmacy/order/OrderDetails.dart index 23f39785..035c516c 100644 --- a/lib/pages/pharmacy/order/OrderDetails.dart +++ b/lib/pages/pharmacy/order/OrderDetails.dart @@ -606,7 +606,7 @@ class _OrderDetailsPageState extends State { if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994) return Color(0xFF4CAF50); else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999) - return Colors.grey[700]; + return Colors.grey[500]; else if (widget.orderModel.orderStatusId == 10) return Colors.orange[300]; else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900]; From a646677faea6a9c567fa1c151a8cf5b94f771218 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 16 Nov 2021 16:07:40 +0300 Subject: [PATCH 10/15] Pharmacy & smart watch data fixes --- .../AppIcon.appiconset/Contents.json | 250 ++--- .../Icon-App-1024x1024@1x.png | Bin 10932 -> 0 bytes lib/config/localized_values.dart | 1 + lib/core/service/client/base_app_client.dart | 4 +- .../pharmacyModule/OrderPreviewViewModel.dart | 23 +- lib/models/SmartWatch/HealthData.dart | 6 +- .../syncHealthData.dart | 39 +- .../product-details/footor/footer-widget.dart | 49 +- .../pharmacyAddresses/PharmacyAddresses.dart | 15 +- lib/pages/pharmacy/profile/profile.dart | 864 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- .../pharmacy/bottom_nav_pharmacy_item.dart | 82 +- 13 files changed, 681 insertions(+), 657 deletions(-) delete mode 100644 ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index e83c3bf5..1eb27a20 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,128 +1,128 @@ { - "images":[ - { - "idiom":"iphone", - "size":"20x20", - "scale":"2x", - "filename":"Icon-App-20x20@2x.png" - }, - { - "idiom":"iphone", - "size":"20x20", - "scale":"3x", - "filename":"Icon-App-20x20@3x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"1x", - "filename":"Icon-App-29x29@1x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"2x", - "filename":"Icon-App-29x29@2x.png" - }, - { - "idiom":"iphone", - "size":"29x29", - "scale":"3x", - "filename":"Icon-App-29x29@3x.png" - }, - { - "idiom":"iphone", - "size":"40x40", - "scale":"2x", - "filename":"Icon-App-40x40@2x.png" - }, - { - "idiom":"iphone", - "size":"40x40", - "scale":"3x", - "filename":"Icon-App-40x40@3x.png" - }, - { - "idiom":"iphone", - "size":"60x60", - "scale":"2x", - "filename":"Icon-App-60x60@2x.png" - }, - { - "idiom":"iphone", - "size":"60x60", - "scale":"3x", - "filename":"Icon-App-60x60@3x.png" - }, - { - "idiom":"iphone", - "size":"76x76", - "scale":"2x", - "filename":"Icon-App-76x76@2x.png" - }, - { - "idiom":"ipad", - "size":"20x20", - "scale":"1x", - "filename":"Icon-App-20x20@1x.png" - }, - { - "idiom":"ipad", - "size":"20x20", - "scale":"2x", - "filename":"Icon-App-20x20@2x.png" - }, - { - "idiom":"ipad", - "size":"29x29", - "scale":"1x", - "filename":"Icon-App-29x29@1x.png" - }, - { - "idiom":"ipad", - "size":"29x29", - "scale":"2x", - "filename":"Icon-App-29x29@2x.png" - }, - { - "idiom":"ipad", - "size":"40x40", - "scale":"1x", - "filename":"Icon-App-40x40@1x.png" - }, - { - "idiom":"ipad", - "size":"40x40", - "scale":"2x", - "filename":"Icon-App-40x40@2x.png" - }, - { - "idiom":"ipad", - "size":"76x76", - "scale":"1x", - "filename":"Icon-App-76x76@1x.png" - }, - { - "idiom":"ipad", - "size":"76x76", - "scale":"2x", - "filename":"Icon-App-76x76@2x.png" - }, - { - "idiom":"ipad", - "size":"83.5x83.5", - "scale":"2x", - "filename":"Icon-App-83.5x83.5@2x.png" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "scale" : "1x", - "filename" : "ItunesArtwork@2x.png" - } - ], - "info":{ - "version":1, - "author":"easyappicon" + "images" : [ + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "iphone", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-60x60@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-60x60@3x.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "Icon-App-20x20@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-20x20@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "Icon-App-29x29@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-29x29@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "Icon-App-40x40@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-40x40@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "filename" : "Icon-App-76x76@1x.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "filename" : "Icon-App-83.5x83.5@2x.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "filename" : "icon.jpg", + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "filename" : "Icon-App-76x76@2x.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "76x76" } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } } diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada4725e9b0ddb1deab583e5b5102493aa332..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10932 zcmeHN2~<R zh`|8`A_PQ1nSu(UMFx?8j8PC!!VDphaL#`F42fd#7Vlc`zIE4n%Y~eiz4y1j|NDpi z?<@|pSJ-HM`qifhf@m%MamgwK83`XpBA<+azdF#2QsT{X@z0A9Bq>~TVErigKH1~P zRX-!h-f0NJ4Mh++{D}J+K>~~rq}d%o%+4dogzXp7RxX4C>Km5XEI|PAFDmo;DFm6G zzjVoB`@qW98Yl0Kvc-9w09^PrsobmG*Eju^=3f?0o-t$U)TL1B3;sZ^!++3&bGZ!o-*6w?;oOhf z=A+Qb$scV5!RbG+&2S}BQ6YH!FKb0``VVX~T$dzzeSZ$&9=X$3)_7Z{SspSYJ!lGE z7yig_41zpQ)%5dr4ff0rh$@ky3-JLRk&DK)NEIHecf9c*?Z1bUB4%pZjQ7hD!A0r-@NF(^WKdr(LXj|=UE7?gBYGgGQV zidf2`ZT@pzXf7}!NH4q(0IMcxsUGDih(0{kRSez&z?CFA0RVXsVFw3^u=^KMtt95q z43q$b*6#uQDLoiCAF_{RFc{!H^moH_cmll#Fc^KXi{9GDl{>%+3qyfOE5;Zq|6#Hb zp^#1G+z^AXfRKaa9HK;%b3Ux~U@q?xg<2DXP%6k!3E)PA<#4$ui8eDy5|9hA5&{?v z(-;*1%(1~-NTQ`Is1_MGdQ{+i*ccd96ab$R$T3=% zw_KuNF@vI!A>>Y_2pl9L{9h1-C6H8<)J4gKI6{WzGBi<@u3P6hNsXG=bRq5c+z;Gc3VUCe;LIIFDmQAGy+=mRyF++u=drBWV8-^>0yE9N&*05XHZpPlE zxu@?8(ZNy7rm?|<+UNe0Vs6&o?l`Pt>P&WaL~M&#Eh%`rg@Mbb)J&@DA-wheQ>hRV z<(XhigZAT z>=M;URcdCaiO3d^?H<^EiEMDV+7HsTiOhoaMX%P65E<(5xMPJKxf!0u>U~uVqnPN7T!X!o@_gs3Ct1 zlZ_$5QXP4{Aj645wG_SNT&6m|O6~Tsl$q?nK*)(`{J4b=(yb^nOATtF1_aS978$x3 zx>Q@s4i3~IT*+l{@dx~Hst21fR*+5}S1@cf>&8*uLw-0^zK(+OpW?cS-YG1QBZ5q! zgTAgivzoF#`cSz&HL>Ti!!v#?36I1*l^mkrx7Y|K6L#n!-~5=d3;K<;Zqi|gpNUn_ z_^GaQDEQ*jfzh;`j&KXb66fWEk1K7vxQIMQ_#Wu_%3 z4Oeb7FJ`8I>Px;^S?)}2+4D_83gHEq>8qSQY0PVP?o)zAv3K~;R$fnwTmI-=ZLK`= zTm+0h*e+Yfr(IlH3i7gUclNH^!MU>id$Jw>O?2i0Cila#v|twub21@e{S2v}8Z13( zNDrTXZVgris|qYm<0NU(tAPouG!QF4ZNpZPkX~{tVf8xY690JqY1NVdiTtW+NqyRP zZ&;T0ikb8V{wxmFhlLTQ&?OP7 z;(z*<+?J2~z*6asSe7h`$8~Se(@t(#%?BGLVs$p``;CyvcT?7Y!{tIPva$LxCQ&4W z6v#F*);|RXvI%qnoOY&i4S*EL&h%hP3O zLsrFZhv&Hu5tF$Lx!8(hs&?!Kx5&L(fdu}UI5d*wn~A`nPUhG&Rv z2#ixiJdhSF-K2tpVL=)5UkXRuPAFrEW}7mW=uAmtVQ&pGE-&az6@#-(Te^n*lrH^m@X-ftVcwO_#7{WI)5v(?>uC9GG{lcGXYJ~Q8q zbMFl7;t+kV;|;KkBW2!P_o%Czhw&Q(nXlxK9ak&6r5t_KH8#1Mr-*0}2h8R9XNkr zto5-b7P_auqTJb(TJlmJ9xreA=6d=d)CVbYP-r4$hDn5|TIhB>SReMfh&OVLkMk-T zYf%$taLF0OqYF?V{+6Xkn>iX@TuqQ?&cN6UjC9YF&%q{Ut3zv{U2)~$>-3;Dp)*(? zg*$mu8^i=-e#acaj*T$pNowo{xiGEk$%DusaQiS!KjJH96XZ-hXv+jk%ard#fu=@Q z$AM)YWvE^{%tDfK%nD49=PI|wYu}lYVbB#a7wtN^Nml@CE@{Gv7+jo{_V?I*jkdLD zJE|jfdrmVbkfS>rN*+`#l%ZUi5_bMS<>=MBDNlpiSb_tAF|Zy`K7kcp@|d?yaTmB^ zo?(vg;B$vxS|SszusORgDg-*Uitzdi{dUV+glA~R8V(?`3GZIl^egW{a919!j#>f` znL1o_^-b`}xnU0+~KIFLQ)$Q6#ym%)(GYC`^XM*{g zv3AM5$+TtDRs%`2TyR^$(hqE7Y1b&`Jd6dS6B#hDVbJlUXcG3y*439D8MrK!2D~6gn>UD4Imctb z+IvAt0iaW73Iq$K?4}H`7wq6YkTMm`tcktXgK0lKPmh=>h+l}Y+pDtvHnG>uqBA)l zAH6BV4F}v$(o$8Gfo*PB>IuaY1*^*`OTx4|hM8jZ?B6HY;F6p4{`OcZZ(us-RVwDx zUzJrCQlp@mz1ZFiSZ*$yX3c_#h9J;yBE$2g%xjmGF4ca z&yL`nGVs!Zxsh^j6i%$a*I3ZD2SoNT`{D%mU=LKaEwbN(_J5%i-6Va?@*>=3(dQy` zOv%$_9lcy9+(t>qohkuU4r_P=R^6ME+wFu&LA9tw9RA?azGhjrVJKy&8=*qZT5Dr8g--d+S8zAyJ$1HlW3Olryt`yE zFIph~Z6oF&o64rw{>lgZISC6p^CBer9C5G6yq%?8tC+)7*d+ib^?fU!JRFxynRLEZ zj;?PwtS}Ao#9whV@KEmwQgM0TVP{hs>dg(1*DiMUOKHdQGIqa0`yZnHk9mtbPfoLx zo;^V6pKUJ!5#n`w2D&381#5#_t}AlTGEgDz$^;u;-vxDN?^#5!zN9ngytY@oTv!nc zp1Xn8uR$1Z;7vY`-<*?DfPHB;x|GUi_fI9@I9SVRv1)qETbNU_8{5U|(>Du84qP#7 z*l9Y$SgA&wGbj>R1YeT9vYjZuC@|{rajTL0f%N@>3$DFU=`lSPl=Iv;EjuGjBa$Gw zHD-;%YOE@<-!7-Mn`0WuO3oWuL6tB2cpPw~Nvuj|KM@))ixuDK`9;jGMe2d)7gHin zS<>k@!x;!TJEc#HdL#RF(`|4W+H88d4V%zlh(7#{q2d0OQX9*FW^`^_<3r$kabWAB z$9BONo5}*(%kx zOXi-yM_cmB3>inPpI~)duvZykJ@^^aWzQ=eQ&STUa}2uT@lV&WoRzkUoE`rR0)`=l zFT%f|LA9fCw>`enm$p7W^E@U7RNBtsh{_-7vVz3DtB*y#*~(L9+x9*wn8VjWw|Q~q zKFsj1Yl>;}%MG3=PY`$g$_mnyhuV&~O~u~)968$0b2!Jkd;2MtAP#ZDYw9hmK_+M$ zb3pxyYC&|CuAbtiG8HZjj?MZJBFbt`ryf+c1dXFuC z0*ZQhBzNBd*}s6K_G}(|Z_9NDV162#y%WSNe|FTDDhx)K!c(mMJh@h87@8(^YdK$&d*^WQe8Z53 z(|@MRJ$Lk-&ii74MPIs80WsOFZ(NX23oR-?As+*aq6b?~62@fSVmM-_*cb1RzZ)`5$agEiL`-E9s7{GM2?(KNPgK1(+c*|-FKoy}X(D_b#etO|YR z(BGZ)0Ntfv-7R4GHoXp?l5g#*={S1{u-QzxCGng*oWr~@X-5f~RA14b8~B+pLKvr4 zfgL|7I>jlak9>D4=(i(cqYf7#318!OSR=^`xxvI!bBlS??`xxWeg?+|>MxaIdH1U~#1tHu zB{QMR?EGRmQ_l4p6YXJ{o(hh-7Tdm>TAX380TZZZyVkqHNzjUn*_|cb?T? zt;d2s-?B#Mc>T-gvBmQZx(y_cfkXZO~{N zT6rP7SD6g~n9QJ)8F*8uHxTLCAZ{l1Y&?6v)BOJZ)=R-pY=Y=&1}jE7fQ>USS}xP#exo57uND0i*rEk@$;nLvRB@u~s^dwRf?G?_enN@$t* zbL%JO=rV(3Ju8#GqUpeE3l_Wu1lN9Y{D4uaUe`g>zlj$1ER$6S6@{m1!~V|bYkhZA z%CvrDRTkHuajMU8;&RZ&itnC~iYLW4DVkP<$}>#&(`UO>!n)Po;Mt(SY8Yb`AS9lt znbX^i?Oe9r_o=?})IHKHoQGKXsps_SE{hwrg?6dMI|^+$CeC&z@*LuF+P`7LfZ*yr+KN8B4{Nzv<`A(wyR@!|gw{zB6Ha ziwPAYh)oJ(nlqSknu(8g9N&1hu0$vFK$W#mp%>X~AU1ay+EKWcFdif{% z#4!4aoVVJ;ULmkQf!ke2}3hqxLK>eq|-d7Ly7-J9zMpT`?dxo6HdfJA|t)?qPEVBDv z{y_b?4^|YA4%WW0VZd8C(ZgQzRI5(I^)=Ub`Y#MHc@nv0w-DaJAqsbEHDWG8Ia6ju zo-iyr*sq((gEwCC&^TYBWt4_@|81?=B-?#P6NMff(*^re zYqvDuO`K@`mjm_Jd;mW_tP`3$cS?R$jR1ZN09$YO%_iBqh5ftzSpMQQtxKFU=FYmP zeY^jph+g<4>YO;U^O>-NFLn~-RqlHvnZl2yd2A{Yc1G@Ga$d+Q&(f^tnPf+Z7serIU};17+2DU_f4Z z@GaPFut27d?!YiD+QP@)T=77cR9~MK@bd~pY%X(h%L={{OIb8IQmf-!xmZkm8A0Ga zQSWONI17_ru5wpHg3jI@i9D+_Y|pCqVuHJNdHUauTD=R$JcD2K_liQisqG$(sm=k9;L* z!L?*4B~ql7uioSX$zWJ?;q-SWXRFhz2Jt4%fOHA=Bwf|RzhwqdXGr78y$J)LR7&3T zE1WWz*>GPWKZ0%|@%6=fyx)5rzUpI;bCj>3RKzNG_1w$fIFCZ&UR0(7S?g}`&Pg$M zf`SLsz8wK82Vyj7;RyKmY{a8G{2BHG%w!^T|Njr!h9TO2LaP^_f22Q1=l$QiU84ao zHe_#{S6;qrC6w~7{y(hs-?-j?lbOfgH^E=XcSgnwW*eEz{_Z<_ json) { @@ -21,7 +19,6 @@ class healthData { MachineDate = json['MachineDate']; Value = json['Value']; TransactionsListID = json['TransactionsListID']; - Notes = json['Notes']; } Map toJson() { @@ -31,7 +28,6 @@ class healthData { data['MachineDate'] = this.MachineDate; data['Value'] = this.Value; data['TransactionsListID'] = this.TransactionsListID; - data['Notes'] = this.Notes; return data; } } \ No newline at end of file diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index ac497ba4..7b089935 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -1,6 +1,7 @@ import 'package:collection/collection.dart'; import 'package:diplomaticquarterapp/models/SmartWatch/HealthData.dart'; import 'package:diplomaticquarterapp/services/smartwatch_integration/SmartWatchIntegrationService.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -149,8 +150,7 @@ class _syncHealthDataButtonState extends State { } } date = DateUtil.convertDateToString(date); - Med_InsertTransactionsInputsList.add( - healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++, Notes: "")); + Med_InsertTransactionsInputsList.add(healthData(MedCategoryID: MedCategoryID, MedSubCategoryID: MedSubCategoryID, MachineDate: date, Value: value, TransactionsListID: TransactionsListID++)); }); } } @@ -197,27 +197,17 @@ class _syncHealthDataButtonState extends State { // to convert from meter to km totalDistance += (element['Value'] * 0.001); } else if (element['MedCategoryID'] == 3) { - print("HeartRate"); + // print("HeartRate"); MedCategoryID = 3; counter++; totalHeartRate += element['Value']; } else if (element['MedCategoryID'] == 4) { print("sleeeeep"); sleepDataList.add(new healthData( - MedCategoryID: 4, - MedSubCategoryID: element['MedSubCategoryID'], - MachineDate: DateUtil.convertDateToString(date), - Value: element['Value'], - TransactionsListID: TransactionsListID++, - Notes: "")); + MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add(new healthData( - MedCategoryID: 4, - MedSubCategoryID: element['MedSubCategoryID'], - MachineDate: DateUtil.convertDateToString(date), - Value: element['Value'], - TransactionsListID: TransactionsListID++, - Notes: "")); + MedCategoryID: 4, MedSubCategoryID: element['MedSubCategoryID'], MachineDate: DateUtil.convertDateToString(date), Value: element['Value'], TransactionsListID: TransactionsListID++)); } // else if(element['MedCategoryID'] == 8){ // @@ -235,27 +225,16 @@ class _syncHealthDataButtonState extends State { } Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalSteps, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 6, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalSteps, TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: totalDistance, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 7, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: totalDistance, TransactionsListID: TransactionsListID++)); Med_InsertTransactionsInputsList2.add( - new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToString(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++, Notes: "")); + new healthData(MedCategoryID: 3, MedSubCategoryID: 0, MachineDate: DateUtil.convertDateToStringLocation(date), Value: avgTotalHeartRate, TransactionsListID: TransactionsListID++)); }); addInsertTransactionsInputsList(); GifLoaderDialogUtils.hideDialog(context); - - // AlertDialogBox dialog = new AlertDialogBox( - // context: context, - // confirmMessage: TranslationBase.of(context).alreadySynced, - // okText: TranslationBase.of(context).ok, - // okFunction: () => { - // AlertDialogBox.closeAlertDialog(context), - // }, - // ); - - // dialog.showAlertDialog(context); } addInsertTransactionsInputsList() { @@ -264,7 +243,7 @@ class _syncHealthDataButtonState extends State { SmartWatchIntegrationService service = new SmartWatchIntegrationService(); service.insertPatientHealthData(Med_InsertTransactionsInputsList2, context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print(res); + AppToast.showSuccessToast(message: TranslationBase.of(context).syncSuccess); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); diff --git a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart index 644ab693..2d9a3489 100644 --- a/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart +++ b/lib/pages/pharmacies/screens/product-details/footor/footer-widget.dart @@ -1,11 +1,15 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; -import 'package:diplomaticquarterapp/pages/pharmacies/screens/cart-page/cart-order-page.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/product-details/footor/quantity_box.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import '../../../../../locator.dart'; @@ -35,6 +39,7 @@ class _FooterWidgetState extends State { double quantityUI = 80; bool showUI = false; AuthenticatedUserObject authenticatedUserObject = locator(); + AppSharedPreferences sharedPref = new AppSharedPreferences(); @override Widget build(BuildContext context) { @@ -182,9 +187,7 @@ class _FooterWidgetState extends State { disabled: (!widget.isAvailable && widget.quantity > 0) || widget.quantity > widget.quantityLimit || widget.item.isRx, onTap: () async { if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); } else await widget.addToCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); }, @@ -204,12 +207,9 @@ class _FooterWidgetState extends State { disabled: (!widget.isAvailable && widget.quantity > 0) || (widget.quantity > widget.quantityLimit) || widget.item.isRx, onTap: () async { if (!authenticatedUserObject.isLogin) { - Navigator.of(context).pushNamed( - WELCOME_LOGIN, - ); + login(); } else { await widget.addToShoppingCartFunction(quantity: widget.quantity, itemID: widget.item.id, model: widget.model); - } }, fontWeight: FontWeight.w600, @@ -227,6 +227,37 @@ class _FooterWidgetState extends State { ); } + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + login() async { + final authService = new AuthProvider(); + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); + } + } + onChangeValue(int i) { setState(() { widget.quantity = i; diff --git a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart index 21bb77eb..a38104b9 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart @@ -126,11 +126,16 @@ class _PharmacyAddressesState extends State { GifLoaderDialogUtils.showMyDialog(context); await widget.orderPreviewViewModel.getInformationsByAddress(widget.orderPreviewViewModel.user.patientIdentificationNo); - await widget.orderPreviewViewModel.getShoppingCart(); - // widget.changeMainState(); - GifLoaderDialogUtils.hideDialog(context); - model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); - _navigateToPaymentOption(model); + if (widget.orderPreviewViewModel.error == "") { + await widget.orderPreviewViewModel.getShoppingCart(); + GifLoaderDialogUtils.hideDialog(context); + model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]); + _navigateToPaymentOption(model); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: widget.orderPreviewViewModel.error); + return; + } }, ), ), diff --git a/lib/pages/pharmacy/profile/profile.dart b/lib/pages/pharmacy/profile/profile.dart index 74f4662d..1f2520b6 100644 --- a/lib/pages/pharmacy/profile/profile.dart +++ b/lib/pages/pharmacy/profile/profile.dart @@ -18,7 +18,6 @@ import 'package:diplomaticquarterapp/pages/pharmacy/order/Order.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; -import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -84,8 +83,6 @@ class _ProfilePageState extends State { ); } } - -// this.isLogin = user != null; } void initState() { @@ -101,511 +98,512 @@ class _ProfilePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) async { - // var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); - // var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); - // GifLoaderDialogUtils.showMyDialog(context); - // model.getOrder(customerId, customerGUID, page_id); - // GifLoaderDialogUtils.hideDialog(context); - }, - builder: (_, model, wi) => AppScaffold( - appBarTitle: TranslationBase.of(context).myAccount, - isShowAppBar: true, - isShowDecPage: true, - isPharmacy: true, + onModelReady: (model) async { + // var customerId = await sharedPref.getString(PHARMACY_CUSTOMER_ID); + // var customerGUID = await sharedPref.getObject(PHARMACY_CUSTOMER_GUID); + // GifLoaderDialogUtils.showMyDialog(context); + // model.getOrder(customerId, customerGUID, page_id); + // GifLoaderDialogUtils.hideDialog(context); + }, + builder: (_, model, wi) => AppScaffold( + appBarTitle: TranslationBase.of(context).myAccount, + isShowAppBar: true, + isShowDecPage: true, + isPharmacy: true, - //isBottomBar: true, - isMainPharmacyPages: true, - body: user != null - ? Container( - color: Colors.white, - child: SingleChildScrollView( - child: Column( + //isBottomBar: true, + isMainPharmacyPages: true, + body: user != null + ? Container( + color: Colors.white, + child: SingleChildScrollView( + child: Column( + children: [ + Container( + child: Row( children: [ Container( child: Row( children: [ Container( - child: Row( - children: [ - Container( - padding: EdgeInsets.only( - top: 20.0, - left: 10.0, - right: 10.0, - bottom: 10.0, - ), - child: LargeAvatar( - name: user.firstName.toString(), - url: '', - ), - ), - Column(children: [ - Row(children: [ - Text( - TranslationBase.of(context).welcome, - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), - ), - ]), - SizedBox( - height: 10, - ), - Row(children: [ - Text( - languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), - style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), - ), - ]), - ]), - ], + padding: EdgeInsets.only( + top: 20.0, + left: 10.0, + right: 10.0, + bottom: 10.0, ), - ) - ], - ), - ), - Divider( - color: Colors.grey[350], - height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 15, - ), - Container( - child: Row( - children: [ - Expanded( - child: InkWell( - onTap: () { - if (customerId == null) { - AppToast.showErrorToast(message: "Customer not found"); - return; - } - Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); - }, - child: Column( - children: [ -// Image(image: AssetImage('assets/images/pharmacy/orders_icon.svg')), - SvgPicture.asset( - 'assets/images/pharmacy/orders_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).orders, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], + child: LargeAvatar( + name: user.firstName.toString(), + url: '', ), ), - ), - Expanded( - child: InkWell( - onTap: () { - if (customerId == null || customerId == '') - Navigator.push(context, FadePage(page: LakumActivationVidaPage())); - else - Navigator.push(context, FadePage(page: LakumMainPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/lakum_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).lakum, - style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), - ), - ], + Column(children: [ + Row(children: [ + Text( + TranslationBase.of(context).welcome, + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.grey), + ), + ]), + SizedBox( + height: 10, ), + Row(children: [ + Text( + languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(), + style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold), + ), + ]), + ]), + ], + ), + ) + ], + ), + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 15, + ), + Container( + child: Row( + children: [ + Expanded( + child: InkWell( + onTap: () { + if (customerId == null) { + AppToast.showErrorToast(message: "Customer not found"); + return; + } + Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID))); + }, + 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( - onTap: () { - Navigator.push(context, FadePage(page: 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( - onTap: () { - Navigator.push(context, FadePage(page: MyReviewsPage())); - }, - child: Column( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/review_icon.svg', - width: 50, - height: 50, - ), - SizedBox( - height: 5, - ), - Text( - TranslationBase.of(context).reviews, - style: TextStyle( - fontSize: 13.0, - fontWeight: FontWeight.bold, - ), - ), - ], + 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), + ), + Expanded( + child: InkWell( + onTap: () { + if (customerId == null || customerId == '') + Navigator.push(context, FadePage(page: LakumActivationVidaPage())); + else + Navigator.push(context, FadePage(page: LakumMainPage())); + }, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - TranslationBase.of(context).myAccount, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + SvgPicture.asset( + 'assets/images/pharmacy/lakum_icon.svg', + width: 50, + height: 50, ), SizedBox( - height: 10, + height: 5, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).lakum, + style: TextStyle(fontSize: 13.0, fontWeight: FontWeight.bold), ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: 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, - ), - ), - ], - ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push(context, FadePage(page: WishlistPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/wishlist_icon.svg', + width: 50, + height: 50, ), SizedBox( height: 5, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: ComparePage())); - }, - child: Row( - children: [ - Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), - SizedBox( - width: 15, - ), - Text( - TranslationBase.of(context).compare, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).wishlist, + style: TextStyle( + fontSize: 13.0, + fontWeight: FontWeight.bold, ), ), + ], + ), + ), + ), + Expanded( + child: InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyReviewsPage())); + }, + child: Column( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/review_icon.svg', + width: 50, + height: 50, + ), SizedBox( height: 5, ), - Divider( - color: Colors.grey, - height: 20, - ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: 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, - ), - ), - ], + Text( + TranslationBase.of(context).reviews, + 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, FadePage(page: HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_prescription_icon.svg', + width: 28, + height: 28, + ), SizedBox( - height: 5, + width: 15, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).myPrescription, + style: TextStyle( + fontSize: 13.0, + ), ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyFamily())); - }, - child: Row( - children: [ - SvgPicture.asset( - 'assets/images/pharmacy/my_family_icon.svg', - width: 20, - height: 20, - ), - SizedBox( - width: 20, - ), - Text( - TranslationBase.of(context).family, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: ComparePage())); + }, + child: Row( + children: [ + Image.asset('assets/images/pharmacy/compare.png', width: 35, height: 35), + SizedBox( + width: 15, + ), + Text( + TranslationBase.of(context).compare, + style: TextStyle( + fontSize: 13.0, ), ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: HomePrescriptionsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/medication_refill_icon.svg', + width: 30, + height: 30, + ), SizedBox( - height: 5, + width: 20, + ), + Text( + TranslationBase.of(context).medicationsRefill, + style: TextStyle( + fontSize: 13.0, + ), ), - Divider( - color: Colors.grey, + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: MyFamily())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/my_family_icon.svg', + width: 20, height: 20, ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: 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( + width: 20, + ), + Text( + TranslationBase.of(context).family, + style: TextStyle( + fontSize: 13.0, ), ), - SizedBox( - height: 5, + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PharmacyAddressesPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/shipping_addresses_icon.svg', + width: 30, + height: 30, ), - Divider( - color: Colors.grey, - height: 20, + SizedBox( + width: 20, ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: PharmacyTermsConditions())); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context).conditionsHMG, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + Text( + TranslationBase.of(context).shippingAddresses, + style: TextStyle( + fontSize: 13.0, ), ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: PharmacyTermsConditions())); + }, + child: Row( + children: [ + Image.asset( + 'assets/images/pharmacy/terms.png', + width: 25, + height: 25, + ), SizedBox( - height: 5, + width: 10, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).conditionsHMG, + style: TextStyle( + fontSize: 13.0, + ), + ), + ], + ), + ), + SizedBox( + height: 5, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId))); + }, + child: Row( + children: [ + Image.asset( + 'assets/images/pharmacy/terms.png', + width: 25, + height: 25, ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId))); - }, - child: Row( - children: [ - Image.asset( - 'assets/images/pharmacy/terms.png', - width: 25, - height: 25, - ), // IconButton(icon: Icon(Icons.error_outline), iconSize: 30, // color: Colors.black,), - SizedBox( - width: 10, - ), - Text( - TranslationBase.of(context).conditions, - style: TextStyle( - fontSize: 13.0, - ), - ), - ], + SizedBox( + width: 10, + ), + Text( + TranslationBase.of(context).conditions, + style: TextStyle( + fontSize: 13.0, ), ), ], ), ), + ], + ), + ), + SizedBox( + height: 10, + ), + Divider( + color: Colors.grey[350], + height: 20, + thickness: 5, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 10, + ), + Container( + padding: EdgeInsets.only(left: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).reachUs, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + ), SizedBox( - height: 10, + height: 5, ), Divider( - color: Colors.grey[350], + color: Colors.grey, height: 20, - thickness: 5, - indent: 0, - endIndent: 0, - ), - SizedBox( - height: 10, ), - Container( - padding: EdgeInsets.only(left: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: LiveChatPage())); + }, + child: Row( children: [ - Text( - TranslationBase.of(context).reachUs, - style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold), + SvgPicture.asset( + 'assets/images/pharmacy/contact_us_icon.svg', + width: 20, + height: 20, ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).contactUs, + style: TextStyle(fontSize: 13.0), ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: 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, + ), + Divider( + color: Colors.grey, + height: 20, + ), + InkWell( + onTap: () { + Navigator.push(context, FadePage(page: FindUsPage())); + }, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/pharmacy/our_locations_icon.svg', + width: 30, + height: 30, ), SizedBox( - height: 5, + width: 20, ), - Divider( - color: Colors.grey, - height: 20, + Text( + TranslationBase.of(context).ourLocations, + style: TextStyle(fontSize: 13.0), ), - InkWell( - onTap: () { - Navigator.push(context, FadePage(page: 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), - ), - ], - ), - ) ], ), ) ], ), - ), - ) - : Container(), - )); + ) + ], + ), + ), + ) + : Container(), + ), + ); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index b04cbd93..0ce07ec4 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2792,6 +2792,7 @@ class TranslationBase { String get cancelReminder => localizedValues["CancelReminder"][locale.languageCode]; String get reminderCancelSuccess => localizedValues["reminderCancelSuccess"][locale.languageCode]; + String get syncSuccess => localizedValues["syncSuccess"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e24fd6f0..5ae0d119 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -48,9 +48,9 @@ class MyInAppBrowser extends InAppBrowser { static String PACKAGES_PAYMENT_SUCCESS_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentSuccess'; static String PACKAGES_PAYMENT_FAIL_URL = '$EXA_CART_API_BASE_URL/Checkout/MobilePaymentFailed'; - static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete']; + static List successURLS = ['success', 'PayFortResponse', 'PayFortSucess', 'mobilepaymentcomplete', 'orderdetails']; - static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed']; + static List errorURLS = ['PayfortCancel', 'errorpage', 'Failed', 'orderdetails']; final Function onExitCallback; final Function onLoadStartCallback; diff --git a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart index 9731f2b1..1d5893fd 100644 --- a/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart +++ b/lib/widgets/pharmacy/bottom_nav_pharmacy_item.dart @@ -1,16 +1,16 @@ -import 'package:diplomaticquarterapp/Constants.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; -import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/login/welcome.dart'; +import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../../locator.dart'; - class BottomNavPharmacyItem extends StatelessWidget { final String title; final IconData icon; @@ -22,15 +22,10 @@ class BottomNavPharmacyItem extends StatelessWidget { final bool isHome; final IconData activeIcon; - BottomNavPharmacyItem( - {this.icon, - this.changeIndex, - this.index, - this.currentIndex, - this.activeIcon, - this.title, - this.onTap, - this.isHome = false}); + + BottomNavPharmacyItem({this.icon, this.changeIndex, this.index, this.currentIndex, this.activeIcon, this.title, this.onTap, this.isHome = false}); + + AppSharedPreferences sharedPref = AppSharedPreferences(); @override Widget build(BuildContext context) { @@ -39,7 +34,7 @@ class BottomNavPharmacyItem extends StatelessWidget { return Expanded( child: SizedBox( - height: 66.0, + height: 66.0, child: Stack( clipBehavior: Clip.none, children: [ @@ -49,13 +44,8 @@ class BottomNavPharmacyItem extends StatelessWidget { highlightColor: Colors.transparent, splashColor: Colors.transparent, onTap: () { - if (!Provider.of(context, listen: false) - .isLogin && - (currentIndex == 2 || currentIndex == 3)) - Navigator.push( - context, - FadePage(page: WelcomeLogin()), - ); + if (!Provider.of(context, listen: false).isLogin && (currentIndex == 2 || currentIndex == 3)) + login(context); else changeIndex(currentIndex); }, @@ -63,9 +53,6 @@ class BottomNavPharmacyItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ -// SizedBox( -// height: 15, -// ), currentIndex == index ? Divider( color: Color(0xff5AB133), @@ -93,20 +80,14 @@ class BottomNavPharmacyItem extends StatelessWidget { title, textAlign: TextAlign.center, color: currentIndex == index ? Colors.grey : Colors.grey, - fontWeight: currentIndex == index - ? FontWeight.normal - : FontWeight.w400, + fontWeight: currentIndex == index ? FontWeight.normal : FontWeight.w400, fontSize: currentIndex == index ? 11 : 9, ), ], ), ), ), - if (currentIndex == 3 && - Provider.of(context, listen: false) - .cartResponse - .quantityCount != - 0) + if (currentIndex == 3 && Provider.of(context, listen: false).cartResponse.quantityCount != 0) Positioned( top: 11.5, right: -3.5, @@ -131,4 +112,35 @@ class BottomNavPharmacyItem extends StatelessWidget { ), ); } + + void setUserValues(value) async { + if (value != null) sharedPref.setObject(IMEI_USER_DATA, value); + } + + login(BuildContext context) async { + final authService = new AuthProvider(); + var data = await sharedPref.getObject(IMEI_USER_DATA); + sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); + if (data != null) { + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + GifLoaderDialogUtils.showMyDialog(context); + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES value) { + GifLoaderDialogUtils.hideDialog(context); + if (value != null) { + setUserValues(value); + Navigator.of(context).pushNamed(CONFIRM_LOGIN); + } else { + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pushNamed( + WELCOME_LOGIN, + ); + }); + } + } } From 5dc1561992bde1bf029056c513a50c06dae6a8e5 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 17 Nov 2021 09:58:12 +0300 Subject: [PATCH 11/15] fixed notify issue --- .../viewModels/pharmacyModule/product_detail_view_model.dart | 4 ++-- .../pharmacies/screens/product-details/product-detail.dart | 4 ++-- lib/services/pharmacy_services/product_detail_service.dart | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart index df895e28..fff3fbf4 100644 --- a/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart +++ b/lib/core/viewModels/pharmacyModule/product_detail_view_model.dart @@ -57,10 +57,10 @@ class ProductDetailViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future notifyMe(customerId, itemID, context) async { + Future notifyMe(customerId, itemID, ) async { hasError = false; setState(ViewState.BusyLocal); - await _productDetailService.notifyMe(customerId, itemID, context); + await _productDetailService.notifyMe(customerId, itemID, ); if (_productDetailService.hasError) { error = _productDetailService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index 5e226fa8..b838f2dd 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -361,6 +361,6 @@ class __ProductDetailPageState extends State { } } -notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, context}) async { - await model.notifyMe(customerId, itemId, context); +notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model, }) async { + await model.notifyMe(customerId, itemId, ); } diff --git a/lib/services/pharmacy_services/product_detail_service.dart b/lib/services/pharmacy_services/product_detail_service.dart index 5599fc87..389fda0d 100644 --- a/lib/services/pharmacy_services/product_detail_service.dart +++ b/lib/services/pharmacy_services/product_detail_service.dart @@ -123,10 +123,11 @@ class ProductDetailService extends BaseService { return Future.value(localRes); } - Future notifyMe(customerId, itemID, context) async { + Future notifyMe(customerId, itemID, ) async { hasError = false; await baseAppClient.getPharmacy(SUBSCRIBE_PRODUCT + "SinceId=$customerId&ProductId=$itemID", onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: TranslationBase.of(context).notifyMeMsg + AppToast.showSuccessToast(message: TranslationBase.of(AppGlobal.context).notifyMeMsg + // TranslationBase.of(context).notifyMeMsg //'You will be notified when product available' ); }, onFailure: (String error, int statusCode) { From 6d970800f9e767aff1d4b360f8f37fd85724c93d Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Nov 2021 10:38:38 +0300 Subject: [PATCH 12/15] Book Appo fix --- .../BookAppointment/components/DocAvailableAppointments.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 8e576c99..3a6d9185 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -78,7 +78,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) != null && await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); From 7d29ee4468975a88a5331445667b607628faca70 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 17 Nov 2021 10:39:29 +0300 Subject: [PATCH 13/15] cart order page fixes --- .../screens/cart-page/cart-order-page.dart | 75 ++++--------------- 1 file changed, 16 insertions(+), 59 deletions(-) diff --git a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart index 26d014a0..ce7b5f94 100644 --- a/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart +++ b/lib/pages/pharmacies/screens/cart-page/cart-order-page.dart @@ -1,15 +1,12 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/Addresses.dart'; -import 'package:diplomaticquarterapp/core/model/pharmacies/ShoppingCartResponse.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/OrderPreviewViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy-terms-conditions-page.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductOrderItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacy/pharmacyAddresses/PharmacyAddresses.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/buttons/GestureIconButton.dart'; @@ -18,12 +15,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; -import 'package:http/http.dart'; import 'package:provider/provider.dart'; -import '../../../../locator.dart'; -import 'cart-order-preview.dart'; - class CartOrderPage extends StatefulWidget { final Function(int) changeTab; @@ -64,8 +57,7 @@ class _CartOrderPageState extends State { body: NetworkBaseView( isLoading: isLoading, isLocalLoader: true, - child: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) + child: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? Container( height: height * 0.85, width: double.infinity, @@ -92,19 +84,17 @@ class _CartOrderPageState extends State { ), Container( child: ListView.builder( - itemCount: - model.cartResponse.shoppingCarts.length, + itemCount: model.cartResponse.shoppingCarts.length, scrollDirection: Axis.vertical, shrinkWrap: true, physics: ScrollPhysics(), - // physics: const AlwaysScrollableScrollPhysics(), + // physics: const AlwaysScrollableScrollPhysics(), itemBuilder: (context, index) { return ProductOrderItem( item: model.cartResponse.shoppingCarts[index], changeCartItems: () async { GifLoaderDialogUtils.showMyDialog(context); - await model.changeProductQuantity(model - .cartResponse.shoppingCarts[index]); + await model.changeProductQuantity(model.cartResponse.shoppingCarts[index]); if (model.state != ViewState.Error) {} if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); @@ -113,10 +103,7 @@ class _CartOrderPageState extends State { }, deleteCartItems: () async { GifLoaderDialogUtils.showMyDialog(context); - await model - .deleteProduct(model - .cartResponse.shoppingCarts[index]) - .then((value) { + await model.deleteProduct(model.cartResponse.shoppingCarts[index]).then((value) { if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } @@ -246,10 +233,7 @@ class _CartOrderPageState extends State { ), ), bottomSheet: Container( - height: !(model.cartResponse.shoppingCarts == null || - model.cartResponse.shoppingCarts.length == 0) - ? height * 0.15 - : 0, + height: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? height * 0.15 : 0, color: Colors.white, child: OrderBottomWidget(model.addresses, height, model, isLoading), ), @@ -257,8 +241,7 @@ class _CartOrderPageState extends State { } void getData() async { - await Provider.of(context, listen: false) - .getShoppingCart(); + await Provider.of(context, listen: false).getShoppingCart(); setState(() { isLoading = false; }); @@ -284,9 +267,7 @@ class _OrderBottomWidgetState extends State { Widget build(BuildContext context) { ProjectViewModel projectProvider = Provider.of(context); - return !widget.isLoading && - !(widget.model.cartResponse.shoppingCarts == null || - widget.model.cartResponse.shoppingCarts.length == 0) + return !widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || widget.model.cartResponse.shoppingCarts.length == 0) ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -333,8 +314,7 @@ class _OrderBottomWidgetState extends State { padding: EdgeInsets.symmetric(horizontal: 4), margin: const EdgeInsets.symmetric(vertical: 4), child: Texts( - TranslationBase.of(context) - .pharmacyServiceTermsCondition, + TranslationBase.of(context).pharmacyServiceTermsCondition, fontSize: 13, color: Colors.grey.shade800, fontWeight: FontWeight.normal, @@ -342,10 +322,7 @@ class _OrderBottomWidgetState extends State { ), ), InkWell( - onTap: () => { - Navigator.push( - context, FadePage(page: PharmacyTermsConditions())) - }, + onTap: () => {Navigator.push(context, FadePage(page: PharmacyTermsConditions()))}, child: Container( child: Icon( Icons.info, @@ -371,8 +348,7 @@ class _OrderBottomWidgetState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Container( - margin: EdgeInsets.symmetric( - horizontal: 0, vertical: 0), + margin: EdgeInsets.symmetric(horizontal: 0, vertical: 0), child: Row( children: [ Texts( @@ -381,8 +357,7 @@ class _OrderBottomWidgetState extends State { fontWeight: FontWeight.bold, ), Padding( - padding: - const EdgeInsets.symmetric(horizontal: 4), + padding: const EdgeInsets.symmetric(horizontal: 4), child: Texts( "${TranslationBase.of(context).inclusiveVat}", fontSize: 8, @@ -404,33 +379,16 @@ class _OrderBottomWidgetState extends State { ), RaisedButton( onPressed: isAgree -// && cart.cartResponse.shoppingCarts[1].product.stockQuantity ==0 ? () => { if (widget.model.isCartItemsOutOfStock()) - { - // Toast msg - AppToast.showErrorToast( - message: TranslationBase.of(context) - .outOfStockMsg) - } + {AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)} else - { - _navigateToAddressPage(widget - .model.user.patientIdentificationNo) - // Navigator.push( - // context, - // FadePage( - // page: - // OrderPreviewPage(widget.addresses))) - } + {_navigateToAddressPage(widget.model.user.patientIdentificationNo)} } : null, child: new Text( "${TranslationBase.of(context).checkOut}", - style: new TextStyle( - color: - isAgree ? Colors.white : Colors.grey.shade300, - fontSize: 14), + style: new TextStyle(color: isAgree ? Colors.white : Colors.grey.shade300, fontSize: 14), ), color: Color(0xFF4CAF50), disabledColor: Color(0xFF848484), @@ -454,8 +412,7 @@ class _OrderBottomWidgetState extends State { if (result != null) { GifLoaderDialogUtils.showMyDialog(context); var address = result; - widget.model.paymentCheckoutData.address = - Addresses.fromJson(address.toJson()); + widget.model.paymentCheckoutData.address = Addresses.fromJson(address.toJson()); await widget.model.getInformationsByAddress(identificationNo); await widget.model.getShoppingCart(); // widget.changeMainState(); From c87a391a2350946aea061fa1545ec3dd2383a3a8 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 17 Nov 2021 11:06:19 +0300 Subject: [PATCH 14/15] fixed wishlist issue --- lib/pages/pharmacies/ProductCheckTypeWidget.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pages/pharmacies/ProductCheckTypeWidget.dart b/lib/pages/pharmacies/ProductCheckTypeWidget.dart index 46c5e7a3..d0a112c6 100644 --- a/lib/pages/pharmacies/ProductCheckTypeWidget.dart +++ b/lib/pages/pharmacies/ProductCheckTypeWidget.dart @@ -31,7 +31,8 @@ class _ProductCheckTypeWidgetState extends State { ? widget.model.wishListList[index].product.namen : widget.model.wishListList[index].product.name, productPrice: widget.model.wishListList[index].subtotal, - productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + // productRate: double.parse(widget.model.wishListList[index].subtotalVatRate), + productRate: widget.model.wishListList[index].product.approvedRatingSum.toDouble(), approvedTotalReviews:widget.model.wishListList[index].product.approvedTotalReviews, productImage: widget.model.wishListList[index].product.images[0].src, productID: widget.model.wishListList[index].product.id, From ffc2f2b4bb70fa2fa2510bde49254d7d99ed2d11 Mon Sep 17 00:00:00 2001 From: Fatimah Alshammari Date: Wed, 17 Nov 2021 15:43:13 +0300 Subject: [PATCH 15/15] fix issues --- .../screens/product-details/availability_info.dart | 10 ++++++++-- .../screens/product-details/product-detail.dart | 12 +++++++++++- .../screens/product-details/reviews_info.dart | 8 +++++--- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lib/pages/pharmacies/screens/product-details/availability_info.dart b/lib/pages/pharmacies/screens/product-details/availability_info.dart index 13e94c87..2c10c8bf 100644 --- a/lib/pages/pharmacies/screens/product-details/availability_info.dart +++ b/lib/pages/pharmacies/screens/product-details/availability_info.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:url_launcher/url_launcher.dart'; class AvailabilityInfo extends StatelessWidget { final ProductDetailViewModel previousModel; @@ -49,7 +51,9 @@ class AvailabilityInfo extends StatelessWidget { child: IconButton( icon: Icon(Icons.location_on), color: Colors.red, - onPressed: () {}, + onPressed: () { + MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].latitude), previousModel.productLocationService[index].locationDescription); + }, ), ), Expanded( @@ -57,7 +61,9 @@ class AvailabilityInfo extends StatelessWidget { child: IconButton( icon: Icon(Icons.phone), color: Colors.red, - onPressed: () {}, + onPressed: () { + launch("tel://" + previousModel.productLocationService[index].phoneNumber); + }, ), ), ], diff --git a/lib/pages/pharmacies/screens/product-details/product-detail.dart b/lib/pages/pharmacies/screens/product-details/product-detail.dart index b838f2dd..4ca6476b 100644 --- a/lib/pages/pharmacies/screens/product-details/product-detail.dart +++ b/lib/pages/pharmacies/screens/product-details/product-detail.dart @@ -288,10 +288,20 @@ class __ProductDetailPageState extends State { product: widget.product, previousModel: model, ) - : isAvailability + : isAvailability && widget.product.stockAvailability != "Out of stock" ? AvailabilityInfo( previousModel: model ) + : isAvailability && widget.product.stockAvailability == "Out of stock" + ? Container( + // padding: EdgeInsets.all(15), + padding: EdgeInsets.fromLTRB(15,15,15,20), + margin: EdgeInsets.only(bottom: 20), + alignment: Alignment.center, + child: Text( + TranslationBase.of(context).noLocationAvailable, + ), + ) : Container(), ], ), diff --git a/lib/pages/pharmacies/screens/product-details/reviews_info.dart b/lib/pages/pharmacies/screens/product-details/reviews_info.dart index bc1e865c..e3050927 100644 --- a/lib/pages/pharmacies/screens/product-details/reviews_info.dart +++ b/lib/pages/pharmacies/screens/product-details/reviews_info.dart @@ -32,9 +32,11 @@ class ReviewsInfo extends StatelessWidget { children: [ Expanded( child: Container( - child: Text( - previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " - + previousModel.productDetailService[0].reviews[index].customer.lastName.toString(), + child: Text(previousModel.productDetailService[0].reviews[index].customer.firstName != null + && previousModel.productDetailService[0].reviews[index].customer.firstName != null + ? previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " " + + previousModel.productDetailService[0].reviews[index].customer.lastName.toString() + :"", // previousModel.productDetailService[0] // .reviews[index].customerId // .toString(),