@ -25,9 +25,10 @@ import '../../../uitl/gif_loader_dialog_utils.dart';
class ResultByClinic extends StatefulWidget {
HospitalsModel ? selectedValue ;
Function ( RegionList , int ? ) onClinicSelected ;
Function ( RegionList ) onClinicSelected ;
ResultByClinic ( { super . key , this . selectedValue , required this . onClinicSelected } ) ;
ResultByClinic (
{ super . key , this . selectedValue , required this . onClinicSelected } ) ;
@ override
State < ResultByClinic > createState ( ) = > _ResultByClinicState ( ) ;
@ -39,7 +40,8 @@ class _ResultByClinicState extends State<ResultByClinic> {
@ override
void initState ( ) {
super . initState ( ) ;
WidgetsBinding . instance . addPostFrameCallback ( ( _ ) = > getClinicWrtHospital ( widget . selectedValue ) ) ;
WidgetsBinding . instance . addPostFrameCallback (
( _ ) = > getClinicWrtHospital ( widget . selectedValue ) ) ;
}
@ override
@ -50,56 +52,66 @@ class _ResultByClinicState extends State<ResultByClinic> {
child: clinicIds ? . isNotEmpty = = true
? ListView . builder (
itemBuilder: ( _ , index ) = > InkWell (
onTap: ( ) {
getDoctorsList (
context ,
" ${ clinicIds ? [ index ] . clinicID . toString ( ) ? ? ' ' } - ${ clinicIds ? [ index ] . isLiveCareClinicAndOnline ! . toString ( ) } - ${ clinicIds ? [ index ] . liveCareClinicID . toString ( ) } - ${ clinicIds ? [ index ] . liveCareServiceID . toString ( ) } " ,
clinicIds ? [ index ] . clinicDescription ! ,
widget . selectedValue ,
clinicIds ? [ index ] ) ;
} ,
child: Material (
color: CustomColors . white ,
child: Padding (
padding: const EdgeInsets . symmetric ( horizontal: 16 , vertical: 24 ) ,
child: Row (
children: [
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
clinicIds ? [ index ] . clinicDescription ? ? ' ' ,
style: TextStyle ( fontSize: 22 , color: Colors . black , fontWeight: FontWeight . w700 ) ,
) ,
] ,
) ,
) ,
Padding (
padding: EdgeInsets . all ( 8 ) ,
child: Center (
child: Icon (
Icons . arrow_forward_ios ,
color: CustomColors . black ,
size: 16 ,
) ,
) ,
) ,
] ,
) ) ,
onTap: ( ) {
getDoctorsList (
context ,
" ${ clinicIds ? [ index ] . clinicID . toString ( ) ? ? ' ' } - ${ clinicIds ? [ index ] . isLiveCareClinicAndOnline ! . toString ( ) } - ${ clinicIds ? [ index ] . liveCareClinicID . toString ( ) } - ${ clinicIds ? [ index ] . liveCareServiceID . toString ( ) } " ,
clinicIds ? [ index ] . clinicDescription ! ,
widget . selectedValue ,
clinicIds ? [ index ] ) ;
} ,
child: Material (
color: CustomColors . white ,
child: Padding (
padding:
const EdgeInsets . symmetric ( horizontal: 16 , vertical: 24 ) ,
child: Row (
children: [
Expanded (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
clinicIds ? [ index ] . clinicDescription ? ? ' ' ,
style: TextStyle (
fontSize: 22 ,
color: Colors . black ,
fontWeight: FontWeight . w700 ) ,
) ,
] ,
) ,
) ,
) ,
itemCount: clinicIds ? . length ? ? 0 ,
Padding (
padding: EdgeInsets . all ( 8 ) ,
child: Center (
child: Icon (
Icons . arrow_forward_ios ,
color: CustomColors . black ,
size: 16 ,
) ,
) ,
) ,
] ,
) ) ,
) ,
) ,
itemCount: clinicIds ? . length ? ? 0 ,
)
: getNoDataWidget ( context ) ) ,
] ,
) ;
}
getDoctorsList ( BuildContext context , String ? dropdownValue , String ? dropdownTitle , HospitalsModel ? selectedHospital , ListClinicCentralized ? selectedClinic ) {
getDoctorsList (
BuildContext context ,
String ? dropdownValue ,
String ? dropdownTitle ,
HospitalsModel ? selectedHospital ,
ListClinicCentralized ? selectedClinic ) {
SearchInfo searchInfo = new SearchInfo ( ) ;
if ( dropdownValue ! = null ) if ( dropdownValue ! . split ( " - " ) [ 0 ] = = " 17 " ) {
searchInfo . ProjectID = int . parse ( selectedHospital ? . mainProjectID . toString ( ) ? ? " " ) ;
searchInfo . ProjectID =
int . parse ( selectedHospital ? . mainProjectID . toString ( ) ? ? " " ) ;
searchInfo . ClinicID = int . parse ( dropdownValue ! . split ( " - " ) [ 0 ] ) ;
searchInfo . hospital = selectedHospital ;
searchInfo . clinic = selectedClinic ;
@ -124,7 +136,10 @@ class _ResultByClinicState extends State<ResultByClinic> {
Navigator . push (
context ,
FadePage (
page: LiveCareBookAppointment ( clinicName: dropdownTitle , liveCareClinicID: dropdownValue ! . split ( " - " ) [ 2 ] , liveCareServiceID: dropdownValue ! . split ( " - " ) [ 3 ] ) ,
page: LiveCareBookAppointment (
clinicName: dropdownTitle ,
liveCareClinicID: dropdownValue ! . split ( " - " ) [ 2 ] ,
liveCareServiceID: dropdownValue ! . split ( " - " ) [ 3 ] ) ,
) ,
) . then ( ( value ) {
print ( " navigation return " ) ;
@ -154,7 +169,8 @@ class _ResultByClinicState extends State<ResultByClinic> {
) . then ( ( value ) { } ) ;
}
Future navigateToDentalComplaints ( BuildContext context , SearchInfo searchInfo ) async {
Future navigateToDentalComplaints (
BuildContext context , SearchInfo searchInfo ) async {
Navigator . push (
context ,
FadePage (
@ -165,7 +181,7 @@ class _ResultByClinicState extends State<ResultByClinic> {
) ,
) . then ( ( value ) {
if ( value is RegionList ) {
widget . onClinicSelected ( value ,null );
widget . onClinicSelected ( value );
}
} ) ;
}
@ -179,11 +195,20 @@ class _ResultByClinicState extends State<ResultByClinic> {
List < String > arrDistance = [ ] ;
List < String > result ;
int numAll ;
List < PatientDoctorAppointmentList > _patientDoctorAppointmentListHospital = [ ] ;
List < PatientDoctorAppointmentList > _patientDoctorAppointmentListHospital =
[ ] ;
DoctorsListService service = new DoctorsListService ( ) ;
service
. getDoctorsList ( clinicID , widget . selectedValue ? . mainProjectID . toString ( ) ! = " " ? int . parse ( widget . selectedValue ? . mainProjectID . toString ( ) ? ? " -1 " ) : 0 , false , languageID , null )
. getDoctorsList (
clinicID ,
widget . selectedValue ? . mainProjectID . toString ( ) ! = " "
? int . parse (
widget . selectedValue ? . mainProjectID . toString ( ) ? ? " -1 " )
: 0 ,
false ,
languageID ,
null )
. then ( ( res ) async {
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
@ -196,13 +221,16 @@ class _ResultByClinicState extends State<ResultByClinic> {
) ) ;
} ) ;
regionHospitalList = await DoctorMapper . getMappedDoctor ( doctorsList , isArabic: isArabic ) ;
regionHospitalList = await DoctorMapper . getMappedDoctor ( doctorsList ,
isArabic: isArabic ) ;
var lat = await sharedPref . getDouble ( USER_LAT ) ;
var lng = await sharedPref . getDouble ( USER_LONG ) ;
var isLocationEnabled = ( lat ! = null & & lat ! = 0.0 ) & & ( lng ! = null & & lng ! = 0.0 ) ;
regionHospitalList = await DoctorMapper . sortList ( isLocationEnabled , regionHospitalList ) ;
widget . onClinicSelected ( regionHospitalList , clinicID ) ;
var isLocationEnabled =
( lat ! = null & & lat ! = 0.0 ) & & ( lng ! = null & & lng ! = 0.0 ) ;
regionHospitalList = await DoctorMapper . sortList (
isLocationEnabled , regionHospitalList ) ;
widget . onClinicSelected ( regionHospitalList ) ;
setState ( ( ) { } ) ;
} else {
GifLoaderDialogUtils . hideDialog ( context ) ;
@ -230,7 +258,8 @@ class _ResultByClinicState extends State<ResultByClinic> {
clinicIds = List . empty ( ) ;
List < ListClinicCentralized > clinicId = [ ] ;
try {
Map res = await service . getClinicByHospital ( projectID: newValue ? . mainProjectID . toString ( ) ? ? " " ) ;
Map res = await service . getClinicByHospital (
projectID: newValue ? . mainProjectID . toString ( ) ? ? " " ) ;
GifLoaderDialogUtils . hideDialog ( context ) ;
if ( res [ ' MessageStatus ' ] = = 1 ) {
List list = res [ ' ListClinic ' ] ;