@ -212,13 +212,11 @@ class _BookConfirmState extends State<BookConfirm> {
disabledBackgroundColor: new Color ( 0xFFbcc2c4 ) . withOpacity ( 0.12 ) ,
elevation: 0 ,
onPressed: ( ) async {
bool isLiveCareSchedule = await this . sharedPref . getBool (
IS_LIVECARE_APPOINTMENT ) ? ? false ;
bool isLiveCareSchedule = await this . sharedPref . getBool ( IS_LIVECARE_APPOINTMENT ) ? ? false ;
if ( isLiveCareSchedule ) {
insertLiveCareScheduledAppointment ( context , widget . doctor ) ;
} else {
checkPatientHasDermaPackage (
widget . doctor , projectViewModel . user . patientID ! ) ;
checkPatientHasDermaPackage ( widget . doctor , projectViewModel . user . patientID ! ) ;
}
} ,
child: Text ( TranslationBase . of ( context ) . bookAppo , style: TextStyle ( fontSize: 16.0 , letterSpacing: - 0.48 , color: Colors . white ) ) ,
@ -256,7 +254,7 @@ class _BookConfirmState extends State<BookConfirm> {
) ;
}
cancelAppointment ( DoctorList docObject , AppoitmentAllHistoryResultList appo , BuildContext context , { int ? invoiceNumber , int ? lineItemNo } ) async {
cancelAppointment ( DoctorList docObject , AppoitmentAllHistoryResultList appo , BuildContext context , { int ? invoiceNumber , int ? lineItemNo } ) async {
ConfirmDialog . closeAlertDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context , barrierDismissible: false ) ;
DoctorsListService service = new DoctorsListService ( ) ;
@ -268,7 +266,7 @@ class _BookConfirmState extends State<BookConfirm> {
if ( isLiveCareSchedule ! = null & & isLiveCareSchedule ) {
insertLiveCareScheduledAppointment ( context , widget . doctor ) ;
} else {
insertAppointment ( context, widget. doctor , widget . initialSlotDuration , invoiceNumber: invoiceNumber , lineItemNo: lineItemNo ) ;
insertAppointment ( widget. doctor , widget . initialSlotDuration , invoiceNumber: invoiceNumber , lineItemNo: lineItemNo ) ;
}
} ) ;
} else {
@ -322,55 +320,53 @@ class _BookConfirmState extends State<BookConfirm> {
print ( err ) ;
} ) ;
}
checkPatientHasDermaPackage ( DoctorList doctor , int patientID ) {
checkPatientHasDermaPackage ( DoctorList doctor , int patientID ) {
GifLoaderDialogUtils . showMyDialog ( context ) ;
widget . service
/ / . insertAppointment ( docObject . doctorID ! , docObject . clinicID ! , docObject . projectID ! , widget . selectedTime , widget . selectedDate , initialSlotDuration , context , ' null ' , null , null , projectViewModel )
. checkPatientHasDermaPackage ( patientID ! , doctor . clinicID ! , doctor . projectID ! , doctor . doctorID ! , projectViewModel . isArabic ? 1 : 2 , context ,
)
. checkPatientHasDermaPackage (
patientID ! ,
doctor . clinicID ! ,
doctor . projectID ! ,
doctor . doctorID ! ,
projectViewModel . isArabic ? 1 : 2 ,
context ,
)
. then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( res [ ' MessageStatus ' ] = = 1 & & res [ ' PatientPackageComponent ' ] [ ' Message ' ] = = ' Success ' ) {
if ( res [ ' MessageStatus ' ] = = 1 & & res [ ' PatientPackageComponent ' ] [ ' Message ' ] = = ' Success ' ) {
PatientPackageComponent package = PatientPackageComponent . fromJson ( res [ ' PatientPackageComponent ' ] ) ;
ConfirmDialog dialog = ConfirmDialog (
context: context ,
confirmMessage: " ${ TranslationBase . of ( context ) . existingPackage } , ${ package . patientPackageComponents ! [ 0 ] . procedureName } , ${ TranslationBase . of ( context ) . continueOrbookNew } " ,
okText: TranslationBase . of ( context ) . continues ,
cancelText: TranslationBase . of ( context ) . newAppointment ,
confirmMessage: " ${ TranslationBase . of ( context ) . existingPackage } ${ package . patientPackageComponents ! [ 0 ] . procedureName } , ${ TranslationBase . of ( context ) . continueOrbookNew } " ,
okText: TranslationBase . of ( context ) . proceedPackage ,
cancelText: TranslationBase . of ( context ) . newAppointment ,
okFunction: ( ) = > {
ConfirmDialog . closeAlertDialog ( context ) ,
insertAppointment (
context , widget . doctor , widget . initialSlotDuration , invoiceNumber: package . patientPackageComponents ! [ 0 ] . invoiceNo , lineItemNo: package . patientPackageComponents ! [ 0 ] . lineItemNo ) } ,
cancelFunction: ( ) = > {
ConfirmDialog . closeAlertDialog ( context ) ,
insertAppointment (
context , widget . doctor , widget . initialSlotDuration )
ConfirmDialog . closeAlertDialog ( context ) ,
insertAppointment ( widget . doctor , widget . initialSlotDuration , invoiceNumber: package . patientPackageComponents ! [ 0 ] . invoiceNo , lineItemNo: package . patientPackageComponents ! [ 0 ] . lineItemNo )
} ,
cancelFunction: ( ) = > { insertAppointment ( widget . doctor , widget . initialSlotDuration ) } ,
) ;
dialog . showAlertDialog ( context ) ;
} else {
insertAppointment (
context , widget . doctor , widget . initialSlotDuration ) ;
} else {
insertAppointment ( widget . doctor , widget . initialSlotDuration ) ;
}
} ) . onError ( ( error , stackTrace ) {
insertAppointment (
context , widget . doctor , widget . initialSlotDuration ) ;
insertAppointment ( widget . doctor , widget . initialSlotDuration ) ;
} ) ;
}
insertAppointment ( context, DoctorList docObject , int initialSlotDuration , { int ? invoiceNumber , int ? lineItemNo } ) async {
insertAppointment ( DoctorList docObject , int initialSlotDuration , { int ? invoiceNumber , int ? lineItemNo } ) async {
final timeSlot = DocAvailableAppointments . selectedAppoDateTime ;
String logs = await sharedPref . getString ( ' selectedLogSlots ' ) ;
List < dynamic > decodedLogs = json . decode ( logs ) ;
GifLoaderDialogUtils . showMyDialog ( context , barrierDismissible: fals e) ;
GifLoaderDialogUtils . showMyDialog ( context , barrierDismissible: tru e) ;
AppoitmentAllHistoryResultList appo ;
widget . service
/ / . insertAppointment ( docObject . doctorID ! , docObject . clinicID ! , docObject . projectID ! , widget . selectedTime , widget . selectedDate , initialSlotDuration , context , ' null ' , null , null , projectViewModel )
. insertAppointment ( docObject . doctorID ! , docObject . clinicID ! , docObject . projectID ! , widget . selectedTime , widget . selectedDate , initialSlotDuration , projectViewModel . isArabic ? 1 : 2 , context ,
null , null , null , projectViewModel , invoiceNumber , lineItemNo ! )
null , null , null , projectViewModel , invoiceNumber , lineItemNo )
. then ( ( res ) {
if ( res [ ' MessageStatus ' ] = = 1 ) {
AppToast . showSuccessToast ( message: TranslationBase . of ( context ) . bookedSuccess ) ;
@ -407,14 +403,14 @@ class _BookConfirmState extends State<BookConfirm> {
confirmMessage: res [ ' ErrorEndUserMessage ' ] ,
okText: TranslationBase . of ( context ) . confirm ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
okFunction: ( ) = > { cancelAppointment ( docObject , appo , context , invoiceNumber: invoiceNumber , lineItemNo: lineItemNo ! ) } ,
okFunction: ( ) = > { cancelAppointment ( docObject , appo , context , invoiceNumber: invoiceNumber , lineItemNo: lineItemNo ) } ,
cancelFunction: ( ) = > { } ,
) ;
dialog . showAlertDialog ( context ) ;
}
} ) . catchError ( ( err ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showErrorToast ( message: err );
AppToast . showErrorToast ( message: err , localContext: context );
} ) ;
projectViewModel . analytics . appointment . book_appointment_click_confirm ( appointment_type: ' regular ' , dateTime: timeSlot ! , doctor: widget . doctor ) ;
}