diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 75638ae8..b5cad835 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -75,7 +75,8 @@ const Map localizedValues = { 'ar': 'يرجى تأكيد الموعد لتفادي الإلغاء' }, "book-success-confirm-more-24-1-2": { - "en": "The online payment process will be available 24 hours before the appointment.", + "en": + "The online payment process will be available 24 hours before the appointment.", "ar": "- عملية الدفع الالكتروني ستكون متاحة قبل الموعد ب 24 ساعة." }, 'upcoming-payment-pending': { @@ -1114,85 +1115,78 @@ const Map localizedValues = { "not-active": {"en": "Not Active", "ar": "غير نشط"}, "card-detail": {"en": "Insurance Details", "ar": "منافعك التامينية"}, "Dr": {"en": "Dr. ", "ar": "الدكتور."}, - "empty": { - "en": "You do not have any records.", - "ar": "ليس لديك أي سجلات" - }, + "empty": {"en": "You do not have any records.", "ar": "ليس لديك أي سجلات"}, "last-visit": { "en": "How was your last visit with doctor?", "ar": "كيف تقيم زيارتك الأخيرة للطبيب؟" }, - "tap-title": { - "en": "Please rate the doctor", - "ar": "يرجى تقييم الطبيب" - }, - "later": { - "en": "Later", - "ar": "لاحقاً" - }, - "sendSuc":{ - "en":"A copy has been sent to the email", - "ar":"تم إرسال نسخة إلى البريد الإلكتروني" + "tap-title": {"en": "Please rate the doctor", "ar": "يرجى تقييم الطبيب"}, + "later": {"en": "Later", "ar": "لاحقاً"}, + "sendSuc": { + "en": "A copy has been sent to the email", + "ar": "تم إرسال نسخة إلى البريد الإلكتروني" }, "instructions": { - "en": "You can now talk directly to the appointments department by chat or request a call back", - "ar": "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" + "en": + "You can now talk directly to the appointments department by chat or request a call back", + "ar": + "يمكنك الان التحدث مباشرة مع قسم المواعيد عن طريق خدمة المحادثة النصية أو طلب معاودة الاتصال" }, "instructions-pharmacies": { - "en": "You can now talk directly to the pharmacist by chat or request a call back", - "ar": "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" - }, - "select-hospital": { - "en": "Choose Hospital", - "ar": "اختر المستشفى" - }, - "start": { - "en": "Start", - "ar": "ابدأ" + "en": + "You can now talk directly to the pharmacist by chat or request a call back", + "ar": + "يمكنك الآن التحدث مباشرة إلى الصيدلي عن طريق الدردشة أو طلب معاودة الاتصال" }, + "select-hospital": {"en": "Choose Hospital", "ar": "اختر المستشفى"}, + "start": {"en": "Start", "ar": "ابدأ"}, "info-chat": { - "en": "This service allows you to chat with customer service directly without the need to call.", - "ar": "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." + "en": + "This service allows you to chat with customer service directly without the need to call.", + "ar": + "المحادثة المباشرة: هذه الخدمة تمكنك التحدث كتابياً مع خدمة العملاء مباشرة دون الحاجة الى الاتصال هاتفياً." }, "last-appointment": { "en": "How was your appointment?", "ar": "كيف كان موعدك الطبي ؟" }, - "rate-clinic": { - "en": "Please rate the clinic", - "ar": "يرجى تقييم العيادة" - }, - "fetch-data": { - "en": "Fetch Data", - "ar": "تحديث الان" - }, + "rate-clinic": {"en": "Please rate the clinic", "ar": "يرجى تقييم العيادة"}, + "fetch-data": {"en": "Fetch Data", "ar": "تحديث الان"}, + "rate": {"en": "Rate", "ar": "تقييم"}, "send-email": { "en": "Send a copy of this report to the email", "ar": "أرسل نسخة من هذا التقرير إلى البريد الإلكتروني" }, - "update-email": { - "en": "Update Email", - "ar": "تحديث البريد الالكتروني" + "update-email": {"en": "Update Email", "ar": "تحديث البريد الالكتروني"}, + "booked-success": { + "en": "The appointment has been successfully booked.", + "ar": "لقد تم حجز الموعد بنجاح" }, - "noDataAvailable": { - "en": "No data available", - "ar": " لا يوجد بيانات متاحة " + "appo-reminder-select-option-30": { + "en": "Before 30 Mins", + "ar": "قبل 30 دقيقة" + }, + "appo-reminder-select-option-60": { + "en": "Before 1 Hour", + "ar": "قبل ساعة واحدة" }, - "noSearchResult": { - "en": "No Search Result", - "ar": "لا توجد نتيجة بحث" + "appo-reminder-select-option-90": { + "en": "Before 1 Hour and 30 mins", + "ar": "قبل ساعة و 30 دقيقة" }, - "selectFileSouse": { - "en": "Select file souse", - "ar": "حدد الملف" + "appo-reminder-select-option-120": { + "en": "Before 2 Hours", + "ar": "قبل ساعتين" }, - "gallery": { - "en": "Gallery", - "ar": "معرض الصور" - }, "camera": { - "en": "Camera", - "ar": "كاميرا" + "noDataAvailable": { + "en": "No data available", + "ar": " لا يوجد بيانات متاحة " }, + "thename": {"en": "The Name", "ar": "الاسم"}, + "noSearchResult": {"en": "No Search Result", "ar": "لا توجد نتيجة بحث"}, + "selectFileSouse": {"en": "Select file souse", "ar": "حدد الملف"}, + "gallery": {"en": "Gallery", "ar": "معرض الصور"}, + "camera": {"en": "Camera", "ar": "كاميرا"}, "med-report": { "en": "Medical Reports", "ar": "التقارير الطبية" diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index bcd7195b..a4e17388 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -19,4 +19,6 @@ const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; const IS_VIBRATION = 'is_vibration'; const THEME_VALUE = 'is_vibration'; const MAIN_USER = 'main-user'; -const WEATHER = 'weather'; \ No newline at end of file +const WEATHER = 'weather'; +const BLOOD_TYPE = 'blood-type'; +const NOTIFICATION_COUNT = 'notification-count'; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 1d8a9d2f..d7e08a66 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -423,7 +423,7 @@ class _BookConfirmState extends State { context) .then((res) { if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); print(res['AppointmentNo']); Future.delayed(new Duration(milliseconds: 500), () { diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 8ac1d197..7caf1977 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -178,7 +178,8 @@ class _DocAvailableAppointmentsState extends State holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), ), daysOfWeekStyle: DaysOfWeekStyle( - weekendStyle: TextStyle().copyWith(color: Colors.blue[600]), + weekendStyle: TextStyle().copyWith(color: Colors.black, fontSize: 14.0), + weekdayStyle: TextStyle().copyWith(color: Colors.black, fontSize: 14.0), ), headerStyle: HeaderStyle( centerHeaderTitle: true, @@ -190,7 +191,7 @@ class _DocAvailableAppointmentsState extends State opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), child: Container( margin: const EdgeInsets.all(4.0), - padding: const EdgeInsets.only(top: 5.0, left: 6.0), + padding: const EdgeInsets.only(top: 5.0, left: 5.0), color: Colors.transparent, width: 0, height: 0, diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index 02c1eb90..1d91f7de 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -15,30 +16,26 @@ class DoctorInformation extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + AppExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + "assets/images/DQ/doctor_information_icon.svg"), + Container( + margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), + child: Text(TranslationBase.of(context).docInfo, + style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), + ), + ], + ), ), - child: Column( + bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - "assets/images/DQ/doctor_information_icon.svg"), - Container( - margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text(TranslationBase.of(context).docInfo, - style: - TextStyle(fontSize: 16.0, letterSpacing: 0.8)), - ), - ], - ), - ), Container( padding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 10.0), child: Table( @@ -79,31 +76,27 @@ class DoctorInformation extends StatelessWidget { ], ), ), - Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + // ), + AppExpandableNotifier( + headerWidget: Container( + margin: EdgeInsets.all(10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SvgPicture.asset( + "assets/images/DQ/doctor_qualification_icon.svg"), + Container( + margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), + child: Text(TranslationBase.of(context).docQualifications, + style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), + ), + ], + ), ), - child: Column( + bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.max, children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SvgPicture.asset( - "assets/images/DQ/doctor_qualification_icon.svg"), - Container( - margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text( - TranslationBase.of(context).docQualifications, - style: - TextStyle(fontSize: 16.0, letterSpacing: 0.8)), - ), - ], - ), - ), Container( margin: EdgeInsets.fromLTRB(20.0, 0.0, 10.0, 5.0), child: Column( @@ -136,9 +129,7 @@ class DoctorInformation extends StatelessWidget { child: Text(text, maxLines: 16, style: TextStyle( - fontSize: 13, - letterSpacing: 0.5, - color: Colors.grey[700])), + fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), ); } @@ -151,10 +142,7 @@ class DoctorInformation extends StatelessWidget { children: [ Text(text.trim(), style: TextStyle( - fontSize: 13, - - letterSpacing: 0.5, - color: Colors.grey[700])), + fontSize: 13, letterSpacing: 0.5, color: Colors.grey[700])), Container( margin: EdgeInsets.only(left: 5.0, right: 5.0), child: Image.network(icon, width: 18.0, height: 18.0), diff --git a/lib/pages/DrawerPages/family/add-family_type.dart b/lib/pages/DrawerPages/family/add-family_type.dart index 2c85b043..cec0a0ab 100644 --- a/lib/pages/DrawerPages/family/add-family_type.dart +++ b/lib/pages/DrawerPages/family/add-family_type.dart @@ -27,7 +27,7 @@ class AddFamilyMemberType extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( - 'assets/images/habib-logo.png', + 'assets/images/DQ/dq_logo_icon.png', height: 80, width: 80, ), diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index a86503a7..62dae624 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -55,7 +55,7 @@ class _MyFamily extends State with TickerProviderStateMixin { ProjectViewModel projectViewModel; AuthenticatedUser user; VitalSignService _vitalSignService = locator(); - + var isVaiable = false; @override void initState() { _tabController = new TabController(length: 2, vsync: this, initialIndex: 0); @@ -229,7 +229,8 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text("No data found")); + child: Text( + TranslationBase.of(context).noDataAvailable)); else return Padding( padding: EdgeInsets.only(top: 50), @@ -355,7 +356,8 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text('No data found')); + child: Text(TranslationBase.of(context) + .noDataAvailable)); else return Column( children: [ @@ -389,12 +391,20 @@ class _MyFamily extends State with TickerProviderStateMixin { left: 10, right: 10), child: Row(children: [ Expanded( - flex: 3, child: AppText('Name')), + flex: 3, + child: AppText( + TranslationBase.of(context) + .theName)), Expanded( - flex: 1, child: AppText('Allow')), + flex: 1, + child: AppText( + TranslationBase.of(context) + .allowView)), Expanded( flex: 1, - child: AppText('Reject')), + child: AppText( + TranslationBase.of(context) + .rejectView)), ])), Column( children: familyFileProvider @@ -469,12 +479,25 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text('No data found')); + child: Text(TranslationBase.of(context) + .noDataAvailable)); else - return SingleChildScrollView( - child: Container( - height: SizeConfig.screenHeight * .3, - child: ListView( + return Container( + height: SizeConfig.screenHeight * .3, + child: SingleChildScrollView( + child: Column( + children: [ + Padding( + padding: EdgeInsets.only( + left: 10, right: 10), + child: Row(children: [ + Expanded( + flex: 3, + child: AppText( + TranslationBase.of(context) + .theName)) + ])), + Column( children: snapshot .data.getAllSharedRecordsByStatusList .map((result) { @@ -492,12 +515,17 @@ class _MyFamily extends State with TickerProviderStateMixin { result.statusDescription, color: result.status == 3 ? Colors.green - : Colors.red, + : result.status == 2 + ? Colors + .yellow[800] + : Colors.red, )), ], )); }).toList(), - ))); + ) + ], + ))); } }) ], @@ -522,70 +550,59 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text('No data found')); + child: Text(TranslationBase.of(context) + .noDataAvailable)); else return Column( children: [ - // Padding( - // padding:EdgeInsets.only(left:10, right:10), - // child: Row( - // mainAxisAlignment: - // MainAxisAlignment.spaceBetween, - // children: [ - // Expanded( - // flex: 3, - // child: AppText( - // TranslationBase.of(context).request), - // ), - // Expanded( - // flex: 2, - // child: AppText( - // TranslationBase.of(context).switchUser, - // )), - // Expanded( - // flex: 1, - // child: AppText( - // TranslationBase.of(context).deleteView, - // )), - // ], - // )), Column(children: [ Padding( padding: EdgeInsets.only(left: 10, right: 10), child: Row(children: [ Expanded( - flex: 3, child: AppText('Name')), + flex: 3, + child: AppText( + TranslationBase.of(context) + .theName)), Expanded( - flex: 1, child: AppText('Delete')), + flex: 1, + child: AppText( + TranslationBase.of(context) + .deleteView)), ])), Column( children: familyFileProvider .allSharedRecordsByStatusResponse .getAllSharedRecordsByStatusList .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: AppText( - result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deactivateRequest( - result.iD, 5, context); - }, - )), - ], - )); + return result.status == 3 + ? Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: AppText( + result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deactivateRequest( + result.iD, + 5, + context); + }, + )), + ], + )) + : Container( + child: AppText(isAvailable())); }).toList()) ]) ], @@ -600,6 +617,15 @@ class _MyFamily extends State with TickerProviderStateMixin { ); } + String isAvailable() { + if (isVaiable == false) { + this.isVaiable = true; + return TranslationBase.of(context).noDataAvailable; + } else { + return ""; + } + } + Future getFamilyFiles() async { if (user != null) { if (await sharedPref.getObject(FAMILY_FILE) != null) { @@ -689,6 +715,7 @@ class _MyFamily extends State with TickerProviderStateMixin { } this.sharedPref.setString(APP_LANGUAGE, currentLang); this.sharedPref.setObject(MAIN_USER, mainUser); + //sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); diff --git a/lib/pages/MyAppointments/AppointmentDetails.dart b/lib/pages/MyAppointments/AppointmentDetails.dart index 4fc038a6..b638b2ff 100644 --- a/lib/pages/MyAppointments/AppointmentDetails.dart +++ b/lib/pages/MyAppointments/AppointmentDetails.dart @@ -37,13 +37,16 @@ class _AppointmentDetailsState extends State @override void initState() { _tabController = new TabController(length: 2, vsync: this); + AppointmentDetails.showFooterButton = false; super.initState(); } + @override void dispose() { super.dispose(); _tabController.dispose(); + AppointmentDetails.showFooterButton = false; } @override @@ -162,7 +165,7 @@ class _AppointmentDetailsState extends State ), Container( alignment: Alignment.center, - child: Text(widget.appo.startTime), + child: Text(widget.appo.startTime.substring(0, 5)), ), Container( margin: EdgeInsets.only(top: 10.0), diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index f36a2828..a49149b5 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -28,6 +29,10 @@ class MyAppointments extends StatefulWidget { List(); List _patientArrivedAppointmentListHospital = List(); + List _patientBookedAppointmentListClinic = List(); + List _patientConfirmedAppointmentListClinic = List(); + List _patientArrivedAppointmentListClinic = List(); + @override _MyAppointmentsState createState() => _MyAppointmentsState(); } @@ -43,9 +48,12 @@ class _MyAppointmentsState extends State List imagesInfo = List(); + FilterType filterType; + @override void initState() { _tabController = new TabController(length: 3, vsync: this); + filterType = FilterType.Clinic; WidgetsBinding.instance.addPostFrameCallback((_) { if (Provider.of(context, listen: false).isLogin) getPatientAppointmentHistory(); @@ -84,6 +92,42 @@ class _MyAppointmentsState extends State color: Colors.grey[600], thickness: 0.5, ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () => setFilterType(FilterType.Clinic), + child: ListTile( + title: Text(TranslationBase.of(context).clinic), + leading: Radio( + value: FilterType.Clinic, + groupValue: filterType, + activeColor: Theme.of(context).primaryColor, + onChanged: (FilterType value) { + setFilterType(value); + }, + ), + ), + ), + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => setFilterType(FilterType.Hospital), + child: ListTile( + title: Text(TranslationBase.of(context).hospital), + leading: Radio( + value: FilterType.Hospital, + groupValue: filterType, + activeColor: Theme.of(context).primaryColor, + onChanged: (FilterType value) => setFilterType(value), + ), + ), + ), + ) + ], + ), isDataLoaded ? Expanded( child: new TabBarView( @@ -114,6 +158,10 @@ class _MyAppointmentsState extends State widget._patientConfirmedAppointmentListHospital.clear(); widget._patientArrivedAppointmentListHospital.clear(); + widget._patientBookedAppointmentListClinic.clear(); + widget._patientConfirmedAppointmentListClinic.clear(); + widget._patientArrivedAppointmentListClinic.clear(); + service.getPatientAppointmentHistory(false, context).then((res) { print(res['AppoimentAllHistoryResultList'].length); GifLoaderDialogUtils.hideDialog(context); @@ -123,7 +171,8 @@ class _MyAppointmentsState extends State if (res['AppoimentAllHistoryResultList'].length != 0) { // isDataLoaded = true; res['AppoimentAllHistoryResultList'].forEach((v) { - widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v)); + widget.appoList + .add(new AppoitmentAllHistoryResultList.fromJson(v)); }); sortAppointmentList(); } else {} @@ -169,11 +218,31 @@ class _MyAppointmentsState extends State }); widget.bookedAppoList.forEach((element) { + List doctorByClinic = + widget._patientBookedAppointmentListClinic + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByClinic.length != 0) { + widget + ._patientBookedAppointmentListClinic[widget + ._patientBookedAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientBookedAppointmentListClinic.add(PatientAppointmentList( + filterName: element.clinicName, patientDoctorAppointment: element)); + } + List doctorByHospital = widget._patientBookedAppointmentListHospital .where( (elementClinic) => - elementClinic.filterName == element.clinicName, + elementClinic.filterName == element.projectName, ) .toList(); @@ -186,16 +255,39 @@ class _MyAppointmentsState extends State .add(element); } else { widget._patientBookedAppointmentListHospital.add(PatientAppointmentList( - filterName: element.clinicName, patientDoctorAppointment: element)); + filterName: element.projectName, + patientDoctorAppointment: element)); } }); widget.confirmedAppoList.forEach((element) { + List doctorByClinic = + widget._patientConfirmedAppointmentListClinic + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByClinic.length != 0) { + widget + ._patientConfirmedAppointmentListClinic[widget + ._patientConfirmedAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientConfirmedAppointmentListClinic.add( + PatientAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + List doctorByHospital = widget._patientConfirmedAppointmentListHospital .where( (elementClinic) => - elementClinic.filterName == element.clinicName, + elementClinic.filterName == element.projectName, ) .toList(); @@ -209,17 +301,37 @@ class _MyAppointmentsState extends State } else { widget._patientConfirmedAppointmentListHospital.add( PatientAppointmentList( - filterName: element.clinicName, + filterName: element.projectName, patientDoctorAppointment: element)); } }); widget.arrivedAppoList.forEach((element) { + List doctorByClinic = + widget._patientArrivedAppointmentListClinic + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByClinic.length != 0) { + widget + ._patientArrivedAppointmentListClinic[widget + ._patientArrivedAppointmentListClinic + .indexOf(doctorByClinic[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList( + filterName: element.clinicName, patientDoctorAppointment: element)); + } + List doctorByHospital = widget._patientArrivedAppointmentListHospital .where( (elementClinic) => - elementClinic.filterName == element.clinicName, + elementClinic.filterName == element.projectName, ) .toList(); @@ -233,9 +345,10 @@ class _MyAppointmentsState extends State } else { widget._patientArrivedAppointmentListHospital.add( PatientAppointmentList( - filterName: element.clinicName, + filterName: element.projectName, patientDoctorAppointment: element)); } + openAppointmentsTab(); }); } @@ -250,11 +363,11 @@ class _MyAppointmentsState extends State } else if (flag == 3) { _tabController.index = 2; } else { - if (widget._patientBookedAppointmentListHospital.length != 0) { + if (widget._patientBookedAppointmentListClinic.length != 0) { _tabController.index = 0; - } else if (widget._patientConfirmedAppointmentListHospital.length != 0) { + } else if (widget._patientConfirmedAppointmentListClinic.length != 0) { _tabController.index = 1; - } else if (widget._patientArrivedAppointmentListHospital.length != 0) { + } else if (widget._patientArrivedAppointmentListClinic.length != 0) { _tabController.index = 2; return; } @@ -270,24 +383,42 @@ class _MyAppointmentsState extends State child: Column( children: [ ...List.generate( - widget._patientBookedAppointmentListHospital.length, + filterType == FilterType.Clinic + ? widget._patientBookedAppointmentListClinic.length + : widget._patientBookedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - ._patientBookedAppointmentListHospital[index] - .filterName, + title: filterType == FilterType.Clinic + ? widget + ._patientBookedAppointmentListClinic[index] + .filterName + : widget + ._patientBookedAppointmentListHospital[index] + .filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientBookedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), + children: filterType == FilterType.Clinic + ? widget + ._patientBookedAppointmentListClinic[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList() + : widget + ._patientBookedAppointmentListHospital[ + index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), )), ) ], @@ -325,24 +456,43 @@ class _MyAppointmentsState extends State child: Column( children: [ ...List.generate( - widget._patientConfirmedAppointmentListHospital.length, + filterType == FilterType.Clinic + ? widget._patientConfirmedAppointmentListClinic.length + : widget + ._patientConfirmedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - ._patientConfirmedAppointmentListHospital[index] - .filterName, + title: filterType == FilterType.Clinic + ? widget + ._patientConfirmedAppointmentListClinic[index] + .filterName + : widget + ._patientConfirmedAppointmentListHospital[index] + .filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientConfirmedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), + children: filterType == FilterType.Clinic + ? widget + ._patientConfirmedAppointmentListClinic[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList() + : widget + ._patientConfirmedAppointmentListHospital[ + index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), )), ) ], @@ -378,24 +528,38 @@ class _MyAppointmentsState extends State child: Column( children: [ ...List.generate( - widget._patientArrivedAppointmentListHospital.length, + filterType == FilterType.Clinic + ? widget._patientArrivedAppointmentListClinic.length + : widget._patientArrivedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget - ._patientArrivedAppointmentListHospital[index] - .filterName, + title: filterType == FilterType.Clinic + ? widget._patientArrivedAppointmentListClinic[index] + .filterName + : widget._patientArrivedAppointmentListHospital[index] + .filterName, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientArrivedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), + children: filterType == FilterType.Clinic + ? widget._patientArrivedAppointmentListClinic[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList() + : widget + ._patientArrivedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), ), ), ) @@ -422,4 +586,10 @@ class _MyAppointmentsState extends State ), ); } + + setFilterType(FilterType filterType) { + setState(() { + this.filterType = filterType; + }); + } } diff --git a/lib/pages/MyAppointments/models/ArrivedButtons.dart b/lib/pages/MyAppointments/models/ArrivedButtons.dart index ab139203..a710e00c 100644 --- a/lib/pages/MyAppointments/models/ArrivedButtons.dart +++ b/lib/pages/MyAppointments/models/ArrivedButtons.dart @@ -46,7 +46,7 @@ class ArrivedButtons { "caller": "Insurance" }, { - "title": TranslationBase.of(AppGlobal.context).askYour, + "title": TranslationBase.of(AppGlobal.context).askDoctor, "subtitle": TranslationBase.of(AppGlobal.context).askYourSubtitle, "icon": "assets/images/new-design/ask_doctor_icon.png", "caller": "askDoc" diff --git a/lib/pages/MyAppointments/widgets/custom_radio.dart b/lib/pages/MyAppointments/widgets/custom_radio.dart index 2ea9a39c..b21e34ec 100644 --- a/lib/pages/MyAppointments/widgets/custom_radio.dart +++ b/lib/pages/MyAppointments/widgets/custom_radio.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/models/AskDocRequestTypeModel.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/askDocDialog.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/reminder_dialog.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class CustomRadio extends StatefulWidget { @@ -21,17 +22,23 @@ class CustomRadioState extends State { void initState() { super.initState(); - if (widget.requestData != null) { - widget.requestData.forEach((element) { - sampleData.add( - new RadioModel(false, element.description, element.parameterCode)); - }); - } else { - sampleData.add(new RadioModel(false, "Before 30 Mins", 30)); - sampleData.add(new RadioModel(false, 'Before 1 Hour', 60)); - sampleData.add(new RadioModel(false, 'Before 2 Hours', 120)); - sampleData.add(new RadioModel(false, 'Before 4 Hours', 240)); - } + WidgetsBinding.instance.addPostFrameCallback((_) { + if (widget.requestData != null) { + widget.requestData.forEach((element) { + sampleData.add(new RadioModel( + false, element.description, element.parameterCode)); + }); + } else { + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder30, 30)); + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder60, 60)); + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder90, 90)); + sampleData.add(new RadioModel( + false, TranslationBase.of(context).appoReminder120, 120)); + } + }); } @override @@ -96,7 +103,7 @@ class RadioItem extends StatelessWidget { ), ), new Container( - margin: new EdgeInsets.only(left: 15.0), + margin: new EdgeInsets.only(left: 15.0, right: 15.0), child: new Text(_item.text, style: TextStyle(fontSize: 16.0)), ), ], diff --git a/lib/pages/MyAppointments/widgets/reminder_dialog.dart b/lib/pages/MyAppointments/widgets/reminder_dialog.dart index 13955e5b..b8803469 100644 --- a/lib/pages/MyAppointments/widgets/reminder_dialog.dart +++ b/lib/pages/MyAppointments/widgets/reminder_dialog.dart @@ -27,19 +27,18 @@ class _ReminderDialogState extends State { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)), child: Container( - height: MediaQuery.of(context).size.height * 0.57, + // height: MediaQuery.of(context).size.height * 0.57, width: 450.0, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, children: [ Container( margin: EdgeInsets.all(20.0), child: Text(TranslationBase.of(context).setReminder, style: TextStyle( fontSize: 20.0, - fontWeight: FontWeight.bold, - fontFamily: "Open-Sans-Bold")), + fontWeight: FontWeight.bold)), ), Container( transform: Matrix4.translationValues(0.0, -30.0, 0.0), @@ -61,13 +60,12 @@ class _ReminderDialogState extends State { child: Text(TranslationBase.of(context).confirm, style: TextStyle( color: Colors.white, - fontWeight: FontWeight.bold, - fontFamily: 'Open-Sans-Bold')), + fontWeight: FontWeight.bold)), ), ), Container( width: MediaQuery.of(context).size.width, - margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0), + margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0, bottom: 20.0), child: OutlineButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0)), @@ -81,8 +79,7 @@ class _ReminderDialogState extends State { child: Text(TranslationBase.of(context).cancel_nocaps, style: TextStyle( color: Colors.red, - fontWeight: FontWeight.bold, - fontFamily: 'Open-Sans-Bold')), + fontWeight: FontWeight.bold)), ), ), ]), diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 98d9cc10..9f93f45c 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; @@ -69,6 +70,7 @@ class _ToDoState extends State { @override Widget build(BuildContext context) { toDoProvider = Provider.of(context); + ProjectViewModel projectViewModel = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, imagesInfo: imagesInfo, @@ -109,11 +111,15 @@ class _ToDoState extends State { height: 20.0), Container( margin: - EdgeInsets.only(left: 5.0, right: 20.0), + EdgeInsets.only(left: 10.0, right: 10.0), child: Text( - getDate(widget - .appoList[index].appointmentDate), - style: TextStyle(fontSize: 11.0)), + DateUtil.getWeekDayMonthDayYearDateFormatted( + DateUtil.convertStringToDate(widget + .appoList[index].appointmentDate), + projectViewModel.isArabic + ? "ar" + : "en") + " " + widget.appoList[index].startTime.substring(0, 5), + style: TextStyle(fontSize: 10.0)), ), widget.appoList[index].isLiveCareAppointment ? SvgPicture.asset( @@ -141,7 +147,7 @@ class _ToDoState extends State { : "-", overflow: TextOverflow.clip, maxLines: 2, - style: TextStyle(fontSize: 11.0)), + style: TextStyle(fontSize: 10.0)), ), ], ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index b8d27d65..2094efd9 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -32,7 +32,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; - +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import '../../locator.dart'; import '../../routes.dart'; import 'home_page.dart'; @@ -154,7 +154,10 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (token != null && await sharedPref.getObject(USER_PROFILE) == null) { DEVICE_TOKEN = token; checkUserStatus(token); + } else { + getNotificationCount(token); } + requestPermissions(); }).catchError((err) { print(err); @@ -513,25 +516,13 @@ class _LandingPageState extends State with WidgetsBindingObserver { // themeNotifier.setTheme(defaultTheme); } void checkUserStatus(token) async { + GifLoaderDialogUtils.showMyDialog(context); authService .selectDeviceImei(token) - .then((SelectDeviceIMEIRES value) => setUserValues(value)); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = - AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - if (data != null) { - authService - .registeredAuthenticatedUser(data, token, 0, 0) - .then((res) => {print(res)}); - authService.getDashboard().then((value) => { - setState(() { - notificationCount = value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] - .toString(); - }) - }); - } - } + .then((SelectDeviceIMEIRES value) => setUserValues(value)) + .catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + }); } static Future myBackgroundMessageHandler( @@ -551,6 +542,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { } void setUserValues(value) async { + GifLoaderDialogUtils.hideDialog(context); sharedPref.setObject(IMEI_USER_DATA, value); } @@ -571,4 +563,24 @@ class _LandingPageState extends State with WidgetsBindingObserver { ); } } + + getNotificationCount(token) async { + if (await sharedPref.getObject(USER_PROFILE) != null) { + var data = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + if (data != null) { + authService + .registeredAuthenticatedUser(data, token, 0, 0) + .then((res) => {print(res)}); + authService.getDashboard().then((value) => { + setState(() { + notificationCount = value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] + .toString(); + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); + }) + }); + } + } + } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index cdd9c09b..7f7c883d 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -9,6 +9,8 @@ import 'package:diplomaticquarterapp/models/Authentication/check_activation_code import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; @@ -22,6 +24,7 @@ import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/otp/sms-popup.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -384,55 +387,34 @@ class _ConfirmLogin extends State { } getMobileInfo(request) { - GifLoaderDialogUtils.showMyDialog(context); - this - .authService - .getLoginInfo(request) - .then((result) => { - GifLoaderDialogUtils.hideDialog(context), - if (result['SMSLoginRequired'] == false) - { - this.loginTokenID = result.logInTokenID, - this.patientOutSA = result.patientOutSA, - // sms for register the biometric - if (result.isSMSSent) - { - this.onlySMSBox = false, - //this.button(); - } - else - {checkActivationCode()} - } - else - { - if (result['IsAuthenticated'] == true) - { - setState(() { - isMoreOption = true; - this.onlySMSBox = true; - // this.fingrePrintBefore = true; - }), - - //sharedPref.setBool(ONLY_SMS, true), - // this.cs.sharedService.setSharedData(true, AuthenticationService.ONLY_SMS); - //this.cs.sharedService.setSharedData(this.selectedOption, AuthenticationService.FINGUREPRINT_BEFORE); - // this.cs.confirmLogin(); - //this.button(); - } - // else - // { - // // this.cs.presentAlert(result.ErrorEndUserMessage); - // } - } - }) - .catchError((err) { + // GifLoaderDialogUtils.showMyDialog(context); + this.authService.getLoginInfo(request).then((result) { + GifLoaderDialogUtils.hideDialog(context); + if (result['SMSLoginRequired'] == false) { + this.loginTokenID = result.logInTokenID; + this.patientOutSA = result.patientOutSA; + // sms for register the biometric + if (result.isSMSSent) { + this.onlySMSBox = false; + //this.button(); + } else { + checkActivationCode(); + } + } else { + if (result['IsAuthenticated'] == true) { + setState(() { + isMoreOption = true; + this.onlySMSBox = true; + // this.fingrePrintBefore = true; + }); + } + } + }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); }); } - setUser() async {} - setDefault() async { if (await sharedPref.getObject(IMEI_USER_DATA) != null) user = SelectDeviceIMEIRES.fromJson( @@ -533,6 +515,8 @@ class _ConfirmLogin extends State { sharedPref.remove(FAMILY_FILE), result.list.isFamily = false, userData = result.list, + // sharedPref.setString( + // BLOOD_TYPE, result['PatientBloodType']), sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), loginTokenID = result.logInTokenID, @@ -591,7 +575,35 @@ class _ConfirmLogin extends State { appointmentRateViewModel.isLogin = true; projectViewModel.isLogin = true; getToDoCount(); - Navigator.of(context).pushNamed(HOME); + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + getToDoCount(), + // GifLoaderDialogUtils.hideDialog(context), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + //GifLoaderDialogUtils.hideDialog(context); + }); + // SMSOTP.showLoadingDialog(context, false), } loading(flag) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 740de4b8..46f52280 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -244,6 +244,7 @@ class _Login extends State { sharedPref.remove(FAMILY_FILE); result = CheckActivationCode.fromJson(result); result.list.isFamily = false; + // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(MAIN_USER, result.list); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index c0ee178d..7eb2621b 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -179,7 +179,7 @@ class PrescriptionItemsPage extends StatelessWidget { ), bottomSheet: Container( width: double.infinity, - height: MediaQuery.of(context).size.height * 0.1, + height: MediaQuery.of(context).size.height * 0.12, color: Colors.grey[100], child: Column( children: [ diff --git a/lib/pages/rateAppointment/rate_appointment_doctor.dart b/lib/pages/rateAppointment/rate_appointment_doctor.dart index c83b178e..2d8379ee 100644 --- a/lib/pages/rateAppointment/rate_appointment_doctor.dart +++ b/lib/pages/rateAppointment/rate_appointment_doctor.dart @@ -40,7 +40,7 @@ class _RateAppointmentDoctorState extends State { headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), - title: Text('Rate'), + title: Text(TranslationBase.of(context).rate), leading: Builder( builder: (BuildContext context) { return IconButton( @@ -94,7 +94,7 @@ class _RateAppointmentDoctorState extends State { height: 22, ), Texts( - model.appointmentDetails.doctorName, + TranslationBase.of(context).dr + " " + model.appointmentDetails.doctorName, bold: true, ), SizedBox( diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 07e1e301..3476435b 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -256,6 +256,7 @@ class AuthProvider with ChangeNotifier { return Future.value(error); // throw error; }, body: neRequest.toJson()); + sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { throw error; diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 0b0c1ef5..7a2dec81 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -299,7 +299,7 @@ class FamilyFilesProvider with ChangeNotifier { AppToast.showErrorToast(message: error); throw error; }, body: request); - + sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { print(error); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 605a865e..2952c132 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1004,28 +1004,47 @@ class TranslationBase { String get cardDetail => localizedValues['card-detail'][locale.languageCode]; String get dr => localizedValues['Dr'][locale.languageCode]; String get sendSuc => localizedValues['sendSuc'][locale.languageCode]; - String get instructions => localizedValues['instructions'][locale.languageCode]; - String get instructionsPharmacies => localizedValues['instructions-pharmacies'][locale.languageCode]; - String get selectHospitalDec => localizedValues['select-hospital'][locale.languageCode]; + String get instructions => + localizedValues['instructions'][locale.languageCode]; + String get instructionsPharmacies => + localizedValues['instructions-pharmacies'][locale.languageCode]; + String get selectHospitalDec => + localizedValues['select-hospital'][locale.languageCode]; String get start => localizedValues['start'][locale.languageCode]; String get infoChat => localizedValues['info-chat'][locale.languageCode]; - String get noRecords => localizedValues['empty'][locale.languageCode]; String get lastVisit => localizedValues['last-visit'][locale.languageCode]; String get tapTitle => localizedValues['tap-title'][locale.languageCode]; String get later => localizedValues['later'][locale.languageCode]; - String get lastAppointment => localizedValues['last-appointment'][locale.languageCode]; + String get lastAppointment => + localizedValues['last-appointment'][locale.languageCode]; String get rateClinic => localizedValues['rate-clinic'][locale.languageCode]; String get fetchData => localizedValues['fetch-data'][locale.languageCode]; - - String get sendConfEmail => localizedValues['send-email'][locale.languageCode]; - String get updateEmail => localizedValues['update-email'][locale.languageCode]; - String get noDataAvailable => localizedValues['noDataAvailable'][locale.languageCode]; - String get noSearchResult => localizedValues['noSearchResult'][locale.languageCode]; - String get selectFileSouse => localizedValues['selectFileSouse'][locale.languageCode]; + String get sendConfEmail => + localizedValues['send-email'][locale.languageCode]; + String get updateEmail => + localizedValues['update-email'][locale.languageCode]; + String get noDataAvailable => + localizedValues['noDataAvailable'][locale.languageCode]; + String get theName => localizedValues['thename'][locale.languageCode]; + String get noSearchResult => + localizedValues['noSearchResult'][locale.languageCode]; + String get selectFileSouse => + localizedValues['selectFileSouse'][locale.languageCode]; + String get rate => localizedValues['rate'][locale.languageCode]; + String get bookedSuccess => + localizedValues['booked-success'][locale.languageCode]; + String get appoReminder30 => + localizedValues['appo-reminder-select-option-30'][locale.languageCode]; + String get appoReminder60 => + localizedValues['appo-reminder-select-option-60'][locale.languageCode]; + String get appoReminder90 => + localizedValues['appo-reminder-select-option-90'][locale.languageCode]; + String get appoReminder120 => + localizedValues['appo-reminder-select-option-120'][locale.languageCode]; String get gallery => localizedValues['gallery'][locale.languageCode]; String get camera => localizedValues['camera'][locale.languageCode]; String get medReport => localizedValues['med-report'][locale.languageCode]; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 6686cd54..24afde74 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -2,12 +2,15 @@ import 'dart:io'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notifications_page.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; +import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -16,6 +19,7 @@ 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/widgets/text/app_texts_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -44,9 +48,11 @@ class _AppDrawerState extends State { AuthenticatedUserObject authenticatedUserObject = locator(); VitalSignService _vitalSignService = locator(); - + AppointmentRateViewModel appointmentRateViewModel = + locator(); ToDoCountProviderModel toDoProvider; - + String booldType; + String notificationCount; @override Widget build(BuildContext context) { toDoProvider = Provider.of(context); @@ -64,7 +70,7 @@ class _AppDrawerState extends State { padding: EdgeInsets.zero, children: [ Container( - height: SizeConfig.screenHeight * .27, + height: SizeConfig.screenHeight * .28, padding: EdgeInsets.all(15), child: InkWell( child: Column( @@ -86,23 +92,27 @@ class _AppDrawerState extends State { children: [ Padding( padding: - EdgeInsets.only(right: 5), + EdgeInsets.only(right: 0), child: Icon( Icons.account_circle, color: Color(0xFF40ACC9), + size: 28, )), - AppText( - user.firstName + - ' ' + - user.lastName, - color: Color(0xFF40ACC9), - ) + Padding( + padding: + EdgeInsets.only(right: 5), + child: AppText( + user.firstName + + ' ' + + user.lastName, + color: Color(0xFF40ACC9), + )) ], ), Row(children: [ Padding( - padding: - EdgeInsets.only(left: 30), + padding: EdgeInsets.only( + left: 30, right: 10), child: Column( children: [ AppText( @@ -118,9 +128,9 @@ class _AppDrawerState extends State { 1.5, ), AppText( - user.bloodGroup != null + booldType != null ? 'Blood Group: ' + - user.bloodGroup + booldType : '', fontSize: SizeConfig .textMultiplier * @@ -128,7 +138,8 @@ class _AppDrawerState extends State { ), ], )) - ]) + ]), + Divider() ])) : SizedBox(), ], @@ -206,9 +217,15 @@ class _AppDrawerState extends State { children: < Widget>[ Expanded( - child: Icon( - Icons - .person), + child: + Icon( + Icons + .account_circle, + color: Color( + 0xFF40ACC9), + size: + 24, + ), ), Expanded( flex: 7, @@ -246,25 +263,25 @@ class _AppDrawerState extends State { result, context); }, - child: Row( - crossAxisAlignment: - CrossAxisAlignment.start, - children: < - Widget>[ - Expanded( - child: - Icon(Icons.person, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - ), - Expanded( - flex: 7, - child: Padding( - padding: EdgeInsets.only(left: 5, right: 5), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - AppText(TranslationBase.of(context).fileno + ": " + result.responseID.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), - ]))), - ], - ))) + child: Padding( + padding: EdgeInsets.only(right: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Expanded( + child: Icon(Icons.account_circle, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ), + Expanded( + flex: 7, + child: Padding( + padding: EdgeInsets.only(left: 5, right: 5), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + AppText(result.patientName, color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + AppText(TranslationBase.of(context).fileno + ": " + result.responseID.toString(), color: result.responseID == user.patientID ? Color(0xFF40ACC9) : Colors.black), + ]))), + ], + )))) : SizedBox(); }).toList()) ], @@ -286,10 +303,43 @@ class _AppDrawerState extends State { }, ), InkWell( - child: DrawerItem( - TranslationBase.of(context) - .notification, - Icons.notifications), + child: Stack( + children: [ + DrawerItem( + TranslationBase.of(context) + .notification, + Icons.notifications, + count: notificationCount != null + ? new Container( + padding: EdgeInsets.all(4), + margin: EdgeInsets.all(2), + decoration: new BoxDecoration( + color: Colors.red, + borderRadius: + BorderRadius.circular( + 20), + ), + constraints: BoxConstraints( + minWidth: 20, + minHeight: 20, + ), + child: new Text( + notificationCount, + style: new TextStyle( + color: Colors.white, + fontSize: projectProvider + .isArabic + ? 8 + : 9, + ), + textAlign: TextAlign.center, + ), + // ), + ) + : SizedBox(), + ), + ], + ), onTap: () { //NotificationsPage Navigator.of(context).pop(); @@ -446,8 +496,11 @@ class _AppDrawerState extends State { var data2 = AuthenticatedUser.fromJson( await this.sharedPref.getObject(MAIN_USER)); - print(data2); + booldType = await sharedPref.getString(BLOOD_TYPE); + notificationCount = await sharedPref.getString(NOTIFICATION_COUNT); + setState(() { + notificationCount = notificationCount; this.user = data; this.mainUser = data2; }); @@ -466,8 +519,6 @@ class _AppDrawerState extends State { Navigator.of(context).pushNamed(HOME); } - - login() async { var data = await sharedPref.getObject(IMEI_USER_DATA); sharedPref.remove(REGISTER_DATA_FOR_LOGIIN); @@ -498,7 +549,7 @@ class _AppDrawerState extends State { .familyFileProvider .silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser) - .then((value) async{ + .then((value) async { await authenticatedUserObject.getUser(); _vitalSignService.heightCm = ""; _vitalSignService.weightKg = ""; @@ -513,7 +564,6 @@ class _AppDrawerState extends State { } loginAfter(result, context) async { - Utils.hideProgressDialog(); result = CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); var currentLang = await sharedPref.getString(APP_LANGUAGE); @@ -523,15 +573,41 @@ class _AppDrawerState extends State { result.list.isFamily = true; } this.sharedPref.setString(APP_LANGUAGE, currentLang); - + // sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']); this.sharedPref.setObject(MAIN_USER, mainUser); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(FAMILY_FILE, familyFile); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID); //this.checkIfUserAgreedBefore(result), - Navigator.of(context).pushNamed( - HOME, - ); + appointmentRateViewModel + .getIsLastAppointmentRatedList() + .then((value) => { + //getToDoCount(), + Utils.hideProgressDialog(), + if (appointmentRateViewModel.isHaveAppointmentNotRate) + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: RateAppointmentDoctor(), + ), + (r) => false) + } + else + { + Navigator.pushAndRemoveUntil( + context, + FadePage( + page: LandingPage(), + ), + (r) => false) + } + }) + .catchError((err) { + print(err); + Utils.hideProgressDialog(); + // GifLoaderDialogUtils.hideDialog(context); + }); } } diff --git a/lib/widgets/drawer/drawer_item_widget.dart b/lib/widgets/drawer/drawer_item_widget.dart index e5a1eb50..100b9ae0 100644 --- a/lib/widgets/drawer/drawer_item_widget.dart +++ b/lib/widgets/drawer/drawer_item_widget.dart @@ -13,11 +13,13 @@ class DrawerItem extends StatefulWidget { final Color iconColor; final bool bottomLine; final bool sideArrow; + final Widget count; DrawerItem(this.title, this.icon, {this.textColor = Colors.black, this.iconColor = Colors.black87, this.subTitle = '', this.bottomLine = true, + this.count, this.sideArrow = false}); @override @@ -55,10 +57,15 @@ class _DrawerItemState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - Texts( - widget.title, - color: widget.textColor, - fontSize: SizeConfig.textMultiplier * 2.3, + Row( + children: [ + Texts( + widget.title, + color: widget.textColor, + fontSize: SizeConfig.textMultiplier * 2.3, + ), + widget.count ?? SizedBox(), + ], ), widget.subTitle != '' ? Texts( @@ -73,7 +80,7 @@ class _DrawerItemState extends State { flex: 1, child: Icon(Icons.keyboard_arrow_right, color: Colors.red)) - : Expanded(flex: 1, child: SizedBox()) + : Expanded(flex: 1, child: SizedBox()), ], ), ));