updates & fixes

pull/83/head
haroon amjad 3 weeks ago
parent fe5b6c35ac
commit 663eda0076

@ -443,6 +443,7 @@ class AuthenticationViewModel extends ChangeNotifier {
int? patientID, int? patientID,
}) async { }) async {
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1); bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1);
MyAppointmentsViewModel myAppointmentsVM = getIt<MyAppointmentsViewModel>();
final request = RequestUtils.getCommonRequestWelcome( final request = RequestUtils.getCommonRequestWelcome(
phoneNumber: phoneNumberController.text, phoneNumber: phoneNumberController.text,
@ -573,6 +574,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
// _appState.setUserBloodGroup = (activation.patientBlodType ?? ""); // _appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppAuthToken = activation.authenticationTokenId; _appState.setAppAuthToken = activation.authenticationTokenId;
myAppointmentsVM.getActiveAppointmentsCount();
final request = await RequestUtils.getAuthanticatedCommonRequest().toJson(); final request = await RequestUtils.getAuthanticatedCommonRequest().toJson();
bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request);
@ -593,7 +595,6 @@ class AuthenticationViewModel extends ChangeNotifier {
if (isUserAgreedBefore) { if (isUserAgreedBefore) {
navigateToHomeScreen(); navigateToHomeScreen();
} else { } else {
MyAppointmentsViewModel myAppointmentsVM = getIt<MyAppointmentsViewModel>();
myAppointmentsVM.setIsAppointmentDataToBeLoaded(true); myAppointmentsVM.setIsAppointmentDataToBeLoaded(true);
navigateToHomeScreen(); navigateToHomeScreen();
//Agreement page not designed yet so we are navigating to home screen directly //Agreement page not designed yet so we are navigating to home screen directly

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/features/insurance/insurance_repo.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_repo.dart';
import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_approval_response_model.dart'; import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_approval_response_model.dart';
import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_card_history.dart'; import 'package:hmg_patient_app_new/features/insurance/models/resp_models/patient_insurance_card_history.dart';
@ -14,9 +15,10 @@ class InsuranceViewModel extends ChangeNotifier {
bool isInsuranceUpdateDetailsLoading = false; bool isInsuranceUpdateDetailsLoading = false;
bool isInsuranceDataToBeLoaded = true; bool isInsuranceDataToBeLoaded = true;
bool isInsuranceApprovalsLoading = false; bool isInsuranceApprovalsLoading = false;
bool isInsuranceExpired = false;
InsuranceRepo insuranceRepo; InsuranceRepo insuranceRepo;
ErrorHandlerService errorHandlerService; ErrorHandlerService errorHandlerService;
@ -85,6 +87,11 @@ class InsuranceViewModel extends ChangeNotifier {
patientInsuranceList = apiResponse.data!; patientInsuranceList = apiResponse.data!;
isInsuranceLoading = false; isInsuranceLoading = false;
isInsuranceDataToBeLoaded = false; isInsuranceDataToBeLoaded = false;
isInsuranceExpired = DateTime.now().isAfter(
DateUtil.convertStringToDate(patientInsuranceList.first.cardValidTo),
);
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);

@ -47,6 +47,8 @@ abstract class MyAppointmentsRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> insertLiveCareVIDARequest({required clientRequestID, required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel}); Future<Either<Failure, GenericApiModel<dynamic>>> insertLiveCareVIDARequest({required clientRequestID, required PatientAppointmentHistoryResponseModel patientAppointmentHistoryResponseModel});
Future<Either<Failure, GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>>> getTamaraInstallmentsDetails(); Future<Either<Failure, GenericApiModel<GetTamaraInstallmentsDetailsResponseModel>>> getTamaraInstallmentsDetails();
Future<Either<Failure, GenericApiModel<dynamic>>> getActiveAppointmentsCount();
} }
class MyAppointmentsRepoImp implements MyAppointmentsRepo { class MyAppointmentsRepoImp implements MyAppointmentsRepo {
@ -476,9 +478,6 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
onSuccess: (response, statusCode, {messageStatus, errorMessage}) { onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try { try {
final list = response['PatientDoctorAppointmentResultList']; final list = response['PatientDoctorAppointmentResultList'];
// if (list == null || list.isEmpty) {
// throw Exception("Appointments list is empty");
// }
final appointmentsList = list.map((item) => PatientAppointmentHistoryResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientAppointmentHistoryResponseModel>(); final appointmentsList = list.map((item) => PatientAppointmentHistoryResponseModel.fromJson(item as Map<String, dynamic>)).toList().cast<PatientAppointmentHistoryResponseModel>();
@ -583,4 +582,40 @@ class MyAppointmentsRepoImp implements MyAppointmentsRepo {
return Left(UnknownFailure(e.toString())); return Left(UnknownFailure(e.toString()));
} }
} }
@override
Future<Either<Failure, GenericApiModel>> getActiveAppointmentsCount() async {
Map<String, dynamic> mapDevice = {};
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(
GET_ACTIVE_APPOINTMENTS_LIST_URL,
body: mapDevice,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final appointmentCount = response['AppointmentActiveNumber'];
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: appointmentCount,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
},
);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
} }

@ -17,6 +17,8 @@ class MyAppointmentsViewModel extends ChangeNotifier {
ErrorHandlerService errorHandlerService; ErrorHandlerService errorHandlerService;
AppState appState; AppState appState;
int activeAppointmentsCount = 0;
bool isMyAppointmentsLoading = false; bool isMyAppointmentsLoading = false;
bool isAppointmentPatientShareLoading = false; bool isAppointmentPatientShareLoading = false;
bool isTimeLineAppointmentsLoading = false; bool isTimeLineAppointmentsLoading = false;
@ -64,7 +66,6 @@ class MyAppointmentsViewModel extends ChangeNotifier {
isMyAppointmentsLoading = true; isMyAppointmentsLoading = true;
isTimeLineAppointmentsLoading = true; isTimeLineAppointmentsLoading = true;
patientMyDoctorsList.clear(); patientMyDoctorsList.clear();
isPatientMyDoctorsLoading = true;
} }
isTamaraDetailsLoading = true; isTamaraDetailsLoading = true;
isAppointmentPatientShareLoading = true; isAppointmentPatientShareLoading = true;
@ -121,10 +122,12 @@ class MyAppointmentsViewModel extends ChangeNotifier {
patientArrivedAppointmentsHistoryList.clear(); patientArrivedAppointmentsHistoryList.clear();
notifyListeners(); notifyListeners();
final result = await myAppointmentsRepo.getPatientAppointments(isActiveAppointment: isActiveAppointment, isArrivedAppointments: isArrivedAppointments); final results = await Future.wait([
final resultArrived = await myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true); myAppointmentsRepo.getPatientAppointments(isActiveAppointment: isActiveAppointment, isArrivedAppointments: isArrivedAppointments),
myAppointmentsRepo.getPatientAppointments(isActiveAppointment: false, isArrivedAppointments: true),
]);
result.fold( results[0].fold(
(failure) async => await errorHandlerService.handleError(failure: failure), (failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 2) { if (apiResponse.messageStatus == 2) {
@ -141,7 +144,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
}, },
); );
resultArrived.fold( results[1].fold(
(failure) async => await errorHandlerService.handleError(failure: failure), (failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) { (apiResponse) {
if (apiResponse.messageStatus == 2) { if (apiResponse.messageStatus == 2) {
@ -149,6 +152,7 @@ class MyAppointmentsViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
patientArrivedAppointmentsHistoryList = apiResponse.data!; patientArrivedAppointmentsHistoryList = apiResponse.data!;
isMyAppointmentsLoading = false; isMyAppointmentsLoading = false;
isAppointmentDataToBeLoaded = false;
notifyListeners(); notifyListeners();
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
@ -363,6 +367,9 @@ class MyAppointmentsViewModel extends ChangeNotifier {
Future<void> getPatientMyDoctors({Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> getPatientMyDoctors({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isAppointmentDataToBeLoaded) return; if (!isAppointmentDataToBeLoaded) return;
isPatientMyDoctorsLoading = true;
notifyListeners();
final result = await myAppointmentsRepo.getPatientDoctorsList(); final result = await myAppointmentsRepo.getPatientDoctorsList();
result.fold( result.fold(
@ -527,17 +534,26 @@ class MyAppointmentsViewModel extends ChangeNotifier {
if (onSuccess != null) { if (onSuccess != null) {
onSuccess(apiResponse); onSuccess(apiResponse);
} }
},
);
}
// if (apiResponse.messageStatus == 2) { Future<void> getActiveAppointmentsCount({Function(dynamic)? onSuccess, Function(String)? onError}) async {
// onError!(apiResponse.errorMessage!); final result = await myAppointmentsRepo.getActiveAppointmentsCount();
// // dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
// } else if (apiResponse.messageStatus == 1) { result.fold(
// getTamaraInstallmentsDetailsResponseModel = apiResponse.data!; (failure) async => await errorHandlerService.handleError(failure: failure),
// notifyListeners(); (apiResponse) {
// if (onSuccess != null) { if (apiResponse.messageStatus == 2) {
// onSuccess(apiResponse); onError!(apiResponse.errorMessage!);
// } activeAppointmentsCount = 0;
// } } else if (apiResponse.messageStatus == 1) {
activeAppointmentsCount = apiResponse.data ?? 0;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
}, },
); );
} }

@ -86,30 +86,25 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
onAskDoctorTap: () {}, onAskDoctorTap: () {},
onCancelTap: () async { onCancelTap: () async {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
showCommonBottomSheet(context, LoaderBottomSheet.showLoader(loadingText: "Cancelling Appointment, Please Wait...".needTranslation);
child: Utils.getLoadingWidget(),
callBackFunc: (str) {},
title: "",
height: ResponsiveExtension.screenHeight * 0.3,
isCloseButtonVisible: false,
isDismissible: false,
isFullScreen: false);
await myAppointmentsViewModel.cancelAppointment( await myAppointmentsViewModel.cancelAppointment(
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
onSuccess: (apiResponse) { onSuccess: (apiResponse) {
Navigator.of(context).pop(); LoaderBottomSheet.hideLoader();
showCommonBottomSheet(context, myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
child: Utils.getSuccessWidget(loadingText: "Appointment Cancelled Successfully".needTranslation), myAppointmentsViewModel.getPatientAppointments(true, false);
callBackFunc: (str) {}, showCommonBottomSheetWithoutHeight(
title: "", context,
height: ResponsiveExtension.screenHeight * 0.3, child: Utils.getSuccessWidget(loadingText: "Appointment Cancelled Successfully".needTranslation),
isCloseButtonVisible: false, callBackFunc: () {
isDismissible: false, Navigator.of(context).pop();
isFullScreen: false, },
isSuccessDialog: true); title: "",
isCloseButtonVisible: true,
isDismissible: false,
isFullScreen: false,
);
}); });
Navigator.of(context).pop();
Navigator.of(context).pop();
}, },
onRescheduleTap: () async { onRescheduleTap: () async {
openDoctorScheduleCalendar(); openDoctorScheduleCalendar();
@ -510,7 +505,7 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
projectName: widget.patientAppointmentHistoryResponseModel.projectName, projectName: widget.patientAppointmentHistoryResponseModel.projectName,
); );
bookAppointmentsViewModel.setSelectedDoctor(doctor); bookAppointmentsViewModel.setSelectedDoctor(doctor);
LoaderBottomSheet.showLoader(); LoaderBottomSheet.showLoader(loadingText: "Fetching Doctor Schedule, Please Wait...".needTranslation);
await bookAppointmentsViewModel.getDoctorFreeSlots( await bookAppointmentsViewModel.getDoctorFreeSlots(
isBookingForLiveCare: false, isBookingForLiveCare: false,
onSuccess: (dynamic respData) async { onSuccess: (dynamic respData) async {
@ -541,24 +536,19 @@ class _AppointmentDetailsPageState extends State<AppointmentDetailsPage> {
case 0: case 0:
break; break;
case 10: case 10:
showCommonBottomSheet(context, LoaderBottomSheet.showLoader(loadingText: "Confirming Appointment, Please Wait...".needTranslation);
child: Utils.getLoadingWidget(), callBackFunc: (str) {}, title: "", height: ResponsiveExtension.screenHeight * 0.3, isCloseButtonVisible: false, isDismissible: false, isFullScreen: false);
await myAppointmentsViewModel.confirmAppointment( await myAppointmentsViewModel.confirmAppointment(
patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel,
onSuccess: (apiResponse) { onSuccess: (apiResponse) {
Navigator.of(context).pop(); LoaderBottomSheet.hideLoader();
showCommonBottomSheet(context, myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
child: Utils.getSuccessWidget(loadingText: "Appointment Confirmed Successfully".needTranslation), myAppointmentsViewModel.getPatientAppointments(true, false);
callBackFunc: (str) {}, showCommonBottomSheet(context, child: Utils.getSuccessWidget(loadingText: "Appointment Confirmed Successfully".needTranslation), callBackFunc: (str) {
title: "", Navigator.of(context).pop();
height: ResponsiveExtension.screenHeight * 0.3, }, title: "", height: ResponsiveExtension.screenHeight * 0.3, isCloseButtonVisible: true, isDismissible: false, isFullScreen: false,
isCloseButtonVisible: false,
isDismissible: false,
isFullScreen: false,
isSuccessDialog: true); isSuccessDialog: true);
}); });
Navigator.of(context).pop(); // LoaderBottomSheet.hideLoader();
Navigator.of(context).pop();
case 15: case 15:
break; break;
case 20: case 20:

@ -8,10 +8,16 @@ 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/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.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/extensions/widget_extensions.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/doctors_list_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.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/doctor_profile_page.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../widgets/chip/app_custom_chip_widget.dart'; import '../../widgets/chip/app_custom_chip_widget.dart';
@ -20,11 +26,13 @@ class MyDoctorsPage extends StatelessWidget {
MyDoctorsPage({super.key}); MyDoctorsPage({super.key});
late MyAppointmentsViewModel myAppointmentsViewModel; late MyAppointmentsViewModel myAppointmentsViewModel;
late BookAppointmentsViewModel bookAppointmentsViewModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>(); AppState appState = getIt.get<AppState>();
myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context, listen: false); myAppointmentsViewModel = Provider.of<MyAppointmentsViewModel>(context, listen: false);
bookAppointmentsViewModel = Provider.of<BookAppointmentsViewModel>(context, listen: false);
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView( body: CollapsingListView(
@ -141,13 +149,38 @@ class MyDoctorsPage extends StatelessWidget {
"".toText16(), "".toText16(),
Transform.flip( Transform.flip(
flipX: appState.isArabic(), flipX: appState.isArabic(),
child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, width: 15.h, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor)), child:
Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon_small, width: 15.h, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor)),
], ],
), ),
], ],
), ),
), ),
), ).onPress(() async {
bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel(
clinicID: myAppointmentsVM.patientMyDoctorsList[index].clinicID,
projectID: myAppointmentsVM.patientMyDoctorsList[index].projectID,
doctorID: myAppointmentsVM.patientMyDoctorsList[index].doctorID,
));
LoaderBottomSheet.showLoader();
await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}),
), ),
), ),
); );

