merge-requests/70/head
unknown 6 years ago
commit 0c44c57c2f

@ -1,5 +1,8 @@
final TOKEN = 'token'; final TOKEN = 'token';
final PROJECT_ID='projectID'; final PROJECT_ID='projectID';
//===========amjad============
final DOCTOR_ID='doctorID';
//=======================
final SLECTED_PATIENT_TYPE='slectedPatientType'; final SLECTED_PATIENT_TYPE='slectedPatientType';
final APP_Language = 'language'; final APP_Language = 'language';
final DOCTOR_PROFILE = 'doctorProfile'; final DOCTOR_PROFILE = 'doctorProfile';

@ -51,6 +51,7 @@ class PatiantInformtion {
String genderDescription; String genderDescription;
String nursingStationName; String nursingStationName;
String appointmentDate; String appointmentDate;
String startTime;
PatiantInformtion({ PatiantInformtion({
this.list, this.list,
@ -87,6 +88,7 @@ class PatiantInformtion {
this.genderDescription, this.genderDescription,
this.nursingStationName, this.nursingStationName,
this.appointmentDate, this.appointmentDate,
this.startTime,
}); });
@ -124,6 +126,7 @@ class PatiantInformtion {
genderDescription: json["GenderDescription"], genderDescription: json["GenderDescription"],
nursingStationName: json["NursingStationName"], nursingStationName: json["NursingStationName"],
appointmentDate: json["AppointmentDate"], appointmentDate: json["AppointmentDate"],
startTime: json["StartTime"],
); );

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/models/patient/patient_model.dart'; import 'package:doctor_app_flutter/models/patient/patient_model.dart';
import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../../config/size_config.dart'; import '../../config/size_config.dart';
@ -19,6 +20,7 @@ import '../../config/config.dart';
import '../../models/doctor_profile_model.dart'; import '../../models/doctor_profile_model.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = Helpers();
// OWNER : Ibrahim albitar // OWNER : Ibrahim albitar
// DATE : 19-04-2020 // DATE : 19-04-2020
@ -32,7 +34,7 @@ class PatientSearchScreen extends StatefulWidget {
class _PatientSearchScreenState extends State<PatientSearchScreen> { class _PatientSearchScreenState extends State<PatientSearchScreen> {
String _selectedType = '1'; String _selectedType = '1';
String _selectedLocation = '1'; String _selectedLocation = '1';
String error = '';
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
bool _autoValidate = false; bool _autoValidate = false;
@ -59,45 +61,56 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
PatientOutSA: false); PatientOutSA: false);
void _validateInputs() async { void _validateInputs() async {
print("####IBRAHIM TEST#####" + _patientSearchFormValues.From); try {
// _patientSearchFormValues.TokenID = print("####IBRAHIM TEST#####" + _patientSearchFormValues.From);
List <dynamic> doctorProfiles = await sharedPref.getObj(DOCTOR_PROFILE); // _patientSearchFormValues.TokenID =
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(doctorProfiles[0]); List<dynamic> doctorProfiles = await sharedPref.getObj(DOCTOR_PROFILE);
print(doctorProfile.doctorName); DoctorProfileModel doctorProfile =
if (_formKey.currentState.validate()) { DoctorProfileModel.fromJson(doctorProfiles[0]);
print(doctorProfile.doctorName);
if (_formKey.currentState.validate()) {
//*****If all data are correct then save data to out variables**** //*****If all data are correct then save data to out variables****
_patientSearchFormValues.setFrom = "0";
_patientSearchFormValues.setTo = "0";
print("***************Check validate1*************");
print(_patientSearchFormValues.getFirstName.trim().length);
print("***************Check validate2*************");
_formKey.currentState.save(); _formKey.currentState.save();
_patientSearchFormValues.setFrom = "0";
_patientSearchFormValues.setTo = "0"; //*********************************** */
sharedPref.setString(TOKEN, '@dm!n');
//*********************************** */ sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType);
sharedPref.setString(TOKEN, '@dm!n'); print('_selectedType${_selectedType}');
sharedPref.setString(SLECTED_PATIENT_TYPE, _selectedType); String token = await sharedPref.getString(TOKEN);
print('_selectedType${_selectedType}'); int projectID = await sharedPref.getInt(PROJECT_ID);
String token = await sharedPref.getString(TOKEN); //====================
int projectID = await sharedPref.getInt(PROJECT_ID); int doctorID = doctorProfile.doctorID;//await sharedPref.getInt(DOCTOR_ID);
_patientSearchFormValues.TokenID = token; //====================
_patientSearchFormValues.ProjectID = 15; //projectID; _patientSearchFormValues.TokenID = token;
// print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf"); _patientSearchFormValues.ProjectID = projectID;//15
Navigator.of(context).pushNamed(PATIENTS, arguments: { //===================
"patientSearchForm": _patientSearchFormValues, _patientSearchFormValues.DoctorID = doctorID;
"selectedType": _selectedType //====================
}); // print(_patientSearchFormValues.PatientMobileNumber+"dfdfdfddf");
} else { Navigator.of(context).pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues,
"selectedType": _selectedType
});
} else {
// If all data are not valid then start auto validation. // If all data are not valid then start auto validation.
setState(() { setState(() {
_autoValidate = true; _autoValidate = true;
}); });
}
} catch (err) {
handelCatchErrorCase(err);
} }
} }
handelCatchErrorCase(err) {
//isLoading = false;
//isError = true;
error = helpers.generateContactAdminMsg(err);
//notifyListeners();
throw err;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
@ -187,17 +200,13 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
AppTextFormField( AppTextFormField(
hintText: 'First Name', hintText: 'First Name',
onSaved: (value) { onSaved: (value) {
// _patientSearchFormValues.FirstName = value;
value == null value == null
? _patientSearchFormValues.setFirstName = ? _patientSearchFormValues.setFirstName =
"0" "0"
: _patientSearchFormValues.setFirstName = : _patientSearchFormValues.setFirstName =
value; value;
print("**********Value********");
print(value.toString().trim().isEmpty);
print("**********Value********");
if (value.toString().trim().isEmpty) { if (value.toString().trim().isEmpty) {
_patientSearchFormValues.setFirstName = "0"; _patientSearchFormValues.setFirstName = "0";
} }
}, },
@ -211,19 +220,14 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
AppTextFormField( AppTextFormField(
hintText: 'Middle Name', hintText: 'Middle Name',
onSaved: (value) { onSaved: (value) {
//_patientSearchFormValues.MiddleName = value;
value == null value == null
? _patientSearchFormValues.setMiddleName = ? _patientSearchFormValues.setMiddleName =
"0" "0"
: _patientSearchFormValues.setMiddleName = : _patientSearchFormValues.setMiddleName =
value; value;
if (value.toString().trim().isEmpty) {
// value.toString().trim().isEmpty _patientSearchFormValues.setMiddleName = "0";
// ? _patientSearchFormValues.setMiddleName = }
// "0"
// : _patientSearchFormValues.setMiddleName =
// value;
}, },
// validator: (value) { // validator: (value) {
// return TextValidator().validateName(value); // return TextValidator().validateName(value);
@ -235,16 +239,13 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
AppTextFormField( AppTextFormField(
hintText: 'Last Name', hintText: 'Last Name',
onSaved: (value) { onSaved: (value) {
// _patientSearchFormValues.LastName = value;
value == null value == null
? _patientSearchFormValues.setLastName = "0" ? _patientSearchFormValues.setLastName = "0"
: _patientSearchFormValues.setLastName = : _patientSearchFormValues.setLastName =
value; value;
if (value.toString().trim().isEmpty) {
// value.toString().trim().isEmpty _patientSearchFormValues.setLastName = "0";
// ? _patientSearchFormValues.setLastName = "0" }
// : _patientSearchFormValues.setLastName =
// value;
}, },
// validator: (value) { // validator: (value) {
// return TextValidator().validateName(value); // return TextValidator().validateName(value);
@ -266,8 +267,11 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
.setPatientMobileNumber = "0" .setPatientMobileNumber = "0"
: _patientSearchFormValues : _patientSearchFormValues
.setPatientMobileNumber = value; .setPatientMobileNumber = value;
// _patientSearchFormValues.PatientMobileNumber =
// value; if (value.toString().trim().isEmpty) {
_patientSearchFormValues
.setPatientMobileNumber = "0";
}
}, },
), ),
SizedBox( SizedBox(
@ -285,6 +289,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
? _patientSearchFormValues.setPatientID = 0 ? _patientSearchFormValues.setPatientID = 0
: _patientSearchFormValues.setPatientID = : _patientSearchFormValues.setPatientID =
int.parse(value); int.parse(value);
if (value.toString().trim().isEmpty) {
_patientSearchFormValues.setPatientID = 0;
}
}), }),
SizedBox( SizedBox(
height: 10, height: 10,

@ -15,6 +15,7 @@ import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -201,8 +202,24 @@ class _PatientsScreenState extends State<PatientsScreen> {
return newDate.toString(); return newDate.toString();
} }
convertDateFormat2(String str) {
String timeConvert;
const start = "/Date(";
const end = "+0300)";
final startIndex = str.indexOf(start);
final endIndex = str.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(str.substring(startIndex + start.length, endIndex)));
String newDate = date.year.toString() +
"/" +
date.month.toString().padLeft(2, '0') +
"/" +
date.day.toString().padLeft(2, '0');
return newDate.toString();
}
filterBooking(String str) { filterBooking(String str) {
this.responseModelList = this.responseModelList2; this.responseModelList = this.responseModelList2;
@ -231,21 +248,13 @@ class _PatientsScreenState extends State<PatientsScreen> {
} }
} }
String checkDate(String dateString) { String checkDate(String dateString) {
String date;
DateTime checkedTime = DateTime.parse(dateString); DateTime checkedTime = DateTime.parse(dateString);
DateTime currentTime = DateTime.now(); DateTime currentTime = DateTime.now();
// print("currentTime.day="+currentTime.day.toString());
// print("checkedTime.day="+checkedTime.day.toString());
// print("currentTime.month="+currentTime.month.toString());
// print("checkedTime.month="+checkedTime.month.toString());
// print("currentTime.year="+currentTime.year.toString());
// print("checkedTime.year="+checkedTime.year.toString());
if ((currentTime.year == checkedTime.year) && if ((currentTime.year == checkedTime.year) &&
(currentTime.month == checkedTime.month) && (currentTime.month == checkedTime.month) &&
(currentTime.day == checkedTime.day)) { (currentTime.day == checkedTime.day)) {
return "Today"; return "Today";
} else if ((currentTime.year == checkedTime.year) && } else if ((currentTime.year == checkedTime.year) &&
(currentTime.month == checkedTime.month)) { (currentTime.month == checkedTime.month)) {
@ -254,11 +263,11 @@ class _PatientsScreenState extends State<PatientsScreen> {
} else if ((currentTime.day - checkedTime.day) == -1) { } else if ((currentTime.day - checkedTime.day) == -1) {
return "Tomorrow"; return "Tomorrow";
} }
if ((currentTime.day - checkedTime.day) <= -2) { if ((currentTime.day - checkedTime.day) <= -2) {
return "Next Week"; return "Next Week";
} else { } else {
return "Old Date"; return "Old Date";
} }
} }
return "Old Date"; return "Old Date";
@ -275,111 +284,120 @@ class _PatientsScreenState extends State<PatientsScreen> {
body: patientsProv.isLoading body: patientsProv.isLoading
? DrAppCircularProgressIndeicator() ? DrAppCircularProgressIndeicator()
: patientsProv.isError : patientsProv.isError
? Center( ? DrAppEmbeddedError(error: patientsProv.error)
child: Text( : litems == null
patientsProv.error, ? DrAppEmbeddedError(
style: TextStyle(color: Theme.of(context).errorColor), error: 'You don\'t have any ' +
), patientTypetitle +
) " patiant")
: Container( : Container(
child:
child: ListView(scrollDirection: Axis.vertical, children: < ListView(scrollDirection: Axis.vertical, children: <
Widget>[ Widget>[
Container( Container(
child: litems == null child: litems == null
? Column( ? Column(
children: <Widget>[ children: <Widget>[
Container( Container(
child: Center( child: Center(
child: child: Padding(
Padding( padding: const EdgeInsets.fromLTRB(
padding: const EdgeInsets.fromLTRB(0, 250, 0, 0), 0, 250, 0, 0),
child: DrAppCircularProgressIndeicator(), child:
)), DrAppCircularProgressIndeicator(),
), )),
),
], ],
) )
: Column( : Column(
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: top: MediaQuery.of(context)
MediaQuery.of(context).size.height * .size
.height *
0.03), 0.03),
child: SERVICES_PATIANT2[ child: SERVICES_PATIANT2[
int.parse(patientType)] == int.parse(patientType)] ==
"List_MyOutPatient" "List_MyOutPatient"
? _locationBar(context) ? _locationBar(context)
: Container(), : Container(),
), ),
SizedBox(height: 10.0), SizedBox(height: 10.0),
Container( Container(
width: SizeConfig.screenWidth * 0.80, width: SizeConfig.screenWidth * 0.80,
child: TextField( child: TextField(
controller: _controller, controller: _controller,
onChanged: (String str) { onChanged: (String str) {
this.searchData(str);
this.searchData(str);
},
decoration: buildInputDecoration(
context, 'Search patiant'),
),
),
Container(
margin: EdgeInsets.fromLTRB(15, 0, 15, 0),
child: Column(
children: responseModelList
.map((PatiantInformtion item) {
return InkWell(
child: CardWithBgWidget(
widget: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
AppText(
item.firstName +
" " +
item.lastName +
"- " +
item.patientId.toString(),
fontSize: 2.5 *
SizeConfig.textMultiplier,
fontWeight: FontWeight.bold,
),
SizedBox(
height: 8,
),
SERVICES_PATIANT2[int.parse(
patientType)] ==
"List_MyOutPatient"
? AppText(
convertDate(item
.appointmentDate
.toString()),
fontSize: 2.5 *
SizeConfig
.textMultiplier)
: AppText(
item.nationalityName,
fontSize: 2.5 *
SizeConfig
.textMultiplier)
],
),
),
onTap: () {
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {"patient": item});
}, },
); decoration: buildInputDecoration(
}).toList(), context, 'Search patiant'),
), ),
), ),
], Container(
)) margin:
]))); EdgeInsets.fromLTRB(15, 0, 15, 0),
child: Column(
children: responseModelList
.map((PatiantInformtion item) {
return InkWell(
child: CardWithBgWidget(
widget: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
AppText(
item.firstName +
" " +
item.lastName +
"- " +
item.patientId
.toString(),
fontSize: 2.5 *
SizeConfig
.textMultiplier,
fontWeight:
FontWeight.bold,
),
SizedBox(
height: 8,
),
SERVICES_PATIANT2[int.parse(
patientType)] ==
"List_MyOutPatient"
? AppText(
convertDateFormat2(item
.appointmentDate
.toString())+" "+"-"+" "+item.startTime
,
fontSize: 2.5 *
SizeConfig
.textMultiplier)
: AppText(
item
.nationalityName,
fontSize: 2.5 *
SizeConfig
.textMultiplier)
],
),
),
onTap: () {
Navigator.of(context).pushNamed(
PATIENTS_PROFILE,
arguments: {
"patient": item
});
},
);
}).toList(),
),
),
],
))
])));
} }
//***********amjad update**buildInputDecoration ***to search box******** //***********amjad update**buildInputDecoration ***to search box********
@ -422,15 +440,12 @@ class _PatientsScreenState extends State<PatientsScreen> {
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
onTap: () { onTap: () {
print(_locations.indexOf(item)); print(_locations.indexOf(item));
filterBooking(item.toString()); filterBooking(item.toString());
setState(() { setState(() {
_activeLocation = _locations.indexOf(item); _activeLocation = _locations.indexOf(item);
}); });
}), }),
_isActive _isActive

