From bb1f101e947f36a4b59040cbc1fa02b693975341 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Tue, 15 Dec 2020 10:39:27 +0200 Subject: [PATCH 01/25] finish re-design refer-patient screen --- lib/config/localized_values.dart | 4 + lib/core/viewModel/patient_view_model.dart | 7 +- .../profile/refer_patient_screen.dart | 683 ++++++++---------- lib/util/translations_delegate_base.dart | 8 +- .../profile/patient_profile_widget.dart | 136 ++-- lib/widgets/shared/app_text_form_field.dart | 2 +- .../shared/dialogs/dailog-list-select.dart | 89 +++ 7 files changed, 470 insertions(+), 459 deletions(-) create mode 100644 lib/widgets/shared/dialogs/dailog-list-select.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0dee26b9..2b84f389 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -201,6 +201,7 @@ const Map> localizedValues = { 'routine': {'en': 'Routine', 'ar': 'روتيني'}, 'send': {'en': 'Send', 'ar': 'ارسال'}, 'referralFrequency': {'en': 'Referral Frequency:', 'ar': 'تواتر الحالة:'}, + 'selectReferralFrequency': {'en': 'Select Referral Frequency:', 'ar': 'اختار تواتر الحالة:'}, 'clinicalDetailsAndRemarks': { 'en': 'Clinical Details and Remarks', 'ar': 'التفاصيل السرسرية والملاحظات' @@ -229,6 +230,7 @@ const Map> localizedValues = { 'beingBad': {'en': 'being bad', 'ar': 'سيء'}, 'beingGreat': {'en': 'being great', 'ar': 'رائع'}, 'cancel': {'en': 'CANCEL', 'ar': 'الغاء'}, + 'ok': {'en': 'OK', 'ar': 'موافق'}, 'done': {'en': 'DONE', 'ar': 'تأكيد'}, 'resumecall': {'en': 'Resume call', 'ar': 'استئناف المكالمة'}, 'endcallwithcharge': {'en': 'End with charge', 'ar': 'ينتهي مع الشحن'}, @@ -273,4 +275,6 @@ const Map> localizedValues = { 'area': {'en': 'AREA:', 'ar': 'المنطقة'}, 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, + 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, + 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, }; diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index f39a3d48..6fdbde32 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -42,10 +42,10 @@ class PatientViewModel extends BaseViewModel { get patientProgressNoteList => _patientService.patientProgressNoteList; - get clinicsList => _patientService.clinicsList; - get doctorsList => _patientService.doctorsList; + List get clinicsList => _patientService.clinicsList; + List get doctorsList => _patientService.doctorsList; + List get referralFrequencyList => _patientService.referalFrequancyList; - get referalFrequancyList => _patientService.referalFrequancyList; Future getPatientList(PatientModel patient, patientType, {bool isBusyLocal = false}) async { if(isBusyLocal) { @@ -167,6 +167,7 @@ class PatientViewModel extends BaseViewModel { } } } + Future getDoctorsList(String clinicId) async { setState(ViewState.BusyLocal); await _patientService.getDoctorsList(clinicId); diff --git a/lib/screens/patients/profile/refer_patient_screen.dart b/lib/screens/patients/profile/refer_patient_screen.dart index ffef05e6..79d2789d 100644 --- a/lib/screens/patients/profile/refer_patient_screen.dart +++ b/lib/screens/patients/profile/refer_patient_screen.dart @@ -6,9 +6,11 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:intl/intl.dart'; @@ -34,26 +36,18 @@ class ReferPatientScreen extends StatefulWidget { } class _ReferPatientState extends State { - var doctorsList; - final _remarksController = TextEditingController(); + dynamic _selectedClinic; + dynamic _selectedDoctor; final _extController = TextEditingController(); - var _isInit = true; - bool isValid; - - var clinicId; - var doctorId; - var freqId; - - String _selectedClinic; - String _selectedDoctor; - String _selectedReferralFrequancy; - int _activePriority = 1; - - FocusNode myFocusNode = FocusNode(); + dynamic _selectedFrequency; + final _remarksController = TextEditingController(); + bool isValid; @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( onModelReady: (model) => model.getClinicsList(), builder: (_, model, w) => AppScaffold( @@ -62,399 +56,255 @@ class _ReferPatientState extends State { body: model.clinicsList == null ? DrAppEmbeddedError(error: 'Something Wrong!') : SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).clinic, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 30, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedClinic, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getClinicNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedDoctor = null; - _selectedClinic = newValue; - var clinicInfo = model - .clinicsList - .where((i) => - i['ClinicDescription'] - .toString() - .contains( - _selectedClinic)) - .toList(); - - clinicId = clinicInfo[0]['ClinicID'] - .toString(); - - model.getDoctorsList(clinicId); - }) - }, - items: model - .getClinicNameList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), - ), - ), - ], - ), - ), - ), - //--------------------------------------------------------------------// - AppText( - TranslationBase.of(context).doctor, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 30, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedDoctor, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getDoctorNameList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedDoctor = newValue; - doctorsList = - model.doctorsList; - - var doctorInfo = doctorsList - .where((i) => i['DoctorName'] - .toString() - .contains(_selectedDoctor)) - .toList(); - doctorId = doctorInfo[0]['DoctorID'] - .toString(); - }) - }, - items: model - .getDoctorNameList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), - ), - ), - ], - ), - ), - ), //-----------------------------/// - AppText( - TranslationBase.of(context).ext, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: AppTextFormField( - hintText: TranslationBase.of(context).ext, - controller: _extController, - inputFormatter: ONLY_NUMBERS, - textInputType: TextInputType.number, - onChanged: (value) => {}, - ), - ), - AppText( - TranslationBase.of(context).priority, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - - priorityBar(context), - - AppText( - TranslationBase.of(context).referralFrequency + - getPriority(), - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, + child: Container( + margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.clinicsList != null && + model.clinicsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.clinicsList, + attributeName: 'ClinicDescription', + attributeValueId: 'ClinicID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = null; + _selectedClinic = selectedValue; + model.getDoctorsList( + _selectedClinic['ClinicID'] + .toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).clinicSelect, + _selectedClinic != null + ? _selectedClinic['ClinicDescription'] + : null, + true), + enabled: false, ), - - AppText( - TranslationBase.of(context).referralFrequency, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).doctorSelect, + _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + true), + enabled: false, ), - RoundedContainer( - margin: 10, - showBorder: true, - raduis: 30, - borderColor: Color(0xff707070), - width: double.infinity, - child: Padding( - padding: EdgeInsets.only( - top: SizeConfig.widthMultiplier * 0.9, - bottom: SizeConfig.widthMultiplier * 0.9, - right: SizeConfig.widthMultiplier * 3, - left: SizeConfig.widthMultiplier * 3), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Expanded( - // add Expanded to have your dropdown button fill remaining space - child: DropdownButton( - isExpanded: true, - value: _selectedReferralFrequancy, - iconSize: 40, - elevation: 16, - selectedItemBuilder: - (BuildContext context) { - return model - .getReferralNamesList() - .map((item) { - return Row( - mainAxisSize: MainAxisSize.max, - children: [ - AppText( - item, - fontSize: - SizeConfig.textMultiplier * - 2.1, - ), - ], - ); - }).toList(); - }, - onChanged: (newValue) => { - setState(() { - _selectedReferralFrequancy = newValue; - var freqInfo = model - .referalFrequancyList - .singleWhere((i) => i[ - 'Description'] - .toString() - .contains( - _selectedReferralFrequancy)); - freqId = freqInfo['ParameterCode'] - .toString(); - myFocusNode.requestFocus(); - }) - }, - items: model - .getReferralNamesList() - .map((item) { - return DropdownMenuItem( - value: item.toString(), - child: Text( - item, - textAlign: TextAlign.end, - ), - ); - }).toList(), - ), - ), - ], - ), - ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).ext, null, false), + enabled: true, + controller: _extController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + keyboardType: TextInputType.number, + )), + SizedBox( + height: 10, + ), + priorityBar(context, screenSize), + SizedBox( + height: 20, + ), + AppText( + "${TranslationBase.of(context).referralFrequency} ${getPriority()}", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 20, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.referralFrequencyList != null && + model.referralFrequencyList.length > 0 + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: model.referralFrequencyList, + attributeName: 'Description', + attributeValueId: 'ParameterCode', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedFrequency = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .selectReferralFrequency, + _selectedFrequency != null + ? _selectedFrequency['Description'] + : null, + true), + enabled: false, ), - AppText( + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: textFieldSelectorDecoration( TranslationBase.of(context).clinicDetailsandRemarks, - fontSize: 18, - fontWeight: FontWeight.bold, - marginLeft: 15, - marginTop: 15, - ), - Padding( - padding: const EdgeInsets.all(10.0), - child: AppTextFormField( - hintText: TranslationBase.of(context).remarks, - focusNode: myFocusNode, - controller: _remarksController, - inputFormatter: ONLY_LETTERS, - textInputType: TextInputType.text, - onChanged: (value) => {}, + null, + false), + enabled: true, + controller: _remarksController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_LETTERS)) + ], + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + SizedBox( + height: 10, + ), + Container( + child: Column( + children: [ + AppText( + TranslationBase.of(context).pleaseFill, + color: HexColor("#B8382B"), + fontWeight: FontWeight.bold, + margin: 10, + visibility: isValid == null ? false : !isValid, ), - ), - Padding( - padding: const EdgeInsets.all(20.0), - child: Column( - children: [ - AppText( - TranslationBase.of(context).pleaseFill, - color: Colors.red, - fontWeight: FontWeight.bold, - margin: 10, - visibility: - isValid == null ? false : !isValid, - ), - // TODO replace AppButton with secondary button and add loading - AppButton( - title: TranslationBase - .of(context) - .send, - color: Color(PRIMARY_COLOR), - onPressed: () => - { - referToDoctor(context, model) - }, - ) - ], - )) - ], + // TODO replace AppButton with secondary button and add loading + AppButton( + title: TranslationBase.of(context).send, + color: HexColor("#B8382B"), + onPressed: () => {referToDoctor(context, model)}, + ) + ], + ), + ), + ], + ), + ), ), - ), - ),); + ), + ); } - Widget priorityBar(BuildContext _context) { + Widget priorityBar(BuildContext _context, Size screenSize) { List _priorities = [ TranslationBase.of(context).veryUrgent, TranslationBase.of(context).urgent, TranslationBase.of(context).routine, ]; return Container( - height: MediaQuery.of(context).size.height * 0.065, - width: SizeConfig.screenWidth * 0.9, - margin: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - color: Color(0Xffffffff), borderRadius: BorderRadius.circular(20)), + height: screenSize.height * 0.070, + decoration: + containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: _priorities.map((item) { bool _isActive = _priorities[_activePriority] == item ? true : false; - return Column(mainAxisSize: MainAxisSize.min, children: [ - InkWell( - child: Center( - child: Container( - height: 40, - width: 90, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(50), - color: _isActive ? HexColor("#B8382B") : Colors.white, - ), - child: Center( - child: Text( - item, - style: TextStyle( - fontSize: 12, - color: _isActive - ? Colors.white - : Colors.black, //Colors.black, - // backgroundColor:_isActive - // ? Hexcolor("#B8382B") - // : Colors.white,//sideColor, - - fontWeight: FontWeight.bold, - ), + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, ), - )), - ), - onTap: () { - print(_priorities.indexOf(item)); - setState(() { - _activePriority = _priorities.indexOf(item); - }); - }), - _isActive - ? Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white), - alignment: Alignment.center, - height: 3, - width: 90, - ) - : Container() - ]); + ), + )), + ), + onTap: () { + print(_priorities.indexOf(item)); + setState(() { + _activePriority = _priorities.indexOf(item); + }); + }, + ), + ); }).toList(), ), ); @@ -484,10 +334,7 @@ class _ReferPatientState extends State { return; } - final routeArgs = ModalRoute - .of(context) - .settings - .arguments as Map; + final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; try { @@ -495,17 +342,16 @@ class _ReferPatientState extends State { extension: _extController.value.text, admissionNo: int.parse(patient.admissionNo), referringDoctorRemarks: _remarksController.value.text, - frequency: freqId, + frequency: _selectedFrequency['ParameterCode'].toString(), patientID: patient.patientId, patientTypeID: patient.patientType, priority: (_activePriority + 1).toString(), roomID: patient.roomId, - selectedClinicID: clinicId.toString(), - selectedDoctorID: doctorId.toString(), + selectedClinicID: _selectedClinic['ClinicID'].toString(), + selectedDoctorID: _selectedDoctor['DoctorID'].toString(), projectID: patient.projectId); // TODO: Add Translation - DrAppToastMsg.showSuccesToast( - 'Reply Successfully'); + DrAppToastMsg.showSuccesToast('Reply Successfully'); Navigator.pop(context); } catch (e) { DrAppToastMsg.showErrorToast(e); @@ -516,10 +362,47 @@ class _ReferPatientState extends State { setState(() { isValid = !_extController.value.text.isNullOrEmpty() && !_remarksController.value.text.isNullOrEmpty() && - freqId != null && - clinicId != null && - doctorId != null; + _selectedClinic != null && + _selectedDoctor != null && + _selectedFrequency != null; }); return isValid; } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 2.0, + )), + ); + } } diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 3bea8990..b520fd6f 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -106,6 +106,8 @@ class TranslationBase { String get profile => localizedValues['profile'][locale.languageCode]; String get gender => localizedValues['gender'][locale.languageCode]; String get clinic => localizedValues['clinic'][locale.languageCode]; + String get clinicSelect => localizedValues['clinicSelect'][locale.languageCode]; + String get doctorSelect => localizedValues['doctorSelect'][locale.languageCode]; String get hospital => localizedValues['hospital'][locale.languageCode]; String get speciality => localizedValues['speciality'][locale.languageCode]; String get errorMessage => @@ -220,8 +222,8 @@ class TranslationBase { String get urgent => localizedValues['urgent'][locale.languageCode]; String get routine => localizedValues['routine'][locale.languageCode]; String get send => localizedValues['send'][locale.languageCode]; - String get referralFrequency => - localizedValues['referralFrequency'][locale.languageCode]; + String get referralFrequency => localizedValues['referralFrequency'][locale.languageCode]; + String get selectReferralFrequency => localizedValues['selectReferralFrequency'][locale.languageCode]; String get clinicalDetailsAndRemarks => localizedValues['clinicalDetailsAndRemarks'][locale.languageCode]; String get remarks => localizedValues['remarks'][locale.languageCode]; @@ -252,6 +254,8 @@ class TranslationBase { String get cancel => localizedValues['cancel'][locale.languageCode]; + String get ok => localizedValues['ok'][locale.languageCode]; + String get done => localizedValues['done'][locale.languageCode]; String get searchMedicineImageCaption => diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 5fefcc1f..ac6c7f0f 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -33,17 +33,13 @@ class PatientProfileWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - color: Colors.grey.shade300, - blurRadius: 10.0, - spreadRadius: 0, - offset: Offset(0, 10) - ), - ], - color: Colors.white - ), + decoration: BoxDecoration(boxShadow: [ + BoxShadow( + color: Colors.grey.shade300, + blurRadius: 10.0, + spreadRadius: 0, + offset: Offset(0, 10)), + ], color: Colors.white), child: Column(children: [ Padding( padding: const EdgeInsets.all(8.0), @@ -102,7 +98,8 @@ class PatientProfileWidget extends StatelessWidget { children: [ Expanded( child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -129,7 +126,8 @@ class PatientProfileWidget extends StatelessWidget { ), Expanded( child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -156,7 +154,8 @@ class PatientProfileWidget extends StatelessWidget { ), Expanded( child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -221,25 +220,25 @@ class PatientProfileWidget extends StatelessWidget { Row( children: [ Container( - width: 14 * SizeConfig.textMultiplier, + width: + 14 * SizeConfig.textMultiplier, child: AppText( - TranslationBase.of(context).dateTime, + TranslationBase.of(context) + .dateTime, color: Colors.black, fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * + SizeConfig.textMultiplier, ), ), AppText( patient.admissionDate != null - ? "${DateUtils - .convertDateFromServerFormat( - patient.admissionDate, - 'EEEE dd, MMMM yyyy hh:mm a')}" + ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" : "", color: Colors.black, fontWeight: FontWeight.normal, fontSize: - 1.6 * SizeConfig.textMultiplier, + 1.6 * SizeConfig.textMultiplier, ), ], ), @@ -249,12 +248,15 @@ class PatientProfileWidget extends StatelessWidget { Row( children: [ Container( - width: 14 * SizeConfig.textMultiplier, + width: + 14 * SizeConfig.textMultiplier, child: AppText( - TranslationBase.of(context).admissionNo, + TranslationBase.of(context) + .admissionNo, color: Colors.black, fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * + SizeConfig.textMultiplier, ), ), AppText( @@ -263,8 +265,8 @@ class PatientProfileWidget extends StatelessWidget { : '', color: Colors.black, fontWeight: FontWeight.normal, - fontSize: 1.6 * - SizeConfig.textMultiplier, + fontSize: + 1.6 * SizeConfig.textMultiplier, ), ], ), @@ -274,24 +276,26 @@ class PatientProfileWidget extends StatelessWidget { Row( children: [ Container( - width: 14 * SizeConfig.textMultiplier, + width: + 14 * SizeConfig.textMultiplier, child: AppText( TranslationBase.of(context).losNo, color: Colors.black, fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * + SizeConfig.textMultiplier, ), ), AppText( patient.admissionDate != null ? DateUtils - .differenceBetweenServerDateAndCurrent( - patient.admissionDate) + .differenceBetweenServerDateAndCurrent( + patient.admissionDate) : "", color: Colors.black, fontWeight: FontWeight.normal, - fontSize: 1.6 * - SizeConfig.textMultiplier, + fontSize: + 1.6 * SizeConfig.textMultiplier, ), ], ), @@ -311,14 +315,18 @@ class PatientProfileWidget extends StatelessWidget { children: [ Expanded( child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).area, + TranslationBase.of(context) + .area, fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * + SizeConfig.textMultiplier, ), SizedBox( height: 4, @@ -326,7 +334,8 @@ class PatientProfileWidget extends StatelessWidget { AppText( patient.clinicDescription, fontWeight: FontWeight.normal, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontSize: 1.6 * + SizeConfig.textMultiplier, ), ], ), @@ -338,27 +347,39 @@ class PatientProfileWidget extends StatelessWidget { ), Expanded( child: Padding( - padding: const EdgeInsets.fromLTRB(16.0, 8.0, 8.0, 8.0), + padding: const EdgeInsets.fromLTRB( + 16.0, 8.0, 8.0, 8.0), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, children: [ Expanded( child: Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).room, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, + TranslationBase.of( + context) + .room, + fontWeight: + FontWeight.bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, ), SizedBox( width: 4, ), AppText( "${patient.nursingStationName}\n${patient.roomId}", - fontWeight: FontWeight.normal, - fontSize: 1.4 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.normal, + fontSize: 1.4 * + SizeConfig + .textMultiplier, ), ], ), @@ -368,20 +389,29 @@ class PatientProfileWidget extends StatelessWidget { ), Expanded( child: Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).bed, - fontWeight: FontWeight.bold, - fontSize: 1.6 * SizeConfig.textMultiplier, + TranslationBase.of( + context) + .bed, + fontWeight: + FontWeight.bold, + fontSize: 1.6 * + SizeConfig + .textMultiplier, ), SizedBox( width: 4, ), AppText( "${patient.bedId}", - fontWeight: FontWeight.normal, - fontSize: 1.6 * SizeConfig.textMultiplier, + fontWeight: + FontWeight.normal, + fontSize: 1.6 * + SizeConfig + .textMultiplier, ), ], ), diff --git a/lib/widgets/shared/app_text_form_field.dart b/lib/widgets/shared/app_text_form_field.dart index a0e91748..b9dd3fc2 100644 --- a/lib/widgets/shared/app_text_form_field.dart +++ b/lib/widgets/shared/app_text_form_field.dart @@ -37,7 +37,7 @@ class AppTextFormField extends FormField { child: TextFormField( focusNode: focusNode, keyboardType: textInputType, - inputFormatters: [WhitelistingTextInputFormatter(RegExp(inputFormatter)), + inputFormatters: [FilteringTextInputFormatter.allow(RegExp(inputFormatter)), ],onChanged: onChanged?? (value){ state.didChange(value); }, diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart new file mode 100644 index 00000000..9e17d53b --- /dev/null +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -0,0 +1,89 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class ListSelectDialog extends StatefulWidget { + final List list; + final String attributeName; + final String attributeValueId; + final okText; + final Function(dynamic) okFunction; + dynamic selectedValue; + + ListSelectDialog( + {@required this.list, + @required this.attributeName, + @required this.attributeValueId, + @required this.okText, + @required this.okFunction}); + + @override + _ListSelectDialogState createState() => _ListSelectDialogState(); +} + +class _ListSelectDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedValue = widget.selectedValue ?? widget.list[0]; + } + + @override + Widget build(BuildContext context) { + return showAlertDialog(context); + } + + showAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = FlatButton( + child: Text(TranslationBase.of(context).cancel), + onPressed: () { + Navigator.of(context).pop(); + }); + Widget continueButton = FlatButton( + child: Text(this.widget.okText), + onPressed: () { + this.widget.okFunction(widget.selectedValue); + Navigator.of(context).pop(); + }); +// set up the AlertDialog + AlertDialog alert = AlertDialog( + // title: Text(widget.title), + content: createDialogList(), + actions: [ + cancelButton, + continueButton, + ], + ); + return alert; + } + + Widget createDialogList() { + return Container( + height: MediaQuery.of(context).size.height * 0.5, + child: SingleChildScrollView( + child: Column( + children: [ + ...widget.list + .map((item) => RadioListTile( + title: Text("${item[widget.attributeName].toString()}"), + groupValue: widget.selectedValue[widget.attributeValueId].toString(), + value: item[widget.attributeValueId].toString(), + activeColor: Colors.blue.shade700, + selected: item[widget.attributeValueId].toString() == widget.selectedValue[widget.attributeValueId].toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) + .toList() + ], + ), + ), + ); + } + + static closeAlertDialog(BuildContext context) { + Navigator.of(context).pop(); + } +} From 4eee5cd9d88e05ac34454dc0e454b3b77584b99e Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 15 Dec 2020 16:57:59 +0200 Subject: [PATCH 02/25] new login type --- lib/config/config.dart | 3 + lib/core/viewModel/auth_view_model.dart | 17 ++++ lib/core/viewModel/project_view_model.dart | 2 +- .../auth/activation_Code_req_model.dart | 48 ++++++++++ .../auth/verification_methods_screen.dart | 5 + lib/widgets/auth/login_form.dart | 8 +- lib/widgets/auth/verification_methods.dart | 96 ++++++++++++++----- 7 files changed, 149 insertions(+), 30 deletions(-) create mode 100644 lib/models/auth/activation_Code_req_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 8af0a4a5..43e516d3 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -71,6 +71,9 @@ const SELECT_DEVICE_IMEI = const SEND_ACTIVATION_CODE_BY_OTP_NOTIFICATION_TYPE = 'Services/Sentry.svc/REST/DoctorApplication_SendActivationCodebyOTPNotificationType'; +const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP = + 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp'; + const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index 9b656d31..fc76fbc3 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -119,6 +120,22 @@ class AuthViewModel with ChangeNotifier { } } + Future sendActivationCodeForDoctorApp(ActivationCodeModel activationCodeModel) async { + try { + var localRes; + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: activationCodeModel.toJson()); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } + Future memberCheckActivationCodeNew(activationCodeModel) async { try { dynamic localRes; diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index a12846c7..9286c64b 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -69,7 +69,7 @@ class ProjectProvider with ChangeNotifier { sharedPref.setString(APP_Language, 'ar'); } else if (lan != "ar" && currentLanguage != lan) { _appLocale = Locale("en"); - _isArabic = false; + _isArabic = false; currentLanguage = 'en'; sharedPref.setString(APP_Language, 'en'); } diff --git a/lib/models/auth/activation_Code_req_model.dart b/lib/models/auth/activation_Code_req_model.dart new file mode 100644 index 00000000..f8f48cd8 --- /dev/null +++ b/lib/models/auth/activation_Code_req_model.dart @@ -0,0 +1,48 @@ +class ActivationCodeModel { + String mobileNumber; + String zipCode; + int channel; + int languageID; + double versionID; + int memberID; + String password; + int facilityId; + String generalid; + + ActivationCodeModel( + {this.mobileNumber, + this.zipCode, + this.channel, + this.languageID, + this.versionID, + this.memberID, + this.password, + this.facilityId, + this.generalid}); + + ActivationCodeModel.fromJson(Map json) { + mobileNumber = json['MobileNumber']; + zipCode = json['ZipCode']; + channel = json['Channel']; + languageID = json['LanguageID']; + versionID = json['VersionID']; + memberID = json['MemberID']; + password = json['Password']; + facilityId = json['facilityId']; + generalid = json['generalid']; + } + + Map toJson() { + final Map data = new Map(); + data['MobileNumber'] = this.mobileNumber; + data['ZipCode'] = this.zipCode; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['VersionID'] = this.versionID; + data['MemberID'] = this.memberID; + data['Password'] = this.password; + data['facilityId'] = this.facilityId; + data['generalid'] = this.generalid; + return data; + } +} diff --git a/lib/screens/auth/verification_methods_screen.dart b/lib/screens/auth/verification_methods_screen.dart index d5ab66ad..2b411dc0 100644 --- a/lib/screens/auth/verification_methods_screen.dart +++ b/lib/screens/auth/verification_methods_screen.dart @@ -13,9 +13,13 @@ import '../../widgets/auth/verification_methods.dart'; *@desc: Verification Methods screen */ class VerificationMethodsScreen extends StatefulWidget { + const VerificationMethodsScreen({Key key, this.password}) : super(key: key); + @override _VerificationMethodsScreenState createState() => _VerificationMethodsScreenState(); + + final password; } class _VerificationMethodsScreenState extends State { @@ -47,6 +51,7 @@ class _VerificationMethodsScreenState extends State { children: [ AuthHeader(loginType.verificationMethods), VerificationMethods( + password: widget.password, changeLoadingStata: changeLoadingStata, ), ], diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 8cf5f3d4..d7eaeeb6 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -240,8 +241,8 @@ class _LoginFormState extends State { saveObjToString(LOGGED_IN_USER, res); sharedPref.setString(TOKEN, res['LogInTokenID']); print("token" + res['LogInTokenID']); - - Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (BuildContext context) => VerificationMethodsScreen(password: userInfo.password,))); + // Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); } else { // handel error // widget.showCenterShortLoadingToast("watting"); @@ -279,7 +280,8 @@ class _LoginFormState extends State { if (res['MessageStatus'] == 1) { setSharedPref('platformImei', _platformImei); saveObjToString(LOGGED_IN_USER, preRes); - Navigator.of(context).pushNamed(VERIFICATION_METHODS); + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (BuildContext context) => VerificationMethodsScreen(password: userInfo.password,))); + // save imei on shared preferance } else { // handel error diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 2102a125..cb6cb62e 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -1,6 +1,9 @@ import 'dart:io' show Platform; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -11,7 +14,6 @@ import '../../routes.dart'; import '../../util/dr_app_shared_pref.dart'; import '../../util/helpers.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -24,8 +26,11 @@ Helpers helpers = Helpers(); *@desc: Verification Methods widget */ class VerificationMethods extends StatefulWidget { - VerificationMethods({this.changeLoadingStata}); + VerificationMethods({this.changeLoadingStata, this.password}); + + final password; final Function changeLoadingStata; + @override _VerificationMethodsState createState() => _VerificationMethodsState(); } @@ -267,40 +272,79 @@ class _VerificationMethodsState extends State { if (oTPSendType == 1 || oTPSendType == 2) { widget.changeLoadingStata(true); + ActivationCodeModel activationCodeModel = ActivationCodeModel( + facilityId: 15, + generalid: "Cs2020@2016\$2958", + memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], + zipCode: _loggedUser['ZipCode'], + mobileNumber: _loggedUser['MobileNumber'], + password: widget.password); + Map model = { - "LogInTokenID": _loggedUser['LogInTokenID'], - "Channel": 9, - "MobileNumber": _loggedUser['MobileNumber'], - "IPAdress": "11.11.11.11", - "LanguageID": 2, - "ProjectID": 15, //TODO : this should become daynamci - "ZipCode": _loggedUser['ZipCode'], - "UserName": _loggedUser['List_MemberInformation'][0]['MemberID'], + "OTP_SendType": oTPSendType }; - authProv.sendActivationCodeByOtpNotificationType(model).then((res) { - widget.changeLoadingStata(false); - if (res['MessageStatus'] == 1) { - Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, - arguments: {'model': model}); - } else { - print(res['ErrorEndUserMessage']); - helpers.showErrorToast(res['ErrorEndUserMessage']); - } - }).catchError((err) { - print('$err'); - widget.changeLoadingStata(false); + try { + authProv + .sendActivationCodeForDoctorApp(activationCodeModel) + .then((res) { + widget.changeLoadingStata(false); + + if (res['MessageStatus'] == 1) { + Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, + arguments: {'model': model}); + } else { + print(res['ErrorEndUserMessage']); + helpers.showErrorToast(res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print('$err'); + widget.changeLoadingStata(false); - helpers.showErrorToast(); - }); + helpers.showErrorToast(); + }); + } catch (e) {} + + // Map model = { + // "LogInTokenID": _loggedUser['LogInTokenID'], + // "Channel": 9, + // "MobileNumber": _loggedUser['MobileNumber'], + // "IPAdress": "11.11.11.11", + // "LanguageID": 2, + // "ProjectID": 15, //TODO : this should become daynamci + // "ZipCode": _loggedUser['ZipCode'], + // "UserName": _loggedUser['List_MemberInformation'][0]['MemberID'], + // "OTP_SendType": oTPSendType + // }; + // authProv.sendActivationCodeByOtpNotificationType(model).then((res) { + // widget.changeLoadingStata(false); + // + // if (res['MessageStatus'] == 1) { + // Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, + // arguments: {'model': model}); + // } else { + // print(res['ErrorEndUserMessage']); + // helpers.showErrorToast(res['ErrorEndUserMessage']); + // } + // }).catchError((err) { + // print('$err'); + // widget.changeLoadingStata(false); + // + // helpers.showErrorToast(); + // }); } else { // TODO route to this page with parameters to inicate we should present 2 option if (Platform.isAndroid && oTPSendType == 3) { helpers.showErrorToast('Your device not support this feature'); } else { - Navigator.of(context).pushNamed(VERIFICATION_METHODS, - arguments: {'verificationMethod': oTPSendType}); + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => + VerificationMethodsScreen(password: widget.password,))); + + // Navigator.of(context).pushNamed(VERIFICATION_METHODS, + // arguments: {'verificationMethod': oTPSendType}); } } } From 46cdd9482c17e732014d00f2db6e9cc901149e39 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 16 Dec 2020 20:08:51 +0200 Subject: [PATCH 03/25] First step from SOAP --- lib/client/base_app_client.dart | 2 +- lib/config/config.dart | 5 + lib/config/localized_values.dart | 4 +- lib/core/service/SOAP_service.dart | 25 + lib/core/viewModel/SOAP_view_model.dart | 23 + lib/core/viewModel/project_view_model.dart | 4 +- lib/main.dart | 6 +- lib/models/SOAP/Allergy_model.dart | 60 +++ .../SOAP/get_Allergies_request_model.dart | 32 ++ lib/routes.dart | 4 + lib/screens/dashboard_screen.dart | 4 +- .../medicine/pharmacies_list_screen.dart | 2 +- .../patients/patient_search_screen.dart | 2 +- lib/screens/patients/patients_screen.dart | 2 +- lib/screens/settings/settings_screen.dart | 2 +- lib/util/translations_delegate_base.dart | 2 + .../dashboard_item_texts_widget.dart | 2 +- .../patients/profile/SOAP/add_SOAP_index.dart | 171 +++++++ .../profile/SOAP/assessment_page.dart | 36 ++ .../patients/profile/SOAP/objective_page.dart | 36 ++ .../patients/profile/SOAP/plan_page.dart | 36 ++ .../patients/profile/SOAP/steps_widget.dart | 447 ++++++++++++++++++ .../profile/SOAP/subjective_page.dart | 36 ++ .../profile/profile_medical_info_widget.dart | 8 +- lib/widgets/shared/app_scaffold_widget.dart | 2 +- lib/widgets/shared/card_with_bg_widget.dart | 2 +- 26 files changed, 938 insertions(+), 17 deletions(-) create mode 100644 lib/core/service/SOAP_service.dart create mode 100644 lib/core/viewModel/SOAP_view_model.dart create mode 100644 lib/models/SOAP/Allergy_model.dart create mode 100644 lib/models/SOAP/get_Allergies_request_model.dart create mode 100644 lib/widgets/patients/profile/SOAP/add_SOAP_index.dart create mode 100644 lib/widgets/patients/profile/SOAP/assessment_page.dart create mode 100644 lib/widgets/patients/profile/SOAP/objective_page.dart create mode 100644 lib/widgets/patients/profile/SOAP/plan_page.dart create mode 100644 lib/widgets/patients/profile/SOAP/steps_widget.dart create mode 100644 lib/widgets/patients/profile/SOAP/subjective_page.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 454f4d04..b2b76709 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -50,7 +50,7 @@ class BaseAppClient { body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; - + body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZWE0M2QxOTEtMWY1OS00ZWY1LThmYTYtM2ExYzBkNjQyNjc5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTk0NyIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMDYwOTgsImV4cCI6MTYwODk3MDA5OCwiaWF0IjoxNjA4MTA2MDk4fQ.EJ_QwlrHPQncnU_CP0HpnERPidpIl5nFQzqB2VNFbNs"; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; diff --git a/lib/config/config.dart b/lib/config/config.dart index 8af0a4a5..a7165953 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -78,6 +78,11 @@ const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; + +// SOAP + +const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 0dee26b9..4cbf8455 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1,4 +1,4 @@ -const Map> localizedValues = { +const Map> localizedValues = { 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, @@ -273,4 +273,6 @@ const Map> localizedValues = { 'area': {'en': 'AREA:', 'ar': 'المنطقة'}, 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, + 'next': {'en': 'Next', 'ar': 'التالي'}, + 'healthRecordInformation': {'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي'}, }; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart new file mode 100644 index 00000000..3ab75c27 --- /dev/null +++ b/lib/core/service/SOAP_service.dart @@ -0,0 +1,25 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; + +class SOAPService extends BaseService { + + List get listOfAllergies => _listOfAllergies; + List _listOfAllergies = []; + + + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { + await baseAppClient.post(GET_ALLERGIES, + onSuccess: (dynamic response, int statusCode) { + _listOfAllergies.clear(); + response['List_Allergies']['entityList'].forEach((v) { + _listOfAllergies + .add(AllergyModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: getAllergiesRequestModel.toJson(),); + } +} diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart new file mode 100644 index 00000000..a68f3991 --- /dev/null +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -0,0 +1,23 @@ +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; +import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; + +import '../../locator.dart'; +import 'base_view_model.dart'; + +class SOAPViewModel extends BaseViewModel { + SOAPService _SOAPService = locator(); + + List get listOfAllergies => _SOAPService.listOfAllergies; + + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { + setState(ViewState.Busy); + await _SOAPService.getAllergies(getAllergiesRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index a12846c7..c751ab33 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -15,7 +15,7 @@ import 'package:provider/provider.dart'; Helpers helpers = Helpers(); -class ProjectProvider with ChangeNotifier { +class ProjectViewModel with ChangeNotifier { DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); Locale _appLocale; String currentLanguage = 'ar'; @@ -31,7 +31,7 @@ class ProjectProvider with ChangeNotifier { bool get isArabic => _isArabic; StreamSubscription subscription; - ProjectProvider() { + ProjectViewModel() { loadSharedPrefLanguage(); subscription = Connectivity() diff --git a/lib/main.dart b/lib/main.dart index 06d0ecfa..d7459f12 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -33,14 +33,14 @@ class MyApp extends StatelessWidget { create: (context) => AuthViewModel()), ChangeNotifierProvider( create: (context) => HospitalViewModel()), - ChangeNotifierProvider( - create: (context) => ProjectProvider(), + ChangeNotifierProvider( + create: (context) => ProjectViewModel(), ), ChangeNotifierProvider( create: (context) => LiveCareViewModel(), ), ], - child: Consumer( + child: Consumer( builder: (context,projectProvider,child) => MaterialApp( showSemanticsDebugger: false, title: 'Flutter Demo', diff --git a/lib/models/SOAP/Allergy_model.dart b/lib/models/SOAP/Allergy_model.dart new file mode 100644 index 00000000..c3493832 --- /dev/null +++ b/lib/models/SOAP/Allergy_model.dart @@ -0,0 +1,60 @@ +class AllergyModel { + int allergyDiseaseId; + String allergyDiseaseName; + int allergyDiseaseType; + int appointmentNo; + int createdBy; + String createdByName; + String createdOn; + int episodeID; + bool isChecked; + bool isUpdatedByNurse; + int severity; + String severityName; + + AllergyModel( + {this.allergyDiseaseId, + this.allergyDiseaseName, + this.allergyDiseaseType, + this.appointmentNo, + this.createdBy, + this.createdByName, + this.createdOn, + this.episodeID, + this.isChecked, + this.isUpdatedByNurse, + this.severity, + this.severityName}); + + AllergyModel.fromJson(Map json) { + allergyDiseaseId = json['allergyDiseaseId']; + allergyDiseaseName = json['allergyDiseaseName']; + allergyDiseaseType = json['allergyDiseaseType']; + appointmentNo = json['appointmentNo']; + createdBy = json['createdBy']; + createdByName = json['createdByName']; + createdOn = json['createdOn']; + episodeID = json['episodeID']; + isChecked = json['isChecked']; + isUpdatedByNurse = json['isUpdatedByNurse']; + severity = json['severity']; + severityName = json['severityName']; + } + + Map toJson() { + final Map data = new Map(); + data['allergyDiseaseId'] = this.allergyDiseaseId; + data['allergyDiseaseName'] = this.allergyDiseaseName; + data['allergyDiseaseType'] = this.allergyDiseaseType; + data['appointmentNo'] = this.appointmentNo; + data['createdBy'] = this.createdBy; + data['createdByName'] = this.createdByName; + data['createdOn'] = this.createdOn; + data['episodeID'] = this.episodeID; + data['isChecked'] = this.isChecked; + data['isUpdatedByNurse'] = this.isUpdatedByNurse; + data['severity'] = this.severity; + data['severityName'] = this.severityName; + return data; + } +} diff --git a/lib/models/SOAP/get_Allergies_request_model.dart b/lib/models/SOAP/get_Allergies_request_model.dart new file mode 100644 index 00000000..7676d530 --- /dev/null +++ b/lib/models/SOAP/get_Allergies_request_model.dart @@ -0,0 +1,32 @@ +class GetAllergiesRequestModel { + String vidaAuthTokenID; + int patientMRN; + int appointmentNo; + int episodeId; + String doctorID; + + GetAllergiesRequestModel( + {this.vidaAuthTokenID, + this.patientMRN, + this.appointmentNo, + this.episodeId, + this.doctorID}); + + GetAllergiesRequestModel.fromJson(Map json) { + vidaAuthTokenID = json['VidaAuthTokenID']; + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + doctorID = json['DoctorID']; + } + + Map toJson() { + final Map data = new Map(); + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['DoctorID'] = this.doctorID; + return data; + } +} diff --git a/lib/routes.dart b/lib/routes.dart index dff02129..ce090676 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/refer_patient_screen import 'package:doctor_app_flutter/screens/patients/profile/prescriptions/in_patient_prescription_details_screen.dart'; import 'package:doctor_app_flutter/screens/live_care/video_call.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/add_SOAP_index.dart'; import './screens/QR_reader_screen.dart'; import './screens/auth/change_password_screen.dart'; @@ -69,6 +70,8 @@ const String PATIENT_ORDERS = 'patients/patient_orders'; const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details'; +const String CREATE_EPISODE = 'patients/create-episode'; + const String BODY_MEASUREMENTS = 'patients/body-measurements'; const String IN_PATIENT_PRESCRIPTIONS_DETAILS = 'patients/prescription-details'; // const String VIDEO_CALL = 'video-call'; @@ -105,6 +108,7 @@ var routes = { PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), + CREATE_EPISODE:(_)=>AddSOAPIndex(), BODY_MEASUREMENTS: (_) => VitalSignItemDetailsScreen(), IN_PATIENT_PRESCRIPTIONS_DETAILS: (_) => InpatientPrescriptionDetailsScreen(), // VIDEO_CALL: (_) => VideoCallPage(patientData: null), diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 80697352..22d58540 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -41,14 +41,14 @@ class _DashboardScreenState extends State { HospitalViewModel hospitalProvider; AuthViewModel authProvider; bool isLoading = false; - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; var _isInit = true; DoctorProfileModel profile; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { - projectsProvider = Provider.of(context); + projectsProvider = Provider.of(context); projectsProvider.getDoctorClinicsList(); } _isInit = false; diff --git a/lib/screens/medicine/pharmacies_list_screen.dart b/lib/screens/medicine/pharmacies_list_screen.dart index 6057bf23..2433487f 100644 --- a/lib/screens/medicine/pharmacies_list_screen.dart +++ b/lib/screens/medicine/pharmacies_list_screen.dart @@ -34,7 +34,7 @@ class PharmaciesListScreen extends StatefulWidget { class _PharmaciesListState extends State { var _data; Helpers helpers = new Helpers(); - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; bool _isInit = true; //bool _isOutOfStuck = false; diff --git a/lib/screens/patients/patient_search_screen.dart b/lib/screens/patients/patient_search_screen.dart index 204d2336..ab352ce0 100644 --- a/lib/screens/patients/patient_search_screen.dart +++ b/lib/screens/patients/patient_search_screen.dart @@ -39,7 +39,7 @@ class _PatientSearchScreenState extends State { String _selectedType = '1'; String _selectedLocation = '1'; String error = ''; - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; String itemText = ''; String itemText2 = ''; final GlobalKey _formKey = GlobalKey(); diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 4ca3e587..1c0c0638 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -60,7 +60,7 @@ class _PatientsScreenState extends State { bool _isError = false; String error = ""; - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; final _controller = TextEditingController(); diff --git a/lib/screens/settings/settings_screen.dart b/lib/screens/settings/settings_screen.dart index 79cd827e..7d41d662 100644 --- a/lib/screens/settings/settings_screen.dart +++ b/lib/screens/settings/settings_screen.dart @@ -8,7 +8,7 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class SettingsScreen extends StatelessWidget { - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 3bea8990..f8638c86 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -293,6 +293,8 @@ class TranslationBase { String get area => localizedValues['area'][locale.languageCode]; String get room => localizedValues['room'][locale.languageCode]; String get bed => localizedValues['bed'][locale.languageCode]; + String get next => localizedValues['next'][locale.languageCode]; + String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/dashboard/dashboard_item_texts_widget.dart b/lib/widgets/dashboard/dashboard_item_texts_widget.dart index c3e4986d..80b0aa17 100644 --- a/lib/widgets/dashboard/dashboard_item_texts_widget.dart +++ b/lib/widgets/dashboard/dashboard_item_texts_widget.dart @@ -26,7 +26,7 @@ class DashboardItemTexts extends StatefulWidget { } class _DashboardItemTextsState extends State { - ProjectProvider projectsProvider; + ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { projectsProvider = Provider.of(context); diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart new file mode 100644 index 00000000..a74e5c51 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -0,0 +1,171 @@ +import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective_page.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../patient_profile_widget.dart'; +import 'steps_widget.dart'; + +class AddSOAPIndex extends StatefulWidget { + @override + _AddSOAPIndexState createState() => _AddSOAPIndexState(); +} + +class _AddSOAPIndexState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + + changePageViewIndex(pageIndex) { + _controller.jumpToPage(pageIndex); + } + + @override + void initState() { + // TODO: implement initState + _controller = new PageController(); + + super.initState(); + } + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).healthRecordInformation, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: + BoxDecoration(boxShadow: [], color: Colors.white), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, + ), + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 5, + ), + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).age, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), + ], + ), + AppText( + "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), + ], + ) + ], + ), + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + width: 20, + ), + FractionallySizedBox( + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.75, + child: Column( + children: [ + Container( + margin: EdgeInsets.only( + left: + MediaQuery.of(context).size.width * 0.05, + right: + MediaQuery.of(context).size.width * 0.05), + child: StepsWidget( + index: _currentIndex, + changeCurrentTab: changePageViewIndex, + ), + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + SubjectivePage(changePageViewIndex: changePageViewIndex,), + ObjectivePage(changePageViewIndex: changePageViewIndex,), + AssessmentPage(changePageViewIndex: changePageViewIndex,), + PlanPage(changePageViewIndex: changePageViewIndex,) + ], + ), + ), + ], + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart new file mode 100644 index 00000000..7649ac46 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -0,0 +1,36 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class AssessmentPage extends StatelessWidget { + final Function changePageViewIndex; + + AssessmentPage({Key key, this.changePageViewIndex}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, +// baseViewModel: widget.model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppButton( + title: TranslationBase.of(context).next, + onPressed: () { + changePageViewIndex(3); + }, + ), + ], + ), + ), + ), + )); + } +} diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart new file mode 100644 index 00000000..8960a8dc --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -0,0 +1,36 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class ObjectivePage extends StatelessWidget { + final Function changePageViewIndex; + + ObjectivePage({Key key, this.changePageViewIndex}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, +// baseViewModel: widget.model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppButton( + title: TranslationBase.of(context).next, + onPressed: () { + changePageViewIndex(2); + }, + ), + ], + ), + ), + ), + )); + } +} diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart new file mode 100644 index 00000000..5054647c --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -0,0 +1,36 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class PlanPage extends StatelessWidget { + final Function changePageViewIndex; + + PlanPage({Key key, this.changePageViewIndex}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, +// baseViewModel: widget.model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppButton( + title: TranslationBase.of(context).next, + onPressed: () { + changePageViewIndex(4); + }, + ), + ], + ), + ), + ), + )); + } +} diff --git a/lib/widgets/patients/profile/SOAP/steps_widget.dart b/lib/widgets/patients/profile/SOAP/steps_widget.dart new file mode 100644 index 00000000..863da3a9 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/steps_widget.dart @@ -0,0 +1,447 @@ +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class StepsWidget extends StatelessWidget { + final int index; + final Function changeCurrentTab; + + StepsWidget({Key key, this.index, this.changeCurrentTab}); + + // TODO : Add translation to name + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return !projectViewModel.isArabic + ? Stack( + children: [ + Container( + height: 120, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: index == 0 ? 15 : 30, + left: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 0 ? 70 : 50, + height: index == 0 ? 70 : 50, + decoration: BoxDecoration( + border: index == 0 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 0 + ? null + : Border.all( + color: Colors.black, width: 0.75), + shape: BoxShape.circle, + color: index == 0 + ? Colors.white + : index > 0 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '1', + variant: index == 0 ? "heading2" : "", + bold: true, + color: index == 0 + ? Colors.black + : index > 0 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 0 ? 5 : 10, + ), + Texts('SUBJECTIVE', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + Positioned( + top: index == 1 ? 15 : 30, + left: MediaQuery.of(context).size.width * 0.28, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 1 ? 70 : 50, + height: index == 1 ? 70 : 50, + decoration: BoxDecoration( + border: index == 1 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 1 + ? Colors.white + : index > 1 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '2', + variant: index == 1 ? "heading2" : '', + bold: true, + color: index == 1 + ? Colors.black + : index > 1 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 1 ? 5 : 10, + ), + Texts('OBJECTIVE', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + Positioned( + top: index == 2 ? 15 : 30, + left: MediaQuery.of(context).size.width * 0.52, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(3) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 2 ? 70 : 50, + height: index == 2 ? 70 : 50, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Colors.white + : index > 2 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '3', + variant: index == 2 ? "heading2" : '', + bold: true, + color: index == 2 + ? Colors.black + : index > 2 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 2 ? 5 : 10, + ), + Texts('ASSESSMENT', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + Positioned( + top: index == 3 ? 15 : 30, + right: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 3 ? 70 : 50, + height: index == 3 ? 70 : 50, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Colors.white + : index > 3 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '4', + variant: index == 3 ? "heading2" : '', + bold: true, + color: index == 3 + ? Colors.black + : index > 3 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 3 ? 5 : 10, + ), + Texts('PLAN', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + ], + ) + : Stack( + children: [ + Container( + height: 120, + width: MediaQuery.of(context).size.width, + color: Colors.transparent, + child: Center( + child: Divider( + color: Colors.grey, + height: 0.75, + thickness: 0.75, + ), + ), + ), + Positioned( + top: index == 0 ? 15 : 30, + right: 0, + child: InkWell( + onTap: () => changeCurrentTab(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 0 ? 70 : 50, + height: index == 0 ? 70 : 50, + decoration: BoxDecoration( + border: index == 0 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 0 + ? null + : Border.all( + color: Colors.black, width: 0.75), + shape: BoxShape.circle, + color: index == 0 + ? Colors.white + : index > 0 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '1', + variant: index == 0 ? "heading2" : "", + bold: true, + color: index == 0 + ? Colors.black + : index > 0 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 0 ? 5 : 10, + ), + Texts('SUBJECTIVE', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + Positioned( + top: index == 1 ? 15 : 30, + right: MediaQuery.of(context).size.width * 0.28, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(1) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 1 ? 70 : 50, + height: index == 1 ? 70 : 50, + decoration: BoxDecoration( + border: index == 1 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 1 + ? Colors.white + : index > 1 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '2', + variant: index == 1 ? "heading2" : '', + bold: true, + color: index == 1 + ? Colors.black + : index > 1 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 1 ? 5 : 10, + ), + Texts('OBJECTIVE', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + Positioned( + top: index == 2 ? 15 : 30, + right: MediaQuery.of(context).size.width * 0.52, + child: InkWell( + onTap: () => index >= 2 ? changeCurrentTab(3) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 2 ? 70 : 50, + height: index == 2 ? 70 : 50, + decoration: BoxDecoration( + border: index == 2 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 2 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 2 + ? Colors.white + : index > 2 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '3', + variant: index == 2 ? "heading2" : '', + bold: true, + color: index == 2 + ? Colors.black + : index > 2 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 2 ? 5 : 10, + ), + Padding( + + padding: const EdgeInsets.only(right: 2), + child: Texts('ASSESSMENT', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ], + ), + ), + ), + Positioned( + top: index == 3 ? 15 : 30, + left: 0, + child: InkWell( + onTap: () => index >= 3 ? changeCurrentTab(4) : null, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: index == 3 ? 70 : 50, + height: index == 3 ? 70 : 50, + decoration: BoxDecoration( + border: index == 3 + ? Border.all(color: Color(0xFFB9382C), width: 2) + : index > 3 + ? null + : Border.all( + color: Color(0xFFCCCCCC), width: 0.75), + shape: BoxShape.circle, + color: index == 3 + ? Colors.white + : index > 3 + ? Color(0xFFB9382C) + : Color(0xFFCCCCCC), + ), + child: Center( + child: Texts( + '4', + variant: index == 3 ? "heading2" : '', + bold: true, + color: index == 3 + ? Colors.black + : index > 3 + ? Colors.white + : Colors.grey, + ), + ), + ), + SizedBox( + height: index == 3 ? 5 : 10, + ), + Texts('PLAN', + variant: "bodyText", + bold: true, + color: Colors.black), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/patients/profile/SOAP/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective_page.dart new file mode 100644 index 00000000..87aa62d7 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/subjective_page.dart @@ -0,0 +1,36 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class SubjectivePage extends StatelessWidget { + final Function changePageViewIndex; + + SubjectivePage({Key key, this.changePageViewIndex}); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, +// baseViewModel: widget.model, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppButton( + title: TranslationBase.of(context).next, + onPressed: () { + changePageViewIndex(1); + }, + ), + ], + ), + ), + ), + )); + } +} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index b8136026..a710cfc3 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -26,7 +26,13 @@ class ProfileMedicalInfoWidget extends StatelessWidget { mainAxisSpacing: 20, crossAxisCount: 2, childAspectRatio: 1.5, - children: [ + children: [ PatientProfileButton( + key: key, + patient: patient, + nameLine1: "Create New", + nameLine2: "Episode", + route: CREATE_EPISODE, + icon: 'heartbeat.png'), PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index eb61ce30..4ddd7873 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -27,7 +27,7 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { AppGlobal.CONTEX = context; - ProjectProvider projectProvider = Provider.of(context); + ProjectViewModel projectProvider = Provider.of(context); return Scaffold( backgroundColor: Colors.white, appBar: isShowAppBar diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index e3110cde..f7fd3637 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -18,7 +18,7 @@ class CardWithBgWidget extends StatelessWidget { @override Widget build(BuildContext context) { - ProjectProvider projectProvider = Provider.of(context); + ProjectViewModel projectProvider = Provider.of(context); return Container( margin: EdgeInsets.symmetric(vertical: 10.0), width: double.infinity, From af77d35ce31b0e4392a5a6d205fd5859a80f96c1 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 17 Dec 2020 10:37:53 +0200 Subject: [PATCH 04/25] ass some changes to SOAP --- .../profile/SOAP/subjective_page.dart | 19 +++++++++++++++++++ pubspec.lock | 7 +++++++ pubspec.yaml | 6 ++++++ 3 files changed, 32 insertions(+) diff --git a/lib/widgets/patients/profile/SOAP/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective_page.dart index 87aa62d7..fb95fc78 100644 --- a/lib/widgets/patients/profile/SOAP/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective_page.dart @@ -1,7 +1,10 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class SubjectivePage extends StatelessWidget { final Function changePageViewIndex; @@ -21,6 +24,22 @@ class SubjectivePage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ + SizedBox(height: 30,), + Row(children: [ + Row( + children: [ + Texts('ASSESSMENT', + variant: "bodyText", + bold: true, + color: Colors.black), + Icon(FontAwesomeIcons.asterisk, color: Color(0xFFB9382C), + size: 12, + ) + ], + ), + Icon(EvaIcons.plus) + ],), + AppButton( title: TranslationBase.of(context).next, onPressed: () { diff --git a/pubspec.lock b/pubspec.lock index ae4f6a70..5c109b95 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -343,6 +343,13 @@ packages: description: flutter source: sdk version: "0.0.0" + font_awesome_flutter: + dependency: "direct main" + description: + name: font_awesome_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "8.11.0" get_it: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index bdda7810..5e8563cd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,11 @@ dependencies: maps_launcher: ^1.2.0 url_launcher: ^5.4.5 charts_flutter: ^0.9.0 + #Icons eva_icons_flutter: ^2.0.0 + font_awesome_flutter: ^8.11.0 + + expandable: ^4.1.4 # Qr code Scanner @@ -56,6 +60,8 @@ dependencies: get_it: ^4.0.2 + + #speech to text speech_to_text: path: speech_to_text From 81352c2b0e9cb6babc8b198b8c672b6ffa3568ba Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 17 Dec 2020 10:47:17 +0200 Subject: [PATCH 05/25] small fix. --- lib/config/config.dart | 3 +++ lib/widgets/patients/profile/SOAP/subjective_page.dart | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index a7165953..0ee1eb0d 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,3 +1,5 @@ +import 'package:flutter/material.dart'; + const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; @@ -142,4 +144,5 @@ const TIMER_MIN = 10; class AppGlobal { static var CONTEX; + static Color appPrimaryColor =Color(0xFFB9382C); } diff --git a/lib/widgets/patients/profile/SOAP/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective_page.dart index fb95fc78..fd6a6e50 100644 --- a/lib/widgets/patients/profile/SOAP/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective_page.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; @@ -32,7 +33,7 @@ class SubjectivePage extends StatelessWidget { variant: "bodyText", bold: true, color: Colors.black), - Icon(FontAwesomeIcons.asterisk, color: Color(0xFFB9382C), + Icon(FontAwesomeIcons.asterisk, color: AppGlobal.appPrimaryColor, size: 12, ) ], From dcba85c7b9b017dbdd116259f72842103e4244fd Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Fri, 18 Dec 2020 19:53:46 +0200 Subject: [PATCH 06/25] Finish first step subjective_page.dart --- lib/config/localized_values.dart | 4 + lib/util/translations_delegate_base.dart | 2 + .../patients/profile/SOAP/add_SOAP_index.dart | 226 ++++++++-------- .../SOAP/subjective/add_allergies_widget.dart | 115 +++++++++ .../SOAP/subjective/add_history_widget.dart | 107 ++++++++ .../subjective/add_medication_widget.dart | 107 ++++++++ .../SOAP/subjective/subjective_page.dart | 242 ++++++++++++++++++ .../profile/SOAP/subjective_page.dart | 56 ---- lib/widgets/shared/TextFields.dart | 4 +- 9 files changed, 694 insertions(+), 169 deletions(-) create mode 100644 lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart create mode 100644 lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart create mode 100644 lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart create mode 100644 lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart delete mode 100644 lib/widgets/patients/profile/SOAP/subjective_page.dart diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 8ae95c74..e205bb4e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -279,4 +279,8 @@ const Map> localizedValues = { 'healthRecordInformation': {'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي'}, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, + "empty-message": { + "en": "Please enter message", + "ar": "يرجى ادخال الموضوع" + }, }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c60a65d3..7292492d 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -299,6 +299,8 @@ class TranslationBase { String get bed => localizedValues['bed'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode]; String get healthRecordInformation => localizedValues['healthRecordInformation'][locale.languageCode]; + String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index a74e5c51..2018a582 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/assessment_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/objective_page.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/plan_page.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective_page.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/subjective_page.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -46,124 +46,126 @@ class _AddSOAPIndexState extends State builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).healthRecordInformation, - body: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - decoration: - BoxDecoration(boxShadow: [], color: Colors.white), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + decoration: + BoxDecoration(boxShadow: [], color: Colors.white), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AvatarWidget( + Icon( + patient.genderDescription == "Male" + ? DoctorApp.male + : DoctorApp.female_icon, + size: 70, + color: Colors.white, ), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).age, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 20, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ), - ], - ) - ], - ), - ), - Container( - width: double.infinity, - height: 1, - color: Color(0xffCCCCCC), - ), - SizedBox( - width: 20, - ), - FractionallySizedBox( - child: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.75, - child: Column( - children: [ - Container( - margin: EdgeInsets.only( - left: - MediaQuery.of(context).size.width * 0.05, - right: - MediaQuery.of(context).size.width * 0.05), - child: StepsWidget( - index: _currentIndex, - changeCurrentTab: changePageViewIndex, + ), + SizedBox( + width: 20, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 5, ), - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - SubjectivePage(changePageViewIndex: changePageViewIndex,), - ObjectivePage(changePageViewIndex: changePageViewIndex,), - AssessmentPage(changePageViewIndex: changePageViewIndex,), - PlanPage(changePageViewIndex: changePageViewIndex,) + AppText( + patient.firstName + ' ' + patient.lastName, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).age, + color: Colors.black, + fontWeight: FontWeight.bold, + ), + SizedBox( + width: 20, + ), + AppText( + patient.age.toString(), + color: Colors.black, + fontWeight: FontWeight.normal, + ), ], ), - ), - ], - ), + AppText( + "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", + color: Color(0xFFB9382C), + fontWeight: FontWeight.bold, + ), + ], + ) + ], ), ), - ) - ], + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + width: 20, + ), + FractionallySizedBox( + child: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.75, + child: Column( + children: [ + Container( + margin: EdgeInsets.only( + left: + MediaQuery.of(context).size.width * 0.05, + right: + MediaQuery.of(context).size.width * 0.05), + child: StepsWidget( + index: _currentIndex, + changeCurrentTab: changePageViewIndex, + ), + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + SubjectivePage(changePageViewIndex: changePageViewIndex,), + ObjectivePage(changePageViewIndex: changePageViewIndex,), + AssessmentPage(changePageViewIndex: changePageViewIndex,), + PlanPage(changePageViewIndex: changePageViewIndex,) + ], + ), + ), + ], + ), + ), + ), + ) + ], + ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart new file mode 100644 index 00000000..54c914f9 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -0,0 +1,115 @@ + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class AddAllergiesWidget extends StatefulWidget { + @override + _AddAllergiesWidgetState createState() => _AddAllergiesWidgetState(); +} + +class _AddAllergiesWidgetState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Allergies", + fontSize: 13.5, + onTapTextFields: () { + openAllergiesList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('White Egg'.toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black), + Texts('Severe'.toUpperCase(), + variant: "bodyText", + bold: true, + color: AppGlobal.appPrimaryColor), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('White Egg'.toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black), + Texts('Severe'.toUpperCase(), + variant: "bodyText", + bold: true, + color: AppGlobal.appPrimaryColor), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + ], + ), + ) + ], + ); + } + openAllergiesList(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: Container( + child: Center( + child: Texts("openAllergiesList"), + )), + ); + }); + } + +} + diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart new file mode 100644 index 00000000..55df7a68 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart @@ -0,0 +1,107 @@ + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class AddHistoryWidget extends StatefulWidget { + @override + _AddHistoryWidgetState createState() => _AddHistoryWidgetState(); +} + +class _AddHistoryWidgetState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add History", + fontSize: 13.5, + onTapTextFields: () { + openHistoryList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('Abdomen Pain', + variant: "bodyText", + bold: true, + color: Colors.black), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('Back Pain', + variant: "bodyText", + bold: true, + color: Colors.black), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + ], + ), + ) + ], + ); + } + openHistoryList(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: Container( + child: Center( + child: Texts("HistoryList"), + )), + ); + }); + } + +} + diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart new file mode 100644 index 00000000..1db7c2e0 --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart @@ -0,0 +1,107 @@ + +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class AddMedication extends StatefulWidget { + @override + _AddMedicationState createState() => _AddMedicationState(); +} + +class _AddMedicationState extends State { + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Current Medications", + fontSize: 13.5, + onTapTextFields: () { + openMedicationsList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('Abdomen Pain', + variant: "bodyText", + bold: true, + color: Colors.black), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('Back Pain', + variant: "bodyText", + bold: true, + color: Colors.black), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + ], + ), + ) + ], + ); + } + openMedicationsList(BuildContext context) { + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: Container( + child: Center( + child: Texts("dfdfd"), + )), + ); + }); + } + +} + diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart new file mode 100644 index 00000000..b5fc805e --- /dev/null +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -0,0 +1,242 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_history_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_medication_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +class SubjectivePage extends StatefulWidget { + final Function changePageViewIndex; + + SubjectivePage({Key key, this.changePageViewIndex}); + + @override + _SubjectivePageState createState() => _SubjectivePageState(); +} + +class _SubjectivePageState extends State { + bool isChiefExpand = true; + bool isHistoryExpand = false; + bool isAllergiesExpand = false; + + TextEditingController messageController = TextEditingController(); + + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: false, + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('CHIEF COMPLAINTS', + variant: isChiefExpand ? "bodyText" : '', + bold: isChiefExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isChiefExpand = !isChiefExpand; + }); + }, + child: Icon( + isChiefExpand ? EvaIcons.minus : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Chief Complaints", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context).emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "History of Present Illness", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context).emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + AddMedication(), + ]), + isExpand: isChiefExpand, + ), + + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('History', + variant: isHistoryExpand ? "bodyText" : '', + bold: isHistoryExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isHistoryExpand = !isHistoryExpand; + }); + }, + child: Icon(isHistoryExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column( + children: [ + AddHistoryWidget() + ], + ), + isExpand: isHistoryExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('Allergies', + variant: isAllergiesExpand ? "bodyText" : '', + bold: isAllergiesExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isAllergiesExpand = !isAllergiesExpand; + }); + }, + child: Icon(isAllergiesExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget:Column( + children: [ + AddAllergiesWidget(), + SizedBox( + height: 30, + ), + ], + ) + , + isExpand: isAllergiesExpand, + ), + SizedBox( + height: 30, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: 30, + ), + AppButton( + title: TranslationBase.of(context).next, + onPressed: () { + widget.changePageViewIndex(1); + }, + ), + ], + ), + ), + ), + )); + } + +} diff --git a/lib/widgets/patients/profile/SOAP/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective_page.dart deleted file mode 100644 index fd6a6e50..00000000 --- a/lib/widgets/patients/profile/SOAP/subjective_page.dart +++ /dev/null @@ -1,56 +0,0 @@ -import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/shared/Text.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:eva_icons_flutter/eva_icons_flutter.dart'; -import 'package:flutter/material.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; - -class SubjectivePage extends StatelessWidget { - final Function changePageViewIndex; - - SubjectivePage({Key key, this.changePageViewIndex}); - - @override - Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: false, -// baseViewModel: widget.model, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox(height: 30,), - Row(children: [ - Row( - children: [ - Texts('ASSESSMENT', - variant: "bodyText", - bold: true, - color: Colors.black), - Icon(FontAwesomeIcons.asterisk, color: AppGlobal.appPrimaryColor, - size: 12, - ) - ], - ), - Icon(EvaIcons.plus) - ],), - - AppButton( - title: TranslationBase.of(context).next, - onPressed: () { - changePageViewIndex(1); - }, - ), - ], - ), - ), - ), - )); - } -} diff --git a/lib/widgets/shared/TextFields.dart b/lib/widgets/shared/TextFields.dart index 269ad660..e41b4379 100644 --- a/lib/widgets/shared/TextFields.dart +++ b/lib/widgets/shared/TextFields.dart @@ -8,7 +8,7 @@ class TextFields extends StatefulWidget { TextFields({Key key, this.type, this.hintText, this.suffixIcon, this.autoFocus, this.onChanged, this.initialValue, this.minLines, this.maxLines, this.inputFormatters, this.padding, this.focus=false, this.maxLengthEnforced=true, this.suffixIconColor, this.inputAction, this.onSubmit, this.keepPadding=true, this.textCapitalization = TextCapitalization.none, this.onTap, this.controller, this.keyboardType, this.validator, this.borderOnlyError=false, - this.onSaved, this.onSuffixTap, this.readOnly: false, this.maxLength, this.prefixIcon, this.bare=false, this.fontSize=16.0, this.fontWeight=FontWeight.w700, this.autoValidate=false}) : super(key: key); + this.onSaved, this.onSuffixTap, this.readOnly: false, this.maxLength, this.prefixIcon, this.bare=false, this.fontSize=16.0, this.fontWeight=FontWeight.w700, this.autoValidate=false, this.onTapTextFields}) : super(key: key); final String hintText; final String initialValue; @@ -18,6 +18,7 @@ class TextFields extends StatefulWidget { final Color suffixIconColor; final IconData prefixIcon; final VoidCallback onTap; + final Function onTapTextFields; final TextEditingController controller; final TextInputType keyboardType; final FormFieldValidator validator; @@ -112,6 +113,7 @@ class _TextFieldsState extends State { boxShadow: [BoxShadow(color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), offset: Offset(0.0, 13.0), blurRadius: focus ? 34.0 : 12.0)] ), child: TextFormField( + onTap: widget.onTapTextFields, keyboardAppearance: Theme.of(context).brightness, scrollPhysics: BouncingScrollPhysics(), autovalidate: widget.autoValidate, From c15300125eb5b3d5c43ae13027f3b3f209b6e022 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 20 Dec 2020 14:36:27 +0200 Subject: [PATCH 07/25] First step objective_page.dart --- .../patients/patients_referred_screen.dart | 1 + .../patients/profile/SOAP/objective_page.dart | 452 +++++++++++++++++- .../SOAP/subjective/add_allergies_widget.dart | 188 +++++++- .../SOAP/subjective/add_history_widget.dart | 341 ++++++++++++- .../SOAP/subjective/subjective_page.dart | 3 +- .../shared/divider_with_spaces_around.dart | 27 ++ 6 files changed, 997 insertions(+), 15 deletions(-) create mode 100644 lib/widgets/shared/divider_with_spaces_around.dart diff --git a/lib/screens/patients/patients_referred_screen.dart b/lib/screens/patients/patients_referred_screen.dart index 70a84f03..df1427c2 100644 --- a/lib/screens/patients/patients_referred_screen.dart +++ b/lib/screens/patients/patients_referred_screen.dart @@ -46,6 +46,7 @@ class _PatientReferredScreenState extends State { Listlist=List(); return AppScaffold( + //TODO : add Translation appBarTitle: "My Referred Patients",//patientTypetitle, body: Center( diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index 8960a8dc..c0df7241 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -1,18 +1,47 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; -class ObjectivePage extends StatelessWidget { +class ObjectivePage extends StatefulWidget { final Function changePageViewIndex; ObjectivePage({Key key, this.changePageViewIndex}); + @override + _ObjectivePageState createState() => _ObjectivePageState(); +} + +class _ObjectivePageState extends State { + bool isSysExaminationExpand = false; + List ExaminationsList; + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return AppScaffold( isShowAppBar: false, -// baseViewModel: widget.model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -21,11 +50,173 @@ class ObjectivePage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('Physical/System Examination', + variant: + isSysExaminationExpand ? "bodyText" : '', + bold: isSysExaminationExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isSysExaminationExpand = + !isSysExaminationExpand; + }); + }, + child: Icon(isSysExaminationExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Examination", + fontSize: 13.5, + onTapTextFields: () { + openExaminationList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 15), + child: Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts('Abdomen'.toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black) + ], + ), + SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: containerBorderDecoration( + Colors.white,Colors.grey + ), + child: Center( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Normal", + style: TextStyle( + fontSize: 12, + color: + Colors.black, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + )), + ), + onTap: () { + + }), + SizedBox(width: 12,), + InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: containerBorderDecoration( + Color(0xFF515A5D), Colors.black + ), + child: Center( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Abnormal", + style: TextStyle( + fontSize: 12, + color: + Colors.white, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + )), + ), + onTap: () { + + }), + ], + ), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), + SizedBox( + height: 20, + ), + ], + ), + ) + ], + ) + ]), + isExpand: isSysExaminationExpand, + ), + DividerWithSpacesAround(height: 30,), AppButton( title: TranslationBase.of(context).next, - onPressed: () { - changePageViewIndex(2); - }, + onPressed: () {}, + ), + SizedBox( + height: 30, ), ], ), @@ -33,4 +224,255 @@ class ObjectivePage extends StatelessWidget { ), )); } + + openExaminationList(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + ; + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + "Examinations", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: [ + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('Examinations', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ), + ], + ), + )), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add SELECTED Examinations".toUpperCase(), + onPressed: () {}, + ), + ]), + )), + ); + }); + } } + diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index 54c914f9..9fc21aa1 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -1,8 +1,10 @@ - import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -13,8 +15,21 @@ class AddAllergiesWidget extends StatefulWidget { } class _AddAllergiesWidgetState extends State { + + List allergiesList; + dynamic _referTo; + dynamic _selectedBranch; + dynamic _selectedClinic; + dynamic _selectedDoctor; + TextEditingController remarkController = TextEditingController(); + + @override Widget build(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + return Column( children: [ Container( @@ -95,7 +110,34 @@ class _AddAllergiesWidgetState extends State { ], ); } + openAllergiesList(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + }; showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, @@ -104,8 +146,147 @@ class _AddAllergiesWidgetState extends State { return FractionallySizedBox( heightFactor: 0.7, child: Container( - child: Center( - child: Texts("openAllergiesList"), + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox( + height: 16, + ), + AppText( + "Add Allergy", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: allergiesList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: allergiesList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _referTo = selectedValue; + _selectedBranch = null; + _selectedClinic = null; + _selectedDoctor = null; + // model.getDoctorBranch().then((value) { + // _selectedBranch = value; + // if (_referTo['id'] == 1) { + // model.getClinics( + // _selectedBranch['ID']); + // } + // }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Select Allergy", + _referTo != null ? _referTo['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: allergiesList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: allergiesList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _referTo = selectedValue; + _selectedBranch = null; + _selectedClinic = null; + _selectedDoctor = null; + // model.getDoctorBranch().then((value) { + // _selectedBranch = value; + // if (_referTo['id'] == 1) { + // model.getClinics( + // _selectedBranch['ID']); + // } + // }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Select Severity", + _referTo != null ? _referTo['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase.of(context).emptyMessage; + else + return null; + }), + ),SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { + }, + ), + ] + + ), )), ); }); @@ -113,3 +294,4 @@ class _AddAllergiesWidgetState extends State { } + diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart index 55df7a68..ef08b28d 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart @@ -3,23 +3,40 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; class AddHistoryWidget extends StatefulWidget { @override _AddHistoryWidgetState createState() => _AddHistoryWidgetState(); } -class _AddHistoryWidgetState extends State { +class _AddHistoryWidgetState extends State + with TickerProviderStateMixin { + PageController _controller; + int _currentIndex = 0; + + changePageViewIndex(pageIndex) { + _controller.jumpToPage(pageIndex); + } + + @override + void initState() { + _controller = new PageController(); + + super.initState(); + } + @override Widget build(BuildContext context) { return Column( children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), + margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( hintText: "Add History", fontSize: 13.5, @@ -87,6 +104,7 @@ class _AddHistoryWidgetState extends State { ], ); } + openHistoryList(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, @@ -96,12 +114,323 @@ class _AddHistoryWidgetState extends State { return FractionallySizedBox( heightFactor: 0.7, child: Container( - child: Center( - child: Texts("HistoryList"), - )), + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 10, + ), + PriorityBar(onTap: (activePriority) { + changePageViewIndex(activePriority); + }), + SizedBox( + height: 20, + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: _controller, + onPageChanged: (index) { + setState(() { + _currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: [ + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ), + ], + ), + )), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add SELECTED HISTORIES".toUpperCase(), + onPressed: () {}, + ), + ], + ), + Container( + child: Center( + child: Texts("eee"), + ), + ), + Container( + child: Center( + child: Texts("cccc"), + ), + ), + ], + ), + ), + ], + ), + )), ); }); } +} + +class PriorityBar extends StatefulWidget { + final Function onTap; + + const PriorityBar({Key key, this.onTap}) : super(key: key); + @override + _PriorityBarState createState() => _PriorityBarState(); } +class _PriorityBarState extends State { + int _activePriority = 0; + + List _priorities = [ + "Family", + "Surgical/Sports", + "Medical", + ]; + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 2.0, + )), + ); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + + return Container( + height: screenSize.height * 0.070, + decoration: + containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), + child: Row( + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: _priorities.map((item) { + bool _isActive = _priorities[_activePriority] == item ? true : false; + return Expanded( + child: InkWell( + child: Center( + child: Container( + height: screenSize.height * 0.070, + decoration: containerBorderDecoration( + _isActive ? HexColor("#B8382B") : Colors.white, + _isActive ? HexColor("#B8382B") : Colors.white), + child: Center( + child: Text( + item, + style: TextStyle( + fontSize: 12, + color: _isActive + ? Colors.white + : Colors.black, //Colors.black, + fontWeight: FontWeight.bold, + ), + ), + )), + ), + onTap: () { + widget.onTap(_priorities.indexOf(item)); + + setState(() { + _activePriority = _priorities.indexOf(item); + }); + }), + ); + }).toList(), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index b5fc805e..ce43b6c3 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -22,7 +22,7 @@ class SubjectivePage extends StatefulWidget { } class _SubjectivePageState extends State { - bool isChiefExpand = true; + bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; @@ -30,6 +30,7 @@ class _SubjectivePageState extends State { @override Widget build(BuildContext context) { + return AppScaffold( isShowAppBar: false, body: SingleChildScrollView( diff --git a/lib/widgets/shared/divider_with_spaces_around.dart b/lib/widgets/shared/divider_with_spaces_around.dart new file mode 100644 index 00000000..b43557cb --- /dev/null +++ b/lib/widgets/shared/divider_with_spaces_around.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; + +class DividerWithSpacesAround extends StatelessWidget { + DividerWithSpacesAround({ + Key key, this.height = 0, + }); + final double height ; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + SizedBox( + height: height, + ), + Container( + width: double.infinity, + height: 1, + color: Color(0xffCCCCCC), + ), + SizedBox( + height: height, + ), + ], + ); + } +} From 7910e6a9e92fbeea55890c3891cc660a0a55fb47 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 20 Dec 2020 16:31:02 +0200 Subject: [PATCH 08/25] Finish step objective_page.dart + assessment_page.dart page --- .../profile/SOAP/assessment_page.dart | 464 +++++++++++++++++- .../patients/profile/SOAP/objective_page.dart | 28 +- 2 files changed, 487 insertions(+), 5 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/assessment_page.dart b/lib/widgets/patients/profile/SOAP/assessment_page.dart index 7649ac46..2f747d52 100644 --- a/lib/widgets/patients/profile/SOAP/assessment_page.dart +++ b/lib/widgets/patients/profile/SOAP/assessment_page.dart @@ -1,18 +1,40 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -class AssessmentPage extends StatelessWidget { +class AssessmentPage extends StatefulWidget { final Function changePageViewIndex; AssessmentPage({Key key, this.changePageViewIndex}); + @override + _AssessmentPageState createState() => _AssessmentPageState(); +} + +class _AssessmentPageState extends State { + bool isAssessmentExpand = false; + + List assessmentList; + dynamic _referTo; + + TextEditingController remarksController = TextEditingController(); + @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return AppScaffold( isShowAppBar: false, -// baseViewModel: widget.model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -21,16 +43,452 @@ class AssessmentPage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('ASSESSMENT', + variant: isAssessmentExpand ? "bodyText" : '', + bold: isAssessmentExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isAssessmentExpand = !isAssessmentExpand; + }); + }, + child: Icon(isAssessmentExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 15), + child: TextFields( + hintText: "Add ASSESSMENT", + fontSize: 13.5, + onTapTextFields: () { + openAssessmentDialog(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "12".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "DEC".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Appointment #: ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "2019054946", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Typhoid Fever", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Type : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Possible Diagnosis", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Doc : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Anas Abdullah", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + SizedBox( + height: 6, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + AppText( + "Some short remark about the allergy", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + + children: [ + AppText( + "ICD: ".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "R07.1".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + children: [ + InkWell( + onTap: () {}, + child: Icon(EvaIcons.edit2Outline), + ) + ], + ), + ], + ), + ) + ], + ) + ]), + isExpand: isAssessmentExpand, + ), + DividerWithSpacesAround( + height: 30, + ), AppButton( title: TranslationBase.of(context).next, onPressed: () { - changePageViewIndex(3); + widget.changePageViewIndex(3); }, ), + SizedBox( + height: 30, + ), ], ), ), ), )); } + + openAssessmentDialog(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown) { + //TODO: make one Input InputDecoration for all + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.75, + widthFactor: 0.9, + + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + "Add Assessment Details".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: assessmentList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: assessmentList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + // model.getDoctorBranch().then((value) { + // _selectedBranch = value; + // if (_referTo['id'] == 1) { + // model.getClinics( + // _selectedBranch['ID']); + // } + // }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Appointment Number", + _referTo != null ? _referTo['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: assessmentList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: assessmentList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() {}); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration("Name or ICD", + _referTo != null ? _referTo['name'] : null, true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: assessmentList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: assessmentList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() {}); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration("Condition", + _referTo != null ? _referTo['name'] : null, true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: assessmentList != null + ? () { + ListSelectDialog dialog = ListSelectDialog( + list: assessmentList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() {}); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration("Type", + _referTo != null ? _referTo['name'] : null, true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 18, + minLines: 8, + controller: remarksController, + validator: (value) { + if (value == null) + return TranslationBase.of(context).emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () {}, + ), + ])), + ); + }); + } } diff --git a/lib/widgets/patients/profile/SOAP/objective_page.dart b/lib/widgets/patients/profile/SOAP/objective_page.dart index c0df7241..b2cd920f 100644 --- a/lib/widgets/patients/profile/SOAP/objective_page.dart +++ b/lib/widgets/patients/profile/SOAP/objective_page.dart @@ -23,7 +23,9 @@ class ObjectivePage extends StatefulWidget { class _ObjectivePageState extends State { bool isSysExaminationExpand = false; - List ExaminationsList; + List examinationsList; + TextEditingController remarksController = TextEditingController(); + BoxDecoration containerBorderDecoration( Color containerColor, Color borderColor) { return BoxDecoration( @@ -202,6 +204,26 @@ class _ObjectivePageState extends State { SizedBox( height: 20, ), + Container( + margin: EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarksController, + validator: (value) { + if (value == null) + return TranslationBase.of(context).emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), ], ), ) @@ -213,7 +235,9 @@ class _ObjectivePageState extends State { DividerWithSpacesAround(height: 30,), AppButton( title: TranslationBase.of(context).next, - onPressed: () {}, + onPressed: () { + widget.changePageViewIndex(2); + }, ), SizedBox( height: 30, From 16e6221b9e25a87d2175cae1dd9cb30d68ebcbbf Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 20 Dec 2020 21:31:22 +0200 Subject: [PATCH 09/25] Finish plan page design --- .../patients/profile/SOAP/plan_page.dart | 290 +++++++++++++++++- 1 file changed, 287 insertions(+), 3 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/plan_page.dart b/lib/widgets/patients/profile/SOAP/plan_page.dart index 5054647c..7b5ddcdc 100644 --- a/lib/widgets/patients/profile/SOAP/plan_page.dart +++ b/lib/widgets/patients/profile/SOAP/plan_page.dart @@ -1,18 +1,49 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -class PlanPage extends StatelessWidget { +class PlanPage extends StatefulWidget { final Function changePageViewIndex; PlanPage({Key key, this.changePageViewIndex}); + @override + _PlanPageState createState() => _PlanPageState(); +} + +class _PlanPageState extends State { + bool isProgressNoteExpand = false; + + List progressNoteList; + + TextEditingController progressNoteController = TextEditingController(); + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 0.5, + )), + ); + } @override Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return AppScaffold( isShowAppBar: false, -// baseViewModel: widget.model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -21,16 +52,269 @@ class PlanPage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.start, children: [ + SizedBox( + height: 30, + ), + HeaderBodyExpandableNotifier( + headerWidget: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Texts('Progress Note', + variant: + isProgressNoteExpand ? "bodyText" : '', + bold: isProgressNoteExpand ? true : false, + color: Colors.black), + Icon( + FontAwesomeIcons.asterisk, + color: AppGlobal.appPrimaryColor, + size: 12, + ) + ], + ), + InkWell( + onTap: () { + setState(() { + isProgressNoteExpand = + !isProgressNoteExpand; + }); + }, + child: Icon(isProgressNoteExpand + ? EvaIcons.minus + : EvaIcons.plus)) + ], + ), + bodyWidget: Column(children: [ + SizedBox( + height: 20, + ), + Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 10, right: 10, top: 15), + child: TextFields( + hintText: "Add Progress Note", + fontSize: 13.5, + onTapTextFields: () { + openExaminationList(context); + }, + readOnly: true, + // hintColor: Colors.black, + suffixIcon: EvaIcons.plusCircleOutline, + suffixIconColor: AppGlobal.appPrimaryColor, + fontWeight: FontWeight.w600, + // controller: messageController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 20, + ), + Container( + margin: EdgeInsets.only(left: 5, right: 5, top: 15), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + "12".toUpperCase(), + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "DEC".toUpperCase(), + fontSize: 10, + color: Colors.grey, + ), + ], + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + SizedBox( + height: 6, + ), + Padding( + padding: const EdgeInsets.all(0.0), + child: AppText( + "Some progress note about", + fontSize: 10, + color: Colors.grey, + ), + ), + ], + ),SizedBox( + height: 8, + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Created By : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Anas Abdullah on 12 De", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + AppText( + "Edited By : ", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + AppText( + "Rahim on 13 Dec", + fontSize: 10, + color: Colors.grey, + ), + ], + ), + + ], + ), + Column( + children: [ + InkWell( + onTap: () {}, + child: Icon(EvaIcons.edit2Outline), + ) + ], + ), + ], + ), + ) + ], + ) + ]), + isExpand: isProgressNoteExpand, + ), + DividerWithSpacesAround(height: 30,), AppButton( title: TranslationBase.of(context).next, onPressed: () { - changePageViewIndex(4); + widget.changePageViewIndex(2); }, ), + SizedBox( + height: 30, + ), ], ), ), ), )); } + + openExaminationList(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + ; + showModalBottomSheet( + backgroundColor: Colors.white, + isScrollControlled: true, + context: context, + builder: (context) { + return FractionallySizedBox( + heightFactor: 0.5, + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + "Add Progress Note", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 16, + minLines: 8, + controller: progressNoteController, + validator: (value) { + if (value == null) + return TranslationBase.of(context).emptyMessage; + else + return null; + }), + ),SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { + }, + ), + ]), + )), + ); + }); + } } From ef6b1bc50e59b549801c549b502e1b2187866b49 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 21 Dec 2020 13:18:28 +0200 Subject: [PATCH 10/25] add master lookups --- lib/client/base_app_client.dart | 3 +- lib/config/config.dart | 1 + lib/core/enum/master_lookup_key.dart | 42 +++++++++++++++++++ lib/core/service/SOAP_service.dart | 24 ++++++++++- lib/core/viewModel/SOAP_view_model.dart | 11 +++++ lib/locator.dart | 4 ++ .../SOAP/subjective/subjective_page.dart | 28 ++++++++----- 7 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 lib/core/enum/master_lookup_key.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index b2b76709..46d34f26 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -50,7 +50,6 @@ class BaseAppClient { body['ClinicID'] = doctorProfile?.clinicID; } body['TokenID'] = token ?? ''; - body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZWE0M2QxOTEtMWY1OS00ZWY1LThmYTYtM2ExYzBkNjQyNjc5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTk0NyIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMDYwOTgsImV4cCI6MTYwODk3MDA5OCwiaWF0IjoxNjA4MTA2MDk4fQ.EJ_QwlrHPQncnU_CP0HpnERPidpIl5nFQzqB2VNFbNs"; String lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; @@ -64,6 +63,8 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; + // body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZWE0M2QxOTEtMWY1OS00ZWY1LThmYTYtM2ExYzBkNjQyNjc5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTk0NyIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMDYwOTgsImV4cCI6MTYwODk3MDA5OCwiaWF0IjoxNjA4MTA2MDk4fQ.EJ_QwlrHPQncnU_CP0HpnERPidpIl5nFQzqB2VNFbNs"; + print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/config/config.dart b/lib/config/config.dart index 0ee1eb0d..817925f5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -84,6 +84,7 @@ const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; // SOAP const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; +const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; var selectedPatientType = 1; diff --git a/lib/core/enum/master_lookup_key.dart b/lib/core/enum/master_lookup_key.dart new file mode 100644 index 00000000..2ea576c6 --- /dev/null +++ b/lib/core/enum/master_lookup_key.dart @@ -0,0 +1,42 @@ +enum MasterKeysService { + Allergies, + HistoryFamily, + HistoryMedical, + HistorySocial, + HistorySports, + HistorySurgical, + PhysicalExamination, + AllergySeverity +} + +extension SelectedMasterKeysService on MasterKeysService { + // ignore: missing_return + int getMasterKeyService() { + switch (this) { + case MasterKeysService.Allergies: + return 11; + break; + case MasterKeysService.HistoryFamily: + return 36; + break; + case MasterKeysService.HistoryMedical: + return 37; + break; + case MasterKeysService.HistorySocial: + return 38; + break; + case MasterKeysService.HistorySports: + return 39; + break; + case MasterKeysService.HistorySurgical: + return 66; + break; + case MasterKeysService.PhysicalExamination: + return 59; + break; + case MasterKeysService.AllergySeverity: + return 55; + break; + } + } +} diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 3ab75c27..69e1adb1 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -1,12 +1,13 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; class SOAPService extends BaseService { - List get listOfAllergies => _listOfAllergies; - List _listOfAllergies = []; + List get listOfAllergies => _listOfAllergies; + List _listOfAllergies = []; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { @@ -22,4 +23,23 @@ class SOAPService extends BaseService { super.error = error; }, body: getAllergiesRequestModel.toJson(),); } + + Future getMasterLookup(MasterKeysService masterKeys) async { + Map body = { + "MasterInput" : masterKeys.getMasterKeyService() + }; + print("fdfd"); + await baseAppClient.post(GET_MASTER_LOOKUP_LIST, + onSuccess: (dynamic response, int statusCode) { + _listOfAllergies.clear(); + response['MasterLookUpList']['entityList'].forEach((v) { + _listOfAllergies + .add(v); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index a68f3991..b34e56d8 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; @@ -20,4 +21,14 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getMasterLookup(MasterKeysService masterKeys) async { + setState(ViewState.Busy); + await _SOAPService.getMasterLookup(masterKeys); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } } diff --git a/lib/locator.dart b/lib/locator.dart index 550b4666..012ad17b 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -2,11 +2,13 @@ import 'package:doctor_app_flutter/core/service/patient_service.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:get_it/get_it.dart'; +import 'core/service/SOAP_service.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; +import 'core/viewModel/SOAP_view_model.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; import 'core/viewModel/referral_view_model.dart'; @@ -24,6 +26,7 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => SOAPService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -32,4 +35,5 @@ void setupLocator() { locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => SOAPViewModel()); } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index ce43b6c3..eafa07c2 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -1,4 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_history_widget.dart'; @@ -30,8 +33,9 @@ class _SubjectivePageState extends State { @override Widget build(BuildContext context) { - - return AppScaffold( + return BaseView( + onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + builder: (_, model, w) => AppScaffold( isShowAppBar: false, body: SingleChildScrollView( physics: ScrollPhysics(), @@ -227,17 +231,19 @@ class _SubjectivePageState extends State { SizedBox( height: 30, ), - AppButton( - title: TranslationBase.of(context).next, - onPressed: () { - widget.changePageViewIndex(1); - }, + AppButton( + title: TranslationBase + .of(context) + .next, + onPressed: () { + widget.changePageViewIndex(1); + }, + ), + ], ), - ], + ), ), - ), - ), - )); + ),),); } } From df68e912b51afc60032f6ef0c7bbf43b3deb42ac Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 22 Dec 2020 17:40:22 +0200 Subject: [PATCH 11/25] first step from calling history --- lib/client/base_app_client.dart | 2 +- lib/core/service/SOAP_service.dart | 87 ++- lib/core/viewModel/SOAP_view_model.dart | 4 +- lib/models/SOAP/master_key_model.dart | 76 +++ lib/models/SOAP/my_selected_allergy.dart | 32 + .../SOAP/subjective/add_allergies_widget.dart | 485 ++++++++------- .../SOAP/subjective/add_history_widget.dart | 551 ++++++++++-------- .../SOAP/subjective/subjective_page.dart | 8 +- .../shared/dialogs/master_key_dailog.dart | 86 +++ 9 files changed, 833 insertions(+), 498 deletions(-) create mode 100644 lib/models/SOAP/master_key_model.dart create mode 100644 lib/models/SOAP/my_selected_allergy.dart create mode 100644 lib/widgets/shared/dialogs/master_key_dailog.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 46d34f26..cc77681f 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -63,7 +63,7 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - // body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiZWE0M2QxOTEtMWY1OS00ZWY1LThmYTYtM2ExYzBkNjQyNjc5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NTk0NyIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgxMDYwOTgsImV4cCI6MTYwODk3MDA5OCwiaWF0IjoxNjA4MTA2MDk4fQ.EJ_QwlrHPQncnU_CP0HpnERPidpIl5nFQzqB2VNFbNs"; + body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiZjcwMTUyYzktMjAwNy00Y2FjLTkzMWUtOGI0MDlhMWFkNjc4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1ODU1MzAiLCJDbGluaWNJZCI6IjE3Iiwicm9sZSI6IkRPQ1RPUlMiLCJuYmYiOjE2MDg1NTMxMDAsImV4cCI6MTYwOTQxNzEwMCwiaWF0IjoxNjA4NTUzMTAwfQ.lydDI-nsHlmb4Z4vesnckCU1i3hnNayoWVacc3E5_XM"; print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 69e1adb1..de729be3 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -1,45 +1,80 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; -import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; class SOAPService extends BaseService { - - List get listOfAllergies => _listOfAllergies; - List _listOfAllergies = []; - + List get listOfAllergies => _listOfAllergies; + List get allergySeverityList => _allergySeverityList; + List _listOfAllergies = []; + List _allergySeverityList = []; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { - await baseAppClient.post(GET_ALLERGIES, - onSuccess: (dynamic response, int statusCode) { - _listOfAllergies.clear(); - response['List_Allergies']['entityList'].forEach((v) { - _listOfAllergies - .add(AllergyModel.fromJson(v)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: getAllergiesRequestModel.toJson(),); + await baseAppClient.post( + GET_ALLERGIES, + onSuccess: (dynamic response, int statusCode) { + _listOfAllergies.clear(); + response['List_Allergies']['entityList'].forEach((v) { + _listOfAllergies.add(MasterKeyModel.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: getAllergiesRequestModel.toJson(), + ); } Future getMasterLookup(MasterKeysService masterKeys) async { Map body = { - "MasterInput" : masterKeys.getMasterKeyService() + "MasterInput": masterKeys.getMasterKeyService() }; - print("fdfd"); await baseAppClient.post(GET_MASTER_LOOKUP_LIST, - onSuccess: (dynamic response, int statusCode) { + onSuccess: (dynamic response, int statusCode) { + setMasterLookupInCorrectArray( + response['MasterLookUpList']['entityList'], masterKeys); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { + switch (masterKeys) { + case MasterKeysService.Allergies: _listOfAllergies.clear(); - response['MasterLookUpList']['entityList'].forEach((v) { + entryList.forEach((v) { _listOfAllergies - .add(v); + .add(MasterKeyModel.fromJson(v)); }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + break; + case MasterKeysService.HistoryFamily: + return 36; + break; + case MasterKeysService.HistoryMedical: + return 37; + break; + case MasterKeysService.HistorySocial: + return 38; + break; + case MasterKeysService.HistorySports: + return 39; + break; + case MasterKeysService.HistorySurgical: + return 66; + break; + case MasterKeysService.PhysicalExamination: + return 59; + break; + case MasterKeysService.AllergySeverity: + _allergySeverityList.clear(); + entryList.forEach((v) { + _allergySeverityList + .add(MasterKeyModel.fromJson(v)); + }); + break; + } } - } diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index b34e56d8..b48bfcba 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -10,7 +11,8 @@ import 'base_view_model.dart'; class SOAPViewModel extends BaseViewModel { SOAPService _SOAPService = locator(); - List get listOfAllergies => _SOAPService.listOfAllergies; + List get listOfAllergies => _SOAPService.listOfAllergies; + List get allergySeverityList => _SOAPService.allergySeverityList; Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); diff --git a/lib/models/SOAP/master_key_model.dart b/lib/models/SOAP/master_key_model.dart new file mode 100644 index 00000000..79615f82 --- /dev/null +++ b/lib/models/SOAP/master_key_model.dart @@ -0,0 +1,76 @@ +class MasterKeyModel { + String alias; + String aliasN; + int code; + Null description; + Null detail1; + Null detail2; + Null detail3; + Null detail4; + Null detail5; + int groupID; + int id; + String nameAr; + String nameEn; + Null remarks; + int typeId; + String valueList; + + MasterKeyModel( + {this.alias, + this.aliasN, + this.code, + this.description, + this.detail1, + this.detail2, + this.detail3, + this.detail4, + this.detail5, + this.groupID, + this.id, + this.nameAr, + this.nameEn, + this.remarks, + this.typeId, + this.valueList}); + + MasterKeyModel.fromJson(Map json) { + alias = json['alias']; + aliasN = json['aliasN']; + code = json['code']; + description = json['description']; + detail1 = json['detail1']; + detail2 = json['detail2']; + detail3 = json['detail3']; + detail4 = json['detail4']; + detail5 = json['detail5']; + groupID = json['groupID']; + id = json['id']; + nameAr = json['nameAr']; + nameEn = json['nameEn']; + remarks = json['remarks']; + typeId = json['typeId']; + valueList = json['valueList']; + } + + Map toJson() { + final Map data = new Map(); + data['alias'] = this.alias; + data['aliasN'] = this.aliasN; + data['code'] = this.code; + data['description'] = this.description; + data['detail1'] = this.detail1; + data['detail2'] = this.detail2; + data['detail3'] = this.detail3; + data['detail4'] = this.detail4; + data['detail5'] = this.detail5; + data['groupID'] = this.groupID; + data['id'] = this.id; + data['nameAr'] = this.nameAr; + data['nameEn'] = this.nameEn; + data['remarks'] = this.remarks; + data['typeId'] = this.typeId; + data['valueList'] = this.valueList; + return data; + } +} diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart new file mode 100644 index 00000000..9996b65a --- /dev/null +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -0,0 +1,32 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +class MySelectedAllergy { + MasterKeyModel selectedAllergySeverity; + MasterKeyModel selectedAllergy; + String remark; + + MySelectedAllergy( + {this.selectedAllergySeverity, this.selectedAllergy, this.remark}); + + MySelectedAllergy.fromJson(Map json) { + selectedAllergySeverity = json['selectedAllergySeverity'] != null + ? new MasterKeyModel.fromJson(json['selectedAllergySeverity']) + : null; + selectedAllergy = json['selectedAllergy'] != null + ? new MasterKeyModel.fromJson(json['selectedAllergy']) + : null; + remark = json['remark']; + } + + Map toJson() { + final Map data = new Map(); + if (this.selectedAllergySeverity != null) { + data['selectedAllergySeverity'] = this.selectedAllergySeverity.toJson(); + } + if (this.selectedAllergy != null) { + data['selectedAllergy'] = this.selectedAllergy.toJson(); + } + data['remark'] = this.remark; + return data; + } +} diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index 9fc21aa1..9dda8c00 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -1,40 +1,42 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class AddAllergiesWidget extends StatefulWidget { + final List myAllergiesList; + + AddAllergiesWidget({Key key, this.myAllergiesList}); + @override _AddAllergiesWidgetState createState() => _AddAllergiesWidgetState(); } class _AddAllergiesWidgetState extends State { + List myAllergiesList; - List allergiesList; - dynamic _referTo; - dynamic _selectedBranch; - dynamic _selectedClinic; - dynamic _selectedDoctor; TextEditingController remarkController = TextEditingController(); - @override Widget build(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; + final screenSize = MediaQuery.of(context).size; return Column( children: [ Container( - margin: - EdgeInsets.only(left: 10, right: 10, top: 15), + margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( hintText: "Add Allergies", fontSize: 13.5, @@ -49,7 +51,8 @@ class _AddAllergiesWidgetState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase.of(context) + return TranslationBase + .of(context) .emptyMessage; else return null; @@ -62,49 +65,37 @@ class _AddAllergiesWidgetState extends State { margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('White Egg'.toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black), - Texts('Severe'.toUpperCase(), - variant: "bodyText", - bold: true, - color: AppGlobal.appPrimaryColor), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('White Egg'.toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black), - Texts('Severe'.toUpperCase(), - variant: "bodyText", - bold: true, - color: AppGlobal.appPrimaryColor), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - ], + children: widget.myAllergiesList.map((selectedAllergy) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Texts(selectedAllergy.selectedAllergy.nameEn + .toUpperCase(), + variant: "bodyText", + bold: true, + color: Colors.black), + Texts(selectedAllergy.selectedAllergySeverity.nameEn + .toUpperCase(), + variant: "bodyText", + bold: true, + color: AppGlobal.appPrimaryColor), + Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ) + ], + ), SizedBox( + height: 20, + ), + ], + ); + }).toList() + ), ) ], @@ -112,186 +103,230 @@ class _AddAllergiesWidgetState extends State { } openAllergiesList(BuildContext context) { - final screenSize = MediaQuery - .of(context) - .size; - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown) { - return InputDecoration( - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), - borderRadius: BorderRadius.circular(8), - ), - hintText: selectedText != null ? selectedText : hintText, - suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, - hintStyle: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - ); - }; showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + return AddAllergies( + addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { + widget.myAllergiesList.add(mySelectedAllergy); + Navigator.of(context).pop(); + },); + }); + } - SizedBox( - height: 16, - ), - AppText( - "Add Allergy", - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: allergiesList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: allergiesList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase - .of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _referTo = selectedValue; - _selectedBranch = null; - _selectedClinic = null; - _selectedDoctor = null; - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Select Allergy", - _referTo != null ? _referTo['name'] : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: allergiesList != null - ? () { - ListSelectDialog dialog = ListSelectDialog( - list: allergiesList, - attributeName: 'name', - attributeValueId: 'id', - okText: TranslationBase - .of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _referTo = selectedValue; - _selectedBranch = null; - _selectedClinic = null; - _selectedDoctor = null; - // model.getDoctorBranch().then((value) { - // _selectedBranch = value; - // if (_referTo['id'] == 1) { - // model.getClinics( - // _selectedBranch['ID']); - // } - // }); - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; +} + +class AddAllergies extends StatefulWidget { + final Function addAllergiesFun; + + const AddAllergies({Key key, this.addAllergiesFun}) : super(key: key); + + @override + _AddAllergiesState createState() => _AddAllergiesState(); +} + +class _AddAllergiesState extends State { + List allergiesList; + List allergySeverityList; + MasterKeyModel _selectedAllergySeverity; + MasterKeyModel _selectedAllergy; + TextEditingController remarkController = TextEditingController(); + + + InputDecoration textFieldSelectorDecoration(String hintText, + String selectedText, bool isDropDown) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery + .of(context) + .size; + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + if (model.listOfAllergies == null) { + await model.getMasterLookup(MasterKeysService.Allergies); + } + if (model.allergySeverityList == null) { + await model.getMasterLookup(MasterKeysService.AllergySeverity); + } + }, + builder: (_, model, w) => + AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + SizedBox( + height: 16, + ), + AppText( + "Add Allergy", + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.listOfAllergies != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfAllergies, + okText: TranslationBase + .of(context) + .ok, + okFunction: (MasterKeyModel selectedValue) { + setState(() { + _selectedAllergy = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Select Allergy", + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergySeverityList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.allergySeverityList, + okText: TranslationBase + .of(context) + .ok, + okFunction: (selectedValue) { + setState(() { + _selectedAllergySeverity = + selectedValue; + // model.getDoctorBranch().then((value) { + // _selectedBranch = value; + // if (_referTo['id'] == 1) { + // model.getClinics( + // _selectedBranch['ID']); + // } + // }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + "Select Severity", + _selectedAllergySeverity != null + ? _selectedAllergySeverity.nameEn + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, right: 0, top: 15), + child: TextFields( + hintText: "Remarks", + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 13, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { + MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( + remark: remarkController.text, + selectedAllergy: _selectedAllergy, + selectedAllergySeverity: _selectedAllergySeverity); + widget.addAllergiesFun(mySelectedAllergy); }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - "Select Severity", - _referTo != null ? _referTo['name'] : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: TextFields( - hintText: "Remarks", - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 13, - controller: remarkController, - validator: (value) { - if (value == null) - return TranslationBase.of(context).emptyMessage; - else - return null; - }), - ),SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - }, - ), - ] + ), + ] + ), + ), ), )), - ); - }); + ), + ); } - } + + + diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart index ef08b28d..b83f5f16 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart @@ -1,10 +1,15 @@ - import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -111,247 +116,7 @@ class _AddHistoryWidgetState extends State isScrollControlled: true, context: context, builder: (context) { - return FractionallySizedBox( - heightFactor: 0.7, - child: Container( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 10, - ), - PriorityBar(onTap: (activePriority) { - changePageViewIndex(activePriority); - }), - SizedBox( - height: 20, - ), - Expanded( - child: PageView( - physics: NeverScrollableScrollPhysics(), - controller: _controller, - onPageChanged: (index) { - setState(() { - _currentIndex = index; - }); - }, - scrollDirection: Axis.horizontal, - children: [ - Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: [ - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ), - ], - ), - )), - ), - SizedBox( - height: 10, - ), - AppButton( - title: "Add SELECTED HISTORIES".toUpperCase(), - onPressed: () {}, - ), - ], - ), - Container( - child: Center( - child: Texts("eee"), - ), - ), - Container( - child: Center( - child: Texts("cccc"), - ), - ), - ], - ), - ), - ], - ), - )), - ); + return AddHistoryDialog(); }); } } @@ -434,3 +199,305 @@ class _PriorityBarState extends State { ); } } + +class AddHistoryDialog extends StatefulWidget { + final Function changePageViewIndex; + final PageController controller; + + const AddHistoryDialog({Key key, this.changePageViewIndex, this.controller}) + : super(key: key); + + @override + _AddHistoryDialogState createState() => _AddHistoryDialogState(); +} + +class _AddHistoryDialogState extends State { + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + heightFactor: 0.7, + child: BaseView( + onModelReady: (model) async { + // if (model.listOfAllergies == null) { + await model.getMasterLookup(MasterKeysService.Allergies); + // } + if (model.allergySeverityList == null) { + await model.getMasterLookup(MasterKeysService.AllergySeverity); + } + }, + builder: (_, model, w) => AppScaffold( + // baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 10, + ), + PriorityBar(onTap: (activePriority) { + widget.changePageViewIndex(activePriority); + }), + SizedBox( + height: 20, + ), + Expanded( + child: PageView( + physics: NeverScrollableScrollPhysics(), + controller: widget.controller, + onPageChanged: (index) { + setState(() { + // currentIndex = index; + }); + }, + scrollDirection: Axis.horizontal, + children: [ + Column( + children: [ + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: [ + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts('History', + variant: "bodyText", + bold: true, + color: Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ), + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED HISTORIES".toUpperCase(), + onPressed: () {}, + ), + ], + ), + Container( + child: Center( + child: Texts("eee"), + ), + ), + Container( + child: Center( + child: Texts("cccc"), + ), + ), + ], + ), + ), + ], + ), + )), + ), + ), + )); + } +} diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index eafa07c2..74d2aa43 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; @@ -28,15 +29,16 @@ class _SubjectivePageState extends State { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; - + List myAllergiesList = List(); TextEditingController messageController = TextEditingController(); @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), + // onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies), builder: (_, model, w) => AppScaffold( isShowAppBar: false, + baseViewModel: model, body: SingleChildScrollView( physics: ScrollPhysics(), child: Center( @@ -211,7 +213,7 @@ class _SubjectivePageState extends State { ), bodyWidget:Column( children: [ - AddAllergiesWidget(), + AddAllergiesWidget(myAllergiesList: myAllergiesList,), SizedBox( height: 30, ), diff --git a/lib/widgets/shared/dialogs/master_key_dailog.dart b/lib/widgets/shared/dialogs/master_key_dailog.dart new file mode 100644 index 00000000..a276c4af --- /dev/null +++ b/lib/widgets/shared/dialogs/master_key_dailog.dart @@ -0,0 +1,86 @@ +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class MasterKeyDailog extends StatefulWidget { + final List list; + final okText; + final Function(MasterKeyModel) okFunction; + MasterKeyModel selectedValue; + + MasterKeyDailog( + {@required this.list, + @required this.okText, + @required this.okFunction}); + + @override + _MasterKeyDailogState createState() => _MasterKeyDailogState(); +} + +class _MasterKeyDailogState extends State { + @override + void initState() { + super.initState(); + widget.selectedValue = widget.selectedValue ?? widget.list[0]; + } + + @override + Widget build(BuildContext context) { + return showAlertDialog(context); + } + + showAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = FlatButton( + child: Text(TranslationBase.of(context).cancel), + onPressed: () { + Navigator.of(context).pop(); + }); + Widget continueButton = FlatButton( + child: Text(this.widget.okText), + onPressed: () { + this.widget.okFunction(widget.selectedValue); + Navigator.of(context).pop(); + }); +// set up the AlertDialog + AlertDialog alert = AlertDialog( + // title: Text(widget.title), + content: createDialogList(), + actions: [ + cancelButton, + continueButton, + ], + ); + return alert; + } + + Widget createDialogList() { + return Container( + height: MediaQuery.of(context).size.height * 0.5, + child: SingleChildScrollView( + child: Column( + children: [ + ...widget.list + .map((item) => RadioListTile( + title: Text(item.nameEn.toString()), + groupValue: widget.selectedValue.id.toString(), + value: item.id.toString(), + activeColor: Colors.blue.shade700, + selected: item.id.toString() == widget.selectedValue.id.toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) + .toList() + ], + ), + ), + ); + } + + static closeAlertDialog(BuildContext context) { + Navigator.of(context).pop(); + } +} From 405ad731c7e643e5ee791d7dcb72b5ed2b55316d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 22 Dec 2020 19:10:26 +0200 Subject: [PATCH 12/25] history list ready --- lib/core/service/SOAP_service.dart | 53 ++- lib/core/viewModel/SOAP_view_model.dart | 17 +- .../SOAP/subjective/add_allergies_widget.dart | 4 +- .../SOAP/subjective/add_history_widget.dart | 445 +++++++++--------- 4 files changed, 275 insertions(+), 244 deletions(-) diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index de729be3..1f28e714 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -4,12 +4,30 @@ import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; -class SOAPService extends BaseService { +class SOAPService extends BaseService { List get listOfAllergies => _listOfAllergies; - List get allergySeverityList => _allergySeverityList; List _listOfAllergies = []; + + List get allergySeverityList => _allergySeverityList; List _allergySeverityList = []; + List get historyFamilyList => _historyFamilyList; + List _historyFamilyList = []; + + List get historyMedicalList => _historyMedicalList; + List _historyMedicalList = []; + + List get historySportList => _historySportList; + List _historySportList = []; + + List get historySocialList => _historySocialList; + List _historySocialList = []; + + List get historySurgicalList => _historySurgicalList; + List _historySurgicalList = []; + + + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( GET_ALLERGIES, @@ -51,19 +69,38 @@ class SOAPService extends BaseService { }); break; case MasterKeysService.HistoryFamily: - return 36; + _historyFamilyList.clear(); + entryList.forEach((v) { + _historyFamilyList + .add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.HistoryMedical: - return 37; + _historyMedicalList.clear(); + entryList.forEach((v) { + _historyMedicalList + .add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.HistorySocial: - return 38; + historySocialList.clear(); + entryList.forEach((v) { + historySocialList + .add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.HistorySports: - return 39; - break; + _historySportList.clear(); + entryList.forEach((v) { + _historySportList + .add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.HistorySurgical: - return 66; + _historySurgicalList.clear(); + entryList.forEach((v) { + _historySurgicalList + .add(MasterKeyModel.fromJson(v)); + }); break; case MasterKeysService.PhysicalExamination: return 59; diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index b48bfcba..1fd239b9 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -12,7 +12,22 @@ class SOAPViewModel extends BaseViewModel { SOAPService _SOAPService = locator(); List get listOfAllergies => _SOAPService.listOfAllergies; - List get allergySeverityList => _SOAPService.allergySeverityList; + + List get allergySeverityList => + _SOAPService.allergySeverityList; + + + List get historyFamilyList => _SOAPService.historyFamilyList; + + List get historyMedicalList => _SOAPService.historyMedicalList; + + List get historySportList => _SOAPService.historySportList; + + List get historySocialList => _SOAPService.historySocialList; + List get historySurgicalList => _SOAPService.historySurgicalList; + List get mergeHistorySurgicalWithHistorySportList => [...historySurgicalList,...historySportList]; + + Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { setState(ViewState.Busy); diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index 9dda8c00..d3260776 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -168,10 +168,10 @@ class _AddAllergiesState extends State { heightFactor: 0.7, child: BaseView( onModelReady: (model) async { - if (model.listOfAllergies == null) { + if (model.listOfAllergies.length == 0) { await model.getMasterLookup(MasterKeysService.Allergies); } - if (model.allergySeverityList == null) { + if (model.allergySeverityList.length == 0) { await model.getMasterLookup(MasterKeysService.AllergySeverity); } }, diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart index b83f5f16..085fa68d 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart @@ -116,7 +116,7 @@ class _AddHistoryWidgetState extends State isScrollControlled: true, context: context, builder: (context) { - return AddHistoryDialog(); + return AddHistoryDialog(changePageViewIndex:changePageViewIndex, controller: _controller,); }); } } @@ -218,11 +218,8 @@ class _AddHistoryDialogState extends State { heightFactor: 0.7, child: BaseView( onModelReady: (model) async { - // if (model.listOfAllergies == null) { - await model.getMasterLookup(MasterKeysService.Allergies); - // } - if (model.allergySeverityList == null) { - await model.getMasterLookup(MasterKeysService.AllergySeverity); + if (model.historyFamilyList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistoryFamily); } }, builder: (_, model, w) => AppScaffold( @@ -237,8 +234,19 @@ class _AddHistoryDialogState extends State { SizedBox( height: 10, ), - PriorityBar(onTap: (activePriority) { + PriorityBar(onTap: (activePriority) async { widget.changePageViewIndex(activePriority); + if(activePriority ==1) { + if (model.historySurgicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistorySurgical); + await model.getMasterLookup(MasterKeysService.HistorySports); + } + } + if(activePriority ==2) { + if (model.historyMedicalList.length == 0) { + await model.getMasterLookup(MasterKeysService.HistoryMedical); + } + } }), SizedBox( height: 20, @@ -254,240 +262,211 @@ class _AddHistoryDialogState extends State { }, scrollDirection: Axis.horizontal, children: [ - Column( - children: [ - NetworkBaseView( - baseViewModel: model, - child: Container( - height: - MediaQuery.of(context).size.height * 0.5, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white), - child: ListView( - children: [ - Column( - children: [ - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), - ), - ), - ], - ), - DividerWithSpacesAround(), - Row( - children: [ - Checkbox( - value: true, - activeColor: - Colors.red[800], - onChanged: (bool newValue) { - setState(() {}); - }), - Expanded( - child: Padding( - padding: const EdgeInsets - .symmetric( - horizontal: 10, - vertical: 0), - child: Texts('History', - variant: "bodyText", - bold: true, - color: Colors.black), + Container( + child: Column( + children: [ + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: model.historyFamilyList + .map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: + (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts( + historyInfo.nameEn, + variant: "bodyText", + bold: true, + color: + Colors.black), + ), + ), + ], ), - ), - ], - ), - DividerWithSpacesAround(), - ], - ), - ], - ), - )), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), ), - ), - SizedBox( - height: 10, - ), - if (model.state == ViewState.Idle) - AppButton( - title: "Add SELECTED HISTORIES".toUpperCase(), - onPressed: () {}, + SizedBox( + height: 10, ), - ], + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED HISTORIES".toUpperCase(), + onPressed: () {}, + ), + ], + ), ), Container( - child: Center( - child: Texts("eee"), + child: Column( + children: [ + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: model.mergeHistorySurgicalWithHistorySportList + .map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: + (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts( + historyInfo.nameEn, + variant: "bodyText", + bold: true, + color: + Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED HISTORIES".toUpperCase(), + onPressed: () {}, + ), + ], ), ), Container( - child: Center( - child: Texts("cccc"), + child: Column( + children: [ + NetworkBaseView( + baseViewModel: model, + child: Container( + height: + MediaQuery.of(context).size.height * 0.5, + child: Center( + child: Container( + margin: EdgeInsets.only(top: 15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: ListView( + children: [ + Column( + children: model.historyMedicalList + .map((historyInfo) { + return Column( + children: [ + Row( + children: [ + Checkbox( + value: true, + activeColor: + Colors.red[800], + onChanged: + (bool newValue) { + setState(() {}); + }), + Expanded( + child: Padding( + padding: + const EdgeInsets + .symmetric( + horizontal: 10, + vertical: 0), + child: Texts( + historyInfo.nameEn, + variant: "bodyText", + bold: true, + color: + Colors.black), + ), + ), + ], + ), + DividerWithSpacesAround(), + ], + ); + }).toList(), + ), + ], + ), + )), + ), + ), + SizedBox( + height: 10, + ), + if (model.state == ViewState.Idle) + AppButton( + title: "Add SELECTED HISTORIES".toUpperCase(), + onPressed: () {}, + ), + ], ), ), ], From 52554d1aef9ead047f2694c0d228339d75c567ac Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 23 Dec 2020 15:16:54 +0200 Subject: [PATCH 13/25] add and remove allergy --- .../SOAP/subjective/add_allergies_widget.dart | 55 ++--- .../SOAP/subjective/add_history_widget.dart | 194 +++++++++++++----- .../SOAP/subjective/subjective_page.dart | 9 +- 3 files changed, 181 insertions(+), 77 deletions(-) diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index d3260776..eaa3889d 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -25,7 +25,6 @@ class AddAllergiesWidget extends StatefulWidget { } class _AddAllergiesWidgetState extends State { - List myAllergiesList; TextEditingController remarkController = TextEditingController(); @@ -73,35 +72,45 @@ class _AddAllergiesWidgetState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Texts(selectedAllergy.selectedAllergy.nameEn + Texts(selectedAllergy.selectedAllergy.nameEn.toUpperCase(), + variant: "bodyText", bold: true, color: Colors.black), + Texts( + selectedAllergy.selectedAllergySeverity.nameEn .toUpperCase(), - variant: "bodyText", - bold: true, - color: Colors.black), - Texts(selectedAllergy.selectedAllergySeverity.nameEn - .toUpperCase(), - variant: "bodyText", - bold: true, - color: AppGlobal.appPrimaryColor), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), SizedBox( - height: 20, - ), + variant: "bodyText", + bold: true, + color: AppGlobal.appPrimaryColor), + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeAllergy(selectedAllergy), + ) ], - ); - }).toList() - - ), + ), + SizedBox( + height: 10, + ), + ], + ); + }).toList()), ) ], ); } + removeAllergy(MySelectedAllergy mySelectedAllergy) { + Iterable allergy = + widget.myAllergiesList.where((element) => mySelectedAllergy == element); + + if (allergy.length > 0) + setState(() { + widget.myAllergiesList.remove(allergy.first); + }); + } + openAllergiesList(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart index 085fa68d..1907453d 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_history_widget.dart @@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -16,6 +17,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; class AddHistoryWidget extends StatefulWidget { + final List myHistoryList; + + const AddHistoryWidget({Key key, this.myHistoryList}) : super(key: key); + @override _AddHistoryWidgetState createState() => _AddHistoryWidgetState(); } @@ -69,54 +74,63 @@ class _AddHistoryWidgetState extends State margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Texts('Abdomen Pain', - variant: "bodyText", - bold: true, - color: Colors.black), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) - ], - ), - SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, + children: widget.myHistoryList.map((myHistory) { + return Column( children: [ - Texts('Back Pain', - variant: "bodyText", - bold: true, - color: Colors.black), - Icon( - FontAwesomeIcons.trash, - color: Colors.grey, - size: 20, - ) + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(myHistory.nameEn, + variant: "bodyText", bold: true, color: Colors.black), + InkWell( + child: Icon( + FontAwesomeIcons.trash, + color: Colors.grey, + size: 20, + ), + onTap: () => removeHistory(myHistory), + ) + ], + ), + SizedBox( + height: 20, + ), ], - ), - ], + ); + }).toList(), ), ) ], ); } + removeHistory(MasterKeyModel masterKey) { + Iterable history = widget.myHistoryList.where((element) => + masterKey.id == element.id && masterKey.typeId == element.typeId); + + if (history.length > 0) + setState(() { + widget.myHistoryList.remove(history.first); + }); + } + openHistoryList(BuildContext context) { showModalBottomSheet( backgroundColor: Colors.white, isScrollControlled: true, context: context, builder: (context) { - return AddHistoryDialog(changePageViewIndex:changePageViewIndex, controller: _controller,); + return AddHistoryDialog( + changePageViewIndex: changePageViewIndex, + controller: _controller, + myHistoryList: widget.myHistoryList, + addSelectedHistories: () { + setState(() { + Navigator.of(context).pop(); + }); + }, + removeHistory: (masterKey) => removeHistory(masterKey), + ); }); } } @@ -203,8 +217,12 @@ class _PriorityBarState extends State { class AddHistoryDialog extends StatefulWidget { final Function changePageViewIndex; final PageController controller; + final List myHistoryList; + final Function addSelectedHistories; + final Function (MasterKeyModel) removeHistory; - const AddHistoryDialog({Key key, this.changePageViewIndex, this.controller}) + const AddHistoryDialog( + {Key key, this.changePageViewIndex, this.controller, this.myHistoryList, this.addSelectedHistories, this.removeHistory}) : super(key: key); @override @@ -286,12 +304,28 @@ class _AddHistoryDialogState extends State { Row( children: [ Checkbox( - value: true, + value: isServiceSelected( + historyInfo), activeColor: - Colors.red[800], + Colors.red[800], onChanged: (bool newValue) { - setState(() {}); + setState(() { + if (isServiceSelected( + historyInfo + )) { + widget + .removeHistory( + historyInfo + ); + } + else { + widget + .myHistoryList + .add( + historyInfo); + } + }); }), Expanded( child: Padding( @@ -325,8 +359,11 @@ class _AddHistoryDialogState extends State { ), if (model.state == ViewState.Idle) AppButton( - title: "Add SELECTED HISTORIES".toUpperCase(), - onPressed: () {}, + title: "Add SELECTED HISTORIES" + .toUpperCase(), + onPressed: () { + widget.addSelectedHistories(); + }, ), ], ), @@ -355,12 +392,29 @@ class _AddHistoryDialogState extends State { Row( children: [ Checkbox( - value: true, + value: isServiceSelected( + historyInfo), activeColor: Colors.red[800], onChanged: - (bool newValue) { - setState(() {}); + ( + bool newValue) { + setState(() { + if (isServiceSelected( + historyInfo + )) { + widget + .removeHistory( + historyInfo + ); + } + else { + widget + .myHistoryList + .add( + historyInfo); + } + }); }), Expanded( child: Padding( @@ -394,8 +448,11 @@ class _AddHistoryDialogState extends State { ), if (model.state == ViewState.Idle) AppButton( - title: "Add SELECTED HISTORIES".toUpperCase(), - onPressed: () {}, + title: "Add SELECTED HISTORIES" + .toUpperCase(), + onPressed: () { + widget.addSelectedHistories(); + }, ), ], ), @@ -424,12 +481,29 @@ class _AddHistoryDialogState extends State { Row( children: [ Checkbox( - value: true, + value: isServiceSelected( + historyInfo), activeColor: Colors.red[800], onChanged: - (bool newValue) { - setState(() {}); + ( + bool newValue) { + setState(() { + if (isServiceSelected( + historyInfo + )) { + widget + .removeHistory( + historyInfo + ); + } + else { + widget + .myHistoryList + .add( + historyInfo); + } + }); }), Expanded( child: Padding( @@ -463,8 +537,13 @@ class _AddHistoryDialogState extends State { ), if (model.state == ViewState.Idle) AppButton( - title: "Add SELECTED HISTORIES".toUpperCase(), - onPressed: () {}, + title: "Add SELECTED HISTORIES" + .toUpperCase(), + onPressed: () { + setState(() { + widget.addSelectedHistories(); + }); + }, ), ], ), @@ -474,9 +553,22 @@ class _AddHistoryDialogState extends State { ), ], ), - )), + )), ), ), )); } + + isServiceSelected(MasterKeyModel masterKey) { + Iterable history = + widget + .myHistoryList + .where((element) => + masterKey.id == element.id && masterKey.typeId == element.typeId); + if (history.length > 0) { + return true; + } + return false; + } + } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index 74d2aa43..bfea6d35 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -30,6 +31,7 @@ class _SubjectivePageState extends State { bool isHistoryExpand = false; bool isAllergiesExpand = false; List myAllergiesList = List(); + List myHistoryList = List(); TextEditingController messageController = TextEditingController(); @override @@ -143,7 +145,7 @@ class _SubjectivePageState extends State { children: [ Row( children: [ - Texts('History', + Texts('History'.toUpperCase(), variant: isHistoryExpand ? "bodyText" : '', bold: isHistoryExpand ? true : false, color: Colors.black), @@ -167,7 +169,7 @@ class _SubjectivePageState extends State { ), bodyWidget: Column( children: [ - AddHistoryWidget() + AddHistoryWidget(myHistoryList: myHistoryList) ], ), isExpand: isHistoryExpand, @@ -189,7 +191,7 @@ class _SubjectivePageState extends State { children: [ Row( children: [ - Texts('Allergies', + Texts('Allergies'.toUpperCase(), variant: isAllergiesExpand ? "bodyText" : '', bold: isAllergiesExpand ? true : false, color: Colors.black), @@ -238,6 +240,7 @@ class _SubjectivePageState extends State { .of(context) .next, onPressed: () { + print( myHistoryList.toString()); widget.changePageViewIndex(1); }, ), From a3dff8c9f8ceb0b2fda9f32e6e56abd8c437f0b5 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 23 Dec 2020 17:35:30 +0200 Subject: [PATCH 14/25] Post Allergies service --- lib/config/config.dart | 1 + lib/core/service/SOAP_service.dart | 12 +++ lib/core/viewModel/SOAP_view_model.dart | 13 +++ .../SOAP/post_allergy_request_model.dart | 93 +++++++++++++++++++ .../patients/profile/SOAP/add_SOAP_index.dart | 9 +- .../SOAP/subjective/add_allergies_widget.dart | 6 +- .../SOAP/subjective/subjective_page.dart | 72 +++++++++++--- 7 files changed, 186 insertions(+), 20 deletions(-) create mode 100644 lib/models/SOAP/post_allergy_request_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 817925f5..783cf811 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -85,6 +85,7 @@ const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; const GET_ALLERGIES = 'Services/DoctorApplication.svc/REST/GetAllergies'; const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; +const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; var selectedPatientType = 1; diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 1f28e714..88d44e5a 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; class SOAPService extends BaseService { List get listOfAllergies => _listOfAllergies; @@ -59,6 +60,17 @@ class SOAPService extends BaseService { }, body: body); } + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + + await baseAppClient.post(POST_ALLERGY, + onSuccess: (dynamic response, int statusCode) { + print("Success"); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: postAllergyRequestModel.toJson()); + } + setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { switch (masterKeys) { case MasterKeysService.Allergies: diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 1fd239b9..608b2e3d 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/service/SOAP_service.dart'; import 'package:doctor_app_flutter/models/SOAP/Allergy_model.dart'; import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -48,4 +49,16 @@ class SOAPViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { + setState(ViewState.BusyLocal); + await _SOAPService.postAllergy(postAllergyRequestModel); + if (_SOAPService.hasError) { + error = _SOAPService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + } diff --git a/lib/models/SOAP/post_allergy_request_model.dart b/lib/models/SOAP/post_allergy_request_model.dart new file mode 100644 index 00000000..6783d885 --- /dev/null +++ b/lib/models/SOAP/post_allergy_request_model.dart @@ -0,0 +1,93 @@ +class PostAllergyRequestModel { + List + listHisProgNotePatientAllergyDiseaseVM; + + PostAllergyRequestModel({this.listHisProgNotePatientAllergyDiseaseVM}); + + PostAllergyRequestModel.fromJson(Map json) { + if (json['listHisProgNotePatientAllergyDiseaseVM'] != null) { + listHisProgNotePatientAllergyDiseaseVM = + new List(); + json['listHisProgNotePatientAllergyDiseaseVM'].forEach((v) { + listHisProgNotePatientAllergyDiseaseVM + .add(new ListHisProgNotePatientAllergyDiseaseVM.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.listHisProgNotePatientAllergyDiseaseVM != null) { + data['listHisProgNotePatientAllergyDiseaseVM'] = this + .listHisProgNotePatientAllergyDiseaseVM + .map((v) => v.toJson()) + .toList(); + } + return data; + } +} + +class ListHisProgNotePatientAllergyDiseaseVM { + int patientMRN; + int allergyDiseaseType; + int allergyDiseaseId; + int episodeId; + int appointmentNo; + int severity; + bool isChecked; + bool isUpdatedByNurse; + String remarks; + int createdBy; + String createdOn; + int editedBy; + String editedOn; + + ListHisProgNotePatientAllergyDiseaseVM( + {this.patientMRN, + this.allergyDiseaseType, + this.allergyDiseaseId, + this.episodeId, + this.appointmentNo, + this.severity, + this.isChecked, + this.isUpdatedByNurse, + this.remarks, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + ListHisProgNotePatientAllergyDiseaseVM.fromJson(Map json) { + patientMRN = json['patientMRN']; + allergyDiseaseType = json['allergyDiseaseType']; + allergyDiseaseId = json['allergyDiseaseId']; + episodeId = json['episodeId']; + appointmentNo = json['appointmentNo']; + severity = json['severity']; + isChecked = json['isChecked']; + isUpdatedByNurse = json['isUpdatedByNurse']; + remarks = json['remarks']; + createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedBy = json['editedBy']; + editedOn = json['editedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['patientMRN'] = this.patientMRN; + data['allergyDiseaseType'] = this.allergyDiseaseType; + data['allergyDiseaseId'] = this.allergyDiseaseId; + data['episodeId'] = this.episodeId; + data['appointmentNo'] = this.appointmentNo; + data['severity'] = this.severity; + data['isChecked'] = this.isChecked; + data['isUpdatedByNurse'] = this.isUpdatedByNurse; + data['remarks'] = this.remarks; + data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedBy'] = this.editedBy; + data['editedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart index 2018a582..9d75b22c 100644 --- a/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart +++ b/lib/widgets/patients/profile/SOAP/add_SOAP_index.dart @@ -1,5 +1,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; +import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -26,7 +28,8 @@ class _AddSOAPIndexState extends State with TickerProviderStateMixin { PageController _controller; int _currentIndex = 0; - + List myAllergiesList= List(); + List myHistoryList = List(); changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); } @@ -60,7 +63,7 @@ class _AddSOAPIndexState extends State padding: const EdgeInsets.all(8.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, - children: [ + children: [ AvatarWidget( Icon( patient.genderDescription == "Male" @@ -149,7 +152,7 @@ class _AddSOAPIndexState extends State }, scrollDirection: Axis.horizontal, children: [ - SubjectivePage(changePageViewIndex: changePageViewIndex,), + SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,), ObjectivePage(changePageViewIndex: changePageViewIndex,), AssessmentPage(changePageViewIndex: changePageViewIndex,), PlanPage(changePageViewIndex: changePageViewIndex,) diff --git a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart index eaa3889d..7f764a0d 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart @@ -119,8 +119,10 @@ class _AddAllergiesWidgetState extends State { builder: (context) { return AddAllergies( addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { - widget.myAllergiesList.add(mySelectedAllergy); - Navigator.of(context).pop(); + setState(() { + widget.myAllergiesList.add(mySelectedAllergy); + Navigator.of(context).pop(); + }); },); }); } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index bfea6d35..86a17e89 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -1,8 +1,8 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; +import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/SOAP/subjective/add_allergies_widget.dart'; @@ -19,8 +19,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class SubjectivePage extends StatefulWidget { final Function changePageViewIndex; + final List myAllergiesList; + final List myHistoryList ; - SubjectivePage({Key key, this.changePageViewIndex}); + SubjectivePage({Key key, this.changePageViewIndex, this.myAllergiesList, this.myHistoryList}); @override _SubjectivePageState createState() => _SubjectivePageState(); @@ -30,9 +32,9 @@ class _SubjectivePageState extends State { bool isChiefExpand = false; bool isHistoryExpand = false; bool isAllergiesExpand = false; - List myAllergiesList = List(); List myHistoryList = List(); - TextEditingController messageController = TextEditingController(); + TextEditingController illnessController = TextEditingController(); + TextEditingController complaintsController = TextEditingController(); @override Widget build(BuildContext context) { @@ -92,10 +94,12 @@ class _SubjectivePageState extends State { fontWeight: FontWeight.w600, maxLines: 25, minLines: 13, - controller: messageController, + controller: complaintsController, validator: (value) { if (value == null) - return TranslationBase.of(context).emptyMessage; + return TranslationBase + .of(context) + .emptyMessage; else return null; }), @@ -112,10 +116,12 @@ class _SubjectivePageState extends State { fontWeight: FontWeight.w600, maxLines: 25, minLines: 13, - controller: messageController, + controller: illnessController, validator: (value) { if (value == null) - return TranslationBase.of(context).emptyMessage; + return TranslationBase + .of(context) + .emptyMessage; else return null; }), @@ -215,7 +221,7 @@ class _SubjectivePageState extends State { ), bodyWidget:Column( children: [ - AddAllergiesWidget(myAllergiesList: myAllergiesList,), + AddAllergiesWidget(myAllergiesList: widget.myAllergiesList,), SizedBox( height: 30, ), @@ -239,16 +245,52 @@ class _SubjectivePageState extends State { title: TranslationBase .of(context) .next, - onPressed: () { - print( myHistoryList.toString()); - widget.changePageViewIndex(1); + + onPressed: () async { + addSubjectiveInfo(model: model, + myAllergiesList: widget.myAllergiesList, + myHistoryList: myHistoryList); + }, ), - ], - ), - ), + ], ), + ), + ), ),),); } + addSubjectiveInfo( + {SOAPViewModel model, List myAllergiesList, List< + MasterKeyModel> myHistoryList }) async { + PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel(); + widget.myAllergiesList.forEach((allergy) { + if(postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM ==null) + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; + postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add( + ListHisProgNotePatientAllergyDiseaseVM( + allergyDiseaseId: allergy.selectedAllergy.id, + allergyDiseaseType: allergy.selectedAllergy.typeId, + patientMRN: 2500477, + episodeId: 200011502, + appointmentNo: 2016053271, + severity: allergy.selectedAllergySeverity.id, + remarks: allergy.remark, + createdBy: 1485, + createdOn: "2020-08-14T20:37:22.780Z", + editedBy: 1485, + editedOn: "2020-08-14T20:37:22.780Z", + isChecked: false, + isUpdatedByNurse: false + )); + }); + await model.postAllergy(postAllergyRequestModel); + + + widget.changePageViewIndex(1); + + print(postAllergyRequestModel); + + } + } From 7cefbb4dbd249ff4d039f77e39d7ccfe12f1cfdd Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 23 Dec 2020 18:36:29 +0200 Subject: [PATCH 15/25] add referral pages --- lib/client/base_app_client.dart | 11 +- lib/config/config.dart | 6 + lib/config/localized_values.dart | 16 + lib/core/service/base/base_service.dart | 55 ++- .../patient-doctor-referral-service.dart | 145 ++++++ lib/core/service/patient_service.dart | 3 +- .../service/referral_patient_service.dart | 1 + .../service/referred_patient_service.dart | 3 +- lib/core/viewModel/base_view_model.dart | 22 + .../patient-doctor-referral-viewModel.dart | 117 +++++ lib/core/viewModel/patient_view_model.dart | 18 +- lib/locator.dart | 4 + lib/main.dart | 2 +- lib/models/patient/PatientArrivalEntity.dart | 84 ++++ .../patient/my_referral/PendingReferral.dart | 119 +++++ .../my_referred_patient_model.dart | 2 + lib/routes.dart | 6 + lib/screens/dashboard_screen.dart | 399 ++++++---------- lib/screens/patients/patients_screen.dart | 1 + .../referral/my-referral-detail-screen.dart | 147 ++++++ .../referral/my-referral-patient-screen.dart | 98 ++++ .../referral/refer-patient-screen.dart | 445 ++++++++++++++++++ .../referral/referred-patient-screen.dart | 74 +++ lib/util/dr_app_toast_msg.dart | 2 +- lib/util/translations_delegate_base.dart | 16 + .../patient-referral-item-widget.dart | 143 ++++++ .../profile/PatientProfileButton.dart | 86 ++++ .../profile/profile-welcome-widget.dart | 86 ++++ .../profile/profile_medical_info_widget.dart | 91 +--- lib/widgets/shared/borderedButton.dart | 83 ++++ 30 files changed, 1914 insertions(+), 371 deletions(-) create mode 100644 lib/core/service/patient-doctor-referral-service.dart create mode 100644 lib/core/viewModel/patient-doctor-referral-viewModel.dart create mode 100644 lib/models/patient/PatientArrivalEntity.dart create mode 100644 lib/models/patient/my_referral/PendingReferral.dart create mode 100644 lib/screens/patients/profile/referral/my-referral-detail-screen.dart create mode 100644 lib/screens/patients/profile/referral/my-referral-patient-screen.dart create mode 100644 lib/screens/patients/profile/referral/refer-patient-screen.dart create mode 100644 lib/screens/patients/profile/referral/referred-patient-screen.dart create mode 100644 lib/widgets/patients/patient-referral-item-widget.dart create mode 100644 lib/widgets/patients/profile/PatientProfileButton.dart create mode 100644 lib/widgets/patients/profile/profile-welcome-widget.dart create mode 100644 lib/widgets/shared/borderedButton.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 454f4d04..ca1b196a 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -45,7 +45,9 @@ class BaseAppClient { body['DoctorID'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID; - body['ProjectID'] = doctorProfile?.projectID; + if(body['ProjectID'] == null){ + body['ProjectID'] = doctorProfile?.projectID; + } if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; } @@ -80,9 +82,10 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - await helpers.logout(); - - helpers.showErrorToast('Your session expired Please login agian'); + // TODO commented this and make si success just for test + // await helpers.logout(); + // helpers.showErrorToast('Your session expired Please login again'); + onSuccess(parsed, statusCode); } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { diff --git a/lib/config/config.dart b/lib/config/config.dart index 8af0a4a5..7e7e279e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -57,6 +57,9 @@ const ADD_REFERRED_DOCTOR_REMARKS = const GET_MY_REFERRED_PATIENT = 'Services/DoctorApplication.svc/REST/GtMyReferredPatient'; +const GET_PENDING_REFERRAL_PATIENT = + 'Services/DoctorApplication.svc/REST/PendingReferrals'; + const GET_DOCTOR_WORKING_HOURS_TABLE = 'Services/Doctors.svc/REST/GetDoctorWorkingHoursTable'; @@ -78,6 +81,9 @@ const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; const END_CALL_WITH_CHARGE = 'LiveCareApi/DoctorApp/CompleteCallWithCharge'; +const GET_PATIENT_ARRIVAL_LIST = + 'Services/DoctorApplication.svc/REST/PatientArrivalList'; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2b84f389..e29c3b79 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -49,6 +49,7 @@ const Map> localizedValues = { 'patientServices': {'en': 'Patient Services', 'ar': 'خدمات المرضى'}, 'searchMedicine': {'en': 'Search Medicine', 'ar': 'بحث عن الدواء'}, 'myReferralPatient': {'en': 'My Referral Patient', 'ar': 'مرضى الاحالة'}, + 'referPatient': {'en': 'Refer Patient', 'ar': 'إحالة مريض'}, 'myReferral': {'en': 'My Referral', 'ar': 'إحالة'}, 'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'}, 'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'}, @@ -277,4 +278,19 @@ const Map> localizedValues = { 'bed': {'en': 'BED:', 'ar': 'السرير'}, 'clinicSelect': {'en': "Select Clinic", 'ar': 'اختار عيادة'}, 'doctorSelect': {'en': "Select Doctor", 'ar': 'اختار طبيب'}, + 'referTo': {'en': "Refer To", 'ar': 'محال إلى'}, + 'referredFrom': {'en': "Referred From", 'ar': 'محال من'}, + 'branch': {'en': "Branch", 'ar': 'الفرع'}, + 'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'}, + 'appointmentNo': {'en': "Appointment #:", 'ar': '# الموعد:'}, + 'refer': {'en': "REFER", 'ar': 'إحالة'}, + 'approved': {'en': "Approved", 'ar': 'موافق عليه'}, + 'rejected': {'en': "Rejected", 'ar': 'مرفوض'}, + 'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'}, + 'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'}, + 'dr': {'en': "DR.", 'ar': 'د.'}, + 'previewHealth': {'en': "Preview Health", 'ar': 'معاينة الصحة'}, + 'summaryReport': {'en': "Summary Report", 'ar': 'تقرير موجز'}, + 'accept': {'en': "ACCEPT", 'ar': 'قبول'}, + 'reject': {'en': "REJECT", 'ar': 'رفض'}, }; diff --git a/lib/core/service/base/base_service.dart b/lib/core/service/base/base_service.dart index c4cb240d..1867cf99 100644 --- a/lib/core/service/base/base_service.dart +++ b/lib/core/service/base/base_service.dart @@ -1,8 +1,61 @@ import 'package:doctor_app_flutter/client/base_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/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; class BaseService { String error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); - //TODO add the user login model when we need it + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + DoctorProfileModel doctorProfile; + + List patientArrivalList = []; + +//TODO add the user login model when we need it + Future getDoctorProfile() async { + if (doctorProfile == null) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + if (doctorProfile != null) { + return doctorProfile; + } + } + return null; + } else { + return doctorProfile; + } + } + + Future getPatientArrivalList(String date) async{ + hasError = false; + Map body = Map(); + body['VidaAuthTokenID'] = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiYjVjZTZkZGEtNDA0OC00N2U4LWFhMmMtYmY5NDJiNjg0MGI0IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODU1MDQiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODU1MDE2OSwiZXhwIjoxNjA5NDE0MTY5LCJpYXQiOjE2MDg1NTAxNjl9.mBoylGXXcfoeZcf61R2m7OfjRHnt8MmzLMG74VcotQ8"; + body['From'] = date; + body['To'] = date; + body['PageIndex'] = 0; + body['PageSize'] = 0; + + await baseAppClient.post( + GET_PATIENT_ARRIVAL_LIST, + onSuccess: (dynamic response, int statusCode) { + patientArrivalList.clear(); + + response['patientArrivalList']['entityList'].forEach((v) { + PatientArrivalEntity item = PatientArrivalEntity.fromJson(v); + patientArrivalList.add(item); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + this.error = error; + }, + body: body, + ); + } + } diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart new file mode 100644 index 00000000..66db83c6 --- /dev/null +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -0,0 +1,145 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; +import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; + +class PatientReferralService extends BaseService { + List projectsList = []; + List clinicsList = []; + List doctorsList = []; + List listMyReferredPatientModel = []; + List pendingReferralList = []; + + Future getProjectsList() async { + hasError = false; + const url = GET_PROJECTS; + var info = { + "LanguageID": 1, + "stamp": "2020-02-26T13:51:44.111Z", + "IPAdress": "11.11.11.11", + "VersionID": 1.2, + "Channel": 9, + "TokenID": "", + "SessionID": "i1UJwCTSqt", + "IsLoginForDoctorApp": true + }; + dynamic localRes; + + await baseAppClient.post(url, onSuccess: (response, statusCode) async { + if (response['MessageStatus'] == 1) { + projectsList = response['ListProject']; + } else { + // handel error + projectsList = ListProject; + } + }, onFailure: (String error, int statusCode) { + projectsList = ListProject; + }, body: info); + } + + Future getClinicsList(int projectId) async { + hasError = false; + ClinicByProjectIdRequest _clinicByProjectIdRequest = + ClinicByProjectIdRequest(); + _clinicByProjectIdRequest.projectID = projectId; + + await baseAppClient.post( + PATIENT_GET_CLINIC_BY_PROJECT_URL, + onSuccess: (dynamic response, int statusCode) { + clinicsList = []; + clinicsList = response['List_Clinic_All']; + print(response['List_Clinic_All']); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _clinicByProjectIdRequest.toJson(), + ); + } + + Future getDoctorsList(String clinicId) async { + hasError = false; + DoctorsByClinicIdRequest _doctorsByClinicIdRequest = + DoctorsByClinicIdRequest(); + + _doctorsByClinicIdRequest.clinicID = clinicId; + await baseAppClient.post( + PATIENT_GET_DOCTOR_BY_CLINIC_URL, + onSuccess: (dynamic response, int statusCode) { + doctorsList = []; + doctorsList = response['List_Doctors_All']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _doctorsByClinicIdRequest.toJson(), + ); + } + + Future getMyReferredPatient() async { + hasError = false; + RequestMyReferralPatientModel _requestMyReferralPatient = + RequestMyReferralPatientModel(); + DoctorProfileModel doctorProfile = await getDoctorProfile(); + + await baseAppClient.post( + GET_MY_REFERRED_PATIENT, + onSuccess: (dynamic response, int statusCode) { + listMyReferredPatientModel.clear(); + + response['List_MyReferredPatient'].forEach((v) { + MyReferredPatientModel item = MyReferredPatientModel.fromJson(v); + if (doctorProfile != null) { + item.isReferralDoctorSameBranch = + doctorProfile.projectID == item.projectId; + } else { + item.isReferralDoctorSameBranch = false; + } + listMyReferredPatientModel.add(item); + }); + // print(response['List_MyReferredPatient']); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: _requestMyReferralPatient.toJson(), + ); + } + + Future getPendingReferralList() async { + hasError = false; + DoctorProfileModel doctorProfile = await getDoctorProfile(); + Map body = Map(); + body['ClinicID'] = 0; + body['DoctorID'] = doctorProfile.doctorID; + body['VidaAuthTokenID'] = + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiYjVjZTZkZGEtNDA0OC00N2U4LWFhMmMtYmY5NDJiNjg0MGI0IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODU1MDQiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODU1MDE2OSwiZXhwIjoxNjA5NDE0MTY5LCJpYXQiOjE2MDg1NTAxNjl9.mBoylGXXcfoeZcf61R2m7OfjRHnt8MmzLMG74VcotQ8"; + + await baseAppClient.post( + GET_PENDING_REFERRAL_PATIENT, + onSuccess: (dynamic response, int statusCode) { + pendingReferralList.clear(); + + response['PendingReferralList'].forEach((v) { + PendingReferral item = PendingReferral.fromJson(v); + item.isReferralDoctorSameBranch = + item.targetProjectId == item.sourceProjectId; + pendingReferralList.add(item); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: body, + ); + } +} diff --git a/lib/core/service/patient_service.dart b/lib/core/service/patient_service.dart index b16753f5..9aa52923 100644 --- a/lib/core/service/patient_service.dart +++ b/lib/core/service/patient_service.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/request_schedule.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart'; import 'package:doctor_app_flutter/models/patient/get_list_stp_referral_frequency_request.dart'; @@ -82,8 +83,6 @@ class PatientService extends BaseService { ClinicByProjectIdRequest(); ReferToDoctorRequest _referToDoctorRequest; - RequestSchedule _requestSchedule = RequestSchedule(); - Future getPatientList(PatientModel patient, patientType) async { hasError = false; int val = int.parse(patientType); diff --git a/lib/core/service/referral_patient_service.dart b/lib/core/service/referral_patient_service.dart index 088e40ca..e3ca6fae 100644 --- a/lib/core/service/referral_patient_service.dart +++ b/lib/core/service/referral_patient_service.dart @@ -24,6 +24,7 @@ class ReferralPatientService extends BaseService { response['List_MyReferralPatient'].forEach((v) { listMyReferralPatientModel.add(MyReferralPatientModel.fromJson(v)); }); + print(response['List_MyReferralPatient']); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/service/referred_patient_service.dart b/lib/core/service/referred_patient_service.dart index 0fb3de64..7285d904 100644 --- a/lib/core/service/referred_patient_service.dart +++ b/lib/core/service/referred_patient_service.dart @@ -11,8 +11,6 @@ class ReferredPatientService extends BaseService { List get listMyReferredPatientModel => _listMyReferredPatientModel; - Helpers helpers = Helpers(); - RequestMyReferralPatientModel _requestMyReferralPatient = RequestMyReferralPatientModel(); VerifyReferralDoctorRemarks _verifyreferraldoctorremarks = @@ -26,6 +24,7 @@ class ReferredPatientService extends BaseService { response['List_MyReferredPatient'].forEach((v) { listMyReferredPatientModel.add(MyReferredPatientModel.fromJson(v)); }); + // print(response['List_MyReferredPatient']); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/base_view_model.dart b/lib/core/viewModel/base_view_model.dart index 29acdd42..d8591660 100644 --- a/lib/core/viewModel/base_view_model.dart +++ b/lib/core/viewModel/base_view_model.dart @@ -1,17 +1,39 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/material.dart'; class BaseViewModel extends ChangeNotifier { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + DoctorProfileModel doctorProfile; + ViewState _state = ViewState.Idle; bool isInternetConnection = true; ViewState get state => _state; String error = ""; + //TODO add the user login model when we need it void setState(ViewState viewState) { _state = viewState; notifyListeners(); } + + Future getDoctorProfile() async { + if (doctorProfile == null) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + if (doctorProfile != null) { + return doctorProfile; + } + } + return null; + } else { + return doctorProfile; + } + } } diff --git a/lib/core/viewModel/patient-doctor-referral-viewModel.dart b/lib/core/viewModel/patient-doctor-referral-viewModel.dart new file mode 100644 index 00000000..bd7bc549 --- /dev/null +++ b/lib/core/viewModel/patient-doctor-referral-viewModel.dart @@ -0,0 +1,117 @@ +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/patient-doctor-referral-service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; + +import '../../locator.dart'; + +class PatientReferralViewModel extends BaseViewModel { + PatientReferralService _referralPatientService = + locator(); + + List get branchesList => _referralPatientService.projectsList; + + List get clinicsList => _referralPatientService.clinicsList; + + List get doctorsList => _referralPatientService.doctorsList; + + List get listMyReferredPatientModel => + _referralPatientService.listMyReferredPatientModel; + + List get pendingReferral => + _referralPatientService.pendingReferralList; + + List get patientArrivalList => _referralPatientService.patientArrivalList; + + Future getBranches() async { + setState(ViewState.Busy); + await _referralPatientService.getProjectsList(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getClinics(int projectId) async { + setState(ViewState.Busy); + await _referralPatientService.getClinicsList(projectId); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getClinicDoctors(String clinicId) async { + setState(ViewState.Busy); + await _referralPatientService.getDoctorsList(clinicId); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getDoctorBranch() async { + DoctorProfileModel doctorProfile = await getDoctorProfile(); + if (doctorProfile != null) { + dynamic _selectedBranch = { + "ID": doctorProfile.projectID, + "Desciption": doctorProfile.projectName + }; + return _selectedBranch; + } + return null; + } + + Future getMyReferredPatient() async { + setState(ViewState.Busy); + await _referralPatientService.getMyReferredPatient(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + MyReferredPatientModel getReferredPatientItem(int index){ + return listMyReferredPatientModel[index]; + } + + Future getPendingReferralPatients() async { + setState(ViewState.Busy); + await _referralPatientService.getPendingReferralList(); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientArrivalList(String date) async { + setState(ViewState.Busy); + await _referralPatientService.getPatientArrivalList(date); + if (_referralPatientService.hasError) { + error = _referralPatientService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + List getAppointmentsByPatientName(String patientName){ + List appointments = []; + patientArrivalList.forEach((element) { + if(element.patientName == patientName){ + appointments.add(element.toJson()); + } + }); + return appointments; + } + +} diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 6fdbde32..e03e0853 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -43,12 +43,15 @@ class PatientViewModel extends BaseViewModel { get patientProgressNoteList => _patientService.patientProgressNoteList; List get clinicsList => _patientService.clinicsList; + List get doctorsList => _patientService.doctorsList; - List get referralFrequencyList => _patientService.referalFrequancyList; + + List get referralFrequencyList => + _patientService.referalFrequancyList; Future getPatientList(PatientModel patient, patientType, {bool isBusyLocal = false}) async { - if(isBusyLocal) { + if (isBusyLocal) { setState(ViewState.BusyLocal); } else { setState(ViewState.Busy); @@ -56,11 +59,12 @@ class PatientViewModel extends BaseViewModel { return _patientService.getPatientList(patient, patientType); if (_patientService.hasError) { error = _patientService.error; - if(isBusyLocal) { + if (isBusyLocal) { setState(ViewState.ErrorLocal); } else { setState(ViewState.Error); - } } else + } + } else setState(ViewState.Idle); } @@ -183,8 +187,9 @@ class PatientViewModel extends BaseViewModel { } List getDoctorNameList() { - var doctorNamelist = - _patientService.doctorsList.map((value) => value['DoctorName'].toString()).toList(); + var doctorNamelist = _patientService.doctorsList + .map((value) => value['DoctorName'].toString()) + .toList(); return doctorNamelist; } @@ -194,6 +199,7 @@ class PatientViewModel extends BaseViewModel { .toList(); return clinicsNameslist; } + Future getReferralFrequancyList() async { setState(ViewState.Busy); await _patientService.getReferralFrequancyList(); diff --git a/lib/locator.dart b/lib/locator.dart index 550b4666..90a06bc9 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -4,11 +4,13 @@ import 'package:get_it/get_it.dart'; import 'core/service/doctor_reply_service.dart'; import 'core/service/medicine_service.dart'; +import 'core/service/patient-doctor-referral-service.dart'; import 'core/service/referral_patient_service.dart'; import 'core/service/referred_patient_service.dart'; import 'core/service/schedule_service.dart'; import 'core/viewModel/doctor_replay_view_model.dart'; import 'core/viewModel/medicine_view_model.dart'; +import 'core/viewModel/patient-doctor-referral-viewModel.dart'; import 'core/viewModel/referral_view_model.dart'; import 'core/viewModel/referred_view_model.dart'; import 'core/viewModel/schedule_view_model.dart'; @@ -24,6 +26,7 @@ void setupLocator() { locator.registerLazySingleton(() => ReferredPatientService()); locator.registerLazySingleton(() => MedicineService()); locator.registerLazySingleton(() => PatientService()); + locator.registerLazySingleton(() => PatientReferralService()); /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -32,4 +35,5 @@ void setupLocator() { locator.registerFactory(() => ReferredPatientViewModel()); locator.registerFactory(() => MedicineViewModel()); locator.registerFactory(() => PatientViewModel()); + locator.registerFactory(() => PatientReferralViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index 06d0ecfa..87de7057 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -60,7 +60,7 @@ class MyApp extends StatelessWidget { buttonColor: HexColor('#B8382C'), fontFamily: 'WorkSans', dividerColor: Colors.grey[350], - backgroundColor: Color.fromRGBO(255,255,255, 1) + backgroundColor: Color.fromRGBO(255,255,255, 1), ), initialRoute: INIT_ROUTE, routes: routes, diff --git a/lib/models/patient/PatientArrivalEntity.dart b/lib/models/patient/PatientArrivalEntity.dart new file mode 100644 index 00000000..54622cd7 --- /dev/null +++ b/lib/models/patient/PatientArrivalEntity.dart @@ -0,0 +1,84 @@ +class PatientArrivalEntity { + String age; + String appointmentDate; + int appointmentNo; + String appointmentType; + String arrivedOn; + String companyName; + String endTime; + int episodeNo; + int fallRiskScore; + String gender; + int medicationOrders; + String mobileNumber; + String nationality; + int patientMRN; + String patientName; + int rowCount; + String startTime; + String visitType; + + PatientArrivalEntity( + {this.age, + this.appointmentDate, + this.appointmentNo, + this.appointmentType, + this.arrivedOn, + this.companyName, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.gender, + this.medicationOrders, + this.mobileNumber, + this.nationality, + this.patientMRN, + this.patientName, + this.rowCount, + this.startTime, + this.visitType}); + + PatientArrivalEntity.fromJson(Map json) { + age = json['age']; + appointmentDate = json['appointmentDate']; + appointmentNo = json['appointmentNo']; + appointmentType = json['appointmentType']; + arrivedOn = json['arrivedOn']; + companyName = json['companyName']; + endTime = json['endTime']; + episodeNo = json['episodeNo']; + fallRiskScore = json['fallRiskScore']; + gender = json['gender']; + medicationOrders = json['medicationOrders']; + mobileNumber = json['mobileNumber']; + nationality = json['nationality']; + patientMRN = json['patientMRN']; + patientName = json['patientName']; + rowCount = json['rowCount']; + startTime = json['startTime']; + visitType = json['visitType']; + } + + Map toJson() { + final Map data = new Map(); + data['age'] = this.age; + data['appointmentDate'] = this.appointmentDate; + data['appointmentNo'] = this.appointmentNo; + data['appointmentType'] = this.appointmentType; + data['arrivedOn'] = this.arrivedOn; + data['companyName'] = this.companyName; + data['endTime'] = this.endTime; + data['episodeNo'] = this.episodeNo; + data['fallRiskScore'] = this.fallRiskScore; + data['gender'] = this.gender; + data['medicationOrders'] = this.medicationOrders; + data['mobileNumber'] = this.mobileNumber; + data['nationality'] = this.nationality; + data['patientMRN'] = this.patientMRN; + data['patientName'] = this.patientName; + data['rowCount'] = this.rowCount; + data['startTime'] = this.startTime; + data['visitType'] = this.visitType; + return data; + } +} \ No newline at end of file diff --git a/lib/models/patient/my_referral/PendingReferral.dart b/lib/models/patient/my_referral/PendingReferral.dart new file mode 100644 index 00000000..9da17985 --- /dev/null +++ b/lib/models/patient/my_referral/PendingReferral.dart @@ -0,0 +1,119 @@ +class PendingReferral { + String responded; + String answerFromTarget; + String createdOn; + int data; + String editedOn; + int interBranchReferral; + int patientID; + String patientName; + int patientType; + int referralNo; + String referralStatus; + String referredByDoctorInfo; + String referredFromBranchName; + String referredOn; + String referredType; + String remarksFromSource; + String respondedOn; + int sourceAppointmentNo; + int sourceProjectId; + String sourceSetupID; + String startDate; + int targetAppointmentNo; + String targetClinicID; + String targetDoctorID; + int targetProjectId; + String targetSetupID; + bool isReferralDoctorSameBranch; + + PendingReferral( + {this.responded, + this.answerFromTarget, + this.createdOn, + this.data, + this.editedOn, + this.interBranchReferral, + this.patientID, + this.patientName, + this.patientType, + this.referralNo, + this.referralStatus, + this.referredByDoctorInfo, + this.referredFromBranchName, + this.referredOn, + this.referredType, + this.remarksFromSource, + this.respondedOn, + this.sourceAppointmentNo, + this.sourceProjectId, + this.sourceSetupID, + this.startDate, + this.targetAppointmentNo, + this.targetClinicID, + this.targetDoctorID, + this.targetProjectId, + this.targetSetupID, + this.isReferralDoctorSameBranch, + }); + + PendingReferral.fromJson(Map json) { + responded = json['Responded']; + answerFromTarget = json['answerFromTarget']; + createdOn = json['createdOn']; + data = json['data']; + editedOn = json['editedOn']; + interBranchReferral = json['interBranchReferral']; + patientID = json['patientID']; + patientName = json['patientName']; + patientType = json['patientType']; + referralNo = json['referralNo']; + referralStatus = json['referralStatus']; + referredByDoctorInfo = json['referredByDoctorInfo']; + referredFromBranchName = json['referredFromBranchName']; + referredOn = json['referredOn']; + referredType = json['referredType']; + remarksFromSource = json['remarksFromSource']; + respondedOn = json['respondedOn']; + sourceAppointmentNo = json['sourceAppointmentNo']; + sourceProjectId = json['sourceProjectId']; + sourceSetupID = json['sourceSetupID']; + startDate = json['startDate']; + targetAppointmentNo = json['targetAppointmentNo']; + targetClinicID = json['targetClinicID']; + targetDoctorID = json['targetDoctorID']; + targetProjectId = json['targetProjectId']; + targetSetupID = json['targetSetupID']; + } + + Map toJson() { + final Map data = new Map(); + data['Responded'] = this.responded; + data['answerFromTarget'] = this.answerFromTarget; + data['createdOn'] = this.createdOn; + data['data'] = this.data; + data['editedOn'] = this.editedOn; + data['interBranchReferral'] = this.interBranchReferral; + data['patientID'] = this.patientID; + data['patientName'] = this.patientName; + data['patientType'] = this.patientType; + data['referralNo'] = this.referralNo; + data['referralStatus'] = this.referralStatus; + data['referredByDoctorInfo'] = this.referredByDoctorInfo; + data['referredFromBranchName'] = this.referredFromBranchName; + data['referredOn'] = this.referredOn; + data['referredType'] = this.referredType; + data['remarksFromSource'] = this.remarksFromSource; + data['respondedOn'] = this.respondedOn; + data['sourceAppointmentNo'] = this.sourceAppointmentNo; + data['sourceProjectId'] = this.sourceProjectId; + data['sourceSetupID'] = this.sourceSetupID; + data['startDate'] = this.startDate; + data['targetAppointmentNo'] = this.targetAppointmentNo; + data['targetClinicID'] = this.targetClinicID; + data['targetDoctorID'] = this.targetDoctorID; + data['targetProjectId'] = this.targetProjectId; + data['targetSetupID'] = this.targetSetupID; + return data; + } +} \ No newline at end of file diff --git a/lib/models/patient/my_referral/my_referred_patient_model.dart b/lib/models/patient/my_referral/my_referred_patient_model.dart index 9ecfdb2f..850c29cb 100644 --- a/lib/models/patient/my_referral/my_referred_patient_model.dart +++ b/lib/models/patient/my_referral/my_referred_patient_model.dart @@ -59,6 +59,7 @@ class MyReferredPatientModel { this.priorityDescription, this.referralClinicDescription, this.referralDoctorName, + this.isReferralDoctorSameBranch, }); int projectId; @@ -111,6 +112,7 @@ class MyReferredPatientModel { String priorityDescription; String referralClinicDescription; String referralDoctorName; + bool isReferralDoctorSameBranch; factory MyReferredPatientModel.fromJson(Map json) => MyReferredPatientModel( projectId: json["ProjectID"], diff --git a/lib/routes.dart b/lib/routes.dart index dff02129..4c9e53a3 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -37,6 +37,8 @@ import './screens/settings/settings_screen.dart'; import 'landing_page.dart'; import 'screens/doctor/doctor_reply_screen.dart'; import 'screens/live_care/panding_list.dart'; +import 'screens/patients/profile/referral/my-referral-detail-screen.dart'; +import 'screens/patients/profile/referral/refer-patient-screen.dart'; const String INIT_ROUTE = ROOT; const String ROOT = 'root'; @@ -65,6 +67,8 @@ const String PRESCRIPTIONS = 'patients/prescription'; const String RADIOLOGY = 'patients/radiology'; const String PROGRESS_NOTE = 'patients/progress-note'; const String REFER_PATIENT = 'patients/refer-patient'; +const String MY_REFERRAL_DETAIL = 'my_referral_detail'; +const String REFER_PATIENT_TO_DOCTOR = 'patients/refer-to-doctor'; const String PATIENT_ORDERS = 'patients/patient_orders'; const String PATIENT_INSURANCE_APPROVALS = 'patients/patient_insurance_approvals'; @@ -102,6 +106,7 @@ var routes = { RADIOLOGY: (_) => RadiologyScreen(), PROGRESS_NOTE: (_) => ProgressNoteScreen(), REFER_PATIENT: (_) => ReferPatientScreen(), + REFER_PATIENT_TO_DOCTOR: (_) => PatientMakeReferralScreen(), PATIENT_ORDERS: (_) => PatientsOrdersScreen(), PATIENT_INSURANCE_APPROVALS: (_) => InsuranceApprovalsScreen(), VITAL_SIGN_DETAILS: (_) => VitalSignDetailsScreen(), @@ -110,4 +115,5 @@ var routes = { // VIDEO_CALL: (_) => VideoCallPage(patientData: null), LIVECARE_PENDING_LIST: (_) => LiveCarePandingListScreen(), // LIVECARE_END_DIALOG: (_) => EndCallDialogBox() + MY_REFERRAL_DETAIL: (_) => MyReferralDetailScreen(), }; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 80697352..0c1c4812 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -7,9 +7,11 @@ import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -23,6 +25,7 @@ import 'doctor/doctor_reply_screen.dart'; import 'doctor/my_referral_patient_screen.dart'; import 'doctor/my_referred_patient_screen.dart'; import 'medicine/medicine_search_screen.dart'; +import 'patients/profile/referral/referred-patient-screen.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = Helpers(); @@ -80,133 +83,56 @@ class _DashboardScreenState extends State { Stack(children: [ Column( children: [ - Container( - height: 140, - color: HexColor('#515B5D'), - width: double.infinity, - child: FractionallySizedBox( - widthFactor: 0.9, + ProfileWelcomeWidget( + InkWell( + onTap: () async { + showCupertinoPicker( + decKey: '', + context: context, + actionList: projectsProvider.doctorClinicsList); + }, child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Row( - children: [ - AppText( - TranslationBase - .of(context) - .welcome, - fontSize: SizeConfig.textMultiplier * 1.7, - color: Colors.white, - ) - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - AppText( - 'Dr. ${authProvider.doctorProfile.doctorName}', - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - color: Colors.white, - ) - ], - ), - SizedBox( - height: 4, - ), - InkWell( - onTap: () async { - showCupertinoPicker( - decKey: '', - context: context, - actionList: projectsProvider - .doctorClinicsList); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: AppText( - authProvider.selectedClinicName != - null - ? authProvider.selectedClinicName - : authProvider.doctorProfile - .clinicDescription, - fontSize: - SizeConfig.textMultiplier * 1.7, - color: Colors.white, - textAlign: TextAlign.center, - ), - alignment: projectsProvider.isArabic - ? Alignment.topRight - : Alignment.topLeft, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - - child: Container( - margin: EdgeInsets.only( - left: 5, - top: projectsProvider - .isArabic ? 0 : 5, - right: 10, - bottom: projectsProvider - .isArabic ? 15 : 7), - child: Icon( - DoctorApp.sync_icon, - - color: Colors.white, - size: SizeConfig - .textMultiplier * - 1.8, - )), - ), - ], - ), - ]), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + child: AppText( + authProvider.selectedClinicName != null + ? authProvider.selectedClinicName + : authProvider + .doctorProfile.clinicDescription, + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.white, + textAlign: TextAlign.center, ), - - ], - ), - Expanded( - child: Column( + alignment: projectsProvider.isArabic + ? Alignment.topRight + : Alignment.topLeft, + ), + Row( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - decoration: BoxDecoration( - color: Theme - .of(context) - .backgroundColor, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - ), - height: 50, - width: 60, - child: Image.network( - authProvider.doctorProfile - .doctorImageURL, -// fit: BoxFit.fill, - ), + InkWell( + child: Container( + margin: EdgeInsets.only( + left: 5, + top: projectsProvider.isArabic + ? 0 + : 5, + right: 10, + bottom: projectsProvider.isArabic + ? 15 + : 7), + child: Icon( + DoctorApp.sync_icon, + color: Colors.white, + size: SizeConfig.textMultiplier * 1.8, + )), ), ], ), - ), - ], - ), + ]), ), ), Container( @@ -246,18 +172,18 @@ class _DashboardScreenState extends State { center: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - AppText("38", - fontSize: - SizeConfig.textMultiplier * 3.7, + AppText( + "38", + fontSize: SizeConfig.textMultiplier * 3.7, color: HexColor('#5D4C35'), - fontWeight: FontWeight.bold,), - AppText(TranslationBase - .of(context) - .outPatients, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 1.4, - color: HexColor('#5D4C35'), - ), + fontWeight: FontWeight.bold, + ), + AppText( + TranslationBase.of(context).outPatients, + fontWeight: FontWeight.normal, + fontSize: SizeConfig.textMultiplier * 1.4, + color: HexColor('#5D4C35'), + ), ], ), circularStrokeCap: CircularStrokeCap.butt, @@ -418,15 +344,12 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .labResult, + TranslationBase.of(context).labResult, color: Colors.white, ) ], ), ), - ], ), imageName: '1.png', @@ -446,7 +369,6 @@ class _DashboardScreenState extends State { ), Container( margin: EdgeInsets.only(bottom: 10), - child: Column( children: [ AppText( @@ -455,15 +377,12 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .radiology, + TranslationBase.of(context).radiology, color: Colors.white, ) ], ), ), - ], ), imageName: '2.png', @@ -481,10 +400,8 @@ class _DashboardScreenState extends State { color: Colors.white, ), ), - Container( margin: EdgeInsets.only(bottom: 10), - child: Column( children: [ AppText( @@ -493,20 +410,16 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .referral, + TranslationBase.of(context).referral, color: Colors.white, ) ], ), ), - ], ), imageName: '3.png', opacity: 0.9, - ), ], ), @@ -522,7 +435,7 @@ class _DashboardScreenState extends State { padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, children: [ Column( children: [ @@ -542,9 +455,7 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .inPatient, + TranslationBase.of(context).inPatient, color: Colors.white, ) ], @@ -555,28 +466,18 @@ class _DashboardScreenState extends State { imageName: '4.png', color: HexColor('#B8382C'), hasBorder: false, - width: MediaQuery - .of(context) - .size - .width * 0.44, - height: MediaQuery - .of(context) - .orientation == Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * 0.13: - MediaQuery - .of(context) - .size - .height * 0.25, + width: MediaQuery.of(context).size.width * 0.44, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.13 + : MediaQuery.of(context).size.height * 0.25, ), DashboardItem( child: Padding( padding: const EdgeInsets.all(8.0), child: Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, children: [ Column( children: [ @@ -596,9 +497,7 @@ class _DashboardScreenState extends State { color: Colors.white, ), AppText( - TranslationBase - .of(context) - .operations, + TranslationBase.of(context).operations, color: Colors.white, ) ], @@ -609,21 +508,11 @@ class _DashboardScreenState extends State { imageName: '5.png', color: HexColor('#B8382C'), hasBorder: false, - width: MediaQuery - .of(context) - .size - .width * 0.44, - height: MediaQuery - .of(context) - .orientation == Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * 0.13: - MediaQuery - .of(context) - .size - .height * 0.25, + width: MediaQuery.of(context).size.width * 0.44, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.13 + : MediaQuery.of(context).size.height * 0.25, ), ], ), @@ -633,9 +522,7 @@ class _DashboardScreenState extends State { Row( children: [ AppText( - TranslationBase - .of(context) - .patientServices, + TranslationBase.of(context).patientServices, fontSize: SizeConfig.textMultiplier * 3, ), ], @@ -691,16 +578,12 @@ class _DashboardScreenState extends State { Column( children: [ AppText( - TranslationBase - .of(context) - .theDoctor, + TranslationBase.of(context).theDoctor, textAlign: TextAlign.center, color: Colors.black, ), AppText( - TranslationBase - .of(context) - .reply, + TranslationBase.of(context).reply, textAlign: TextAlign.center, color: Colors.black, ), @@ -713,8 +596,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - DoctorReplyScreen(), + builder: (context) => DoctorReplyScreen(), ), ); }, @@ -729,9 +611,7 @@ class _DashboardScreenState extends State { color: Colors.black, ), AppText( - TranslationBase - .of(context) - .searchMedicine, + TranslationBase.of(context).searchMedicine, color: Colors.black, textAlign: TextAlign.center, ) @@ -742,8 +622,7 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - MedicineSearchScreen(), + builder: (context) => MedicineSearchScreen(), ), ); }, @@ -777,12 +656,8 @@ class _DashboardScreenState extends State { ), AppText( projectsProvider.isArabic - ? TranslationBase - .of(context) - .qr - : TranslationBase - .of(context) - .reader, + ? TranslationBase.of(context).qr + : TranslationBase.of(context).reader, color: Colors.black, textAlign: TextAlign.center, ), @@ -806,9 +681,7 @@ class _DashboardScreenState extends State { color: Colors.black, ), AppText( - TranslationBase - .of(context) - .myReferralPatient, + TranslationBase.of(context).myReferralPatient, textAlign: TextAlign.center, color: Colors.black, ) @@ -820,7 +693,7 @@ class _DashboardScreenState extends State { context, MaterialPageRoute( builder: (context) => - MyReferralPatient(), + MyReferralPatientScreen(), ), ); }, @@ -835,9 +708,7 @@ class _DashboardScreenState extends State { color: Colors.black, ), AppText( - TranslationBase - .of(context) - .myReferredPatient, + TranslationBase.of(context).myReferredPatient, color: Colors.black, textAlign: TextAlign.center, ) @@ -848,8 +719,8 @@ class _DashboardScreenState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => - MyReferredPatient(), + builder: (context) => ReferredPatientScreen(), + // MyReferredPatient(), ), ); }, @@ -890,21 +761,17 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: AppText(TranslationBase - .of(context) - .cancel - // style: TextStyle(context) - ), + child: AppText(TranslationBase.of(context).cancel + // style: TextStyle(context) + ), onPressed: () { Navigator.pop(context); }, ), CupertinoButton( - child: AppText(TranslationBase - .of(context) - .done - // style: textStyle(context), - ), + child: AppText(TranslationBase.of(context).done + // style: textStyle(context), + ), onPressed: () { Navigator.pop(context); // onSelectFun(cupertinoPickerIndex); @@ -927,8 +794,7 @@ class _DashboardScreenState extends State { child: AppText( e.clinicName, fontSize: - SizeConfig.textMultiplier * - 1.9, + SizeConfig.textMultiplier * 1.9, )), ), )) @@ -969,19 +835,20 @@ class _DashboardScreenState extends State { }); } } + // TODO Move to it file class DashboardItem extends StatelessWidget { - const DashboardItem({ - this.hasBorder = false, - this.imageName, - @required this.child, - this.onTap, - Key key, - this.width, - this.height, - this.color, - this.opacity = 0.4 - }) : super(key: key); + const DashboardItem( + {this.hasBorder = false, + this.imageName, + @required this.child, + this.onTap, + Key key, + this.width, + this.height, + this.color, + this.opacity = 0.4}) + : super(key: key); final bool hasBorder; final String imageName; final Widget child; @@ -996,38 +863,34 @@ class DashboardItem extends StatelessWidget { return InkWell( onTap: onTap, child: Container( - width: width != null ? width : MediaQuery - .of(context) - .size - .width * 0.29, - height: height != null ? height : MediaQuery - .of(context) - .orientation == Orientation.portrait ? MediaQuery - .of(context) - .size - .height * 0.19 : MediaQuery - .of(context) - .size - .height * 0.35, - + width: width != null ? width : MediaQuery.of(context).size.width * 0.29, + height: height != null + ? height + : MediaQuery.of(context).orientation == Orientation.portrait + ? MediaQuery.of(context).size.height * 0.19 + : MediaQuery.of(context).size.height * 0.35, decoration: BoxDecoration( - color: !hasBorder ? color != null ? color : HexColor('#050705') - .withOpacity(opacity) : Colors - .white, + color: !hasBorder + ? color != null + ? color + : HexColor('#050705').withOpacity(opacity) + : Colors.white, borderRadius: BorderRadius.circular(6.0), - border: hasBorder ? Border.all( - width: 1.0, color: const Color(0xffcccccc)) : Border.all( - width: 0.0, color: Colors.transparent), - image: imageName != null ? DecorationImage( - image: AssetImage('assets/images/dashboard/${imageName}'), - fit: BoxFit.cover, - colorFilter: new ColorFilter.mode( - Colors.black.withOpacity(0.2), BlendMode.dstIn), - - ) : null, - + border: hasBorder + ? Border.all(width: 1.0, color: const Color(0xffcccccc)) + : Border.all(width: 0.0, color: Colors.transparent), + image: imageName != null + ? DecorationImage( + image: AssetImage('assets/images/dashboard/${imageName}'), + fit: BoxFit.cover, + colorFilter: new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn), + ) + : null, + ), + child: Center( + child: child, ), - child: Center(child: child,), ), ); } diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 4ca3e587..6ec180e9 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -293,6 +293,7 @@ class _PatientsScreenState extends State { } }); }).catchError((error) { + setState(() { _isError = true; _isLoading = false; diff --git a/lib/screens/patients/profile/referral/my-referral-detail-screen.dart b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart new file mode 100644 index 00000000..3d2b5202 --- /dev/null +++ b/lib/screens/patients/profile/referral/my-referral-detail-screen.dart @@ -0,0 +1,147 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/borderedButton.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class MyReferralDetailScreen extends StatelessWidget { + PendingReferral pendingReferral; + + @override + Widget build(BuildContext context) { + final gridHeight = (MediaQuery.of(context).size.width * 0.3) * 1.8; + + AuthViewModel authProvider = Provider.of(context); + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + pendingReferral = routeArgs['referral']; + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ProfileWelcomeWidget( + AppText( + authProvider.selectedClinicName != null + ? authProvider.selectedClinicName + : authProvider.doctorProfile.clinicDescription, + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.white, + textAlign: TextAlign.center, + ), + height: 100, + ), + SizedBox( + height: 16, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: AppText( + TranslationBase.of(context).myReferralPatient, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + PatientReferralItemWidget( + patientName: pendingReferral.patientName, + referralStatus: null, + isReferredTo: false, + isSameBranch: pendingReferral.isReferralDoctorSameBranch, + referralDoctorName: pendingReferral.referredByDoctorInfo, + clinicDescription: null, + remark: pendingReferral.remarksFromSource, + ), + SizedBox( + child: GridView.count( + childAspectRatio: 1.8, + crossAxisSpacing: 8, + mainAxisSpacing: 10, + controller: new ScrollController(keepScrollOffset: false), + shrinkWrap: true, + padding: const EdgeInsets.all(4.0), + crossAxisCount: 2, + children: [ + PatientProfileButton( + key: key, + // patient: patient, + // route: RADIOLOGY, + nameLine1: TranslationBase.of(context).previewHealth, + nameLine2: TranslationBase.of(context).summaryReport, + icon: 'radiology-1.png'), + PatientProfileButton( + key: key, + // patient: patient, + // route: LAB_ORDERS, + nameLine1: TranslationBase.of(context).lab, + nameLine2: TranslationBase.of(context).result, + icon: 'lab.png'), + PatientProfileButton( + key: key, + // patient: patient, + // route: VITAL_SIGN_DETAILS, + nameLine1: TranslationBase.of(context).vital, + nameLine2: TranslationBase.of(context).signs, + icon: 'heartbeat.png'), + ], + ), + ), + ], + ), + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), + child: Row( + children: [ + Expanded( + child: BorderedButton( + TranslationBase.of(context).accept, + backgroundColor: Color(0xFF4BA821), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: null, + ), + ), + SizedBox( + height: 8, + ), + Expanded( + child: BorderedButton( + TranslationBase.of(context).reject, + backgroundColor: Color(0xFFB9382C), + textColor: Colors.white, + fontSize: 16, + hPadding: 8, + vPadding: 12, + handler: null, + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/referral/my-referral-patient-screen.dart b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart new file mode 100644 index 00000000..5a91ac51 --- /dev/null +++ b/lib/screens/patients/profile/referral/my-referral-patient-screen.dart @@ -0,0 +1,98 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../../../routes.dart'; + +class MyReferralPatientScreen extends StatelessWidget { + // previous design page is: MyReferralPatient + @override + Widget build(BuildContext context) { + AuthViewModel authProvider = Provider.of(context); + + return BaseView( + onModelReady: (model) => model.getPendingReferralPatients(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + body: model.pendingReferral == null || + model.pendingReferral.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).errorNoSchedule, + color: Theme.of(context).errorColor, + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ProfileWelcomeWidget( + AppText( + authProvider.selectedClinicName != null + ? authProvider.selectedClinicName + : authProvider.doctorProfile.clinicDescription, + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.white, + textAlign: TextAlign.center, + ), + height: 100, + ), + SizedBox( + height: 16, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: AppText( + TranslationBase.of(context).myReferralPatient, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + ...List.generate( + model.pendingReferral.length, + (index) => PatientReferralItemWidget( + patientName: model.pendingReferral[index].patientName, + referralStatus: null, + isReferredTo: false, + isSameBranch: model.pendingReferral[index] + .isReferralDoctorSameBranch, + referralDoctorName: + model.pendingReferral[index].referredByDoctorInfo, + clinicDescription: null, + remark: + model.pendingReferral[index].remarksFromSource, + infoIcon: InkWell( + onTap: () { + Navigator.of(context).pushNamed( + MY_REFERRAL_DETAIL, + arguments: { + 'referral': model.pendingReferral[index] + }); + }, + child: Icon( + Icons.info_outline, + color: Colors.black, + size: 30, + ), + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart new file mode 100644 index 00000000..ec8aaf93 --- /dev/null +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -0,0 +1,445 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:hexcolor/hexcolor.dart'; + +import '../../../QR_reader_screen.dart'; + +class PatientMakeReferralScreen extends StatefulWidget { + // previous design page is: ReferPatientScreen + @override + _PatientMakeReferralScreenState createState() => + _PatientMakeReferralScreenState(); +} + +class _PatientMakeReferralScreenState extends State { + PatiantInformtion patient; + List referToList; + dynamic _referTo; + dynamic _selectedBranch; + dynamic _selectedClinic; + dynamic _selectedDoctor; + DateTime appointmentDate; + final _remarksController = TextEditingController(); + PatientArrivalEntity _selectedPatientArrivalEntity; + + @override + void initState() { + super.initState(); + referToList = List(); + dynamic sameBranch = {"id": 1, "name": "Same Branch"}; + dynamic otherBranch = {"id": 2, "name": "Other Branch"}; + referToList.add(sameBranch); + referToList.add(otherBranch); + appointmentDate = DateTime.now(); + } + + @override + Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; + + final screenSize = MediaQuery.of(context).size; + + return BaseView( + onModelReady: (model) => model.getBranches(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + body: SingleChildScrollView( + child: Container( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Column( + children: [ + Container( + height: 75, + child: AppText( + "This is where upper view for avatar.. etc placed", + fontWeight: FontWeight.normal, + fontSize: 16, + ), + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 16, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).referPatient, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: referToList != null + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: referToList, + attributeName: 'name', + attributeValueId: 'id', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _referTo = selectedValue; + _selectedBranch = null; + _selectedClinic = null; + _selectedDoctor = null; + model + .getDoctorBranch() + .then((value) { + _selectedBranch = value; + if (_referTo['id'] == 1) { + model.getClinics( + _selectedBranch['ID']); + } + }); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).referTo, + _referTo != null ? _referTo['name'] : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.branchesList != null && + model.branchesList.length > 0 && + _referTo != null && + _referTo['id'] == 2 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.branchesList, + attributeName: 'Desciption', + attributeValueId: 'ID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedBranch = selectedValue; + _selectedClinic = null; + _selectedDoctor = null; + model.getClinics( + _selectedBranch['ID']); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).branch, + _selectedBranch != null + ? _selectedBranch['Desciption'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedBranch != null && + model.clinicsList != null && + model.clinicsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.clinicsList, + attributeName: 'ClinicDescription', + attributeValueId: 'ClinicID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = null; + _selectedClinic = selectedValue; + model.getClinicDoctors( + _selectedClinic['ClinicID'] + .toString()); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).clinic, + _selectedClinic != null + ? _selectedClinic['ClinicDescription'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: _selectedClinic != null && + model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + ListSelectDialog dialog = + ListSelectDialog( + list: model.doctorsList, + attributeName: 'DoctorName', + attributeValueId: 'DoctorID', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).doctor, + _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + true), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: () => _selectDate(context, model), + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context) + .chooseAppointment, + _selectedPatientArrivalEntity != null + ? "${TranslationBase.of(context).appointmentNo} ${_selectedPatientArrivalEntity.appointmentNo}" + : null, + true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase.of(context).remarks, + null, + false), + enabled: true, + controller: _remarksController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_LETTERS)) + ], + keyboardType: TextInputType.text, + minLines: 4, + maxLines: 6, + )), + ], + ), + ), + ], + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).refer, + color: HexColor("#B8382B"), + onPressed: () => { + /*referToDoctor(context, model)*/ + }, + ), + ) + ], + ), + ), + ), + ), + ); + } + + _selectDate(BuildContext context, PatientReferralViewModel model) async { + // https://medium.com/flutter-community/a-deep-dive-into-datepicker-in-flutter-37e84f7d8d6c good reference + // https://stackoverflow.com/a/63147062/6246772 to customize a date picker + final DateTime picked = await showDatePicker( + context: context, + initialDate: appointmentDate, + firstDate: DateTime(2000), + lastDate: DateTime(2040), + initialEntryMode: DatePickerEntryMode.calendar, + ); + if (picked != null && picked != appointmentDate) { + appointmentDate = picked; + model + .getPatientArrivalList(DateUtils.convertStringToDateFormat( + appointmentDate.toString(), "yyyy-MM-dd")) + .then((_) { + if (model.patientArrivalList != null && + model.patientArrivalList.length > 0) { + List appointments = model.getAppointmentsByPatientName("${patient.firstName} ${patient.middleName} ${patient.lastName}"); + if(appointments.length > 0){ + ListSelectDialog dialog = + ListSelectDialog( + list: appointments, + attributeName: 'appointmentNo', + attributeValueId: 'appointmentNo', + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedPatientArrivalEntity = PatientArrivalEntity.fromJson(selectedValue); + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + }else { + setState(() { + _selectedPatientArrivalEntity = null; + }); + DrAppToastMsg.showErrorToast("There is no appointments for ${patient.firstName} ${patient.middleName} ${patient.lastName}"); + } + }else { + setState(() { + _selectedPatientArrivalEntity = null; + }); + DrAppToastMsg.showErrorToast("There is no appointments for ${patient.firstName} ${patient.middleName} ${patient.lastName}"); + } + }); + } + } + + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {Icon suffixIcon}) { + return InputDecoration( + focusedBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + disabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), + borderRadius: BorderRadius.circular(8), + ), + hintText: selectedText != null ? selectedText : hintText, + suffixIcon: isDropDown + ? suffixIcon != null + ? suffixIcon + : Icon( + Icons.arrow_drop_down, + color: Colors.black, + ) + : null, + hintStyle: TextStyle( + fontSize: 14, + color: Colors.grey.shade600, + ), + ); + } + + BoxDecoration containerBorderDecoration( + Color containerColor, Color borderColor) { + return BoxDecoration( + color: containerColor, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.all(Radius.circular(6)), + border: Border.fromBorderSide(BorderSide( + color: borderColor, + width: 2.0, + )), + ); + } +} diff --git a/lib/screens/patients/profile/referral/referred-patient-screen.dart b/lib/screens/patients/profile/referral/referred-patient-screen.dart new file mode 100644 index 00000000..9fc5b4f8 --- /dev/null +++ b/lib/screens/patients/profile/referral/referred-patient-screen.dart @@ -0,0 +1,74 @@ +import 'package:doctor_app_flutter/core/viewModel/patient-doctor-referral-viewModel.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class ReferredPatientScreen extends StatelessWidget { + // previous design page is: MyReferredPatient + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getMyReferredPatient(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).referPatient, + body: model.listMyReferredPatientModel == null || + model.listMyReferredPatientModel.length == 0 + ? Center( + child: AppText( + TranslationBase.of(context).errorNoSchedule, + color: Theme.of(context).errorColor, + ), + ) + : SingleChildScrollView( + child: Container( + child: Column( + children: [ + Container( + height: 75, + child: AppText( + "This is where upper view for avatar.. etc placed", + fontWeight: FontWeight.normal, + fontSize: 16, + ), + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 2, + indent: 0, + endIndent: 0, + ), + ...List.generate( + model.listMyReferredPatientModel.length, + (index) => PatientReferralItemWidget( + patientName: + "${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}", + referralStatus: + "${model.getReferredPatientItem(index).referralStatus}", + isReferredTo: true, + isSameBranch: model + .getReferredPatientItem(index) + .isReferralDoctorSameBranch, + referralDoctorName: model + .getReferredPatientItem(index) + .referralDoctorName, + clinicDescription: model + .getReferredPatientItem(index) + .referralClinicDescription, + remark: model + .getReferredPatientItem(index) + .referringDoctorRemarks, + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/util/dr_app_toast_msg.dart b/lib/util/dr_app_toast_msg.dart index fd1baa01..09259b45 100644 --- a/lib/util/dr_app_toast_msg.dart +++ b/lib/util/dr_app_toast_msg.dart @@ -41,7 +41,7 @@ import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; timeInSeconds: 1); } - void showTopShortToast(msg) { + static void showTopShortToast(msg) { FlutterFlexibleToast.showToast( message: msg, toastLength: Toast.LENGTH_SHORT, diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index b520fd6f..940e0617 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -80,6 +80,7 @@ class TranslationBase { String get searchMedicine => localizedValues['searchMedicine'][locale.languageCode]; String get myReferralPatient => localizedValues['myReferralPatient'][locale.languageCode]; + String get referPatient => localizedValues['referPatient'][locale.languageCode]; String get myReferral => localizedValues['myReferral'][locale.languageCode]; String get myReferredPatient => localizedValues['myReferredPatient'][locale.languageCode]; @@ -297,6 +298,21 @@ class TranslationBase { String get area => localizedValues['area'][locale.languageCode]; String get room => localizedValues['room'][locale.languageCode]; String get bed => localizedValues['bed'][locale.languageCode]; + String get referTo => localizedValues['referTo'][locale.languageCode]; + String get referredFrom => localizedValues['referredFrom'][locale.languageCode]; + String get branch => localizedValues['branch'][locale.languageCode]; + String get chooseAppointment => localizedValues['chooseAppointment'][locale.languageCode]; + String get appointmentNo => localizedValues['appointmentNo'][locale.languageCode]; + String get refer => localizedValues['refer'][locale.languageCode]; + String get approved => localizedValues['approved'][locale.languageCode]; + String get rejected => localizedValues['rejected'][locale.languageCode]; + String get sameBranch => localizedValues['sameBranch'][locale.languageCode]; + String get otherBranch => localizedValues['otherBranch'][locale.languageCode]; + String get dr => localizedValues['dr'][locale.languageCode]; + String get previewHealth => localizedValues['previewHealth'][locale.languageCode]; + String get summaryReport => localizedValues['summaryReport'][locale.languageCode]; + String get accept => localizedValues['accept'][locale.languageCode]; + String get reject => localizedValues['reject'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/patients/patient-referral-item-widget.dart b/lib/widgets/patients/patient-referral-item-widget.dart new file mode 100644 index 00000000..662e7fee --- /dev/null +++ b/lib/widgets/patients/patient-referral-item-widget.dart @@ -0,0 +1,143 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientReferralItemWidget extends StatelessWidget { + final String patientName; + final String referralStatus; + final isReferredTo; + final isSameBranch; + final String referralDoctorName; + final String clinicDescription; + final String remark; + final Widget infoIcon; + + PatientReferralItemWidget({ + this.patientName, + this.referralStatus, + this.isReferredTo = false, + this.isSameBranch, + this.referralDoctorName, + this.clinicDescription, + this.remark, + this.infoIcon, + }); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.all(16.0), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: AppText( + patientName, + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + if (referralStatus != null) + Container( + color: Color(0xFF4BA821), + padding: EdgeInsets.all(4), + child: AppText( + referralStatus == "46" + ? TranslationBase.of(context).approved + : TranslationBase.of(context).rejected, + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + SizedBox( + height: 8, + ), + Row( + children: [ + AppText( + isReferredTo + ? "${TranslationBase.of(context).referTo}: " + : "${TranslationBase.of(context).referredFrom}: ", + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + isSameBranch + ? TranslationBase.of(context).sameBranch + : TranslationBase.of(context).otherBranch, + color: Colors.grey, + fontWeight: FontWeight.normal, + fontSize: 12, + ), + ], + ), + SizedBox( + height: 8, + ), + AppText( + "${TranslationBase.of(context).dr} $referralDoctorName", + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + SizedBox( + height: 8, + ), + if (clinicDescription != null) + Row( + children: [ + AppText( + "${TranslationBase.of(context).clinic}: ", + color: Colors.black, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + AppText( + clinicDescription, + color: Colors.grey, + fontWeight: FontWeight.normal, + fontSize: 12, + ), + ], + ), + SizedBox( + height: 8, + ), + AppText( + remark, + color: Colors.grey, + fontWeight: FontWeight.normal, + fontSize: 12, + ), + SizedBox( + height: 16, + ), + ], + ), + ), + if (infoIcon != null) infoIcon, + ], + ), + const Divider( + color: Color(0xffCCCCCC), + height: 1, + thickness: 1, + indent: 0, + endIndent: 0, + ), + SizedBox( + height: 8, + ), + ], + ), + ); + } +} diff --git a/lib/widgets/patients/profile/PatientProfileButton.dart b/lib/widgets/patients/profile/PatientProfileButton.dart new file mode 100644 index 00000000..dab1f9de --- /dev/null +++ b/lib/widgets/patients/profile/PatientProfileButton.dart @@ -0,0 +1,86 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; + +class PatientProfileButton extends StatelessWidget { + final String nameLine1; + final String nameLine2; + final String icon; + final dynamic route; + final PatiantInformtion patient; + final String url = "assets/images/"; + PatientProfileButton( + {Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route}) + : super(key: key); + @override + Widget build(BuildContext context) { + return new Container( + margin: new EdgeInsets.symmetric(horizontal: 4.0), + child: InkWell( + onTap: () { + navigator(context, this.route); + }, + child: Column(children: [ + Container( + alignment: Alignment.topLeft, + padding: EdgeInsets.all(5), + child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + this.nameLine1, + color: Color(0xFFB9382C), + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 2, + ), + AppText( + this.nameLine2, + color: Colors.black, + fontWeight: FontWeight.w600, + textAlign: TextAlign.left, + fontSize: SizeConfig.textMultiplier * 2, + ), + ], + ), + ), + Expanded( + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + padding: EdgeInsets.all(10), + child: new Image.asset(url + icon)) + ], + )), + ) + ]), + ), + decoration: BoxDecoration( + // border: Border.all(), + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(10)), + border: Border.fromBorderSide(BorderSide( + color: Color(0xffBBBBBB), + width: 1, + )), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.2), + spreadRadius: 5, + blurRadius: 7, + offset: Offset(0, 3), // changes position of shadow + ), + ], + ), + padding: EdgeInsets.fromLTRB(5, 10, 5, 5), + ); + } + + void navigator(BuildContext context, route) { + Navigator.of(context).pushNamed(route, arguments: {'patient': patient}); + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart new file mode 100644 index 00000000..fae705f4 --- /dev/null +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -0,0 +1,86 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class ProfileWelcomeWidget extends StatelessWidget { + + final Widget clinicWidget; +final double height; + + ProfileWelcomeWidget(this.clinicWidget, {this.height = 140}); + + @override + Widget build(BuildContext context) { + AuthViewModel authProvider = Provider.of(context); + + return Container( + height: height, + color: HexColor('#515B5D'), + width: double.infinity, + child: FractionallySizedBox( + widthFactor: 0.9, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Row( + children: [ + AppText( + TranslationBase.of(context).welcome, + fontSize: SizeConfig.textMultiplier * 1.7, + color: Colors.white, + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + AppText( + 'Dr. ${authProvider.doctorProfile.doctorName}', + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2.5, + color: Colors.white, + ) + ], + ), + SizedBox( + height: 4, + ), + clinicWidget, + ], + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration( + color: Theme.of(context).backgroundColor, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + ), + height: 50, + width: 60, + child: Image.network( + authProvider.doctorProfile.doctorImageURL, +// fit: BoxFit.fill, + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index b8136026..76a26fac 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -6,9 +6,10 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../../config/size_config.dart'; import '../../shared/app_texts_widget.dart'; -import '../../shared/rounded_container_widget.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'PatientProfileButton.dart'; + /* *@author: Elham Rababah *@Date:22/4/2020 @@ -52,8 +53,8 @@ class ProfileMedicalInfoWidget extends StatelessWidget { key: key, patient: patient, route: RADIOLOGY, - nameLine1: TranslationBase.of(context).radiology, - nameLine2: TranslationBase.of(context).service, + nameLine1: TranslationBase.of(context).previewHealth, + nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), Visibility( visible: selectedPatientType != 0 && selectedPatientType != 5, @@ -78,7 +79,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { child: PatientProfileButton( key: key, patient: patient, - route: REFER_PATIENT, + route: REFER_PATIENT_TO_DOCTOR, nameLine1: TranslationBase.of(context).myReferral, nameLine2: TranslationBase.of(context).patient, icon: 'note.png')), @@ -143,85 +144,3 @@ class CircleAvatarWidget extends StatelessWidget { ); } } - -class PatientProfileButton extends StatelessWidget { - final String nameLine1; - final String nameLine2; - final String icon; - final dynamic route; - final PatiantInformtion patient; - final String url = "assets/images/"; - PatientProfileButton( - {Key key, this.patient, this.nameLine1, this.nameLine2, this.icon, this.route}) - : super(key: key); - @override - Widget build(BuildContext context) { - return new Container( - margin: new EdgeInsets.symmetric(horizontal: 4.0), - child: InkWell( - onTap: () { - navigator(context, this.route); - }, - child: Column(children: [ - Container( - alignment: Alignment.topLeft, - padding: EdgeInsets.all(5), - child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - this.nameLine1, - color: Color(0xFFB9382C), - fontWeight: FontWeight.w600, - textAlign: TextAlign.left, - fontSize: SizeConfig.textMultiplier * 2, - ), - AppText( - this.nameLine2, - color: Colors.black, - fontWeight: FontWeight.w600, - textAlign: TextAlign.left, - fontSize: SizeConfig.textMultiplier * 2, - ), - ], - ), - ), - Expanded( - child: Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - padding: EdgeInsets.all(10), - child: new Image.asset(url + icon)) - ], - )), - ) - ]), - ), - decoration: BoxDecoration( - // border: Border.all(), - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(10)), - border: Border.fromBorderSide(BorderSide( - color: Color(0xffBBBBBB), - width: 1, - )), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - spreadRadius: 5, - blurRadius: 7, - offset: Offset(0, 3), // changes position of shadow - ), - ], - ), - padding: EdgeInsets.fromLTRB(5, 10, 5, 5), - ); - } - - void navigator(BuildContext context, route) { - Navigator.of(context).pushNamed(route, arguments: {'patient': patient}); - } -} diff --git a/lib/widgets/shared/borderedButton.dart b/lib/widgets/shared/borderedButton.dart new file mode 100644 index 00000000..5ccf4544 --- /dev/null +++ b/lib/widgets/shared/borderedButton.dart @@ -0,0 +1,83 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:flutter/material.dart'; + +class BorderedButton extends StatelessWidget { + final String text; + final Function handler; + final Color textColor; + final bool hasBorder; + final Color borderColor; + final Color backgroundColor; + final double vPadding; + final double hPadding; + final double radius; + final double lPadding; + final double tPadding; + final double rPadding; + final double bPadding; + final double fontSize; + final Widget icon; + final FontWeight fontWeight; + + BorderedButton( + this.text, { + this.handler, + this.textColor, + this.hasBorder = false, + this.borderColor, + this.backgroundColor, + this.vPadding = 0, + this.hPadding = 0, + this.radius = 4.0, + this.lPadding = 4.0, + this.tPadding = 0.0, + this.rPadding = 4.0, + this.bPadding = 0.0, + this.fontSize = 0, + this.icon, + this.fontWeight, + }); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + handler(); + }, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + color: backgroundColor ?? Colors.white, + borderRadius: BorderRadius.circular(radius), + border: Border.fromBorderSide(BorderSide( + color: hasBorder ? borderColor : Colors.white, + width: 0.8, + )), + ), + child: Container( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + icon != null ? icon : Container(), + Container( + padding: (hPadding > 0 || vPadding > 0) + ? EdgeInsets.symmetric( + vertical: vPadding, horizontal: hPadding) + : EdgeInsets.fromLTRB( + lPadding, tPadding, rPadding, bPadding), + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize, + fontWeight: fontWeight != null ? fontWeight : FontWeight.normal, + color: textColor ?? Color(0xffc4aa54)), + ), + ), + ], + ), + ), + ), + ); + } +} From 9bb396c30972b08f7a81d261ba469098acd39c3f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 23 Dec 2020 18:38:10 +0200 Subject: [PATCH 16/25] fix error in base app --- lib/client/base_app_client.dart | 22 +++++++++++++++---- .../SOAP/subjective/subjective_page.dart | 6 ++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index cc77681f..9d621755 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -3,11 +3,9 @@ import 'dart:convert'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; -import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:http/http.dart' as http; -import 'package:provider/provider.dart'; DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); Helpers helpers = new Helpers(); @@ -84,10 +82,26 @@ class BaseAppClient { await helpers.logout(); helpers.showErrorToast('Your session expired Please login agian'); - } else if (parsed['MessageStatus'] == 1) { + } else + if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { - onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + String error = + parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; + + if (parsed["ValidationErrors"] != null) { + if (parsed["ValidationErrors"]["ValidationErrors"] != null && + parsed["ValidationErrors"]["ValidationErrors"].length != 0) { + error =''; + for (var i = 0; + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { + error = error +parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] +"\n"; + } + } + } + + onFailure(error, statusCode); } } diff --git a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart index 86a17e89..a78f6d0b 100644 --- a/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart +++ b/lib/widgets/patients/profile/SOAP/subjective/subjective_page.dart @@ -1,4 +1,6 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart'; @@ -286,7 +288,9 @@ class _SubjectivePageState extends State { }); await model.postAllergy(postAllergyRequestModel); - + if(model.state == ViewState.ErrorLocal) { + helpers.showErrorToast(model.error); + } widget.changePageViewIndex(1); print(postAllergyRequestModel); From cb80ce778523c8ec8fa5588a568a3ab4c2d00b93 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 23 Dec 2020 18:38:41 +0200 Subject: [PATCH 17/25] isAuthunticated behaviour --- lib/client/base_app_client.dart | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index ca1b196a..f7498cc8 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -82,10 +82,8 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - // TODO commented this and make si success just for test - // await helpers.logout(); - // helpers.showErrorToast('Your session expired Please login again'); - onSuccess(parsed, statusCode); + await helpers.logout(); + helpers.showErrorToast('Your session expired Please login again'); } else if (parsed['MessageStatus'] == 1) { onSuccess(parsed, statusCode); } else { From d2550df08cfd6981836587c628223366beae79a8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 23 Dec 2020 19:06:14 +0200 Subject: [PATCH 18/25] adding shared lockup service --- lib/core/service/SOAP_service.dart | 98 +---------------------- lib/core/service/base/lockup-service.dart | 98 +++++++++++++++++++++++ 2 files changed, 102 insertions(+), 94 deletions(-) create mode 100644 lib/core/service/base/lockup-service.dart diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 88d44e5a..67fa380b 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -5,37 +5,17 @@ import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart' import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; -class SOAPService extends BaseService { - List get listOfAllergies => _listOfAllergies; - List _listOfAllergies = []; - - List get allergySeverityList => _allergySeverityList; - List _allergySeverityList = []; - - List get historyFamilyList => _historyFamilyList; - List _historyFamilyList = []; - - List get historyMedicalList => _historyMedicalList; - List _historyMedicalList = []; - - List get historySportList => _historySportList; - List _historySportList = []; - - List get historySocialList => _historySocialList; - List _historySocialList = []; - - List get historySurgicalList => _historySurgicalList; - List _historySurgicalList = []; - +import 'base/lockup-service.dart'; +class SOAPService extends LockupService { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( GET_ALLERGIES, onSuccess: (dynamic response, int statusCode) { - _listOfAllergies.clear(); + listOfAllergies.clear(); response['List_Allergies']['entityList'].forEach((v) { - _listOfAllergies.add(MasterKeyModel.fromJson(v)); + listOfAllergies.add(MasterKeyModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { @@ -46,20 +26,6 @@ class SOAPService extends BaseService { ); } - Future getMasterLookup(MasterKeysService masterKeys) async { - Map body = { - "MasterInput": masterKeys.getMasterKeyService() - }; - await baseAppClient.post(GET_MASTER_LOOKUP_LIST, - onSuccess: (dynamic response, int statusCode) { - setMasterLookupInCorrectArray( - response['MasterLookUpList']['entityList'], masterKeys); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); - } - Future postAllergy(PostAllergyRequestModel postAllergyRequestModel) async { await baseAppClient.post(POST_ALLERGY, @@ -70,60 +36,4 @@ class SOAPService extends BaseService { super.error = error; }, body: postAllergyRequestModel.toJson()); } - - setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { - switch (masterKeys) { - case MasterKeysService.Allergies: - _listOfAllergies.clear(); - entryList.forEach((v) { - _listOfAllergies - .add(MasterKeyModel.fromJson(v)); - }); - break; - case MasterKeysService.HistoryFamily: - _historyFamilyList.clear(); - entryList.forEach((v) { - _historyFamilyList - .add(MasterKeyModel.fromJson(v)); - }); - break; - case MasterKeysService.HistoryMedical: - _historyMedicalList.clear(); - entryList.forEach((v) { - _historyMedicalList - .add(MasterKeyModel.fromJson(v)); - }); - break; - case MasterKeysService.HistorySocial: - historySocialList.clear(); - entryList.forEach((v) { - historySocialList - .add(MasterKeyModel.fromJson(v)); - }); - break; - case MasterKeysService.HistorySports: - _historySportList.clear(); - entryList.forEach((v) { - _historySportList - .add(MasterKeyModel.fromJson(v)); - }); break; - case MasterKeysService.HistorySurgical: - _historySurgicalList.clear(); - entryList.forEach((v) { - _historySurgicalList - .add(MasterKeyModel.fromJson(v)); - }); - break; - case MasterKeysService.PhysicalExamination: - return 59; - break; - case MasterKeysService.AllergySeverity: - _allergySeverityList.clear(); - entryList.forEach((v) { - _allergySeverityList - .add(MasterKeyModel.fromJson(v)); - }); - break; - } - } } diff --git a/lib/core/service/base/lockup-service.dart b/lib/core/service/base/lockup-service.dart new file mode 100644 index 00000000..2d52d3d9 --- /dev/null +++ b/lib/core/service/base/lockup-service.dart @@ -0,0 +1,98 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; +import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; + +import 'base_service.dart'; + +class LockupService extends BaseService { + + List listOfAllergies = []; + + List get allergySeverityList => _allergySeverityList; + List _allergySeverityList = []; + + List get historyFamilyList => _historyFamilyList; + List _historyFamilyList = []; + + List get historyMedicalList => _historyMedicalList; + List _historyMedicalList = []; + + List get historySportList => _historySportList; + List _historySportList = []; + + List get historySocialList => _historySocialList; + List _historySocialList = []; + + List get historySurgicalList => _historySurgicalList; + List _historySurgicalList = []; + + Future getMasterLookup(MasterKeysService masterKeys) async { + Map body = { + "MasterInput": masterKeys.getMasterKeyService() + }; + await baseAppClient.post(GET_MASTER_LOOKUP_LIST, + onSuccess: (dynamic response, int statusCode) { + setMasterLookupInCorrectArray( + response['MasterLookUpList']['entityList'], masterKeys); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + setMasterLookupInCorrectArray(entryList, MasterKeysService masterKeys) { + switch (masterKeys) { + case MasterKeysService.Allergies: + listOfAllergies.clear(); + entryList.forEach((v) { + listOfAllergies + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistoryFamily: + _historyFamilyList.clear(); + entryList.forEach((v) { + _historyFamilyList + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistoryMedical: + _historyMedicalList.clear(); + entryList.forEach((v) { + _historyMedicalList + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistorySocial: + historySocialList.clear(); + entryList.forEach((v) { + historySocialList + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.HistorySports: + _historySportList.clear(); + entryList.forEach((v) { + _historySportList + .add(MasterKeyModel.fromJson(v)); + }); break; + case MasterKeysService.HistorySurgical: + _historySurgicalList.clear(); + entryList.forEach((v) { + _historySurgicalList + .add(MasterKeyModel.fromJson(v)); + }); + break; + case MasterKeysService.PhysicalExamination: + return 59; + break; + case MasterKeysService.AllergySeverity: + _allergySeverityList.clear(); + entryList.forEach((v) { + _allergySeverityList + .add(MasterKeyModel.fromJson(v)); + }); + break; + } + } +} \ No newline at end of file From 25063b95902b4b8d697fa8fe4c8c7e58a2ca1a93 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 23 Dec 2020 19:07:53 +0200 Subject: [PATCH 19/25] adding lookup service --- lib/core/service/SOAP_service.dart | 2 +- lib/core/service/base/lockup-service.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 67fa380b..739152ea 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -7,7 +7,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; import 'base/lockup-service.dart'; -class SOAPService extends LockupService { +class SOAPService extends LookupService { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { await baseAppClient.post( diff --git a/lib/core/service/base/lockup-service.dart b/lib/core/service/base/lockup-service.dart index 2d52d3d9..1e46d13a 100644 --- a/lib/core/service/base/lockup-service.dart +++ b/lib/core/service/base/lockup-service.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'base_service.dart'; -class LockupService extends BaseService { +class LookupService extends BaseService { List listOfAllergies = []; From 8ffb37257310f1535adc466eaf544b9beba976b8 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 23 Dec 2020 19:12:42 +0200 Subject: [PATCH 20/25] rename llokup file --- lib/core/service/SOAP_service.dart | 2 +- .../service/base/{lockup-service.dart => lookup-service.dart} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lib/core/service/base/{lockup-service.dart => lookup-service.dart} (100%) diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 739152ea..56645184 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -5,7 +5,7 @@ import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart' import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; -import 'base/lockup-service.dart'; +import 'base/lookup-service.dart'; class SOAPService extends LookupService { diff --git a/lib/core/service/base/lockup-service.dart b/lib/core/service/base/lookup-service.dart similarity index 100% rename from lib/core/service/base/lockup-service.dart rename to lib/core/service/base/lookup-service.dart From 9b0731d5c83c0f70290f2831205a577e29d73fd6 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 24 Dec 2020 13:14:39 +0200 Subject: [PATCH 21/25] check activation code --- lib/client/base_app_client.dart | 4 +- lib/config/config.dart | 5 ++ lib/config/shared_pref_kay.dart | 8 +++ lib/core/viewModel/auth_view_model.dart | 24 +++++++ .../check_activation_code_request_model.dart | 64 +++++++++++++++++++ lib/widgets/auth/verfiy_account.dart | 35 +++++++++- lib/widgets/auth/verification_methods.dart | 10 ++- 7 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 lib/models/auth/check_activation_code_request_model.dart diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 9d621755..6157aea8 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -61,7 +61,9 @@ class BaseAppClient { body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; - body['VidaAuthTokenID'] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiZjcwMTUyYzktMjAwNy00Y2FjLTkzMWUtOGI0MDlhMWFkNjc4IiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1ODU1MzAiLCJDbGluaWNJZCI6IjE3Iiwicm9sZSI6IkRPQ1RPUlMiLCJuYmYiOjE2MDg1NTMxMDAsImV4cCI6MTYwOTQxNzEwMCwiaWF0IjoxNjA4NTUzMTAwfQ.lydDI-nsHlmb4Z4vesnckCU1i3hnNayoWVacc3E5_XM"; + body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/config/config.dart b/lib/config/config.dart index 2db503fe..fd1fb33a 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -78,6 +78,11 @@ const SEND_ACTIVATION_CODE_FOR_DOCTOR_APP = const MEMBER_CHECK_ACTIVATION_CODE_NEW = 'Services/Sentry.svc/REST/MemberCheckActivationCode_New'; + +const CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP = + 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp'; + + const GET_DOC_PROFILES = 'Services/Doctors.svc/REST/GetDocProfiles'; const TRANSFERT_TO_ADMIN = 'LiveCareApi/DoctorApp/TransferToAdmin'; const END_CALL = 'LiveCareApi/DoctorApp/EndCall'; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 18b58c28..c41859e6 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,5 +1,13 @@ final TOKEN = 'token'; final PROJECT_ID = 'projectID'; +final VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID'; +final VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID'; +final LOGIN_TOKEN_ID = 'LogInToken'; + + +// set VidaAuthTokenID +// VidaRefreshTokenID +// LogInTokenIDPROJECT_ID = 'projectID'; //===========amjad============ final DOCTOR_ID = 'doctorID'; //======================= diff --git a/lib/core/viewModel/auth_view_model.dart b/lib/core/viewModel/auth_view_model.dart index fc76fbc3..120642bf 100644 --- a/lib/core/viewModel/auth_view_model.dart +++ b/lib/core/viewModel/auth_view_model.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/models/auth/activation_Code_req_model.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; @@ -158,6 +159,29 @@ class AuthViewModel with ChangeNotifier { } } + + Future checkActivationCodeForDoctorApp(CheckActivationCodeRequestModel checkActivationCodeRequestModel) async { + try { + dynamic localRes; + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_DOCTOR_APP, + onSuccess: (dynamic response, int statusCode) { + localRes = response; + selectedClinicName = + ClinicModel.fromJson(response['List_DoctorsClinic'][0]).clinicName; + + response['List_DoctorsClinic'].forEach((v) { + doctorsClinicList.add(new ClinicModel.fromJson(v)); + }); + }, onFailure: (String error, int statusCode) { + throw error; + }, body: checkActivationCodeRequestModel.toJson()); + return Future.value(localRes); + } catch (error) { + print(error); + throw error; + } + } + /* *@author: Elham Rababah *@Date:17/5/2020 diff --git a/lib/models/auth/check_activation_code_request_model.dart b/lib/models/auth/check_activation_code_request_model.dart new file mode 100644 index 00000000..856f1c43 --- /dev/null +++ b/lib/models/auth/check_activation_code_request_model.dart @@ -0,0 +1,64 @@ +class CheckActivationCodeRequestModel { + String mobileNumber; + String zipCode; + int doctorID; + String iPAdress; + int channel; + int languageID; + int projectID; + double versionID; + String generalid; + String logInTokenID; + String activationCode; + String vidaAuthTokenID; + String vidaRefreshTokenID; + + CheckActivationCodeRequestModel( + {this.mobileNumber, + this.zipCode, + this.doctorID, + this.iPAdress, + this.channel, + this.languageID, + this.projectID, + this.versionID, + this.generalid, + this.logInTokenID, + this.activationCode, + this.vidaAuthTokenID, + this.vidaRefreshTokenID}); + + CheckActivationCodeRequestModel.fromJson(Map json) { + mobileNumber = json['MobileNumber']; + zipCode = json['ZipCode']; + doctorID = json['DoctorID']; + iPAdress = json['IPAdress']; + channel = json['Channel']; + languageID = json['LanguageID']; + projectID = json['ProjectID']; + versionID = json['VersionID']; + generalid = json['generalid']; + logInTokenID = json['LogInTokenID']; + activationCode = json['activationCode']; + vidaAuthTokenID = json['VidaAuthTokenID']; + vidaRefreshTokenID = json['VidaRefreshTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['MobileNumber'] = this.mobileNumber; + data['ZipCode'] = this.zipCode; + data['DoctorID'] = this.doctorID; + data['IPAdress'] = this.iPAdress; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['ProjectID'] = this.projectID; + data['VersionID'] = this.versionID; + data['generalid'] = this.generalid; + data['LogInTokenID'] = this.logInTokenID; + data['activationCode'] = this.activationCode; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; + return data; + } +} diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 43e9e988..295a3feb 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/models/auth/check_activation_code_request_model.dart'; import 'package:doctor_app_flutter/models/doctor/clinic_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart'; @@ -363,7 +364,37 @@ class _VerifyAccountState extends State { "IsSilentLogIN": false }; - authProv.memberCheckActivationCodeNew(model).then((res) async{ + // "MobileNumber": "0541696495", + // + // "ZipCode": "966", + // + // "DoctorID": 1485, + // "IPAdress": "10.10.10.10", + // + // "Channel": 9, + // + // "LanguageID": 2, + // + // "ProjectID": 15, + // + // "VersionID": 1.2, + // + // "generalid": "Cs2020@2016$2958", + // + // "LogInTokenID": "+C16+k1lMkOwG2Zynd0nDQ==", + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( + zipCode: _loggedUser['ZipCode'], + mobileNumber: _loggedUser['MobileNumber'], + projectID: await sharedPref.getInt(PROJECT_ID), + logInTokenID: await sharedPref.getInt(LOGIN_TOKEN_ID), + doctorID: 1485, + // TODO do it dynamic + activationCode: activationCode, + generalid: "Cs2020@2016\$2958" + ); + + authProv.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp) + .then((res) async { if (res['MessageStatus'] == 1) { sharedPref.setString(TOKEN, res['AuthenticationTokenID']); if (res['List_DoctorProfile'] != null) { @@ -371,7 +402,7 @@ class _VerifyAccountState extends State { res['List_DoctorProfile'][0], changeLoadingStata); } else { ClinicModel clinic = - ClinicModel.fromJson(res['List_DoctorsClinic'][0]); + ClinicModel.fromJson(res['List_DoctorsClinic'][0]); getDocProfiles(clinic, changeLoadingStata); } } else { diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index cb6cb62e..6959d45a 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -267,17 +267,18 @@ class _VerificationMethodsState extends State { *@return: *@desc: send Activation Code By Otp Notification Type */ - sendActivationCodeByOtpNotificationType(oTPSendType, AuthViewModel authProv) { + sendActivationCodeByOtpNotificationType(oTPSendType, AuthViewModel authProv) async { // TODO : build enum for verfication method if (oTPSendType == 1 || oTPSendType == 2) { widget.changeLoadingStata(true); - + int projectID = await sharedPref.getInt(PROJECT_ID); ActivationCodeModel activationCodeModel = ActivationCodeModel( - facilityId: 15, + facilityId: projectID, generalid: "Cs2020@2016\$2958", memberID: _loggedUser['List_MemberInformation'][0]['MemberID'], zipCode: _loggedUser['ZipCode'], mobileNumber: _loggedUser['MobileNumber'], + password: widget.password); Map model = { @@ -292,6 +293,9 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { + sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); + sharedPref.setString(VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); + sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, arguments: {'model': model}); } else { From 9a614b25b5dd6b3866abf79cfa18c1ab40769bba Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Dec 2020 12:18:01 +0200 Subject: [PATCH 22/25] Finish the login --- lib/widgets/auth/verfiy_account.dart | 2 +- lib/widgets/auth/verification_methods.dart | 29 ++-------------------- 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 295a3feb..56c2ba09 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -386,7 +386,7 @@ class _VerifyAccountState extends State { zipCode: _loggedUser['ZipCode'], mobileNumber: _loggedUser['MobileNumber'], projectID: await sharedPref.getInt(PROJECT_ID), - logInTokenID: await sharedPref.getInt(LOGIN_TOKEN_ID), + logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), doctorID: 1485, // TODO do it dynamic activationCode: activationCode, diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index 6959d45a..32c541a3 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -293,6 +293,7 @@ class _VerificationMethodsState extends State { widget.changeLoadingStata(false); if (res['MessageStatus'] == 1) { + print("VerificationCode : "+ res["VerificationCode"]); sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]); sharedPref.setString(VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]); sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]); @@ -311,33 +312,7 @@ class _VerificationMethodsState extends State { }); } catch (e) {} - // Map model = { - // "LogInTokenID": _loggedUser['LogInTokenID'], - // "Channel": 9, - // "MobileNumber": _loggedUser['MobileNumber'], - // "IPAdress": "11.11.11.11", - // "LanguageID": 2, - // "ProjectID": 15, //TODO : this should become daynamci - // "ZipCode": _loggedUser['ZipCode'], - // "UserName": _loggedUser['List_MemberInformation'][0]['MemberID'], - // "OTP_SendType": oTPSendType - // }; - // authProv.sendActivationCodeByOtpNotificationType(model).then((res) { - // widget.changeLoadingStata(false); - // - // if (res['MessageStatus'] == 1) { - // Navigator.of(context).pushReplacementNamed(VERIFY_ACCOUNT, - // arguments: {'model': model}); - // } else { - // print(res['ErrorEndUserMessage']); - // helpers.showErrorToast(res['ErrorEndUserMessage']); - // } - // }).catchError((err) { - // print('$err'); - // widget.changeLoadingStata(false); - // - // helpers.showErrorToast(); - // }); + } else { // TODO route to this page with parameters to inicate we should present 2 option if (Platform.isAndroid && oTPSendType == 3) { From 2658694b70c2109b9a17955397ad260596e6b58a Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Dec 2020 12:22:17 +0200 Subject: [PATCH 23/25] remove static value --- lib/widgets/auth/verfiy_account.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 56c2ba09..35332198 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -387,8 +387,6 @@ class _VerifyAccountState extends State { mobileNumber: _loggedUser['MobileNumber'], projectID: await sharedPref.getInt(PROJECT_ID), logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID), - doctorID: 1485, - // TODO do it dynamic activationCode: activationCode, generalid: "Cs2020@2016\$2958" ); From abbe89167306642693e8c97f830fb66e13f7412d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Dec 2020 12:26:02 +0200 Subject: [PATCH 24/25] improve code quality --- lib/config/shared_pref_kay.dart | 7 ------- lib/widgets/auth/login_form.dart | 7 ------- lib/widgets/auth/verfiy_account.dart | 19 ------------------- 3 files changed, 33 deletions(-) diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index c41859e6..7fd0eba2 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -3,14 +3,7 @@ final PROJECT_ID = 'projectID'; final VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID'; final VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID'; final LOGIN_TOKEN_ID = 'LogInToken'; - - -// set VidaAuthTokenID -// VidaRefreshTokenID -// LogInTokenIDPROJECT_ID = 'projectID'; -//===========amjad============ final DOCTOR_ID = 'doctorID'; -//======================= final SLECTED_PATIENT_TYPE = 'slectedPatientType'; final APP_Language = 'language'; final DOCTOR_PROFILE = 'doctorProfile'; diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index d7eaeeb6..808b1763 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -225,10 +225,6 @@ class _LoginFormState extends State { login(context, AuthViewModel authProv, Function changeLoadingStata) { FocusScopeNode currentFocus = FocusScope.of(context); - - // if (!currentFocus.hasPrimaryFocus) { - // currentFocus.unfocus(); - // } changeLoadingStata(true); if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); @@ -242,13 +238,10 @@ class _LoginFormState extends State { sharedPref.setString(TOKEN, res['LogInTokenID']); print("token" + res['LogInTokenID']); Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (BuildContext context) => VerificationMethodsScreen(password: userInfo.password,))); - // Navigator.of(context).pushReplacementNamed(VERIFICATION_METHODS); } else { // handel error - // widget.showCenterShortLoadingToast("watting"); helpers.showErrorToast(res['ErrorEndUserMessage']); } - // Navigator.of(context).pushNamed(HOME); }).catchError((err) { print('$err'); changeLoadingStata(false); diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index 35332198..e72e1317 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -363,25 +363,6 @@ class _VerifyAccountState extends State { "IsLoginForDoctorApp": true, "IsSilentLogIN": false }; - - // "MobileNumber": "0541696495", - // - // "ZipCode": "966", - // - // "DoctorID": 1485, - // "IPAdress": "10.10.10.10", - // - // "Channel": 9, - // - // "LanguageID": 2, - // - // "ProjectID": 15, - // - // "VersionID": 1.2, - // - // "generalid": "Cs2020@2016$2958", - // - // "LogInTokenID": "+C16+k1lMkOwG2Zynd0nDQ==", CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( zipCode: _loggedUser['ZipCode'], mobileNumber: _loggedUser['MobileNumber'], From f6ddf7a9eb44e574e8a53c5f07df540e7589e560 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Sun, 27 Dec 2020 13:58:21 +0200 Subject: [PATCH 25/25] make logout button close all screen stack and push to login --- lib/util/helpers.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index 41c0b4f7..0c3f1b5f 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -348,6 +348,7 @@ class Helpers { String lang = await sharedPref.getString(APP_Language); await clearSharedPref(); sharedPref.setString(APP_Language, lang); - Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + // Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); + Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } }