|
|
|
|
@ -4,6 +4,8 @@ import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/api_consts.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_assets.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/app_state.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
@ -31,6 +33,7 @@ import 'package:hmg_patient_app_new/presentation/prescriptions/prescription_deta
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
|
|
|
|
@ -132,10 +135,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
|
},
|
|
|
|
|
onCancelTap: () async {
|
|
|
|
|
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
|
|
|
|
|
var isEventAddedOrRemoved = await CalenderUtilsNew.instance.checkAndRemove( id:"${widget.patientAppointmentHistoryResponseModel.appointmentNo}", );
|
|
|
|
|
setState(() {
|
|
|
|
|
myAppointmentsViewModel.setAppointmentReminder(isEventAddedOrRemoved, widget.patientAppointmentHistoryResponseModel);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
LoaderBottomSheet.showLoader(loadingText: "Cancelling Appointment, Please Wait...".needTranslation);
|
|
|
|
|
await myAppointmentsViewModel.cancelAppointment(
|
|
|
|
|
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
|
|
|
|
|
@ -155,6 +155,11 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var isEventAddedOrRemoved = await CalenderUtilsNew.instance.checkAndRemove( id:"${widget.patientAppointmentHistoryResponseModel.appointmentNo}", );
|
|
|
|
|
setState(() {
|
|
|
|
|
myAppointmentsViewModel.setAppointmentReminder(isEventAddedOrRemoved, widget.patientAppointmentHistoryResponseModel);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onRescheduleTap: () async {
|
|
|
|
|
openDoctorScheduleCalendar();
|
|
|
|
|
@ -164,90 +169,105 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
|
|
|
|
|
!AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: 20.r,
|
|
|
|
|
hasShadow: false,
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Appointment Status".needTranslation.toText16(isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 4.h),
|
|
|
|
|
(!AppointmentType.isConfirmed(widget.patientAppointmentHistoryResponseModel)
|
|
|
|
|
? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500)
|
|
|
|
|
: "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
//TODO Add countdown timer in case of LiveCare Appointment
|
|
|
|
|
widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false
|
|
|
|
|
? Row(
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 40.h, height: 40.h),
|
|
|
|
|
SizedBox(width: 12.w),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"The doctor will call you once the appointment time approaches."
|
|
|
|
|
.needTranslation
|
|
|
|
|
.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500),
|
|
|
|
|
],
|
|
|
|
|
Consumer<BookAppointmentsViewModel>(builder: (context, bookAppointmentsVM, child) {
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor,
|
|
|
|
|
borderRadius: 20.r,
|
|
|
|
|
hasShadow: false,
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
"Appointment Status".needTranslation.toText16(isBold: true),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 4.h),
|
|
|
|
|
(!AppointmentType.isConfirmed(widget.patientAppointmentHistoryResponseModel)
|
|
|
|
|
? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500)
|
|
|
|
|
: "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
//TODO Add countdown timer in case of LiveCare Appointment
|
|
|
|
|
widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false
|
|
|
|
|
? Row(
|
|
|
|
|
children: [
|
|
|
|
|
Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 40.h, height: 40.h),
|
|
|
|
|
SizedBox(width: 12.w),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"The doctor will call you once the appointment time approaches."
|
|
|
|
|
.needTranslation
|
|
|
|
|
.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
ClipRRect(
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
borderRadius: BorderRadius.circular(24.r),
|
|
|
|
|
// Todo: what is this???? Api Key??? 😲
|
|
|
|
|
child: Image.network(
|
|
|
|
|
"https://maps.googleapis.com/maps/api/staticmap?center=${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&zoom=14&size=350x165&maptype=roadmap&markers=color:red%7C${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&key=${ApiKeyConstants.googleMapsApiKey}",
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
ClipRRect(
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
borderRadius: BorderRadius.circular(24.r),
|
|
|
|
|
// Todo: what is this???? Api Key??? 😲
|
|
|
|
|
child: Image.network(
|
|
|
|
|
"https://maps.googleapis.com/maps/api/staticmap?center=${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&zoom=14&size=350x165&maptype=roadmap&markers=color:red%7C${widget.patientAppointmentHistoryResponseModel.latitude},${widget.patientAppointmentHistoryResponseModel.longitude}&key=${ApiKeyConstants.googleMapsApiKey}",
|
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Positioned(
|
|
|
|
|
bottom: 0,
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.785,
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: "Get Directions".needTranslation,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
MapsLauncher.launchCoordinates(
|
|
|
|
|
double.parse(widget.patientAppointmentHistoryResponseModel.latitude!),
|
|
|
|
|
double.parse(widget.patientAppointmentHistoryResponseModel.longitude!),
|
|
|
|
|
widget.patientAppointmentHistoryResponseModel.projectName);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.textColor.withValues(alpha: 0.8),
|
|
|
|
|
borderColor: AppointmentType.getNextActionButtonColor(
|
|
|
|
|
widget.patientAppointmentHistoryResponseModel.nextAction)
|
|
|
|
|
.withValues(alpha: 0.01),
|
|
|
|
|
textColor: AppColors.whiteColor,
|
|
|
|
|
fontSize: 14.f,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
|
|
|
|
height: 40.h,
|
|
|
|
|
icon: AppAssets.directions_icon,
|
|
|
|
|
iconColor: AppColors.whiteColor,
|
|
|
|
|
iconSize: 14.h,
|
|
|
|
|
).paddingAll(12.h),
|
|
|
|
|
Positioned(
|
|
|
|
|
bottom: 0,
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.785,
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: "Get Directions".needTranslation,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
MapsLauncher.launchCoordinates(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!),
|
|
|
|
|
double.parse(widget.patientAppointmentHistoryResponseModel.longitude!), widget.patientAppointmentHistoryResponseModel.projectName);
|
|
|
|
|
},
|
|
|
|
|
backgroundColor: AppColors.textColor.withValues(alpha: 0.8),
|
|
|
|
|
borderColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withValues(alpha: 0.01),
|
|
|
|
|
textColor: AppColors.whiteColor,
|
|
|
|
|
fontSize: 14.f,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
borderRadius: 12.r,
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w),
|
|
|
|
|
height: 40.h,
|
|
|
|
|
icon: AppAssets.directions_icon,
|
|
|
|
|
iconColor: AppColors.whiteColor,
|
|
|
|
|
iconSize: 14.h,
|
|
|
|
|
).paddingAll(12.h),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
|
Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
spacing: 8.w,
|
|
|
|
|
runSpacing: 8.h,
|
|
|
|
|
children: [
|
|
|
|
|
AppCustomChipWidget(
|
|
|
|
|
labelText: bookAppointmentsVM.isAppointmentNearestGateLoading
|
|
|
|
|
? "Floor: Ground Floor"
|
|
|
|
|
: "Floor: ${getIt.get<AppState>().isArabic() ? bookAppointmentsViewModel.appointmentNearestGateResponseModel!.clinicLocationN : bookAppointmentsViewModel.appointmentNearestGateResponseModel!.clinicLocation}",
|
|
|
|
|
).toShimmer2(isShow: bookAppointmentsVM.isAppointmentNearestGateLoading),
|
|
|
|
|
AppCustomChipWidget(
|
|
|
|
|
labelText:
|
|
|
|
|
"Nearest Gate: ${getIt.get<AppState>().isArabic() ? bookAppointmentsVM.appointmentNearestGateResponseModel!.nearestGateNumberN : bookAppointmentsVM.appointmentNearestGateResponseModel!.nearestGateNumber}")
|
|
|
|
|
.toShimmer2(isShow: bookAppointmentsVM.isAppointmentNearestGateLoading),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
|