@ -39,17 +39,9 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
TextEditingController _mobileTextController = TextEditingController ( ) ;
TextEditingController _mobileTextController = TextEditingController ( ) ;
bool _isSubmitted = false ;
bool _isSubmitted = false ;
dynamic _selectedCountry = {
dynamic _selectedCountry = { " name " : " Saudi Arabia " , " name_ar " : " المملكة العربية السعودية " , " code " : " +966 " , " countryCode " : " SA " , " pattern " : " 5xxxxxxxx " , " maxLength " : 9 } ;
" name " : " Saudi Arabia " ,
" name_ar " : " المملكة العربية السعودية " ,
" code " : " +966 " ,
" countryCode " : " SA " ,
" pattern " : " 5xxxxxxxx " ,
" maxLength " : 9
} ;
SearchCriteriaModel selectedCriteria = SearchCriteriaModel (
SearchCriteriaModel selectedCriteria = SearchCriteriaModel ( name: " Identification Number " , nameAr: " رقم المحول " , value: 1 ) ;
name: " Identification Number " , nameAr: " رقم المحول " , value: 1 ) ;
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
@ -59,23 +51,15 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
if ( projectViewModel . isLogin ) {
if ( projectViewModel . isLogin ) {
Future . delayed ( new Duration ( milliseconds: 300 ) ) . then ( ( value ) async {
Future . delayed ( new Duration ( milliseconds: 300 ) ) . then ( ( value ) async {
GifLoaderDialogUtils . showMyDialog ( context ) ;
GifLoaderDialogUtils . showMyDialog ( context ) ;
SearchEReferralRequestModel searchEReferralRequestModel =
SearchEReferralRequestModel searchEReferralRequestModel = new SearchEReferralRequestModel (
new SearchEReferralRequestModel (
patientMobileNumber: ( projectViewModel . user . outSA = = 0 ? " 966 " : " 971 " ) + projectViewModel . user . mobileNumber . substring ( 1 , projectViewModel . user . mobileNumber . length ) ,
patientMobileNumber: ( projectViewModel . user . outSA = = 0
? " 966 "
: " 971 " ) +
projectViewModel . user . mobileNumber
. substring ( 1 , projectViewModel . user . mobileNumber . length ) ,
) ;
) ;
if ( selectedCriteria . value = = 1 ) {
if ( selectedCriteria . value = = 1 ) {
searchEReferralRequestModel . identificationNo =
searchEReferralRequestModel . identificationNo = _searchTextController . text ;
_searchTextController . text ;
searchEReferralRequestModel . referralNumber = 0 ;
searchEReferralRequestModel . referralNumber = 0 ;
} else {
} else {
searchEReferralRequestModel . referralNumber =
searchEReferralRequestModel . referralNumber = int . parse ( _searchTextController . text ) ;
int . parse ( _searchTextController . text ) ;
searchEReferralRequestModel . identificationNo = projectViewModel . user . patientIdentificationNo ;
searchEReferralRequestModel . identificationNo =
projectViewModel . user . patientIdentificationNo ;
}
}
await model . getEReferrals ( searchEReferralRequestModel ) ;
await model . getEReferrals ( searchEReferralRequestModel ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
@ -102,15 +86,10 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
padding: EdgeInsets . all ( 12 ) ,
padding: EdgeInsets . all ( 12 ) ,
width: double . infinity ,
width: double . infinity ,
height: 65 ,
height: 65 ,
decoration: BoxDecoration (
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 12 ) , color: Colors . white ) ,
borderRadius: BorderRadius . circular ( 12 ) ,
color: Colors . white ) ,
child: Row (
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
children: [ Texts ( getSearchCriteriaName ( ) ) , Icon ( Icons . arrow_drop_down ) ] ,
Texts ( getSearchCriteriaName ( ) ) ,
Icon ( Icons . arrow_drop_down )
] ,
) ,
) ,
) ,
) ,
) ,
) ,
@ -118,9 +97,7 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
height: 12 ,
height: 12 ,
) ,
) ,
NewTextFields (
NewTextFields (
hintText: selectedCriteria . value = = 1
hintText: selectedCriteria . value = = 1 ? " Enter Patient Identification No " : " Enter Referral Number " ,
? " Enter Patient Identification No "
: " Enter Referral Number " ,
controller: _searchTextController ,
controller: _searchTextController ,
onChanged: ( _ ) {
onChanged: ( _ ) {
setState ( ( ) { } ) ;
setState ( ( ) { } ) ;
@ -135,15 +112,10 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
padding: EdgeInsets . all ( 12 ) ,
padding: EdgeInsets . all ( 12 ) ,
width: double . infinity ,
width: double . infinity ,
height: 65 ,
height: 65 ,
decoration: BoxDecoration (
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 12 ) , color: Colors . white ) ,
borderRadius: BorderRadius . circular ( 12 ) ,
color: Colors . white ) ,
child: Row (
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
children: [ Texts ( getCountryName ( ) ) , Icon ( Icons . arrow_drop_down ) ] ,
Texts ( getCountryName ( ) ) ,
Icon ( Icons . arrow_drop_down )
] ,
) ,
) ,
) ,
) ,
) ,
) ,
@ -155,31 +127,21 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
onChange: ( _ ) {
onChange: ( _ ) {
setState ( ( ) { } ) ;
setState ( ( ) { } ) ;
} ,
} ,
code: _selectedCountry = = null
code: _selectedCountry = = null ? " 11 " : _selectedCountry [ " code " ] ,
? " 11 "
: _selectedCountry [ " code " ] ,
) ,
) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
if ( ( model . state = = ViewState . Idle & &
if ( ( model . state = = ViewState . Idle & & model . allReferral . length = = 0 ) ) Center ( child: Text ( TranslationBase . of ( context ) . noSearchResult ) ) ,
model . allReferral . length = = 0 ) )
if ( ( model . state = = ViewState . ErrorLocal ) ) AppEmbeddedError ( error: model . error ) ,
Center (
child: Text (
TranslationBase . of ( context ) . noSearchResult ) ) ,
if ( ( model . state = = ViewState . ErrorLocal ) )
AppEmbeddedError ( error: model . error ) ,
model . allReferral . length > 0
model . allReferral . length > 0
? NetworkBaseView (
? NetworkBaseView (
baseViewModel: model ,
baseViewModel: model ,
child: ListView . separated (
child: ListView . separated (
separatorBuilder: ( context , index ) = >
separatorBuilder: ( context , index ) = > SizedBox ( height: 0 ) ,
SizedBox ( height: 0 ) ,
shrinkWrap: true ,
shrinkWrap: true ,
physics: NeverScrollableScrollPhysics ( ) ,
physics: NeverScrollableScrollPhysics ( ) ,
itemCount: model . allReferral = = null
itemCount: model . allReferral = = null ? 0 : model . allReferral . length ,
? 0
: model . allReferral . length ,
itemBuilder: ( BuildContext context , int index ) {
itemBuilder: ( BuildContext context , int index ) {
return Container (
return Container (
width: double . infinity ,
width: double . infinity ,
@ -188,9 +150,7 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
Navigator . push (
Navigator . push (
context ,
context ,
FadePage (
FadePage (
page: ReferralDetails (
page: ReferralDetails ( referral: model . allReferral [ index ] ) ,
referral:
model . allReferral [ index ] ) ,
) ,
) ,
) ;
) ;
} ,
} ,
@ -200,71 +160,22 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
child: Padding (
child: Padding (
padding: const EdgeInsets . all ( 12.0 ) ,
padding: const EdgeInsets . all ( 12.0 ) ,
child: Row (
child: Row (
mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
MainAxisAlignment . spaceBetween ,
children: [
children: [
Column (
Column (
crossAxisAlignment:
crossAxisAlignment: CrossAxisAlignment . start ,
CrossAxisAlignment . start ,
children: [
children: [
Text (
Text ( projectViewModel . isArabic ? model . allReferral [ index ] . statusAr : model . allReferral [ index ] . status ,
projectViewModel . isArabic
style: TextStyle ( fontSize: 14.0 , letterSpacing: - 0.56 , fontWeight: FontWeight . bold ) ) ,
? model
. allReferral [
index ]
. statusAr
: model
. allReferral [
index ]
. status ,
style: TextStyle (
fontSize: 14.0 ,
letterSpacing: - 0.56 ,
fontWeight:
FontWeight . bold ) ) ,
Container (
Container (
margin: EdgeInsets . only (
margin: EdgeInsets . only ( top: 5.0 ) ,
top: 5.0 ) ,
child: myRichText ( TranslationBase . of ( context ) . patientName + " : " , model . allReferral [ index ] . patientName , projectViewModel . isArabic ) ) ,
child: myRichText (
myRichText ( TranslationBase . of ( context ) . hospital + " : " , model . allReferral [ index ] . preferredBranchName , projectViewModel . isArabic ) ,
TranslationBase . of (
myRichText ( TranslationBase . of ( context ) . referralDate + " : " ,
context )
DateUtil . getMonthDayYearDateFormatted ( DateUtil . convertStringToDateNoTimeZone ( model . allReferral [ index ] . referralDate ) ) , projectViewModel . isArabic ) ,
. patientName +
" : " ,
model
. allReferral [
index ]
. patientName ,
projectViewModel
. isArabic ) ) ,
myRichText (
TranslationBase . of (
context )
. hospital +
" : " ,
model . allReferral [ index ]
. preferredBranchName ,
projectViewModel
. isArabic ) ,
myRichText (
TranslationBase . of (
context )
. referralDate +
" : " ,
DateUtil . getMonthDayYearDateFormatted (
DateUtil . convertStringToDateNoTimeZone (
model
. allReferral [
index ]
. referralDate ) ) ,
projectViewModel
. isArabic ) ,
] ,
] ,
) ,
) ,
Icon ( projectViewModel . isArabic
Icon ( projectViewModel . isArabic ? Icons . arrow_back_ios_outlined : Icons . arrow_forward_outlined ) ,
? Icons
. arrow_back_ios_outlined
: Icons
. arrow_forward_outlined ) ,
] ,
] ,
) ,
) ,
) ,
) ,
@ -289,23 +200,17 @@ class _SearchForReferralsPageState extends State<SearchForReferralsPage> {
padding: EdgeInsets . all ( 14 ) ,
padding: EdgeInsets . all ( 14 ) ,
child: DefaultButton (
child: DefaultButton (
TranslationBase . of ( context ) . search ,
TranslationBase . of ( context ) . search ,
( _searchTextController . text . isEmpty | |
( _searchTextController . text . isEmpty | | _mobileTextController . text . isEmpty )
_mobileTextController . text . isEmpty )
? null
? null
: ( ) async {
: ( ) async {
SearchEReferralRequestModel
SearchEReferralRequestModel searchEReferralRequestModel = new SearchEReferralRequestModel (
searchEReferralRequestModel =
patientMobileNumber: _selectedCountry [ ' code ' ] + _mobileTextController . text ,
new SearchEReferralRequestModel (
patientMobileNumber: _selectedCountry [ ' code ' ] +
_mobileTextController . text ,
) ;
) ;
if ( selectedCriteria . value = = 1 ) {
if ( selectedCriteria . value = = 1 ) {
searchEReferralRequestModel . identificationNo =
searchEReferralRequestModel . identificationNo = _searchTextController . text ;
_searchTextController . text ;
searchEReferralRequestModel . referralNumber = 0 ;
searchEReferralRequestModel . referralNumber = 0 ;
} else {
} else {
searchEReferralRequestModel . referralNumber =
searchEReferralRequestModel . referralNumber = int . parse ( _searchTextController . text ) ;
int . parse ( _searchTextController . text ) ;
searchEReferralRequestModel . identificationNo = ' ' ;
searchEReferralRequestModel . identificationNo = ' ' ;
}
}
await model . getEReferrals ( searchEReferralRequestModel ) ;
await model . getEReferrals ( searchEReferralRequestModel ) ;