My appointment fixes

dev_3.3_faiz_payfort
haroon amjad 2 years ago
parent 27b6e04d33
commit 75bfeaa716

@ -158,7 +158,8 @@ class BaseAppClient {
? body['PatientOutSA']
: user['OutSA']
: user['OutSA'];
body['SessionID'] = getSessionId(body['TokenID']); //getSe
body['SessionID'] = getSessionId(body['TokenID'] != null ? body['TokenID'] : ""); //getSe
// body['SessionID'] = body['TokenID']; //getSe
headers = {
'Content-Type': 'application/json',
@ -720,7 +721,8 @@ class BaseAppClient {
String getSessionId(String id) {
///return id.replaceAll(RegExp('/[^\w\s]/'), '');
if (id != null) return id.replaceAll(RegExp('/[^a-zA-Z]'), '');
// if (id != null) return id.replaceAll(RegExp('/[^a-zA-Z]'), '');
return id.replaceAll(RegExp('/[^a-zA-Z]'), '');
}
static defaultHttpParameters() async {

@ -25,6 +25,11 @@ import 'package:provider/provider.dart';
import 'AppointmentDetails.dart';
class MyAppointments extends StatefulWidget {
@override
_MyAppointmentsState createState() => _MyAppointmentsState();
}
class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProviderStateMixin {
List<AppoitmentAllHistoryResultList> upcomingAppoList = [];
List<AppoitmentAllHistoryResultList> arrivedAppoListNew = [];
@ -43,11 +48,6 @@ class MyAppointments extends StatefulWidget {
List<PatientAppointmentList> _patientBookedAndConfirmedAppointmentListHospital = List();
List<PatientAppointmentList> _patientBookedAndConfirmedAppointmentListClinic = List();
@override
_MyAppointmentsState createState() => _MyAppointmentsState();
}
class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProviderStateMixin {
bool isDataLoaded = false;
var sharedPref = new AppSharedPreferences();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -145,23 +145,23 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
widget.upcomingAppoList.clear();
widget.arrivedAppoListNew.clear();
upcomingAppoList.clear();
arrivedAppoListNew.clear();
widget.bookedAppoList.clear();
widget.confirmedAppoList.clear();
widget.arrivedAppoList.clear();
bookedAppoList.clear();
confirmedAppoList.clear();
arrivedAppoList.clear();
widget._patientBookedAppointmentListHospital.clear();
widget._patientConfirmedAppointmentListHospital.clear();
widget._patientArrivedAppointmentListHospital.clear();
_patientBookedAppointmentListHospital.clear();
_patientConfirmedAppointmentListHospital.clear();
_patientArrivedAppointmentListHospital.clear();
widget._patientBookedAppointmentListClinic.clear();
widget._patientConfirmedAppointmentListClinic.clear();
widget._patientArrivedAppointmentListClinic.clear();
_patientBookedAppointmentListClinic.clear();
_patientConfirmedAppointmentListClinic.clear();
_patientArrivedAppointmentListClinic.clear();
widget._patientBookedAndConfirmedAppointmentListHospital.clear();
widget._patientBookedAndConfirmedAppointmentListClinic.clear();
_patientBookedAndConfirmedAppointmentListHospital.clear();
_patientBookedAndConfirmedAppointmentListClinic.clear();
service.getPatientAppointmentHistory(false, languageID, context, isForUpcomming: isForUpcoming, IsForArrived: isForArrived).then((res) {
GifLoaderDialogUtils.hideDialog(context);
@ -170,9 +170,9 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
if (res['AppoimentAllHistoryResultList'].length != 0) {
res['AppoimentAllHistoryResultList'].forEach((v) {
if (isForArrived) {
widget.arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v));
arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v));
} else {
widget.upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
}
});
sortAppointmentList(isForUpcoming, isForArrived);
@ -217,118 +217,118 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
sortAppointmentList(bool isForUpcoming, bool isForArrived) {
if (isForArrived) {
widget.arrivedAppoListNew.forEach((v) {
arrivedAppoListNew.forEach((v) {
if (isBooked(v)) {
widget.bookedAppoList.add(v);
bookedAppoList.add(v);
}
if (isConfirmed(v)) {
widget.confirmedAppoList.add(v);
confirmedAppoList.add(v);
}
if (isArrived(v)) {
widget.arrivedAppoList.add(v);
arrivedAppoList.add(v);
}
});
} else {
widget.upcomingAppoList.forEach((v) {
upcomingAppoList.forEach((v) {
if (isBooked(v)) {
widget.bookedAppoList.add(v);
bookedAppoList.add(v);
}
if (isConfirmed(v)) {
widget.confirmedAppoList.add(v);
confirmedAppoList.add(v);
}
if (isArrived(v)) {
widget.arrivedAppoList.add(v);
arrivedAppoList.add(v);
}
});
}
widget.bookedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = widget._patientBookedAppointmentListClinic
bookedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = _patientBookedAppointmentListClinic
.where(
(elementClinic) => elementClinic.filterName == element.clinicName,
)
.toList();
if (doctorByClinic.length != 0) {
widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
_patientBookedAppointmentListClinic[_patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
} else {
widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
_patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
List<PatientAppointmentList> doctorByHospital = widget._patientBookedAppointmentListHospital
List<PatientAppointmentList> doctorByHospital = _patientBookedAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.toList();
if (doctorByHospital.length != 0) {
widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
_patientBookedAppointmentListHospital[_patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
} else {
widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
_patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
//Merging Booked & Confirmed Appointments into Upcoming Tab
widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientBookedAppointmentListHospital);
widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientBookedAppointmentListClinic);
_patientBookedAndConfirmedAppointmentListHospital.addAll(_patientBookedAppointmentListHospital);
_patientBookedAndConfirmedAppointmentListClinic.addAll(_patientBookedAppointmentListClinic);
});
widget.confirmedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = widget._patientConfirmedAppointmentListClinic
confirmedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = _patientConfirmedAppointmentListClinic
.where(
(elementClinic) => elementClinic.filterName == element.clinicName,
)
.toList();
if (doctorByClinic.length != 0) {
widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
_patientConfirmedAppointmentListClinic[_patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
} else {
widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
_patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
List<PatientAppointmentList> doctorByHospital = widget._patientConfirmedAppointmentListHospital
List<PatientAppointmentList> doctorByHospital = _patientConfirmedAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.toList();
if (doctorByHospital.length != 0) {
widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
_patientConfirmedAppointmentListHospital[_patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
} else {
widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
_patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
//Merging Booked & Confirmed Appointments into Upcoming Tab
widget._patientBookedAndConfirmedAppointmentListHospital.addAll(widget._patientConfirmedAppointmentListHospital);
widget._patientBookedAndConfirmedAppointmentListClinic.addAll(widget._patientConfirmedAppointmentListClinic);
_patientBookedAndConfirmedAppointmentListHospital.addAll(_patientConfirmedAppointmentListHospital);
_patientBookedAndConfirmedAppointmentListClinic.addAll(_patientConfirmedAppointmentListClinic);
});
widget.arrivedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = widget._patientArrivedAppointmentListClinic
arrivedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = _patientArrivedAppointmentListClinic
.where(
(elementClinic) => elementClinic.filterName == element.clinicName,
)
.toList();
if (doctorByClinic.length != 0) {
widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
_patientArrivedAppointmentListClinic[_patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
} else {
widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
_patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
List<PatientAppointmentList> doctorByHospital = widget._patientArrivedAppointmentListHospital
List<PatientAppointmentList> doctorByHospital = _patientArrivedAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.toList();
if (doctorByHospital.length != 0) {
widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
_patientArrivedAppointmentListHospital[_patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
} else {
widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
_patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
// openAppointmentsTab();
@ -345,11 +345,11 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
} else if (flag == 3) {
index = 2;
} else {
if (widget._patientBookedAppointmentListClinic.length != 0) {
if (_patientBookedAppointmentListClinic.length != 0) {
index = 0;
} else if (widget._patientConfirmedAppointmentListClinic.length != 0) {
} else if (_patientConfirmedAppointmentListClinic.length != 0) {
index = 1;
} else if (widget._patientArrivedAppointmentListClinic.length != 0) {
} else if (_patientArrivedAppointmentListClinic.length != 0) {
index = 2;
// return;
}
@ -359,12 +359,12 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
}
Widget getBookedAppointments() {
return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital);
return _getAppointment(bookedAppoList.length, (filterType == FilterType.Clinic) ? _patientBookedAppointmentListClinic : _patientBookedAppointmentListHospital);
}
Widget getBookedAndConfirmedAppointments() {
return _getAppointment((widget.bookedAppoList.length + widget.confirmedAppoList.length),
(filterType == FilterType.Clinic) ? widget._patientBookedAndConfirmedAppointmentListClinic : widget._patientBookedAndConfirmedAppointmentListHospital);
return _getAppointment(
(bookedAppoList.length + confirmedAppoList.length), (filterType == FilterType.Clinic) ? _patientBookedAndConfirmedAppointmentListClinic : _patientBookedAndConfirmedAppointmentListHospital);
}
Widget _getAppointment(int _listLength, List<PatientAppointmentList> _list) {
@ -382,7 +382,9 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(
_currentPage == 0 ? TranslationBase.of(context).noBookedAppo : (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo),
_currentPage == 0
? TranslationBase.of(context).noBookedAppo
: (_currentPage == 1 ? TranslationBase.of(context).noUpcomingAppointment : TranslationBase.of(context).noArrivedAppo),
style: TextStyle(
fontSize: 16.0,
),
@ -461,11 +463,11 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
}
Widget getConfirmedAppointments() {
return _getAppointment(widget.confirmedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientConfirmedAppointmentListClinic : widget._patientConfirmedAppointmentListHospital);
return _getAppointment(confirmedAppoList.length, (filterType == FilterType.Clinic) ? _patientConfirmedAppointmentListClinic : _patientConfirmedAppointmentListHospital);
}
Widget getArrivedAppointments() {
return _getAppointment(widget.arrivedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientArrivedAppointmentListClinic : widget._patientArrivedAppointmentListHospital);
return _getAppointment(arrivedAppoList.length, (filterType == FilterType.Clinic) ? _patientArrivedAppointmentListClinic : _patientArrivedAppointmentListHospital);
}
setFilterType(FilterType filterType) {
@ -479,6 +481,12 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
onTap: () {
setState(() {
_currentPage = _value;
if (_value == 1) {
getPatientAppointmentHistory(true, false);
}
if (_value == 2) {
getPatientAppointmentHistory(false, true);
}
});
},
child: Row(

@ -706,7 +706,7 @@ class _AppDrawerState extends State<AppDrawer> {
_vitalSignService.heightCm = "";
_vitalSignService.weightKg = "";
if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser();
// if (pharmacyModuleViewModel.error.isNotEmpty) await pharmacyModuleViewModel.createUser();
int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2;

Loading…
Cancel
Save