diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 30575eb9..884c7e09 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -6,6 +6,7 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> + diff --git a/assets/images/new-design/AM.PNG b/assets/images/new-design/AM.PNG new file mode 100644 index 00000000..212ca0b1 Binary files /dev/null and b/assets/images/new-design/AM.PNG differ diff --git a/lib/config/config.dart b/lib/config/config.dart index a0bf52be..7ef2a306 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -7,7 +7,7 @@ const MAX_SMALL_SCREEN = 660; const BASE_URL = 'https://hmgwebservices.com/'; -const GET_PROJECT = '/Lists.svc/REST/GetProject'; +const GET_PROJECT = 'Services/Lists.svc/REST/GetProject'; ///Doctor const GET_MY_DOCTOR = @@ -50,6 +50,14 @@ const GET_PATIENT_AppointmentHistory = const GET_PATIENT_VITAL_SIGN = 'Services/Doctors.svc/REST/Doctor_GetPatientVitalSign'; +///Er Nearest +const GET_NEAREST_HOSPITAL= + 'Services/Patients.svc/REST/Patient_GetProjectAvgERWaitingTime'; + + + + + ///Reports const REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; const INSERT_REQUEST_FOR_MEDICAL_REPORT = @@ -164,7 +172,6 @@ const SESSION_ID = 'TMRhVmkGhOsvamErw'; const IS_DENTAL_ALLOWED_BACKEND = false; const PATIENT_TYPE = 1; const PATIENT_TYPE_ID = 1; - var DeviceTypeID = Platform.isIOS ? 1 : 2; const LANGUAGE_ID = 2; const GET_PHARMCY_ITEMS = "Services/Lists.svc/REST/GetPharmcyItems_Region"; @@ -179,6 +186,21 @@ const GET_PAtIENTS_INSURANCE_APPROVALS = "Services/Patients.svc/REST/GetApprovalStatus"; const SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse'; +const GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS"; +const GET_VACCINATION_ONHAND = "/Services/ERP.svc/REST/GET_VACCINATION_ONHAND"; + +const GET_PATIENT_SICK_LEAVE = 'Services/Patients.svc/REST/GetPatientSickLeave'; + +const SendSickLeaveEmail = 'Services/Notifications.svc/REST/SendSickLeaveEmail'; + +const GET_PATIENT_AdVANCE_BALANCE_AMOUNT = 'Services/Patients.svc/REST/GetPatientAdvanceBalanceAmount'; +const GET_PATIENT_INFO_BY_ID = 'Services/Doctors.svc/REST/GetPatientInfoByPatientID'; +const GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER = 'Services/Patients.svc/REST/AP_GetPatientInfoByPatientIDandMobileNumber'; +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 TIMER_MIN = 10; + class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f50ea02c..0cb3fa2b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -227,6 +227,7 @@ const Map> localizedValues = { 'ar': 'مسح فوق رمز الاستجابة السريعة للتحقق في الجهاز في المستشفى' }, "sendEmail": {"en": "Send Email", "ar": "ارسال نسخة"}, + "EmailSentSuccessfully": {"en": "Email Sent Successfully", "ar": "تم إرسال البريد الإلكتروني بنجاح"}, "close": {"en": "Close", "ar": "مغلق"}, "booked": {"en": "Booked", "ar": "محجوز"}, "confirmed": {"en": "Confirmed", "ar": "مؤكد"}, @@ -365,23 +366,23 @@ const Map> localizedValues = { "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, "logs": {"en": "Logs", "ar": "السجلات"}, - "parking": {"en": "Parking", "ar": "مواقف"}, - "alhabiServices": {"en": "HMG Service", "ar": "خدمات الحبيب"}, - "parkingTitle": { - "en": - "Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the car’s location in Google Maps. 3- Read another position by pressing the Clear Position Data button.", - "ar": - " خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). " - }, - "readBarcode": {"en": "Read Barcode", "ar": "قراءة الكود"}, - "showMyPark": {"en": "Show My Park", "ar": "عرض بارك"}, - "clearMyData": {"en": "clear My Data", "ar": "امسح البيانات"}, - "floor": {"en": "Floor:", "ar": "الطابق"}, - "gate": {"en": "Gate:", "ar": "بوابة"}, - "building": {"en": "Building:", "ar": "المبنى"}, - "branch": {"en": "Branch:", "ar": "الفرع"}, - "emergencyServices": {"en": "Emergency Services:", "ar": "خدمات الطوارئ"}, "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, + "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."}, + "parking":{"en":"Parking","ar":"مواقف"}, + "alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"}, + "parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the car’s location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "}, + "readBarcode":{"en":"Read Barcode","ar":"قراءة الكود"}, + "showMyPark":{"en":"Show My Park","ar":"عرض بارك"}, + "clearMyData":{"en":"clear My Data","ar":"امسح البيانات"}, + "floor":{"en":"Floor:","ar":"الطابق"}, + "gate":{"en":"Gate:","ar":"بوابة"}, + "building":{"en":"Building:","ar":"المبنى"}, + "branch":{"en":"Branch:","ar":"الفرع"}, + "emergencyServices":{"en":"Emergency Services:","ar":"خدمات الطوارئ"}, + "nearester":{"en":"Nearest ER:","ar":"أقرب طوارى"}, + "locationa":{"en":"location:","ar":"الموقع"}, + "ambulancerequest":{"en":"Ambulance :","ar":"طلب نقل "}, + "requestA":{"en":"Request:","ar":"اسعاف"}, "MyAppointments": {"en": "My Appointments", "ar": "مواعيدي"}, "NoBookedAppointments": { "en": "No Booked Appointments", @@ -421,7 +422,7 @@ const Map> localizedValues = { "MyVaccines": {"en": "My Vaccines", "ar": "تطعيماتي"}, "MyVaccinesSubtitle": {"en": "List", "ar": "قائمة"}, "Medical": {"en": "Medical", "ar": "التقارير"}, - "MedicalSubtitle": {"Report": "List", "ar": "الطبية"}, + "MedicalSubtitle": {"en": "Report", "ar": "الطبية"}, "Monthly": {"en": "Monthly", "ar": "تقارير"}, "MonthlySubtitle": {"en": "Report", "ar": "الشهرية"}, "Sick": {"en": "Sick", "ar": "الإجازات"}, @@ -449,7 +450,6 @@ const Map> localizedValues = { "OrderDetails": {"en": "Order Details", "ar": "تفاصيل الطلب"}, "VitalSign": {"en": "Vital Sign", "ar": "العلامة حيوية"}, "MonthlyReports": {"en": "Monthly Reports", "ar": "تقارير شهرية"}, - "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."}, "km":{"en":"KMs:","ar":"كم"}, "PatientHealthSummaryReport":{"en":"Patient Health Summary Report","ar":" ملخص التقارير الشهرية"}, "ToViewTheTermsAndConditions":{"en":"To View The Terms And Conditions Report","ar":" عرض الشروط والأحكام "}, @@ -459,4 +459,6 @@ const Map> localizedValues = { "Save":{"en":"Save","ar":"حفظ "}, "UserAgreement":{"en":"User Agreement","ar":"اتفاقية الخصوصية "}, "UpdateSuccessfully":{"en":"Update Successfully","ar":"تم التحديث بنجاح"}, + "CHECK_VACCINE_AVAILABILITY":{"en":"CHECK VACCINE AVAILABILITY","ar":"تحقق من توافر اللقاح"}, + "MyVaccinesAvailability":{"en":"MyVaccinesAvailability","ar":"توفر لقاحي"}, }; diff --git a/lib/core/model/er/projectavgerwaitingtime.dart b/lib/core/model/er/projectavgerwaitingtime.dart new file mode 100644 index 00000000..9b21ec66 --- /dev/null +++ b/lib/core/model/er/projectavgerwaitingtime.dart @@ -0,0 +1,104 @@ +class ProjectAvgERWaitingTime { + int iD; + int projectID; + int avgTimeInMinutes; + String avgTimeInHHMM; + dynamic distanceInKilometers; + String latitude; + String longitude; + String phoneNumber; + String projectImageURL; + String projectName; + + ProjectAvgERWaitingTime( + {this.iD, + this.projectID, + this.avgTimeInMinutes, + this.avgTimeInHHMM, + this.distanceInKilometers, + this.latitude, + this.longitude, + this.phoneNumber, + this.projectImageURL, + this.projectName}); + + ProjectAvgERWaitingTime.fromJson(Map json) { + iD = json['ID']; + projectID = json['ProjectID']; + avgTimeInMinutes = json['AvgTimeInMinutes']; + avgTimeInHHMM = json['AvgTimeInHHMM']; + distanceInKilometers = json['DistanceInKilometers']; + latitude = json['Latitude']; + longitude = json['Longitude']; + phoneNumber = json['PhoneNumber']; + projectImageURL = json['ProjectImageURL']; + projectName = json['ProjectName']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['ProjectID'] = this.projectID; + data['AvgTimeInMinutes'] = this.avgTimeInMinutes; + data['AvgTimeInHHMM'] = this.avgTimeInHHMM; + data['DistanceInKilometers'] = this.distanceInKilometers; + data['Latitude'] = this.latitude; + data['Longitude'] = this.longitude; + data['PhoneNumber'] = this.phoneNumber; + data['ProjectImageURL'] = this.projectImageURL; + data['ProjectName'] = this.projectName; + return data; + } +} +//class ProjectAvgERWaitingTime { +// int iD; +// int projectID; +// int avgTimeInMinutes; +// String avgTimeInHHMM; +// String distanceInKilometers; +// String latitude; +// String longitude; +// String phoneNumber; +// String projectImageURL; +// String projectName; +// +// ProjectAvgERWaitingTime( +// {this.iD, +// this.projectID, +// this.avgTimeInMinutes, +// this.avgTimeInHHMM, +// this.distanceInKilometers, +// this.latitude, +// this.longitude, +// this.phoneNumber, +// this.projectImageURL, +// this.projectName}); +// +// ProjectAvgERWaitingTime.fromJson(Map json) { +// iD = json['ID']; +// projectID = json['ProjectID']; +// avgTimeInMinutes = json['AvgTimeInMinutes']; +// avgTimeInHHMM = json['AvgTimeInHHMM']; +// distanceInKilometers = json['DistanceInKilometers']; +// latitude = json['Latitude']; +// longitude = json['Longitude']; +// phoneNumber = json['PhoneNumber']; +// projectImageURL = json['ProjectImageURL']; +// projectName = json['ProjectName']; +// } +// +// Map toJson() { +// final Map data = new Map(); +// data['ID'] = this.iD; +// data['ProjectID'] = this.projectID; +// data['AvgTimeInMinutes'] = this.avgTimeInMinutes; +// data['AvgTimeInHHMM'] = this.avgTimeInHHMM; +// data['DistanceInKilometers'] = this.distanceInKilometers; +// data['Latitude'] = this.latitude; +// data['Longitude'] = this.longitude; +// data['PhoneNumber'] = this.phoneNumber; +// data['ProjectImageURL'] = this.projectImageURL; +// data['ProjectName'] = this.projectName; +// return data; +// } +//} \ No newline at end of file diff --git a/lib/core/model/hospitals/hospitals_model.dart b/lib/core/model/hospitals/hospitals_model.dart index a8308de8..264528c7 100644 --- a/lib/core/model/hospitals/hospitals_model.dart +++ b/lib/core/model/hospitals/hospitals_model.dart @@ -1,18 +1,18 @@ class HospitalsModel { String desciption; Null desciptionN; - int iD; + dynamic iD; String legalName; String legalNameN; String name; Null nameN; String phoneNumber; String setupID; - int distanceInKilometers; + dynamic distanceInKilometers; bool isActive; String latitude; String longitude; - int mainProjectID; + dynamic mainProjectID; Null projectOutSA; bool usingInDoctorApp; diff --git a/lib/core/model/my_balance/AdvanceModel.dart b/lib/core/model/my_balance/AdvanceModel.dart new file mode 100644 index 00000000..40472b13 --- /dev/null +++ b/lib/core/model/my_balance/AdvanceModel.dart @@ -0,0 +1,18 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; + +class AdvanceModel { + String fileNumber; + String amount; + HospitalsModel hospitalsModel; + String email; + String note; + String depositorName; + + AdvanceModel( + {this.amount, + this.email, + this.note, + this.hospitalsModel, + this.fileNumber, + this.depositorName}); +} diff --git a/lib/core/model/my_balance/patient_advance_balance_amount.dart b/lib/core/model/my_balance/patient_advance_balance_amount.dart new file mode 100644 index 00000000..44a5083f --- /dev/null +++ b/lib/core/model/my_balance/patient_advance_balance_amount.dart @@ -0,0 +1,28 @@ +class PatientAdvanceBalanceAmount { + int distanceInKilometers; + dynamic patientAdvanceBalanceAmount; + String projectDescription; + int projectID; + + PatientAdvanceBalanceAmount( + {this.distanceInKilometers, + this.patientAdvanceBalanceAmount, + this.projectDescription, + this.projectID}); + + PatientAdvanceBalanceAmount.fromJson(Map json) { + distanceInKilometers = json['DistanceInKilometers']; + patientAdvanceBalanceAmount = json['PatientAdvanceBalanceAmount']; + projectDescription = json['ProjectDescription']; + projectID = json['ProjectID']; + } + + Map toJson() { + final Map data = new Map(); + data['DistanceInKilometers'] = this.distanceInKilometers; + data['PatientAdvanceBalanceAmount'] = this.patientAdvanceBalanceAmount; + data['ProjectDescription'] = this.projectDescription; + data['ProjectID'] = this.projectID; + return data; + } +} diff --git a/lib/core/model/my_balance/patient_info.dart b/lib/core/model/my_balance/patient_info.dart new file mode 100644 index 00000000..6004f014 --- /dev/null +++ b/lib/core/model/my_balance/patient_info.dart @@ -0,0 +1,32 @@ +class PatientInfo { + String fullName; + String mobileNumber; + int patientID; + int projectID; + String zipCode; + + PatientInfo( + {this.fullName, + this.mobileNumber, + this.patientID, + this.projectID, + this.zipCode}); + + PatientInfo.fromJson(Map json) { + fullName = json['FullName']; + mobileNumber = json['MobileNumber']; + patientID = json['PatientID']; + projectID = json['ProjectID']; + zipCode = json['ZipCode']; + } + + Map toJson() { + final Map data = new Map(); + data['FullName'] = this.fullName; + data['MobileNumber'] = this.mobileNumber; + data['PatientID'] = this.patientID; + data['ProjectID'] = this.projectID; + data['ZipCode'] = this.zipCode; + return data; + } +} diff --git a/lib/core/model/my_balance/patient_info_and_mobile_number.dart b/lib/core/model/my_balance/patient_info_and_mobile_number.dart new file mode 100644 index 00000000..8f05b4d9 --- /dev/null +++ b/lib/core/model/my_balance/patient_info_and_mobile_number.dart @@ -0,0 +1,84 @@ +class PatientInfoAndMobileNumber { + String setupID; + int projectID; + int mainAccountID; + int patientType; + int patientID; + String firstName; + Null middleName; + Null lastName; + Null firstNameN; + Null middleNameN; + Null lastNameN; + Null gender; + Null dateofBirth; + Null dateofBirthN; + Null nationalityID; + String mobileNumber; + String emailAddress; + Null zipCode; + + PatientInfoAndMobileNumber( + {this.setupID, + this.projectID, + this.mainAccountID, + this.patientType, + this.patientID, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.dateofBirthN, + this.nationalityID, + this.mobileNumber, + this.emailAddress, + this.zipCode}); + + PatientInfoAndMobileNumber.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + mainAccountID = json['MainAccountID']; + patientType = json['PatientType']; + patientID = json['PatientID']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + gender = json['Gender']; + dateofBirth = json['DateofBirth']; + dateofBirthN = json['DateofBirthN']; + nationalityID = json['NationalityID']; + mobileNumber = json['MobileNumber']; + emailAddress = json['EmailAddress']; + zipCode = json['ZipCode']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['MainAccountID'] = this.mainAccountID; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['Gender'] = this.gender; + data['DateofBirth'] = this.dateofBirth; + data['DateofBirthN'] = this.dateofBirthN; + data['NationalityID'] = this.nationalityID; + data['MobileNumber'] = this.mobileNumber; + data['EmailAddress'] = this.emailAddress; + data['ZipCode'] = this.zipCode; + return data; + } +} diff --git a/lib/core/model/sick_leave/sick_leave.dart b/lib/core/model/sick_leave/sick_leave.dart new file mode 100644 index 00000000..ff73e1da --- /dev/null +++ b/lib/core/model/sick_leave/sick_leave.dart @@ -0,0 +1,139 @@ +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; + +class SickLeave { + String setupID; + int projectID; + int patientID; + int patientType; + int clinicID; + int doctorID; + int requestNo; + DateTime requestDate; + int sickLeaveDays; + int appointmentNo; + int admissionNo; + int actualDoctorRate; + String appointmentDate; + String clinicName; + String doctorImageURL; + String doctorName; + int doctorRate; + String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + bool isInOutPatient; + String isInOutPatientDescription; + String isInOutPatientDescriptionN; + int noOfPatientsRate; + Null patientName; + String projectName; + String qR; + List speciality; + + SickLeave( + {this.setupID, + this.projectID, + this.patientID, + this.patientType, + this.clinicID, + this.doctorID, + this.requestNo, + this.requestDate, + this.sickLeaveDays, + this.appointmentNo, + this.admissionNo, + this.actualDoctorRate, + this.appointmentDate, + this.clinicName, + this.doctorImageURL, + this.doctorName, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.isInOutPatient, + this.isInOutPatientDescription, + this.isInOutPatientDescriptionN, + this.noOfPatientsRate, + this.patientName, + this.projectName, + this.qR, + this.speciality}); + + SickLeave.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + requestNo = json['RequestNo']; + requestDate = DateUtil.convertStringToDate(json['RequestDate']); + sickLeaveDays = json['SickLeaveDays']; + appointmentNo = json['AppointmentNo']; + admissionNo = json['AdmissionNo']; + actualDoctorRate = json['ActualDoctorRate']; + appointmentDate = json['AppointmentDate']; + clinicName = json['ClinicName']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + isInOutPatient = json['IsInOutPatient']; + isInOutPatientDescription = json['IsInOutPatientDescription']; + isInOutPatientDescriptionN = json['IsInOutPatientDescriptionN']; + noOfPatientsRate = json['NoOfPatientsRate']; + patientName = json['PatientName']; + projectName = json['ProjectName']; + qR = json['QR']; + if(json['Speciality']!=null) + speciality = json['Speciality'].cast(); + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['RequestNo'] = this.requestNo; + data['RequestDate'] = DateUtil.convertDateToString(requestDate); + data['SickLeaveDays'] = this.sickLeaveDays; + data['AppointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['AppointmentDate'] = this.appointmentDate; + data['ClinicName'] = this.clinicName; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['IsInOutPatient'] = this.isInOutPatient; + data['IsInOutPatientDescription'] = this.isInOutPatientDescription; + data['IsInOutPatientDescriptionN'] = this.isInOutPatientDescriptionN; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['PatientName'] = this.patientName; + data['ProjectName'] = this.projectName; + data['QR'] = this.qR; + data['Speciality'] = this.speciality; + return data; + } +} diff --git a/lib/core/model/vaccine/my_vaccine.dart b/lib/core/model/vaccine/my_vaccine.dart index ac6e2e19..dc921c12 100644 --- a/lib/core/model/vaccine/my_vaccine.dart +++ b/lib/core/model/vaccine/my_vaccine.dart @@ -1,91 +1,152 @@ class VaccineModel { - String to; - String from; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; + String setupID; + int projectID; int patientID; - String tokenID; - int patientTypeID; - int patientType; + int invoiceNo; + String procedureID; + String vaccineName; + Null vaccineNameN; String invoiceDate; + int doctorID; + int clinicID; + String firstName; + String middleName; + String lastName; + Null firstNameN; + Null middleNameN; + Null lastNameN; + String dateofBirth; + int actualDoctorRate; + String age; + String clinicName; String doctorImageURL; String doctorName; + int doctorRate; String doctorTitle; + int gender; + String genderDescription; + bool isActiveDoctorProfile; + bool isDoctorAllowVedioCall; + bool isExecludeDoctor; + int noOfPatientsRate; + String patientName; String projectName; - String vaccineName; + String qR; + List speciality; + String vaccinationDate; - VaccineModel({ - this.to, - this.from, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.patientID, - this.tokenID, - this.patientTypeID, - this.patientType, - this.invoiceDate, - this.doctorImageURL, - this.doctorName, - this.doctorTitle, - this.projectName, - this.vaccineName, - }); + VaccineModel( + {this.setupID, + this.projectID, + this.patientID, + this.invoiceNo, + this.procedureID, + this.vaccineName, + this.vaccineNameN, + this.invoiceDate, + this.doctorID, + this.clinicID, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.dateofBirth, + this.actualDoctorRate, + this.age, + this.clinicName, + this.doctorImageURL, + this.doctorName, + this.doctorRate, + this.doctorTitle, + this.gender, + this.genderDescription, + this.isActiveDoctorProfile, + this.isDoctorAllowVedioCall, + this.isExecludeDoctor, + this.noOfPatientsRate, + this.patientName, + this.projectName, + this.qR, + this.speciality, + this.vaccinationDate}); VaccineModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + invoiceNo = json['InvoiceNo']; + procedureID = json['ProcedureID']; vaccineName = json['VaccineName']; - projectName = json['ProjectName']; - doctorTitle = json['DoctorTitle']; - doctorName = json['DoctorName']; - doctorImageURL = json['DoctorImageURL']; + vaccineNameN = json['VaccineNameN']; invoiceDate = json['InvoiceDate']; - to = json['To']; - from = json['From']; - 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']; - patientID = json['PatientID']; - tokenID = json['TokenID']; - patientTypeID = json['PatientTypeID']; - patientType = json['PatientType']; + doctorID = json['DoctorID']; + clinicID = json['ClinicID']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + dateofBirth = json['DateofBirth']; + actualDoctorRate = json['ActualDoctorRate']; + age = json['Age']; + clinicName = json['ClinicName']; + doctorImageURL = json['DoctorImageURL']; + doctorName = json['DoctorName']; + doctorRate = json['DoctorRate']; + doctorTitle = json['DoctorTitle']; + gender = json['Gender']; + genderDescription = json['GenderDescription']; + isActiveDoctorProfile = json['IsActiveDoctorProfile']; + isDoctorAllowVedioCall = json['IsDoctorAllowVedioCall']; + isExecludeDoctor = json['IsExecludeDoctor']; + noOfPatientsRate = json['NoOfPatientsRate']; + patientName = json['PatientName']; + projectName = json['ProjectName']; + qR = json['QR']; + speciality = json['Speciality'].cast(); + vaccinationDate = json['VaccinationDate']; } Map toJson() { final Map data = new Map(); - data['To'] = this.to; - data['From'] = this.from; - 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; + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; data['PatientID'] = this.patientID; - data['TokenID'] = this.tokenID; - data['PatientTypeID'] = this.patientTypeID; - data['PatientType'] = this.patientType; + data['InvoiceNo'] = this.invoiceNo; + data['ProcedureID'] = this.procedureID; + data['VaccineName'] = this.vaccineName; + data['VaccineNameN'] = this.vaccineNameN; + data['InvoiceDate'] = this.invoiceDate; + data['DoctorID'] = this.doctorID; + data['ClinicID'] = this.clinicID; + data['FirstName'] = this.firstName; + data['MiddleName'] = this.middleName; + data['LastName'] = this.lastName; + data['FirstNameN'] = this.firstNameN; + data['MiddleNameN'] = this.middleNameN; + data['LastNameN'] = this.lastNameN; + data['DateofBirth'] = this.dateofBirth; + data['ActualDoctorRate'] = this.actualDoctorRate; + data['Age'] = this.age; + data['ClinicName'] = this.clinicName; + data['DoctorImageURL'] = this.doctorImageURL; + data['DoctorName'] = this.doctorName; + data['DoctorRate'] = this.doctorRate; + data['DoctorTitle'] = this.doctorTitle; + data['Gender'] = this.gender; + data['GenderDescription'] = this.genderDescription; + data['IsActiveDoctorProfile'] = this.isActiveDoctorProfile; + data['IsDoctorAllowVedioCall'] = this.isDoctorAllowVedioCall; + data['IsExecludeDoctor'] = this.isExecludeDoctor; + data['NoOfPatientsRate'] = this.noOfPatientsRate; + data['PatientName'] = this.patientName; + data['ProjectName'] = this.projectName; + data['QR'] = this.qR; + data['Speciality'] = this.speciality; + data['VaccinationDate'] = this.vaccinationDate; return data; } } diff --git a/lib/core/model/vaccine/vaccination_item.dart b/lib/core/model/vaccine/vaccination_item.dart new file mode 100644 index 00000000..0009ea7d --- /dev/null +++ b/lib/core/model/vaccine/vaccination_item.dart @@ -0,0 +1,18 @@ +class VaccinationItem { + String dESCRIPTION; + String iTEMCODE; + + VaccinationItem({this.dESCRIPTION, this.iTEMCODE}); + + VaccinationItem.fromJson(Map json) { + dESCRIPTION = json['DESCRIPTION']; + iTEMCODE = json['ITEM_CODE']; + } + + Map toJson() { + final Map data = new Map(); + data['DESCRIPTION'] = this.dESCRIPTION; + data['ITEM_CODE'] = this.iTEMCODE; + return data; + } +} diff --git a/lib/core/model/vaccine/vaccination_on_hand.dart b/lib/core/model/vaccine/vaccination_on_hand.dart new file mode 100644 index 00000000..daf3e886 --- /dev/null +++ b/lib/core/model/vaccine/vaccination_on_hand.dart @@ -0,0 +1,44 @@ +class VaccinationOnHand { + int distanceInKilometers; + int iTEMONHAND; + bool isThereItems; + String oRGANIZATIONCODE; + String oRGANIZATIONNAME; + String projectAlias; + int projectID; + String projectName; + + VaccinationOnHand( + {this.distanceInKilometers, + this.iTEMONHAND, + this.isThereItems, + this.oRGANIZATIONCODE, + this.oRGANIZATIONNAME, + this.projectAlias, + this.projectID, + this.projectName}); + + VaccinationOnHand.fromJson(Map json) { + distanceInKilometers = json['DistanceInKilometers']; + iTEMONHAND = json['ITEM_ONHAND']; + isThereItems = json['IsThereItems']; + oRGANIZATIONCODE = json['ORGANIZATION_CODE']; + oRGANIZATIONNAME = json['ORGANIZATION_NAME']; + projectAlias = json['ProjectAlias']; + projectID = json['ProjectID']; + projectName = json['ProjectName']; + } + + Map toJson() { + final Map data = new Map(); + data['DistanceInKilometers'] = this.distanceInKilometers; + data['ITEM_ONHAND'] = this.iTEMONHAND; + data['IsThereItems'] = this.isThereItems; + data['ORGANIZATION_CODE'] = this.oRGANIZATIONCODE; + data['ORGANIZATION_NAME'] = this.oRGANIZATIONNAME; + data['ProjectAlias'] = this.projectAlias; + data['ProjectID'] = this.projectID; + data['ProjectName'] = this.projectName; + return data; + } +} diff --git a/lib/core/service/er/er_service.dart b/lib/core/service/er/er_service.dart new file mode 100644 index 00000000..bd3b6116 --- /dev/null +++ b/lib/core/service/er/er_service.dart @@ -0,0 +1,43 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; +import '../base_service.dart'; + +class ErService extends BaseService { + List projectAvgERWaitingTimeModelList = List(); + + Map body = Map(); + String Latitude = ""; + String Longitude = ""; + String PhoneNumber = ""; + + Future getProjectAvgERWaitingTimeOrders({int id, int projectID}) async { + hasError = false; + + if (id != null && projectID != null) { + body['ID'] = id; + body['ProjectID'] = projectID; + } + var lat = await sharedPref.getDouble(USER_LAT); + var long = await sharedPref.getDouble(USER_LONG); + body['Latitude'] = lat ?? 0; + body['Longitude'] = long ?? 0; + + await baseAppClient.post(GET_NEAREST_HOSPITAL, + onSuccess: (dynamic response, int statusCode) { + projectAvgERWaitingTimeModelList.clear(); + response['List_ProjectAvgERWaitingTime'].forEach((vital) { + projectAvgERWaitingTimeModelList + .add(ProjectAvgERWaitingTime.fromJson(vital)); + }); + projectAvgERWaitingTimeModelList.forEach((element) { + Latitude = '${element.latitude}'; + Longitude = '${element.longitude}'; + PhoneNumber = '${element.phoneNumber}'; + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index c131d94f..194b8256 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -2,35 +2,43 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; import 'package:diplomaticquarterapp/core/model/hospitals/request_get_hospitals_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:geolocator/geolocator.dart'; class HospitalService extends BaseService { List _hospitals = List(); List get hospitals => _hospitals; - RequestGetHospitalsModel _requestGetHospitalsModel = RequestGetHospitalsModel( - latitude: 0, - longitude: 0, - versionID: 5.2, - channel: 3, - languageID: 2, - iPAdress: '10.20.10.20', - generalid: 'Cs2020@2016\$2958', - patientOutSA: 0, - sessionID: 'JUWuiMBCEGkAAxQpakQ', - isDentalAllowedBackend: false, - deviceTypeID: 2); + double _latitude; + double _longitude; + + _getCurrentLocation() async { + await getLastKnownPosition().then((value) { + _latitude = value.latitude; + _longitude = value.longitude; + }).catchError((e) { + _longitude = 0; + _latitude = 0; + }); + // currentLocation = LatLng(position.latitude, position.longitude); + } Future getHospitals() async { + await _getCurrentLocation(); + Map body = Map(); + body['Latitude'] = _latitude; + body['Longitude'] = _longitude; + await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { - _hospitals.clear(); + _hospitals.clear(); response['ListProject'].forEach((hospital) { _hospitals.add(HospitalsModel.fromJson(hospital)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _requestGetHospitalsModel.toJson()); + }, body: body); } + } diff --git a/lib/core/service/medical/PatientSickLeaveService.dart b/lib/core/service/medical/PatientSickLeaveService.dart new file mode 100644 index 00000000..b2bb16ef --- /dev/null +++ b/lib/core/service/medical/PatientSickLeaveService.dart @@ -0,0 +1,45 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; + +class PatientSickLeaveService extends BaseService { + List sickLeaveList = List(); + + getSickLeave() async { + hasError = false; + super.error = ""; + await baseAppClient.post(GET_PATIENT_SICK_LEAVE, + onSuccess: (response, statusCode) async { + sickLeaveList.clear(); + response['List_SickLeave'].forEach((sickLeave) { + sickLeaveList.add(SickLeave.fromJson(sickLeave)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + sendSickLeaveEmail( + {int requestNo, String projectName, String doctorName, int projectID,String setupID}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['RequestNo'] = requestNo; + body['To'] = user.emailAddress; + body['DateofBirth'] = user.dateofBirth; + body['PatientIditificationNum'] = user.patientIdentificationNo; + body['PatientMobileNumber'] = user.mobileNumber; + body['PatientName'] = user.firstName + " " + user.firstName; + body['ProjectName'] = projectName; + body['DoctorName'] = doctorName; + body['ProjectID'] = 12; + body['SetupID'] = 12; + await baseAppClient + .post(SendSickLeaveEmail, onSuccess: (response, statusCode) async {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } +} diff --git a/lib/core/service/medical/my_balance_service.dart b/lib/core/service/medical/my_balance_service.dart new file mode 100644 index 00000000..cbc1be97 --- /dev/null +++ b/lib/core/service/medical/my_balance_service.dart @@ -0,0 +1,148 @@ +import 'dart:convert'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordsByStatusReq.dart'; +import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; + +class MyBalanceService extends BaseService { + List patientAdvanceBalanceAmountList = List(); + double totalAdvanceBalanceAmount; + List patientInfoList = List(); + GetAllSharedRecordsByStatusResponse getAllSharedRecordsByStatusResponse = + GetAllSharedRecordsByStatusResponse(); + PatientInfoAndMobileNumber patientInfoAndMobileNumber; + String logInTokenID; + String verificationCode; + + getPatientAdvanceBalanceAmount() async { + hasError = false; + super.error = ""; + await baseAppClient.post(GET_PATIENT_AdVANCE_BALANCE_AMOUNT, + onSuccess: (response, statusCode) async { + patientAdvanceBalanceAmountList.clear(); + response['List_PatientAdvanceBalanceAmount'].forEach((item) { + patientAdvanceBalanceAmountList + .add(PatientAdvanceBalanceAmount.fromJson(item)); + }); + totalAdvanceBalanceAmount = response['TotalAdvanceBalanceAmount']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + getPatientInfoByPatientID({String id}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['SearchPatientID'] = int.parse(id); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_PATIENT_INFO_BY_ID, + onSuccess: (response, statusCode) async { + patientInfoList.clear(); + response['GetPatientInfoByPatientIDList'].forEach((item) { + patientInfoList.add(PatientInfo.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + getPatientInfoByPatientIDAndMobileNumber() async { + hasError = false; + super.error = ""; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + body['MobileNo'] = user.mobileNumber; + body['ProjectID'] = user.projectID; + + await baseAppClient.post(GET_PATIENT_INFO_BY_ID_AND_MOBILE_NUMBER, + onSuccess: (response, statusCode) async { + response['List_PatientInfo'].forEach((item) { + patientInfoAndMobileNumber = PatientInfoAndMobileNumber.fromJson(item); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + super.error = error; + }, body: body); + } + + sendActivationCodeForAdvancePayment({int patientID,int projectID}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['PatientID'] = patientID; + body['ProjectID'] = projectID; + body['isDentalAllowedBackend'] = false; + + await baseAppClient.post(SEND_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT, + onSuccess: (response, statusCode) async { + logInTokenID = response['LogInTokenID']; + verificationCode = response['VerificationCode']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + super.error = error; + }, body: body); + } + + checkActivationCodeForAdvancePayment({String activationCode}) async { + hasError = false; + super.error = ""; + Map body = Map(); + body['activationCode'] = activationCode; + body['PatientMobileNumber'] = 'XXXXXXXXXX'; + body['isDentalAllowedBackend'] = false; + body['LogInTokenID'] = logInTokenID; + + await baseAppClient.post(CHECK_ACTIVATION_CODE_FOR_ADVANCE_PAYMENT, + onSuccess: (response, statusCode) async { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + super.error = error; + }, body: body); + } + + getSharedRecordByStatus() async { + try { + var request = GetAllSharedRecordsByStatusReq(); + request.status = 0; + await baseAppClient.post(GET_SHARED_RECORD_BY_STATUS, + onSuccess: (dynamic response, int statusCode) { + sharedPref.setObject(FAMILY_FILE, response); + getAllSharedRecordsByStatusResponse = + GetAllSharedRecordsByStatusResponse.fromJson(response); + }, onFailure: (String error, int statusCode) { + AppToast.showErrorToast(message: error); + hasError = true; + super.error = error; + }, body: request.toJson()); + } catch (error) { + print(error); + hasError = true; + super.error = error; + } + } + + getFamilyFiles() async { + if (await sharedPref.getObject(FAMILY_FILE) != null) { + getAllSharedRecordsByStatusResponse = + GetAllSharedRecordsByStatusResponse.fromJson( + await sharedPref.getObject(FAMILY_FILE)); + return getAllSharedRecordsByStatusResponse; + } else { + return getSharedRecordByStatus(); + } + } +} diff --git a/lib/core/service/vaccine_service.dart b/lib/core/service/vaccine_service.dart index 189e26d8..297909a4 100644 --- a/lib/core/service/vaccine_service.dart +++ b/lib/core/service/vaccine_service.dart @@ -1,31 +1,20 @@ import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/core/model/vaccine/vaccination_item.dart'; +import 'package:diplomaticquarterapp/core/model/vaccine/vaccination_on_hand.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/core/model/vaccine/my_vaccine.dart'; class VaccineService extends BaseService { List _vaccineList = List(); + List vaccinationItemList = List(); + List vaccinationOnHandList = List(); List get vaccineList => _vaccineList; - VaccineModel _vaccineModel = VaccineModel( - to: "0", - from: "0", - channel: 3, - deviceTypeID: 2, - generalid: "Cs2020@2016\$2958", - iPAdress: "10.20.10.20", - isDentalAllowedBackend: false, - languageID: 2, - patientID: 1231755, - patientOutSA: 0, - patientType: 1, - patientTypeID: 1, - sessionID: "uoKFXSLUwEaHYPwKZNA", - tokenID: "@dm!n", - versionID: 5.5, - ); - Future getMyVaccine() async { + Map body = Map(); + body['To'] = "0"; + body['From'] = "0"; hasError = false; _vaccineList.clear(); await baseAppClient.post(GET_VACCINES, @@ -36,8 +25,51 @@ class VaccineService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _vaccineModel.toJson()); + }, body: body); } - Future sendEmail() async {} + Future sendEmail() async { + Map body = Map(); + body['ListVaccines'] = vaccineList.map((v) => v.toJson()).toList(); + body['To'] = user.emailAddress; + body['DateofBirth'] = user.dateofBirth; + body['PatientIditificationNum'] = user.patientIdentificationNo; + body['PatientMobileNumber'] = user.mobileNumber; + body['PatientName'] = user.firstName + " " + user.lastName; + + hasError = false; + + await baseAppClient.post(GET_VACCINES_EMAIL, + onSuccess: (dynamic response, int statusCode) {}, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + + Future getMyVaccinationItem() async { + await baseAppClient.post(GET_VACCINATIONS_ITEMS, + onSuccess: (dynamic response, int statusCode) { + response['GetVaccinationsList'].forEach((item) { + vaccinationItemList.add(VaccinationItem.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: Map()); + } + + Future getMyVaccinationOnHand({String pItemCode}) async { + Map body = Map(); + body['P_ITEM_CODE'] = pItemCode; + await baseAppClient.post(GET_VACCINATION_ONHAND, + onSuccess: (dynamic response, int statusCode) { + response['GetVaccinationOnHandList'].forEach((item) { + vaccinationOnHandList.add(VaccinationOnHand.fromJson(item)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } } diff --git a/lib/core/viewModels/er/near_hospital_view_model.dart b/lib/core/viewModels/er/near_hospital_view_model.dart new file mode 100644 index 00000000..f12aa28f --- /dev/null +++ b/lib/core/viewModels/er/near_hospital_view_model.dart @@ -0,0 +1,31 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/er/projectavgerwaitingtime.dart'; + +import 'package:diplomaticquarterapp/core/service/er/er_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.dart'; + +import '../../../locator.dart'; + +class NearHospitalViewModel extends BaseViewModel { + ErService _erService = locator(); + + List get ProjectAvgERWaitingTimeModeList => + _erService.projectAvgERWaitingTimeModelList; + + getProjectAvgERWaitingTimeOrders({int id, int projectID}) async { + setState(ViewState.Busy); + + if (id != null && projectID != null) { + await _erService.getProjectAvgERWaitingTimeOrders( + id: id, projectID: projectID); + } else { + await _erService.getProjectAvgERWaitingTimeOrders(); + } + if (_erService.hasError) { + error = _erService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/core/viewModels/medical/my_balance_view_model.dart b/lib/core/viewModels/medical/my_balance_view_model.dart new file mode 100644 index 00000000..350e9d89 --- /dev/null +++ b/lib/core/viewModels/medical/my_balance_view_model.dart @@ -0,0 +1,116 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_advance_balance_amount.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/service/hospital_service.dart'; +import 'package:diplomaticquarterapp/core/service/medical/my_balance_service.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; + +class MyBalanceViewModel extends BaseViewModel { + MyBalanceService _myBalanceService = locator(); + + HospitalService _hospitalService = locator(); + + List get hospitals => _hospitalService.hospitals; + + List get patientAdvanceBalanceAmountList => + _myBalanceService.patientAdvanceBalanceAmountList; + + double get totalAdvanceBalanceAmount => + _myBalanceService.totalAdvanceBalanceAmount; + + GetAllSharedRecordsByStatusResponse get getAllSharedRecordsByStatusResponse => + _myBalanceService.getAllSharedRecordsByStatusResponse; + + List get patientInfoList => _myBalanceService.patientInfoList; + + PatientInfoAndMobileNumber get patientInfoAndMobileNumber => + _myBalanceService.patientInfoAndMobileNumber; + + + String get logInTokenID => _myBalanceService.logInTokenID; + String get verificationCode => _myBalanceService.verificationCode; + + getPatientAdvanceBalanceAmount() async { + setState(ViewState.Busy); + await _myBalanceService.getPatientAdvanceBalanceAmount(); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future getHospitals() async { + setState(ViewState.Busy); + await _hospitalService.getHospitals(); + if (_hospitalService.hasError) { + error = _hospitalService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getPatientInfoByPatientID({String id}) async { + setState(ViewState.Busy); + await _myBalanceService.getPatientInfoByPatientID(id: id); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); + } + } + + Future getPatientInfoByPatientIDAndMobileNumber() async { + setState(ViewState.Busy); + await _myBalanceService.getPatientInfoByPatientIDAndMobileNumber(); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); + } + } + + Future sendActivationCodeForAdvancePayment({int patientID,int projectID}) async { + setState(ViewState.Busy); + await _myBalanceService.sendActivationCodeForAdvancePayment(patientID: patientID,projectID: projectID); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); + } + } + Future checkActivationCodeForAdvancePayment({String activationCode}) async { + setState(ViewState.Busy); + await _myBalanceService.checkActivationCodeForAdvancePayment(activationCode: activationCode); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + } + + Future getFamilyFiles() async { + setState(ViewState.Busy); + await _myBalanceService.getFamilyFiles(); + if (_myBalanceService.hasError) { + error = _myBalanceService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else { + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/medical/patient_sick_leave_view_model.dart b/lib/core/viewModels/medical/patient_sick_leave_view_model.dart new file mode 100644 index 00000000..6addf833 --- /dev/null +++ b/lib/core/viewModels/medical/patient_sick_leave_view_model.dart @@ -0,0 +1,42 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; +import 'package:diplomaticquarterapp/core/service/medical/PatientSickLeaveService.dart'; +import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; + +class PatientSickLeaveViewMode extends BaseViewModel { + PatientSickLeaveService _patientSickLeaveService = + locator(); + + List get sickLeaveList => _patientSickLeaveService.sickLeaveList; + + getSickLeave() async { + setState(ViewState.Busy); + await _patientSickLeaveService.getSickLeave(); + if (_patientSickLeaveService.hasError) { + error = _patientSickLeaveService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + Future sendSickLeaveEmail( + {String message, + int requestNo, + String projectName, + String doctorName,int projectID,String setupID}) async { + setState(ViewState.Busy); + await _patientSickLeaveService.sendSickLeaveEmail( + requestNo: requestNo, projectName: projectName, doctorName: doctorName,projectID: projectID,setupID: setupID); + if (_patientSickLeaveService.hasError) { + error = _patientSickLeaveService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else { + AppToast.showSuccessToast(message: message); + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/vaccine_view_model.dart b/lib/core/viewModels/vaccine_view_model.dart index a3b6c057..9f8dfecf 100644 --- a/lib/core/viewModels/vaccine_view_model.dart +++ b/lib/core/viewModels/vaccine_view_model.dart @@ -1,3 +1,6 @@ +import 'package:diplomaticquarterapp/core/model/vaccine/vaccination_item.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; + import 'base_view_model.dart'; import '../../locator.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; @@ -10,10 +13,11 @@ class VaccineViewModel extends BaseViewModel { VaccineService _vaccineService = locator(); List get vaccineList => _vaccineService.vaccineList; + List get vaccinationItemList => _vaccineService.vaccinationItemList; + Future getVaccine() async { hasError = false; - //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); await _vaccineService.getMyVaccine(); if (_vaccineService.hasError) { @@ -22,4 +26,40 @@ class VaccineViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + Future getMyVaccinationItem() async { + hasError = false; + setState(ViewState.Busy); + await _vaccineService.getMyVaccinationItem(); + if (_vaccineService.hasError) { + error = _vaccineService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getMyVaccinationOnHand({String pItemCode}) async { + hasError = false; + setState(ViewState.Busy); + await _vaccineService.getMyVaccinationOnHand(pItemCode: pItemCode); + if (_vaccineService.hasError) { + error = _vaccineService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + Future sendEmail({String message}) async { + hasError = false; + setState(ViewState.BusyLocal); + await _vaccineService.sendEmail(); + if (_vaccineService.hasError) { + error = _vaccineService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else { + AppToast.showSuccessToast(message: message); + setState(ViewState.Idle); + } + } } diff --git a/lib/locator.dart b/lib/locator.dart index 6839fbc2..6c8d178e 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -5,22 +5,28 @@ import 'package:get_it/get_it.dart'; import 'core/service/appointment_rate_service.dart'; import 'core/service/dashboard_service.dart'; +import 'core/service/er/er_service.dart'; import 'core/service/feedback/feedback_service.dart'; import 'core/service/hospital_service.dart'; +import 'core/service/medical/PatientSickLeaveService.dart'; import 'core/service/medical/labs_service.dart'; import 'core/service/medical/medical_service.dart'; +import 'core/service/medical/my_balance_service.dart'; import 'core/service/medical/my_doctor_service.dart'; import 'core/service/medical/prescriptions_service.dart'; import 'core/service/medical/radiology_service.dart'; import 'core/service/medical/reports_monthly_service.dart'; import 'core/service/medical/vital_sign_service.dart'; import 'core/viewModels/appointment_rate_view_model.dart'; +import 'core/viewModels/er/near_hospital_view_model.dart'; import 'core/viewModels/feedback/feedback_view_model.dart'; import 'core/service/medical/reports_service.dart'; import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/medical/labs_view_model.dart'; import 'core/viewModels/medical/medical_view_model.dart'; +import 'core/viewModels/medical/my_balance_view_model.dart'; import 'core/viewModels/medical/my_doctor_view_model.dart'; +import 'core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'core/viewModels/medical/prescriptions_view_model.dart'; import 'core/viewModels/medical/radiology_view_model.dart'; import 'core/viewModels/medical/reports_monthly_view_model.dart'; @@ -56,6 +62,9 @@ void setupLocator() { locator.registerLazySingleton(() => QrService()); locator.registerFactory(() => VaccineService()); locator.registerLazySingleton(() => ReportsMonthlyService()); + locator.registerLazySingleton(() => ErService()); + locator.registerLazySingleton(() => PatientSickLeaveService()); + locator.registerLazySingleton(() => MyBalanceService()); /// View Model locator.registerFactory(() => HospitalViewModel()); @@ -74,5 +83,8 @@ void setupLocator() { locator.registerFactory(() => AppointmentRateViewModel()); locator.registerFactory(() => QrViewModel()); locator.registerFactory(() => ReportsMonthlyViewModel()); + locator.registerFactory(() => NearHospitalViewModel()); + locator.registerFactory(() => PatientSickLeaveViewMode()); + locator.registerFactory(() => MyBalanceViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index 0c6b2760..ec42e7a3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class MyApp extends StatelessWidget { errorColor: Color.fromRGBO(235, 80, 60, 1.0), scaffoldBackgroundColor:Hexcolor('#E9E9E9'),// Colors.grey[100], textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), - textSelectionHandleColor: Color.fromRGBO(80, 100, 253, 1.0), + textSelectionHandleColor: Colors.grey, canvasColor: Colors.white, backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), @@ -77,7 +77,7 @@ class MyApp extends StatelessWidget { bottomSheetTheme:BottomSheetThemeData( backgroundColor: Hexcolor('#E0E0E0') ) , - cursorColor: Color.fromRGBO(78, 62, 253, 1.0), + cursorColor: Colors.grey, iconTheme: IconThemeData(), appBarTheme: AppBarTheme( color: Colors.grey[700], diff --git a/lib/pages/ErService/AmbulanceReq.dart b/lib/pages/ErService/AmbulanceReq.dart new file mode 100644 index 00000000..e69de29b diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart new file mode 100644 index 00000000..6b6166bb --- /dev/null +++ b/lib/pages/ErService/ErOptions.dart @@ -0,0 +1,78 @@ +import 'package:diplomaticquarterapp/uitl/location_util.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; + +import 'package:flutter/material.dart'; +import '../../uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; + +class ErOptions extends StatefulWidget { + final bool isAppbar; + + const ErOptions({Key key, this.isAppbar}) : super(key: key); + + + @override + _ErOptionsState createState() => _ErOptionsState(); +} + +class _ErOptionsState extends State { + LocationUtils locationUtils; + + @override + void initState() { + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + + super.initState(); + } + @override + Widget build(BuildContext context) { + return AppScaffold( + isShowAppBar: widget.isAppbar, + appBarTitle: TranslationBase.of(context).bookAppo, + body: Container( + margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ +// Text(TranslationBase.of(context).searchBy, +// style: TextStyle( +// fontSize: 24.0, +// letterSpacing: 1.0, +// fontWeight: FontWeight.bold, +// color: new Color(0xFF60686b))), + Container( + margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + child: CardCommonEr( + image: 'assets/images/new-design/AM.PNG', + text: TranslationBase.of(context).ambulancerequest, + subText: TranslationBase.of(context).requestA, + type: 0, + + ), + ), + Expanded( + child: CardCommonEr( + image: 'assets/images/new-design/emergency_icon.png', + text: TranslationBase.of(context).nearester, + subText: TranslationBase.of(context).locationa, + type: 1), + + ) + ], + ), + ), + ], + ), + ), + ); + } +} + diff --git a/lib/pages/ErService/NearestEr.dart b/lib/pages/ErService/NearestEr.dart new file mode 100644 index 00000000..227cfb3b --- /dev/null +++ b/lib/pages/ErService/NearestEr.dart @@ -0,0 +1,350 @@ +import 'package:diplomaticquarterapp/core/viewModels/er/near_hospital_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.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 '../../uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; +import 'widgets/card_position.dart'; + +class NearestEr extends StatelessWidget { + static const String _url = "assets/images/"; + + int appointmentNo; + int projectID; + + NearestEr({this.appointmentNo, this.projectID}); + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: appointmentNo != null && projectID != null + ? (model) => model.getProjectAvgERWaitingTimeOrders( + id: appointmentNo, projectID: projectID) + : (model) => model.getProjectAvgERWaitingTimeOrders(), + builder: (_, mode, widget) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Nearest ER', + baseViewModel: mode, + body: mode.ProjectAvgERWaitingTimeModeList.length > 0 + ? Container( + child: ListView( + children: [ + Text( + "\nThis service Displays nearest branch\n among all the branches of All Habib \n medical Group based on your current Location", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 18.0, + letterSpacing: 1.0, + fontWeight: FontWeight.w900, + color: new Color(0xFF60686b))), + Container( + margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Container( + child: CardPosition( + text: mode + .ProjectAvgERWaitingTimeModeList[0] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + subText: mode + .ProjectAvgERWaitingTimeModeList[0] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[0].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[0] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[0] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[0] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[0] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[0] + .projectName, + ), + ), + + ), + Expanded( + child: Container( + child: CardPosition( + text: mode + .ProjectAvgERWaitingTimeModeList[1] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + subText: mode + .ProjectAvgERWaitingTimeModeList[1] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[1].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[1] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[1] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[1] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[1] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[1] + .projectName, + ), + ), + + ) + ], + ), + Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Container( + child: CardPosition( + + text: mode + .ProjectAvgERWaitingTimeModeList[2] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + + subText: mode + .ProjectAvgERWaitingTimeModeList[2] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[2].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[2] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[2] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[2] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[2] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[2] + .projectName, + ), + ), + + ), + Expanded( + child: Container( + child: CardPosition( + + text: mode + .ProjectAvgERWaitingTimeModeList[3] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + + subText: mode + .ProjectAvgERWaitingTimeModeList[3] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[3].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[3] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[3] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[3] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[3] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[3] + .projectName, + ), + ), + flex: 0, + ) + ], + ), + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Container( + child: CardPosition( + + text: mode + .ProjectAvgERWaitingTimeModeList[4] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + + subText: mode + .ProjectAvgERWaitingTimeModeList[4] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[4].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[4] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[4] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[4] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[4] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[4] + .projectName, + ), + ), + + ), + Expanded( + child: Container( + child: CardPosition( + text: mode + .ProjectAvgERWaitingTimeModeList[5] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + subText: mode + .ProjectAvgERWaitingTimeModeList[5] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[5].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[5] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[5] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[5] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[5] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[5] + .projectName, + ), + ), + + ) + ], + ), + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: Container( + child: CardPosition( + text: mode + .ProjectAvgERWaitingTimeModeList[6] + .projectName + .toString(), + image: + 'assets/images/new-design/find_us_icon.png', + subText: mode + .ProjectAvgERWaitingTimeModeList[6] + .distanceInKilometers + .toString(), + type: mode + .ProjectAvgERWaitingTimeModeList[6].iD + .toString(), + telephone: mode + .ProjectAvgERWaitingTimeModeList[6] + .phoneNumber + .toString(), + networkImage: mode + .ProjectAvgERWaitingTimeModeList[6] + .projectImageURL + .toString(), + latitude: mode + .ProjectAvgERWaitingTimeModeList[6] + .latitude, + longitude: mode + .ProjectAvgERWaitingTimeModeList[6] + .longitude, + projectname: mode + .ProjectAvgERWaitingTimeModeList[6] + .projectName, + ), + ), + flex: 0, + ), + ], + ), + ], + )), + ], + ), + ) + : Center( + child: Texts('No Data'), + ), + ), + ); + } +} + diff --git a/lib/pages/ErService/widgets/card_common.dart b/lib/pages/ErService/widgets/card_common.dart new file mode 100644 index 00000000..c65789c5 --- /dev/null +++ b/lib/pages/ErService/widgets/card_common.dart @@ -0,0 +1,89 @@ +//import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; + +import '../NearestEr.dart'; + +class CardCommonEr extends StatelessWidget { + final image; + final text; + final subText; + final type; + const CardCommonEr( + {@required this.image, + @required this.text, + @required this.subText, + @required this.type}); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + navigateToSearch(context, this.type); + print("=============this.type============="+this.type); + }, + child: Container( + margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), + decoration: BoxDecoration(boxShadow: [ + BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) + ], borderRadius: BorderRadius.circular(10), color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(this.text, + overflow: TextOverflow.clip, + style: TextStyle( + color: new Color(0xFFc5272d), + letterSpacing: 1.0, + fontSize: 20.0)), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + child: Text(this.subText, + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), + ), + Container( + alignment: Alignment.bottomRight, + margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), + child: Image.asset(this.image, width: 60.0, height: 60.0), + ), + ], + ), + ), + ); + } + + Future navigateToSearch(context, type) async { +//===Switch case=== + if(type==0) + {print("========Ambalunce=========");} + else{ + print("=========Nearest ER==========="); + +// Navigator.push( +// context, +// +// FadePage( +// // page: NearestEr(isAppbar: true,))); +// page: NearestEr())); + Navigator.push( + context, + FadePage( + page: NearestEr())); + + } + + +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) => Search( +// type: type, +// ))); + } +} diff --git a/lib/pages/ErService/widgets/card_position.dart b/lib/pages/ErService/widgets/card_position.dart new file mode 100644 index 00000000..457f646d --- /dev/null +++ b/lib/pages/ErService/widgets/card_position.dart @@ -0,0 +1,126 @@ +//import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; +import 'package:flutter/material.dart'; +import 'package:giffy_dialog/giffy_dialog.dart'; +import 'package:url_launcher/url_launcher.dart'; +import 'package:maps_launcher/maps_launcher.dart'; + + +import '../NearestEr.dart'; + +class CardPosition extends StatelessWidget { + final image; + final text; + final subText; + final type; + final telephone; + final networkImage; + final latitude; + final longitude; + final projectname; + const CardPosition( + { + @required this.image, + @required this.text, + @required this.subText, + @required this.type, + @required this.telephone, + @required this.networkImage , + @required this.latitude, + @required this.longitude, + @required this.projectname , + }); + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + navigateToSearch(context, this.type,this.telephone,this.networkImage,this.latitude,this.longitude,this.projectname); + + }, + child: Container( + width:170, + margin: EdgeInsets.fromLTRB(7.0, 7.0, 7.0, 7.0), + decoration: BoxDecoration(boxShadow: [ + BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) + ], borderRadius: BorderRadius.circular(10), color: Colors.white), + child: Column( + + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(this.text, + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.black, + letterSpacing: 1.0, + fontSize: 2 * SizeConfig.textMultiplier)), + ), + Container( + alignment: Alignment.center, + margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), + child: Image.asset(this.image, width: 60.0, height: 60.0), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + child: Text(this.subText, + overflow: TextOverflow.clip, + style: TextStyle( + color: Color(0xFFc5272d), letterSpacing: 1.0, fontSize: 15.0)), + ), + + ], + ), + ), + ); + } + + Future navigateToSearch(context, type,telephone,networkImage,latitude,longitude,projectname) async { + +//===Switch case=== + print("================"+type); + print("================"+telephone); + print("================"+networkImage); + + showDialog( + context: context,builder: (_) => AssetGiffyDialog( + title: Text(projectname, + style: TextStyle( + fontSize: 22.0, fontWeight: FontWeight.w600), + ),image:Image.network(networkImage, fit: BoxFit.cover,), + + buttonOkText:Text("LOCATION"), + buttonOkColor: Colors.grey, + buttonCancelText:Text('CAll') , + buttonCancelColor: Colors.grey, + onOkButtonPressed: () { MapsLauncher.launchCoordinates(double.parse(latitude),double.parse(longitude),projectname);}, + onCancelButtonPressed :() {launch("tel://" +telephone);} + +// double.parse( +// _medicineProvider.pharmaciesList[index]["Latitude"]), +// double.parse( +// _medicineProvider.pharmaciesList[index]["Longitude"]), +// _medicineProvider.pharmaciesList[index] +// ["LocationDescription"]); + //launch("tel://" +telephone); +//================ +// MapsLauncher.launchCoordinates( +// double.parse( +// _medicineProvider.pharmaciesList[index]["Latitude"]), +// double.parse( +// _medicineProvider.pharmaciesList[index]["Longitude"]), +// _medicineProvider.pharmaciesList[index] +// ["LocationDescription"]); +//================= + + + + ) ); + + } + + } + + diff --git a/lib/pages/insurance/insurance_card_screen.dart b/lib/pages/insurance/insurance_card_screen.dart index 70d164ff..6483b6b2 100644 --- a/lib/pages/insurance/insurance_card_screen.dart +++ b/lib/pages/insurance/insurance_card_screen.dart @@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; @@ -39,95 +40,117 @@ class _InsuranceCardState extends State { itemBuilder: (BuildContext context, int index) { return RoundedContainer( backgroundColor: Colors.white, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ExpansionTile( - title: Container( - height: 65.0, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 15.0), - child: Texts( - model.insurance[index].groupName, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ExpansionTile( + title: Container( + height: 65.0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 15.0), + child: Texts( + model.insurance[index].groupName, + ), ), - ), - ], - ), - ), - children: [ - Divider( - color: Colors.black, - height: 25.0, - thickness: 0.5, - ), - Texts( - TranslationBase.of(context).companyName + - model.insurance[index].companyName, - fontSize: 20.0, - ), - Divider( - color: Colors.black, - height: 25.0, - thickness: 0.5, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Text( - TranslationBase.of(context).category + - model.insurance[index].subCategoryDesc, - style: TextStyle(fontSize: 18.5), - ), - Text( - TranslationBase.of(context).expirationDate + - convertDateFormat( - model.insurance[index].cardValidTo), - style: TextStyle(fontSize: 18.5), - ), - Text( - TranslationBase.of(context).patientCard + - model.insurance[index].patientCardID, - style: TextStyle(fontSize: 18.5), - ), - Text( - TranslationBase.of(context).policyNumber + - model - .insurance[index].insurancePolicyNumber, - style: TextStyle(fontSize: 18.5), - ), - ], - ), - Column( - children: [ - model.insurance[index].isActive == true - ? Text('Active', - style: TextStyle( - color: Colors.green, - fontWeight: FontWeight.w900, - fontSize: 17.9)) - : Text('Not Active', - style: TextStyle( - color: Colors.red, - fontWeight: FontWeight.w900, - fontSize: 17.9)) - ], - ), - SizedBox( - height: 14.5, + ], + ), ), - if (model.insurance[index].isActive == true) + children: [ Container( - child: Button( - label: TranslationBase.of(context).seeDetails, + padding: EdgeInsets.all(14), + width: double.infinity, + decoration: BoxDecoration( + shape: BoxShape.rectangle, + border: Border.all(color: Colors.grey,width: 0.2), + borderRadius: BorderRadius.all(Radius.circular(2)), + boxShadow: [ + BoxShadow( + color: Colors.white70, + ), + + ] + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + TranslationBase.of(context).companyName + + model.insurance[index].companyName, + fontSize: 20.0, + ), + Divider( + color: Colors.black, + height: 25.0, + thickness: 0.5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + TranslationBase.of(context).category + + model.insurance[index].subCategoryDesc, + style: TextStyle(fontSize: 18.5), + ), + Text( + TranslationBase.of(context).expirationDate + + convertDateFormat( + model.insurance[index].cardValidTo), + style: TextStyle(fontSize: 18.5), + ), + Text( + TranslationBase.of(context).patientCard + + model.insurance[index].patientCardID, + style: TextStyle(fontSize: 18.5), + ), + Text( + TranslationBase.of(context).policyNumber + + model + .insurance[index].insurancePolicyNumber, + style: TextStyle(fontSize: 18.5), + ), + ], + ), + Column( + children: [ + model.insurance[index].isActive == true + ? Text('Active', + style: TextStyle( + color: Colors.green, + fontWeight: FontWeight.w900, + fontSize: 17.9)) + : Text('Not Active', + style: TextStyle( + color: Colors.red, + fontWeight: FontWeight.w900, + fontSize: 17.9)) + ], + ), + SizedBox( + height: 14.5, + ), + if (model.insurance[index].isActive == true) + Container( + color: Colors.transparent, + child: SecondaryButton( + label: TranslationBase.of(context).seeDetails, + textColor: Colors.white, + ), + width: double.infinity, + ), + ], ), - width: 400.0, ), - ], - ), - ], + + + ], + ), + ], + ), ), ); }), diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index da9d4828..ff79e7fb 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -2,7 +2,9 @@ import 'package:diplomaticquarterapp/config/size_config.dart'; 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/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/feedback/feedback_home_page.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; @@ -512,27 +514,31 @@ class _HomePageState extends State { )), Container( width: MediaQuery.of(context).size.width * 0.29, - child: Center( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Column( - children: [ - Image.asset( - 'assets/images/Dr_Schedule_report.png', - width: 50, - height: 50, - ), - SizedBox( - height: 15, - ), - Texts( - TranslationBase.of(context).emergencyServices, - textAlign: TextAlign.center, - color: Colors.black87, - bold: false, - fontSize: SizeConfig.textMultiplier * 2.0, - ) - ], + child: InkWell( + onTap: ()=>Navigator.push(context, + FadePage(page: ErOptions(isAppbar: true,))), + child: Center( + child: Padding( + padding: const EdgeInsets.all(15.0), + child: Column( + children: [ + Image.asset( + 'assets/images/Dr_Schedule_report.png', + width: 50, + height: 50, + ), + SizedBox( + height: 15, + ), + Texts( + TranslationBase.of(context).emergencyServices, + textAlign: TextAlign.center, + color: Colors.black87, + bold: false, + fontSize: SizeConfig.textMultiplier * 2.0, + ) + ], + ), ), ), ), @@ -592,6 +598,10 @@ class _HomePageState extends State { context, FadePage(page: AllHabibMedicalService())), ), DashboardItem( + onTap: (){ + Navigator.push(context, FadePage(page: FeedbackHomePage())); + + }, child: Container( width: double.infinity, padding: EdgeInsets.all(10), diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart new file mode 100644 index 00000000..14f9b664 --- /dev/null +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -0,0 +1,377 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/balance/dialogs/SelectHospitalDialog.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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:smart_progress_bar/smart_progress_bar.dart'; + +import '../../../core/model/my_balance/AdvanceModel.dart'; +import 'dialogs/ConfirmSMSDialog.dart'; +import 'dialogs/SelectBeneficiaryDialog.dart'; +import 'dialogs/SelectPatientFamilyDialog.dart'; +import 'dialogs/SelectPatientInfoDialog.dart'; +import 'confirm_payment_page.dart'; +import 'new_text_Field.dart'; + +enum BeneficiaryType { MyAccount, MyFamilyFiles, OtherAccount, NON } + +class AdvancePaymentPage extends StatefulWidget { + @override + _AdvancePaymentPageState createState() => _AdvancePaymentPageState(); +} + +class _AdvancePaymentPageState extends State { + TextEditingController _fileTextController = TextEditingController(); + TextEditingController _notesTextController = TextEditingController(); + BeneficiaryType beneficiaryType = BeneficiaryType.NON; + HospitalsModel _selectedHospital; + String amount = ""; + String email; + PatientInfo _selectedPatientInfo; + GetAllSharedRecordsByStatusList selectedPatientFamily; + AdvanceModel advanceModel = AdvanceModel(); + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getHospitals(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Advance Payment', + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'You can create and add an Advanced Payment for you account or other accounts.', + textAlign: TextAlign.center, + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectBeneficiaryDialog(model), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getBeneficiaryType()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + SizedBox( + height: 12, + ), + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + InkWell( + onTap: () { + model.getFamilyFiles().then((value) { + confirmSelectFamilyDialog(model + .getAllSharedRecordsByStatusResponse + .getAllSharedRecordsByStatusList); + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getFamilyMembersName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'File Number', + controller: _fileTextController, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) + SizedBox( + height: 12, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) + InkWell( + onTap: () { + if (_fileTextController.text.isNotEmpty) + model + .getPatientInfoByPatientID( + id: _fileTextController.text) + .then((value) { + confirmSelectPatientDialog(model.patientInfoList); + }).showProgressBar( + text: "Loading", + backgroundColor: + Colors.blue.withOpacity(0.6)); + else + AppToast.showErrorToast( + message: 'Please Enter The File Number'); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getPatientName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + InkWell( + onTap: () => confirmSelectHospitalDialog(model.hospitals), + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(getHospitalName()), + Icon(Icons.arrow_drop_down) + ], + ), + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'Amount*', + keyboardType: TextInputType.number, + onChanged: (value) { + setState(() { + amount = value; + }); + }, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'Depositor Email*', + initialValue: model.user.emailAddress, + onChanged: (value) { + email = value; + }, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'Notes', + controller: _notesTextController, + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + label: 'Submit', + disabled: amount.isEmpty || + _fileTextController.text.isEmpty || + _selectedHospital == null, + onTap: () { + advanceModel.fileNumber = _fileTextController.text; + advanceModel.hospitalsModel = _selectedHospital; + advanceModel.note = _notesTextController.text; + advanceModel.email = email ?? model.user.emailAddress; + advanceModel.amount = amount; + + model.getPatientInfoByPatientIDAndMobileNumber().then((value) { + if (model.state != ViewState.Error && + model.state != ViewState.ErrorLocal) { + Utils.hideKeyboard(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PaymentMethod())).then( + (value) { + Navigator.push( + context, + FadePage( + page: ConfirmPaymentPage( + advanceModel: advanceModel, + selectedPaymentMethod: value, + patientInfoAndMobileNumber: + model.patientInfoAndMobileNumber, + ), + ), + ); + }, + ); + } + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); + }, + ), + )), + ); + } + + void confirmSelectBeneficiaryDialog(MyBalanceViewModel model) { + showDialog( + context: context, + child: SelectBeneficiaryDialog( + beneficiaryType: beneficiaryType, + onValueSelected: (value) { + setState(() { + if (value == BeneficiaryType.MyAccount) { + _fileTextController.text = model.user.patientID.toString(); + advanceModel.depositorName = + model.user.firstName + " " + model.user.lastName; + } else + _fileTextController.text = ""; + + beneficiaryType = value; + }); + }, + ), + ); + } + + void confirmSelectHospitalDialog(List hospitals) { + showDialog( + context: context, + child: SelectHospitalDialog( + hospitals: hospitals, + selectedHospital: _selectedHospital, + onValueSelected: (value) { + setState(() { + _selectedHospital = value; + }); + }, + ), + ); + } + + + void confirmSelectPatientDialog(List patientInfoList) { + showDialog( + context: context, + child: SelectPatientInfoDialog( + patientInfoList: patientInfoList, + selectedPatientInfo: _selectedPatientInfo, + onValueSelected: (value) { + setState(() { + advanceModel.depositorName = value.fullName; + _selectedPatientInfo = value; + }); + }, + ), + ); + } + + void confirmSelectFamilyDialog( + List getAllSharedRecordsByStatusList) { + showDialog( + context: context, + child: SelectPatientFamilyDialog( + getAllSharedRecordsByStatusList: getAllSharedRecordsByStatusList, + selectedPatientFamily: selectedPatientFamily, + onValueSelected: (value) { + setState(() { + selectedPatientFamily = value; + _fileTextController.text = selectedPatientFamily.patientID.toString(); + advanceModel.depositorName = value.patientName; + }); + }, + ), + ); + } + + String getBeneficiaryType() { + switch (beneficiaryType) { + case BeneficiaryType.MyAccount: + return "My Account"; + case BeneficiaryType.MyFamilyFiles: + return "My Family Files"; + break; + case BeneficiaryType.OtherAccount: + return "Other Account"; + break; + case BeneficiaryType.NON: + return "Select Beneficiary"; + } + return ""; + } + + String getHospitalName() { + if (_selectedHospital != null) + return _selectedHospital.name; + else + return "Select Hospital"; + } + + String getPatientName() { + if (_selectedPatientInfo != null) + return _selectedPatientInfo.fullName; + else + return "Select Patient Name"; + } + + String getFamilyMembersName() { + if (selectedPatientFamily != null) + return selectedPatientFamily.patientName; + else + return "Select Patient Name"; + } +} diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart new file mode 100644 index 00000000..d865dd2d --- /dev/null +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -0,0 +1,176 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'dialogs/ConfirmSMSDialog.dart'; +import 'new_text_Field.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class ConfirmPaymentPage extends StatelessWidget { + final AdvanceModel advanceModel; + final PatientInfoAndMobileNumber patientInfoAndMobileNumber; + final String selectedPaymentMethod; + + ConfirmPaymentPage( + {this.advanceModel, + this.patientInfoAndMobileNumber, + this.selectedPaymentMethod}); + + @override + Widget build(BuildContext context) { + void showSMSDialog() { + showDialog( + context: context, + barrierDismissible: false, + child: ConfirmSMSDialog( + phoneNumber: patientInfoAndMobileNumber.mobileNumber, + + ), + ); + } + + return BaseView( + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Advance Payment', + body: SingleChildScrollView( + physics: ScrollPhysics(), + child: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'Confirm the Payment', + textAlign: TextAlign.center, + fontWeight: FontWeight.w500, + fontSize: 24, + ), + SizedBox( + height: 12, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + height: 100.0, + padding: EdgeInsets.all(7.0), + width: MediaQuery.of(context).size.width * 0.45, + child: Image.asset(getImagePath(selectedPaymentMethod)), + ), + Texts( + '${advanceModel.amount} SAR', + fontSize: 26, + bold: true, + ) + ], + ), + SizedBox( + height: 12, + ), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(3), + child: NewTextFields( + hintText: 'File Number', + initialValue: advanceModel.fileNumber, + isEnabled: false, + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(3), + child: NewTextFields( + hintText: 'Name', + initialValue: patientInfoAndMobileNumber.firstName, + isEnabled: false, + ), + ), + ), + ], + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'Mobile Number', + initialValue: patientInfoAndMobileNumber.mobileNumber, + isEnabled: false, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'Depositor Name', + initialValue: advanceModel.depositorName, + isEnabled: false, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: 'Note', + initialValue: advanceModel.note, + isEnabled: false, + ), + ], + ), + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + label: 'CONFIRM', + disabled: model.state == ViewState.Busy, + onTap: () { + model + .sendActivationCodeForAdvancePayment( + patientID: int.parse(advanceModel.fileNumber),projectID: advanceModel.hospitalsModel.iD) + .then((value) { + if (model.state != ViewState.ErrorLocal && + model.state != ViewState.Error) showSMSDialog(); + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); + }, + ), + ), + ), + ); + } + + String getImagePath(String paymentMethod) { + switch (paymentMethod) { + case "MADA": + return 'assets/images/new-design/mada.png'; + break; + case "SADAD": + return 'assets/images/new-design/sadad.png'; + break; + case "VISA": + return 'assets/images/new-design/visa.png'; + break; + case "MASTERCARD": + return 'assets/images/new-design/mastercard.png'; + break; + case "Installment": + return 'assets/images/new-design/installment.png'; + break; + } + + return 'assets/images/new-design/mada.png'; + } +} diff --git a/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart new file mode 100644 index 00000000..7983d204 --- /dev/null +++ b/lib/pages/medical/balance/dialogs/ConfirmSMSDialog.dart @@ -0,0 +1,363 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/AdvanceModel.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info_and_mobile_number.dart'; +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:smart_progress_bar/smart_progress_bar.dart'; + +class ConfirmSMSDialog extends StatefulWidget { + final String phoneNumber; + final AdvanceModel advanceModel; + final PatientInfoAndMobileNumber patientInfoAndMobileNumber; + final String selectedPaymentMethod; + const ConfirmSMSDialog({Key key, this.phoneNumber,this.advanceModel,this.selectedPaymentMethod,this.patientInfoAndMobileNumber}) + : super(key: key); + + @override + _ConfirmSMSDialogState createState() => _ConfirmSMSDialogState(); +} + +class _ConfirmSMSDialogState extends State { + final verifyAccountForm = GlobalKey(); + Map verifyAccountFormValue = { + 'digit1': null, + 'digit2': null, + 'digit3': null, + 'digit4': null, + }; + + TextEditingController digit1 = TextEditingController(text: ""); + TextEditingController digit2 = TextEditingController(text: ""); + TextEditingController digit3 = TextEditingController(text: ""); + TextEditingController digit4 = TextEditingController(text: ""); + + String timerText = (TIMER_MIN - 1).toString() + ':59'; + int min = TIMER_MIN - 1; + int sec = 59; + Timer _timer; + + resendCode() { + min = TIMER_MIN - 1; + sec = 59; + _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { + if (min <= 0 && sec <= 0) { + timer.cancel(); + } else { + setState(() { + sec = sec - 1; + if (sec == 0 && min == 0) { + Navigator.pop(context); + min = 0; + sec = 0; + } else if (sec == 0) { + min = min - 1; + sec = 59; + } + timerText = min.toString() + ':' + sec.toString(); + }); + } + }); + } + + FocusNode focusD1; + FocusNode focusD2; + FocusNode focusD3; + FocusNode focusD4; + + @override + void initState() { + super.initState(); + resendCode(); + focusD1 = FocusNode(); + focusD2 = FocusNode(); + focusD3 = FocusNode(); + focusD4 = FocusNode(); + } + + @override + void dispose() { + _timer.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => Dialog( + elevation: 0.6, + child: Container( + height: 520, + child: ListView( + children: [ + Container( + width: double.infinity, + height: 40, + color: Colors.grey[700], + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + flex: 4, + child: Center( + child: Texts( + 'SMS', + color: Colors.white, + textAlign: TextAlign.center, + ))), + Expanded( + flex: 1, + child: InkWell( + onTap: () => Navigator.pop(context), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, color: Colors.white), + child: Icon( + Icons.clear, + color: Colors.grey[900], + )), + ), + ) + ], + ), + ), + Image.asset( + 'assets/images/login/103.png', + height: MediaQuery.of(context).size.width * 0.25, + width: MediaQuery.of(context).size.width * 0.25, + ), + SizedBox( + height: 12, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'Please enter the Verification code send to [${widget.phoneNumber}]', + textAlign: TextAlign.center, + ), + ), + SizedBox( + height: 12, + ), + Form( + key: verifyAccountForm, + child: Container( + width: SizeConfig.realScreenWidth * 0.90, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 30, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + width: 65, + child: TextFormField( + textInputAction: TextInputAction.next, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + focusNode: focusD1, + maxLength: 1, + controller: digit1, + textAlign: TextAlign.center, + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + onSaved: (val) { + verifyAccountFormValue['digit1'] = val; + }, + validator: validateCodeDigit, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD2); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context).requestFocus(focusD2); + } + }, + ), + ), + Container( + width: 65, + child: TextFormField( + focusNode: focusD2, + controller: digit2, + textInputAction: TextInputAction.next, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit2'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD3); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context).requestFocus(focusD3); + } + }, + ), + ), + Container( + width: 65, + child: TextFormField( + focusNode: focusD3, + controller: digit3, + textInputAction: TextInputAction.next, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit3'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD4); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + } + }, + )), + Container( + width: 65, + child: TextFormField( + focusNode: focusD4, + controller: digit4, + maxLength: 1, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 3, + ), + keyboardType: TextInputType.number, + decoration: buildInputDecoration(context), + validator: validateCodeDigit, + onSaved: (val) { + verifyAccountFormValue['digit4'] = val; + }, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(focusD4); + submit(model); + }, + onChanged: (val) { + if (val.length == 1) { + FocusScope.of(context) + .requestFocus(focusD4); + submit(model); + } + }), + ) + ], + ), + SizedBox( + height: 8, + ), + if (model.state == ViewState.ErrorLocal || + model.state == ViewState.Error) + Container( + margin: EdgeInsets.only(left: 8,right: 8), + width: double.maxFinite, + child: Texts( + model.error, + color: Colors.red, + ), + ), + SizedBox(height: 20), + // buildText(), + + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + 'The verification code expires in $timerText', + textAlign: TextAlign.center, + ), + ), + SizedBox(height: 20), + + Container( + width: double.maxFinite, + padding: EdgeInsets.all(12), + child: SecondaryButton( + textColor: Colors.white, + label: 'SUBMIT', + onTap: () { + submit(model); + }, + ), + ), + ], + ), + ), + ) + ], + ), + ), + ), + ); + } + + void submit(MyBalanceViewModel model) { + if (verifyAccountForm.currentState.validate()) { + final activationCode = + digit1.text + digit2.text + digit3.text + digit4.text; + model.checkActivationCodeForAdvancePayment( + activationCode: activationCode).then((value) { + //TODO complete payment + }).showProgressBar( + text: "Loading", + backgroundColor: Colors.blue.withOpacity(0.6)); + } + } + + String validateCodeDigit(value) { + if (value.isEmpty) { + return 'Please enter your Password'; + } + + return null; + } + + InputDecoration buildInputDecoration(BuildContext context) { + return InputDecoration( + // ts/images/password_icon.png + contentPadding: EdgeInsets.only(top: 20, bottom: 20), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5)), + borderSide: BorderSide(color: Colors.black), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).primaryColor), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + focusedErrorBorder: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + borderSide: BorderSide(color: Theme.of(context).errorColor), + ), + ); + } +} diff --git a/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart new file mode 100644 index 00000000..efd907b7 --- /dev/null +++ b/lib/pages/medical/balance/dialogs/SelectBeneficiaryDialog.dart @@ -0,0 +1,175 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import '../advance_payment_page.dart'; + +class SelectBeneficiaryDialog extends StatefulWidget { + final BeneficiaryType beneficiaryType; + final Function(BeneficiaryType) onValueSelected; + + SelectBeneficiaryDialog( + {Key key, this.beneficiaryType, this.onValueSelected}); + + @override + _SelectBeneficiaryDialogState createState() => + _SelectBeneficiaryDialogState(this.beneficiaryType); +} + +class _SelectBeneficiaryDialogState extends State { + _SelectBeneficiaryDialogState(this.beneficiaryType); + + BeneficiaryType beneficiaryType; + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Container( + child: Column( + children: [ + Divider(), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = BeneficiaryType.MyAccount; + }); + }, + child: ListTile( + title: const Text('My Account'), + leading: Radio( + value: BeneficiaryType.MyAccount, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (BeneficiaryType value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = BeneficiaryType.MyFamilyFiles; + }); + }, + child: ListTile( + title: const Text('My Family Files'), + leading: Radio( + value: BeneficiaryType.MyFamilyFiles, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (BeneficiaryType value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + beneficiaryType = BeneficiaryType.OtherAccount; + }); + }, + child: ListTile( + title: const Text('Other Account'), + leading: Radio( + value: BeneficiaryType.OtherAccount, + groupValue: beneficiaryType, + activeColor: Colors.red[800], + onChanged: (BeneficiaryType value) { + setState(() { + beneficiaryType = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + 'CANCEL', + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(beneficiaryType); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + 'Ok', + fontWeight: FontWeight.w400, + ), + ), + ), + ), + ), + ], + ) + ], + ), + ) + ], + ); + } +} diff --git a/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart new file mode 100644 index 00000000..7957c800 --- /dev/null +++ b/lib/pages/medical/balance/dialogs/SelectHospitalDialog.dart @@ -0,0 +1,128 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectHospitalDialog extends StatefulWidget { + final List hospitals; + final Function(HospitalsModel) onValueSelected; + HospitalsModel selectedHospital; + + SelectHospitalDialog( + {Key key, this.hospitals, this.onValueSelected, this.selectedHospital}); + + @override + _SelectHospitalDialogState createState() => _SelectHospitalDialogState(); +} + +class _SelectHospitalDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedHospital = widget.selectedHospital ?? widget.hospitals[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.hospitals.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedHospital = widget.hospitals[index]; + }); + }, + child: ListTile( + title: Text(widget.hospitals[index].name + + ' ${widget.hospitals[index].distanceInKilometers} KM'), + leading: Radio( + value: widget.hospitals[index], + groupValue: widget.selectedHospital, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedHospital = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + 'CANCEL', + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedHospital); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + 'Ok', + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart new file mode 100644 index 00000000..a21d753a --- /dev/null +++ b/lib/pages/medical/balance/dialogs/SelectPatientFamilyDialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectPatientFamilyDialog extends StatefulWidget { + final List getAllSharedRecordsByStatusList; + final Function(GetAllSharedRecordsByStatusList) onValueSelected; + GetAllSharedRecordsByStatusList selectedPatientFamily; + + SelectPatientFamilyDialog({Key key, this.getAllSharedRecordsByStatusList, this.onValueSelected,this.selectedPatientFamily}); + + @override + _SelectPatientFamilyDialogState createState() => _SelectPatientFamilyDialogState(); +} + +class _SelectPatientFamilyDialogState extends State { + + @override + void initState() { + super.initState(); + widget.selectedPatientFamily = widget.selectedPatientFamily?? widget.getAllSharedRecordsByStatusList[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.getAllSharedRecordsByStatusList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedPatientFamily = widget.getAllSharedRecordsByStatusList[index]; + }); + }, + child: ListTile( + title: Text(widget.getAllSharedRecordsByStatusList[index].patientName), + leading: Radio( + value: widget.getAllSharedRecordsByStatusList[index], + groupValue: widget.selectedPatientFamily, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedPatientFamily = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + 'CANCEL', + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedPatientFamily); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + 'Ok', + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart new file mode 100644 index 00000000..af6c02e1 --- /dev/null +++ b/lib/pages/medical/balance/dialogs/SelectPatientInfoDialog.dart @@ -0,0 +1,129 @@ +import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart'; +import 'package:diplomaticquarterapp/core/model/my_balance/patient_info.dart'; +import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class SelectPatientInfoDialog extends StatefulWidget { + final List patientInfoList ; + final Function(PatientInfo) onValueSelected; + PatientInfo selectedPatientInfo; + + SelectPatientInfoDialog({Key key, this.patientInfoList, this.onValueSelected,this.selectedPatientInfo}); + + @override + _SelectPatientInfoDialogState createState() => _SelectPatientInfoDialogState(); +} + +class _SelectPatientInfoDialogState extends State { + + @override + void initState() { + super.initState(); + widget.selectedPatientInfo = widget.selectedPatientInfo?? widget.patientInfoList[0]; + } + + @override + Widget build(BuildContext context) { + return SimpleDialog( + children: [ + Column( + children: [ + Divider(), + ...List.generate( + widget.patientInfoList.length, + (index) => Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 2, + ), + Row( + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + setState(() { + widget.selectedPatientInfo = widget.patientInfoList[index]; + }); + }, + child: ListTile( + title: Text(widget.patientInfoList[index].fullName), + leading: Radio( + value: widget.patientInfoList[index], + groupValue: widget.selectedPatientInfo, + activeColor: Colors.red[800], + onChanged: (value) { + setState(() { + widget.selectedPatientInfo = value; + }); + }, + ), + ), + ), + ) + ], + ), + SizedBox( + height: 5.0, + ), + ], + ), + ), + SizedBox( + height: 5.0, + ), + Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + child: Center( + child: Texts( + 'CANCEL', + color: Colors.red, + ), + ), + ), + ), + ), + ), + Container( + width: 1, + height: 30, + color: Colors.grey[500], + ), + Expanded( + flex: 1, + child: InkWell( + onTap: () { + widget.onValueSelected(widget.selectedPatientInfo); + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Center( + child: Texts( + 'Ok', + fontWeight: FontWeight.w400, + )), + ), + ), + ), + ], + ) + ], + ) + ], + ); + } +} diff --git a/lib/pages/medical/balance/dialogs/show_timer_text.dart b/lib/pages/medical/balance/dialogs/show_timer_text.dart new file mode 100644 index 00000000..b2cd936b --- /dev/null +++ b/lib/pages/medical/balance/dialogs/show_timer_text.dart @@ -0,0 +1,89 @@ +import 'dart:async'; + +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class ShowTimerText extends StatefulWidget { + ShowTimerText({Key key, this.model}); + final model; + + @override + _ShowTimerTextState createState() => _ShowTimerTextState(); +} + +class _ShowTimerTextState extends State { + String timerText = (TIMER_MIN - 1).toString() + ':59'; + int min = TIMER_MIN - 1; + int sec = 59; + Timer _timer; + +// AuthProvider authProv; + + resendCode() { + min = TIMER_MIN - 1; + sec = 59; + _timer = Timer.periodic(Duration(seconds: 1), (Timer timer) { + if (min <= 0 && sec <= 0) { + timer.cancel(); + } else { + setState(() { + sec = sec - 1; + if (sec == 0 && min == 0) { + //TODO + + min = 0; + sec = 0; + } else if (sec == 0) { + min = min - 1; + sec = 59; + } + timerText = min.toString() + ':' + sec.toString(); + }); + } + }); + } + + @override + void initState() { + super.initState(); + resendCode(); + } + + @override + void dispose() { + _timer.cancel(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Center( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + onTap: min != 0 || sec != 0 + ? null + : () { + resendActivatioinCode(); + }, + child: Text( + timerText, + style: TextStyle( + fontSize: 3.0 * SizeConfig.textMultiplier, + color: Hexcolor('#B8382C'), + fontWeight: FontWeight.bold), + ), + ), + ], + ), + ); + } + + resendActivatioinCode() { + + } +} diff --git a/lib/pages/medical/balance/my_balance_page.dart b/lib/pages/medical/balance/my_balance_page.dart new file mode 100644 index 00000000..9e56dfee --- /dev/null +++ b/lib/pages/medical/balance/my_balance_page.dart @@ -0,0 +1,106 @@ +import 'package:diplomaticquarterapp/core/viewModels/medical/my_balance_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.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:hexcolor/hexcolor.dart'; + +import 'advance_payment_page.dart'; + +class MyBalancePage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPatientAdvanceBalanceAmount(), + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBarTitle: 'My Balances', + body: Container( + margin: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + 'Balance Amount', + color: Colors.black, + bold: true, + ), + SizedBox( + height: 15, + ), + Container( + padding: EdgeInsets.all(8), + width: double.infinity, + height: 65, + decoration: BoxDecoration( + color: Hexcolor('#B61422'), + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts( + 'Total Balance', + color: Colors.white, + ), + Texts( + '${model.totalAdvanceBalanceAmount ?? 0} SAR', + color: Colors.white, + bold: true, + ), + ], + ), + ), + SizedBox( + height: 9, + ), + ...List.generate( + model.patientAdvanceBalanceAmountList.length, + (index) => Container( + padding: EdgeInsets.all(8), + height: 65, + margin: EdgeInsets.only(top: 8), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Texts(model.patientAdvanceBalanceAmountList[index] + .projectDescription), + Texts( + '${model.patientAdvanceBalanceAmountList[index].patientAdvanceBalanceAmount} SAR', + bold: true, + ), + ], + ), + ), + ), + ], + ), + ), + bottomSheet: Container( + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + padding: EdgeInsets.all(12), + child: SecondaryButton( + // color: Colors.grey[900], + textColor: Colors.white, + label: ' Create Advanced Payment', + onTap: () { + Navigator.push(context, + FadePage(page: AdvancePaymentPage())); + }, + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/balance/new_text_Field.dart b/lib/pages/medical/balance/new_text_Field.dart new file mode 100644 index 00000000..ad9eb580 --- /dev/null +++ b/lib/pages/medical/balance/new_text_Field.dart @@ -0,0 +1,239 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class NumberTextInputFormatter extends TextInputFormatter { + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + final int newTextLength = newValue.text.length; + int selectionIndex = newValue.selection.end; + int usedSubstringIndex = 0; + final StringBuffer newText = StringBuffer(); + if (newTextLength >= 1) { + newText.write('('); + if (newValue.selection.end >= 1) selectionIndex++; + } + if (newTextLength >= 4) { + newText.write(newValue.text.substring(0, usedSubstringIndex = 3) + ') '); + if (newValue.selection.end >= 3) selectionIndex += 2; + } + if (newTextLength >= 7) { + newText.write(newValue.text.substring(3, usedSubstringIndex = 6) + '-'); + if (newValue.selection.end >= 6) selectionIndex++; + } + if (newTextLength >= 11) { + newText.write(newValue.text.substring(6, usedSubstringIndex = 10) + ' '); + if (newValue.selection.end >= 10) selectionIndex++; + } + // Dump the rest. + if (newTextLength >= usedSubstringIndex) + newText.write(newValue.text.substring(usedSubstringIndex)); + return TextEditingValue( + text: newText.toString(), + selection: TextSelection.collapsed(offset: selectionIndex), + ); + } +} + +final _mobileFormatter = NumberTextInputFormatter(); + +class NewTextFields extends StatefulWidget { + NewTextFields( + {Key key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.onTap, + this.fontSize = 16.0, + this.fontWeight = FontWeight.w700, + this.autoValidate = false, + this.hintColor,this.isEnabled=true}) + : super(key: key); + + final String hintText; + + // final String initialValue; + final String type; + final bool autoFocus; + final IconData suffixIcon; + final Color suffixIconColor; + final Icon prefixIcon; + final VoidCallback onTap; + final TextEditingController controller; + final TextInputType keyboardType; + final FormFieldValidator validator; + final Function onSaved; + final Function onSuffixTap; + final Function onChanged; + final Function onSubmit; + final bool readOnly; + final int maxLength; + final int minLines; + final int maxLines; + final bool maxLengthEnforced; + final bool bare; + final bool isEnabled; + final TextInputAction inputAction; + final double fontSize; + final FontWeight fontWeight; + final bool keepPadding; + final TextCapitalization textCapitalization; + final List inputFormatters; + final bool autoValidate; + final EdgeInsets padding; + final bool focus; + final bool borderOnlyError; + final Color hintColor; + final String initialValue; + @override + _NewTextFieldsState createState() => _NewTextFieldsState(); +} + +class _NewTextFieldsState extends State { + final FocusNode _focusNode = FocusNode(); + bool focus = false; + bool view = false; + + @override + void initState() { + super.initState(); + _focusNode.addListener(() { + setState(() { + focus = _focusNode.hasFocus; + }); + }); + } + + @override + void didUpdateWidget(NewTextFields oldWidget) { + if (widget.focus) _focusNode.requestFocus(); + super.didUpdateWidget(oldWidget); + } + + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + + + bool _determineReadOnly() { + if (widget.readOnly != null && widget.readOnly) { + _focusNode.unfocus(); + return true; + } else { + return false; + } + } + + @override + Widget build(BuildContext context) { + return AnimatedContainer( + duration: Duration(milliseconds: 300), + decoration:BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white), + child: Container( + margin: EdgeInsets.only(top: 8), + + child: TextFormField( + enabled: widget.isEnabled, + initialValue: widget.initialValue, + keyboardAppearance: Theme.of(context).brightness, + scrollPhysics: BouncingScrollPhysics(), + autovalidate: widget.autoValidate, + textCapitalization: widget.textCapitalization, + onFieldSubmitted: widget.inputAction == TextInputAction.next + ? (widget.onSubmit != null + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) + : widget.onSubmit, + textInputAction: widget.inputAction, + minLines: widget.minLines ?? 1, + maxLines: widget.maxLines ?? 1, + maxLengthEnforced: widget.maxLengthEnforced, + onChanged: widget.onChanged, + focusNode: _focusNode, + maxLength: widget.maxLength ?? null, + controller: widget.controller, + keyboardType: widget.keyboardType, + readOnly: _determineReadOnly(), + obscureText: widget.type == "password" && !view ? true : false, + autofocus: widget.autoFocus ?? false, + validator: widget.validator, + onSaved: widget.onSaved, + + style: Theme.of(context) + .textTheme + .body2 + .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + inputFormatters: widget.keyboardType == TextInputType.phone + ? [ + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] + : widget.inputFormatters, + decoration: InputDecoration( + labelText: widget.hintText, + labelStyle: TextStyle(color: Colors.black), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(0.5), + width: 1.0), + borderRadius: BorderRadius.circular(12.0)), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .errorColor + .withOpacity(0.5), + width: 1.0), + borderRadius: BorderRadius.circular(8.0)), + focusedBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12)), + disabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12)), + enabledBorder: OutlineInputBorder( + borderSide: + BorderSide(color: Colors.white, width: 1.0), + borderRadius: BorderRadius.circular(12), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/medical/medical_profile_page.dart b/lib/pages/medical/medical_profile_page.dart index e78e18a9..678ede88 100644 --- a/lib/pages/medical/medical_profile_page.dart +++ b/lib/pages/medical/medical_profile_page.dart @@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model. import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/patient_sick_leave_page.dart'; import 'package:diplomaticquarterapp/pages/medical/reports/monthly_reports.dart'; import 'package:diplomaticquarterapp/pages/vaccine/my_vaccines_screen.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_home_page.dart'; @@ -23,6 +24,7 @@ import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_card_screen.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; +import 'balance/my_balance_page.dart'; import 'doctor/doctor_home_page.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_approval_screen.dart'; @@ -331,12 +333,13 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( - onTap: (){ + onTap: () { Navigator.push(context, FadePage(page: MonthlyReportsPage())); }, child: MedicalProfileItem( - title: TranslationBase.of(context).monthly, + title: + TranslationBase.of(context).monthly, imagePath: 'medical_history_icon.png', subTitle: TranslationBase.of(context) .monthlySubtitle, @@ -349,10 +352,12 @@ class _MedicalProfilePageState extends State { flex: 1, child: InkWell( //TODO -// onTap: () { -// Navigator.push( -// context, FadePage(page: DoctorHomePage())); -// }, + onTap: () { + Navigator.push( + context, + FadePage( + page: PatientSickLeavePage())); + }, child: MedicalProfileItem( title: TranslationBase.of(context).sick, imagePath: 'insurance_card_icon.png', @@ -364,10 +369,10 @@ class _MedicalProfilePageState extends State { Expanded( flex: 1, child: InkWell( -// onTap: () { -// Navigator.push( -// context, FadePage(page: InsuranceApproval())); -// }, + onTap: () { + Navigator.push(context, + FadePage(page: MyBalancePage())); + }, child: MedicalProfileItem( title: TranslationBase.of(context).myBalance, diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart new file mode 100644 index 00000000..dab3d6cf --- /dev/null +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -0,0 +1,51 @@ +import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; +import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; + +class PatientSickLeavePage extends StatefulWidget { + @override + _PatientSickLeavePageState createState() => _PatientSickLeavePageState(); +} + +class _PatientSickLeavePageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getSickLeave(), + builder: (_, model, w) => AppScaffold( + isShowAppBar: true, + appBarTitle: 'Sick Leave', + baseViewModel: model, + body: Container( + margin: EdgeInsets.all(12), + child: ListView.builder( + itemCount: model.sickLeaveList.length, + itemBuilder: (context, index) => DoctorCard( + name: model.sickLeaveList[index].doctorName, + date: DateUtil.getMonthDayYearDateFormatted( + model.sickLeaveList[index].requestDate), + profileUrl: model.sickLeaveList[index].doctorImageURL, + rat: model.sickLeaveList[index].actualDoctorRate.toDouble(), + subName: model.sickLeaveList[index].projectName, + isInOutPatientDescription: + model.sickLeaveList[index].isInOutPatientDescription, + onEmailTap: () { + model.sendSickLeaveEmail( + message: TranslationBase.of(context).emailSentSuccessfully, + requestNo: model.sickLeaveList[index].requestNo, + doctorName: model.sickLeaveList[index].doctorName, + projectName: model.sickLeaveList[index].projectName, + setupID: model.sickLeaveList[index].setupID, + projectID: model.sickLeaveList[index].projectID); + }, + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/vaccine/my_vaccines_item_screen.dart b/lib/pages/vaccine/my_vaccines_item_screen.dart new file mode 100644 index 00000000..33ef5975 --- /dev/null +++ b/lib/pages/vaccine/my_vaccines_item_screen.dart @@ -0,0 +1,78 @@ +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; +import '../base/base_view.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; +import 'package:popup_box/popup_box.dart'; + +class MyVaccinesItemPage extends StatefulWidget { + @override + _MyVaccinesItemPageState createState() => _MyVaccinesItemPageState(); +} + +class _MyVaccinesItemPageState extends State { + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getMyVaccinationItem(), + builder: (BuildContext context, VaccineViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).myVaccinesAvailability, + baseViewModel: model, + body: Container( + margin: EdgeInsets.only( + left: SizeConfig.screenWidth * 0.004, + right: SizeConfig.screenWidth * 0.004, + top: SizeConfig.screenWidth * 0.04, + ), + child: ListView.builder( + itemCount: model.vaccinationItemList.length, + itemBuilder: (context, index) => InkWell( + onTap: () async { + await model.getMyVaccinationOnHand( + pItemCode: model.vaccinationItemList[index].iTEMCODE); + if (model.hasError) { + AppToast.showErrorToast(message: model.error); + } else { + //TODO show dialog + + } + }, + child: Container( + margin: EdgeInsets.all(5), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(7), + color: Colors.white, + ), + child: Row( + children: [ + Expanded( + child: Texts( + model.vaccinationItemList[index].dESCRIPTION)), + Icon(projectViewModel.isArabic + ? Icons.arrow_forward_ios + : Icons.arrow_back_ios) + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/pages/vaccine/my_vaccines_screen.dart b/lib/pages/vaccine/my_vaccines_screen.dart index cfb0415f..02d67cac 100644 --- a/lib/pages/vaccine/my_vaccines_screen.dart +++ b/lib/pages/vaccine/my_vaccines_screen.dart @@ -1,17 +1,19 @@ -import 'dart:typed_data'; -import 'dart:convert'; +import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:flutter/cupertino.dart'; import '../base/base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/core/viewModels/vaccine_view_model.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container.dart'; -import 'package:flutter_email_sender/flutter_email_sender.dart'; import 'package:popup_box/popup_box.dart'; +import 'my_vaccines_item_screen.dart'; + class MyVaccines extends StatefulWidget { @override _MyVaccinesState createState() => _MyVaccinesState(); @@ -25,7 +27,7 @@ class _MyVaccinesState extends State { builder: (BuildContext context, VaccineViewModel model, Widget child) => AppScaffold( isShowAppBar: true, - appBarTitle: 'My Vaccines', + appBarTitle: TranslationBase.of(context).myVaccines, baseViewModel: model, body: Container( margin: EdgeInsets.only( @@ -58,69 +60,76 @@ class _MyVaccinesState extends State { children: [ Row( children: [ - Column( - children: [ - Padding( - padding: EdgeInsets.symmetric( - horizontal: 20.0, - vertical: 20.0), - child: Image.network( - model.vaccineList[index] - .doctorImageURL, - height: SizeConfig - .imageSizeMultiplier * - 23, - width: SizeConfig - .imageSizeMultiplier * - 20, - fit: BoxFit.fill, - ), - ), - ], - ), - Container( + Expanded( child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, children: [ - Text( - model.vaccineList[index] - .doctorTitle + - model.vaccineList[index] - .doctorName, - style: TextStyle( - fontWeight: FontWeight.w900, - fontSize: 16.6, + Padding( + padding: EdgeInsets.symmetric( + horizontal: 20.0, + vertical: 20.0), + child: Image.network( + model.vaccineList[index] + .doctorImageURL, + height: SizeConfig + .imageSizeMultiplier * + 23, + width: SizeConfig + .imageSizeMultiplier * + 20, + fit: BoxFit.fill, ), ), - SpaceBetweenTexts(space: 7.0), - Text( - model.vaccineList[index] - .projectName, - style: TextStyle( - fontSize: 17.0, - letterSpacing: 0.5, + ], + ), + flex: 2, + ), + Expanded( + child: Container( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + model.vaccineList[index] + .doctorTitle + + model.vaccineList[index] + .doctorName, + style: TextStyle( + fontWeight: + FontWeight.w900, + fontSize: 16.6, + ), ), - ), - SpaceBetweenTexts(space: 7.0), - Text( - model.vaccineList[index] - .vaccineName, - style: TextStyle( - fontSize: 17.0, + SizedBox(height: 7.0), + Text( + model.vaccineList[index] + .projectName, + style: TextStyle( + fontSize: 17.0, + letterSpacing: 0.5, + ), ), - ), - SpaceBetweenTexts(space: 7.0), - Text( - 'Date Taken ' + - convertDateFormat(model - .vaccineList[index] - .invoiceDate), - style: - TextStyle(fontSize: 17.0), - ), - ], + SizedBox(height: 7.0), + Text( + model.vaccineList[index] + .vaccineName, + style: TextStyle( + fontSize: 17.0, + ), + ), + SizedBox(height: 7.0), + Text( + 'Date Taken ' + + convertDateFormat(model + .vaccineList[index] + .invoiceDate), + style: TextStyle( + fontSize: 17.0), + ), + ], + ), ), + flex: 5, ), ], ), @@ -134,182 +143,52 @@ class _MyVaccinesState extends State { ], ), ), - SpaceBetweenTexts(space: 165.0), - Flexible( - child: Container( - width: 350.0, - height: 80.0, - child: Button( - label: 'CHECK VACCINE AVAILABILITY', - backgroundColor: Color(0xff9EA3A4), - ), + // SpaceBetweenTexts(space: 165.0), + ], + ), + ), + bottomSheet: Container( + color: Theme.of(context).scaffoldBackgroundColor, + padding: EdgeInsets.all(12), + height: MediaQuery.of(context).size.height * 0.25, + width: double.infinity, + child: Column( + children: [ + Divider( + height: 2, + thickness: 1, + ), + SizedBox( + height: 6, + ), + Container( + width: double.infinity, + // height: 80.0, + child: Button( + label: TranslationBase.of(context).checkVaccineAvailability, + backgroundColor: Color(0xff9EA3A4), + onTap: () => + Navigator.push(context, FadePage(page: MyVaccinesItemPage())), ), ), - Flexible( - child: Container( - width: 350.0, - height: 80.0, - child: Button( - label: 'SEND EMAIL', - backgroundColor: Color(0xffF62426), - onTap: () async { - await PopupBox.showPopupBox( - context: context, - button: MaterialButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), - ), - color: Colors.white, - child: Text( - 'CANCEL', - style: TextStyle(fontSize: 16.5), - ), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - willDisplayWidget: Column( - children: [ - Text( - 'Conform \nSend a copy of this report to the email' + - model.vaccineList[0].doctorName, - style: TextStyle( - fontSize: 20, - color: Colors.black26, - fontWeight: FontWeight.w900), - ), - SizedBox( - height: 30.0, - ), - ], - )); - }, - ), + Container( + width: double.infinity, + // height: 80.0, + child: SecondaryButton( + label: TranslationBase.of(context).sendEmail, + color: Color(0xffF62426), + textColor: Colors.white, + disabled: model.vaccineList.length == 0, + loading: model.state == ViewState.BusyLocal, + onTap: () async { + model.sendEmail( + message: + TranslationBase.of(context).emailSentSuccessfully); + }, ), ), ], ), - -// child: ListView.builder( -// itemCount: model.vaccineList == null ? 0 : model.vaccineList.length, -// itemBuilder: (BuildContext context, int index) { -// return Column( -// children: [ -// RoundedContainer( -// backgroundColor: Colors.white, -// child: Column( -// children: [ -// ExpansionTile( -// title: Container( -// height: 60.0, -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Texts('2018'), -// ], -// ), -// ), -// children: [ -// Column( -// children: [ -// Row( -// children: [ -// Column( -// children: [ -// Padding( -// padding: EdgeInsets.symmetric( -// horizontal: 20.0, vertical: 20.0), -// child: Container( -// child: Image.network( -// model.vaccineList[index] -// .doctorImageURL, -// height: SizeConfig -// .imageSizeMultiplier * -// 23, -// width: SizeConfig -// .imageSizeMultiplier * -// 20, -// fit: BoxFit.fill, -// colorBlendMode: -// BlendMode.hardLight, -// ), -// ), -// ) -// ], -// ), -// Container( -// child: Column( -// mainAxisAlignment: -// MainAxisAlignment.start, -// crossAxisAlignment: -// CrossAxisAlignment.start, -// children: [ -// Text( -// model.vaccineList[index] -// .doctorTitle + -// model.vaccineList[index] -// .doctorName, -// style: TextStyle( -// fontWeight: FontWeight.w900, -// fontSize: 17.5), -// ), -// Text( -// model -// .vaccineList[index].projectName, -// style: TextStyle( -// fontSize: 19.0, -// letterSpacing: 0.3, -// color: Colors.grey, -// fontWeight: FontWeight.bold), -// ), -// Text( -// model -// .vaccineList[index].vaccineName, -// style: TextStyle( -// fontSize: 19.0, -// color: Colors.grey, -// fontWeight: FontWeight.bold), -// ), -// Text( -// 'Date Taken ' + -// convertDateFormat(model -// .vaccineList[index] -// .invoiceDate), -// style: TextStyle( -// fontSize: 19.0, -// color: Colors.grey, -// fontWeight: FontWeight.bold), -// ), -// ], -// ), -// ), -// ], -// ), -// ], -// ), -// ], -// ), -// ], -// ), -// ), -// Container( -// width: 300, -// child: Button( -// label: 'CHECK VACCINE AVAILABILITY', -// backgroundColor: Color(0xff9EA3A4), -// ), -// ), -// Container( -// width: 300, -// child: Button( -// label: 'SEND EMAIL', -// backgroundColor: Color(0xff9EA3A4), -// ), -// ), -// ], -// ); -// }, -// ), ), ), ); @@ -332,30 +211,4 @@ class _MyVaccinesState extends State { return newDate.toString(); } - - emailSender() async { - final Email email = Email( - body: 'Email body', - subject: 'Email subject', - recipients: ['example@example.com'], - cc: ['cc@example.com'], - bcc: ['bcc@example.com'], - attachmentPaths: ['/path/to/attachment.zip'], - isHTML: false, - ); - - await FlutterEmailSender.send(email); - } -} - -class SpaceBetweenTexts extends StatelessWidget { - final double space; - SpaceBetweenTexts({this.space}); - - @override - Widget build(BuildContext context) { - return SizedBox( - height: space, - ); - } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 41a5a537..f8ead077 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -444,6 +444,14 @@ class TranslationBase { String get branch =>localizedValues['branch'][locale.languageCode]; String get emergencyServices =>localizedValues['emergencyServices'][locale.languageCode]; + String get nearester=> localizedValues['nearester'][locale.languageCode]; + String get locationa=> localizedValues['locationa'][locale.languageCode]; + String get ambulancerequest=> localizedValues['ambulancerequest'][locale.languageCode]; + String get requestA=> localizedValues['requestA'][locale.languageCode]; + + + + String get consultation => localizedValues['consultation'][locale.languageCode]; @@ -521,6 +529,9 @@ class TranslationBase { String get save => localizedValues['Save'][locale.languageCode]; String get userAgreement => localizedValues['UserAgreement'][locale.languageCode]; String get updateSuccessfully => localizedValues['UpdateSuccessfully'][locale.languageCode]; + String get emailSentSuccessfully => localizedValues['EmailSentSuccessfully'][locale.languageCode]; + String get checkVaccineAvailability => localizedValues['CHECK_VACCINE_AVAILABILITY'][locale.languageCode]; + String get myVaccinesAvailability => localizedValues['MyVaccinesAvailability'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/data_display/medical/doctor_card.dart b/lib/widgets/data_display/medical/doctor_card.dart index 47095cf7..b7c4a185 100644 --- a/lib/widgets/data_display/medical/doctor_card.dart +++ b/lib/widgets/data_display/medical/doctor_card.dart @@ -14,6 +14,9 @@ class DoctorCard extends StatelessWidget { final String profileUrl; final String billNo; final Function onTap; + final Function onEmailTap; + + final String isInOutPatientDescription; DoctorCard( {this.name, @@ -22,7 +25,9 @@ class DoctorCard extends StatelessWidget { this.date, this.profileUrl, this.billNo, - this.onTap}); + this.onTap, + this.onEmailTap, + this.isInOutPatientDescription}); @override Widget build(BuildContext context) { @@ -36,6 +41,7 @@ class DoctorCard extends StatelessWidget { borderRadius: BorderRadius.all( Radius.circular(8.0), ), + color: Colors.white ), child: InkWell( onTap: onTap, @@ -56,7 +62,7 @@ class DoctorCard extends StatelessWidget { quarterTurns: 3, child: Center( child: Text( - "Calendar", + isInOutPatientDescription ?? "Calendar", style: TextStyle(color: Colors.white), ), )), @@ -111,6 +117,13 @@ class DoctorCard extends StatelessWidget { ), ), ), + InkWell( + onTap: onEmailTap, + child: Icon( + Icons.email, + color: Colors.red, + ), + ) ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index ea73a56b..9b9588fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,9 +31,11 @@ dependencies: # Permissions permission_handler: ^5.0.0+hotfix.3 device_info: ^0.4.2+4 +#popub + giffy_dialog: ^1.8.0 # Flutter Html View - flutter_html: ^1.0.2 + flutter_html: 1.0.2 # Native flutter_device_type: ^0.2.0