@ -50,35 +50,61 @@ class _DynamicElementsState extends State<DynamicElements> {
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, textInputType: TextInputType.number,
hintText: 'From', hintText: 'From',
controller: _fromDateController, controller: _fromDateController, //_fromDateController,
// validator: (value) {
// return TextValidator().validateDate(_fromDateController.text);
// },
inputFormatter: ONLY_DATE, inputFormatter: ONLY_DATE,
onTap: () { onTap: () {
_presentDatePicker('_selectedFromDate'); _presentDatePicker('_selectedFromDate');
}, },
// validator: (value) {
// return TextValidator().validateDate(_fromDateController.text);
// },
/*
*@author: Amjad Amireh
*@Date:13/5/2020
*@param:
*@return:check if field empty added static value
*@desc:
*/
onSaved: (value) { onSaved: (value) {
widget._patientSearchFormValues.From = _fromDateController.text; if (_fromDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.From = "0";
} else {
widget._patientSearchFormValues.From =
_fromDateController.text;
}
}, },
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
AppTextFormField( AppTextFormField(
textInputType: TextInputType.number, textInputType: TextInputType.number,
hintText: 'TO', hintText: 'TO',
controller: _toDateController, controller: _fromDateController, //_toDateController,
onTap: () { onTap: () {
_presentDatePicker('_selectedToDate'); _presentDatePicker('_selectedToDate');
}, },
// validator: (value) { // validator: (value) {
// return TextValidator().validateDate(_toDateController.text); // return TextValidator().validateDate(_toDateController.text);
// }, // },
/*
*@author: Amjad Amireh
*@Date:13/5/2020
*@param:
*@return:check if field empty added static value
*@desc:
*/
inputFormatter: ONLY_DATE, inputFormatter: ONLY_DATE,
onSaved: (value) { onSaved: (value) {
widget._patientSearchFormValues.To = _toDateController.text; if (_toDateController.text.toString().trim().isEmpty) {
widget._patientSearchFormValues.To = "0";
} else {
widget._patientSearchFormValues.To = _toDateController.text;
}
}, },
), ),
], ],

Loading…
Cancel
Save