diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 6e0914f8..edd8802f 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,12 +3,15 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:http/http.dart' as http; +import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = new Helpers(); +//ProjectProvider projectsProvider = new ProjectProvider(); /* *@author: Mohammad Aljammal @@ -38,6 +41,7 @@ class BaseAppClient { String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; body['ProjectID'] = doctorProfile?.projectID; @@ -45,7 +49,13 @@ class BaseAppClient { body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; - body['LanguageID'] = LANGUAGE_ID; + + String lang = await sharedPref.getString(APP_Language); + if (lang != null && lang == 'ar') + body['LanguageID'] = 1; + else + body['LanguageID'] = 2; + body['stamp'] = STAMP; body['IPAdress'] = IP_ADDRESS; body['VersionID'] = VERSION_ID; diff --git a/lib/config/config.dart b/lib/config/config.dart index e642e79d..a93d5de1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -32,6 +32,9 @@ const GET_RADIOLOGY = 'Services/DoctorApplication.svc/REST/GetPatientRadResult'; const GET_LIVECARE_PENDINGLIST = 'Services/DoctorApplication.svc/REST/GetPendingPatientER'; const START_LIVECARE_CALL = 'LiveCareApi/DoctorApp/CallPatient'; +const LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL = + "Lists.svc/REST/DashBoard_GetLiveCareDoctorsStatsticsForCertainDoctor"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ @@ -62,6 +65,15 @@ var SERVICES_PATIANT_HEADER = [ "Tomorrow", "Referral" ]; +var SERVICES_PATIANT_HEADER_AR = [ + "المريض الخارجي", + "المريض المنوم", + "المريض المعافى", + "المريض المحول الي", + "المريض المحال المعافى", + "مريض الغد", + "المريض المحول مني" +]; //****************** // Colors ////// by : ibrahim diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2e046718..892d54fe 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -211,5 +211,7 @@ const Map> localizedValues = { 'en': 'You don\'t have any Orders', 'ar': 'لا يوجد لديك اي طلبات' }, - 'livecare': {'en': 'Live Care', 'ar': 'Live Care'} + 'livecare': {'en': 'Live Care', 'ar': 'Live Care'}, + 'beingBad': {'en': 'being bad', 'ar': 'سيء'}, + 'beingGreat': {'en': 'being great', 'ar': 'راثع'}, }; diff --git a/lib/models/doctor/statstics_for_certain_doctor_request.dart b/lib/models/doctor/statstics_for_certain_doctor_request.dart new file mode 100644 index 00000000..08fa03f3 --- /dev/null +++ b/lib/models/doctor/statstics_for_certain_doctor_request.dart @@ -0,0 +1,36 @@ +class StatsticsForCertainDoctorRequest { + bool outSA; + int doctorID; + String tokenID; + int channel; + int projectID; + String generalid; + + StatsticsForCertainDoctorRequest( + {this.outSA, + this.doctorID, + this.tokenID, + this.channel, + this.projectID, + this.generalid}); + + StatsticsForCertainDoctorRequest.fromJson(Map json) { + outSA = json['OutSA']; + doctorID = json['DoctorID']; + tokenID = json['TokenID']; + channel = json['Channel']; + projectID = json['ProjectID']; + generalid = json['generalid']; + } + + Map toJson() { + final Map data = new Map(); + data['OutSA'] = this.outSA; + data['DoctorID'] = this.doctorID; + data['TokenID'] = this.tokenID; + data['Channel'] = this.channel; + data['ProjectID'] = this.projectID; + data['generalid'] = this.generalid; + return data; + } +} diff --git a/lib/providers/doctors_provider.dart b/lib/providers/doctors_provider.dart new file mode 100644 index 00000000..6ef4b7db --- /dev/null +++ b/lib/providers/doctors_provider.dart @@ -0,0 +1,68 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/models/doctor/statstics_for_certain_doctor_request.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:flutter/cupertino.dart'; + +Helpers helpers = Helpers(); +DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + +StatsticsForCertainDoctorRequest _statsticsForCertainDoctorRequest = StatsticsForCertainDoctorRequest(); + + +var certainDoctorsStasticsList = []; + +/*@author: ibrahem albitar + *@Date:22/6/2020 + *@desc: Doctor Provider + */ + +class DoctorsProvider with ChangeNotifier { + + bool isLoading = false; + bool isError = false; + String error = ''; + + resetDefaultValues() { + isLoading = true; + isError = false; + error = ''; + notifyListeners(); + } + + + /*@author: ibrahem albitar + *@Date:22/6/2020 + *@desc: StatsticsForCertainDoctor + */ + getStatsticsForCertainDoctor(String generalId) async { + resetDefaultValues(); + try { + _statsticsForCertainDoctorRequest.generalid = generalId; + await BaseAppClient.post(LIVE_CARE_STATISTICS_FOR_CERTAIN_DOCTOR_URL, + onSuccess: (dynamic response, int statusCode) { + certainDoctorsStasticsList = response['List_LiveCareCertainDoctorsStastics']; + isLoading = false; + isError = false; + this.error = ''; + }, onFailure: (String error, int statusCode) { + isLoading = false; + isError = true; + this.error = error; + }, body: _statsticsForCertainDoctorRequest.toJson()); + notifyListeners(); + } catch (err) { + handelCatchErrorCase(err); + } + } + + handelCatchErrorCase(err) { + isLoading = false; + isError = true; + error = helpers.generateContactAdminMsg(err); + notifyListeners(); + throw err; + } + +} \ No newline at end of file diff --git a/lib/providers/hospital_provider.dart b/lib/providers/hospital_provider.dart index 547bffe2..a32e9516 100644 --- a/lib/providers/hospital_provider.dart +++ b/lib/providers/hospital_provider.dart @@ -6,7 +6,7 @@ class HospitalProvider with ChangeNotifier { Future getProjectsList() async { const url = GET_PROJECTS; var info = { - "LanguageID": 2, + "LanguageID": 1, "stamp": "2020-02-26T13:51:44.111Z", "IPAdress": "11.11.11.11", "VersionID": 1.2, @@ -15,17 +15,13 @@ class HospitalProvider with ChangeNotifier { "SessionID": "i1UJwCTSqt", "IsLoginForDoctorApp": true }; - dynamic localRes ; + dynamic localRes; - await BaseAppClient.post(url, - onSuccess: ( response, statusCode) async { - localRes= response; - }, - onFailure: (String error, int statusCode) { - throw error; - }, - body: info); + await BaseAppClient.post(url, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: info); return Future.value(localRes); - } } diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index 05b11e96..be2d47de 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -22,6 +22,7 @@ class _VideoCallPageState extends State { LiveCareProvider _liveCareProvider; bool _isInit = true; var patientData = {}; + String image_url = 'https://hmgwebservices.com/Images/MobileImages/DUBAI/'; //bool _isOutOfStuck = false; Helpers helpers = new Helpers(); @override @@ -130,7 +131,9 @@ class _VideoCallPageState extends State { ClipRRect( borderRadius: BorderRadius.circular(200.0), child: Image.network( - 'https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png', + patientData["Gender"] == "1" + ? image_url + 'unkown.png' + : image_url + 'unkowwn_female.png', height: 200.0, width: 200.0, ), diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index 99bb44ca..5c8726d7 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -60,6 +60,10 @@ class _MedicineSearchState extends State { hintText: TranslationBase.of(context).searchMedicineNameHere, controller: myController, onSaved: (value) {}, + onFieldSubmitted: (value){ + searchMedicine(context); + }, + textInputAction: TextInputAction.search, inputFormatter: ONLY_LETTERS), ), Container( diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index 598c3e08..2f42a8ea 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -3,6 +3,7 @@ import 'dart:typed_data'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/medicine_provider.dart'; +import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -34,6 +35,7 @@ class _PharmaciesListState extends State { var _data; Helpers helpers = new Helpers(); MedicineProvider _medicineProvider; + ProjectProvider projectsProvider; bool _isInit = true; //bool _isOutOfStuck = false; @@ -50,6 +52,7 @@ class _PharmaciesListState extends State { @override Widget build(BuildContext context) { + projectsProvider = Provider.of(context); return AppScaffold( appBarTitle: TranslationBase.of(context).pharmaciesList, body: Container( @@ -139,18 +142,23 @@ class _PharmaciesListState extends State { ); })), Container( - margin: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 2, - bottom: SizeConfig.widthMultiplier * 2, - right: SizeConfig.widthMultiplier * 4, - left: SizeConfig.widthMultiplier * 4, + margin: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 2, + bottom: SizeConfig.widthMultiplier * 2, + right: SizeConfig.widthMultiplier * 4, + left: SizeConfig.widthMultiplier * 4, + ), + child: Align( + alignment: Alignment.centerLeft, + child: AppText( + TranslationBase.of(context).youCanFindItIn, + fontWeight: FontWeight.bold, ), - child: Align( - alignment: Alignment.centerLeft, - child: AppText( - TranslationBase.of(context).youCanFindItIn, - fontWeight: FontWeight.bold, - ))), + ), + alignment: projectsProvider.isArabic + ? Alignment.topRight + : Alignment.topLeft, + ), Expanded( child: Container( width: SizeConfig.screenWidth * 0.99, diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index fef6567a..5e64a805 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/topten_users_res_model.dart'; import 'package:doctor_app_flutter/providers/patients_provider.dart'; +import 'package:doctor_app_flutter/providers/project_provider.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart'; @@ -53,7 +54,8 @@ class _PatientsScreenState extends State { final String assetName = 'assets/image.svg'; // List _locations = ['Today', 'Old Date', 'YESTERDAY']; - List _locations = ['All', 'Today', 'Tomorrow', 'Next Week']; + List _locations = []; //['All', 'Today', 'Tomorrow', 'Next Week']; + int _activeLocation = 0; bool _isInit = true; @@ -63,6 +65,7 @@ class _PatientsScreenState extends State { bool _isError = true; String error = ""; + ProjectProvider projectsProvider; final _controller = TextEditingController(); @@ -71,12 +74,18 @@ class _PatientsScreenState extends State { @override void didChangeDependencies() { + projectsProvider = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patientSearchForm']; patientType = routeArgs['selectedType']; - patientTypetitle = SERVICES_PATIANT_HEADER[int.parse(patientType)]; + + if (!projectsProvider.isArabic) + patientTypetitle = SERVICES_PATIANT_HEADER[int.parse(patientType)]; + else + patientTypetitle = SERVICES_PATIANT_HEADER_AR[int.parse(patientType)]; print(patientType); @@ -296,6 +305,12 @@ class _PatientsScreenState extends State { */ @override Widget build(BuildContext context) { + _locations = [ + TranslationBase.of(context).all, + TranslationBase.of(context).today, + TranslationBase.of(context).tomorrow, + TranslationBase.of(context).nextWeek, + ]; PatientsProvider patientsProv = Provider.of(context); return AppScaffold( @@ -539,7 +554,8 @@ class _PatientsScreenState extends State { ], ) : AppText( - item.nationalityName, + item.nationalityName ?? + item.nationalityNameN, fontSize: 2.5 * SizeConfig.textMultiplier, diff --git a/lib/screens/patients/profile/insurance_approvals_screen.dart b/lib/screens/patients/profile/insurance_approvals_screen.dart index 99db9a4f..a171a0e9 100644 --- a/lib/screens/patients/profile/insurance_approvals_screen.dart +++ b/lib/screens/patients/profile/insurance_approvals_screen.dart @@ -61,7 +61,9 @@ class _InsuranceApprovalsState extends State { patientTypeID: patient.patientType, languageID: 2); patientsProv - .getPatientInsuranceApprovals(insuranceApprovalsRequest.toJson()); + .getPatientInsuranceApprovals(insuranceApprovalsRequest.toJson()).then((c){ + approvalsList = patientsProv.insuranceApporvalsList; + }); } @override @@ -97,6 +99,7 @@ class _InsuranceApprovalsState extends State { onChanged: (String str) { this.searchData(str); }, + textInputAction: TextInputAction.done, decoration: buildInputDecoration( context, TranslationBase.of(context) diff --git a/lib/screens/patients/profile/patient_orders_screen.dart b/lib/screens/patients/profile/patient_orders_screen.dart index 78b3b294..8effd1f9 100644 --- a/lib/screens/patients/profile/patient_orders_screen.dart +++ b/lib/screens/patients/profile/patient_orders_screen.dart @@ -59,7 +59,9 @@ class _PatientsOrdersState extends State { tokenID: token, patientTypeID: patient.patientType, languageID: 2); - patientsProv.getPatientProgressNote(progressNoteRequest.toJson()); + patientsProv.getPatientProgressNote(progressNoteRequest.toJson()).then((c){ + notesList = patientsProv.patientProgressNoteList; + }); } @override @@ -94,6 +96,7 @@ class _PatientsOrdersState extends State { onChanged: (String str) { this.searchData(str); }, + textInputAction: TextInputAction.done, decoration: buildInputDecoration(context, TranslationBase.of(context).searchOrders), ), diff --git a/lib/screens/patients/profile/progress_note_screen.dart b/lib/screens/patients/profile/progress_note_screen.dart index a2aea154..90640c59 100644 --- a/lib/screens/patients/profile/progress_note_screen.dart +++ b/lib/screens/patients/profile/progress_note_screen.dart @@ -59,7 +59,9 @@ class _ProgressNoteState extends State { tokenID: token, patientTypeID: patient.patientType, languageID: 2); - patientsProv.getPatientProgressNote(progressNoteRequest.toJson()); + patientsProv.getPatientProgressNote(progressNoteRequest.toJson()).then((c){ + notesList = patientsProv.patientProgressNoteList; + }); } @override @@ -94,6 +96,7 @@ class _ProgressNoteState extends State { onChanged: (String str) { this.searchData(str); }, + textInputAction: TextInputAction.done, decoration: buildInputDecoration(context, TranslationBase.of(context).searchNote), ), diff --git a/lib/screens/profile_screen.dart b/lib/screens/profile_screen.dart index fa9869ad..283649aa 100644 --- a/lib/screens/profile_screen.dart +++ b/lib/screens/profile_screen.dart @@ -78,8 +78,8 @@ class _ProfileScreenState extends State { Icons.crop_square, color: Colors.black, subTitle: doctorProfile.doctorRate == 0 - ? "being bad" - : "being great", + ? TranslationBase.of(context).beingBad + : TranslationBase.of(context).beingGreat, ), ], ), diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index bc06dd7a..ca49936e 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -231,6 +231,8 @@ class TranslationBase { String get errorNoOrders => localizedValues['errorNoOrders'][locale.languageCode]; String get livecare => localizedValues['livecare'][locale.languageCode]; + String get beingBad => localizedValues['beingBad'][locale.languageCode]; + String get beingGreat => localizedValues['beingGreat'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index 06dfb9e7..b0b9a8ec 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -19,7 +19,9 @@ class AppTextFormField extends FormField { bool autovalidate = true, TextInputType textInputType, String hintText, - FocusNode focusNode + FocusNode focusNode, + TextInputAction textInputAction, + ValueChanged onFieldSubmitted, }) : super( onSaved: onSaved, validator: validator, @@ -34,6 +36,8 @@ class AppTextFormField extends FormField { onChanged: onChanged?? (value){ state.didChange(value); }, + textInputAction: textInputAction, + onFieldSubmitted: onFieldSubmitted, decoration: InputDecoration( hintText: hintText, hintStyle: TextStyle(fontSize: SizeConfig.textMultiplier * 2),