|
|
|
|
@ -25,7 +25,8 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'AppointmentDetails.dart';
|
|
|
|
|
|
|
|
|
|
class MyAppointments extends StatefulWidget {
|
|
|
|
|
List<AppoitmentAllHistoryResultList> appoList = [];
|
|
|
|
|
List<AppoitmentAllHistoryResultList> upcomingAppoList = [];
|
|
|
|
|
List<AppoitmentAllHistoryResultList> arrivedAppoListNew = [];
|
|
|
|
|
|
|
|
|
|
List<AppoitmentAllHistoryResultList> bookedAppoList = [];
|
|
|
|
|
List<AppoitmentAllHistoryResultList> confirmedAppoList = [];
|
|
|
|
|
@ -39,6 +40,9 @@ class MyAppointments extends StatefulWidget {
|
|
|
|
|
List<PatientAppointmentList> _patientConfirmedAppointmentListClinic =[];
|
|
|
|
|
List<PatientAppointmentList> _patientArrivedAppointmentListClinic =[];
|
|
|
|
|
|
|
|
|
|
List<PatientAppointmentList> _patientBookedAndConfirmedAppointmentListHospital = [];
|
|
|
|
|
List<PatientAppointmentList> _patientBookedAndConfirmedAppointmentListClinic = [];
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_MyAppointmentsState createState() => _MyAppointmentsState();
|
|
|
|
|
}
|
|
|
|
|
@ -52,7 +56,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
|
|
|
|
|
FilterType? filterType;
|
|
|
|
|
|
|
|
|
|
int _currentPage = 0;
|
|
|
|
|
int _currentPage = 1;
|
|
|
|
|
|
|
|
|
|
ToDoCountProviderModel? toDoProvider;
|
|
|
|
|
ProjectViewModel? projectViewModel;
|
|
|
|
|
@ -61,7 +65,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
void initState() {
|
|
|
|
|
filterType = FilterType.Clinic;
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) getPatientAppointmentHistory();
|
|
|
|
|
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) getPatientAppointmentHistory(true, false);
|
|
|
|
|
});
|
|
|
|
|
imagesInfo.add(ImagesInfo(
|
|
|
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png'));
|
|
|
|
|
@ -86,7 +90,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
backgroundColor: Color(0xffF8F8F8),
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
showDropDown: true,
|
|
|
|
|
showDropDown: false,
|
|
|
|
|
dropdownIndexValue: _currentPage,
|
|
|
|
|
dropDownIndexChange: (index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -94,8 +98,8 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
dropDownList: [
|
|
|
|
|
TranslationBase.of(context).booked,
|
|
|
|
|
TranslationBase.of(context).confirmed,
|
|
|
|
|
// TranslationBase.of(context).booked,
|
|
|
|
|
TranslationBase.of(context).upcoming,
|
|
|
|
|
TranslationBase.of(context).arrived,
|
|
|
|
|
],
|
|
|
|
|
description: TranslationBase.of(context).infoMyAppointments,
|
|
|
|
|
@ -115,10 +119,10 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
children: [
|
|
|
|
|
myRadioButton(TranslationBase.of(context).booked, 0),
|
|
|
|
|
myRadioButton(TranslationBase.of(context).confirmed, 1),
|
|
|
|
|
myRadioButton(TranslationBase.of(context).upcoming, 1),
|
|
|
|
|
// myRadioButton(TranslationBase.of(context).upcoming, 1),
|
|
|
|
|
myRadioButton(TranslationBase.of(context).arrived, 2),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -127,7 +131,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: IndexedStack(
|
|
|
|
|
index: _currentPage,
|
|
|
|
|
children: [getBookedAppointments(), getConfirmedAppointments(), getArrivedAppointments()],
|
|
|
|
|
children: [getBookedAppointments(), getBookedAndConfirmedAppointments(), getArrivedAppointments()],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container(),
|
|
|
|
|
@ -136,11 +140,14 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPatientAppointmentHistory() {
|
|
|
|
|
int languageID = projectViewModel!.isArabic! ? 1 : 2;
|
|
|
|
|
getPatientAppointmentHistory(bool isForUpcoming, bool isForArrived) {
|
|
|
|
|
int? languageID = projectViewModel!.isArabic ? 1 : 2;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
DoctorsListService service = new DoctorsListService();
|
|
|
|
|
widget.appoList.clear();
|
|
|
|
|
|
|
|
|
|
widget.upcomingAppoList.clear();
|
|
|
|
|
widget.arrivedAppoListNew.clear();
|
|
|
|
|
|
|
|
|
|
widget.bookedAppoList.clear();
|
|
|
|
|
widget.confirmedAppoList.clear();
|
|
|
|
|
widget.arrivedAppoList.clear();
|
|
|
|
|
@ -153,19 +160,23 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
widget._patientConfirmedAppointmentListClinic.clear();
|
|
|
|
|
widget._patientArrivedAppointmentListClinic.clear();
|
|
|
|
|
|
|
|
|
|
service.getPatientAppointmentHistory(false, languageID, context).then((res) {
|
|
|
|
|
widget._patientBookedAndConfirmedAppointmentListHospital.clear();
|
|
|
|
|
widget._patientBookedAndConfirmedAppointmentListClinic.clear();
|
|
|
|
|
|
|
|
|
|
service.getPatientAppointmentHistory(false, languageID, context, isForUpcomming: isForUpcoming, IsForArrived: isForArrived).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
setState(() {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
// setState(() {
|
|
|
|
|
if (res['AppoimentAllHistoryResultList'].length != 0) {
|
|
|
|
|
// isDataLoaded = true;
|
|
|
|
|
res['AppoimentAllHistoryResultList'].forEach((v) {
|
|
|
|
|
widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
|
|
|
|
if (isForArrived) {
|
|
|
|
|
widget.arrivedAppoListNew.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
|
|
|
|
} else {
|
|
|
|
|
widget.upcomingAppoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
sortAppointmentList();
|
|
|
|
|
sortAppointmentList(isForUpcoming, isForArrived);
|
|
|
|
|
} else {}
|
|
|
|
|
// });
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
@ -180,11 +191,12 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getToDoCount() {
|
|
|
|
|
toDoProvider!.setState(0, true, "0");
|
|
|
|
|
toDoProvider!.setState(0, 0, true, "0");
|
|
|
|
|
ClinicListService service = new ClinicListService();
|
|
|
|
|
service.getActiveAppointmentNo(context).then((res) {
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
toDoProvider!.setState(res['AppointmentActiveNumber'], true, "0");
|
|
|
|
|
// toDoProvider.setState(res['AppointmentActiveNumber'], true, "0");
|
|
|
|
|
toDoProvider!.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, "0");
|
|
|
|
|
} else {}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
@ -203,20 +215,36 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
return AppointmentType.isBooked(appo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sortAppointmentList() {
|
|
|
|
|
widget.appoList.forEach((v) {
|
|
|
|
|
if (isBooked(v)) {
|
|
|
|
|
widget.bookedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
sortAppointmentList(bool isForUpcoming, bool isForArrived) {
|
|
|
|
|
if (isForArrived) {
|
|
|
|
|
widget.arrivedAppoListNew.forEach((v) {
|
|
|
|
|
if (isBooked(v)) {
|
|
|
|
|
widget.bookedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isConfirmed(v)) {
|
|
|
|
|
widget.confirmedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
if (isConfirmed(v)) {
|
|
|
|
|
widget.confirmedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isArrived(v)) {
|
|
|
|
|
widget.arrivedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (isArrived(v)) {
|
|
|
|
|
widget.arrivedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
widget.upcomingAppoList.forEach((v) {
|
|
|
|
|
if (isBooked(v)) {
|
|
|
|
|
widget.bookedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isConfirmed(v)) {
|
|
|
|
|
widget.confirmedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isArrived(v)) {
|
|
|
|
|
widget.arrivedAppoList.add(v);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
widget.bookedAppoList.forEach((element) {
|
|
|
|
|
List<PatientAppointmentList> doctorByClinic = widget._patientBookedAppointmentListClinic
|
|
|
|
|
@ -242,6 +270,10 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
} else {
|
|
|
|
|
widget._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);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.confirmedAppoList.forEach((element) {
|
|
|
|
|
@ -268,6 +300,10 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
} else {
|
|
|
|
|
widget._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);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
widget.arrivedAppoList.forEach((element) {
|
|
|
|
|
@ -295,7 +331,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openAppointmentsTab();
|
|
|
|
|
// openAppointmentsTab();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -326,6 +362,11 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getBookedAndConfirmedAppointments() {
|
|
|
|
|
return _getAppointment((widget.bookedAppoList.length + widget.confirmedAppoList.length),
|
|
|
|
|
(filterType == FilterType.Clinic) ? widget._patientBookedAndConfirmedAppointmentListClinic : widget._patientBookedAndConfirmedAppointmentListHospital);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _getAppointment(int _listLength, List<PatientAppointmentList> _list) {
|
|
|
|
|
return Container(
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -341,7 +382,7 @@ 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).noConfirmedAppo : 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,
|
|
|
|
|
),
|
|
|
|
|
@ -388,7 +429,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
).then((value) {
|
|
|
|
|
getPatientAppointmentHistory();
|
|
|
|
|
getPatientAppointmentHistory(true, false);
|
|
|
|
|
}),
|
|
|
|
|
isInOutPatient: _appointmentResult.isInOutPatient,
|
|
|
|
|
name: _appointmentResult.doctorTitle! + " " + _appointmentResult.doctorNameObj!,
|
|
|
|
|
@ -453,6 +494,12 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
|
|
|
|
|
onChanged: (index) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_currentPage = index!;
|
|
|
|
|
if (_value == 1) {
|
|
|
|
|
getPatientAppointmentHistory(true, false);
|
|
|
|
|
}
|
|
|
|
|
if (_value == 2) {
|
|
|
|
|
getPatientAppointmentHistory(false, true);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//_pageController.animateToPage(index, duration: Duration(milliseconds: 250), curve: Curves.easeInOut);
|
|
|
|
|
},
|
|
|
|
|
|