diff --git a/lib/config/config.dart b/lib/config/config.dart index f3b05b6a..8cdd118b 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -75,6 +75,9 @@ const GET_PROJECTS_LIST = 'Services/Lists.svc/REST/GetProject'; //URL to get doctors list const GET_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/SearchDoctorsByTime"; +//URL to dental doctors list +const GET_DENTAL_DOCTORS_LIST_URL = "Services/Doctors.svc/REST/Dental_DoctorChiefComplaintMapping"; + //URL to get doctor free slots const GET_DOCTOR_FREE_SLOTS = "Services/Doctors.svc/REST/GetDoctorFreeSlots"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 95398e23..d950f05d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -374,5 +374,6 @@ const Map> localizedValues = { "gate":{"en":"Gate:","ar":"بوابة"}, "building":{"en":"Building:","ar":"المبنى"}, "branch":{"en":"Branch:","ar":"الفرع"}, - "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"} + "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}, + "km":{"en":"KMs:","ar":"كم"}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index f45fe22b..bc5c8a3f 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -2,14 +2,11 @@ import 'dart:convert'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:http/http.dart' as http; -import '../../../locator.dart'; import '../../../routes.dart'; AppSharedPreferences sharedPref = new AppSharedPreferences(); @@ -33,9 +30,11 @@ class BaseAppClient { var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'en'); var user = await sharedPref.getObject(USER_PROFILE); - body['SetupID'] = body.containsKey('SetupID') - ? body['SetupID'] != null ? body['SetupID'] : SETUP_ID - : SETUP_ID; + if (body.containsKey('SetupID')) { + body['SetupID'] = body.containsKey('SetupID') + ? body['SetupID'] != null ? body['SetupID'] : SETUP_ID + : SETUP_ID; + } body['VersionID'] = body.containsKey('VersionID') ? body['VersionID'] != null ? body['VersionID'] : VERSION_ID : VERSION_ID; @@ -46,16 +45,29 @@ class BaseAppClient { body['PatientOutSA'] = body.containsKey('PatientOutSA') ? body['PatientOutSA'] != null ? body['PatientOutSA'] : PATIENT_OUT_SA : PATIENT_OUT_SA; - body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; + + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null ? body['isDentalAllowedBackend'] : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } + body['DeviceTypeID'] = DeviceTypeID; - body['PatientType'] = body.containsKey('PatientType') - ? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE - : PATIENT_TYPE; - body['PatientTypeID'] = body.containsKey('PatientTypeID') - ? body['PatientTypeID'] != null - ? body['PatientTypeID'] - : PATIENT_TYPE_ID - : PATIENT_TYPE_ID; + + if (body.containsKey('PatientType')) { + body['PatientType'] = body.containsKey('PatientType') + ? body['PatientType'] != null ? body['PatientType'] : PATIENT_TYPE + : PATIENT_TYPE; + } + + if (body.containsKey('PatientTypeID')) { + body['PatientTypeID'] = body.containsKey('PatientTypeID') + ? body['PatientTypeID'] != null + ? body['PatientTypeID'] + : PATIENT_TYPE_ID + : PATIENT_TYPE_ID; + } + if (user != null) { body['TokenID'] = token; body['PatientID'] = diff --git a/lib/models/Appointments/AppoimentAllHistoryResultList.dart b/lib/models/Appointments/AppoimentAllHistoryResultList.dart index a935542a..9ba1fb8e 100644 --- a/lib/models/Appointments/AppoimentAllHistoryResultList.dart +++ b/lib/models/Appointments/AppoimentAllHistoryResultList.dart @@ -272,3 +272,13 @@ class AppoitmentAllHistoryResultList { return data; } } + +class PatientAppointmentList { + String filterName = ""; + List patientDoctorAppointmentList = List(); + + PatientAppointmentList( + {this.filterName, AppoitmentAllHistoryResultList patientDoctorAppointment}) { + patientDoctorAppointmentList.add(patientDoctorAppointment); + } +} diff --git a/lib/models/Appointments/DentalChiefComplaintsModel.dart b/lib/models/Appointments/DentalChiefComplaintsModel.dart new file mode 100644 index 00000000..c15b828a --- /dev/null +++ b/lib/models/Appointments/DentalChiefComplaintsModel.dart @@ -0,0 +1,48 @@ +class DentalChiefComplaintsModel { + List listDentalChiefComplain; + + DentalChiefComplaintsModel({this.listDentalChiefComplain}); + + DentalChiefComplaintsModel.fromJson(Map json) { + if (json['List_DentalChiefComplain'] != null) { + listDentalChiefComplain = new List(); + json['List_DentalChiefComplain'].forEach((v) { + listDentalChiefComplain.add(new ListDentalChiefComplain.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + 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 json) { + projectID = json['ProjectID']; + iD = json['ID']; + name = json['Name']; + nameN = json['NameN']; + } + + Map toJson() { + final Map data = new Map(); + data['ProjectID'] = this.projectID; + data['ID'] = this.iD; + data['Name'] = this.name; + data['NameN'] = this.nameN; + return data; + } +} diff --git a/lib/pages/BookAppointment/DentalComplaints.dart b/lib/pages/BookAppointment/DentalComplaints.dart index 756aa8bf..9d3da450 100644 --- a/lib/pages/BookAppointment/DentalComplaints.dart +++ b/lib/pages/BookAppointment/DentalComplaints.dart @@ -1,5 +1,10 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DentalChiefComplaintsModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/SearchInfoModel.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DentalComplaintCard.dart'; +import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -14,6 +19,11 @@ class DentalComplaints extends StatefulWidget { } class _DentalComplaintsState extends State { + List complaintsList = []; + AppSharedPreferences sharedPref = AppSharedPreferences(); + bool isDataLoaded = false; + var languageID; + @override void initState() { WidgetsBinding.instance @@ -26,20 +36,43 @@ class _DentalComplaintsState extends State { return AppScaffold( isShowAppBar: true, appBarTitle: "Symptoms", - body: Container(), + body: Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: ListView.builder( + itemCount: complaintsList.length, + itemBuilder: (BuildContext context, int index) { + return Container( + margin: EdgeInsets.only(bottom: 10.0), + child: DentalComplaintCard( + listDentalChiefComplain: complaintsList[index], + languageID: languageID, + ), + ); + }, + ), + ), ); } + getLanguageID() async { + languageID = await sharedPref.getString(APP_LANGUAGE); + } + getChiefComplaintsList() { + getLanguageID(); ClinicListService service = new ClinicListService(); service .getChiefComplaintsList( widget.searchInfo.ClinicID, widget.searchInfo.ProjectID, context) .then((res) { if (res['MessageStatus'] == 1) { -// setState(() { -// res['List_DentalChiefComplain'].forEach((v) {}); -// }); + print(res['List_DentalChiefComplain']); + setState(() { + res['List_DentalChiefComplain'].forEach((v) { + complaintsList.add(new ListDentalChiefComplain.fromJson(v)); + }); + print(complaintsList.length); + }); } else {} }).catchError((err) { print(err); diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index c52002b4..2b5fac17 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -43,7 +43,7 @@ class _SearchResultsState extends State { (index) => AppExpandableNotifier( title: widget .patientDoctorAppointmentListHospital[index].filterName + " - " +widget - .patientDoctorAppointmentListHospital[index].distanceInKMs + " KMs" , + .patientDoctorAppointmentListHospital[index].distanceInKMs + " " + TranslationBase.of(context).km, bodyWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 6ff05204..6b3eff38 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -82,7 +82,7 @@ class _SearchByClinicState extends State { onChanged: (newValue) { setState(() { dropdownValue = newValue; - if (!isDentalSelectedAndSupported()) { + if (!isDentalSelectedAndSupported() && !nearestAppo) { projectDropdownValue = ""; getDoctorsList(context); } @@ -194,6 +194,7 @@ class _SearchByClinicState extends State { .getDoctorsList( int.parse(dropdownValue), projectDropdownValue != "" ? int.parse(projectDropdownValue) : 0, + nearestAppo, context) .then((res) { if (res['MessageStatus'] == 1) { @@ -248,6 +249,8 @@ class _SearchByClinicState extends State { num: numAll, resultDistance: resultDistance), ), - ); + ).then((value) { + getProjectsList(); + }); } } diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 6819c54b..88912a3f 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -145,7 +145,7 @@ class _ExpandableListViewState extends State { String getProjectDistance(String distance) { if (distance != "0") - return " - " + distance + " KMs"; + return " - " + distance + " " + TranslationBase.of(context).km; else { return ""; } diff --git a/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart new file mode 100644 index 00000000..27f37d0a --- /dev/null +++ b/lib/pages/BookAppointment/widgets/DentalComplaintCard.dart @@ -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 { + @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: [ + Container( + width: MediaQuery.of(context).size.width * 0.85, + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text(widget.listDentalChiefComplain.name, + style: + TextStyle(fontSize: 16.0, color: Colors.black)), + ), + ], + ), + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Icon(Icons.arrow_forward_ios, + size: 20.0, color: Colors.black54), + ], + ), + ), + ], + ), + ), + ), + ); + } + + getChiefComplaintsList() { + List doctorsList = []; + List _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 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 docList, + List + patientDoctorAppointmentListHospital) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchResults( + doctorsList: docList, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))); + } +} diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index e8f08af5..67c536c4 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -39,7 +40,7 @@ class DoctorView extends StatelessWidget { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.5, + width: MediaQuery.of(context).size.width * 0.55, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -74,6 +75,16 @@ class DoctorView extends StatelessWidget { color: Colors.grey[600], letterSpacing: 1.0)), ), + this.doctor.nearestFreeSlot != null ? Container( + margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + child: Text( + getDate(this.doctor.nearestFreeSlot), + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.bold, + color: Colors.green[600], + letterSpacing: 1.0)), + ) : Container(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisSize: MainAxisSize.max, @@ -136,6 +147,29 @@ class DoctorView extends StatelessWidget { }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + String getDate(String date) { + DateTime dateObj = DateUtil.convertStringToDate(date); + return DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString() + + " " + + dateObj.hour.toString() + + ":" + + getMinute(dateObj); + } + + String getMinute(DateTime dateObj) { + if(dateObj.minute == 0) { + return dateObj.minute.toString() + "0"; + } else { + return dateObj.minute.toString(); + } + } + Future navigateToDoctorProfile(context, docObject, docProfile, {isAppo}) async { Navigator.push( diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 63034373..699990ac 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCar import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -15,6 +16,13 @@ class MyAppointments extends StatefulWidget { List confirmedAppoList = []; List arrivedAppoList = []; + List _patientBookedAppointmentListHospital = List(); + + List _patientConfirmedAppointmentListHospital = + List(); + + List _patientArrivedAppointmentListHospital = List(); + @override _MyAppointmentsState createState() => _MyAppointmentsState(); } @@ -40,7 +48,6 @@ class _MyAppointmentsState extends State isShowAppBar: true, body: Container( child: Column(children: [ - /// this is will not colored with theme data TabBar( tabs: [ Tab(text: TranslationBase.of(context).booked), @@ -94,7 +101,8 @@ class _MyAppointmentsState extends State } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } bool isConfirmed(AppoitmentAllHistoryResultList appo) { @@ -123,64 +131,176 @@ class _MyAppointmentsState extends State widget.arrivedAppoList.add(v); } }); + + widget.bookedAppoList.forEach((element) { + List doctorByHospital = + widget._patientBookedAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + widget + ._patientBookedAppointmentListHospital[widget + ._patientBookedAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientBookedAppointmentListHospital.add(PatientAppointmentList( + filterName: element.clinicName, patientDoctorAppointment: element)); + } + }); + + widget.confirmedAppoList.forEach((element) { + List doctorByHospital = + widget._patientConfirmedAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + widget + ._patientConfirmedAppointmentListHospital[widget + ._patientConfirmedAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientConfirmedAppointmentListHospital.add( + PatientAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + }); + + widget.arrivedAppoList.forEach((element) { + List doctorByHospital = + widget._patientArrivedAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.clinicName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + widget + ._patientArrivedAppointmentListHospital[widget + ._patientArrivedAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + widget._patientArrivedAppointmentListHospital.add( + PatientAppointmentList( + filterName: element.clinicName, + patientDoctorAppointment: element)); + } + }); } openAppointmentsTab() { if (widget.bookedAppoList.length != 0) { - _tabController.animateTo((_tabController.index + 1) % 1); + _tabController.index = 0; } else if (widget.confirmedAppoList.length != 0) { - _tabController.animateTo((_tabController.index + 1) % 2); + _tabController.index = 1; } else if (widget.arrivedAppoList.length != 0) { - _tabController.animateTo((_tabController.index + 1) % 3); + _tabController.index = 2; return; } } Widget getBookedAppointments() { return Container( - child: widget.bookedAppoList.length != 0 - ? new ListView.builder( - itemCount: widget.bookedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.bookedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, - ) - : Container( - child: Center( + margin: EdgeInsets.only(top: 10.0), + child: Container( + child: widget.bookedAppoList.length != 0 + ? SingleChildScrollView( + physics: BouncingScrollPhysics(), child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, children: [ - Image.asset( - "assets/images/new-design/noAppointmentIcon.png"), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("No Booked Appointments", - style: TextStyle( - fontSize: 16.0, + ...List.generate( + widget._patientBookedAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + ._patientBookedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget + ._patientBookedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), )), - ), + ) ], ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/images/new-design/noAppointmentIcon.png"), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("No Booked Appointments", + style: TextStyle( + fontSize: 16.0, + )), + ), + ], + ), + ), ), - ), + ), ); } Widget getConfirmedAppointments() { return widget.confirmedAppoList.length != 0 ? Container( - child: new ListView.builder( - itemCount: widget.confirmedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.confirmedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, + margin: EdgeInsets.only(top: 10.0), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + ...List.generate( + widget._patientConfirmedAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + ._patientConfirmedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget + ._patientConfirmedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + )), + ) + ], + ), ), ) : Container( @@ -206,16 +326,47 @@ class _MyAppointmentsState extends State Widget getArrivedAppointments() { return widget.arrivedAppoList.length != 0 ? Container( - child: new ListView.builder( - itemCount: widget.arrivedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.arrivedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, + margin: EdgeInsets.only(top: 10.0), + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + ...List.generate( + widget._patientArrivedAppointmentListHospital.length, + (index) => AppExpandableNotifier( + title: widget + ._patientArrivedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget + ._patientArrivedAppointmentListHospital[index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + )), + ) + ], + ), ), ) +// Container( +// child: new ListView.builder( +// itemCount: widget.arrivedAppoList.length, +// itemBuilder: (context, i) { +// return AppointmentCard( +// appo: widget.arrivedAppoList[i], +// onReloadAppointmentHistory: getPatientAppointmentHistory, +// ); +// }, +// ), +// ) : Container( child: Center( child: Column( diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index e2f6f706..b64bd232 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -42,7 +42,7 @@ class _ApointmentCardState extends State { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.6, + width: MediaQuery.of(context).size.width * 0.57, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -95,7 +95,7 @@ class _ApointmentCardState extends State { emptyIcon: Icons.star, ), Container( - transform: Matrix4.translationValues(0.0, -40.0, 0.0), + transform: Matrix4.translationValues(15.0, -40.0, 0.0), child: Image.asset( "assets/images/new-design/arrow.png", width: 25.0, diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index 61845095..c992e8e9 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; -import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:flutter/cupertino.dart'; class DoctorsListService extends BaseService { @@ -23,7 +22,8 @@ class DoctorsListService extends BaseService { double lat; double long; - Future getDoctorsList(int clinicID, int projectID, BuildContext context, + Future getDoctorsList( + int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -34,7 +34,8 @@ class DoctorsListService extends BaseService { authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } @@ -62,6 +63,9 @@ class DoctorsListService extends BaseService { "IsGetNearAppointment": false, "Latitude": lat.toString(), "Longitude": long.toString(), + "IsGetNearAppointment": isNearest, + if (isNearest) + "SelectedDate": DateUtil.convertDateToString(DateTime.now()), "License": true }; @@ -88,7 +92,8 @@ class DoctorsListService extends BaseService { authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { lat = await this.sharedPref.getDouble(USER_LAT); long = await this.sharedPref.getDouble(USER_LONG); } diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index cb486762..8cc1e469 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -37,10 +37,10 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_CLINICS_LIST_URL, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } @@ -64,14 +64,15 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_PROJECTS_LIST, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } - Future getChiefComplaintsList(int clinicID, int projectID, BuildContext context, + Future getChiefComplaintsList( + int clinicID, int projectID, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); Map request; @@ -82,12 +83,6 @@ class ClinicListService extends BaseService { authUser = data; } - if (await this.sharedPref.getDouble(USER_LAT) != null && - await this.sharedPref.getDouble(USER_LONG) != null) { - lat = await this.sharedPref.getDouble(USER_LAT); - long = await this.sharedPref.getDouble(USER_LONG); - } - var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { @@ -114,11 +109,56 @@ class ClinicListService extends BaseService { await baseAppClient.post(GET_DOCTORS_LIST_URL, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); return Future.value(localRes); } + Future getChiefComplaintDoctorList( + int chiefComplaintID, int projectID, BuildContext context, + {doctorId}) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "ChiefComplaintID": chiefComplaintID, + "ProjectID": projectID, + "VersionID": 5.6, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": 0, + "SessionID": null, + "isDentalAllowedBackend": true, + "Latitude": lat.toString(), + "Longitude": long.toString(), + "DeviceTypeID": 1 + }; + + dynamic localRes; + + await baseAppClient.post(GET_DENTAL_DOCTORS_LIST_URL, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index d9fc04bc..3b3e581d 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -452,6 +452,8 @@ class TranslationBase { localizedValues['textToSpeech'][locale.languageCode]; String get locationDialogMessage => localizedValues['locationDialogMessage'][locale.languageCode]; + String get km => + localizedValues['km'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/others/bottom_bar.dart b/lib/widgets/others/bottom_bar.dart index 32df2dfc..d0fc01f6 100644 --- a/lib/widgets/others/bottom_bar.dart +++ b/lib/widgets/others/bottom_bar.dart @@ -312,7 +312,7 @@ class _SearchBot extends State { List doctorsList = []; DoctorsListService service = new DoctorsListService(); service - .getDoctorsList(clinicId, projectId, context, doctorId: doctorName) + .getDoctorsList(clinicId, projectId, false, context, doctorId: doctorName) .then((res) { if (res['MessageStatus'] == 1) { setState(() {