diff --git a/lib/models/Appointments/DoctorProfile.dart b/lib/models/Appointments/DoctorProfile.dart index df6031a7..f96eb4d6 100644 --- a/lib/models/Appointments/DoctorProfile.dart +++ b/lib/models/Appointments/DoctorProfile.dart @@ -1,47 +1,47 @@ class DoctorProfileList { - int doctorID; + num doctorID; String doctorName; - Null doctorNameN; - int clinicID; + dynamic doctorNameN; + num clinicID; String clinicDescription; - Null clinicDescriptionN; - Null licenseExpiry; - int employmentType; - Null setupID; - int projectID; + dynamic clinicDescriptionN; + dynamic licenseExpiry; + num employmentType; + dynamic setupID; + num projectID; String projectName; String nationalityID; String nationalityName; - Null nationalityNameN; - int gender; + dynamic nationalityNameN; + num gender; String genderDescription; - Null genderDescriptionN; - Null doctorTitle; - Null projectNameN; + dynamic genderDescriptionN; + dynamic doctorTitle; + dynamic projectNameN; bool isAllowWaitList; String titleDescription; - Null titleDescriptionN; - Null isRegistered; - Null isDoctorDummy; + dynamic titleDescriptionN; + dynamic isRegistered; + dynamic isDoctorDummy; bool isActive; bool isDoctorHasPrePostImages; - Null isDoctorAppointmentDisplayed; + dynamic isDoctorAppointmentDisplayed; bool doctorClinicActive; - Null isbookingAllowed; + dynamic isbookingAllowed; String doctorCases; - Null doctorPicture; + dynamic doctorPicture; String doctorProfileInfo; List specialty; - int actualDoctorRate; + num actualDoctorRate; String doctorImageURL; - int doctorRate; - double decimalDoctorRate; + num doctorRate; + num decimalDoctorRate; String doctorTitleForProfile; bool isAppointmentAllowed; String nationalityFlagURL; - int noOfPatientsRate; + num noOfPatientsRate; String qR; - int serviceID; + num serviceID; DoctorProfileList( {this.doctorID, diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 323567b7..585e862d 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -47,6 +47,8 @@ class BookConfirm extends StatefulWidget { class _BookConfirmState extends State { ToDoCountProviderModel toDoProvider; + AppSharedPreferences sharedPref = new AppSharedPreferences(); + @override void initState() { widget.authUser = new AuthenticatedUser(); @@ -195,8 +197,8 @@ class _BookConfirmState extends State { elevation: 0, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), - onPressed: () { - if (!widget.isLiveCareAppointment) { + onPressed: () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -244,8 +246,8 @@ class _BookConfirmState extends State { service.cancelAppointment(appo, context).then((res) { GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { - Future.delayed(new Duration(milliseconds: 1500), () { - if (!widget.isLiveCareAppointment) { + Future.delayed(new Duration(milliseconds: 1500), () async { + if (!await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) { insertAppointment(context, widget.doctor); } else { insertLiveCareScheduledAppointment(context, widget.doctor); @@ -441,6 +443,7 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { GifLoaderDialogUtils.hideDialog(context); + this.sharedPref.remove(IS_LIVECARE_APPOINTMENT); Navigator.push( context, FadePage( diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 959816af..8e576c99 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -12,7 +12,6 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; - import 'package:syncfusion_flutter_calendar/calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -79,7 +78,7 @@ class _DocAvailableAppointmentsState extends State wit WidgetsBinding.instance.addPostFrameCallback((_) async { getCurrentLanguage(); - if (widget.isLiveCareAppointment) + if (await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT)) getDoctorScheduledFreeSlots(context, widget.doctor); else { getDoctorFreeSlots(context, widget.doctor); @@ -351,22 +350,27 @@ class MeetingDataSource extends CalendarDataSource { DateTime getStartTime(int index) { return _getMeetingData(index).from; } + @override DateTime getEndTime(int index) { return _getMeetingData(index).to; } + @override String getSubject(int index) { return _getMeetingData(index).eventName; } + @override Color getColor(int index) { return _getMeetingData(index).background; } + @override bool isAllDay(int index) { return _getMeetingData(index).isAllDay; } + Meeting _getMeetingData(int index) { final dynamic meeting = appointments[index]; Meeting meetingData; diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 1a0ec103..b46e1958 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; -import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -20,7 +18,10 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.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/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; @@ -40,7 +41,7 @@ class ToDo extends StatefulWidget { bool isShowAppBar = true; Function onBackClick; - ToDo({@required this.isShowAppBar,this.onBackClick}); + ToDo({@required this.isShowAppBar, this.onBackClick}); @override _ToDoState createState() => _ToDoState(); @@ -49,11 +50,7 @@ class ToDo extends StatefulWidget { class _ToDoState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); - AuthenticatedUser authUser; - AuthenticatedUserObject authenticatedUserObject = locator(); - List imagesInfo = List(); - ToDoCountProviderModel toDoProvider; CountdownTimerController controller; @@ -63,7 +60,7 @@ class _ToDoState extends State { void initState() { widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { - if (authenticatedUserObject.isLogin) getPatientData(); + getPatientAppointmentHistory(); }); super.initState(); imagesInfo @@ -85,7 +82,7 @@ class _ToDoState extends State { showNewAppBarTitle: true, icon: "assets/images/new/bottom_nav/todo.svg", description: TranslationBase.of(context).infoTodo, - onTap:widget.onBackClick, + onTap: widget.onBackClick, backgroundColor: CustomColors.appBackgroudGrey2Color, body: SingleChildScrollView( child: Column( @@ -98,207 +95,353 @@ class _ToDoState extends State { padding: EdgeInsets.all(0.0), itemCount: widget.appoList.length, itemBuilder: (context, index) { - print("ttt " + getNextActionImage(widget.appoList[index].nextAction)); - print("ttt " + widget.appoList[index].nextAction.toString()); return Container( - margin: EdgeInsets.all(10.0), + width: double.infinity, + margin: EdgeInsets.only(left: 12.0, right: 12.0, top: 12.0), + decoration: cardRadius(12), + padding: EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: widget.appoList[index].clinicID == 265 + ? Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: SvgPicture.asset("assets/images/new/drive-thru.svg"), + ) + : widget.appoList[index].isLiveCareAppointment + ? SvgPicture.asset("assets/images/new/virtual.svg") + : SvgPicture.asset("assets/images/new/hospital-visit.svg"), + + // SvgPicture.asset("assets/images/new/virtual.svg"), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text( + widget.appoList[index].clinicID == 265 + ? TranslationBase.of(context).drivethruAppo + : widget.appoList[index].isLiveCareAppointment + ? TranslationBase.of(context).liveCareAppo + : TranslationBase.of(context).walkinAppo, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: CountdownTimer( + controller: new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + widgetBuilder: (_, CurrentRemainingTime time) { + return time != null + ? Text( + '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + TranslationBase.of(context).upcomingTimeLeft, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)) + : Container(); + }, + ), + ), + ], + ), + ], + ), + Container( + child: InkWell( + onTap: () { + performNextAction(widget.appoList[index]); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: getNextActionButtonColor(widget.appoList[index].nextAction), + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + getNextActionText(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), + ), + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + url: widget.appoList[index].doctorImageURL, + width: 52, + height: 52, ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), + SizedBox(width: 11), + Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, + mainAxisSize: MainAxisSize.min, children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", + DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, children: [ - Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), - Container( - width: MediaQuery.of(context).size.width * 0.4, - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Text( - DateUtil.getWeekDayMonthDayYearDateFormatted( - DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + - " " + - widget.appoList[index].startTime.substring(0, 5), - overflow: TextOverflow.clip, - style: TextStyle(fontSize: 10.0)), - ), - !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), - Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: widget.appoList[index].isLiveCareAppointment - ? Container() - : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", - overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + RatingBar.readOnly( + initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, ), ], ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), - ), - ), - ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, - style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), - if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), - style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: widget.appoList[index].actualDoctorRate.toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - Container( - child: CountdownTimer( - controller: - new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), - widgetBuilder: (_, CurrentRemainingTime time) { - return time != null - ? Text( - '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + - TranslationBase.of(context).upcomingTimeLeft, - style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) - : Container(); - }, - ), - ), - ], - ), - ), - ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => performNextAction(widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ), - ) - ], - ), - Divider( - color: Colors.grey[500], - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), - ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context, widget.appoList[index]); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), - ), - ), - ) - ], - ), ], ), ), - ), + ], ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), - color: Color(0xff20bc44), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + getNextActionDescription(widget.appoList[index].nextAction), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), ), - height: 30.0, - padding: EdgeInsets.only(right: 10, left: 10), - margin: EdgeInsets.symmetric(horizontal: 20), - transform: Matrix4.translationValues(0.0, -8.0, 0.0), - child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: [ - widget.appoList[index].clinicID == 265 - ? Container( - margin: EdgeInsets.only(left: 5.0, right: 5.0), - child: SvgPicture.asset( - "assets/images/new/car_icon.svg", - height: 15, - width: 15, - ), - ) - : widget.appoList[index].isLiveCareAppointment - ? Image.asset("assets/images/new-design/video.png") - : Image.asset("assets/images/new-design/walkin.png"), - widget.appoList[index].clinicID == 265 - ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - : widget.appoList[index].isLiveCareAppointment - ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) - ], + ), + InkWell( + onTap: () { + navigateToAppointmentDetails(context, widget.appoList[index]); + }, + child: Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + TranslationBase.of(context).moreDetails, + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), ), ), ], ), ); + // return Container( + // margin: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Container( + // child: Card( + // margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + // color: Colors.white, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // child: Container( + // width: MediaQuery.of(context).size.width, + // padding: EdgeInsets.all(10.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // children: [ + // Row( + // children: [ + // Image.asset("assets/images/new-design/time_icon.png", width: 20.0, height: 20.0), + // Container( + // width: MediaQuery.of(context).size.width * 0.4, + // margin: EdgeInsets.only(left: 10.0, right: 10.0), + // child: Text( + // DateUtil.getWeekDayMonthDayYearDateFormatted( + // DateUtil.convertStringToDate(widget.appoList[index].appointmentDate), projectViewModel.isArabic ? "ar" : "en") + + // " " + + // widget.appoList[index].startTime.substring(0, 5), + // overflow: TextOverflow.clip, + // style: TextStyle(fontSize: 10.0)), + // ), + // !widget.appoList[index].isLiveCareAppointment ? Image.asset("assets/images/new-design/hospital_address_icon.png", width: 20.0, height: 20.0) : Container(), + // Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: widget.appoList[index].isLiveCareAppointment + // ? Container() + // : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + // overflow: TextOverflow.clip, maxLines: 2, style: TextStyle(fontSize: 10.0)), + // ), + // ], + // ), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Divider( + // color: Colors.grey[500], + // ), + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 1, + // child: Container( + // height: MediaQuery.of(context).size.height * 0.1, + // margin: EdgeInsets.only(top: 5.0), + // child: ClipRRect( + // borderRadius: BorderRadius.circular(100.0), + // child: Image.network(widget.appoList[index].doctorImageURL, fit: BoxFit.fill), + // ), + // ), + // ), + // Expanded( + // flex: 3, + // child: Container( + // margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Text(widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj, + // style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.bold, letterSpacing: -0.64)), + // if (getDoctorSpeciality(widget.appoList[index].doctorSpeciality) != "null\n") + // Container( + // margin: EdgeInsets.only(top: 3.0, bottom: 3.0), + // child: Text(getDoctorSpeciality(widget.appoList[index].doctorSpeciality).trim(), + // style: TextStyle(fontSize: 12.0, color: Colors.grey[600], letterSpacing: -0.64)), + // ), + // Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // mainAxisSize: MainAxisSize.max, + // children: [ + // RatingBar.readOnly( + // initialRating: widget.appoList[index].actualDoctorRate.toDouble(), + // size: 20.0, + // filledColor: Colors.yellow[700], + // emptyColor: Colors.grey[500], + // isHalfAllowed: true, + // halfFilledIcon: Icons.star_half, + // filledIcon: Icons.star, + // emptyIcon: Icons.star, + // ), + // ], + // ), + // Container( + // child: CountdownTimer( + // controller: + // new CountdownTimerController(endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60), + // widgetBuilder: (_, CurrentRemainingTime time) { + // return time != null + // ? Text( + // '${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} ' + + // TranslationBase.of(context).upcomingTimeLeft, + // style: TextStyle(fontSize: 12.0, color: Color(0xffC5272D))) + // : Container(); + // }, + // ), + // ), + // ], + // ), + // ), + // ), + // Expanded( + // flex: 1, + // child: InkWell( + // onTap: () => performNextAction(widget.appoList[index]), + // child: Container( + // margin: EdgeInsets.only(top: 20.0), + // child: Column( + // children: [ + // Image.asset(getNextActionImage(widget.appoList[index].nextAction), width: 50.0, height: 50.0), + // Container( + // margin: EdgeInsets.only(top: 5.0), + // child: Text(getNextActionText(widget.appoList[index].nextAction), textAlign: TextAlign.center, style: TextStyle(fontSize: 12.0)), + // ) + // ], + // ), + // ), + // ), + // ) + // ], + // ), + // Divider( + // color: Colors.grey[500], + // ), + // Flex( + // direction: Axis.horizontal, + // children: [ + // Expanded( + // flex: 2, + // child: Container( + // child: Text(getNextActionDescription(widget.appoList[index].nextAction), style: TextStyle(fontSize: 11.0, color: Colors.grey[700])), + // ), + // ), + // Expanded( + // flex: 1, + // child: GestureDetector( + // onTap: () { + // navigateToAppointmentDetails(context, widget.appoList[index]); + // }, + // child: Container( + // child: Text(TranslationBase.of(context).upcomingDetails, + // textAlign: TextAlign.end, style: TextStyle(fontSize: 11.0, color: new Color(0xffC5272D), decoration: TextDecoration.underline)), + // ), + // ), + // ) + // ], + // ), + // ], + // ), + // ), + // ), + // ), + // Container( + // decoration: BoxDecoration( + // borderRadius: BorderRadius.only(bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0)), + // color: Color(0xff20bc44), + // ), + // height: 30.0, + // padding: EdgeInsets.only(right: 10, left: 10), + // margin: EdgeInsets.symmetric(horizontal: 20), + // transform: Matrix4.translationValues(0.0, -8.0, 0.0), + // child: Row( + // mainAxisSize: MainAxisSize.min, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // widget.appoList[index].clinicID == 265 + // ? Container( + // margin: EdgeInsets.only(left: 5.0, right: 5.0), + // child: SvgPicture.asset( + // "assets/images/new/car_icon.svg", + // height: 15, + // width: 15, + // ), + // ) + // : widget.appoList[index].isLiveCareAppointment + // ? Image.asset("assets/images/new-design/video.png") + // : Image.asset("assets/images/new-design/walkin.png"), + // widget.appoList[index].clinicID == 265 + // ? Text(TranslationBase.of(context).drivethruAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : widget.appoList[index].isLiveCareAppointment + // ? Text(TranslationBase.of(context).videoAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // : Text(TranslationBase.of(context).walkinAppo, style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 11.0)) + // ], + // ), + // ), + // ], + // ), + // ); }, ), ), @@ -375,6 +518,48 @@ class _ToDoState extends State { } } + Color getNextActionButtonColor(nextAction) { + switch (nextAction) { + case 0: + return CustomColors.accentColor; + break; + case 10: + return CustomColors.green; + break; + + case 15: + return CustomColors.grey2; + break; + + case 20: + return CustomColors.green; + break; + + case 30: + return CustomColors.accentColor; + break; + + case 40: + return CustomColors.green; + break; + + case 50: + return CustomColors.green; + break; + + case 60: + return CustomColors.orange; + break; + + case 90: + return CustomColors.accentColor; + break; + + default: + return CustomColors.green; + } + } + String getNextActionText(nextAction) { switch (nextAction) { case 0: @@ -732,35 +917,34 @@ class _ToDoState extends State { }); } - getPatientData() async { - AppSharedPreferences sharedPref = AppSharedPreferences(); - if (await sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); - setState(() { - print(data); - authUser = data; - }); - getPatientAppointmentHistory(); - } - } + // getPatientData() async { + // AppSharedPreferences sharedPref = AppSharedPreferences(); + // if (await sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + // setState(() { + // print(data); + // authUser = data; + // }); + // getPatientAppointmentHistory(); + // } + // } Future navigateToPaymentMethod(context, PatientShareResponse patientShareResponse, AppoitmentAllHistoryResultList appo) async { - if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - setState(() { - authUser = data; - }); - } - - Navigator.push(context, FadePage(page: PaymentMethod( - onSelectedMethod: (String metohd) { + // if (await this.sharedPref.getObject(USER_PROFILE) != null) { + // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); + // setState(() { + // authUser = data; + // }); + // } + + Navigator.push(context, FadePage(page: PaymentMethod(onSelectedMethod: (String metohd) { setState(() {}); }))).then((value) { print(value); getPatientAppointmentHistory(); if (value != null) { - openPayment(value, authUser, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); + openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo); } }); } diff --git a/lib/pages/ToDoList/widgets/paymentDialog.dart b/lib/pages/ToDoList/widgets/paymentDialog.dart index eedbb874..7a0bdc2e 100644 --- a/lib/pages/ToDoList/widgets/paymentDialog.dart +++ b/lib/pages/ToDoList/widgets/paymentDialog.dart @@ -89,7 +89,7 @@ class _PaymentDialogState extends State { children: [ Expanded( child: DefaultButton( - TranslationBase.of(context).cancel, + TranslationBase.of(context).cancel_nocaps, () { Navigator.pop(context, null); }, diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 6610ed33..863947ea 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -1,20 +1,17 @@ -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; -import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; -import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; import 'package:rating_bar/rating_bar.dart'; class TodoListCard extends StatefulWidget { - AppoitmentAllHistoryResultList appo; - var languageID; - final VoidCallback onListUpdated; - - TodoListCard({@required this.appo, this.onListUpdated}); + TodoListCard(); @override _TodoListCardState createState() => _TodoListCardState(); @@ -25,333 +22,128 @@ class _TodoListCardState extends State { @override void initState() { -// widget.onListUpdated(); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return Container( + width: double.infinity, margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ + decoration: cardRadius(12), + padding: EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Row( - children: [ - Image.asset("assets/images/new-design/time_icon.png", - width: 20.0, height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 30.0), - child: Text(getDate(widget.appo.appointmentDate), - style: TextStyle(fontSize: 12.0)), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 4.0), + child: SvgPicture.asset("assets/images/new/virtual.svg"), ), - widget.appo.isLiveCareAppointment - ? SvgPicture.asset( - "assets/images/new-design/liveCare_logo_icon.svg", - width: 20.0, - height: 20.0) - : Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: widget.appo.isLiveCareAppointment - ? Text(TranslationBase.of(context).upcomingLivecare, - style: TextStyle(fontSize: 12.0)) - : Text(widget.appo.projectName, - style: TextStyle(fontSize: 12.0)), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text(TranslationBase.of(context).videoAppo, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: Text("01:23:22 " + TranslationBase.of(context).upcomingTimeLeft, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48)), + ), + ], ), ], ), Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network(widget.appo.doctorImageURL, - fit: BoxFit.fill), - ), + child: InkWell( + onTap: () { + // showConfirmMessage(model, order); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14), + decoration: BoxDecoration( + color: CustomColors.green, + border: Border.all(color: Colors.white, width: 1), + borderRadius: BorderRadius.circular(6), ), - ), - Expanded( - flex: 3, - child: Container( - margin: - EdgeInsets.only(top: 20.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.appo.doctorTitle + - " " + - widget.appo.doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality( - widget.appo.doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, - children: [ - RatingBar.readOnly( - initialRating: 4.0, - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, - ), - ], - ), - ], - ), + child: Text( + TranslationBase.of(context).confirm, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4), ), ), - Expanded( - flex: 1, - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget.appo.nextAction), - width: 50.0, - height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget.appo.nextAction), - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0)), - ) - ], - ), - ), - ) - ], + ), ), - Divider( - color: Colors.grey[500], + ], + ), + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Text( + "Raed Mubarak Bin Ghanem", + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + LargeAvatar( + name: "Raed Mubarak Bin Ghanem", + url: "https://hmgwebservices.com/Images/MobileImages/TAKHSUSI/158210.png", + width: 52, + height: 52, ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription(widget.appo.nextAction), - style: TextStyle( - fontSize: 12.0, color: Colors.grey[700])), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText(TranslationBase.of(context).clinic + ": ", "Cardiology", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).appointmentDate + ": ", "11/04/2021 15:30", projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).branch, "Olaya Hospital", projectViewModel.isArabic), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: 4.5, + size: 16.0, + filledColor: Color(0XFFD02127), + emptyColor: Color(0XFFD02127), + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star_border, + ), + ], ), - ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails(context); - }, - child: Container( - child: Text(TranslationBase.of(context).upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: new Color(0xFF40ACC9), - decoration: TextDecoration.underline)), - ), - ), - ) - ], + ], + ), ), ], ), - ), + Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Text( + "Please confirm the appointment to avoid cancellation", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 25 / 16), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 0.0), + child: Text( + "More Details", + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, color: CustomColors.accentColor, letterSpacing: -0.48, height: 25 / 16, decoration: TextDecoration.underline), + ), + ), + ], ), ); } - - String getNextActionImage(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return "assets/images/new-design/confirm_button.png"; - break; - - case 15: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic_disabled.png" - : "assets/images/new-design/pay_online_button_disabled.png"; - break; - - case 20: - return widget.languageID == 'ar' - ? "assets/images/new-design/pay_online_button_arabic.png" - : "assets/images/new-design/pay_online_button.png"; - break; - - case 30: - return "assets/images/new-design/qr_code_button.png"; - break; - - case 40: - return "assets/images/new-design/video_call_instruction.png"; - break; - - case 50: - return "assets/images/new-design/liveCare_logo_icon.png"; - break; - - default: - return ""; - } - } - - String getNextActionText(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).confirm; - break; - - case 15: - return TranslationBase.of(context).pendingPayment; - break; - - case 20: - return TranslationBase.of(context).payNow; - break; - - case 30: - return TranslationBase.of(context).viewQR; - break; - - case 40: - return TranslationBase.of(context).instruction; - break; - - case 50: - return TranslationBase.of(context).livecare; - break; - - default: - return ""; - } - } - - String getNextActionDescription(nextAction) { - switch (nextAction) { - case 0: - return "No Action"; - break; - case 10: - return TranslationBase.of(context).upcomingConfirm; - break; - - case 15: - return TranslationBase.of(context).upcomingPaymentPending; - break; - - case 20: - return TranslationBase.of(context).upcomingPaymentNow; - break; - - case 30: - return TranslationBase.of(context).upcomingQR; - break; - - case 40: - return TranslationBase.of(context).upcomingVirtual; - break; - - case 50: - return TranslationBase.of(context).upcomingLivecare; - break; - - default: - return ""; - } - } - - getLanguageID() async { - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - setState(() { - widget.languageID = languageID; - }); - } - - 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(); - } - } - - String getDoctorSpeciality(List docSpecial) { - String docSpeciality = ""; - docSpecial.forEach((v) { - docSpeciality = docSpeciality + v + "\n"; - }); - return docSpeciality; - } - - Future navigateToAppointmentDetails(context) async { - Navigator.push( - context, FadePage(page: AppointmentDetails())); - } } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 988d102c..bf4d33c7 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -626,7 +626,7 @@ class _clinic_listState extends State { } Future navigateToSearchResults(context, List docList, List patientDoctorAppointmentListHospital) async { - Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: true, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); + Navigator.push(context, FadePage(page: SearchResults(doctorsList: docList, isLiveCareAppointment: false, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); } updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { diff --git a/lib/widgets/my_rich_text.dart b/lib/widgets/my_rich_text.dart index 92100f48..c3d108c5 100644 --- a/lib/widgets/my_rich_text.dart +++ b/lib/widgets/my_rich_text.dart @@ -12,11 +12,11 @@ class MyRichText extends StatelessWidget { maxLines: 1, text: TextSpan( text: title, - style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), + style: TextStyle(fontSize: 10, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff575757), letterSpacing: -0.4, height: 18 / 10), children: [ TextSpan( text: " $value", - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontFamily: isArabic ? 'Cairo' : 'Poppins', color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), ) ]), );