From 96d5c3ce1d982346ca50a42a954f8fbf2f614463 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 14 May 2024 10:45:49 +0300 Subject: [PATCH] My Instructions added --- lib/config/config.dart | 2 + lib/config/localized_values.dart | 1 + lib/core/service/client/base_app_client.dart | 2 +- ...et_dental_instructions_response_model.dart | 77 +++++++++++++++++ .../medical/dental_instructions_page.dart | 85 +++++++++++++++++++ .../clinic_services/get_clinic_service.dart | 11 +++ lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 15 +++- 8 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 lib/models/get_dental_instructions_response_model.dart create mode 100644 lib/pages/medical/dental_instructions_page.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 996b3e65..c5562fed 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -631,6 +631,8 @@ var GET_BLOOD_DONATION_FREE_SLOTS = 'Services/OUTPs.svc/REST/BD_GetFreeSlots'; var GET_WE_CARE_TOUR_URL = 'Services/Consent.svc/Rest/Consent_VirtualJurny_Url_GetByProjectID'; +var GET_DENTAL_INSTRUCTIONS = 'Services/OUTPs.svc/Rest/getProcedureNotification'; + //PAYFORT var getPayFortProjectDetails = "Services/PayFort_Serv.svc/REST/GetPayFortProjectDetails"; var addPayFortApplePayResponse = "Services/PayFort_Serv.svc/REST/AddResponse"; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 6910f8de..fbc54c13 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1934,4 +1934,5 @@ const Map localizedValues = { "loadMore": {"en": "Load More", "ar": "تحميل المزيد"}, "selectHospitalBloodDonation": {"en": "Please select the hospital you want to book an appointment with: ", "ar": "يرجى اختيار المستشفى الذي تريد حجز موعد معه:"}, "wecare": {"en": "We Care", "ar": "نحن نهتم"}, + "myinstructions": {"en": "My Instructions", "ar": "تعليماتي"}, }; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 10d18e3a..4bc52b94 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -175,7 +175,7 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; //0560717232 - // body['PatientID'] = 3300938; //4609100 + // body['PatientID'] = 4767804; //4609100 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 diff --git a/lib/models/get_dental_instructions_response_model.dart b/lib/models/get_dental_instructions_response_model.dart new file mode 100644 index 00000000..6f2f8621 --- /dev/null +++ b/lib/models/get_dental_instructions_response_model.dart @@ -0,0 +1,77 @@ +class GetDentalInstructionsResponseModel { + List data; + dynamic message; + int status; + + GetDentalInstructionsResponseModel({this.data, this.message, this.status}); + + GetDentalInstructionsResponseModel.fromJson(Map json) { + if (json['Data'] != null) { + data = []; + json['Data'].forEach((v) { + data.add(new Data.fromJson(v)); + }); + } + message = json['message']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + if (this.data != null) { + data['Data'] = this.data.map((v) => v.toJson()).toList(); + } + data['message'] = this.message; + data['status'] = this.status; + return data; + } +} + +class Data { + String createdOn; + String mobileNo; + int patientId; + int procedureId; + int projectId; + String setupId; + String smsContent; + int sourceReferenceNo; + String sourceType; + + Data( + {this.createdOn, + this.mobileNo, + this.patientId, + this.procedureId, + this.projectId, + this.setupId, + this.smsContent, + this.sourceReferenceNo, + this.sourceType}); + + Data.fromJson(Map json) { + createdOn = json['createdOn']; + mobileNo = json['mobileNo']; + patientId = json['patientId']; + procedureId = json['procedureId']; + projectId = json['projectId']; + setupId = json['setupId']; + smsContent = json['smsContent']; + sourceReferenceNo = json['sourceReferenceNo']; + sourceType = json['sourceType']; + } + + Map toJson() { + final Map data = new Map(); + data['createdOn'] = this.createdOn; + data['mobileNo'] = this.mobileNo; + data['patientId'] = this.patientId; + data['procedureId'] = this.procedureId; + data['projectId'] = this.projectId; + data['setupId'] = this.setupId; + data['smsContent'] = this.smsContent; + data['sourceReferenceNo'] = this.sourceReferenceNo; + data['sourceType'] = this.sourceType; + return data; + } +} diff --git a/lib/pages/medical/dental_instructions_page.dart b/lib/pages/medical/dental_instructions_page.dart new file mode 100644 index 00000000..a704d620 --- /dev/null +++ b/lib/pages/medical/dental_instructions_page.dart @@ -0,0 +1,85 @@ +import 'package:diplomaticquarterapp/models/get_dental_instructions_response_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; + +class DentalInstructionsPage extends StatefulWidget { + const DentalInstructionsPage(); + + @override + State createState() => _DentalInstructionsPageState(); +} + +class _DentalInstructionsPageState extends State { + GetDentalInstructionsResponseModel getDentalInstructionsResponseModel; + + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback((_) { + getDentalInstructions(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: TranslationBase.of(context).myinstructions, + isShowAppBar: true, + showNewAppBar: true, + showNewAppBarTitle: true, + isShowDecPage: false, + backgroundColor: CustomColors.appBackgroudGrey2Color, + body: Container( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + children: [ + getDentalInstructionsResponseModel != null && getDentalInstructionsResponseModel.data.isNotEmpty + ? ListView.builder( + itemCount: getDentalInstructionsResponseModel.data.length, + shrinkWrap: true, + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(top: 16.0, bottom: 16.0), + child: Text( + getDentalInstructionsResponseModel.data[index].smsContent, + style: TextStyle( + fontSize: 14.0, + letterSpacing: -0.56, + color: Color(0xff575757), + ), + ), + ); + }, + ) + : Center(child: getNoDataWidget(context)), + ], + ), + ), + ), + ), + ); + } + + getDentalInstructions() { + GifLoaderDialogUtils.showMyDialog(context); + ClinicListService service = new ClinicListService(); + service.getDentalInstructions().then((res) { + print(res["ProcedureNotificationResponse"]); + getDentalInstructionsResponseModel = GetDentalInstructionsResponseModel.fromJson(res["ProcedureNotificationResponse"]); + GifLoaderDialogUtils.hideDialog(context); + setState(() {}); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + AppToast.showErrorToast(message: err.toString()); + }); + } +} diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 41c0b081..d8ca8857 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -165,4 +165,15 @@ class ClinicListService extends BaseService { return Future.value(localRes); } + Future getDentalInstructions() async { + Map request = {}; + dynamic localRes; + await baseAppClient.post(GET_DENTAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 3d0eb100..48d1ce7b 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2919,6 +2919,7 @@ class TranslationBase { String get loadMore => localizedValues["loadMore"][locale.languageCode]; String get selectHospitalBloodDonation => localizedValues["selectHospitalBloodDonation"][locale.languageCode]; String get wecare => localizedValues["wecare"][locale.languageCode]; + String get myinstructions => localizedValues["myinstructions"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 960ae8a2..bda6fae3 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -25,6 +25,7 @@ import 'package:diplomaticquarterapp/pages/medical/active_medications/ActiveMedi import 'package:diplomaticquarterapp/pages/medical/allergies_page.dart'; import 'package:diplomaticquarterapp/pages/medical/ask_doctor/ask_doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; +import 'package:diplomaticquarterapp/pages/medical/dental_instructions_page.dart'; import 'package:diplomaticquarterapp/pages/medical/doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/medical/eye/EyeMeasurementsPage.dart'; import 'package:diplomaticquarterapp/pages/medical/labs/labs_home_page.dart'; @@ -383,7 +384,6 @@ class Utils { )); medical.add(InkWell( - // onTap: () => projectViewModel.havePrivilege(85) ? Navigator.push(context, FadePage(page: AnicllaryOrders())) : null, onTap: () => onWeCareClick(), child: MedicalProfileItem( title: TranslationBase.of(context).wecare, @@ -394,6 +394,19 @@ class Utils { ), )); + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: DentalInstructionsPage())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).myinstructions, + imagePath: 'medical_instructions.svg', + isPngImage: false, + subTitle: TranslationBase.of(context).service, + isEnable: projectViewModel.havePrivilege(85), + ), + )); + medical.add(InkWell( onTap: () => projectViewModel.havePrivilege(14) ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) : null, child: MedicalProfileItem(