@ -3,6 +3,7 @@ import 'dart:async';
import ' package:doctor_app_flutter/config/config.dart ' ;
import ' package:doctor_app_flutter/config/size_config.dart ' ;
import ' package:doctor_app_flutter/core/enum/view_state.dart ' ;
import ' package:doctor_app_flutter/core/model/PatientRegistration/GetPatientInfoRequestModel.dart ' ;
import ' package:doctor_app_flutter/core/model/SOAP/in_patient/post_episode_for_Inpatient_request_model.dart ' ;
import ' package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart ' ;
import ' package:doctor_app_flutter/core/model/patient/patiant_info_model.dart ' ;
@ -21,8 +22,11 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import ' package:doctor_app_flutter/utils/utils.dart ' ;
import ' package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-header-new-design-app-bar.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/app_texts_widget.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart ' ;
import ' package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter_svg/svg.dart ' ;
import ' package:hexcolor/hexcolor.dart ' ;
@ -31,6 +35,7 @@ import 'package:quiver/async.dart';
import ' ../../../../locator.dart ' ;
import ' ../../../../routes.dart ' ;
import ' ../../../video_call_zoom/zoom_video_call.dart ' ;
class PatientProfileScreen extends StatefulWidget {
@ override
@ -59,7 +64,8 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
late TabController _tabController ;
int index = 0 ;
int _activeTab = 0 ;
String noteValidation = " " ;
TextEditingController noteController = TextEditingController ( ) ;
late StreamController < String > videoCallDurationStreamController ;
late Stream < String > videoCallDurationStream ;
@ -356,18 +362,33 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
Utils . showErrorToast ( model . error ) ;
} else {
await model . getDoctorProfile ( ) ;
patient . appointmentNo = int . parse ( model . startCallRes ! . appointmentNo . toString ( ) ) ;
patient . appointmentNo = int . parse ( model . startCallRes ! . appointmentNo . toString ( ) ) ;
patient . episodeNo = 0 ;
model . updateInCallPatient ( patient: patient , appointmentNo: int . parse ( model . startCallRes ! . appointmentNo . toString ( ) ) ) ;
model . updateInCallPatient ( patient: patient , appointmentNo: int . parse ( model . startCallRes ! . appointmentNo . toString ( ) ) ) ;
setState ( ( ) {
isCallStarted = true ;
} ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
AppPermissionsUtils . requestVideoCallPermission (
/ / AppPermissionsUtils . requestVideoCallPermission (
/ / context: context ,
/ / onTapGrant: ( ) {
/ / locator < VideoCallService > ( )
/ / . openVideo ( model . startCallRes ! , patient , model . startCallRes ! = null ? model . startCallRes ! . isRecording ! : true , callConnected , callDisconnected ) ;
/ / } ) ;
/ / model . startCallRes ! . openTokenID !
AppPermissionsUtils . requestVideoCallPermission (
context: context ,
onTapGrant: ( ) {
locator < VideoCallService > ( )
. openVideo ( model . startCallRes ! , patient , model . startCallRes ! = null ? model . startCallRes ! . isRecording ! : true , callConnected , callDisconnected ) ;
Navigator . pushNamed (
context ,
" zoom-call " ,
arguments: CallArguments ( model . startCallRes ! . openSessionID ! , " 123 " , " doctor " , " 40 " , " 0 " , true , 1 ) ,
) . then ( ( completion ) {
Future < void > . delayed ( const Duration ( seconds: 1 ) )
. then ( ( _ ) async {
_showEndCallPopup ( context , model , patient , patient . vcId ! ) ;
} ) ;
} ) ;
} ) ;
}
}
@ -386,7 +407,65 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
) ,
) ;
}
void _showEndCallPopup ( BuildContext context , LiveCarePatientViewModel model , PatiantInformtion patient , int vcID ) {
showDialog (
context: context ,
barrierDismissible: false ,
builder: ( BuildContext context ) {
return AlertDialog (
title: Text ( ' Call Ended ' ) ,
content: SizedBox (
height: 150 ,
child: Column (
mainAxisAlignment: MainAxisAlignment . center ,
children: [
AppTextFieldCustom ( onChanged: ( val ) { } , onFieldSubmitted: ( ) { } , hintText: " Please enter Notes " , height: 100 , validationError: noteValidation , controller: noteController , ) ,
] , ) ) ,
actions: [
AppButton (
onPressed: ( ) {
_transferToAdmin ( model , patient , vcID ) ;
} ,
title: ' Transfer to Admin ' ,
color: Colors . grey ,
fontColor: Colors . white ,
fontSize: 14 ,
) ,
SizedBox ( height: 15 , ) ,
AppButton (
onPressed: ( ) {
_endWithCharge ( model , patient , vcID ) ;
} ,
title: ' End with Charge ' ,
color: Colors . red ,
fontColor: Colors . white ,
fontSize: 14 ,
)
] ,
) ;
} ,
) ;
}
_transferToAdmin ( LiveCarePatientViewModel model , PatiantInformtion patient , int vcID ) {
if ( noteController . text . isEmpty ) {
noteValidation = ' Please Enter Notes ' ;
setState ( ( ) {
} ) ;
} else {
model . transferToAdmin ( vcID , noteController . text ) ;
Navigator . of ( context ) . pop ( ) ;
}
}
_endWithCharge ( LiveCarePatientViewModel model , PatiantInformtion patient , int vcID ) {
model . endCallWithCharge ( vcID , true ) ;
Navigator . of ( context ) . pop ( ) ;
}
createEpisode ( { required PatiantInformtion patient , required SOAPViewModel model } ) async {
await locator < AnalyticsService > ( ) . logEvent (
eventCategory: " Patient Profile " ,