diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 077bd7f5..9fc39b5c 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -37,7 +37,7 @@ const Map> localizedValues = { 'lab': {'en': 'Lab', 'ar': 'المختبر'}, 'result': {'en': 'Result', 'ar': 'نتيجة'}, 'todayStatistics': {'en': 'Today Statistics', 'ar': 'إحصائيات اليوم'}, - 'arrived': {'en': 'Arrived', 'ar': 'وصل'}, + 'arrived': {'en': 'Arrival Patients', 'ar': ' المرضى الواصلين'}, 'er': {'en': 'ER', 'ar': 'حالة طوارئ'}, 'walkIn': {'en': 'Walk-in', 'ar': 'ادخل'}, 'notArrived': {'en': 'Not Arrived', 'ar': 'لم يصل'}, diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 0e52b16c..f09a8779 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -24,11 +24,7 @@ class PrescriptionService extends BaseService { PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(); SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( //search: ["Acetaminophen"], - // vidaAuthTokenID: - // "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlV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SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", ); PostPrescriptionReqModel _postPrescriptionReqModel = diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index d12ac7f5..70bf0899 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -49,18 +49,22 @@ class PatientViewModel extends BaseViewModel { _patientService.referalFrequancyList; Future getPatientList(patient, patientType, + {bool isBusyLocal = false}) async { + var localRes ; if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); } + localRes = await _patientService.getPatientList(patient, patientType); if (_patientService.hasError) { error = _patientService.error; setState(ViewState.Error); + } - return _patientService.getPatientList(patient, patientType); + return localRes; } diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 52fbb677..726e5050 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -44,6 +44,8 @@ class _PatientSearchScreenState extends State { bool _autoValidate = false; bool onlyArrived = true; + bool isFormSubmitted = false; + var _patientSearchFormValues = PatientModel( FirstName: "0", MiddleName: "0", @@ -64,7 +66,9 @@ class _PatientSearchScreenState extends State { PatientOutSA: false); void _validateInputs() async { - + setState(() { + isFormSubmitted = true; + }); try { if (_formKey.currentState.validate()) { @@ -73,8 +77,11 @@ class _PatientSearchScreenState extends State { if ((_patientSearchFormValues.From == "0" || _patientSearchFormValues.To == "0") && _selectedType == "7") { - helpers.showErrorToast("Please Choose The Dates"); + // helpers.showErrorToast("Please Choose The Dates"); } else { + setState(() { + isFormSubmitted = false; + }); Navigator.of(context).pushNamed(PATIENTS, arguments: { "patientSearchForm": _patientSearchFormValues, "selectedType": _selectedType @@ -112,7 +119,7 @@ class _PatientSearchScreenState extends State { children: [ Container( child: Icon( - DoctorApp.search_patient, + DoctorApp.search_patient_1, size: 100, color: Colors.black, ), @@ -403,7 +410,7 @@ class _PatientSearchScreenState extends State { ), ), (!(_selectedType == '2' || _selectedType == '4')) - ? DynamicElements(_patientSearchFormValues) + ? DynamicElements(_patientSearchFormValues, isFormSubmitted) : SizedBox( height: 0, ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 14f68a79..4fcabf07 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -273,7 +273,7 @@ class _PatientsScreenState extends State { patientType) .then((res) { setState(() { - _isLoading = false; + if (res != null && res['MessageStatus'] == 1) { if (val2 == 7) { @@ -302,10 +302,13 @@ class _PatientsScreenState extends State { responseModelList = new ModelResponse.fromJson(parsed).list; responseModelList2 = responseModelList; _isError = false; + } else { _isError = true; - error = model.error; //res['ErrorEndUserMessage'] ?? res['ErrorMessage']; + error = model.error??res['ErrorEndUserMessage'] ?? res['ErrorMessage']; } + + _isLoading = false; }); }).catchError((error) { setState(() { diff --git a/lib/widgets/patients/dynamic_elements.dart b/lib/widgets/patients/dynamic_elements.dart index e6688397..60b681d7 100644 --- a/lib/widgets/patients/dynamic_elements.dart +++ b/lib/widgets/patients/dynamic_elements.dart @@ -1,13 +1,15 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/custom_validation_error.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; class DynamicElements extends StatefulWidget { final PatientModel _patientSearchFormValues; - DynamicElements(this._patientSearchFormValues); + final bool isFormSubmitted; + DynamicElements(this._patientSearchFormValues, this.isFormSubmitted); @override _DynamicElementsState createState() => _DynamicElementsState(); } @@ -113,6 +115,10 @@ class _DynamicElementsState extends State { ), SizedBox( + height: 5, + ), + if(widget._patientSearchFormValues.From == "0" && widget.isFormSubmitted) + CustomValidationError(),SizedBox( height: 10, ), AppTextFormField( @@ -137,6 +143,10 @@ class _DynamicElementsState extends State { } }, ), + if(widget._patientSearchFormValues.To == "0" && widget.isFormSubmitted) + CustomValidationError(),SizedBox( + height: 10, + ), ], ); }, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 8a9ae52b..11664510 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,9 +1,10 @@ +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; @@ -28,6 +29,7 @@ class _AppDrawerState extends State { bool _isInit = true; Helpers helpers = new Helpers(); ProjectViewModel projectsProvider; + // @override // void didChangeDependencies() { // super.didChangeDependencies(); @@ -47,119 +49,126 @@ class _AppDrawerState extends State { // margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 2), child: Drawer( child: Column(children: [ - Expanded( - flex: 4, - child: ListView(padding: EdgeInsets.zero, children: [ - Container( - height: SizeConfig.heightMultiplier * 50, - child: InkWell( - child: DrawerHeader( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - child: Image.asset('assets/images/logo.png'), - margin: EdgeInsets.only(top: 10, bottom: 15), - ), - SizedBox( - height: 1, - child: Container( - color: Colors.black26, + Expanded( + flex: 4, + child: ListView(padding: EdgeInsets.zero, children: [ + Container( + height: SizeConfig.heightMultiplier * 50, + child: InkWell( + child: DrawerHeader( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: Image.asset( + 'assets/images/logo.png', ), + margin: EdgeInsets.only(top: 10, bottom: 15), ), - SizedBox(height: 15), - authProvider.doctorProfile != null - ? CircleAvatar( - radius: SizeConfig.imageSizeMultiplier * 12, - backgroundImage: NetworkImage( - authProvider.doctorProfile.doctorImageURL), - backgroundColor: Colors.white, - ) - : SizedBox(), - authProvider.doctorProfile != null - ? Padding( - padding: EdgeInsets.only(top: 10), - child: AppText( - authProvider.doctorProfile?.doctorName, - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: SizeConfig.textMultiplier * 2, - )) - : SizedBox(), - AppText( - projectsProvider.isArabic - ? authProvider - .doctorProfile.titleDescriptionN ?? - "" - : authProvider - .doctorProfile?.titleDescription ?? - "", - fontWeight: FontWeight.normal, - color: Colors.black87), - RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(18.0), - side: BorderSide(color: Colors.red)), - child: AppText( - TranslationBase.of(context).logout, - color: Colors.white, - ), - onPressed: () async { - Navigator.pop(context); - await helpers.logout(); - }, + SizedBox( + height: 1, + child: Container( + color: Colors.black26, + ), + ), + SizedBox(height: 15), + InkWell( + onTap: (){ + Navigator.of(context).pushNamed(PROFILE, arguments: { + 'title': authProvider.doctorProfile.doctorName, + "doctorProfileall": authProvider.doctorProfile + }); + }, + child: Column( + children: [ + authProvider.doctorProfile != null + ? CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + backgroundImage: NetworkImage( + authProvider.doctorProfile.doctorImageURL), + backgroundColor: Colors.white, + ) + : SizedBox(), + authProvider.doctorProfile != null + ? Padding( + padding: EdgeInsets.only(top: 10), + child: AppText( + authProvider.doctorProfile?.doctorName, + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: SizeConfig.textMultiplier * 2, + )) + : SizedBox(), + AppText( + projectsProvider.isArabic + ? authProvider + .doctorProfile.titleDescriptionN ?? + "" + : authProvider + .doctorProfile?.titleDescription ?? + "", + fontWeight: FontWeight.normal, + color: Colors.black87), + ], + ), + ), + RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(18.0), + side: BorderSide(color: Colors.red)), + child: AppText( + TranslationBase.of(context).logout, + color: Colors.white, + ), + onPressed: () async { + Navigator.pop(context); + await helpers.logout(); + }, + ), + ], ), - ], + ), ), ), - onTap: () { - //Navigator.of(context).pushNamed(PROFILE); - Navigator.of(context).pushNamed(PROFILE, arguments: { - 'title': authProvider.doctorProfile.doctorName, - "doctorProfileall": authProvider.doctorProfile - }); - }, - ), - ), - InkWell( - child: DrawerItem( - TranslationBase.of(context).settings, Icons.settings), - onTap: () { - Navigator.pop(context); - Navigator.of(context).pushNamed(SETTINGS); - }, - ), - InkWell( - child: DrawerItem( - TranslationBase.of(context).qr + - TranslationBase.of(context).reader, - DoctorApp.qr_code), - onTap: () { - Navigator.pop(context); - Navigator.of(context).pushNamed(QR_READER); - }, + InkWell( + child: DrawerItem( + TranslationBase.of(context).settings, Icons.settings), + onTap: () { + Navigator.pop(context); + Navigator.of(context).pushNamed(SETTINGS); + }, + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).qr + + TranslationBase.of(context).reader, + DoctorApp.qr_code), + onTap: () { + Navigator.pop(context); + Navigator.of(context).pushNamed(QR_READER); + }, + ), + ]), ), - ]), - ), - Expanded( - flex: 1, - child: Column(children: [ - Container( - // This align moves the children to the bottom - child: Align( - alignment: FractionalOffset.bottomCenter, - child: Container( - child: Column( - children: [ - Text("Powered by"), - Image.asset( - 'assets/images/cs_logo_container.png', - width: SizeConfig.imageSizeMultiplier * 30, - ) - ], - )))) - ])) - ])), + Expanded( + flex: 1, + child: Column(children: [ + Container( + // This align moves the children to the bottom + child: Align( + alignment: FractionalOffset.bottomCenter, + child: Container( + child: Column( + children: [ + Text("Powered by"), + Image.asset( + 'assets/images/cs_logo_container.png', + width: SizeConfig.imageSizeMultiplier * 30, + ) + ], + )))) + ])) + ])), ), width: SizeConfig.realScreenWidth * 0.60, margin: 0, diff --git a/lib/widgets/shared/drawer_item_widget.dart b/lib/widgets/shared/drawer_item_widget.dart index c4fe25c1..9696aa1f 100644 --- a/lib/widgets/shared/drawer_item_widget.dart +++ b/lib/widgets/shared/drawer_item_widget.dart @@ -28,7 +28,7 @@ class _DrawerItemState extends State { return Container( margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), child: Row( - crossAxisAlignment: CrossAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Icon( widget.icon, @@ -37,12 +37,15 @@ class _DrawerItemState extends State { ), Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( widget.title, color: widget.color ?? Colors.black, // fontWeight: FontWeight.bold, - margin: 5, + // margin: 5, + marginLeft: 5, + marginRight: 5, fontSize: SizeConfig.textMultiplier * 2.3, ), AppText(