@ -1,3 +1,6 @@
import ' dart:collection ' ;
import ' package:device_calendar/device_calendar.dart ' ;
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart ' ;
@ -11,6 +14,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/SchedulePage.dart';
import ' package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart ' ;
import ' package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
import ' package:diplomaticquarterapp/uitl/CalendarUtils.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_toast.dart ' ;
import ' package:diplomaticquarterapp/uitl/date_uitl.dart ' ;
@ -94,23 +98,30 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
children: < Widget > [
DoctorHeader (
headerModel: HeaderModel (
widget . appo . doctorTitle + " " + widget . appo . doctorNameObj ,
widget . appo . doctorID ,
widget . appo . doctorImageURL ,
widget . appo . doctorSpeciality ,
" " ,
widget . appo . projectName ,
DateUtil . convertStringToDate ( widget . appo . appointmentDate ) ,
widget . appo . startTime . substring ( 0 , 5 ) ,
null ,
widget . appo . doctorRate ,
widget . appo . actualDoctorRate ,
widget . appo . noOfPatientsRate ,
" " ,
decimalDoctorRate: widget . appo . decimalDoctorRate . toString ( )
/ / model . user . emailAddress ,
) ,
isNeedToShowButton: ( widget . appo . clinicID = = 17 | | widget . appo . clinicID = = 47 | | widget . appo . clinicID = = 23 | | widget . appo . clinicID = = 265 | | widget . appo . isExecludeDoctor | | widget . appo . isLiveCareAppointment ) ? false : true ,
widget . appo . doctorTitle + " " + widget . appo . doctorNameObj ,
widget . appo . doctorID ,
widget . appo . doctorImageURL ,
widget . appo . doctorSpeciality ,
" " ,
widget . appo . projectName ,
DateUtil . convertStringToDate ( widget . appo . appointmentDate ) ,
widget . appo . startTime . substring ( 0 , 5 ) ,
null ,
widget . appo . doctorRate ,
widget . appo . actualDoctorRate ,
widget . appo . noOfPatientsRate ,
" " ,
decimalDoctorRate: widget . appo . decimalDoctorRate . toString ( )
/ / model . user . emailAddress ,
) ,
isNeedToShowButton: ( widget . appo . clinicID = = 17 | |
widget . appo . clinicID = = 47 | |
widget . appo . clinicID = = 23 | |
widget . appo . clinicID = = 265 | |
widget . appo . isExecludeDoctor | |
widget . appo . isLiveCareAppointment )
? false
: true ,
buttonTitle: TranslationBase . of ( context ) . schedule ,
buttonIcon: ' assets/images/new/Boo_ Appointment.svg ' ,
showConfirmMessageDialog: false ,
@ -139,7 +150,12 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
onTap: ( index ) {
setState ( ( ) {
if ( index = = 1 ) {
if ( widget . appo . clinicID = = 17 | | widget . appo . clinicID = = 47 | | widget . appo . clinicID = = 23 | | widget . appo . clinicID = = 265 | | widget . appo . isExecludeDoctor | | widget . appo . isLiveCareAppointment ) {
if ( widget . appo . clinicID = = 17 | |
widget . appo . clinicID = = 47 | |
widget . appo . clinicID = = 23 | |
widget . appo . clinicID = = 265 | |
widget . appo . isExecludeDoctor | |
widget . appo . isLiveCareAppointment ) {
_tabController . index = _tabController . previousIndex ;
AppointmentDetails . showFooterButton = false ;
} else {
@ -150,7 +166,12 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
} ,
tabs: [
Tab ( child: Text ( TranslationBase . of ( context ) . appoActions , style: TextStyle ( color: Colors . black ) ) ) ,
widget . appo . clinicID = = 17 | | widget . appo . clinicID = = 23 | | widget . appo . clinicID = = 47 | | widget . appo . clinicID = = 265 | | widget . appo . isExecludeDoctor | | widget . appo . isLiveCareAppointment
widget . appo . clinicID = = 17 | |
widget . appo . clinicID = = 23 | |
widget . appo . clinicID = = 47 | |
widget . appo . clinicID = = 265 | |
widget . appo . isExecludeDoctor | |
widget . appo . isLiveCareAppointment
? Tab (
child: Text ( TranslationBase . of ( context ) . availableAppo , style: TextStyle ( color: Colors . grey ) ) ,
)
@ -563,15 +584,31 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
} ) ;
}
checkIfHasReminder ( ) async {
CalendarUtils calendarUtils = await CalendarUtils . getInstance ( ) ;
DateTime startEventsDate = DateUtil . convertStringToDate ( widget . appo . appointmentDate ) ;
DateTime endEventsDate = DateUtil . convertStringToDate ( widget . appo . appointmentDate ) ;
RetrieveEventsParams params = new RetrieveEventsParams ( startDate: startEventsDate , endDate: endEventsDate ) ;
await calendarUtils . retrieveEvents ( calendarUtils . calendars [ 0 ] . id , params ) . then ( ( value ) {
Result < UnmodifiableListView < Event > > events = value ;
events . data . forEach ( ( element ) {
if ( element . title . contains ( widget . appo . doctorNameObj ) ) calendarUtils . deleteEvent ( calendarUtils . calendars [ 0 ] , element ) ;
} ) ;
} ) ;
}
cancelAppointment ( ) {
ConfirmDialog . closeAlertDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
DoctorsListService service = new DoctorsListService ( ) ;
service . cancelAppointment ( widget . appo , context ) . then ( ( res ) {
projectViewModel . analytics . appointment . appointment_details_cancel ( appointment: widget . appo ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
checkIfHasReminder ( ) ;
getToDoCount ( ) ;
AppToast . showSuccessToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
Navigator . of ( context ) . pop ( ) ;