Merge branch 'Haroon' into 'master'
Haroon See merge request Cloud_Solution/diplomatic-quarter!38find_us
commit
a75adae281
@ -0,0 +1,48 @@
|
||||
class DentalChiefComplaintsModel {
|
||||
List<ListDentalChiefComplain> listDentalChiefComplain;
|
||||
|
||||
DentalChiefComplaintsModel({this.listDentalChiefComplain});
|
||||
|
||||
DentalChiefComplaintsModel.fromJson(Map<String, dynamic> json) {
|
||||
if (json['List_DentalChiefComplain'] != null) {
|
||||
listDentalChiefComplain = new List<ListDentalChiefComplain>();
|
||||
json['List_DentalChiefComplain'].forEach((v) {
|
||||
listDentalChiefComplain.add(new ListDentalChiefComplain.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
if (this.listDentalChiefComplain != null) {
|
||||
data['List_DentalChiefComplain'] =
|
||||
this.listDentalChiefComplain.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class ListDentalChiefComplain {
|
||||
int projectID;
|
||||
int iD;
|
||||
String name;
|
||||
String nameN;
|
||||
|
||||
ListDentalChiefComplain({this.projectID, this.iD, this.name, this.nameN});
|
||||
|
||||
ListDentalChiefComplain.fromJson(Map<String, dynamic> json) {
|
||||
projectID = json['ProjectID'];
|
||||
iD = json['ID'];
|
||||
name = json['Name'];
|
||||
nameN = json['NameN'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['ProjectID'] = this.projectID;
|
||||
data['ID'] = this.iD;
|
||||
data['Name'] = this.name;
|
||||
data['NameN'] = this.nameN;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||
import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart';
|
||||
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:smart_progress_bar/smart_progress_bar.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class DentalComplaintCard extends StatefulWidget {
|
||||
final ListDentalChiefComplain listDentalChiefComplain;
|
||||
var languageID;
|
||||
|
||||
DentalComplaintCard(
|
||||
{@required this.listDentalChiefComplain, this.languageID});
|
||||
|
||||
@override
|
||||
_DentalComplaintCardState createState() => _DentalComplaintCardState();
|
||||
}
|
||||
|
||||
class _DentalComplaintCardState extends State<DentalComplaintCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
getChiefComplaintsList();
|
||||
},
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.85,
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(widget.listDentalChiefComplain.name,
|
||||
style:
|
||||
TextStyle(fontSize: 16.0, color: Colors.black)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Icon(Icons.arrow_forward_ios,
|
||||
size: 20.0, color: Colors.black54),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getChiefComplaintsList() {
|
||||
List<DoctorList> doctorsList = [];
|
||||
List<PatientDoctorAppointmentList> _patientDoctorAppointmentListHospital =
|
||||
List();
|
||||
|
||||
ClinicListService service = new ClinicListService();
|
||||
service
|
||||
.getChiefComplaintDoctorList(widget.listDentalChiefComplain.iD,
|
||||
widget.listDentalChiefComplain.projectID, context)
|
||||
.then((res) {
|
||||
if (res['MessageStatus'] == 1) {
|
||||
print(res['List_DentalDoctorChiefComplaintMapping']);
|
||||
setState(() {
|
||||
doctorsList.clear();
|
||||
res['List_DentalDoctorChiefComplaintMapping'].forEach((v) {
|
||||
doctorsList.add(new DoctorList.fromJson(v));
|
||||
});
|
||||
|
||||
doctorsList.forEach((element) {
|
||||
List<PatientDoctorAppointmentList> doctorByHospital =
|
||||
_patientDoctorAppointmentListHospital
|
||||
.where(
|
||||
(elementClinic) =>
|
||||
elementClinic.filterName == element.projectName,
|
||||
)
|
||||
.toList();
|
||||
|
||||
if (doctorByHospital.length != 0) {
|
||||
_patientDoctorAppointmentListHospital[
|
||||
_patientDoctorAppointmentListHospital
|
||||
.indexOf(doctorByHospital[0])]
|
||||
.patientDoctorAppointmentList
|
||||
.add(element);
|
||||
} else {
|
||||
_patientDoctorAppointmentListHospital.add(
|
||||
PatientDoctorAppointmentList(
|
||||
filterName: element.projectName,
|
||||
distanceInKMs:
|
||||
element.projectDistanceInKiloMeters.toString(),
|
||||
patientDoctorAppointment: element));
|
||||
}
|
||||
});
|
||||
navigateToSearchResults(
|
||||
context, doctorsList, _patientDoctorAppointmentListHospital);
|
||||
});
|
||||
} else {
|
||||
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
||||
}
|
||||
}).catchError((err) {
|
||||
print(err);
|
||||
}).showProgressBar(
|
||||
text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6));
|
||||
}
|
||||
|
||||
Future navigateToSearchResults(
|
||||
context,
|
||||
List<DoctorList> docList,
|
||||
List<PatientDoctorAppointmentList>
|
||||
patientDoctorAppointmentListHospital) async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => SearchResults(
|
||||
doctorsList: docList,
|
||||
patientDoctorAppointmentListHospital:
|
||||
patientDoctorAppointmentListHospital)));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue