diff --git a/assets/images/new-design/calendar.png b/assets/images/new-design/calendar.png new file mode 100644 index 00000000..ac72b030 Binary files /dev/null and b/assets/images/new-design/calendar.png differ diff --git a/assets/images/new-design/covid-19-big-banner-bg.png b/assets/images/new-design/covid-19-big-banner-bg.png new file mode 100644 index 00000000..a66d6815 Binary files /dev/null and b/assets/images/new-design/covid-19-big-banner-bg.png differ diff --git a/assets/images/new-design/covid_bg_transparent.png b/assets/images/new-design/covid_bg_transparent.png new file mode 100644 index 00000000..cd5f12f1 Binary files /dev/null and b/assets/images/new-design/covid_bg_transparent.png differ diff --git a/assets/images/new-design/hmg_full_logo_hd_white.png b/assets/images/new-design/hmg_full_logo_hd_white.png new file mode 100644 index 00000000..e4d7ae60 Binary files /dev/null and b/assets/images/new-design/hmg_full_logo_hd_white.png differ diff --git a/assets/images/new-design/waiting_for_doctor.png b/assets/images/new-design/waiting_for_doctor.png new file mode 100644 index 00000000..c330c25a Binary files /dev/null and b/assets/images/new-design/waiting_for_doctor.png differ diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 0c67376e..903def2a 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -1,5 +1,8 @@ - + + aps-environment + development + diff --git a/lib/config/config.dart b/lib/config/config.dart index 1342c28e..36e1b086 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -156,6 +156,9 @@ const GET_PATIENT_APPOINTMENT_CURFEW_HISTORY = const CONFIRM_APPOINTMENT = "Services/MobileNotifications.svc/REST/ConfirmAppointment"; +const INSERT_VIDA_REQUEST = + "Services/ER_VirtualCall.svc/REST/PatientER_VidaRequestInseart"; + //URL to cancel appointment const CANCEL_APPOINTMENT = "Services/Doctors.svc/REST/CancelAppointment"; @@ -185,6 +188,22 @@ const SEND_CALL_REQUEST = 'Services/Doctors.svc/REST/InsertCallInfo'; const GET_LIVECARE_CLINICS = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinics'; + +const GET_LIVECARE_SCHEDULE_CLINICS = + 'Services/Doctors.svc/REST/PatientER_GetClinicsHaveSchedule'; + +const GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST = + 'Services/Doctors.svc/REST/PatientER_GetDoctorByClinicID'; + +const GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS = + 'Services/Doctors.svc/REST/PatientER_GetDoctorFreeSlots'; + +const INSERT_LIVECARE_SCHEDULE_APPOINTMENT = + 'Services/Doctors.svc/REST/InsertSpecificAppoitmentForSchedule'; + +const GET_PATIENT_SHARE_LIVECARE = + "Services/Doctors.svc/REST/GetCheckinScreenAppointmentDetailsByAppointmentNOForLiveCare"; + const GET_LIVECARE_CLINIC_TIMING = 'Services/ER_VirtualCall.svc/REST/PatientER_GetClinicsServiceTimingsSchedule'; @@ -245,6 +264,14 @@ const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_ const SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/SendActivationCodeForAdvancePayment'; const CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT = 'Services/Authentication.svc/REST/CheckActivationCodeForAdvancePayment'; + +const GET_COVID_DRIVETHRU_PROJECT_LIST = 'Services/Doctors.svc/REST/COVID19_ProjectDriveThroughTestingCenter'; + +const GET_COVID_DRIVETHRU_PAYMENT_INFO = 'Services/Doctors.svc/REST/COVID19_GetPatientPaymentInormation'; + +const GET_COVID_DRIVETHRU_FREE_SLOTS = 'Services/Doctors.svc/REST/COVID19_GetFreeSlots'; + + ///My Trackers const GET_DIABETIC_RESULT_AVERAGE='Services/Patients.svc/REST/Patient_GetDiabeticResultAverage'; const GET_DIABTEC_RESULT='Services/Patients.svc/REST/Patient_GetDiabtecResults'; @@ -291,6 +318,7 @@ const GET_ALL_CITIES = 'services/Lists.svc/rest/GetAllCities'; const CREATE_E_REFERRAL = "Services/Patients.svc/REST/CreateEReferral"; const GET_E_REFERRALS = "Services/Patients.svc/REST/GetEReferrals"; + const TIMER_MIN = 10; class AppGlobal { @@ -313,6 +341,7 @@ class AppGlobal { request.TokenID = "@dm!n"; request.isDentalAllowedBackend = false; request.DeviceTypeID = Platform.isIOS ? 1 : 2; + request.DeviceType = Platform.isIOS ? "iOS" : "Android"; return request; } diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 40840423..2f958d56 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -47,6 +47,8 @@ const Map> localizedValues = { }, 'confirmAppo': {'en': 'Confirm Appointment', 'ar': 'تأكيد الموعد'}, 'confirm': {'en': 'Confirm', 'ar': 'تأكيد'}, + 'confirmLiveCare': {'en': 'Confirm LiveCare', 'ar': 'تأكيد لايف كير'}, + 'waitingForDoctor': {'en': 'Waiting for doctor', 'ar': 'في انتظار الطبيب'}, 'appointment': {'en': 'Appointment', 'ar': 'الموعد'}, 'confirmLater': {'en': 'Confirm Later', 'ar': 'تأكيد لاحقا'}, 'todoList': {'en': 'Todo List', 'ar': 'مهامي'}, @@ -58,6 +60,7 @@ const Map> localizedValues = { 'viewQR': {'en': 'View QR Code', 'ar': 'عرض رمز الاستجابة السريعة'}, 'instruction': {'en': 'Instructions', 'ar': 'تعليمات'}, 'livecare': {'en': 'LiveCare', 'ar': 'لايف كير'}, + 'livecareAppo': {'en': 'LiveCare Appointment', 'ar': 'الموعد لايف كير'}, 'cancelAppoMsg': { 'en': 'Are you sure you want to cancel this appointment?', 'ar': 'هل أنت متأكد أنك تريد إلغاء هذا الموعد؟' diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 61e36022..8087a7f1 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -14,3 +14,4 @@ const FAMILY_FILE = 'family-file'; const USER_LAT = 'user-lat'; const USER_LONG = 'user-long'; const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; +const IS_LIVECARE_APPOINTMENT = 'is_livecare_appointment'; diff --git a/lib/models/Appointments/AppoimentAllHistoryResultList.dart b/lib/models/Appointments/AppoimentAllHistoryResultList.dart index 9ba1fb8e..20eace25 100644 --- a/lib/models/Appointments/AppoimentAllHistoryResultList.dart +++ b/lib/models/Appointments/AppoimentAllHistoryResultList.dart @@ -64,73 +64,75 @@ class AppoitmentAllHistoryResultList { String qR; int remaniningHoursTocanPay; bool sMSButtonVisable; + int serviceID; AppoitmentAllHistoryResultList( {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}); + 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, + this.serviceID}); AppoitmentAllHistoryResultList.fromJson(Map json) { setupID = json['SetupID']; @@ -173,7 +175,9 @@ class AppoitmentAllHistoryResultList { doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; doctorRate = json['DoctorRate']; - doctorSpeciality = json['DoctorSpeciality'] != null ?json['DoctorSpeciality'].cast() : ["null"]; + doctorSpeciality = json['DoctorSpeciality'] != null + ? json['DoctorSpeciality'].cast() + : ["null"]; doctorTitle = json['DoctorTitle']; gender = json['Gender']; genderDescription = json['GenderDescription']; @@ -188,7 +192,7 @@ class AppoitmentAllHistoryResultList { isOnlineCheckedIN = json['IsOnlineCheckedIN']; latitude = json['Latitude']; listHISGetContactLensPerscription = - json['List_HIS_GetContactLensPerscription']; + json['List_HIS_GetContactLensPerscription']; listHISGetGlassPerscription = json['List_HIS_GetGlassPerscription']; longitude = json['Longitude']; nextAction = json['NextAction']; @@ -199,6 +203,7 @@ class AppoitmentAllHistoryResultList { qR = json['QR']; remaniningHoursTocanPay = json['RemaniningHoursTocanPay']; sMSButtonVisable = json['SMSButtonVisable']; + serviceID = json['ServiceID']; } Map toJson() { @@ -269,6 +274,7 @@ class AppoitmentAllHistoryResultList { data['QR'] = this.qR; data['RemaniningHoursTocanPay'] = this.remaniningHoursTocanPay; data['SMSButtonVisable'] = this.sMSButtonVisable; + data['ServiceID'] = this.serviceID; return data; } } @@ -278,7 +284,8 @@ class PatientAppointmentList { List patientDoctorAppointmentList = List(); PatientAppointmentList( - {this.filterName, AppoitmentAllHistoryResultList patientDoctorAppointment}) { + {this.filterName, + AppoitmentAllHistoryResultList patientDoctorAppointment}) { patientDoctorAppointmentList.add(patientDoctorAppointment); } } diff --git a/lib/models/Appointments/InsertAppointmentRequest.dart b/lib/models/Appointments/InsertAppointmentRequest.dart index badbb6a7..383e2eb5 100644 --- a/lib/models/Appointments/InsertAppointmentRequest.dart +++ b/lib/models/Appointments/InsertAppointmentRequest.dart @@ -13,7 +13,6 @@ class InsertAppointmentRequest extends Request { bool IsVirtual; List GeneralProcedureList; String DeviceToken; - String DeviceType; bool IsForLiveCare; String OriginalClinicID; String OriginalProjectID; diff --git a/lib/models/Appointments/PatientShareResposne.dart b/lib/models/Appointments/PatientShareResposne.dart index e4a05e04..40670990 100644 --- a/lib/models/Appointments/PatientShareResposne.dart +++ b/lib/models/Appointments/PatientShareResposne.dart @@ -1,104 +1,108 @@ class PatientShareResponse { int advanceNumber; - String appointmentDate; + dynamic appointmentDate; int appointmentNo; int cashPrice; int cashPriceTax; int cashPriceWithTax; int clinicID; - String clinicName; + dynamic clinicName; int companyId; - String companyName; + dynamic companyName; int companyShareWithTax; - String doctorImageURL; - String doctorNameObj; - List doctorSpeciality; - Null errCode; + dynamic doctorImageURL; + dynamic doctorNameObj; + int doctorID; + List doctorSpeciality; + dynamic errCode; int groupID; bool iSAllowOnlineCheckedIN; - Null insurancePolicyNo; + dynamic insurancePolicyNo; bool isExcludedForOnlineCheckin; int isFollowup; bool isLiveCareAppointment; bool isOnlineCheckedIN; - String message; + dynamic message; int nextAction; - Null patientCardID; + dynamic patientCardID; int patientID; dynamic patientShare; dynamic patientShareWithTax; int patientStatusType; dynamic patientTaxAmount; - String patientType; + dynamic patientType; int paymentAmount; - String paymentDate; - Null paymentMethodName; - Null paymentReferenceNumber; + dynamic paymentDate; + dynamic paymentMethodName; + dynamic paymentReferenceNumber; int policyId; - String policyName; - String procedureName; + dynamic policyName; + dynamic procedureName; int projectID; - String projectName; - Null setupID; + dynamic projectName; + dynamic setupID; int sourceType; - String startTime; + dynamic startTime; int status; int statusCode; - Null statusDesc; - Null subPolicyNo; + dynamic statusDesc; + dynamic subPolicyNo; int userID; + int serviceID; PatientShareResponse( {this.advanceNumber, - this.appointmentDate, - this.appointmentNo, - this.cashPrice, - this.cashPriceTax, - this.cashPriceWithTax, - this.clinicID, - this.clinicName, - this.companyId, - this.companyName, - this.companyShareWithTax, - this.doctorImageURL, - this.doctorNameObj, - this.doctorSpeciality, - this.errCode, - this.groupID, - this.iSAllowOnlineCheckedIN, - this.insurancePolicyNo, - this.isExcludedForOnlineCheckin, - this.isFollowup, - this.isLiveCareAppointment, - this.isOnlineCheckedIN, - this.message, - this.nextAction, - this.patientCardID, - this.patientID, - this.patientShare, - this.patientShareWithTax, - this.patientStatusType, - this.patientTaxAmount, - this.patientType, - this.paymentAmount, - this.paymentDate, - this.paymentMethodName, - this.paymentReferenceNumber, - this.policyId, - this.policyName, - this.procedureName, - this.projectID, - this.projectName, - this.setupID, - this.sourceType, - this.startTime, - this.status, - this.statusCode, - this.statusDesc, - this.subPolicyNo, - this.userID}); + this.appointmentDate, + this.appointmentNo, + this.cashPrice, + this.cashPriceTax, + this.cashPriceWithTax, + this.clinicID, + this.clinicName, + this.companyId, + this.companyName, + this.companyShareWithTax, + this.doctorID, + this.doctorImageURL, + this.doctorNameObj, + this.doctorSpeciality, + this.errCode, + this.groupID, + this.iSAllowOnlineCheckedIN, + this.insurancePolicyNo, + this.isExcludedForOnlineCheckin, + this.isFollowup, + this.isLiveCareAppointment, + this.isOnlineCheckedIN, + this.message, + this.nextAction, + this.patientCardID, + this.patientID, + this.patientShare, + this.patientShareWithTax, + this.patientStatusType, + this.patientTaxAmount, + this.patientType, + this.paymentAmount, + this.paymentDate, + this.paymentMethodName, + this.paymentReferenceNumber, + this.policyId, + this.policyName, + this.procedureName, + this.projectID, + this.projectName, + this.setupID, + this.sourceType, + this.startTime, + this.status, + this.statusCode, + this.statusDesc, + this.subPolicyNo, + this.userID, + this.serviceID}); - PatientShareResponse.fromJson(Map json) { + PatientShareResponse.fromJson(Map json) { advanceNumber = json['AdvanceNumber']; appointmentDate = json['AppointmentDate']; appointmentNo = json['AppointmentNo']; @@ -110,9 +114,10 @@ class PatientShareResponse { companyId = json['CompanyId']; companyName = json['CompanyName']; companyShareWithTax = json['CompanyShareWithTax']; + doctorID = json['DoctorID']; doctorImageURL = json['DoctorImageURL']; doctorNameObj = json['DoctorNameObj']; - doctorSpeciality = json['DoctorSpeciality'].cast(); +// doctorSpeciality = json['DoctorSpeciality'].cast(); errCode = json['ErrCode']; groupID = json['GroupID']; iSAllowOnlineCheckedIN = json['ISAllowOnlineCheckedIN']; @@ -147,10 +152,11 @@ class PatientShareResponse { statusDesc = json['StatusDesc']; subPolicyNo = json['SubPolicyNo']; userID = json['UserID']; + serviceID = json['ServiceID']; } - Map toJson() { - final Map data = new Map(); + Map toJson() { + final Map data = new Map(); data['AdvanceNumber'] = this.advanceNumber; data['AppointmentDate'] = this.appointmentDate; data['AppointmentNo'] = this.appointmentNo; @@ -162,6 +168,7 @@ class PatientShareResponse { data['CompanyId'] = this.companyId; data['CompanyName'] = this.companyName; data['CompanyShareWithTax'] = this.companyShareWithTax; + data['DoctorID'] = this.doctorID; data['DoctorImageURL'] = this.doctorImageURL; data['DoctorNameObj'] = this.doctorNameObj; data['DoctorSpeciality'] = this.doctorSpeciality; @@ -199,6 +206,7 @@ class PatientShareResponse { data['StatusDesc'] = this.statusDesc; data['SubPolicyNo'] = this.subPolicyNo; data['UserID'] = this.userID; + data['ServiceID'] = this.serviceID; return data; } } diff --git a/lib/models/CovidDriveThru/CovidPaymentInfoResponse.dart b/lib/models/CovidDriveThru/CovidPaymentInfoResponse.dart new file mode 100644 index 00000000..a1290e4d --- /dev/null +++ b/lib/models/CovidDriveThru/CovidPaymentInfoResponse.dart @@ -0,0 +1,96 @@ +class CovidPaymentInfoResponse { + dynamic propertyChanged; + dynamic cashPriceField; + dynamic cashPriceTaxField; + dynamic cashPriceWithTaxField; + dynamic companyIdField; + String companyNameField; + dynamic companyShareWithTaxField; + dynamic errCodeField; + dynamic groupIDField; + dynamic insurancePolicyNoField; + String messageField; + dynamic patientCardIDField; + dynamic patientShareField; + dynamic patientShareWithTaxField; + dynamic patientTaxAmountField; + dynamic policyIdField; + dynamic policyNameField; + String procedureNameField; + dynamic setupIDField; + dynamic statusCodeField; + dynamic subPolicyNoField; + + CovidPaymentInfoResponse( + {this.propertyChanged, + this.cashPriceField, + this.cashPriceTaxField, + this.cashPriceWithTaxField, + this.companyIdField, + this.companyNameField, + this.companyShareWithTaxField, + this.errCodeField, + this.groupIDField, + this.insurancePolicyNoField, + this.messageField, + this.patientCardIDField, + this.patientShareField, + this.patientShareWithTaxField, + this.patientTaxAmountField, + this.policyIdField, + this.policyNameField, + this.procedureNameField, + this.setupIDField, + this.statusCodeField, + this.subPolicyNoField}); + + CovidPaymentInfoResponse.fromJson(Map json) { + propertyChanged = json['PropertyChanged']; + cashPriceField = json['cashPriceField']; + cashPriceTaxField = json['cashPriceTaxField']; + cashPriceWithTaxField = json['cashPriceWithTaxField']; + companyIdField = json['companyIdField']; + companyNameField = json['companyNameField']; + companyShareWithTaxField = json['companyShareWithTaxField']; + errCodeField = json['errCodeField']; + groupIDField = json['groupIDField']; + insurancePolicyNoField = json['insurancePolicyNoField']; + messageField = json['messageField']; + patientCardIDField = json['patientCardIDField']; + patientShareField = json['patientShareField']; + patientShareWithTaxField = json['patientShareWithTaxField']; + patientTaxAmountField = json['patientTaxAmountField']; + policyIdField = json['policyIdField']; + policyNameField = json['policyNameField']; + procedureNameField = json['procedureNameField']; + setupIDField = json['setupIDField']; + statusCodeField = json['statusCodeField']; + subPolicyNoField = json['subPolicyNoField']; + } + + Map toJson() { + final Map data = new Map(); + data['PropertyChanged'] = this.propertyChanged; + data['cashPriceField'] = this.cashPriceField; + data['cashPriceTaxField'] = this.cashPriceTaxField; + data['cashPriceWithTaxField'] = this.cashPriceWithTaxField; + data['companyIdField'] = this.companyIdField; + data['companyNameField'] = this.companyNameField; + data['companyShareWithTaxField'] = this.companyShareWithTaxField; + data['errCodeField'] = this.errCodeField; + data['groupIDField'] = this.groupIDField; + data['insurancePolicyNoField'] = this.insurancePolicyNoField; + data['messageField'] = this.messageField; + data['patientCardIDField'] = this.patientCardIDField; + data['patientShareField'] = this.patientShareField; + data['patientShareWithTaxField'] = this.patientShareWithTaxField; + data['patientTaxAmountField'] = this.patientTaxAmountField; + data['policyIdField'] = this.policyIdField; + data['policyNameField'] = this.policyNameField; + data['procedureNameField'] = this.procedureNameField; + data['setupIDField'] = this.setupIDField; + data['statusCodeField'] = this.statusCodeField; + data['subPolicyNoField'] = this.subPolicyNoField; + return data; + } +} diff --git a/lib/models/CovidDriveThru/DriveThroughTestingCenterModel.dart b/lib/models/CovidDriveThru/DriveThroughTestingCenterModel.dart new file mode 100644 index 00000000..c85a06b3 --- /dev/null +++ b/lib/models/CovidDriveThru/DriveThroughTestingCenterModel.dart @@ -0,0 +1,68 @@ +class DriveThroughTestingCenterModel { + int rowID; + int iD; + int projectID; + String setupID; + double longitude; + double latitude; + int numberOfTracks; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedON; + dynamic projectName; + dynamic projectNameN; + + DriveThroughTestingCenterModel( + {this.rowID, + this.iD, + this.projectID, + this.setupID, + this.longitude, + this.latitude, + this.numberOfTracks, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedON, + this.projectName, + this.projectNameN}); + + DriveThroughTestingCenterModel.fromJson(Map json) { + rowID = json['RowID']; + iD = json['ID']; + projectID = json['ProjectID']; + setupID = json['SetupID']; + longitude = json['Longitude']; + latitude = json['Latitude']; + numberOfTracks = json['NumberOfTracks']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedON = json['EditedON']; + projectName = json['ProjectName']; + projectNameN = json['ProjectNameN']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['ID'] = this.iD; + data['ProjectID'] = this.projectID; + data['SetupID'] = this.setupID; + data['Longitude'] = this.longitude; + data['Latitude'] = this.latitude; + data['NumberOfTracks'] = this.numberOfTracks; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedON'] = this.editedON; + data['ProjectName'] = this.projectName; + data['ProjectNameN'] = this.projectNameN; + return data; + } +} diff --git a/lib/models/LiveCare/LiveCareScheduleClinicsListResponse.dart b/lib/models/LiveCare/LiveCareScheduleClinicsListResponse.dart new file mode 100644 index 00000000..8951370c --- /dev/null +++ b/lib/models/LiveCare/LiveCareScheduleClinicsListResponse.dart @@ -0,0 +1,64 @@ +class LiveCareScheduleClinicsListResponse { + List clinicsHaveScheduleList; + + LiveCareScheduleClinicsListResponse({this.clinicsHaveScheduleList}); + + LiveCareScheduleClinicsListResponse.fromJson(Map json) { + if (json['ClinicsHaveScheduleList'] != null) { + clinicsHaveScheduleList = new List(); + json['ClinicsHaveScheduleList'].forEach((v) { + clinicsHaveScheduleList.add(new ClinicsHaveScheduleList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + if (this.clinicsHaveScheduleList != null) { + data['ClinicsHaveScheduleList'] = + this.clinicsHaveScheduleList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ClinicsHaveScheduleList { + int clinicID; + int serviceID; + int projectID; + String clinicDesc; + String clinicDescN; + String projectDesc; + String projectDescN; + + ClinicsHaveScheduleList( + {this.clinicID, + this.serviceID, + this.projectID, + this.clinicDesc, + this.clinicDescN, + this.projectDesc, + this.projectDescN}); + + ClinicsHaveScheduleList.fromJson(Map json) { + clinicID = json['ClinicID']; + serviceID = json['ServiceID']; + projectID = json['ProjectID']; + clinicDesc = json['ClinicDesc']; + clinicDescN = json['ClinicDescN']; + projectDesc = json['ProjectDesc']; + projectDescN = json['ProjectDescN']; + } + + Map toJson() { + final Map data = new Map(); + data['ClinicID'] = this.clinicID; + data['ServiceID'] = this.serviceID; + data['ProjectID'] = this.projectID; + data['ClinicDesc'] = this.clinicDesc; + data['ClinicDescN'] = this.clinicDescN; + data['ProjectDesc'] = this.projectDesc; + data['ProjectDescN'] = this.projectDescN; + return data; + } +} diff --git a/lib/models/LiveCare/insertVIDARequest.dart b/lib/models/LiveCare/insertVIDARequest.dart new file mode 100644 index 00000000..938ca102 --- /dev/null +++ b/lib/models/LiveCare/insertVIDARequest.dart @@ -0,0 +1,92 @@ +class insertVIDARequest { + int patientID; + int acceptedBy; + int appointmentNo; + String deviceToken; + double latitude; + double longitude; + int serviceID; + int projectID; + int clinicID; + String deviceType; + String voipToken; + double versionID; + int channel; + int languageID; + String iPAdress; + String generalid; + int patientOutSA; + String sessionID; + bool isDentalAllowedBackend; + int deviceTypeID; + + insertVIDARequest( + {this.patientID, + this.acceptedBy, + this.appointmentNo, + this.deviceToken, + this.latitude, + this.longitude, + this.serviceID, + this.projectID, + this.clinicID, + this.deviceType, + this.voipToken, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); + + insertVIDARequest.fromJson(Map json) { + patientID = json['PatientID']; + acceptedBy = json['AcceptedBy']; + appointmentNo = json['AppointmentNo']; + deviceToken = json['DeviceToken']; + latitude = json['Latitude']; + longitude = json['Longitude']; + serviceID = json['ServiceID']; + projectID = json['ProjectID']; + clinicID = json['ClinicID']; + deviceType = json['DeviceType']; + voipToken = json['VoipToken']; + versionID = json['VersionID']; + channel = json['Channel']; + languageID = json['LanguageID']; + iPAdress = json['IPAdress']; + generalid = json['generalid']; + patientOutSA = json['PatientOutSA']; + sessionID = json['SessionID']; + isDentalAllowedBackend = json['isDentalAllowedBackend']; + deviceTypeID = json['DeviceTypeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientID'] = this.patientID; + data['AcceptedBy'] = this.acceptedBy; + data['AppointmentNo'] = this.appointmentNo; + data['DeviceToken'] = this.deviceToken; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['ServiceID'] = this.serviceID; + data['ProjectID'] = this.projectID; + data['ClinicID'] = this.clinicID; + data['DeviceType'] = this.deviceType; + data['VoipToken'] = this.voipToken; + data['VersionID'] = this.versionID; + data['Channel'] = this.channel; + data['LanguageID'] = this.languageID; + data['IPAdress'] = this.iPAdress; + data['generalid'] = this.generalid; + data['PatientOutSA'] = this.patientOutSA; + data['SessionID'] = this.sessionID; + data['isDentalAllowedBackend'] = this.isDentalAllowedBackend; + data['DeviceTypeID'] = this.deviceTypeID; + return data; + } +} diff --git a/lib/models/Request.dart b/lib/models/Request.dart index 03aa7760..a4cef77b 100644 --- a/lib/models/Request.dart +++ b/lib/models/Request.dart @@ -5,6 +5,7 @@ class Request { var ProjectID; var LanguageID; var DeviceTypeID; + var DeviceType; var AppointmentNo; var IPAdress; var VersionID; diff --git a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart index 1e8cb50c..c9993b95 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/delivery_due/delivery_due.dart @@ -96,7 +96,7 @@ class _DeliveryDueState extends State { children: [ Row( children: [ - Icon(Icons.date_range_rounded), + Icon(Icons.date_range), Texts('Date'), ], ), diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart index 9a2f08df..58caee36 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_cholesterol.dart @@ -190,7 +190,7 @@ class _BloodCholesterolState extends State { child: TextFormField( controller: textController, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly +// FilteringTextInputFormatter.digitsOnly ], keyboardType: TextInputType.number, decoration: InputDecoration( diff --git a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart index a90a5bbb..f5d66ccf 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/blood_sugar.dart @@ -192,7 +192,7 @@ class _BloodSugarState extends State { child: TextFormField( controller: textController, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly +// FilteringTextInputFormatter.digitsOnly ], keyboardType: TextInputType.number, decoration: InputDecoration( diff --git a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart index fdf8d191..a86fdb88 100644 --- a/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart +++ b/lib/pages/AlHabibMedicalService/health_converter/triglycerides.dart @@ -188,7 +188,7 @@ class _TriglyceridesState extends State { child: TextFormField( controller: textController, inputFormatters: [ - FilteringTextInputFormatter.digitsOnly +// FilteringTextInputFormatter.digitsOnly ], keyboardType: TextInputType.number, decoration: InputDecoration( diff --git a/lib/pages/AlHabibMedicalService/​ health_calculators.dart b/lib/pages/AlHabibMedicalService/​ health_calculators.dart index 15f7209b..cdadfe98 100644 --- a/lib/pages/AlHabibMedicalService/​ health_calculators.dart +++ b/lib/pages/AlHabibMedicalService/​ health_calculators.dart @@ -1,5 +1,3 @@ -import 'file:///C:/Users/admin/AndroidStudioProjects/diplomatic-quarter/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart'; -import 'file:///C:/Users/admin/AndroidStudioProjects/diplomatic-quarter/lib/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart'; @@ -9,7 +7,9 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'health_calculator/bmi_calculator/bmi_calculator.dart'; import 'health_calculator/bmr_calculator/bmr_calculator.dart'; +import 'health_calculator/calorie_calculator/calorie_calculator.dart'; import 'health_calculator/delivery_due/delivery_due.dart'; import 'health_calculator/ideal_body/ideal_body.dart'; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 88ecdb6b..b0110d2b 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -24,10 +24,12 @@ class BookConfirm extends StatefulWidget { String appoDateFormatted = ""; String appoTimeFormatted = ""; + bool isLiveCareAppointment; BookConfirm( {@required this.doctor, @required this.selectedDate, + @required this.isLiveCareAppointment, @required this.selectedTime}); DoctorsListService service; @@ -208,11 +210,13 @@ class _BookConfirmState extends State { "assets/images/new-design/icon_hospital.png"), ), Container( + width: MediaQuery.of(context).size.width * 0.7, margin: EdgeInsets.fromLTRB(20.0, 5.0, 10.0, 5.0), child: Text( TranslationBase.of(context).clinic + ": " + widget.doctor.clinicName, + overflow: TextOverflow.clip, style: TextStyle( fontSize: 14.0, color: Colors.grey[700], @@ -338,6 +342,9 @@ class _BookConfirmState extends State { ), ), ), + SizedBox( + height: 120.0, + ), ], ), ), @@ -358,7 +365,11 @@ class _BookConfirmState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: () { - insertAppointment(context, widget.doctor); + if (!widget.isLiveCareAppointment) { + insertAppointment(context, widget.doctor); + } else { + insertLiveCareScheduledAppointment(context, widget.doctor); + } }, child: Text(TranslationBase.of(context).bookNow, style: TextStyle(fontSize: 18.0)), @@ -375,7 +386,11 @@ class _BookConfirmState extends State { service.cancelAppointment(appo, context).then((res) { if (res['MessageStatus'] == 1) { Future.delayed(new Duration(milliseconds: 1500), () { - insertAppointment(context, docObject); + if (!widget.isLiveCareAppointment) { + insertAppointment(context, widget.doctor); + } else { + insertLiveCareScheduledAppointment(context, widget.doctor); + } }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); @@ -434,6 +449,55 @@ class _BookConfirmState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + insertLiveCareScheduledAppointment(context, DoctorList docObject) { + AppoitmentAllHistoryResultList appo; + widget.service + .insertLiveCareScheduleAppointment( + docObject.doctorID, + docObject.clinicID, + docObject.projectID, + docObject.serviceID, + widget.selectedTime, + widget.selectedDate, + context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + print(res['AppointmentNo']); + + Future.delayed(new Duration(milliseconds: 1800), () { + getLiveCareAppointmentPatientShare(context, res['AppointmentNo'], + docObject.clinicID, docObject.projectID, docObject); + }); + } else { + appo = new AppoitmentAllHistoryResultList(); + appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; + appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; + appo.projectID = res['SameClinicApptList'][0]['ProjectID']; + appo.endTime = res['SameClinicApptList'][0]['EndTime']; + appo.startTime = res['SameClinicApptList'][0]['StartTime']; + appo.doctorID = res['SameClinicApptList'][0]['DoctorID']; + appo.isLiveCareAppointment = true; + appo.originalClinicID = 0; + appo.originalProjectID = 0; + appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; + + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, appo, context)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + AppToast.showErrorToast(message: err); + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + getPatientShare(context, String appointmentNo, int clinicID, int projectID, DoctorList docObject) { widget.service @@ -448,6 +512,21 @@ class _BookConfirmState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + getLiveCareAppointmentPatientShare(context, String appointmentNo, + int clinicID, int projectID, DoctorList docObject) { + widget.service + .getLiveCareAppointmentPatientShare( + appointmentNo, clinicID, projectID, context) + .then((res) { + print(res); + widget.patientShareResponse = new PatientShareResponse.fromJson(res); + navigateToBookSuccess(context, docObject, widget.patientShareResponse); + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + String getTime(DateTime dateTime) { final DateFormat formatter = DateFormat('HH:mm'); setState(() { @@ -502,7 +581,6 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { - Navigator.push( context, MaterialPageRoute( diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 7a19ea28..34dbdc2f 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -39,12 +39,6 @@ class _BookSuccessState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser; - @override - void initState() { - // TODO: implement initState - super.initState(); - } - @override Widget build(BuildContext context) { return Scaffold( @@ -184,6 +178,9 @@ class _BookSuccessState extends State { case 30: return _getQRAppo(); break; + case 50: + return _getConfirmAppo(); + break; } } @@ -204,6 +201,9 @@ class _BookSuccessState extends State { case 30: return 'QR Code'; break; + case 50: + return 'Confirm LiveCare'; + break; } } @@ -286,8 +286,24 @@ class _BookSuccessState extends State { textColor: Colors.white, disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), - onPressed: () {}, - child: Text(TranslationBase.of(context).confirm.toUpperCase(), + onPressed: () { + AppoitmentAllHistoryResultList appo = + new AppoitmentAllHistoryResultList(); + appo.clinicID = widget.docObject.clinicID; + appo.projectID = widget.docObject.projectID; + appo.appointmentNo = + widget.patientShareResponse.appointmentNo; + appo.serviceID = widget.patientShareResponse.serviceID; + appo.isLiveCareAppointment = widget.patientShareResponse.isLiveCareAppointment; + appo.doctorID = widget.patientShareResponse.doctorID; + confirmAppointment(appo); + }, + child: Text( + widget.patientShareResponse.isLiveCareAppointment + ? TranslationBase.of(context) + .confirmLiveCare + .toUpperCase() + : TranslationBase.of(context).confirm.toUpperCase(), style: TextStyle(fontSize: 18.0)), ), ), @@ -321,6 +337,50 @@ class _BookSuccessState extends State { return Container(); } + confirmAppointment(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .confirmAppointment( + appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + if (appo.isLiveCareAppointment) { + insertLiveCareVIDARequest(appo); + } else { + navigateToHome(context); + } + }); + } + + insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, + appo.serviceID, appo.doctorID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + navigateToHome(context); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + Widget _getPayNowAppo() { return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -543,7 +603,8 @@ class _BookSuccessState extends State { } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -560,22 +621,12 @@ class _BookSuccessState extends State { appo.appointmentNo.toString()); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } -// -// Future navigateToQR( -// context, String appoQR, PatientShareResponse patientShareResponse) async { -// Navigator.push( -// context, -// MaterialPageRoute( -// builder: (context) => QRCode( -// patientShareResponse: patientShareResponse, -// appoQR: appoQR, -// ))).then((value) {}); -// } - - addAdvancedNumberRequest(String advanceNumber, String paymentReference, - String appointmentID) { + + addAdvancedNumberRequest( + String advanceNumber, String paymentReference, String appointmentID) { DoctorsListService service = new DoctorsListService(); service .addAdvancedNumberRequest( @@ -585,7 +636,8 @@ class _BookSuccessState extends State { getAppoQR(context); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Widget _getQRAppo() { @@ -730,7 +782,7 @@ class _BookSuccessState extends State { } Future navigateToHome(context) async { - Navigator.of(context).pushNamed(HOME); + Navigator.of(context).popAndPushNamed(HOME); } getAppoQR(context) { @@ -742,7 +794,8 @@ class _BookSuccessState extends State { navigateToQR(context, res['AppointmentQR']); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToQR(context, String appoQR) async { diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index d3b6fc7c..2c7e723a 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/DoctorProfile.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -10,7 +11,7 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; -import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; + import 'BookConfirm.dart'; import 'components/DocAvailableAppointments.dart'; import 'components/DocInfo.dart'; @@ -19,9 +20,12 @@ class DoctorProfile extends StatefulWidget { DoctorList doctor; DoctorProfileList docProfileList; final bool isOpenAppt; + bool isLiveCareAppointment; + DoctorProfile( {@required this.doctor, @required this.docProfileList, + @required this.isLiveCareAppointment, this.isOpenAppt = false}); AuthenticatedUser authUser; @@ -35,6 +39,7 @@ class _DoctorProfileState extends State TabController _tabController; bool showFooterButton = false; var event = RobotProvider(); + @override void initState() { _tabController = new TabController( @@ -54,6 +59,7 @@ class _DoctorProfileState extends State }); _tabController = new TabController(length: 2, vsync: this); widget.authUser = new AuthenticatedUser(); + widget.doctor.speciality = widget.docProfileList.specialty; getPatientData(); super.initState(); } @@ -190,7 +196,9 @@ class _DoctorProfileState extends State physics: NeverScrollableScrollPhysics(), children: [ DoctorInformation(docProfileList: widget.docProfileList), - DocAvailableAppointments(doctor: widget.doctor) + DocAvailableAppointments( + doctor: widget.doctor, + isLiveCareAppointment: widget.isLiveCareAppointment) ], controller: _tabController, ), @@ -245,6 +253,7 @@ class _DoctorProfileState extends State MaterialPageRoute( builder: (context) => BookConfirm( doctor: widget.doctor, + isLiveCareAppointment: widget.isLiveCareAppointment, selectedDate: DocAvailableAppointments.selectedDate, selectedTime: DocAvailableAppointments.selectedTime))); } diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 2b5fac17..1ed1b6a0 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -9,9 +9,10 @@ import 'package:flutter/material.dart'; class SearchResults extends StatefulWidget { List doctorsList = []; List patientDoctorAppointmentListHospital; + bool isLiveCareAppointment; SearchResults( - {@required this.doctorsList, this.patientDoctorAppointmentListHospital}); + {@required this.doctorsList, this.patientDoctorAppointmentListHospital, @required this.isLiveCareAppointment}); @override _SearchResultsState createState() => _SearchResultsState(); @@ -53,6 +54,7 @@ class _SearchResultsState extends State { .map((doctor) { return DoctorView( doctor: doctor, + isLiveCareAppointment: widget.isLiveCareAppointment, ); }).toList(), )), diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 3c5e49ff..88116cd9 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -2,12 +2,13 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -import 'package:table_calendar/table_calendar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'package:table_calendar/table_calendar.dart'; import '../../../uitl/date_uitl.dart'; @@ -17,8 +18,10 @@ class DocAvailableAppointments extends StatefulWidget { static DateTime selectedAppoDateTime; static String selectedDate; static String selectedTime; + bool isLiveCareAppointment; - DocAvailableAppointments({@required this.doctor}); + DocAvailableAppointments( + {@required this.doctor, @required this.isLiveCareAppointment}); @override _DocAvailableAppointmentsState createState() => @@ -31,6 +34,8 @@ class _DocAvailableAppointmentsState extends State AnimationController _animationController; CalendarController _calendarController; + AppSharedPreferences sharedPref = new AppSharedPreferences(); + var selectedDate = ""; dynamic selectedDateJSON; dynamic jsonFreeSlots; @@ -56,8 +61,13 @@ class _DocAvailableAppointmentsState extends State _selectedDay: ['Event A0'] }; - WidgetsBinding.instance - .addPostFrameCallback((_) => getDoctorFreeSlots(context, widget.doctor)); + WidgetsBinding.instance.addPostFrameCallback((_) async { + if (widget.isLiveCareAppointment) + getDoctorScheduledFreeSlots(context, widget.doctor); + else { + getDoctorFreeSlots(context, widget.doctor); + } + }); _calendarController = CalendarController(); _animationController = AnimationController( @@ -323,8 +333,8 @@ class _DocAvailableAppointmentsState extends State getDoctorFreeSlots(context, DoctorList docObject) { DoctorsListService service = new DoctorsListService(); service - .getDoctorFreeSlots( - docObject.doctorID, docObject.clinicID, docObject.projectID, context) + .getDoctorFreeSlots(docObject.doctorID, docObject.clinicID, + docObject.projectID, context) .then((res) { if (res['MessageStatus'] == 1) { if (res['FreeTimeSlots'].length != 0) { @@ -340,7 +350,32 @@ class _DocAvailableAppointmentsState extends State } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + getDoctorScheduledFreeSlots(context, DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + service + .getDoctorScheduledFreeSlots(docObject.doctorID, docObject.clinicID, + docObject.projectID, docObject.serviceID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + if (res['PatientER_DoctorFreeSlots'].length != 0) { + freeSlotsResponse = res['PatientER_DoctorFreeSlots']; + print("res['PatientER_DoctorFreeSlots']"); + print(res['PatientER_DoctorFreeSlots'].length); + _getJSONSlots().then((value) => { + setState(() => {_events.clear(), _events = value}) + }); + } else {} + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Widget _buildEventsMarker(DateTime date, List events) { @@ -350,8 +385,8 @@ class _DocAvailableAppointmentsState extends State color: _calendarController.isSelected(date) ? Colors.green[400] : _calendarController.isToday(date) - ? Colors.brown[300] - : Colors.blue[400], + ? Colors.brown[300] + : Colors.blue[400], ), width: 40.0, height: 40.0, diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 1e7deb38..80288085 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -162,6 +162,7 @@ class _SearchByDoctorState extends State { context, MaterialPageRoute( builder: (context) => SearchResults( + isLiveCareAppointment: false, doctorsList: docList, patientDoctorAppointmentListHospital: patientDoctorAppointmentListHospital))); diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 88912a3f..76741874 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -128,8 +128,8 @@ class _ExpandableListViewState extends State { widget.doctorsList2[index].projectName.toString() ? DoctorView( //AJ note - doctor: widget.doctorsList2[index] - + doctor: widget.doctorsList2[index], + isLiveCareAppointment: false, // widget.doctorsList2[index] ) : Container(); diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index cad9da25..40c0e2fc 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -11,10 +11,11 @@ import '../DoctorProfile.dart'; class DoctorView extends StatelessWidget { final DoctorList doctor; + bool isLiveCareAppointment; - DoctorView({@required this.doctor}); + DoctorView({@required this.doctor, @required this.isLiveCareAppointment}); @override Widget build(BuildContext context) { @@ -186,6 +187,7 @@ class DoctorView extends StatelessWidget { MaterialPageRoute( builder: (context) => DoctorProfile( doctor: docObject, + isLiveCareAppointment: isLiveCareAppointment, docProfileList: docProfile, isOpenAppt: isAppo, ))); diff --git a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart index 65e2d7b2..8e9fe806 100644 --- a/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart +++ b/lib/pages/ContactUs/LiveChat/hospitalsLivechat_page.dart @@ -139,7 +139,7 @@ class _HospitalsLiveChatPageState extends State { IconButton( icon: Icon( Icons - .arrow_forward, + .arrow_forward_ios, color: tappedIndex == index ? Colors.white diff --git a/lib/pages/ContactUs/findus/hospitrals_page.dart b/lib/pages/ContactUs/findus/hospitrals_page.dart index b883ae41..d8d898e3 100644 --- a/lib/pages/ContactUs/findus/hospitrals_page.dart +++ b/lib/pages/ContactUs/findus/hospitrals_page.dart @@ -115,7 +115,7 @@ class _HospitalsPageState extends State { CrossAxisAlignment.center, children: [ IconButton( - // icon: Icon(Icons.person_pin_circle_outlined,color: Colors.red,), + // icon: Icon(Icons.location_on,color: Colors.red,), icon: new Image.asset( 'assets/images/new-design/navigate.png'), tooltip: '', diff --git a/lib/pages/ContactUs/findus/pharmacies_page.dart b/lib/pages/ContactUs/findus/pharmacies_page.dart index 5dc44019..663bd3ec 100644 --- a/lib/pages/ContactUs/findus/pharmacies_page.dart +++ b/lib/pages/ContactUs/findus/pharmacies_page.dart @@ -141,7 +141,7 @@ class _PharmaciesPageState extends State { IconButton( // icon: Icon( // Icons - // .person_pin_circle_outlined, + // .location_on, // color: Colors.red, // ), icon: new Image.asset( diff --git a/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart new file mode 100644 index 00000000..060a8132 --- /dev/null +++ b/lib/pages/Covid-DriveThru/Covid-TimeSlots.dart @@ -0,0 +1,599 @@ +import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/models/Appointments/FreeSlot.dart'; +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/models/Appointments/timeSlot.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-alert.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; +import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:intl/intl.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'package:table_calendar/table_calendar.dart'; + +class CovidTimeSlots extends StatefulWidget { + int projectID; + static bool areSlotsAvailable = false; + static DateTime selectedAppoDateTime; + static String selectedDate; + static String selectedTime; + + int selectedClinicID; + int selectedDoctorID; + + PatientShareResponse patientShareResponse; + + CovidTimeSlots({@required this.projectID}); + + @override + _CovidTimeSlotsState createState() => _CovidTimeSlotsState(); +} + +class _CovidTimeSlotsState extends State + with TickerProviderStateMixin { + Map _events; + AnimationController _animationController; + CalendarController _calendarController; + + AppSharedPreferences sharedPref = new AppSharedPreferences(); + + var selectedDate = ""; + dynamic selectedDateJSON; + dynamic jsonFreeSlots; + + List docFreeSlots = []; + List dayEvents = []; + + int selectedButtonIndex = 0; + + dynamic freeSlotsResponse; + + ScrollController _scrollController; + + @override + void initState() { + final _selectedDay = DateTime.now(); + + widget.patientShareResponse = new PatientShareResponse(); + + _scrollController = new ScrollController(); + + _events = { + _selectedDay: ['Event A0'] + }; + + WidgetsBinding.instance.addPostFrameCallback( + (_) => getCovidFreeSlots(context, widget.projectID)); + + _calendarController = CalendarController(); + _animationController = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 50), + ); + + _animationController.forward(); + super.initState(); + } + + @override + void dispose() { + _animationController.dispose(); + _calendarController.dispose(); + super.dispose(); + } + + void _onDaySelected(DateTime day, List events) { + final DateFormat formatter = DateFormat('yyyy-MM-dd'); + setState(() { + this.selectedDate = DateUtil.getMonthDayYearDateFormatted(day); + openTimeSlotsPickerForDate(day, docFreeSlots); + CovidTimeSlots.selectedDate = formatter.format(day); + print(CovidTimeSlots.selectedDate); + }); + } + + void _onVisibleDaysChanged( + DateTime first, DateTime last, CalendarFormat format) { + print('CALLBACK: _onVisibleDaysChanged'); + } + + void _onCalendarCreated( + DateTime first, DateTime last, CalendarFormat format) { + print('CALLBACK: _onCalendarCreated'); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + isShowAppBar: true, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 150.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/new-design/covid-19-big-banner-bg.png"), + fit: BoxFit.fill, + ), + color: Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all(Radius.circular(10))), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 90.0, + height: 90.0), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only( + left: 20.0, right: 20.0, top: 40.0), + child: Text("COVID-19 TEST", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 24.0)), + ), + Container( + margin: EdgeInsets.only( + left: 20.0, right: 20.0, top: 10.0), + child: Text("Drive-Thru", + style: TextStyle( + color: Colors.white, fontSize: 24.0)), + ), + ], + ), + ], + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: Colors.white), + margin: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 5.0), + padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0), + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height * 0.65, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(10.0), + child: Text( + "Kindly select one of the available appointments from below: ", + style: + TextStyle(color: Colors.black, fontSize: 16.0)), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.center, + child: Text(selectedDate, + style: TextStyle( + fontSize: 18.0, fontWeight: FontWeight.bold)), + ), + Container( + height: 50, + margin: EdgeInsets.all(20.0), + child: ListView.builder( + controller: _scrollController, + scrollDirection: Axis.horizontal, + itemCount: dayEvents.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.only(right: 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + side: BorderSide( + color: Colors.blue[400], + //Color of the border + style: BorderStyle.solid, + //Style of the border + width: 1.5, //width of the border + ), + ), + minWidth: + MediaQuery.of(context).size.width * 0.2, + child: index == selectedButtonIndex + ? getSelectedButton(index) + : getNormalButton(index)), + ); + }, + ), + ), + _buildTableCalendarWithBuilders(), + ], + ), + ), + SizedBox( + height: 100.0, + ), + ], + ), + ), + ), + bottomSheet: Container( + margin: EdgeInsets.all(10.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { + bookCovidTestAppointment(); + }, + child: Text("BOOK", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ); + } + + Widget _buildTableCalendarWithBuilders() { + return TableCalendar( + locale: 'en_US', + calendarController: _calendarController, + events: _events, + initialCalendarFormat: CalendarFormat.month, + startDay: DateTime.now(), + formatAnimation: FormatAnimation.slide, + startingDayOfWeek: StartingDayOfWeek.sunday, + weekendDays: [DateTime.friday, DateTime.saturday], + availableGestures: AvailableGestures.horizontalSwipe, + availableCalendarFormats: const { + CalendarFormat.month: '', + CalendarFormat.week: '', + }, + calendarStyle: CalendarStyle( + outsideDaysVisible: false, + weekendStyle: TextStyle().copyWith(color: Colors.blue[800]), + holidayStyle: TextStyle().copyWith(color: Colors.blue[800]), + ), + daysOfWeekStyle: DaysOfWeekStyle( + weekendStyle: TextStyle().copyWith(color: Colors.blue[600]), + ), + headerStyle: HeaderStyle( + centerHeaderTitle: true, + formatButtonVisible: false, + ), + builders: CalendarBuilders( + selectedDayBuilder: (context, date, _) { + return FadeTransition( + opacity: Tween(begin: 0.0, end: 1.0).animate(_animationController), + child: Container( + margin: const EdgeInsets.all(4.0), + padding: const EdgeInsets.only(top: 5.0, left: 6.0), + color: Colors.transparent, + width: 0, + height: 0, + child: Text( + '${date.day}', + style: TextStyle().copyWith(fontSize: 16.0), + ), + ), + ); + }, + todayDayBuilder: (context, date, _) { + return Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _calendarController.isSelected(date) + ? Colors.green[400] + : _calendarController.isToday(date) + ? Colors.brown[300] + : Colors.blue[400], + ), + width: 40.0, + height: 40.0, + child: Center( + child: Text( + '${date.day}', + style: TextStyle().copyWith( + color: Colors.white, + fontSize: 14.0, + ), + ), + ), + ); + }, + markersBuilder: (context, date, events, holidays) { + final children = []; + + if (events.isNotEmpty) { + children.add( + Positioned( + right: 4, + bottom: 4, + child: _buildEventsMarker(date, events), + ), + ); + } + + return children; + }, + ), + onDaySelected: (date, events) { + _onDaySelected(date, events); + _animationController.forward(from: 0.0); + }, + onVisibleDaysChanged: _onVisibleDaysChanged, + onCalendarCreated: _onCalendarCreated, + ); + } + + openTimeSlotsPickerForDate(DateTime dateStart, List freeSlots) { + dayEvents.clear(); + DateTime dateStartObj = new DateTime( + dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); + + freeSlots.forEach((v) { + if (v.start == dateStartObj) dayEvents.add(v); + }); + + setState(() { + if (dayEvents.length != 0) + CovidTimeSlots.areSlotsAvailable = true; + else + CovidTimeSlots.areSlotsAvailable = false; + + selectedButtonIndex = 0; + + CovidTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime; + }); + } + + Future> _getJSONSlots() async { + Map _eventsParsed; + List slotsList = []; + DateTime date; + final DateFormat formatter = DateFormat('HH:mm'); + final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); + for (var i = 0; i < freeSlotsResponse.length; i++) { + date = + DateUtil.convertStringToDate(freeSlotsResponse[i]['FreeTimeSlots']); + slotsList.add(FreeSlot(date, ['slot'])); + docFreeSlots.add(TimeSlot( + isoTime: formatter.format(date), + start: new DateTime(date.year, date.month, date.day, 0, 0, 0, 0), + end: date)); + } + _eventsParsed = + Map.fromIterable(slotsList, key: (e) => e.slot, value: (e) => e.event); + setState(() { + CovidTimeSlots.selectedDate = dateFormatter.format( + DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); + selectedDate = DateUtil.getMonthDayYearDateFormatted( + DateUtil.convertStringToDate(freeSlotsResponse[0]['FreeTimeSlots'])); + selectedDateJSON = freeSlotsResponse[0]['FreeTimeSlots']; + }); + openTimeSlotsPickerForDate( + DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots); + _calendarController + .setFocusedDay(DateUtil.convertStringToDate(selectedDateJSON)); + return _eventsParsed; + } + + Widget _buildEventsMarker(DateTime date, List events) { + return Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _calendarController.isSelected(date) + ? Colors.green[400] + : _calendarController.isToday(date) + ? Colors.brown[300] + : Colors.blue[400], + ), + width: 40.0, + height: 40.0, + child: Center( + child: Text( + '${date.day}', + style: TextStyle().copyWith( + color: Colors.white, + fontSize: 14.0, + ), + ), + ), + ); + } + + Widget getNormalButton(int index) { + return RaisedButton( + color: Colors.white, + textColor: new Color(0xFF60686b), + onPressed: () { + setState(() { + selectedButtonIndex = index; + CovidTimeSlots.selectedTime = dayEvents[index].isoTime; + print(CovidTimeSlots.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + ); + } + + Widget getSelectedButton(int index) { + return RaisedButton( + color: Colors.blue[400], + textColor: Colors.white, + onPressed: () { + setState(() { + selectedButtonIndex = index; + CovidTimeSlots.selectedTime = dayEvents[index].isoTime; + print(CovidTimeSlots.selectedTime); + }); + }, + child: Text(dayEvents[index].isoTime, + style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold)), + ); + } + + bookCovidTestAppointment() { +// Navigator.push(context, +// MaterialPageRoute(builder: (context) => CovidPaymentAlert())); + + DoctorList docObject = new DoctorList(); + docObject.doctorID = widget.selectedDoctorID; + docObject.clinicID = widget.selectedClinicID; + docObject.projectID = widget.projectID; + insertAppointmentCovidTest(context, docObject); + } + + insertAppointmentCovidTest(context, DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + AppoitmentAllHistoryResultList appo; + service + .insertAppointment( + docObject.doctorID, + docObject.clinicID, + docObject.projectID, + CovidTimeSlots.selectedTime, + CovidTimeSlots.selectedDate, + context) + .then((res) { + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: "Appointment Booked Successfully"); + Future.delayed(new Duration(milliseconds: 1800), () { + getPatientShare(context, res['AppointmentNo'], docObject.clinicID, + docObject.projectID, docObject); + }); + } else { + appo = new AppoitmentAllHistoryResultList(); + appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; + appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; + appo.projectID = res['SameClinicApptList'][0]['ProjectID']; + appo.endTime = res['SameClinicApptList'][0]['EndTime']; + appo.startTime = res['SameClinicApptList'][0]['StartTime']; + appo.doctorID = res['SameClinicApptList'][0]['DoctorID']; + appo.isLiveCareAppointment = false; + appo.originalClinicID = 0; + appo.originalProjectID = 0; + appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; + + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: res['ErrorEndUserMessage'], + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {cancelAppointment(docObject, appo, context)}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + }).catchError((err) { + AppToast.showErrorToast(message: err); + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, + BuildContext context) { + ConfirmDialog.closeAlertDialog(context); + DoctorsListService service = new DoctorsListService(); + service.cancelAppointment(appo, context).then((res) { + if (res['MessageStatus'] == 1) { + Future.delayed(new Duration(milliseconds: 1500), () { + insertAppointmentCovidTest(context, docObject); + }); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + getPatientShare(context, String appointmentNo, int clinicID, int projectID, + DoctorList docObject) { + DoctorsListService service = new DoctorsListService(); + service + .getPatientShare(appointmentNo, clinicID, projectID, context) + .then((res) { + print(res); + widget.patientShareResponse = new PatientShareResponse.fromJson(res); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + navigateToPaymentAlert(); + }); + } + + navigateToPaymentAlert() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidPaymentAlert( + patientShareResponse: widget.patientShareResponse))); + } + + getCovidFreeSlots(BuildContext context, int projectID) { + CovidDriveThruService service = new CovidDriveThruService(); + service.getCovidFreeSlots(context, projectID).then((res) { + print(res['COVID19_FreeTimeSlots']); + if (res['MessageStatus'] == 1) { + if (res['COVID19_FreeTimeSlots'].length != 0) { + freeSlotsResponse = res['COVID19_FreeTimeSlots']; + print(res['COVID19_FreeTimeSlots'].length); + _getJSONSlots().then((value) => { + setState(() => { + widget.selectedClinicID = + freeSlotsResponse[0]['ClinicID'], + widget.selectedDoctorID = + freeSlotsResponse[0]['DoctorID'], + _events.clear(), + _events = value + }) + }); + } else {} + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } +} diff --git a/lib/pages/Covid-DriveThru/covid-drivethru-location.dart b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart new file mode 100644 index 00000000..0563c4bd --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-drivethru-location.dart @@ -0,0 +1,305 @@ +import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart'; +import 'package:diplomaticquarterapp/models/CovidDriveThru/DriveThroughTestingCenterModel.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-payment-details.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/covid-drivethru/covid-drivethru.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:maps_launcher/maps_launcher.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class CovidDrivethruLocation extends StatefulWidget { + @override + _CovidDrivethruLocationState createState() => _CovidDrivethruLocationState(); +} + +class _CovidDrivethruLocationState extends State { + String projectDropdownValue; + List projectsList = []; + bool isLocationSelected = false; + String projectLat = ""; + String projectLong = ""; + String projectName = ""; + String projectID = ""; + + @override + void initState() { + WidgetsBinding.instance + .addPostFrameCallback((_) => getProjectsList(context)); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + isShowAppBar: true, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + child: Text("Get The Result During 8 Hours", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 22.0, + color: Colors.black)), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text( + "We are using the advance technology to test COVID-19, The sample for examination is taking between the nose and mouth (nasopharyngeal swab), the examination is done by ELITE In Genius of the company ELITECH GROUP MOLECULAR DIAGNOSTICS, Note that the device belongs to an Italian company and is manufactured in Japan with RC- PCR​", + style: TextStyle(fontSize: 16.0, color: Colors.black)), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + alignment: Alignment.centerLeft, + child: Text("Select Location", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0, + letterSpacing: 0.8, + color: Colors.grey[700])), + ), + Container( + height: 60.0, + decoration: BoxDecoration( + color: Colors.white, + border: Border.all( + color: Colors.grey[400], + width: 1.0, + ), + borderRadius: BorderRadius.circular(10), + ), + padding: EdgeInsets.all(8.0), + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(top: 15.0), + child: DropdownButtonHideUnderline( + child: DropdownButton( + hint: new Text("Select Address"), + value: projectDropdownValue, + items: projectsList.map((item) { + return new DropdownMenuItem( + value: item.iD.toString(), + child: new Text(item.projectName), + ); + }).toList(), + onChanged: (newValue) { + setState(() { + projectDropdownValue = newValue; + setProjectLocation(newValue); + }); + }, + ), + )), + isLocationSelected + ? Container( + margin: EdgeInsets.only(top: 15.0), + alignment: Alignment.centerLeft, + child: Text("Selected Location", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0, + letterSpacing: 0.8, + color: Colors.black)), + ) + : Container(), + isLocationSelected + ? Container( + margin: EdgeInsets.only(top: 5.0), + decoration: BoxDecoration( + border: Border.all(color: Colors.grey[400], width: 1.0), + ), + child: Image.network( + "https://maps.googleapis.com/maps/api/staticmap?center=" + + this.projectLat + + "," + + this.projectLong + + "&zoom=15&size=800x400&maptype=roadmap&markers=color:red%7C" + + this.projectLat + + "," + + this.projectLong + + "&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8"), + ) + : Container(), + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.15, + width: double.infinity, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.91, + height: 45.0, + child: RaisedButton( + color: new Color(0xFFc5272d), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.red[300], + onPressed: () { + getDirections(); + }, + child: + Text("GET DIRECTIONS", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { + back(); + }, + child: Text("BACK", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { + next(); + }, + child: Text("NEXT", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ], + ), + ), + ); + } + + getDirections() { + if (isLocationSelected) { + MapsLauncher.launchCoordinates(double.parse(projectLat), + double.parse(projectLong), this.projectName); + } else { + Utils.showErrorToast( + "Please select address from the dropdown menu to get directions"); + } + } + + next() { + if (isLocationSelected) { + getPaymentInfo(context, projectID); + } else { + Utils.showErrorToast( + "Please select address from the dropdown menu to continue"); + } + } + + back() { + Navigator.of(context).popAndPushNamed(HOME); + } + + setProjectLocation(newValue) { + print(newValue); + setState(() { + this.projectLat = + projectsList[(int.parse(newValue) - 1)].latitude.toString(); + this.projectLong = + projectsList[(int.parse(newValue) - 1)].longitude.toString(); + this.projectName = projectsList[(int.parse(newValue) - 1)].projectName; + this.projectID = + projectsList[(int.parse(newValue) - 1)].projectID.toString(); + isLocationSelected = true; + }); + } + + getPaymentInfo(BuildContext context, String projectID) { + CovidDriveThruService service = new CovidDriveThruService(); + + CovidPaymentInfoResponse covidPaymentInfoResponse = + new CovidPaymentInfoResponse(); + + service + .getCovidPaymentInformation(context, int.parse(projectID)) + .then((res) { + if (res['MessageStatus'] == 1) { + setState(() { + covidPaymentInfoResponse = CovidPaymentInfoResponse.fromJson( + res['COVID19_PatientShare']); + print(covidPaymentInfoResponse.procedureNameField); + }); + } else {} + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidPaymentDetails( + covidPaymentInfoResponse: covidPaymentInfoResponse, + projectID: int.parse(projectID), + ))); + }); + } + + getProjectsList(BuildContext context) { + CovidDriveThruService service = new CovidDriveThruService(); + service.getCovidProjectsList(context).then((res) { + print(res); + if (res['MessageStatus'] == 1) { + print(res); + setState(() { + res['List_COVID19_ProjectDriveThroughTestingCenter'].forEach((v) { + projectsList.add(new DriveThroughTestingCenterModel.fromJson(v)); + }); + }); + } else {} + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } +} diff --git a/lib/pages/Covid-DriveThru/covid-payment-alert.dart b/lib/pages/Covid-DriveThru/covid-payment-alert.dart new file mode 100644 index 00000000..ac5f45fc --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-payment-alert.dart @@ -0,0 +1,288 @@ +import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class CovidPaymentAlert extends StatefulWidget { + PatientShareResponse patientShareResponse; + + CovidPaymentAlert({@required this.patientShareResponse}); + + @override + _CovidPaymentAlertState createState() => _CovidPaymentAlertState(); +} + +class _CovidPaymentAlertState extends State { + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + isShowAppBar: true, + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 200.0, + color: new Color(0xFFc5272d), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: 50.0), + child: SvgPicture.asset( + 'assets/images/new-design/alert_icon.svg', + width: 80.0, + height: 80.0), + ), + Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(left: 30.0, right: 20.0), + child: Text("Alert", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 24.0)), + ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + margin: EdgeInsets.only( + left: 30.0, right: 20.0, top: 5.0), + child: Text( + "Pay With-in 15 mins to confirm the appointment", + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.white, fontSize: 20.0)), + ), + ], + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 30.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + alignment: Alignment.center, + child: Text("Pay With-in 15 mins", + overflow: TextOverflow.clip, + style: TextStyle( + color: new Color(0xFFc5272d), + fontSize: 24.0, + fontWeight: FontWeight.bold)), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(top: 15.0), + child: Text( + "Payment for Covid-19 Test should Be made with-in 15 mins otherwise The system will Cancel the Scheduled appointment automatically​.", + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.grey[700], + fontSize: 18.0, + letterSpacing: 0.8)), + ), + Container( + margin: EdgeInsets.only( + top: 40.0, bottom: 10.0, left: 0.0, right: 20.0), + child: Text(TranslationBase.of(context).appoInfo, + style: TextStyle( + fontSize: 18.0, + color: Colors.grey[700], + fontWeight: FontWeight.bold)), + ), + Container( + margin: EdgeInsets.only(left: 0.0, bottom: 20.0), + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.grey[200], + boxShadow: [ + BoxShadow(color: Colors.grey, spreadRadius: 2), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, bottom: 10.0, left: 20.0, right: 20.0), + child: Text("COVID-19 TEST", + style: TextStyle( + fontSize: 18.0, + color: Colors.black, + fontWeight: FontWeight.bold)), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + children: [ + Container( + margin: + EdgeInsets.only(left: 20.0, right: 20.0), + child: Icon( + Icons.local_hospital, + size: 24, + color: Colors.grey[700], + )), + Container( + child: Text( + widget.patientShareResponse.projectName != + null + ? widget.patientShareResponse.projectName + : "NULL", + style: TextStyle( + fontSize: 18.0, color: Colors.grey[700])), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + children: [ + Container( + margin: + EdgeInsets.only(left: 20.0, right: 20.0), + child: Icon( + Icons.date_range, + size: 24, + color: Colors.grey[700], + )), + Container( + child: Text( + widget.patientShareResponse.appointmentDate != + null + ? getDate(widget.patientShareResponse + .appointmentDate) + .split(" ")[0] + : "NULL", + style: TextStyle( + fontSize: 18.0, color: Colors.grey[700])), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + children: [ + Container( + margin: + EdgeInsets.only(left: 20.0, right: 20.0), + child: Icon( + Icons.access_time, + size: 24, + color: Colors.grey[700], + )), + Container( + child: Text( + widget.patientShareResponse.appointmentDate != + null + ? getDate(widget.patientShareResponse + .appointmentDate) + .split(" ")[1] + : "NULL", + style: TextStyle( + fontSize: 18.0, color: Colors.grey[700])), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(bottom: 10.0), + child: Row( + children: [ + Container( + margin: + EdgeInsets.only(left: 20.0, right: 20.0), + child: SvgPicture.asset( + "assets/images/new-design/track_icon.svg", + width: 20.0, + height: 20.0)), + Container( + child: Text( + widget.patientShareResponse.doctorNameObj != + null + ? widget + .patientShareResponse.doctorNameObj + : "NULL", + style: TextStyle( + fontSize: 18.0, color: Colors.grey[700])), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ], + ), + ), + bottomSheet: Container( + margin: EdgeInsets.all(10.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { +// bookCovidTestAppointment(); + }, + child: Text("NEXT", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ); + } + + String getDate(String appoDate) { + var appoDateFormatted = ""; + + var dateObj = DateUtil.convertStringToDate(appoDate); + + setState(() { + appoDateFormatted = DateUtil.getWeekDay(dateObj.weekday) + + ", " + + dateObj.day.toString() + + " " + + DateUtil.getMonth(dateObj.month) + + " " + + dateObj.year.toString() + + " " + + dateObj.hour.toString() + + ":" + + dateObj.minute.toString() + + ":00"; + }); + return appoDateFormatted; + } +} diff --git a/lib/pages/Covid-DriveThru/covid-payment-details.dart b/lib/pages/Covid-DriveThru/covid-payment-details.dart new file mode 100644 index 00000000..1254997d --- /dev/null +++ b/lib/pages/Covid-DriveThru/covid-payment-details.dart @@ -0,0 +1,257 @@ +import 'package:diplomaticquarterapp/models/CovidDriveThru/CovidPaymentInfoResponse.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/Covid-TimeSlots.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class CovidPaymentDetails extends StatefulWidget { + CovidPaymentInfoResponse covidPaymentInfoResponse; + int projectID; + + CovidPaymentDetails( + {@required this.covidPaymentInfoResponse, @required this.projectID}); + + @override + _CovidPaymentDetailsState createState() => _CovidPaymentDetailsState(); +} + +class _CovidPaymentDetailsState extends State { + bool isAgree = false; + + @override + Widget build(BuildContext context) { + return AppScaffold( + appBarTitle: "COVID-19 TEST", + isShowAppBar: true, + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.fromLTRB(15.0, 15.0, 15.0, 0.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 150.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/new-design/covid-19-big-banner-bg.png"), + fit: BoxFit.fill, + ), + color: Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all(Radius.circular(10))), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.only(left: 15.0, right: 15.0, top: 30.0), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 90.0, + height: 90.0), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only( + left: 20.0, right: 20.0, top: 40.0), + child: Text("COVID-19 TEST", + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 24.0)), + ), + Container( + margin: EdgeInsets.only( + left: 20.0, right: 20.0, top: 10.0), + child: Text("Drive-Thru", + style: TextStyle( + color: Colors.white, fontSize: 24.0)), + ), + ], + ), + ], + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10.0), + color: Colors.white), + margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 5.0), + padding: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 20.0), + child: Column( + children: [ + Container( + alignment: Alignment.center, + margin: + EdgeInsets.only(left: 0.0, right: 20.0, top: 30.0), + child: Text("Test Fees", + style: TextStyle( + color: Colors.black, + fontSize: 22.0, + fontWeight: FontWeight.bold)), + ), + Table( + children: [ + TableRow(children: [ + TableCell( + child: _getNormalText(TranslationBase.of(context) + .patientShareToDo)), + TableCell( + child: _getNormalText(widget + .covidPaymentInfoResponse.patientShareField + .toString())), + ]), + TableRow(children: [ + TableCell( + child: _getNormalText( + TranslationBase.of(context).patientTaxToDo)), + TableCell( + child: _getNormalText(widget + .covidPaymentInfoResponse + .patientTaxAmountField + .toString())), + ]), + TableRow(children: [ + TableCell( + child: _getNormalText(TranslationBase.of(context) + .patientShareTotalToDo)), + TableCell( + child: _getNormalText(widget + .covidPaymentInfoResponse + .patientShareWithTaxField + .toString())), + ]), + ], + ), + ], + ), + ), + Container( + margin: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 5.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Checkbox( + value: isAgree, + onChanged: (value) { + setState(() { + isAgree = !isAgree; + }); + }, + activeColor: Colors.blue, + ), + Texts(TranslationBase.of(context) + .iAgreeToTheTermsAndConditions), + ], + ), + ), + Divider( + color: Colors.grey, + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 5.0), + child: Text("You can pay by following options: ", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + fontFamily: "Open-Sans")), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 5.0), + child: Image.asset( + "assets/images/new-design/payment_options_invoice_confirmation.png", + width: 300), + ), + ], + ), + ), + ), + bottomSheet: Container( + margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 20.0), + child: Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: () { + cancel(); + }, + child: Text("CANCEL", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + Expanded( + flex: 1, + child: Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 5.0, 0.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: Colors.grey[500], + onPressed: isAgree ? next : null, + child: Text("NEXT", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ), + ], + ), + ), + ); + } + + void next() { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CovidTimeSlots( + projectID: widget.projectID, + ))); + } + + cancel() { + Navigator.pop(context); + } + + _getNormalText(text) { + return Container( + margin: EdgeInsets.only(top: 20.0, right: 10.0), + child: Text(text, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontFamily: 'Open-Sans', + letterSpacing: 0.5, + color: Colors.grey[700])), + ); + } +} diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index 19e82086..18740ce7 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -352,18 +352,24 @@ class _AppointmentActionsState extends State { cancelAppointment() { ConfirmDialog.closeAlertDialog(context); DoctorsListService service = new DoctorsListService(); - service.cancelAppointment(widget.appo, context).then((res) { - print(res); - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - Navigator.of(context).pop(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + service + .cancelAppointment(widget.appo, context) + .then((res) { + print(res); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + Navigator.of(context).pop(); + }); } openAppointmentRadiology() { @@ -468,8 +474,7 @@ class _AppointmentActionsState extends State { } }).catchError((err) { print(err); - AppToast.showErrorToast( - message: err); + AppToast.showErrorToast(message: err); }).showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } @@ -540,7 +545,7 @@ class _AppointmentActionsState extends State { DoctorsListService service = new DoctorsListService(); service .confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, - widget.appo.projectID, context) + widget.appo.projectID, widget.appo.isLiveCareAppointment, context) .then((res) { if (res['MessageStatus'] == 1) { AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index b64bd232..2e5c88b0 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -24,7 +24,7 @@ class _ApointmentCardState extends State { navigateToAppointmentDetails(context, widget.appo); }, child: Card( - margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), + margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index dc96864a..7c20b53d 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -16,6 +16,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -37,8 +38,6 @@ class _ToDoState extends State { @override void initState() { -// authUser = authProvider.getAuthenticatedUser(); - print("initState!!!!!"); widget.patientShareResponse = new PatientShareResponse(); WidgetsBinding.instance .addPostFrameCallback((_) => getPatientAppointmentHistory()); @@ -50,205 +49,230 @@ class _ToDoState extends State { return AppScaffold( appBarTitle: TranslationBase.of(context).todoList, body: SingleChildScrollView( - child: Container( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.appoList.length, - itemBuilder: (context, index) { - return Container( - margin: EdgeInsets.all(10.0), - child: Card( - margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), - color: Colors.white, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - child: Container( - width: MediaQuery.of(context).size.width, - padding: EdgeInsets.all(10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Row( + child: Column( + children: [ + Container( + child: ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: widget.appoList.length, + itemBuilder: (context, index) { + return Container( + margin: EdgeInsets.all(10.0), + child: Card( + margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 8.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width, + padding: EdgeInsets.all(10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, children: [ - Image.asset( - "assets/images/new-design/time_icon.png", - width: 20.0, - height: 20.0), - Container( - margin: EdgeInsets.only(left: 10.0, right: 30.0), - child: Text( - getDate( - widget.appoList[index].appointmentDate), - style: TextStyle(fontSize: 12.0)), + Row( + children: [ + Image.asset( + "assets/images/new-design/time_icon.png", + width: 20.0, + height: 20.0), + Container( + margin: + EdgeInsets.only(left: 5.0, right: 25.0), + child: Text( + getDate(widget + .appoList[index].appointmentDate), + style: TextStyle(fontSize: 11.0)), + ), + widget.appoList[index].isLiveCareAppointment + ? SvgPicture.asset( + "assets/images/new-design/liveCare_logo_icon.svg", + width: 20.0, + height: 20.0) + : Image.asset( + "assets/images/new-design/hospital_address_icon.png", + width: 20.0, + height: 20.0), + Container( + margin: + EdgeInsets.only(left: 5.0, right: 5.0), + child: widget + .appoList[index].isLiveCareAppointment + ? Text( + TranslationBase.of(context) + .liveCareAppo, + style: TextStyle(fontSize: 12.0)) + : Text(widget.appoList[index].projectName != null ? widget.appoList[index].projectName : "-", + style: TextStyle(fontSize: 11.0)), + ), + ], ), - Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), Container( - margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Text(widget.appoList[index].projectName, - style: TextStyle(fontSize: 12.0)), - ), - ], - ), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Divider( - color: Colors.grey[500], - ), - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 1, - child: Container( - height: - MediaQuery.of(context).size.height * 0.1, - margin: EdgeInsets.only(top: 5.0), - child: ClipRRect( - borderRadius: BorderRadius.circular(100.0), - child: Image.network( - widget.appoList[index].doctorImageURL, - fit: BoxFit.fill), - ), + margin: EdgeInsets.only(top: 5.0), + child: Divider( + color: Colors.grey[500], ), ), - Expanded( - flex: 3, - child: Container( - margin: EdgeInsets.only( - top: 20.0, left: 20.0, right: 20.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.appoList[index].doctorTitle + - " " + - widget - .appoList[index].doctorNameObj, - style: TextStyle( - fontSize: 14.0, - color: Colors.black, - fontWeight: FontWeight.bold, - letterSpacing: 1.0)), - Container( - margin: EdgeInsets.only( - top: 3.0, bottom: 3.0), - child: Text( - getDoctorSpeciality(widget - .appoList[index] - .doctorSpeciality) - .trim(), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[600], - letterSpacing: 1.0)), + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 1, + child: Container( + height: MediaQuery.of(context).size.height * + 0.1, + margin: EdgeInsets.only(top: 5.0), + child: ClipRRect( + borderRadius: + BorderRadius.circular(100.0), + child: Image.network( + widget.appoList[index].doctorImageURL, + fit: BoxFit.fill), ), - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.max, + ), + ), + Expanded( + flex: 3, + child: Container( + margin: EdgeInsets.only( + top: 20.0, left: 20.0, right: 20.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, children: [ - RatingBar.readOnly( - initialRating: widget - .appoList[index].actualDoctorRate - .toDouble(), - size: 20.0, - filledColor: Colors.yellow[700], - emptyColor: Colors.grey[500], - isHalfAllowed: true, - halfFilledIcon: Icons.star_half, - filledIcon: Icons.star, - emptyIcon: Icons.star, + Text( + widget.appoList[index].doctorTitle + + " " + + widget.appoList[index] + .doctorNameObj, + style: TextStyle( + fontSize: 14.0, + color: Colors.black, + fontWeight: FontWeight.bold, + letterSpacing: 1.0)), + Container( + margin: EdgeInsets.only( + top: 3.0, bottom: 3.0), + child: Text( + getDoctorSpeciality(widget + .appoList[index] + .doctorSpeciality) + .trim(), + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[600], + letterSpacing: 1.0)), + ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + children: [ + RatingBar.readOnly( + initialRating: widget + .appoList[index] + .actualDoctorRate + .toDouble(), + size: 20.0, + filledColor: Colors.yellow[700], + emptyColor: Colors.grey[500], + isHalfAllowed: true, + halfFilledIcon: Icons.star_half, + filledIcon: Icons.star, + emptyIcon: Icons.star, + ), + ], ), ], ), - ], + ), ), - ), + Expanded( + flex: 1, + child: InkWell( + onTap: () => performNextAction( + widget.appoList[index]), + child: Container( + margin: EdgeInsets.only(top: 20.0), + child: Column( + children: [ + Image.asset( + getNextActionImage(widget + .appoList[index].nextAction), + width: 50.0, + height: 50.0), + Container( + margin: EdgeInsets.only(top: 5.0), + child: Text( + getNextActionText(widget + .appoList[index] + .nextAction), + textAlign: TextAlign.center, + style: + TextStyle(fontSize: 12.0)), + ) + ], + ), + ), + ), + ) + ], ), - Expanded( - flex: 1, - child: InkWell( - onTap: () => - performNextAction(widget.appoList[index]), - child: Container( - margin: EdgeInsets.only(top: 20.0), - child: Column( - children: [ - Image.asset( - getNextActionImage(widget - .appoList[index].nextAction), - width: 50.0, - height: 50.0), - Container( - margin: EdgeInsets.only(top: 5.0), - child: Text( - getNextActionText(widget - .appoList[index].nextAction), - textAlign: TextAlign.center, - style: TextStyle(fontSize: 12.0)), - ) - ], + Divider( + color: Colors.grey[500], + ), + Flex( + direction: Axis.horizontal, + children: [ + Expanded( + flex: 2, + child: Container( + child: Text( + getNextActionDescription( + widget.appoList[index].nextAction), + style: TextStyle( + fontSize: 12.0, + color: Colors.grey[700])), ), ), - ), - ) - ], - ), - Divider( - color: Colors.grey[500], - ), - Flex( - direction: Axis.horizontal, - children: [ - Expanded( - flex: 2, - child: Container( - child: Text( - getNextActionDescription( - widget.appoList[index].nextAction), - style: TextStyle( - fontSize: 12.0, - color: Colors.grey[700])), - ), + Expanded( + flex: 1, + child: GestureDetector( + onTap: () { + navigateToAppointmentDetails( + context, widget.appoList[index]); + }, + child: Container( + child: Text( + TranslationBase.of(context) + .upcomingDetails, + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 12.0, + color: Colors.red[600], + decoration: + TextDecoration.underline)), + ), + ), + ) + ], ), - Expanded( - flex: 1, - child: GestureDetector( - onTap: () { - navigateToAppointmentDetails( - context, widget.appoList[index]); - }, - child: Container( - child: Text( - TranslationBase.of(context) - .upcomingDetails, - textAlign: TextAlign.end, - style: TextStyle( - fontSize: 12.0, - color: Colors.red[600], - decoration: - TextDecoration.underline)), - ), - ), - ) ], ), - ], + ), ), - ), - ), - ); - }, - ), + ); + }, + ), + ), + SizedBox( + height: 120.0, + ), + ], ), ), ); @@ -284,7 +308,11 @@ class _ToDoState extends State { break; case 50: - return "assets/images/new-design/liveCare_logo_icon.png"; + return "assets/images/new-design/confirm_button.png"; + break; + + case 60: + return "assets/images/new-design/waiting_for_doctor.png"; break; default: @@ -297,14 +325,17 @@ class _ToDoState extends State { case 10: confirmAppointment(appo); break; - case 20: getPatientShare(context, appo); break; - case 30: getAppoQR(context, appo); break; + case 50: + confirmAppointment(appo); + break; + case 60: + break; } } @@ -334,7 +365,11 @@ class _ToDoState extends State { break; case 50: - return TranslationBase.of(context).livecare; + return TranslationBase.of(context).confirmLiveCare; + break; + + case 60: + return TranslationBase.of(context).waitingForDoctor; break; default: @@ -371,6 +406,10 @@ class _ToDoState extends State { return TranslationBase.of(context).upcomingLivecare; break; + case 60: + return TranslationBase.of(context).waitingForDoctor; + break; + default: return ""; } @@ -427,7 +466,6 @@ class _ToDoState extends State { getPatientAppointmentHistory() { DoctorsListService service = new DoctorsListService(); service.getPatientAppointmentHistory(true, context).then((res) { - print(res['AppoimentAllHistoryResultList']); if (res['MessageStatus'] == 1) { setState(() { if (res['AppoimentAllHistoryResultList'].length != 0) { @@ -438,13 +476,18 @@ class _ToDoState extends State { }); } else {} }); + widget.appoList.forEach((element) { + print(element.isLiveCareAppointment); + print(element.nextAction); + }); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { print(err); AppToast.showErrorToast(message: err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getPatientShare(context, AppoitmentAllHistoryResultList appo) { @@ -457,7 +500,8 @@ class _ToDoState extends State { openPaymentDialog(appo, widget.patientShareResponse); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } getAppoQR(context, AppoitmentAllHistoryResultList appo) { @@ -478,7 +522,8 @@ class _ToDoState extends State { navigateToQR(context, res['AppointmentQR'], patientShareResponse); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToQR( @@ -592,7 +637,8 @@ class _ToDoState extends State { } }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } createAdvancePayment(res, AppoitmentAllHistoryResultList appo) { @@ -610,7 +656,8 @@ class _ToDoState extends State { appo); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } addAdvancedNumberRequest(String advanceNumber, String paymentReference, @@ -624,7 +671,8 @@ class _ToDoState extends State { getAppoQR(context, appo); }).catchError((err) { print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } Future navigateToPaymentMethod( @@ -659,17 +707,49 @@ class _ToDoState extends State { confirmAppointment(AppoitmentAllHistoryResultList appo) { DoctorsListService service = new DoctorsListService(); service - .confirmAppointment( - appo.appointmentNo, appo.clinicID, appo.projectID, context) + .confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, + appo.isLiveCareAppointment, context) .then((res) { - if (res['MessageStatus'] == 1) { - AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); - getPatientAppointmentHistory(); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } - }).catchError((err) { - print(err); - }).showProgressBar(text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + getPatientAppointmentHistory(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + if (appo.isLiveCareAppointment) { + insertLiveCareVIDARequest(appo); + } else { + getPatientAppointmentHistory(); + } + }); + } + + insertLiveCareVIDARequest(AppoitmentAllHistoryResultList appo) { + DoctorsListService service = new DoctorsListService(); + service + .insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, + appo.serviceID, appo.doctorID, context) + .then((res) { + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['ErrorEndUserMessage']); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + getPatientAppointmentHistory(); + }); } } diff --git a/lib/pages/ToDoList/widgets/upcomingCard.dart b/lib/pages/ToDoList/widgets/upcomingCard.dart index 1b4a4cc3..c1d1b546 100644 --- a/lib/pages/ToDoList/widgets/upcomingCard.dart +++ b/lib/pages/ToDoList/widgets/upcomingCard.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:rating_bar/rating_bar.dart'; class TodoListCard extends StatefulWidget { @@ -12,7 +13,6 @@ class TodoListCard extends StatefulWidget { var languageID; final VoidCallback onListUpdated; - TodoListCard({@required this.appo, this.onListUpdated}); @override @@ -54,14 +54,22 @@ class _TodoListCardState extends State { child: Text(getDate(widget.appo.appointmentDate), style: TextStyle(fontSize: 12.0)), ), - Image.asset( - "assets/images/new-design/hospital_address_icon.png", - width: 20.0, - height: 20.0), + widget.appo.isLiveCareAppointment + ? SvgPicture.asset( + "assets/images/new-design/liveCare_logo_icon.svg", + width: 20.0, + height: 20.0) + : Image.asset( + "assets/images/new-design/hospital_address_icon.png", + width: 20.0, + height: 20.0), Container( margin: EdgeInsets.only(left: 10.0, right: 10.0), - child: Text(widget.appo.projectName, - style: TextStyle(fontSize: 12.0)), + child: widget.appo.isLiveCareAppointment + ? Text(TranslationBase.of(context).upcomingLivecare, + style: TextStyle(fontSize: 12.0)) + : Text(widget.appo.projectName, + style: TextStyle(fontSize: 12.0)), ), ], ), @@ -105,7 +113,10 @@ class _TodoListCardState extends State { letterSpacing: 1.0)), Container( margin: EdgeInsets.only(top: 3.0, bottom: 3.0), - child: Text(getDoctorSpeciality(widget.appo.doctorSpeciality).trim(), + child: Text( + getDoctorSpeciality( + widget.appo.doctorSpeciality) + .trim(), style: TextStyle( fontSize: 12.0, color: Colors.grey[600], @@ -323,14 +334,13 @@ class _TodoListCardState extends State { } String getMinute(DateTime dateObj) { - if(dateObj.minute == 0) { + if (dateObj.minute == 0) { return dateObj.minute.toString() + "0"; } else { return dateObj.minute.toString(); } } - String getDoctorSpeciality(List docSpecial) { String docSpeciality = ""; docSpecial.forEach((v) { diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 59c0a167..79671682 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -3,18 +3,19 @@ import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/hmg_service.dart'; +import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -56,20 +57,114 @@ class _HomePageState extends State { child: Stack( children: [ Positioned( - top: 30, - left: 15, - right: 15, + top: 15, + left: 5, + right: 5, child: Container( width: MediaQuery.of(context).size.width * 0.8, child: Row( children: [ + Expanded( + child: Container( + height: 120, + padding: EdgeInsets.all(5), + margin: EdgeInsets.all(5), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/new-design/covid_bg_transparent.png"), + fit: BoxFit.fill, + ), + color: + Colors.white.withOpacity(0.3), + borderRadius: BorderRadius.all( + Radius.circular(5))), + child: Container( + margin: EdgeInsets.only(top: 10.0), + child: Column( + children: [ + Text("COVID-19 TEST", + style: TextStyle( + color: Colors.white, + fontWeight: + FontWeight.bold, + fontSize: 18.0)), + Row( + children: [ + Container( + margin: EdgeInsets.only( + top: 15.0, left: 3.5, right: 3.5), + child: SvgPicture.asset( + 'assets/images/new-design/covid-19-car.svg', + width: 45.0, + height: 45.0), + ), + Container( + margin: EdgeInsets.only( + left: 10.0, + top: 10.0), + child: Column( + children: [ + Text("Drive-Thru", + style: TextStyle( + color: Colors + .white, + fontWeight: + FontWeight + .bold, + fontSize: + 16.0)), + ButtonTheme( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 5.0), + ), + minWidth: MediaQuery.of( + context) + .size + .width * + 0.15, + height: 25.0, + child: RaisedButton( + color: Colors + .red[800], + textColor: + Colors.white, + disabledTextColor: + Colors.white, + disabledColor: + new Color( + 0xFFbcc2c4), + onPressed: () { + navigateToCovidDriveThru(); + }, + child: Text( + "BOOK NOW", + style: TextStyle( + fontSize: + 12.0)), + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), + ), + ), Expanded( child: InkWell( onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())), child: Container( - height: 110, + height: 120, padding: EdgeInsets.all(15), margin: EdgeInsets.all(5), decoration: BoxDecoration( @@ -77,25 +172,14 @@ class _HomePageState extends State { .withOpacity(0.3), borderRadius: BorderRadius.all( Radius.circular(5))), - child: Image.asset( - 'assets/images/livecare_white_logo.png', + child: SvgPicture.asset( + projectViewModel.isArabic + ? 'assets/images/new-design/livecare_arabic_logo.svg' + : 'assets/images/new-design/liveCare_white_logo.svg', ), ), ), ), - Expanded( - child: Container( - height: 110, - padding: EdgeInsets.all(15), - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - color: - Colors.white.withOpacity(0.3), - borderRadius: BorderRadius.all( - Radius.circular(5))), - // child: Image.asset('assets/images/livecare_white_logo.png',), - ), - ), ], ), ), @@ -662,6 +746,11 @@ class _HomePageState extends State { ), ); } + + navigateToCovidDriveThru() { + Navigator.push(context, + MaterialPageRoute(builder: (context) => CovidDrivethruLocation())); + } } class DashboardItem extends StatelessWidget { diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index a545f8a7..0c6a2144 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -29,9 +29,6 @@ import 'package:rxdart/rxdart.dart'; import 'home_page.dart'; - - - class LandingPage extends StatefulWidget { static bool isOpenCallPage = false; diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index f3129823..fc5c4eab 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -8,6 +8,8 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; +import 'livecare_type_select.dart'; + class LiveCareHome extends StatefulWidget { static bool showFooterButton = true; diff --git a/lib/pages/livecare/livecare_scheduling/livecare_scheduling_clinic_list.dart b/lib/pages/livecare/livecare_scheduling/livecare_scheduling_clinic_list.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart new file mode 100644 index 00000000..4309cc62 --- /dev/null +++ b/lib/pages/livecare/livecare_scheduling/schedule_clinic_card.dart @@ -0,0 +1,51 @@ +import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; +import 'package:flutter/material.dart'; + +class ScheduleClinicCard extends StatefulWidget { + bool isSelected; + final ClinicsHaveScheduleList clinicsHaveScheduleList; + var languageID; + + ScheduleClinicCard( + {this.isSelected, + this.languageID, + @required this.clinicsHaveScheduleList}); + + @override + _ScheduleClinicCardState createState() => _ScheduleClinicCardState(); +} + +class _ScheduleClinicCardState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Card( + margin: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 8.0), + color: widget.isSelected ? Colors.blue : Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + child: Text( + widget.languageID == 'ar' + ? widget.clinicsHaveScheduleList.clinicDescN + : widget.clinicsHaveScheduleList.clinicDesc, + style: TextStyle( + fontSize: 16.0, + color: + widget.isSelected ? Colors.white : Colors.black)), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/livecare/livecare_type_select.dart b/lib/pages/livecare/livecare_type_select.dart new file mode 100644 index 00000000..64114304 --- /dev/null +++ b/lib/pages/livecare/livecare_type_select.dart @@ -0,0 +1,227 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; + +class LiveCareTypeSelect extends StatefulWidget { + @override + _LiveCareTypeSelectState createState() => _LiveCareTypeSelectState(); +} + +class _LiveCareTypeSelectState extends State { + var languageID; + AppSharedPreferences sharedPref = AppSharedPreferences(); + + @override + void initState() { + getLanguageID(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + leading: InkWell( + onTap: () { + Navigator.pop(context, null); + }, + child: Icon( + Icons.close, + color: Colors.white, + ), + ), + title: Text(TranslationBase.of(context).bookAppo, + style: TextStyle(color: Colors.white)), + ), + body: SingleChildScrollView( + child: Container( + margin: EdgeInsets.only(left: 20.0, right: 20.0), + child: Column( + children: [ + Container( + alignment: Alignment.center, + margin: EdgeInsets.only(top: 15.0, bottom: 10.0), + child: Image.asset( + languageID == 'ar' + ? "assets/images/new-design/liveCare_ar_bg.png" + : "assets/images/new-design/liveCare_en_bg.png", + width: 120), + ), + Container( + alignment: Alignment.center, + child: Text("LiveCare Service", + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 20.0))), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.center, + child: Text( + "is to obtain medical advice with a specialist doctor Via a video call", + textAlign: TextAlign.center, + style: TextStyle(fontSize: 18.0))), + Container( + margin: EdgeInsets.only(top: 15.0), + alignment: Alignment.centerLeft, + child: Text("WHY LIVECARE?", + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 20.0))), + Container( + margin: EdgeInsets.only(top: 20.0, left: 20.0), + child: Row( + children: [ + SvgPicture.asset("assets/images/new-design/check_icon.svg", + width: 25), + Container( + width: MediaQuery.of(context).size.width * 0.72, + margin: EdgeInsets.all(10.0), + child: Text( + "No need to wait, you will get Medical consultation immediately via Video call.", + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14.0)), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, left: 20.0), + child: Row( + children: [ + SvgPicture.asset("assets/images/new-design/check_icon.svg", + width: 25), + Container( + width: MediaQuery.of(context).size.width * 0.72, + margin: EdgeInsets.all(10.0), + child: Text("The doctor will see your medical file.", + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14.0)), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 5.0, left: 20.0), + child: Row( + children: [ + SvgPicture.asset("assets/images/new-design/check_icon.svg", + width: 25), + Container( + width: MediaQuery.of(context).size.width * 0.72, + margin: EdgeInsets.all(10.0), + child: Text("Free Prescription delivery service.", + overflow: TextOverflow.clip, + style: TextStyle(fontSize: 14.0)), + ) + ], + ), + ), + Container( + margin: EdgeInsets.only(top: 20.0), + child: Text( + "** The service is included with some insurance companies according to the terms and conditions With our best wishes for health and wellness", + style: TextStyle(fontSize: 16.0))), + InkWell( + onTap: (){ + Navigator.pop(context, "immediate"); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.red[900], + borderRadius: BorderRadius.all(Radius.circular(10.0))), + height: 120.0, + margin: EdgeInsets.only(top: 20.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: 20.0), + child: SvgPicture.asset( + "assets/images/new-design/liveCare_logo_icon_white.svg", + width: 80), + ), + Container( + width: MediaQuery.of(context).size.width * 0.56, + margin: EdgeInsets.fromLTRB(30.0, 20.0, 0.0, 0.0), + child: Column( + children: [ + Text("Get Medical consultation immediately", + overflow: TextOverflow.clip, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0, + color: Colors.white)), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.centerLeft, + child: Text("Instant video call", + style: TextStyle( + fontSize: 18.0, color: Colors.white)), + ) + ], + ), + ), + ], + )), + ), + InkWell( + onTap: (){ + Navigator.pop(context, "schedule"); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.grey[700], + borderRadius: BorderRadius.all(Radius.circular(10.0))), + height: 120.0, + margin: EdgeInsets.only(top: 20.0), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(left: 20.0), + child: Image.asset( + "assets/images/new-design/calendar.png", + width: 70), + ), + Container( + width: MediaQuery.of(context).size.width * 0.58, + margin: EdgeInsets.fromLTRB(30.0, 30.0, 0.0, 0.0), + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + child: Text("Book Appointment", + overflow: TextOverflow.clip, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18.0, + color: Colors.white)), + ), + Container( + margin: EdgeInsets.only(top: 10.0), + alignment: Alignment.centerLeft, + child: Text("Schedule Video Call", + style: TextStyle( + fontSize: 18.0, color: Colors.white)), + ) + ], + ), + ), + ], + )), + ), + SizedBox( + height: 40.0, + ), + ], + ), + ), + ), + ); + } + + getLanguageID() async { + var languageID = await sharedPref.getString(APP_LANGUAGE); + setState(() { + this.languageID = languageID; + }); + } +} diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 9100a64e..c1f5eb75 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -1,9 +1,14 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; +import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/LiveCareScheduleClinicsListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/SearchResults.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart'; +import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; @@ -30,8 +35,11 @@ class _clinic_listState extends State { int currentSelectedIndex = 0; LiveCareClinicsListResponse liveCareClinicsListResponse; + LiveCareScheduleClinicsListResponse liveCareScheduleClinicsListResponse; + bool isDataLoaded = false; var languageID; + var currentSelectedLiveCareType; int selectedClinicID = 1; String selectedClinicName = "-"; @@ -46,11 +54,13 @@ class _clinic_listState extends State { @override void initState() { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); + liveCareScheduleClinicsListResponse = + new LiveCareScheduleClinicsListResponse(); + WidgetsBinding.instance.addPostFrameCallback((_) { -// Future.delayed(new Duration(milliseconds: 1200), () { - getLiveCareClinicsList(); -// }); + openLiveCareSelectionDialog(); }); + getLanguageID(); super.initState(); } @@ -58,77 +68,9 @@ class _clinic_listState extends State { @override Widget build(BuildContext context) { return SingleChildScrollView( - child: Column( - children: [ - isDataLoaded - ? Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Text("Online Clinics: ", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareClinicsListResponse - .patientERGetClinicsList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedIndex(liveCareClinicsListResponse - .patientERGetClinicsList[index]); - }, - child: ClinicCard( - isSelected: selectedClinicID == - liveCareClinicsListResponse - .patientERGetClinicsList[index] - .serviceID - ? true - : false, - patientERGetClinicsList: - liveCareClinicsListResponse - .patientERGetClinicsList[index], - languageID: languageID, - ), - ); - }, - ), - Container( - height: 10.0, - ), - ], - ), - ) - : Container(), - isDataLoaded ? Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: startLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), - ), - ), - ) : Container(), - ], - ), - ); + child: currentSelectedLiveCareType == "immediate" + ? getLiveCareImmediateClinicList() + : getLiveCareScheduleClinicList()); } void startLiveCare() { @@ -388,10 +330,298 @@ class _clinic_listState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } + getLiveCareScheduleClinicsList() { + isDataLoaded = false; + LiveCareService service = new LiveCareService(); + service.getLiveCareScheduledClinics(context).then((res) { + print(res['ClinicsHaveScheduleList'].length); + if (res['MessageStatus'] == 1) { + setState(() { + liveCareScheduleClinicsListResponse = + LiveCareScheduleClinicsListResponse.fromJson(res); + print(liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList.length); + selectedClinicID = liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList[0].serviceID; + selectedClinicName = liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList[0].clinicDesc; + isDataLoaded = true; + }); + } else { + isDataLoaded = true; + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + openLiveCareSelectionDialog() { + Navigator.of(context) + .push(new MaterialPageRoute( + builder: (BuildContext context) { + return LiveCareTypeSelect(); + }, + fullscreenDialog: true)) + .then((value) { + if (value == null) { + Navigator.pop(context); + } else { + print(value); + if (value == "immediate") { + setState(() { + currentSelectedLiveCareType = "immediate"; + }); + getLiveCareClinicsList(); + } + if (value == "schedule") { + setState(() { + currentSelectedLiveCareType = "schedule"; + }); + getLiveCareScheduleClinicsList(); + } + } + }); + } + + Widget getLiveCareScheduleClinicList() { + return Column( + children: [ + isDataLoaded + ? Container( + height: MediaQuery.of(context).size.height * 0.7, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ +// Container( +// margin: EdgeInsets.all(15.0), +// child: Text("Online Clinics: ", +// style: TextStyle( +// fontSize: 20.0, fontWeight: FontWeight.bold)), +// ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedScheduleIndex( + liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList[index]); + }, + child: ScheduleClinicCard( + isSelected: selectedClinicID == + liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList[index] + .serviceID + ? true + : false, + clinicsHaveScheduleList: + liveCareScheduleClinicsListResponse + .clinicsHaveScheduleList[index], + languageID: languageID, + ), + ); + }, + ), + Container( + height: 10.0, + ), + ], + ), + ) + : Container(), + isDataLoaded + ? Align( + alignment: FractionalOffset.bottomCenter, + child: Container( + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: startScheduleLiveCare, + child: Text("Start", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ) + : Container(), + ], + ); + } + + Widget getLiveCareImmediateClinicList() { + return Column( + children: [ + isDataLoaded + ? Container( + height: MediaQuery.of(context).size.height * 0.7, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(15.0), + child: Text("Online Clinics: ", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareClinicsListResponse + .patientERGetClinicsList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedIndex(liveCareClinicsListResponse + .patientERGetClinicsList[index]); + }, + child: ClinicCard( + isSelected: selectedClinicID == + liveCareClinicsListResponse + .patientERGetClinicsList[index] + .serviceID + ? true + : false, + patientERGetClinicsList: liveCareClinicsListResponse + .patientERGetClinicsList[index], + languageID: languageID, + ), + ); + }, + ), + Container( + height: 10.0, + ), + ], + ), + ) + : Container(), + isDataLoaded + ? Align( + alignment: FractionalOffset.bottomCenter, + child: Container( + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: startLiveCare, + child: Text("Start", style: TextStyle(fontSize: 18.0)), + ), + ), + ), + ) + : Container(), + ], + ); + } + + void startScheduleLiveCare() { + List doctorsList = []; + LiveCareService service = new LiveCareService(); + List _patientDoctorAppointmentListHospital = + List(); + service + .getLiveCareScheduledDoctorList(context, selectedClinicID) + .then((res) { + print(res['DoctorByClinicIDList']); + print(res['DoctorByClinicIDList'].length); + if (res['MessageStatus'] == 1) { + setState(() { + if (res['DoctorByClinicIDList'].length != 0) { + res['DoctorByClinicIDList'].forEach((v) { + doctorsList.add(new DoctorList.fromJson(v)); + }); + + doctorsList.forEach((element) { + List doctorByHospital = + _patientDoctorAppointmentListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (doctorByHospital.length != 0) { + _patientDoctorAppointmentListHospital[ + _patientDoctorAppointmentListHospital + .indexOf(doctorByHospital[0])] + .patientDoctorAppointmentList + .add(element); + } else { + _patientDoctorAppointmentListHospital.add( + PatientDoctorAppointmentList( + filterName: element.projectName, + distanceInKMs: + element.projectDistanceInKiloMeters.toString(), + patientDoctorAppointment: element)); + } + }); + } else {} + }); + this.sharedPref.setBool(IS_LIVECARE_APPOINTMENT, true); + navigateToSearchResults( + context, doctorsList, _patientDoctorAppointmentListHospital); + } else {} + }).catchError((err) { + print(err); + }).showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + } + + Future navigateToSearchResults( + context, + List docList, + List + patientDoctorAppointmentListHospital) async { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => SearchResults( + doctorsList: docList, + isLiveCareAppointment: true, + patientDoctorAppointmentListHospital: + patientDoctorAppointmentListHospital))); + } + updateSelectedIndex(PatientERGetClinicsList patientERGetClinicsList) { setState(() { selectedClinicID = patientERGetClinicsList.serviceID; selectedClinicName = patientERGetClinicsList.serviceName; }); } + + updateSelectedScheduleIndex(ClinicsHaveScheduleList patientERGetClinicsList) { + setState(() { + selectedClinicID = patientERGetClinicsList.serviceID; + selectedClinicName = patientERGetClinicsList.clinicDesc; + }); + } } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index c992e8e9..24d81bdf 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/LiveCare/insertVIDARequest.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; @@ -21,11 +22,12 @@ class DoctorsListService extends BaseService { double lat; double long; + String deviceToken; + String tokenID; Future getDoctorsList( int clinicID, int projectID, bool isNearest, BuildContext context, {doctorId}) async { - //Utils.showProgressDialog(context); Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -48,7 +50,7 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "Channel": req.Channel, "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, "SessionID": "YckwoXhUmWBsnHKEKig", @@ -106,7 +108,7 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "Channel": req.Channel, "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, "SessionID": null, @@ -146,7 +148,7 @@ class DoctorsListService extends BaseService { "VersionID": req.VersionID, "Channel": req.Channel, "generalid": 'Cs2020@2016\$2958', - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "TokenID": "", "DeviceTypeID": req.DeviceTypeID, "SessionID": null, @@ -188,7 +190,7 @@ class DoctorsListService extends BaseService { "LanguageID": languageID == 'ar' ? 1 : 2, "IPAdress": "10.20.10.20", "generalid": "Cs2020@2016\$2958", - "PatientOutSA": 0, + "PatientOutSA": authUser.outSA, "SessionID": null, "isDentalAllowedBackend": false, "DeviceTypeID": 1 @@ -205,6 +207,42 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getDoctorScheduledFreeSlots( + int docID, int clinicID, int projectID, int serviceID, BuildContext context) async { + Map request; + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "DoctorID": docID, + "IsBookingForLiveCare": 1, + "ClinicID": clinicID, + "ProjectID": projectID, + "OriginalClinicID": clinicID, + "ServiceID": serviceID, + "days": 50, + "isReschadual": false, + "VersionID": req.VersionID, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "generalid": "Cs2020@2016\$2958", + "PatientOutSA": authUser.outSA, + "SessionID": null, + "isDentalAllowedBackend": false, + "DeviceTypeID": 1 + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_SCHEDULE_DOCTOR_TIME_SLOTS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future insertAppointment(int docID, int clinicID, int projectID, String selectedTime, String selectedDate, BuildContext context) async { Map request; @@ -258,6 +296,60 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future insertLiveCareScheduleAppointment(int docID, int clinicID, int projectID, int serviceID, + String selectedTime, String selectedDate, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "IsForLiveCare": true, + "ProjectID": projectID, + "ClinicID": clinicID, + "DoctorID": docID, + "ServiceID": serviceID, + "StartTime": selectedTime, + "SelectedTime": selectedTime, + "EndTime": selectedTime, + "InitialSlotDuration": 0, + "StrAppointmentDate": selectedDate, + "IsVirtual": false, + "DeviceType": Platform.isIOS ? 'iOS' : 'Android', + "BookedBy": 102, + "VisitType": 1, + "VisitFor": 1, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + + await baseAppClient.post(INSERT_LIVECARE_SCHEDULE_APPOINTMENT, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientShare( String appoID, int clinicID, int projectID, BuildContext context) async { Map request; @@ -302,6 +394,51 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getLiveCareAppointmentPatientShare( + String appoID, int clinicID, int projectID, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "ProjectID": projectID, + "ClinicID": clinicID, + "AppointmentNo": appoID, + "IsActiveAppointment": true, + "IsForLiveCare": true, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "SessionID": "YckwoXhUmWBsnHKEKig", + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "TokenID": "@dm!n", + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + + await baseAppClient.post(GET_PATIENT_SHARE_LIVECARE, + onSuccess: (response, statusCode) async { + localRes = response['OnlineCheckInAppointments'][0]; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getPatientAppointmentHistory( bool isActiveAppointment, BuildContext context) async { Map request; @@ -378,7 +515,7 @@ class DoctorsListService extends BaseService { } Future confirmAppointment( - int appoNo, int clinicID, int projectID, BuildContext context) async { + int appoNo, int clinicID, int projectID, bool isLiveCare, BuildContext context) async { Map request; if (await this.sharedPref.getObject(USER_PROFILE) != null) { @@ -392,6 +529,7 @@ class DoctorsListService extends BaseService { request = { "AppointmentNumber": appoNo, + "IsLiveCareAppointment": isLiveCare, "ClinicID": clinicID, "ProjectID": projectID, "ConfirmationBy": 102, @@ -421,6 +559,62 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + + Future insertVIDARequest( + int appoNo, int clinicID, int projectID, int serviceID, int docID, BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + deviceToken = await sharedPref.getString(PUSH_TOKEN); + + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + + request = { + "AppointmentNo": appoNo, + "ClinicID": clinicID, + "ProjectID": projectID, + "ServiceID": serviceID, + "AcceptedBy": docID, + "DeviceToken": deviceToken, + "Latitude": lat, + "Longitude": long, + "DeviceType": req.DeviceType, + "VersionID": req.VersionID, + "Channel": req.Channel, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": req.IPAdress, + "generalid": req.generalid, + "PatientOutSA": authUser.outSA, + "isDentalAllowedBackend": false, + "DeviceTypeID": req.DeviceTypeID, + "PatientID": authUser.patientID, + "PatientTypeID": authUser.patientType, + "PatientType": authUser.patientType + }; + + dynamic localRes; + + await baseAppClient.post(INSERT_VIDA_REQUEST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future cancelAppointment( AppoitmentAllHistoryResultList appo, BuildContext context) async { Map request; diff --git a/lib/services/covid-drivethru/covid-drivethru.dart b/lib/services/covid-drivethru/covid-drivethru.dart new file mode 100644 index 00000000..2681783b --- /dev/null +++ b/lib/services/covid-drivethru/covid-drivethru.dart @@ -0,0 +1,126 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/Request.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:flutter/material.dart'; + +class CovidDriveThruService extends BaseService { + AppSharedPreferences sharedPref = AppSharedPreferences(); + AppGlobal appGlobal = new AppGlobal(); + + AuthenticatedUser authUser = new AuthenticatedUser(); + AuthProvider authProvider = new AuthProvider(); + + Future getCovidProjectsList(BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": authUser.outSA, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "License": true + }; + + dynamic localRes; + + await baseAppClient.post(GET_COVID_DRIVETHRU_PROJECT_LIST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getCovidPaymentInformation(BuildContext context, int projectID) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "ProjectID": projectID, + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": authUser.outSA, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "License": true + }; + + dynamic localRes; + + await baseAppClient.post(GET_COVID_DRIVETHRU_PAYMENT_INFO, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getCovidFreeSlots(BuildContext context, int projectID) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "ProjectID": projectID, + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": authUser.outSA, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "License": true + }; + + dynamic localRes; + + await baseAppClient.post(GET_COVID_DRIVETHRU_FREE_SLOTS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } +} diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index f76e0336..65cf6daf 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -53,6 +53,81 @@ class LiveCareService extends BaseService { return Future.value(localRes); } + Future getLiveCareScheduledClinics(BuildContext context) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINICS, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getLiveCareScheduledDoctorList(BuildContext context, int serviceID) async { + Map request; + + if (await this.sharedPref.getObject(USER_PROFILE) != null) { + var data = AuthenticatedUser.fromJson( + await this.sharedPref.getObject(USER_PROFILE)); + authUser = data; + } + + var languageID = await sharedPref.getString(APP_LANGUAGE); + Request req = appGlobal.getPublicRequest(); + request = { + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "VersionID": req.VersionID, + "Channel": req.Channel, + "generalid": 'Cs2020@2016\$2958', + "PatientOutSA": 0, + "TokenID": "", + "DeviceTypeID": req.DeviceTypeID, + "ServiceID": serviceID, + "SessionID": "YckwoXhUmWBsnHKEKig", + "Age": authUser.age != null ? authUser.age : 0, + "PatientID": authUser.patientID != null ? authUser.patientID : 0, + "Gender": authUser.gender != null ? authUser.gender : 0 + }; + + dynamic localRes; + + await baseAppClient.post(GET_LIVECARE_SCHEDULE_CLINIC_DOCTOR_LIST, + onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + Future getLivecareHistory(BuildContext context) async { Map request; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 28b273e5..1574e63b 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -95,6 +95,10 @@ class TranslationBase { String get confirm => localizedValues['confirm'][locale.languageCode]; + String get confirmLiveCare => localizedValues['confirmLiveCare'][locale.languageCode]; + + String get waitingForDoctor => localizedValues['waitingForDoctor'][locale.languageCode]; + String get confirmLater => localizedValues['confirmLater'][locale.languageCode]; @@ -220,6 +224,9 @@ class TranslationBase { String get upcomingLivecare => localizedValues['upcoming-livecare'][locale.languageCode]; + String get liveCareAppo => + localizedValues['livecareAppo'][locale.languageCode]; + String get upcomingDetails => localizedValues['upcoming-details'][locale.languageCode]; diff --git a/lib/widgets/others/arrow_back.dart b/lib/widgets/others/arrow_back.dart index 498554fd..619f4f41 100644 --- a/lib/widgets/others/arrow_back.dart +++ b/lib/widgets/others/arrow_back.dart @@ -18,9 +18,9 @@ class ArrowBack extends StatelessWidget { }, context), child: Icon( projectViewModel.isArabic - ? Icons.arrow_back_ios - : Icons.arrow_forward_ios, - color: Theme.of(context).primaryColor), + ? Icons.arrow_forward_ios + : Icons.arrow_back_ios, + color: Colors.white), ); } }