working on referral page

merge-requests/402/head
mosazaid 5 years ago
parent f280ed731d
commit f57a5bbcef

@ -4,8 +4,8 @@ const MAX_SMALL_SCREEN = 660;
const ONLY_NUMBERS = "[0-9]"; const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = const PATIENT_PROGRESS_NOTE_URL =

@ -333,7 +333,7 @@ const Map<String, Map<String, String>> localizedValues = {
'branch': {'en': "Branch", 'ar': 'الفرع'}, 'branch': {'en': "Branch", 'ar': 'الفرع'},
'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'}, 'chooseAppointment': {'en': "Choose Appointment", 'ar': 'اختر موعد'},
'appointmentNo': {'en': "Appointment # : ", 'ar': '# الموعد:'}, 'appointmentNo': {'en': "Appointment # : ", 'ar': '# الموعد:'},
'refer': {'en': "REFER", 'ar': 'إحالة'}, 'refer': {'en': "Refer", 'ar': 'إحالة'},
'rejected': {'en': "Rejected", 'ar': 'مرفوض'}, 'rejected': {'en': "Rejected", 'ar': 'مرفوض'},
'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'}, 'sameBranch': {'en': "Same Branch", 'ar': 'نفس الفرع'},
'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'}, 'otherBranch': {'en': "Other Branch", 'ar': 'فرع آخر'},

