From 9f44b25353bc49ef1006013fe103011e8e064063 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 4 Jul 2023 12:27:59 +0300 Subject: [PATCH] Meal Plan API integration in progress --- lib/config/config.dart | 3 +++ lib/pages/InPatientServices/meal_plan.dart | 24 +++++++++++++++++++ .../clinic_services/get_clinic_service.dart | 22 +++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/lib/config/config.dart b/lib/config/config.dart index 96e03819..57376060 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -606,6 +606,9 @@ var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymoth var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification'; +//Meal Plan APIs +var GET_ADMITTED_PATIENTS = 'Services/MOP.svc/REST/GetAdmittedPatients'; + class AppGlobal { static var context; diff --git a/lib/pages/InPatientServices/meal_plan.dart b/lib/pages/InPatientServices/meal_plan.dart index 883d3c65..b38eddc5 100644 --- a/lib/pages/InPatientServices/meal_plan.dart +++ b/lib/pages/InPatientServices/meal_plan.dart @@ -1,8 +1,12 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.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_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; class MealPlanPage extends StatefulWidget { const MealPlanPage({Key key}) : super(key: key); @@ -12,8 +16,16 @@ class MealPlanPage extends StatefulWidget { } class _MealPlanPageState extends State { + ProjectViewModel projectViewModel; + + @override + void initState() { + super.initState(); + } + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return AppScaffold( isShowAppBar: true, isShowDecPage: false, @@ -92,4 +104,16 @@ class _MealPlanPageState extends State { ), ); } + + void getAdmittedPatientDetails() { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getAdmittedPatientDetails(projectViewModel.user.patientID, projectViewModel.inPatientProjectID, projectViewModel.getAdmissionInfoResponseModel.admissionNo, 0, 0, 0, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + // AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + Navigator.of(context).pop(); + }).catchError((err) { + print(err); + }); + } } diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 276c66eb..4e685a06 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -274,4 +274,26 @@ class ClinicListService extends BaseService { }, body: request, isAllowAny: true); return Future.value(localRes); } + + Future getAdmittedPatientDetails(int patientID, int projectID, int admissionNo, int buildingID, int floorID, int nursingStationID, context) async { + Map request; + request = { + "ProjectID": projectID, + "PatientID" : patientID, + "AdmissionNo": admissionNo, + "BuildingID" : buildingID, + "FloorID" : floorID, + "NursingStationID": nursingStationID + }; + + dynamic localRes; + + await baseAppClient.post(GET_ADMITTED_PATIENTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + }