diff --git a/assets/fonts/DoctorApp.ttf b/assets/fonts/DoctorApp.ttf index 21ce4a5d..22539da0 100644 Binary files a/assets/fonts/DoctorApp.ttf and b/assets/fonts/DoctorApp.ttf differ diff --git a/assets/images/leaves.svg b/assets/images/leaves.svg new file mode 100644 index 00000000..474585fd --- /dev/null +++ b/assets/images/leaves.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/lib/config/config.dart b/lib/config/config.dart index fc7edf42..e3163bb2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -107,6 +107,15 @@ const ARRIVED_PATIENT_URL = const ADD_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/PostSickLeave'; const GET_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/GetAllSickLeaves'; const EXTEND_SICK_LEAVE = 'Services/DoctorApplication.svc/REST/ExtendSickLeave'; + +const GET_OFFTIME = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; +const GET_COVERING_DOCTORS = + 'Services/DoctorApplication.svc/REST/GetCoveringDoctor'; +const ADD_RESCHDEULE = 'Services/DoctorApplication.svc/REST/PostRequisition'; +const UPDATE_RESCHDEULE = + 'Services/DoctorApplication.svc/REST/PatchRequisition'; +const GET_RESCHEDULE_LEAVE = + 'Services/DoctorApplication.svc/REST/GetRequisition'; const GET_PRESCRIPTION_LIST = 'Services/DoctorApplication.svc/REST/GetPrescription'; @@ -130,13 +139,14 @@ const POST_CHIEF_COMPLAINT = const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; const POST_PROGRESS_NOTE = - 'Services/DoctorApplication.svc/REST/PostProgressNote'; + '/Services/DoctorApplication.svc/REST/PostProgressNote'; const POST_ASSESSMENT = 'Services/DoctorApplication.svc/REST/PostAssessment'; const PATCH_ALLERGY = 'Services/DoctorApplication.svc/REST/PatchAllergies'; const PATCH_HISTORY = 'Services/DoctorApplication.svc/REST/PatchHistory'; const PATCH_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PatchChiefcomplaint'; + const PATCH_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PatchPhysicalExam'; const PATCH_PROGRESS_NOTE = @@ -156,6 +166,7 @@ const GET_CATEGORISE_PROCEDURE = const UPDATE_PROCEDURE = 'Services/DoctorApplication.svc/REST/PatchProcedure'; const UPDATE_PRESCRIPTION = 'Services/DoctorApplication.svc/REST/PatchPrescription'; +const SEARCH_DRUG = 'Services/DoctorApplication.svc/REST/GetMedicationList'; const GET_MEDICAL_FILE = 'Services/DoctorApplication.svc/REST/GetMedicalFile'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e9b01caf..1dc0216e 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -354,6 +354,14 @@ const Map> localizedValues = { 'instruction': {'en': 'Instructions', 'ar': 'إرشادات'}, 'addMedication': {'en': 'ADD MEDICATION', 'ar': 'اضف الدواء'}, 'route': {'en': 'Route', 'ar': 'المسار'}, + 'reschedule-leave': { + 'en': 'Reschedule and leaves', + 'ar': 'إعادة الجدولة والأوراق' + }, + 'no-reschedule-leave': { + 'en': 'No Reschedule and leaves', + 'ar': 'لا إعادة جدولة ويغادر' + }, 'weight': {'en': "Weight", 'ar': 'الوزن'}, 'kg': {'en': "kg", 'ar': 'كغ'}, 'height': {'en': "Height", 'ar': 'الطول'}, @@ -369,68 +377,133 @@ const Map> localizedValues = { 'rhythm': {'en': "Rhythm", 'ar': 'الإيقاع'}, 'respBeats': {'en': 'RESP (beats/minute)', 'ar': ' (دقة/دقيقة)التنفس'}, 'patternOfRespiration': {'en': "Pattern Of Respiration", 'ar': 'نمط التنفس'}, - 'bloodPressureDiastoleAndSystole': {'en': 'Blood Pressure (Sys, Dias)', 'ar': 'ضغط الدم (العظمى, الصغرى)'}, + 'bloodPressureDiastoleAndSystole': { + 'en': 'Blood Pressure (Sys, Dias)', + 'ar': 'ضغط الدم (العظمى, الصغرى)' + }, 'cuffLocation': {'en': "Cuff Location", 'ar': 'موقع الكف'}, 'cuffSize': {'en': "Cuff Size", 'ar': 'حجم الكف'}, 'patientPosition': {'en': "Patient Position", 'ar': 'موقع المريض'}, 'fio2': {'en': "FIO2(%)", 'ar': 'FIO2(%)'}, 'sao2': {'en': "SAO2(%)", 'ar': 'SAO2(%)'}, 'painManagement': {'en': "Pain Management", 'ar': 'إدارة الألم'}, + 'holiday': {'en': "Holiday", 'ar': 'يوم الاجازة'}, + 'to': {'en': "To", 'ar': 'إلى'}, + 'coveringDoctor': {'en': "Covering Doctor", 'ar': 'تغطية دكتور'}, + 'requestLeave': {'en': 'Request Leave', 'ar': 'طلب إجازة'}, + 'pleaseEnterDate': { + 'en': 'Please enter leave start date', + 'ar': 'الرجاء إدخال تاريخ بدء الإجازة' + }, + 'pleaseEnterNoOfDays': { + 'en': 'Please enter sick leave days', + 'ar': 'الرجاء إدخال أيام الإجازة المرضية' + }, + 'pleaseEnterRemarks': { + 'en': 'Please enter remarks', + 'ar': 'الرجاء إدخال الملاحظات' + }, + 'update': {'en': 'Update', 'ar': 'تحديث'}, 'admission': {'en': "Admission", 'ar': 'قبول'}, 'request': {'en': "Request", 'ar': 'طلب'}, 'admissionRequest': {'en': "Admission Request", 'ar': 'طلب قبول'}, 'patientDetails': {'en': "Patient Details", 'ar': 'تفاصيل المريض'}, - 'specialityAndDoctorDetail': {'en': "SPECIALITY AND DOCTOR DETAILS", 'ar': 'تفاصيل التخصص والطبيب'}, + 'specialityAndDoctorDetail': { + 'en': "SPECIALITY AND DOCTOR DETAILS", + 'ar': 'تفاصيل التخصص والطبيب' + }, 'referringDate': {'en': "Referring Date", 'ar': 'تاريخ الإحالة'}, 'referringDoctor': {'en': "Referring Doctor", 'ar': 'دكتور الإحالة'}, 'otherInformation': {'en': "Other Information", 'ar': 'معلومات أخرى'}, 'expectedDays': {'en': "Expected Days", 'ar': 'الأيام المتوقعة'}, - 'expectedAdmissionDate': {'en': "Expected Admission Date", 'ar': 'تاريخ القبول المتوقع'}, + 'expectedAdmissionDate': { + 'en': "Expected Admission Date", + 'ar': 'تاريخ القبول المتوقع' + }, 'emergencyAdmission': {'en': "EMERGENCY ADMISSION", 'ar': 'دخول الطوارئ'}, 'patientPregnant': {'en': "Patient Pregnant", 'ar': 'حمل المريض'}, - 'treatmentLine': {'en': "Main line of treatment", 'ar': 'الخط الرئيسي للعلاج'}, + 'treatmentLine': { + 'en': "Main line of treatment", + 'ar': 'الخط الرئيسي للعلاج' + }, 'ward': {'en': "Ward", 'ar': 'رعاية'}, - 'preAnesthesiaReferred': {'en': "PRE ANESTHESIA REFERRED", 'ar': 'الاحالة قبل التخدير'}, + 'preAnesthesiaReferred': { + 'en': "PRE ANESTHESIA REFERRED", + 'ar': 'الاحالة قبل التخدير' + }, 'admissionType': {'en': "Admission Type", 'ar': 'نوع القبول'}, 'diagnosis': {'en': "Diagnosis", 'ar': 'التشخيص'}, 'allergies': {'en': "Allergies", 'ar': 'الحساسية'}, - 'preOperativeOrders': {'en': "Pre Operative Orders", 'ar': 'أوامر ما قبل العملية'}, - 'elementForImprovement': {'en': "Element For Improvement", 'ar': 'عنصر للتحسين'}, + 'preOperativeOrders': { + 'en': "Pre Operative Orders", + 'ar': 'أوامر ما قبل العملية' + }, + 'elementForImprovement': { + 'en': "Element For Improvement", + 'ar': 'عنصر للتحسين' + }, 'dischargeDate': {'en': "Discharge Date", 'ar': 'تاريخ التفريغ'}, 'dietType': {'en': "Diet Type", 'ar': 'نوع النظام الغذائي'}, - 'dietTypeRemarks': {'en': "Remarks on diet type", 'ar': 'ملاحظات على نوع النظام الغذائي'}, + 'dietTypeRemarks': { + 'en': "Remarks on diet type", + 'ar': 'ملاحظات على نوع النظام الغذائي' + }, 'save': {'en': "SAVE", 'ar': 'حفظ'}, - 'postPlansEstimatedCost': {'en': "POST PLANS & ESTIMATED COST", 'ar': 'خطط البريد والتكلفة المقدرة'}, + 'postPlansEstimatedCost': { + 'en': "POST PLANS & ESTIMATED COST", + 'ar': 'خطط البريد والتكلفة المقدرة' + }, 'ucaf': {'en': "UCAF", 'ar': 'UCAF'}, 'emergencyCase': {'en': "Emergency Case", 'ar': 'حالة طارئة'}, 'durationOfIllness': {'en': "duration Of Illness", 'ar': 'مدة المرض'}, - 'chiefComplaintsAndSymptoms': {'en': "CHIEF COMPLAINTS & OTHER SYMPTOMS", 'ar': 'شكاوى الرئيس وأعراض أخرى'}, - 'patientFeelsPainInHisBackAndCough': {'en': "Patient Feels pain in his back and cough", 'ar': 'يشعر المريض بألم في ظهره ويسعل'}, - 'additionalTextComplaints': {'en': "Additional text to add about Complaints", 'ar': 'نص إضافي لإضافته حول الشكاوى'}, + 'chiefComplaintsAndSymptoms': { + 'en': "CHIEF COMPLAINTS & OTHER SYMPTOMS", + 'ar': 'شكاوى الرئيس وأعراض أخرى' + }, + 'patientFeelsPainInHisBackAndCough': { + 'en': "Patient Feels pain in his back and cough", + 'ar': 'يشعر المريض بألم في ظهره ويسعل' + }, + 'additionalTextComplaints': { + 'en': "Additional text to add about Complaints", + 'ar': 'نص إضافي لإضافته حول الشكاوى' + }, 'otherConditions': {'en': "OTHER CONDITIONS", 'ar': 'شروط أخرى'}, 'other': {'en': "Other", 'ar': 'أخرى'}, 'how': {'en': "How", 'ar': 'كيف'}, 'when': {'en': "When", 'ar': 'متى'}, 'where': {'en': "Where", 'ar': 'أين'}, - 'specifyPossibleLineManagement': {'en': "Specify possible line of management", 'ar': 'حدد خط الإدارة المحتمل'}, + 'specifyPossibleLineManagement': { + 'en': "Specify possible line of management", + 'ar': 'حدد خط الإدارة المحتمل' + }, 'significantSigns': {'en': "SIGNIFICANT SIGNS", 'ar': 'علامات مهمة'}, 'backAbdomen': {'en': "Back : Abdomen", 'ar': 'الظهر: البطن'}, + 'reasons': {'en': "Reasons", 'ar': 'الأسباب'}, 'createNew': {'en': "Create New", 'ar': 'انشاء '}, 'episode': {'en': "Episode", 'ar': 'Episode'}, - 'update': {'en': "Update", 'ar': 'تعديل'}, 'chiefComplaints': {'en': "Chief Complaints", 'ar': 'الشكاوى'}, 'addChiefComplaints': {'en': "Add Chief Complaints", 'ar': ' اضافه الشكاوى'}, 'histories': {'en': "Histories", 'ar': 'التاريخ المرضي'}, 'allergiesSoap': {'en': "Allergies", 'ar': 'الحساسية'}, - 'historyOfPresentIllness': {'en': "History of Present Illness", 'ar': 'تاريخ المرض الحالي'}, - 'requiredMsg': {'en': "Please add required field correctly", 'ar':"الرجاء إضافة الحقل المطلوب بشكل صحيح" }, - 'addHistory': {'en': "Add History", 'ar':"اضافه تاريخ مرضي" }, - 'searchHistory': {'en': "Search History", 'ar':" البحث" }, - 'addSelectedHistories': {'en': "add selected histories", 'ar':" اضافه تاريخ مرضي" }, - 'addAllergies': {'en': "Add Allergies", 'ar':"أضف الحساسية" }, - 'itemExist': {'en': "This item already exist", 'ar':"هذا العنصر موجود" }, - 'selectAllergy': {'en': "Select Allergy", 'ar':"أختر الحساسية" }, - 'selectSeverity': {'en': "Select Severity", 'ar':"أختر الدرجه" }, + 'historyOfPresentIllness': { + 'en': "History of Present Illness", + 'ar': 'تاريخ المرض الحالي' + }, + 'requiredMsg': { + 'en': "Please add required field correctly", + 'ar': "الرجاء إضافة الحقل المطلوب بشكل صحيح" + }, + 'addHistory': {'en': "Add History", 'ar': "اضافه تاريخ مرضي"}, + 'searchHistory': {'en': "Search History", 'ar': " البحث"}, + 'addSelectedHistories': { + 'en': "add selected histories", + 'ar': " اضافه تاريخ مرضي" + }, + 'addAllergies': {'en': "Add Allergies", 'ar': "أضف الحساسية"}, + 'itemExist': {'en': "This item already exist", 'ar': "هذا العنصر موجود"}, + 'selectAllergy': {'en': "Select Allergy", 'ar': "أختر الحساسية"}, + 'selectSeverity': {'en': "Select Severity", 'ar': "أختر الدرجه"}, 'medications': {'en': "Medications", 'ar':"الأدوية" }, 'procedures': {'en': "Procedures", 'ar':"الإجراءات" }, 'vitalSignEmptyMsg': {'en': "There is no vital signs for this patient", 'ar':"لا توجد علامات حيوية لهذا المريض" }, diff --git a/lib/core/model/procedure/get_procedure_model.dart b/lib/core/model/procedure/get_procedure_model.dart index bdb69b1c..5c83b49b 100644 --- a/lib/core/model/procedure/get_procedure_model.dart +++ b/lib/core/model/procedure/get_procedure_model.dart @@ -34,7 +34,7 @@ class EntityList { String genderValidation; String group; String orderedValidation; - int price; + dynamic price; String procedureId; String procedureName; String specialPermission; diff --git a/lib/core/model/search_drug_model.dart b/lib/core/model/search_drug_model.dart new file mode 100644 index 00000000..396526c1 --- /dev/null +++ b/lib/core/model/search_drug_model.dart @@ -0,0 +1,65 @@ +class SearchDrugModel { + List entityList; + int rowcount; + dynamic statusMessage; + + SearchDrugModel({this.entityList, this.rowcount, this.statusMessage}); + + SearchDrugModel.fromJson(Map json) { + if (json['entityList'] != null) { + entityList = new List(); + json['entityList'].forEach((v) { + entityList.add(new EntityList.fromJson(v)); + }); + } + rowcount = json['rowcount']; + statusMessage = json['statusMessage']; + } + + Map toJson() { + final Map data = new Map(); + if (this.entityList != null) { + data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + } + data['rowcount'] = this.rowcount; + data['statusMessage'] = this.statusMessage; + return data; + } +} + +class EntityList { + dynamic description; + dynamic genericName; + dynamic itemId; + dynamic keywords; + dynamic price; + dynamic quantity; + + EntityList( + {this.description, + this.genericName, + this.itemId, + this.keywords, + this.price, + this.quantity}); + + EntityList.fromJson(Map json) { + description = json['Description']; + genericName = json['GenericName']; + itemId = json['ItemId']; + keywords = json['Keywords']; + price = json['Price']; + quantity = json['Quantity']; + } + + Map toJson() { + final Map data = new Map(); + data['Description'] = this.description; + data['GenericName'] = this.genericName; + data['ItemId'] = this.itemId; + data['Keywords'] = this.keywords; + data['Price'] = this.price; + data['Quantity'] = this.quantity; + return data; + } +} diff --git a/lib/core/model/search_drug_request_model.dart b/lib/core/model/search_drug_request_model.dart new file mode 100644 index 00000000..e1cccc43 --- /dev/null +++ b/lib/core/model/search_drug_request_model.dart @@ -0,0 +1,18 @@ +class SearchDrugRequestModel { + List search; + String vidaAuthTokenID; + + SearchDrugRequestModel({this.search, this.vidaAuthTokenID}); + + SearchDrugRequestModel.fromJson(Map json) { + search = json['Search'].cast(); + vidaAuthTokenID = json['VidaAuthTokenID']; + } + + Map toJson() { + final Map data = new Map(); + data['Search'] = this.search; + data['VidaAuthTokenID'] = this.vidaAuthTokenID; + return data; + } +} diff --git a/lib/core/service/patient-doctor-referral-service.dart b/lib/core/service/patient-doctor-referral-service.dart index a15ed05a..7eb8001b 100644 --- a/lib/core/service/patient-doctor-referral-service.dart +++ b/lib/core/service/patient-doctor-referral-service.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/models/patient/get_clinic_by_project_id_reque import 'package:doctor_app_flutter/models/patient/get_doctor_by_clinic_id_request.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/request_my_referral_patient_model.dart'; import 'base/lookup-service.dart'; @@ -188,7 +189,7 @@ class PatientReferralService extends LookupService { } Future makeReferral( - PatientArrivalEntity patientArrivalEntity, + PatiantInformtion patient, String isoStringDate, int projectID, int clinicID, @@ -203,8 +204,8 @@ class PatientReferralService extends LookupService { .add({"goalId": element.id, "remarks": element.remarks}); }); - body['PatientMRN'] = patientArrivalEntity.patientMRN; - body['AppointmentNo'] = patientArrivalEntity.appointmentNo; + body['PatientMRN'] = patient.patientMRN; + body['AppointmentNo'] = patient.appointmentNo; body['SetupID'] = setupID; body['appointmentDate'] = isoStringDate; body['SlotStart'] = isoStringDate; diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index ced17cd4..3ccdc23c 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -2,17 +2,26 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/prescription_req_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; class PrescriptionService extends BaseService { List _prescriptionList = List(); List get prescriptionList => _prescriptionList; + List _drugsList = List(); + List get drugsList => _drugsList; PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel( patientMRN: 3120877, vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8", ); + SearchDrugRequestModel _drugRequestModel = SearchDrugRequestModel( + search: ["panadol"], + vidaAuthTokenID: + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiY2QwOWU3MTEtZDEwYy00NjZhLWEwNDctMjc4MDBmNmRkMTYxIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTYyMDMiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkhFQUQgTlVSU0VTIiwiRE9DVE9SUyIsIkhFQUQgRE9DVE9SUyIsIkFETUlOSVNUUkFUT1JTIiwiUkVDRVBUSU9OSVNUIiwiRVIgTlVSU0UiLCJJVkYgUkVDRVBUSU9OSVNUIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIklWRiBET0NUT1IiLCJJVkYgTlVSU0UiLCJJVkYgQ09PUkRJTkFUT1IiLCJJVkYgTEFCIFNUQUZGIiwiQ09OU0VOVCAiLCJNRURJQ0FMIFJFUE9SVCAtIFNJQ0sgTEVBVkUgTUFOQUdFUiJdLCJuYmYiOjE2MDkyNjQ2MTQsImV4cCI6MTYxMDEyODYxNCwiaWF0IjoxNjA5MjY0NjE0fQ.xCJ0jGtSFf36G8uZpdmHVoLfXDyP6e9mBpuOPSlzuio", + ); PostPrescriptionReqModel _postPrescriptionReqModel = PostPrescriptionReqModel(); @@ -30,6 +39,18 @@ class PrescriptionService extends BaseService { }, body: _prescriptionReqModel.toJson()); } + Future getDrugs() async { + hasError = false; + _drugsList.clear(); + await baseAppClient.post(SEARCH_DRUG, + onSuccess: (dynamic response, int statusCode) { + _drugsList.add(SearchDrugModel.fromJson(response['MedicationList'])); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _drugRequestModel.toJson()); + } + Future postPrescription( PostPrescriptionReqModel postProcedureReqModel) async { hasError = false; diff --git a/lib/core/service/procedure_service.dart b/lib/core/service/procedure_service.dart index 0152de24..8122f0a7 100644 --- a/lib/core/service/procedure_service.dart +++ b/lib/core/service/procedure_service.dart @@ -14,10 +14,10 @@ class ProcedureService extends BaseService { List procedureslist = List(); GetProcedureReqModel _getProcedureReqModel = GetProcedureReqModel( - clinicId: 0, + clinicId: 17, pageSize: 10, pageIndex: 1, - patientMRN: 0, + patientMRN: 3120725, //categoryId: null, vidaAuthTokenID: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI", diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 70d9a3e4..c4aa8abf 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/extend_sick_leave_request.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; @@ -8,9 +9,18 @@ import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.d class SickLeaveService extends BaseService { Map get sickLeavestatisitics => _statistics; Map _statistics = {}; - + List get getOffTimeList => offTime; + List offTime = []; + List get getReasons => reasonse; + List reasonse = []; List get getAllSickLeave => _getAllsickLeave; List _getAllsickLeave = []; + List get coveringDoctorsList => _coveringDoctors; + List _coveringDoctors = []; + + List get getAllRescheduleLeave => + _getReScheduleLeave; + List _getReScheduleLeave = []; Future getStatistics(appoNo, patientMRN) async { hasError = false; await baseAppClient.post( @@ -29,14 +39,14 @@ class SickLeaveService extends BaseService { } Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { - addSickLeaveRequest.appointmentNo = '2016054661'; - addSickLeaveRequest.patientMRN = '3120746'; + // addSickLeaveRequest.appointmentNo = '2016054661'; + // addSickLeaveRequest.patientMRN = '3120746'; hasError = false; await baseAppClient.post( ADD_SICK_LEAVE, onSuccess: (dynamic response, int statusCode) { Future.value(response); - print(response); + //print(response); // _statistics = {}; // _statistics = response['SickLeaveStatistics']; }, @@ -72,7 +82,7 @@ class SickLeaveService extends BaseService { ); } - Future getSickLeave() async { + Future getSickLeave(patientMRN) async { hasError = false; await baseAppClient.post( GET_SICK_LEAVE, @@ -87,7 +97,109 @@ class SickLeaveService extends BaseService { hasError = true; super.error = error; }, - body: {'PatientMRN': 3120772}, + body: {'PatientMRN': patientMRN}, + ); + } + + Future getRescheduleLeave() async { + hasError = false; + await baseAppClient.post( + GET_RESCHEDULE_LEAVE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + _getReScheduleLeave.clear(); + response['requisitionList']['entityList'].forEach((v) { + _getReScheduleLeave.add(GetRescheduleLeavesResponse.fromJson(v)); + }); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {'ClinicID': 1}, + ); + } + + Future getOffTime() async { + hasError = false; + + await baseAppClient.post( + GET_OFFTIME, + onSuccess: (dynamic response, int statusCode) { + offTime = []; + offTime = response['MasterLookUpList']['entityList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": 2013}, + ); + } + + Future getReasonsByID({id}) async { + hasError = false; + + await baseAppClient.post( + GET_OFFTIME, + onSuccess: (dynamic response, int statusCode) { + reasonse = []; + reasonse = response['MasterLookUpList']['entityList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"MasterInput": id ?? 18}, + ); + } + + Future getCoveringDoctors() async { + hasError = false; + + await baseAppClient.post( + GET_COVERING_DOCTORS, + onSuccess: (dynamic response, int statusCode) { + _coveringDoctors = []; + _coveringDoctors = response['coveringDoctorList']['entityList']; + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: {"ClinicID": 1}, + ); + } + + addReschedule(request) async { + hasError = false; + + await baseAppClient.post( + ADD_RESCHDEULE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: request, + ); + } + + updateReschedule(request) async { + hasError = false; + + await baseAppClient.post( + UPDATE_RESCHDEULE, + onSuccess: (dynamic response, int statusCode) { + Future.value(response); + }, + onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, + body: request, ); } } diff --git a/lib/core/viewModel/leave_rechdule_response.dart b/lib/core/viewModel/leave_rechdule_response.dart new file mode 100644 index 00000000..d7cab8bf --- /dev/null +++ b/lib/core/viewModel/leave_rechdule_response.dart @@ -0,0 +1,52 @@ +class GetRescheduleLeavesResponse { + int clinicId; + var coveringDoctorId; + String date; + String dateTimeFrom; + String dateTimeTo; + int doctorId; + int reasonId; + int requisitionNo; + int requisitionType; + int status; + + GetRescheduleLeavesResponse( + {this.clinicId, + this.coveringDoctorId, + this.date, + this.dateTimeFrom, + this.dateTimeTo, + this.doctorId, + this.reasonId, + this.requisitionNo, + this.requisitionType, + this.status}); + + GetRescheduleLeavesResponse.fromJson(Map json) { + clinicId = json['clinicId']; + coveringDoctorId = json['coveringDoctorId']; + date = json['date']; + dateTimeFrom = json['dateTimeFrom']; + dateTimeTo = json['dateTimeTo']; + doctorId = json['doctorId']; + reasonId = json['reasonId']; + requisitionNo = json['requisitionNo']; + requisitionType = json['requisitionType']; + status = json['status']; + } + + Map toJson() { + final Map data = new Map(); + data['clinicId'] = this.clinicId; + data['coveringDoctorId'] = this.coveringDoctorId; + data['date'] = this.date; + data['dateTimeFrom'] = this.dateTimeFrom; + data['dateTimeTo'] = this.dateTimeTo; + data['doctorId'] = this.doctorId; + data['reasonId'] = this.reasonId; + data['requisitionNo'] = this.requisitionNo; + data['requisitionType'] = this.requisitionType; + data['status'] = this.status; + return data; + } +} diff --git a/lib/core/viewModel/patient-referral-viewmodel.dart b/lib/core/viewModel/patient-referral-viewmodel.dart index 9662a910..e5657883 100644 --- a/lib/core/viewModel/patient-referral-viewmodel.dart +++ b/lib/core/viewModel/patient-referral-viewmodel.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/PendingReferral.dart'; import 'package:doctor_app_flutter/models/patient/my_referral/my_referred_patient_model.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import '../../locator.dart'; @@ -117,35 +118,14 @@ class PatientReferralViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getPatientArrivalList(String date) async { - setState(ViewState.Busy); - await _referralPatientService.getPatientArrivalList(date); - if (_referralPatientService.hasError) { - error = _referralPatientService.error; - setState(ViewState.ErrorLocal); - } else { - setState(ViewState.Idle); - } - } - - List getAppointmentsByPatientName(String patientName) { - List appointments = []; - patientArrivalList.forEach((element) { - if (element.patientName == patientName) { - appointments.add(element.toJson()); - } - }); - return appointments; - } - - Future makeReferral(PatientArrivalEntity patientArrivalEntity, + Future makeReferral(PatiantInformtion patient, String isoStringDate, int projectID, int clinicID, int doctorID, String remarks) async { setState(ViewState.Busy); - await _referralPatientService.makeReferral(patientArrivalEntity, isoStringDate, projectID, clinicID, doctorID, remarks); + await _referralPatientService.makeReferral(patient, isoStringDate, projectID, clinicID, doctorID, remarks); if (_referralPatientService.hasError) { error = _referralPatientService.error; setState(ViewState.Error); diff --git a/lib/core/viewModel/patient_view_model.dart b/lib/core/viewModel/patient_view_model.dart index 9672da83..2fcdc779 100644 --- a/lib/core/viewModel/patient_view_model.dart +++ b/lib/core/viewModel/patient_view_model.dart @@ -49,7 +49,7 @@ class PatientViewModel extends BaseViewModel { List get referralFrequencyList => _patientService.referalFrequancyList; - Future getPatientList( patient, patientType, + Future getPatientList(patient, patientType, {bool isBusyLocal = false}) async { if (isBusyLocal) { setState(ViewState.BusyLocal); diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index 14684aeb..e5fa9a0f 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/Prescription_model.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug_model.dart'; import 'package:doctor_app_flutter/core/service/prescription_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; @@ -11,6 +12,7 @@ class PrescriptionViewModel extends BaseViewModel { List get prescriptionList => _prescriptionService.prescriptionList; + List get drugsList => _prescriptionService.drugsList; Future getPrescription() async { hasError = false; @@ -53,4 +55,16 @@ class PrescriptionViewModel extends BaseViewModel { setState(ViewState.Idle); } } + + Future getDrugs() async { + hasError = false; + //_insuranceCardService.clearInsuranceCard(); + setState(ViewState.Busy); + await _prescriptionService.getDrugs(); + if (_prescriptionService.hasError) { + error = _prescriptionService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/core/viewModel/sick_leave_view_model.dart b/lib/core/viewModel/sick_leave_view_model.dart index a11d43ec..d5aba154 100644 --- a/lib/core/viewModel/sick_leave_view_model.dart +++ b/lib/core/viewModel/sick_leave_view_model.dart @@ -12,6 +12,10 @@ class SickLeaveViewModel extends BaseViewModel { SickLeaveService _sickLeaveService = locator(); get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics; get getAllSIckLeave => _sickLeaveService.getAllSickLeave; + List get allOffTime => _sickLeaveService.getOffTimeList; + List get allReasons => _sickLeaveService.getReasons; + List get coveringDoctors => _sickLeaveService.coveringDoctorsList; + get getReschduleLeave => _sickLeaveService.getAllRescheduleLeave; Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { setState(ViewState.Busy); await _sickLeaveService.addSickLeave(addSickLeaveRequest); @@ -42,9 +46,69 @@ class SickLeaveViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getSickLeave() async { + Future getSickLeave(patientMRN) async { setState(ViewState.Busy); - await _sickLeaveService.getSickLeave(); + await _sickLeaveService.getSickLeave(patientMRN); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getRescheduleLeave() async { + setState(ViewState.Busy); + await _sickLeaveService.getRescheduleLeave(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getOffTime() async { + setState(ViewState.Busy); + await _sickLeaveService.getOffTime(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getReasons(id) async { + setState(ViewState.Busy); + await _sickLeaveService.getReasonsByID(id: id); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future getCoveringDoctors() async { + setState(ViewState.Busy); + await _sickLeaveService.getCoveringDoctors(); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future addReschedule(request) async { + setState(ViewState.Busy); + await _sickLeaveService.addReschedule(request); + if (_sickLeaveService.hasError) { + error = _sickLeaveService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + Future updateReschedule(request) async { + setState(ViewState.Busy); + await _sickLeaveService.updateReschedule(request); if (_sickLeaveService.hasError) { error = _sickLeaveService.error; setState(ViewState.Error); diff --git a/lib/icons_app/config.json b/lib/icons_app/config.json index fef927b0..ede09595 100644 --- a/lib/icons_app/config.json +++ b/lib/icons_app/config.json @@ -384,6 +384,34 @@ "sync" ] }, + { + "uid": "a0f7dbb184f90f285a9cba8cf09a9b6a", + "css": "drawer_icon", + "code": 59429, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1564.7 1000H68C30.6 1000 0 958.7 0 908.2H0C0 857.6 30.6 816.3 68 816.3H1564.7C1602 816.3 1632.7 857.6 1632.7 908.2H1632.7C1632.7 958.7 1602 1000 1564.7 1000ZM911.6 591.8H68C30.6 591.8 0 550.5 0 500H0C0 449.5 30.6 408.2 68 408.2H911.6C949 408.2 979.6 449.5 979.6 500H979.6C979.6 550.5 949 591.8 911.6 591.8ZM1238.1 183.7H68C30.6 183.7 0 142.4 0 91.8H0C0 41.3 30.6 0 68 0H1238.1C1275.5 0 1306.1 41.3 1306.1 91.8H1306.1C1306.1 142.4 1275.5 183.7 1238.1 183.7Z", + "width": 1633 + }, + "search": [ + "drawer_icon" + ] + }, + { + "uid": "764baf138776221a3e1e845391b188a4", + "css": "leaves", + "code": 59446, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M968.7 468.7H572.9A31.3 31.3 0 1 1 572.9 406.2H968.7A31.3 31.3 0 1 1 968.7 468.7ZM968.7 468.7M812.5 625A31.3 31.3 0 0 1 790.4 571.6L924.5 437.5 790.4 303.3A31.3 31.3 0 0 1 834.6 259.1L990.9 415.4A31.3 31.3 0 0 1 990.9 459.6L834.6 615.8A31.2 31.2 0 0 1 812.5 625ZM812.5 625M333.3 1000A83.3 83.3 0 0 0 416.7 916.7V166.7A83.9 83.9 0 0 0 360.3 87.5L109.9 4.1A84.2 84.2 0 0 0 0 83.4V833.4A83.9 83.9 0 0 0 56.4 912.4L306.8 995.8A87.2 87.2 0 0 0 333.3 1000ZM83.3 62.5A24.5 24.5 0 0 1 90.8 63.6L340.1 146.7A21.4 21.4 0 0 1 354.2 166.6V916.6A22 22 0 0 1 325.9 936.4L76.6 853.3A21.5 21.5 0 0 1 62.5 833.3V83.3A20.9 20.9 0 0 1 83.3 62.5ZM83.3 62.5M635.4 208.3A31.3 31.3 0 0 0 666.7 177.1V114.6A114.7 114.7 0 0 0 552.1 0H83.3A31.3 31.3 0 0 0 83.3 62.5H552.1A52.1 52.1 0 0 1 604.2 114.6V177.1A31.3 31.3 0 0 0 635.4 208.3ZM635.4 208.3M385.4 875H552.1A114.7 114.7 0 0 0 666.6 760.4V697.9A31.3 31.3 0 0 0 604.1 697.9V760.4A52.1 52.1 0 0 1 552.1 812.5H385.4A31.3 31.3 0 0 0 385.4 875ZM385.4 875", + "width": 1000 + }, + "search": [ + "leaves" + ] + }, { "uid": "740f78c2b53c8cc100a8b0d283bbd34f", "css": "home_icon-1", @@ -481,19 +509,6 @@ "search": [ "scdedule_icon_active" ] - }, { - "uid": "a0f7dbb184f90f285a9cba8cf09a9b6a", - "css": "drawer_icon", - "code": 59429, - "src": "custom_icons", - "selected": true, - "svg": { - "path": "M1564.7 1000H68C30.6 1000 0 958.7 0 908.2H0C0 857.6 30.6 816.3 68 816.3H1564.7C1602 816.3 1632.7 857.6 1632.7 908.2H1632.7C1632.7 958.7 1602 1000 1564.7 1000ZM911.6 591.8H68C30.6 591.8 0 550.5 0 500H0C0 449.5 30.6 408.2 68 408.2H911.6C949 408.2 979.6 449.5 979.6 500H979.6C979.6 550.5 949 591.8 911.6 591.8ZM1238.1 183.7H68C30.6 183.7 0 142.4 0 91.8H0C0 41.3 30.6 0 68 0H1238.1C1275.5 0 1306.1 41.3 1306.1 91.8H1306.1C1306.1 142.4 1275.5 183.7 1238.1 183.7Z", - "width": 1633 - }, - "search": [ - "drawer_icon" - ] } ] } \ No newline at end of file diff --git a/lib/icons_app/doctor_app_icons.dart b/lib/icons_app/doctor_app_icons.dart index 80db55c1..ef01c934 100644 --- a/lib/icons_app/doctor_app_icons.dart +++ b/lib/icons_app/doctor_app_icons.dart @@ -11,7 +11,7 @@ /// fonts: /// - asset: fonts/DoctorApp.ttf /// -/// +/// /// import 'package:flutter/widgets.dart'; @@ -19,35 +19,64 @@ class DoctorApp { DoctorApp._(); static const _kFontFam = 'DoctorApp'; - static const _kFontPkg = null; - - static const IconData female_icon = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData male = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData reject_icon = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon_active = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData menu_icon_active = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_icon_active = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scdedule_icon_active = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData schedule_icon = IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData discharge_patient = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData approved_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData pending_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData in_patient_white = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab_results = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData home_icon = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData operations = IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData out_patient = IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData patient = IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData radiology = IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData mail = IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData medicine_search = IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr_code = IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referral = IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData referred = IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_patient = IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sync_icon = IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drawer_icon = IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const String _kFontPkg = null; + static const IconData female_icon = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData male = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData reject_icon = + IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon_active = + IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon = + IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData menu_icon_active = + IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon = + IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message_icon_active = + IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData scdedule_icon_active = + IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData schedule_icon = + IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData discharge_patient = + IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData approved_icon = + IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData pending_icon = + IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData in_patient_white = + IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData lab_results = + IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData home_icon = + IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData operations = + IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData out_patient = + IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData patient = + IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr_code = + IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData radiology = + IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referral = + IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData search_patient = + IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData mail = + IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData medicine_search = + IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData referred = + IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData sync_icon = + IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData drawer_icon = + IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData leaves = + IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b6bbc6cf..20f22382 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/core/viewModel/hospital_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/my-referral-patient-screen.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -184,7 +185,9 @@ class _DashboardScreenState extends State { ), Container( color: Colors.white, - height: this.isExpanded ? 150 : 110, + height: this.isExpanded + ? MediaQuery.of(context).size.height * 0.19 + : MediaQuery.of(context).size.height * 0.12, ), ], ), @@ -953,6 +956,40 @@ class _DashboardScreenState extends State { SizedBox( height: 20, ), + Row( + children: [ + DashboardItem( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Icon( + DoctorApp.leaves, + size: 50, + ), + AppText( + TranslationBase.of(context).rescheduleLeaves, + color: Colors.black, + textAlign: TextAlign.center, + ) + ], + ), + hasBorder: true, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + AddRescheduleLeavScreen(), + // MyReferredPatient(), + ), + ); + }, + ) + ], + ), + SizedBox( + height: 20, + ), ], ), ), diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 3ca6c9b3..1ffd7150 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/models/patient/PatientArrivalEntity.dart'; @@ -34,7 +35,6 @@ class _PatientMakeReferralScreenState extends State { dynamic _selectedDoctor; DateTime appointmentDate; final _remarksController = TextEditingController(); - PatientArrivalEntity _selectedPatientArrivalEntity; @override void initState() { @@ -55,7 +55,7 @@ class _PatientMakeReferralScreenState extends State { final screenSize = MediaQuery.of(context).size; return BaseView( - onModelReady: (model) => model.getBranches(), + onModelReady: (model) => model.getMasterLookup(MasterKeysService.physiotherapyGoals), builder: (_, model, w) => AppScaffold( baseViewModel: model, appBarTitle: TranslationBase.of(context).referPatient, @@ -284,8 +284,8 @@ class _PatientMakeReferralScreenState extends State { decoration: textFieldSelectorDecoration( TranslationBase.of(context) .chooseAppointment, - _selectedPatientArrivalEntity != null - ? "${TranslationBase.of(context).appointmentNo} ${_selectedPatientArrivalEntity.appointmentNo}" + appointmentDate != null + ? "${DateUtils.convertDateToFormat(appointmentDate, "yyyy-MM-dd")}" : null, true, suffixIcon: Icon( @@ -326,14 +326,14 @@ class _PatientMakeReferralScreenState extends State { title: TranslationBase.of(context).refer, color: HexColor("#B8382B"), onPressed: () { - if (_selectedPatientArrivalEntity == null || + if (appointmentDate == null || _selectedBranch == null || _selectedClinic == null || _selectedDoctor == null || _remarksController.text == null) return; model .makeReferral( - _selectedPatientArrivalEntity, + patient, appointmentDate.toIso8601String(), _selectedBranch['ID'], _selectedClinic['ClinicID'], @@ -362,8 +362,10 @@ class _PatientMakeReferralScreenState extends State { initialEntryMode: DatePickerEntryMode.calendar, ); if (picked != null && picked != appointmentDate) { - appointmentDate = picked; - model + setState(() { + appointmentDate = picked; + }); + /* model .getPatientArrivalList(DateUtils.convertStringToDateFormat( appointmentDate.toString(), "yyyy-MM-dd")) .then((_) { @@ -409,7 +411,7 @@ class _PatientMakeReferralScreenState extends State { DrAppToastMsg.showErrorToast( TranslationBase.of(context).noAppointmentsErrorMsg); } - }); + });*/ } } diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index ce58776d..e3ed71a9 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -29,303 +30,341 @@ void addPrescriptionForm(context, PrescriptionViewModel model) { TextEditingController doseController = TextEditingController(); final GlobalKey formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; + showModalBottomSheet( isScrollControlled: true, context: context, builder: (BuildContext bc) { - return DraggableScrollableSheet( - initialChildSize: 0.90, - maxChildSize: 0.90, - minChildSize: 0.9, - builder: (BuildContext context, ScrollController scrollController) { - return SingleChildScrollView( - child: Container( - height: 980, - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - //mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - AppText( - TranslationBase.of(context).medicines.toUpperCase(), - fontWeight: FontWeight.w900, - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - child: Form( - key: formKey, - child: Column( - //mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context) - .searchMedicine, - controller: drugIdController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: spaceBetweenTextFileds, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).orderType, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).strength, - keyboardType: TextInputType.number, - controller: strengthController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: TranslationBase.of(context).route, - controller: routeController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).frequency, - controller: frequencyController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).doseTime, - controller: doseController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).indication, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).fromDate, - keyboardType: TextInputType.datetime, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).duration, - // borderColor: Colors.white, - keyboardType: TextInputType.number, - controller: durationController, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.all( - Radius.circular(6.0)), - border: Border.all( - width: 1.0, - color: HexColor("#CCCCCC"))), - child: TextFields( - hintText: - TranslationBase.of(context).instruction, - controller: indicationController, - keyboardType: TextInputType.number, - validator: (value) { - if (value.isEmpty) - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }, - ), - ), - SizedBox(height: spaceBetweenTextFileds), - Container( - margin: EdgeInsets.all( - SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: TranslationBase.of(context) - .addMedication, - onPressed: () { - formKey.currentState.save(); + return BaseView( + onModelReady: (model) => model.getDrugs(), + builder: (BuildContext context, PrescriptionViewModel model, + Widget child) => + DraggableScrollableSheet( + initialChildSize: 0.90, + maxChildSize: 0.90, + minChildSize: 0.9, + builder: (BuildContext context, + ScrollController scrollController) { + return SingleChildScrollView( + child: Container( + height: 980, + child: Padding( + padding: EdgeInsets.symmetric( + horizontal: 12.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + //mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + AppText( + TranslationBase.of(context) + .medicines + .toUpperCase(), + fontWeight: FontWeight.w900, + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + child: Form( + key: formKey, + child: Column( + //mainAxisAlignment: MainAxisAlignment.end, + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context) + .searchMedicine, + controller: drugIdController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of( + context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: spaceBetweenTextFileds, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .orderType, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .strength, + keyboardType: TextInputType.number, + controller: strengthController, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context).route, + controller: routeController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .frequency, + controller: frequencyController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .doseTime, + controller: doseController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .indication, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .fromDate, + keyboardType: TextInputType.datetime, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: + TranslationBase.of(context) + .duration, + // borderColor: Colors.white, + keyboardType: TextInputType.number, + controller: durationController, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of( + context) + .emptyMessage; + else + return null; + }), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + child: TextFields( + hintText: TranslationBase.of(context) + .instruction, + controller: indicationController, + keyboardType: TextInputType.number, + validator: (value) { + if (value.isEmpty) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }, + ), + ), + SizedBox(height: spaceBetweenTextFileds), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: TranslationBase.of(context) + .addMedication, + onPressed: () { + formKey.currentState.save(); - if (formKey.currentState.validate()) { - postProcedure( - model: model, - duration: durationController.text, - dose: doseController.text, - frequency: - frequencyController.text, - route: routeController.text, - drugId: drugIdController.text, - strength: strengthController.text, - indication: - indicationController.text, - instruction: - indicationController.text, - ); - Navigator.pop(context); - } - { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // NewPrescriptionScreen()), - // ); - } - }, + if (formKey.currentState + .validate()) { + postProcedure( + model: model, + duration: + durationController.text, + dose: doseController.text, + frequency: + frequencyController + .text, + route: routeController.text, + drugId: + drugIdController.text, + strength: + strengthController.text, + indication: + indicationController + .text, + instruction: + indicationController + .text, + ); + Navigator.pop(context); + } + { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => + // NewPrescriptionScreen()), + // ); + } + }, + ), + ], + ), ), ], ), ), - ], - ), + ), + ], ), ), - ], - ), - ), - ), - ); - }); + ), + ); + }), + ); }); } +// openAllergiesList(BuildContext context) { +// showModalBottomSheet( +// backgroundColor: Colors.white, +// isScrollControlled: true, +// context: context, +// builder: (context) { +// return AddAllergies( +// addAllergiesFun: (MySelectedAllergy mySelectedAllergy) { +// setState(() { +// widget.myAllergiesList.add(mySelectedAllergy); +// Navigator.of(context).pop(); +// }); +// }, +// ); +// }); +// } + postProcedure( {String duration, String dose, diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 8116f005..c0afe663 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -420,7 +420,7 @@ class _ProcedureScreenState extends State { } } -postProcedure({ProcedureViewModel model}) async { +postProcedure({ProcedureViewModel model, String remarks}) async { PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); @@ -433,10 +433,10 @@ postProcedure({ProcedureViewModel model}) async { 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxNDg1IiwianRpIjoiZjQ4YTk0OTQtYTczZS00MDI3LWI2MjgtNzc4MjAwMzUyYWEzIiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMTQ4NSIsIk5hbWUiOiJTSEFLRVJBIFBBUlZFRU4gKFVTRUQgQlkgRVNFUlZJQ0VTKSIsIkVtcGxveWVlSWQiOiIxNDg1IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiIxNDg1IiwiU0VTU0lPTklEIjoiMjE1ODUyMTAiLCJDbGluaWNJZCI6IjMiLCJyb2xlIjoiRE9DVE9SUyIsIm5iZiI6MTYwODM2NDU2OCwiZXhwIjoxNjA5MjI4NTY4LCJpYXQiOjE2MDgzNjQ1Njh9.YLbvq5nxPn8o9ZYkcbc5YAX7Jy23Mm0s33oRmE8GHDI'; controls.add( - Controls(code: 'Remarks', controlValue: 'Testing'), + Controls(code: remarks.isEmpty ? '' : remarks, controlValue: 'sssssssss'), ); controlsProcedure.add( - Procedures(category: "02", procedure: "02011002", controls: controls)); + Procedures(category: "02", procedure: "02011009", controls: controls)); postProcedureReqModel.procedures = controlsProcedure; await model.postProcedure(postProcedureReqModel); @@ -448,7 +448,8 @@ postProcedure({ProcedureViewModel model}) async { } } -updateProcedure({ProcedureViewModel model, String remarks}) async { +updateProcedure( + {ProcedureViewModel model, String remarks, String procedureId}) async { PostProcedureReqModel updateProcedureReqModel = new PostProcedureReqModel(); List controls = List(); List controlsProcedure = List(); @@ -500,6 +501,7 @@ class AddSelectedProcedure extends StatefulWidget { class _AddSelectedProcedureState extends State { TextEditingController procedureController = TextEditingController(); + TextEditingController remarksController = TextEditingController(); List entityList = List(); @override Widget build(BuildContext context) { @@ -559,6 +561,7 @@ class _AddSelectedProcedureState extends State { ), TextFields( hintText: 'Remarks', + controller: remarksController, minLines: 3, maxLines: 5, ), @@ -574,7 +577,9 @@ class _AddSelectedProcedureState extends State { title: 'add Selected Procedures'.toUpperCase(), onPressed: () { Navigator.pop(context); - postProcedure(model: widget.model); + postProcedure( + model: widget.model, + remarks: remarksController.text); }, ), ], diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart new file mode 100644 index 00000000..a4739247 --- /dev/null +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -0,0 +1,292 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/leave_rechdule_response.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/reschedule-leaves/reschedule_leave.dart'; +import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class AddRescheduleLeavScreen extends StatelessWidget { + ProjectViewModel projectsProvider; + @override + Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + return BaseView( + onModelReady: (model) => + {model.getRescheduleLeave(), model.getCoveringDoctors()}, + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).rescheduleLeaves, + body: model.getReschduleLeave.length > 0 + ? SingleChildScrollView( + child: Column( + children: [ + Container( + margin: + EdgeInsets.only(left: 15, right: 15, top: 20), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: + TranslationBase.of(context).requestLeave, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons.add_circle, + color: Colors.red, + )), + textInputType: TextInputType.text, + onTap: () { + openLeave( + context, + false, + ); + }, + inputFormatter: ONLY_LETTERS, + ) + ], + ), + ), + Column( + children: model.getReschduleLeave.map( + (GetRescheduleLeavesResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: + EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase + .of(context) + .approved + : item.status == 2 + ? TranslationBase.of( + context) + .pending + : TranslationBase.of( + context) + .rejected, + fontWeight: + FontWeight.bold, + color: Colors.white, + ), + color: item.status == 1 + ? Colors.green + : item.status == 2 + ? Colors + .yellow[800] + : Colors.red[800], + ), + SizedBox( + height: 5, + ), + Container( + child: AppText( + TranslationBase.of( + context) + .holiday + + ' ', + fontWeight: + FontWeight.bold, + )), + Row( + children: [ + Flexible( + child: Text( + item.dateTimeFrom + + ' ' + + TranslationBase.of( + context) + .to + + ' ' + + item.dateTimeTo, + // overflow: + // TextOverflow.ellipsis, + )) + ], + ), + SizedBox( + height: 5, + ), + AppText( + TranslationBase.of( + context) + .coveringDoctor, + fontWeight: + FontWeight.bold, + ), + model.coveringDoctors + .length > + 0 + ? Row(children: [ + AppText(getDoctor( + model + .coveringDoctors, + item.doctorId)) + ]) + : SizedBox(), + AppText( + TranslationBase.of( + context) + .reasons, + fontWeight: + FontWeight.bold, + ), + model.allReasons.length > 0 + ? Row(children: [ + AppText(getReasons( + model + .allReasons, + item.reasonId)) + ]) + : SizedBox(), + ], + ), + SizedBox( + width: 10, + ), + ], + ), + ), + (item.status == 1) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.edit_outlined, + size: 30, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + openLeave(context, true, + extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 10, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ) + ], + ), + ) + : new Builder(builder: (context) { + return Center( + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: Border.all( + color: HexColor('#B8382C'), width: 4), + borderRadius: + BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openLeave( + context, + false, + ); + }), + ), + Padding( + child: AppText( + TranslationBase.of(context).noReScheduleLeave, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), + ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) + ], + ), + )); + }), + )); + } + + openLeave(BuildContext context, isExtend, {extendedData}) { + showModalBottomSheet( + context: context, + builder: (context) { + return new Container( + child: RescheduleLeaveScreen( + isExtend, + extendedData, + )); + }); + } + + getDoctor(model, doctorId) { + var obj; + obj = model.where((i) => i['doctorID'] == doctorId).toList(); + print(obj); + + return obj.length > 0 ? obj[0]['doctorName'] : ""; + } + + getReasons(model, reasonID) { + var obj; + obj = model.where((i) => i['id'] == reasonID).toList(); + print(obj); + + return obj.length > 0 + ? projectsProvider.isArabic == true + ? obj[0]['nameAr'] + : obj[0]['nameEn'] + : ""; + } +} diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart new file mode 100644 index 00000000..c74395a3 --- /dev/null +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -0,0 +1,819 @@ +import 'package:date_time_picker/date_time_picker.dart'; +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; +import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; +import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; +import 'package:doctor_app_flutter/util/text_validator.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/Text.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:intl/intl.dart'; +import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; +import 'package:provider/provider.dart'; + +Helpers helpers = Helpers(); + +class RescheduleLeaveScreen extends StatefulWidget { + final isUpdate; + final updateData; + RescheduleLeaveScreen(this.isUpdate, this.updateData); + @override + _RescheduleLeaveScreen createState() => _RescheduleLeaveScreen(); +} + +class _RescheduleLeaveScreen extends State { + DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); + TextEditingController _toDateController = new TextEditingController(); + TextEditingController _toDateController2 = new TextEditingController(); + ProjectViewModel projectsProvider; + String _selectedClinic; + Map profile = {}; + var offTime = '2'; + var date; + var doctorID; + var reason; + var fromDate; + var toDate; + var clinicID; + TextEditingController _controller4; + void _presentDatePicker(id) { + showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime.now(), + lastDate: DateTime(2050), + ).then((pickedDate) { + if (pickedDate == null) { + return; + } + setState(() { + final df = new DateFormat('yyyy-MM-dd'); + if (id == 'fromDate') { + fromDate = pickedDate; //df.format(); + _toDateController.text = df.format(pickedDate); + } else { + toDate = pickedDate; // + _toDateController2.text = df.format(pickedDate); + } + }); + }); + } + + @override + void initState() { + getProfile(); + + super.initState(); + } + + @override + Widget build(BuildContext context) { + projectsProvider = Provider.of(context); + return BaseView( + onModelReady: (model) => model.getClinicsList(), + builder: (_, model, w) => BaseView( + onModelReady: (model2) => { + model2.getOffTime(), + model2.getReasons(18), + model2.getCoveringDoctors() + }, + builder: (_, model2, w) => AppScaffold( + baseViewModel: model2, + isShowAppBar: false, + body: Center( + child: Container( + margin: EdgeInsets.only(top: 10), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + Expanded( + // add Expanded to have your dropdown button fill remaining space + child: DropdownButtonHideUnderline( + child: new IgnorePointer( + ignoring: true, + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: getClinicName( + model) ?? + "", + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext + context) { + return model + .getClinicNameList() + .map((item) { + return Row( + mainAxisSize: + MainAxisSize + .max, + children: [ + AppText( + item, + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => + {}, + items: model + .getClinicNameList() + .map((item) { + return DropdownMenuItem( + value: + item.toString(), + child: Text( + item, + textAlign: + TextAlign.end, + ), + ); + }).toList(), + ))), + ), + ], + ) + ], + ), + )), + + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + new IgnorePointer( + ignoring: true, + child: AppTextFormField( + readOnly: true, + hintText: profile != null + ? profile['DoctorName'] + : "", + borderColor: Colors.white, + onSaved: (value) {}, + inputFormatter: ONLY_NUMBERS)) + ], + ), + ), + + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allOffTime.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: offTime == null + ? model2.allOffTime[0] + ['code'] + : offTime, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model2.allOffTime + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + item[ + 'description'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + offTime = newValue; + }), + if (offTime == '1') + {model2.getReasons(18)} + else if (offTime == '2') + {model2.getReasons(19)} + else if (offTime == '3' || + offTime == '5') + {model2.getReasons(102)} + }, + items: model2.allOffTime + .map((item) { + return DropdownMenuItem< + String>( + value: item['code'] + .toString(), + child: Text( + item['description'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + offTime == '1' + ? Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + fromDate = value; + }), + ], + )), + Row( + children: [ + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + // new AppTextFormField( + // readOnly: true, + // hintText: "", + // borderColor: Colors.white, + // onSaved: (value) {}, + // inputFormatter: ONLY_NUMBERS), + + DateTimePicker( + type: + DateTimePickerType.time, + controller: _controller4, + //initialValue: _initialValue, + // icon: Icon(Icons.access_time), + + //use24HourFormat: false, + //locale: Locale('en', 'US'), + onChanged: (val) => () { + print(val); + }, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => {}, + ) + ], + ), + ), + ), + Expanded( + child: Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: + HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + DateTimePicker( + type: + DateTimePickerType.time, + controller: _controller4, + //initialValue: _initialValue, + // icon: Icon(Icons.access_time), + + //use24HourFormat: false, + //locale: Locale('en', 'US'), + onChanged: (val) => () { + print(val); + }, + validator: (val) { + print(val); + // setState( + // () => _valueToValidate4 = val); + return null; + }, + onSaved: (val) => + {print(val)}, + ) + ], + ), + ), + ) + ], + ) + ], + ) + : Column( + children: [ + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase.of( + context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon(Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: _toDateController, + onTap: () { + _presentDatePicker( + 'fromDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all( + Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + padding: EdgeInsets.all(5), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppTextFormField( + hintText: TranslationBase + .of(context) + .fromDate, + borderColor: Colors.white, + prefix: IconButton( + icon: Icon( + Icons + .calendar_today)), + textInputType: + TextInputType.number, + controller: + _toDateController2, + onTap: () { + _presentDatePicker( + 'toDate'); + }, + inputFormatter: ONLY_DATE, + onChanged: (value) { + setState(() { + toDate = value; + }); + }), + ], + )) + ], + ), + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.allReasons.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: reason == null + ? model2.allReasons[0] + ['id'] + .toString() + : reason, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model2.allReasons + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'nameAr'] + : item[ + 'nameEn'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + reason = newValue; + }) + }, + items: model2.allReasons + .map((item) { + return DropdownMenuItem< + String>( + value: item['id'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item['nameAr'] + : item['nameEn'], + textAlign: + TextAlign.end, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + + Container( + margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, + color: HexColor("#CCCCCC"))), + width: double.infinity, + child: Padding( + padding: EdgeInsets.only( + top: SizeConfig.widthMultiplier * 0.9, + bottom: SizeConfig.widthMultiplier * 0.9, + right: SizeConfig.widthMultiplier * 3, + left: SizeConfig.widthMultiplier * 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + mainAxisSize: MainAxisSize.max, + children: [ + model2.coveringDoctors.length > 0 + ? Expanded( + // add Expanded to have your dropdown button fill remaining space + child: + DropdownButtonHideUnderline( + child: DropdownButton( + focusColor: Colors.grey, + isExpanded: true, + value: doctorID == null + ? model2 + .coveringDoctors[0] + ['doctorID'] + .toString() + : doctorID, + iconSize: 40, + elevation: 16, + selectedItemBuilder: + (BuildContext context) { + return model2 + .coveringDoctors + .map((item) { + return Row( + mainAxisSize: + MainAxisSize.max, + children: [ + AppText( + projectsProvider + .isArabic + ? item[ + 'doctorNameN'] + : item[ + 'doctorName'], + fontSize: SizeConfig + .textMultiplier * + 2.1, + color: + Colors.grey, + ), + ], + ); + }).toList(); + }, + onChanged: (newValue) => { + setState(() { + doctorID = newValue; + }) + }, + items: model2 + .coveringDoctors + .map((item) { + return DropdownMenuItem< + String>( + value: item['doctorID'] + .toString(), + child: Text( + projectsProvider + .isArabic + ? item[ + 'doctorNameN'] + : item[ + 'doctorName'], + textAlign: + TextAlign.start, + ), + ); + }).toList(), + )), + ) + : SizedBox(), + ], + ) + ], + ), + )), + Container( + margin: EdgeInsets.all( + SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: widget.isUpdate == true + ? TranslationBase.of(context).update + : TranslationBase.of(context).add, + onPressed: () { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } + }, + ), + ], + ), + ), + // Column( + // children: [ + // Texts(TranslationBase.of(context) + // .previousSickLeaveIssue + + // ' ') + // ], + // ) + ], + ), + ), + ), + ), + ))); + } + + getProfile() async { + Map p = await sharedPref.getObj(DOCTOR_PROFILE); + setState(() { + if (widget.updateData != null) { + this.profile = p; + this.clinicID = widget.updateData.clinicId; + + _toDateController.text = widget.updateData.dateTimeFrom; + _toDateController2.text = widget.updateData.dateTimeTo; + } + }); + } + + getClinicName(model) { + var clinicID = this.profile['ClinicID'] ?? 1; + var clinicInfo = + model.clinicsList.where((i) => i['ClinicID'] == clinicID).toList(); + return clinicInfo.length > 0 ? clinicInfo[0]['ClinicDescription'] : ""; + } + + addRecheduleLeave(model) { + final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + Map request = { + "Requisition": { + "requisitionNo": 0, + "requisitionType": offTime, + "clinicId": this.profile['ClinicID'], + "doctorId": this.profile['ClinicID'], + "dateTimeFrom": df.format(fromDate), + "dateTimeTo": df.format(toDate), + "date": df.format(DateTime.now()), + "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "status": 2, + "schedule": [ + { + "weekDayId": 1, + "shiftId": 1, + "isOpen": true, + "timeFrom": null, + "timeTo": null, + "timeFromstr": "", + "timeTostr": "" + } + ] + } + }; + + model.addReschedule(request).then((response) { + print(response); + }); + } + + updateRecheduleLeave(model) { + final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + Map request = { + "Requisition": { + "requisitionNo": 0, + "requisitionType": offTime, + "clinicId": this.profile['ClinicID'], + "doctorId": this.profile['ClinicID'], + "dateTimeFrom": df.format(fromDate), + "dateTimeTo": df.format(toDate), + "date": df.format(DateTime.now()), + "reasonId": reason == null ? model.allOffTime[0]['code'] : reason, + "coveringDoctorId": + doctorID == null ? model.coveringDoctors[0]['doctorID'] : doctorID, + "status": 2, + "schedule": [ + { + "weekDayId": 1, + "shiftId": 1, + "isOpen": true, + "timeFrom": null, + "timeTo": null, + "timeFromstr": "", + "timeTostr": "" + } + ] + } + }; + + model.updateReschedule(request).then((response) { + print(response); + }); + } +} diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index 37bf9454..d456f2a6 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -2,10 +2,12 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/sickleave/get_all_sickleave_response.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/sick-leave/sick_leave.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; @@ -13,166 +15,167 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; class AddSickLeavScreen extends StatelessWidget { + PatiantInformtion patient; @override Widget build(BuildContext context) { + final routeArgs = ModalRoute.of(context).settings.arguments as Map; + patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getSickLeave(), + onModelReady: (model) => model.getSickLeave(patient.patientMRN), builder: (_, model, w) => AppScaffold( - baseViewModel: model, - appBarTitle: TranslationBase.of(context).sickleave, - body: model.getAllSIckLeave.length > 0 - ? SingleChildScrollView( - child: Column( - children: model.getAllSIckLeave - .map((GetAllSickLeaveResponse item) { - return CardWithBgWidgetNew( - widget: Column( - children: [ - Container( - padding: EdgeInsets.only(left: 10, right: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Expanded( - flex: 4, - child: Wrap( - // mainAxisAlignment: - // MainAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.all(3), - child: AppText( - item.status == 1 - ? TranslationBase.of( - context) - .approved - : item.status == 2 - ? TranslationBase - .of(context) - .extended - : TranslationBase - .of(context) - .pending, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - color: item.status == 1 - ? Colors.green - : Colors.yellow[800], - ), - Row( - children: [ - AppText( - TranslationBase.of( - context) - .leaveStartDate + - ' ', - fontWeight: - FontWeight.bold, - ), - Flexible( - child: Text( - item.startDate, - overflow: - TextOverflow.ellipsis, - )) - ], - ), - AppText( - item.noOfDays.toString() + - ' ' + - TranslationBase.of( + baseViewModel: model, + appBarTitle: TranslationBase.of(context).sickleave, + body: SingleChildScrollView( + child: Column(children: [ + PatientPageHeaderWidget(patient), + model.getAllSIckLeave.length > 0 + ? Column( + children: model.getAllSIckLeave + .map((GetAllSickLeaveResponse item) { + return CardWithBgWidgetNew( + widget: Column( + children: [ + Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Expanded( + flex: 4, + child: Wrap( + // mainAxisAlignment: + // MainAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.all(3), + child: AppText( + item.status == 1 + ? TranslationBase.of( context) - .daysSickleave, + .approved + : item.status == 2 + ? TranslationBase.of( + context) + .extended + : TranslationBase.of( + context) + .pending, fontWeight: FontWeight.bold, + color: Colors.white, ), - Row(children: [ + color: item.status == 1 + ? Colors.green + : Colors.yellow[800], + ), + Row( + children: [ AppText( - item.remarks, - ) - ]), - ], - ), - SizedBox( - width: 20, - ), - ], - ), + TranslationBase.of(context) + .leaveStartDate + + ' ', + fontWeight: FontWeight.bold, + ), + Flexible( + child: Text( + item.startDate, + overflow: + TextOverflow.ellipsis, + )) + ], + ), + AppText( + item.noOfDays.toString() + + ' ' + + TranslationBase.of(context) + .daysSickleave, + fontWeight: FontWeight.bold, + ), + Row(children: [ + AppText( + item.remarks, + ) + ]), + ], + ), + SizedBox( + width: 20, + ), + ], ), - (item.status == 1 || item.status == 2) - ? Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.open_in_full, - size: 40, - ), - // color: Colors.green, //Colors.black, - onPressed: () => { - openSickLeave(context, true, - extendedData: item) - }, - )) - : SizedBox(), - ], - )), - SizedBox( - height: 20, + ), + (item.status == 1 || item.status == 2) + ? Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.open_in_full, + size: 25, + ), + // color: Colors.green, //Colors.black, + onPressed: () => { + openSickLeave(context, true, + extendedData: item) + }, + )) + : SizedBox(), + ], + )), + SizedBox( + height: 20, + ), + Divider( + height: 1, + ), + ], + )); + }).toList(), + ) + : new Builder(builder: (context) { + return Container( + height: MediaQuery.of(context).size.height * .7, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.all(40), + decoration: BoxDecoration( + border: Border.all( + color: HexColor('#B8382C'), width: 4), + borderRadius: + BorderRadius.all(Radius.circular(100))), + child: IconButton( + icon: Icon( + Icons.add, + size: 35, + ), + onPressed: () { + openSickLeave( + context, + false, + ); + }), ), - Divider( - height: 1, + Padding( + child: AppText( + TranslationBase.of(context) + .noSickLeaveApplied, + fontWeight: FontWeight.bold, + ), + padding: EdgeInsets.all(10), ), + AppText( + TranslationBase.of(context).applyNow, + fontWeight: FontWeight.bold, + color: HexColor('#B8382C'), + ) ], )); - }).toList(), - ), - ) - : new Builder(builder: (context) { - return Center( - child: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: EdgeInsets.all(40), - decoration: BoxDecoration( - border: Border.all( - color: HexColor('#B8382C'), width: 4), - borderRadius: - BorderRadius.all(Radius.circular(100))), - child: IconButton( - icon: Icon( - Icons.add, - size: 35, - ), - onPressed: () { - openSickLeave( - context, - false, - ); - }), - ), - Padding( - child: AppText( - TranslationBase.of(context).noSickLeaveApplied, - fontWeight: FontWeight.bold, - ), - padding: EdgeInsets.all(10), - ), - AppText( - TranslationBase.of(context).applyNow, - fontWeight: FontWeight.bold, - color: HexColor('#B8382C'), - ) - ], - ), - )); }), - )); + ])))); } openSickLeave(BuildContext context, isExtend, @@ -182,11 +185,15 @@ class AddSickLeavScreen extends StatelessWidget { builder: (context) { return new Container( child: SickLeaveScreen( - appointmentNo: extendedData.appointmentNo, - patientMRN: extendedData.patientMRN, - isExtended: isExtend, - extendedData: extendedData, - )); + appointmentNo: isExtend == true + ? extendedData.appointmentNo + : patient.appointmentNo, //extendedData.appointmentNo, + patientMRN: isExtend == true + ? extendedData.patientMRN + : patient.patientMRN, + isExtended: isExtend, + extendedData: extendedData, + patient: patient)); }); } } diff --git a/lib/screens/sick-leave/sick_leave.dart b/lib/screens/sick-leave/sick_leave.dart index 026b7c19..2aea6f43 100644 --- a/lib/screens/sick-leave/sick_leave.dart +++ b/lib/screens/sick-leave/sick_leave.dart @@ -6,9 +6,11 @@ import 'package:doctor_app_flutter/core/viewModel/sick_leave_view_model.dart'; import 'package:doctor_app_flutter/models/sickleave/add_sickleave_request.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/text_validator.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-page-header-widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -28,11 +30,13 @@ class SickLeaveScreen extends StatefulWidget { final GetAllSickLeaveResponse extendedData; final appointmentNo; final patientMRN; + final patient; SickLeaveScreen( {this.appointmentNo, this.patientMRN, this.isExtended = false, - this.extendedData}); + this.extendedData, + this.patient}); @override _SickLeaveScreenState createState() => _SickLeaveScreenState(); } @@ -48,7 +52,7 @@ class _SickLeaveScreenState extends State { context: context, initialDate: DateTime.now(), firstDate: DateTime(2019), - lastDate: DateTime.now(), + lastDate: DateTime(2050), ).then((pickedDate) { if (pickedDate == null) { return; @@ -252,6 +256,7 @@ class _SickLeaveScreenState extends State { model2.sickLeaveStatistics[ 'recommendedSickLeaveDays'], fontWeight: FontWeight.bold, + textAlign: TextAlign.start, ), padding: EdgeInsets.all(10), ) @@ -339,9 +344,7 @@ class _SickLeaveScreenState extends State { print(value); }); } else { - model2 - .addSickLeave(addSickLeave) - .then((value) => print(value)); + _validateInputs(model2); } }, ), @@ -363,6 +366,27 @@ class _SickLeaveScreenState extends State { ))); } + void _validateInputs(model2) async { + try { + if (addSickLeave.noOfDays == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterNoOfDays); + } else if (addSickLeave.remarks == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterRemarks); + } else if (addSickLeave.startDate == null) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseEnterDate); + } else { + addSickLeave.patientMRN = widget.patient.patientMRN.toString(); + addSickLeave.appointmentNo = widget.patient.appointmentNo.toString(); + model2.addSickLeave(addSickLeave).then((value) => print(value)); + } + } catch (err) { + print(err); + } + } + getProfile() async { Map p = await sharedPref.getObj(DOCTOR_PROFILE); setState(() { diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 3b1950db..7070d252 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -388,90 +388,150 @@ class TranslationBase { String get indication => localizedValues['indication'][locale.languageCode]; String get duration => localizedValues['duration'][locale.languageCode]; String get instruction => localizedValues['instruction'][locale.languageCode]; + String get rescheduleLeaves => + localizedValues['reschedule-leave'][locale.languageCode]; String get addMedication => localizedValues['addMedication'][locale.languageCode]; String get route => localizedValues['route'][locale.languageCode]; + String get noReScheduleLeave => + localizedValues['no-reschedule-leave'][locale.languageCode]; String get weight => localizedValues['weight'][locale.languageCode]; String get kg => localizedValues['kg'][locale.languageCode]; String get height => localizedValues['height'][locale.languageCode]; String get cm => localizedValues['cm'][locale.languageCode]; - String get idealBodyWeight => localizedValues['idealBodyWeight'][locale.languageCode]; + String get idealBodyWeight => + localizedValues['idealBodyWeight'][locale.languageCode]; String get waistSize => localizedValues['waistSize'][locale.languageCode]; String get inch => localizedValues['inch'][locale.languageCode]; String get headCircum => localizedValues['headCircum'][locale.languageCode]; - String get leanBodyWeight => localizedValues['leanBodyWeight'][locale.languageCode]; - String get bodyMassIndex => localizedValues['bodyMassIndex'][locale.languageCode]; + String get leanBodyWeight => + localizedValues['leanBodyWeight'][locale.languageCode]; + String get bodyMassIndex => + localizedValues['bodyMassIndex'][locale.languageCode]; String get method => localizedValues['method'][locale.languageCode]; String get pulseBeats => localizedValues['pulseBeats'][locale.languageCode]; String get rhythm => localizedValues['rhythm'][locale.languageCode]; String get respBeats => localizedValues['respBeats'][locale.languageCode]; - String get patternOfRespiration => localizedValues['patternOfRespiration'][locale.languageCode]; - String get bloodPressureDiastoleAndSystole => localizedValues['bloodPressureDiastoleAndSystole'][locale.languageCode]; - String get cuffLocation => localizedValues['cuffLocation'][locale.languageCode]; + String get patternOfRespiration => + localizedValues['patternOfRespiration'][locale.languageCode]; + String get bloodPressureDiastoleAndSystole => + localizedValues['bloodPressureDiastoleAndSystole'][locale.languageCode]; + String get cuffLocation => + localizedValues['cuffLocation'][locale.languageCode]; String get cuffSize => localizedValues['cuffSize'][locale.languageCode]; - String get patientPosition => localizedValues['patientPosition'][locale.languageCode]; + String get patientPosition => + localizedValues['patientPosition'][locale.languageCode]; String get fio2 => localizedValues['fio2'][locale.languageCode]; String get sao2 => localizedValues['sao2'][locale.languageCode]; - String get painManagement => localizedValues['painManagement'][locale.languageCode]; + String get painManagement => + localizedValues['painManagement'][locale.languageCode]; + String get holiday => localizedValues['holiday'][locale.languageCode]; + String get to => localizedValues['to'][locale.languageCode]; + String get coveringDoctor => + localizedValues['coveringDoctor'][locale.languageCode]; + String get requestLeave => + localizedValues['requestLeave'][locale.languageCode]; + String get pleaseEnterDate => + localizedValues['pleaseEnterDate'][locale.languageCode]; + String get pleaseEnterNoOfDays => + localizedValues['pleaseEnterNoOfDays'][locale.languageCode]; + String get pleaseEnterRemarks => + localizedValues['pleaseEnterRemarks'][locale.languageCode]; + String get update => localizedValues['update'][locale.languageCode]; String get admission => localizedValues['admission'][locale.languageCode]; String get request => localizedValues['request'][locale.languageCode]; - String get admissionRequest => localizedValues['admissionRequest'][locale.languageCode]; - String get patientDetails => localizedValues['patientDetails'][locale.languageCode]; - String get specialityAndDoctorDetail => localizedValues['specialityAndDoctorDetail'][locale.languageCode]; - String get referringDate => localizedValues['referringDate'][locale.languageCode]; - String get referringDoctor => localizedValues['referringDoctor'][locale.languageCode]; - String get otherInformation => localizedValues['otherInformation'][locale.languageCode]; - String get expectedDays => localizedValues['expectedDays'][locale.languageCode]; - String get expectedAdmissionDate => localizedValues['expectedAdmissionDate'][locale.languageCode]; - String get emergencyAdmission => localizedValues['emergencyAdmission'][locale.languageCode]; - String get patientPregnant => localizedValues['patientPregnant'][locale.languageCode]; - String get treatmentLine => localizedValues['treatmentLine'][locale.languageCode]; + String get admissionRequest => + localizedValues['admissionRequest'][locale.languageCode]; + String get patientDetails => + localizedValues['patientDetails'][locale.languageCode]; + String get specialityAndDoctorDetail => + localizedValues['specialityAndDoctorDetail'][locale.languageCode]; + String get referringDate => + localizedValues['referringDate'][locale.languageCode]; + String get referringDoctor => + localizedValues['referringDoctor'][locale.languageCode]; + String get otherInformation => + localizedValues['otherInformation'][locale.languageCode]; + String get expectedDays => + localizedValues['expectedDays'][locale.languageCode]; + String get expectedAdmissionDate => + localizedValues['expectedAdmissionDate'][locale.languageCode]; + String get emergencyAdmission => + localizedValues['emergencyAdmission'][locale.languageCode]; + String get patientPregnant => + localizedValues['patientPregnant'][locale.languageCode]; + String get treatmentLine => + localizedValues['treatmentLine'][locale.languageCode]; String get ward => localizedValues['ward'][locale.languageCode]; - String get preAnesthesiaReferred => localizedValues['preAnesthesiaReferred'][locale.languageCode]; - String get admissionType => localizedValues['admissionType'][locale.languageCode]; + String get preAnesthesiaReferred => + localizedValues['preAnesthesiaReferred'][locale.languageCode]; + String get admissionType => + localizedValues['admissionType'][locale.languageCode]; String get diagnosis => localizedValues['diagnosis'][locale.languageCode]; String get allergies => localizedValues['allergies'][locale.languageCode]; - String get preOperativeOrders => localizedValues['preOperativeOrders'][locale.languageCode]; - String get elementForImprovement => localizedValues['elementForImprovement'][locale.languageCode]; - String get dischargeDate => localizedValues['dischargeDate'][locale.languageCode]; + String get preOperativeOrders => + localizedValues['preOperativeOrders'][locale.languageCode]; + String get elementForImprovement => + localizedValues['elementForImprovement'][locale.languageCode]; + String get dischargeDate => + localizedValues['dischargeDate'][locale.languageCode]; String get dietType => localizedValues['dietType'][locale.languageCode]; - String get dietTypeRemarks => localizedValues['dietTypeRemarks'][locale.languageCode]; + String get dietTypeRemarks => + localizedValues['dietTypeRemarks'][locale.languageCode]; String get save => localizedValues['save'][locale.languageCode]; - String get postPlansEstimatedCost => localizedValues['postPlansEstimatedCost'][locale.languageCode]; + String get postPlansEstimatedCost => + localizedValues['postPlansEstimatedCost'][locale.languageCode]; String get ucaf => localizedValues['ucaf'][locale.languageCode]; - String get emergencyCase => localizedValues['emergencyCase'][locale.languageCode]; - String get durationOfIllness => localizedValues['durationOfIllness'][locale.languageCode]; - String get chiefComplaintsAndSymptoms => localizedValues['chiefComplaintsAndSymptoms'][locale.languageCode]; - String get patientFeelsPainInHisBackAndCough => localizedValues['patientFeelsPainInHisBackAndCough'][locale.languageCode]; - String get additionalTextComplaints => localizedValues['additionalTextComplaints'][locale.languageCode]; - String get otherConditions => localizedValues['otherConditions'][locale.languageCode]; + String get emergencyCase => + localizedValues['emergencyCase'][locale.languageCode]; + String get durationOfIllness => + localizedValues['durationOfIllness'][locale.languageCode]; + String get chiefComplaintsAndSymptoms => + localizedValues['chiefComplaintsAndSymptoms'][locale.languageCode]; + String get patientFeelsPainInHisBackAndCough => + localizedValues['patientFeelsPainInHisBackAndCough'][locale.languageCode]; + String get additionalTextComplaints => + localizedValues['additionalTextComplaints'][locale.languageCode]; + String get otherConditions => + localizedValues['otherConditions'][locale.languageCode]; String get other => localizedValues['other'][locale.languageCode]; String get how => localizedValues['how'][locale.languageCode]; String get when => localizedValues['when'][locale.languageCode]; String get where => localizedValues['where'][locale.languageCode]; - String get specifyPossibleLineManagement => localizedValues['specifyPossibleLineManagement'][locale.languageCode]; - String get significantSigns => localizedValues['significantSigns'][locale.languageCode]; + String get specifyPossibleLineManagement => + localizedValues['specifyPossibleLineManagement'][locale.languageCode]; + String get significantSigns => + localizedValues['significantSigns'][locale.languageCode]; String get backAbdomen => localizedValues['backAbdomen'][locale.languageCode]; + String get reasons => localizedValues['reasons'][locale.languageCode]; String get createNew => localizedValues['createNew'][locale.languageCode]; - String get update => localizedValues['update'][locale.languageCode]; + String get episode => localizedValues['episode'][locale.languageCode]; String get medications => localizedValues['medications'][locale.languageCode]; String get procedures => localizedValues['procedures'][locale.languageCode]; - - String get chiefComplaints=> localizedValues['chiefComplaints'][locale.languageCode]; + String get chiefComplaints => + localizedValues['chiefComplaints'][locale.languageCode]; String get histories => localizedValues['histories'][locale.languageCode]; - String get allergiesSoap => localizedValues['allergiesSoap'][locale.languageCode]; - String get addChiefComplaints => localizedValues['addChiefComplaints'][locale.languageCode]; - String get historyOfPresentIllness => localizedValues['historyOfPresentIllness'][locale.languageCode]; + String get allergiesSoap => + localizedValues['allergiesSoap'][locale.languageCode]; + String get addChiefComplaints => + localizedValues['addChiefComplaints'][locale.languageCode]; + String get historyOfPresentIllness => + localizedValues['historyOfPresentIllness'][locale.languageCode]; String get requiredMsg => localizedValues['requiredMsg'][locale.languageCode]; String get addHistory => localizedValues['addHistory'][locale.languageCode]; - String get searchHistory => localizedValues['searchHistory'][locale.languageCode]; - String get addSelectedHistories => localizedValues['addSelectedHistories'][locale.languageCode]; - String get addAllergies => localizedValues['addAllergies'][locale.languageCode]; + String get searchHistory => + localizedValues['searchHistory'][locale.languageCode]; + String get addSelectedHistories => + localizedValues['addSelectedHistories'][locale.languageCode]; + String get addAllergies => + localizedValues['addAllergies'][locale.languageCode]; String get itemExist => localizedValues['itemExist'][locale.languageCode]; - String get selectAllergy => localizedValues['selectAllergy'][locale.languageCode]; - String get selectSeverity => localizedValues['selectSeverity'][locale.languageCode]; + String get selectAllergy => + localizedValues['selectAllergy'][locale.languageCode]; + String get selectSeverity => + localizedValues['selectSeverity'][locale.languageCode]; String get vitalSignEmptyMsg => localizedValues['vitalSignEmptyMsg'][locale.languageCode]; } diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart index 5d54dfa5..43f7bcdd 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart @@ -28,7 +28,6 @@ class UpdateAllergiesWidget extends StatefulWidget { } class _UpdateAllergiesWidgetState extends State { - TextEditingController remarkController = TextEditingController(); @override @@ -53,9 +52,7 @@ class _UpdateAllergiesWidgetState extends State { // controller: messageController, validator: (value) { if (value == null) - return TranslationBase - .of(context) - .emptyMessage; + return TranslationBase.of(context).emptyMessage; else return null; }), @@ -64,19 +61,15 @@ class _UpdateAllergiesWidgetState extends State { height: 20, ), Container( - margin: - EdgeInsets.only(left: 15, right: 15, top: 15), + margin: EdgeInsets.only(left: 15, right: 15, top: 15), child: Column( children: widget.myAllergiesList.map((selectedAllergy) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start,children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween,crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ Container( child: Expanded( @@ -169,9 +162,9 @@ class _AddAllergiesState extends State { TextEditingController remarkController = TextEditingController(); GlobalKey key = new GlobalKey>(); - - InputDecoration textFieldSelectorDecoration(String hintText, - String selectedText, bool isDropDown,{IconData icon}) { + InputDecoration textFieldSelectorDecoration( + String hintText, String selectedText, bool isDropDown, + {IconData icon}) { return InputDecoration( focusedBorder: OutlineInputBorder( borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), @@ -211,166 +204,166 @@ class _AddAllergiesState extends State { await model.getMasterLookup(MasterKeysService.AllergySeverity); } }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: SingleChildScrollView( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - SizedBox( - height: 16, - ), - AppText( - TranslationBase + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: SingleChildScrollView( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 16, + ), + AppText( + TranslationBase .of(context) .addAllergies, - fontWeight: FontWeight.bold, - fontSize: 16, - ), - SizedBox( - height: 16, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergiesList != null - ? () { - setState(() { - _selectedAllergy = null; - }); - } - : null, - child: _selectedAllergy==null? AutoCompleteTextField( - decoration: textFieldSelectorDecoration( - TranslationBase + fontWeight: FontWeight.bold, + fontSize: 16, + ), + SizedBox( + height: 16, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergiesList != null + ? () { + setState(() { + _selectedAllergy = null; + }); + } + : null, + child: _selectedAllergy == null + ? AutoCompleteTextField( + decoration: textFieldSelectorDecoration( + TranslationBase .of(context) .selectAllergy, - _selectedAllergy != null - ? _selectedAllergy.nameEn - : null, true, icon: EvaIcons.search), - itemSubmitted: (item) => - setState(() => _selectedAllergy = item), - key: key, - suggestions: model.allergiesList, - itemBuilder: (context, suggestion) => - new Padding( - child: Texts( - projectViewModel.isArabic ? suggestion - .nameAr : suggestion.nameEn), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.nameAr.toLowerCase().startsWith( - input.toLowerCase()) || - suggestion.nameEn.toLowerCase() - .startsWith(input.toLowerCase()), - ):TextField( - decoration: textFieldSelectorDecoration( - TranslationBase + _selectedAllergy != null + ? _selectedAllergy.nameEn + : null, + true, + icon: EvaIcons.search), + itemSubmitted: (item) => + setState(() => _selectedAllergy = item), + key: key, + suggestions: model.allergiesList, + itemBuilder: (context, suggestion) => + new Padding( + child: Texts( + projectViewModel.isArabic + ? suggestion.nameAr + : suggestion.nameEn), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.nameAr + .toLowerCase() + .startsWith(input.toLowerCase()) || + suggestion.nameEn + .toLowerCase() + .startsWith(input.toLowerCase()), + ) + : TextField( + decoration: textFieldSelectorDecoration( + TranslationBase .of(context) .selectAllergy, - _selectedAllergy != null - ? projectViewModel.isArabic?_selectedAllergy.nameAr: _selectedAllergy.nameEn - : null, true, icon: EvaIcons.search), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allergySeverityList != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.allergySeverityList, - okText: TranslationBase - .of(context) - .ok, - okFunction: (selectedValue) { - setState(() { - _selectedAllergySeverity = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - child: TextField( - decoration: textFieldSelectorDecoration( - TranslationBase + _selectedAllergy != null + ? projectViewModel.isArabic?_selectedAllergy.nameAr: _selectedAllergy.nameEn + : null, + true, + icon: EvaIcons.search), + enabled: false, + ), + ), + ), + SizedBox( + height: 10, + ), + Container( + height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allergySeverityList != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.allergySeverityList, + okText: TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedAllergySeverity = + selectedValue; + + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + child: TextField( + decoration: textFieldSelectorDecoration( + TranslationBase .of(context) .selectSeverity, - _selectedAllergySeverity != null - ? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn - : null, - true), - enabled: false, - ), - ), + _selectedAllergySeverity != null + ? projectViewModel.isArabic?_selectedAllergySeverity.nameAr:_selectedAllergySeverity.nameEn + : null, + true), + enabled: false, ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: TextFields( - hintText: TranslationBase.of(context).remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 10, - controller: remarkController, - validator: (value) { - if (value == null) - return TranslationBase - .of(context) - .emptyMessage; - else - return null; - }), - ), SizedBox( - height: 10, - ), - AppButton( - title: "Add".toUpperCase(), - onPressed: () { - MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( + ), + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: FontWeight.w600, + maxLines: 25, + minLines: 10, + controller: remarkController, + validator: (value) { + if (value == null) + return TranslationBase.of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + AppButton( + title: "Add".toUpperCase(), + onPressed: () { + MySelectedAllergy mySelectedAllergy = + new MySelectedAllergy( remark: remarkController.text, selectedAllergy: _selectedAllergy, - selectedAllergySeverity: _selectedAllergySeverity); - widget.addAllergiesFun(mySelectedAllergy); - }, - ), - ] - - ), - ), - ), - )), + selectedAllergySeverity: + _selectedAllergySeverity); + widget.addAllergiesFun(mySelectedAllergy); + }, + ), + ]), + ), + ), + )), ), ); } } - - - - - diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 4ff72904..808e09dc 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -35,9 +35,6 @@ class _AppDrawerState extends State { // _isInit = false; // } - - - @override Widget build(BuildContext context) { AuthViewModel authProvider = Provider.of(context); @@ -68,20 +65,24 @@ class _AppDrawerState extends State { ), ), SizedBox(height: 15), - CircleAvatar( - radius: SizeConfig.imageSizeMultiplier * 12, - backgroundImage: - NetworkImage(authProvider.doctorProfile.doctorImageURL), - backgroundColor: Colors.white, - ), - Padding( - padding: EdgeInsets.only(top: 10), - child: AppText( - authProvider.doctorProfile?.doctorName, - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: SizeConfig.textMultiplier * 2, - )), + authProvider.doctorProfile != null + ? CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + backgroundImage: NetworkImage( + authProvider.doctorProfile.doctorImageURL), + backgroundColor: Colors.white, + ) + : SizedBox(), + authProvider.doctorProfile != null + ? Padding( + padding: EdgeInsets.only(top: 10), + child: AppText( + authProvider.doctorProfile?.doctorName, + fontWeight: FontWeight.bold, + color: Colors.black, + fontSize: SizeConfig.textMultiplier * 2, + )) + : SizedBox(), AppText( "Director of medical records", //TODO: Make The Dr Title Dynamic and check overflow issue. fontWeight: FontWeight.normal, @@ -121,7 +122,9 @@ class _AppDrawerState extends State { ), InkWell( child: DrawerItem( - TranslationBase.of(context).qr+ TranslationBase.of(context).reader, DoctorApp.qr_code), + TranslationBase.of(context).qr + + TranslationBase.of(context).reader, + DoctorApp.qr_code), onTap: () { Navigator.pop(context); Navigator.of(context).pushNamed(QR_READER); diff --git a/pubspec.lock b/pubspec.lock index 61cc667f..67028733 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -260,6 +260,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.10" + date_time_picker: + dependency: "direct main" + description: + name: date_time_picker + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" device_info: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 91283a89..57ed4cbb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -62,6 +62,7 @@ dependencies: #Autocomplete TextField autocomplete_textfield: ^1.7.3 + date_time_picker: ^1.1.1 # Html html: ^0.14.0+4