@ -4,9 +4,11 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart
import ' package:diplomaticquarterapp/models/Appointments/FreeSlot.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/FreeSlot.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/timeSlot.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/timeSlot.dart ' ;
import ' package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart ' ;
import ' package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart ' ;
import ' package:diplomaticquarterapp/models/CovidDriveThru/CovidTestProceduresResponse.dart ' ;
import ' package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-alert.dart ' ;
import ' package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-alert.dart ' ;
import ' package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart ' ;
import ' package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart ' ;
import ' package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart ' ;
import ' package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart ' ;
import ' package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
@ -15,7 +17,6 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/transitions/fade_page.dart ' ;
import ' package:diplomaticquarterapp/widgets/transitions/fade_page.dart ' ;
@ -66,7 +67,7 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
ScrollController _scrollController ;
ScrollController _scrollController ;
ProjectViewModel projectViewModel ;
ToDoCountProviderModel toDoProvider ;
@ override
@ override
void initState ( ) {
void initState ( ) {
@ -119,203 +120,211 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
projectViewModel = Provider . of ( context ) ;
ProjectViewModel projectViewModel = Provider . of ( context ) ;
toDoProvider = Provider . of < ToDoCountProviderModel > ( context ) ;
return AppScaffold (
return AppScaffold (
appBarTitle: TranslationBase . of ( context ) . covidTest ,
appBarTitle: TranslationBase . of ( context ) . covidTest ,
isShowAppBar: true ,
isShowAppBar: true ,
showNewAppBar: true ,
showNewAppBar: true ,
showNewAppBarTitle: true ,
showNewAppBarTitle: true ,
body: SingleChildScrollView (
backgroundColor: CustomColors . appBackgroudGrey2Color ,
child: Container (
body: Column (
margin: EdgeInsets . fromLTRB ( 15.0 , 15.0 , 15.0 , 0.0 ) ,
children: [
child: Column (
Expanded (
crossAxisAlignment: CrossAxisAlignment . start ,
child: SingleChildScrollView (
children: < Widget > [
child: Container (
Container (
margin: EdgeInsets . fromLTRB ( 15.0 , 15.0 , 15.0 , 0.0 ) ,
height: 150.0 ,
decoration: BoxDecoration (
image: DecorationImage (
image: AssetImage ( " assets/images/new-design/covid-19-big-banner-bg.png " ) ,
fit: BoxFit . fill ,
) ,
color: Colors . white . withOpacity ( 0.3 ) ,
borderRadius: BorderRadius . all ( Radius . circular ( 10 ) ) ) ,
child: Row (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Container (
margin: EdgeInsets . only ( left: 15.0 , right: 15.0 , top: 30.0 ) ,
child: SvgPicture . asset ( ' assets/images/new-design/covid-19-car.svg ' , width: 90.0 , height: 90.0 ) ,
) ,
Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Container (
margin: EdgeInsets . only ( left: 20.0 , right: 20.0 , top: 20.0 ) ,
child: Text ( TranslationBase . of ( context ) . covidTest , style: TextStyle ( color: Colors . white , fontWeight: FontWeight . bold , fontSize: 24.0 ) ) ,
) ,
Container (
margin: EdgeInsets . only ( left: 20.0 , right: 20.0 , top: 10.0 ) ,
child: Text ( TranslationBase . of ( context ) . driveThru , style: TextStyle ( color: Colors . white , fontSize: 24.0 ) ) ,
) ,
] ,
) ,
] ,
) ,
) ,
Container (
child: Column (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisSize: MainAxisSize . max ,
children: < Widget > [
children: < Widget > [
_buildTableCalendarWithBuilders ( projectViewModel ) ,
Padding (
padding: const EdgeInsets . only ( left: 16 , right: 16 , bottom: 16 ) ,
child: Text ( selectedDate , style: TextStyle ( fontSize: 16.0 , fontWeight: FontWeight . w600 , letterSpacing: - 0.64 ) ) ,
) ,
Container (
Container (
height: 40 ,
child: Column (
child: ListView . builder (
crossAxisAlignment: CrossAxisAlignment . start ,
controller: _scrollController ,
mainAxisSize: MainAxisSize . max ,
scrollDirection: Axis . horizontal ,
children: < Widget > [
itemCount: dayEvents . length ,
Text (
itemBuilder: ( context , index ) {
TranslationBase . of ( context ) . selectAppo ,
return Container (
style: TextStyle (
margin: EdgeInsets . only ( right: ( index = = dayEvents . length - 1 ) ? 16 : 5.0 , left: index = = 0 ? 16 : 5 ) ,
color: Colors . black ,
child: ButtonTheme (
fontSize: 16.0 ,
shape: RoundedRectangleBorder (
letterSpacing: - 0.64 ,
borderRadius: BorderRadius . circular ( 5.0 ) ,
fontWeight: FontWeight . w600 ,
side: BorderSide (
) ,
color: index = = selectedButtonIndex ? CustomColors . green : Colors . black , / / Color of the border
) ,
style: BorderStyle . solid , / / Style of the border
Card (
width: 1.5 , / / width of the border
shape: cardRadius ( 12 ) ,
) ,
child: _buildTableCalendarWithBuilders ( projectViewModel ) ,
) ,
) ,
minWidth: MediaQuery . of ( context ) . size . width * 0.18 ,
mHeight ( 12 ) ,
child: index = = selectedButtonIndex ? getSelectedButton ( index ) : getNormalButton ( index ) ) ,
Text (
) ;
selectedDate ,
} ,
style: TextStyle (
fontSize: 16.0 ,
fontWeight: FontWeight . bold ,
letterSpacing: - 0.64 ,
) ,
) ,
mHeight ( 8 ) ,
Container (
height: 40 ,
child: ListView . builder (
controller: _scrollController ,
scrollDirection: Axis . horizontal ,
itemCount: dayEvents . length ,
itemBuilder: ( context , index ) {
return Container (
margin: EdgeInsets . only ( right: ( index = = dayEvents . length - 1 ) ? 0 : 5.0 , left: index = = 0 ? 0 : 5 ) ,
child: ButtonTheme (
shape: RoundedRectangleBorder (
borderRadius: BorderRadius . circular ( 5.0 ) ,
side: BorderSide (
color: index = = selectedButtonIndex ? CustomColors . green : Colors . black , / / Color of the border
style: BorderStyle . solid , / / Style of the border
width: 1.5 , / / width of the border
) ,
) ,
minWidth: MediaQuery . of ( context ) . size . width * 0.2 ,
child: index = = selectedButtonIndex ? getSelectedButton ( index ) : getNormalButton ( index ) ) ,
) ;
} ,
) ,
) ,
] ,
) ,
) ,
) ,
) ,
SizedBox (
height: 100.0 ,
) ,
] ,
] ,
) ,
) ,
) ,
) ,
SizedBox (
) ,
height: 10.0 ,
) ,
) ,
Card (
if ( CovidTimeSlots . areSlotsAvailable )
elevation: 20 ,
Container (
margin: EdgeInsets . zero ,
color: Colors . grey [ 100 ] ,
shape: cardRadius ( 0 ) ,
margin: EdgeInsets . all ( 10.0 ) ,
child: Container (
child: DefaultButton (
width: double . infinity ,
TranslationBase . of ( context ) . bookNow ,
padding: EdgeInsets . all ( 12 ) ,
( ) {
child: ButtonTheme (
bookCovidTestAppointment ( ) ;
shape: RoundedRectangleBorder (
} ,
borderRadius: BorderRadius . circular ( 10.0 ) ,
) ,
minWidth: MediaQuery . of ( context ) . size . width * 0.7 ,
height: 45.0 ,
child: RaisedButton (
color: CustomColors . green ,
textColor: Colors . white ,
disabledTextColor: Colors . white ,
elevation: 0 ,
disabledColor: Colors . grey [ 500 ] ,
onPressed: ( ) {
bookCovidTestAppointment ( ) ;
} ,
child: Text (
TranslationBase . of ( context ) . bookAppo ,
style: TextStyle (
fontSize: 16.0 ,
letterSpacing: - 0.64 ,
) ,
) ,
) ,
) ,
) ,
] ,
) ,
) ,
) ,
) ,
)
] ,
) ,
) ,
) ;
) ;
}
}
Widget _buildTableCalendarWithBuilders ( ProjectViewModel projectViewModel ) {
Widget _buildTableCalendarWithBuilders ( ProjectViewModel projectViewModel ) {
return Card (
return TableCalendar (
shape: cardRadius ( 12 ) ,
locale: projectViewModel . isArabic ? ' ar_SA ' : ' en_US ' ,
margin: EdgeInsets . all ( 16 ) ,
calendarController: _calendarController ,
clipBehavior: Clip . antiAlias ,
events: _events ,
child: Padding (
initialCalendarFormat: CalendarFormat . month ,
padding: const EdgeInsets . only ( bottom: 12 ) ,
startDay: DateTime . now ( ) ,
child: TableCalendar (
formatAnimation: FormatAnimation . slide ,
locale: projectViewModel . isArabic ? ' ar_SA ' : ' en_US ' ,
startingDayOfWeek: StartingDayOfWeek . sunday ,
calendarController: _calendarController ,
weekendDays: [ DateTime . friday , DateTime . saturday ] ,
events: _events ,
availableGestures: AvailableGestures . horizontalSwipe ,
initialCalendarFormat: CalendarFormat . month ,
availableCalendarFormats: const {
startDay: DateTime . now ( ) ,
CalendarFormat . month: ' ' ,
formatAnimation: FormatAnimation . slide ,
CalendarFormat . week: ' ' ,
startingDayOfWeek: StartingDayOfWeek . sunday ,
} ,
weekendDays: [ DateTime . friday , DateTime . saturday ] ,
calendarStyle: CalendarStyle (
availableGestures: AvailableGestures . horizontalSwipe ,
outsideDaysVisible: false ,
availableCalendarFormats: const {
weekendStyle: TextStyle ( ) . copyWith ( color: Colors . blue [ 800 ] ) ,
CalendarFormat . month: ' ' ,
holidayStyle: TextStyle ( ) . copyWith ( color: Colors . blue [ 800 ] ) ,
CalendarFormat . week: ' ' ,
) ,
} ,
daysOfWeekStyle: DaysOfWeekStyle (
calendarStyle: CalendarStyle (
weekendStyle: TextStyle ( ) . copyWith ( color: Colors . black , fontSize: 11.0 , fontWeight: FontWeight . w600 ) ,
outsideDaysVisible: false ,
weekdayStyle: TextStyle ( ) . copyWith ( color: Colors . black , fontSize: 11.0 , fontWeight: FontWeight . w600 ) ,
weekendStyle: TextStyle ( ) . copyWith ( color: Colors . blue [ 800 ] ) ,
) ,
holidayStyle: TextStyle ( ) . copyWith ( color: Colors . blue [ 800 ] ) ,
headerStyle: HeaderStyle ( centerHeaderTitle: true , formatButtonVisible: false , titleTextStyle: TextStyle ( fontSize: 16 , letterSpacing: - 0.64 , fontWeight: FontWeight . w600 ) ) ,
) ,
builders: CalendarBuilders (
daysOfWeekStyle: DaysOfWeekStyle (
selectedDayBuilder: ( context , date , _ ) {
weekendStyle: TextStyle ( ) . copyWith ( color: Colors . black , fontSize: 11.0 , fontWeight: FontWeight . w600 ) ,
return FadeTransition (
weekdayStyle: TextStyle ( ) . copyWith ( color: Colors . black , fontSize: 11.0 , fontWeight: FontWeight . w600 ) ,
opacity: Tween ( begin: 0.0 , end: 1.0 ) . animate ( _animationController ) ,
) ,
child: Container (
headerStyle: HeaderStyle ( centerHeaderTitle: true , formatButtonVisible: false , titleTextStyle: TextStyle ( fontSize: 16 , letterSpacing: - 0.64 , fontWeight: FontWeight . w600 ) ) ,
margin: const EdgeInsets . all ( 4.0 ) ,
builders: CalendarBuilders (
padding: const EdgeInsets . only ( top: 5.0 , left: 6.0 ) ,
selectedDayBuilder: ( context , date , _ ) {
color: Colors . transparent ,
return FadeTransition (
width: 0 ,
opacity: Tween ( begin: 0.0 , end: 1.0 ) . animate ( _animationController ) ,
height: 0 ,
child: Container (
child: Text (
margin: const EdgeInsets . all ( 4.0 ) ,
' ${ date . day } ' ,
padding: const EdgeInsets . only ( top: 5.0 , left: 5.0 ) ,
style: TextStyle ( ) . copyWith ( fontSize: 14.0 ) ,
color: Colors . transparent ,
) ,
width: 0 ,
) ,
height: 0 ,
) ;
child: Text (
} ,
' ${ date . day } ' ,
todayDayBuilder: ( context , date , _ ) {
style: TextStyle ( ) . copyWith ( fontSize: 14.0 ) ,
return Container (
) ,
decoration: BoxDecoration (
) ,
shape: BoxShape . circle ,
) ;
color: _calendarController . isSelected ( date )
} ,
? Colors . green [ 400 ]
todayDayBuilder: ( context , date , _ ) {
: _calendarController . isToday ( date )
return Container (
? Colors . transparent
decoration: BoxDecoration (
: Color ( 0xff76cfb7 ) ,
shape: BoxShape . circle ,
) ,
color: _calendarController . isSelected ( date )
width: 40.0 ,
? Colors . green [ 400 ]
height: 40.0 ,
: _calendarController . isToday ( date )
child: Center (
? Colors . transparent
child: Text (
: Color ( 0xff76cfb7 ) ,
' ${ date . day } ' ,
) ,
style: TextStyle ( ) . copyWith (
width: 40.0 ,
color: Colors . white ,
height: 40.0 ,
fontSize: 14.0 ,
child: Center (
child: Text (
' ${ date . day } ' ,
style: TextStyle ( ) . copyWith (
color: Colors . white ,
fontSize: 14.0 ,
) ,
) ,
) ,
) ,
) ;
) ,
} ,
) ,
markersBuilder: ( context , date , events , holidays ) {
) ;
final children = < Widget > [ ] ;
} ,
markersBuilder: ( context , date , events , holidays ) {
if ( events . isNotEmpty ) {
final children = < Widget > [ ] ;
children . add (
Positioned (
if ( events . isNotEmpty ) {
right: 4 ,
children . add (
bottom: 4 ,
Positioned (
child: _buildEventsMarker ( date , events ) ,
right: 4 ,
) ,
bottom: 4 ,
) ;
child: _buildEventsMarker ( date , events ) ,
}
) ,
) ;
}
return children ;
return children ;
} ,
} ,
) ,
onDaySelected: ( date , event , _ ) {
_onDaySelected ( date , event , projectViewModel ) ;
_animationController . forward ( from: 0.0 ) ;
} ,
onVisibleDaysChanged: _onVisibleDaysChanged ,
onCalendarCreated: _onCalendarCreated ,
) ,
) ,
) ,
onDaySelected: ( date , event , _ ) {
_onDaySelected ( date , event , projectViewModel ) ;
_animationController . forward ( from: 0.0 ) ;
} ,
onVisibleDaysChanged: _onVisibleDaysChanged ,
onCalendarCreated: _onCalendarCreated ,
) ;
) ;
}
}
@ -353,7 +362,7 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
_eventsParsed = Map . fromIterable ( slotsList , key: ( e ) = > e . slot , value: ( e ) = > e . event ) ;
_eventsParsed = Map . fromIterable ( slotsList , key: ( e ) = > e . slot , value: ( e ) = > e . event ) ;
setState ( ( ) {
setState ( ( ) {
CovidTimeSlots . selectedDate = dateFormatter . format ( DateUtil . convertStringToDate ( freeSlotsResponse [ 0 ] [ ' FreeTimeSlots ' ] ) ) ;
CovidTimeSlots . selectedDate = dateFormatter . format ( DateUtil . convertStringToDate ( freeSlotsResponse [ 0 ] [ ' FreeTimeSlots ' ] ) ) ;
selectedDate = DateUtil . get WeekDay MonthDayYearDateFormatted( DateUtil . convertStringToDate ( freeSlotsResponse [ 0 ] [ ' FreeTimeSlots ' ] ) , projectViewModel . isArabic ? " ar " : " en " ) ;
selectedDate = DateUtil . get MonthDayYearDateFormatted( DateUtil . convertStringToDate ( freeSlotsResponse [ 0 ] [ ' FreeTimeSlots ' ] ) ) ;
selectedDateJSON = freeSlotsResponse [ 0 ] [ ' FreeTimeSlots ' ] ;
selectedDateJSON = freeSlotsResponse [ 0 ] [ ' FreeTimeSlots ' ] ;
} ) ;
} ) ;
openTimeSlotsPickerForDate ( DateUtil . convertStringToDate ( selectedDateJSON ) , docFreeSlots ) ;
openTimeSlotsPickerForDate ( DateUtil . convertStringToDate ( selectedDateJSON ) , docFreeSlots ) ;
@ -363,12 +372,21 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
Widget _buildEventsMarker ( DateTime date , List events ) {
Widget _buildEventsMarker ( DateTime date , List events ) {
return Container (
return Container (
/ / decoration: BoxDecoration (
/ / shape: BoxShape . circle ,
/ / color: _calendarController . isSelected ( date )
/ / ? Colors . green [ 400 ]
/ / : _calendarController . isToday ( date )
/ / ? Colors . brown [ 300 ]
/ / : Colors . blue [ 400 ] ,
/ / ) ,
decoration: containerColorRadiusBorderWidth (
decoration: containerColorRadiusBorderWidth (
_calendarController . isSelected ( date )
_calendarController . isSelected ( date )
? CustomColors . green
? CustomColors . green
: _calendarController . isToday ( date )
: _calendarController . isToday ( date )
? CustomColors . green . withOpacity ( 0.5 )
? CustomColors . green . withOpacity ( 0.5 )
: Colors . white ,
: Colors . white ,
200 ,
200 ,
_calendarController . isSelected ( date ) ? CustomColors . green : Colors . black ,
_calendarController . isSelected ( date ) ? CustomColors . green : Colors . black ,
2 ) ,
2 ) ,
@ -379,7 +397,7 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
' ${ date . day } ' ,
' ${ date . day } ' ,
style: TextStyle ( ) . copyWith (
style: TextStyle ( ) . copyWith (
color: _calendarController . isSelected ( date ) ? Colors . white : Colors . black ,
color: _calendarController . isSelected ( date ) ? Colors . white : Colors . black ,
fontSize: 1 4 .0,
fontSize: 1 3 .0,
) ,
) ,
) ,
) ,
) ,
) ,
@ -395,53 +413,35 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
setState ( ( ) {
setState ( ( ) {
selectedButtonIndex = index ;
selectedButtonIndex = index ;
CovidTimeSlots . selectedTime = dayEvents [ index ] . isoTime ;
CovidTimeSlots . selectedTime = dayEvents [ index ] . isoTime ;
print ( CovidTimeSlots . selectedTime ) ;
} ) ;
} ) ;
} ,
} ,
child: Text ( dayEvents [ index ] . isoTime , style: TextStyle ( fontSize: 12.0 )) ,
child: Text ( dayEvents [ index ] . isoTime , style: TextStyle ( fontSize: 12.0 , fontWeight: FontWeight . bold )) ,
) ;
) ;
}
}
Widget getSelectedButton ( int index ) {
Widget getSelectedButton ( int index ) {
return RaisedButton (
return RaisedButton (
color: CustomColors . green ,
color: CustomColors . green , / / Color of the border
/ / Color of the border
textColor: Colors . white ,
textColor: Colors . white ,
elevation: 0 ,
onPressed: ( ) {
onPressed: ( ) {
setState ( ( ) {
setState ( ( ) {
selectedButtonIndex = index ;
selectedButtonIndex = index ;
CovidTimeSlots . selectedTime = dayEvents [ index ] . isoTime ;
CovidTimeSlots . selectedTime = dayEvents [ index ] . isoTime ;
print ( CovidTimeSlots . selectedTime ) ;
} ) ;
} ) ;
} ,
} ,
child: Text ( dayEvents [ index ] . isoTime , style: TextStyle ( fontSize: 12.0 )) ,
child: Text ( dayEvents [ index ] . isoTime , style: TextStyle ( fontSize: 12.0 , fontWeight: FontWeight . bold )) ,
) ;
) ;
}
}
bookCovidTestAppointment ( ) {
bookCovidTestAppointment ( ) {
var messageEn = " This Appointment is being booked for patient " +
GifLoaderDialogUtils . showMyDialog ( context ) ;
projectViewModel . user . firstName +
DoctorList docObject = new DoctorList ( ) ;
" " +
docObject . doctorID = widget . selectedDoctorID ;
projectViewModel . user . lastName +
docObject . clinicID = widget . selectedClinicID ;
" , Having file number " +
docObject . projectID = widget . projectID ;
projectViewModel . user . patientID . toString ( ) +
insertAppointmentCovidTest ( context , docObject ) ;
" . Please confirm! " ;
var messageAr =
" يتم حجز هذا الموعد المراجع " + projectViewModel . user . firstName + " " + projectViewModel . user . lastName + " , وجود رقم الملف " + projectViewModel . user . patientID . toString ( ) + " . يرجى تأكيد! " ;
ConfirmDialog dialog = new ConfirmDialog (
context: context ,
confirmMessage: projectViewModel . isArabic ? messageAr : messageEn ,
okText: TranslationBase . of ( context ) . confirm ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
okFunction: ( ) {
GifLoaderDialogUtils . showMyDialog ( context ) ;
DoctorList docObject = new DoctorList ( ) ;
docObject . doctorID = widget . selectedDoctorID ;
docObject . clinicID = widget . selectedClinicID ;
docObject . projectID = widget . projectID ;
insertAppointmentCovidTest ( context , docObject ) ;
} ,
cancelFunction: ( ) = > { } ) ;
dialog . showAlertDialog ( context ) ;
}
}
insertAppointmentCovidTest ( context , DoctorList docObject ) {
insertAppointmentCovidTest ( context , DoctorList docObject ) {
@ -452,6 +452,7 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
. then ( ( res ) {
. then ( ( res ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
AppToast . showSuccessToast ( message: " Appointment Booked Successfully " ) ;
AppToast . showSuccessToast ( message: " Appointment Booked Successfully " ) ;
getToDoCount ( ) ;
getPatientShare ( context , res [ ' AppointmentNo ' ] , docObject . clinicID , docObject . projectID , docObject ) ;
getPatientShare ( context , res [ ' AppointmentNo ' ] , docObject . clinicID , docObject . projectID , docObject ) ;
} else {
} else {
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
@ -483,13 +484,28 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
} ) ;
} ) ;
}
}
getToDoCount ( ) {
toDoProvider . setState ( 0 , true ) ;
ClinicListService service = new ClinicListService ( ) ;
service . getActiveAppointmentNo ( context ) . then ( ( res ) {
print ( res [ ' AppointmentActiveNumber ' ] ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
toDoProvider . setState ( res [ ' AppointmentActiveNumber ' ] , true ) ;
} else { }
} ) . catchError ( ( err ) {
print ( err ) ;
} ) ;
}
cancelAppointment ( DoctorList docObject , AppoitmentAllHistoryResultList appo , BuildContext context ) {
cancelAppointment ( DoctorList docObject , AppoitmentAllHistoryResultList appo , BuildContext context ) {
ConfirmDialog . closeAlertDialog ( context ) ;
ConfirmDialog . closeAlertDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
DoctorsListService service = new DoctorsListService ( ) ;
DoctorsListService service = new DoctorsListService ( ) ;
service . cancelAppointment ( appo , context ) . then ( ( res ) {
service . cancelAppointment ( appo , context ) . then ( ( res ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
/ / Future . delayed ( new Duration ( milliseconds: 1500 ) , ( ) {
insertAppointmentCovidTest ( context , docObject ) ;
insertAppointmentCovidTest ( context , docObject ) ;
/ / } ) ;
} else {
} else {
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
@ -522,26 +538,24 @@ class _CovidTimeSlotsState extends State<CovidTimeSlots> with TickerProviderStat
}
}
getCovidFreeSlots ( BuildContext context , int projectID ) {
getCovidFreeSlots ( BuildContext context , int projectID ) {
CovidTimeSlots . areSlotsAvailable = false ;
CovidDriveThruService service = new CovidDriveThruService ( ) ;
CovidDriveThruService service = new CovidDriveThruService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service . getCovidFreeSlots ( context , projectID ) . then ( ( res ) {
service . getCovidFreeSlots ( context , projectID ) . then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
if ( res [ ' COVID19_FreeTimeSlots ' ] . length ! = 0 ) {
if ( res [ ' COVID19_FreeTimeSlots ' ] . length ! = 0 ) {
CovidTimeSlots . areSlotsAvailable = true ;
freeSlotsResponse = res [ ' COVID19_FreeTimeSlots ' ] ;
freeSlotsResponse = res [ ' COVID19_FreeTimeSlots ' ] ;
_getJSONSlots ( ) . then ( ( value ) = > {
_getJSONSlots ( ) . then ( ( value ) = > {
setState ( ( ) = > { widget . selectedClinicID = freeSlotsResponse [ 0 ] [ ' ClinicID ' ] , widget . selectedDoctorID = freeSlotsResponse [ 0 ] [ ' DoctorID ' ] , _events . clear ( ) , _events = value } )
setState ( ( ) = > { widget . selectedClinicID = freeSlotsResponse [ 0 ] [ ' ClinicID ' ] , widget . selectedDoctorID = freeSlotsResponse [ 0 ] [ ' DoctorID ' ] , _events . clear ( ) , _events = value } )
} ) ;
} ) ;
} else {
} else { }
CovidTimeSlots . areSlotsAvailable = false ;
}
} else {
} else {
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
AppToast . showErrorToast ( message: res [ ' ErrorEndUserMessage ' ] ) ;
}
}
} ) . catchError ( ( err ) {
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err . toString ( ) ) ;
print ( err ) ;
print ( err ) ;
} ) ;
} ) ;
}
}