From f280ed731d7eed934d706f14ab43d7eeb6644038 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 31 Mar 2021 16:48:14 +0300 Subject: [PATCH] finish Admission request new design --- lib/config/localized_values.dart | 3 +- .../admission-request-first-screen.dart | 722 ++++++++---------- .../admission-request-third-screen.dart | 492 +++++------- .../admission-request_second-screen.dart | 642 +++++++++------- lib/util/translations_delegate_base.dart | 2 + lib/widgets/shared/app-textfield-custom.dart | 75 +- 6 files changed, 950 insertions(+), 986 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9a74047c..c6ee6aa1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -287,6 +287,7 @@ const Map> localizedValues = { 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, 'next': {'en': 'Next', 'ar': 'التالي'}, + 'previous': {'en': 'PREVIOUS', 'ar': 'السابق'}, 'healthRecordInformation': { 'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي' @@ -705,7 +706,7 @@ const Map> localizedValues = { 'ar': " : استجابة الإحالة" }, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, - 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, + 'diagnosisDetail': {'en': "Diagnosis Details", 'ar': "تفاصيل التشخيص"}, 'referralSuccessMsgAccept': { 'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح" diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart index 1cf69da8..3fa16be2 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -58,7 +58,7 @@ class _AdmissionRequestThirdScreenState isShowAppBar: false, appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( - onTap: (){ + onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); @@ -66,418 +66,344 @@ class _AdmissionRequestThirdScreenState }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: SingleChildScrollView( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), + Container( + margin: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // PatientPageHeaderWidget(patient), - PatientProfileHeaderNewDesign( - patient, patientType, arrivalType), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).admission}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).request}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 0, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .specialityAndDoctorDetail, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.8, - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.070, - hintText: "test field", - isDropDown: true, - controller: _sickLeaveCommentsController, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.clinicList != null && - model.clinicList.length > 0 - ? () { - openListDialogField( - 'clinicGroupName', - 'clinicID', - model.clinicList, - (selectedValue) { - setState(() { - _selectedClinic = selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getClinics().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.clinicList.length > 0) { - openListDialogField( - 'clinicGroupName', - 'clinicID', - model.clinicList, - (selectedValue) { - setState(() { - _selectedClinic = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .clinic, - _selectedClinic != null - ? _selectedClinic[ - 'clinicGroupName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 20, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: _selectedClinic != null - ? model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - openListDialogField( - 'DoctorName', - 'DoctorID', - model.doctorsList, - (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils - .showMyDialog(context); - await model - .getClinicDoctors( - _selectedClinic[ - 'clinicID']) - .then((_) => - GifLoaderDialogUtils - .hideDialog( - context)); - if (model.state == - ViewState.Idle && - model.doctorsList.length > - 0) { - openListDialogField( - 'DoctorName', - 'DoctorID', - model.doctorsList, - (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - } - : null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .doctor, - _selectedDoctor != null - ? _selectedDoctor[ - 'DoctorName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).patientDetails, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).patientPregnant, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _patientPregnant, - onChanged: (newValue) { - setState(() { - _patientPregnant = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .isSickLeaveRequired, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _isSickLeaveRequired, - onChanged: (newValue) { - setState(() { - _isSickLeaveRequired = newValue; + AppText( + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).clinic, + isDropDown: true, + dropDownText: _selectedClinic != null + ? _selectedClinic['clinicGroupName'] + : null, + enabled: false, + onClick: model.clinicList != null && + model.clinicList.length > 0 + ? () { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getClinics().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.clinicList.length > 0) { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .sickLeaveComments, - null, - false), - enabled: true, - controller: _sickLeaveCommentsController, - keyboardType: TextInputType.text, - minLines: 2, - maxLines: 4, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.dietTypesList != null && - model.dietTypesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.dietTypesList, - (selectedValue) { - setState(() { - _selectedDietType = - selectedValue; - }); + ), + SizedBox( + height: 20, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).doctor, + isDropDown: true, + dropDownText: _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + enabled: false, + onClick: _selectedClinic != null + ? model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + openListDialogField('DoctorName', + 'DoctorID', model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getClinicDoctors( + _selectedClinic['clinicID']) + .then((_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.doctorsList.length > 0) { + openListDialogField('DoctorName', + 'DoctorID', model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDietTypes().then( - (_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.dietTypesList.length > - 0) { - openListDialogField('nameEn', - 'id', model.dietTypesList, - (selectedValue) { - setState(() { - _selectedDietType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietType, - _selectedDietType != null - ? _selectedDietType['nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietTypeRemarks, - null, - false), - enabled: true, - controller: _dietTypeRemarksController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .pastMedicalHistory, - null, - false), - enabled: true, - controller: _postMedicalHistoryController, - keyboardType: TextInputType.text, - minLines: 2, - maxLines: 4, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .pastSurgicalHistory, - null, - false), - enabled: true, - controller: _postSurgicalHistoryController, - keyboardType: TextInputType.text, - minLines: 2, - maxLines: 4, - )), - ], + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + } + : null, + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).patientPregnant, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, ), + value: _patientPregnant, + activeColor: HexColor("#D02127"), + onChanged: (newValue) { + setState(() { + _patientPregnant = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).isSickLeaveRequired, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, + ), + value: _isSickLeaveRequired, + activeColor: HexColor("#D02127"), + onChanged: (newValue) { + setState(() { + _isSickLeaveRequired = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).sickLeaveComments, + controller: _sickLeaveCommentsController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).dietType, + isDropDown: true, + dropDownText: _selectedDietType != null + ? _selectedDietType['nameEn'] + : null, + enabled: false, + onClick: model.dietTypesList != null && + model.dietTypesList.length > 0 + ? () { + openListDialogField( + 'nameEn', 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDietTypes().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.dietTypesList.length > 0) { + openListDialogField( + 'nameEn', 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).dietTypeRemarks, + controller: _dietTypeRemarksController, + minLines: 4, + maxLines: 6, + inputType: TextInputType.multiline, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).pastMedicalHistory, + controller: _postMedicalHistoryController, + minLines: 4, + maxLines: 6, + inputType: TextInputType.multiline, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).pastSurgicalHistory, + controller: _postSurgicalHistoryController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, ), ], ), ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () { - model.admissionRequestData = AdmissionRequest(); - if (_selectedClinic != null && - _selectedDoctor != null && - _sickLeaveCommentsController.text != "" && - _postMedicalHistoryController.text != "" && - _postSurgicalHistoryController.text != "") { - model.admissionRequestData.patientMRN = - patient.patientMRN; - model.admissionRequestData.appointmentNo = - patient.appointmentNo; - model.admissionRequestData.episodeID = - patient.episodeNo; - model.admissionRequestData.admissionRequestNo = 0; + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#D02127"), + onPressed: () { + model.admissionRequestData = AdmissionRequest(); + if (_selectedClinic != null && + _selectedDoctor != null && + _sickLeaveCommentsController.text != "" && + _postMedicalHistoryController.text != "" && + _postSurgicalHistoryController.text != "") { + model.admissionRequestData.patientMRN = + patient.patientMRN; + model.admissionRequestData.appointmentNo = + patient.appointmentNo; + model.admissionRequestData.episodeID = patient.episodeNo; + model.admissionRequestData.admissionRequestNo = 0; - model.admissionRequestData.admitToClinic = - _selectedClinic['clinicID']; - model.admissionRequestData.mrpDoctorID = - _selectedDoctor['DoctorID']; + model.admissionRequestData.admitToClinic = + _selectedClinic['clinicID']; + model.admissionRequestData.mrpDoctorID = + _selectedDoctor['DoctorID']; - model.admissionRequestData.isPregnant = - _patientPregnant; - model.admissionRequestData.isSickLeaveRequired = - _isSickLeaveRequired; - model.admissionRequestData.sickLeaveComments = - _sickLeaveCommentsController.text; - model.admissionRequestData.isDietType = - _selectedDietType != null ? true : false; - model.admissionRequestData.dietType = - _selectedDietType != null - ? _selectedDietType['id'] - : 0; - model.admissionRequestData.dietRemarks = - _dietTypeRemarksController.text; - model.admissionRequestData.pastMedicalHistory = - _postMedicalHistoryController.text; - model.admissionRequestData.pastSurgicalHistory = - _postSurgicalHistoryController.text; - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_2, - arguments: { - 'patient': patient, - 'admission-data': model.admissionRequestData - }); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, - ), - ), - ], + model.admissionRequestData.isPregnant = _patientPregnant; + model.admissionRequestData.isSickLeaveRequired = + _isSickLeaveRequired; + model.admissionRequestData.sickLeaveComments = + _sickLeaveCommentsController.text; + model.admissionRequestData.isDietType = + _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = + _selectedDietType != null + ? _selectedDietType['id'] + : 0; + model.admissionRequestData.dietRemarks = + _dietTypeRemarksController.text; + model.admissionRequestData.pastMedicalHistory = + _postMedicalHistoryController.text; + model.admissionRequestData.pastSurgicalHistory = + _postSurgicalHistoryController.text; + Navigator.of(context) + .pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, ), + ), + ], + ), ), ), ); diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index 342d2e72..b5cf732a 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -7,11 +7,12 @@ import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-view import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.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'; @@ -32,11 +33,6 @@ class AdmissionRequestThirdScreen extends StatefulWidget { class _AdmissionRequestThirdScreenState extends State { - final _treatmentLineController = TextEditingController(); - final _complicationsController = TextEditingController(); - final _otherProceduresController = TextEditingController(); - - dynamic _selectedAdmissionType; dynamic _selectedDiagnosis; dynamic _selectedIcd; dynamic _selectedDiagnosisType; @@ -45,6 +41,8 @@ class _AdmissionRequestThirdScreenState Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; AdmissionRequest admissionRequest = routeArgs['admission-data']; final screenSize = MediaQuery.of(context).size; @@ -53,6 +51,7 @@ class _AdmissionRequestThirdScreenState return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, + isShowAppBar: false, appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -68,132 +67,68 @@ class _AdmissionRequestThirdScreenState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 16), + margin: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).treatmentLine, - null, - false), - enabled: true, - controller: _treatmentLineController, - keyboardType: TextInputType.text, - minLines: 3, - maxLines: 5, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).complications, - null, - false), - enabled: true, - controller: _complicationsController, - keyboardType: TextInputType.text, - minLines: 3, - maxLines: 5, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).otherProcedure, - null, - false), - enabled: true, - controller: _otherProceduresController, - keyboardType: TextInputType.text, - minLines: 3, - maxLines: 5, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.admissionTypeList != null && - model.admissionTypeList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup(MasterKeysService - .AdmissionRequestType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.admissionTypeList.length > 0) { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).admissionType, - _selectedAdmissionType != null - ? _selectedAdmissionType['nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 16, + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, ), AppText( - TranslationBase.of(context).diagnosisDetail, + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, + ) + ], + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnosisDetail, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.diagnosisTypesList != null && - model.diagnosisTypesList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).diagnosis, + dropDownText: _selectedDiagnosis != null + ? _selectedDiagnosis['nameEn'] + : null, + enabled: false, + isDropDown: true, + onClick: model.diagnosisTypesList != null && + model.diagnosisTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getDiagnosis().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.diagnosisTypesList.length > 0) { openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) { @@ -201,51 +136,46 @@ class _AdmissionRequestThirdScreenState _selectedDiagnosis = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDiagnosis().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.diagnosisTypesList.length > 0) { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, - (selectedValue) { - setState(() { - _selectedDiagnosis = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).diagnosis, - _selectedDiagnosis != null - ? _selectedDiagnosis['nameEn'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.icdCodes != null && - model.icdCodes.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).icd, + dropDownText: _selectedIcd != null + ? _selectedIcd['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.icdCodes != null && + model.icdCodes.length > 0 + ? () { + openListDialogField( + 'description', 'code', model.icdCodes, + (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getICDCodes(patient.patientMRN) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.icdCodes.length > 0) { openListDialogField( 'description', 'code', model.icdCodes, (selectedValue) { @@ -253,57 +183,51 @@ class _AdmissionRequestThirdScreenState _selectedIcd = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getICDCodes(patient.patientMRN) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.icdCodes.length > 0) { - openListDialogField( - 'description', - 'code', - model.icdCodes, (selectedValue) { - setState(() { - _selectedIcd = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).icd, - _selectedIcd != null - ? _selectedIcd['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisSelectionTypes != - null && - model.listOfDiagnosisSelectionTypes - .length > - 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).diagnoseType, + dropDownText: _selectedDiagnosisType != null + ? _selectedDiagnosisType['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.listOfDiagnosisSelectionTypes != + null && + model.listOfDiagnosisSelectionTypes.length > + 0 + ? () { + openListDialogField('description', 'code', + model.listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getMasterLookup(MasterKeysService + .DiagnosisSelectionType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.listOfDiagnosisSelectionTypes + .length > + 0) { openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes, (selectedValue) { @@ -312,49 +236,14 @@ class _AdmissionRequestThirdScreenState selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup(MasterKeysService - .DiagnosisSelectionType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.listOfDiagnosisSelectionTypes - .length > - 0) { - openListDialogField( - 'description', - 'code', - model.listOfDiagnosisSelectionTypes, - (selectedValue) { - setState(() { - _selectedDiagnosisType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).diagnoseType, - _selectedDiagnosisType != null - ? _selectedDiagnosisType['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, @@ -367,55 +256,66 @@ class _AdmissionRequestThirdScreenState )), Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () async { - if (_treatmentLineController.text != "" && - _complicationsController.text != "" && - _otherProceduresController.text != "" && - _selectedAdmissionType != null && - _selectedDiagnosis != null && - _selectedIcd != null && - _selectedDiagnosisType != null) { - model.admissionRequestData = admissionRequest; - - model.admissionRequestData.mainLineOfTreatment = - _treatmentLineController.text; - model.admissionRequestData.complications = - _complicationsController.text; - model.admissionRequestData.otherProcedures = - _otherProceduresController.text; - model.admissionRequestData.admissionType = - _selectedAdmissionType['id']; + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).submit, + color: HexColor("#359846"), + onPressed: () async { + if (_selectedDiagnosis != null && + _selectedIcd != null && + _selectedDiagnosisType != null) { + model.admissionRequestData = admissionRequest; - dynamic admissionRequestDiagnoses = [ - { - 'diagnosisDescription': _selectedDiagnosis['nameEn'], - 'diagnosisType': _selectedDiagnosis['id'], - 'icdCode': _selectedIcd['code'], - 'icdCodeDescription': _selectedIcd['description'], - 'type': _selectedDiagnosisType['code'], - 'remarks': "", - 'isActive': true, - } - ]; - model.admissionRequestData.admissionRequestDiagnoses = - admissionRequestDiagnoses; + dynamic admissionRequestDiagnoses = [ + { + 'diagnosisDescription': + _selectedDiagnosis['nameEn'], + 'diagnosisType': _selectedDiagnosis['id'], + 'icdCode': _selectedIcd['code'], + 'icdCodeDescription': + _selectedIcd['description'], + 'type': _selectedDiagnosisType['code'], + 'remarks': "", + 'isActive': true, + } + ]; + model.admissionRequestData + .admissionRequestDiagnoses = + admissionRequestDiagnoses; - await model.makeAdmissionRequest(); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).admissionRequestSuccessMsg); - Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); - } - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, + await model.makeAdmissionRequest(); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .admissionRequestSuccessMsg); + Navigator.popUntil(context, + ModalRoute.withName(PATIENTS_PROFILE)); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], ), ), ], diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 91885724..987f5f43 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -12,6 +12,8 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.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/patient-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.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'; @@ -36,17 +38,23 @@ class _AdmissionRequestSecondScreenState final _estimatedCostController = TextEditingController(); final _expectedDaysController = TextEditingController(); final _otherDepartmentsInterventionsController = TextEditingController(); + final _treatmentLineController = TextEditingController(); + final _complicationsController = TextEditingController(); + final _otherProceduresController = TextEditingController(); DateTime _expectedAdmissionDate; dynamic _selectedFloor; dynamic _selectedWard; dynamic _selectedRoomCategory; + dynamic _selectedAdmissionType; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; AdmissionRequest admissionRequest = routeArgs['admission-data']; final screenSize = MediaQuery.of(context).size; @@ -55,6 +63,7 @@ class _AdmissionRequestSecondScreenState return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, + isShowAppBar: false, appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -70,145 +79,159 @@ class _AdmissionRequestSecondScreenState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), + margin: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 16, + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, ), + AppText( + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ AppText( TranslationBase.of(context) .postPlansEstimatedCost, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .estimatedCost, - null, - false), - enabled: true, - controller: _estimatedCostController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).estimatedCost, + controller: _estimatedCostController, + inputType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + ), SizedBox( height: 10, ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).postPlans, - null, - false), - enabled: true, + AppTextFieldCustom( + hintText: TranslationBase.of(context).postPlans, controller: _postPlansEstimatedCostController, - keyboardType: TextInputType.text, + inputType: TextInputType.multiline, minLines: 4, maxLines: 6, - )), + ), SizedBox( height: 10, ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .otherDepartmentsInterventions, - null, - false), - enabled: true, - controller: + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .otherDepartmentsInterventions, + controller: _otherDepartmentsInterventionsController, - keyboardType: TextInputType.multiline, - minLines: 2, - maxLines: 4, - )), + inputType: TextInputType.multiline, + minLines: 2, + maxLines: 4, + ), SizedBox( height: 10, ), AppText( TranslationBase.of(context).otherInformation, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedDays, - null, - false), - enabled: true, - controller: _expectedDaysController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).expectedDays, + controller: _expectedDaysController, + inputType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - if (_expectedAdmissionDate == null) { - _expectedAdmissionDate = DateTime.now(); - } - _selectDate(context, _expectedAdmissionDate, - (picked) { - setState(() { - _expectedAdmissionDate = picked; - }); - }); - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedAdmissionDate, - _expectedAdmissionDate != null - ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context) + .expectedAdmissionDate, + dropDownText: _expectedAdmissionDate != null + ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" + : null, + enabled: false, + isDropDown: true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, ), + onClick: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate(context, _expectedAdmissionDate, + (picked) { + setState(() { + _expectedAdmissionDate = picked; + }); + }); + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.floorList != null && - model.floorList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).floor, + dropDownText: _selectedFloor != null + ? _selectedFloor['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.floorList != null && + model.floorList.length > 0 + ? () { + openListDialogField( + 'description', + 'floorID', + model.floorList, (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getFloors().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.floorList.length > 0) { openListDialogField( 'description', 'floorID', @@ -217,52 +240,47 @@ class _AdmissionRequestSecondScreenState _selectedFloor = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getFloors().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.floorList.length > 0) { - openListDialogField('description', - 'floorID', model.floorList, - (selectedValue) { - setState(() { - _selectedFloor = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).floor, - _selectedFloor != null - ? _selectedFloor['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.wardList != null && - model.wardList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).ward, + dropDownText: _selectedWard != null + ? _selectedWard['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.wardList != null && + model.wardList.length > 0 + ? () { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getWards().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { openListDialogField( 'description', 'nursingStationID', @@ -271,54 +289,51 @@ class _AdmissionRequestSecondScreenState _selectedWard = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getWards().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.wardList.length > 0) { - openListDialogField( - 'description', - 'nursingStationID', - model.wardList, - (selectedValue) { - setState(() { - _selectedWard = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).ward, - _selectedWard != null - ? _selectedWard['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.roomCategoryList != null && - model.roomCategoryList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).roomCategory, + dropDownText: _selectedRoomCategory != null + ? _selectedRoomCategory['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.roomCategoryList != null && + model.roomCategoryList.length > 0 + ? () { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, + (selectedValue) { + setState(() { + _selectedRoomCategory = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getRoomCategories().then( + (_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.roomCategoryList.length > 0) { openListDialogField( 'description', 'categoryID', @@ -329,52 +344,103 @@ class _AdmissionRequestSecondScreenState selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getRoomCategories().then( - (_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.roomCategoryList.length > - 0) { - openListDialogField( - 'description', - 'categoryID', - model.roomCategoryList, - (selectedValue) { - setState(() { - _selectedRoomCategory = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .roomCategory, - _selectedRoomCategory != null - ? _selectedRoomCategory[ - 'description'] - : null, - true), - enabled: false, - ), - ), + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).treatmentLine, + controller: _treatmentLineController, + inputType: TextInputType.multiline, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).complications, + controller: _complicationsController, + inputType: TextInputType.multiline, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).otherProcedure, + controller: _otherProceduresController, + inputType: TextInputType.multiline, + minLines: 3, + maxLines: 5, ), SizedBox( height: 10, ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).admissionType, + dropDownText: _selectedAdmissionType != null + ? _selectedAdmissionType['nameEn'] + : null, + enabled: false, + isDropDown: true, + onClick: model.admissionTypeList != null && + model.admissionTypeList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .AdmissionRequestType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.admissionTypeList.length > + 0) { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + ), ], ), ), @@ -384,53 +450,91 @@ class _AdmissionRequestSecondScreenState ), Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () async { - if (_estimatedCostController.text != "" && - _postPlansEstimatedCostController.text != "" && - _expectedDaysController.text != "" && - _expectedAdmissionDate != null && - _otherDepartmentsInterventionsController.text != "" && - _selectedFloor != null && - _selectedRoomCategory != - null /*_selectedWard is not required*/) { - model.admissionRequestData = admissionRequest; + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#D02127"), + onPressed: () async { + if (_estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "" && + _expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _otherDepartmentsInterventionsController.text != + "" && + _selectedFloor != null && + _selectedRoomCategory != + null /*_selectedWard is not required*/ && + _treatmentLineController.text != "" && + _complicationsController.text != "" && + _otherProceduresController.text != "" && + _selectedAdmissionType != null) { + model.admissionRequestData = admissionRequest; - model.admissionRequestData.estimatedCost = - int.parse(_estimatedCostController.text); - model.admissionRequestData.elementsForImprovement = - _postPlansEstimatedCostController.text; + model.admissionRequestData.estimatedCost = + int.parse(_estimatedCostController.text); + model.admissionRequestData + .elementsForImprovement = + _postPlansEstimatedCostController.text; - model.admissionRequestData.expectedDays = - int.parse(_expectedDaysController.text); - model.admissionRequestData.admissionDate = - _expectedAdmissionDate.toIso8601String(); - model.admissionRequestData - .otherDepartmentInterventions = - _otherDepartmentsInterventionsController.text; - model.admissionRequestData.admissionLocationID = - _selectedFloor['floorID']; - model.admissionRequestData.wardID = - _selectedWard != null - ? _selectedWard['nursingStationID'] - : 0; - model.admissionRequestData.roomCategoryID = - _selectedRoomCategory['categoryID']; + model.admissionRequestData.expectedDays = + int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = + _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData + .otherDepartmentInterventions = + _otherDepartmentsInterventionsController.text; + model.admissionRequestData.admissionLocationID = + _selectedFloor['floorID']; + model.admissionRequestData.wardID = + _selectedWard != null + ? _selectedWard['nursingStationID'] + : 0; + model.admissionRequestData.roomCategoryID = + _selectedRoomCategory['categoryID']; - model.admissionRequestData.admissionRequestProcedures = - []; - Navigator.of(context) - .pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { - 'patient': patient, - 'admission-data': model.admissionRequestData - }); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, + model.admissionRequestData + .admissionRequestProcedures = []; + + model.admissionRequestData.mainLineOfTreatment = + _treatmentLineController.text; + model.admissionRequestData.complications = + _complicationsController.text; + model.admissionRequestData.otherProcedures = + _otherProceduresController.text; + model.admissionRequestData.admissionType = + _selectedAdmissionType['id']; + + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_3, + arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], ), ), ], diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7ff65bb1..d499636b 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -552,6 +552,8 @@ class TranslationBase { String get next => localizedValues['next'][locale.languageCode]; + String get previous => localizedValues['previous'][locale.languageCode]; + String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; diff --git a/lib/widgets/shared/app-textfield-custom.dart b/lib/widgets/shared/app-textfield-custom.dart index 15c8865a..5cc6c417 100644 --- a/lib/widgets/shared/app-textfield-custom.dart +++ b/lib/widgets/shared/app-textfield-custom.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:flutter/material.dart'; - +import 'package:flutter/services.dart'; import 'app_texts_widget.dart'; class AppTextFieldCustom extends StatefulWidget { @@ -9,17 +9,30 @@ class AppTextFieldCustom extends StatefulWidget { final String hintText; final TextEditingController controller; final bool isDropDown; + final String dropDownText; final Icon suffixIcon; final Color dropDownColor; + final bool enabled; + final TextInputType inputType; + final int minLines; + final int maxLines; + final List inputFormatters; - AppTextFieldCustom( - {this.height = 0, - this.onClick, - this.hintText, - this.controller, - this.isDropDown = false, - this.suffixIcon, - this.dropDownColor}); + AppTextFieldCustom({ + this.height = 0, + this.onClick, + this.hintText, + this.controller, + this.isDropDown = false, + this.dropDownText, + this.suffixIcon, + this.dropDownColor, + this.enabled = true, + this.inputType = TextInputType.text, + this.minLines = 1, + this.maxLines = 1, + this.inputFormatters, + }); @override _AppTextFieldCustomState createState() => _AppTextFieldCustomState(); @@ -43,23 +56,38 @@ class _AppTextFieldCustomState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - if (widget.controller.text != "") + if ((widget.controller != null && + widget.controller.text != "") || + widget.dropDownText != null) AppText( widget.hintText, fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.4, fontWeight: FontWeight.w600, ), - TextField( - textAlign: TextAlign.left, - decoration: textFieldSelectorDecoration( - widget.hintText, null, true), - style: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - controller: widget.controller, - ), + widget.dropDownText == null + ? TextField( + textAlign: TextAlign.left, + decoration: textFieldSelectorDecoration( + widget.hintText, null, true), + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + fontFamily: 'Poppins', + color: Colors.grey.shade800, + ), + controller: widget.controller, + keyboardType: widget.inputType, + enabled: widget.enabled, + minLines: widget.minLines, + maxLines: widget.maxLines, + inputFormatters: widget.inputFormatters != null ? widget.inputFormatters : [], + ) + : AppText( + widget.dropDownText, + fontFamily: 'Poppins', + color: Colors.grey.shade800, + fontSize: SizeConfig.textMultiplier * 1.7, + ), ], ), ), @@ -67,7 +95,7 @@ class _AppTextFieldCustomState extends State { ? widget.suffixIcon != null ? widget.suffixIcon : Icon( - Icons.arrow_drop_down, + Icons.keyboard_arrow_down, color: widget.dropDownColor != null ? widget.dropDownColor : Colors.black, @@ -85,7 +113,7 @@ class _AppTextFieldCustomState extends State { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), + borderRadius: BorderRadius.all(Radius.circular(12)), border: Border.fromBorderSide(BorderSide( color: borderColor, width: borderWidth == -1 ? 2.0 : borderWidth, @@ -102,6 +130,9 @@ class _AppTextFieldCustomState extends State { enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Color(0Xffffffff)), ), + disabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Color(0Xffffffff)), ),