From 9ffe064a3bc4fc0836e5ef37f37ac550896e9cc3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 7 Sep 2021 14:12:00 +0300 Subject: [PATCH] updates & fixes --- lib/config/config.dart | 6 +- lib/config/localized_values.dart | 10 +-- .../service/appointment_rate_service.dart | 50 ++++++++++----- .../appointment_rate_view_model.dart | 38 ++++++----- lib/pages/ErService/ErOptions.dart | 2 +- lib/pages/landing/home_page.dart | 6 ++ lib/pages/landing/landing_page.dart | 2 +- lib/pages/login/confirm-login.dart | 10 +-- .../rate_appointment_clinic.dart | 64 +++++++++---------- lib/uitl/utils.dart | 4 +- .../medical/LabResult/LabResultWidget.dart | 5 +- lib/widgets/drawer/app_drawer_widget.dart | 14 ++-- 12 files changed, 120 insertions(+), 91 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index dabfdf55..dd9711b3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -163,13 +163,11 @@ const SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalRe ///Rate const IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; const GET_APPOINTMENT_DETAILS_BY_NO = 'Services/MobileNotifications.svc/REST/GetAppointmentDetailsByApptNo'; +const NEW_RATE_APPOINTMENT_URL = "Services/Doctors.svc/REST/AppointmentsRating_InsertAppointmentRate"; +const NEW_RATE_DOCTOR_URL = "Services/Doctors.svc/REST/DoctorsRating_InsertDoctorRate"; const GET_QR_PARKING = 'Services/SWP.svc/REST/GetQRParkingByID'; -//const BASE_URL = 'https://hmgwebservices.com/'; // Production Environment -//const BASE_URL = 'https://hmgwebservices.com/Services'; // Production Environment -//const BASE_URL = 'https://uat.hmgwebservices.com/Services'; // UAT Environment - //URL to get clinic list const GET_CLINICS_LIST_URL = "Services/lists.svc/REST/GetClinicCentralized"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 11bb669a..67f4bb2d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -303,11 +303,11 @@ const Map localizedValues = { "gate": {"en": "Gate:", "ar": "بوابة"}, "building": {"en": "Building:", "ar": "المبنى"}, "branch": {"en": "Branch:", "ar": "الفرع"}, - "emergencyServices": {"en": "Emergency Services:", "ar": "خدمات الطوارئ"}, - "nearester": {"en": "Nearest ER:", "ar": "أقرب طوارى"}, - "locationa": {"en": "location:", "ar": "الموقع"}, - "ambulancerequest": {"en": "Ambulance :", "ar": "طلب نقل "}, - "requestA": {"en": "Request:", "ar": "اسعاف"}, + "emergencyServices": {"en": "Emergency Services", "ar": "خدمات الطوارئ"}, + "nearester": {"en": "Nearest ER", "ar": "أقرب طوارى"}, + "locationa": {"en": "location", "ar": "الموقع"}, + "ambulancerequest": {"en": "Ambulance", "ar": "طلب نقل "}, + "requestA": {"en": "Request", "ar": "اسعاف"}, "MyAppointments": {"en": "My", "ar": "مواعيدي"}, "NoBookedAppointments": {"en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة"}, "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, diff --git a/lib/core/service/appointment_rate_service.dart b/lib/core/service/appointment_rate_service.dart index 021a680d..16355e9a 100644 --- a/lib/core/service/appointment_rate_service.dart +++ b/lib/core/service/appointment_rate_service.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/model/rate/appointment_rate.dart'; import 'package:diplomaticquarterapp/core/model/rate/appoitment_rated.dart'; -import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; class AppointmentRateService extends BaseService { @@ -10,8 +10,7 @@ class AppointmentRateService extends BaseService { Future getIsLastAppointmentRatedList() async { hasError = false; - await baseAppClient.post(IS_LAST_APPOITMENT_RATED, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(IS_LAST_APPOITMENT_RATED, onSuccess: (dynamic response, int statusCode) { appointmentRatedList.clear(); response['IsLastAppoitmentRatedList'].forEach((appoint) { appointmentRatedList.add(AppoitmentRated.fromJson(appoint)); @@ -27,19 +26,15 @@ class AppointmentRateService extends BaseService { Map bodyData = Map(); bodyData['AppointmentNumber'] = appointmentRatedList[0].appointmentNo; bodyData['ProjectID'] = appointmentRatedList[0].projectID; - await baseAppClient.post(GET_APPOINTMENT_DETAILS_BY_NO, - onSuccess: (dynamic response, int statusCode) { - if (response['AppointmentDetails'] != null) - appointmentDetails = - AppointmentDetails.fromJson(response['AppointmentDetails']); + await baseAppClient.post(GET_APPOINTMENT_DETAILS_BY_NO, onSuccess: (dynamic response, int statusCode) { + if (response['AppointmentDetails'] != null) appointmentDetails = AppointmentDetails.fromJson(response['AppointmentDetails']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: bodyData); } - Future sendAppointmentRate(int rate, int appointmentNo, int projectID, - int doctorID, int clinicID, String note) async { + Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { hasError = false; AppointmentRate appointmentRate = AppointmentRate(); appointmentRate.rate = rate; @@ -51,17 +46,42 @@ class AppointmentRateService extends BaseService { appointmentRate.createdBy = 2; appointmentRate.editedBy = 2; - await baseAppClient.post(NEW_RATE_APPOINTMENT_URL, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(NEW_RATE_APPOINTMENT_URL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: appointmentRate.toJson()); } + Future sendDoctorRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName) async { + Map request; + hasError = false; + request = { + "DoctorID": doctorID, + "Rate": rate, + "ClinicID": clinicID, + "ProjectID": projectID, + "AppointmentNo": appointmentNo, + "Note": note, + "MobileNumber": authenticatedUserObject.user.mobileNumber, + "AppointmentDate": appoDate, + "DoctorName": docName, + "ProjectName": projectName, + "COCTypeName": 1, + "PatientName": authenticatedUserObject.user.firstName + " " + authenticatedUserObject.user.lastName, + "PatientOutSA": authenticatedUserObject.user.outSA, + "PatientTypeID": authenticatedUserObject.user.patientType, + "ClinicName": clinicName, + "PatientIdentificationID": authenticatedUserObject.user.patientIdentificationNo + }; + + await baseAppClient.post(NEW_RATE_DOCTOR_URL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: request); + } + AppoitmentRated get lastAppointmentRated { - if (appointmentRatedList.length > 0) - return appointmentRatedList[appointmentRatedList.length - 1]; + if (appointmentRatedList.length > 0) return appointmentRatedList[appointmentRatedList.length - 1]; return null; } diff --git a/lib/core/viewModels/appointment_rate_view_model.dart b/lib/core/viewModels/appointment_rate_view_model.dart index e1bdfc9e..9e0d338b 100644 --- a/lib/core/viewModels/appointment_rate_view_model.dart +++ b/lib/core/viewModels/appointment_rate_view_model.dart @@ -3,16 +3,15 @@ import 'package:diplomaticquarterapp/core/model/rate/appointment_details.dart'; import 'package:diplomaticquarterapp/core/model/rate/appoitment_rated.dart'; import 'package:diplomaticquarterapp/core/service/appointment_rate_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; + import '../../locator.dart'; class AppointmentRateViewModel extends BaseViewModel { - AppointmentRateService _appointmentRateService = - locator(); + AppointmentRateService _appointmentRateService = locator(); bool isHaveAppointmentNotRate = false; AppointmentDetails get appointmentDetails => _appointmentRateService.appointmentDetails; - Future getIsLastAppointmentRatedList() async { isHaveAppointmentNotRate = false; setState(ViewState.Busy); @@ -21,8 +20,7 @@ class AppointmentRateViewModel extends BaseViewModel { error = _appointmentRateService.error; setState(ViewState.Error); } else { - if(_appointmentRateService.appointmentRatedList.length>0) - await getAppointmentDetails(); + if (_appointmentRateService.appointmentRatedList.length > 0) await getAppointmentDetails(); } } @@ -32,17 +30,14 @@ class AppointmentRateViewModel extends BaseViewModel { error = _appointmentRateService.error; setState(ViewState.Error); } else { - if (_appointmentRateService.appointmentDetails != null) - isHaveAppointmentNotRate = true; + if (_appointmentRateService.appointmentDetails != null) isHaveAppointmentNotRate = true; setState(ViewState.Idle); } } - Future sendAppointmentRate(int rate, int appointmentNo, int projectID, - int doctorID, int clinicID, String note) async { + Future sendAppointmentRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note) async { setState(ViewState.Busy); - await _appointmentRateService.sendAppointmentRate( - rate, appointmentNo, projectID, doctorID, clinicID, note); + await _appointmentRateService.sendAppointmentRate(rate, appointmentNo, projectID, doctorID, clinicID, note); if (_appointmentRateService.hasError) { error = _appointmentRateService.error; setState(ViewState.ErrorLocal); @@ -52,14 +47,23 @@ class AppointmentRateViewModel extends BaseViewModel { } } - AppoitmentRated get lastAppointmentRated => - _appointmentRateService.lastAppointmentRated; + Future sendDoctorRate(int rate, int appointmentNo, int projectID, int doctorID, int clinicID, String note, String appoDate, String docName, String projectName, String clinicName) async { + setState(ViewState.Busy); + await _appointmentRateService.sendDoctorRate(rate, appointmentNo, projectID, doctorID, clinicID, note, appoDate, docName, projectName, clinicName); + if (_appointmentRateService.hasError) { + error = _appointmentRateService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + _appointmentRateService.deleteAllAppAppointmentRate(); + } + } - deleteAppointmentRated(AppoitmentRated appointmentRated) => - _appointmentRateService.deleteAppointmentRated(appointmentRated); + AppoitmentRated get lastAppointmentRated => _appointmentRateService.lastAppointmentRated; - deleteAppAppointmentRate() => - _appointmentRateService.deleteAllAppAppointmentRate(); + deleteAppointmentRated(AppoitmentRated appointmentRated) => _appointmentRateService.deleteAppointmentRated(appointmentRated); + + deleteAppAppointmentRate() => _appointmentRateService.deleteAllAppAppointmentRate(); setIsRated(bool isRated) { this.isHaveAppointmentNotRate = isRated; diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index 6cc61195..8b3e03ed 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -44,7 +44,7 @@ class _ErOptionsState extends State { return AppScaffold( isShowAppBar: widget.isAppbar, - appBarTitle: TranslationBase.of(context).bookAppo, + appBarTitle: TranslationBase.of(context).emergencyServices, isShowDecPage: false, showNewAppBar: true, showNewAppBarTitle: true, diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 9ba5ad9c..80dcaa88 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -40,6 +40,12 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { PharmacyModuleViewModel pharmacyModuleViewModel = locator(); + @override + void initState() { + // TODO: implement initState + super.initState(); + } + @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 1e50e81d..cc49804d 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -232,7 +232,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { locationUtils = new LocationUtils(isShowConfirmDialog: false, context: context); WidgetsBinding.instance.addPostFrameCallback((_) { - // locationUtils.getCurrentLocation(); + locationUtils.getCurrentLocation(); if (projectViewModel.isLogin) { familyFileProvider.getSharedRecordByStatus(); } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 85669531..6d271761 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -23,9 +24,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.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'; @@ -35,7 +34,6 @@ import 'package:intl/intl.dart'; import 'package:local_auth/auth_strings.dart'; import 'package:local_auth/local_auth.dart'; import 'package:provider/provider.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; class ConfirmLogin extends StatefulWidget { @override @@ -375,6 +373,7 @@ class _ConfirmLogin extends State { } var tempType; + startSMSService(type) { tempType = type; new SMSOTP( @@ -510,9 +509,12 @@ class _ConfirmLogin extends State { GifLoaderDialogUtils.showMyDialog(context); var request = this.getCommonRequest().toJson(); + dynamic res; + authService .checkActivationCode(request, value) .then((result) => { + res = result, if (result is Map) { result = CheckActivationCode.fromJson(result), @@ -530,7 +532,7 @@ class _ConfirmLogin extends State { // sharedPref.setString( // BLOOD_TYPE, result['PatientBloodType']), authenticatedUserObject.user = result.list, - + projectViewModel.setPrivilege(privilegeList: res), sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(USER_PROFILE, result.list), loginTokenID = result.logInTokenID, diff --git a/lib/pages/rateAppointment/rate_appointment_clinic.dart b/lib/pages/rateAppointment/rate_appointment_clinic.dart index d1d3388f..15c040ab 100644 --- a/lib/pages/rateAppointment/rate_appointment_clinic.dart +++ b/lib/pages/rateAppointment/rate_appointment_clinic.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; @@ -14,15 +15,13 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class RateAppointmentClinic extends StatefulWidget { final AppointmentDetails appointmentDetails; final String doctorNote; final int doctorRate; - RateAppointmentClinic( - {this.appointmentDetails, this.doctorRate, this.doctorNote}); + RateAppointmentClinic({this.appointmentDetails, this.doctorRate, this.doctorNote}); @override _RateAppointmentClinicState createState() => _RateAppointmentClinicState(); @@ -43,8 +42,7 @@ class _RateAppointmentClinicState extends State { appBar: AppBar( elevation: 0, textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), title: Text('Rate'), leading: Builder( @@ -91,11 +89,7 @@ class _RateAppointmentClinicState extends State { height: 8, ), LargeAvatar( - url: - 'https://hmgwebservices.com/Images/Hospitals/' + - model.appointmentDetails.projectID - .toString() + - '.jpg', + url: 'https://hmgwebservices.com/Images/Hospitals/' + model.appointmentDetails.projectID.toString() + '.jpg', name: model.appointmentDetails.clinicName, width: 110, height: 110, @@ -112,9 +106,7 @@ class _RateAppointmentClinicState extends State { height: 4, ), Texts( - DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - model.appointmentDetails.appointmentDate)), + DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(model.appointmentDetails.appointmentDate)), ), SizedBox( height: 8, @@ -146,10 +138,8 @@ class _RateAppointmentClinicState extends State { duration: Duration(milliseconds: 1000), switchInCurve: Curves.elasticOut, switchOutCurve: Curves.elasticIn, - transitionBuilder: - (Widget child, Animation animation) { - return ScaleTransition( - child: child, scale: animation); + transitionBuilder: (Widget child, Animation animation) { + return ScaleTransition(child: child, scale: animation); }, child: Container( key: ValueKey(rating), @@ -162,9 +152,7 @@ class _RateAppointmentClinicState extends State { }, iconSize: rating == (index + 1) ? 60 : 40, // Theme.of(context).hintColor, - icon: Image.asset('assets/images/' + - (index + 1).toString() + - '.png')), + icon: Image.asset('assets/images/' + (index + 1).toString() + '.png')), ), ), ) @@ -192,25 +180,33 @@ class _RateAppointmentClinicState extends State { if (rating > 0) { model .sendAppointmentRate( - rating, - widget.appointmentDetails.appointmentNo, - widget.appointmentDetails.projectID, - widget.appointmentDetails.doctorID, - widget.appointmentDetails.clinicID, - note) + rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note) .then( (value) => { - Navigator.pushReplacement( - context, - FadePage( - page: LandingPage(), - ), - ) + model + .sendDoctorRate( + widget.doctorRate, + widget.appointmentDetails.appointmentNo, + widget.appointmentDetails.projectID, + widget.appointmentDetails.doctorID, + widget.appointmentDetails.clinicID, + note, + widget.appointmentDetails.appointmentDate, + widget.appointmentDetails.doctorName, + widget.appointmentDetails.projectName, + widget.appointmentDetails.clinicName) + .then((value) { + Navigator.pushReplacement( + context, + FadePage( + page: LandingPage(), + ), + ); + }), }, ); } else { - AppToast.showErrorToast( - message: 'please rate the clinic'); + AppToast.showErrorToast(message: 'please rate the clinic'); } }, label: TranslationBase.of(context).submit, diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 5259837a..fd0f9a48 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -852,14 +852,14 @@ class Utils { ); } - static Widget tableColumnValue(String text, {bool isLast = false}) { + static Widget tableColumnValue(String text, {bool isLast = false, bool isCapitable = true}) { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ SizedBox(height: 12), Text( - text.toLowerCase().capitalizeFirstofEach, + isCapitable ? text.toLowerCase().capitalizeFirstofEach : text, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), ), SizedBox(height: 12), diff --git a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart index 6914554b..f9eb0427 100644 --- a/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart +++ b/lib/widgets/data_display/medical/LabResult/LabResultWidget.dart @@ -14,7 +14,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; - import '../../text.dart'; import 'FlowChartPage.dart'; @@ -116,7 +115,7 @@ class LabResultWidget extends StatelessWidget { openPassportUpdatePage(BuildContext context) { Navigator.push(context, FadePage(page: PassportUpdatePage())).then((value) { print(value); - if(value != null && value == true) { + if (value != null && value == true) { showConfirmMessage(context, projectViewModel.user.emailAddress, "yes"); } }); @@ -179,7 +178,7 @@ class LabResultWidget extends StatelessWidget { children: [ Utils.tableColumnValue(labResultList[i].description, isLast: i == (labResultList.length - 1)), Utils.tableColumnValue(labResultList[i].resultValue + " " + labResultList[i].uOM, isLast: i == (labResultList.length - 1)), - Utils.tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1)), + Utils.tableColumnValue(labResultList[i].referanceRange, isLast: i == (labResultList.length - 1), isCapitable: false), ], ), ); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index ed62a579..b13a6095 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -1,23 +1,24 @@ import 'dart:io'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -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/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; -import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_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/Authentication/select_device_imei_res.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/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; -import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -32,11 +33,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; -import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; + import '../../config/size_config.dart'; import '../../locator.dart'; import 'drawer_item_widget.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; class AppDrawer extends StatefulWidget { @override @@ -59,10 +59,12 @@ class _AppDrawerState extends State { AuthenticatedUserObject authenticatedUserObject = locator(); VitalSignService _vitalSignService = locator(); AppointmentRateViewModel appointmentRateViewModel = locator(); + PrivilegeService _privilegeService = locator(); ToDoCountProviderModel toDoProvider; String booldType; String notificationCount; final authService = new AuthProvider(); + @override Widget build(BuildContext context) { projectProvider = Provider.of(context); @@ -497,6 +499,8 @@ class _AppDrawerState extends State { await authenticatedUserObject.getUser(); _vitalSignService.heightCm = ""; _vitalSignService.weightKg = ""; + await _privilegeService.getPrivilege(); + projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); var appLanguage = await sharedPref.getString(APP_LANGUAGE); await sharedPref.clear(); await sharedPref.setString(APP_LANGUAGE, appLanguage);