finish Admission request new design

merge-requests/394/head
mosazaid 5 years ago
parent 1f70498982
commit f280ed731d

@ -287,6 +287,7 @@ const Map<String, Map<String, String>> localizedValues = {
'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'room': {'en': 'ROOM:', 'ar': 'الغرفة'},
'bed': {'en': 'BED:', 'ar': 'السرير'}, 'bed': {'en': 'BED:', 'ar': 'السرير'},
'next': {'en': 'Next', 'ar': 'التالي'}, 'next': {'en': 'Next', 'ar': 'التالي'},
'previous': {'en': 'PREVIOUS', 'ar': 'السابق'},
'healthRecordInformation': { 'healthRecordInformation': {
'en': 'HEALTH RECORD INFORMATION', 'en': 'HEALTH RECORD INFORMATION',
'ar': 'معلومات السجل الصحي' 'ar': 'معلومات السجل الصحي'
@ -705,7 +706,7 @@ const Map<String, Map<String, String>> localizedValues = {
'ar': " : استجابة الإحالة" 'ar': " : استجابة الإحالة"
}, },
'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"},
'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, 'diagnosisDetail': {'en': "Diagnosis Details", 'ar': "تفاصيل التشخيص"},
'referralSuccessMsgAccept': { 'referralSuccessMsgAccept': {
'en': "Referral Accepted Successfully", 'en': "Referral Accepted Successfully",
'ar': "تم قبول الإحالة بنجاح" 'ar': "تم قبول الإحالة بنجاح"

@ -58,7 +58,7 @@ class _AdmissionRequestThirdScreenState
isShowAppBar: false, isShowAppBar: false,
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: (){ onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); currentFocus.unfocus();
@ -66,418 +66,344 @@ class _AdmissionRequestThirdScreenState
}, },
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// PatientPageHeaderWidget(patient),
PatientProfileHeaderNewDesign(
patient, patientType, arrivalType),
Container(
margin: EdgeInsets.all(16.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// PatientPageHeaderWidget(patient), AppText(
PatientProfileHeaderNewDesign( "${TranslationBase.of(context).admission}",
patient, patientType, arrivalType), fontFamily: 'Poppins',
Container( fontSize: SizeConfig.textMultiplier * 1.6,
margin: EdgeInsets.all(16.0), fontWeight: FontWeight.w600,
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,
)
],
),
), ),
Container( AppText(
margin: EdgeInsets.symmetric( "${TranslationBase.of(context).request}",
vertical: 0, horizontal: 16), fontFamily: 'Poppins',
child: Column( fontSize: SizeConfig.textMultiplier * 3,
crossAxisAlignment: CrossAxisAlignment.start, fontWeight: FontWeight.bold,
children: [ )
AppText( ],
TranslationBase.of(context) ),
.specialityAndDoctorDetail, ),
fontFamily: 'Poppins', Container(
fontSize: SizeConfig.textMultiplier * 1.8, margin:
fontWeight: FontWeight.w700, EdgeInsets.symmetric(vertical: 0, horizontal: 16),
), child: Column(
SizedBox( crossAxisAlignment: CrossAxisAlignment.start,
height: 10, children: [
), AppText(
AppTextFieldCustom( TranslationBase.of(context)
height: screenSize.height * 0.070, .specialityAndDoctorDetail,
hintText: "test field", fontFamily: 'Poppins',
isDropDown: true, fontSize: SizeConfig.textMultiplier * 1.8,
controller: _sickLeaveCommentsController, fontWeight: FontWeight.w700,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).clinic,
onTap: model.clinicList != null && isDropDown: true,
model.clinicList.length > 0 dropDownText: _selectedClinic != null
? () { ? _selectedClinic['clinicGroupName']
openListDialogField( : null,
'clinicGroupName', enabled: false,
'clinicID', onClick: model.clinicList != null &&
model.clinicList, model.clinicList.length > 0
(selectedValue) { ? () {
setState(() { openListDialogField(
_selectedClinic = selectedValue; 'clinicGroupName',
}); 'clinicID',
}); model.clinicList, (selectedValue) {
} setState(() {
: () async { _selectedClinic = selectedValue;
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;
}); });
}
: () 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, SizedBox(
contentPadding: EdgeInsets.all(0), height: 20,
), ),
Container( AppTextFieldCustom(
child: TextField( height: screenSize.height * 0.075,
decoration: hintText: TranslationBase.of(context).doctor,
Helpers.textFieldSelectorDecoration( isDropDown: true,
TranslationBase.of(context) dropDownText: _selectedDoctor != null
.sickLeaveComments, ? _selectedDoctor['DoctorName']
null, : null,
false), enabled: false,
enabled: true, onClick: _selectedClinic != null
controller: _sickLeaveCommentsController, ? model.doctorsList != null &&
keyboardType: TextInputType.text, model.doctorsList.length > 0
minLines: 2, ? () {
maxLines: 4, openListDialogField('DoctorName',
)), 'DoctorID', model.doctorsList,
SizedBox( (selectedValue) {
height: 10, setState(() {
), _selectedDoctor = selectedValue;
Container( });
height: screenSize.height * 0.070, });
child: InkWell( }
onTap: model.dietTypesList != null && : () async {
model.dietTypesList.length > 0 GifLoaderDialogUtils.showMyDialog(
? () { context);
openListDialogField('nameEn', 'id', await model
model.dietTypesList, .getClinicDoctors(
(selectedValue) { _selectedClinic['clinicID'])
setState(() { .then((_) => GifLoaderDialogUtils
_selectedDietType = .hideDialog(context));
selectedValue; if (model.state == ViewState.Idle &&
}); model.doctorsList.length > 0) {
openListDialogField('DoctorName',
'DoctorID', model.doctorsList,
(selectedValue) {
setState(() {
_selectedDoctor = selectedValue;
}); });
} });
: () async { } else if (model.state ==
GifLoaderDialogUtils.showMyDialog( ViewState.ErrorLocal) {
context); DrAppToastMsg.showErrorToast(
await model.getDietTypes().then( model.error);
(_) => GifLoaderDialogUtils } else {
.hideDialog(context)); DrAppToastMsg.showErrorToast(
if (model.state == ViewState.Idle && "Empty List");
model.dietTypesList.length > }
0) { }
openListDialogField('nameEn', : null,
'id', model.dietTypesList, ),
(selectedValue) { SizedBox(
setState(() { height: 16,
_selectedDietType = ),
selectedValue; AppText(
}); TranslationBase.of(context).patientDetails,
}); fontFamily: 'Poppins',
} else if (model.state == fontSize: SizeConfig.textMultiplier * 1.8,
ViewState.ErrorLocal) { fontWeight: FontWeight.w700,
DrAppToastMsg.showErrorToast( ),
model.error); SizedBox(
} else { height: 10,
DrAppToastMsg.showErrorToast( ),
"Empty List"); CheckboxListTile(
} title: AppText(
}, TranslationBase.of(context).patientPregnant,
child: TextField( fontWeight: FontWeight.normal,
decoration: fontFamily: 'Poppins',
Helpers.textFieldSelectorDecoration( fontSize: SizeConfig.textMultiplier * 2.0,
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,
)),
],
), ),
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, Container(
color: HexColor("#B8382B"), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
onPressed: () { child: AppButton(
model.admissionRequestData = AdmissionRequest(); title: TranslationBase.of(context).next,
if (_selectedClinic != null && color: HexColor("#D02127"),
_selectedDoctor != null && onPressed: () {
_sickLeaveCommentsController.text != "" && model.admissionRequestData = AdmissionRequest();
_postMedicalHistoryController.text != "" && if (_selectedClinic != null &&
_postSurgicalHistoryController.text != "") { _selectedDoctor != null &&
model.admissionRequestData.patientMRN = _sickLeaveCommentsController.text != "" &&
patient.patientMRN; _postMedicalHistoryController.text != "" &&
model.admissionRequestData.appointmentNo = _postSurgicalHistoryController.text != "") {
patient.appointmentNo; model.admissionRequestData.patientMRN =
model.admissionRequestData.episodeID = patient.patientMRN;
patient.episodeNo; model.admissionRequestData.appointmentNo =
model.admissionRequestData.admissionRequestNo = 0; patient.appointmentNo;
model.admissionRequestData.episodeID = patient.episodeNo;
model.admissionRequestData.admissionRequestNo = 0;
model.admissionRequestData.admitToClinic = model.admissionRequestData.admitToClinic =
_selectedClinic['clinicID']; _selectedClinic['clinicID'];
model.admissionRequestData.mrpDoctorID = model.admissionRequestData.mrpDoctorID =
_selectedDoctor['DoctorID']; _selectedDoctor['DoctorID'];
model.admissionRequestData.isPregnant = model.admissionRequestData.isPregnant = _patientPregnant;
_patientPregnant; model.admissionRequestData.isSickLeaveRequired =
model.admissionRequestData.isSickLeaveRequired = _isSickLeaveRequired;
_isSickLeaveRequired; model.admissionRequestData.sickLeaveComments =
model.admissionRequestData.sickLeaveComments = _sickLeaveCommentsController.text;
_sickLeaveCommentsController.text; model.admissionRequestData.isDietType =
model.admissionRequestData.isDietType = _selectedDietType != null ? true : false;
_selectedDietType != null ? true : false; model.admissionRequestData.dietType =
model.admissionRequestData.dietType = _selectedDietType != null
_selectedDietType != null ? _selectedDietType['id']
? _selectedDietType['id'] : 0;
: 0; model.admissionRequestData.dietRemarks =
model.admissionRequestData.dietRemarks = _dietTypeRemarksController.text;
_dietTypeRemarksController.text; model.admissionRequestData.pastMedicalHistory =
model.admissionRequestData.pastMedicalHistory = _postMedicalHistoryController.text;
_postMedicalHistoryController.text; model.admissionRequestData.pastSurgicalHistory =
model.admissionRequestData.pastSurgicalHistory = _postSurgicalHistoryController.text;
_postSurgicalHistoryController.text; Navigator.of(context)
Navigator.of(context).pushNamed( .pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {
PATIENT_ADMISSION_REQUEST_2, 'patient': patient,
arguments: { 'patientType': patientType,
'patient': patient, 'arrivalType': arrivalType,
'admission-data': model.admissionRequestData 'admission-data': model.admissionRequestData
}); });
} else { } else {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill); TranslationBase.of(context).pleaseFill);
} }
}, },
),
),
],
), ),
),
],
),
), ),
), ),
); );

