CR-19328-LiveCare-Enhancements
haroon amjad 2 weeks ago
parent 0d9d39bf9a
commit 6699b3f0be

@ -2066,11 +2066,11 @@
"notificationPermissionText": "إذن الإشعارات",
"testLiveCareConnection": "اختبار اتصال لايف كير",
"cameraFeedInactive": "بث الكاميرا غير نشط",
"cantWaitLiveCare": "معاودة الاتصال بي, لا أستطيع الانتظار”",
"whenCallBackLiveCare": "متى تود أن نعاود الاتصال بك؟",
"after30Mins": "اتصل بي بعد 30 دقيقة",
"after30MinsDesc": "سيتصل بك الطبيب بعد 30 دقيقة.",
"after1Hour": "اتصل بي بعد ساعة",
"after1HourDesc": "سيتصل بك الطبيب بعد ساعة واحدة."
"after1HourDesc": "سيتصل بك الطبيب بعد ساعة واحدة.",
"backToHome": "العودة للصفحة الرئيسية"
}

@ -2056,13 +2056,13 @@
"notificationPermissionText": "Notifications Permission",
"testLiveCareConnection": "Test LiveCare Connection",
"cameraFeedInactive": "Camera feed inactive",
"cantWaitLiveCare": "I can't wait, Please call me later",
"whenCallBackLiveCare": "When would you like to be called back?",
"after30Mins": "After 30 Mins",
"after30MinsDesc": "You will be called by the doctor after 30 mins",
"after1Hour": "After 1 Hour",
"after1HourDesc": "You will be called by the doctor after 1 hour"
"after1HourDesc": "You will be called by the doctor after 1 hour",
"backToHome": "Back To Home"
}

