@ -1,4 +1,5 @@
import ' package:diplomaticquarterapp/config/shared_pref_kay.dart ' ;
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/models/Authentication/authenticated_user.dart ' ;
import ' package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart ' ;
import ' package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart ' ;
@ -8,8 +9,10 @@ import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import ' package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart ' ;
import ' package:diplomaticquarterapp/widgets/transitions/fade_page.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:provider/provider.dart ' ;
class LiveCareHistoryCard extends StatefulWidget {
ErRequestHistoryList erRequestHistoryList ;
@ -24,6 +27,8 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
AuthenticatedUser authUser = new AuthenticatedUser ( ) ;
AppSharedPreferences sharedPref = AppSharedPreferences ( ) ;
ProjectViewModel projectViewModel ;
@ override
void initState ( ) {
getAuthenticatedUser ( ) ;
@ -32,6 +37,7 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
@ override
Widget build ( BuildContext context ) {
projectViewModel = Provider . of ( context ) ;
return Container (
margin: EdgeInsets . all ( 10.0 ) ,
child: Card (
@ -48,23 +54,14 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisSize: MainAxisSize . min ,
children: < Widget > [
Text ( " Requested date: " ,
style:
TextStyle ( fontSize: 16.0 , fontWeight: FontWeight . bold ) ) ,
Text ( TranslationBase . of ( context ) . requestedDate , style: TextStyle ( fontSize: 16.0 , fontWeight: FontWeight . bold ) ) ,
Container (
margin: EdgeInsets . only ( top: 1 0.0) ,
margin: EdgeInsets . only ( top: 0.0 ) ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: < Widget > [
Text ( widget . erRequestHistoryList . sArrivalTime ,
style: TextStyle ( fontSize: 14.0 ) ) ,
Text (
" Call Duration \n " +
getCallTime (
widget . erRequestHistoryList . callDuration ) ,
textAlign: TextAlign . center ,
style:
TextStyle ( fontSize: 14.0 , color: Colors . grey [ 600 ] ) ) ,
Text ( widget . erRequestHistoryList . sArrivalTime , style: TextStyle ( fontSize: 14.0 ) ) ,
Text ( TranslationBase . of ( context ) . callDuration + " \n " + getCallTime ( widget . erRequestHistoryList . callDuration ) , textAlign: TextAlign . center , style: TextStyle ( fontSize: 14.0 , color: Colors . grey [ 600 ] ) ) ,
] ,
) ,
) ,
@ -76,8 +73,7 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
color: Colors . green ,
) ,
margin: EdgeInsets . only ( top: 5.0 , bottom: 5.0 ) ,
child: Text ( widget . erRequestHistoryList . stringCallStatus ,
style: TextStyle ( fontSize: 14.0 , color: Colors . white ) ) ,
child: Text ( widget . erRequestHistoryList . stringCallStatus , style: TextStyle ( fontSize: 14.0 , color: Colors . white ) ) ,
) ,
Divider (
color: Colors . grey [ 500 ] ,
@ -90,17 +86,15 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
Expanded (
child: InkWell (
onTap: ( ) {
print ( " Invoice " ) ;
openInvoice ( ) ;
} ,
child: Container (
child: Row (
children: < Widget > [
Icon ( Icons . content_paste , color: Colors . blue ) ,
Icon ( Icons . content_paste , color: Colors . red ) ,
Container (
margin: EdgeInsets . only ( left: 10.0 ) ,
child: Text ( " Invoice " ,
textAlign: TextAlign . center ) ,
child: Text ( TranslationBase . of ( context ) . invoice , textAlign: TextAlign . center , style: TextStyle ( fontSize: 12.0 ) ) ,
) ,
] ,
) ,
@ -110,7 +104,6 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
Expanded (
child: InkWell (
onTap: ( ) {
print ( " Complaints " ) ;
openComplaint ( ) ;
} ,
child: Container (
@ -119,8 +112,7 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
Icon ( Icons . add , size: 24.0 , color: Colors . red ) ,
Container (
margin: EdgeInsets . only ( left: 10.0 ) ,
child: Text ( " Complaints " ,
textAlign: TextAlign . center ) ,
child: Text ( TranslationBase . of ( context ) . complaint , textAlign: TextAlign . center , style: TextStyle ( fontSize: 12.0 ) ) ,
) ,
] ,
) ,
@ -130,19 +122,16 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
Expanded (
child: InkWell (
onTap: ( ) {
print( " Rate Dr & Appointment " ) ;
rateLiveCareAppo( ) ;
} ,
child: Container (
child: Row (
children: < Widget > [
Icon ( Icons . star ,
size: 24.0 , color: Colors . yellow [ 700 ] ) ,
Icon ( Icons . star , size: 24.0 , color: Colors . yellow [ 700 ] ) ,
Container (
width: MediaQuery . of ( context ) . size . width * 0.2 ,
margin: EdgeInsets . only ( left: 10.0 ) ,
child: Text ( " Rate Dr & Appointment " ,
overflow: TextOverflow . clip ,
textAlign: TextAlign . center ) ,
child: Text ( TranslationBase . of ( context ) . rateDoctorAppo , overflow: TextOverflow . clip , textAlign: TextAlign . center , style: TextStyle ( fontSize: 12.0 ) ) ,
) ,
] ,
) ,
@ -159,16 +148,25 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
) ;
}
rateLiveCareAppo ( ) {
if ( widget . erRequestHistoryList . isAppointmentHaveRating ) {
AppToast . showErrorToast ( message: TranslationBase . of ( context ) . alreadyRated ) ;
} else {
}
}
openInvoice ( ) {
ConfirmDialog dialog = new ConfirmDialog (
context: context ,
confirmMessage: " Send a copy of this invoice to the email: " +
authUser . emailAddress ,
okText: TranslationBase . of ( context ) . confirm ,
cancelText: TranslationBase . of ( context ) . cancel_nocaps ,
okFunction: ( ) = > { sendInvoiceEmail ( context ) } ,
cancelFunction: ( ) = > { } ) ;
dialog . showAlertDialog ( context ) ;
show Dialog(
context: context ,
child: ConfirmSendEmailDialog (
email: projectViewModel . u ser. emailAddress ,
o nTapSendEmail: ( ) {
sendInvoiceEmail ( context ) ;
} ,
) ,
) ;
}
openComplaint ( ) {
@ -176,17 +174,10 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
}
sendInvoiceEmail ( context ) {
ConfirmDialog . closeAlertDialog ( context ) ;
LiveCareService service = new LiveCareService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service
. sendLiveCareInvoiceEmail (
widget . erRequestHistoryList . appointmentNo . toString ( ) ,
widget . erRequestHistoryList . projectID ,
authUser . emailAddress ,
context )
. then ( ( res ) {
AppToast . showSuccessToast ( message: " LiveCare invoice sent successfully " ) ;
service . sendLiveCareInvoiceEmail ( widget . erRequestHistoryList . appointmentNo . toString ( ) , widget . erRequestHistoryList . projectID , authUser . emailAddress , context ) . then ( ( res ) {
AppToast . showSuccessToast ( message: TranslationBase ( context ) . emailSentSuccessfully ) ;
} ) . catchError ( ( err ) {
AppToast . showErrorToast ( message: err ) ;
print ( err ) ;
@ -195,8 +186,7 @@ class _LiveCareHistoryCardState extends State<LiveCareHistoryCard> {
getAuthenticatedUser ( ) async {
if ( await this . sharedPref . getObject ( USER_PROFILE ) ! = null ) {
var data = AuthenticatedUser . fromJson (
await this . sharedPref . getObject ( USER_PROFILE ) ) ;
var data = AuthenticatedUser . fromJson ( await this . sharedPref . getObject ( USER_PROFILE ) ) ;
setState ( ( ) {
authUser = data ;
} ) ;