Merge branch 'master' into Main_App_Replacement

# Conflicts:
#	lib/core/api_consts.dart
Main_App_Replacement
Haroon Amjad 3 weeks ago
commit 5c33097635

@ -211,7 +211,7 @@ class ApiClientImp implements ApiClient {
}
// body['TokenID'] = "@dm!n";
// body['PatientID'] = 226077;
// body['PatientID'] = 5422188;
// body['PatientID'] = 53320;
// body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0;

@ -865,7 +865,8 @@ var GET_CUSTOMER_INFO = "VerifyCustomer";
//Pharmacy
var GET_PHARMACY_CATEGORISE = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
var GET_PHARMACY_CATEGORISE =
'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=0';
var GET_OFFERS_CATEGORISE = 'discountcategories';
var GET_OFFERS_PRODUCTS = 'offerproducts/';
var GET_CATEGORISE_PARENT = 'categories?fields=id,name,namen,description,image,localized_names,display_order,parent_category_id,is_leaf&parent_id=';

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
@ -842,67 +843,73 @@ class BookAppointmentsViewModel extends ChangeNotifier {
}
Future<void> getDoctorFreeSlots({bool isBookingForLiveCare = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
docFreeSlots.clear();
DateTime date;
final DateFormat formatter = DateFormat('HH:mm', "en-US");
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
Map<DateTime, List> _eventsParsed;
final result = await bookAppointmentsRepo.getDoctorFreeSlots(
selectedDoctor.clinicID ?? 0,
selectedDoctor.projectID ?? 0,
selectedDoctor.doctorID ?? 0,
isBookingForLiveCare,
continueDentalPlan: isContinueDentalPlan,
onError: onError,
);
result.fold(
(failure) async {
print(failure);
if (onError != null) {
onError(failure.message);
}
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage ?? "Unknown error occurred");
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['FreeTimeSlots'] == null || apiResponse.data['FreeTimeSlots'].isEmpty) {
onError!("No free slots available".tr());
return;
// try {
docFreeSlots.clear();
DateTime date;
final DateFormat formatter = DateFormat('HH:mm', "en-US");
// final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
// Map<DateTime, List> _eventsParsed;
final result = await bookAppointmentsRepo.getDoctorFreeSlots(
selectedDoctor.clinicID ?? 0,
selectedDoctor.projectID ?? 0,
selectedDoctor.doctorID ?? 0,
isBookingForLiveCare,
continueDentalPlan: isContinueDentalPlan,
onError: onError,
);
result.fold(
(failure) async {
print(failure);
if (onError != null) {
onError(failure.message);
}
initialSlotDuration = apiResponse.data["InitialSlotDuration"];
freeSlotsResponse = apiResponse.data['FreeTimeSlots'];
isWaitingAppointmentAvailable = apiResponse.data["IsAllowToBookWaitingAppointment"];
// isWaitingAppointmentAvailable = true;
freeSlotsResponse.forEach((element) {
// date = (isLiveCareSchedule != null && isLiveCareSchedule)
// ? DateUtil.convertStringToDate(element)
// :
date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
slotsList.add(FreeSlot(date, ['slot']));
docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
});
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {
onError!(apiResponse.errorMessage ?? "Unknown error occurred");
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['FreeTimeSlots'] == null || apiResponse.data['FreeTimeSlots'].isEmpty) {
onError!("No free slots available".tr());
return;
}
initialSlotDuration = apiResponse.data["InitialSlotDuration"];
freeSlotsResponse = apiResponse.data['FreeTimeSlots'];
isWaitingAppointmentAvailable = apiResponse.data["IsAllowToBookWaitingAppointment"];
// isWaitingAppointmentAvailable = true;
freeSlotsResponse.forEach((element) {
// date = (isLiveCareSchedule != null && isLiveCareSchedule)
// ? DateUtil.convertStringToDate(element)
// :
date = DateUtil.convertStringToDateSaudiTimezone(element, int.parse(selectedDoctor.projectID.toString()));
slotsList.add(FreeSlot(date, ['slot']));
docFreeSlots.add(TimeSlot(isoTime: formatter.format(date), start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), end: date, vidaDate: element));
});
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
}
},
);
},
);
// } catch(ex) {
// if (onError != null) {
// onError(ex.toString());
// }
// }
}
Future<void> getLiveCareDoctorFreeSlots({bool isBookingForLiveCare = false, Function(dynamic)? onSuccess, Function(String)? onError}) async {
docFreeSlots.clear();
DateTime date;
final DateFormat formatter = DateFormat('HH:mm', "en-US");
final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
Map<DateTime, List> _eventsParsed;
// final DateFormat dateFormatter = DateFormat('yyyy-MM-dd');
// Map<DateTime, List> _eventsParsed;
final result = await bookAppointmentsRepo.getLiveCareDoctorFreeSlots(
selectedDoctor.clinicID ?? 0, selectedLiveCareClinic.serviceID ?? 0, selectedDoctor.projectID ?? 0, selectedDoctor.doctorID ?? 0, isBookingForLiveCare,

@ -135,7 +135,9 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
result.fold(
(failure) async {
onError!(failure.message);
if(onError != null) {
onError(failure.message);
}
},
(apiResponse) {
if (apiResponse.messageStatus == 2) {

@ -117,6 +117,8 @@ Future<void> callInitializations() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
Intl.defaultLocale = "en_US";
SafeDevice.init(
SafeDeviceConfig(mockLocationCheckEnabled: false), // disables mock location check on Android
);

@ -523,6 +523,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
],
).onPress(() {
bookAppointmentsViewModel.setIsDoctorSearchByNameStarted(false);
bookAppointmentsViewModel.setIsLiveCareSchedule(false);
bookAppointmentsViewModel.setProjectID(null);
Navigator.of(context).push(
CustomPageRoute(
@ -554,6 +555,7 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
).onPress(() {
Clarity.sendCustomEvent('Select_Region_Page');
bookAppointmentsViewModel.setProjectID(null);
bookAppointmentsViewModel.setIsLiveCareSchedule(false);
openRegionListBottomSheet(context, RegionBottomSheetType.FOR_REGION);
}),
],

@ -218,7 +218,7 @@ class _SearchDoctorByNameState extends State<SearchDoctorByName> {
bookAppointmentsViewModel: bookAppointmentsViewModel,
isDoctorNameSearch: true,
).paddingSymmetrical(16.h, 0.h).onPress(() async {
if (bookAppointmentsVM.filteredDoctorList[index].clinicID == 17 && getIt.get<AppState>().getAuthenticatedUser()!.age! < 12) {
if (getIt.get<AppState>().isAuthenticated && bookAppointmentsVM.filteredDoctorList[index].clinicID == 17 && getIt.get<AppState>().getAuthenticatedUser()!.age! < 12) {
bookAppointmentsViewModel.setProjectID(bookAppointmentsVM.filteredDoctorList[index].projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(GetClinicsListResponseModel(
clinicID: bookAppointmentsVM.filteredDoctorList[index].clinicID,

@ -186,7 +186,7 @@ class DoctorCard extends StatelessWidget {
if (isDoctorNameSearch && doctorsListResponseModel.clinicID == 17) {
GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel(
clinicID: doctorsListResponseModel.clinicID, clinicDescription: doctorsListResponseModel.clinicName, isLiveCareClinicAndOnline: false, liveCareServiceID: 0, liveCareClinicID: 0);
if (getIt.get<AppState>().getAuthenticatedUser()!.age! > 12) {
if (getIt.get<AppState>().isAuthenticated && getIt.get<AppState>().getAuthenticatedUser()!.age! > 12) {
bookAppointmentsViewModel.setProjectID(doctorsListResponseModel.projectID.toString());
bookAppointmentsViewModel.setSelectedClinic(selectedClinic);
bookAppointmentsViewModel.setIsChiefComplaintsListLoading(true);

@ -116,8 +116,8 @@ class _SplashScreenState extends State<SplashPage> {
logLevel: LogLevel.Error, // Optional: Set the log level (Verbose, Debug, Info, Warning, Error, None)
);
Clarity.initialize(context, config);
Clarity.initialize(getIt.get<NavigationService>().navigatorKey.currentContext!, config);
// Set initial app context tags
try {
final appState = getIt.get<AppState>();

Loading…
Cancel
Save