@ -1023,7 +1023,7 @@ const DOWNLOAD_PHARMACY_INVOICE_PDF = 'Services/Notifications.svc/REST/DownloadI
const GET_APPOINTMENT_PARKING_QR = 'Services/outps.svc/rest/pms_getParkingTicketByAppointmentNo';
const RESCHEDULE_LIVECARE_CALL = 'Services/ER_VirtualCall.svc/ArrangeCall';
const RESCHEDULE_LIVECARE_CALL = 'Services/ER_VirtualCall.svc/REST/ArrangeCall';
class ApiKeyConstants {
static final String googleMapsApiKey = 'AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng';

@ -64,6 +64,7 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
bool isTermsAccepted = false;
int selectedRescheduleTime = 0; //1 => 30 mins, 2 => 60 mins
bool isLiveCareHistoryLoading = false;
initImmediateLiveCare() {
_appState = getIt<AppState>();
@ -104,6 +105,11 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
notifyListeners();
}
setIsLiveCareHistoryLoading(bool val) {
isLiveCareHistoryLoading = val;
notifyListeners();
}
Future<void> getLiveCareImmediateClinicsList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
immediateLiveCareClinicsList.clear();
isImmediateLiveCareClinicsLoading = true;
@ -300,14 +306,18 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
Future<void> getPatientLiveCareHistory({Function(dynamic)? onSuccess, Function(String)? onError}) async {
patientLiveCareHistoryList = [];
patientLiveCareHistoryList.clear();
patientHasPendingLiveCareRequest = false;
timer?.cancel();
isLiveCareHistoryLoading = true;
notifyListeners();
final result = await immediateLiveCareRepo.getPatientLiveCareHistory();
result.fold(
(failure) async {
isLiveCareHistoryLoading = false;
notifyListeners();
if (onError != null) {
onError(failure.message);
}
@ -337,6 +347,7 @@ class ImmediateLiveCareViewModel extends ChangeNotifier {
patientHasPendingLiveCareRequest = false;
stopTimer(); // Stop timer if no history
}
isLiveCareHistoryLoading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);

@ -2052,5 +2052,6 @@ abstract class LocaleKeys {
static const after30MinsDesc = 'after30MinsDesc';
static const after1Hour = 'after1Hour';
static const after1HourDesc = 'after1HourDesc';
static const backToHome = 'backToHome';
}

@ -34,7 +34,7 @@ class ImmediateLiveCarePendingRequestPage extends StatefulWidget {
}
class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCarePendingRequestPage> {
late ImmediateLiveCareViewModel immediateLiveCareViewModel;
// late ImmediateLiveCareViewModel immediateLiveCareViewModel;
late AppState appState;
String chatURL = "";
@ -83,7 +83,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
@override
Widget build(BuildContext context) {
immediateLiveCareViewModel = Provider.of<ImmediateLiveCareViewModel>(context, listen: false);
// immediateLiveCareViewModel = Provider.of<ImmediateLiveCareViewModel>(context, listen: false);
appState = getIt.get<AppState>();
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
@ -118,7 +118,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
Wrap(
children: [
AppCustomChipWidget(
labelText: immediateLiveCareViewModel.patientLiveCareHistoryList.isNotEmpty ? immediateLiveCareViewModel.patientLiveCareHistoryList[0].stringCallStatus : "",
labelText: immediateLiveCareVM.patientLiveCareHistoryList.isNotEmpty ? immediateLiveCareVM.patientLiveCareHistoryList[0].stringCallStatus : "",
backgroundColor: AppColors.warningColorYellow.withValues(alpha: 0.20),
textColor: AppColors.alertColor,
),
@ -127,7 +127,7 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
icon: AppAssets.appointment_calendar_icon,
labelText: DateUtil.formatDateToDate(
DateUtil.convertStringToDate(
immediateLiveCareViewModel.patientLiveCareHistoryList.isNotEmpty ? immediateLiveCareViewModel.patientLiveCareHistoryList[0].arrivalTime : ""),
immediateLiveCareVM.patientLiveCareHistoryList.isNotEmpty ? immediateLiveCareVM.patientLiveCareHistoryList[0].arrivalTime : ""),
false)),
],
),
@ -146,9 +146,11 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
SizedBox(height: 8.h),
LocaleKeys.liveCarePendingRequestText.tr(context: context).toText14(isBold: true),
SizedBox(height: 16.h),
(immediateLiveCareViewModel.patientLiveCareHistoryList.first.callType ?? "").toLowerCase() == "video"
? CustomButton(
text: LocaleKeys.testConnection.tr(context: context),
immediateLiveCareVM.isLiveCareHistoryLoading
? SizedBox.shrink()
: (immediateLiveCareVM.patientLiveCareHistoryList.first.callType ?? "").toLowerCase() == "video"
? CustomButton(
text: LocaleKeys.testConnection.tr(context: context),
onPressed: () {
showCommonBottomSheetWithoutHeight(context,
child: ZoomConnectionTestSheet(),
@ -201,15 +203,17 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
},
),
SizedBox(height: 16.h),
CustomButton(
text: LocaleKeys.cantWaitLiveCare.tr(context: context),
onPressed: () {
showCommonBottomSheetWithoutHeight(context,
child: LiveCareRescheduleWidget(
immediateLiveCareViewModel: immediateLiveCareVM,
), callBackFunc: () async {
if (immediateLiveCareVM.selectedRescheduleTime != 0) {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.reschedulingAppo.tr(context: context));
immediateLiveCareVM.patientLiveCareHistoryList.first.callStatus != 15
? CustomButton(
text: LocaleKeys.cantWaitLiveCare.tr(context: context),
onPressed: () {
immediateLiveCareVM.setSelectedRescheduleTime(0);
showCommonBottomSheetWithoutHeight(context,
child: LiveCareRescheduleWidget(
immediateLiveCareViewModel: immediateLiveCareVM,
), callBackFunc: () async {
if (immediateLiveCareVM.selectedRescheduleTime != 0) {
LoaderBottomSheet.showLoader(loadingText: LocaleKeys.reschedulingAppo.tr(context: context));
String rescheduleDateTime = "";
if (immediateLiveCareVM.selectedRescheduleTime == 1) {
rescheduleDateTime = DateUtil.convertDateToString(DateTime.now().add(Duration(minutes: 30)));
@ -218,18 +222,19 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
rescheduleDateTime = DateUtil.convertDateToString(DateTime.now().add(Duration(minutes: 60)));
}
immediateLiveCareVM.rescheduleLiveCareCallRequest(
callID: immediateLiveCareViewModel.patientLiveCareHistoryList.first.vCID,
serviceID: immediateLiveCareViewModel.patientLiveCareHistoryList.first.serviceID,
consultationTime: rescheduleDateTime,
isRescheduledForOneHourLater: immediateLiveCareVM.selectedRescheduleTime == 1 ? false : true,
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(context,
child: Utils.getErrorWidget(loadingText: err.toString()),
callBackFunc: () {},
callID: immediateLiveCareVM.patientLiveCareHistoryList.first.vCID,
serviceID: immediateLiveCareVM.patientLiveCareHistoryList.first.serviceID,
consultationTime: rescheduleDateTime,
isRescheduledForOneHourLater: immediateLiveCareVM.selectedRescheduleTime == 1 ? false : true,
onSuccess: (val) {
LoaderBottomSheet.hideLoader();
immediateLiveCareVM.getPatientLiveCareHistory();
},
onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(context,
child: Utils.getErrorWidget(loadingText: err.toString()),
callBackFunc: () {},
title: "",
isCloseButtonVisible: true,
isDismissible: true,
@ -249,7 +254,31 @@ class _ImmediateLiveCarePendingRequestPageState extends State<ImmediateLiveCareP
iconColor: AppColors.alertColor,
iconSize: 18.h,
icon: AppAssets.calendar,
),
)
: Column(
children: [
"Your callback request has been successfully submitted! A doctor will contact you within ${immediateLiveCareVM.selectedRescheduleTime == 1 ? '30' : '60'} Mins"
.toText14(isBold: true),
SizedBox(height: 12.h),
CustomButton(
text: LocaleKeys.backToHome.tr(context: context),
onPressed: () {
Navigator.of(context).pop();
},
backgroundColor: AppColors.warningColorYellow.withValues(alpha: 0.20),
borderColor: AppColors.warningColorYellow.withValues(alpha: 0.01),
textColor: AppColors.alertColor,
fontSize: 14.f,
fontWeight: FontWeight.w600,
borderRadius: 12.r,
padding: EdgeInsets.symmetric(horizontal: 10.w),
height: 40.h,
iconColor: AppColors.alertColor,
iconSize: 18.h,
icon: AppAssets.homeBottom,
)
],
),
SizedBox(height: 8.h),
],
),

Loading…
Cancel
Save