diff --git a/assets/images/pharmacy/shipping_image.png b/assets/images/pharmacy/shipping_image.png new file mode 100644 index 00000000..ba16e92c Binary files /dev/null and b/assets/images/pharmacy/shipping_image.png differ diff --git a/assets/images/pharmacy/shipping_image_ar.png b/assets/images/pharmacy/shipping_image_ar.png new file mode 100644 index 00000000..cb623a62 Binary files /dev/null and b/assets/images/pharmacy/shipping_image_ar.png differ diff --git a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart index 803a80f0..12d7eab3 100644 --- a/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart +++ b/lib/core/service/AlHabibMedicalService/customer_addresses_service.dart @@ -77,9 +77,9 @@ class CustomerAddressesService extends BaseService { class CustomerInfo { bool isRegistered; String userName; - Null password; + dynamic password; String email; - Null errorMessage; + dynamic errorMessage; String mobileNumber; int customerId; @@ -121,19 +121,19 @@ class AddressInfo { String firstName; String lastName; String email; - Null company; + dynamic company; int countryId; String country; - Null stateProvinceId; + dynamic stateProvinceId; String city; String address1; String address2; String zipPostalCode; String phoneNumber; - Null faxNumber; + dynamic faxNumber; String customerAttributes; String createdOnUtc; - Null province; + dynamic province; String latLong; AddressInfo( diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index c0d80bf5..fd25a3ab 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -44,11 +44,16 @@ class BaseAppClient { } try { //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + var pharmacyToken = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); + var user = await sharedPref.getObject(USER_PROFILE); + Map headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }; if (!isExternal) { String token = await sharedPref.getString(TOKEN); var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - var user = await sharedPref.getObject(USER_PROFILE); if (body.containsKey('SetupID')) { body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null @@ -102,22 +107,26 @@ class BaseAppClient { ? body['PatientID'] : user['PatientID']; body['PatientOutSA'] = user['OutSA']; - body['SessionID'] = SESSION_ID; //getSessionId(token); + body['SessionID'] = SESSION_ID; //getSe + headers = { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'Authorization': pharmacyToken, + 'Mobilenumber': user['MobileNumber'].toString(), + 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', + 'Username': user['PatientID'].toString(), + }; } } } print("URL : $url"); print("Body : ${json.encode(body)}"); - var ss = json.encode(body); if (await Utils.checkConnection()) { final response = await http.post(url.trim(), body: json.encode(body), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }); + headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { @@ -268,15 +277,6 @@ class BaseAppClient { var token = await sharedPref.getString(PHARMACY_AUTORZIE_TOKEN); var user = await sharedPref.getObject(USER_PROFILE); - // Map test = { - // 'Content-Type': 'application/json', - // 'Accept': 'application/json', - // 'Authorization': token ?? "", - // 'Mobilenumber': user['MobileNumber'].toString(), - // 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', - // 'Username': user['PatientID'].toString(), - // }; - if (await Utils.checkConnection()) { final response = await http.get(url.trim(), headers: { 'Content-Type': 'application/json', diff --git a/lib/core/viewModels/PrescriptionDeliveryViewModel.dart b/lib/core/viewModels/PrescriptionDeliveryViewModel.dart new file mode 100644 index 00000000..e9731bae --- /dev/null +++ b/lib/core/viewModels/PrescriptionDeliveryViewModel.dart @@ -0,0 +1,26 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + +import '../../locator.dart'; + +class PrescriptionDeliveryViewModel extends BaseViewModel{ + + CustomerAddressesService _customerAddressesService = locator(); + + List get addressesList => _customerAddressesService.addressesList; + + Future getCustomerAddresses() async { + setState(ViewState.Busy); + await _customerAddressesService.getCustomerAddresses( + ); + if (_customerAddressesService.hasError) { + error = _customerAddressesService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + +} \ No newline at end of file diff --git a/lib/locator.dart b/lib/locator.dart index 0dfca5af..4d7f1e50 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -69,6 +69,7 @@ import 'core/service/parmacyModule/parmacy_module_service.dart'; import 'core/service/offers_service.dart'; import 'core/service/pharmacy_categorise_service.dart'; import 'core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart'; +import 'core/viewModels/PrescriptionDeliveryViewModel.dart'; import 'core/viewModels/TermsConditionsViewModel.dart'; import 'core/viewModels/all_habib_medical_services/e_referral_view_model.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; @@ -255,6 +256,7 @@ void setupLocator() { locator.registerFactory(() => EyeViewModel()); locator.registerFactory(() => ActiveMedicationsViewModel()); locator.registerFactory(() => AskDoctorViewModel()); + locator.registerFactory(() => PrescriptionDeliveryViewModel()); locator.registerFactory(() => AllergiesViewModel()); locator.registerFactory(() => HomeHealthCareViewModel()); diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index 431990e8..009a7a16 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -121,7 +121,7 @@ class _MedicalProfilePageState extends State { childAspectRatio: MediaQuery.of(context) .size .width / - (MediaQuery.of(context).size.height / 2.40), + (MediaQuery.of(context).size.height / 2.20), ), itemCount: myMedicalList.length, itemBuilder: (BuildContext context, int index) { diff --git a/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart new file mode 100644 index 00000000..b33246de --- /dev/null +++ b/lib/pages/medical/prescriptions/PrescriptionIDeliveryAddressPage.dart @@ -0,0 +1,99 @@ +import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/core/model/prescriptions/Prescriptions.dart'; + +class PrescriptionDeliveryAddressPage extends StatelessWidget { + final Prescriptions prescriptions; + + const PrescriptionDeliveryAddressPage({Key key, this.prescriptions}) + : super(key: key); + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return AppScaffold( + isShowAppBar: true, + appBarTitle: 'Delivery Address', + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + height: 15, + ), + InkWell( + onTap: () {}, + child: Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + height: 50, + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(7), + color: Colors.white, + shape: BoxShape.rectangle, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: Texts( + 'Selected Address', + variant: 'bodyText', + ), + margin: EdgeInsets.only(left: 10, right: 10), + ), + Icon( + Icons.arrow_drop_down, + size: 22, + color: Colors.grey, + ) + ], + ), + ), + ), + SizedBox( + height: 15, + ), + Container( + + child: Image.asset(projectViewModel.isArabic + ? 'assets/images/pharmacy/shipping_image_ar.png' + : 'assets/images/pharmacy/shipping_image.png',height: 300,), + ) + ], + ), + ), + bottomSheet: Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.25, + color: Colors.grey[100], + child: Column( + children: [ + Divider(), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Add New Address'.toUpperCase(), + onTap: () {}, + ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + label: 'Continue'.toUpperCase(), + backgroundColor: Colors.green[200], + onTap: () {}, + )) + ], + ), + )); + } +} diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 6fb07f68..864bdca2 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -14,12 +15,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../widgets/dialogs/confirm_send_email_dialog.dart'; +import 'PrescriptionIDeliveryAddressPage.dart'; class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; PrescriptionItemsPage({Key key, this.prescriptions}); - + //TODO @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); @@ -181,7 +183,7 @@ class PrescriptionItemsPage extends StatelessWidget { ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.14, + height: MediaQuery.of(context).size.height * 0.25, color: Colors.grey[100], child: Column( children: [ @@ -197,12 +199,22 @@ class PrescriptionItemsPage extends StatelessWidget { loading: model.state == ViewState.BusyLocal, ), ), - if (false) Container( width: MediaQuery.of(context).size.width * 0.8, - child: Button( + child: SecondaryButton( label: TranslationBase.of(context).resendOrder, - backgroundColor: Colors.green[200], + color: Colors.green[200], + onTap: (){ + var asd=""; + Navigator.push( + context, + FadePage( + page: PrescriptionDeliveryAddressPage( + prescriptions: prescriptions, + ), + ), + ); + }, )) ], ), diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index b2c52b2b..85e97429 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -206,33 +206,30 @@ class Utils { ); }, child: isLogin - ? Container( - height: 120, - child: Stack(children: [ - MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true, - ), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: secondaryColor.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), - badgeContent: Container( - padding: EdgeInsets.all(2.0), - child: Text(count.toString(), - style: - TextStyle(color: Colors.white, fontSize: 16.0)), - ), + ? Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + ), + Positioned( + right: 0.0, + child: Badge( + toAnimate: false, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: + TextStyle(color: Colors.white, fontSize: 16.0)), ), ), - ]), - ) + ), + ]) : MedicalProfileItem( title: TranslationBase.of(context).myAppointments, imagePath: 'my_appointment_icon.png', diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index 1751e0e5..15a08218 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -22,31 +22,32 @@ class MedicalProfileItem extends StatelessWidget { @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); - return RoundedContainer( - showBorder: true, - borderWidth: 0, - margin: 4, - child: Container( - padding: EdgeInsets.all(10), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(title, - fontSize: 1.5 * SizeConfig.textMultiplier, - color: secondaryColor, - fontWeight: FontWeight.bold), - Texts(subTitle,fontSize: 1.4 * SizeConfig.textMultiplier,), - Align( - alignment:projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, - child: Image.asset( - "assets/images/medical/$imagePath", - height: SizeConfig.heightMultiplier * 5, - width: SizeConfig.heightMultiplier * 5, - ), - ) - ], - ), + return Container( + height: 180, + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white + ), + padding: EdgeInsets.all(10), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts(title, + fontSize: 1.5 * SizeConfig.textMultiplier, + color: secondaryColor, + fontWeight: FontWeight.bold), + Texts(subTitle,fontSize: 1.4 * SizeConfig.textMultiplier,), + Align( + alignment:projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, + child: Image.asset( + "assets/images/medical/$imagePath", + height: SizeConfig.heightMultiplier * 5, + width: SizeConfig.heightMultiplier * 5, + ), + ) + ], ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index b891a671..2c07d0c9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,6 +49,7 @@ dependencies: shared_preferences: ^0.5.8 flutter_flexible_toast: ^0.1.4 firebase_messaging: ^7.0.3 + cloud_firestore: ^0.14.3 android_intent: ^0.3.7+7 # Progress bar progress_hud_v2: ^2.0.0