From 725c87fe8b148e8b287909a5a463a2734608576e Mon Sep 17 00:00:00 2001 From: Mohammad Aljammal Date: Wed, 26 May 2021 15:27:52 +0300 Subject: [PATCH] Add favorite procedure templates for lab and radiology --- lib/core/service/home/dasboard_service.dart | 2 +- lib/core/viewModel/procedure_View_model.dart | 1 + lib/screens/home/home_screen.dart | 6 +- .../live_care/live_care_patient_screen.dart | 2 +- .../insurance_approval_screen_patient.dart | 2 +- .../radiology/radiology_home_page.dart | 3 +- .../procedures/ExpansionProcedure.dart | 39 +-- .../procedures/add-favourite-procedure.dart | 69 ++--- .../procedures/add-procedure-form.dart | 158 +----------- .../procedures/add_lab_home_screen.dart | 218 ++++++++++++++++ lib/screens/procedures/add_lab_orders.dart | 6 +- .../procedures/add_procedure_homeScreen.dart | 2 + .../procedures/add_radiology_order.dart | 5 +- .../procedures/add_radiology_screen.dart | 219 ++++++++++++++++ .../procedures/entity_list_fav_procedure.dart | 3 +- .../procedures/procedure_checkout_screen.dart | 237 +++++++++--------- 16 files changed, 635 insertions(+), 337 deletions(-) create mode 100644 lib/screens/procedures/add_lab_home_screen.dart create mode 100644 lib/screens/procedures/add_radiology_screen.dart diff --git a/lib/core/service/home/dasboard_service.dart b/lib/core/service/home/dasboard_service.dart index ba836287..b35d24f2 100644 --- a/lib/core/service/home/dasboard_service.dart +++ b/lib/core/service/home/dasboard_service.dart @@ -44,7 +44,7 @@ class DashboardService extends BaseService { super.error = error; }, body: { - "DoctorID": doctorProfile.doctorID// test user 9920 + "DoctorID": doctorProfile?.doctorID// test user 9920 }, ); } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 29b4b0e4..823ca2b4 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -23,6 +23,7 @@ import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:flutter/cupertino.dart'; class ProcedureViewModel extends BaseViewModel { + //TODO Hussam clean it FilterType filterType = FilterType.Clinic; bool hasError = false; ProcedureService _procedureService = locator(); diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index b2020abe..c305b752 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -241,12 +241,12 @@ class _HomeScreenState extends State { ), sliderActiveIndex == 1 ? DashboardSliderItemWidget( - model.dashboardItemsList[6]) + model.dashboardItemsList[4]) : sliderActiveIndex == 0 ? DashboardSliderItemWidget( model.dashboardItemsList[3]) : DashboardSliderItemWidget( - model.dashboardItemsList[4]), + model.dashboardItemsList[6]), ]))) : SizedBox(), FractionallySizedBox( @@ -332,7 +332,7 @@ class _HomeScreenState extends State { patientCards.add(HomePatientCard( backgroundColor: backgroundColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex], - cardIcon: DoctorApp.inpatient, + cardIcon: DoctorApp.livecare, textColor: textColors[colorIndex], text: "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index abe8cf58..6bef6d5f 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -51,7 +51,7 @@ class _LiveCarePatientScreenState extends State { ), Expanded( child: AppText( - "Live Care Patients", + "LiveCare Patients", fontSize: SizeConfig.textMultiplier * 2.8, fontWeight: FontWeight.bold, color: Color(0xFF2B353E), diff --git a/lib/screens/patients/insurance_approval_screen_patient.dart b/lib/screens/patients/insurance_approval_screen_patient.dart index 2e4645ae..2bffdda5 100644 --- a/lib/screens/patients/insurance_approval_screen_patient.dart +++ b/lib/screens/patients/insurance_approval_screen_patient.dart @@ -39,7 +39,7 @@ class _InsuranceApprovalScreenNewState ? (model) => model.getInsuranceInPatient(mrn: patient.patientId) : patient.appointmentNo != null ? (model) => model.getInsuranceApproval(patient, - appointmentNo: patient.appointmentNo, + appointmentNo: patient?.appointmentNo, projectId: patient.projectId) : (model) => model.getInsuranceApproval(patient), builder: (BuildContext context, InsuranceViewModel model, Widget child) => diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 7d70b677..4e969793 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/radiology/radiology_details_page.dart'; import 'package:doctor_app_flutter/screens/procedures/add_radiology_order.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_radiology_screen.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; @@ -117,7 +118,7 @@ class _RadiologyHomePageState extends State { context, MaterialPageRoute( builder: (context) => - AddSelectedRadiologyOrder( + AddRadiologyScreen( patient: patient, model: model, )), diff --git a/lib/screens/procedures/ExpansionProcedure.dart b/lib/screens/procedures/ExpansionProcedure.dart index 188f6634..cdad16da 100644 --- a/lib/screens/procedures/ExpansionProcedure.dart +++ b/lib/screens/procedures/ExpansionProcedure.dart @@ -11,7 +11,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ExpansionProcedure extends StatefulWidget { - final ProcedureTempleteModel procedureTempleteModel; + final ProcedureTempleteDetailsModelList procedureTempleteModel; final ProcedureViewModel model; final Function(ProcedureTempleteDetailsModel) removeFavProcedure; final Function(ProcedureTempleteDetailsModel) addFavProcedure; @@ -37,19 +37,14 @@ class ExpansionProcedure extends StatefulWidget { class _ExpansionProcedureState extends State { bool _isShowMore = false; - List _templateDetailsList = List(); BaseAppClient baseAppClient = BaseAppClient(); + @override Widget build(BuildContext context) { return Column( children: [ InkWell( onTap: () async { - if (!_isShowMore && _templateDetailsList.isEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - await getProcedureTemplateDetails(widget.procedureTempleteModel.templateID); - GifLoaderDialogUtils.hideDialog(context); - } setState(() { _isShowMore = !_isShowMore; }); @@ -116,8 +111,8 @@ class _ExpansionProcedureState extends State { )), duration: Duration(milliseconds: 7000), child: Column( - children: - _templateDetailsList.map((itemProcedure) { + children: widget.procedureTempleteModel.procedureTemplate + .map((itemProcedure) { return Container( child: Padding( padding: EdgeInsets.symmetric(horizontal: 12), @@ -135,8 +130,10 @@ class _ExpansionProcedureState extends State { activeColor: Color(0xffD02127), onChanged: (bool newValue) { setState(() { - if (widget.isEntityFavListSelected(itemProcedure)) { - widget.removeFavProcedure(itemProcedure); + if (widget.isEntityFavListSelected( + itemProcedure)) { + widget + .removeFavProcedure(itemProcedure); } else { widget.addFavProcedure(itemProcedure); } @@ -145,8 +142,7 @@ class _ExpansionProcedureState extends State { ), Expanded( child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 10, vertical: 0), + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 0), child: AppText(itemProcedure.procedureName, fontSize: 14.0, variant: "bodyText", @@ -169,21 +165,4 @@ class _ExpansionProcedureState extends State { ], ); } - - getProcedureTemplateDetails(templateId)async { - ProcedureTempleteDetailsRequestModel _procedureTempleteDetailsRequestModel = ProcedureTempleteDetailsRequestModel(templateID: templateId, searchType: 1, patientID: 0); - _templateDetailsList.clear(); - await baseAppClient.post(GET_PROCEDURE_TEMPLETE_DETAILS, - onSuccess: (dynamic response, int statusCode) { - response['HIS_ProcedureTemplateDetailsList'].forEach((template) { - setState(() { - _templateDetailsList.add(ProcedureTempleteDetailsModel.fromJson(template)); - }); - }); - }, onFailure: (String error, int statusCode) { - DrAppToastMsg.showErrorToast(error); - - }, body: _procedureTempleteDetailsRequestModel.toJson()); - } - } diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index be6e3451..7e43f934 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -20,9 +20,17 @@ import 'package:flutter/material.dart'; class AddFavouriteProcedure extends StatefulWidget { final ProcedureViewModel model; final PatiantInformtion patient; + final String categoryID; + final String addButtonTitle; + final String toolbarTitle; - const AddFavouriteProcedure({Key key, this.model, this.patient}) - : super(key: key); + AddFavouriteProcedure( + {Key key, + this.model, + this.patient, + this.categoryID, + @required this.addButtonTitle, + @required this.toolbarTitle}); @override _AddFavouriteProcedureState createState() => _AddFavouriteProcedureState(); @@ -46,6 +54,7 @@ class _AddFavouriteProcedureState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, + baseViewModel: model, body: Column( children: [ Container( @@ -54,27 +63,25 @@ class _AddFavouriteProcedureState extends State { if (model.procedureTemplate.length != 0) Expanded( child: NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchFavProceduresWidget( - model: widget.model, - masterList: widget.model.procedureTemplate, - removeFavProcedure: (item) { - setState(() { - entityList.remove(item); - }); - }, - addFavProcedure: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); - }, - isEntityFavListSelected: (master) => - isEntityListSelected(master), - )), + baseViewModel: model, + child: EntityListCheckboxSearchFavProceduresWidget( + model: widget.model, + masterList: widget.model.procedureTemplate, + //TODO change it to the new model + removeFavProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addFavProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + isEntityFavListSelected: (master) => + isEntityListSelected(master), + ), + ), ), Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), @@ -82,7 +89,8 @@ class _AddFavouriteProcedureState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: TranslationBase.of(context).addSelectedProcedures, + title: widget.addButtonTitle ?? + TranslationBase.of(context).addSelectedProcedures, color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () { @@ -97,11 +105,14 @@ class _AddFavouriteProcedureState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => ProcedureCheckOutScreen( - items: entityList, - model: model, - patient: widget.patient, - )), + builder: (context) => ProcedureCheckOutScreen( + items: entityList, + model: model, + patient: widget.patient, + addButtonTitle: widget.addButtonTitle, + toolbarTitle: widget.toolbarTitle, + ), + ), ); }, ), diff --git a/lib/screens/procedures/add-procedure-form.dart b/lib/screens/procedures/add-procedure-form.dart index 4e08a73d..844ff246 100644 --- a/lib/screens/procedures/add-procedure-form.dart +++ b/lib/screens/procedures/add-procedure-form.dart @@ -111,6 +111,7 @@ class AddSelectedProcedure extends StatefulWidget { const AddSelectedProcedure({Key key, this.model, this.patient}) : super(key: key); + @override _AddSelectedProcedureState createState() => _AddSelectedProcedureState(patient: patient, model: model); @@ -120,7 +121,9 @@ class _AddSelectedProcedureState extends State { int selectedType; ProcedureViewModel model; PatiantInformtion patient; + _AddSelectedProcedureState({this.patient, this.model}); + TextEditingController procedureController = TextEditingController(); TextEditingController remarksController = TextEditingController(); List entityList = List(); @@ -220,7 +223,8 @@ class _AddSelectedProcedureState extends State { if (procedureName.text.isNotEmpty && procedureName.text.length >= 3) model.getProcedureCategory( - categoryName: procedureName.text); + categoryName: + procedureName.text); else DrAppToastMsg.showErrorToast( TranslationBase.of(context) @@ -235,90 +239,11 @@ class _AddSelectedProcedureState extends State { ), ], ), - // SizedBox( - // width: MediaQuery.of(context).size.width * 0.29, - // ), - // InkWell( - // child: Icon( - // Icons.close, - // size: 24.0, - // ), - // onTap: () { - // Navigator.pop(context); - // }, - // ), - // ], - // ), - // SizedBox( - // height: 10.0, - // ), - // Container( - // height: screenSize.height * 0.070, - // child: InkWell( - // onTap: model.categoryList != null && - // model.categoryList.length > 0 - // ? () { - // ListSelectDialog dialog = - // ListSelectDialog( - // list: model.categoryList, - // attributeName: 'categoryName', - // attributeValueId: 'categoryId', - // okText: TranslationBase.of(context).ok, - // okFunction: (selectedValue) { - // setState(() { - // selectedCategory = selectedValue; - // model.getProcedureCategory( - // categoryName: selectedCategory[ - // 'categoryName'], - // categoryID: selectedCategory[ - // 'categoryId'] <= - // 9 - // ? "0" + - // selectedCategory[ - // 'categoryId'] - // .toString() - // : selectedCategory[ - // 'categoryId'] - // .toString()); - // }); - // }, - // ); - // showDialog( - // barrierDismissible: false, - // context: context, - // builder: (BuildContext context) { - // return dialog; - // }, - // ); - // //model.getProcedureCategory(); - // } - // : null, - // child: TextField( - // decoration: textFieldSelectorDecoration( - // TranslationBase.of(context) - // .procedureCategorise, - // selectedCategory != null - // ? selectedCategory['categoryName'] - // : null, - // true, - // suffixIcon: Icon( - // Icons.search, - // color: Colors.black, - // )), - // enabled: false, - // ), - // ), - // ), if (procedureName.text.isNotEmpty && model.procedureList.length != 0) NetworkBaseView( baseViewModel: model, - child: - // selectedCategory != null - // ? selectedCategory['categoryId'] == 02 || - // selectedCategory['categoryId'] == 03 - // ? - EntityListCheckboxSearchWidget( + child: EntityListCheckboxSearchWidget( model: widget.model, masterList: widget .model.categoriesList[0].entityList, @@ -338,77 +263,10 @@ class _AddSelectedProcedureState extends State { }, isEntityListSelected: (master) => isEntityListSelected(master), - ) - // : ProcedureListWidget( - // model: widget.model, - // masterList: widget.model - // .categoriesList[0].entityList, - // removeHistory: (item) { - // setState(() { - // entityList.remove(item); - // }); - // }, - // addHistory: (history) { - // setState(() { - // entityList.add(history); - // }); - // }, - // addSelectedHistories: () { - // //TODO build your fun herr - // // widget.addSelectedHistories(); - // }, - // isEntityListSelected: (master) => - // isEntityListSelected(master), - // ) - // : null, - ), + )), SizedBox( - height: 15.0, + height: 115.0, ), - Column( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - // Container( - // child: Row( - // children: [ - // AppText( - // TranslationBase.of(context).orderType), - // Radio( - // activeColor: Color(0xFFB9382C), - // value: 1, - // groupValue: selectedType, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text('routine'), - // Radio( - // activeColor: Color(0xFFB9382C), - // groupValue: selectedType, - // value: 0, - // onChanged: (value) { - // setSelectedType(value); - // }, - // ), - // Text(TranslationBase.of(context).urgent), - // ], - // ), - // ), - // SizedBox( - // height: 15.0, - // ), - // TextFields( - // hintText: TranslationBase.of(context).remarks, - // controller: remarksController, - // minLines: 3, - // maxLines: 5, - // ), - SizedBox( - height: 100.0, - ), - ], - ) ], ), ), diff --git a/lib/screens/procedures/add_lab_home_screen.dart b/lib/screens/procedures/add_lab_home_screen.dart new file mode 100644 index 00000000..d86c4ecd --- /dev/null +++ b/lib/screens/procedures/add_lab_home_screen.dart @@ -0,0 +1,218 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_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/procedures/add-favourite-procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'add_lab_orders.dart'; + +class AddLabHomeScreen extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + const AddLabHomeScreen({Key key, this.model, this.patient}) : super(key: key); + @override + _AddLabHomeScreenState createState() => + _AddLabHomeScreenState(patient: patient, model: model); +} + +class _AddLabHomeScreenState extends State + with SingleTickerProviderStateMixin { + _AddLabHomeScreenState({this.patient, this.model}); + ProcedureViewModel model; + PatiantInformtion patient; + TabController _tabController; + int _activeTab = 0; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + 'Add Procedure', + fontWeight: FontWeight.w700, + fontSize: 20, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ) + ]), + SizedBox( + height: MediaQuery.of(context).size.height * 0.04, + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: + MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + "Favorite Templates", + ), + tabWidget( + screenSize, + _activeTab == 1, + 'All Lab', + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + AddFavouriteProcedure( + patient: patient, + model: model, + addButtonTitle: TranslationBase.of(context).addLabOrder, + toolbarTitle: TranslationBase.of(context).applyForNewLabOrder, + categoryID: "02", + ), + AddSelectedLabOrder( + model: model, + patient: patient, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + }), + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/procedures/add_lab_orders.dart b/lib/screens/procedures/add_lab_orders.dart index cd3205df..a4cb4e68 100644 --- a/lib/screens/procedures/add_lab_orders.dart +++ b/lib/screens/procedures/add_lab_orders.dart @@ -218,14 +218,10 @@ class _AddSelectedLabOrderState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: TranslationBase.of(context) - .addLabOrder, //TranslationBase.of(context) + title: TranslationBase.of(context).addLabOrder, fontWeight: FontWeight.w700, - //.addSelectedProcedures, color: Color(0xff359846), onPressed: () { - //print(entityList.toString()); - onPressed: if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( TranslationBase.of(context) diff --git a/lib/screens/procedures/add_procedure_homeScreen.dart b/lib/screens/procedures/add_procedure_homeScreen.dart index 4a4d8242..39ed4b25 100644 --- a/lib/screens/procedures/add_procedure_homeScreen.dart +++ b/lib/screens/procedures/add_procedure_homeScreen.dart @@ -147,6 +147,8 @@ class _AddProcedureHomeState extends State AddFavouriteProcedure( patient: patient, model: model, + addButtonTitle: TranslationBase.of(context).addSelectedProcedures, + toolbarTitle: 'Add Procedure', ), AddSelectedProcedure( model: model, diff --git a/lib/screens/procedures/add_radiology_order.dart b/lib/screens/procedures/add_radiology_order.dart index 3f19e7f9..78e91ba8 100644 --- a/lib/screens/procedures/add_radiology_order.dart +++ b/lib/screens/procedures/add_radiology_order.dart @@ -110,6 +110,7 @@ class AddSelectedRadiologyOrder extends StatefulWidget { const AddSelectedRadiologyOrder({Key key, this.model, this.patient}) : super(key: key); + @override _AddSelectedRadiologyOrderState createState() => _AddSelectedRadiologyOrderState(patient: patient, model: model); @@ -119,7 +120,9 @@ class _AddSelectedRadiologyOrderState extends State { int selectedType; ProcedureViewModel model; PatiantInformtion patient; + _AddSelectedRadiologyOrderState({this.patient, this.model}); + TextEditingController procedureController = TextEditingController(); TextEditingController remarksController = TextEditingController(); List entityList = List(); @@ -221,8 +224,6 @@ class _AddSelectedRadiologyOrderState extends State { color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () { - //print(entityList.toString()); - onPressed: if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast(TranslationBase.of(context) .fillTheMandatoryProcedureDetails); diff --git a/lib/screens/procedures/add_radiology_screen.dart b/lib/screens/procedures/add_radiology_screen.dart new file mode 100644 index 00000000..ac21e7d9 --- /dev/null +++ b/lib/screens/procedures/add_radiology_screen.dart @@ -0,0 +1,219 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_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/procedures/add-favourite-procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.dart'; +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'add_lab_orders.dart'; +import 'add_radiology_order.dart'; + +class AddRadiologyScreen extends StatefulWidget { + final ProcedureViewModel model; + final PatiantInformtion patient; + const AddRadiologyScreen({Key key, this.model, this.patient}) : super(key: key); + @override + _AddRadiologyScreenState createState() => + _AddRadiologyScreenState(patient: patient, model: model); +} + +class _AddRadiologyScreenState extends State + with SingleTickerProviderStateMixin { + _AddRadiologyScreenState({this.patient, this.model}); + ProcedureViewModel model; + PatiantInformtion patient; + TabController _tabController; + int _activeTab = 0; + + @override + void initState() { + super.initState(); + _tabController = TabController(length: 2, vsync: this); + _tabController.addListener(_handleTabSelection); + } + + @override + void dispose() { + super.dispose(); + _tabController.dispose(); + } + + _handleTabSelection() { + setState(() { + _activeTab = _tabController.index; + }); + } + + @override + Widget build(BuildContext context) { + final screenSize = MediaQuery.of(context).size; + return BaseView( + builder: (BuildContext context, ProcedureViewModel model, Widget child) => + AppScaffold( + isShowAppBar: false, + body: NetworkBaseView( + baseViewModel: model, + child: DraggableScrollableSheet( + minChildSize: 0.90, + initialChildSize: 0.95, + maxChildSize: 1.0, + builder: + (BuildContext context, ScrollController scrollController) { + return Container( + height: MediaQuery.of(context).size.height * 1.20, + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context).addLabOrder, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + InkWell( + child: Icon( + Icons.close, + size: 24.0, + ), + onTap: () { + Navigator.pop(context); + }, + ) + ]), + SizedBox( + height: MediaQuery.of(context).size.height * 0.04, + ), + Expanded( + child: Scaffold( + extendBodyBehindAppBar: true, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + MediaQuery.of(context).size.height * 0.070), + child: Container( + height: + MediaQuery.of(context).size.height * 0.070, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).dividerColor, + width: 0.5), //width: 0.7 + ), + color: Colors.white), + child: Center( + child: TabBar( + isScrollable: false, + controller: _tabController, + indicatorColor: Colors.transparent, + indicatorWeight: 1.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Theme.of(context).primaryColor, + labelPadding: EdgeInsets.only( + top: 0, left: 0, right: 0, bottom: 0), + unselectedLabelColor: Colors.grey[800], + tabs: [ + tabWidget( + screenSize, + _activeTab == 0, + "Favorite Templates", + ), + tabWidget( + screenSize, + _activeTab == 1, + 'All Radiology', + ), + ], + ), + ), + ), + ), + body: Column( + children: [ + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController, + children: [ + AddFavouriteProcedure( + patient: patient, + model: model, + addButtonTitle: TranslationBase.of(context).addLabOrder, + toolbarTitle: TranslationBase.of(context).applyForNewLabOrder, + categoryID: "03", + ), + AddSelectedRadiologyOrder( + model: model, + patient: patient, + ), + ], + ), + ), + ], + ), + ), + ), + ], + ), + ), + ); + }), + ), + ), + ); + } + + Widget tabWidget(Size screenSize, bool isActive, String title, + {int counter = -1}) { + return Center( + child: Container( + height: screenSize.height * 0.070, + decoration: TextFieldsUtils.containerBorderDecoration( + isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA), + isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA), + borderRadius: 4, + borderWidth: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + title, + fontSize: SizeConfig.textMultiplier * 1.5, + color: isActive ? Colors.white : Color(0xFF2B353E), + fontWeight: FontWeight.w700, + ), + if (counter != -1) + Container( + margin: EdgeInsets.all(4), + width: 15, + height: 15, + decoration: BoxDecoration( + color: isActive ? Colors.white : Color(0xFFD02127), + shape: BoxShape.circle, + ), + child: Center( + child: FittedBox( + child: AppText( + "$counter", + fontSize: SizeConfig.textMultiplier * 1.5, + color: !isActive ? Colors.white : Color(0xFFD02127), + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart index 1dac2f24..c5189a48 100644 --- a/lib/screens/procedures/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -61,6 +61,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState } List items = List(); + List itemss = List(); List itemsProcedure = List(); List remarksList = List(); List typeList = List(); @@ -104,7 +105,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState ), items.length != 0 ? Column( - children: items.map((historyInfo) { + children: itemss.map((historyInfo) { return ExpansionProcedure( procedureTempleteModel: historyInfo, model: widget.model, diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index f5b6dcb7..76d6cf6f 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -14,10 +14,14 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ProcedureCheckOutScreen extends StatefulWidget { - ProcedureCheckOutScreen({this.items, this.model, this.patient}); final List items; final ProcedureViewModel model; final PatiantInformtion patient; + final String addButtonTitle; + final String toolbarTitle; + + ProcedureCheckOutScreen( + {this.items, this.model, this.patient,@required this.addButtonTitle,@required this.toolbarTitle}); @override _ProcedureCheckOutScreenState createState() => @@ -63,7 +67,7 @@ class _ProcedureCheckOutScreenState extends State { width: 5.0, ), AppText( - 'Add Procedure', + widget.toolbarTitle ?? 'Add Procedure', fontWeight: FontWeight.w700, fontSize: 20, ), @@ -71,122 +75,129 @@ class _ProcedureCheckOutScreenState extends State { ), ), ), - SizedBox(height: 30,), - ...List.generate(widget.items.length, (index) => Container( - margin: EdgeInsets.only(bottom: 15.0), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.all(Radius.circular(10.0))), - child: ExpansionTile( - initiallyExpanded: true, - title: Row( - children: [ - Icon( - Icons.check_box, - color: Color(0xffD02127), - size: 30.5, - ), - SizedBox( - width: 6.0, - ), - Expanded( - child: - AppText(widget.items[index].procedureName)), - ], - ), - children: [ - Container( - child: Padding( - padding: EdgeInsets.symmetric(horizontal: 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Padding( - padding: const EdgeInsets.symmetric( - horizontal: 11), + SizedBox( + height: 30, + ), + ...List.generate( + widget.items.length, + (index) => Container( + margin: EdgeInsets.only(bottom: 15.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: + BorderRadius.all(Radius.circular(10.0))), + child: ExpansionTile( + initiallyExpanded: true, + title: Row( + children: [ + Icon( + Icons.check_box, + color: Color(0xffD02127), + size: 30.5, + ), + SizedBox( + width: 6.0, + ), + Expanded( child: AppText( - TranslationBase.of(context).orderType, - fontWeight: FontWeight.w700, - color: Color(0xff2B353E), - ), + widget.items[index].procedureName)), + ], + ), + children: [ + Container( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 11), + child: AppText( + TranslationBase.of(context) + .orderType, + fontWeight: FontWeight.w700, + color: Color(0xff2B353E), + ), + ), + ], + ), + Row( + children: [ + Radio( + activeColor: Color(0xFFD02127), + value: 0, + groupValue: + widget.items[index].selectedType, + onChanged: (value) { + widget.items[index].selectedType = + 0; + setState(() { + widget.items[index].type = + value.toString(); + }); + }, + ), + AppText( + 'routine', + color: Color(0xff575757), + fontWeight: FontWeight.w600, + ), + Radio( + activeColor: Color(0xFFD02127), + groupValue: + widget.items[index].selectedType, + value: 1, + onChanged: (value) { + widget.items[index].selectedType = + 1; + setState(() { + widget.items[index].type = + value.toString(); + }); + }, + ), + AppText( + TranslationBase.of(context).urgent, + color: Color(0xff575757), + fontWeight: FontWeight.w600, + ), + ], + ), + ], ), - ], + ), ), - Row( - children: [ - Radio( - activeColor: Color(0xFFD02127), - value: 0, - groupValue: - widget.items[index].selectedType, - onChanged: (value) { - widget.items[index].selectedType = 0; - setState(() { - widget.items[index].type = - value.toString(); - }); - }, - ), - AppText( - 'routine', - color: Color(0xff575757), - fontWeight: FontWeight.w600, - ), - Radio( - activeColor: Color(0xFFD02127), - groupValue: - widget.items[index].selectedType, - value: 1, - onChanged: (value) { - widget.items[index].selectedType = 1; - setState(() { - widget.items[index].type = - value.toString(); - }); - }, - ), - AppText( - TranslationBase.of(context).urgent, - color: Color(0xff575757), - fontWeight: FontWeight.w600, - ), - ], + SizedBox( + height: 2.0, + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 12, vertical: 15.0), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + controller: remarksController, + onChanged: (value) { + widget.items[index].remarks = value; + }, + minLines: 3, + maxLines: 5, + borderWidth: 0.5, + borderColor: Colors.grey[500], + ), ), + SizedBox( + height: 19.0, + ), + //DividerWithSpacesAround(), ], ), - ), - ), - SizedBox( - height: 2.0, - ), - Padding( - padding: EdgeInsets.symmetric( - horizontal: 12, vertical: 15.0), - child: TextFields( - hintText: TranslationBase.of(context).remarks, - controller: remarksController, - onChanged: (value) { - widget.items[index].remarks = value; - }, - minLines: 3, - maxLines: 5, - borderWidth: 0.5, - borderColor: Colors.grey[500], - ), - ), - SizedBox( - height: 19.0, - ), - //DividerWithSpacesAround(), - ], - ), - )), - SizedBox(height: 90,), - - + )), + SizedBox( + height: 90, + ), ], ), ), @@ -196,7 +207,7 @@ class _ProcedureCheckOutScreenState extends State { alignment: WrapAlignment.center, children: [ AppButton( - title: TranslationBase.of(context).addSelectedProcedures, + title: widget.addButtonTitle ?? TranslationBase.of(context).addSelectedProcedures, color: Color(0xff359846), fontWeight: FontWeight.w700, onPressed: () async {