Merge branch 'feature-ucaf' into 'development'

Feature ucaf

See merge request Cloud_Solution/doctor_app_flutter!284
merge-requests/285/merge
Mohammad Aljammal 5 years ago
commit 1f6d2c940c

@ -52,6 +52,8 @@ const Map<String, Map<String, String>> localizedValues = {
'referPatient': {'en': 'Referral Patient', 'ar': 'إحالة مريض'},
'myReferral': {'en': 'My Referral', 'ar': 'إحالة'},
'myReferredPatient': {'en': 'My Referred Patient', 'ar': 'مرضاي المحالين'},
'referredPatient': {'en': 'Referred Patient', 'ar': 'المرضى المحالين'},
'referredOn': {'en': 'referred On : ', 'ar': ' : تمت الإحالة في'},
'firstName': {'en': 'First Name', 'ar': 'الاسم الاول'},
'middleName': {'en': 'Middle Name', 'ar': 'اسم الاب'},
'lastName': {'en': 'Last Name', 'ar': 'اسم العائلة'},
@ -692,5 +694,7 @@ const Map<String, Map<String, String>> localizedValues = {
'referralStatusCancelled': {'en': "Cancelled", 'ar': "ملغاة"},
'referralStatusCompleted': {'en': "Completed", 'ar': "مكتمل"},
'referralStatusNotSeen': {'en': "NotSeen", 'ar': "لم يرى"},
'clinicSearch': {'en': "Search Clinic", 'ar': "بحث عن عيادة"},
'doctorSearch': {'en': "Search Doctor", 'ar': "بحث عن طبيب"},
// 'icd': {'en': "ICD", 'ar': " "},
};

@ -42,7 +42,8 @@ class MyReferralDetailScreen extends StatelessWidget {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient,
body: model.patientArrivalList != null && model.patientArrivalList.length > 0
body: model.patientArrivalList != null &&
model.patientArrivalList.length > 0
? Column(
children: [
Expanded(
@ -77,6 +78,7 @@ class MyReferralDetailScreen extends StatelessWidget {
),
),
PatientReferralItemWidget(
"${pendingReferral.patientID}",
patientName: pendingReferral.patientName,
referralStatus: null,
isReferredTo: false,
@ -86,6 +88,7 @@ class MyReferralDetailScreen extends StatelessWidget {
pendingReferral.referredByDoctorInfo,
clinicDescription: null,
remark: pendingReferral.remarksFromSource,
referredOn: pendingReferral.referredOn,
),
SizedBox(
child: GridView.count(
@ -147,8 +150,9 @@ class MyReferralDetailScreen extends StatelessWidget {
hPadding: 8,
vPadding: 12,
handler: () async {
await model.responseReferral(pendingReferral, true);
if(model.state == ViewState.ErrorLocal){
await model.responseReferral(
pendingReferral, true);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},
@ -166,8 +170,9 @@ class MyReferralDetailScreen extends StatelessWidget {
hPadding: 8,
vPadding: 12,
handler: () async {
await model.responseReferral(pendingReferral, true);
if(model.state == ViewState.ErrorLocal){
await model.responseReferral(
pendingReferral, true);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
},

@ -23,8 +23,7 @@ class MyReferralPatientScreen extends StatelessWidget {
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient,
body: model.pendingReferral == null ||
model.pendingReferral.length == 0
body: model.pendingReferral == null || model.pendingReferral.length == 0
? Center(
child: AppText(
TranslationBase.of(context).referralEmptyMsg,
@ -62,6 +61,7 @@ class MyReferralPatientScreen extends StatelessWidget {
...List.generate(
model.pendingReferral.length,
(index) => PatientReferralItemWidget(
"${model.pendingReferral[index].patientID}",
patientName: model.pendingReferral[index].patientName,
referralStatus: null,
isReferredTo: false,
@ -72,13 +72,13 @@ class MyReferralPatientScreen extends StatelessWidget {
clinicDescription: null,
remark:
model.pendingReferral[index].remarksFromSource,
referredOn: model.pendingReferral[index].referredOn,
infoIcon: InkWell(
onTap: () {
Navigator.of(context).pushNamed(
MY_REFERRAL_DETAIL,
arguments: {
'referral': model.pendingReferral[index]
});
Navigator.of(context)
.pushNamed(MY_REFERRAL_DETAIL, arguments: {
'referral': model.pendingReferral[index]
});
},
child: Icon(
Icons.info_outline,

@ -1,17 +1,14 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
@ -20,8 +17,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../../QR_reader_screen.dart';
class PatientMakeReferralScreen extends StatefulWidget {
// previous design page is: ReferPatientScreen
@override
@ -96,6 +91,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
model.patientReferral.length == 0
? ReferralForm(model, screenSize)
: PatientReferralItemWidget(
"${model.patientReferral[0].patientID}",
patientName: model.patientReferral[0].patientName,
referralStatus:
"${model.patientReferral[0].referralStatus}",
@ -105,7 +101,9 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
referralDoctorName:
model.patientReferral[0].referredByDoctorInfo,
clinicDescription: null,
remark: model.patientReferral[0].remarksFromSource),
remark: model.patientReferral[0].remarksFromSource,
referredOn: model.patientReferral[0].referredOn,
),
],
),
if (model.patientReferral.length == 0)
@ -201,7 +199,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referTo,
_referTo != null ? _referTo['name'] : null,
true),
@ -248,7 +246,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).branch,
_selectedBranch != null
? _selectedBranch['facilityName']
@ -272,6 +270,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
list: model.clinicsList,
attributeName: 'ClinicDescription',
attributeValueId: 'ClinicID',
usingSearch: true,
hintSearchText: TranslationBase.of(context).clinicSearch,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
@ -296,7 +296,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).clinic,
_selectedClinic != null
? _selectedClinic['ClinicDescription']
@ -320,6 +320,8 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
list: model.doctorsList,
attributeName: 'DoctorName',
attributeValueId: 'DoctorID',
usingSearch: true,
hintSearchText: TranslationBase.of(context).doctorSearch,
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) {
setState(() {
@ -337,7 +339,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).doctor,
_selectedDoctor != null
? _selectedDoctor['DoctorName']
@ -355,7 +357,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
child: InkWell(
onTap: () => _selectDate(context, model),
child: TextField(
decoration: textFieldSelectorDecoration(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).chooseAppointment,
appointmentDate != null
? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}"
@ -374,7 +376,7 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
),
Container(
child: TextField(
decoration: textFieldSelectorDecoration(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).remarks, null, false),
enabled: true,
controller: _remarksController,
@ -453,49 +455,4 @@ class _PatientMakeReferralScreenState extends State<PatientMakeReferralScreen> {
});*/
}
}
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.arrow_drop_down,
color: Colors.black,
)
: null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
}
BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration(
color: containerColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(6)),
border: Border.fromBorderSide(BorderSide(
color: borderColor,
width: 2.0,
)),
);
}
}

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.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/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/patient-referral-item-widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -14,7 +15,7 @@ class ReferredPatientScreen extends StatelessWidget {
onModelReady: (model) => model.getMyReferredPatient(),
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).referPatient,
appBarTitle: TranslationBase.of(context).referredPatient,
body: model.listMyReferredPatientModel == null ||
model.listMyReferredPatientModel.length == 0
? Center(
@ -45,6 +46,7 @@ class ReferredPatientScreen extends StatelessWidget {
...List.generate(
model.listMyReferredPatientModel.length,
(index) => PatientReferralItemWidget(
"${model.getReferredPatientItem(index).patientId}",
patientName:
"${model.getReferredPatientItem(index).firstName} ${model.getReferredPatientItem(index).middleName} ${model.getReferredPatientItem(index).lastName}",
referralStatus:
@ -62,6 +64,12 @@ class ReferredPatientScreen extends StatelessWidget {
remark: model
.getReferredPatientItem(index)
.referringDoctorRemarks,
referredOn: model
.getReferredPatientItem(index)
.referralDate !=
null
? DateUtils.convertDateFromServerFormat(model.getReferredPatientItem(index).referralDate, "dd/MM/yyyy")
: null,
),
),
],

@ -117,6 +117,10 @@ class TranslationBase {
String get myReferredPatient =>
localizedValues['myReferredPatient'][locale.languageCode];
String get referredPatient =>
localizedValues['referredPatient'][locale.languageCode];
String get referredOn =>
localizedValues['referredOn'][locale.languageCode];
String get firstName => localizedValues['firstName'][locale.languageCode];
@ -1065,6 +1069,8 @@ String get ICDName =>
String get referralStatusCancelled => localizedValues['referralStatusCancelled'][locale.languageCode];
String get referralStatusCompleted => localizedValues['referralStatusCompleted'][locale.languageCode];
String get referralStatusNotSeen => localizedValues['referralStatusNotSeen'][locale.languageCode];
String get clinicSearch => localizedValues['clinicSearch'][locale.languageCode];
String get doctorSearch => localizedValues['doctorSearch'][locale.languageCode];
String get patientName =>
localizedValues['patient-name'][locale.languageCode];

@ -4,15 +4,18 @@ import 'package:flutter/material.dart';
class PatientReferralItemWidget extends StatelessWidget {
final String patientName;
final String patientID;
final String referralStatus;
final isReferredTo;
final isSameBranch;
final String referralDoctorName;
final String clinicDescription;
final String remark;
final String referredOn;
final Widget infoIcon;
PatientReferralItemWidget({
PatientReferralItemWidget(
this.patientID, {
this.patientName,
this.referralStatus,
this.isReferredTo = false,
@ -20,6 +23,7 @@ class PatientReferralItemWidget extends StatelessWidget {
this.referralDoctorName,
this.clinicDescription,
this.remark,
this.referredOn,
this.infoIcon,
});
@ -35,7 +39,6 @@ class PatientReferralItemWidget extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (referralStatus != null)
Row(
children: [
@ -131,6 +134,25 @@ class PatientReferralItemWidget extends StatelessWidget {
SizedBox(
height: 8,
),
Row(
children: [
AppText(
"${TranslationBase.of(context).patientID}: ",
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 12,
),
AppText(
patientID ?? '-',
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 12,
),
],
),
SizedBox(
height: 8,
),
Row(
children: [
AppText(
@ -140,7 +162,7 @@ class PatientReferralItemWidget extends StatelessWidget {
fontSize: 12,
),
AppText(
patientName??'-',
patientName ?? '-',
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 12,
@ -166,6 +188,25 @@ class PatientReferralItemWidget extends StatelessWidget {
),
],
),
SizedBox(
height: 8,
),
Row(
children: [
AppText(
TranslationBase.of(context).referredOn,
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 12,
),
AppText(
referredOn ?? '-',
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 12,
),
],
),
SizedBox(
height: 16,
),

@ -2,6 +2,8 @@ import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/shared/TextFields.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
class ListSelectDialog extends StatefulWidget {
@ -12,24 +14,32 @@ class ListSelectDialog extends StatefulWidget {
final Function(dynamic) okFunction;
dynamic selectedValue;
final Widget searchWidget;
final bool usingSearch;
final String hintSearchText;
ListSelectDialog(
{@required this.list,
@required this.attributeName,
@required this.attributeValueId,
@required this.okText,
@required this.okFunction,
this.searchWidget});
ListSelectDialog({
@required this.list,
@required this.attributeName,
@required this.attributeValueId,
@required this.okText,
@required this.okFunction,
this.searchWidget,
this.usingSearch = false,
this.hintSearchText,
});
@override
_ListSelectDialogState createState() => _ListSelectDialogState();
}
class _ListSelectDialogState extends State<ListSelectDialog> {
List<dynamic> items = List();
@override
void initState() {
super.initState();
widget.selectedValue = widget.selectedValue ?? widget.list[0];
items.addAll(widget.list);
super.initState();
}
@override
@ -69,7 +79,21 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
child: Column(
children: [
if (widget.searchWidget != null) widget.searchWidget,
...widget.list
if(widget.usingSearch)
Container(
height: MediaQuery.of(context).size.height * 0.070,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
widget.hintSearchText ?? TranslationBase
.of(context)
.search, null, false, suffixIcon: Icon(Icons.search,)),
enabled: true,
keyboardType: TextInputType.text,
onChanged: (value) {
filterSearchResults(value);
},
)),
...items
.map((item) => RadioListTile(
title: Text("${item[widget.attributeName].toString()}"),
groupValue: widget.selectedValue[widget.attributeValueId]
@ -95,4 +119,27 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
static closeAlertDialog(BuildContext context) {
Navigator.of(context).pop();
}
void filterSearchResults(String query) {
List<dynamic> dummySearchList = List();
dummySearchList.addAll(widget.list);
if (query.isNotEmpty) {
List<dynamic> dummyListData = List();
dummySearchList.forEach((item) {
if ("${item[widget.attributeName].toString()}".toLowerCase().contains(query.toLowerCase())) {
dummyListData.add(item);
}
});
setState(() {
items.clear();
items.addAll(dummyListData);
});
return;
} else {
setState(() {
items.clear();
items.addAll(widget.list);
});
}
}
}

Loading…
Cancel
Save