@ -11,12 +11,12 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import ' package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.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.dart ' ;
import ' package:diplomaticquarterapp/uitl/utils_new.dart ' ;
import ' package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/secondary_button.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:flutter/cupertino.dart ' ;
@ -29,13 +29,10 @@ class NewEReferralStepThreePage extends StatefulWidget {
final CreateEReferralRequestModel createEReferralRequestModel ;
final Function changePageViewIndex ;
const NewEReferralStepThreePage (
{ Key key , this . createEReferralRequestModel , this . changePageViewIndex } )
: super ( key: key ) ;
const NewEReferralStepThreePage ( { Key key , this . createEReferralRequestModel , this . changePageViewIndex } ) : super ( key: key ) ;
@ override
_NewEReferralStepThreePageState createState ( ) = >
_NewEReferralStepThreePageState ( ) ;
_NewEReferralStepThreePageState createState ( ) = > _NewEReferralStepThreePageState ( ) ;
}
class _NewEReferralStepThreePageState extends State < NewEReferralStepThreePage > {
@ -104,8 +101,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
mainAxisAlignment: MainAxisAlignment . start ,
children: [
Padding (
padding: const EdgeInsets . symmetric (
horizontal: 9 ) ,
padding: const EdgeInsets . symmetric ( horizontal: 9 ) ,
child: Texts (
TranslationBase . of ( context ) . medicalReport ,
color: Colors . grey ,
@ -120,21 +116,14 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
context ,
( String image , File file ) {
setState ( ( ) {
EReferralAttachment
eReferralAttachment =
new EReferralAttachment (
fileName:
' image ${ medicalReportImages . length + 1 } .png ' ,
base64String: image ) ;
medicalReportImages
. add ( eReferralAttachment ) ;
EReferralAttachment eReferralAttachment = new EReferralAttachment ( fileName: ' image ${ medicalReportImages . length + 1 } .png ' , base64String: image ) ;
medicalReportImages . add ( eReferralAttachment ) ;
} ) ;
} ,
) ;
} ,
child: Container (
margin: EdgeInsets . only (
left: 10 , right: 10 , top: 15 ) ,
margin: EdgeInsets . only ( left: 10 , right: 10 , top: 15 ) ,
height: 50 ,
decoration: BoxDecoration (
border: Border . all ( color: Colors . grey ) ,
@ -144,10 +133,8 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
) ,
child: Center (
child: Row (
crossAxisAlignment:
CrossAxisAlignment . center ,
mainAxisAlignment:
MainAxisAlignment . center ,
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: < Widget > [
Icon ( Icons . attach_file ) ,
Texts (
@ -169,30 +156,24 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
margin: EdgeInsets . all ( 10 ) ,
padding: EdgeInsets . all ( 8.0 ) ,
child: Row (
mainAxisAlignment:
MainAxisAlignment . spaceBetween ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: < Widget > [
Row (
crossAxisAlignment:
CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Icon (
FontAwesomeIcons . paperclip ) ,
Icon ( FontAwesomeIcons . paperclip ) ,
SizedBox (
width: 8 ,
) ,
Texts (
medicalReportImages [ index ]
. fileName ,
medicalReportImages [ index ] . fileName ,
) ,
] ,
) ,
InkWell (
onTap: ( ) {
setState ( ( ) {
medicalReportImages . remove (
medicalReportImages [
index ] ) ;
medicalReportImages . remove ( medicalReportImages [ index ] ) ;
} ) ;
} ,
child: Icon (
@ -210,27 +191,22 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
) ,
Container (
padding: EdgeInsets . only ( top: 10 ) ,
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 12 ) ,
color: Colors . white ) ,
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 12 ) , color: Colors . white ) ,
child: Column (
children: [
Container (
width: double . infinity ,
decoration: containerRadius ( Colors . white , 12 ) ,
margin: EdgeInsets . only ( left: 20 , right: 20 ) ,
padding: EdgeInsets . only (
left: 10 , right: 10 , top: 12 , bottom: 12 ) ,
padding: EdgeInsets . only ( left: 10 , right: 10 , top: 12 , bottom: 12 ) ,
child: Row (
children: [
Flexible (
child: Column (
crossAxisAlignment:
CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
TranslationBase . of ( context )
. preferredBranch ,
TranslationBase . of ( context ) . preferredBranch ,
style: TextStyle (
fontSize: 11 ,
letterSpacing: - 0.44 ,
@ -239,38 +215,24 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
) ,
Container (
height: 18 ,
child:
DropdownButtonHideUnderline (
child: DropdownButtonHideUnderline (
child: DropdownButton < String > (
key: projectDropdownKey ,
hint: Text ( TranslationBase . of (
context )
. selectPreferredBranch ) ,
hint: Text ( TranslationBase . of ( context ) . selectPreferredBranch ) ,
value: projectDropdownValue ,
iconSize: 0 ,
isExpanded: true ,
style: TextStyle (
fontSize: 14 ,
letterSpacing: - 0.56 ,
color: Colors . black ) ,
items:
projectsList . map ( ( item ) {
return new DropdownMenuItem <
String > (
value: item . mainProjectID
. toString ( ) +
" , " +
item . name . toString ( ) ,
child:
new Text ( item . name ) ,
style: TextStyle ( fontSize: 14 , letterSpacing: - 0.56 , color: Colors . black ) ,
items: projectsList . map ( ( item ) {
return new DropdownMenuItem < String > (
value: item . mainProjectID . toString ( ) + " , " + item . name . toString ( ) ,
child: new Text ( item . name ) ,
) ;
} ) . toList ( ) ,
onChanged: ( newValue ) {
setState ( ( ) {
projectDropdownValue =
newValue ;
print (
projectDropdownValue ) ;
projectDropdownValue = newValue ;
print ( projectDropdownValue ) ;
} ) ;
} ,
) ,
@ -289,9 +251,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
height: 12 ,
) ,
Container (
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 12 ) ,
color: Colors . white ) ,
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 12 ) , color: Colors . white ) ,
child: Column (
children: [
Row (
@ -337,25 +297,16 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
children: [
InkWell (
onTap: ( ) {
ImageOptions . showImageOptions ( context ,
( String image , File file ) {
ImageOptions . showImageOptions ( context , ( String image , File file ) {
setState ( ( ) {
EReferralAttachment
eReferralAttachment =
new EReferralAttachment (
fileName:
' image ${ medicalReportImages . length + 1 } .png ' ,
base64String: image ) ;
EReferralAttachment eReferralAttachment = new EReferralAttachment ( fileName: ' image ${ medicalReportImages . length + 1 } .png ' , base64String: image ) ;
insuredPatientImages = [
eReferralAttachment
] ;
insuredPatientImages = [ eReferralAttachment ] ;
} ) ;
} ) ;
} ,
child: Container (
margin: EdgeInsets . only (
left: 10 , right: 10 , top: 15 ) ,
margin: EdgeInsets . only ( left: 10 , right: 10 , top: 15 ) ,
height: 50 ,
decoration: BoxDecoration (
border: Border . all ( color: Colors . grey ) ,
@ -365,10 +316,8 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
) ,
child: Center (
child: Row (
crossAxisAlignment:
CrossAxisAlignment . center ,
mainAxisAlignment:
MainAxisAlignment . center ,
crossAxisAlignment: CrossAxisAlignment . center ,
mainAxisAlignment: MainAxisAlignment . center ,
children: < Widget > [
Icon ( Icons . attach_file ) ,
Texts (
@ -390,15 +339,12 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
margin: EdgeInsets . all ( 10 ) ,
padding: EdgeInsets . all ( 8.0 ) ,
child: Row (
mainAxisAlignment:
MainAxisAlignment . spaceBetween ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: < Widget > [
Row (
crossAxisAlignment:
CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
Icon ( FontAwesomeIcons
. paperclip ) ,
Icon ( FontAwesomeIcons . paperclip ) ,
SizedBox (
width: 8 ,
) ,
@ -410,9 +356,7 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
InkWell (
onTap: ( ) {
setState ( ( ) {
insuredPatientImages . remove (
insuredPatientImages [
index ] ) ;
insuredPatientImages . remove ( insuredPatientImages [ index ] ) ;
} ) ;
} ,
child: Icon (
@ -444,44 +388,24 @@ class _NewEReferralStepThreePageState extends State<NewEReferralStepThreePage> {
medicalReportImages . length = = 0
? null
: ( ) async {
this
. widget
. createEReferralRequestModel
. medicalReportAttachment = medicalReportImages ;
this
. widget
. createEReferralRequestModel
. insuranceCardAttachment =
insuredPatientImages . length ! = 0
? insuredPatientImages [ 0 ]
: null ;
this
. widget
. createEReferralRequestModel
. isInsuredPatient = isPatientInsured ;
/ / ToDo make the preferred Branch info dynamic
this
. widget
. createEReferralRequestModel
. preferredBranchCode =
num . tryParse ( projectDropdownValue . split ( " , " ) [ 0 ] ) ;
this
. widget
. createEReferralRequestModel
. preferredBranchName =
projectDropdownValue . split ( " , " ) [ 1 ] ;
this
. widget
. createEReferralRequestModel
. otherRelationship = " " ;
await model . createEReferral (
this . widget . createEReferralRequestModel ) ;
if ( model . state = = ViewState . ErrorLocal ) {
Utils . showErrorToast ( model . error ) ;
} else {
AppToast . showSuccessToast (
message: " Referral sent successfully " ) ;
}
Future . delayed ( new Duration ( milliseconds: 300 ) ) . then ( ( value ) async {
GifLoaderDialogUtils . showMyDialog ( context ) ;
this . widget . createEReferralRequestModel . medicalReportAttachment = medicalReportImages ;
this . widget . createEReferralRequestModel . insuranceCardAttachment = insuredPatientImages . length ! = 0 ? insuredPatientImages [ 0 ] : null ;
this . widget . createEReferralRequestModel . isInsuredPatient = isPatientInsured ;
/ / ToDo make the preferred Branch info dynamic
this . widget . createEReferralRequestModel . preferredBranchCode = num . tryParse ( projectDropdownValue . split ( " , " ) [ 0 ] ) ;
this . widget . createEReferralRequestModel . preferredBranchName = projectDropdownValue . split ( " , " ) [ 1 ] ;
this . widget . createEReferralRequestModel . otherRelationship = " " ;
await model . createEReferral ( this . widget . createEReferralRequestModel ) ;
if ( model . state = = ViewState . ErrorLocal ) {
GifLoaderDialogUtils . hideDialog ( context ) ;
Utils . showErrorToast ( model . error ) ;
} else {
GifLoaderDialogUtils . hideDialog ( context ) ;
AppToast . showSuccessToast ( message: " Referral sent successfully " ) ;
}
} ) ;
} ,
disabledColor: Colors . grey ,
color: Color ( 0xff359846 ) ,