@ -2,7 +2,10 @@ import 'dart:convert';
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/pages/insurance/AttachInsuranceCardImageDialog.dart ' ;
import ' package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
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/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
@ -21,7 +24,9 @@ class _BirthNotificationState extends State<BirthNotification> {
TextEditingController motherMRN = new TextEditingController ( ) ;
TextEditingController motherName = new TextEditingController ( ) ;
TextEditingController fatherName = new TextEditingController ( ) ;
TextEditingController fatherNameAR = new TextEditingController ( ) ;
TextEditingController babyName = new TextEditingController ( ) ;
TextEditingController babyNameAR = new TextEditingController ( ) ;
TextEditingController contactNumber = new TextEditingController ( ) ;
ProjectViewModel projectViewModel ;
@ -64,9 +69,13 @@ class _BirthNotificationState extends State<BirthNotification> {
mHeight ( 16 ) ,
inputWidget ( TranslationBase . of ( context ) . mothersName , " " , motherName , isEnable: false ) ,
mHeight ( 16 ) ,
inputWidget ( TranslationBase . of ( context ) . fathersName , " " , fatherName ) ,
inputWidget ( TranslationBase . of ( context ) . fathersName EN , " " , fatherName ) ,
mHeight ( 16 ) ,
inputWidget ( TranslationBase . of ( context ) . babysName , " " , babyName ) ,
inputWidget ( TranslationBase . of ( context ) . fathersNameAR , " " , fatherNameAR ) ,
mHeight ( 16 ) ,
inputWidget ( TranslationBase . of ( context ) . babysNameEN , " " , babyName ) ,
mHeight ( 16 ) ,
inputWidget ( TranslationBase . of ( context ) . babysNameAR , " " , babyNameAR ) ,
mHeight ( 16 ) ,
inputWidget ( TranslationBase . of ( context ) . contactNumber , " " , contactNumber ) ,
mHeight ( 16 ) ,
@ -151,9 +160,21 @@ class _BirthNotificationState extends State<BirthNotification> {
) ,
) ,
mHeight ( 16.0 ) ,
/ / DefaultButton (
/ / TranslationBase . of ( context ) . submit ,
/ / ( fatherNameAR . text . isEmpty | | fatherName . text . isEmpty | | babyNameAR . text . isEmpty | | babyName . text . isEmpty ) ? null : ( ) {
/ / submitBirthNotification ( ) ;
/ / } ,
/ / color: CustomColors . accentColor ,
/ / disabledColor: CustomColors . grey2 ,
/ / ) ,
DefaultButton (
TranslationBase . of ( context ) . submit ,
( ) { } ,
( fatherNameAR . text . isEmpty | | fatherName . text . isEmpty | | babyNameAR . text . isEmpty | | babyName . text . isEmpty | | images . isEmpty )
? null
: ( ) {
submitBirthNotification ( ) ;
} ,
color: CustomColors . accentColor ,
disabledColor: CustomColors . grey2 ,
) ,
@ -164,6 +185,21 @@ class _BirthNotificationState extends State<BirthNotification> {
) ;
}
void submitBirthNotification ( ) {
ClinicListService service = new ClinicListService ( ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
service
. submitBirthNotification (
projectViewModel . user . patientID , projectViewModel . inPatientProjectID , fatherNameAR . text , fatherName . text , babyNameAR . text , babyName . text , contactNumber . text , images [ 0 ] , context )
. then ( ( res ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showSuccessToast ( message: TranslationBase . of ( context ) . processDoneSuccessfully ) ;
Navigator . of ( context ) . pop ( ) ;
} ) . catchError ( ( err ) {
print ( err ) ;
} ) ;
}
void confirmAttachInsuranceCardImageDialogDialog ( { BuildContext context , String name , String fileNo } ) {
showDialog (
context: context ,