diff --git a/lib/core/service/vaccine_service.dart b/lib/core/service/vaccine_service.dart index 29349378..f4ff7176 100644 --- a/lib/core/service/vaccine_service.dart +++ b/lib/core/service/vaccine_service.dart @@ -15,6 +15,10 @@ class VaccineService extends BaseService { Map body = Map(); body['To'] = "0"; body['From'] = "0"; + + // body['PatientID'] = 1018977; + // body['TokenID'] = "@dm!n"; + hasError = false; _vaccineList.clear(); await baseAppClient.post(GET_VACCINES, diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index f75cc59f..0265dc32 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -1,21 +1,18 @@ -import 'package:diplomaticquarterapp/config/size_config.dart'; -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../base/base_view.dart'; -import 'my_vaccines_item_screen.dart'; //TODO fix by jammal we have a static data class MyVaccines extends StatefulWidget { @@ -40,191 +37,71 @@ class _MyVaccinesState extends State { ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vacceines/ar/0.png') ], body: Container( - margin: EdgeInsets.only( - left: SizeConfig.screenWidth * 0.004, - right: SizeConfig.screenWidth * 0.004, - top: SizeConfig.screenWidth * 0.04, - ), + margin: EdgeInsets.only(top: 20.0), child: Column( children: [ - RoundedContainer( - backgroundColor: Colors.white, - child: ExpansionTile( - title: Container( - height: 65.0, - child: Text('2018'), - ), - children: [ - Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, - itemBuilder: (BuildContext context, int index) { - return Column( - children: [ - RoundedContainer( - child: Column( - children: [ - Row( - children: [ - Expanded( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 20.0), - child: Image.network( - model.vaccineList[index].doctorImageURL, - height: SizeConfig.imageSizeMultiplier * 23, - width: SizeConfig.imageSizeMultiplier * 20, - fit: BoxFit.fill, - ), - ), - ], - ), - flex: 2, - ), - Expanded( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.vaccineList[index].doctorTitle + model.vaccineList[index].doctorName, - style: TextStyle( - fontWeight: FontWeight.w900, - fontSize: 16.6, - ), - ), - SizedBox(height: 7.0), - Text( - model.vaccineList[index].projectName, - style: TextStyle( - fontSize: 17.0, - letterSpacing: 0.5, - ), - ), - SizedBox(height: 7.0), - Text( - model.vaccineList[index].vaccineName, - style: TextStyle( - fontSize: 17.0, - ), - ), - SizedBox(height: 7.0), - Text( - 'Date Taken ' + convertDateFormat(model.vaccineList[index].invoiceDate), - style: TextStyle(fontSize: 17.0), - ), - ], - ), - ), - flex: 5, - ), - ], - ), - ], - ), - ), - ], - ); - }), - ) - ], - ), - ), + AppExpandableNotifier( + isExpand: true, + title: "2013", + bodyWidget: Container( + child: ListView.separated( + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, + padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21), + separatorBuilder: (context, index) => SizedBox(height: 14), + itemBuilder: (BuildContext context, int index) { + return DoctorCard( + onTap: () {}, + isInOutPatient: true, + isShowInOutPatient: false, + name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName, + billNo: "", + vaccineName: model.vaccineList[index].vaccineName, + profileUrl: model.vaccineList[index].doctorImageURL, + subName: model.vaccineList[index].projectName, + isLiveCareAppointment: false, + date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate), + isSortByClinic: true, + ); + }), + )), // SpaceBetweenTexts(space: 165.0), ], ), ), - bottomSheet: model.state == ViewState.Busy - ? Container( - height: 0, - ) - : model.vaccineList.length > 0 - ? Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(12), - height: MediaQuery.of(context).size.height * 0.25, - width: double.infinity, - child: Column( - children: [ - Divider( - height: 2, - thickness: 1, - ), - SizedBox( - height: 6, - ), - Container( - width: double.infinity, - // height: 80.0, - child: Button( - disabled: true, - label: TranslationBase.of(context).checkVaccineAvailability, - backgroundColor: Color(0xff9EA3A4), - onTap: () => Navigator.push(context, FadePage(page: MyVaccinesItemPage())), - ), - ), - if (projectViewModel.havePrivilege(27)) - Container( - width: double.infinity, - child: DefaultButton( - TranslationBase.of(context).sendEmail, - () { - showDialog( - context: context, - child: ConfirmSendEmailDialog( - email: projectViewModel.user.emailAddress, - onTapSendEmail: () { - model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - }, - ), - ); - }, - ), - - // SecondaryButton( - // label: TranslationBase.of(context).sendEmail, - // color: Color(0xffF62426), - // textColor: Colors.white, - // disabled: model.vaccineList.length == 0, - // loading: model.state == ViewState.BusyLocal, - // onTap: () async { - // showDialog( - // context: context, - // child: ConfirmSendEmailDialog( - // email: projectViewModel.user.emailAddress, - // onTapSendEmail: () { - // // generateCovidCertificate(context, isOutsideKSA); - // model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - // }, - // ), - // ); - // // model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); - // }, - // ), - ), - ], + bottomSheet: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: Row(mainAxisSize: MainAxisSize.min, children: [ + Expanded( + child: DefaultButton( + TranslationBase.of(context).availability, + () { + // Navigator.push(context, FadePage(page: MyVaccinesItemPage())); + }, + color: Color(0xffEAEAEA), + textColor: Color(0xff000000), + ), + ), + SizedBox(width: 8), + Expanded( + child: DefaultButton( + TranslationBase.of(context).sendEmail, + () { + showDialog( + context: context, + child: ConfirmSendEmailDialog( + email: projectViewModel.user.emailAddress, + onTapSendEmail: () { + model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully); + }, ), - ) - : Container( - height: 0, - ), + ); + }, + )) + ])), ), ); } - - convertDateFormat(String Date) { - const start = "/Date("; - const end = "+0300)"; - - final startIndex = Date.indexOf(start); - final endIndex = Date.indexOf(end, startIndex + start.length); - - var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(Date.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0'); - - return newDate.toString(); - } } diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index bcab455b..8ddca1b2 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -21,11 +21,13 @@ class DoctorCard extends StatelessWidget { final Function onTap; final Function onEmailTap; final bool isInOutPatient; + final bool isShowInOutPatient; final bool isLiveCareAppointment; final bool isSortByClinic; final String appointmentTime; final bool isParentAppointment; final int remainingTimeInMinutes; + final String vaccineName; DoctorCard( {this.name, @@ -41,6 +43,8 @@ class DoctorCard extends StatelessWidget { this.isLiveCareAppointment = false, this.appointmentTime, this.remainingTimeInMinutes, + this.isShowInOutPatient = true, + this.vaccineName = "", this.isParentAppointment = false}); ProjectViewModel projectViewModel; @@ -54,10 +58,7 @@ class DoctorCard extends StatelessWidget { borderRadius: BorderRadius.all( Radius.circular(10.0), ), - border: Border.all( - width: 1, - color: Color(0xffEFEFEF) - ), + border: Border.all(width: 1, color: Color(0xffEFEFEF)), boxShadow: [ BoxShadow( color: Color(0xff000000).withOpacity(.05), @@ -77,21 +78,23 @@ class DoctorCard extends StatelessWidget { height: double.infinity, alignment: Alignment.center, padding: EdgeInsets.only(left: 2, right: 2), - decoration: BoxDecoration( - //Colors.red[900] Color(0xff404545) - color: isLiveCareAppointment - ? Color(0xff2E303A) - : !isInOutPatient - ? Color(0xffD02127) - : Color(0xffa9a089), - borderRadius: BorderRadius.only( - topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), - bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), - topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), - bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), - ), - ), - child: RotatedBox( + decoration: isShowInOutPatient + ? BoxDecoration( + //Colors.red[900] Color(0xff404545) + color: isLiveCareAppointment + ? Color(0xff2E303A) + : !isInOutPatient + ? Color(0xffD02127) + : Color(0xffa9a089), + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), + bottomLeft: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10), + topRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), + bottomRight: projectViewModel.isArabic ? Radius.circular(10) : Radius.circular(0), + ), + ) + : BoxDecoration(), + child: isShowInOutPatient ? RotatedBox( quarterTurns: 3, child: Text( isLiveCareAppointment @@ -101,7 +104,7 @@ class DoctorCard extends StatelessWidget { : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach, style: TextStyle(fontSize: 10, fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), ), - ), + ) : Container(), ), Expanded( child: Padding( @@ -162,7 +165,8 @@ class DoctorCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if (rating == null) myRichText(TranslationBase.of(context).invoiceNo, billNo ?? "", projectViewModel.isArabic), + if (rating == null && billNo != "") myRichText(TranslationBase.of(context).invoiceNo, billNo ?? "", projectViewModel.isArabic), + if (vaccineName != "") myRichText("", vaccineName ?? "", projectViewModel.isArabic), if (rating != null) Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,