CR-19328-LiveCare-Enhancements
haroon amjad 1 month ago
parent ca71ff08e3
commit 0d9d39bf9a

@ -33,7 +33,7 @@ abstract class ImmediateLiveCareRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> addInsuranceUpdateRequestForLiveCare(String name, String mobileNumber, String fileNumber,
{Function(dynamic)? onSuccess, Function(String)? onError});
Future<Either<Failure, GenericApiModel<dynamic>>> rescheduleLiveCareCallRequest(int callID, int serviceID, String consultationTime, bool isRescheduledForOneHourLater,
Future<Either<Failure, GenericApiModel<dynamic>>> rescheduleLiveCareCallRequest(int callID, int serviceID, int selectedRescheduleType, bool isRescheduledForOneHourLater,
{Function(dynamic)? onSuccess, Function(String)? onError});
}
@ -301,13 +301,13 @@ class ImmediateLiveCareRepoImp implements ImmediateLiveCareRepo {
}
@override
Future<Either<Failure, GenericApiModel>> rescheduleLiveCareCallRequest(int callID, int serviceID, String consultationTime, bool isRescheduledForOneHourLater,
Future<Either<Failure, GenericApiModel>> rescheduleLiveCareCallRequest(int callID, int serviceID, int selectedRescheduleType, bool isRescheduledForOneHourLater,
{Function(dynamic p1)? onSuccess, Function(String p1)? onError}) async {
Map<String, dynamic> mapDevice = {
"VCID": callID,
"UserID": getIt.get<AppState>().getAuthenticatedUser()!.patientId,
"ServiceID": serviceID,
"consultationTime": consultationTime,
"ArrangeCallDuration": selectedRescheduleType,
"Notes": isRescheduledForOneHourLater ? "Rescheduled by user for 1 hour later" : "Rescheduled by user for 30 mins later",
"ProjectID": getIt.get<AppState>().getAuthenticatedUser()!.outSa! == 0
? ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat

@ -63,6 +63,8 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
bool isTermsAccepted = false;
int selectedRescheduleTime = 0; //1 => 30 mins, 2 => 60 mins
initImmediateLiveCare() {
_appState = getIt<AppState>();
immediateLiveCareClinicsList = [];
@ -97,6 +99,11 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
notifyListeners();
}
setSelectedRescheduleTime(int selectedTime) {
selectedRescheduleTime = selectedTime;
notifyListeners();
}
Future<void> getLiveCareImmediateClinicsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
immediateLiveCareClinicsList.clear();
isImmediateLiveCareClinicsLoading = true;
@ -368,7 +375,7 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
Future<void> rescheduleLiveCareCallRequest(
{int? callID, int? serviceID, String? consultationTime, bool? isRescheduledForOneHourLater, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await immediateLiveCareRepo.rescheduleLiveCareCallRequest(callID!, serviceID!, consultationTime!, isRescheduledForOneHourLater!);
final result = await immediateLiveCareRepo.rescheduleLiveCareCallRequest(callID!, serviceID!, selectedRescheduleTime, isRescheduledForOneHourLater!);
result.fold(
// (failure) async => await errorHandlerService.handleError(failure: failure),

@ -204,21 +204,24 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
CustomButton(
text: LocaleKeys.cantWaitLiveCare.tr(context: context),
onPressed: () {
showCommonBottomSheetWithoutHeight(context, child: LiveCareRescheduleWidget(), callBackFunc: (val) async {
if (val != null) {
showCommonBottomSheetWithoutHeight(context,
child: LiveCareRescheduleWidget(
immediateLiveCareViewModel: immediateLiveCareVM,
), callBackFunc: () async {
if (immediateLiveCareVM.selectedRescheduleTime != 0) {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.reschedulingAppo.tr(context: context));
String rescheduleDateTime = "";
if (val == "30") {
if (immediateLiveCareVM.selectedRescheduleTime == 1) {
rescheduleDateTime = DateUtil.convertDateToString(DateTime.now().add(Duration(minutes: 30)));
}
if (val == "60") {
if (immediateLiveCareVM.selectedRescheduleTime == 2) {
rescheduleDateTime = DateUtil.convertDateToString(DateTime.now().add(Duration(minutes: 60)));
}
immediateLiveCareVM.rescheduleLiveCareCallRequest(
callID: immediateLiveCareViewModel.patientLiveCareHistoryList.first.vCID,
serviceID: immediateLiveCareViewModel.patientLiveCareHistoryList.first.serviceID,
consultationTime: rescheduleDateTime,
isRescheduledForOneHourLater: val == "30" ? false : true,
isRescheduledForOneHourLater: immediateLiveCareVM.selectedRescheduleTime == 1 ? false : true,
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
},

@ -6,15 +6,17 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
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/features/immediate_livecare/immediate_livecare_view_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import '../../../../core/dependencies.dart';
import '../../../../generated/locale_keys.g.dart';
class LiveCareRescheduleWidget extends StatelessWidget {
LiveCareRescheduleWidget({super.key});
LiveCareRescheduleWidget({super.key, required this.immediateLiveCareViewModel});
late AppState appState;
ImmediateLiveCareViewModel immediateLiveCareViewModel;
@override
Widget build(BuildContext context) {
@ -27,7 +29,8 @@ class LiveCareRescheduleWidget extends StatelessWidget {
LocaleKeys.after30MinsDesc.tr(context: context),
// "Call for immediate assistance",
).onPress(() {
Navigator.of(context).pop("30");
immediateLiveCareViewModel.setSelectedRescheduleTime(1);
Navigator.of(context).pop();
}),
SizedBox(height: 16.h),
checkInOptionCard(
@ -35,7 +38,8 @@ class LiveCareRescheduleWidget extends StatelessWidget {
LocaleKeys.after1Hour.tr(context: context),
LocaleKeys.after1HourDesc.tr(context: context),
).onPress(() async {
Navigator.of(context).pop("60");
immediateLiveCareViewModel.setSelectedRescheduleTime(2);
Navigator.of(context).pop();
}),
SizedBox(height: 16.h),
],

@ -339,7 +339,7 @@ void showCommonBottomSheetWithoutHeight(
},
).then((value) {
if (callBackFunc != null) {
callBackFunc(value);
callBackFunc();
}
});
}

Loading…
Cancel
Save