|
|
|
@ -14,8 +14,10 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/book_appointments/models/timeslots.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/book_appointments/models/timeslots.dart';
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/book_appointment/dental_chief_complaints_page.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/book_appointment/review_appointment_page.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/book_appointment/review_appointment_page.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
|
|
|
|
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
|
|
|
|
@ -95,63 +97,116 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.45,
|
|
|
|
height: MediaQuery.of(context).size.height * 0.45,
|
|
|
|
child: Directionality(
|
|
|
|
child: Stack(
|
|
|
|
textDirection: isArabic ? ui.TextDirection.rtl : ui.TextDirection.ltr,
|
|
|
|
children: [
|
|
|
|
child: Localizations.override(
|
|
|
|
Directionality(
|
|
|
|
context: context,
|
|
|
|
textDirection: isArabic ? ui.TextDirection.rtl : ui.TextDirection.ltr,
|
|
|
|
locale: isArabic ? const Locale('ar', 'SA') : const Locale('en'),
|
|
|
|
child: Localizations.override(
|
|
|
|
child: ClarityUnmask(
|
|
|
|
context: context,
|
|
|
|
child: SfCalendar(
|
|
|
|
locale: isArabic ? const Locale('ar', 'SA') : const Locale('en'),
|
|
|
|
controller: _calendarController,
|
|
|
|
child: ClarityUnmask(
|
|
|
|
minDate: DateTime.now(),
|
|
|
|
child: SfCalendar(
|
|
|
|
showNavigationArrow: true,
|
|
|
|
controller: _calendarController,
|
|
|
|
// headerHeight: 60.h,
|
|
|
|
minDate: DateTime.now(),
|
|
|
|
headerStyle: CalendarHeaderStyle(
|
|
|
|
initialDisplayDate: DateUtil.convertStringToDate(bookAppointmentsViewModel.freeSlotsResponse[0]),
|
|
|
|
backgroundColor: AppColors.transparent,
|
|
|
|
showNavigationArrow: false,
|
|
|
|
textAlign: isArabic ? TextAlign.end : TextAlign.start,
|
|
|
|
headerHeight: 60.h,
|
|
|
|
textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor),
|
|
|
|
headerStyle: CalendarHeaderStyle(
|
|
|
|
),
|
|
|
|
backgroundColor: AppColors.transparent,
|
|
|
|
viewHeaderStyle: ViewHeaderStyle(
|
|
|
|
// textAlign: isArabic ? TextAlign.end : TextAlign.start,
|
|
|
|
// backgroundColor: AppColors.scaffoldBgColor,
|
|
|
|
textStyle: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.primaryRedColor),
|
|
|
|
dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
viewHeaderStyle: ViewHeaderStyle(
|
|
|
|
view: CalendarView.month,
|
|
|
|
// backgroundColor: AppColors.scaffoldBgColor,
|
|
|
|
todayHighlightColor: Colors.transparent,
|
|
|
|
dayTextStyle: TextStyle(fontSize: 14.f, fontWeight: FontWeight.w600, letterSpacing: -0.46, color: AppColors.textColor),
|
|
|
|
todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
selectionDecoration: ShapeDecoration(
|
|
|
|
view: CalendarView.month,
|
|
|
|
color: AppColors.transparent,
|
|
|
|
todayHighlightColor: Colors.transparent,
|
|
|
|
shape: SmoothRectangleBorder(
|
|
|
|
todayTextStyle: TextStyle(color: AppColors.textColor, fontWeight: FontWeight.bold),
|
|
|
|
borderRadius: BorderRadius.circular(10.r),
|
|
|
|
selectionDecoration: ShapeDecoration(
|
|
|
|
smoothness: 1,
|
|
|
|
color: AppColors.transparent,
|
|
|
|
side: BorderSide(color: AppColors.primaryRedColor, width: 1.5),
|
|
|
|
shape: SmoothRectangleBorder(
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10.r),
|
|
|
|
|
|
|
|
smoothness: 1,
|
|
|
|
|
|
|
|
side: BorderSide(color: AppColors.primaryRedColor, width: 1.5),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
cellBorderColor: AppColors.transparent,
|
|
|
|
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
|
|
|
|
monthCellBuilder: (context, details) => Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(12.h),
|
|
|
|
|
|
|
|
child: details.date.day.toString().toText14(
|
|
|
|
|
|
|
|
isCenter: true,
|
|
|
|
|
|
|
|
color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor,
|
|
|
|
|
|
|
|
isEnglishOnly: true,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
monthViewSettings: MonthViewSettings(
|
|
|
|
|
|
|
|
dayFormat: "EEE",
|
|
|
|
|
|
|
|
appointmentDisplayMode: MonthAppointmentDisplayMode.indicator,
|
|
|
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
|
|
|
appointmentDisplayCount: 1,
|
|
|
|
|
|
|
|
monthCellStyle: MonthCellStyle(
|
|
|
|
|
|
|
|
textStyle: TextStyle(fontSize: 19.f),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: (CalendarTapDetails details) {
|
|
|
|
|
|
|
|
_calendarController.selectedDate = details.date;
|
|
|
|
|
|
|
|
_onDaySelected(details.date!);
|
|
|
|
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
cellBorderColor: AppColors.transparent,
|
|
|
|
),
|
|
|
|
dataSource: MeetingDataSource(_getDataSource()),
|
|
|
|
),
|
|
|
|
monthCellBuilder: (context, details) => Padding(
|
|
|
|
// Custom Navigation Arrows
|
|
|
|
padding: EdgeInsets.all(12.h),
|
|
|
|
Positioned(
|
|
|
|
child: details.date.day.toString().toText14(
|
|
|
|
top: 0,
|
|
|
|
isCenter: true,
|
|
|
|
right: isArabic ? null : 0,
|
|
|
|
color: details.date == _calendarController.selectedDate ? AppColors.primaryRedColor : AppColors.textColor,
|
|
|
|
left: isArabic ? 0 : null,
|
|
|
|
isEnglishOnly: true,
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
|
|
height: 60.h,
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
// Previous Month Arrow
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
_calendarController.backward!();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(8.h),
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
// isArabic ? Icons.arrow_forward_ios : Icons.arrow_back_ios,
|
|
|
|
|
|
|
|
Icons.arrow_back_ios,
|
|
|
|
|
|
|
|
size: 24.h,
|
|
|
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
// Next Month Arrow
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
_calendarController.forward!();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.all(8.h),
|
|
|
|
|
|
|
|
child: Icon(
|
|
|
|
|
|
|
|
// isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios,
|
|
|
|
|
|
|
|
Icons.arrow_forward_ios,
|
|
|
|
|
|
|
|
size: 24.h,
|
|
|
|
|
|
|
|
color: AppColors.primaryRedColor,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
monthViewSettings: MonthViewSettings(
|
|
|
|
|
|
|
|
dayFormat: "EEE",
|
|
|
|
|
|
|
|
appointmentDisplayMode: MonthAppointmentDisplayMode.indicator,
|
|
|
|
|
|
|
|
showTrailingAndLeadingDates: false,
|
|
|
|
|
|
|
|
appointmentDisplayCount: 1,
|
|
|
|
|
|
|
|
monthCellStyle: MonthCellStyle(
|
|
|
|
|
|
|
|
textStyle: TextStyle(fontSize: 19.f),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onTap: (CalendarTapDetails details) {
|
|
|
|
|
|
|
|
_calendarController.selectedDate = details.date;
|
|
|
|
|
|
|
|
_onDaySelected(details.date!);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height: 10.h),
|
|
|
|
SizedBox(height: 10.h),
|
|
|
|
@ -164,7 +219,7 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
? ClarityUnmask(
|
|
|
|
? ClarityUnmask(
|
|
|
|
child: ConstrainedBox(
|
|
|
|
child: ConstrainedBox(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
maxHeight: MediaQuery.of(context).size.height * 0.15,
|
|
|
|
maxHeight: MediaQuery.of(context).size.height * 0.25,
|
|
|
|
minHeight: 0,
|
|
|
|
minHeight: 0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Directionality(
|
|
|
|
child: Directionality(
|
|
|
|
@ -213,15 +268,31 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
bookAppointmentsViewModel.getAppointmentNearestGate(
|
|
|
|
if (bookAppointmentsViewModel.selectedClinic.clinicID! == 17 && bookAppointmentsViewModel.selectedChiefComplaintID == 0) {
|
|
|
|
projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!);
|
|
|
|
GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel(
|
|
|
|
bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime, selectedDateDisplay);
|
|
|
|
clinicID: bookAppointmentsViewModel.selectedClinic.clinicID,
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
clinicDescription: bookAppointmentsViewModel.selectedClinic.clinicDescription,
|
|
|
|
Navigator.of(context).push(
|
|
|
|
isLiveCareClinicAndOnline: false,
|
|
|
|
CustomPageRoute(
|
|
|
|
liveCareServiceID: 0,
|
|
|
|
page: ReviewAppointmentPage(),
|
|
|
|
liveCareClinicID: 0);
|
|
|
|
),
|
|
|
|
bookAppointmentsViewModel.setProjectID(bookAppointmentsViewModel.selectedDoctor.projectID.toString());
|
|
|
|
);
|
|
|
|
bookAppointmentsViewModel.setSelectedClinic(selectedClinic);
|
|
|
|
|
|
|
|
bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true);
|
|
|
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
|
|
|
page: DentalChiefComplaintsPage(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
bookAppointmentsViewModel.getAppointmentNearestGate(projectID: bookAppointmentsViewModel.selectedDoctor.projectID!, clinicID: bookAppointmentsViewModel.selectedDoctor.clinicID!);
|
|
|
|
|
|
|
|
bookAppointmentsViewModel.setSelectedAppointmentDateTime(selectedDate, selectedTime, selectedDateDisplay);
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
|
|
|
CustomPageRoute(
|
|
|
|
|
|
|
|
page: ReviewAppointmentPage(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
@ -231,8 +302,7 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Lottie.asset(AppAnimations.errorAnimation,
|
|
|
|
Lottie.asset(AppAnimations.errorAnimation, repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
|
|
|
|
repeat: true, reverse: false, frameRate: FrameRate(60), width: 100.h, height: 100.h, fit: BoxFit.fill),
|
|
|
|
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
SizedBox(height: 8.h),
|
|
|
|
(LocaleKeys.loginToUseService.tr(context: context)).toText16(color: AppColors.blackColor),
|
|
|
|
(LocaleKeys.loginToUseService.tr(context: context)).toText16(color: AppColors.blackColor),
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
@ -331,12 +401,7 @@ class _AppointmentCalendarState extends State<AppointmentCalendar> {
|
|
|
|
selectedButtonIndex = 0;
|
|
|
|
selectedButtonIndex = 0;
|
|
|
|
List<Map<String, dynamic>> timeList = [];
|
|
|
|
List<Map<String, dynamic>> timeList = [];
|
|
|
|
for (var i = 0; i < dayEvents.length; i++) {
|
|
|
|
for (var i = 0; i < dayEvents.length; i++) {
|
|
|
|
Map<String, dynamic> timeSlot = {
|
|
|
|
Map<String, dynamic> timeSlot = {"isoTime": dayEvents[i].isoTime, "start": dayEvents[i].start.toString(), "end": dayEvents[i].end.toString(), "vidaDate": dayEvents[i].vidaDate};
|
|
|
|
"isoTime": dayEvents[i].isoTime,
|
|
|
|
|
|
|
|
"start": dayEvents[i].start.toString(),
|
|
|
|
|
|
|
|
"end": dayEvents[i].end.toString(),
|
|
|
|
|
|
|
|
"vidaDate": dayEvents[i].vidaDate
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
timeList.add(timeSlot);
|
|
|
|
timeList.add(timeSlot);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dayEvents.isNotEmpty) {
|
|
|
|
if (dayEvents.isNotEmpty) {
|
|
|
|
|