diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index c1438159..e38db07c 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -96,8 +96,9 @@ class BaseAppClient { } else { var parsed = json.decode(response.body.toString()); if (!parsed['IsAuthenticated']) { - await helpers.logout(); - helpers.showErrorToast('Your session expired Please login agian'); + onFailure(getError(parsed), statusCode); + //await helpers.logout(); + //helpers.showErrorToast('Your session expired Please login agian'); } else if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 71929250..077bd7f5 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -587,9 +587,9 @@ const Map> localizedValues = { 'en': "There is no detail for this patient", 'ar': "لا توجد تفاصيل لهذا المريض" }, - 'allergicTO': {'en': "ALLERGIC TO ", 'ar':" حساس من" }, - 'normal': {'en': "Normal", 'ar':"عادي" }, - 'abnormal': {'en': "Abnormal", 'ar':" غير عادي" }, + 'allergicTO': {'en': "ALLERGIC TO ", 'ar': " حساس من"}, + 'normal': {'en': "Normal", 'ar': "عادي"}, + 'abnormal': {'en': "Abnormal", 'ar': " غير عادي"}, "systolic-lng": {"en": "Systolic", "ar": "الإنقباض"}, "diastolic-lng": {"en": "Diastolic", "ar": "الإنبساط"}, "mass": {"en": "Mass", "ar": "كتلة"}, @@ -620,19 +620,50 @@ const Map> localizedValues = { }, 'updateProcedure': {'en': "Update Procedure", 'ar': "تحديث العملية"}, 'orderProcedure': {'en': "order procedure", 'ar': "طلب العمليات"}, - 'nameOrICD': {'en': "Name or ICD", 'ar':"الاسم او  ICD" }, - 'dType': {'en': "Type", 'ar':"النوع" }, - 'addAssessmentDetails': {'en': "Add Assessment Details", 'ar':"أضف تفاصيل التقييم" }, - 'progressNoteSOAP': {'en': "Progress Note", 'ar':"ملاحظة التقدم" }, - 'addProgressNote': {'en': "Add Progress Note", 'ar':"أضف ملاحظة التقدم" }, - 'createdBy': {'en': "Created By :", 'ar':"أضيفت : " }, - 'editedBy': {'en': "Edited By :", 'ar':"عدلت : " }, - 'currentMedications': {'en': "Current Medications", 'ar':"الأدوية الحالية" }, - 'noItem': {'en': "No items exists in this list", 'ar':"لا توجد عناصر في هذه القائمة" }, - 'postUcafSuccessMsg': {'en': "UCAF request send successfully", 'ar':"تم ارسال طلب UCAF بنجاح" }, - 'vitalSignDetailEmpty': {'en': "There is no data for this vital sign", 'ar':"لا توجد بيانات لهذه العلامة الحيوية" }, - 'assessmentErrorMsg': {'en': "You have to add at least one assessment.", 'ar':"يجب عليك إضافة تقييم واحد على الأقل." }, - 'examinationErrorMsg': {'en': "You have to add at least one examination.", 'ar':"يجب عليك إضافة الفحص واحد على الأقل." }, - 'progressNoteErrorMsg': {'en': "You have to add progress Note.", 'ar':"يجب عليك إضافة ملاحظة التقدم." }, - 'chiefComplaintErrorMsg': {'en': "You have to add chief complaint fields correctly .", 'ar':"يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" }, + 'nameOrICD': {'en': "Name or ICD", 'ar': "الاسم او  ICD"}, + 'dType': {'en': "Type", 'ar': "النوع"}, + 'addAssessmentDetails': { + 'en': "Add Assessment Details", + 'ar': "أضف تفاصيل التقييم" + }, + 'progressNoteSOAP': {'en': "Progress Note", 'ar': "ملاحظة التقدم"}, + 'addProgressNote': {'en': "Add Progress Note", 'ar': "أضف ملاحظة التقدم"}, + 'createdBy': {'en': "Created By :", 'ar': "أضيفت : "}, + 'editedBy': {'en': "Edited By :", 'ar': "عدلت : "}, + 'currentMedications': {'en': "Current Medications", 'ar': "الأدوية الحالية"}, + 'noItem': { + 'en': "No items exists in this list", + 'ar': "لا توجد عناصر في هذه القائمة" + }, + 'postUcafSuccessMsg': { + 'en': "UCAF request send successfully", + 'ar': "تم ارسال طلب UCAF بنجاح" + }, + 'vitalSignDetailEmpty': { + 'en': "There is no data for this vital sign", + 'ar': "لا توجد بيانات لهذه العلامة الحيوية" + }, + 'onlyOfftimeHoliday': { + 'en': "You can only apply holiday or offtime from mobile app", + 'ar': "يمكنك فقط تطبيق عطلة أو إجازة من تطبيق الهاتف" + }, + 'active': {'en': "Active", 'ar': "نشيط"}, + 'hold': {'en': "Hold", 'ar': "معلق"}, + 'loading': {'en': "Loading...", 'ar': "جار التحميل..."}, + 'assessmentErrorMsg': { + 'en': "You have to add at least one assessment.", + 'ar': "يجب عليك إضافة تقييم واحد على الأقل." + }, + 'examinationErrorMsg': { + 'en': "You have to add at least one examination.", + 'ar': "يجب عليك إضافة الفحص واحد على الأقل." + }, + 'progressNoteErrorMsg': { + 'en': "You have to add progress Note.", + 'ar': "يجب عليك إضافة ملاحظة التقدم." + }, + 'chiefComplaintErrorMsg': { + 'en': "You have to add chief complaint fields correctly .", + 'ar': "يجب عليك إضافة حقول شكوى الرئيس بشكل صحيح" + }, }; diff --git a/lib/core/service/prescription_service.dart b/lib/core/service/prescription_service.dart index 35b5372e..0e52b16c 100644 --- a/lib/core/service/prescription_service.dart +++ b/lib/core/service/prescription_service.dart @@ -48,7 +48,9 @@ class PrescriptionService extends BaseService { }, body: _prescriptionReqModel.toJson()); } - Future getDrugs() async { + Future getDrugs({String drugName}) async { + _drugRequestModel = SearchDrugRequestModel(search: [drugName]); + hasError = false; await baseAppClient.post(SEARCH_DRUG, @@ -118,7 +120,60 @@ class PrescriptionService extends BaseService { List prescription) async { Map request = { "Prescription": { - "objPatientInfo": {"Gender": patient.gender, "Age": patient.age}, + "objPatientInfo": {"Gender": "Male", "Age": "21/06/1967"}, + "objVitalSign": {"Height": "180", "Weight": "37"}, + "objPrescriptionItems": [ + { + "DrugId": "83-20-00-30-20-03-03", + "DrugName": "WARFARIN 1 MG TAB 28'S (N)", + "Dose": "1", + "DoseType": "04", + "Unit": "actuation(s)", + "FrequencyType": "1/3/Day", + "Duration": "3/Day", + "IsScreen": "true" + }, + { + "DrugId": "64-20-00-10-00-03-15", + "DrugName": "PANADOL 500 MG TAB 24'S(DIS)", + "Dose": "1", + "DoseType": "04", + "Unit": "MG", + "FrequencyType": "3/1/Day", + "Duration": "4/Day", + "RouteID": "24", + "IsScreen": "true" + } + ], + "objAllergies": { + "Allergy": { + "objProperties": {"Id": "26", "Name": "phenoxymethylpenicillin"} + } + }, + "objDiagnosis": { + "Diagnosis": { + "objProperties": {"Id": "A01.1", "Name": "Paratyphoid fever A"} + } + }, + "IsDoctor": "false", + "IsPharmacist": "false" + }, + "IPAdress": "10.10.10.10", + "Channel": 9, + "LanguageID": 2, + "VersionID": 5.3, + "SessionID": "BlUSkYymTt", + "IsLoginForDoctorApp": true, + "PatientOutSA": 0, + "TokenID": "@dm!n", + "OutSA": true + }; + Map requestN = { + "Prescription": { + "objPatientInfo": { + "Gender": patient.gender == 1 ? 'Male' : 'Female', + "Age": patient.age + }, "objVitalSign": {"Height": vital.heightCm, "Weight": vital.weightKg}, "objPrescriptionItems": prescription[0].entityList, "objAllergies": allergy, diff --git a/lib/core/service/sickleave_service.dart b/lib/core/service/sickleave_service.dart index 63a7496c..15d77d5c 100644 --- a/lib/core/service/sickleave_service.dart +++ b/lib/core/service/sickleave_service.dart @@ -100,7 +100,7 @@ class SickLeaveService extends BaseService { hasError = true; super.error = error; }, - body: {'PatientMRN': patientMRN}, + body: {'PatientMRN': patientMRN, "Status": 0}, ); } diff --git a/lib/core/viewModel/prescription_view_model.dart b/lib/core/viewModel/prescription_view_model.dart index e7da4385..467a715c 100644 --- a/lib/core/viewModel/prescription_view_model.dart +++ b/lib/core/viewModel/prescription_view_model.dart @@ -61,11 +61,11 @@ class PrescriptionViewModel extends BaseViewModel { } } - Future getDrugs() async { + Future getDrugs({String drugName}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); - await _prescriptionService.getDrugs(); + setState(ViewState.BusyLocal); + await _prescriptionService.getDrugs(drugName: drugName); if (_prescriptionService.hasError) { error = _prescriptionService.error; setState(ViewState.ErrorLocal); diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 5e1d8d0c..fb84f505 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -68,7 +68,7 @@ class ProcedureViewModel extends BaseViewModel { } Future updateProcedure( - PostProcedureReqModel postProcedureReqModel, int mrn) async { + {PostProcedureReqModel postProcedureReqModel, int mrn}) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); diff --git a/lib/core/viewModel/project_view_model.dart b/lib/core/viewModel/project_view_model.dart index aed67d83..e144042e 100644 --- a/lib/core/viewModel/project_view_model.dart +++ b/lib/core/viewModel/project_view_model.dart @@ -114,18 +114,17 @@ class ProjectViewModel with ChangeNotifier { } void getProfile() async { - // Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - // DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); - // ProfileReqModel docInfo = new ProfileReqModel( - // doctorID: doctorProfile.doctorID, - // clinicID: doctorProfile.clinicID, - // license: true, - // projectID: doctorProfile.projectID, - // tokenID: '', - // languageID: 2); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); + ProfileReqModel docInfo = new ProfileReqModel( + doctorID: doctorProfile.doctorID, + clinicID: doctorProfile.clinicID, + license: true, + projectID: doctorProfile.projectID, + ); Provider.of(AppGlobal.CONTEX, listen: false) - .getDocProfiles(ProfileReqModel().toJson()) + .getDocProfiles(docInfo.toJson()) .then((res) async { sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]); }).catchError((err) { diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index f7c4b0a2..3547a73d 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -42,6 +42,7 @@ class PatiantInformtion { int patientMRN; String admissionNo; String admissionDate; + String createdOn; String roomId; String bedId; String nursingStationId; @@ -77,6 +78,7 @@ class PatiantInformtion { this.patientType, this.admissionNo, this.admissionDate, + this.createdOn, this.roomId, this.bedId, this.nursingStationId, @@ -129,6 +131,7 @@ class PatiantInformtion { patientType: json["PatientType"]?? json["patientType"], admissionNo: json["AdmissionNo"]?? json["admissionNo"], admissionDate: json["AdmissionDate"]?? json["admissionDate"], + createdOn: json["CreatedOn"]?? json["CreatedOn"], roomId: json["RoomID"]?? json["roomID"], bedId: json["BedID"]?? json["bedID"], nursingStationId: json["NursingStationID"]?? json["nursingStationID"], @@ -158,10 +161,4 @@ class PatiantInformtion { patientMRN :json['patientMRN'] ?? json['PatientMRN'], ); - - - - - - } diff --git a/lib/screens/auth/login_screen.dart b/lib/screens/auth/login_screen.dart index 1ed441e4..84121abf 100644 --- a/lib/screens/auth/login_screen.dart +++ b/lib/screens/auth/login_screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/core/viewModel/imei_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -120,18 +121,9 @@ class _LoginsreenState extends State { ), ], ) - - // : Column( - // crossAxisAlignment: - // CrossAxisAlignment.start, - // children: [ - // AuthHeader(loginType.unknownUser), - // KnownUserLogin(), - // ], - // ), ])) ]) - : Center(child: CircularProgressIndicator()), + : Center(child: AppLoaderWidget()), ), )); } diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 18ad7d8d..76f4e16e 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -116,7 +116,7 @@ class _DashboardScreenState extends State { IsLoginForDoctorApp: true, PatientOutSA: false); return BaseView( - //onModelReady: (model) => model.getDashboard(), + onModelReady: (model) => model.getDashboard(), builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: false, diff --git a/lib/screens/medical-file/medical_file_page.dart b/lib/screens/medical-file/medical_file_page.dart index 069dfbc2..54d978e3 100644 --- a/lib/screens/medical-file/medical_file_page.dart +++ b/lib/screens/medical-file/medical_file_page.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/medical-file/medical_file_details.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/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -34,57 +35,7 @@ class _MedicalFilePageState extends State { child: Container( child: Column( children: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Row( - children: [ - AvatarWidget( - Icon( - patient.genderDescription == "Male" - ? DoctorApp.male - : DoctorApp.female_icon, - size: 70, - color: Colors.white, - ), - ), - SizedBox( - width: 20, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - patient.firstName + ' ' + patient.lastName, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, - fontWeight: FontWeight.bold, - ), - SizedBox( - width: 5.0, - ), - AppText( - patient.age.toString(), - color: Colors.black, - fontWeight: FontWeight.normal, - ), - ], - ), - AppText( - "ALLERGIC TO: FOOD, ASPIRIN", - color: Color(0xFFB9382C), - fontWeight: FontWeight.bold, - ), - ], - ) - ], - ), - ), + PatientPageHeaderWidget(patient), Divider( height: 1.0, thickness: 1.0, diff --git a/lib/screens/prescription/add_prescription_form.dart b/lib/screens/prescription/add_prescription_form.dart index 7b7535d6..e93e1f3f 100644 --- a/lib/screens/prescription/add_prescription_form.dart +++ b/lib/screens/prescription/add_prescription_form.dart @@ -21,6 +21,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_buttons_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/dialogs/dailog-list-select.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -107,6 +108,12 @@ class _PrescriptionFormWidgetState extends State { TextEditingController drugIdController = TextEditingController(); TextEditingController doseController = TextEditingController(); + final searchController = TextEditingController(); + + var notesList; + var filteredNotesList; + String textSeartch = "Amoxicillin"; + final GlobalKey formKey = GlobalKey(); final double spaceBetweenTextFileds = 12; List referToList; @@ -165,6 +172,24 @@ class _PrescriptionFormWidgetState extends State { dynamic route7 = {"id": 27, "name": "In Both EYES"}; dynamic route8 = {"id": 28, "name": "In Both Ears"}; dynamic route9 = {"id": 32, "name": "Intramuscular"}; + dynamic route10 = {"id": 60, "name": "TRANSDERMAL"}; + dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"}; + dynamic route12 = {"id": 15, "name": "for INJECTION"}; + dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"}; + dynamic route14 = {"id": 57, "name": "NASOGASTRIC"}; + dynamic route15 = {"id": 56, "name": "IRRIGATION"}; + dynamic route16 = {"id": 55, "name": "INTRAVITREAL"}; + dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"}; + dynamic route18 = {"id": 51, "name": "EPIDURAL"}; + dynamic route19 = {"id": 47, "name": "Parenteral"}; + dynamic route20 = {"id": 43, "name": "IM"}; + dynamic route21 = {"id": 42, "name": "IV"}; + dynamic route22 = {"id": 41, "name": "Sublingual"}; + dynamic route23 = {"id": 40, "name": "For Nebulization"}; + dynamic route24 = {"id": 39, "name": "Nasal"}; + dynamic route25 = {"id": 37, "name": "Inserted into Vagina"}; + dynamic route26 = {"id": 36, "name": "Inserted into Rectum"}; + dynamic route27 = {"id": 31, "name": "In Each Nostril"}; dynamic frequency1 = {"id": 1, "name": "2 Times a day"}; dynamic frequency2 = {"id": 2, "name": "3 Times a day"}; dynamic frequency3 = {"id": 3, "name": "4 Times a day"}; @@ -258,6 +283,24 @@ class _PrescriptionFormWidgetState extends State { routeList.add(route7); routeList.add(route8); routeList.add(route9); + routeList.add(route10); + routeList.add(route11); + routeList.add(route12); + routeList.add(route13); + routeList.add(route14); + routeList.add(route15); + routeList.add(route16); + routeList.add(route17); + routeList.add(route18); + routeList.add(route19); + routeList.add(route20); + routeList.add(route21); + routeList.add(route22); + routeList.add(route23); + routeList.add(route24); + routeList.add(route25); + routeList.add(route26); + routeList.add(route27); strengthList.add(strength1); strengthList.add(strength2); strengthList.add(strength3); @@ -295,12 +338,13 @@ class _PrescriptionFormWidgetState extends State { @override Widget build(BuildContext context) { + ListSelectDialog drugDialog; final screenSize = MediaQuery.of(context).size; // final routeArgs = ModalRoute.of(context).settings.arguments as Map; // patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getDrugs(), + onModelReady: (model) => model.getDrugs(drugName: textSeartch), builder: (BuildContext context, PrescriptionViewModel model, Widget child) => NetworkBaseView( @@ -339,7 +383,7 @@ class _PrescriptionFormWidgetState extends State { onTap: model.drugsList != null && model.drugsList.length > 0 ? () { - ListSelectDialog dialog = + return drugDialog = ListSelectDialog( list: model.drugsList, attributeName: 'GenericName', @@ -352,17 +396,121 @@ class _PrescriptionFormWidgetState extends State { selectedDrug = selectedValue; }); }, + /* searchWidget: Row( + children: [ + Expanded( + child: TextField( + decoration: Helpers + .textFieldSelectorDecoration( + TranslationBase.of( + context) + .search, + searchController.text != + null && + searchController + .text != + "" + ? searchController + .text + : null, + false, + ), + onChanged: (String str) { + textSeartch = str; + }, + controller: + searchController, + enabled: true, + ), + ), + Container( + child: InkWell( + child: Icon( + Icons.search, + color: Colors.black, + ), + onTap: () async { + Navigator.of(context) + .pop(); + await searchMedicine( + context, + model, + textSeartch); + showDialog( + barrierDismissible: + false, + context: context, + builder: (BuildContext + context) { + return drugDialog; + }, + ); + }, + ), + margin: + EdgeInsets.symmetric( + horizontal: 8), + ) + ], + ),*/ ); showDialog( barrierDismissible: false, context: context, builder: (BuildContext context) { - return dialog; + return drugDialog; }, ); } : null, - child: TextField( + child: Row( + children: [ + Expanded( + child: TextField( + decoration: Helpers + .textFieldSelectorDecoration( + TranslationBase.of(context) + .search, + searchController.text != null && + searchController.text != + "" + ? searchController.text + : null, + false, + ), + onChanged: (String str) { + textSeartch = str; + }, + controller: searchController, + enabled: true, + ), + ), + Container( + child: InkWell( + child: Icon( + Icons.search, + color: Colors.black, + ), + onTap: () async { + // Navigator.of(context) + // .pop(); + await searchMedicine( + context, model, textSeartch); + showDialog( + barrierDismissible: false, + context: context, + builder: + (BuildContext context) { + return drugDialog; + }, + ); + }, + ), + margin: EdgeInsets.symmetric( + horizontal: 8), + ) + ], + ), /*TextField( decoration: textFieldSelectorDecoration( TranslationBase.of(context) .searchMedicine, @@ -374,8 +522,8 @@ class _PrescriptionFormWidgetState extends State { Icons.search, color: Colors.black, )), - enabled: false, - ), + enabled: true, + ),*/ ), ), SizedBox( @@ -808,9 +956,9 @@ class _PrescriptionFormWidgetState extends State { title: TranslationBase.of(context) .addMedication, onPressed: () { - formKey.currentState.save(); - Navigator.pop(context); - openDrugToDrug(); + // formKey.currentState.save(); + // Navigator.pop(context); + // openDrugToDrug(); if (strength == null || route == null || frequency == null || @@ -945,4 +1093,41 @@ class _PrescriptionFormWidgetState extends State { ); }); } + + // searchData(String str, PrescriptionViewModel model) { + // var strExist = str.length > 0 ? true : false; + // + // if (strExist) { + // filteredNotesList = null; + // filteredNotesList = model.drugsList + // .where((note) => + // note["GenericName"].toString().contains(str.toUpperCase())) + // .toList(); + // setState(() { + // notesList = filteredNotesList; + // }); + // } else { + // setState(() { + // notesList = model.drugsList; + // }); + // } + // } + + searchMedicine(context, PrescriptionViewModel model, String str) async { + FocusScope.of(context).unfocus(); + // if (searchController.text.isEmpty()) { + // helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); + // //"Type Medicine Name") + // return; + // } + if (searchController.text.length < 0) { + helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter); + return; + } + + GifLoaderDialogUtils.showMyDialog(context); + + await model.getDrugs(drugName: searchController.text); + GifLoaderDialogUtils.hideDialog(context); + } } diff --git a/lib/screens/prescription/prescription_screen.dart b/lib/screens/prescription/prescription_screen.dart index c1f00092..4d000838 100644 --- a/lib/screens/prescription/prescription_screen.dart +++ b/lib/screens/prescription/prescription_screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.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/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.dart'; @@ -337,7 +338,25 @@ class _NewPrescriptionScreenState extends State { child: Column( children: [ AppText( - '8\nDEC', + DateTime.parse(model + .prescriptionList[ + 0] + .entityList[ + index] + .startDate) + .day + .toString(), + color: Colors + .green, + ), + AppText( + Helpers.getMonth(model.prescriptionList[0].entityList[index].startDate != + null + ? (DateTime.parse(model.prescriptionList[0].entityList[index].startDate) + .month) + : DateTime.now() + .month) + .toUpperCase(), color: Colors .green, ) diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 667bcc6d..5483ffd9 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -11,6 +11,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_checkbox_search_widget.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/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -271,7 +272,36 @@ class _ProcedureScreenState extends State { child: Column( children: [ AppText( - '8\nDEC', + DateTime.parse(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate) + .day + .toString(), + color: + Colors.green, + ), + AppText( + Helpers.getMonth(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate != + null + ? (DateTime.parse(model + .procedureList[ + 0] + .entityList[ + index] + .orderDate) + .month) + : DateTime + .now() + .month) + .toUpperCase(), color: Colors.green, ) @@ -421,6 +451,8 @@ class _ProcedureScreenState extends State { child: Icon( Icons.edit), onTap: () { + // model + // .updateProcedure(); updateProcedureForm( context, remarks: model @@ -691,7 +723,8 @@ updateProcedure( category: categorieId, procedure: procedureId, controls: controls)); updateProcedureReqModel.procedures = controlsProcedure; - await model.updateProcedure(updateProcedureReqModel, patient.patientMRN); + await model.updateProcedure( + postProcedureReqModel: updateProcedureReqModel, mrn: patient.patientMRN); if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index 685259b4..b4ebecf4 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -210,7 +210,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { ], ), ), - (item.status == 1) + (item.status == 2) ? Expanded( flex: 1, child: IconButton( diff --git a/lib/screens/reschedule-leaves/reschedule_leave.dart b/lib/screens/reschedule-leaves/reschedule_leave.dart index 5d546c04..f0bf122f 100644 --- a/lib/screens/reschedule-leaves/reschedule_leave.dart +++ b/lib/screens/reschedule-leaves/reschedule_leave.dart @@ -54,8 +54,8 @@ class _RescheduleLeaveScreen extends State { var clinicID; var fromTime; var toTime; - TextEditingController _controller4; - TextEditingController _controller5; + TextEditingController _controller4 = new TextEditingController(); + TextEditingController _controller5 = new TextEditingController(); void _presentDatePicker(id) { var date = new DateTime.now(); var initialDate = id == 'fromDate' @@ -718,10 +718,16 @@ class _RescheduleLeaveScreen extends State { ? TranslationBase.of(context).update : TranslationBase.of(context).add, onPressed: () { - if (widget.isUpdate == true) { - updateRecheduleLeave(model2); + if (offTime == '1' || offTime == '2') { + if (widget.isUpdate == true) { + updateRecheduleLeave(model2); + } else { + addRecheduleLeave(model2); + } } else { - addRecheduleLeave(model2); + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .onlyOfftimeHoliday); } }, ), @@ -750,9 +756,21 @@ class _RescheduleLeaveScreen extends State { this.profile = p; if (widget.updateData != null) { this.clinicID = widget.updateData.clinicId; + final df = new DateFormat('HH:mm:ss'); + final dateFormat = new DateFormat('yyyy-MM-dd'); - _toDateController.text = widget.updateData.dateTimeFrom; - _toDateController2.text = widget.updateData.dateTimeTo; + _toDateController.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeFrom)); + //df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.fromTime = + df.format(DateTime.parse(widget.updateData.dateTimeFrom)); + this.toTime = df.format(DateTime.parse(widget.updateData.dateTimeTo)); + _toDateController2.text = + dateFormat.format(DateTime.parse(widget.updateData.dateTimeTo)); + _controller5.text = toTime; + _controller4.text = fromTime; + toDate = _toDateController2.text; + fromDate = _toDateController.text; } }); } @@ -827,20 +845,29 @@ class _RescheduleLeaveScreen extends State { } updateRecheduleLeave(model) { - final df = new DateFormat('yyyy-MM-ddThh:mm:ss'); + final df = new DateFormat('yyyy-MM-ddTHH:MM:ss'); final dateFormat = new DateFormat('yyyy-MM-dd'); - + var fromDates = fromDate; + var toDates = toDate; if (offTime == '1') { - fromDate = dateFormat.format(fromDate) + 'T' + fromTime + '00'; - toDate = dateFormat.format(fromDate) + 'T' + toTime + '00'; + fromDate = df.format(DateTime.parse(fromDates)) + + 'T' + + fromTime + + ':' + + DateTime.now().second.toString(); + toDate = df.format(DateTime.parse(fromDates)) + + 'T' + + toTime + + ':' + + DateTime.now().second.toString(); } else { - fromDate = df.format(fromDate); - toDate = df.format(toDate); + fromDate = df.format(fromDates); + toDate = df.format(toDates); } Map request = { "Requisition": { - "requisitionNo": 0, + "requisitionNo": widget.updateData.requisitionNo, "requisitionType": offTime, "clinicId": this.profile['ClinicID'], "doctorId": this.profile['DoctorID'], diff --git a/lib/screens/sick-leave/add-sickleave.dart b/lib/screens/sick-leave/add-sickleave.dart index d456f2a6..93353d85 100644 --- a/lib/screens/sick-leave/add-sickleave.dart +++ b/lib/screens/sick-leave/add-sickleave.dart @@ -56,20 +56,22 @@ class AddSickLeavScreen extends StatelessWidget { item.status == 1 ? TranslationBase.of( context) - .approved + .hold : item.status == 2 ? TranslationBase.of( context) - .extended + .active : TranslationBase.of( context) - .pending, + .all, fontWeight: FontWeight.bold, color: Colors.white, ), color: item.status == 1 - ? Colors.green - : Colors.yellow[800], + ? Colors.yellow[800] + : item.status == 2 + ? Colors.green + : Colors.black, ), Row( children: [ @@ -96,7 +98,7 @@ class AddSickLeavScreen extends StatelessWidget { ), Row(children: [ AppText( - item.remarks, + item.remarks ?? "", ) ]), ], diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index a7229ca2..07709fc9 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -317,7 +317,7 @@ class Helpers { listOfHours.forEach((element) { WorkingHours workingHours = WorkingHours(); var from = element.substring( - element.indexOf('m ') + 2, element.indexOf('To') - 2); + element.indexOf('m ') + 2, element.indexOf('To') - 1); workingHours.from = from.trim(); var to = element.substring(element.indexOf('To') + 2); workingHours.to = to.trim(); diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index b513b14b..2c3be5b1 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -997,11 +997,9 @@ class TranslationBase { String get orderProcedure => localizedValues['orderProcedure'][locale.languageCode]; - String get nameOrICD => - localizedValues['nameOrICD'][locale.languageCode]; + String get nameOrICD => localizedValues['nameOrICD'][locale.languageCode]; - String get dType => - localizedValues['dType'][locale.languageCode]; + String get dType => localizedValues['dType'][locale.languageCode]; String get addAssessmentDetails => localizedValues['addAssessmentDetails'][locale.languageCode]; @@ -1012,19 +1010,21 @@ class TranslationBase { String get addProgressNote => localizedValues['addProgressNote'][locale.languageCode]; - String get createdBy => - localizedValues['createdBy'][locale.languageCode]; + String get createdBy => localizedValues['createdBy'][locale.languageCode]; - String get editedBy => - localizedValues['editedBy'][locale.languageCode]; + String get editedBy => localizedValues['editedBy'][locale.languageCode]; String get currentMedications => localizedValues['currentMedications'][locale.languageCode]; - String get noItem => - localizedValues['noItem'][locale.languageCode]; + String get noItem => localizedValues['noItem'][locale.languageCode]; String get postUcafSuccessMsg => localizedValues['postUcafSuccessMsg'][locale.languageCode]; String get vitalSignDetailEmpty => localizedValues['vitalSignDetailEmpty'][locale.languageCode]; + String get onlyOfftimeHoliday => + localizedValues['onlyOfftimeHoliday'][locale.languageCode]; + String get active => localizedValues['active'][locale.languageCode]; + String get hold => localizedValues['hold'][locale.languageCode]; + String get loading => localizedValues['loading'][locale.languageCode]; String get assessmentErrorMsg => localizedValues['assessmentErrorMsg'][locale.languageCode]; diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index 3aac5cdd..4f496010 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -1,5 +1,6 @@ import 'package:doctor_app_flutter/lookups/hospital_lookup.dart'; import 'package:doctor_app_flutter/screens/auth/verification_methods_screen.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -41,7 +42,7 @@ class _LoginFormState extends State { bool _isInit = true; FocusNode focusPass = FocusNode(); FocusNode focusProject = FocusNode(); - + HospitalViewModel projectsProv; var userInfo = UserModel( userID: '', password: '', @@ -56,24 +57,13 @@ class _LoginFormState extends State { @override void initState() { super.initState(); - initPlatformState(); - } - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - authProv = Provider.of(context); - - if (_isInit) { - if (projectsList.length == 0) { - getProjectsList(); - } - } - _isInit = false; } @override Widget build(BuildContext context) { + authProv = Provider.of(context); + projectsProv = Provider.of(context); + getProjects(); return Form( key: loginFormKey, child: Container( @@ -128,25 +118,33 @@ class _LoginFormState extends State { }, ), buildSizedBox(), - TextFormField( - focusNode: focusProject, - controller: projectIdController, - onTap: () { - helpers.showCupertinoPicker( - context, projectsList, 'Name', onSelectProject); - }, - showCursor: false, - readOnly: true, - decoration: buildInputDecoration( - context, - TranslationBase.of(context).selectYourProject, - 'assets/images/password_icon.png'), - validator: (value) { - if (value.isEmpty) { - return TranslationBase.of(context).pleaseEnterYourProject; - } - return null; - }), + projectsList.length > 0 + ? TextFormField( + focusNode: focusProject, + controller: projectIdController, + onTap: () { + helpers.showCupertinoPicker( + context, projectsList, 'Name', onSelectProject); + }, + showCursor: false, + readOnly: true, + decoration: buildInputDecoration( + context, + TranslationBase.of(context).selectYourProject, + 'assets/images/password_icon.png'), + validator: (value) { + if (value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterYourProject; + } + return null; + }) + : TextFormField( + readOnly: true, + decoration: buildInputDecoration( + context, + TranslationBase.of(context).loading, + 'assets/images/password_icon.png')), buildSizedBox(), Row( mainAxisAlignment: MainAxisAlignment.end, @@ -325,8 +323,9 @@ class _LoginFormState extends State { } getProjectsList() { - HospitalViewModel projectsProv = Provider.of(context); + //showLoading(); projectsProv.getProjectsList().then((res) { + //hideLoading(); if (res['MessageStatus'] == 1) { setState(() { projectsList = res['ListProject']; @@ -371,4 +370,13 @@ class _LoginFormState extends State { hideLoading() { Navigator.pop(context); } + + getProjects() { + if (_isInit) { + if (projectsList.length == 0) { + getProjectsList(); + } + } + _isInit = false; + } } diff --git a/lib/widgets/auth/verification_methods.dart b/lib/widgets/auth/verification_methods.dart index adc35982..b5111704 100644 --- a/lib/widgets/auth/verification_methods.dart +++ b/lib/widgets/auth/verification_methods.dart @@ -71,6 +71,7 @@ class _VerificationMethodsState extends State { void initState() { super.initState(); _loggedUserFuture = getSharedPref(); + _getAvailableBiometrics(); } Future getSharedPref() async { @@ -117,199 +118,188 @@ class _VerificationMethodsState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( - height: SizeConfig.realScreenHeight * 0.6, - child: Column( - children: [ - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .welcomeBack + - ' ' + - user.doctorName, - fontSize: - SizeConfig.textMultiplier * 3.5, - ), - SizedBox( - height: 20, - ), - AppText( - TranslationBase.of(context) - .accountInfo, - fontSize: - SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 20, - ), - Card( - color: Colors.grey[300], - child: Row( - children: [ - Flexible( - child: ListTile( - title: Text( + // height: SizeConfig.realScreenHeight * 0.6, + child: Column( + children: [ + user != null && isMoreOption == false + ? Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .welcomeBack + + ' ' + + user.doctorName, + fontSize: + SizeConfig.textMultiplier * 3.5, + ), + SizedBox( + height: 20, + ), + AppText( + TranslationBase.of(context).accountInfo, + fontSize: + SizeConfig.textMultiplier * 2.5, + ), + SizedBox( + height: 20, + ), + Card( + color: Colors.grey[300], + child: Row( + children: [ + Flexible( + child: ListTile( + title: Text( + TranslationBase.of(context) + .lastLoginAt, + textAlign: TextAlign.center, + overflow: + TextOverflow.ellipsis, + ), + subtitle: Text( + user.editedOn != null + ? formatDate(Helpers + .convertStringToDate( + user.editedOn)) + : user.createdOn != null + ? formatDate(Helpers + .convertStringToDate(user + .createdOn)) + : '--', + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center), + )), + Flexible( + child: ListTile( + title: Text( TranslationBase.of(context) - .lastLoginAt, - textAlign: TextAlign.center, + .lastLoginWith, overflow: TextOverflow.ellipsis, - ), - subtitle: Text( - user.editedOn != null - ? formatDate(Helpers - .convertStringToDate( - user - .editedOn)) - : user.createdOn != - null - ? formatDate(Helpers - .convertStringToDate(user - .createdOn)) - : '--', - overflow: - TextOverflow.ellipsis, - textAlign: - TextAlign.center), - )), - Flexible( - child: ListTile( - title: Text( - TranslationBase.of( - context) - .lastLoginWith, - overflow: - TextOverflow.ellipsis, - textAlign: - TextAlign.center), - subtitle: Text( - getType(user.logInTypeID, - context), - overflow: - TextOverflow.ellipsis, - textAlign: - TextAlign.center), - )) - ], - )), - ], - ) - : Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - this.onlySMSBox == false - ? AppText( - TranslationBase.of(context) - .verifyLoginWith, - fontSize: SizeConfig - .textMultiplier * - 3.5, - textAlign: TextAlign.left, - ) - : AppText( - TranslationBase.of(context) - .verifyFingerprint2, - fontSize: SizeConfig - .textMultiplier * - 2.5, - textAlign: TextAlign.start, - ), - ]), - user != null && isMoreOption == false - ? Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: InkWell( - onTap: () => { - authenticateUser( - 3, - BiometricType - .face - .index, - authProv) - }, - child: getButton( - user.logInTypeID, - authProv))), - Expanded( - child: - getButton(5, authProv)) - ]) - ]) - : Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - onlySMSBox == false - ? Row( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Expanded( - child: getButton( - 3, authProv)), - Expanded( - child: getButton( - 4, authProv)) - ], - ) - : SizedBox(), - Row( + textAlign: + TextAlign.center), + subtitle: Text( + getType(user.logInTypeID, + context), + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.center), + )) + ], + )), + ], + ) + : Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + this.onlySMSBox == false + ? AppText( + TranslationBase.of(context) + .verifyLoginWith, + fontSize: + SizeConfig.textMultiplier * + 3.5, + textAlign: TextAlign.left, + ) + : AppText( + TranslationBase.of(context) + .verifyFingerprint2, + fontSize: + SizeConfig.textMultiplier * + 2.5, + textAlign: TextAlign.start, + ), + ]), + user != null && isMoreOption == false + ? Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( - child: - getButton(1, authProv)), + child: InkWell( + onTap: () => { + authenticateUser( + 3, + BiometricType + .face.index, + authProv) + }, + child: getButton( + user.logInTypeID, + authProv))), Expanded( - child: getButton(2, authProv)) - ], - ), - ]), - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.end, + child: getButton(5, authProv)) + ]) + ]) + : Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + onlySMSBox == false + ? Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: getButton( + 3, authProv)), + Expanded( + child: getButton( + 4, authProv)) + ], + ) + : SizedBox(), + Row( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Expanded( + child: getButton(1, authProv)), + Expanded( + child: getButton(2, authProv)) + ], + ), + ]), + + // ) + ], + ), + ), + Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + user != null + ? Row( children: [ - user != null - ? Row( - children: [ - Expanded( - child: Button( - title: - TranslationBase.of(context) - .useAnotherAccount, - onTap: () { - Navigator.of(context) - .pushNamed(LOGIN); - }, - )), - ], - ) - : SizedBox(), + Expanded( + child: Button( + title: TranslationBase.of(context) + .useAnotherAccount, + onTap: () { + Navigator.of(context).pushNamed(LOGIN); + }, + )), ], - ), - ) - ], - )) + ) + : SizedBox(), + ], + ), ], ), )); @@ -499,9 +489,10 @@ class _VerificationMethodsState extends State { authenticateUser(3, BiometricType.fingerprint.index, authProv) }, child: RoundedContainer( - backgroundColor: BiometricType.fingerprint.index == 1 - ? Colors.white - : Colors.white.withOpacity(.7), + backgroundColor: + checkIfBiometricAvailable(BiometricType.fingerprint) + ? Colors.white + : Colors.white.withOpacity(.7), borderColor: Colors.grey, showBorder: true, child: Padding( @@ -566,9 +557,7 @@ class _VerificationMethodsState extends State { }) }, child: RoundedContainer( - backgroundColor: BiometricType.fingerprint.index == 1 - ? Colors.white - : Colors.white.withOpacity(.7), + backgroundColor: Colors.white, borderColor: Colors.grey, showBorder: true, child: Padding( @@ -756,11 +745,11 @@ class _VerificationMethodsState extends State { getDocProfiles(clinic, authProv); } } else { - //changeLoadingStata(false); + Navigator.pop(context); helpers.showErrorToast(res['ErrorEndUserMessage']); } }).catchError((err) { - //changeLoadingStata(false); + Navigator.pop(context); helpers.showErrorToast(err); }); } diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 4e4c6b8c..34ec97db 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -24,13 +24,15 @@ class MyScheduleWidget extends StatelessWidget { Column( children: [ Divider( - height: 10, + height: 1, color: Colors.grey, thickness: 1.0, ), - Text('${workingHoursTable.date.day}') ], ), + SizedBox( + height: 10, + ), Row( children: [ AppText( @@ -50,44 +52,19 @@ class MyScheduleWidget extends StatelessWidget { return Container( child: Column( children: [ - Row( - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - AppText( - work.from + ' - ', - fontSize: 2.0 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 5, - ), - AppText( - work.to, - fontSize: 2.0 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ), - ], - ), - ], + SizedBox( + height: 5, + ), + AppText( + work.from + ' - ' + work.to, + fontSize: 2.0 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, ) ], ), ); }).toList(), ), - SizedBox( - width: 8, - ) ], ), ), diff --git a/lib/widgets/otp/sms-popup.dart b/lib/widgets/otp/sms-popup.dart index dfcb33cd..fb5a9a0c 100644 --- a/lib/widgets/otp/sms-popup.dart +++ b/lib/widgets/otp/sms-popup.dart @@ -52,7 +52,7 @@ class SMSOTP { String errorMsg; ProjectViewModel projectProvider; String displayTime = ''; - + bool isClosed = false; displayDialog(BuildContext context) async { return showDialog( context: context, @@ -65,6 +65,7 @@ class SMSOTP { IconButton( icon: Icon(Icons.close), onPressed: () { + this.isClosed = true; Navigator.pop(context); this.onFailure(); }, @@ -307,7 +308,7 @@ class SMSOTP { timer = Future.delayed(Duration(seconds: 1), () { if (this.remainingTime > 0) { - startTimer(setState); + if (isClosed == false) startTimer(setState); } else { Navigator.pop(context); } diff --git a/lib/widgets/patients/profile/patient_profile_widget.dart b/lib/widgets/patients/profile/patient_profile_widget.dart index 67c489e7..225decf4 100644 --- a/lib/widgets/patients/profile/patient_profile_widget.dart +++ b/lib/widgets/patients/profile/patient_profile_widget.dart @@ -254,8 +254,8 @@ class PatientProfileWidget extends StatelessWidget { ), Expanded( child: AppText( - patient.admissionDate != null - ? "${DateUtils.convertDateFromServerFormat(patient.admissionDate, 'EEEE dd, MMMM yyyy hh:mm a')}" + patient.createdOn != null + ? "${DateUtils.convertDateFromServerFormat(patient.createdOn, 'EEEE dd, MMMM yyyy hh:mm a')}" : "", color: Colors.black, fontWeight: FontWeight.normal, @@ -310,10 +310,10 @@ class PatientProfileWidget extends StatelessWidget { ), ), AppText( - patient.admissionDate != null + patient.createdOn != null ? DateUtils .differenceBetweenServerDateAndCurrent( - patient.admissionDate) + patient.createdOn) : "", color: Colors.black, fontWeight: FontWeight.normal, diff --git a/lib/widgets/patients/profile/profile_medical_info_widget.dart b/lib/widgets/patients/profile/profile_medical_info_widget.dart index b243f15a..e839a0b9 100644 --- a/lib/widgets/patients/profile/profile_medical_info_widget.dart +++ b/lib/widgets/patients/profile/profile_medical_info_widget.dart @@ -98,7 +98,9 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).previewHealth, nameLine2: TranslationBase.of(context).summaryReport, icon: 'radiology-1.png'), - if (selectedPatientType != 0 && selectedPatientType != 5 && selectedPatientType != 7) + if (selectedPatientType != 0 && + selectedPatientType != 5 && + selectedPatientType != 7) PatientProfileButton( key: key, patient: patient, @@ -114,20 +116,22 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).admission, nameLine2: TranslationBase.of(context).request, icon: 'heartbeat.png'), - PatientProfileButton( - key: key, - patient: patient, - route: ORDER_PRESCRIPTION, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).prescription, - icon: 'lab.png'), - PatientProfileButton( - key: key, - patient: patient, - route: ORDER_PROCEDURE, - nameLine1: TranslationBase.of(context).orders, - nameLine2: TranslationBase.of(context).procedures, - icon: 'lab.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + route: ORDER_PRESCRIPTION, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).prescription, + icon: 'lab.png'), + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) + PatientProfileButton( + key: key, + patient: patient, + route: ORDER_PROCEDURE, + nameLine1: TranslationBase.of(context).orders, + nameLine2: TranslationBase.of(context).procedures, + icon: 'lab.png'), if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, @@ -144,7 +148,7 @@ class ProfileMedicalInfoWidget extends StatelessWidget { nameLine1: TranslationBase.of(context).orders, nameLine2: TranslationBase.of(context).list, icon: 'radiology-1.png'), - if (selectedPatientType != 0 && selectedPatientType != 5) + if (int.parse(patientType) == 7 || int.parse(patientType) == 6) PatientProfileButton( key: key, patient: patient, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 808e09dc..8a9ae52b 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; @@ -26,6 +27,7 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { bool _isInit = true; Helpers helpers = new Helpers(); + ProjectViewModel projectsProvider; // @override // void didChangeDependencies() { // super.didChangeDependencies(); @@ -38,6 +40,7 @@ class _AppDrawerState extends State { @override Widget build(BuildContext context) { AuthViewModel authProvider = Provider.of(context); + projectsProvider = Provider.of(context); return RoundedContainer( child: Container( color: Colors.white, @@ -84,7 +87,13 @@ class _AppDrawerState extends State { )) : SizedBox(), AppText( - "Director of medical records", //TODO: Make The Dr Title Dynamic and check overflow issue. + projectsProvider.isArabic + ? authProvider + .doctorProfile.titleDescriptionN ?? + "" + : authProvider + .doctorProfile?.titleDescription ?? + "", fontWeight: FontWeight.normal, color: Colors.black87), RaisedButton( diff --git a/lib/widgets/shared/dialogs/dailog-list-select.dart b/lib/widgets/shared/dialogs/dailog-list-select.dart index 68dce5a4..fa33a72d 100644 --- a/lib/widgets/shared/dialogs/dailog-list-select.dart +++ b/lib/widgets/shared/dialogs/dailog-list-select.dart @@ -1,3 +1,6 @@ +import 'package:doctor_app_flutter/client/base_app_client.dart'; +import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:flutter/material.dart'; @@ -8,13 +11,15 @@ class ListSelectDialog extends StatefulWidget { final okText; final Function(dynamic) okFunction; dynamic selectedValue; + final Widget searchWidget; ListSelectDialog( {@required this.list, @required this.attributeName, @required this.attributeValueId, @required this.okText, - @required this.okFunction}); + @required this.okFunction, + this.searchWidget}); @override _ListSelectDialogState createState() => _ListSelectDialogState(); @@ -63,6 +68,7 @@ class _ListSelectDialogState extends State { child: SingleChildScrollView( child: Column( children: [ + if (widget.searchWidget != null) widget.searchWidget, ...widget.list .map((item) => RadioListTile( title: Text("${item[widget.attributeName].toString()}"), diff --git a/lib/widgets/shared/dialogs/search-drugs-dailog-list.dart b/lib/widgets/shared/dialogs/search-drugs-dailog-list.dart new file mode 100644 index 00000000..68dce5a4 --- /dev/null +++ b/lib/widgets/shared/dialogs/search-drugs-dailog-list.dart @@ -0,0 +1,92 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:flutter/material.dart'; + +class ListSelectDialog extends StatefulWidget { + final List list; + final String attributeName; + final String attributeValueId; + final okText; + final Function(dynamic) okFunction; + dynamic selectedValue; + + ListSelectDialog( + {@required this.list, + @required this.attributeName, + @required this.attributeValueId, + @required this.okText, + @required this.okFunction}); + + @override + _ListSelectDialogState createState() => _ListSelectDialogState(); +} + +class _ListSelectDialogState extends State { + @override + void initState() { + super.initState(); + widget.selectedValue = widget.selectedValue ?? widget.list[0]; + } + + @override + Widget build(BuildContext context) { + return showAlertDialog(context); + } + + showAlertDialog(BuildContext context) { + // set up the buttons + Widget cancelButton = FlatButton( + child: Text(TranslationBase.of(context).cancel), + onPressed: () { + Navigator.of(context).pop(); + }); + Widget continueButton = FlatButton( + child: Text(this.widget.okText), + onPressed: () { + this.widget.okFunction(widget.selectedValue); + Navigator.of(context).pop(); + }); +// set up the AlertDialog + AlertDialog alert = AlertDialog( + // title: Text(widget.title), + content: createDialogList(), + actions: [ + cancelButton, + continueButton, + ], + ); + return alert; + } + + Widget createDialogList() { + return Container( + height: MediaQuery.of(context).size.height * 0.5, + child: SingleChildScrollView( + child: Column( + children: [ + ...widget.list + .map((item) => RadioListTile( + title: Text("${item[widget.attributeName].toString()}"), + groupValue: widget.selectedValue[widget.attributeValueId] + .toString(), + value: item[widget.attributeValueId].toString(), + activeColor: Colors.blue.shade700, + selected: item[widget.attributeValueId].toString() == + widget.selectedValue[widget.attributeValueId] + .toString(), + onChanged: (val) { + setState(() { + widget.selectedValue = item; + }); + }, + )) + .toList() + ], + ), + ), + ); + } + + static closeAlertDialog(BuildContext context) { + Navigator.of(context).pop(); + } +}