terms and condition added to the rrt module.

pull/99/head
tahaalam 2 months ago
parent f3676f5596
commit 8f46dddbd6

@ -58,6 +58,7 @@ abstract class EmergencyServicesRepo {
Future<Either<Failure, GenericApiModel<RRTServiceData>>> getRRTOrders({int? id});
Future<Either<Failure, GenericApiModel<bool>>> cancelRRTOrder(int? iD);
Future<Either<Failure, GenericApiModel<String>>> getTermsAndCondition();
}
class EmergencyServicesRepoImp implements EmergencyServicesRepo {
@ -681,5 +682,40 @@ class EmergencyServicesRepoImp implements EmergencyServicesRepo {
}
}
@override
Future<Either<Failure, GenericApiModel<String>>> getTermsAndCondition() async {
try {
GenericApiModel<String>? apiResponse;
Failure? failure;
await apiClient.post(
body: {},
GET_USER_TERMS,
onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
},
onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
final agreement = response['UserAgreementContent'];
apiResponse = GenericApiModel<String>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: agreement,
);
} 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()));
}
}
}

@ -39,6 +39,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_rep
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_map_screen.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_request_type_select.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/terms_and_condition.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/call_ambulance_page.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart';
import 'package:hmg_patient_app_new/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart';
@ -156,6 +157,8 @@ class EmergencyServicesViewModel extends ChangeNotifier {
bool isMyAppointmentsLoading = false;
String? termsAndConditions;
Future<void> getRRTProcedures({Function(dynamic)? onSuccess, Function(String)? onError}) async {
print("the app state is ${appState.isAuthenticated}");
@ -1063,4 +1066,21 @@ class EmergencyServicesViewModel extends ChangeNotifier {
clearRRTData(){
selectedRRTProcedure = null;
}
FutureOr<void> getTermsAndConditions() async {
LoaderBottomSheet.showLoader(loadingText: "Fetching Terms And Conditions".needTranslation);
var response = await emergencyServicesRepo.getTermsAndCondition();
LoaderBottomSheet.hideLoader();
response.fold((failure)=>errorHandlerService.handleError(failure: failure),(success){
termsAndConditions = success.data;
print("the response terms are $termsAndConditions");
notifyListeners();
navServices.push(
CustomPageRoute(
page: TermsAndCondition(termsAndCondition:success.data??""), direction: AxisDirection.down),
);
});
}
}

@ -256,7 +256,7 @@ class RrtRequestTypeSelect extends StatelessWidget {
SizedBox.shrink(),
LocaleKeys.agreeTo.tr().toText16(color: AppColors.textColor, weight: FontWeight.w500),
LocaleKeys.termsConditoins.tr().toText16(color: AppColors.errorColor, isUnderLine: true, weight: FontWeight.w500).onPress(() {
Navigator.of(context).pushNamed('/terms');
emergencyServicesVM.getTermsAndConditions();
}),
],
),

@ -0,0 +1,33 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
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/emergency_services/emergency_services_view_model.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
import 'package:provider/provider.dart';
class TermsAndCondition extends StatelessWidget {
final String termsAndCondition;
const TermsAndCondition({super.key, required this.termsAndCondition});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: CollapsingListView(
title: "Terms And Condition".needTranslation,
child:DecoratedBox(decoration:RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 20.h,
hasShadow: true,
),child: HtmlWidget(termsAndCondition).paddingAll(16.h)).paddingAll(12.h)))]));
}
}
Loading…
Cancel
Save