From 4dd3f9ad015a06a8c52ad9aeb26467d1264e88d5 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 9 Sep 2020 12:05:09 +0300 Subject: [PATCH] done Patient Sick Leave --- .../medical/PatientSickLeaveService.dart | 4 +- .../patient_sick_leave_view_model.dart | 6 +-- lib/pages/medical/medical_profile_page.dart | 16 +++++--- .../medical/patient_sick_leave_page.dart | 39 +++++++++++-------- 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/lib/core/service/medical/PatientSickLeaveService.dart b/lib/core/service/medical/PatientSickLeaveService.dart index 4801d8b0..b2bb16ef 100644 --- a/lib/core/service/medical/PatientSickLeaveService.dart +++ b/lib/core/service/medical/PatientSickLeaveService.dart @@ -21,7 +21,7 @@ class PatientSickLeaveService extends BaseService { } sendSickLeaveEmail( - {int requestNo, String projectName, String doctorName}) async { + {int requestNo, String projectName, String doctorName, int projectID,String setupID}) async { hasError = false; super.error = ""; Map body = Map(); @@ -33,6 +33,8 @@ class PatientSickLeaveService extends BaseService { body['PatientName'] = user.firstName + " " + user.firstName; body['ProjectName'] = projectName; body['DoctorName'] = doctorName; + body['ProjectID'] = 12; + body['SetupID'] = 12; await baseAppClient .post(SendSickLeaveEmail, onSuccess: (response, statusCode) async {}, onFailure: (String error, int statusCode) { diff --git a/lib/core/viewModels/medical/patient_sick_leave_view_model.dart b/lib/core/viewModels/medical/patient_sick_leave_view_model.dart index 9ed25b01..6addf833 100644 --- a/lib/core/viewModels/medical/patient_sick_leave_view_model.dart +++ b/lib/core/viewModels/medical/patient_sick_leave_view_model.dart @@ -26,10 +26,10 @@ class PatientSickLeaveViewMode extends BaseViewModel { {String message, int requestNo, String projectName, - String doctorName}) async { - setState(ViewState.BusyLocal); + String doctorName,int projectID,String setupID}) async { + setState(ViewState.Busy); await _patientSickLeaveService.sendSickLeaveEmail( - requestNo: requestNo, projectName: projectName, doctorName: doctorName); + requestNo: requestNo, projectName: projectName, doctorName: doctorName,projectID: projectID,setupID: setupID); if (_patientSickLeaveService.hasError) { error = _patientSickLeaveService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index e78e18a9..7abd724d 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model. import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; @@ -331,12 +332,13 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: (){ + onTap: () { Navigator.push(context, FadePage(page: MonthlyReportsPage())); }, child: MedicalProfileItem( - title: TranslationBase.of(context).monthly, + title: + TranslationBase.of(context).monthly, imagePath: 'medical_history_icon.png', subTitle: TranslationBase.of(context) .monthlySubtitle, @@ -349,10 +351,12 @@ class _MedicalProfilePageState extends State { flex: 1, child: InkWell( //TODO -// onTap: () { -// Navigator.push( -// context, FadePage(page: DoctorHomePage())); -// }, + onTap: () { + Navigator.push( + context, + FadePage( + page: PatientSickLeavePage())); + }, child: MedicalProfileItem( title: TranslationBase.of(context).sick, imagePath: 'insurance_card_icon.png', diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 06604c99..dab3d6cf 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -19,22 +20,28 @@ class _PatientSickLeavePageState extends State { isShowAppBar: true, appBarTitle: 'Sick Leave', baseViewModel: model, - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(12), - child: ListView.builder( - itemCount: model.sickLeaveList.length, - itemBuilder: (context, index) => DoctorCard( - name: model.sickLeaveList[index].doctorName, - date: DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].requestDate), - profileUrl:model.sickLeaveList[index].doctorImageURL, - rat: model.sickLeaveList[index].doctorRate.toDouble(), - subName: model.sickLeaveList[index].projectName, - isInOutPatientDescription: model.sickLeaveList[index].isInOutPatientDescription, - onEmailTap: (){ - model.sendSickLeaveEmail(); - }, - ), + body: Container( + margin: EdgeInsets.all(12), + child: ListView.builder( + itemCount: model.sickLeaveList.length, + itemBuilder: (context, index) => DoctorCard( + name: model.sickLeaveList[index].doctorName, + date: DateUtil.getMonthDayYearDateFormatted( + model.sickLeaveList[index].requestDate), + profileUrl: model.sickLeaveList[index].doctorImageURL, + rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), + subName: model.sickLeaveList[index].projectName, + isInOutPatientDescription: + model.sickLeaveList[index].isInOutPatientDescription, + onEmailTap: () { + model.sendSickLeaveEmail( + message: TranslationBase.of(context).emailSentSuccessfully, + requestNo: model.sickLeaveList[index].requestNo, + doctorName: model.sickLeaveList[index].doctorName, + projectName: model.sickLeaveList[index].projectName, + setupID: model.sickLeaveList[index].setupID, + projectID: model.sickLeaveList[index].projectID); + }, ), ), ),