From d9fabbab17b3dff99909cf06ed6482078be2c725 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Tue, 17 Aug 2021 11:31:52 +0300 Subject: [PATCH] Fix feedback --- ios/Podfile | 2 +- ios/Runner.xcodeproj/project.pbxproj | 18 ----- lib/core/model/sick_leave/sick_leave.dart | 4 +- .../service/feedback/feedback_service.dart | 9 ++- .../feedback/feedback_view_model.dart | 5 +- .../widgets/AppointmentActions.dart | 3 +- lib/pages/feedback/appointment_history.dart | 18 ++--- lib/pages/feedback/feedback_home_page.dart | 8 +- lib/pages/feedback/send_feedback_page.dart | 73 ++++++++++++++++--- .../medical/patient_sick_leave_page.dart | 2 +- 10 files changed, 93 insertions(+), 49 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index 89424e2a..9fbc2933 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +# platform :ios, '10.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 40202660..366647c0 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -220,7 +220,6 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, EFDAD5E1235DCA1DB6187148 /* [CP] Embed Pods Frameworks */, - 835BB6C21DD911F74065B670 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -320,23 +319,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 835BB6C21DD911F74065B670 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/lib/core/model/sick_leave/sick_leave.dart b/lib/core/model/sick_leave/sick_leave.dart index 6811a552..1d396e18 100644 --- a/lib/core/model/sick_leave/sick_leave.dart +++ b/lib/core/model/sick_leave/sick_leave.dart @@ -13,7 +13,7 @@ class SickLeave { int appointmentNo; int admissionNo; int actualDoctorRate; - String appointmentDate; + DateTime appointmentDate; String clinicName; String doctorImageURL; String doctorName; @@ -80,7 +80,7 @@ class SickLeave { appointmentNo = json['AppointmentNo']; admissionNo = json['AdmissionNo']; actualDoctorRate = json['ActualDoctorRate']; - appointmentDate = json['AppointmentDate']; + appointmentDate = DateUtil.convertStringToDate(json['AppointmentDate']); clinicName = json['ClinicName']; doctorImageURL = json['DoctorImageURL']; doctorName = json['DoctorName']; diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index 9355daf0..51537ef7 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/model/feedback/request_insert_coc_item.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -11,14 +12,14 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; class FeedbackService extends BaseService { List cOCItemList = List(); RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem(); - List appointHistoryList = List(); + List appointHistoryList = List(); Future sendCOCItem( {String title, String details, String cOCTypeName, String attachment, - AppointmentHistory appointHistory}) async { + AppoitmentAllHistoryResultList appointHistory}) async { hasError = false; var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); @@ -45,7 +46,7 @@ class FeedbackService extends BaseService { if (appointHistory != null) { body['AppoinmentNo'] = appointHistory.appointmentNo; - body['AppointmentDate'] = DateUtil.convertDateToString(appointHistory.appointmentDate); + body['AppointmentDate'] = appointHistory.appointmentDate; body['ClinicID'] = appointHistory.clinicID; body['ClinicName'] = appointHistory.clinicName; body['DoctorID'] = appointHistory.doctorID; @@ -88,7 +89,7 @@ class FeedbackService extends BaseService { onSuccess: (dynamic response, int statusCode) { appointHistoryList = []; response['AppoimentAllHistoryResultList'].forEach((appoint) { - appointHistoryList.add(AppointmentHistory.fromJson(appoint)); + appointHistoryList.add(AppoitmentAllHistoryResultList.fromJson(appoint)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModels/feedback/feedback_view_model.dart b/lib/core/viewModels/feedback/feedback_view_model.dart index 6793c786..2a9dc90b 100644 --- a/lib/core/viewModels/feedback/feedback_view_model.dart +++ b/lib/core/viewModels/feedback/feedback_view_model.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/model/feedback/COC_items.dart'; import 'package:diplomaticquarterapp/core/service/feedback/feedback_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/feedback/appointment_history.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/cupertino.dart'; @@ -23,7 +24,7 @@ class FeedbackViewModel extends BaseViewModel { List get cOCItemList => _feedbackService.cOCItemList; - List get appointHistoryList => + List get appointHistoryList => _feedbackService.appointHistoryList; Future sendCOCItem( @@ -31,7 +32,7 @@ class FeedbackViewModel extends BaseViewModel { String details, String cOCTypeName, String attachment, - AppointmentHistory appointHistory}) async { + AppoitmentAllHistoryResultList appointHistory}) async { setState(ViewState.BusyLocal); await _feedbackService.sendCOCItem( title: title, diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index c37cf6ee..ff133d80 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart'; import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report_enh.dart'; import 'package:diplomaticquarterapp/core/model/radiology/final_radiology.dart'; +import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/appoDetailsButtons.dart'; @@ -685,7 +686,7 @@ class _AppointmentActionsState extends State { } navigateToInsertComplaint() { - Navigator.push(context, FadePage(page: FeedbackHomePage())); + Navigator.push(context, FadePage(page: FeedbackHomePage(messageType: MessageType.ComplaintOnAnAppointment,appointment: widget.appo,))); } rateAppointment() { diff --git a/lib/pages/feedback/appointment_history.dart b/lib/pages/feedback/appointment_history.dart index a1dcdd33..92a26eb1 100644 --- a/lib/pages/feedback/appointment_history.dart +++ b/lib/pages/feedback/appointment_history.dart @@ -5,7 +5,7 @@ class AppointmentHistory { int projectID; int appointmentNo; DateTime appointmentDate; - Null appointmentDateN; + dynamic appointmentDateN; int appointmentType; String bookDate; int patientType; @@ -26,14 +26,14 @@ class AppointmentHistory { String confirmedOn; int arrivalChangedBy; DateTime arrivedOn; - Null editedBy; - Null editedOn; - Null doctorName; - Null doctorNameN; + dynamic editedBy; + dynamic editedOn; + dynamic doctorName; + dynamic doctorNameN; String statusDesc; - Null statusDescN; + dynamic statusDescN; bool vitalStatus; - Null vitalSignAppointmentNo; + dynamic vitalSignAppointmentNo; int episodeID; int actualDoctorRate; String clinicName; @@ -55,8 +55,8 @@ class AppointmentHistory { bool isMedicalReportRequested; bool isOnlineCheckedIN; String latitude; - Null listHISGetContactLensPerscription; - Null listHISGetGlassPerscription; + dynamic listHISGetContactLensPerscription; + dynamic listHISGetGlassPerscription; String longitude; int nextAction; int noOfPatientsRate; diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart index f7f998bf..15f348f9 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -1,5 +1,7 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/feedback/send_feedback_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; @@ -10,6 +12,10 @@ import 'package:flutter/material.dart'; import 'status_feedback_page.dart'; class FeedbackHomePage extends StatefulWidget { + final AppoitmentAllHistoryResultList appointment; + final MessageType messageType; + const FeedbackHomePage({Key key, this.appointment, this.messageType= MessageType.NON}) : super(key: key); + @override _FeedbackHomePageState createState() => _FeedbackHomePageState(); } @@ -105,7 +111,7 @@ class _FeedbackHomePageState extends State child: TabBarView( physics: BouncingScrollPhysics(), controller: _tabController, - children: [SendFeedbackPage(), StatusFeedbackPage()], + children: [SendFeedbackPage(appointment: widget.appointment,messageType: widget.messageType,), StatusFeedbackPage()], ), ) ], diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 967a3874..bbef1757 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -1,6 +1,8 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; @@ -20,6 +22,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'dart:convert'; import 'dart:io'; @@ -27,6 +30,10 @@ import 'appointment_history.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; class SendFeedbackPage extends StatefulWidget { + final AppoitmentAllHistoryResultList appointment; + final MessageType messageType; + const SendFeedbackPage({Key key, this.appointment, this.messageType = MessageType.NON}) : super(key: key); + @override _SendFeedbackPageState createState() => _SendFeedbackPageState(); } @@ -36,7 +43,7 @@ class _SendFeedbackPageState extends State { TextEditingController messageController = TextEditingController(); List images = []; String title; - AppointmentHistory appointHistory; + AppoitmentAllHistoryResultList appointHistory; bool isShowListAppointHistory = true; String message; final formKey = GlobalKey(); @@ -73,17 +80,23 @@ class _SendFeedbackPageState extends State { setMessageType(MessageType messageType) { setState(() { this.messageType = messageType; + this.appointHistory = widget.appointment; }); } @override void initState() { + setState(() { + this.messageType = widget.messageType; + this.appointHistory = widget.appointment; + }); requestPermissions(); super.initState(); } @override Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); return BaseView( allowAny: true, builder: (_, model, widget) => AppScaffold( @@ -144,14 +157,59 @@ class _SendFeedbackPageState extends State { InkWell( onTap: () { setState(() { - isShowListAppointHistory = true; + isShowListAppointHistory = true; }); }, child: Container( margin: EdgeInsets.all(8.0), - color: Colors.white, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8) + ), child: Row( children: [ + Container( + width: projectViewModel.isArabic ? 27 : 20, + height: projectViewModel.isArabic ? 105 : 90, + decoration: BoxDecoration( + //Colors.red[900] Color(0xff404545) + color: appointHistory.isLiveCareAppointment + ? Color(0xff404545) + : !appointHistory.isInOutPatient + ? Colors.red[900] + : Theme.of(context).primaryColor, + borderRadius: BorderRadius.only( + topLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + bottomLeft: projectViewModel.isArabic + ? Radius.circular(0) + : Radius.circular(8), + topRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + bottomRight: projectViewModel.isArabic + ? Radius.circular(8) + : Radius.circular(0), + ), + ), + child: RotatedBox( + quarterTurns: 3, + child: Center( + child: Text( + appointHistory.isLiveCareAppointment + ? TranslationBase.of(context).liveCare.toUpperCase() + : !appointHistory.isInOutPatient + ? TranslationBase.of(context) + .inPatient + .toUpperCase() + : TranslationBase.of(context) + .outpatient + .toUpperCase(), + style: TextStyle(color: Colors.white,fontSize: 12), + ), + )), + ), Expanded( flex: 4, child: Column( @@ -182,9 +240,7 @@ class _SendFeedbackPageState extends State { ), Texts( DateUtil - .getMonthDayYearDateFormatted( - appointHistory - .appointmentDate), + .getMonthDayYearDateFormatted(DateUtil.convertStringToDate(appointHistory.appointmentDate)), variant: 'caption3', ), StarRating( @@ -278,10 +334,7 @@ class _SendFeedbackPageState extends State { bold: true, ), Texts( - DateUtil.getMonthDayYearDateFormatted(model - .appointHistoryList[ - index] - .appointmentDate), + DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(model.appointHistoryList[index].appointmentDate)), variant: 'caption3', ), StarRating( diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 196b5d79..dcedc714 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -47,7 +47,7 @@ class _PatientSickLeavePageState extends State { itemBuilder: (context, index) => DoctorCard( isLiveCareAppointment: model.sickLeaveList[index].isLiveCareAppointment, name: model.sickLeaveList[index].doctorName, - date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.sickLeaveList[index].requestDate):DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].requestDate), + date:projectViewModel.isArabic? DateUtil.getMonthDayYearDateFormattedAr(model.sickLeaveList[index].appointmentDate):DateUtil.getMonthDayYearDateFormatted(model.sickLeaveList[index].appointmentDate), profileUrl: model.sickLeaveList[index].doctorImageURL, rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), subName: model.sickLeaveList[index].projectName,