@ -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/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_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/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/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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-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_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/app_texts_widget.dart';
@ -32,11 +33,6 @@ class AdmissionRequestThirdScreen extends StatefulWidget {
class _AdmissionRequestThirdScreenState class _AdmissionRequestThirdScreenState
extends State<AdmissionRequestThirdScreen> { extends State<AdmissionRequestThirdScreen> {
final _treatmentLineController = TextEditingController();
final _complicationsController = TextEditingController();
final _otherProceduresController = TextEditingController();
dynamic _selectedAdmissionType;
dynamic _selectedDiagnosis; dynamic _selectedDiagnosis;
dynamic _selectedIcd; dynamic _selectedIcd;
dynamic _selectedDiagnosisType; dynamic _selectedDiagnosisType;
@ -45,6 +41,8 @@ class _AdmissionRequestThirdScreenState
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
AdmissionRequest admissionRequest = routeArgs['admission-data']; AdmissionRequest admissionRequest = routeArgs['admission-data'];
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
@ -53,6 +51,7 @@ class _AdmissionRequestThirdScreenState
return BaseView<AdmissionRequestViewModel>( return BaseView<AdmissionRequestViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {
@ -68,132 +67,68 @@ class _AdmissionRequestThirdScreenState
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
PatientPageHeaderWidget(patient), PatientProfileHeaderNewDesign(
patient, patientType, arrivalType),
Container( Container(
margin: margin: EdgeInsets.all(16.0),
EdgeInsets.symmetric(vertical: 16, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( AppText(
height: 10, "${TranslationBase.of(context).admission}",
), fontFamily: 'Poppins',
Container( fontSize: SizeConfig.textMultiplier * 1.6,
child: TextField( fontWeight: FontWeight.w600,
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( AppText(
TranslationBase.of(context).diagnosisDetail, "${TranslationBase.of(context).request}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold, 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( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).diagnosis,
onTap: model.diagnosisTypesList != null && dropDownText: _selectedDiagnosis != null
model.diagnosisTypesList.length > 0 ? _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', openListDialogField('nameEn', 'id',
model.diagnosisTypesList, model.diagnosisTypesList,
(selectedValue) { (selectedValue) {
@ -201,51 +136,46 @@ class _AdmissionRequestThirdScreenState
_selectedDiagnosis = selectedValue; _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( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).icd,
onTap: model.icdCodes != null && dropDownText: _selectedIcd != null
model.icdCodes.length > 0 ? _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( openListDialogField(
'description', 'code', model.icdCodes, 'description', 'code', model.icdCodes,
(selectedValue) { (selectedValue) {
@ -253,57 +183,51 @@ class _AdmissionRequestThirdScreenState
_selectedIcd = selectedValue; _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( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).diagnoseType,
onTap: model.listOfDiagnosisSelectionTypes != dropDownText: _selectedDiagnosisType != null
null && ? _selectedDiagnosisType['description']
model.listOfDiagnosisSelectionTypes : null,
.length > enabled: false,
0 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', openListDialogField('description', 'code',
model.listOfDiagnosisSelectionTypes, model.listOfDiagnosisSelectionTypes,
(selectedValue) { (selectedValue) {
@ -312,49 +236,14 @@ class _AdmissionRequestThirdScreenState
selectedValue; 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( SizedBox(
height: 10, height: 10,
@ -367,55 +256,66 @@ class _AdmissionRequestThirdScreenState
)), )),
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton( child: Row(
title: TranslationBase.of(context).next, children: [
color: HexColor("#B8382B"), Expanded(
onPressed: () async { child: AppButton(
if (_treatmentLineController.text != "" && title: TranslationBase.of(context).previous,
_complicationsController.text != "" && color: HexColor("#EAEAEA"),
_otherProceduresController.text != "" && fontColor: Colors.black,
_selectedAdmissionType != null && onPressed: () {
_selectedDiagnosis != null && Navigator.pop(context);
_selectedIcd != null && },
_selectedDiagnosisType != null) { ),
model.admissionRequestData = admissionRequest; ),
SizedBox(
model.admissionRequestData.mainLineOfTreatment = width: 10,
_treatmentLineController.text; ),
model.admissionRequestData.complications = Expanded(
_complicationsController.text; child: AppButton(
model.admissionRequestData.otherProcedures = title: TranslationBase.of(context).submit,
_otherProceduresController.text; color: HexColor("#359846"),
model.admissionRequestData.admissionType = onPressed: () async {
_selectedAdmissionType['id']; if (_selectedDiagnosis != null &&
_selectedIcd != null &&
_selectedDiagnosisType != null) {
model.admissionRequestData = admissionRequest;
dynamic admissionRequestDiagnoses = [ dynamic admissionRequestDiagnoses = [
{ {
'diagnosisDescription': _selectedDiagnosis['nameEn'], 'diagnosisDescription':
'diagnosisType': _selectedDiagnosis['id'], _selectedDiagnosis['nameEn'],
'icdCode': _selectedIcd['code'], 'diagnosisType': _selectedDiagnosis['id'],
'icdCodeDescription': _selectedIcd['description'], 'icdCode': _selectedIcd['code'],
'type': _selectedDiagnosisType['code'], 'icdCodeDescription':
'remarks': "", _selectedIcd['description'],
'isActive': true, 'type': _selectedDiagnosisType['code'],
} 'remarks': "",
]; 'isActive': true,
model.admissionRequestData.admissionRequestDiagnoses = }
admissionRequestDiagnoses; ];
model.admissionRequestData
.admissionRequestDiagnoses =
admissionRequestDiagnoses;
await model.makeAdmissionRequest(); await model.makeAdmissionRequest();
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
} else { } else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
TranslationBase.of(context).admissionRequestSuccessMsg); TranslationBase.of(context)
Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); .admissionRequestSuccessMsg);
} Navigator.popUntil(context,
} else { ModalRoute.withName(PATIENTS_PROFILE));
DrAppToastMsg.showErrorToast( }
TranslationBase.of(context).pleaseFill); } else {
} DrAppToastMsg.showErrorToast(
}, TranslationBase.of(context).pleaseFill);
}
},
),
),
],
), ),
), ),
], ],

@ -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/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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-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_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/app_texts_widget.dart';
@ -36,17 +38,23 @@ class _AdmissionRequestSecondScreenState
final _estimatedCostController = TextEditingController(); final _estimatedCostController = TextEditingController();
final _expectedDaysController = TextEditingController(); final _expectedDaysController = TextEditingController();
final _otherDepartmentsInterventionsController = TextEditingController(); final _otherDepartmentsInterventionsController = TextEditingController();
final _treatmentLineController = TextEditingController();
final _complicationsController = TextEditingController();
final _otherProceduresController = TextEditingController();
DateTime _expectedAdmissionDate; DateTime _expectedAdmissionDate;
dynamic _selectedFloor; dynamic _selectedFloor;
dynamic _selectedWard; dynamic _selectedWard;
dynamic _selectedRoomCategory; dynamic _selectedRoomCategory;
dynamic _selectedAdmissionType;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
AdmissionRequest admissionRequest = routeArgs['admission-data']; AdmissionRequest admissionRequest = routeArgs['admission-data'];
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
@ -55,6 +63,7 @@ class _AdmissionRequestSecondScreenState
return BaseView<AdmissionRequestViewModel>( return BaseView<AdmissionRequestViewModel>(
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).admissionRequest, appBarTitle: TranslationBase.of(context).admissionRequest,
body: GestureDetector( body: GestureDetector(
onTap: () { onTap: () {
@ -70,145 +79,159 @@ class _AdmissionRequestSecondScreenState
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
PatientPageHeaderWidget(patient), PatientProfileHeaderNewDesign(
patient, patientType, arrivalType),
Container( Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.all(16.0),
vertical: 16, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( AppText(
height: 16, "${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( AppText(
TranslationBase.of(context) TranslationBase.of(context)
.postPlansEstimatedCost, .postPlansEstimatedCost,
fontWeight: FontWeight.bold, fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w700,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: TextField( hintText:
decoration: TranslationBase.of(context).estimatedCost,
Helpers.textFieldSelectorDecoration( controller: _estimatedCostController,
TranslationBase.of(context) inputType: TextInputType.number,
.estimatedCost, inputFormatters: [
null, FilteringTextInputFormatter.allow(
false), RegExp(ONLY_NUMBERS))
enabled: true, ],
controller: _estimatedCostController, ),
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
keyboardType: TextInputType.number,
)),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
child: TextField( hintText: TranslationBase.of(context).postPlans,
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).postPlans,
null,
false),
enabled: true,
controller: _postPlansEstimatedCostController, controller: _postPlansEstimatedCostController,
keyboardType: TextInputType.text, inputType: TextInputType.multiline,
minLines: 4, minLines: 4,
maxLines: 6, maxLines: 6,
)), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
child: TextField( hintText: TranslationBase.of(context)
decoration: .otherDepartmentsInterventions,
Helpers.textFieldSelectorDecoration( controller:
TranslationBase.of(context)
.otherDepartmentsInterventions,
null,
false),
enabled: true,
controller:
_otherDepartmentsInterventionsController, _otherDepartmentsInterventionsController,
keyboardType: TextInputType.multiline, inputType: TextInputType.multiline,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
)), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
AppText( AppText(
TranslationBase.of(context).otherInformation, TranslationBase.of(context).otherInformation,
fontWeight: FontWeight.bold, fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 1.8,
fontWeight: FontWeight.w700,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: TextField( hintText:
decoration: TranslationBase.of(context).expectedDays,
Helpers.textFieldSelectorDecoration( controller: _expectedDaysController,
TranslationBase.of(context) inputType: TextInputType.number,
.expectedDays, inputFormatters: [
null, FilteringTextInputFormatter.allow(
false), RegExp(ONLY_NUMBERS))
enabled: true, ],
controller: _expectedDaysController, ),
inputFormatters: [
FilteringTextInputFormatter.allow(
RegExp(ONLY_NUMBERS))
],
keyboardType: TextInputType.number,
)),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context)
onTap: () { .expectedAdmissionDate,
if (_expectedAdmissionDate == null) { dropDownText: _expectedAdmissionDate != null
_expectedAdmissionDate = DateTime.now(); ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}"
} : null,
_selectDate(context, _expectedAdmissionDate, enabled: false,
(picked) { isDropDown: true,
setState(() { suffixIcon: Icon(
_expectedAdmissionDate = picked; Icons.calendar_today,
}); color: Colors.black,
});
},
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,
),
), ),
onClick: () {
if (_expectedAdmissionDate == null) {
_expectedAdmissionDate = DateTime.now();
}
_selectDate(context, _expectedAdmissionDate,
(picked) {
setState(() {
_expectedAdmissionDate = picked;
});
});
},
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).floor,
onTap: model.floorList != null && dropDownText: _selectedFloor != null
model.floorList.length > 0 ? _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( openListDialogField(
'description', 'description',
'floorID', 'floorID',
@ -217,52 +240,47 @@ class _AdmissionRequestSecondScreenState
_selectedFloor = selectedValue; _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( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText: TranslationBase.of(context).ward,
onTap: model.wardList != null && dropDownText: _selectedWard != null
model.wardList.length > 0 ? _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( openListDialogField(
'description', 'description',
'nursingStationID', 'nursingStationID',
@ -271,54 +289,51 @@ class _AdmissionRequestSecondScreenState
_selectedWard = selectedValue; _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( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
height: screenSize.height * 0.070, height: screenSize.height * 0.075,
child: InkWell( hintText:
onTap: model.roomCategoryList != null && TranslationBase.of(context).roomCategory,
model.roomCategoryList.length > 0 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( openListDialogField(
'description', 'description',
'categoryID', 'categoryID',
@ -329,52 +344,103 @@ class _AdmissionRequestSecondScreenState
selectedValue; selectedValue;
}); });
}); });
} else if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} else {
DrAppToastMsg.showErrorToast(
"Empty List");
} }
: () async { },
GifLoaderDialogUtils.showMyDialog( ),
context); SizedBox(
await model.getRoomCategories().then( height: 10,
(_) => GifLoaderDialogUtils ),
.hideDialog(context)); AppTextFieldCustom(
if (model.state == ViewState.Idle && hintText:
model.roomCategoryList.length > TranslationBase.of(context).treatmentLine,
0) { controller: _treatmentLineController,
openListDialogField( inputType: TextInputType.multiline,
'description', minLines: 3,
'categoryID', maxLines: 5,
model.roomCategoryList, ),
(selectedValue) { SizedBox(
setState(() { height: 10,
_selectedRoomCategory = ),
selectedValue; AppTextFieldCustom(
}); hintText:
}); TranslationBase.of(context).complications,
} else if (model.state == controller: _complicationsController,
ViewState.ErrorLocal) { inputType: TextInputType.multiline,
DrAppToastMsg.showErrorToast( minLines: 3,
model.error); maxLines: 5,
} else { ),
DrAppToastMsg.showErrorToast( SizedBox(
"Empty List"); height: 10,
} ),
}, AppTextFieldCustom(
child: TextField( hintText:
decoration: TranslationBase.of(context).otherProcedure,
Helpers.textFieldSelectorDecoration( controller: _otherProceduresController,
TranslationBase.of(context) inputType: TextInputType.multiline,
.roomCategory, minLines: 3,
_selectedRoomCategory != null maxLines: 5,
? _selectedRoomCategory[
'description']
: null,
true),
enabled: false,
),
),
), ),
SizedBox( SizedBox(
height: 10, 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( Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton( child: Row(
title: TranslationBase.of(context).next, children: [
color: HexColor("#B8382B"), Expanded(
onPressed: () async { child: AppButton(
if (_estimatedCostController.text != "" && title: TranslationBase.of(context).previous,
_postPlansEstimatedCostController.text != "" && color: HexColor("#EAEAEA"),
_expectedDaysController.text != "" && fontColor: Colors.black,
_expectedAdmissionDate != null && onPressed: () {
_otherDepartmentsInterventionsController.text != "" && Navigator.pop(context);
_selectedFloor != null && },
_selectedRoomCategory != ),
null /*_selectedWard is not required*/) { ),
model.admissionRequestData = admissionRequest; 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 = model.admissionRequestData.estimatedCost =
int.parse(_estimatedCostController.text); int.parse(_estimatedCostController.text);
model.admissionRequestData.elementsForImprovement = model.admissionRequestData
_postPlansEstimatedCostController.text; .elementsForImprovement =
_postPlansEstimatedCostController.text;
model.admissionRequestData.expectedDays = model.admissionRequestData.expectedDays =
int.parse(_expectedDaysController.text); int.parse(_expectedDaysController.text);
model.admissionRequestData.admissionDate = model.admissionRequestData.admissionDate =
_expectedAdmissionDate.toIso8601String(); _expectedAdmissionDate.toIso8601String();
model.admissionRequestData model.admissionRequestData
.otherDepartmentInterventions = .otherDepartmentInterventions =
_otherDepartmentsInterventionsController.text; _otherDepartmentsInterventionsController.text;
model.admissionRequestData.admissionLocationID = model.admissionRequestData.admissionLocationID =
_selectedFloor['floorID']; _selectedFloor['floorID'];
model.admissionRequestData.wardID = model.admissionRequestData.wardID =
_selectedWard != null _selectedWard != null
? _selectedWard['nursingStationID'] ? _selectedWard['nursingStationID']
: 0; : 0;
model.admissionRequestData.roomCategoryID = model.admissionRequestData.roomCategoryID =
_selectedRoomCategory['categoryID']; _selectedRoomCategory['categoryID'];
model.admissionRequestData.admissionRequestProcedures = model.admissionRequestData
[]; .admissionRequestProcedures = [];
Navigator.of(context)
.pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { model.admissionRequestData.mainLineOfTreatment =
'patient': patient, _treatmentLineController.text;
'admission-data': model.admissionRequestData model.admissionRequestData.complications =
}); _complicationsController.text;
} else { model.admissionRequestData.otherProcedures =
DrAppToastMsg.showErrorToast( _otherProceduresController.text;
TranslationBase.of(context).pleaseFill); 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);
}
},
),
),
],
), ),
), ),
], ],