@ -117,26 +117,26 @@ class _AppointmentCardState extends State<AppointmentCard> {
).toShimmer2(isShow: widget.isLoading), ).toShimmer2(isShow: widget.isLoading),
), ),
// TODO: Implement the logic to enable/disable the switch based on reminder status // TODO: Implement the logic to enable/disable the switch based on reminder status
AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) // AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel)
? SizedBox().toShimmer2(isShow: widget.isLoading) // ? SizedBox().toShimmer2(isShow: widget.isLoading)
: Switch( // : Switch(
activeColor: AppColors.successColor, // activeColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15), // activeTrackColor: AppColors.successColor.withValues(alpha: .15),
thumbIcon: WidgetStateProperty.resolveWith<Icon?>( // thumbIcon: WidgetStateProperty.resolveWith<Icon?>(
(Set<WidgetState> states) { // (Set<WidgetState> states) {
if (states.contains(WidgetState.selected)) { // if (states.contains(WidgetState.selected)) {
return const Icon(Icons.check); // Icon when switch is ON // return const Icon(Icons.check); // Icon when switch is ON
} // }
return const Icon(Icons.close); // Icon when switch is OFF // return const Icon(Icons.close); // Icon when switch is OFF
}, // },
), // ),
value: widget.isLoading ? false : widget.patientAppointmentHistoryResponseModel.hasReminder!, // value: widget.isLoading ? false : widget.patientAppointmentHistoryResponseModel.hasReminder!,
onChanged: (newValue) { // onChanged: (newValue) {
setState(() { // setState(() {
widget.myAppointmentsViewModel.setAppointmentReminder(newValue, widget.patientAppointmentHistoryResponseModel); // widget.myAppointmentsViewModel.setAppointmentReminder(newValue, widget.patientAppointmentHistoryResponseModel);
}); // });
}, // },
).toShimmer2(isShow: widget.isLoading), // ).toShimmer2(isShow: widget.isLoading),
], ],
), ),
SizedBox(height: 16.h), SizedBox(height: 16.h),
@ -155,7 +155,7 @@ class _AppointmentCardState extends State<AppointmentCard> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
(widget.isLoading ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" : widget.patientAppointmentHistoryResponseModel.doctorNameObj!) (widget.isLoading ? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png" : widget.patientAppointmentHistoryResponseModel.doctorNameObj!)
.toText16(isBold: true) .toText16(isBold: true, maxlines: 1)
.toShimmer2(isShow: widget.isLoading), .toShimmer2(isShow: widget.isLoading),
SizedBox(height: 8.h), SizedBox(height: 8.h),
Wrap( Wrap(

@ -43,6 +43,7 @@ class PatientInsuranceCard extends StatelessWidget {
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -51,20 +52,14 @@ class PatientInsuranceCard extends StatelessWidget {
"Policy: ${insuranceCardDetailsModel.insurancePolicyNo}".toText12(isBold: true, color: AppColors.lightGrayColor), "Policy: ${insuranceCardDetailsModel.insurancePolicyNo}".toText12(isBold: true, color: AppColors.lightGrayColor),
], ],
), ),
CustomButton( AppCustomChipWidget(
icon: isInsuranceExpired ? AppAssets.cancel_circle_icon : AppAssets.insurance_active_icon, icon: isInsuranceExpired ? AppAssets.cancel_circle_icon : AppAssets.insurance_active_icon,
labelText: isInsuranceExpired ? "Insurance Expired".needTranslation : "Insurance Active".needTranslation,
iconColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, iconColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor,
iconSize: 13.h,
text: isInsuranceExpired ? "Insurance Expired".needTranslation : "Insurance Active".needTranslation,
onPressed: () {},
backgroundColor: isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.15) : AppColors.successColor.withOpacity(0.15),
borderColor: isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.01) : AppColors.successColor.withOpacity(0.01),
textColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, textColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor,
fontSize: 10, iconSize: 12,
fontWeight: FontWeight.w500, backgroundColor: isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.successColor.withOpacity(0.1),
borderRadius: 12, labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h),
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 30.h,
), ),
], ],
), ),
@ -79,8 +74,10 @@ class PatientInsuranceCard extends StatelessWidget {
children: [ children: [
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.doctor_calendar_icon, icon: AppAssets.doctor_calendar_icon,
labelText: "${LocaleKeys.expiryDate.tr(context: context)} ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(insuranceCardDetailsModel.cardValidTo), false)}"), labelText: "${LocaleKeys.expiryDate.tr(context: context)} ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(insuranceCardDetailsModel.cardValidTo), false)}",
AppCustomChipWidget(labelText: "Patient Card ID: ${insuranceCardDetailsModel.patientCardID}"), labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h),
),
AppCustomChipWidget(labelText: "Patient Card ID: ${insuranceCardDetailsModel.patientCardID}".needTranslation),
], ],
), ),
SizedBox(height: 10.h), SizedBox(height: 10.h),

