Nearest Appointment selected

pull/130/head
haroon amjad 4 months ago
parent 3044b901c2
commit 87fd9a42b7

@ -700,7 +700,7 @@ var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatb
class ApiConsts { class ApiConsts {
static const maxSmallScreen = 660; static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -49,6 +49,8 @@ class BookAppointmentsViewModel extends ChangeNotifier {
int initialSlotDuration = 0; int initialSlotDuration = 0;
bool isNearestAppointmentSelected = false;
LocationUtils locationUtils; LocationUtils locationUtils;
List<GetClinicsListResponseModel> clinicsList = []; List<GetClinicsListResponseModel> clinicsList = [];
@ -187,6 +189,18 @@ class BookAppointmentsViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
setIsNearestAppointmentSelected(bool isNearestAppointmentSelected) {
this.isNearestAppointmentSelected = isNearestAppointmentSelected;
if (isNearestAppointmentSelected) {
doctorsList.sort((a, b) => DateUtil.convertStringToDate(a.nearestFreeSlot!).compareTo(DateUtil.convertStringToDate(b.nearestFreeSlot!)));
} else {
doctorsList.sort((a, b) => b.decimalDoctorRate!.compareTo(a.decimalDoctorRate!));
}
notifyListeners();
}
setIsWaitingAppointmentSelected(bool isWaitingAppointmentSelected) { setIsWaitingAppointmentSelected(bool isWaitingAppointmentSelected) {
this.isWaitingAppointmentSelected = isWaitingAppointmentSelected; this.isWaitingAppointmentSelected = isWaitingAppointmentSelected;
notifyListeners(); notifyListeners();
@ -391,6 +405,7 @@ class BookAppointmentsViewModel extends ChangeNotifier {
doctorsList = apiResponse.data!; doctorsList = apiResponse.data!;
filteredDoctorList = doctorsList; filteredDoctorList = doctorsList;
isDoctorsListLoading = false; isDoctorsListLoading = false;
doctorsList.sort((a, b) => b.decimalDoctorRate!.compareTo(a.decimalDoctorRate!));
initializeFilteredList(); initializeFilteredList();
clearSearchFilters(); clearSearchFilters();
getFiltersFromDoctorList(); getFiltersFromDoctorList();

@ -37,7 +37,9 @@ class LocationViewModel extends ChangeNotifier {
} }
GMSMapServices.CameraPosition getGMSLocation() { GMSMapServices.CameraPosition getGMSLocation() {
return GMSMapServices.CameraPosition(target: GMSMapServices.LatLng(getIt<AppState>().userLat, getIt<AppState>().userLong), zoom: 18); return GMSMapServices.CameraPosition(
target: GMSMapServices.LatLng(getIt<AppState>().userLat != 0.0 ? getIt<AppState>().userLat : 24.7248316, getIt<AppState>().userLong != 0.0 ? getIt<AppState>().userLong : 46.4928828),
zoom: 18);
} }
void placeValueInController() async { void placeValueInController() async {

@ -41,6 +41,7 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
@override @override
void initState() { void initState() {
scheduleMicrotask(() { scheduleMicrotask(() {
bookAppointmentsViewModel.setIsNearestAppointmentSelected(false);
if (bookAppointmentsViewModel.isLiveCareSchedule) { if (bookAppointmentsViewModel.isLiveCareSchedule) {
bookAppointmentsViewModel.getLiveCareDoctorsList(); bookAppointmentsViewModel.getLiveCareDoctorsList();
} else { } else {
@ -105,8 +106,33 @@ class _SelectDoctorPageState extends State<SelectDoctorPage> {
), ),
], ],
), ),
SizedBox(height: 16.h),
Row(
mainAxisSize: MainAxisSize.max,
children: [
// Utils.buildSvgWithAssets(icon: AppAssets.prescription_reminder_icon, width: 35.h, height: 35.h),
// SizedBox(width: 8.h),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.nearestAppo.tr(context: context).toText13(isBold: true),
"View nearest available appointments".needTranslation.toText11(color: AppColors.textColorLight, weight: FontWeight.w500),
],
),
const Spacer(),
Switch(
activeThumbColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15),
value: bookAppointmentsVM.isNearestAppointmentSelected,
onChanged: (newValue) async {
bookAppointmentsVM.setIsNearestAppointmentSelected(newValue);
},
),
],
),
ListView.separated( ListView.separated(
padding: EdgeInsets.only(top: 24.h), padding: EdgeInsets.only(top: 16.h),
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemCount: bookAppointmentsVM.isDoctorsListLoading itemCount: bookAppointmentsVM.isDoctorsListLoading

@ -115,12 +115,14 @@ class DoctorCard extends StatelessWidget {
iconColor: AppColors.ratingColorYellow, iconColor: AppColors.ratingColorYellow,
labelText: "Rating: ${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate}".needTranslation, labelText: "Rating: ${isLoading ? 4.78 : doctorsListResponseModel.decimalDoctorRate}".needTranslation,
).toShimmer2(isShow: isLoading), ).toShimmer2(isShow: isLoading),
doctorsListResponseModel.nearestFreeSlot != null bookAppointmentsViewModel.isNearestAppointmentSelected
? doctorsListResponseModel.nearestFreeSlot != null
? AppCustomChipWidget( ? AppCustomChipWidget(
labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)).needTranslation, labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)).needTranslation,
backgroundColor: AppColors.successColor, backgroundColor: AppColors.successColor,
textColor: AppColors.whiteColor, textColor: AppColors.whiteColor,
).toShimmer2(isShow: isLoading) ).toShimmer2(isShow: isLoading)
: SizedBox.shrink()
: SizedBox.shrink(), : SizedBox.shrink(),
], ],
), ),

Loading…
Cancel
Save