diff --git a/assets/images/inpatient_advance.png b/assets/images/inpatient_advance.png new file mode 100644 index 00000000..38f1b7f4 Binary files /dev/null and b/assets/images/inpatient_advance.png differ diff --git a/assets/images/new/admission_notice.png b/assets/images/new/admission_notice.png new file mode 100644 index 00000000..50b5c1d5 Binary files /dev/null and b/assets/images/new/admission_notice.png differ diff --git a/assets/images/new/birth.png b/assets/images/new/birth.png new file mode 100644 index 00000000..39bd3f81 Binary files /dev/null and b/assets/images/new/birth.png differ diff --git a/assets/images/new/consent.jpg b/assets/images/new/consent.jpg new file mode 100644 index 00000000..0d0e7df8 Binary files /dev/null and b/assets/images/new/consent.jpg differ diff --git a/assets/images/new/hospital.png b/assets/images/new/hospital.png new file mode 100644 index 00000000..10c6a1f1 Binary files /dev/null and b/assets/images/new/hospital.png differ diff --git a/assets/images/new/instructions.jpg b/assets/images/new/instructions.jpg new file mode 100644 index 00000000..0b6025f5 Binary files /dev/null and b/assets/images/new/instructions.jpg differ diff --git a/assets/images/new/meal_plan.png b/assets/images/new/meal_plan.png new file mode 100644 index 00000000..4368a1df Binary files /dev/null and b/assets/images/new/meal_plan.png differ diff --git a/assets/images/new/medical_instructions.png b/assets/images/new/medical_instructions.png new file mode 100644 index 00000000..a6d0e0e2 Binary files /dev/null and b/assets/images/new/medical_instructions.png differ diff --git a/lib/config/config.dart b/lib/config/config.dart index 3b774575..21e83c1e 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -617,6 +617,40 @@ var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality'; var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; +// Check If InPatient API +var CHECK_IF_INPATIENT = 'Services/Patients.svc/REST/GetInPatientAdmissionInfo'; + +var CHECK_IF_PATIENT_ADMITTED = 'Services/Inps.svc/REST/checkIsPatientAdmittedOrAdmissionRequest'; + + + +// Get General Instructions API +var GET_GENERAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getGeneralInstructions'; + +// Get Medical Instructions API +var GET_MEDICAL_INSTRUCTIONS = 'Services/INPs.svc/REST/getPatientAdmissionRequest'; + +var GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS = 'Services/INPs.svc/REST/getInpatientAdvancePendingPayment'; + +var GET_INPATIENT_PAID_ADVANCE_PAYMENT = 'Services/INPs.svc/REST/getInpatientAdvanceHistory'; + +var GET_INPATIENT_ADVANCE_PAYMENT_LINK = 'Services/PayFort_Serv.svc/REST/InsertInPatientAdvanceDetails'; + +var INSERT_INPATIENT_ORDER = 'Services/INPs.svc/REST/Inpcp_insertOrder'; + +var INPATIENT_DISCHARGE_MEDICATIONS = 'Services/INPs.svc/REST/chekPatientHasDischargeMedicine'; + +var GET_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/getBirthNotification_bymothermrn'; + +var SAVE_BIRTH_NOTIFICATION = 'Services/INPs.svc/REST/SaveBirthNotification'; + +//Meal Plan APIs +var GET_ADMITTED_PATIENTS = 'Services/MOP.svc/REST/GetAdmittedPatients'; +var GET_CURRENT_WEEKID_WEEKDAY = 'Services/MOP.svc/REST/GetCurrentWeekAndDayHMGMP'; +var GET_MEALS_OF_SCHEDULE_ID = 'Services/MOP.svc/REST/GetMealsOfScheduleID_Mobile'; +var GET_MEAL_ITEMS_OF_SCHEDULE_ID = 'Services/MOP.svc/REST/GetDefaultItemsOfScheduleID'; +var PLACE_MEAL_PLAN_ORDER = 'Services/MOP.svc/REST/UpdateOrMakeNewOrder'; + var CHECK_PATIENT_NPHIES_ELIGIBILITY = 'Services/Doctors.svc/REST/checkPatientInsuranceCompanyValidity'; var CONVERT_PATIENT_TO_CASH = 'Services/Doctors.svc/REST/deActivateInsuranceCompany'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 3f3074d3..97a7c1d4 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -175,7 +175,7 @@ const Map localizedValues = { "reminderCancelSuccess": {"en": "The reminder has been cancelled successfully", "ar": "تم إلغاء التذكير بنجاح"}, "patientShareToDo": {"en": "Amount before tax: ", "ar": "المبلغ قبل الضريبة:"}, "patientTaxToDo": {"en": "Tax amount: ", "ar": "قيمة الضريبة:"}, - "patientShareTotalToDo": {"en": "Total amount Due: ", "ar": "المبلغ الإجمالي المستحق:"}, + "patientShareTotalToDo": {"en": "Total amount due: ", "ar": "المبلغ الإجمالي المستحق:"}, 'paymentMethod': {'en': 'Payment Method', 'ar': 'طريقة الدفع او السداد'}, 'noNeedToWaitInLine': {'en': 'No need to stand in line.', 'ar': 'لا داعي للوقوف في الطابور.'}, 'useQRAppoAttend': {'en': 'Use the QR code to register the appointment attendance.', 'ar': 'استخدم الكود لتسجيل الحضور في المستشفى.'}, @@ -1891,6 +1891,47 @@ const Map localizedValues = { "updateInsuranceManuallyDialog": {"en": "Would you like to update your insurance manually?", "ar": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, "viewReport": {"en": "View Report", "ar": "عرض التقرير"}, "sickLeaveAdmittedPatient": {"en": "You cannot activate this sick leave since you're an admitted patient.", "ar": "لا يمكنك تفعيل هذه الإجازة المرضية لأنك مريض مقبل."}, + "InPatient": {"en": "InPatient", "ar": "خدمات"}, + "InPatientServices": {"en": "Services", "ar": "تنويم"}, + "InPatientServicesHeader": {"en": "InPatient Services", "ar": "خدمات التنويم"}, + "admissionGeneral": {"en": "Admission General", "ar": "اقرار"}, + "consent": {"en": "Consent", "ar": "التنويم"}, + "generalInstructionsTitle": {"en": "General", "ar": "تعليمات"}, + "generalInstructionsSubTitle": {"en": "Instructions", "ar": "التنويم العامة"}, + "medicalInstructionsTitle": {"en": "Medical", "ar": "التعليمات الطبية"}, + "medicalInstructionsSubTitle": {"en": "Instructions", "ar": "قبل التنويم"}, + "mealPlanTitle": {"en": "Meal Plan", "ar": "خدمات"}, + "mealPlanSubTitle": {"en": "Services", "ar": "الوجبات"}, + "birthNotificationTitle": {"en": "Birth", "ar": "خدمات"}, + "birthNotificationSubTitle": {"en": "Notification", "ar": "تبليغ الولادة"}, + "admissionNoticeTitle": {"en": "Admission", "ar": "إشعار"}, + "admissionNoticeSubTitle": {"en": "Notice", "ar": "تنويم"}, + "mothersMRN": {"en": "Mother's MRN *", "ar": "رقم ملف الأم"}, + "mothersName": {"en": "Mother's name *", "ar": "اسم الأم"}, + "fathersNameEN": {"en": "Father's name english *", "ar": "اسم الاب انجليزي"}, + "fathersNameAR": {"en": "Father's name arabic *", "ar": "اسم الاب عربي"}, + "babysNameEN": {"en": "Baby's name english *", "ar": "اسم المولود انجليزي"}, + "babysNameAR": {"en": "Baby's name arabic *", "ar": "اسم المولود عربي"}, + "contactNumber": {"en": "Contact number *", "ar": "رقم الاتصال"}, + "scanID": {"en": "Scan ID", "ar": "معرف المسح"}, + "birthNotificationNotes1": { + "en": "For Saudis: Provide copy of the identification card for both couples. If the wife doesn't have identification card, The family card must be provided.", + "ar": "للسعوديين : إرفاق صورة من بطاقة الأحوال لكلا الزوجين وفي حال عدم توفر بطاقة الزوجة ترفق عنها بطاقة العائلة" + }, + "birthNotificationNotes2": {"en": "Non Saudis: Provide copy of iqama or copy of the passport.", "ar": "لغير السعوديين : إرفاق صورة الإقامة آأو جواز السفر"}, + "birthNotificationNotes3": {"en": "For Residents without identification card: Provide marriage contract.", "ar": "للمواطنين الغير حاملين لبطاقة الأحوال : إرفاق صورة من عقد الزواج برقم الحاسب"}, + "placeOrder": {"en": "Place Order", "ar": "مكان الامر"}, + "isFasting": {"en": "Are you fasting?", "ar": "هل أنت صائم؟"}, + "noGeneralInstructions": {"en": "You do not have any general instructions right now.", "ar": "ليس لديك أي تعليمات عامة في الوقت الحالي."}, + "noMedicalInstructions": {"en": "You do not have any medical instructions right now.", "ar": "ليس لديك أي تعليمات طبية في الوقت الحالي."}, + "medicalInstructions": {"en": "Medical Instructions:", "ar": "تعليمات طبية:"}, + "generalInstructions": {"en": "General Instructions:", "ar": "تعليمات عامة:"}, + "copyLink": {"en": "COPY LINK", "ar": "نسخ الوصلة:"}, + "paymentLinkCopied": {"en": "Payment link copied to your clipboard!'", "ar": "تم نسخ رابط الدفع إلى الحافظة الخاصة بك!"}, + "copyLinkTxt": {"en": "Or you can copy the payment link from below & send it to someone who can pay on your behalf: ", "ar": "أو يمكنك نسخ رابط الدفع من الأسفل وإرساله إلى شخص يمكنه الدفع نيابة عنك:"}, + "proErrorMessage": {"en": "Dear patient, Our staff is currently out of office, please note that our working hours are from 7:00 AM to 10:00 PM, and we'd love to help you during that time, or you can call ", "ar": "عزيزي المريض ، طاقم العمل لدينا خارج المكتب حاليًا ، يرجى ملاحظة أن ساعات العمل لدينا من 7:00 صباحًا إلى 10:00 مساءً ، ويسعدنا مساعدتك خلال هذا الوقت ، أو يمكنك الاتصال بـ <أدخل الرقم هنا>"}, + "admissionNo": {"en": "Admission No", "ar": "رقم القبول:"}, + "admissionReqNo": {"en": "Admission Request No", "ar": "رقم طلب القبول:"}, "dischargeDate": {"en": "Discharge Date", "ar": "تاريخ التفريغ"}, "selectAdmissionText": {"en": "Please select one of the admissions from below to view medical reports:", "ar": "يرجى تحديد أحد حالات القبول من الأسفل لعرض التقارير الطبية:"}, "invalidEligibility": {"en": "You cannot make online payment because you are not eligible to use the provided service.", "ar": "لا يمكنك إجراء الدفع عبر الإنترنت لأنك غير مؤهل لاستخدام الخدمة المقدمة."}, @@ -1903,4 +1944,11 @@ const Map localizedValues = { "validInsurance": {"en": "Do you have a valid insurance?", "ar": "هل لديك تأمين صالح؟"}, "checkInViaLocation": {"en": "Check-In Via Location", "ar": "تسجيل الوصول عبر الموقع"}, "locationCheckInError": {"en": "Please make sure that you're within the hospital location to perform online check-in.", "ar": "يرجى التأكد من تواجدك داخل موقع المستشفى لإجراء تسجيل الوصول عبر الإنترنت."}, + "onlyAdmitted": {"en": "This service is only available for admitted patients", "ar": "هذه الخدمة متاحة فقط للمرضى المقبولين"}, + "assistYou": {"en": "How we may assist you?", "ar": "كيف يمكننا مساعدتك؟"}, + "receive": {"en": "Receive", "ar": "تجهيز"}, + "PRO": {"en": "PRO", "ar": "علاقات المرضى"}, + "patientRelationOffice": {"en": "Patient Relation Office", "ar": "علاقات المرضى"}, + + }; \ No newline at end of file diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index c795394f..3d98703a 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -150,8 +150,8 @@ class BaseAppClient { // body['IdentificationNo'] = 1023854217; // body['MobileNo'] = "531940021"; - // body?['PatientID'] = 1231755; //3844083 - // body?['TokenID'] = "@dm!n"; + // body['PatientID'] = 4767370; //3844083 + // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 // Mobile no.: 0502303285 diff --git a/lib/core/viewModels/project_view_model.dart b/lib/core/viewModels/project_view_model.dart index 45c4e95c..e37e8809 100644 --- a/lib/core/viewModels/project_view_model.dart +++ b/lib/core/viewModels/project_view_model.dart @@ -11,13 +11,14 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/laser_body_parts.dart'; import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_request_info_response_model.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_datetime_picker_plus/flutter_datetime_picker_plus.dart'; bool isAppArabic = false; - class ProjectViewModel extends BaseViewModel { GAnalytics get analytics => locator(); @@ -36,11 +37,19 @@ class ProjectViewModel extends BaseViewModel { String error = ''; dynamic searchvalue; bool isLogin = false; + int laserSelectionDuration; + bool isPatientAdmitted = false; + bool patientHasAdmissionRequest = false; + int inPatientProjectID = 0; + GetAdmissionInfoResponseModel getAdmissionInfoResponseModel; + GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel; + + double _latitude; + double _longitude; RegisterInfoResponse _registerInfo = RegisterInfoResponse(); RegisterInfoResponse get registerInfo => _registerInfo; - dynamic get searchValue => searchvalue; Locale get appLocal => _appLocale; @@ -63,7 +72,7 @@ class ProjectViewModel extends BaseViewModel { List get projectDetailListModel => _projectDetailListModel; List selectedBodyPartList = []; - + late StreamSubscription subscription; late double _latitude; @@ -119,6 +128,31 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } + setIsPatientAdmitted(bool isAdmitted) { + this.isPatientAdmitted = isAdmitted; + notifyListeners(); + } + + setPatientHasAdmissionRequest(bool hasAdmissionRequest) { + this.patientHasAdmissionRequest = hasAdmissionRequest; + notifyListeners(); + } + + setInPatientProjectID(int projectID) { + this.inPatientProjectID = projectID; + notifyListeners(); + } + + setInPatientAdmissionInfo(GetAdmissionInfoResponseModel _getAdmissionInfoResponseModel) { + this.getAdmissionInfoResponseModel = _getAdmissionInfoResponseModel; + notifyListeners(); + } + + setInPatientAdmissionRequest(GetAdmissionRequestInfoResponseModel _getAdmissionRequestInfoResponseModel) { + this.getAdmissionRequestInfoResponseModel = _getAdmissionRequestInfoResponseModel; + notifyListeners(); + } + setPrivilegeModelList({List? privilege}) { this.isLoginChild = isLoginChild; privilegeRootUser = privilege!; @@ -162,7 +196,7 @@ class ProjectViewModel extends BaseViewModel { notifyListeners(); } - + bool havePrivilege(int id) { bool isHavePrivilege = false; @@ -192,7 +226,7 @@ class ProjectViewModel extends BaseViewModel { searchvalue = data; notifyListeners(); } - + void setLatitudeLongitude(double lat, double long) { _latitude = lat; _longitude = long; diff --git a/lib/models/InPatientServices/get_admission_info_response_model.dart b/lib/models/InPatientServices/get_admission_info_response_model.dart new file mode 100644 index 00000000..25d87884 --- /dev/null +++ b/lib/models/InPatientServices/get_admission_info_response_model.dart @@ -0,0 +1,92 @@ +class GetAdmissionInfoResponseModel { + String setupID; + int projectID; + int admissionNo; + String admissionDate; + int admissionRequestNo; + int admissionType; + int patientType; + int patientID; + int clinicID; + int doctorID; + int admittingClinicID; + int admittingDoctorID; + int categoryID; + String roomID; + String bedID; + dynamic dischargeDate; + int approvalNo; + int status; + String statusDesc; + String statusDescN; + + GetAdmissionInfoResponseModel( + {this.setupID, + this.projectID, + this.admissionNo, + this.admissionDate, + this.admissionRequestNo, + this.admissionType, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.admittingClinicID, + this.admittingDoctorID, + this.categoryID, + this.roomID, + this.bedID, + this.dischargeDate, + this.approvalNo, + this.status, + this.statusDesc, + this.statusDescN}); + + GetAdmissionInfoResponseModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + admissionDate = json['AdmissionDate']; + admissionRequestNo = json['AdmissionRequestNo']; + admissionType = json['AdmissionType']; + patientType = json['PatientType']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + admittingClinicID = json['AdmittingClinicID']; + admittingDoctorID = json['AdmittingDoctorID']; + categoryID = json['CategoryID']; + roomID = json['RoomID']; + bedID = json['BedID']; + dischargeDate = json['DischargeDate']; + approvalNo = json['ApprovalNo']; + status = json['Status']; + statusDesc = json['StatusDesc']; + statusDescN = json['StatusDescN']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['AdmissionDate'] = this.admissionDate; + data['AdmissionRequestNo'] = this.admissionRequestNo; + data['AdmissionType'] = this.admissionType; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['AdmittingClinicID'] = this.admittingClinicID; + data['AdmittingDoctorID'] = this.admittingDoctorID; + data['CategoryID'] = this.categoryID; + data['RoomID'] = this.roomID; + data['BedID'] = this.bedID; + data['DischargeDate'] = this.dischargeDate; + data['ApprovalNo'] = this.approvalNo; + data['Status'] = this.status; + data['StatusDesc'] = this.statusDesc; + data['StatusDescN'] = this.statusDescN; + return data; + } +} diff --git a/lib/models/InPatientServices/get_admission_request_info_response_model.dart b/lib/models/InPatientServices/get_admission_request_info_response_model.dart new file mode 100644 index 00000000..c11a7ccd --- /dev/null +++ b/lib/models/InPatientServices/get_admission_request_info_response_model.dart @@ -0,0 +1,86 @@ +class GetAdmissionRequestInfoResponseModel { + int admissionRequestNo; + String clinicName; + String doctorName; + String expectedAdmissionDate; + List medicalInstructions; + dynamic medicalInstructionsXML; + String medicalRemarks; + int projectId; + String projectName; + String setupId; + int clinicId; + int doctorId; + + GetAdmissionRequestInfoResponseModel( + {this.admissionRequestNo, + this.clinicName, + this.doctorName, + this.expectedAdmissionDate, + this.medicalInstructions, + this.medicalInstructionsXML, + this.medicalRemarks, + this.projectId, + this.projectName, + this.setupId, + this.clinicId, + this.doctorId}); + + GetAdmissionRequestInfoResponseModel.fromJson(Map json) { + admissionRequestNo = json['admissionRequestNo']; + clinicName = json['clinicName']; + doctorName = json['doctorName']; + clinicId = json['ClinicID']; + doctorId = json['DoctorID']; + expectedAdmissionDate = json['expectedAdmissionDate']; + if (json['medicaLInstructions'] != null) { + medicalInstructions = []; + json['medicaLInstructions'].forEach((v) { + medicalInstructions.add(new MedicaLInstructions.fromJson(v)); + }); + } + medicalInstructionsXML = json['medicalInstructionsXML']; + medicalRemarks = json['medicalRemarks']; + projectId = json['projectId']; + projectName = json['projectName']; + setupId = json['setupId']; + } + + Map toJson() { + final Map data = new Map(); + data['admissionRequestNo'] = this.admissionRequestNo; + data['clinicName'] = this.clinicName; + data['doctorName'] = this.doctorName; + data['clinicId'] = this.clinicId; + data['doctorId'] = this.doctorId; + data['expectedAdmissionDate'] = this.expectedAdmissionDate; + if (this.medicalInstructions != null) { + data['medicaLInstructions'] = this.medicalInstructions.map((v) => v.toJson()).toList(); + } + data['medicalInstructionsXML'] = this.medicalInstructionsXML; + data['medicalRemarks'] = this.medicalRemarks; + data['projectId'] = this.projectId; + data['projectName'] = this.projectName; + data['setupId'] = this.setupId; + return data; + } +} + +class MedicaLInstructions { + String description; + int parameterCode; + + MedicaLInstructions({this.description, this.parameterCode}); + + MedicaLInstructions.fromJson(Map json) { + description = json['description']; + parameterCode = json['parameterCode']; + } + + Map toJson() { + final Map data = new Map(); + data['description'] = this.description; + data['parameterCode'] = this.parameterCode; + return data; + } +} diff --git a/lib/models/InPatientServices/get_admitted_patient_response_model.dart b/lib/models/InPatientServices/get_admitted_patient_response_model.dart new file mode 100644 index 00000000..17836ed1 --- /dev/null +++ b/lib/models/InPatientServices/get_admitted_patient_response_model.dart @@ -0,0 +1,220 @@ +class GetAdmittedPatientsResponseModel { + String setupID; + int projectID; + int admissionNo; + String admissionDate; + int patientType; + int patientID; + int clinicID; + int doctorID; + String roomID; + String bedID; + int status; + int admissionStatus; + String createdOn; + String firstName; + String middleName; + String lastName; + String firstNameN; + String middleNameN; + String lastNameN; + int gender; + String dateofBirth; + dynamic companionFirstName; + dynamic companionMiddleName; + dynamic companionLastName; + dynamic companionFirstNameN; + dynamic companionMiddleNameN; + dynamic companionLastNameN; + dynamic companionID; + dynamic companionGender; + bool isHasCompanion; + int buildingID; + int floorID; + int nursingStationID; + int dietType; + String dietTypeDateCahnged; + String dietTypeDescription; + String dietTypeDescriptionN; + dynamic allergyDiseaseDateCahnged; + dynamic allergyDiseaseChecked; + dynamic doctorRemarks; + dynamic allergyRemarks; + String age; + dynamic allergies; + String companionFullName; + bool dietTypeChanged; + String dietTypeDateCahngedDate; + String genderDescription; + dynamic genderImageUrl; + bool hasAllergy; + bool isNewAdmitted; + String patientFullName; + dynamic allergyRemark; + + GetAdmittedPatientsResponseModel( + {this.setupID, + this.projectID, + this.admissionNo, + this.admissionDate, + this.patientType, + this.patientID, + this.clinicID, + this.doctorID, + this.roomID, + this.bedID, + this.status, + this.admissionStatus, + this.createdOn, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.companionFirstName, + this.companionMiddleName, + this.companionLastName, + this.companionFirstNameN, + this.companionMiddleNameN, + this.companionLastNameN, + this.companionID, + this.companionGender, + this.isHasCompanion, + this.buildingID, + this.floorID, + this.nursingStationID, + this.dietType, + this.dietTypeDateCahnged, + this.dietTypeDescription, + this.dietTypeDescriptionN, + this.allergyDiseaseDateCahnged, + this.allergyDiseaseChecked, + this.doctorRemarks, + this.allergyRemarks, + this.age, + this.allergies, + this.companionFullName, + this.dietTypeChanged, + this.dietTypeDateCahngedDate, + this.genderDescription, + this.genderImageUrl, + this.hasAllergy, + this.isNewAdmitted, + this.patientFullName, + this.allergyRemark}); + + GetAdmittedPatientsResponseModel.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + admissionNo = json['AdmissionNo']; + admissionDate = json['AdmissionDate']; + patientType = json['PatientType']; + patientID = json['PatientID']; + clinicID = json['ClinicID']; + doctorID = json['DoctorID']; + roomID = json['RoomID']; + bedID = json['BedID']; + status = json['Status']; + admissionStatus = json['AdmissionStatus']; + createdOn = json['CreatedOn']; + firstName = json['FirstName']; + middleName = json['MiddleName']; + lastName = json['LastName']; + firstNameN = json['FirstNameN']; + middleNameN = json['MiddleNameN']; + lastNameN = json['LastNameN']; + gender = json['Gender']; + dateofBirth = json['DateofBirth']; + companionFirstName = json['CompanionFirstName']; + companionMiddleName = json['CompanionMiddleName']; + companionLastName = json['CompanionLastName']; + companionFirstNameN = json['CompanionFirstNameN']; + companionMiddleNameN = json['CompanionMiddleNameN']; + companionLastNameN = json['CompanionLastNameN']; + companionID = json['CompanionID']; + companionGender = json['CompanionGender']; + isHasCompanion = json['IsHasCompanion']; + buildingID = json['BuildingID']; + floorID = json['FloorID']; + nursingStationID = json['NursingStationID']; + dietType = json['DietType']; + dietTypeDateCahnged = json['DietTypeDateCahnged']; + dietTypeDescription = json['DietTypeDescription']; + dietTypeDescriptionN = json['DietTypeDescriptionN']; + allergyDiseaseDateCahnged = json['AllergyDiseaseDateCahnged']; + allergyDiseaseChecked = json['AllergyDiseaseChecked']; + doctorRemarks = json['DoctorRemarks']; + allergyRemarks = json['AllergyRemarks']; + age = json['Age']; + allergies = json['Allergies']; + companionFullName = json['CompanionFullName']; + dietTypeChanged = json['DietTypeChanged']; + dietTypeDateCahngedDate = json['DietTypeDateCahnged_Date']; + genderDescription = json['GenderDescription']; + genderImageUrl = json['GenderImageUrl']; + hasAllergy = json['HasAllergy']; + isNewAdmitted = json['IsNewAdmitted']; + patientFullName = json['PatientFullName']; + allergyRemark = json['allergyRemark']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['AdmissionNo'] = this.admissionNo; + data['AdmissionDate'] = this.admissionDate; + data['PatientType'] = this.patientType; + data['PatientID'] = this.patientID; + data['ClinicID'] = this.clinicID; + data['DoctorID'] = this.doctorID; + data['RoomID'] = this.roomID; + data['BedID'] = this.bedID; + data['Status'] = this.status; + data['AdmissionStatus'] = this.admissionStatus; + data['CreatedOn'] = this.createdOn; + 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['CompanionFirstName'] = this.companionFirstName; + data['CompanionMiddleName'] = this.companionMiddleName; + data['CompanionLastName'] = this.companionLastName; + data['CompanionFirstNameN'] = this.companionFirstNameN; + data['CompanionMiddleNameN'] = this.companionMiddleNameN; + data['CompanionLastNameN'] = this.companionLastNameN; + data['CompanionID'] = this.companionID; + data['CompanionGender'] = this.companionGender; + data['IsHasCompanion'] = this.isHasCompanion; + data['BuildingID'] = this.buildingID; + data['FloorID'] = this.floorID; + data['NursingStationID'] = this.nursingStationID; + data['DietType'] = this.dietType; + data['DietTypeDateCahnged'] = this.dietTypeDateCahnged; + data['DietTypeDescription'] = this.dietTypeDescription; + data['DietTypeDescriptionN'] = this.dietTypeDescriptionN; + data['AllergyDiseaseDateCahnged'] = this.allergyDiseaseDateCahnged; + data['AllergyDiseaseChecked'] = this.allergyDiseaseChecked; + data['DoctorRemarks'] = this.doctorRemarks; + data['AllergyRemarks'] = this.allergyRemarks; + data['Age'] = this.age; + data['Allergies'] = this.allergies; + data['CompanionFullName'] = this.companionFullName; + data['DietTypeChanged'] = this.dietTypeChanged; + data['DietTypeDateCahnged_Date'] = this.dietTypeDateCahngedDate; + data['GenderDescription'] = this.genderDescription; + data['GenderImageUrl'] = this.genderImageUrl; + data['HasAllergy'] = this.hasAllergy; + data['IsNewAdmitted'] = this.isNewAdmitted; + data['PatientFullName'] = this.patientFullName; + data['allergyRemark'] = this.allergyRemark; + return data; + } +} diff --git a/lib/models/InPatientServices/get_general_instructions_response_model.dart b/lib/models/InPatientServices/get_general_instructions_response_model.dart new file mode 100644 index 00000000..e582782d --- /dev/null +++ b/lib/models/InPatientServices/get_general_instructions_response_model.dart @@ -0,0 +1,52 @@ +class GetGeneralInstructions { + int rowID; + int iD; + int projectID; + String text; + String textN; + bool isActive; + int createdBy; + String createdOn; + dynamic editedBy; + dynamic editedOn; + + GetGeneralInstructions( + {this.rowID, + this.iD, + this.projectID, + this.text, + this.textN, + this.isActive, + this.createdBy, + this.createdOn, + this.editedBy, + this.editedOn}); + + GetGeneralInstructions.fromJson(Map json) { + rowID = json['RowID']; + iD = json['ID']; + projectID = json['ProjectID']; + text = json['Text']; + textN = json['TextN']; + isActive = json['IsActive']; + createdBy = json['CreatedBy']; + createdOn = json['CreatedOn']; + editedBy = json['EditedBy']; + editedOn = json['EditedOn']; + } + + Map toJson() { + final Map data = new Map(); + data['RowID'] = this.rowID; + data['ID'] = this.iD; + data['ProjectID'] = this.projectID; + data['Text'] = this.text; + data['TextN'] = this.textN; + data['IsActive'] = this.isActive; + data['CreatedBy'] = this.createdBy; + data['CreatedOn'] = this.createdOn; + data['EditedBy'] = this.editedBy; + data['EditedOn'] = this.editedOn; + return data; + } +} diff --git a/lib/models/InPatientServices/get_inpatient_advance_history_response_model.dart b/lib/models/InPatientServices/get_inpatient_advance_history_response_model.dart new file mode 100644 index 00000000..fcc42771 --- /dev/null +++ b/lib/models/InPatientServices/get_inpatient_advance_history_response_model.dart @@ -0,0 +1,71 @@ +class InPatientAdvanceHistoryResponseModel { + int advanceNumber; + int errorCode; + String message; + List responseInpatientAdvanceInfo; + int statusCode; + + InPatientAdvanceHistoryResponseModel({this.advanceNumber, this.errorCode, this.message, this.responseInpatientAdvanceInfo, this.statusCode}); + + InPatientAdvanceHistoryResponseModel.fromJson(Map json) { + advanceNumber = json['advanceNumber']; + errorCode = json['errorCode']; + message = json['message']; + if (json['responseInpatientAdvanceInfo'] != null) { + responseInpatientAdvanceInfo = []; + json['responseInpatientAdvanceInfo'].forEach((v) { + responseInpatientAdvanceInfo.add(new ResponseInpatientAdvanceInfo.fromJson(v)); + }); + } + statusCode = json['statusCode']; + } + + Map toJson() { + final Map data = new Map(); + data['advanceNumber'] = this.advanceNumber; + data['errorCode'] = this.errorCode; + data['message'] = this.message; + if (this.responseInpatientAdvanceInfo != null) { + data['responseInpatientAdvanceInfo'] = this.responseInpatientAdvanceInfo.map((v) => v.toJson()).toList(); + } + data['statusCode'] = this.statusCode; + return data; + } +} + +class ResponseInpatientAdvanceInfo { + int admissionNo; + int admissionReqNo; + String createdOn; + int patientId; + int projectId; + num requestedAmount; + String setupId; + int status; + + ResponseInpatientAdvanceInfo({this.admissionNo, this.admissionReqNo, this.createdOn, this.patientId, this.projectId, this.requestedAmount, this.setupId, this.status}); + + ResponseInpatientAdvanceInfo.fromJson(Map json) { + admissionNo = json['admissionNo']; + admissionReqNo = json['admissionReqNo']; + createdOn = json['createdOn']; + patientId = json['patientId']; + projectId = json['projectId']; + requestedAmount = json['requestedAmount']; + setupId = json['setupId']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['admissionNo'] = this.admissionNo; + data['admissionReqNo'] = this.admissionReqNo; + data['createdOn'] = this.createdOn; + data['patientId'] = this.patientId; + data['projectId'] = this.projectId; + data['requestedAmount'] = this.requestedAmount; + data['setupId'] = this.setupId; + data['status'] = this.status; + return data; + } +} diff --git a/lib/models/InPatientServices/get_inpatient_advance_requests_response_model.dart b/lib/models/InPatientServices/get_inpatient_advance_requests_response_model.dart new file mode 100644 index 00000000..b5f4fb49 --- /dev/null +++ b/lib/models/InPatientServices/get_inpatient_advance_requests_response_model.dart @@ -0,0 +1,74 @@ +class InPatientAdvanceResponseModel { + int advanceNumber; + Null errorCode; + String message; + List responseInpatientAdvanceInfo; + int statusCode; + + InPatientAdvanceResponseModel({this.advanceNumber, this.errorCode, this.message, this.responseInpatientAdvanceInfo, this.statusCode}); + + InPatientAdvanceResponseModel.fromJson(Map json) { + advanceNumber = json['advanceNumber']; + errorCode = json['errorCode']; + message = json['message']; + if (json['responseInpatientAdvanceInfo'] != null) { + responseInpatientAdvanceInfo = []; + json['responseInpatientAdvanceInfo'].forEach((v) { + responseInpatientAdvanceInfo.add(new ResponseInpatientAdvanceInfo.fromJson(v)); + }); + } + statusCode = json['statusCode']; + } + + Map toJson() { + final Map data = new Map(); + data['advanceNumber'] = this.advanceNumber; + data['errorCode'] = this.errorCode; + data['message'] = this.message; + if (this.responseInpatientAdvanceInfo != null) { + data['responseInpatientAdvanceInfo'] = this.responseInpatientAdvanceInfo.map((v) => v.toJson()).toList(); + } + data['statusCode'] = this.statusCode; + return data; + } +} + +class ResponseInpatientAdvanceInfo { + int admissionNo; + int admissionReqNo; + String createdOn; + int patientId; + int projectId; + num requestedAmount; + String setupId; + int status; + int paymentRequestID; + + ResponseInpatientAdvanceInfo({this.admissionNo, this.admissionReqNo, this.createdOn, this.patientId, this.projectId, this.requestedAmount, this.setupId, this.status, this.paymentRequestID}); + + ResponseInpatientAdvanceInfo.fromJson(Map json) { + admissionNo = json['admissionNo']; + admissionReqNo = json['admissionReqNo']; + createdOn = json['createdOn']; + patientId = json['patientId']; + projectId = json['projectId']; + requestedAmount = json['requestedAmount']; + setupId = json['setupId']; + status = json['status']; + paymentRequestID = json['PaymentRequestId']; + } + + Map toJson() { + final Map data = new Map(); + data['admissionNo'] = this.admissionNo; + data['admissionReqNo'] = this.admissionReqNo; + data['createdOn'] = this.createdOn; + data['patientId'] = this.patientId; + data['projectId'] = this.projectId; + data['requestedAmount'] = this.requestedAmount; + data['setupId'] = this.setupId; + data['status'] = this.status; + data['PaymentRequestId'] = this.paymentRequestID; + return data; + } +} diff --git a/lib/models/InPatientServices/get_meal_items_schedule_response_model.dart b/lib/models/InPatientServices/get_meal_items_schedule_response_model.dart new file mode 100644 index 00000000..c55d716d --- /dev/null +++ b/lib/models/InPatientServices/get_meal_items_schedule_response_model.dart @@ -0,0 +1,74 @@ +import 'package:flutter/material.dart'; + +class GetMealItemsScheduleResponseModel { + int itemID; + String description; + String descriptionN; + dynamic comment; + dynamic commentN; + String imageURL; + bool isDefault; + int categoryID; + String categoryDescription; + String categoryDescriptionN; + int scheduleID; + int cal; + + GetMealItemsScheduleResponseModel( + {this.itemID, + this.description, + this.descriptionN, + this.comment, + this.commentN, + this.imageURL, + this.isDefault, + this.categoryID, + this.categoryDescription, + this.categoryDescriptionN, + this.scheduleID, + this.cal}); + + GetMealItemsScheduleResponseModel.fromJson(Map json) { + itemID = json['ItemID']; + description = json['Description']; + descriptionN = json['DescriptionN']; + comment = json['Comment']; + commentN = json['CommentN']; + imageURL = json['ImageURL']; + isDefault = json['IsDefault']; + categoryID = json['CategoryID']; + categoryDescription = json['CategoryDescription']; + categoryDescriptionN = json['CategoryDescriptionN']; + scheduleID = json['ScheduleID']; + cal = json['cal']; + } + + Map toJson() { + final Map data = new Map(); + data['ItemID'] = this.itemID; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['Comment'] = this.comment; + data['CommentN'] = this.commentN; + data['ImageURL'] = this.imageURL; + data['IsDefault'] = this.isDefault; + data['CategoryID'] = this.categoryID; + data['CategoryDescription'] = this.categoryDescription; + data['CategoryDescriptionN'] = this.categoryDescriptionN; + data['ScheduleID'] = this.scheduleID; + data['cal'] = this.cal; + return data; + } +} + +class GetMealItemsScheduleResponseModelList { + String filterName = ""; + List getMealItemsScheduleResponseModelList = []; + + // int selectedItemID = 0; + final ValueNotifier selectedItemID = ValueNotifier(0); + + GetMealItemsScheduleResponseModelList({this.filterName, GetMealItemsScheduleResponseModel getMealItemsScheduleResponseModel}) { + getMealItemsScheduleResponseModelList.add(getMealItemsScheduleResponseModel); + } +} diff --git a/lib/models/InPatientServices/get_meals_schedule_response_model.dart b/lib/models/InPatientServices/get_meals_schedule_response_model.dart new file mode 100644 index 00000000..178ba426 --- /dev/null +++ b/lib/models/InPatientServices/get_meals_schedule_response_model.dart @@ -0,0 +1,60 @@ +class GetMealsScheduleResponseModel { + int scheduleID; + int mealID; + String description; + String descriptionN; + int weekID; + String weekDescription; + String weekDescriptionN; + String tAT; + int dietTypeID; + int dayID; + bool isShow; + String tATTime; + + GetMealsScheduleResponseModel( + {this.scheduleID, + this.mealID, + this.description, + this.descriptionN, + this.weekID, + this.weekDescription, + this.weekDescriptionN, + this.tAT, + this.dietTypeID, + this.dayID, + this.isShow, + this.tATTime}); + + GetMealsScheduleResponseModel.fromJson(Map json) { + scheduleID = json['ScheduleID']; + mealID = json['MealID']; + description = json['Description']; + descriptionN = json['DescriptionN']; + weekID = json['WeekID']; + weekDescription = json['WeekDescription']; + weekDescriptionN = json['WeekDescriptionN']; + tAT = json['TAT']; + dietTypeID = json['DietTypeID']; + dayID = json['DayID']; + isShow = json['IsShow']; + tATTime = json['TATTime']; + } + + Map toJson() { + final Map data = new Map(); + data['ScheduleID'] = this.scheduleID; + data['MealID'] = this.mealID; + data['Description'] = this.description; + data['DescriptionN'] = this.descriptionN; + data['WeekID'] = this.weekID; + data['WeekDescription'] = this.weekDescription; + data['WeekDescriptionN'] = this.weekDescriptionN; + data['TAT'] = this.tAT; + data['DietTypeID'] = this.dietTypeID; + data['DayID'] = this.dayID; + data['IsShow'] = this.isShow; + data['TATTime'] = this.tATTime; + return data; + } +} diff --git a/lib/models/InPatientServices/get_medical_instructions_response_model.dart b/lib/models/InPatientServices/get_medical_instructions_response_model.dart new file mode 100644 index 00000000..2396e588 --- /dev/null +++ b/lib/models/InPatientServices/get_medical_instructions_response_model.dart @@ -0,0 +1,85 @@ +class GetMedicalInstructions { + dynamic propertyChanged; + int admissionRequestNoField; + String clinicNameField; + String doctorNameField; + String expectedAdmissionDateField; + List medicaLInstructionsField; + dynamic medicalInstructionsXMLField; + String medicalRemarksField; + int projectIdField; + String projectNameField; + String setupIdField; + + GetMedicalInstructions( + {this.propertyChanged, + this.admissionRequestNoField, + this.clinicNameField, + this.doctorNameField, + this.expectedAdmissionDateField, + this.medicaLInstructionsField, + this.medicalInstructionsXMLField, + this.medicalRemarksField, + this.projectIdField, + this.projectNameField, + this.setupIdField}); + + GetMedicalInstructions.fromJson(Map json) { + propertyChanged = json['PropertyChanged']; + admissionRequestNoField = json['admissionRequestNoField']; + clinicNameField = json['clinicNameField']; + doctorNameField = json['doctorNameField']; + expectedAdmissionDateField = json['expectedAdmissionDateField']; + if (json['medicaLInstructions'] != null) { + medicaLInstructionsField = []; + json['medicaLInstructions'].forEach((v) { + medicaLInstructionsField.add(new MedicaLInstructionsField.fromJson(v)); + }); + } + medicalInstructionsXMLField = json['medicalInstructionsXMLField']; + medicalRemarksField = json['medicalRemarksField']; + projectIdField = json['projectIdField']; + projectNameField = json['projectNameField']; + setupIdField = json['setupIdField']; + } + + Map toJson() { + final Map data = new Map(); + data['PropertyChanged'] = this.propertyChanged; + data['admissionRequestNoField'] = this.admissionRequestNoField; + data['clinicNameField'] = this.clinicNameField; + data['doctorNameField'] = this.doctorNameField; + data['expectedAdmissionDateField'] = this.expectedAdmissionDateField; + if (this.medicaLInstructionsField != null) { + data['medicaLInstructionsField'] = this.medicaLInstructionsField.map((v) => v.toJson()).toList(); + } + data['medicalInstructionsXMLField'] = this.medicalInstructionsXMLField; + data['medicalRemarksField'] = this.medicalRemarksField; + data['projectIdField'] = this.projectIdField; + data['projectNameField'] = this.projectNameField; + data['setupIdField'] = this.setupIdField; + return data; + } +} + +class MedicaLInstructionsField { + Null propertyChanged; + String descriptionField; + int parameterCodeField; + + MedicaLInstructionsField({this.propertyChanged, this.descriptionField, this.parameterCodeField}); + + MedicaLInstructionsField.fromJson(Map json) { + propertyChanged = json['PropertyChanged']; + descriptionField = json['description']; + parameterCodeField = json['parameterCodeField']; + } + + Map toJson() { + final Map data = new Map(); + data['PropertyChanged'] = this.propertyChanged; + data['descriptionField'] = this.descriptionField; + data['parameterCodeField'] = this.parameterCodeField; + return data; + } +} diff --git a/lib/pages/BookAppointment/BookSuccess.dart b/lib/pages/BookAppointment/BookSuccess.dart index 5c815605..497e1df1 100644 --- a/lib/pages/BookAppointment/BookSuccess.dart +++ b/lib/pages/BookAppointment/BookSuccess.dart @@ -160,6 +160,7 @@ class _BookSuccessState extends State { return Container( alignment: Alignment.bottomCenter, height: MediaQuery.of(context).size.height * 0.18, + margin: EdgeInsets.only(bottom: 24), child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -170,7 +171,7 @@ class _BookSuccessState extends State { minWidth: MediaQuery.of(context).size.width * 0.7, height: 45.0, child: CustomTextButton( - backgroundColor: Color(0xFF60686b), + backgroundColor: CustomColors.green, elevation: 0, onPressed: () { // navigateToQR(context); diff --git a/lib/pages/InPatientServices/birth_notification.dart b/lib/pages/InPatientServices/birth_notification.dart new file mode 100644 index 00000000..23ae1a4c --- /dev/null +++ b/lib/pages/InPatientServices/birth_notification.dart @@ -0,0 +1,305 @@ +import 'dart:convert'; + +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/pages/insurance/AttachInsuranceCardImageDialog.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class BirthNotification extends StatefulWidget { + const BirthNotification({Key key}) : super(key: key); + + @override + State createState() => _BirthNotificationState(); +} + +class _BirthNotificationState extends State { + TextEditingController motherMRN = new TextEditingController(); + TextEditingController motherName = new TextEditingController(); + TextEditingController fatherName = new TextEditingController(); + TextEditingController fatherNameAR = new TextEditingController(); + TextEditingController babyName = new TextEditingController(); + TextEditingController babyNameAR = new TextEditingController(); + TextEditingController contactNumber = new TextEditingController(); + + ProjectViewModel projectViewModel; + + List images = []; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + motherMRN.text = projectViewModel.user.patientID.toString(); + motherName.text = projectViewModel.user.firstName + " " + projectViewModel.user.lastName; + contactNumber.text = projectViewModel.user.mobileNumber; + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).birthNotificationTitle + " " + TranslationBase.of(context).birthNotificationSubTitle, + body: SingleChildScrollView( + child: Container( + width: MediaQuery.of(context).size.width, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.all(21.0), + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).enterDetailBelow + " :", + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + mHeight(16), + inputWidget(TranslationBase.of(context).mothersMRN, "", motherMRN, isEnable: false), + mHeight(16), + inputWidget(TranslationBase.of(context).mothersName, "", motherName, isEnable: false), + mHeight(16), + inputWidget(TranslationBase.of(context).fathersNameEN, "", fatherName), + mHeight(16), + inputWidget(TranslationBase.of(context).fathersNameAR, "", fatherNameAR), + mHeight(16), + inputWidget(TranslationBase.of(context).babysNameEN, "", babyName), + mHeight(16), + inputWidget(TranslationBase.of(context).babysNameAR, "", babyNameAR), + mHeight(16), + inputWidget(TranslationBase.of(context).contactNumber, "", contactNumber), + mHeight(16), + DefaultButton( + TranslationBase.of(context).scanID, + () { + confirmAttachInsuranceCardImageDialogDialog( + context: context, name: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, fileNo: projectViewModel.user.patientID.toString()); + }, + color: CustomColors.accentColor, + disabledColor: CustomColors.grey2, + ), + if (images.isNotEmpty) mHeight(16), + if (images.isNotEmpty) + Padding( + padding: const EdgeInsets.only(top: 16.0, bottom: 16.0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Image.memory( + base64Decode(images[0]), + width: 80.0, + height: 80.0, + fit: BoxFit.cover, + ), + Text( + "image 1.png", + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + InkWell( + onTap: () { + setState(() { + images.clear(); + }); + }, + child: Icon( + Icons.delete_sharp, + color: Colors.red[300], + ), + ) + ], + ), + ), + mHeight(16), + Text( + "● " + TranslationBase.of(context).birthNotificationNotes1, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + mHeight(16), + Text( + "● " + TranslationBase.of(context).birthNotificationNotes2, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + mHeight(16), + Text( + "● " + TranslationBase.of(context).birthNotificationNotes3, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + mHeight(100.0), + // DefaultButton( + // TranslationBase.of(context).submit, + // (fatherNameAR.text.isEmpty || fatherName.text.isEmpty || babyNameAR.text.isEmpty || babyName.text.isEmpty) ? null : () { + // submitBirthNotification(); + // }, + // color: CustomColors.accentColor, + // disabledColor: CustomColors.grey2, + // ), + ], + ), + ), + ), + bottomSheet: Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(20), + child: DefaultButton( + TranslationBase.of(context).submit, + (fatherNameAR.text.isEmpty || fatherName.text.isEmpty || babyNameAR.text.isEmpty || babyName.text.isEmpty || images.isEmpty) + ? null + : () { + submitBirthNotification(); + }, + color: CustomColors.accentColor, + disabledColor: CustomColors.grey2, + ), + ), + ); + } + + void submitBirthNotification() { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .submitBirthNotification( + projectViewModel.user.patientID, projectViewModel.inPatientProjectID, fatherNameAR.text, fatherName.text, babyNameAR.text, babyName.text, contactNumber.text, images[0], context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).processDoneSuccessfully); + Navigator.of(context).pop(); + }).catchError((err) { + print(err); + }); + } + + void confirmAttachInsuranceCardImageDialogDialog({BuildContext context, String name, String fileNo}) { + showDialog( + context: context, + builder: (cxt) => AttachInsuranceCardImageDialog( + fileNo: fileNo, + name: name, + image: (file, image) async { + images.clear(); + images.add(image); + setState(() {}); + }, + isBirthNotification: true, + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.name, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } +} diff --git a/lib/pages/InPatientServices/components/inpatient_paid_advance_payment.dart b/lib/pages/InPatientServices/components/inpatient_paid_advance_payment.dart new file mode 100644 index 00000000..460c7309 --- /dev/null +++ b/lib/pages/InPatientServices/components/inpatient_paid_advance_payment.dart @@ -0,0 +1,103 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_inpatient_advance_history_response_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class InPatientPaidAdvancePayment extends StatefulWidget { + const InPatientPaidAdvancePayment({Key key}) : super(key: key); + + @override + State createState() => _InPatientPaidAdvancePaymentState(); +} + +class _InPatientPaidAdvancePaymentState extends State { + ProjectViewModel projectViewModel; + InPatientAdvanceHistoryResponseModel inPatientAdvanceHistoryResponseModel; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + getInPatientAdvancePaymentHistory(); + }); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return Padding( + padding: const EdgeInsets.all(16.0), + child: inPatientAdvanceHistoryResponseModel != null && inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo != null + ? ListView.separated( + itemCount: inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo.length, + itemBuilder: (BuildContext context, int index) { + return Container( + decoration: cardRadius(12), + padding: EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + MyRichText( + TranslationBase.of(context).admissionNo + ": ", inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo[index].admissionNo.toString(), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).admissionReqNo + ": ", inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo[index].admissionReqNo.toString(), + projectViewModel.isArabic), + MyRichText( + TranslationBase.of(context).date + ": ", + DateUtil.formatDateToDate(DateUtil.convertStringToDate(inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo[index].createdOn), false), + projectViewModel.isArabic), + MyRichText( + TranslationBase.of(context).amount_ + ": ", inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo[index].requestedAmount.toString(), projectViewModel.isArabic), + MyRichText(TranslationBase.of(context).status + ": ", getStatus(inPatientAdvanceHistoryResponseModel.responseInpatientAdvanceInfo[index]), projectViewModel.isArabic), + ], + ), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return SizedBox( + height: 12.0, + ); + }, + ) + : getNoDataWidget(context), + ); + } + + String getStatus(ResponseInpatientAdvanceInfo responseInpatientAdvanceInfo) { + switch (responseInpatientAdvanceInfo.status) { + case 1: + return "Hold"; + break; + case 2: + return "Active"; + break; + case 4: + return "Cancelled"; + break; + default: + return ""; + } + } + + void getInPatientAdvancePaymentHistory() { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .getInPatientAdvancePaymentHistory(projectViewModel.inPatientProjectID, projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionNo : 0, + projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo : projectViewModel.getAdmissionRequestInfoResponseModel.admissionRequestNo, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + inPatientAdvanceHistoryResponseModel = InPatientAdvanceHistoryResponseModel.fromJson(res["responseInpatient"]); + setState(() {}); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} diff --git a/lib/pages/InPatientServices/components/inpatient_pending_advance_payment.dart b/lib/pages/InPatientServices/components/inpatient_pending_advance_payment.dart new file mode 100644 index 00000000..abed2b96 --- /dev/null +++ b/lib/pages/InPatientServices/components/inpatient_pending_advance_payment.dart @@ -0,0 +1,285 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_inpatient_advance_requests_response_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_inappwebview/flutter_inappwebview.dart'; +import 'package:provider/provider.dart'; +import 'package:share_plus/share_plus.dart'; + +class InPatientPendingAdvancePayment extends StatefulWidget { + InPatientAdvanceResponseModel inPatientAdvanceResponseModel; + bool isHasData; + + InPatientPendingAdvancePayment({this.isHasData, this.inPatientAdvanceResponseModel}); + + @override + State createState() => _InPatientPendingAdvancePaymentState(); +} + +class _InPatientPendingAdvancePaymentState extends State { + ProjectViewModel projectViewModel; + InAppBrowser browser = new InAppBrowser(); + + var _InAppBrowserOptions = InAppBrowserClassOptions( + inAppWebViewGroupOptions: InAppWebViewGroupOptions( + crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, transparentBackground: false), + ios: IOSInAppWebViewOptions(applePayAPIEnabled: true, isFraudulentWebsiteWarningEnabled: false)), + crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), + android: AndroidInAppBrowserOptions(), + ios: + IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); + + @override + void initState() { + // browser = new InAppBrowser(onLoadStartCallback: onBrowserLoadStart); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + width: double.infinity, + child: Container( + decoration: cardRadius(12), + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: widget.isHasData && widget.inPatientAdvanceResponseModel.responseInpatientAdvanceInfo != null + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Payment request for: ", + // TranslationBase.of(context).covidBookAppo, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + letterSpacing: -0.64, + ), + ), + mHeight(6), + Row( + children: [ + Text( + TranslationBase.of(context).patientName + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).identificationNumber + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.patientIdentificationNo, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Text( + TranslationBase.of(context).mrn + ":", + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 10, + letterSpacing: -0.6, + color: CustomColors.grey, + ), + ), + mWidth(3), + Text( + projectViewModel.user.patientID.toString(), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ], + ) + : getNoDataWidget(context), + ), + ), + ), + mHeight(12), + // Expanded(child: Container()), + widget.isHasData + ? Container( + decoration: cardRadius(12.0), + margin: EdgeInsets.zero, + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + TranslationBase.of(context).patientShareTotalToDo, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).sar + " ${widget.inPatientAdvanceResponseModel.responseInpatientAdvanceInfo[0].requestedAmount}", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24, + letterSpacing: -0.64, + ), + ), + ], + ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).YouCanPayByTheFollowingOptions, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + SizedBox(height: 12), + SizedBox( + width: MediaQuery.of(context).size.width * 0.75, + child: getPaymentMethods(), + ), + SizedBox(height: 12), + DefaultButton( + TranslationBase.of(context).payNow.toUpperCase(), + () { + getInPatientPaymentLink(false); + }, + // : null, + color: CustomColors.green, + disabledColor: CustomColors.grey2, + ), + SizedBox(height: 12), + Text( + TranslationBase.of(context).copyLinkTxt, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + SizedBox(height: 12), + DefaultButton( + TranslationBase.of(context).copyLink.toUpperCase(), + () { + getInPatientPaymentLink(true); + }, + svgIcon: "assets/images/new/copy.svg", + color: CustomColors.accentColor, + disabledColor: CustomColors.grey2, + ), + ], + ), + ) + : Container(), + ], + ), + ); + } + + onBrowserLoadStart(String url) { + MyInAppBrowser.successURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = true; + return; + } + }); + + MyInAppBrowser.errorURLS.forEach((element) { + if (url.contains(element)) { + if (browser.isOpened()) browser.close(); + MyInAppBrowser.isPaymentDone = false; + return; + } + }); + } + + void getInPatientPaymentLink(bool isCopy) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + int orderID = num.parse(DateTime.now().microsecondsSinceEpoch.toString().substring(7, 15)); + int clinicID = projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.clinicID : 17; + service + .getInPatientPaymentLink( + projectViewModel.inPatientProjectID, + projectViewModel.getAdmissionInfoResponseModel.admissionNo, + orderID, + projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + projectViewModel.user.emailAddress, + widget.inPatientAdvanceResponseModel.responseInpatientAdvanceInfo[0].requestedAmount, + projectViewModel.user.patientIdentificationNo, + clinicID, + widget.inPatientAdvanceResponseModel.responseInpatientAdvanceInfo[0].paymentRequestID, + context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + String paymentLink = res["PaymentUrl"]; + print(paymentLink); + if (isCopy) { + Share.share(paymentLink); + } else { + this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(paymentLink)), options: _InAppBrowserOptions); + } + } else { + AppToast.showErrorToast(message: res["endUserMessage"]); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} diff --git a/lib/pages/InPatientServices/general_instructions.dart b/lib/pages/InPatientServices/general_instructions.dart new file mode 100644 index 00000000..6a923120 --- /dev/null +++ b/lib/pages/InPatientServices/general_instructions.dart @@ -0,0 +1,93 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_general_instructions_response_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +class GeneralInstructions extends StatelessWidget { + List getGeneralInstructionsList; + ProjectViewModel projectViewModel; + + GeneralInstructions({@required this.getGeneralInstructionsList}); + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).InPatientServicesHeader, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.all(21.0), + child: Text(TranslationBase.of(context).generalInstructions, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 21.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + )), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: Card( + elevation: 0.0, + margin: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: EdgeInsets.all(16.0), + child: Container( + child: ListView.separated( + itemCount: getGeneralInstructionsList.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: SvgPicture.asset("assets/images/new-design/ionic-ios-checkmark-circle.svg"), + ), + Container( + width: MediaQuery.of(context).size.width * 0.75, + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: Text(projectViewModel.isArabic ? getGeneralInstructionsList[index].textN : getGeneralInstructionsList[index].text, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + )), + ), + ], + )); + }, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.only(left: 14, right: 14), + child: mHeight(16.0), + ); + }, + )), + ), + ), + ), + ) + ], + )); + } +} diff --git a/lib/pages/InPatientServices/help_PRO.dart b/lib/pages/InPatientServices/help_PRO.dart new file mode 100644 index 00000000..385f0672 --- /dev/null +++ b/lib/pages/InPatientServices/help_PRO.dart @@ -0,0 +1,169 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class HelpPRO extends StatefulWidget { + const HelpPRO({Key key}) : super(key: key); + + @override + State createState() => _HelpPROState(); +} + +class _HelpPROState extends State { + TextEditingController assistText = new TextEditingController(); + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).patientRelationOffice, + body: SingleChildScrollView( + child: Container( + width: MediaQuery.of(context).size.width, + decoration: containerRadius(Colors.white, 12), + margin: EdgeInsets.all(21.0), + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).assistYou, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + ), + ), + mHeight(16), + inputWidget(TranslationBase.of(context).enterDetails, "", assistText), + mHeight(16), + DefaultButton( + TranslationBase.of(context).send, + () { + if (assistText.text.isNotEmpty) { + callReceivePrescriptionAPI(context); + } else { + Utils.showErrorToast(TranslationBase.of(context).emptyMessage); + } + }, + ), + ], + ), + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.name, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); + } + + void callReceivePrescriptionAPI(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .insertInPatientOrder(projectViewModel.getAdmissionInfoResponseModel, 1, (projectViewModel.user.firstName + " " + projectViewModel.user.lastName), + (projectViewModel.user.firstNameN + " " + projectViewModel.user.lastNameN), projectViewModel.user.mobileNumber, assistText.text, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).successSendReport); + Navigator.of(context).pop(); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } +} diff --git a/lib/pages/InPatientServices/inpatient_advance_payment.dart b/lib/pages/InPatientServices/inpatient_advance_payment.dart new file mode 100644 index 00000000..8761388a --- /dev/null +++ b/lib/pages/InPatientServices/inpatient_advance_payment.dart @@ -0,0 +1,77 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_inpatient_advance_requests_response_model.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/components/inpatient_paid_advance_payment.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/components/inpatient_pending_advance_payment.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class InPatientAdvancePayment extends StatefulWidget { + InPatientAdvanceResponseModel inPatientAdvanceResponseModel; + bool isHasData; + + InPatientAdvancePayment({this.isHasData, this.inPatientAdvanceResponseModel}); + + @override + State createState() => _InPatientAdvancePaymentState(); +} + +class _InPatientAdvancePaymentState extends State with SingleTickerProviderStateMixin { + TabController _tabController; + ProjectViewModel projectViewModel; + + @override + void initState() { + _tabController = TabController(length: 2, vsync: this); + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).advancePayment, + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + physics: const NeverScrollableScrollPhysics(), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).pending), Text(TranslationBase.of(context).history)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + InPatientPendingAdvancePayment(isHasData: widget.isHasData, inPatientAdvanceResponseModel: widget.inPatientAdvanceResponseModel), + InPatientPaidAdvancePayment(), + ], + ), + ) + ], + ), + ); + } +} diff --git a/lib/pages/InPatientServices/inpatient_home.dart b/lib/pages/InPatientServices/inpatient_home.dart new file mode 100644 index 00000000..bcc2010e --- /dev/null +++ b/lib/pages/InPatientServices/inpatient_home.dart @@ -0,0 +1,378 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_general_instructions_response_model.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/birth_notification.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/general_instructions.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/help_PRO.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/inpatient_advance_payment.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/meal_plan.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/medical_instructions.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/alert_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../../models/InPatientServices/get_inpatient_advance_requests_response_model.dart'; +import '../../models/InPatientServices/get_medical_instructions_response_model.dart'; + +class InPatientServicesHome extends StatefulWidget { + @override + State createState() => _InPatientServicesHomeState(); +} + +class _InPatientServicesHomeState extends State { + ProjectViewModel projectViewModel; + InPatientAdvanceResponseModel inPatientAdvanceResponseModel; + bool isReceivePrescriptionEnabled = false; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + checkDischargeMedications(context); + }); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + List inPatientServiceList = getInPatientServicesList(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).InPatientServicesHeader, + body: Container( + margin: EdgeInsets.all(20.0), + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(left: 12, right: 12), + child: GridView.builder( + shrinkWrap: true, + primary: false, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + padding: EdgeInsets.zero, + itemCount: inPatientServiceList.length, + itemBuilder: (BuildContext context, int index) { + return inPatientServiceList[index]; + }, + ), + ), + ], + ), + ), + ); + } + + List getInPatientServicesList(BuildContext context) { + List serviceList = List(); + + serviceList.add( + InkWell( + onTap: () { + if (projectViewModel.isPatientAdmitted ? true : checkAdmissionRequestDate()) openGeneralInstructions(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).generalInstructionsTitle, + imagePath: 'general_instructions.svg', + subTitle: TranslationBase.of(context).generalInstructionsSubTitle, + width: 50.0, + height: 40.0, + isInPatient: true, + isEnable: projectViewModel.isPatientAdmitted ? true : checkAdmissionRequestDate(), + ), + ), + ); + + serviceList.add( + InkWell( + onTap: () { + if (projectViewModel.isPatientAdmitted ? true : checkAdmissionRequestDate()) openMedicalInstructions(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicalInstructionsTitle, + imagePath: 'medical_instructions.svg', + subTitle: TranslationBase.of(context).medicalInstructionsSubTitle, + width: 50.0, + height: 40.0, + isInPatient: true, + isEnable: projectViewModel.isPatientAdmitted ? true : checkAdmissionRequestDate(), + ), + ), + ); + + serviceList.add( + InkWell( + onTap: () { + if (projectViewModel.isPatientAdmitted) { + Navigator.push(context, FadePage(page: MealPlanPage())); + } else { + AppToast.showErrorToast(message: "This service is only available to admitted patients"); + } + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).mealPlanTitle, + imagePath: 'meal_plan.svg', + subTitle: TranslationBase.of(context).mealPlanSubTitle, + width: 50.0, + height: 40.0, + isInPatient: true, + isEnable: projectViewModel.isPatientAdmitted), + ), + ); + + serviceList.add( + InkWell( + onTap: () { + openBirthNotificationsPage(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).birthNotificationTitle, + imagePath: 'birth_notification.svg', + subTitle: TranslationBase.of(context).birthNotificationSubTitle, + width: 50.0, + height: 40.0, + isInPatient: true, + ), + ), + ); + + // serviceList.add( + // InkWell( + // onTap: () { + // // Navigator.push(context, FadePage(page: AdvancePaymentPage())); + // }, + // child: MedicalProfileItem( + // title: TranslationBase.of(context).admissionNoticeTitle, + // imagePath: 'admission_notice.svg', + // subTitle: TranslationBase.of(context).admissionNoticeSubTitle, + // width: 50.0, + // height: 40.0, + // isInPatient: true, + // ), + // ), + // ); + + serviceList.add( + InkWell( + onTap: () { + getInPatientAdvancePaymentRequests(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).advancePayment, + imagePath: 'advance_payment.svg', + subTitle: TranslationBase.of(context).payment, + width: 50.0, + height: 40.0, + isInPatient: true, + ), + ), + ); + + serviceList.add( + InkWell( + onTap: () { + // Navigator.push(context, FadePage(page: AdvancePaymentPage())); + if (isReceivePrescriptionEnabled) receivePrescriptionAPI(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).receive, + imagePath: 'receive_prescription.svg', + subTitle: TranslationBase.of(context).prescriptions, + width: 50.0, + height: 40.0, + isInPatient: true, + isEnable: isReceivePrescriptionEnabled), + ), + ); + + serviceList.add( + InkWell( + onTap: () { + checkCurrentTime(context); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).help, + imagePath: 'help_pro.svg', + subTitle: TranslationBase.of(context).PRO, + width: 50.0, + height: 40.0, + isInPatient: true, + ), + ), + ); + + return serviceList; + } + + void receivePrescriptionAPI(BuildContext context) { + AlertDialogBox( + context: context, + confirmMessage: TranslationBase.of(context).successSendReport, + okText: TranslationBase.of(context).ok, + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + callReceivePrescriptionAPI(context); + }).showAlertDialog(context); + + // ConfirmDialog dialog = new ConfirmDialog( + // context: context, + // confirmMessage: TranslationBase.of(context).successSendReport, + // okText: TranslationBase.of(context).ok, + // cancelText: TranslationBase.of(context).cancel_nocaps, + // okFunction: () { + // Navigator.of(context).pop(); + // }, + // cancelFunction: () => {}); + // dialog.showAlertDialog(context); + } + + void checkDischargeMedications(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getDischargeMedicationOrder(projectViewModel.getAdmissionInfoResponseModel).then((res) { + print(res["PatientHasDischargeMedicineList"].length); + setState(() { + if (res["PatientHasDischargeMedicineList"].length != 0) { + isReceivePrescriptionEnabled = true; + } + }); + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void callReceivePrescriptionAPI(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .insertInPatientOrder(projectViewModel.getAdmissionInfoResponseModel, 2, (projectViewModel.user.firstName + " " + projectViewModel.user.lastName), + (projectViewModel.user.firstNameN + " " + projectViewModel.user.lastNameN), projectViewModel.user.mobileNumber, "I need my medicines", context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void openBirthNotificationsPage(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getBirthNotification(projectViewModel.user.patientID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + print(res['birthNotification']); + Navigator.push(context, FadePage(page: BirthNotification())); + } else { + AppToast.showErrorToast(message: res["endUserMessage"]); + } + }).catchError((err) { + print(err); + }); + } + + void openGeneralInstructions(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getGeneralInstructions(projectViewModel.inPatientProjectID, context).then((res) { + if (res['generalInstructions'].length != 0) { + List getGeneralInstructionsList = []; + res['generalInstructions'].forEach((v) { + getGeneralInstructionsList.add(new GetGeneralInstructions.fromJson(v)); + }); + GifLoaderDialogUtils.hideDialog(context); + print(res['generalInstructions']); + Navigator.push(context, FadePage(page: GeneralInstructions(getGeneralInstructionsList: getGeneralInstructionsList))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).noGeneralInstructions); + } + }).catchError((err) { + print(err); + }); + } + + void openMedicalInstructions(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getMedicalInstructions(projectViewModel.inPatientProjectID, context).then((res) { + if (res['MedicalInstruction'] != null && res['MedicalInstruction'].length != 0) { + List getMedicalInstructionsList = []; + res['MedicalInstruction'].forEach((v) { + getMedicalInstructionsList.add(new GetMedicalInstructions.fromJson(v)); + }); + GifLoaderDialogUtils.hideDialog(context); + print(res['MedicalInstruction']); + Navigator.push(context, FadePage(page: MedicalInstructionsPage(getMedicalInstructionsList: getMedicalInstructionsList))); + } else { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: TranslationBase.of(context).noMedicalInstructions); + } + }).catchError((err) { + print(err); + }); + } + + void getInPatientAdvancePaymentRequests(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .getInPatientAdvancePaymentRequests(projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.projectID : projectViewModel.getAdmissionRequestInfoResponseModel.projectId, projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionNo : 0, + projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo : projectViewModel.getAdmissionRequestInfoResponseModel.admissionRequestNo, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + if (res['responseInpatient'] != null) { + inPatientAdvanceResponseModel = InPatientAdvanceResponseModel.fromJson(res["responseInpatient"]); + Navigator.push(context, FadePage(page: InPatientAdvancePayment(isHasData: inPatientAdvanceResponseModel.responseInpatientAdvanceInfo != null, inPatientAdvanceResponseModel: inPatientAdvanceResponseModel))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).noData); + } + } else { + Navigator.push(context, FadePage(page: InPatientAdvancePayment(isHasData: inPatientAdvanceResponseModel.responseInpatientAdvanceInfo != null, inPatientAdvanceResponseModel: inPatientAdvanceResponseModel))); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void checkCurrentTime(BuildContext context) { + print(DateTime.now().hour); + print(DateTime.now().minute); + if (DateTime.now().hour >= 7 && DateTime.now().hour <= 22) { + Navigator.push(context, FadePage(page: HelpPRO())); + } else { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).proErrorMessage, + okText: TranslationBase.of(context).callNow, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {ConfirmDialog.closeAlertDialog(context), launchUrl(Uri.parse("tel://" + "011 525 9553"))}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + } + + bool checkAdmissionRequestDate() { + print(DateUtil.convertStringToDate(projectViewModel.getAdmissionRequestInfoResponseModel.expectedAdmissionDate)); + print(DateUtil.convertStringToDate(projectViewModel.getAdmissionRequestInfoResponseModel.expectedAdmissionDate).difference(DateTime.now()).inHours); + if (DateUtil.convertStringToDate(projectViewModel.getAdmissionRequestInfoResponseModel.expectedAdmissionDate).difference(DateTime.now()).inHours > 24) { + return false; + } + return true; + } +} diff --git a/lib/pages/InPatientServices/meal_plan.dart b/lib/pages/InPatientServices/meal_plan.dart new file mode 100644 index 00000000..053ea6e3 --- /dev/null +++ b/lib/pages/InPatientServices/meal_plan.dart @@ -0,0 +1,641 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admitted_patient_response_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_meal_items_schedule_response_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_meals_schedule_response_model.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class MealPlanPage extends StatefulWidget { + const MealPlanPage({Key key}) : super(key: key); + + @override + State createState() => _MealPlanPageState(); +} + +class _MealPlanPageState extends State { + ProjectViewModel projectViewModel; + GetAdmittedPatientsResponseModel getAdmittedPatientsResponseModel; + List getMealsScheduleResponseModelList = []; + + List getMealItemsScheduleResponseModelBreakfast = []; + List getMealItemsScheduleResponseModelLunch = []; + List getMealItemsScheduleResponseModelDinner = []; + + List _getMealItemsScheduleResponseModelBreakfast = []; + List _getMealItemsScheduleResponseModelLunch = []; + List _getMealItemsScheduleResponseModelDinner = []; + + int currentDay = 0; + int currentWeek = 0; + + int selectedMealScheduleID = 0; + + final ValueNotifier isFasting = ValueNotifier(false); + bool isFastingVal = false; + + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + getAdmittedPatientDetails(); + }); + } + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).mealPlanTitle, + body: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(21.0), + child: getMealsScheduleResponseModelList.length != 0 + ? Column( + children: [ + Container( + decoration: containerRadius((getMealsScheduleResponseModelList[0].isShow) ? Colors.white : Colors.grey[300], 12), + child: AppExpandableNotifier( + title: "Breakfast TAT: " + DateUtil.convertTime(getMealsScheduleResponseModelList[0].tATTime), + isTitleSingleLine: false, + widgetColor: Colors.transparent, + isExpand: getMealsScheduleResponseModelList[0].isShow, + isDisabled: !getMealsScheduleResponseModelList[0].isShow, + bodyWidget: Column( + children: [ + getDivider(), + ListView.separated( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(_getMealItemsScheduleResponseModelBreakfast[index].filterName, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + SizedBox( + height: 12.0, + ), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index2) { + return Container( + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ValueListenableBuilder( + valueListenable: _getMealItemsScheduleResponseModelBreakfast[index].selectedItemID, + builder: (context, val, child) { + return Radio( + value: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].itemID, + groupValue: _getMealItemsScheduleResponseModelBreakfast[index].selectedItemID.value, + activeColor: Colors.red[800], + onChanged: (value) { + _getMealItemsScheduleResponseModelBreakfast[index].selectedItemID.value = value; + }, + ); + }), + LargeAvatar( + name: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].description, + url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg", + width: 60, + height: 60, + radius: 5, + disableProfileView: true, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText( + "", + projectViewModel.isArabic + ? _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].descriptionN + : _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList[index2].description, + projectViewModel.isArabic), + ], + ), + ), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.all(16.0), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelBreakfast[index].getMealItemsScheduleResponseModelList.length), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelBreakfast.length), + ], + ), + ), + ), + mHeight(21), + Container( + decoration: containerRadius(getMealsScheduleResponseModelList[1].isShow ? Colors.white : Colors.grey[300], 12), + child: AppExpandableNotifier( + title: "Lunch TAT: " + DateUtil.convertTime(getMealsScheduleResponseModelList[1].tATTime), + isTitleSingleLine: false, + widgetColor: Colors.transparent, + isExpand: getMealsScheduleResponseModelList[1].isShow, + isDisabled: !getMealsScheduleResponseModelList[1].isShow, + bodyWidget: Column( + children: [ + getDivider(), + ListView.separated( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(_getMealItemsScheduleResponseModelLunch[index].filterName, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + SizedBox( + height: 12.0, + ), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index2) { + return Container( + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ValueListenableBuilder( + valueListenable: _getMealItemsScheduleResponseModelLunch[index].selectedItemID, + builder: (context, val, child) { + return Radio( + value: _getMealItemsScheduleResponseModelLunch[index].getMealItemsScheduleResponseModelList[index2].itemID, + groupValue: _getMealItemsScheduleResponseModelLunch[index].selectedItemID.value, + activeColor: Colors.red[800], + onChanged: (value) { + _getMealItemsScheduleResponseModelLunch[index].selectedItemID.value = value; + }, + ); + }), + LargeAvatar( + name: _getMealItemsScheduleResponseModelLunch[index].getMealItemsScheduleResponseModelList[index2].description, + url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg", + width: 60, + height: 60, + radius: 5, + disableProfileView: true, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText( + "", + projectViewModel.isArabic + ? _getMealItemsScheduleResponseModelLunch[index].getMealItemsScheduleResponseModelList[index2].descriptionN + : _getMealItemsScheduleResponseModelLunch[index].getMealItemsScheduleResponseModelList[index2].description, + projectViewModel.isArabic), + ], + ), + ), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.all(16.0), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelLunch[index].getMealItemsScheduleResponseModelList.length), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelLunch.length), + ], + ), + ), + ), + mHeight(21), + Container( + decoration: containerRadius(getMealsScheduleResponseModelList[2].isShow ? Colors.white : Colors.grey[300], 12), + child: AppExpandableNotifier( + title: "Dinner TAT: " + DateUtil.convertTime(getMealsScheduleResponseModelList[2].tATTime), + isTitleSingleLine: false, + widgetColor: Colors.transparent, + isExpand: getMealsScheduleResponseModelList[2].isShow, + isDisabled: !getMealsScheduleResponseModelList[2].isShow, + bodyWidget: Column( + children: [ + getDivider(), + ListView.separated( + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(_getMealItemsScheduleResponseModelDinner[index].filterName, + style: TextStyle(fontWeight: FontWeight.w600, fontSize: 18.0, letterSpacing: -0.64, color: CustomColors.darkGrey)), + SizedBox( + height: 12.0, + ), + ListView.separated( + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, index2) { + return Container( + child: Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ValueListenableBuilder( + valueListenable: _getMealItemsScheduleResponseModelDinner[index].selectedItemID, + builder: (context, val, child) { + return Radio( + value: _getMealItemsScheduleResponseModelDinner[index].getMealItemsScheduleResponseModelList[index2].itemID, + groupValue: _getMealItemsScheduleResponseModelDinner[index].selectedItemID.value, + activeColor: Colors.red[800], + onChanged: (value) { + _getMealItemsScheduleResponseModelDinner[index].selectedItemID.value = value; + }, + ); + }), + LargeAvatar( + name: _getMealItemsScheduleResponseModelDinner[index].getMealItemsScheduleResponseModelList[index2].description, + url: "https://www.pumpkinnspice.com/wp-content/uploads/2016/03/easy-breakfast-quesadillas-11-683x1024.jpg", + width: 60, + height: 60, + radius: 5, + disableProfileView: true, + ), + SizedBox(width: 11), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + MyRichText( + "", + projectViewModel.isArabic + ? _getMealItemsScheduleResponseModelDinner[index].getMealItemsScheduleResponseModelList[index2].descriptionN + : _getMealItemsScheduleResponseModelDinner[index].getMealItemsScheduleResponseModelList[index2].description, + projectViewModel.isArabic), + ], + ), + ), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.all(16.0), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelDinner[index].getMealItemsScheduleResponseModelList.length), + ], + ), + ); + }, + separatorBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Divider( + height: 1.5, + thickness: 1.0, + color: Colors.grey.shade200, + ), + ); + }, + itemCount: _getMealItemsScheduleResponseModelDinner.length), + ], + ), + ), + ), + ], + ) + : Container(), + ), + ), + bottomSheet: Container( + color: Colors.white, + width: double.infinity, + padding: EdgeInsets.all(20), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + ValueListenableBuilder( + valueListenable: isFasting, + builder: (context, val, child) { + return Checkbox( + onChanged: (bool value) { + isFasting.value = value; + isFastingVal = value; + }, + value: isFastingVal, + activeColor: Color(0xFFc5272d), + ); + }), + Text( + TranslationBase.of(context).isFasting, + style: TextStyle( + fontSize: 14, + letterSpacing: -0.48, + ), + ), + ], + ), + mHeight(12), + DefaultButton( + TranslationBase.of(context).placeOrder, + () { + placeOrder(); + }, + color: Color(0xff359846), + disabledColor: Colors.grey, + ), + ], + ), + ), + ); + } + + void placeOrder() { + List selectedItemIDs = []; + + if (_getMealItemsScheduleResponseModelBreakfast.isNotEmpty) { + _getMealItemsScheduleResponseModelBreakfast.forEach((element) { + selectedItemIDs.add(element.selectedItemID.value.toString()); + }); + } + + if (_getMealItemsScheduleResponseModelLunch.isNotEmpty) { + _getMealItemsScheduleResponseModelLunch.forEach((element) { + selectedItemIDs.add(element.selectedItemID.value.toString()); + }); + } + + if (_getMealItemsScheduleResponseModelDinner.isNotEmpty) { + _getMealItemsScheduleResponseModelDinner.forEach((element) { + selectedItemIDs.add(element.selectedItemID.value.toString()); + }); + } + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .placeMealPlanOrder(getAdmittedPatientsResponseModel.projectID, selectedMealScheduleID, selectedItemIDs.join(","), projectViewModel.user.patientID, + getAdmittedPatientsResponseModel.admissionNo, getAdmittedPatientsResponseModel.isHasCompanion, isFastingVal, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: "Your meal order has been received successfully"); + Navigator.pop(context); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + Widget getDivider() { + return Padding( + padding: EdgeInsets.only(left: 15, right: 15), + child: Divider( + height: 1.5, + thickness: 2.0, + color: Colors.black, + ), + ); + } + + void getAdmittedPatientDetails() { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getAdmittedPatientDetails(projectViewModel.user.patientID, projectViewModel.inPatientProjectID, projectViewModel.getAdmissionInfoResponseModel.admissionNo, 0, 0, 0, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["List_MOP_AdmittedPatients"] != null && res["List_MOP_AdmittedPatients"].length != 0) { + print(res["List_MOP_AdmittedPatients"]); + getAdmittedPatientsResponseModel = new GetAdmittedPatientsResponseModel.fromJson(res["List_MOP_AdmittedPatients"][0]); + print(getAdmittedPatientsResponseModel.dietType); + getCurrentWeekIDAndDay(getAdmittedPatientsResponseModel.dietType); + } else { + AppToast.showErrorToast(message: "No data found for admitted patient"); + getCurrentWeekIDAndDay(1); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void getCurrentWeekIDAndDay(int dietType) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getCurrentWeekIDAndDay(context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + currentDay = res["CurrentDay"]; + currentWeek = res["CurrentWeek"]; + getMealsOfScheduleID(dietType); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void getMealsOfScheduleID(int dietType) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getMealsOfScheduleID(projectViewModel.inPatientProjectID, projectViewModel.getAdmissionInfoResponseModel.admissionNo, dietType, currentWeek, currentDay, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["List_MOP_MealsOfScheduleID_Mobile"] != null && res["List_MOP_MealsOfScheduleID_Mobile"].length != 0) { + res['List_MOP_MealsOfScheduleID_Mobile'].forEach((scheduleItem) { + getMealsScheduleResponseModelList.add(GetMealsScheduleResponseModel.fromJson(scheduleItem)); + }); + if (getMealsScheduleResponseModelList[0].isShow) { + selectedMealScheduleID = getMealsScheduleResponseModelList[0].scheduleID; + getDefaultItemsOfScheduleID(getMealsScheduleResponseModelList[0].scheduleID, 1); + } + if (getMealsScheduleResponseModelList[1].isShow) { + selectedMealScheduleID = getMealsScheduleResponseModelList[1].scheduleID; + getDefaultItemsOfScheduleID(getMealsScheduleResponseModelList[1].scheduleID, 2); + } + if (getMealsScheduleResponseModelList[2].isShow) { + selectedMealScheduleID = getMealsScheduleResponseModelList[2].scheduleID; + getDefaultItemsOfScheduleID(getMealsScheduleResponseModelList[2].scheduleID, 3); + } + } else { + AppToast.showErrorToast(message: "No meal schedule found for admitted patient"); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void getDefaultItemsOfScheduleID(int scheduleID, int mealType) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service.getDefaultItemsOfScheduleID(projectViewModel.inPatientProjectID, scheduleID, context).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["List_MOP_DefaultItemsOfMealModel"] != null && res["List_MOP_DefaultItemsOfMealModel"].length != 0) { + if (mealType == 1) { + res['List_MOP_DefaultItemsOfMealModel'].forEach((scheduleItem) { + getMealItemsScheduleResponseModelBreakfast.add(GetMealItemsScheduleResponseModel.fromJson(scheduleItem)); + }); + sortMealsByCategoryBreakfast(); + } + if (mealType == 2) { + res['List_MOP_DefaultItemsOfMealModel'].forEach((scheduleItem) { + getMealItemsScheduleResponseModelLunch.add(GetMealItemsScheduleResponseModel.fromJson(scheduleItem)); + }); + sortMealsByCategoryLunch(); + } + if (mealType == 3) { + res['List_MOP_DefaultItemsOfMealModel'].forEach((scheduleItem) { + getMealItemsScheduleResponseModelDinner.add(GetMealItemsScheduleResponseModel.fromJson(scheduleItem)); + }); + sortMealsByCategoryDinner(); + } + } else { + AppToast.showErrorToast(message: "No meal items found for admitted patient"); + } + setState(() {}); + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void sortMealsByCategoryBreakfast() { + getMealItemsScheduleResponseModelBreakfast.forEach((element) { + List breakfastMealItems = _getMealItemsScheduleResponseModelBreakfast + .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription)) + .toList(); + if (breakfastMealItems.length != 0) { + _getMealItemsScheduleResponseModelBreakfast[_getMealItemsScheduleResponseModelBreakfast.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); + } else { + _getMealItemsScheduleResponseModelBreakfast + .add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element)); + } + }); + + _getMealItemsScheduleResponseModelBreakfast.forEach((element) { + element.getMealItemsScheduleResponseModelList.forEach((elementInner) { + if (elementInner.isDefault) { + element.selectedItemID.value = elementInner.itemID; + } + }); + }); + } + + void sortMealsByCategoryLunch() { + getMealItemsScheduleResponseModelLunch.forEach((element) { + List breakfastMealItems = _getMealItemsScheduleResponseModelLunch + .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription)) + .toList(); + if (breakfastMealItems.length != 0) { + _getMealItemsScheduleResponseModelLunch[_getMealItemsScheduleResponseModelLunch.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); + } else { + _getMealItemsScheduleResponseModelLunch + .add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element)); + } + }); + + _getMealItemsScheduleResponseModelLunch.forEach((element) { + element.getMealItemsScheduleResponseModelList.forEach((elementInner) { + if (elementInner.isDefault) { + element.selectedItemID.value = elementInner.itemID; + } + }); + }); + } + + void sortMealsByCategoryDinner() { + getMealItemsScheduleResponseModelDinner.forEach((element) { + List breakfastMealItems = _getMealItemsScheduleResponseModelDinner + .where((elementClinic) => elementClinic.filterName == (projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription)) + .toList(); + if (breakfastMealItems.length != 0) { + _getMealItemsScheduleResponseModelDinner[_getMealItemsScheduleResponseModelDinner.indexOf(breakfastMealItems[0])].getMealItemsScheduleResponseModelList.add(element); + } else { + _getMealItemsScheduleResponseModelDinner + .add(GetMealItemsScheduleResponseModelList(filterName: projectViewModel.isArabic ? element.categoryDescriptionN : element.categoryDescription, getMealItemsScheduleResponseModel: element)); + } + }); + _getMealItemsScheduleResponseModelDinner.forEach((element) { + element.getMealItemsScheduleResponseModelList.forEach((elementInner) { + if (elementInner.isDefault) { + element.selectedItemID.value = elementInner.itemID; + } + }); + }); + } +} diff --git a/lib/pages/InPatientServices/medical_instructions.dart b/lib/pages/InPatientServices/medical_instructions.dart new file mode 100644 index 00000000..099c5558 --- /dev/null +++ b/lib/pages/InPatientServices/medical_instructions.dart @@ -0,0 +1,100 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; + +import '../../models/InPatientServices/get_medical_instructions_response_model.dart'; + +class MedicalInstructionsPage extends StatefulWidget { + List getMedicalInstructionsList; + + MedicalInstructionsPage({@required this.getMedicalInstructionsList}); + + @override + State createState() => _MedicalInstructionsPageState(); +} + +class _MedicalInstructionsPageState extends State { + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AppScaffold( + isShowAppBar: true, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).InPatientServicesHeader, + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: const EdgeInsets.all(21.0), + child: Text(TranslationBase.of(context).medicalInstructions, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 21.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + )), + ), + Expanded( + child: Container( + width: MediaQuery.of(context).size.width, + child: Card( + elevation: 0.0, + margin: EdgeInsets.only(left: 16.0, right: 16.0, bottom: 16.0), + color: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + side: BorderSide(color: Colors.transparent, width: 0.0), + ), + child: Padding( + padding: EdgeInsets.all(16.0), + child: Container( + child: ListView.separated( + itemCount: widget.getMedicalInstructionsList[0].medicaLInstructionsField.length, + itemBuilder: (BuildContext context, int index) { + return Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: SvgPicture.asset("assets/images/new-design/ionic-ios-checkmark-circle.svg"), + ), + Container( + width: MediaQuery.of(context).size.width * 0.75, + margin: EdgeInsets.only(left: 5.0, right: 5.0), + child: Text(widget.getMedicalInstructionsList[0].medicaLInstructionsField[index].descriptionField, + overflow: TextOverflow.clip, + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.64, + )), + ), + ], + )); + }, + separatorBuilder: (BuildContext context, int index) { + return Padding( + padding: const EdgeInsets.only(left: 14, right: 14), + child: mHeight(16.0), + ); + }, + )), + ), + ), + ), + ) + ], + )); + } +} diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index 144d732c..89edb85f 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -379,7 +379,9 @@ class _MyAppointmentsState extends State with SingleTickerProvid date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate!), isSortByClinic: _isSortByClinic, rating: _appointmentResult.actualDoctorRate! + 0.0, - appointmentTime: _appointmentResult.isLiveCareAppointment! ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate!).toString().split(" ")[1].substring(0, 5) : _appointmentResult.startTime!.substring(0, 5), + appointmentTime: _appointmentResult.isLiveCareAppointment + ! ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate!).toString().split(" ")[1].substring(0, 5) + : _appointmentResult.startTime!.substring(0, 5), // appointmentTime: _appointmentResult.startTime.substring(0, 5), remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED) ? _appointmentResult.remaniningHoursTocanPay diff --git a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart index d54b2ebd..2083ce39 100644 --- a/lib/pages/insurance/AttachInsuranceCardImageDialog.dart +++ b/lib/pages/insurance/AttachInsuranceCardImageDialog.dart @@ -16,8 +16,9 @@ class AttachInsuranceCardImageDialog extends StatefulWidget { final String identificationNo; final String mobileNo; final Function(File file, String image) image; + final bool isBirthNotification; - const AttachInsuranceCardImageDialog({Key? key, required this.name, required this.fileNo, required this.identificationNo, required this.mobileNo, required this.image}) : super(key: key); + const AttachInsuranceCardImageDialog({Key? key, required this.name, required this.fileNo, required this.identificationNo, required this.mobileNo, required this.image, this.isBirthNotification = false}) : super(key: key); @override _AttachInsuranceCardImageDialogState createState() => _AttachInsuranceCardImageDialogState(); @@ -40,7 +41,7 @@ class _AttachInsuranceCardImageDialogState extends State { List appoList = []; late ApplePayResponse applePayResponse; + // bool isPatientAdmitted = true; + @override void initState() { // TODO: implement initState super.initState(); - - // getPatientAppointmentHistory1(); - // getFamilyFiles(); } initialiseHmgServices(bool isLogin) { @@ -62,10 +61,29 @@ class _HomePageFragment2State extends State { hmgServices.add(HmgServices(8, TranslationBase.of(context).connectTitle, TranslationBase.of(context).connectSubtitle, "assets/images/new/reach_us.svg", isLogin)); } + initialiseInPatientHmgServices(bool isLogin) { + hmgServices.clear(); + // hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin)); + // hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/CoronaIcon.svg", isLogin)); + // hmgServices.add(new HmgServices(2, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", isLogin)); + hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(2, TranslationBase.of(context).emergencyTitle, TranslationBase.of(context).emergencySubtitle, "assets/images/new/emergency.svg", isLogin)); + hmgServices.add(new HmgServices(6, TranslationBase.of(context).ereferralTitle, TranslationBase.of(context).ereferralSubtitle, "assets/images/new/E_Referral.svg", isLogin)); + hmgServices.add(new HmgServices(7, "H\u2082O", TranslationBase.of(context).dailyWater, "assets/images/new/h2o.svg", isLogin)); + hmgServices.add(new HmgServices(8, TranslationBase.of(context).connectTitle, TranslationBase.of(context).connectSubtitle, "assets/images/new/reach_us.svg", isLogin)); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); - initialiseHmgServices(false); + + if (projectViewModel.isPatientAdmitted || projectViewModel.patientHasAdmissionRequest) { + initialiseInPatientHmgServices(false); + } else { + initialiseHmgServices(false); + } + var appoCountProvider = Provider.of(context); var userProvider = Provider.of(context); List myMedicalList = Utils.myMedicalListHomePage(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin); @@ -261,23 +279,72 @@ class _HomePageFragment2State extends State { ], ), ), - Padding( - padding: const EdgeInsets.only( - left: 20, - right: 20, - top: 0, - ), - child: GridView.builder( - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: hmgServices.length, - padding: EdgeInsets.zero, - itemBuilder: (BuildContext context, int index) { - return ServicesView(hmgServices[index], index, true); - }, - ), - ), + projectViewModel.isPatientAdmitted || projectViewModel.patientHasAdmissionRequest + ? Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 12.0), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Expanded( + flex: 9, + child: Container( + margin: projectViewModel.isArabic ? EdgeInsets.only(left: 12.0) : EdgeInsets.only(right: 12.0), + child: AspectRatio( + aspectRatio: 2.15, + child: ServicesView( + new HmgServices(23, TranslationBase.of(context).InPatient, TranslationBase.of(context).inPatientServices, "assets/images/new/InPatient.svg", false), + 23, + true)), + ), + ), + Expanded( + flex: 4, + child: AspectRatio( + aspectRatio: 1.0, + child: ServicesView( + new HmgServices(5, TranslationBase.of(context).online, TranslationBase.of(context).payment, "assets/images/new/paymentMethods.png", false), 2, true)), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 0, + ), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServicesView(hmgServices[index], index, true); + }, + ), + ), + ], + ) + : Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 0, + ), + child: GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), + physics: NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: hmgServices.length, + padding: EdgeInsets.zero, + itemBuilder: (BuildContext context, int index) { + return ServicesView(hmgServices[index], index, true); + }, + ), + ), ], ), mHeight(140), @@ -545,6 +612,12 @@ class _HomePageFragment2State extends State { ); } + Widget getInpatientButton() { + return Container( + height: 50.0, + ); + } + Widget showFloating(String icon) { return Container( width: MediaQuery.of(context).size.width * 0.06, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 8af30b63..93ba665d 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -300,6 +300,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { } } }); + + // HMG_Geofencing(context).loadZones().then((instance) => instance.init()); } void setUserValues(value) async { @@ -317,25 +319,26 @@ class _LandingPageState extends State with WidgetsBindingObserver { } } - registerGeofences() async { - await locator().getAllGeoZones(GeoZonesRequestModel()); - - void doIt() { - getUserInformation().then((value) { - if (value != null) projectViewModel.platformBridge().registerHmgGeofences(); - }); - } - - if (await Permission.location.isGranted) { - doIt(); - } else { - [Permission.location].request().then((value) async { - if (await Permission.location.isGranted) { - doIt(); - } - }); - } - } + // registerGeofences() async { + // await locator().getAllGeoZones(GeoZonesRequestModel()); + // + // // void doIt() { + // // // getUserInformation().then((value) { + // // // if (value != null) + // // projectViewModel.platformBridge().registerHmgGeofences(); + // // // }); + // // } + // // + // // if (await Permission.location.isGranted) { + // // doIt(); + // // } else { + // // [Permission.location].request().then((value) async { + // // if (await Permission.location.isGranted) { + // // doIt(); + // // } + // // }); + // // } + // } login() async { var data = await sharedPref.getObject(IMEI_USER_DATA); @@ -644,6 +647,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { String voipToken = await sharedPref.getString(APNS_TOKEN); getOneSignalVOIPToken(voipToken); } + // registerGeofences(); } getOneSignalVOIPToken(String voipToken) { diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index bafec12e..5635a4a6 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -22,6 +22,7 @@ import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/inpatient_home.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; @@ -191,6 +192,9 @@ class ServicesView extends StatelessWidget { } else if (hmgServices.action == 8) { Navigator.push(context, FadePage(page: ContactUsPage())); locator().hmgServices.logServiceName('find us reach us'); + } else if (hmgServices.action == 23) { + Navigator.push(context, FadePage(page: InPatientServicesHome())); + locator().hmgServices.logServiceName('find us reach us'); } } diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index e05ffe4e..3384af90 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -14,6 +14,8 @@ import 'package:diplomaticquarterapp/models/Authentication/check_activation_code import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/models/Authentication/send_activation_request.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_request_info_response_model.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/register_new.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; @@ -649,8 +651,8 @@ class _ConfirmLogin extends State { loginTokenID = result.logInTokenID, sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), sharedPref.setString(TOKEN, result.authenticationTokenID), - checkIfUserAgreedBefore(result), projectViewModel.analytics.loginRegistration.login_successful(), + checkIfUserAgreedBefore(result), } } else @@ -685,6 +687,38 @@ class _ConfirmLogin extends State { } } + checkIfIsInPatient() { + bool isAdmitted = false; + bool hasAdmissionRequest = false; + GetAdmissionInfoResponseModel getAdmissionInfoResponseModel; + GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel; + ClinicListService service = new ClinicListService(); + service.checkIfInPatientAPI(context).then((res) { + if (res['MessageStatus'] == 1) { + isAdmitted = res['isAdmitted']; + hasAdmissionRequest = res['hasAdmissionRequests']; + print("IS ADMITTED: $isAdmitted"); + print("Has Admission Request: $hasAdmissionRequest"); + if (isAdmitted) { + if (res['PatientAdmittedInformation'].length != 0) { + getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]); + projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']); + projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel); + projectViewModel.setIsPatientAdmitted(true); + } + } + if (hasAdmissionRequest) { + if (res['MedicalInstruction'].length != 0) { + getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]); + projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']); + projectViewModel.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel); + projectViewModel.setPatientHasAdmissionRequest(true); + } + } + } else {} + }); + } + insertIMEI() { authService.insertDeviceImei(selectedOption).then((value) => {}).catchError((err) { print(err); @@ -716,6 +750,7 @@ class _ConfirmLogin extends State { .getIsLastAppointmentRatedList() .then((value) => { getToDoCount(), + checkIfIsInPatient(), GifLoaderDialogUtils.hideDialog(AppGlobal.context), if (appointmentRateViewModel.isHaveAppointmentNotRate) { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 21812f33..32f5bf0c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,5 +1,7 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; +import 'package:diplomaticquarterapp/core/service/geofencing/GeofencingServices.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -7,6 +9,8 @@ import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_request_info_response_model.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/confirm-login.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; @@ -17,6 +21,7 @@ import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; @@ -339,7 +344,7 @@ class _Login extends State { } this.authService.checkActivationCode(request, code).then((result) async { sharedPref.remove(FAMILY_FILE); - registerGeoZones(); + // registerGeoZones(); projectViewModel.setPrivilege(privilegeList: result); result = CheckActivationCode.fromJson(result); result.list.isFamily = false; @@ -358,6 +363,7 @@ class _Login extends State { appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { + checkIfIsInPatient(), getToDoCount(), GifLoaderDialogUtils.hideDialog(context), if (appointmentRateViewModel.isHaveAppointmentNotRate) @@ -399,7 +405,40 @@ class _Login extends State { }); } - void registerGeoZones() { + checkIfIsInPatient() { + bool isAdmitted = false; + bool hasAdmissionRequest = false; + GetAdmissionInfoResponseModel getAdmissionInfoResponseModel; + GetAdmissionRequestInfoResponseModel getAdmissionRequestInfoResponseModel; + ClinicListService service = new ClinicListService(); + service.checkIfInPatientAPI(context).then((res) { + if (res['MessageStatus'] == 1) { + isAdmitted = res['isAdmitted']; + hasAdmissionRequest = res['hasAdmissionRequests']; + print("IS ADMITTED: $isAdmitted"); + print("Has Admission Request: $hasAdmissionRequest"); + if (isAdmitted) { + if (res['PatientAdmittedInformation'].length != 0) { + getAdmissionInfoResponseModel = GetAdmissionInfoResponseModel.fromJson(res['PatientAdmittedInformation'][0]); + projectViewModel.setInPatientProjectID(res['PatientAdmittedInformation'][0]['ProjectID']); + projectViewModel.setInPatientAdmissionInfo(getAdmissionInfoResponseModel); + projectViewModel.setIsPatientAdmitted(true); + } + } + if (hasAdmissionRequest) { + if (res['MedicalInstruction'].length != 0) { + getAdmissionRequestInfoResponseModel = GetAdmissionRequestInfoResponseModel.fromJson(res['MedicalInstruction'][0]); + projectViewModel.setInPatientProjectID(res['MedicalInstruction'][0]['ProjectID']); + projectViewModel.setInPatientAdmissionRequest(getAdmissionRequestInfoResponseModel); + projectViewModel.setPatientHasAdmissionRequest(true); + } + } + } else {} + }); + } + + void registerGeoZones() async { + await locator().getAllGeoZones(GeoZonesRequestModel()); projectViewModel.platformBridge().registerHmgGeofences(); } diff --git a/lib/pages/paymentService/payment_service.dart b/lib/pages/paymentService/payment_service.dart index bef8c3c2..fead1795 100644 --- a/lib/pages/paymentService/payment_service.dart +++ b/lib/pages/paymentService/payment_service.dart @@ -2,10 +2,14 @@ import 'package:badges/badges.dart' as badge_import; import 'package:diplomaticquarterapp/Constants.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_inpatient_advance_requests_response_model.dart'; +import 'package:diplomaticquarterapp/pages/InPatientServices/inpatient_advance_payment.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/advance_payment_page.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/my_balance_page.dart'; +import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -18,6 +22,8 @@ class PaymentService extends StatelessWidget { ToDoCountProviderModel? model; ProjectViewModel? projectViewModel; + InPatientAdvanceResponseModel inPatientAdvanceResponseModel; + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); @@ -147,9 +153,55 @@ class PaymentService extends StatelessWidget { ), ), ); + + medical.add( + InkWell( + onTap: () { + if(projectViewModel.isPatientAdmitted) { + getInPatientAdvancePaymentRequests(context); + projectViewModel.analytics.advancePayments.payment_services(service_type: 'inpatient advance payment'); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).onlyAdmitted); + } + }, + child: MedicalProfileItem( + title: "InPatient", + imagePath: 'assets/images/inpatient_advance.png', + subTitle: "Advance Payment", + isPngImage: true, + width: 45.0, + height: 45.0, + ), + ), + ); + return medical; } + void getInPatientAdvancePaymentRequests(BuildContext context) { + ClinicListService service = new ClinicListService(); + GifLoaderDialogUtils.showMyDialog(context); + service + .getInPatientAdvancePaymentRequests(projectViewModel.inPatientProjectID, projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionNo : 0, + projectViewModel.isPatientAdmitted ? projectViewModel.getAdmissionInfoResponseModel.admissionRequestNo : projectViewModel.getAdmissionRequestInfoResponseModel.admissionRequestNo, context) + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["MessageStatus"] == 1) { + if (res['responseInpatient'] != null) { + inPatientAdvanceResponseModel = InPatientAdvanceResponseModel.fromJson(res["responseInpatient"]); + Navigator.push(context, FadePage(page: InPatientAdvancePayment(isHasData: inPatientAdvanceResponseModel.responseInpatientAdvanceInfo != null, inPatientAdvanceResponseModel: inPatientAdvanceResponseModel))); + } else { + AppToast.showErrorToast(message: TranslationBase.of(context).noData); + } + } else { + Navigator.push(context, FadePage(page: InPatientAdvancePayment(isHasData: inPatientAdvanceResponseModel.responseInpatientAdvanceInfo != null, inPatientAdvanceResponseModel: inPatientAdvanceResponseModel))); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + navigateToToDoPage(BuildContext context) { if (projectViewModel!.isLogin) { // if (model.count != 0) { diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index 2a80cd33..29e6ac2d 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -217,7 +217,8 @@ class AuthProvider with ChangeNotifier { request.channel = CHANNEL; request.iPAdress = IP_ADDRESS; request.generalid = GENERAL_ID; - request.languageID = (languageID == 'ar' ? 1 : 2); + // request.languageID = (languageID == 'ar' ? 1 : 2); + request.languageID = 2; request.deviceTypeID = Platform.isIOS ? 1 : 2; request.patientOutSA = request.zipCode == '966' ? 0 : 1; request.isDentalAllowedBackend = false; diff --git a/lib/services/clinic_services/get_clinic_service.dart b/lib/services/clinic_services/get_clinic_service.dart index 3b3c3395..a4390fe6 100644 --- a/lib/services/clinic_services/get_clinic_service.dart +++ b/lib/services/clinic_services/get_clinic_service.dart @@ -2,9 +2,11 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; +import 'package:diplomaticquarterapp/models/InPatientServices/get_admission_info_response_model.dart'; import 'package:diplomaticquarterapp/models/Request.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:flutter/material.dart'; class ClinicListService extends BaseService { @@ -48,6 +50,96 @@ class ClinicListService extends BaseService { return Future.value(localRes); } + Future checkIfInPatientAPI(context) async { + Map request; + request = { + "IsActiveAppointment": false, + }; + + dynamic localRes; + + await baseAppClient.post(CHECK_IF_PATIENT_ADMITTED, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future getGeneralInstructions(int projectID, context) async { + Map request; + request = {"ProjectID": projectID}; + + dynamic localRes; + + await baseAppClient.post(GET_GENERAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getInPatientAdvancePaymentRequests(int projectID, int admissionNo, int admissionReqNo, context) async { + Map request; + request = {"ProjectID": projectID, "AdmissionReqNo": admissionReqNo, "AdmissionNo": admissionNo}; + + dynamic localRes; + + await baseAppClient.post(GET_INPATIENT_ADVANCE_PAYMENT_REQUESTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getInPatientPaymentLink(int projectID, int admissionNo, int orderID, String name, String email, num amount, String nationalID, int clinicID, int paymentRequestID, context) async { + Map request; + // request = {"ProjectID": projectID, "AdmissionReqNo": admissionReqNo, "AdmissionNo": admissionNo}; + + request = { + "ProjectID": projectID, + "ClientOrderID": orderID, + "OrderDescription": "InPatient Advance Payment", + "CustomerName": name, + "CustomerEmail": email, + "Amount": amount, + "IsPaid": 0, + "AppointmentID": admissionNo.toString(), + "PaymentOption": "0", + "PaymentReferenceNumber": admissionNo, + "SourceType": "1", + "NationalID": nationalID, + "ClinicID": clinicID, + "PaymentRequestId": paymentRequestID, + "createdBy": 102 + }; + + dynamic localRes; + + await baseAppClient.post(GET_INPATIENT_ADVANCE_PAYMENT_LINK, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getMedicalInstructions(int projectID, context) async { + Map request; + request = {"ProjectID": projectID}; + + dynamic localRes; + + await baseAppClient.post(GET_MEDICAL_INSTRUCTIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + Future getProjectsList(context) async { Map request = {}; @@ -142,14 +234,228 @@ class ClinicListService extends BaseService { }, body: request); return Future.value(localRes); } + Future getCountries() async { - Map request ={}; - dynamic localRes; - await baseAppClient.post(GET_NATIONALITY, onSuccess: (response, statusCode) async { - localRes = response; - }, onFailure: (String error, int statusCode) { - throw error; - }, body: request); - return Future.value(localRes); -} + Map request = {}; + dynamic localRes; + await baseAppClient.post(GET_NATIONALITY, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request); + return Future.value(localRes); + } + + Future insertInPatientOrder( + GetAdmissionInfoResponseModel getAdmissionInfoResponseModel, int typeID, String patientName, String patientNameAR, String patientMobileNo, String comments, context) async { + Map request; + request = { + "ProjectID": getAdmissionInfoResponseModel.projectID, + "TypeID": typeID, + "RoomNo": getAdmissionInfoResponseModel.roomID, + "GenderId": 2, + "AdmissionNo": getAdmissionInfoResponseModel.admissionNo, + "prescriptionNo": 250420, + "patientName": patientName, + "patientNameN": patientNameAR, + "PatientMobileNumber": patientMobileNo, + "comments": comments + }; + + dynamic localRes; + + await baseAppClient.post(INSERT_INPATIENT_ORDER, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getBirthNotification(num motherMRN, context) async { + Map request; + request = { + "mothermrn": motherMRN, + }; + + dynamic localRes; + + await baseAppClient.post(GET_BIRTH_NOTIFICATION, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future submitBirthNotification(num motherMRN, int projectID, String fatherNameAR, String fatherNameEN, String babyNameAR, String babyNameEN, String contactNum, String idImage, context) async { + Map request; + request = { + "ProjectID": projectID, + "mothermrn": motherMRN, + "fatherName": fatherNameEN, + "fatherNameAr": fatherNameAR, + "babyName": babyNameEN, + "babyNameAr": babyNameAR, + "contactNumber": contactNum, + "iDImage": idImage, + }; + + dynamic localRes; + + await baseAppClient.post(SAVE_BIRTH_NOTIFICATION, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getAdmittedPatientDetails(int patientID, int projectID, int admissionNo, int buildingID, int floorID, int nursingStationID, context) async { + Map request; + request = {"ProjectID": projectID, "PatientID": patientID, "AdmissionNo": admissionNo, "BuildingID": buildingID, "FloorID": floorID, "NursingStationID": nursingStationID}; + + dynamic localRes; + + await baseAppClient.post(GET_ADMITTED_PATIENTS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getInPatientAdvancePaymentHistory(int projectID, int admissionNo, int admissionReqNo, context) async { + Map request; + request = {"ProjectID": projectID, "AdmissionNo": admissionNo, "AdmissionReqNo": admissionReqNo}; + + dynamic localRes; + + await baseAppClient.post(GET_INPATIENT_PAID_ADVANCE_PAYMENT, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getCurrentWeekIDAndDay(BuildContext context) async { + dynamic localRes; + await baseAppClient.get(GET_CURRENT_WEEKID_WEEKDAY, isExternal: false, isRCService: false, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }); + return localRes; + } + + Future getMealsOfScheduleID(int projectID, int admissionNo, int dietType, int weekID, int weekDay, context) async { + Map request; + request = { + "ProjectID": projectID, + "AdmissionNo": admissionNo, + "BuildingID": 0, + "FloorID": 0, + "NursingStationID": 0, + "DietType": dietType, + "WeekID": weekID, + "WeekDay": weekDay, + }; + + dynamic localRes; + + await baseAppClient.post(GET_MEALS_OF_SCHEDULE_ID, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getDefaultItemsOfScheduleID(int projectID, int scheduleID, context) async { + Map request; + request = { + "ProjectID": projectID, + "MealScheduleID": scheduleID, + }; + + dynamic localRes; + + await baseAppClient.post(GET_MEAL_ITEMS_OF_SCHEDULE_ID, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future placeMealPlanOrder(int projectID, int scheduleID, String itemIDList, int patientID, int admissionNo, bool isCompanion, bool isFasting, context) async { + Map request; + request = { + "ProjectID": projectID, + "ItemIDList": itemIDList, + "IsActive": true, + "OrderDate": DateUtil.getISODateFormat(DateTime.now()).replaceAll("T", " "), + "PatientID": patientID, + "AdmissionNo": admissionNo, + "IsCompanion": isCompanion, + "IsFasting": isFasting, + "CreatedBy": patientID, + "EditedBy": patientID, + "MealScheduleID": scheduleID, + "MealStatus": 1, + "ItemStatus": 0, + "ConfirmedBy": patientID, + "Remarks": "", + "IsVIP": false, + "IsFixedRemarks": false + }; + + dynamic localRes; + + await baseAppClient.post(PLACE_MEAL_PLAN_ORDER, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } + + Future getDischargeMedicationOrder(GetAdmissionInfoResponseModel getAdmissionInfoResponseModel) async { + Map request; + request = { + "ProjectID": getAdmissionInfoResponseModel.projectID, + "ClinicID": getAdmissionInfoResponseModel.clinicID, + "DoctorID": getAdmissionInfoResponseModel.doctorID, + "AdmissionNo": getAdmissionInfoResponseModel.admissionNo + }; + + // request = { + // "ProjectID": 12, + // "VersionID": 10.8, + // "Channel": 3, + // "LanguageID": 2, + // "IPAdress": "10.20.10.20", + // "generalid": "Cs2020@2016\$2958", + // "DeviceTypeID": 2, + // "PatientType": 1, + // "PatientTypeID": 1, + // "TokenID": "@dm!n", + // "PatientID": 869588, + // "PatientOutSA": 0, + // "SessionID": "rVuK3nzN4UKN0SW95un0jQ==", + // "ClinicID": 2, + // "DoctorID": "7600", + // "AdmissionNo": 2011001258 + // }; + + dynamic localRes; + + await baseAppClient.post(INPATIENT_DISCHARGE_MEDICATIONS, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isAllowAny: true); + return Future.value(localRes); + } } diff --git a/lib/uitl/HMG_Geofence.dart b/lib/uitl/HMG_Geofence.dart index d45c609a..9f1075bc 100644 --- a/lib/uitl/HMG_Geofence.dart +++ b/lib/uitl/HMG_Geofence.dart @@ -18,7 +18,7 @@ // import 'package:geofencing/geofencing.dart'; // // class HMG_Geofencing { -// var _testTrigger = false; +// var _testTrigger = true; // static var _isolatePortName = "hmg_geofencing_send_port"; // // List _zones; diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 074d2910..1391f482 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -1,4 +1,5 @@ import 'package:device_calendar/device_calendar.dart'; +import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; class DateUtil { @@ -90,6 +91,17 @@ class DateUtil { return start + "$milliseconds" + end; } + static String convertTime(String timeStr) { + TimeOfDay time = TimeOfDay(hour: num.parse(timeStr.split(":")[0]), minute: num.parse(timeStr.split(":")[1])); // 24-hour format time + + int hour = time.hourOfPeriod; // get hour in 12-hour format + String meridiem = time.period == DayPeriod.am ? "AM" : "PM"; // get AM/PM + + String convertedTime = '$hour:${time.minute == 0 ? "00" : time.minute} $meridiem'; // create the new time string + + return convertedTime; + } + static String formatDateToDate(DateTime date, bool isArabic) { return DateFormat('dd MMM yyy', isArabic ? "ar_SA" : "en_US").format(date); } diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 4f0d914a..536ad111 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -19,6 +19,7 @@ import 'package:firebase_messaging/firebase_messaging.dart' as fir; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_ios_voip_kit/call_state_type.dart'; import 'package:flutter_ios_voip_kit/flutter_ios_voip_kit.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:get_it/get_it.dart'; @@ -41,6 +42,7 @@ Future backgroundMessageHandler(dynamic message) async { } if (message.data != null && (message.data['is_call'] == 'true' || message.data['is_call'] == true)) { + // showCallkitIncoming(message); _incomingCall(message.data); return; } else { @@ -103,6 +105,57 @@ callPage(String sessionID, String token) async { // } } +// Future showCallkitIncoming(Map message) async { +// // if (message['type'] == 'ReservationCallStart') { +// var params = CallKitParams( +// id: DateTime.now().millisecondsSinceEpoch.toString(), +// nameCaller: 'Dr Sulaiman Al Habib', +// appName: 'Dr Sulaiman Al Habib', +// avatar: 'https://play-lh.googleusercontent.com/FBNNpxb7m6eM6wtW7MV1Ffp6OXOGLI38q47zcvP29OCYA1yhYH5mZzl5itZi0TgOyZpG', +// handle: 'LiveCare Call', +// type: 1, +// duration: 60000, +// textAccept: 'Accept', +// textDecline: 'Decline', +// textMissedCall: 'Missed call', +// textCallback: 'Call back', +// extra: { +// // 'reservationID': message['id'], +// 'userId': '1a2b3c4d' +// }, +// headers: {'apiKey': 'Abc@123!', 'platform': 'flutter'}, +// android: AndroidParams( +// isCustomNotification: true, +// isShowLogo: false, +// isShowCallback: false, +// ringtonePath: 'system_ringtone_default', +// backgroundColor: '#424242FF', +// // 'backgroundUrl': 'https://i.pravatar.cc/500', +// actionColor: '#4CAF50', +// incomingCallNotificationChannelName: "Incoming Call", +// missedCallNotificationChannelName: "Missed Call", +// ), +// ios: IOSParams( +// iconName: 'CallKitLogo', +// handleType: '', +// supportsVideo: true, +// maximumCallGroups: 2, +// maximumCallsPerCallGroup: 1, +// audioSessionMode: 'default', +// audioSessionActive: true, +// audioSessionPreferredSampleRate: 44100.0, +// audioSessionPreferredIOBufferDuration: 0.005, +// supportsDTMF: true, +// supportsHolding: true, +// supportsGrouping: false, +// supportsUngrouping: false, +// ringtonePath: 'system_ringtone_default')); +// await FlutterCallkitIncoming.showCallkitIncoming(params); +// // } else if (message['type'] == 'ReservationCallFinished') { +// // await FlutterCallkitIncoming.endAllCalls(); +// // } +// } + _incomingCall(Map data) async { LandingPage.incomingCallData = IncomingCallData.fromJson(data); if (LandingPage.isOpenCallPage == false) { @@ -262,6 +315,7 @@ class PushNotificationHandler { } if (remoteMessage.data['is_call'] == 'true' || remoteMessage.data['is_call'] == true) { _incomingCall(remoteMessage.data); + // showCallkitIncoming(remoteMessage.data); } else { GetNotificationsResponseModel notification = new GetNotificationsResponseModel(); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a4d61818..148fc71c 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2900,8 +2900,51 @@ class TranslationBase { String get updateInsuranceManuallyDialog => localizedValues["updateInsuranceManuallyDialog"][locale.languageCode]; String get viewReport => localizedValues["viewReport"][locale.languageCode]; String get sickLeaveAdmittedPatient => localizedValues["sickLeaveAdmittedPatient"][locale.languageCode]; + String get InPatient => localizedValues["InPatient"][locale.languageCode]; + String get inPatientServices => localizedValues["InPatientServices"][locale.languageCode]; + String get InPatientServicesHeader => localizedValues["InPatientServicesHeader"][locale.languageCode]; + String get admissionGeneral => localizedValues["admissionGeneral"][locale.languageCode]; + String get consent => localizedValues["consent"][locale.languageCode]; + String get generalInstructionsTitle => localizedValues["generalInstructionsTitle"][locale.languageCode]; + String get generalInstructionsSubTitle => localizedValues["generalInstructionsSubTitle"][locale.languageCode]; + String get medicalInstructionsTitle => localizedValues["medicalInstructionsTitle"][locale.languageCode]; + String get medicalInstructionsSubTitle => localizedValues["medicalInstructionsSubTitle"][locale.languageCode]; + String get mealPlanTitle => localizedValues["mealPlanTitle"][locale.languageCode]; + String get mealPlanSubTitle => localizedValues["mealPlanSubTitle"][locale.languageCode]; + String get birthNotificationTitle => localizedValues["birthNotificationTitle"][locale.languageCode]; + String get birthNotificationSubTitle => localizedValues["birthNotificationSubTitle"][locale.languageCode]; + String get admissionNoticeTitle => localizedValues["admissionNoticeTitle"][locale.languageCode]; + String get admissionNoticeSubTitle => localizedValues["admissionNoticeSubTitle"][locale.languageCode]; + String get mothersMRN => localizedValues["mothersMRN"][locale.languageCode]; + String get mothersName => localizedValues["mothersName"][locale.languageCode]; + String get fathersNameEN => localizedValues["fathersNameEN"][locale.languageCode]; + String get fathersNameAR => localizedValues["fathersNameAR"][locale.languageCode]; + String get babysNameEN => localizedValues["babysNameEN"][locale.languageCode]; + String get babysNameAR => localizedValues["babysNameAR"][locale.languageCode]; + String get contactNumber => localizedValues["contactNumber"][locale.languageCode]; + String get scanID => localizedValues["scanID"][locale.languageCode]; + String get birthNotificationNotes1 => localizedValues["birthNotificationNotes1"][locale.languageCode]; + String get birthNotificationNotes2 => localizedValues["birthNotificationNotes2"][locale.languageCode]; + String get birthNotificationNotes3 => localizedValues["birthNotificationNotes3"][locale.languageCode]; + String get placeOrder => localizedValues["placeOrder"][locale.languageCode]; + String get isFasting => localizedValues["isFasting"][locale.languageCode]; + String get noGeneralInstructions => localizedValues["noGeneralInstructions"][locale.languageCode]; + String get noMedicalInstructions => localizedValues["noMedicalInstructions"][locale.languageCode]; + String get medicalInstructions => localizedValues["medicalInstructions"][locale.languageCode]; + String get generalInstructions => localizedValues["generalInstructions"][locale.languageCode]; + String get copyLink => localizedValues["copyLink"][locale.languageCode]; + String get copyLinkTxt => localizedValues["copyLinkTxt"][locale.languageCode]; + String get paymentLinkCopied => localizedValues["paymentLinkCopied"][locale.languageCode]; + String get proErrorMessage => localizedValues["proErrorMessage"][locale.languageCode]; + String get admissionNo => localizedValues["admissionNo"][locale.languageCode]; + String get admissionReqNo => localizedValues["admissionReqNo"][locale.languageCode]; String get dischargeDate => localizedValues["dischargeDate"][locale.languageCode]; String get selectAdmissionText => localizedValues["selectAdmissionText"][locale.languageCode]; + String get onlyAdmitted => localizedValues["onlyAdmitted"][locale.languageCode]; + String get assistYou => localizedValues["assistYou"][locale.languageCode]; + String get receive => localizedValues["receive"][locale.languageCode]; + String get PRO => localizedValues["PRO"][locale.languageCode]; + String get patientRelationOffice => localizedValues["patientRelationOffice"][locale.languageCode]; String get invalidEligibility => localizedValues["invalidEligibility"][locale.languageCode]; String get invalidInsurance => localizedValues["invalidInsurance"][locale.languageCode]; String get continueCash => localizedValues["continueCash"][locale.languageCode]; diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 21bef1ce..f4ce2ea7 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -759,6 +759,7 @@ class Utils { SizedBox(height: 6), Text( text, + maxLines: 1, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.48, height: 18 / 12), ), SizedBox(height: 5), diff --git a/lib/uitl/utils_new.dart b/lib/uitl/utils_new.dart index 685ab36b..696a778d 100644 --- a/lib/uitl/utils_new.dart +++ b/lib/uitl/utils_new.dart @@ -313,6 +313,13 @@ Decoration containerBottomRightRadiusWithGradientBorder(double radius, {Color? d Decoration containerRadius(Color background, double radius) { return BoxDecoration( color: background, + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], border: Border.all( width: 1, // color: background // <--- border width here diff --git a/lib/widgets/bottom_options/BottomSheet.dart b/lib/widgets/bottom_options/BottomSheet.dart index 04568632..3a49f3d8 100644 --- a/lib/widgets/bottom_options/BottomSheet.dart +++ b/lib/widgets/bottom_options/BottomSheet.dart @@ -70,7 +70,7 @@ class ImageOptions { } galleryImageAndroid(Function(String, File) image) async { - if(await PermissionService.isExternalStorageEnabled()) { + if (await PermissionService.isExternalStorageEnabled()) { File _image = File((await ImagePicker.platform.pickImage(source: ImageSource.gallery, imageQuality: 20))!.path); String fileName = _image.path; final bytes = File(fileName).readAsBytesSync(); diff --git a/lib/widgets/buttons/defaultButton.dart b/lib/widgets/buttons/defaultButton.dart index 34be0f60..4b2b50fb 100644 --- a/lib/widgets/buttons/defaultButton.dart +++ b/lib/widgets/buttons/defaultButton.dart @@ -73,6 +73,7 @@ class DefaultButton extends StatelessWidget { style: TextButton.styleFrom( backgroundColor: color ?? const Color(0xffD02127), disabledForegroundColor: disabledColor, + disabledBackgroundColor: disabledColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index d9ffce3f..6d905484 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -10,6 +10,7 @@ class MedicalProfileItem extends StatelessWidget { final String subTitle; final bool hasBadge = false; final bool isPngImage; + final bool isInPatient; bool isEnable; Color? imgColor; final width; @@ -24,7 +25,7 @@ class MedicalProfileItem extends StatelessWidget { this.imgColor, this.isPngImage = false, this.width, - this.height}); + this.height, this.isInPatient = false}); @override Widget build(BuildContext context) { @@ -64,7 +65,7 @@ class MedicalProfileItem extends StatelessWidget { color: imgColor, ) : SvgPicture.asset( - "assets/images/new/services/$imagePath", + isInPatient ? "assets/images/new/inpatient/$imagePath" : "assets/images/new/services/$imagePath", height: height != null ? height : SizeConfig.widthMultiplier! * 7, diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 9d3fe17b..c8159f2b 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -10,7 +10,6 @@ import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -21,9 +20,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notificatio import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; -import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; @@ -611,6 +608,9 @@ class _AppDrawerState extends State { _vitalSignService.weightKg = ""; await _privilegeService.getPrivilege(); projectProvider!.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); + projectProvider!.setIsPatientAdmitted(false); + projectProvider!.setPatientHasAdmissionRequest(false); + projectProvider!.setInPatientProjectID(0); var appLanguage = await sharedPref.getString(APP_LANGUAGE); await sharedPref.clear(); await sharedPref.setString(APP_LANGUAGE, appLanguage); diff --git a/lib/widgets/others/app_expandable_notifier.dart b/lib/widgets/others/app_expandable_notifier.dart index 8122286f..91575dec 100644 --- a/lib/widgets/others/app_expandable_notifier.dart +++ b/lib/widgets/others/app_expandable_notifier.dart @@ -20,10 +20,22 @@ class AppExpandableNotifier extends StatefulWidget { bool expandFlag = false; bool hasCounter = false; String counter = "0"; + Color widgetColor = Colors.white; var controller = new ExpandableController(); bool isTitleSingleLine; + bool isDisabled = false; - AppExpandableNotifier({this.headerWidget, this.bodyWidget, this.title, this.collapsed, this.isExpand = false, this.isTitleSingleLine = true, this.hasCounter = false, this.counter = "0"}); + AppExpandableNotifier( + {this.headerWidget, + this.bodyWidget, + this.title, + this.collapsed, + this.isExpand = false, + this.isTitleSingleLine = true, + this.hasCounter = false, + this.counter = "0", + this.widgetColor, + this.isDisabled = false}); _AppExpandableNotifier createState() => _AppExpandableNotifier(); } @@ -60,7 +72,7 @@ class _AppExpandableNotifier extends State { } return ExpandableNotifier( child: Container( - color: Colors.white, + color: widget.widgetColor != null ? widget.widgetColor : Colors.white, child: Column( children: [ SizedBox( @@ -80,10 +92,11 @@ class _AppExpandableNotifier extends State { padding: const EdgeInsets.only(top: 20, bottom: 20, left: 21, right: 21), child: InkWell( onTap: () { - setState(() { - widget.expandFlag = !widget.expandFlag; - widget.controller.expanded = widget.expandFlag; - }); + if (!widget.isDisabled) + setState(() { + widget.expandFlag = !widget.expandFlag; + widget.controller.expanded = widget.expandFlag; + }); }, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -94,27 +107,30 @@ class _AppExpandableNotifier extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (_mainTitle.isNotEmpty && widget.isTitleSingleLine) - !widget.hasCounter ? - Text( - _mainTitle, - style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 1), - ) : Row( - children: [ - Text( - _mainTitle, - style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 1), - ), - SizedBox(width: 10.0,), - CircleAvatar( - backgroundColor: CustomColors.accentColor, - radius: 12.0, - child: Text( - widget.counter, - style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.72), + !widget.hasCounter + ? Text( + _mainTitle, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 1), + ) + : Row( + children: [ + Text( + _mainTitle, + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 1), + ), + SizedBox( + width: 10.0, + ), + CircleAvatar( + backgroundColor: CustomColors.accentColor, + radius: 12.0, + child: Text( + widget.counter, + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.72), + ), + ) + ], ), - ) - ], - ), if (_title.isNotEmpty && !widget.isTitleSingleLine) Text( _title, diff --git a/pubspec.yaml b/pubspec.yaml index e0e4c4ab..ebf51eb9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,8 +36,8 @@ dependencies: #chart fl_chart: ^0.64.0 - - + + #Camera Preview camera: ^0.10.1 @@ -142,7 +142,7 @@ dependencies: flutter_nfc_kit: ^3.3.1 #geofencing: any speech_to_text: ^6.1.1 - + #in_app_update: ^4.2.2 in_app_review: ^2.0.3 @@ -157,7 +157,7 @@ dependencies: flutter_staggered_grid_view: ^0.7.0 huawei_hmsavailability: ^6.11.0+301 huawei_location: ^6.11.0+301 - + share_plus: ^6.3.4 # Marker Animation auto_size_text: ^3.0.0 equatable: ^2.0.3 @@ -206,6 +206,7 @@ flutter: - assets/payment_options/ - assets/images/new/ + - assets/images/new/inpatient/ - assets/images/new/mass/ - assets/images/new/bottom_nav/ - assets/images/new/services/