@ -552,6 +552,8 @@ class TranslationBase {
String get next => localizedValues['next'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode];
String get previous => localizedValues['previous'][locale.languageCode];
String get emptyMessage => String get emptyMessage =>
localizedValues['empty-message'][locale.languageCode]; localizedValues['empty-message'][locale.languageCode];

@ -1,6 +1,6 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'app_texts_widget.dart'; import 'app_texts_widget.dart';
class AppTextFieldCustom extends StatefulWidget { class AppTextFieldCustom extends StatefulWidget {
@ -9,17 +9,30 @@ class AppTextFieldCustom extends StatefulWidget {
final String hintText; final String hintText;
final TextEditingController controller; final TextEditingController controller;
final bool isDropDown; final bool isDropDown;
final String dropDownText;
final Icon suffixIcon; final Icon suffixIcon;
final Color dropDownColor; final Color dropDownColor;
final bool enabled;
final TextInputType inputType;
final int minLines;
final int maxLines;
final List<TextInputFormatter> inputFormatters;
AppTextFieldCustom( AppTextFieldCustom({
{this.height = 0, this.height = 0,
this.onClick, this.onClick,
this.hintText, this.hintText,
this.controller, this.controller,
this.isDropDown = false, this.isDropDown = false,
this.suffixIcon, this.dropDownText,
this.dropDownColor}); this.suffixIcon,
this.dropDownColor,
this.enabled = true,
this.inputType = TextInputType.text,
this.minLines = 1,
this.maxLines = 1,
this.inputFormatters,
});
@override @override
_AppTextFieldCustomState createState() => _AppTextFieldCustomState(); _AppTextFieldCustomState createState() => _AppTextFieldCustomState();
@ -43,23 +56,38 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
if (widget.controller.text != "") if ((widget.controller != null &&
widget.controller.text != "") ||
widget.dropDownText != null)
AppText( AppText(
widget.hintText, widget.hintText,
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.4, fontSize: SizeConfig.textMultiplier * 1.4,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
TextField( widget.dropDownText == null
textAlign: TextAlign.left, ? TextField(
decoration: textFieldSelectorDecoration( textAlign: TextAlign.left,
widget.hintText, null, true), decoration: textFieldSelectorDecoration(
style: TextStyle( widget.hintText, null, true),
fontSize: 14, style: TextStyle(
color: Colors.grey.shade600, fontSize: SizeConfig.textMultiplier * 1.7,
), fontFamily: 'Poppins',
controller: widget.controller, 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<AppTextFieldCustom> {
? widget.suffixIcon != null ? widget.suffixIcon != null
? widget.suffixIcon ? widget.suffixIcon
: Icon( : Icon(
Icons.arrow_drop_down, Icons.keyboard_arrow_down,
color: widget.dropDownColor != null color: widget.dropDownColor != null
? widget.dropDownColor ? widget.dropDownColor
: Colors.black, : Colors.black,
@ -85,7 +113,7 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius: BorderRadius.all(Radius.circular(12)),
border: Border.fromBorderSide(BorderSide( border: Border.fromBorderSide(BorderSide(
color: borderColor, color: borderColor,
width: borderWidth == -1 ? 2.0 : borderWidth, width: borderWidth == -1 ? 2.0 : borderWidth,
@ -102,6 +130,9 @@ class _AppTextFieldCustomState extends State<AppTextFieldCustom> {
enabledBorder: UnderlineInputBorder( enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0Xffffffff)), borderSide: BorderSide(color: Color(0Xffffffff)),
), ),
disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0Xffffffff)),
),
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Color(0Xffffffff)), borderSide: BorderSide(color: Color(0Xffffffff)),
), ),

Loading…
Cancel
Save