@ -1,4 +1,5 @@
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -9,6 +10,8 @@ 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/patient-referral-item-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.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';
@ -46,6 +49,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
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;
patient = routeArgs['patient']; patient = routeArgs['patient'];
String patientType = routeArgs['patientType'];
String arrivalType = routeArgs['arrivalType'];
referToList = List(); referToList = List();
dynamic sameBranch = { dynamic sameBranch = {
@ -66,46 +71,69 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
/*if (model.state == ViewState.BusyLocal)
Container(
color: Colors.white,
width: 50,
height: 50,
child: AppLoaderWidget(
containerColor: Colors.white,
)),*/
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
PatientPageHeaderWidget(patient), PatientProfileHeaderNewDesign(
const Divider( patient, patientType, arrivalType),
color: Color(0xffCCCCCC), Container(
height: 1, margin: EdgeInsets.all(16.0),
thickness: 2, child: Column(
indent: 0, crossAxisAlignment: CrossAxisAlignment.start,
endIndent: 0, children: [
AppText(
"${TranslationBase.of(context).refer}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 1.6,
fontWeight: FontWeight.w600,
),
AppText(
"${TranslationBase.of(context).patient}",
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier * 3,
fontWeight: FontWeight.bold,
)
],
),
), ),
model.patientReferral.length == 0 model.patientReferral.length == 0
? ReferralForm(model, screenSize) ? referralForm(model, screenSize)
: PatientReferralItemWidget( : PatientReferralItemWidget(
"${model.patientReferral[model.patientReferral.length -1].patientID}", "${model.patientReferral[model.patientReferral.length - 1].patientID}",
patientName: model.patientReferral[model.patientReferral.length -1].patientName, patientName: model
.patientReferral[
model.patientReferral.length - 1]
.patientName,
referralStatus: referralStatus:
"${model.patientReferral[model.patientReferral.length -1].referralStatus}", "${model.patientReferral[model.patientReferral.length - 1].referralStatus}",
isReferredTo: true, isReferredTo: true,
isSameBranch: model isSameBranch: model
.patientReferral[model.patientReferral.length -1].isReferralDoctorSameBranch, .patientReferral[
referralDoctorName: model.patientReferral.length - 1]
model.patientReferral[model.patientReferral.length -1].referredByDoctorInfo, .isReferralDoctorSameBranch,
referralDoctorName: model
.patientReferral[
model.patientReferral.length - 1]
.referredByDoctorInfo,
clinicDescription: null, clinicDescription: null,
remark: model.patientReferral[model.patientReferral.length -1].remarksFromSource, remark: model
referredOn: model.patientReferral[model.patientReferral.length -1].referredOn, .patientReferral[
answerFromTarget: model.patientReferral.length - 1]
model.patientReferral[model.patientReferral.length -1].answerFromTarget, .remarksFromSource,
referredOn: model
.patientReferral[
model.patientReferral.length - 1]
.referredOn,
answerFromTarget: model
.patientReferral[
model.patientReferral.length - 1]
.answerFromTarget,
), ),
], ],
), ),
@ -114,7 +142,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton( child: AppButton(
title: TranslationBase.of(context).refer, title: TranslationBase.of(context).refer,
color: HexColor("#B8382B"), fontWeight: FontWeight.w700,
color: HexColor("#359846"),
onPressed: () { onPressed: () {
if (appointmentDate == null || if (appointmentDate == null ||
_selectedBranch == null || _selectedBranch == null ||
@ -145,262 +174,221 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
); );
} }
Widget ReferralForm(PatientReferralViewModel model, Size screenSize) { Widget referralForm(PatientReferralViewModel model, Size screenSize) {
return Container( return Container(
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16), margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SizedBox( AppTextFieldCustom(
height: 16, height: screenSize.height * 0.075,
), hintText: TranslationBase.of(context).branch,
AppText( dropDownText: _referTo != null ? _referTo['name'] : null,
TranslationBase.of(context).referPatient, enabled: false,
fontWeight: FontWeight.bold, isDropDown: true,
fontSize: 16, onClick: referToList != null
), ? () {
SizedBox( ListSelectDialog dialog = ListSelectDialog(
height: 16, list: referToList,
), attributeName: 'name',
Container( attributeValueId: 'id',
height: screenSize.height * 0.070, okText: TranslationBase.of(context).ok,
child: InkWell( okFunction: (selectedValue) {
onTap: referToList != null setState(() {
? () { _referTo = selectedValue;
ListSelectDialog dialog = ListSelectDialog( _selectedBranch = null;
list: referToList, _selectedClinic = null;
attributeName: 'name', _selectedDoctor = null;
attributeValueId: 'id', model.getDoctorBranch().then((value) async {
okText: TranslationBase.of(context).ok, _selectedBranch = value;
okFunction: (selectedValue) { if (_referTo['id'] == 1) {
setState(() { GifLoaderDialogUtils.showMyDialog(context);
_referTo = selectedValue; await model
_selectedBranch = null; .getClinics(_selectedBranch['facilityId'])
_selectedClinic = null; .then((_) =>
_selectedDoctor = null; GifLoaderDialogUtils.hideDialog(context));
model.getDoctorBranch().then((value) async { if (model.state == ViewState.ErrorLocal) {
_selectedBranch = value; DrAppToastMsg.showErrorToast(model.error);
if (_referTo['id'] == 1) {
GifLoaderDialogUtils.showMyDialog(context);
await model
.getClinics(_selectedBranch['facilityId'])
.then((_) =>
GifLoaderDialogUtils.hideDialog(
context));
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
} }
}); } else {
_selectedBranch = null;
}
}); });
}, });
); },
showDialog( );
barrierDismissible: false, showDialog(
context: context, barrierDismissible: false,
builder: (BuildContext context) { context: context,
return dialog; builder: (BuildContext context) {
}, return dialog;
); },
} );
: null, }
child: TextField( : null,
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referTo,
_referTo != null ? _referTo['name'] : 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).hospital,
onTap: model.branchesList != null && dropDownText: _selectedBranch != null
model.branchesList.length > 0 && ? _selectedBranch['facilityName']
_referTo != null && : null,
_referTo['id'] == 2 enabled: false,
? () { isDropDown: true,
ListSelectDialog dialog = ListSelectDialog( onClick: model.branchesList != null &&
list: model.branchesList, model.branchesList.length > 0 &&
attributeName: 'facilityName', _referTo != null &&
attributeValueId: 'facilityId', _referTo['id'] == 2
okText: TranslationBase.of(context).ok, ? () {
okFunction: (selectedValue) { ListSelectDialog dialog = ListSelectDialog(
setState(() async { list: model.branchesList,
_selectedBranch = selectedValue; attributeName: 'facilityName',
_selectedClinic = null; attributeValueId: 'facilityId',
_selectedDoctor = null; okText: TranslationBase.of(context).ok,
GifLoaderDialogUtils.showMyDialog(context); okFunction: (selectedValue) {
await model setState(() async {
.getClinics(_selectedBranch['facilityId']) _selectedBranch = selectedValue;
.then((_) => _selectedClinic = null;
GifLoaderDialogUtils.hideDialog(context)); _selectedDoctor = null;
if (model.state == ViewState.ErrorLocal) { GifLoaderDialogUtils.showMyDialog(context);
DrAppToastMsg.showErrorToast(model.error); await model
} .getClinics(_selectedBranch['facilityId'])
}); .then((_) =>
}, GifLoaderDialogUtils.hideDialog(context));
); if (model.state == ViewState.ErrorLocal) {
showDialog( DrAppToastMsg.showErrorToast(model.error);
barrierDismissible: false, }
context: context, });
builder: (BuildContext context) { },
return dialog; );
}, showDialog(
); barrierDismissible: false,
} context: context,
: null, builder: (BuildContext context) {
child: TextField( return dialog;
decoration: Helpers.textFieldSelectorDecoration( },
TranslationBase.of(context).branch, );
_selectedBranch != null }
? _selectedBranch['facilityName'] : null,
: 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).clinic,
onTap: _selectedBranch != null && dropDownText: _selectedClinic != null
model.clinicsList != null && ? _selectedClinic['ClinicDescription']
model.clinicsList.length > 0 : null,
? () { enabled: false,
ListSelectDialog dialog = ListSelectDialog( isDropDown: true,
list: model.clinicsList, onClick: _selectedBranch != null &&
attributeName: 'ClinicDescription', model.clinicsList != null &&
attributeValueId: 'ClinicID', model.clinicsList.length > 0
usingSearch: true, ? () {
hintSearchText: ListSelectDialog dialog = ListSelectDialog(
TranslationBase.of(context).clinicSearch, list: model.clinicsList,
okText: TranslationBase.of(context).ok, attributeName: 'ClinicDescription',
okFunction: (selectedValue) { attributeValueId: 'ClinicID',
setState(() async { usingSearch: true,
_selectedDoctor = null; hintSearchText: TranslationBase.of(context).clinicSearch,
_selectedClinic = selectedValue; okText: TranslationBase.of(context).ok,
GifLoaderDialogUtils.showMyDialog(context); okFunction: (selectedValue) {
await model setState(() async {
.getClinicDoctors( _selectedDoctor = null;
_selectedClinic['ClinicID'].toString()) _selectedClinic = selectedValue;
.then((_) => GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.hideDialog(context)); await model
if (model.state == ViewState.ErrorLocal) { .getClinicDoctors(
DrAppToastMsg.showErrorToast(model.error); _selectedClinic['ClinicID'].toString())
} .then((_) =>
}); GifLoaderDialogUtils.hideDialog(context));
}, if (model.state == ViewState.ErrorLocal) {
); DrAppToastMsg.showErrorToast(model.error);
showDialog( }
barrierDismissible: false, });
context: context, },
builder: (BuildContext context) { );
return dialog; showDialog(
}, barrierDismissible: false,
); context: context,
} builder: (BuildContext context) {
: null, return dialog;
child: TextField( },
decoration: Helpers.textFieldSelectorDecoration( );
TranslationBase.of(context).clinic, }
_selectedClinic != null : null,
? _selectedClinic['ClinicDescription']
: 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).doctor,
onTap: _selectedClinic != null && dropDownText:
model.doctorsList != null && _selectedDoctor != null ? _selectedDoctor['DoctorName'] : null,
model.doctorsList.length > 0 enabled: false,
? () { isDropDown: true,
ListSelectDialog dialog = ListSelectDialog( onClick: _selectedClinic != null &&
list: model.doctorsList, model.doctorsList != null &&
attributeName: 'DoctorName', model.doctorsList.length > 0
attributeValueId: 'DoctorID', ? () {
usingSearch: true, ListSelectDialog dialog = ListSelectDialog(
hintSearchText: list: model.doctorsList,
TranslationBase.of(context).doctorSearch, attributeName: 'DoctorName',
okText: TranslationBase.of(context).ok, attributeValueId: 'DoctorID',
okFunction: (selectedValue) { usingSearch: true,
setState(() { hintSearchText: TranslationBase.of(context).doctorSearch,
_selectedDoctor = selectedValue; okText: TranslationBase.of(context).ok,
}); okFunction: (selectedValue) {
}, setState(() {
); _selectedDoctor = selectedValue;
showDialog( });
barrierDismissible: false, },
context: context, );
builder: (BuildContext context) { showDialog(
return dialog; barrierDismissible: false,
}, context: context,
); builder: (BuildContext context) {
} return dialog;
: null, },
child: TextField( );
decoration: Helpers.textFieldSelectorDecoration( }
TranslationBase.of(context).doctor, : null,
_selectedDoctor != null
? _selectedDoctor['DoctorName']
: 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).date,
onTap: () => _selectDate(context, model), dropDownText: appointmentDate != null
child: TextField( ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}"
decoration: Helpers.textFieldSelectorDecoration( : null,
TranslationBase.of(context).chooseAppointment, enabled: false,
appointmentDate != null isDropDown: true,
? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" suffixIcon: Icon(
: null, Icons.calendar_today,
true, color: Colors.black,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
), ),
onClick: (){
_selectDate(context, model);
},
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( AppTextFieldCustom(
child: TextField( hintText:
decoration: Helpers.textFieldSelectorDecoration( TranslationBase.of(context).dietTypeRemarks,
TranslationBase.of(context).remarks, null, false),
enabled: true,
controller: _remarksController, controller: _remarksController,
// inputFormatters: [ inputType: TextInputType.multiline,
// FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS))
// ],
keyboardType: TextInputType.text,
minLines: 4, minLines: 4,
maxLines: 6, maxLines: 6,
)), ),
], ],
), ),
); );

Loading…
Cancel
Save