From 32e2732c43dc7a01d96438f8787394830690340c Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Sun, 16 Aug 2020 15:06:33 +0300 Subject: [PATCH] feedback service --- lib/config/config.dart | 1 + lib/core/service/base_service.dart | 18 +- lib/core/service/client/base_app_client.dart | 4 +- .../service/feedback/feedback_service.dart | 56 +++- lib/core/service/medical/labs_service.dart | 84 +++--- .../service/medical/radiology_service.dart | 26 +- .../feedback/feedback_view_model.dart | 21 +- lib/pages/feedback/appointment_history.dart | 276 ++++++++++++++++++ lib/pages/feedback/feedback_home_page.dart | 2 +- lib/pages/feedback/send_feedback_page.dart | 225 +++++++++++++- ...ck_page.dart => status_feedback_page.dart} | 20 +- lib/uitl/date_uitl.dart | 13 +- 12 files changed, 633 insertions(+), 113 deletions(-) create mode 100644 lib/pages/feedback/appointment_history.dart rename lib/pages/feedback/{Status_feedback_page.dart => status_feedback_page.dart} (83%) diff --git a/lib/config/config.dart b/lib/config/config.dart index 08d70c15..038ef7db 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -38,6 +38,7 @@ const SEND_RAD_REPORT_EMAIL = '/Notifications.svc/REST/SendRadReportEmail'; ///Feedback const SEND_FEEDBACK = '/COCWS.svc/REST/InsertCOCItemInSPList'; const GET_STATUS_FOR_COCO = '/COCWS.svc/REST/GetStatusforCOC'; +const GET_PATIENT_AppointmentHistory = '/Doctors.svc/REST/PateintHasAppoimentHistory'; ///VITAL SIGN const GET_PATIENT_VITAL_SIGN = '/Doctors.svc/REST/Doctor_GetPatientVitalSign'; diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index 828420c7..aee938c6 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -1,9 +1,23 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'client/base_app_client.dart'; -class BaseService{ +class BaseService { String error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); + AuthenticatedUser user; -} \ No newline at end of file + AppSharedPreferences sharedPref = AppSharedPreferences(); + + BaseService() { + getUser(); + } + + getUser() async { + user = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 05cb0f8b..edf2b9c6 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -31,8 +31,8 @@ class BaseAppClient { body['LanguageID'] = LANGUAGE; body['IPAdress'] = IP_ADDRESS; body['generalid'] = GENERAL_ID; - // body['PatientOutSA'] = PATIENT_OUT_SA; - body['SessionID'] = null; //SESSION_ID; + body['PatientOutSA'] = PATIENT_OUT_SA; + body['SessionID'] = SESSION_ID; body['isDentalAllowedBackend'] = IS_DENTAL_ALLOWED_BACKEND; body['DeviceTypeID'] = DeviceTypeID; body['PatientType'] = PATIENT_TYPE; diff --git a/lib/core/service/feedback/feedback_service.dart b/lib/core/service/feedback/feedback_service.dart index eaf2f94a..39065f48 100644 --- a/lib/core/service/feedback/feedback_service.dart +++ b/lib/core/service/feedback/feedback_service.dart @@ -4,16 +4,20 @@ import 'package:diplomaticquarterapp/config/config.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/pages/feedback/appointment_history.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; class FeedbackService extends BaseService { List cOCItemList = List(); RequestInsertCOCItem _requestInsertCOCItem = RequestInsertCOCItem(); + List appointHistoryList = List(); Future sendCOCItem( {String title, String details, String cOCTypeName, - String attachment}) async { + String attachment, + AppointmentHistory appointHistory}) async { hasError = false; _requestInsertCOCItem.attachment = attachment; @@ -21,23 +25,35 @@ class FeedbackService extends BaseService { _requestInsertCOCItem.details = details; _requestInsertCOCItem.cOCTypeName = cOCTypeName; _requestInsertCOCItem.formTypeID = cOCTypeName; - _requestInsertCOCItem.mobileNo = - "966537503378"; //TODO Change it to be dynamic + _requestInsertCOCItem.mobileNo = user.mobileNumber; _requestInsertCOCItem.isUserLoggedIn = true; - _requestInsertCOCItem.projectID = 1231755; - _requestInsertCOCItem.patientName = "TAMER FANASHEH"; + _requestInsertCOCItem.projectID = user.projectID; + _requestInsertCOCItem.patientName = user.firstName + " " + user.lastName; _requestInsertCOCItem.fileName = ""; + _requestInsertCOCItem.appVersion = VERSION_ID; _requestInsertCOCItem.uILanguage = "ar"; //TODO Change it to be dynamic _requestInsertCOCItem.browserInfo = Platform.localHostname; _requestInsertCOCItem.deviceInfo = Platform.localHostname; _requestInsertCOCItem.resolution = "400x847"; _requestInsertCOCItem.projectID = 0; - _requestInsertCOCItem.identificationNo = 2344670985; + _requestInsertCOCItem.identificationNo = + int.parse(user.patientIdentificationNo); + + final Map body = _requestInsertCOCItem.toJson(); + + if (appointHistory != null) { + body['AppoinmentNo'] = appointHistory.appointmentNo; + body['AppointmentDate'] = + DateUtil.convertDateToString(appointHistory.appointmentDate); + body['ClinicID'] = appointHistory.clinicID; + body['ClinicName'] = appointHistory.clinicName; + body['DoctorID'] = appointHistory.doctorID; + body['DoctorName'] = appointHistory.doctorNameObj; + body['ProjectName'] = appointHistory.projectName; + } await baseAppClient - .post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) { - var asd = ""; - }, + .post(SEND_FEEDBACK, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -46,9 +62,9 @@ class FeedbackService extends BaseService { Future getStatusCOC() async { hasError = false; - Map body = new Map(); - body['IdentificationNo'] = '2344670985'; - body['MobileNo'] = '966537503378'; + Map body = new Map(); + body['IdentificationNo'] = user.patientIdentificationNo; + body['MobileNo'] = user.mobileNumber; body['Searching_type'] = '1'; await baseAppClient.post(GET_STATUS_FOR_COCO, @@ -62,4 +78,20 @@ class FeedbackService extends BaseService { super.error = error; }, body: body); } + + Future getPatentAppointmentHistory() async { + hasError = false; + Map body = new Map(); + body['IsComingFromCOC'] = true; + baseAppClient.post(GET_PATIENT_AppointmentHistory, + onSuccess: (dynamic response, int statusCode) { + appointHistoryList = []; + response['AppoimentAllHistoryResultList'].forEach((appoint) { + appointHistoryList.add(AppointmentHistory.fromJson(appoint)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index b1a57c89..98f8110e 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -8,78 +8,74 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; class LabsService extends BaseService { - - RequestPatientLabOrders _requestPatientLabOrders = RequestPatientLabOrders(); List patientLabOrdersList = List(); - Future getPatientLabOrdersList() async { await baseAppClient.post(GET_Patient_LAB_ORDERS, onSuccess: (dynamic response, int statusCode) { - patientLabOrdersList.clear(); - response['ListPLO'].forEach((hospital) { - patientLabOrdersList - .add(PatientLabOrders.fromJson(hospital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _requestPatientLabOrders.toJson()); + patientLabOrdersList.clear(); + response['ListPLO'].forEach((hospital) { + patientLabOrdersList.add(PatientLabOrders.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPatientLabOrders.toJson()); } - - RequestPatientLabSpecialResult _requestPatientLabSpecialResult = RequestPatientLabSpecialResult(); - + RequestPatientLabSpecialResult _requestPatientLabSpecialResult = + RequestPatientLabSpecialResult(); List patientLabSpecialResult = List(); Future getLaboratoryResult( - {String projectID, int clinicID, String invoiceNo, String orderNo}) async { - hasError = false; + {String projectID, + int clinicID, + String invoiceNo, + String orderNo}) async { + hasError = false; _requestPatientLabSpecialResult.projectID = projectID; _requestPatientLabSpecialResult.clinicID = clinicID; - _requestPatientLabSpecialResult.invoiceNo = invoiceNo;//'1800296522';//; + _requestPatientLabSpecialResult.invoiceNo = invoiceNo; //'1800296522';//; _requestPatientLabSpecialResult.orderNo = orderNo; await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, onSuccess: (dynamic response, int statusCode) { - patientLabSpecialResult.clear(); - response['ListPLSR'].forEach((hospital) { - patientLabSpecialResult - .add(PatientLabSpecialResult.fromJson(hospital)); - }); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _requestPatientLabSpecialResult.toJson()); + patientLabSpecialResult.clear(); + response['ListPLSR'].forEach((hospital) { + patientLabSpecialResult.add(PatientLabSpecialResult.fromJson(hospital)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestPatientLabSpecialResult.toJson()); } - RequestSendLabReportEmail _requestSendLabReportEmail = RequestSendLabReportEmail(); - - Future sendLabReportEmail( - {PatientLabOrders patientLabOrder}) async { + RequestSendLabReportEmail _requestSendLabReportEmail = + RequestSendLabReportEmail(); + Future sendLabReportEmail({PatientLabOrders patientLabOrder}) async { _requestSendLabReportEmail.projectID = patientLabOrder.projectID; _requestSendLabReportEmail.invoiceNo = patientLabOrder.invoiceNo; _requestSendLabReportEmail.doctorName = patientLabOrder.doctorName; _requestSendLabReportEmail.clinicName = patientLabOrder.clinicDescription; - _requestSendLabReportEmail.patientName = 'Tamer';//TODO Change it - _requestSendLabReportEmail.patientIditificationNum = '2344670985';//TODO change it - _requestSendLabReportEmail.dateofBirth = '/Date(536743800000+0300)/';//TODO change it - _requestSendLabReportEmail.to = 'Tamer.fanasheh@gmail.com';//TODO change it - _requestSendLabReportEmail.orderDate = '${patientLabOrder.orderDate.year}-${patientLabOrder.orderDate.month}-${patientLabOrder.orderDate.day}'; - _requestSendLabReportEmail.patientMobileNumber = '537503378';//TODO change it + _requestSendLabReportEmail.patientName = user.firstName + user.lastName; + _requestSendLabReportEmail.patientIditificationNum = + user.patientIdentificationNo; + _requestSendLabReportEmail.dateofBirth = user.dateofBirth; + _requestSendLabReportEmail.to = user.emailAddress; + _requestSendLabReportEmail.orderDate = + '${patientLabOrder.orderDate.year}-${patientLabOrder.orderDate.month}-${patientLabOrder.orderDate.day}'; + _requestSendLabReportEmail.patientMobileNumber = user.mobileNumber; _requestSendLabReportEmail.projectName = patientLabOrder.projectName; await baseAppClient.post(GET_Patient_LAB_SPECIAL_RESULT, onSuccess: (dynamic response, int statusCode) { - AppToast.showSuccessToast(message: 'A copy has been sent to the email'); - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: _requestSendLabReportEmail.toJson()); + AppToast.showSuccessToast(message: 'A copy has been sent to the email'); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestSendLabReportEmail.toJson()); } - - } diff --git a/lib/core/service/medical/radiology_service.dart b/lib/core/service/medical/radiology_service.dart index 3c22eab7..b3cb737b 100644 --- a/lib/core/service/medical/radiology_service.dart +++ b/lib/core/service/medical/radiology_service.dart @@ -7,7 +7,7 @@ class RadiologyService extends BaseService { List finalRadiologyList = List(); String url = ''; - Future getRadImageURL({int invoiceNo, int lineItem,int projectId}) async { + Future getRadImageURL({int invoiceNo, int lineItem, int projectId}) async { hasError = false; final Map body = new Map(); body['InvoiceNo'] = invoiceNo; @@ -24,7 +24,7 @@ class RadiologyService extends BaseService { }, body: body); } - Future getPatientRadOrders () async { + Future getPatientRadOrders() async { hasError = false; await baseAppClient.post(GET_PATIENT_ORDERS, onSuccess: (dynamic response, int statusCode) { @@ -55,29 +55,25 @@ class RadiologyService extends BaseService { RequestSendRadReportEmail _requestSendRadReportEmail = RequestSendRadReportEmail(); - Future sendRadReportEmail( - {FinalRadiology finalRadiology}) async { + Future sendRadReportEmail({FinalRadiology finalRadiology}) async { _requestSendRadReportEmail.projectID = finalRadiology.projectID; _requestSendRadReportEmail.clinicName = finalRadiology.clinicDescription; _requestSendRadReportEmail.invoiceNo = finalRadiology.invoiceNo; _requestSendRadReportEmail.setupID = finalRadiology.setupID; _requestSendRadReportEmail.doctorName = finalRadiology.doctorName; _requestSendRadReportEmail.orderDate = '${finalRadiology.orderDate.year}-${finalRadiology.orderDate.month}-${finalRadiology.orderDate.day}'; - _requestSendRadReportEmail.patientIditificationNum = '2344670985';//TODO change it - _requestSendRadReportEmail.patientMobileNumber = '537503378';//TODO change it - _requestSendRadReportEmail.patientName = 'TAMER FANASHE';//TODO change it - _requestSendRadReportEmail.patientIditificationNum = '2344670985';//TODO change it + _requestSendRadReportEmail.patientIditificationNum = user.patientIdentificationNo; + _requestSendRadReportEmail.patientMobileNumber = user.mobileNumber; + _requestSendRadReportEmail.patientName = user.firstName + " " + user.lastName; + _requestSendRadReportEmail.patientIditificationNum = user.patientIdentificationNo; _requestSendRadReportEmail.projectName = finalRadiology.projectName; - _requestSendRadReportEmail.radResult = 'asd';//finalRadiology.reportData; - _requestSendRadReportEmail.to = 'Tamer.fanasheh@gmail.com'; - _requestSendRadReportEmail.dateofBirth = '/Date(536743800000+0300)/'; + _requestSendRadReportEmail.radResult = 'asd'; //finalRadiology.reportData; + _requestSendRadReportEmail.to = user.emailAddress; + _requestSendRadReportEmail.dateofBirth = user.dateofBirth; hasError = false; await baseAppClient.post(SEND_RAD_REPORT_EMAIL, - isAllowAny: true, - onSuccess: (dynamic response, int statusCode) { - - }, + isAllowAny: true, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; diff --git a/lib/core/viewModels/feedback/feedback_view_model.dart b/lib/core/viewModels/feedback/feedback_view_model.dart index 1176caf7..5f464322 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/pages/feedback/appointment_history.dart'; import '../../../locator.dart'; @@ -10,17 +11,22 @@ class FeedbackViewModel extends BaseViewModel { List get cOCItemList => _feedbackService.cOCItemList; + List get appointHistoryList => + _feedbackService.appointHistoryList; + Future sendCOCItem( {String title, String details, String cOCTypeName, - String attachment}) async { + String attachment, + AppointmentHistory appointHistory}) async { setState(ViewState.BusyLocal); await _feedbackService.sendCOCItem( title: title, details: details, cOCTypeName: cOCTypeName, - attachment: attachment); + attachment: attachment, + appointHistory: appointHistory); if (_feedbackService.hasError) { error = _feedbackService.error; setState(ViewState.ErrorLocal); @@ -41,4 +47,15 @@ class FeedbackViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + getPatentAppointmentHistory() async { + setState(ViewState.Busy); + await _feedbackService.getPatentAppointmentHistory(); + if (_feedbackService.hasError) { + error = _feedbackService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } } diff --git a/lib/pages/feedback/appointment_history.dart b/lib/pages/feedback/appointment_history.dart new file mode 100644 index 00000000..cfbd5800 --- /dev/null +++ b/lib/pages/feedback/appointment_history.dart @@ -0,0 +1,276 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class AppointmentHistory { + String setupID; + int projectID; + int appointmentNo; + DateTime appointmentDate; + Null appointmentDateN; + int appointmentType; + String bookDate; + int patientType; + int patientID; + int clinicID; + int doctorID; + String endDate; + String startTime; + String endTime; + int status; + int visitType; + int visitFor; + int patientStatusType; + int companyID; + int bookedBy; + String bookedOn; + int confirmedBy; + String confirmedOn; + int arrivalChangedBy; + String arrivedOn; + Null editedBy; + Null editedOn; + Null doctorName; + Null doctorNameN; + String statusDesc; + Null statusDescN; + bool vitalStatus; + Null vitalSignAppointmentNo; + int episodeID; + int actualDoctorRate; + String clinicName; + bool complainExists; + String doctorImageURL; + String doctorNameObj; + int doctorRate; + List doctorSpeciality; + String doctorTitle; + int gender; + String genderDescription; + bool iSAllowOnlineCheckedIN; + bool isActiveDoctor; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + int isFollowup; + bool isLiveCareAppointment; + bool isMedicalReportRequested; + bool isOnlineCheckedIN; + String latitude; + Null listHISGetContactLensPerscription; + Null listHISGetGlassPerscription; + String longitude; + int nextAction; + int noOfPatientsRate; + int originalClinicID; + int originalProjectID; + String projectName; + String qR; + int remaniningHoursTocanPay; + bool sMSButtonVisable; + + AppointmentHistory( + {this.setupID, + this.projectID, + this.appointmentNo, + this.appointmentDate, + this.appointmentDateN, + this.appointmentType, + this.bookDate, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.endDate, + this.startTime, + this.endTime, + this.status, + this.visitType, + this.visitFor, + this.patientStatusType, + this.companyID, + this.bookedBy, + this.bookedOn, + this.confirmedBy, + this.confirmedOn, + this.arrivalChangedBy, + this.arrivedOn, + this.editedBy, + this.editedOn, + this.doctorName, + this.doctorNameN, + this.statusDesc, + this.statusDescN, + this.vitalStatus, + this.vitalSignAppointmentNo, + this.episodeID, + this.actualDoctorRate, + this.clinicName, + this.complainExists, + this.doctorImageURL, + this.doctorNameObj, + this.doctorRate, + this.doctorSpeciality, + this.doctorTitle, + this.gender, + this.genderDescription, + this.iSAllowOnlineCheckedIN, + this.isActiveDoctor, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isFollowup, + this.isLiveCareAppointment, + this.isMedicalReportRequested, + this.isOnlineCheckedIN, + this.latitude, + this.listHISGetContactLensPerscription, + this.listHISGetGlassPerscription, + this.longitude, + this.nextAction, + this.noOfPatientsRate, + this.originalClinicID, + this.originalProjectID, + this.projectName, + this.qR, + this.remaniningHoursTocanPay, + this.sMSButtonVisable}); + + AppointmentHistory.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + appointmentNo = json['AppointmentNo']; + appointmentDate = DateUtil.convertStringToDate(json['AppointmentDate']); + appointmentDateN = json['AppointmentDateN']; + appointmentType = json['AppointmentType']; + bookDate = json['BookDate']; + patientType = json['PatientType']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + endDate = json['EndDate']; + startTime = json['StartTime']; + endTime = json['EndTime']; + status = json['Status']; + visitType = json['VisitType']; + visitFor = json['VisitFor']; + patientStatusType = json['PatientStatusType']; + companyID = json['CompanyID']; + bookedBy = json['BookedBy']; + bookedOn = json['BookedOn']; + confirmedBy = json['ConfirmedBy']; + confirmedOn = json['ConfirmedOn']; + arrivalChangedBy = json['ArrivalChangedBy']; + arrivedOn = json['ArrivedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + doctorName = json['DoctorName']; + doctorNameN = json['DoctorNameN']; + statusDesc = json['StatusDesc']; + statusDescN = json['StatusDescN']; + vitalStatus = json['VitalStatus']; + vitalSignAppointmentNo = json['VitalSignAppointmentNo']; + episodeID = json['EpisodeID']; + actualDoctorRate = json['ActualDoctorRate']; + clinicName = json['ClinicName']; + complainExists = json['ComplainExists']; + doctorImageURL = json['DoctorImageURL']; + doctorNameObj = json['DoctorNameObj']; + doctorRate = json['DoctorRate']; +// doctorSpeciality = json['DoctorSpeciality'].cast(); + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + iSAllowOnlineCheckedIN = json['ISAllowOnlineCheckedIN']; + isActiveDoctor = json['IsActiveDoctor']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isFollowup = json['IsFollowup']; + isLiveCareAppointment = json['IsLiveCareAppointment']; + isMedicalReportRequested = json['IsMedicalReportRequested']; + isOnlineCheckedIN = json['IsOnlineCheckedIN']; + latitude = json['Latitude']; + listHISGetContactLensPerscription = + json['List_HIS_GetContactLensPerscription']; + listHISGetGlassPerscription = json['List_HIS_GetGlassPerscription']; + longitude = json['Longitude']; + nextAction = json['NextAction']; + noOfPatientsRate = json['NoOfPatientsRate']; + originalClinicID = json['OriginalClinicID']; + originalProjectID = json['OriginalProjectID']; + projectName = json['ProjectName']; + qR = json['QR']; + remaniningHoursTocanPay = json['RemaniningHoursTocanPay']; + sMSButtonVisable = json['SMSButtonVisable']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['AppointmentNo'] = this.appointmentNo; + data['AppointmentDate'] = this.appointmentDate; + data['AppointmentDateN'] = this.appointmentDateN; + data['AppointmentType'] = this.appointmentType; + data['BookDate'] = this.bookDate; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['EndDate'] = this.endDate; + data['StartTime'] = this.startTime; + data['EndTime'] = this.endTime; + data['Status'] = this.status; + data['VisitType'] = this.visitType; + data['VisitFor'] = this.visitFor; + data['PatientStatusType'] = this.patientStatusType; + data['CompanyID'] = this.companyID; + data['BookedBy'] = this.bookedBy; + data['BookedOn'] = this.bookedOn; + data['ConfirmedBy'] = this.confirmedBy; + data['ConfirmedOn'] = this.confirmedOn; + data['ArrivalChangedBy'] = this.arrivalChangedBy; + data['ArrivedOn'] = this.arrivedOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + data['DoctorName'] = this.doctorName; + data['DoctorNameN'] = this.doctorNameN; + data['StatusDesc'] = this.statusDesc; + data['StatusDescN'] = this.statusDescN; + data['VitalStatus'] = this.vitalStatus; + data['VitalSignAppointmentNo'] = this.vitalSignAppointmentNo; + data['EpisodeID'] = this.episodeID; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['ClinicName'] = this.clinicName; + data['ComplainExists'] = this.complainExists; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorNameObj'] = this.doctorNameObj; + data['DoctorRate'] = this.doctorRate; + data['DoctorSpeciality'] = this.doctorSpeciality; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['ISAllowOnlineCheckedIN'] = this.iSAllowOnlineCheckedIN; + data['IsActiveDoctor'] = this.isActiveDoctor; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsFollowup'] = this.isFollowup; + data['IsLiveCareAppointment'] = this.isLiveCareAppointment; + data['IsMedicalReportRequested'] = this.isMedicalReportRequested; + data['IsOnlineCheckedIN'] = this.isOnlineCheckedIN; + data['Latitude'] = this.latitude; + data['List_HIS_GetContactLensPerscription'] = + this.listHISGetContactLensPerscription; + data['List_HIS_GetGlassPerscription'] = this.listHISGetGlassPerscription; + data['Longitude'] = this.longitude; + data['NextAction'] = this.nextAction; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['OriginalClinicID'] = this.originalClinicID; + data['OriginalProjectID'] = this.originalProjectID; + data['ProjectName'] = this.projectName; + data['QR'] = this.qR; + data['RemaniningHoursTocanPay'] = this.remaniningHoursTocanPay; + data['SMSButtonVisable'] = this.sMSButtonVisable; + return data; + } +} diff --git a/lib/pages/feedback/feedback_home_page.dart b/lib/pages/feedback/feedback_home_page.dart index 92bfaff7..68f0bfab 100644 --- a/lib/pages/feedback/feedback_home_page.dart +++ b/lib/pages/feedback/feedback_home_page.dart @@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'Status_feedback_page.dart'; +import 'status_feedback_page.dart'; class FeedbackHomePage extends StatefulWidget { @override diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 801a0a37..436dae62 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -2,15 +2,21 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/feedback/feedback_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/bottom_options/BottomSheet.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; +import 'package:diplomaticquarterapp/widgets/others/StarRating.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'appointment_history.dart'; + enum MessageType { ComplaintOnAnAppointment, ComplaintWithoutAppointment, @@ -32,7 +38,8 @@ class _SendFeedbackPageState extends State { String _selected = "not selected"; List images = []; String title; - + AppointmentHistory appointHistory; + bool isShowListAppointHistory = true; String message; final formKey = GlobalKey(); @@ -63,7 +70,7 @@ class _SendFeedbackPageState extends State { ), InkWell( onTap: () { - confirmBox(); + confirmBox(model); }, child: Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), @@ -93,6 +100,189 @@ class _SendFeedbackPageState extends State { ), ), ), + if (appointHistory != null) + InkWell( + onTap: () { + setState(() { + isShowListAppointHistory = true; + }); + }, + child: Container( + margin: EdgeInsets.all(8.0), + color: Colors.white, + child: Row( + children: [ + Expanded( + flex: 4, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Expanded( + flex: 1, + child: LargeAvatar( + name: appointHistory.doctorNameObj, + url: appointHistory.doctorImageURL, + ), + ), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Texts( + appointHistory.doctorNameObj, + bold: true, + ), + Texts( + DateUtil + .getMonthDayYearDateFormatted( + appointHistory + .appointmentDate), + variant: 'caption3', + ), + StarRating( + totalAverage: appointHistory + .doctorRate + .toDouble(), + forceStars: true), + ], + ), + ), + ), + ], + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Center( + child: Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), + ) + ], + ), + ), + ), + if (messageType == MessageType.ComplaintOnAnAppointment && + model.appointHistoryList.length != 0 && + isShowListAppointHistory) + Container( + height: MediaQuery.of(context).size.height * 0.4, + child: ListView.builder( + itemCount: model.appointHistoryList.length, + itemBuilder: (context, index) => InkWell( + onTap: () { + setState(() { + appointHistory = model.appointHistoryList[index]; + isShowListAppointHistory = false; + }); + }, + child: Container( + margin: EdgeInsets.only(left: 8, right: 8), + color: Colors.white, + child: Column( + children: [ + Row( + children: [ + Expanded( + flex: 4, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Expanded( + flex: 1, + child: LargeAvatar( + name: model + .appointHistoryList[ + index] + .doctorNameObj, + url: model + .appointHistoryList[ + index] + .doctorImageURL, + ), + ), + Expanded( + flex: 4, + child: Container( + margin: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Texts( + model + .appointHistoryList[ + index] + .doctorNameObj, + bold: true, + ), + Texts( + DateUtil.getMonthDayYearDateFormatted(model + .appointHistoryList[ + index] + .appointmentDate), + variant: 'caption3', + ), + StarRating( + totalAverage: model + .appointHistoryList[ + index] + .doctorRate + .toDouble(), + forceStars: true), + ], + ), + ), + ), + ], + ), + ), + ], + ), + ), + Expanded( + flex: 1, + child: Center( + child: Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), + ) + ], + ), + SizedBox( + height: 5, + ), + Divider( + height: 0.5, + color: Colors.grey[400], + ) + ], + ), + ), + ), + ), + ), Container( margin: EdgeInsets.only(left: 10, right: 10, top: 15), child: TextFields( @@ -219,7 +409,11 @@ class _SendFeedbackPageState extends State { title: titleController.text, attachment: images.length > 0 ? images[0] : "", details: messageController.text, - cOCTypeName: getCOCName()) + cOCTypeName: getCOCName(), + appointHistory: messageType == + MessageType.ComplaintOnAnAppointment + ? appointHistory + : null) .then((value) { if (value) { setState(() { @@ -228,11 +422,10 @@ class _SendFeedbackPageState extends State { images = []; messageType = MessageType.NON; }); - AppToast.showSuccessToast(message: "Your feedback was sended"); - + AppToast.showSuccessToast( + message: "Your feedback was send"); } else { AppToast.showErrorToast(message: model.error); - } }); else { @@ -272,11 +465,21 @@ class _SendFeedbackPageState extends State { } // Show Dialog function - void confirmBox() { + void confirmBox(FeedbackViewModel model) { showDialog( context: context, child: FeedbackTypeDialog( - onValueChange: _onValueChange, + onValueChange: (MessageType value) { + if (value == MessageType.ComplaintOnAnAppointment) { + model.getPatentAppointmentHistory(); + setState(() { + appointHistory = null; + }); + } + setState(() { + messageType = value; + }); + }, initialValue: messageType, onValueSelected: () { setState(() { @@ -304,12 +507,6 @@ class _SendFeedbackPageState extends State { }, )); } - - void _onValueChange(MessageType value) { - setState(() { - messageType = value; - }); - } } class FeedbackTypeDialog extends StatefulWidget { diff --git a/lib/pages/feedback/Status_feedback_page.dart b/lib/pages/feedback/status_feedback_page.dart similarity index 83% rename from lib/pages/feedback/Status_feedback_page.dart rename to lib/pages/feedback/status_feedback_page.dart index 7fc01d06..20ef4bed 100644 --- a/lib/pages/feedback/Status_feedback_page.dart +++ b/lib/pages/feedback/status_feedback_page.dart @@ -21,7 +21,7 @@ class _StatusFeedbackPageState extends State { builder: (_, model, widget) => AppScaffold( baseViewModel: model, body: Container( - margin: EdgeInsets.only(top: 8.0,left: 8.0,right: 8.0,bottom: MediaQuery.of(context).size.height * 0.1 ), + margin: EdgeInsets.only(top: 8.0,left: 8.0,right: 8.0 ), padding: EdgeInsets.all(15.0), child: ListView.builder( itemCount: model.cOCItemList.length, @@ -74,24 +74,6 @@ class _StatusFeedbackPageState extends State { ), )), ), - bottomSheet: Container( - height: MediaQuery.of(context).size.height * 0.13, - width: double.infinity, - padding: EdgeInsets.all(8.0), - child: Center( - child: Container( - height: MediaQuery.of(context).size.height * 0.1, - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - label: 'Search', - loading: model.state == ViewState.BusyLocal, - onTap: () { - //TODO When come back - }, - ), - ), - ), - ), ), ); } diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index f59e7cb1..55bb4593 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -1,9 +1,10 @@ import 'package:intl/intl.dart'; + class DateUtil { /// convert String To Date function /// [date] String we want to convert static DateTime convertStringToDate(String date) { - if(date!=null) { + if (date != null) { const start = "/Date("; const end = "+0300)"; final startIndex = date.indexOf(start); @@ -13,10 +14,18 @@ class DateUtil { date.substring(startIndex + start.length, endIndex), ), ); - }else + } else return DateTime.now(); } + static String convertDateToString(DateTime date) { + const start = "/Date("; + const end = "+0300)"; + int milliseconds = date.millisecondsSinceEpoch; + + return start + "$milliseconds" + end; + } + /// check Date /// [dateString] String we want to convert static String checkDate(DateTime checkedTime) {