|
|
|
|
@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCar
|
|
|
|
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
|
|
|
|
@ -15,6 +16,13 @@ class MyAppointments extends StatefulWidget {
|
|
|
|
|
List<AppoitmentAllHistoryResultList> confirmedAppoList = [];
|
|
|
|
|
List<AppoitmentAllHistoryResultList> arrivedAppoList = [];
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> _patientBookedAppointmentListHospital = List();
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> _patientConfirmedAppointmentListHospital =
|
|
|
|
|
List();
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> _patientArrivedAppointmentListHospital = List();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_MyAppointmentsState createState() => _MyAppointmentsState();
|
|
|
|
|
}
|
|
|
|
|
@ -40,7 +48,6 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
body: Container(
|
|
|
|
|
child: Column(children: [
|
|
|
|
|
/// this is will not colored with theme data
|
|
|
|
|
TabBar(
|
|
|
|
|
tabs: [
|
|
|
|
|
Tab(text: TranslationBase.of(context).booked),
|
|
|
|
|
@ -94,7 +101,8 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
}).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
}).showProgressBar(
|
|
|
|
|
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isConfirmed(AppoitmentAllHistoryResultList appo) {
|
|
|
|
|
@ -123,64 +131,176 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
widget.arrivedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.bookedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByHospital =
|
|
|
|
|
widget._patientBookedAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByHospital.length != 0) {
|
|
|
|
|
widget
|
|
|
|
|
._patientBookedAppointmentListHospital[widget
|
|
|
|
|
._patientBookedAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName, patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.confirmedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByHospital =
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByHospital.length != 0) {
|
|
|
|
|
widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital.add(
|
|
|
|
|
PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName,
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.arrivedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByHospital =
|
|
|
|
|
widget._patientArrivedAppointmentListHospital
|
|
|
|
|
.where(
|
|
|
|
|
(elementClinic) =>
|
|
|
|
|
elementClinic.filterName == element.clinicName,
|
|
|
|
|
)
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
if (doctorByHospital.length != 0) {
|
|
|
|
|
widget
|
|
|
|
|
._patientArrivedAppointmentListHospital[widget
|
|
|
|
|
._patientArrivedAppointmentListHospital
|
|
|
|
|
.indexOf(doctorByHospital[0])]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
widget._patientArrivedAppointmentListHospital.add(
|
|
|
|
|
PatientAppointmentList(
|
|
|
|
|
filterName: element.clinicName,
|
|
|
|
|
patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openAppointmentsTab() {
|
|
|
|
|
if (widget.bookedAppoList.length != 0) {
|
|
|
|
|
_tabController.animateTo((_tabController.index + 1) % 1);
|
|
|
|
|
_tabController.index = 0;
|
|
|
|
|
} else if (widget.confirmedAppoList.length != 0) {
|
|
|
|
|
_tabController.animateTo((_tabController.index + 1) % 2);
|
|
|
|
|
_tabController.index = 1;
|
|
|
|
|
} else if (widget.arrivedAppoList.length != 0) {
|
|
|
|
|
_tabController.animateTo((_tabController.index + 1) % 3);
|
|
|
|
|
_tabController.index = 2;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getBookedAppointments() {
|
|
|
|
|
return Container(
|
|
|
|
|
child: widget.bookedAppoList.length != 0
|
|
|
|
|
? new ListView.builder(
|
|
|
|
|
itemCount: widget.bookedAppoList.length,
|
|
|
|
|
itemBuilder: (context, i) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: widget.bookedAppoList[i],
|
|
|
|
|
onReloadAppointmentHistory: getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
child: Center(
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0),
|
|
|
|
|
child: Container(
|
|
|
|
|
child: widget.bookedAppoList.length != 0
|
|
|
|
|
? SingleChildScrollView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/images/new-design/noAppointmentIcon.png"),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0),
|
|
|
|
|
child: Text("No Booked Appointments",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget._patientBookedAppointmentListHospital.length,
|
|
|
|
|
(index) => AppExpandableNotifier(
|
|
|
|
|
title: widget
|
|
|
|
|
._patientBookedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget
|
|
|
|
|
._patientBookedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Image.asset(
|
|
|
|
|
"assets/images/new-design/noAppointmentIcon.png"),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0),
|
|
|
|
|
child: Text("No Booked Appointments",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getConfirmedAppointments() {
|
|
|
|
|
return widget.confirmedAppoList.length != 0
|
|
|
|
|
? Container(
|
|
|
|
|
child: new ListView.builder(
|
|
|
|
|
itemCount: widget.confirmedAppoList.length,
|
|
|
|
|
itemBuilder: (context, i) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: widget.confirmedAppoList[i],
|
|
|
|
|
onReloadAppointmentHistory: getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget._patientConfirmedAppointmentListHospital.length,
|
|
|
|
|
(index) => AppExpandableNotifier(
|
|
|
|
|
title: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget
|
|
|
|
|
._patientConfirmedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(
|
|
|
|
|
@ -206,16 +326,47 @@ class _MyAppointmentsState extends State<MyAppointments>
|
|
|
|
|
Widget getArrivedAppointments() {
|
|
|
|
|
return widget.arrivedAppoList.length != 0
|
|
|
|
|
? Container(
|
|
|
|
|
child: new ListView.builder(
|
|
|
|
|
itemCount: widget.arrivedAppoList.length,
|
|
|
|
|
itemBuilder: (context, i) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: widget.arrivedAppoList[i],
|
|
|
|
|
onReloadAppointmentHistory: getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
margin: EdgeInsets.only(top: 10.0),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
...List.generate(
|
|
|
|
|
widget._patientArrivedAppointmentListHospital.length,
|
|
|
|
|
(index) => AppExpandableNotifier(
|
|
|
|
|
title: widget
|
|
|
|
|
._patientArrivedAppointmentListHospital[index]
|
|
|
|
|
.filterName,
|
|
|
|
|
bodyWidget: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: widget
|
|
|
|
|
._patientArrivedAppointmentListHospital[index]
|
|
|
|
|
.patientDoctorAppointmentList
|
|
|
|
|
.map((doctor) {
|
|
|
|
|
return AppointmentCard(
|
|
|
|
|
appo: doctor,
|
|
|
|
|
onReloadAppointmentHistory:
|
|
|
|
|
getPatientAppointmentHistory,
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
// Container(
|
|
|
|
|
// child: new ListView.builder(
|
|
|
|
|
// itemCount: widget.arrivedAppoList.length,
|
|
|
|
|
// itemBuilder: (context, i) {
|
|
|
|
|
// return AppointmentCard(
|
|
|
|
|
// appo: widget.arrivedAppoList[i],
|
|
|
|
|
// onReloadAppointmentHistory: getPatientAppointmentHistory,
|
|
|
|
|
// );
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
: Container(
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Column(
|
|
|
|
|
|