diff --git a/lib/config/config.dart b/lib/config/config.dart index 6c867ac1..5fc169de 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -593,6 +593,9 @@ var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLog // Check If InPatient API var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo'; +// Get General Instructions API +var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions'; + class AppGlobal { static var context; diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 410a862a..0c438fb4 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -35,6 +35,7 @@ class ProjectViewModel extends BaseViewModel { bool isLogin = false; int laserSelectionDuration; bool isPatientAdmitted = false; + int inPatientProjectID = 0; double _latitude; double _longitude; @@ -116,6 +117,11 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } + setInPatientProjectID(int projectID) { + this.inPatientProjectID = projectID; + notifyListeners(); + } + setPrivilegeModelList({List privilege}) { this.isLoginChild = isLoginChild; privilegeRootUser = privilege; diff --git a/lib/models/InPatientServices/get_general_instructions_response_model.dart b/lib/models/InPatientServices/get_general_instructions_response_model.dart new file mode 100644 index 00000000..e582782d --- /dev/null +++ b/lib/models/InPatientServices/get_general_instructions_response_model.dart @@ -0,0 +1,52 @@ +class GetGeneralInstructions { + int rowID; + int iD; + int projectID; + String text; + String textN; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + + GetGeneralInstructions( + {this.rowID, + this.iD, + this.projectID, + this.text, + this.textN, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + GetGeneralInstructions.fromJson(Map json) { + rowID = json['RowID']; + iD = json['ID']; + projectID = json['ProjectID']; + text = json['Text']; + textN = json['TextN']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['ID'] = this.iD; + data['ProjectID'] = this.projectID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/pages/InPatientServices/general_instructions.dart b/lib/pages/InPatientServices/general_instructions.dart new file mode 100644 index 00000000..88f9797d --- /dev/null +++ b/lib/pages/InPatientServices/general_instructions.dart @@ -0,0 +1,93 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_general_instructions_response_model.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'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class GeneralInstructions extends StatelessWidget { + List getGeneralInstructionsList; + ProjectViewModel projectViewModel; + + GeneralInstructions({@required this.getGeneralInstructionsList}); + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).InPatientServicesHeader, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: Text("General Instructions", + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + )), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: Card( + elevation: 0.0, + margin: EdgeInsets.all(16), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: EdgeInsets.all(16.0), + child: Container( + child: ListView.separated( + itemCount: getGeneralInstructionsList.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: SvgPicture.asset("assets/images/new-design/ionic-ios-checkmark-circle.svg"), + ), + Container( + width: MediaQuery.of(context).size.width * 0.75, + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: Text(projectViewModel.isArabic ? getGeneralInstructionsList[index].textN : getGeneralInstructionsList[index].text, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + )), + ), + ], + )); + }, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.only(left: 14, right: 14), + child: mHeight(16.0), + ); + }, + )), + ), + ), + ), + ) + ], + )); + } +} diff --git a/lib/pages/InPatientServices/inpatient_home.dart b/lib/pages/InPatientServices/inpatient_home.dart index 25c84c35..ea5e0e1d 100644 --- a/lib/pages/InPatientServices/inpatient_home.dart +++ b/lib/pages/InPatientServices/inpatient_home.dart @@ -1,7 +1,12 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_general_instructions_response_model.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/general_instructions.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/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -64,7 +69,7 @@ class InPatientServicesHome extends StatelessWidget { serviceList.add( InkWell( onTap: () { - // Navigator.push(context, FadePage(page: AdvancePaymentPage())); + openGeneralInstructions(context); }, child: MedicalProfileItem( title: TranslationBase.of(context).generalInstructionsTitle, @@ -140,7 +145,25 @@ class InPatientServicesHome extends StatelessWidget { ), ), ); - return serviceList; } + + void openGeneralInstructions(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getGeneralInstructions(projectViewModel.inPatientProjectID, context).then((res) { + List getGeneralInstructionsList = []; + + res['generalInstructions'].forEach((v) { + getGeneralInstructionsList.add(new GetGeneralInstructions.fromJson(v)); + }); + + GifLoaderDialogUtils.hideDialog(context); + + print(res['generalInstructions']); + Navigator.push(context, FadePage(page: GeneralInstructions(getGeneralInstructionsList: getGeneralInstructionsList))); + }).catchError((err) { + print(err); + }); + } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 7d2632e7..ac92c2db 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -672,6 +672,7 @@ class _ConfirmLogin extends State { if (res['List_PatientAdmissionInfo'].length != 0) { print("INPATIENT!!!"); projectViewModel.setIsPatientAdmitted(true); + projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']); } else { print("OUTPATIENT!!!"); projectViewModel.setIsPatientAdmitted(false); diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 9fd1566f..7507382b 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -399,6 +399,7 @@ class _Login extends State { if (res['List_PatientAdmissionInfo'].length != 0) { print("INPATIENT!!!"); projectViewModel.setIsPatientAdmitted(true); + projectViewModel.setInPatientProjectID(res['List_PatientAdmissionInfo'][0]['ProjectID']); } else { print("OUTPATIENT!!!"); projectViewModel.setIsPatientAdmitted(false); diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index b7ed77bd..0ebebfa2 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -77,6 +77,22 @@ class ClinicListService extends BaseService { return Future.value(localRes); } + Future getGeneralInstructions(int projectID, context) async { + Map request; + request = { + "ProjectID": projectID + }; + + dynamic localRes; + + await baseAppClient.post(GET_GENERAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + Future getProjectsList(context) async { Map request; var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 31ffa903..a4d323b5 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -548,6 +548,7 @@ class _AppDrawerState extends State { await _privilegeService.getPrivilege(); projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); projectProvider.setIsPatientAdmitted(false); + projectProvider.setInPatientProjectID(0); var appLanguage = await sharedPref.getString(APP_LANGUAGE); await sharedPref.clear(); await sharedPref.setString(APP_LANGUAGE, appLanguage);