@ -26,6 +26,7 @@ import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart';
import 'package:hmg_patient_app_new/presentation/appointments/my_doctors_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_doctors_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/doctor_profile_page.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart';
import 'package:hmg_patient_app_new/presentation/insurance/insurance_approvals_page.dart'; import 'package:hmg_patient_app_new/presentation/insurance/insurance_approvals_page.dart';
import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart'; import 'package:hmg_patient_app_new/presentation/insurance/insurance_home_page.dart';
@ -200,9 +201,21 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
), ),
AppCustomChipWidget( AppCustomChipWidget(
icon: AppAssets.blood_icon, icon: AppAssets.blood_icon,
labelText: "${LocaleKeys.bloodType.tr(context: context)}: ${appState.getUserBloodGroup}", labelText: "Blood: ${appState.getUserBloodGroup}",
iconColor: AppColors.primaryRedColor, iconColor: AppColors.primaryRedColor,
labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h),
), ),
Consumer<InsuranceViewModel>(builder: (context, insuranceVM, child) {
return AppCustomChipWidget(
icon: insuranceVM.isInsuranceExpired ? AppAssets.cancel_circle_icon : AppAssets.insurance_active_icon,
labelText: insuranceVM.isInsuranceExpired ? "Insurance Expired".needTranslation : "Insurance Active".needTranslation,
iconColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor,
textColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor,
iconSize: 12,
backgroundColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.successColor.withOpacity(0.1),
labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h),
);
}),
], ],
), ),
], ],
@ -515,7 +528,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
backgroundColor: AppColors.secondaryLightRedColor, backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 12.3, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12.h, borderRadius: 12.h,
height: 40.h, height: 40.h,
@ -532,7 +545,7 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
backgroundColor: AppColors.secondaryLightRedColor, backgroundColor: AppColors.secondaryLightRedColor,
borderColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor,
textColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor,
fontSize: 13, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
borderRadius: 12.h, borderRadius: 12.h,
height: 40.h, height: 40.h,
@ -569,7 +582,6 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h),
], ],
).onPress(() { ).onPress(() {
myAppointmentsViewModel.setIsPatientMyDoctorsLoading(true);
myAppointmentsViewModel.getPatientMyDoctors(); myAppointmentsViewModel.getPatientMyDoctors();
Navigator.of(context).push( Navigator.of(context).push(
CustomPageRoute( CustomPageRoute(
@ -639,7 +651,31 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
), ),
], ],
), ),
), ).onPress(() async {
bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel(
clinicID: myAppointmentsVM.patientMyDoctorsList[index].clinicID,
projectID: myAppointmentsVM.patientMyDoctorsList[index].projectID,
doctorID: myAppointmentsVM.patientMyDoctorsList[index].doctorID,
));
LoaderBottomSheet.showLoader();
await bookAppointmentsViewModel.getDoctorProfile(onSuccess: (dynamic respData) {
LoaderBottomSheet.hideLoader();
Navigator.of(context).push(
CustomPageRoute(
page: DoctorProfilePage(),
),
);
}, onError: (err) {
LoaderBottomSheet.hideLoader();
showCommonBottomSheetWithoutHeight(
context,
child: Utils.getErrorWidget(loadingText: err),
callBackFunc: () {},
isFullScreen: false,
isCloseButtonVisible: true,
);
});
}),
), ),
), ),
) )

@ -59,6 +59,7 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
Expanded( Expanded(
child: CollapsingListView( child: CollapsingListView(
title: LocaleKeys.prescriptions.tr(context: context), title: LocaleKeys.prescriptions.tr(context: context),
instructions: () {},
child: SingleChildScrollView( child: SingleChildScrollView(
child: Consumer<PrescriptionsViewModel>(builder: (context, prescriptionVM, child) { child: Consumer<PrescriptionsViewModel>(builder: (context, prescriptionVM, child) {
return Column( return Column(

@ -209,21 +209,7 @@ class PrescriptionItemView extends StatelessWidget {
height: 40.h, height: 40.h,
).toShimmer2(isShow: isLoading), ).toShimmer2(isShow: isLoading),
), ),
SizedBox(width: 16.h), // SizedBox(width: 16.h),
Expanded(
child: CustomButton(
text: LocaleKeys.readInstructions.tr(context: context),
onPressed: () {},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
fontSize: 13,
fontWeight: FontWeight.w500,
borderRadius: 12,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 40.h,
).toShimmer2(isShow: isLoading),
),
], ],
).paddingSymmetrical(16.h, 16.h), ).paddingSymmetrical(16.h, 16.h),
], ],

@ -21,12 +21,14 @@ class CollapsingListView extends StatelessWidget {
VoidCallback? report; VoidCallback? report;
VoidCallback? logout; VoidCallback? logout;
VoidCallback? history; VoidCallback? history;
VoidCallback? instructions;
Widget? bottomChild; Widget? bottomChild;
Widget? trailing; Widget? trailing;
bool isClose; bool isClose;
bool isLeading; bool isLeading;
CollapsingListView({required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout, this.history, this.isLeading = true, this.trailing}); CollapsingListView(
{required this.title, this.child, this.search, this.isClose = false, this.bottomChild, this.report, this.logout, this.history, this.instructions, this.isLeading = true, this.trailing});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -98,6 +100,7 @@ class CollapsingListView extends StatelessWidget {
if (logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(logout!), if (logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(logout!),
if (report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(report!), if (report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(report!),
if (history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(history!), if (history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(history!),
if (instructions != null) actionButton(context, t, title: "Instructions".needTranslation, icon: AppAssets.requests).onPress(instructions!),
if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24), if (search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(search!).paddingOnly(right: 24),
if (trailing != null) trailing!, if (trailing != null) trailing!,
], ],

@ -58,7 +58,7 @@ class AppCustomChipWidget extends StatelessWidget {
color: Colors.transparent, // Crucially, set color to transparent color: Colors.transparent, // Crucially, set color to transparent
style: BorderStyle.none, style: BorderStyle.none,
), ),
borderRadius: BorderRadius.circular(8.0), // Apply a border radius of 16.0 borderRadius: BorderRadius.circular(8.h), // Apply a border radius of 16.0
), ),
), ),
child: icon.isNotEmpty child: icon.isNotEmpty

Loading…
Cancel
Save