From 2a1426ecd954f6cfd934c0cf4d6670941ae07294 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 30 Mar 2021 22:50:40 +0300 Subject: [PATCH 001/297] adding lab form and radiology --- lib/core/viewModel/procedure_View_model.dart | 255 ++++++++++++++++++ lib/core/viewModel/radiology_view_model.dart | 11 +- .../profile/lab_result/labs_home_page.dart | 104 ++++--- .../radiology/radiology_home_page.dart | 46 +++- lib/screens/procedures/procedure_screen.dart | 2 +- 5 files changed, 364 insertions(+), 54 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 6af34f4d..8af1144f 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -1,4 +1,9 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/model/labs/LabOrderResult.dart'; +import 'package:doctor_app_flutter/core/model/labs/lab_result.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_orders.dart'; +import 'package:doctor_app_flutter/core/model/labs/patient_lab_special_result.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_procedure_model.dart'; @@ -6,11 +11,18 @@ import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_request_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; +import 'package:doctor_app_flutter/core/model/radiology/final_radiology.dart'; +import 'package:doctor_app_flutter/core/service/labs_service.dart'; import 'package:doctor_app_flutter/core/service/procedure_service.dart'; +import 'package:doctor_app_flutter/core/service/radiology_service.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; +import 'package:flutter/cupertino.dart'; class ProcedureViewModel extends BaseViewModel { + FilterType filterType = FilterType.Clinic; bool hasError = false; ProcedureService _procedureService = locator(); List get procedureList => @@ -20,6 +32,24 @@ class ProcedureViewModel extends BaseViewModel { List get categoriesList => _procedureService.categoriesList; List get categoryList => _procedureService.categoryList; + RadiologyService _radiologyService = locator(); + LabsService _labsService = locator(); + List _finalRadiologyListClinic = List(); + List _finalRadiologyListHospital = List(); + List get finalRadiologyList => + filterType == FilterType.Clinic + ? _finalRadiologyListClinic + : _finalRadiologyListHospital; + List get labOrdersResultsList => + _labsService.labOrdersResultsList; + + List _patientLabOrdersListClinic = List(); + List _patientLabOrdersListHospital = List(); + + List get patientLabOrdersList => + filterType == FilterType.Clinic + ? _patientLabOrdersListClinic + : _patientLabOrdersListHospital; Future getProcedure({int mrn}) async { hasError = false; @@ -101,4 +131,229 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); //await getProcedure(mrn: mrn); } + + void getPatientRadOrders(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _radiologyService.getPatientRadOrders(patient); + if (_radiologyService.hasError) { + error = _radiologyService.error; + setState(ViewState.Error); + } else { + _radiologyService.finalRadiologyList.forEach((element) { + List finalRadiologyListClinic = + _finalRadiologyListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); + + if (finalRadiologyListClinic.length != 0) { + _finalRadiologyListClinic[ + finalRadiologyListClinic.indexOf(finalRadiologyListClinic[0])] + .finalRadiologyList + .add(element); + } else { + _finalRadiologyListClinic.add(FinalRadiologyList( + filterName: element.clinicDescription, finalRadiology: element)); + } + + // FinalRadiologyList list sort via project + List finalRadiologyListHospital = + _finalRadiologyListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (finalRadiologyListHospital.length != 0) { + _finalRadiologyListHospital[finalRadiologyListHospital + .indexOf(finalRadiologyListHospital[0])] + .finalRadiologyList + .add(element); + } else { + _finalRadiologyListHospital.add(FinalRadiologyList( + filterName: element.projectName, finalRadiology: element)); + } + }); + + setState(ViewState.Idle); + } + } + + String get radImageURL => _radiologyService.url; + + getRadImageURL( + {int invoiceNo, + int lineItem, + int projectId, + @required PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _radiologyService.getRadImageURL( + invoiceNo: invoiceNo, + lineItem: lineItem, + projectId: projectId, + patient: patient); + if (_radiologyService.hasError) { + error = _radiologyService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + + setFilterType(FilterType filterType) { + this.filterType = filterType; + notifyListeners(); + } + + List get patientLabSpecialResult => + _labsService.patientLabSpecialResult; + + List get labResultList => _labsService.labResultList; + + List labResultLists = List(); + + List get labResultListsCoustom { + return labResultLists; + } + + void getLabs(PatiantInformtion patient) async { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersList(patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + _labsService.patientLabOrdersList.forEach((element) { + List patientLabOrdersClinic = + _patientLabOrdersListClinic + .where((elementClinic) => + elementClinic.filterName == element.clinicDescription) + .toList(); + + if (patientLabOrdersClinic.length != 0) { + _patientLabOrdersListClinic[_patientLabOrdersListClinic + .indexOf(patientLabOrdersClinic[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListClinic.add(PatientLabOrdersList( + filterName: element.clinicDescription, + patientDoctorAppointment: element)); + } + + // doctor list sort via project + List patientLabOrdersHospital = + _patientLabOrdersListHospital + .where( + (elementClinic) => + elementClinic.filterName == element.projectName, + ) + .toList(); + + if (patientLabOrdersHospital.length != 0) { + _patientLabOrdersListHospital[_patientLabOrdersListHospital + .indexOf(patientLabOrdersHospital[0])] + .patientLabOrdersList + .add(element); + } else { + _patientLabOrdersListHospital.add(PatientLabOrdersList( + filterName: element.projectName, + patientDoctorAppointment: element)); + } + }); + + setState(ViewState.Idle); + } + } + + getLaboratoryResult( + {String projectID, + int clinicID, + String invoiceNo, + String orderNo, + PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getLaboratoryResult( + invoiceNo: invoiceNo, + orderNo: orderNo, + projectID: projectID, + clinicID: clinicID, + patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + setState(ViewState.Idle); + } + } + + getPatientLabResult( + {PatientLabOrders patientLabOrder, PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getPatientLabResult( + patientLabOrder: patientLabOrder, patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + _labsService.labResultList.forEach((element) { + List patientLabOrdersClinic = labResultLists + .where( + (elementClinic) => elementClinic.filterName == element.testCode) + .toList(); + + if (patientLabOrdersClinic.length != 0) { + var value = + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] + .patientLabResultList + .where((e) => + e.sampleCollectedOn == element.sampleCollectedOn && + e.resultValue == element.resultValue) + .toList(); + if (value.isEmpty) + labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])] + .patientLabResultList + .add(element); + } else { + labResultLists + .add(LabResultList(filterName: element.testCode, lab: element)); + } + }); + setState(ViewState.Idle); + } + } + + getPatientLabOrdersResults( + {PatientLabOrders patientLabOrder, + String procedure, + PatiantInformtion patient}) async { + setState(ViewState.Busy); + await _labsService.getPatientLabOrdersResults( + patientLabOrder: patientLabOrder, + procedure: procedure, + patient: patient); + if (_labsService.hasError) { + error = _labsService.error; + setState(ViewState.Error); + } else { + bool isShouldClear = false; + if (_labsService.labOrdersResultsList.length == 1) { + labOrdersResultsList.forEach((element) { + if (element.resultValue.contains('/') || + element.resultValue.contains('*') || + element.resultValue.isEmpty) isShouldClear = true; + }); + } + if (isShouldClear) _labsService.labOrdersResultsList.clear(); + setState(ViewState.Idle); + } + } + + sendLabReportEmail({PatientLabOrders patientLabOrder, String mes}) async { + await _labsService.sendLabReportEmail(patientLabOrder: patientLabOrder); + if (_labsService.hasError) { + error = _labsService.error; + } else + DrAppToastMsg.showSuccesToast(mes); + } } diff --git a/lib/core/viewModel/radiology_view_model.dart b/lib/core/viewModel/radiology_view_model.dart index 3a194970..4370b47f 100644 --- a/lib/core/viewModel/radiology_view_model.dart +++ b/lib/core/viewModel/radiology_view_model.dart @@ -70,10 +70,17 @@ class RadiologyViewModel extends BaseViewModel { String get radImageURL => _radiologyService.url; - getRadImageURL({int invoiceNo, int lineItem, int projectId,@required PatiantInformtion patient}) async { + getRadImageURL( + {int invoiceNo, + int lineItem, + int projectId, + @required PatiantInformtion patient}) async { setState(ViewState.Busy); await _radiologyService.getRadImageURL( - invoiceNo: invoiceNo, lineItem: lineItem, projectId: projectId,patient: patient); + invoiceNo: invoiceNo, + lineItem: lineItem, + projectId: projectId, + patient: patient); if (_radiologyService.hasError) { error = _radiologyService.error; setState(ViewState.Error); diff --git a/lib/screens/patients/profile/lab_result/labs_home_page.dart b/lib/screens/patients/profile/lab_result/labs_home_page.dart index aeca5508..bbf60821 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/viewModel/labs_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; 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/patients/profile/lab_result/laboratory_result_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_lab_orders.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; @@ -23,13 +25,14 @@ class LabsHomePage extends StatelessWidget { @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; + PatiantInformtion patient = routeArgs['patient']; - patientType = routeArgs['patientType']; - arrivalType = routeArgs['arrivalType']; - print(arrivalType); - return BaseView( + patientType = routeArgs['patientType']; + arrivalType = routeArgs['arrivalType']; + print(arrivalType); + return BaseView( onModelReady: (model) => model.getLabs(patient), - builder: (context, LabsViewModel model, widget) => AppScaffold( + builder: (context, ProcedureViewModel model, widget) => AppScaffold( baseViewModel: model, isShowAppBar: false, body: SingleChildScrollView( @@ -39,55 +42,76 @@ class LabsHomePage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), - SizedBox(height: 12,), + PatientProfileHeaderNewDesign(patient, + patient.patientType.toString() ?? '0', patientType), + SizedBox( + height: 12, + ), Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('Lab',style: "caption2",color: Colors.black,fontSize: 13,), - Texts('Result',bold: true,fontSize: 22,), + Texts( + 'Lab', + style: "caption2", + color: Colors.black, + fontSize: 13, + ), + Texts( + 'Result', + bold: true, + fontSize: 22, + ), ], ), ), - if(patientType!=null && patientType=='7') - InkWell( - onTap: (){ - //TODO Hussam call the add page here - }, - child: Container( - width: double.maxFinite, - height: 140, - margin: EdgeInsets.all(10), - decoration: BoxDecoration( - color: Colors.grey[300], - borderRadius: BorderRadius.circular(10), - ), - child: Center( - child: Container( - height: 90, - child: Column( - children: [ - Container( - height: 40, - width: 40, - decoration: BoxDecoration( - color: Colors.grey[600], - borderRadius: BorderRadius.circular(10), + if (patientType != null && patientType == '7') + InkWell( + onTap: () { + addSelectedLabOrder(context, model, patient); + }, + child: Container( + width: double.maxFinite, + height: 140, + margin: EdgeInsets.all(10), + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Container( + height: 90, + child: Column( + children: [ + Container( + height: 40, + width: 40, + decoration: BoxDecoration( + color: Colors.grey[600], + borderRadius: BorderRadius.circular(10), + ), + child: Center( + child: Icon( + Icons.add, + color: Colors.white, + ), + ), ), - child: Center( - child: Icon(Icons.add,color: Colors.white,), + SizedBox( + height: 10, ), - ), - SizedBox(height: 10,), - Texts('Apply for New Lab Order',color: Colors.grey[600],fontWeight: FontWeight.w600,) - ], + Texts( + 'Apply for New Lab Order', + color: Colors.grey[600], + fontWeight: FontWeight.w600, + ) + ], + ), ), ), ), ), - ), ...List.generate( model.patientLabOrdersList.length, (index) => Column( diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 6db06be5..4617abff 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -1,9 +1,11 @@ import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/radiology_view_model.dart'; 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/patients/profile/radiology/radiology_details_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_radiology_order.dart'; import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; @@ -24,7 +26,8 @@ class RadiologyHomePage extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; - return BaseView( + ProcedureViewModel model2 = ProcedureViewModel(); + return BaseView( onModelReady: (model) => model.getPatientRadOrders(patient), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, @@ -35,22 +38,34 @@ class RadiologyHomePage extends StatelessWidget { child: ListView( physics: BouncingScrollPhysics(), children: [ - PatientProfileHeaderNewDesign(patient,arrivalType??'0',patientType), - SizedBox(height: 12,), + PatientProfileHeaderNewDesign( + patient, patient.patientType.toString() ?? '0', patientType), + SizedBox( + height: 12, + ), Padding( padding: const EdgeInsets.all(8.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Texts('Radiology',style: "caption2",color: Colors.black,fontSize: 13,), - Texts('Result',bold: true,fontSize: 22,), + Texts( + 'Radiology', + style: "caption2", + color: Colors.black, + fontSize: 13, + ), + Texts( + 'Result', + bold: true, + fontSize: 22, + ), ], ), ), - if(patientType!=null && patientType=='7') + if (patientType != null && patientType == '7') InkWell( - onTap: (){ - //TODO Hussam call the add page here + onTap: () { + addSelectedRadiologyOrder(context, model, patient); }, child: Container( width: double.maxFinite, @@ -73,11 +88,20 @@ class RadiologyHomePage extends StatelessWidget { borderRadius: BorderRadius.circular(10), ), child: Center( - child: Icon(Icons.add,color: Colors.white,), + child: Icon( + Icons.add, + color: Colors.white, + ), ), ), - SizedBox(height: 10,), - Texts('Apply for Radiology Order',color: Colors.grey[600],fontWeight: FontWeight.w600,) + SizedBox( + height: 10, + ), + Texts( + 'Apply for Radiology Order', + color: Colors.grey[600], + fontWeight: FontWeight.w600, + ) ], ), ), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index a03e1348..902a5022 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -34,7 +34,7 @@ class _ProcedureScreenState extends State { final routeArgs = ModalRoute.of(context).settings.arguments as Map; patient = routeArgs['patient']; return BaseView( - onModelReady: (model) => model.getProcedure(mrn: 0), + onModelReady: (model) => model.getProcedure(mrn: patient.patientId), builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: true, From 0f3f3f8f55d75346748029761a10e27dbf47fe0d Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 31 Mar 2021 10:15:08 +0300 Subject: [PATCH 002/297] adding lab form and radiology --- lib/screens/procedures/add_lab_orders.dart | 4 ++-- lib/screens/procedures/add_radiology_order.dart | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart index ada0641b..d72ffa65 100644 --- a/lib/screens/procedures/add_lab_orders.dart +++ b/lib/screens/procedures/add_lab_orders.dart @@ -75,14 +75,14 @@ postProcedure( if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); + model.getLabs(patient); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); } } else { if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); + model.getLabs(patient); } else if (model.state == ViewState.Idle) { helpers.showErrorToast( model.valadteProcedureList[0].entityList[0].warringMessages); diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart index c523c2b0..d3ae723d 100644 --- a/lib/screens/procedures/add_radiology_order.dart +++ b/lib/screens/procedures/add_radiology_order.dart @@ -75,14 +75,14 @@ postProcedure( if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); + model.getPatientRadOrders(patient); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); } } else { if (model.state == ViewState.ErrorLocal) { helpers.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); + model.getPatientRadOrders(patient); } else if (model.state == ViewState.Idle) { helpers.showErrorToast( model.valadteProcedureList[0].entityList[0].warringMessages); From 2bd505290d26730f205bea5b83da5d330f32fa21 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 31 Mar 2021 12:13:14 +0300 Subject: [PATCH 003/297] fix design --- .../patients/profile/radiology/radiology_home_page.dart | 4 ++-- .../patient_profile_header_with_appointment_card.dart | 8 +++++--- pubspec.lock | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 4617abff..a0f44cb7 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -30,8 +30,8 @@ class RadiologyHomePage extends StatelessWidget { return BaseView( onModelReady: (model) => model.getPatientRadOrders(patient), builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).radiology, + isShowAppBar: false, + // appBarTitle: TranslationBase.of(context).radiology, baseViewModel: model, body: FractionallySizedBox( widthFactor: 1.0, diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart index 26f474e2..61de70e1 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart @@ -47,7 +47,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { decoration: BoxDecoration( color: Colors.white, ), - height: 300, + //height: 300, child: Container( padding: EdgeInsets.only(left: 10, right: 10, bottom: 10), margin: EdgeInsets.only(top: 50), @@ -401,8 +401,10 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { 'Result Date:', color: Colors.grey[800], ), - Texts( - '${DateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + Expanded( + child: Texts( + '${DateUtils.getDayMonthYearDateFormatted(appointmentDate, isArabic: projectViewModel.isArabic)}', + ), ) ], ) diff --git a/pubspec.lock b/pubspec.lock index e15e02c9..46eca7cf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -608,7 +608,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.4" + version: "1.3.0-nullsafety.3" mime: dependency: transitive description: @@ -900,7 +900,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.2" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: @@ -1084,5 +1084,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=2.10.0 <=2.11.0-213.1.beta" + dart: ">=2.10.0 <2.11.0" flutter: ">=1.22.0 <2.0.0" From 5256c9633f96fb437f1dacd2f6c7953dbdbbcbac Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 31 Mar 2021 12:22:43 +0300 Subject: [PATCH 004/297] leave reschedule change --- lib/core/viewModel/leave_rechdule_response.dart | 7 +++++-- lib/screens/reschedule-leaves/add-rescheduleleave.dart | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/core/viewModel/leave_rechdule_response.dart b/lib/core/viewModel/leave_rechdule_response.dart index d7cab8bf..abcba69e 100644 --- a/lib/core/viewModel/leave_rechdule_response.dart +++ b/lib/core/viewModel/leave_rechdule_response.dart @@ -9,7 +9,7 @@ class GetRescheduleLeavesResponse { int requisitionNo; int requisitionType; int status; - + String createdOn; GetRescheduleLeavesResponse( {this.clinicId, this.coveringDoctorId, @@ -20,7 +20,8 @@ class GetRescheduleLeavesResponse { this.reasonId, this.requisitionNo, this.requisitionType, - this.status}); + this.status, + this.createdOn}); GetRescheduleLeavesResponse.fromJson(Map json) { clinicId = json['clinicId']; @@ -33,6 +34,7 @@ class GetRescheduleLeavesResponse { requisitionNo = json['requisitionNo']; requisitionType = json['requisitionType']; status = json['status']; + createdOn = json['createdOn']; } Map toJson() { @@ -47,6 +49,7 @@ class GetRescheduleLeavesResponse { data['requisitionNo'] = this.requisitionNo; data['requisitionType'] = this.requisitionType; data['status'] = this.status; + data['createdOn'] = this.createdOn; return data; } } diff --git a/lib/screens/reschedule-leaves/add-rescheduleleave.dart b/lib/screens/reschedule-leaves/add-rescheduleleave.dart index aaafa380..72aed198 100644 --- a/lib/screens/reschedule-leaves/add-rescheduleleave.dart +++ b/lib/screens/reschedule-leaves/add-rescheduleleave.dart @@ -133,7 +133,7 @@ class AddRescheduleLeavScreen extends StatelessWidget { child: AppText( DateUtils .convertStringToDateFormat( - item.dateTimeTo, + item.createdOn, 'yyyy-MM-dd HH:mm'), fontWeight: FontWeight.bold, )) From 5714ed95401a98df74064802baa2287ec4b4d332 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 31 Mar 2021 13:07:10 +0300 Subject: [PATCH 005/297] small fix on replay page --- lib/config/localized_values.dart | 7 +++++++ lib/util/translations_delegate_base.dart | 2 ++ lib/widgets/doctor/doctor_reply_widget.dart | 19 ++++++++----------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9fa9c35c..94173b26 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -816,4 +816,11 @@ const Map> localizedValues = { "en": "Extend Sick Leave Request", "ar": "تمديد طلب الإجازة المرضية" }, + "unReplied": { + "en": "UnReplied", + "ar": "لم يتم الرد" + },"replied": { + "en": "Replied", + "ar": " تم الرد" + }, }; diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7ff65bb1..5ffdd939 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1193,6 +1193,8 @@ class TranslationBase { String get updateReschedule => localizedValues['update-reschedule'][locale.languageCode]; String get sickLeave => localizedValues['sick_leave'][locale.languageCode]; + String get unReplied => localizedValues['unReplied'][locale.languageCode]; + String get replied => localizedValues['replied'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 5660fde6..d0d8c3ca 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -25,9 +25,9 @@ class _DoctorReplyWidgetState extends State { return Container( child: CardWithBgWidget( bgColor: - widget.reply.status == 1 - ? Color(0xffc4aa54) - : Colors.red[700], + widget.reply.status == 2 + ? Color(0xFF2E303A) + : Color(0xFFD02127), hasBorder: false, widget: Container( // padding: EdgeInsets.only(left: 20, right: 0, bottom: 0), @@ -45,15 +45,12 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: widget.reply.infoStatus!=null ? widget.reply.infoStatus :'', + text: widget.reply.status==2 ? TranslationBase.of(context).replied :TranslationBase.of(context).unReplied , style: TextStyle( - color: widget.reply.status != null - ? widget.reply.status == 1 - ? Color(0xffc4aa54) - : widget.reply.status == 2 - ? Colors.green[700] - : Colors.red[700] - : Colors.grey[500], + color: widget.reply.status == 2 + ? Color(0xFF2E303A) + : Color(0xFFD02127), + fontWeight: FontWeight.w700, fontFamily: 'Poppins', fontSize: 2.0 * SizeConfig.textMultiplier)), From f280ed731d7eed934d706f14ab43d7eeb6644038 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 31 Mar 2021 16:48:14 +0300 Subject: [PATCH 006/297] finish Admission request new design --- lib/config/localized_values.dart | 3 +- .../admission-request-first-screen.dart | 722 ++++++++---------- .../admission-request-third-screen.dart | 492 +++++------- .../admission-request_second-screen.dart | 642 +++++++++------- lib/util/translations_delegate_base.dart | 2 + lib/widgets/shared/app-textfield-custom.dart | 75 +- 6 files changed, 950 insertions(+), 986 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9a74047c..c6ee6aa1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -287,6 +287,7 @@ const Map> localizedValues = { 'room': {'en': 'ROOM:', 'ar': 'الغرفة'}, 'bed': {'en': 'BED:', 'ar': 'السرير'}, 'next': {'en': 'Next', 'ar': 'التالي'}, + 'previous': {'en': 'PREVIOUS', 'ar': 'السابق'}, 'healthRecordInformation': { 'en': 'HEALTH RECORD INFORMATION', 'ar': 'معلومات السجل الصحي' @@ -705,7 +706,7 @@ const Map> localizedValues = { 'ar': " : استجابة الإحالة" }, 'estimatedCost': {'en': "Estimated Cost", 'ar': "التكلفة المتوقعة"}, - 'diagnosisDetail': {'en': "Diagnosis Detail : ", 'ar': "تفاصيل التشخيص"}, + 'diagnosisDetail': {'en': "Diagnosis Details", 'ar': "تفاصيل التشخيص"}, 'referralSuccessMsgAccept': { 'en': "Referral Accepted Successfully", 'ar': "تم قبول الإحالة بنجاح" diff --git a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart index 1cf69da8..3fa16be2 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-first-screen.dart @@ -58,7 +58,7 @@ class _AdmissionRequestThirdScreenState isShowAppBar: false, appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( - onTap: (){ + onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); if (!currentFocus.hasPrimaryFocus) { currentFocus.unfocus(); @@ -66,418 +66,344 @@ class _AdmissionRequestThirdScreenState }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: SingleChildScrollView( + children: [ + Expanded( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), + Container( + margin: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // PatientPageHeaderWidget(patient), - PatientProfileHeaderNewDesign( - patient, patientType, arrivalType), - Container( - margin: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - "${TranslationBase.of(context).admission}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.6, - fontWeight: FontWeight.w600, - ), - AppText( - "${TranslationBase.of(context).request}", - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 3, - fontWeight: FontWeight.bold, - ) - ], - ), + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, ), - Container( - margin: EdgeInsets.symmetric( - vertical: 0, horizontal: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context) - .specialityAndDoctorDetail, - fontFamily: 'Poppins', - fontSize: SizeConfig.textMultiplier * 1.8, - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 10, - ), - AppTextFieldCustom( - height: screenSize.height * 0.070, - hintText: "test field", - isDropDown: true, - controller: _sickLeaveCommentsController, - ), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.clinicList != null && - model.clinicList.length > 0 - ? () { - openListDialogField( - 'clinicGroupName', - 'clinicID', - model.clinicList, - (selectedValue) { - setState(() { - _selectedClinic = selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getClinics().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.clinicList.length > 0) { - openListDialogField( - 'clinicGroupName', - 'clinicID', - model.clinicList, - (selectedValue) { - setState(() { - _selectedClinic = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .clinic, - _selectedClinic != null - ? _selectedClinic[ - 'clinicGroupName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 20, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: _selectedClinic != null - ? model.doctorsList != null && - model.doctorsList.length > 0 - ? () { - openListDialogField( - 'DoctorName', - 'DoctorID', - model.doctorsList, - (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils - .showMyDialog(context); - await model - .getClinicDoctors( - _selectedClinic[ - 'clinicID']) - .then((_) => - GifLoaderDialogUtils - .hideDialog( - context)); - if (model.state == - ViewState.Idle && - model.doctorsList.length > - 0) { - openListDialogField( - 'DoctorName', - 'DoctorID', - model.doctorsList, - (selectedValue) { - setState(() { - _selectedDoctor = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - } - : null, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .doctor, - _selectedDoctor != null - ? _selectedDoctor[ - 'DoctorName'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 16, - ), - AppText( - TranslationBase.of(context).patientDetails, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, - ), - SizedBox( - height: 10, - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context).patientPregnant, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _patientPregnant, - onChanged: (newValue) { - setState(() { - _patientPregnant = newValue; - }); - }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - CheckboxListTile( - title: AppText( - TranslationBase.of(context) - .isSickLeaveRequired, - fontWeight: FontWeight.normal, - fontSize: SizeConfig.textMultiplier * 2.1, - ), - value: _isSickLeaveRequired, - onChanged: (newValue) { - setState(() { - _isSickLeaveRequired = newValue; + AppText( + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context) + .specialityAndDoctorDetail, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).clinic, + isDropDown: true, + dropDownText: _selectedClinic != null + ? _selectedClinic['clinicGroupName'] + : null, + enabled: false, + onClick: model.clinicList != null && + model.clinicList.length > 0 + ? () { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getClinics().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.clinicList.length > 0) { + openListDialogField( + 'clinicGroupName', + 'clinicID', + model.clinicList, (selectedValue) { + setState(() { + _selectedClinic = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } }, - controlAffinity: - ListTileControlAffinity.leading, - contentPadding: EdgeInsets.all(0), - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .sickLeaveComments, - null, - false), - enabled: true, - controller: _sickLeaveCommentsController, - keyboardType: TextInputType.text, - minLines: 2, - maxLines: 4, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.dietTypesList != null && - model.dietTypesList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.dietTypesList, - (selectedValue) { - setState(() { - _selectedDietType = - selectedValue; - }); + ), + SizedBox( + height: 20, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).doctor, + isDropDown: true, + dropDownText: _selectedDoctor != null + ? _selectedDoctor['DoctorName'] + : null, + enabled: false, + onClick: _selectedClinic != null + ? model.doctorsList != null && + model.doctorsList.length > 0 + ? () { + openListDialogField('DoctorName', + 'DoctorID', model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getClinicDoctors( + _selectedClinic['clinicID']) + .then((_) => GifLoaderDialogUtils + .hideDialog(context)); + if (model.state == ViewState.Idle && + model.doctorsList.length > 0) { + openListDialogField('DoctorName', + 'DoctorID', model.doctorsList, + (selectedValue) { + setState(() { + _selectedDoctor = selectedValue; }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDietTypes().then( - (_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.dietTypesList.length > - 0) { - openListDialogField('nameEn', - 'id', model.dietTypesList, - (selectedValue) { - setState(() { - _selectedDietType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietType, - _selectedDietType != null - ? _selectedDietType['nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .dietTypeRemarks, - null, - false), - enabled: true, - controller: _dietTypeRemarksController, - keyboardType: TextInputType.text, - minLines: 4, - maxLines: 6, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .pastMedicalHistory, - null, - false), - enabled: true, - controller: _postMedicalHistoryController, - keyboardType: TextInputType.text, - minLines: 2, - maxLines: 4, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .pastSurgicalHistory, - null, - false), - enabled: true, - controller: _postSurgicalHistoryController, - keyboardType: TextInputType.text, - minLines: 2, - maxLines: 4, - )), - ], + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + } + : null, + ), + SizedBox( + height: 16, + ), + AppText( + TranslationBase.of(context).patientDetails, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 10, + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).patientPregnant, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, ), + value: _patientPregnant, + activeColor: HexColor("#D02127"), + onChanged: (newValue) { + setState(() { + _patientPregnant = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + CheckboxListTile( + title: AppText( + TranslationBase.of(context).isSickLeaveRequired, + fontWeight: FontWeight.normal, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 2.0, + ), + value: _isSickLeaveRequired, + activeColor: HexColor("#D02127"), + onChanged: (newValue) { + setState(() { + _isSickLeaveRequired = newValue; + }); + }, + controlAffinity: ListTileControlAffinity.leading, + contentPadding: EdgeInsets.all(0), + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).sickLeaveComments, + controller: _sickLeaveCommentsController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).dietType, + isDropDown: true, + dropDownText: _selectedDietType != null + ? _selectedDietType['nameEn'] + : null, + enabled: false, + onClick: model.dietTypesList != null && + model.dietTypesList.length > 0 + ? () { + openListDialogField( + 'nameEn', 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getDietTypes().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.dietTypesList.length > 0) { + openListDialogField( + 'nameEn', 'id', model.dietTypesList, + (selectedValue) { + setState(() { + _selectedDietType = selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).dietTypeRemarks, + controller: _dietTypeRemarksController, + minLines: 4, + maxLines: 6, + inputType: TextInputType.multiline, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).pastMedicalHistory, + controller: _postMedicalHistoryController, + minLines: 4, + maxLines: 6, + inputType: TextInputType.multiline, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: TranslationBase.of(context).pastSurgicalHistory, + controller: _postSurgicalHistoryController, + minLines: 2, + maxLines: 4, + inputType: TextInputType.multiline, ), ], ), ), - ), - Container( - margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () { - model.admissionRequestData = AdmissionRequest(); - if (_selectedClinic != null && - _selectedDoctor != null && - _sickLeaveCommentsController.text != "" && - _postMedicalHistoryController.text != "" && - _postSurgicalHistoryController.text != "") { - model.admissionRequestData.patientMRN = - patient.patientMRN; - model.admissionRequestData.appointmentNo = - patient.appointmentNo; - model.admissionRequestData.episodeID = - patient.episodeNo; - model.admissionRequestData.admissionRequestNo = 0; + ], + ), + ), + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#D02127"), + onPressed: () { + model.admissionRequestData = AdmissionRequest(); + if (_selectedClinic != null && + _selectedDoctor != null && + _sickLeaveCommentsController.text != "" && + _postMedicalHistoryController.text != "" && + _postSurgicalHistoryController.text != "") { + model.admissionRequestData.patientMRN = + patient.patientMRN; + model.admissionRequestData.appointmentNo = + patient.appointmentNo; + model.admissionRequestData.episodeID = patient.episodeNo; + model.admissionRequestData.admissionRequestNo = 0; - model.admissionRequestData.admitToClinic = - _selectedClinic['clinicID']; - model.admissionRequestData.mrpDoctorID = - _selectedDoctor['DoctorID']; + model.admissionRequestData.admitToClinic = + _selectedClinic['clinicID']; + model.admissionRequestData.mrpDoctorID = + _selectedDoctor['DoctorID']; - model.admissionRequestData.isPregnant = - _patientPregnant; - model.admissionRequestData.isSickLeaveRequired = - _isSickLeaveRequired; - model.admissionRequestData.sickLeaveComments = - _sickLeaveCommentsController.text; - model.admissionRequestData.isDietType = - _selectedDietType != null ? true : false; - model.admissionRequestData.dietType = - _selectedDietType != null - ? _selectedDietType['id'] - : 0; - model.admissionRequestData.dietRemarks = - _dietTypeRemarksController.text; - model.admissionRequestData.pastMedicalHistory = - _postMedicalHistoryController.text; - model.admissionRequestData.pastSurgicalHistory = - _postSurgicalHistoryController.text; - Navigator.of(context).pushNamed( - PATIENT_ADMISSION_REQUEST_2, - arguments: { - 'patient': patient, - 'admission-data': model.admissionRequestData - }); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, - ), - ), - ], + model.admissionRequestData.isPregnant = _patientPregnant; + model.admissionRequestData.isSickLeaveRequired = + _isSickLeaveRequired; + model.admissionRequestData.sickLeaveComments = + _sickLeaveCommentsController.text; + model.admissionRequestData.isDietType = + _selectedDietType != null ? true : false; + model.admissionRequestData.dietType = + _selectedDietType != null + ? _selectedDietType['id'] + : 0; + model.admissionRequestData.dietRemarks = + _dietTypeRemarksController.text; + model.admissionRequestData.pastMedicalHistory = + _postMedicalHistoryController.text; + model.admissionRequestData.pastSurgicalHistory = + _postSurgicalHistoryController.text; + Navigator.of(context) + .pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, ), + ), + ], + ), ), ), ); diff --git a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart index 342d2e72..b5cf732a 100644 --- a/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request-third-screen.dart @@ -7,11 +7,12 @@ import 'package:doctor_app_flutter/core/viewModel/patient-admission-request-view import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; 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/util/date-utils.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-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.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_texts_widget.dart'; @@ -32,11 +33,6 @@ class AdmissionRequestThirdScreen extends StatefulWidget { class _AdmissionRequestThirdScreenState extends State { - final _treatmentLineController = TextEditingController(); - final _complicationsController = TextEditingController(); - final _otherProceduresController = TextEditingController(); - - dynamic _selectedAdmissionType; dynamic _selectedDiagnosis; dynamic _selectedIcd; dynamic _selectedDiagnosisType; @@ -45,6 +41,8 @@ class _AdmissionRequestThirdScreenState Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; AdmissionRequest admissionRequest = routeArgs['admission-data']; final screenSize = MediaQuery.of(context).size; @@ -53,6 +51,7 @@ class _AdmissionRequestThirdScreenState return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, + isShowAppBar: false, appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -68,132 +67,68 @@ class _AdmissionRequestThirdScreenState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), Container( - margin: - EdgeInsets.symmetric(vertical: 16, horizontal: 16), + margin: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).treatmentLine, - null, - false), - enabled: true, - controller: _treatmentLineController, - keyboardType: TextInputType.text, - minLines: 3, - maxLines: 5, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).complications, - null, - false), - enabled: true, - controller: _complicationsController, - keyboardType: TextInputType.text, - minLines: 3, - maxLines: 5, - )), - SizedBox( - height: 10, - ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).otherProcedure, - null, - false), - enabled: true, - controller: _otherProceduresController, - keyboardType: TextInputType.text, - minLines: 3, - maxLines: 5, - )), - SizedBox( - height: 10, - ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.admissionTypeList != null && - model.admissionTypeList.length > 0 - ? () { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup(MasterKeysService - .AdmissionRequestType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.admissionTypeList.length > 0) { - openListDialogField('nameEn', 'id', - model.admissionTypeList, - (selectedValue) { - setState(() { - _selectedAdmissionType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).admissionType, - _selectedAdmissionType != null - ? _selectedAdmissionType['nameEn'] - : null, - true), - enabled: false, - ), - ), - ), - SizedBox( - height: 16, + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, ), AppText( - TranslationBase.of(context).diagnosisDetail, + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, + ) + ], + ), + ), + Container( + margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + TranslationBase.of(context).diagnosisDetail, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.diagnosisTypesList != null && - model.diagnosisTypesList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).diagnosis, + dropDownText: _selectedDiagnosis != null + ? _selectedDiagnosis['nameEn'] + : null, + enabled: false, + isDropDown: true, + onClick: model.diagnosisTypesList != null && + model.diagnosisTypesList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.diagnosisTypesList, + (selectedValue) { + setState(() { + _selectedDiagnosis = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getDiagnosis().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.diagnosisTypesList.length > 0) { openListDialogField('nameEn', 'id', model.diagnosisTypesList, (selectedValue) { @@ -201,51 +136,46 @@ class _AdmissionRequestThirdScreenState _selectedDiagnosis = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getDiagnosis().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.diagnosisTypesList.length > 0) { - openListDialogField('nameEn', 'id', - model.diagnosisTypesList, - (selectedValue) { - setState(() { - _selectedDiagnosis = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).diagnosis, - _selectedDiagnosis != null - ? _selectedDiagnosis['nameEn'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.icdCodes != null && - model.icdCodes.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).icd, + dropDownText: _selectedIcd != null + ? _selectedIcd['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.icdCodes != null && + model.icdCodes.length > 0 + ? () { + openListDialogField( + 'description', 'code', model.icdCodes, + (selectedValue) { + setState(() { + _selectedIcd = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getICDCodes(patient.patientMRN) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.icdCodes.length > 0) { openListDialogField( 'description', 'code', model.icdCodes, (selectedValue) { @@ -253,57 +183,51 @@ class _AdmissionRequestThirdScreenState _selectedIcd = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getICDCodes(patient.patientMRN) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.icdCodes.length > 0) { - openListDialogField( - 'description', - 'code', - model.icdCodes, (selectedValue) { - setState(() { - _selectedIcd = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).icd, - _selectedIcd != null - ? _selectedIcd['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.listOfDiagnosisSelectionTypes != - null && - model.listOfDiagnosisSelectionTypes - .length > - 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).diagnoseType, + dropDownText: _selectedDiagnosisType != null + ? _selectedDiagnosisType['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.listOfDiagnosisSelectionTypes != + null && + model.listOfDiagnosisSelectionTypes.length > + 0 + ? () { + openListDialogField('description', 'code', + model.listOfDiagnosisSelectionTypes, + (selectedValue) { + setState(() { + _selectedDiagnosisType = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog(context); + await model + .getMasterLookup(MasterKeysService + .DiagnosisSelectionType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.listOfDiagnosisSelectionTypes + .length > + 0) { openListDialogField('description', 'code', model.listOfDiagnosisSelectionTypes, (selectedValue) { @@ -312,49 +236,14 @@ class _AdmissionRequestThirdScreenState selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model - .getMasterLookup(MasterKeysService - .DiagnosisSelectionType) - .then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.listOfDiagnosisSelectionTypes - .length > - 0) { - openListDialogField( - 'description', - 'code', - model.listOfDiagnosisSelectionTypes, - (selectedValue) { - setState(() { - _selectedDiagnosisType = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).diagnoseType, - _selectedDiagnosisType != null - ? _selectedDiagnosisType['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, @@ -367,55 +256,66 @@ class _AdmissionRequestThirdScreenState )), Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () async { - if (_treatmentLineController.text != "" && - _complicationsController.text != "" && - _otherProceduresController.text != "" && - _selectedAdmissionType != null && - _selectedDiagnosis != null && - _selectedIcd != null && - _selectedDiagnosisType != null) { - model.admissionRequestData = admissionRequest; - - model.admissionRequestData.mainLineOfTreatment = - _treatmentLineController.text; - model.admissionRequestData.complications = - _complicationsController.text; - model.admissionRequestData.otherProcedures = - _otherProceduresController.text; - model.admissionRequestData.admissionType = - _selectedAdmissionType['id']; + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).submit, + color: HexColor("#359846"), + onPressed: () async { + if (_selectedDiagnosis != null && + _selectedIcd != null && + _selectedDiagnosisType != null) { + model.admissionRequestData = admissionRequest; - dynamic admissionRequestDiagnoses = [ - { - 'diagnosisDescription': _selectedDiagnosis['nameEn'], - 'diagnosisType': _selectedDiagnosis['id'], - 'icdCode': _selectedIcd['code'], - 'icdCodeDescription': _selectedIcd['description'], - 'type': _selectedDiagnosisType['code'], - 'remarks': "", - 'isActive': true, - } - ]; - model.admissionRequestData.admissionRequestDiagnoses = - admissionRequestDiagnoses; + dynamic admissionRequestDiagnoses = [ + { + 'diagnosisDescription': + _selectedDiagnosis['nameEn'], + 'diagnosisType': _selectedDiagnosis['id'], + 'icdCode': _selectedIcd['code'], + 'icdCodeDescription': + _selectedIcd['description'], + 'type': _selectedDiagnosisType['code'], + 'remarks': "", + 'isActive': true, + } + ]; + model.admissionRequestData + .admissionRequestDiagnoses = + admissionRequestDiagnoses; - await model.makeAdmissionRequest(); - if (model.state == ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast(model.error); - } else { - DrAppToastMsg.showSuccesToast( - TranslationBase.of(context).admissionRequestSuccessMsg); - Navigator.popUntil(context, ModalRoute.withName(PATIENTS_PROFILE)); - } - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, + await model.makeAdmissionRequest(); + if (model.state == ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast(model.error); + } else { + DrAppToastMsg.showSuccesToast( + TranslationBase.of(context) + .admissionRequestSuccessMsg); + Navigator.popUntil(context, + ModalRoute.withName(PATIENTS_PROFILE)); + } + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], ), ), ], diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 91885724..987f5f43 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -12,6 +12,8 @@ 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-page-header-widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design.dart'; +import 'package:doctor_app_flutter/widgets/shared/app-textfield-custom.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_texts_widget.dart'; @@ -36,17 +38,23 @@ class _AdmissionRequestSecondScreenState final _estimatedCostController = TextEditingController(); final _expectedDaysController = TextEditingController(); final _otherDepartmentsInterventionsController = TextEditingController(); + final _treatmentLineController = TextEditingController(); + final _complicationsController = TextEditingController(); + final _otherProceduresController = TextEditingController(); DateTime _expectedAdmissionDate; dynamic _selectedFloor; dynamic _selectedWard; dynamic _selectedRoomCategory; + dynamic _selectedAdmissionType; @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; PatiantInformtion patient = routeArgs['patient']; + String patientType = routeArgs['patientType']; + String arrivalType = routeArgs['arrivalType']; AdmissionRequest admissionRequest = routeArgs['admission-data']; final screenSize = MediaQuery.of(context).size; @@ -55,6 +63,7 @@ class _AdmissionRequestSecondScreenState return BaseView( builder: (_, model, w) => AppScaffold( baseViewModel: model, + isShowAppBar: false, appBarTitle: TranslationBase.of(context).admissionRequest, body: GestureDetector( onTap: () { @@ -70,145 +79,159 @@ class _AdmissionRequestSecondScreenState child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - PatientPageHeaderWidget(patient), + PatientProfileHeaderNewDesign( + patient, patientType, arrivalType), Container( - margin: EdgeInsets.symmetric( - vertical: 16, horizontal: 16), + margin: EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 16, + AppText( + "${TranslationBase.of(context).admission}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.6, + fontWeight: FontWeight.w600, ), + AppText( + "${TranslationBase.of(context).request}", + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 3, + fontWeight: FontWeight.bold, + ) + ], + ), + ), + Container( + margin: + EdgeInsets.symmetric(vertical: 0, horizontal: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ AppText( TranslationBase.of(context) .postPlansEstimatedCost, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .estimatedCost, - null, - false), - enabled: true, - controller: _estimatedCostController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).estimatedCost, + controller: _estimatedCostController, + inputType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + ), SizedBox( height: 10, ), - Container( - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).postPlans, - null, - false), - enabled: true, + AppTextFieldCustom( + hintText: TranslationBase.of(context).postPlans, controller: _postPlansEstimatedCostController, - keyboardType: TextInputType.text, + inputType: TextInputType.multiline, minLines: 4, maxLines: 6, - )), + ), SizedBox( height: 10, ), - Container( - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .otherDepartmentsInterventions, - null, - false), - enabled: true, - controller: + AppTextFieldCustom( + hintText: TranslationBase.of(context) + .otherDepartmentsInterventions, + controller: _otherDepartmentsInterventionsController, - keyboardType: TextInputType.multiline, - minLines: 2, - maxLines: 4, - )), + inputType: TextInputType.multiline, + minLines: 2, + maxLines: 4, + ), SizedBox( height: 10, ), AppText( TranslationBase.of(context).otherInformation, - fontWeight: FontWeight.bold, - fontSize: SizeConfig.textMultiplier * 2.5, + fontFamily: 'Poppins', + fontSize: SizeConfig.textMultiplier * 1.8, + fontWeight: FontWeight.w700, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedDays, - null, - false), - enabled: true, - controller: _expectedDaysController, - inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_NUMBERS)) - ], - keyboardType: TextInputType.number, - )), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).expectedDays, + controller: _expectedDaysController, + inputType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(ONLY_NUMBERS)) + ], + ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: () { - if (_expectedAdmissionDate == null) { - _expectedAdmissionDate = DateTime.now(); - } - _selectDate(context, _expectedAdmissionDate, - (picked) { - setState(() { - _expectedAdmissionDate = picked; - }); - }); - }, - child: TextField( - decoration: Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .expectedAdmissionDate, - _expectedAdmissionDate != null - ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" - : null, - true, - suffixIcon: Icon( - Icons.calendar_today, - color: Colors.black, - )), - enabled: false, - ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context) + .expectedAdmissionDate, + dropDownText: _expectedAdmissionDate != null + ? "${DateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" + : null, + enabled: false, + isDropDown: true, + suffixIcon: Icon( + Icons.calendar_today, + color: Colors.black, ), + onClick: () { + if (_expectedAdmissionDate == null) { + _expectedAdmissionDate = DateTime.now(); + } + _selectDate(context, _expectedAdmissionDate, + (picked) { + setState(() { + _expectedAdmissionDate = picked; + }); + }); + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.floorList != null && - model.floorList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).floor, + dropDownText: _selectedFloor != null + ? _selectedFloor['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.floorList != null && + model.floorList.length > 0 + ? () { + openListDialogField( + 'description', + 'floorID', + model.floorList, (selectedValue) { + setState(() { + _selectedFloor = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getFloors().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.floorList.length > 0) { openListDialogField( 'description', 'floorID', @@ -217,52 +240,47 @@ class _AdmissionRequestSecondScreenState _selectedFloor = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getFloors().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.floorList.length > 0) { - openListDialogField('description', - 'floorID', model.floorList, - (selectedValue) { - setState(() { - _selectedFloor = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).floor, - _selectedFloor != null - ? _selectedFloor['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.wardList != null && - model.wardList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: TranslationBase.of(context).ward, + dropDownText: _selectedWard != null + ? _selectedWard['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.wardList != null && + model.wardList.length > 0 + ? () { + openListDialogField( + 'description', + 'nursingStationID', + model.wardList, (selectedValue) { + setState(() { + _selectedWard = selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getWards().then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.wardList.length > 0) { openListDialogField( 'description', 'nursingStationID', @@ -271,54 +289,51 @@ class _AdmissionRequestSecondScreenState _selectedWard = selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getWards().then((_) => - GifLoaderDialogUtils.hideDialog( - context)); - if (model.state == ViewState.Idle && - model.wardList.length > 0) { - openListDialogField( - 'description', - 'nursingStationID', - model.wardList, - (selectedValue) { - setState(() { - _selectedWard = selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context).ward, - _selectedWard != null - ? _selectedWard['description'] - : null, - true), - enabled: false, - ), - ), + }, ), SizedBox( height: 10, ), - Container( - height: screenSize.height * 0.070, - child: InkWell( - onTap: model.roomCategoryList != null && - model.roomCategoryList.length > 0 - ? () { + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).roomCategory, + dropDownText: _selectedRoomCategory != null + ? _selectedRoomCategory['description'] + : null, + enabled: false, + isDropDown: true, + onClick: model.roomCategoryList != null && + model.roomCategoryList.length > 0 + ? () { + openListDialogField( + 'description', + 'categoryID', + model.roomCategoryList, + (selectedValue) { + setState(() { + _selectedRoomCategory = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getRoomCategories().then( + (_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.roomCategoryList.length > 0) { openListDialogField( 'description', 'categoryID', @@ -329,52 +344,103 @@ class _AdmissionRequestSecondScreenState selectedValue; }); }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); } - : () async { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getRoomCategories().then( - (_) => GifLoaderDialogUtils - .hideDialog(context)); - if (model.state == ViewState.Idle && - model.roomCategoryList.length > - 0) { - openListDialogField( - 'description', - 'categoryID', - model.roomCategoryList, - (selectedValue) { - setState(() { - _selectedRoomCategory = - selectedValue; - }); - }); - } else if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } else { - DrAppToastMsg.showErrorToast( - "Empty List"); - } - }, - child: TextField( - decoration: - Helpers.textFieldSelectorDecoration( - TranslationBase.of(context) - .roomCategory, - _selectedRoomCategory != null - ? _selectedRoomCategory[ - 'description'] - : null, - true), - enabled: false, - ), - ), + }, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).treatmentLine, + controller: _treatmentLineController, + inputType: TextInputType.multiline, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).complications, + controller: _complicationsController, + inputType: TextInputType.multiline, + minLines: 3, + maxLines: 5, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + hintText: + TranslationBase.of(context).otherProcedure, + controller: _otherProceduresController, + inputType: TextInputType.multiline, + minLines: 3, + maxLines: 5, ), SizedBox( height: 10, ), + AppTextFieldCustom( + height: screenSize.height * 0.075, + hintText: + TranslationBase.of(context).admissionType, + dropDownText: _selectedAdmissionType != null + ? _selectedAdmissionType['nameEn'] + : null, + enabled: false, + isDropDown: true, + onClick: model.admissionTypeList != null && + model.admissionTypeList.length > 0 + ? () { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } + : () async { + GifLoaderDialogUtils.showMyDialog( + context); + await model + .getMasterLookup(MasterKeysService + .AdmissionRequestType) + .then((_) => + GifLoaderDialogUtils.hideDialog( + context)); + if (model.state == ViewState.Idle && + model.admissionTypeList.length > + 0) { + openListDialogField('nameEn', 'id', + model.admissionTypeList, + (selectedValue) { + setState(() { + _selectedAdmissionType = + selectedValue; + }); + }); + } else if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } else { + DrAppToastMsg.showErrorToast( + "Empty List"); + } + }, + ), ], ), ), @@ -384,53 +450,91 @@ class _AdmissionRequestSecondScreenState ), Container( margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), - child: AppButton( - title: TranslationBase.of(context).next, - color: HexColor("#B8382B"), - onPressed: () async { - if (_estimatedCostController.text != "" && - _postPlansEstimatedCostController.text != "" && - _expectedDaysController.text != "" && - _expectedAdmissionDate != null && - _otherDepartmentsInterventionsController.text != "" && - _selectedFloor != null && - _selectedRoomCategory != - null /*_selectedWard is not required*/) { - model.admissionRequestData = admissionRequest; + child: Row( + children: [ + Expanded( + child: AppButton( + title: TranslationBase.of(context).previous, + color: HexColor("#EAEAEA"), + fontColor: Colors.black, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + SizedBox( + width: 10, + ), + Expanded( + child: AppButton( + title: TranslationBase.of(context).next, + color: HexColor("#D02127"), + onPressed: () async { + if (_estimatedCostController.text != "" && + _postPlansEstimatedCostController.text != "" && + _expectedDaysController.text != "" && + _expectedAdmissionDate != null && + _otherDepartmentsInterventionsController.text != + "" && + _selectedFloor != null && + _selectedRoomCategory != + null /*_selectedWard is not required*/ && + _treatmentLineController.text != "" && + _complicationsController.text != "" && + _otherProceduresController.text != "" && + _selectedAdmissionType != null) { + model.admissionRequestData = admissionRequest; - model.admissionRequestData.estimatedCost = - int.parse(_estimatedCostController.text); - model.admissionRequestData.elementsForImprovement = - _postPlansEstimatedCostController.text; + model.admissionRequestData.estimatedCost = + int.parse(_estimatedCostController.text); + model.admissionRequestData + .elementsForImprovement = + _postPlansEstimatedCostController.text; - model.admissionRequestData.expectedDays = - int.parse(_expectedDaysController.text); - model.admissionRequestData.admissionDate = - _expectedAdmissionDate.toIso8601String(); - model.admissionRequestData - .otherDepartmentInterventions = - _otherDepartmentsInterventionsController.text; - model.admissionRequestData.admissionLocationID = - _selectedFloor['floorID']; - model.admissionRequestData.wardID = - _selectedWard != null - ? _selectedWard['nursingStationID'] - : 0; - model.admissionRequestData.roomCategoryID = - _selectedRoomCategory['categoryID']; + model.admissionRequestData.expectedDays = + int.parse(_expectedDaysController.text); + model.admissionRequestData.admissionDate = + _expectedAdmissionDate.toIso8601String(); + model.admissionRequestData + .otherDepartmentInterventions = + _otherDepartmentsInterventionsController.text; + model.admissionRequestData.admissionLocationID = + _selectedFloor['floorID']; + model.admissionRequestData.wardID = + _selectedWard != null + ? _selectedWard['nursingStationID'] + : 0; + model.admissionRequestData.roomCategoryID = + _selectedRoomCategory['categoryID']; - model.admissionRequestData.admissionRequestProcedures = - []; - Navigator.of(context) - .pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: { - 'patient': patient, - 'admission-data': model.admissionRequestData - }); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).pleaseFill); - } - }, + model.admissionRequestData + .admissionRequestProcedures = []; + + model.admissionRequestData.mainLineOfTreatment = + _treatmentLineController.text; + model.admissionRequestData.complications = + _complicationsController.text; + model.admissionRequestData.otherProcedures = + _otherProceduresController.text; + model.admissionRequestData.admissionType = + _selectedAdmissionType['id']; + + Navigator.of(context).pushNamed( + PATIENT_ADMISSION_REQUEST_3, + arguments: { + 'patient': patient, + 'patientType': patientType, + 'arrivalType': arrivalType, + 'admission-data': model.admissionRequestData + }); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context).pleaseFill); + } + }, + ), + ), + ], ), ), ], diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index 7ff65bb1..d499636b 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -552,6 +552,8 @@ class TranslationBase { String get next => localizedValues['next'][locale.languageCode]; + String get previous => localizedValues['previous'][locale.languageCode]; + String get emptyMessage => localizedValues['empty-message'][locale.languageCode]; diff --git a/lib/widgets/shared/app-textfield-custom.dart b/lib/widgets/shared/app-textfield-custom.dart index 15c8865a..5cc6c417 100644 --- a/lib/widgets/shared/app-textfield-custom.dart +++ b/lib/widgets/shared/app-textfield-custom.dart @@ -1,6 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:flutter/material.dart'; - +import 'package:flutter/services.dart'; import 'app_texts_widget.dart'; class AppTextFieldCustom extends StatefulWidget { @@ -9,17 +9,30 @@ class AppTextFieldCustom extends StatefulWidget { final String hintText; final TextEditingController controller; final bool isDropDown; + final String dropDownText; final Icon suffixIcon; final Color dropDownColor; + final bool enabled; + final TextInputType inputType; + final int minLines; + final int maxLines; + final List inputFormatters; - AppTextFieldCustom( - {this.height = 0, - this.onClick, - this.hintText, - this.controller, - this.isDropDown = false, - this.suffixIcon, - this.dropDownColor}); + AppTextFieldCustom({ + this.height = 0, + this.onClick, + this.hintText, + this.controller, + this.isDropDown = false, + this.dropDownText, + this.suffixIcon, + this.dropDownColor, + this.enabled = true, + this.inputType = TextInputType.text, + this.minLines = 1, + this.maxLines = 1, + this.inputFormatters, + }); @override _AppTextFieldCustomState createState() => _AppTextFieldCustomState(); @@ -43,23 +56,38 @@ class _AppTextFieldCustomState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - if (widget.controller.text != "") + if ((widget.controller != null && + widget.controller.text != "") || + widget.dropDownText != null) AppText( widget.hintText, fontFamily: 'Poppins', fontSize: SizeConfig.textMultiplier * 1.4, fontWeight: FontWeight.w600, ), - TextField( - textAlign: TextAlign.left, - decoration: textFieldSelectorDecoration( - widget.hintText, null, true), - style: TextStyle( - fontSize: 14, - color: Colors.grey.shade600, - ), - controller: widget.controller, - ), + widget.dropDownText == null + ? TextField( + textAlign: TextAlign.left, + decoration: textFieldSelectorDecoration( + widget.hintText, null, true), + style: TextStyle( + fontSize: SizeConfig.textMultiplier * 1.7, + fontFamily: 'Poppins', + color: Colors.grey.shade800, + ), + controller: widget.controller, + keyboardType: widget.inputType, + enabled: widget.enabled, + minLines: widget.minLines, + maxLines: widget.maxLines, + inputFormatters: widget.inputFormatters != null ? widget.inputFormatters : [], + ) + : AppText( + widget.dropDownText, + fontFamily: 'Poppins', + color: Colors.grey.shade800, + fontSize: SizeConfig.textMultiplier * 1.7, + ), ], ), ), @@ -67,7 +95,7 @@ class _AppTextFieldCustomState extends State { ? widget.suffixIcon != null ? widget.suffixIcon : Icon( - Icons.arrow_drop_down, + Icons.keyboard_arrow_down, color: widget.dropDownColor != null ? widget.dropDownColor : Colors.black, @@ -85,7 +113,7 @@ class _AppTextFieldCustomState extends State { return BoxDecoration( color: containerColor, shape: BoxShape.rectangle, - borderRadius: BorderRadius.all(Radius.circular(8)), + borderRadius: BorderRadius.all(Radius.circular(12)), border: Border.fromBorderSide(BorderSide( color: borderColor, width: borderWidth == -1 ? 2.0 : borderWidth, @@ -102,6 +130,9 @@ class _AppTextFieldCustomState extends State { enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: Color(0Xffffffff)), ), + disabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Color(0Xffffffff)), + ), focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: Color(0Xffffffff)), ), From d45b8a9cc590be8999bc1d1ceea77ef61598ce27 Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 31 Mar 2021 16:59:32 +0300 Subject: [PATCH 007/297] change the font type in the app and Prescription --- lib/core/viewModel/procedure_View_model.dart | 4 + lib/main.dart | 2 +- .../radiology/radiology_details_page.dart | 37 ++- .../radiology/radiology_home_page.dart | 56 ++-- .../prescription/prescription_items_page.dart | 312 ++++++++---------- .../prescription/prescriptions_page.dart | 7 +- lib/screens/procedures/procedure_screen.dart | 2 +- .../patient-profile-header-new-design.dart | 30 +- ..._profile_header_with_appointment_card.dart | 61 +++- lib/widgets/shared/Text.dart | 3 +- lib/widgets/shared/app_button.dart | 2 +- lib/widgets/shared/app_texts_widget.dart | 2 +- lib/widgets/shared/doctor_card.dart | 24 +- pubspec.yaml | 20 +- 14 files changed, 283 insertions(+), 279 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 8af1144f..5c4bfbfe 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -40,6 +40,10 @@ class ProcedureViewModel extends BaseViewModel { filterType == FilterType.Clinic ? _finalRadiologyListClinic : _finalRadiologyListHospital; + + List get radiologyList => + _radiologyService.finalRadiologyList; + List get labOrdersResultsList => _labsService.labOrdersResultsList; diff --git a/lib/main.dart b/lib/main.dart index e3db2e49..a7515e7b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -61,7 +61,7 @@ class MyApp extends StatelessWidget { primarySwatch: Colors.grey, primaryColor: Colors.grey, buttonColor: HexColor('#B8382C'), - fontFamily: 'WorkSans', + fontFamily: 'Poppins', dividerColor: Colors.grey[350], backgroundColor: Color.fromRGBO(255, 255, 255, 1), ), diff --git a/lib/screens/patients/profile/radiology/radiology_details_page.dart b/lib/screens/patients/profile/radiology/radiology_details_page.dart index 8d27e704..ac94b3d3 100644 --- a/lib/screens/patients/profile/radiology/radiology_details_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_details_page.dart @@ -37,6 +37,7 @@ class RadiologyDetailsPage extends StatelessWidget { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ + PatientProfileHeaderWhitAppointment(patient: patient, patientType: patientType??"0", arrivalType: arrivalType??"0", @@ -46,10 +47,9 @@ class RadiologyDetailsPage extends StatelessWidget { profileUrl: finalRadiology.doctorImageURL, invoiceNO: finalRadiology.invoiceNo.toString(), ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.2, - ), + Container( + decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), @@ -60,21 +60,26 @@ class RadiologyDetailsPage extends StatelessWidget { SizedBox(height: 5,), Texts(TranslationBase.of(context).generalResult), SizedBox(height: 5,), - Texts( - '${finalRadiology.reportData}', - textAlign: TextAlign.start, - fontSize: 17, - color: Colors.grey, + Padding( + padding: const EdgeInsets.all(8.0), + child: Texts( + '${finalRadiology.reportData}', + textAlign: TextAlign.start, + fontSize: 17, + color: Colors.grey, + ), ), SizedBox(height: 25,), - Container( - width: MediaQuery.of(context).size.width * 0.8, - child: Button( - color: Colors.red, - onTap: () { - launch(model.radImageURL); - }, - title: TranslationBase.of(context).openRad, + Center( + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + child: Button( + color: Colors.red, + onTap: () { + launch(model.radImageURL); + }, + title: TranslationBase.of(context).openRad, + ), ), ), ], diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index a0f44cb7..f083f779 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -26,7 +26,7 @@ class RadiologyHomePage extends StatelessWidget { PatiantInformtion patient = routeArgs['patient']; String patientType = routeArgs['patientType']; String arrivalType = routeArgs['arrivalType']; - ProcedureViewModel model2 = ProcedureViewModel(); + return BaseView( onModelReady: (model) => model.getPatientRadOrders(patient), builder: (_, model, widget) => AppScaffold( @@ -39,7 +39,7 @@ class RadiologyHomePage extends StatelessWidget { physics: BouncingScrollPhysics(), children: [ PatientProfileHeaderNewDesign( - patient, patient.patientType.toString() ?? '0', patientType), + patient, patient.patientType.toString() ?? '0', arrivalType), SizedBox( height: 12, ), @@ -108,38 +108,26 @@ class RadiologyHomePage extends StatelessWidget { ), ), ), - ...List.generate( - model.finalRadiologyList.length, - (index) => AppExpandableNotifier( - title: model.finalRadiologyList[index].filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: model - .finalRadiologyList[index].finalRadiologyList - .map((radiology) { - return InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: RadiologyDetailsPage( - finalRadiology: radiology, - patient: patient, - ), - ), - ), - child: DoctorCard( - doctorName: radiology.doctorName, - profileUrl: radiology.doctorImageURL, - invoiceNO: '${radiology.invoiceNo}', - branch: '${radiology.projectName}', - appointmentDate: radiology.orderDate, - orderNo: radiology.orderNo.toString(), - ), - ); - }).toList(), - )), - ) + ...List.generate(model.radiologyList.length, (index) => InkWell( + onTap: () => Navigator.push( + context, + FadePage( + page: RadiologyDetailsPage( + finalRadiology: model.radiologyList[index], + patient: patient, + ), + ), + ), + child: DoctorCard( + doctorName: model.radiologyList[index].doctorName, + profileUrl: model.radiologyList[index].doctorImageURL, + invoiceNO: '${model.radiologyList[index].invoiceNo}', + branch: '${model.radiologyList[index].projectName}', + appointmentDate: model.radiologyList[index].orderDate, + orderNo: model.radiologyList[index].orderNo.toString(), + ), + )), + ], ), ), diff --git a/lib/screens/prescription/prescription_items_page.dart b/lib/screens/prescription/prescription_items_page.dart index 031ee85f..af5bbb3f 100644 --- a/lib/screens/prescription/prescription_items_page.dart +++ b/lib/screens/prescription/prescription_items_page.dart @@ -5,7 +5,9 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; 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/prescription_details_page.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/patient_profile_header_with_appointment_card.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; @@ -15,7 +17,9 @@ import 'package:flutter/material.dart'; class PrescriptionItemsPage extends StatelessWidget { final Prescriptions prescriptions; final PatiantInformtion patient; - PrescriptionItemsPage({Key key, this.prescriptions, this.patient}); + final String patientType; + final String arrivalType; + PrescriptionItemsPage({Key key, this.prescriptions, this.patient, this.patientType, this.arrivalType}); @override Widget build(BuildContext context) { @@ -23,199 +27,159 @@ class PrescriptionItemsPage extends StatelessWidget { onModelReady: (model) => model.getPrescriptionReport(prescriptions: prescriptions,patient: patient), builder: (_, model, widget) => AppScaffold( - isShowAppBar: true, - appBarTitle: TranslationBase.of(context).prescriptions, + isShowAppBar: false, baseViewModel: model, body: SingleChildScrollView( child: Container( child: Column( children: [ - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white, - ), - margin: EdgeInsets.all(12), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.only(left: 18,right: 18), - child: Texts('Name ',bold: true,)), - Row( - children: [ - SizedBox(width: 18,), - Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all(width: 0.5,color: Colors.grey) - ), - height: 45, - width: 45, - ), - SizedBox(width: 10,), - Expanded(child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts('Route: Monthly'), - Texts('Does: 2 Time a day with 1 hour gap'), - SizedBox(height: 12,), - Texts('Note: 2 Time a day with 1 hour gap'), - ], - ),) - - - ], - ) - ], - ), - ), + PatientProfileHeaderWhitAppointment(patient: patient, + patientType: patientType??"0", + arrivalType: arrivalType??"0", + branch: '', + clinic: prescriptions.clinicDescription, + isPrescriptions: true, + appointmentDate: DateUtils.getDateTimeFromServerFormat(prescriptions.appointmentDate), + doctorName: prescriptions.doctorName, + profileUrl: prescriptions.doctorImageURL, + // invoiceNO: widget.patientLabOrders.invoiceNo, ), if (!prescriptions.isInOutPatient) ...List.generate( model.prescriptionReportList.length, - (index) => InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: - model.prescriptionReportList[index], - ), - ), + (index) => Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, ), - child: Container( - width: double.infinity, - margin: - EdgeInsets.only(top: 10, left: 10, right: 10), - padding: EdgeInsets.all(8.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all( - color: Colors.grey[200], width: 0.5), - ), - child: Row( - children: [ - ClipRRect( - borderRadius: - BorderRadius.all(Radius.circular(5)), - child: Image.network( - model.prescriptionReportList[index] - .imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Texts(model - .prescriptionReportList[index] - .itemDescription - .isNotEmpty - ? model.prescriptionReportList[index] - .itemDescription - : model.prescriptionReportList[index] - .itemDescriptionN)), - )), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], + margin: EdgeInsets.all(12), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 18,right: 18), + child: Texts(model.prescriptionReportList[index].itemDescription.isNotEmpty ? model.prescriptionReportList[index].itemDescription : model.prescriptionReportList[index].itemDescriptionN,bold: true,)), + SizedBox(height: 12,), + Row( + children: [ + SizedBox(width: 18,), + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 0.5,color: Colors.grey) + ), + height: 55, + width: 55, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.network( + model.prescriptionReportList[index].imageSRCUrl, + fit: BoxFit.cover, + ), + ), + ), + SizedBox(width: 10,), + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).route,color: Colors.grey,), + Expanded(child: Texts(model.prescriptionReportList[index].routeN)), + ], + ), + Row( + children: [ + Texts(TranslationBase.of(context).frequency,color: Colors.grey,), + Texts(model.prescriptionReportList[index].frequencyN ?? ''), + ], + ), + SizedBox(height: 12,), + Texts(model.prescriptionReportList[index].remarks ?? ''), + ], + ),) + + + ], ) ], ), ), )) + else - ...List.generate( - model.prescriptionReportEnhList.length, - (index) => InkWell( - onTap: () { - PrescriptionReport prescriptionReport = - PrescriptionReport( - imageSRCUrl: model - .prescriptionReportEnhList[index].imageSRCUrl, - itemDescription: model - .prescriptionReportEnhList[index] - .itemDescription, - itemDescriptionN: model - .prescriptionReportEnhList[index] - .itemDescription, - routeN: - model.prescriptionReportEnhList[index].route, - frequency: model - .prescriptionReportEnhList[index].frequency, - frequencyN: model - .prescriptionReportEnhList[index].frequency, - doseDailyQuantity: model - .prescriptionReportEnhList[index] - .doseDailyQuantity, - days: model.prescriptionReportEnhList[index].days, - itemID: - model.prescriptionReportEnhList[index].itemID, - remarks: model - .prescriptionReportEnhList[index].remarks); - Navigator.push( - context, - FadePage( - page: PrescriptionDetailsPage( - prescriptionReport: prescriptionReport, - ), + ...List.generate( + model.prescriptionReportEnhList.length, + (index) => Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Colors.white, + ), + margin: EdgeInsets.all(12), + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.only(left: 18,right: 18), + child: Texts(model.prescriptionReportEnhList[index].itemDescription,bold: true,),), + SizedBox(height: 12,), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(width: 18,), + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(width: 0.5,color: Colors.grey) + ), + height: 55, + width: 55, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Image.network( + model.prescriptionReportEnhList[index].imageSRCUrl, + fit: BoxFit.cover, + + ), + ), + ), + SizedBox(width: 10,), + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Texts(TranslationBase.of(context).route,color: Colors.grey,), + Expanded(child: Texts(model.prescriptionReportEnhList[index].route??'')), + ], + ), + Row( + children: [ + Texts(TranslationBase.of(context).frequency,color: Colors.grey,), + Texts(model.prescriptionReportEnhList[index].frequency ?? ''), + ], + ), + SizedBox(height: 12,), + Texts(model.prescriptionReportEnhList[index].remarks?? ''), + ], + ),) + + + ], + ) + ], ), - ); - }, - child: Container( - margin: EdgeInsets.all(8.0), - color: Colors.white, - child: Row( - children: [ - ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(5)), - child: Image.network( - model - .prescriptionReportEnhList[index].imageSRCUrl, - fit: BoxFit.cover, - width: 60, - height: 70, - ), - ), - SizedBox( - width: 10, - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(model.prescriptionReportEnhList[index] - .itemDescription), - ], - ), - ), - ), - Icon( - Icons.arrow_forward_ios, - size: 18, - color: Colors.grey[500], - ) - ], ), ), - ), - ), + ), + + ], ), diff --git a/lib/screens/prescription/prescriptions_page.dart b/lib/screens/prescription/prescriptions_page.dart index 9f7e7f2f..ec27f4bc 100644 --- a/lib/screens/prescription/prescriptions_page.dart +++ b/lib/screens/prescription/prescriptions_page.dart @@ -91,6 +91,8 @@ class PrescriptionsPage extends StatelessWidget { page: PrescriptionItemsPage( prescriptions: model.prescriptionsList[index], patient: patient, + patientType: patientType, + arrivalType: arrivalType, ), ), ), @@ -98,10 +100,9 @@ class PrescriptionsPage extends StatelessWidget { doctorName: model.prescriptionsList[index].doctorName, profileUrl: model.prescriptionsList[index].doctorImageURL, branch: model.prescriptionsList[index].name, + clinic: model.prescriptionsList[index].clinicDescription, + isPrescriptions: true, appointmentDate: DateUtils.getDateTimeFromServerFormat(model.prescriptionsList[index].appointmentDate,), - orderNo: model.prescriptionsList[index].appointmentNo.toString(), - invoiceNO:model.prescriptionsList[index].appointmentNo.toString(), - ) )) diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 902a5022..fd3b78b9 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -28,7 +28,7 @@ class _ProcedureScreenState extends State { } TextEditingController procedureController = TextEditingController(); - + //TODO Jammal @override Widget build(BuildContext context) { final routeArgs = ModalRoute.of(context).settings.arguments as Map; diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design.dart b/lib/widgets/patients/profile/patient-profile-header-new-design.dart index b50a191b..848bda41 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design.dart @@ -22,7 +22,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { Widget build(BuildContext context) { return Container( padding: EdgeInsets.only( - left: 0, right: 5, bottom: 5, top: 5), + left: 0, right: 5, bottom: 5,), decoration: BoxDecoration( color: Colors.white, ), @@ -188,9 +188,7 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { ), Container( child: AppText( - convertDateFormat2(patient - .appointmentDate - .toString()), + convertDateFormat2(patient.appointmentDate.toString()?? ''), fontSize: 1.5 * SizeConfig .textMultiplier, @@ -314,20 +312,22 @@ class PatientProfileHeaderNewDesign extends StatelessWidget { } convertDateFormat2(String str) { - String timeConvert; + String newDate; const start = "/Date("; - const end = "+0300)"; + if (str.isNotEmpty) { + const end = "+0300)"; - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + } return newDate.toString(); } diff --git a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart index 61de70e1..57f79f7a 100644 --- a/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart +++ b/lib/widgets/patients/profile/patient_profile_header_with_appointment_card.dart @@ -26,7 +26,8 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { final String profileUrl; final String invoiceNO; final String orderNo; - + final bool isPrescriptions; + final String clinic; PatientProfileHeaderWhitAppointment( {this.patient, this.patientType, @@ -36,7 +37,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { this.appointmentDate, this.profileUrl, this.invoiceNO, - this.orderNo}); + this.orderNo, this.isPrescriptions = false, this.clinic}); @override Widget build(BuildContext context) { @@ -209,9 +210,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { ), Container( child: AppText( - convertDateFormat2(patient - .appointmentDate - .toString()), + convertDateFormat2(patient.appointmentDate??''), fontSize: 1.5 * SizeConfig .textMultiplier, @@ -371,7 +370,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { fontWeight: FontWeight.w600, fontSize: 14, ), - if (orderNo != null) + if (orderNo != null && !isPrescriptions) Row( children: [ Texts( @@ -383,7 +382,7 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { ) ], ), - if (invoiceNO != null) + if (invoiceNO != null && !isPrescriptions) Row( children: [ Texts( @@ -395,10 +394,34 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { ) ], ), + if(isPrescriptions) + Row( + children: [ + Texts( + 'Branch:', + color: Colors.grey[800], + ), + Texts( + branch?? '', + ) + ], + ), + if(isPrescriptions) + Row( + children: [ + Texts( + 'Clinic:', + color: Colors.grey[800], + ), + Texts( + clinic?? '', + ) + ], + ), Row( children: [ Texts( - 'Result Date:', + !isPrescriptions? 'Result Date:': 'Prescriptions Date', color: Colors.grey[800], ), Expanded( @@ -425,20 +448,22 @@ class PatientProfileHeaderWhitAppointment extends StatelessWidget { } convertDateFormat2(String str) { - String timeConvert; + String newDate =""; const start = "/Date("; const end = "+0300)"; - final startIndex = str.indexOf(start); - final endIndex = str.indexOf(end, startIndex + start.length); + if (str.isNotEmpty) { + final startIndex = str.indexOf(start); + final endIndex = str.indexOf(end, startIndex + start.length); - var date = new DateTime.fromMillisecondsSinceEpoch( - int.parse(str.substring(startIndex + start.length, endIndex))); - String newDate = date.year.toString() + - "/" + - date.month.toString().padLeft(2, '0') + - "/" + - date.day.toString().padLeft(2, '0'); + var date = new DateTime.fromMillisecondsSinceEpoch( + int.parse(str.substring(startIndex + start.length, endIndex))); + newDate = date.year.toString() + + "/" + + date.month.toString().padLeft(2, '0') + + "/" + + date.day.toString().padLeft(2, '0'); + } return newDate.toString(); } diff --git a/lib/widgets/shared/Text.dart b/lib/widgets/shared/Text.dart index 59929075..d3fa3cb9 100644 --- a/lib/widgets/shared/Text.dart +++ b/lib/widgets/shared/Text.dart @@ -217,6 +217,7 @@ class _TextsState extends State { letterSpacing: widget.variant == "overline" ? 1.5 : null, fontWeight: widget.fontWeight ?? _getFontWeight(), + fontFamily: 'Poppins', decoration: widget.textDecoration //TextDecoration.lineThrough )), @@ -251,7 +252,7 @@ class _TextsState extends State { style: _getFontStyle().copyWith( color: HexColor('#FF0000'), fontWeight: FontWeight.w800, - fontFamily: "WorkSans", + fontFamily: "Poppins", )), ), ), diff --git a/lib/widgets/shared/app_button.dart b/lib/widgets/shared/app_button.dart index 60a3528d..3f9c4549 100644 --- a/lib/widgets/shared/app_button.dart +++ b/lib/widgets/shared/app_button.dart @@ -138,7 +138,7 @@ class _ButtonState extends State