From ba1827140f19de188bbe207a67fc828a73049949 Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Sun, 10 May 2020 11:39:03 +0300 Subject: [PATCH 01/15] patiant drop dawn --- lib/providers/patients_provider.dart | 10 ++-- pubspec.lock | 84 +++++++++++++++++++++------- 2 files changed, 68 insertions(+), 26 deletions(-) diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index bf22e565..0c533c52 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -41,12 +41,12 @@ class PatientsProvider with ChangeNotifier { Future getPatientList(PatientModel patient, patientType) async { /* const url = BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ - // var srvicePatiant = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; - // print("a=SERVICES_PATIANT[patientType]========='=======a"); + int val = int.parse(patientType); - final url ="https://uat.hmgwebservices.com/Services/DoctorApplication.svc/REST/"+ SERVICES_PATIANT[val];///"https://uat.hmgwebservices.com/Services/Doctors.svc/REST/"; - //BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; - // print("a===========$url=======a"); + //**********Modify url by amjad amireh for patiant type********* + final url = + BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; + try { final response = await client.post(url, diff --git a/pubspec.lock b/pubspec.lock index 14612a67..0d78e107 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.4.0" bazel_worker: dependency: transitive description: @@ -49,7 +49,7 @@ packages: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "1.0.5" build: dependency: transitive description: @@ -126,7 +126,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.1.2" checked_yaml: dependency: transitive description: @@ -134,13 +134,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" code_builder: dependency: transitive description: @@ -154,7 +147,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.14.11" connectivity: dependency: "direct main" description: @@ -211,13 +204,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.4" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" fixnum: dependency: transitive description: @@ -324,6 +310,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.10" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" imei_plugin: dependency: "direct main" description: @@ -373,6 +366,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.11.4" + maps_launcher: + dependency: "direct main" + description: + name: maps_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" matcher: dependency: transitive description: @@ -428,7 +428,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.6.4" pedantic: dependency: transitive description: @@ -443,6 +443,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1+1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" platform: dependency: transitive description: @@ -587,7 +594,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.5.5" stack_trace: dependency: transitive description: @@ -629,7 +636,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.11" timing: dependency: transitive description: @@ -644,6 +651,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.6" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.4.5" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+5" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.6" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.1+4" vector_math: dependency: transitive description: @@ -665,6 +700,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" yaml: dependency: transitive description: From f3c35758b18305864f87e76edee84c048702b10d Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Mon, 11 May 2020 00:18:05 +0300 Subject: [PATCH 02/15] modify comment --- lib/providers/patients_provider.dart | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 0f9dff6f..afe24758 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -43,16 +43,11 @@ class PatientsProvider with ChangeNotifier { BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ int val = int.parse(patientType); -<<<<<<< HEAD //**********Modify url by amjad amireh for patiant type********* - final url = - BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; + -======= - final url =BASE_URL+"DoctorApplication.svc/REST/"+ SERVICES_PATIANT[val];///"https://uat.hmgwebservices.com/Services/Doctors.svc/REST/"; - //BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; + final url =BASE_URL+"DoctorApplication.svc/REST/"+ SERVICES_PATIANT[val]; // print("a===========$url=======a"); ->>>>>>> 8d3aa791dfc0074fddba54520ff4c13f5aa02bad try { final response = await client.post(url, From 142c8d97e3bdd0498668f74b60955c9b3ee4ff83 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 11 May 2020 12:45:53 +0300 Subject: [PATCH 03/15] first step from body measurements --- lib/routes.dart | 23 +-- lib/screens/auth/login_screen.dart | 2 +- .../vital_sign/body_measurements_screen.dart | 143 ++++++++++++++++++ .../vital_sign/vital_sign_details_screen.dart | 24 +-- 4 files changed, 172 insertions(+), 20 deletions(-) create mode 100644 lib/screens/patients/profile/vital_sign/body_measurements_screen.dart diff --git a/lib/routes.dart b/lib/routes.dart index dcef9fbe..f2f5f6bb 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -1,3 +1,5 @@ +import './screens/patients/profile/vital_sign/body_measurements_screen.dart'; + import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; import './screens/auth/login_screen.dart'; @@ -46,8 +48,7 @@ const String LAB_ORDERS = 'patients/lab_orders'; const String PRESCRIPTIONS = 'patients/prescription'; const String RADIOLOGY = 'patients/radiology'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; - - +const String BODY_MEASUREMENTS = 'patients/body-measurements'; var routes = { HOME: (_) => DashboardScreen(), @@ -63,15 +64,17 @@ var routes = { SETTINGS: (_) => SettingsScreen(), CHANGE_PASSWORD: (_) => ChangePasswordScreen(), VERIFY_ACCOUNT: (_) => VerifyAccountScreen(), - VERIFICATION_METHODS:(_)=> VerificationMethodsScreen(), - PATIENTS_PROFILE:(_)=> PatientProfileScreen(), - PHARMACIES_LIST: (_) => PharmaciesListScreen(itemID: null,), + VERIFICATION_METHODS: (_) => VerificationMethodsScreen(), + PATIENTS_PROFILE: (_) => PatientProfileScreen(), + PHARMACIES_LIST: (_) => PharmaciesListScreen( + itemID: null, + ), VITAL_SIGN: (_) => VitalSignScreen(), MESSAGES: (_) => MessagesScreen(), SERVICES: (_) => ServicesScreen(), - LAB_ORDERS:(_)=>LabOrdersScreen(), - PRESCRIPTIONS:(_)=>PrescriptionScreen(), - RADIOLOGY:(_)=>RadiologyScreen(), - VITAL_SIGN_DETAILS:(_)=>VitalSignDetailsScreen(), - + LAB_ORDERS: (_) => LabOrdersScreen(), + PRESCRIPTIONS: (_) => PrescriptionScreen(), + RADIOLOGY: (_) => RadiologyScreen(), + VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), + BODY_MEASUREMENTS: (_) => BodyMeasurementsScreen() }; diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index c203dae9..d8c45a57 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -72,7 +72,7 @@ class _LoginsreenState extends State { return Text('Error: ${snapshot.error}'); } else { return Container( - margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 30), + margin: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 30), alignment: Alignment.topLeft, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/screens/patients/profile/vital_sign/body_measurements_screen.dart b/lib/screens/patients/profile/vital_sign/body_measurements_screen.dart new file mode 100644 index 00000000..bf89edac --- /dev/null +++ b/lib/screens/patients/profile/vital_sign/body_measurements_screen.dart @@ -0,0 +1,143 @@ +import 'package:charts_flutter/flutter.dart' as charts; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/vital_sign_res_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; + +class BodyMeasurementsScreen extends StatelessWidget { + BodyMeasurementsScreen(); + List vitalList; + @override + Widget build(BuildContext context) { + _seriesData = List>(); + _seriesPieData = List>(); + _seriesLineData = List>(); + _generateData(); + return AppScaffold( + appBarTitle: 'Body Measurements', + body: RoundedContainer( + height: SizeConfig.realScreenHeight*0.4, + child: Padding( + padding: EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Column( + children: [ + Text( + 'Body Mass Index', + style: TextStyle( + fontSize: 24.0, fontWeight: FontWeight.bold), + ), + Expanded( + child: charts.BarChart( + _seriesData, + animate: true, + barGroupingType: charts.BarGroupingType.grouped, + // behaviors: [new charts.SeriesLegend()], + // primaryMeasureAxis: , + animationDuration: Duration(seconds: 5), + ), + ), + ], + ), + ), + ), + ), + ), + ); + } + + List> _seriesData; + List> _seriesPieData; + List> _seriesLineData; + + _generateData() { + var data1 = [ + new Pollution(1980, 'USA', 40), + ]; + + + _seriesData.add( + charts.Series( + domainFn: (Pollution pollution, _) => '', + measureFn: (Pollution pollution, _) => pollution.quantity, + id: '2017', + data: data1, + fillPatternFn: (_, __) => charts.FillPatternType.solid, + fillColorFn: (Pollution pollution, _) => + charts.ColorUtil.fromDartColor(Color(0xff990099)), + ), + ); + _seriesData.add( + charts.Series( + domainFn: (Pollution pollution, _) => '', + measureFn: (Pollution pollution, _) => pollution.quantity, + id: '2017', + data: data1, + fillPatternFn: (_, __) => charts.FillPatternType.solid, + fillColorFn: (Pollution pollution, _) => + charts.ColorUtil.fromDartColor(Color(0xff990099)), + ), + ); + _seriesData.add( + charts.Series( + domainFn: (Pollution pollution, _) => '', + measureFn: (Pollution pollution, _) => pollution.quantity, + id: '2017', + data: data1, + fillPatternFn: (_, __) => charts.FillPatternType.solid, + fillColorFn: (Pollution pollution, _) => + charts.ColorUtil.fromDartColor(Color(0xff990099)), + ), + ); + _seriesData.add( + charts.Series( + domainFn: (Pollution pollution, _) => '', + measureFn: (Pollution pollution, _) => pollution.quantity, + id: '2017', + data: data1, + fillPatternFn: (_, __) => charts.FillPatternType.solid, + fillColorFn: (Pollution pollution, _) => + charts.ColorUtil.fromDartColor(Color(0xff990099)), + ), + ); + _seriesData.add( + charts.Series( + domainFn: (Pollution pollution, _) => '', + measureFn: (Pollution pollution, _) => pollution.quantity, + id: '2017', + data: data1, + fillPatternFn: (_, __) => charts.FillPatternType.solid, + fillColorFn: (Pollution pollution, _) => + charts.ColorUtil.fromDartColor(Color(0xff990099)), + ), + ); + + + + } +} + +class Pollution { + String place; + int year; + int quantity; + + Pollution(this.year, this.place, this.quantity); +} + +class Task { + String task; + double taskvalue; + Color colorval; + + Task(this.task, this.taskvalue, this.colorval); +} + +class Sales { + int yearval; + int salesval; + + Sales(this.yearval, this.salesval); +} diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart index bf4aad6b..a7155e01 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_details_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/routes.dart'; import 'package:flutter/material.dart'; import '../../../../config/size_config.dart'; @@ -10,7 +11,7 @@ class VitalSignDetailsScreen extends StatelessWidget { // VitalSignDetailsScreen({Key key, this.vitalSing}) : super(key: key); VitalSignResModel vitalSing; String url = "assets/images/"; - final double contWidth = SizeConfig.realScreenWidth * 0.70; + final double contWidth = SizeConfig.realScreenWidth * 0.70; @override Widget build(BuildContext context) { @@ -19,7 +20,7 @@ class VitalSignDetailsScreen extends StatelessWidget { return AppScaffold( appBarTitle: "vital Sing ", body: RoundedContainer( - height: SizeConfig.realScreenHeight *0.7, + height: SizeConfig.realScreenHeight * 0.7, child: CustomScrollView( primary: false, slivers: [ @@ -31,18 +32,22 @@ class VitalSignDetailsScreen extends StatelessWidget { mainAxisSpacing: 0, crossAxisCount: 3, children: [ + InkWell( + onTap: (){ + Navigator.of(context).pushNamed(BODY_MEASUREMENTS); + }, + child: CircleAvatarWidget( + des: 'Body Measurements', + url: url + 'heartbeat.png', + ), + ), CircleAvatarWidget( - des: 'Body Measurements', - url: url + 'heartbeat.png', - - ), CircleAvatarWidget( des: 'Temperature', url: url + 'heartbeat.png', ), CircleAvatarWidget( des: 'Pulse', url: url + 'heartbeat.png', - ), CircleAvatarWidget( des: 'Respiration', @@ -52,10 +57,11 @@ class VitalSignDetailsScreen extends StatelessWidget { des: 'Blood Pressure', url: url + 'heartbeat.png', ), - CircleAvatarWidget( + CircleAvatarWidget( des: 'Oxygenation', url: url + 'heartbeat.png', - ), CircleAvatarWidget( + ), + CircleAvatarWidget( des: 'Pain Scale', url: url + 'heartbeat.png', ), From 17ba899b8eaea10049f57efa8a9d1aa207b5769b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 11 May 2020 13:16:17 +0300 Subject: [PATCH 04/15] add chart package to pubspec --- pubspec.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/pubspec.yaml b/pubspec.yaml index 00c18525..62c813b2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: connectivity: ^0.4.8+2 maps_launcher: ^1.2.0 url_launcher: ^5.4.5 + charts_flutter: ^0.9.0 From ac4489c452895bda8ec13841a86657c921b599a6 Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Mon, 11 May 2020 16:44:32 +0300 Subject: [PATCH 05/15] patiant model modify --- lib/models/patient/patient_model.dart | 96 +++++++++++++++++-- .../patients/patient_search_screen.dart | 30 ++++-- lib/screens/patients/patients_screen.dart | 13 +-- 3 files changed, 119 insertions(+), 20 deletions(-) diff --git a/lib/models/patient/patient_model.dart b/lib/models/patient/patient_model.dart index e49f64ea..93e77c18 100644 --- a/lib/models/patient/patient_model.dart +++ b/lib/models/patient/patient_model.dart @@ -1,8 +1,18 @@ + +/* + *@author:Modified by amjad add getter and setter Amjad Amireh + *@Date:11/5/2020 + *@param: + *@return:PatientsScreen Search textbox filter + + *@desc: + */ class PatientModel { int ProjectID; int ClinicID; int DoctorID; String FirstName; + String MiddleName; String LastName; String PatientMobileNumber; @@ -21,13 +31,87 @@ class PatientModel { bool PatientOutSA; - getFirstName() { - return this.FirstName; - } + int get getProjectID => ProjectID; + + set setProjectID(int ProjectID) => this.ProjectID = ProjectID; + + int get getClinicID => ClinicID; + + set setClinicID(int ClinicID) => this.ClinicID = ClinicID; + + int get getDoctorID => DoctorID; + + set setDoctorID(int DoctorID) => this.DoctorID = DoctorID; + String get getFirstName => FirstName; + + set setFirstName(String FirstName) => this.FirstName = FirstName; + + String get getMiddleName => MiddleName; + + set setMiddleName(String MiddleName) => this.MiddleName = MiddleName; + + String get getLastName => LastName; + + set setLastName(String LastName) => this.LastName = LastName; + + String get getPatientMobileNumber => PatientMobileNumber; + + set setPatientMobileNumber(String PatientMobileNumber) => this.PatientMobileNumber = PatientMobileNumber; + +// String get getPatientIdentificationID => PatientIdentificationID; + +// set setPatientIdentificationID(String PatientIdentificationID) => this.PatientIdentificationID = PatientIdentificationID; + + int get getPatientID => PatientID; + + set setPatientID(int PatientID) => this.PatientID = PatientID; + + String get getFrom => From; + + set setFrom(String From) => this.From = From; + + String get getTo => To; + + set setTo(String To) => this.To = To; + + int get getLanguageID => LanguageID; + + set setLanguageID(int LanguageID) => this.LanguageID = LanguageID; + + String get getStamp => stamp; + + set setStamp(String stamp) => this.stamp = stamp; + + String get getIPAdress => IPAdress; + + set setIPAdress(String IPAdress) => this.IPAdress = IPAdress; + + double get getVersionID => VersionID; + + set setVersionID(double VersionID) => this.VersionID = VersionID; + + int get getChannel => Channel; + + set setChannel(int Channel) => this.Channel = Channel; + + String get getTokenID => TokenID; + + set setTokenID(String TokenID) => this.TokenID = TokenID; + + String get getSessionID => SessionID; + + set setSessionID(String SessionID) => this.SessionID = SessionID; + + bool get getIsLoginForDoctorApp => IsLoginForDoctorApp; + + set setIsLoginForDoctorApp(bool IsLoginForDoctorApp) => this.IsLoginForDoctorApp = IsLoginForDoctorApp; + + bool get getPatientOutSA => PatientOutSA; + + set setPatientOutSA(bool PatientOutSA) => this.PatientOutSA = PatientOutSA; + + - setFirstName( FirstName) { - this.FirstName = FirstName; - } diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 2582310a..4704b564 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -62,15 +62,32 @@ class _PatientSearchScreenState extends State { // _patientSearchFormValues.TokenID = if (_formKey.currentState.validate()) { -// If all data are correct then save data to out variables - // _formKey.currentState.save(); - sharedPref.setString(TOKEN,'@dm!n'); - sharedPref.setString(SLECTED_PATIENT_TYPE,_selectedType); +//*****If all data are correct then save data to out variables**** + if (_patientSearchFormValues.getFirstName == null || + _patientSearchFormValues.getMiddleName == null || + _patientSearchFormValues.getLastName == null || + _patientSearchFormValues.getPatientMobileNumber == null) { + _patientSearchFormValues.setFirstName = "0"; + _patientSearchFormValues.setLastName = "0"; + _patientSearchFormValues.setMiddleName = "0"; + _patientSearchFormValues.setPatientMobileNumber = "0"; + _patientSearchFormValues.setPatientID = 0; + _patientSearchFormValues.From = "0"; + _patientSearchFormValues.To = "0"; + + //_formKey.currentState.save(); + } else { + _formKey.currentState.save(); + } + // _formKey.currentState.save(); + //*********************************** */ + sharedPref.setString(TOKEN, '@dm!n'); + sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); print('_selectedType${_selectedType}'); String token = await sharedPref.getString(TOKEN); int projectID = await sharedPref.getInt(PROJECT_ID); _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = 15;//projectID; + _patientSearchFormValues.ProjectID = 15; //projectID; // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, @@ -173,7 +190,8 @@ class _PatientSearchScreenState extends State { AppTextFormField( hintText: 'First Name', onSaved: (value) { - _patientSearchFormValues.FirstName = value; + // _patientSearchFormValues.FirstName = value; + _patientSearchFormValues.setFirstName = value; }, // validator: (value) { // return TextValidator().validateName(value); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 979c4158..676f9589 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -285,15 +285,12 @@ class _PatientsScreenState extends State { Container( child: Center( child: - DrAppCircularProgressIndeicator()), + Padding( + padding: const EdgeInsets.fromLTRB(0, 250, 0, 0), + child: DrAppCircularProgressIndeicator(), + )), ), - Container( - child: Text( - "Sorry There is No Data", - style: TextStyle( - color: Theme.of(context).errorColor), - ), - ) + ], ) : Column( From bc395c3fcc7801499ea05b517f7e10467366a053 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 12 May 2020 14:21:14 +0300 Subject: [PATCH 06/15] add doctor profile to shaerd pref --- lib/config/shared_pref_kay.dart | 3 +- lib/models/doctor_profile_model.dart | 176 ++++++++++++++++++ lib/providers/project_provider.dart | 2 +- .../patients/patient_search_screen.dart | 5 +- lib/util/helpers.dart | 2 +- lib/widgets/auth/verfiy_account.dart | 1 + 6 files changed, 185 insertions(+), 4 deletions(-) create mode 100644 lib/models/doctor_profile_model.dart diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 8a90edf6..29ff4548 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,4 +1,5 @@ final TOKEN = 'token'; final PROJECT_ID="projectID"; final SLECTED_PATIENT_TYPE="slectedPatientType"; -final APP_Language = "language"; \ No newline at end of file +final APP_Language = "language"; +final DOCTOR_PROFILE = 'doctorProfile'; \ No newline at end of file diff --git a/lib/models/doctor_profile_model.dart b/lib/models/doctor_profile_model.dart new file mode 100644 index 00000000..17625968 --- /dev/null +++ b/lib/models/doctor_profile_model.dart @@ -0,0 +1,176 @@ +class DoctorProfileModel { + int doctorID; + String doctorName; + Null doctorNameN; + int clinicID; + String clinicDescription; + Null clinicDescriptionN; + Null licenseExpiry; + int employmentType; + Null setupID; + int projectID; + String projectName; + String nationalityID; + String nationalityName; + Null nationalityNameN; + int gender; + String genderDescription; + Null genderDescriptionN; + Null doctorTitle; + Null projectNameN; + bool isAllowWaitList; + String titleDescription; + Null titleDescriptionN; + Null isRegistered; + Null isDoctorDummy; + bool isActive; + Null isDoctorAppointmentDisplayed; + bool doctorClinicActive; + Null isbookingAllowed; + String doctorCases; + Null doctorPicture; + String doctorProfileInfo; + List specialty; + int actualDoctorRate; + String doctorImageURL; + int doctorRate; + String doctorTitleForProfile; + bool isAppointmentAllowed; + String nationalityFlagURL; + int noOfPatientsRate; + String qR; + int serviceID; + + DoctorProfileModel( + {this.doctorID, + this.doctorName, + this.doctorNameN, + this.clinicID, + this.clinicDescription, + this.clinicDescriptionN, + this.licenseExpiry, + this.employmentType, + this.setupID, + this.projectID, + this.projectName, + this.nationalityID, + this.nationalityName, + this.nationalityNameN, + this.gender, + this.genderDescription, + this.genderDescriptionN, + this.doctorTitle, + this.projectNameN, + this.isAllowWaitList, + this.titleDescription, + this.titleDescriptionN, + this.isRegistered, + this.isDoctorDummy, + this.isActive, + this.isDoctorAppointmentDisplayed, + this.doctorClinicActive, + this.isbookingAllowed, + this.doctorCases, + this.doctorPicture, + this.doctorProfileInfo, + this.specialty, + this.actualDoctorRate, + this.doctorImageURL, + this.doctorRate, + this.doctorTitleForProfile, + this.isAppointmentAllowed, + this.nationalityFlagURL, + this.noOfPatientsRate, + this.qR, + this.serviceID}); + + DoctorProfileModel.fromJson(Map json) { + doctorID = json['DoctorID']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + clinicID = json['ClinicID']; + clinicDescription = json['ClinicDescription']; + clinicDescriptionN = json['ClinicDescriptionN']; + licenseExpiry = json['LicenseExpiry']; + employmentType = json['EmploymentType']; + setupID = json['SetupID']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + nationalityID = json['NationalityID']; + nationalityName = json['NationalityName']; + nationalityNameN = json['NationalityNameN']; + gender = json['Gender']; + genderDescription = json['Gender_Description']; + genderDescriptionN = json['Gender_DescriptionN']; + doctorTitle = json['DoctorTitle']; + projectNameN = json['ProjectNameN']; + isAllowWaitList = json['IsAllowWaitList']; + titleDescription = json['Title_Description']; + titleDescriptionN = json['Title_DescriptionN']; + isRegistered = json['IsRegistered']; + isDoctorDummy = json['IsDoctorDummy']; + isActive = json['IsActive']; + isDoctorAppointmentDisplayed = json['IsDoctorAppointmentDisplayed']; + doctorClinicActive = json['DoctorClinicActive']; + isbookingAllowed = json['IsbookingAllowed']; + doctorCases = json['DoctorCases']; + doctorPicture = json['DoctorPicture']; + doctorProfileInfo = json['DoctorProfileInfo']; + specialty = json['Specialty'].cast(); + actualDoctorRate = json['ActualDoctorRate']; + doctorImageURL = json['DoctorImageURL']; + doctorRate = json['DoctorRate']; + doctorTitleForProfile = json['DoctorTitleForProfile']; + isAppointmentAllowed = json['IsAppointmentAllowed']; + nationalityFlagURL = json['NationalityFlagURL']; + noOfPatientsRate = json['NoOfPatientsRate']; + qR = json['QR']; + serviceID = json['ServiceID']; + } + + Map toJson() { + final Map data = new Map(); + data['DoctorID'] = this.doctorID; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['ClinicID'] = this.clinicID; + data['ClinicDescription'] = this.clinicDescription; + data['ClinicDescriptionN'] = this.clinicDescriptionN; + data['LicenseExpiry'] = this.licenseExpiry; + data['EmploymentType'] = this.employmentType; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + data['NationalityID'] = this.nationalityID; + data['NationalityName'] = this.nationalityName; + data['NationalityNameN'] = this.nationalityNameN; + data['Gender'] = this.gender; + data['Gender_Description'] = this.genderDescription; + data['Gender_DescriptionN'] = this.genderDescriptionN; + data['DoctorTitle'] = this.doctorTitle; + data['ProjectNameN'] = this.projectNameN; + data['IsAllowWaitList'] = this.isAllowWaitList; + data['Title_Description'] = this.titleDescription; + data['Title_DescriptionN'] = this.titleDescriptionN; + data['IsRegistered'] = this.isRegistered; + data['IsDoctorDummy'] = this.isDoctorDummy; + data['IsActive'] = this.isActive; + data['IsDoctorAppointmentDisplayed'] = this.isDoctorAppointmentDisplayed; + data['DoctorClinicActive'] = this.doctorClinicActive; + data['IsbookingAllowed'] = this.isbookingAllowed; + data['DoctorCases'] = this.doctorCases; + data['DoctorPicture'] = this.doctorPicture; + data['DoctorProfileInfo'] = this.doctorProfileInfo; + data['Specialty'] = this.specialty; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitleForProfile'] = this.doctorTitleForProfile; + data['IsAppointmentAllowed'] = this.isAppointmentAllowed; + data['NationalityFlagURL'] = this.nationalityFlagURL; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['QR'] = this.qR; + data['ServiceID'] = this.serviceID; + return data; + } +} diff --git a/lib/providers/project_provider.dart b/lib/providers/project_provider.dart index abf53ea3..27dced84 100644 --- a/lib/providers/project_provider.dart +++ b/lib/providers/project_provider.dart @@ -18,7 +18,7 @@ class ProjectProvider with ChangeNotifier{ } void loadSharedPrefLanguage() async { currentLanguage = await sharedPref.getString(APP_Language); - _appLocale = Locale(currentLanguage ?? 'ar'); + _appLocale = Locale(currentLanguage ?? 'en'); _isArabic = currentLanguage != null ? currentLanguage == 'ar' ? true : false : false; diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 2582310a..b3c9e100 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -16,6 +16,7 @@ import 'package:flutter/rendering.dart'; import '../../lookups/patient_lookup.dart'; import '../../widgets/patients/dynamic_elements.dart'; import '../../config/config.dart'; +import '../../models/doctor_profile_model.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -60,7 +61,9 @@ class _PatientSearchScreenState extends State { void _validateInputs() async { print("####IBRAHIM TEST#####" + _patientSearchFormValues.From); // _patientSearchFormValues.TokenID = - + List doctorProfiles = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(doctorProfiles[0]); + print(doctorProfile.doctorName); if (_formKey.currentState.validate()) { // If all data are correct then save data to out variables // _formKey.currentState.save(); diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index a0a54c72..c182ae07 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -48,7 +48,7 @@ class Helpers { children: items.map((item) { return Text( '${item["$decKey"]}', - style: TextStyle(fontSize: 20), + style: TextStyle(fontSize: SizeConfig.textMultiplier *3), ); }).toList(), diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 0cdbd931..df134102 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -288,6 +288,7 @@ class _VerifyAccountState extends State { changeLoadingStata(false); if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); + sharedPref.setObj(DOCTOR_PROFILE, res['List_DoctorProfile']); Navigator.of(context).pushNamed(HOME); } else { helpers.showErrorToast(res['ErrorEndUserMessage']); From 8ee8ba4581a2c2c40c228f1687891a44eded2e27 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 12 May 2020 14:22:33 +0300 Subject: [PATCH 07/15] small fix --- lib/config/shared_pref_kay.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 29ff4548..36dbdaf1 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,5 +1,5 @@ final TOKEN = 'token'; -final PROJECT_ID="projectID"; -final SLECTED_PATIENT_TYPE="slectedPatientType"; -final APP_Language = "language"; +final PROJECT_ID='projectID'; +final SLECTED_PATIENT_TYPE='slectedPatientType'; +final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; \ No newline at end of file From 6bfbf3e8e9b192c8ec10afd87b7ce34deb8e9310 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 12 May 2020 16:06:40 +0300 Subject: [PATCH 08/15] fix bug --- lib/providers/patients_provider.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 0b63f598..461103ee 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -168,7 +168,6 @@ class PatientsProvider with ChangeNotifier { print('$res'); if (res['MessageStatus'] == 1) { patientLabResultOrdersList = []; - print("res['List_GetLabOreders']"); res['List_GetLabOreders'].forEach((v) { patientLabResultOrdersList.add(new LabOrdersResModel.fromJson(v)); }); @@ -214,7 +213,6 @@ class PatientsProvider with ChangeNotifier { print('$res'); if (res['MessageStatus'] == 1) { patientPrescriptionsList = []; - print("res['PatientPrescriptionList']"); res['PatientPrescriptionList'].forEach((v) { patientPrescriptionsList .add(new PrescriptionResModel.fromJson(v)); @@ -260,7 +258,6 @@ class PatientsProvider with ChangeNotifier { print('$res'); if (res['MessageStatus'] == 1) { patientRadiologyList = []; - print("res['List_GetRadOreders']"); res['List_GetRadOreders'].forEach((v) { patientRadiologyList.add(new RadiologyResModel.fromJson(v)); }); From f9346c3fef53c18155f540e16b583a87dbc06727 Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Tue, 12 May 2020 16:38:38 +0300 Subject: [PATCH 09/15] modify search patiant --- .../patients/patient_search_screen.dart | 80 ++++++++++++++----- lib/screens/patients/patients_screen.dart | 13 ++- 2 files changed, 68 insertions(+), 25 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 4704b564..f4e27c02 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -63,23 +63,17 @@ class _PatientSearchScreenState extends State { if (_formKey.currentState.validate()) { //*****If all data are correct then save data to out variables**** - if (_patientSearchFormValues.getFirstName == null || - _patientSearchFormValues.getMiddleName == null || - _patientSearchFormValues.getLastName == null || - _patientSearchFormValues.getPatientMobileNumber == null) { - _patientSearchFormValues.setFirstName = "0"; - _patientSearchFormValues.setLastName = "0"; - _patientSearchFormValues.setMiddleName = "0"; - _patientSearchFormValues.setPatientMobileNumber = "0"; - _patientSearchFormValues.setPatientID = 0; - _patientSearchFormValues.From = "0"; - _patientSearchFormValues.To = "0"; - - //_formKey.currentState.save(); - } else { + + _patientSearchFormValues.setFrom = "0"; + _patientSearchFormValues.setTo = "0"; + print("***************Check validate1*************"); + + print(_patientSearchFormValues.getFirstName.trim().length); + print("***************Check validate2*************"); _formKey.currentState.save(); - } - // _formKey.currentState.save(); + _patientSearchFormValues.setFrom = "0"; + _patientSearchFormValues.setTo = "0"; + //*********************************** */ sharedPref.setString(TOKEN, '@dm!n'); sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); @@ -191,7 +185,18 @@ class _PatientSearchScreenState extends State { hintText: 'First Name', onSaved: (value) { // _patientSearchFormValues.FirstName = value; - _patientSearchFormValues.setFirstName = value; + value == null + ? _patientSearchFormValues.setFirstName = + "0" + : _patientSearchFormValues.setFirstName = + value; + print("**********Value********"); + print(value.toString().trim().isEmpty); + print("**********Value********"); + if (value.toString().trim().isEmpty) { + + _patientSearchFormValues.setFirstName = "0"; + } }, // validator: (value) { // return TextValidator().validateName(value); @@ -203,7 +208,19 @@ class _PatientSearchScreenState extends State { AppTextFormField( hintText: 'Middle Name', onSaved: (value) { - _patientSearchFormValues.MiddleName = value; + //_patientSearchFormValues.MiddleName = value; + + value == null + ? _patientSearchFormValues.setMiddleName = + "0" + : _patientSearchFormValues.setMiddleName = + value; + + // value.toString().trim().isEmpty + // ? _patientSearchFormValues.setMiddleName = + // "0" + // : _patientSearchFormValues.setMiddleName = + // value; }, // validator: (value) { // return TextValidator().validateName(value); @@ -215,7 +232,16 @@ class _PatientSearchScreenState extends State { AppTextFormField( hintText: 'Last Name', onSaved: (value) { - _patientSearchFormValues.LastName = value; + // _patientSearchFormValues.LastName = value; + value == null + ? _patientSearchFormValues.setLastName = "0" + : _patientSearchFormValues.setLastName = + value; + + // value.toString().trim().isEmpty + // ? _patientSearchFormValues.setLastName = "0" + // : _patientSearchFormValues.setLastName = + // value; }, // validator: (value) { // return TextValidator().validateName(value); @@ -232,8 +258,13 @@ class _PatientSearchScreenState extends State { // }, inputFormatter: ONLY_NUMBERS, onSaved: (value) { - _patientSearchFormValues.PatientMobileNumber = - value; + value == null + ? _patientSearchFormValues + .setPatientMobileNumber = "0" + : _patientSearchFormValues + .setPatientMobileNumber = value; + // _patientSearchFormValues.PatientMobileNumber = + // value; }, ), SizedBox( @@ -245,7 +276,12 @@ class _PatientSearchScreenState extends State { // inputFormatter: ONLY_NUMBERS, onSaved: (value) { - _patientSearchFormValues.PatientID = 89000; + // _patientSearchFormValues.PatientID = 89000; + + value == null + ? _patientSearchFormValues.setPatientID = 0 + : _patientSearchFormValues.setPatientID = + int.parse(value); }), SizedBox( height: 10, diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 676f9589..c8d70165 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -236,18 +236,25 @@ class _PatientsScreenState extends State { String date; DateTime checkedTime = DateTime.parse(dateString); DateTime currentTime = DateTime.now(); - + // print("currentTime.day="+currentTime.day.toString()); + // print("checkedTime.day="+checkedTime.day.toString()); + // print("currentTime.month="+currentTime.month.toString()); + // print("checkedTime.month="+checkedTime.month.toString()); + // print("currentTime.year="+currentTime.year.toString()); + // print("checkedTime.year="+checkedTime.year.toString()); if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) { - return "TODAY"; + + return "Today"; } else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) { if ((currentTime.day - checkedTime.day) == 1) { return "YESTERDAY"; } else if ((currentTime.day - checkedTime.day) == -1) { - return "TOMORROW"; + return "Tomorrow"; } + if ((currentTime.day - checkedTime.day) <= -2) { return "Next Week"; } else { From 1e656af1430369d0a2dd7b8234fd92c188763481 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 12 May 2020 18:18:35 +0300 Subject: [PATCH 10/15] handelCatcherrorCase --- .../patient/prescription_res_model.dart | 4 +- lib/providers/patients_provider.dart | 43 +++++++++++++------ .../profile/lab_result/lab_orders_screen.dart | 15 ++----- .../prescriptions/prescriptions_screen.dart | 16 ++----- .../profile/radiology/radiology_screen.dart | 27 ++++-------- .../profile/vital_sign/vital_sign_screen.dart | 21 ++++----- lib/util/helpers.dart | 20 ++++++++- .../shared/errors/dr_app_embedded_error.dart | 28 ++++++++++++ 8 files changed, 104 insertions(+), 70 deletions(-) create mode 100644 lib/widgets/shared/errors/dr_app_embedded_error.dart diff --git a/lib/models/patient/prescription_res_model.dart b/lib/models/patient/prescription_res_model.dart index 7bb545ee..9c7e296d 100644 --- a/lib/models/patient/prescription_res_model.dart +++ b/lib/models/patient/prescription_res_model.dart @@ -38,7 +38,7 @@ class PrescriptionResModel { String nationalityFlagURL; int noOfPatientsRate; String qR; - List speciality; + List speciality; PrescriptionResModel( {this.setupID, @@ -108,7 +108,7 @@ class PrescriptionResModel { nationalityFlagURL = json['NationalityFlagURL']; noOfPatientsRate = json['NoOfPatientsRate']; qR = json['QR']; - speciality = json['Speciality'].cast(); + speciality = json['Speciality']; } Map toJson() { diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 461103ee..8d7b6631 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription_req_model.dart'; import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; +import 'package:doctor_app_flutter/widgets/auth/login_form.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart'; @@ -23,6 +24,7 @@ const GET_PATIENT_LAB_OREDERS = const GET_PRESCRIPTION = BASE_URL + 'Patients.svc/REST/GetPrescriptionApptList'; const GET_RADIOLOGY = BASE_URL + 'DoctorApplication.svc/REST/GetPatientRadResult'; +Helpers helpers = Helpers(); class PatientsProvider with ChangeNotifier { bool isLoading = false; @@ -44,8 +46,11 @@ class PatientsProvider with ChangeNotifier { // var srvicePatiant = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; // print("a=SERVICES_PATIANT[patientType]========='=======a"); int val = int.parse(patientType); - final url =BASE_URL+"DoctorApplication.svc/REST/"+ SERVICES_PATIANT[val];///"https://uat.hmgwebservices.com/Services/Doctors.svc/REST/"; - //BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; + final url = + BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val]; + + ///"https://uat.hmgwebservices.com/Services/Doctors.svc/REST/"; + //BASE_URL + 'DoctorApplication.svc/REST/' + SERVICES_PATIANT[val]; // print("a===========$url=======a"); try { @@ -76,8 +81,8 @@ class PatientsProvider with ChangeNotifier { //*********************** return Future.value(json.decode(response.body)); - } catch (error) { - throw error; + } catch (err) { + throw err; } } @@ -128,8 +133,8 @@ class PatientsProvider with ChangeNotifier { error = 'Please Check The Internet Connection'; } notifyListeners(); - } catch (error) { - throw error; + } catch (err) { + handelCatchErrorCase(err); } } @@ -182,8 +187,8 @@ class PatientsProvider with ChangeNotifier { error = 'Please Check The Internet Connection'; } notifyListeners(); - } catch (error) { - throw error; + } catch (err) { + handelCatchErrorCase(err); } } @@ -228,11 +233,25 @@ class PatientsProvider with ChangeNotifier { error = 'Please Check The Internet Connection'; } notifyListeners(); - } catch (error) { - throw error; + } catch (err) { + handelCatchErrorCase(err); } } + /*@author: Elham Rababah + *@Date:12/5/2020 + *@param: patient + *@return: + *@desc: getPatientRadiology + */ + handelCatchErrorCase(err) { + isLoading = false; + isError = true; + error = helpers.generateContactAdminMsg(err); + notifyListeners(); + throw err; + } + /*@author: Elham Rababah *@Date:3/5/2020 *@param: patient @@ -272,8 +291,8 @@ class PatientsProvider with ChangeNotifier { error = 'Please Check The Internet Connection'; } notifyListeners(); - } catch (error) { - throw error; + } catch (err) { + handelCatchErrorCase(err); } } } diff --git a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart index d26ab4c7..ae2bc1d8 100644 --- a/lib/screens/patients/profile/lab_result/lab_orders_screen.dart +++ b/lib/screens/patients/profile/lab_result/lab_orders_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -78,19 +79,9 @@ class _LabOrdersScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? Center( - child: Text( - patientsProv.error, - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: patientsProv.error) : patientsProv.patientLabResultOrdersList.length == 0 - ? Center( - child: Text( - 'You don\'t have any Orders', - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: 'You don\'t have any Orders') : Container( margin: EdgeInsets.fromLTRB( SizeConfig.realScreenWidth * 0.05, diff --git a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart index 47fff706..3bded248 100644 --- a/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart +++ b/lib/screens/patients/profile/prescriptions/prescriptions_screen.dart @@ -12,6 +12,7 @@ import '../../../../widgets/shared/app_texts_widget.dart'; import '../../../../widgets/shared/card_with_bg_widget.dart'; import '../../../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; import '../../../../widgets/shared/profile_image_widget.dart'; +import '../../../../widgets/shared/errors/dr_app_embedded_error.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); @@ -78,19 +79,10 @@ class _PrescriptionScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? Center( - child: Text( - patientsProv.error, - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: patientsProv.error) : patientsProv.patientPrescriptionsList.length == 0 - ? Center( - child: Text( - 'You don\'t have any Prescriptions', - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError( + error: 'You don\'t have any Prescriptions') : Container( margin: EdgeInsets.fromLTRB( SizeConfig.realScreenWidth * 0.05, diff --git a/lib/screens/patients/profile/radiology/radiology_screen.dart b/lib/screens/patients/profile/radiology/radiology_screen.dart index 8b48e88c..e5dd68f7 100644 --- a/lib/screens/patients/profile/radiology/radiology_screen.dart +++ b/lib/screens/patients/profile/radiology/radiology_screen.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -78,19 +79,9 @@ class _RadiologyScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? Center( - child: Text( - patientsProv.error, - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: patientsProv.error) : patientsProv.patientRadiologyList.length == 0 - ? Center( - child: Text( - 'You don\'t have any Vital Sign', - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') : Container( margin: EdgeInsets.fromLTRB( SizeConfig.realScreenWidth * 0.05, @@ -120,11 +111,12 @@ class _RadiologyScreenState extends State { CrossAxisAlignment.start, children: [ AppText( - '${patientsProv.patientRadiologyList[index].doctorName}', - fontSize: 2.5 * - SizeConfig.textMultiplier, - fontWeight: FontWeight.bold - ), + '${patientsProv.patientRadiologyList[index].doctorName}', + fontSize: 2.5 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold), SizedBox( height: 8, ), @@ -132,7 +124,6 @@ class _RadiologyScreenState extends State { 'Invoice No:${patientsProv.patientRadiologyList[index].invoiceNo}', fontSize: 2 * SizeConfig.textMultiplier, - ), SizedBox( height: 8, diff --git a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart index 570a5aa1..8b08f8ac 100644 --- a/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart +++ b/lib/screens/patients/profile/vital_sign/vital_sign_screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/routes.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -81,19 +82,9 @@ class _VitalSignScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? Center( - child: Text( - patientsProv.error, - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: patientsProv.error) : patientsProv.patientVitalSignList.length == 0 - ? Center( - child: Text( - 'You don\'t have any Vital Sign', - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) + ? DrAppEmbeddedError(error: 'You don\'t have any Vital Sign') : Container( margin: EdgeInsets.fromLTRB( SizeConfig.realScreenWidth * 0.05, @@ -151,7 +142,11 @@ class _VitalSignScreenState extends State { ), ), onTap: () { - Navigator.of(context).pushNamed(VITAL_SIGN_DETAILS,arguments: {'vitalSing':patientsProv.patientVitalSignList[index]}); + Navigator.of(context) + .pushNamed(VITAL_SIGN_DETAILS, arguments: { + 'vitalSing': + patientsProv.patientVitalSignList[index] + }); }, ); }), diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index c182ae07..2065ea57 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -70,7 +70,7 @@ class Helpers { *@desc: showErrorToast */ showErrorToast([msg = null]) { - String localMsg = 'Something wrong happened, please contact the admin'; + String localMsg = generateContactAdminMsg(); if (msg != null) { localMsg = msg.toString(); @@ -96,4 +96,22 @@ class Helpers { return false; } } +/* + *@author: Elham Rababah + *@Date:12/5/2020 + *@param: + *@return: String + *@desc: generate Contact Admin Msg + */ +generateContactAdminMsg([err = null]) { + String localMsg = 'Something wrong happened, please contact the admin'; + if (err != null) { + localMsg = localMsg +'\n \n'+ err.toString(); + } + return localMsg; + } + +} + + diff --git a/lib/widgets/shared/errors/dr_app_embedded_error.dart b/lib/widgets/shared/errors/dr_app_embedded_error.dart new file mode 100644 index 00000000..6bac4a2c --- /dev/null +++ b/lib/widgets/shared/errors/dr_app_embedded_error.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; + +/* + *@author: Elham Rababah + *@Date:12/5/2020 + *@param: error + *@return: StatelessWidget + *@desc: DrAppEmbeddedError class + */ +class DrAppEmbeddedError extends StatelessWidget { + const DrAppEmbeddedError({ + Key key, + @required this.error, + }) : super(key: key); + + final String error; + + @override + Widget build(BuildContext context) { + return Center( + child: Text( + error, + style: TextStyle(color: Theme.of(context).errorColor), + textAlign: TextAlign.center, + ), + ); + } +} \ No newline at end of file From aa72674805d2694a5038e6f103e4f5abe8f9dcea Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Wed, 13 May 2020 15:38:17 +0300 Subject: [PATCH 11/15] Modify Error validation --- .../patients/patient_search_screen.dart | 111 ++++----- lib/screens/patients/patients_screen.dart | 232 +++++++++--------- lib/widgets/patients/dynamic_elements.dart | 42 +++- 3 files changed, 204 insertions(+), 181 deletions(-) diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index de2572f8..cfc2c753 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:flutter/services.dart'; import '../../config/size_config.dart'; @@ -19,6 +20,7 @@ import '../../config/config.dart'; import '../../models/doctor_profile_model.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); +Helpers helpers = Helpers(); // OWNER : Ibrahim albitar // DATE : 19-04-2020 @@ -32,7 +34,7 @@ class PatientSearchScreen extends StatefulWidget { class _PatientSearchScreenState extends State { String _selectedType = '1'; String _selectedLocation = '1'; - + String error = ''; final GlobalKey _formKey = GlobalKey(); bool _autoValidate = false; @@ -59,45 +61,50 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { - print("####IBRAHIM TEST#####" + _patientSearchFormValues.From); - // _patientSearchFormValues.TokenID = - List doctorProfiles = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(doctorProfiles[0]); - print(doctorProfile.doctorName); - if (_formKey.currentState.validate()) { + try { + print("####IBRAHIM TEST#####" + _patientSearchFormValues.From); + // _patientSearchFormValues.TokenID = + List doctorProfiles = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = + DoctorProfileModel.fromJson(doctorProfiles[0]); + print(doctorProfile.doctorName); + if (_formKey.currentState.validate()) { //*****If all data are correct then save data to out variables**** - - _patientSearchFormValues.setFrom = "0"; - _patientSearchFormValues.setTo = "0"; - print("***************Check validate1*************"); - - print(_patientSearchFormValues.getFirstName.trim().length); - print("***************Check validate2*************"); + _formKey.currentState.save(); - _patientSearchFormValues.setFrom = "0"; - _patientSearchFormValues.setTo = "0"; - - //*********************************** */ - sharedPref.setString(TOKEN, '@dm!n'); - sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); - print('_selectedType${_selectedType}'); - String token = await sharedPref.getString(TOKEN); - int projectID = await sharedPref.getInt(PROJECT_ID); - _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = 15; //projectID; - // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); - Navigator.of(context).pushNamed(PATIENTS, arguments: { - "patientSearchForm": _patientSearchFormValues, - "selectedType": _selectedType - }); - } else { + + //*********************************** */ + sharedPref.setString(TOKEN, '@dm!n'); + sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); + print('_selectedType${_selectedType}'); + String token = await sharedPref.getString(TOKEN); + int projectID = await sharedPref.getInt(PROJECT_ID); + _patientSearchFormValues.TokenID = token; + _patientSearchFormValues.ProjectID = 15; //projectID; + // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); + Navigator.of(context).pushNamed(PATIENTS, arguments: { + "patientSearchForm": _patientSearchFormValues, + "selectedType": _selectedType + }); + } else { // If all data are not valid then start auto validation. - setState(() { - _autoValidate = true; - }); + setState(() { + _autoValidate = true; + }); + } + } catch (err) { + handelCatchErrorCase(err); } } + handelCatchErrorCase(err) { + //isLoading = false; + //isError = true; + error = helpers.generateContactAdminMsg(err); + //notifyListeners(); + throw err; + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -187,17 +194,13 @@ class _PatientSearchScreenState extends State { AppTextFormField( hintText: 'First Name', onSaved: (value) { - // _patientSearchFormValues.FirstName = value; value == null ? _patientSearchFormValues.setFirstName = "0" : _patientSearchFormValues.setFirstName = value; - print("**********Value********"); - print(value.toString().trim().isEmpty); - print("**********Value********"); + if (value.toString().trim().isEmpty) { - _patientSearchFormValues.setFirstName = "0"; } }, @@ -211,19 +214,14 @@ class _PatientSearchScreenState extends State { AppTextFormField( hintText: 'Middle Name', onSaved: (value) { - //_patientSearchFormValues.MiddleName = value; - value == null ? _patientSearchFormValues.setMiddleName = "0" : _patientSearchFormValues.setMiddleName = value; - - // value.toString().trim().isEmpty - // ? _patientSearchFormValues.setMiddleName = - // "0" - // : _patientSearchFormValues.setMiddleName = - // value; + if (value.toString().trim().isEmpty) { + _patientSearchFormValues.setMiddleName = "0"; + } }, // validator: (value) { // return TextValidator().validateName(value); @@ -235,16 +233,13 @@ class _PatientSearchScreenState extends State { AppTextFormField( hintText: 'Last Name', onSaved: (value) { - // _patientSearchFormValues.LastName = value; value == null ? _patientSearchFormValues.setLastName = "0" : _patientSearchFormValues.setLastName = value; - - // value.toString().trim().isEmpty - // ? _patientSearchFormValues.setLastName = "0" - // : _patientSearchFormValues.setLastName = - // value; + if (value.toString().trim().isEmpty) { + _patientSearchFormValues.setLastName = "0"; + } }, // validator: (value) { // return TextValidator().validateName(value); @@ -266,8 +261,11 @@ class _PatientSearchScreenState extends State { .setPatientMobileNumber = "0" : _patientSearchFormValues .setPatientMobileNumber = value; - // _patientSearchFormValues.PatientMobileNumber = - // value; + + if (value.toString().trim().isEmpty) { + _patientSearchFormValues + .setPatientMobileNumber = "0"; + } }, ), SizedBox( @@ -285,6 +283,9 @@ class _PatientSearchScreenState extends State { ? _patientSearchFormValues.setPatientID = 0 : _patientSearchFormValues.setPatientID = int.parse(value); + if (value.toString().trim().isEmpty) { + _patientSearchFormValues.setPatientID = 0; + } }), SizedBox( height: 10, diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index c8d70165..076473ba 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; @@ -202,7 +203,6 @@ class _PatientsScreenState extends State { return newDate.toString(); } - filterBooking(String str) { this.responseModelList = this.responseModelList2; @@ -231,21 +231,13 @@ class _PatientsScreenState extends State { } } - String checkDate(String dateString) { - String date; DateTime checkedTime = DateTime.parse(dateString); DateTime currentTime = DateTime.now(); - // print("currentTime.day="+currentTime.day.toString()); - // print("checkedTime.day="+checkedTime.day.toString()); - // print("currentTime.month="+currentTime.month.toString()); - // print("checkedTime.month="+checkedTime.month.toString()); - // print("currentTime.year="+currentTime.year.toString()); - // print("checkedTime.year="+checkedTime.year.toString()); + if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month) && (currentTime.day == checkedTime.day)) { - return "Today"; } else if ((currentTime.year == checkedTime.year) && (currentTime.month == checkedTime.month)) { @@ -254,11 +246,11 @@ class _PatientsScreenState extends State { } else if ((currentTime.day - checkedTime.day) == -1) { return "Tomorrow"; } - + if ((currentTime.day - checkedTime.day) <= -2) { return "Next Week"; } else { - return "Old Date"; + return "Old Date"; } } return "Old Date"; @@ -275,111 +267,118 @@ class _PatientsScreenState extends State { body: patientsProv.isLoading ? DrAppCircularProgressIndeicator() : patientsProv.isError - ? Center( - child: Text( - patientsProv.error, - style: TextStyle(color: Theme.of(context).errorColor), - ), - ) - : Container( - - child: ListView(scrollDirection: Axis.vertical, children: < - Widget>[ - Container( - child: litems == null - ? Column( - children: [ - Container( - child: Center( - child: - Padding( - padding: const EdgeInsets.fromLTRB(0, 250, 0, 0), - child: DrAppCircularProgressIndeicator(), - )), - ), - - ], - ) - : Column( - children: [ - Padding( - padding: EdgeInsets.only( - top: - MediaQuery.of(context).size.height * + ? DrAppEmbeddedError(error: patientsProv.error) + : litems == null + ? DrAppEmbeddedError( + error: 'You don\'t have any ' + + patientTypetitle + + " patiant") + : Container( + child: + ListView(scrollDirection: Axis.vertical, children: < + Widget>[ + Container( + child: litems == null + ? Column( + children: [ + Container( + child: Center( + child: Padding( + padding: const EdgeInsets.fromLTRB( + 0, 250, 0, 0), + child: + DrAppCircularProgressIndeicator(), + )), + ), + ], + ) + : Column( + children: [ + Padding( + padding: EdgeInsets.only( + top: MediaQuery.of(context) + .size + .height * 0.03), - child: SERVICES_PATIANT2[ - int.parse(patientType)] == - "List_MyOutPatient" - ? _locationBar(context) - : Container(), - ), - SizedBox(height: 10.0), - Container( - width: SizeConfig.screenWidth * 0.80, - child: TextField( - controller: _controller, - onChanged: (String str) { - - this.searchData(str); - }, - decoration: buildInputDecoration( - context, 'Search patiant'), - ), - ), - Container( - margin: EdgeInsets.fromLTRB(15, 0, 15, 0), - child: Column( - children: responseModelList - .map((PatiantInformtion item) { - return InkWell( - child: CardWithBgWidget( - widget: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - item.firstName + - " " + - item.lastName + - "- " + - item.patientId.toString(), - fontSize: 2.5 * - SizeConfig.textMultiplier, - fontWeight: FontWeight.bold, - ), - SizedBox( - height: 8, - ), - SERVICES_PATIANT2[int.parse( - patientType)] == - "List_MyOutPatient" - ? AppText( - convertDate(item - .appointmentDate - .toString()), - fontSize: 2.5 * - SizeConfig - .textMultiplier) - : AppText( - item.nationalityName, - fontSize: 2.5 * - SizeConfig - .textMultiplier) - ], - ), - ), - onTap: () { - Navigator.of(context).pushNamed( - PATIENTS_PROFILE, - arguments: {"patient": item}); + child: SERVICES_PATIANT2[ + int.parse(patientType)] == + "List_MyOutPatient" + ? _locationBar(context) + : Container(), + ), + SizedBox(height: 10.0), + Container( + width: SizeConfig.screenWidth * 0.80, + child: TextField( + controller: _controller, + onChanged: (String str) { + this.searchData(str); }, - ); - }).toList(), - ), - ), - ], - )) - ]))); + decoration: buildInputDecoration( + context, 'Search patiant'), + ), + ), + Container( + margin: + EdgeInsets.fromLTRB(15, 0, 15, 0), + child: Column( + children: responseModelList + .map((PatiantInformtion item) { + return InkWell( + child: CardWithBgWidget( + widget: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + item.firstName + + " " + + item.lastName + + "- " + + item.patientId + .toString(), + fontSize: 2.5 * + SizeConfig + .textMultiplier, + fontWeight: + FontWeight.bold, + ), + SizedBox( + height: 8, + ), + SERVICES_PATIANT2[int.parse( + patientType)] == + "List_MyOutPatient" + ? AppText( + convertDate(item + .appointmentDate + .toString()), + fontSize: 2.5 * + SizeConfig + .textMultiplier) + : AppText( + item + .nationalityName, + fontSize: 2.5 * + SizeConfig + .textMultiplier) + ], + ), + ), + onTap: () { + Navigator.of(context).pushNamed( + PATIENTS_PROFILE, + arguments: { + "patient": item + }); + }, + ); + }).toList(), + ), + ), + ], + )) + ]))); } //***********amjad update**buildInputDecoration ***to search box******** @@ -422,15 +421,12 @@ class _PatientsScreenState extends State { fontWeight: FontWeight.bold), ), onTap: () { - print(_locations.indexOf(item)); - filterBooking(item.toString()); setState(() { _activeLocation = _locations.indexOf(item); - }); }), _isActive diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index f8e3e6ac..8b6fc5a8 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -50,35 +50,61 @@ class _DynamicElementsState extends State { AppTextFormField( textInputType: TextInputType.number, hintText: 'From', - controller: _fromDateController, - // validator: (value) { - // return TextValidator().validateDate(_fromDateController.text); - // }, + controller: _fromDateController, //_fromDateController, + inputFormatter: ONLY_DATE, onTap: () { _presentDatePicker('_selectedFromDate'); }, + + // validator: (value) { + // return TextValidator().validateDate(_fromDateController.text); + // }, + /* + *@author: Amjad Amireh + *@Date:13/5/2020 + *@param: + *@return:check if field empty added static value + + *@desc: + */ onSaved: (value) { - widget._patientSearchFormValues.From = _fromDateController.text; + if (_fromDateController.text.toString().trim().isEmpty) { + widget._patientSearchFormValues.From = "0"; + } else { + widget._patientSearchFormValues.From = + _fromDateController.text; + } }, ), - SizedBox( height: 10, ), AppTextFormField( textInputType: TextInputType.number, hintText: 'TO', - controller: _toDateController, + controller: _fromDateController, //_toDateController, onTap: () { _presentDatePicker('_selectedToDate'); }, // validator: (value) { // return TextValidator().validateDate(_toDateController.text); // }, + /* + *@author: Amjad Amireh + *@Date:13/5/2020 + *@param: + *@return:check if field empty added static value + + *@desc: + */ inputFormatter: ONLY_DATE, onSaved: (value) { - widget._patientSearchFormValues.To = _toDateController.text; + if (_toDateController.text.toString().trim().isEmpty) { + widget._patientSearchFormValues.To = "0"; + } else { + widget._patientSearchFormValues.To = _toDateController.text; + } }, ), ], From ce1a502d32f65513661d6e79171d21c29db7f7ee Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Wed, 13 May 2020 23:28:49 +0300 Subject: [PATCH 12/15] Doctor id dynamic --- lib/config/shared_pref_kay.dart | 3 +++ lib/screens/patients/patient_search_screen.dart | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 36dbdaf1..fc74bb99 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,5 +1,8 @@ final TOKEN = 'token'; final PROJECT_ID='projectID'; +//===========amjad============ +final DOCTOR_ID='doctorID'; +//======================= final SLECTED_PATIENT_TYPE='slectedPatientType'; final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; \ No newline at end of file diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index cfc2c753..c9b35a35 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -79,8 +79,14 @@ class _PatientSearchScreenState extends State { print('_selectedType${_selectedType}'); String token = await sharedPref.getString(TOKEN); int projectID = await sharedPref.getInt(PROJECT_ID); + //==================== + int doctorID = doctorProfile.doctorID;//await sharedPref.getInt(DOCTOR_ID); + //==================== _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = 15; //projectID; + _patientSearchFormValues.ProjectID = projectID;//15 + //=================== + _patientSearchFormValues.DoctorID = doctorID; + //==================== // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, From 2f0c400328760a9f9731a06b730513e3b6d6e45b Mon Sep 17 00:00:00 2001 From: Amjad Amireh Date: Thu, 14 May 2020 00:45:17 +0300 Subject: [PATCH 13/15] Modify time and date --- lib/models/patient/patiant_info_model.dart | 3 +++ lib/screens/patients/patients_screen.dart | 23 ++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index c85edace..fd695c9c 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -51,6 +51,7 @@ class PatiantInformtion { String genderDescription; String nursingStationName; String appointmentDate; + String startTime; PatiantInformtion({ this.list, @@ -87,6 +88,7 @@ class PatiantInformtion { this.genderDescription, this.nursingStationName, this.appointmentDate, + this.startTime, }); @@ -124,6 +126,7 @@ class PatiantInformtion { genderDescription: json["GenderDescription"], nursingStationName: json["NursingStationName"], appointmentDate: json["AppointmentDate"], + startTime: json["StartTime"], ); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 076473ba..e3bb2908 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -202,7 +202,24 @@ class _PatientsScreenState extends State { return newDate.toString(); } + convertDateFormat2(String str) { + String timeConvert; + const start = "/Date("; + const end = "+0300)"; + + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); + + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + String newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + return newDate.toString(); + } filterBooking(String str) { this.responseModelList = this.responseModelList2; @@ -350,9 +367,11 @@ class _PatientsScreenState extends State { patientType)] == "List_MyOutPatient" ? AppText( - convertDate(item + + convertDateFormat2(item .appointmentDate - .toString()), + .toString())+" "+"-"+" "+item.startTime + , fontSize: 2.5 * SizeConfig .textMultiplier) From de6f814f56aaa950560a1a5dc3ef2caa0b50eac2 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 14 May 2020 14:35:32 +0300 Subject: [PATCH 14/15] change client to AppClient --- lib/config/config.dart | 39 ++++++++++++++-- lib/providers/hospital_provider.dart | 16 +------ lib/providers/patients_provider.dart | 46 ++++++------------- .../profile/profile_header_widget.dart | 3 -- 4 files changed, 50 insertions(+), 54 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 93dfa881..372fab75 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,12 +6,41 @@ const ONLY_DATE = "[0-9/]"; const BASE_URL = 'https://uat.hmgwebservices.com/Services/'; const PHARMACY_ITEMS_URL = "Lists.svc/REST/GetPharmcyItems"; const PHARMACY_LIST_URL = "Patients.svc/REST/GetPharmcyList"; +const GET_PROJECTS = 'Lists.svc/REST/GetProjectForDoctorAPP'; +const GET_PATIENT_VITAL_SIGN = 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; +const GET_PATIENT_LAB_OREDERS = + 'DoctorApplication.svc/REST/GetPatientLabOreders'; +const GET_PRESCRIPTION = 'Patients.svc/REST/GetPrescriptionApptList'; +const GET_RADIOLOGY = 'DoctorApplication.svc/REST/GetPatientRadResult'; //*********change value to decode json from Dropdown ************ - var SERVICES_PATIANT = ["GetMyOutPatient", "GetMyInPatient", "GtMyDischargePatient","GtMyReferredPatient","GtMyDischargeReferralPatient","GtMyTomorrowPatient","GtMyReferralPatient"]; -var SERVICES_PATIANT2 = ["List_MyOutPatient", "List_MyInPatient","List_MyDischargePatient" ,"List_MyReferredPatient","List_MyDischargeReferralPatient","List_MyTomorrowPatient","List_MyReferralPatient"]; -var SERVICES_PATIANT_HEADER = ["OutPatient", "InPatient", "Discharge","Referred","Referral Discharge","Tomorrow","Referral"]; +var SERVICES_PATIANT = [ + "GetMyOutPatient", + "GetMyInPatient", + "GtMyDischargePatient", + "GtMyReferredPatient", + "GtMyDischargeReferralPatient", + "GtMyTomorrowPatient", + "GtMyReferralPatient" +]; +var SERVICES_PATIANT2 = [ + "List_MyOutPatient", + "List_MyInPatient", + "List_MyDischargePatient", + "List_MyReferredPatient", + "List_MyDischargeReferralPatient", + "List_MyTomorrowPatient", + "List_MyReferralPatient" +]; +var SERVICES_PATIANT_HEADER = [ + "OutPatient", + "InPatient", + "Discharge", + "Referred", + "Referral Discharge", + "Tomorrow", + "Referral" +]; //****************** - // Colors ////// by : ibrahim -const PRIMARY_COLOR = 0xff58434F; \ No newline at end of file +const PRIMARY_COLOR = 0xff58434F; diff --git a/lib/providers/hospital_provider.dart b/lib/providers/hospital_provider.dart index 005a53ac..abf758a2 100644 --- a/lib/providers/hospital_provider.dart +++ b/lib/providers/hospital_provider.dart @@ -1,23 +1,11 @@ import 'dart:convert'; +import 'package:doctor_app_flutter/client/app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; -import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; - -import '../interceptor/http_interceptor.dart'; import 'package:flutter/cupertino.dart'; -import 'package:http/http.dart'; -import 'package:http_interceptor/http_client_with_interceptor.dart'; - -const GET_PROJECTS = BASE_URL + 'Lists.svc/REST/GetProjectForDoctorAPP'; class HospitalProvider with ChangeNotifier { - - - Client client = - HttpClientWithInterceptor.build(interceptors: [HttpInterceptor()]); - Future getProjectsList() async { const url = GET_PROJECTS; var info = { @@ -31,7 +19,7 @@ class HospitalProvider with ChangeNotifier { "IsLoginForDoctorApp": true }; try { - final response = await client.post(url, body: json.encode(info)); + final response = await AppClient.post(url, body: json.encode(info)); return Future.value(json.decode(response.body)); } catch (error) { throw error; diff --git a/lib/providers/patients_provider.dart b/lib/providers/patients_provider.dart index 9e6ef767..c68e94d0 100644 --- a/lib/providers/patients_provider.dart +++ b/lib/providers/patients_provider.dart @@ -1,29 +1,20 @@ import 'dart:convert'; -import 'package:doctor_app_flutter/models/patient/lab_orders_res_model.dart'; -import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/models/patient/prescription_req_model.dart'; -import 'package:doctor_app_flutter/models/patient/prescription_res_model.dart'; -import 'package:doctor_app_flutter/models/patient/radiology_res_model.dart'; -import 'package:doctor_app_flutter/widgets/auth/login_form.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart'; import 'package:http_interceptor/http_client_with_interceptor.dart'; +import '../client/app_client.dart'; import '../config/config.dart'; import '../interceptor/http_interceptor.dart'; +import '../models/patient/lab_orders_res_model.dart'; +import '../models/patient/patiant_info_model.dart'; import '../models/patient/patient_model.dart'; +import '../models/patient/prescription_res_model.dart'; +import '../models/patient/radiology_res_model.dart'; import '../models/patient/vital_sign_res_model.dart'; - import '../util/helpers.dart'; -const GET_PATIENT_VITAL_SIGN = - BASE_URL + 'Doctors.svc/REST/Doctor_GetPatientVitalSign'; -const GET_PATIENT_LAB_OREDERS = - BASE_URL + 'DoctorApplication.svc/REST/GetPatientLabOreders'; -const GET_PRESCRIPTION = BASE_URL + 'Patients.svc/REST/GetPrescriptionApptList'; -const GET_RADIOLOGY = - BASE_URL + 'DoctorApplication.svc/REST/GetPatientRadResult'; Helpers helpers = Helpers(); class PatientsProvider with ChangeNotifier { @@ -43,12 +34,12 @@ class PatientsProvider with ChangeNotifier { Future getPatientList(PatientModel patient, patientType) async { /* const url = BASE_URL+'DoctorApplication.svc/REST/GetMyInPatient';*/ - + int val = int.parse(patientType); - //**********Modify url by amjad amireh for patiant type********* - - - final url =BASE_URL+"DoctorApplication.svc/REST/"+ SERVICES_PATIANT[val]; + //**********Modify url by amjad amireh for patiant type********* + + final url = + BASE_URL + "DoctorApplication.svc/REST/" + SERVICES_PATIANT[val]; // print("a===========$url=======a"); try { @@ -103,7 +94,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { - final response = await client.post(GET_PATIENT_VITAL_SIGN, + final response = await AppClient.post(GET_PATIENT_VITAL_SIGN, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -136,15 +127,6 @@ class PatientsProvider with ChangeNotifier { } } - PatiantInformtion getSelectedPatient() { - return _selectedPatient; - } - - setSelectedPatient(PatiantInformtion patient) { - // return _selectedPatient; - _selectedPatient = patient; - } - /*@author: Elham Rababah *@Date:27/4/2020 *@param: patient @@ -158,7 +140,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { - final response = await client.post(GET_PATIENT_LAB_OREDERS, + final response = await AppClient.post(GET_PATIENT_LAB_OREDERS, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -204,7 +186,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { final response = - await client.post(GET_PRESCRIPTION, body: json.encode(patient)); + await AppClient.post(GET_PRESCRIPTION, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; @@ -263,7 +245,7 @@ class PatientsProvider with ChangeNotifier { try { if (await Helpers.checkConnection()) { final response = - await client.post(GET_RADIOLOGY, body: json.encode(patient)); + await AppClient.post(GET_RADIOLOGY, body: json.encode(patient)); final int statusCode = response.statusCode; isLoading = false; diff --git a/lib/widgets/patients/profile/profile_header_widget.dart b/lib/widgets/patients/profile/profile_header_widget.dart index a745cf88..4aa9f92b 100644 --- a/lib/widgets/patients/profile/profile_header_widget.dart +++ b/lib/widgets/patients/profile/profile_header_widget.dart @@ -1,9 +1,6 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/providers/patients_provider.dart'; - import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -import 'package:provider/provider.dart'; import '../../../config/size_config.dart'; import '../../shared/profile_image_widget.dart'; From 146e913113c16d0fca6a6489c52787e5153fda03 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 17 May 2020 18:02:51 +0300 Subject: [PATCH 15/15] add choose clinic to login process --- lib/models/clinic_model.dart | 43 +++++ lib/models/profile_req_Model.dart | 71 ++++++++ lib/providers/auth_provider.dart | 20 +++ .../auth/verification_methods_screen.dart | 5 +- .../patients/patient_search_screen.dart | 26 +-- lib/widgets/auth/auth_header.dart | 2 +- lib/widgets/auth/verfiy_account.dart | 89 +++++++++- lib/widgets/auth/verification_methods.dart | 156 +++++++++--------- 8 files changed, 308 insertions(+), 104 deletions(-) create mode 100644 lib/models/clinic_model.dart create mode 100644 lib/models/profile_req_Model.dart diff --git a/lib/models/clinic_model.dart b/lib/models/clinic_model.dart new file mode 100644 index 00000000..e5eb8eee --- /dev/null +++ b/lib/models/clinic_model.dart @@ -0,0 +1,43 @@ +/* + *@author: Elham Rababah + *@Date:17/5/2020 + *@param: + *@return: + *@desc: Clinic Model + */ +class ClinicModel { + Null setupID; + int projectID; + int doctorID; + int clinicID; + bool isActive; + String clinicName; + + ClinicModel( + {this.setupID, + this.projectID, + this.doctorID, + this.clinicID, + this.isActive, + this.clinicName}); + + ClinicModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + isActive = json['IsActive']; + clinicName = json['ClinicName']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['IsActive'] = this.isActive; + data['ClinicName'] = this.clinicName; + return data; + } +} diff --git a/lib/models/profile_req_Model.dart b/lib/models/profile_req_Model.dart new file mode 100644 index 00000000..6a850811 --- /dev/null +++ b/lib/models/profile_req_Model.dart @@ -0,0 +1,71 @@ +/* + *@author: Elham Rababah + *@Date:17/5/2020 + *@param: + *@return: + *@desc: ProfileReqModel + */ +class ProfileReqModel { + int projectID; + int clinicID; + int doctorID; + bool isRegistered; + bool license; + int languageID; + String stamp; + String iPAdress; + double versionID; + int channel; + String tokenID; + String sessionID; + bool isLoginForDoctorApp; + + ProfileReqModel( + {this.projectID, + this.clinicID, + this.doctorID, + this.isRegistered =true, + this.license, + this.languageID, + this.stamp = '2020-04-26T09:32:18.317Z', + this.iPAdress='11.11.11.11', + this.versionID=1.2, + this.channel=9, + this.sessionID='E2bsEeYEJo', + this.tokenID, + this.isLoginForDoctorApp = true}); + + ProfileReqModel.fromJson(Map json) { + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + doctorID = json['doctorID']; + isRegistered = json['IsRegistered']; + license = json['License']; + languageID = json['LanguageID']; + stamp = json['stamp']; + iPAdress = json['IPAdress']; + versionID = json['VersionID']; + channel = json['Channel']; + tokenID = json['TokenID']; + sessionID = json['SessionID']; + isLoginForDoctorApp = json['IsLoginForDoctorApp']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['doctorID'] = this.doctorID; + data['IsRegistered'] = this.isRegistered; + data['License'] = this.license; + data['LanguageID'] = this.languageID; + data['stamp'] = this.stamp; + data['IPAdress'] = this.iPAdress; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['TokenID'] = this.tokenID; + data['SessionID'] = this.sessionID; + data['IsLoginForDoctorApp'] = this.isLoginForDoctorApp; + return data; + } +} diff --git a/lib/providers/auth_provider.dart b/lib/providers/auth_provider.dart index 5e4877b4..af93c837 100644 --- a/lib/providers/auth_provider.dart +++ b/lib/providers/auth_provider.dart @@ -14,6 +14,7 @@ const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; const MEMBER_CHECK_ACTIVATION_CODE_NEW ='Sentry.svc/REST/MemberCheckActivationCode_New'; +const GET_DOC_PROFILES = 'Doctors.svc/REST/GetDocProfiles'; class AuthProvider with ChangeNotifier { Future login(UserModel userInfo) async { const url = LOGIN_URL; @@ -85,4 +86,23 @@ class AuthProvider with ChangeNotifier { throw error; } } + + /* + *@author: Elham Rababah + *@Date:17/5/2020 + *@param: docInfo + *@return:Future + *@desc: getDocProfiles + */ + Future getDocProfiles(docInfo) async { + const url = GET_DOC_PROFILES; + + try { + final response = await AppClient.post(url, body: json.encode(docInfo)); + return Future.value(json.decode(response.body)); + } catch (error) { + print(error); + throw error; + } + } } diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index 91fc4713..89193c65 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -46,8 +46,9 @@ class _VerificationMethodsScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ AuthHeader(loginType.verificationMethods), - VerificationMethods(changeLoadingStata: - changeLoadingStata,), + VerificationMethods( + changeLoadingStata: changeLoadingStata, + ), ], ), ), diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index c9b35a35..d79a032a 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -39,9 +39,6 @@ class _PatientSearchScreenState extends State { bool _autoValidate = false; var _patientSearchFormValues = PatientModel( - ProjectID: 15, - ClinicID: 0, - DoctorID: 4709, FirstName: "0", MiddleName: "0", LastName: "0", @@ -62,15 +59,10 @@ class _PatientSearchScreenState extends State { void _validateInputs() async { try { - print("####IBRAHIM TEST#####" + _patientSearchFormValues.From); - // _patientSearchFormValues.TokenID = - List doctorProfiles = await sharedPref.getObj(DOCTOR_PROFILE); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = - DoctorProfileModel.fromJson(doctorProfiles[0]); - print(doctorProfile.doctorName); + new DoctorProfileModel.fromJson(profile); if (_formKey.currentState.validate()) { -//*****If all data are correct then save data to out variables**** - _formKey.currentState.save(); //*********************************** */ @@ -78,16 +70,12 @@ class _PatientSearchScreenState extends State { sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); print('_selectedType${_selectedType}'); String token = await sharedPref.getString(TOKEN); - int projectID = await sharedPref.getInt(PROJECT_ID); - //==================== - int doctorID = doctorProfile.doctorID;//await sharedPref.getInt(DOCTOR_ID); - //==================== + _patientSearchFormValues.TokenID = token; - _patientSearchFormValues.ProjectID = projectID;//15 - //=================== - _patientSearchFormValues.DoctorID = doctorID; - //==================== - // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); + _patientSearchFormValues.ProjectID = doctorProfile.projectID ;//15 + _patientSearchFormValues.DoctorID = doctorProfile.doctorID; + _patientSearchFormValues.ClinicID = doctorProfile.clinicID; + Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, "selectedType": _selectedType diff --git a/lib/widgets/auth/auth_header.dart b/lib/widgets/auth/auth_header.dart index ef507fd6..5fced98d 100644 --- a/lib/widgets/auth/auth_header.dart +++ b/lib/widgets/auth/auth_header.dart @@ -23,7 +23,7 @@ class AuthHeader extends StatelessWidget { children: [ Container( margin: SizeConfig.isMobile - ? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0) + ? EdgeInsetsDirectional.fromSTEB(0, SizeConfig.realScreenHeight*0.03, 0, 0) : EdgeInsetsDirectional.fromSTEB( SizeConfig.realScreenWidth * 0.13, 0, 0, 0), child: buildImageLogo(), diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index df134102..f701d554 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -1,4 +1,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/clinic_model.dart'; +import 'package:doctor_app_flutter/models/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/profile_req_Model.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -32,6 +35,7 @@ class _VerifyAccountState extends State { }; Future _loggedUserFuture; var _loggedUser; + AuthProvider authProv; @override void initState() { super.initState(); @@ -46,7 +50,7 @@ class _VerifyAccountState extends State { @override Widget build(BuildContext context) { - AuthProvider authProv = Provider.of(context); + authProv = Provider.of(context); return FutureBuilder( future: Future.wait([_loggedUserFuture]), @@ -200,6 +204,7 @@ class _VerifyAccountState extends State { } return null; } + /* *@author: Elham Rababah *@Date:28/4/2020 @@ -256,7 +261,7 @@ class _VerifyAccountState extends State { *@return: *@desc: verify Account func call sendActivationCodeByOtpNotificationType service */ - verifyAccount(AuthProvider authProv, Function changeLoadingStata) async{ + verifyAccount(AuthProvider authProv, Function changeLoadingStata) async { if (verifyAccountForm.currentState.validate()) { changeLoadingStata(true); @@ -285,12 +290,22 @@ class _VerifyAccountState extends State { changeLoadingStata(true); authProv.memberCheckActivationCodeNew(model).then((res) { - changeLoadingStata(false); + // changeLoadingStata(false); if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); - sharedPref.setObj(DOCTOR_PROFILE, res['List_DoctorProfile']); - Navigator.of(context).pushNamed(HOME); + if (res['List_DoctorProfile'] != null) { + loginProcessCompleted(res['List_DoctorProfile'][0],changeLoadingStata); + } else { + _asyncSimpleDialog(context, res['List_DoctorsClinic'], 'ClinicName', + 'Please Select Clinic') + .then((clinicInfo) { + ClinicModel clinic = ClinicModel.fromJson(clinicInfo); + print(clinicInfo); + getDocProfiles(clinic, changeLoadingStata); + }); + } } else { + changeLoadingStata(false); helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { @@ -303,4 +318,68 @@ class _VerifyAccountState extends State { // changeLoadingStata(false); } } + + + /* + *@author: Elham Rababah + *@Date:17/5/2020 + *@param: Map profile, Function changeLoadingStata + *@return: + *@desc: loginProcessCompleted + */ + loginProcessCompleted(Map profile, Function changeLoadingStata) { + changeLoadingStata(false); + sharedPref.setObj(DOCTOR_PROFILE, profile); + Navigator.of(context).pushNamed(HOME); + } + + Future _asyncSimpleDialog( + BuildContext context, List list, String txtKey, + [String text = '']) async { + return await showDialog( + context: context, + barrierDismissible: true, + builder: (BuildContext context) { + return SimpleDialog( + title: Text(text), + children: list.map((value) { + return SimpleDialogOption( + onPressed: () { + Navigator.pop(context, + value); //here passing the index to be return on item selection + }, + child: Text(value[txtKey]), //item value + ); + }).toList(), + ); + }); + } + + /* + *@author: Elham Rababah + *@Date:17/5/2020 + *@param: ClinicModel clinicInfo, Function changeLoadingStata + *@return: + *@desc: getDocProfiles + */ + getDocProfiles(ClinicModel clinicInfo, Function changeLoadingStata) { + ProfileReqModel docInfo = new ProfileReqModel( + doctorID: clinicInfo.doctorID, + clinicID: clinicInfo.clinicID, + license: true, + projectID: clinicInfo.projectID, + tokenID: '', + languageID: 2); + authProv.getDocProfiles(docInfo).then((res) { + if (res['MessageStatus'] == 1) { + print("DoctorProfileList ${res['DoctorProfileList'][0]}"); + loginProcessCompleted(res['DoctorProfileList'][0], changeLoadingStata); + } else { + changeLoadingStata(false); + helpers.showErrorToast(res['ErrorEndUserMessage']); + } + }).catchError((err) { + print('$err'); + }); + } } diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 4c8ac7e9..462f76ef 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -57,7 +58,7 @@ class _VerificationMethodsState extends State { return Text('Error: ${snapshot.error}'); } else { return Container( - width: SizeConfig.realScreenWidth * 0.90, + width: SizeConfig.realScreenWidth * 0.80, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -68,55 +69,54 @@ class _VerificationMethodsState extends State { ), ), SizedBox( - height: 40, + height: 20, ), Container( - width: SizeConfig.realScreenWidth * 80, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: spaceBetweenMethods, - children: [ - buildVerificationMethod( - context, - 'assets/images/verification_fingerprint_icon.png', - 'Fingerprint', - () {}), - buildVerificationMethod( - context, - 'assets/images/verification_faceid_icon.png', - 'Face ID', - () {}), - ], + height: SizeConfig.realScreenHeight * 0.6, + child: CustomScrollView( + primary: false, + slivers: [ + SliverPadding( + padding: const EdgeInsets.all(0), + sliver: SliverGrid.count( + // childAspectRatio: 0.7, + crossAxisSpacing: 0, + mainAxisSpacing: 5, + crossAxisCount: 2, + children: [ + buildVerificationMethod( + context, + 'assets/images/verification_fingerprint_icon.png', + 'Fingerprint', + () {}), + buildVerificationMethod( + context, + 'assets/images/verification_faceid_icon.png', + 'Face ID', + () {}), + buildVerificationMethod( + context, + 'assets/images/verification_whatsapp_icon.png', + 'WhatsApp', () { + sendActivationCodeByOtpNotificationType( + 2, authProv); + }), + buildVerificationMethod( + context, + 'assets/images/verification_sms_icon.png', + 'SMS', () { + sendActivationCodeByOtpNotificationType( + 1, authProv); + }), + ], + ), ), - SizedBox( - height: 40, - ), - Row( - mainAxisAlignment: spaceBetweenMethods, - children: [ - buildVerificationMethod( - context, - 'assets/images/verification_whatsapp_icon.png', - 'WhatsApp', () { - sendActivationCodeByOtpNotificationType( - 2, authProv); - }), - buildVerificationMethod( - context, - 'assets/images/verification_sms_icon.png', - 'SMS', () { - sendActivationCodeByOtpNotificationType( - 1, authProv); - }), - ], - ) ], ), + // height: 500, ), - SizedBox( - height: SizeConfig.heightMultiplier * 2, + SizedBox( + // height: 20, ) ], ), @@ -126,41 +126,43 @@ class _VerificationMethodsState extends State { }); } - InkWell buildVerificationMethod(context, url, dec, Function fun) { - return InkWell( - onTap: fun, - child: Container( - // height: SizeConfig.heightMultiplier *2, - height: SizeConfig.heightMultiplier * 19, - width: SizeConfig.widthMultiplier * 37, + Center buildVerificationMethod(context, url, dec, Function fun) { + return Center( + child: InkWell( + onTap: fun, + child: Container( + // height: SizeConfig.heightMultiplier *2, + height: SizeConfig.heightMultiplier * 19, + width: SizeConfig.widthMultiplier * 37, - padding: EdgeInsets.all(10), - decoration: BoxDecoration( - border: Border.all( - width: 1, - color: Hexcolor( - '#CCCCCC') // <--- border width here + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + border: Border.all( + width: 1, + color: Hexcolor( + '#CCCCCC') // <--- border width here + ), + borderRadius: BorderRadius.all(Radius.circular(10))), + child: Column( + children: [ + Container( + margin: EdgeInsetsDirectional.only( + top: SizeConfig.heightMultiplier * 0.5), + child: Image.asset( + url, + height: SizeConfig.heightMultiplier * 11, + fit: BoxFit.cover, ), - borderRadius: BorderRadius.all(Radius.circular(10))), - child: Column( - children: [ - Container( - margin: EdgeInsetsDirectional.only( - top: SizeConfig.heightMultiplier * 0.5), - child: Image.asset( - url, - height: SizeConfig.heightMultiplier * 10, - fit: BoxFit.cover, ), - ), - SizedBox( - height: 10, - ), - Text( - dec, - style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), - ) - ], + SizedBox( + height: 10, + ), + Text( + dec, + style: TextStyle(fontSize: SizeConfig.textMultiplier * 2), + ) + ], + ), ), ), ); @@ -180,7 +182,7 @@ class _VerificationMethodsState extends State { Map model = { "LogInTokenID": _loggedUser['LogInTokenID'], "Channel": 9, - "MobileNumber": 785228065,//_loggedUser['MobileNumber'], + "MobileNumber": 785228065, //_loggedUser['MobileNumber'], "IPAdress": "11.11.11.11", "LanguageID": 2, "ProjectID": 15, //TODO : this should become daynamci