From e85a32274a0ab6cdd00887ffed37a17ca5eacb42 Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Mon, 14 Mar 2022 09:32:46 +0300 Subject: [PATCH 01/26] Refactoring some issues in procedures screen --- lib/core/viewModel/procedure_View_model.dart | 29 +- .../procedures/add-procedure-page.dart | 13 +- .../base_add_procedure_tab_page.dart | 45 +-- .../entity_list_checkbox_search_widget.dart | 27 +- .../procedures/procedure_checkout_screen.dart | 276 +++++++++--------- lib/screens/procedures/procedure_screen.dart | 77 ++--- lib/screens/procedures/tab_widget.dart | 41 +++ lib/screens/procedures/update-procedure.dart | 11 - 8 files changed, 250 insertions(+), 269 deletions(-) create mode 100644 lib/screens/procedures/tab_widget.dart diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 21ce023b..bec0e2de 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -24,7 +24,6 @@ import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:flutter/cupertino.dart'; -import '../../widgets/shared/loader/gif_loader_dialog_utils.dart'; class ProcedureViewModel extends BaseViewModel { //TODO Hussam clean it @@ -68,8 +67,24 @@ class ProcedureViewModel extends BaseViewModel { List get procedureTemplateDetails => _procedureService.templateDetailsList; - List _patientLabOrdersListClinic = List(); - List _patientLabOrdersListHospital = List(); + + Future filterSearchResults(String query,List masterList, List items) async { + List dummySearchList = List(); + dummySearchList.addAll(masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + items.clear(); + items.addAll(dummyListData); + } else { + items.clear(); + items.addAll(masterList); + } + } Future getProcedure({int mrn, String patientType, int appointmentNo}) async { hasError = false; @@ -433,4 +448,12 @@ class ProcedureViewModel extends BaseViewModel { Utils.showErrorToast(error); } } + + bool isEntityListSelected(cpe.EntityList masterKey, List entityList) { + Iterable history = entityList.where((element) => masterKey.procedureId == element.procedureId); + if (history.length > 0) { + return true; + } + return false; + } } diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart index 26dde2e0..820082a1 100644 --- a/lib/screens/procedures/add-procedure-page.dart +++ b/lib/screens/procedures/add-procedure-page.dart @@ -167,7 +167,7 @@ class _AddProcedurePageState extends State { // widget.addSelectedHistories(); }, isEntityListSelected: (master) => - isEntityListSelected(master), + widget.model.isEntityListSelected(master,entityList), )), ], ), @@ -210,15 +210,4 @@ class _AddProcedurePageState extends State { ), ); } - - - ///TODO Elham* move it to view model - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } } diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 5df0130a..6c481658 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -4,12 +4,10 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription/add_prescription.dart'; +import 'package:doctor_app_flutter/screens/procedures/tab_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import '../../core/viewModel/project_view_model.dart'; -import '../../utils/tab_utils.dart'; import 'ProcedureType.dart'; import 'add-favourite-procedure.dart'; import 'add-procedure-page.dart'; @@ -94,7 +92,7 @@ class _BaseAddProcedureTabPageState extends State top: 0, left: 0, right: 0, bottom: 0), unselectedLabelColor: Colors.grey[800], tabs: [ - tabWidget( + TabWidget.tabWidget( screenSize, _activeTab == 0, @@ -102,7 +100,7 @@ class _BaseAddProcedureTabPageState extends State .getFavouriteTabName(context), isFirst: true,context: context ), - tabWidget( + TabWidget.tabWidget( screenSize, _activeTab == 1, procedureType.getAllLabelName(context), @@ -148,41 +146,4 @@ class _BaseAddProcedureTabPageState extends State ), ); } - - ///TODO Elham* move it to new file - - - Widget tabWidget( - Size screenSize, - bool isActive, - String title, { - int counter = -1, - bool isFirst = false, - bool isMiddle = false, - bool isLast = false, - context, - }) { - ProjectViewModel projectViewModel = Provider.of(context); - - return Center( - child: Container( - height: TabUtils.getTabHeight(context), - decoration: TabUtils.getBoxTabsBoxDecoration( - isActive: isActive, - isFirst: isFirst, - isMiddle: isMiddle, - isLast: isLast, - projectViewModel: projectViewModel), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - - TabUtils.getTabText(title: title, isActive: isActive), - if (counter != -1) - TabUtils.getTabCounter(isActive: isActive, counter: counter) - ], - ), - ), - ); - } } diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index c6a468fb..f7c6a377 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -84,7 +84,7 @@ class _EntityListCheckboxSearchWidgetState suffixIcon: EvaIcons.search, suffixIconColor: Color(0xff2B353E), onChanged: (value) { - filterSearchResults(value); + widget.model.filterSearchResults(value, widget.masterList, items); }, hasBorder: false, ), @@ -246,29 +246,4 @@ class _EntityListCheckboxSearchWidgetState ), ); } - - - ///TODO Elham* move it to view model - void filterSearchResults(String query) { - List dummySearchList = List(); - dummySearchList.addAll(widget.masterList); - if (query.isNotEmpty) { - List dummyListData = List(); - dummySearchList.forEach((item) { - if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { - dummyListData.add(item); - } - }); - setState(() { - items.clear(); - items.addAll(dummyListData); - }); - return; - } else { - setState(() { - items.clear(); - items.addAll(widget.masterList); - }); - } - } } diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/procedure_checkout_screen.dart index 31a0a195..f2f57762 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/procedure_checkout_screen.dart @@ -85,126 +85,125 @@ class _ProcedureCheckOutScreenState extends State { SizedBox( height: 30, ), - - ///TODO Elham* user view list builder - - ...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)), - ], - ), + ListView.builder( + scrollDirection: Axis.vertical, + itemCount: widget.items.length, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return 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: [ - 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, - ), - ], - ), - ], - ), - ), + Icon( + Icons.check_box, + color: Color(0xffD02127), + size: 30.5, ), SizedBox( - height: 2.0, + width: 6.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], + 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), + 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, + ), + ], + ), + ], ), ), - SizedBox( - height: 19.0, + ), + 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], ), - //DividerWithSpacesAround(), - ], - ), - )), + ), + SizedBox( + height: 19.0, + ), + //DividerWithSpacesAround(), + ], + ), + ); + }), + SizedBox( height: 90, ), @@ -222,31 +221,7 @@ class _ProcedureCheckOutScreenState extends State { color: AppGlobal.appGreenColor, fontWeight: FontWeight.w700, onPressed: () async { - - ///TODO Elham* move it to function - - List entityList = List(); - widget.items.forEach((element) { - entityList.add( - EntityList( - procedureId: element.procedureID, - remarks: element.remarks, - categoryID: element.categoryID, - type: element.type, - ), - ); - }); - await locator().logEvent( - eventCategory: "Procedure Checkout Screen", - eventAction: "Add New Procedure", - ); - Navigator.pop(context); - await model.preparePostProcedure( - entityList: entityList, - patient: widget.patient, - remarks: remarksController.text); - Navigator.pop(context); - Navigator.pop(context); + addProcedures(model); }, ), ], @@ -255,4 +230,29 @@ class _ProcedureCheckOutScreenState extends State { ), ); } + + Future addProcedures(ProcedureViewModel model) async { + List entityList = List(); + widget.items.forEach((element) { + entityList.add( + EntityList( + procedureId: element.procedureID, + remarks: element.remarks, + categoryID: element.categoryID, + type: element.type, + ), + ); + }); + await locator().logEvent( + eventCategory: "Procedure Checkout Screen", + eventAction: "Add New Procedure", + ); + Navigator.pop(context); + await model.preparePostProcedure( + entityList: entityList, + patient: widget.patient, + remarks: remarksController.text); + Navigator.pop(context); + Navigator.pop(context); + } } diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 1a6de092..c79ef942 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -127,43 +127,46 @@ class ProcedureScreen extends StatelessWidget { ), ), if (model.procedureList.isNotEmpty) - ///TODO Elham* use list view builder - ...List.generate( - model.procedureList[0].rowcount, - (index) => ProcedureCard( - categoryID: model.procedureList[0].entityList[index].categoryID, - entityList: model.procedureList[0].entityList[index], - onTap: () { - if (model.procedureList[0].entityList[index].categoryID == - 2 || - model.procedureList[0].entityList[index].categoryID == 4) - updateProcedureForm(context, - model: model, - patient: patient, - remarks: model - .procedureList[0].entityList[index].remarks, - orderType: model - .procedureList[0].entityList[index].orderType - .toString(), - orderNo: model - .procedureList[0].entityList[index].orderNo, - procedureName: model.procedureList[0] - .entityList[index].procedureName, - categoreId: model - .procedureList[0].entityList[index].categoryID - .toString(), - procedureId: model.procedureList[0] - .entityList[index].procedureId, - limetNo: model.procedureList[0].entityList[index] - .lineItemNo); - // } else - // Helpers.showErrorToast( - // 'You Cant Update This Procedure'); - }, - patient: patient, - doctorID: model?.doctorProfile?.doctorID, - ), - ), + ListView.builder( + scrollDirection: Axis.vertical, + itemCount: model.procedureList[0].rowcount, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + return ProcedureCard( + categoryID: model + .procedureList[0].entityList[index].categoryID, + entityList: model.procedureList[0].entityList[index], + onTap: () { + if (model.procedureList[0].entityList[index].categoryID == + 2 || + model.procedureList[0].entityList[index].categoryID == 4) + updateProcedureForm(context, + model: model, + patient: patient, + remarks: model.procedureList[0] + .entityList[index].remarks, + orderType: model.procedureList[0] + .entityList[index].orderType + .toString(), + orderNo: model.procedureList[0] + .entityList[index].orderNo, + procedureName: model.procedureList[0] + .entityList[index].procedureName, + categoreId: model.procedureList[0] + .entityList[index].categoryID + .toString(), + procedureId: model.procedureList[0] + .entityList[index].procedureId, + limetNo: model.procedureList[0] + .entityList[index].lineItemNo); + // } else + // Helpers.showErrorToast( + // 'You Cant Update This Procedure'); + }, + patient: patient, + doctorID: model?.doctorProfile?.doctorID, + ); + }), if (model.state == ViewState.ErrorLocal || (model.procedureList.isNotEmpty && model.procedureList[0].entityList.isEmpty)) diff --git a/lib/screens/procedures/tab_widget.dart b/lib/screens/procedures/tab_widget.dart new file mode 100644 index 00000000..9683c1b4 --- /dev/null +++ b/lib/screens/procedures/tab_widget.dart @@ -0,0 +1,41 @@ +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/utils/tab_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + + +class TabWidget { + static Widget tabWidget( + Size screenSize, + bool isActive, + String title, + { + int counter = -1, + bool isFirst = false, + bool isMiddle = false, + bool isLast = false, + context, + }) { + ProjectViewModel projectViewModel = Provider.of(context); + return Center( + child: Container( + height: TabUtils.getTabHeight(context), + decoration: TabUtils.getBoxTabsBoxDecoration( + isActive: isActive, + isFirst: isFirst, + isMiddle: isMiddle, + isLast: isLast, + projectViewModel: projectViewModel), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + + TabUtils.getTabText(title: title, isActive: isActive), + if (counter != -1) + TabUtils.getTabCounter(isActive: isActive, counter: counter) + ], + ), + ), + ); + } +} diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update-procedure.dart index 1ae3d3e5..d1ca6268 100644 --- a/lib/screens/procedures/update-procedure.dart +++ b/lib/screens/procedures/update-procedure.dart @@ -265,15 +265,4 @@ class _UpdateProcedureWidgetState extends State { model.getProcedure(mrn: patient.patientMRN); } } - - - ///TODO Elham* move it to view model - bool isEntityListSelected(EntityList masterKey) { - Iterable history = entityList - .where((element) => masterKey.procedureId == element.procedureId); - if (history.length > 0) { - return true; - } - return false; - } } From 1ac24bee90233b67f1a260a6ba743f3d63c827da Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Mon, 14 Mar 2022 09:55:02 +0300 Subject: [PATCH 02/26] Refactoring some issues in procedures screen --- lib/screens/procedures/add-procedure-page.dart | 1 - .../procedures/entity_list_checkbox_search_widget.dart | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart index 820082a1..ca34fc77 100644 --- a/lib/screens/procedures/add-procedure-page.dart +++ b/lib/screens/procedures/add-procedure-page.dart @@ -193,7 +193,6 @@ class _AddProcedurePageState extends State { ); return; } - await this.model.preparePostProcedure( orderType: selectedType.toString(), entityList: entityList, diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index f7c6a377..03fd808f 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -8,7 +8,6 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - import '../../config/config.dart'; class EntityListCheckboxSearchWidget extends StatefulWidget { @@ -16,12 +15,9 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { final Function addSelectedHistories; final Function(EntityList) removeHistory; final Function(EntityList) addHistory; - final Function(EntityList) addRemarks; - final bool Function(EntityList) isEntityListSelected; final List masterList; - /// todo clear the function here EntityListCheckboxSearchWidget( {Key key, this.model, @@ -30,7 +26,7 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { this.masterList, this.addHistory, this.isEntityListSelected, - this.addRemarks}) + }) : super(key: key); @override From a0193195895089425ee36de455318aa9813322f0 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 14 Mar 2022 11:15:26 +0300 Subject: [PATCH 03/26] some fixes --- lib/screens/procedures/ProcedureCard.dart | 2 -- lib/screens/procedures/add-favourite-procedure.dart | 1 + lib/screens/procedures/add-procedure-page.dart | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/ProcedureCard.dart index 090d5a7f..6742f136 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/ProcedureCard.dart @@ -1,4 +1,3 @@ -//import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; @@ -42,7 +41,6 @@ class ProcedureCard extends StatelessWidget { return Container( width: double.maxFinite, - //height: MediaQuery.of(context).size.height * .22, margin: EdgeInsets.all(10), padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add-favourite-procedure.dart index 7b0d869a..0a2c9507 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add-favourite-procedure.dart @@ -132,6 +132,7 @@ class _AddFavouriteProcedureState extends State { ); } + bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { Iterable history = entityList.where( (element) => diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart index ca34fc77..becd9cca 100644 --- a/lib/screens/procedures/add-procedure-page.dart +++ b/lib/screens/procedures/add-procedure-page.dart @@ -152,6 +152,7 @@ class _AddProcedurePageState extends State { model: widget.model, masterList: model.categoriesList[0].entityList, + /// TODO Elham* use correct name we are not in history removeHistory: (item) { setState(() { entityList.remove(item); @@ -164,7 +165,6 @@ class _AddProcedurePageState extends State { }, addSelectedHistories: () { //TODO build your fun herr - // widget.addSelectedHistories(); }, isEntityListSelected: (master) => widget.model.isEntityListSelected(master,entityList), From f1dd50d7bfeda85c57ffcefb9e7e99b26091151f Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Tue, 15 Mar 2022 15:01:11 +0300 Subject: [PATCH 04/26] Doing some refactoring --- lib/core/viewModel/procedure_View_model.dart | 48 ++++++++++++++++++- .../profile/lab_result/labs_home_page.dart | 3 +- .../radiology/radiology_home_page.dart | 3 +- .../prescription/new_prescriptions_page.dart | 9 +--- .../prescription/old_prescriptions_page.dart | 6 --- ...dure.dart => add_favourite_procedure.dart} | 2 +- ...dure-page.dart => add_procedure_page.dart} | 5 +- .../base_add_procedure_tab_page.dart | 7 +-- .../procedures/entity_list_fav_procedure.dart | 5 +- ...rocedure.dart => expansion_procedure.dart} | 0 ...ProcedureCard.dart => procedure_card.dart} | 4 -- lib/screens/procedures/procedure_screen.dart | 7 ++- ...ProcedureType.dart => procedure_type.dart} | 0 ...e-procedure.dart => update_procedure.dart} | 0 14 files changed, 59 insertions(+), 40 deletions(-) rename lib/screens/procedures/{add-favourite-procedure.dart => add_favourite_procedure.dart} (98%) rename lib/screens/procedures/{add-procedure-page.dart => add_procedure_page.dart} (98%) rename lib/screens/procedures/{ExpansionProcedure.dart => expansion_procedure.dart} (100%) rename lib/screens/procedures/{ProcedureCard.dart => procedure_card.dart} (98%) rename lib/screens/procedures/{ProcedureType.dart => procedure_type.dart} (100%) rename lib/screens/procedures/{update-procedure.dart => update_procedure.dart} (100%) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index bec0e2de..6847560d 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -14,13 +14,14 @@ import 'package:doctor_app_flutter/core/model/procedure/procedure_valadate_model 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/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/lab_order/labs_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/procedure/procedure_service.dart'; import 'package:doctor_app_flutter/core/service/patient_medical_file/radiology/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/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:flutter/cupertino.dart'; @@ -67,6 +68,9 @@ class ProcedureViewModel extends BaseViewModel { List get procedureTemplateDetails => _procedureService.templateDetailsList; + List entityList = List(); + + Future filterSearchResults(String query,List masterList, List items) async { List dummySearchList = List(); @@ -449,11 +453,51 @@ class ProcedureViewModel extends BaseViewModel { } } - bool isEntityListSelected(cpe.EntityList masterKey, List entityList) { + bool isEntityListSelected(cpe.EntityList masterKey, List entityList) { Iterable history = entityList.where((element) => masterKey.procedureId == element.procedureId); if (history.length > 0) { return true; } return false; } + + isProcedureEntityListSelected({ProcedureTempleteDetailsModel masterKey, List entityList }) { + Iterable history = entityList.where( + (element) => + masterKey.templateID == element.templateID && + masterKey.procedureName == element.procedureName); + if (history.length > 0) { + return true; + } + return false; + } + + Future addProcedures(ProcedureViewModel model, + List items, + PatiantInformtion patient, + TextEditingController remarksController, + BuildContext context) async { + List entityList = List(); + items.forEach((element) { + entityList.add( + cpe.EntityList( + procedureId: element.procedureID, + remarks: element.remarks, + categoryID: element.categoryID, + type: element.type, + ), + ); + }); + await locator().logEvent( + eventCategory: "Procedure Checkout Screen", + eventAction: "Add New Procedure", + ); + Navigator.pop(context); + await model.preparePostProcedure( + entityList: entityList, + patient: patient, + remarks: remarksController.text); + Navigator.pop(context); + Navigator.pop(context); + } } 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 05e86a7f..4f4b295a 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -3,8 +3,8 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/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/ProcedureType.dart'; import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; @@ -16,7 +16,6 @@ import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - import '../../../../widgets/shared/errors/error_message.dart'; class LabsHomePage extends StatefulWidget { diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 244fd37f..c6be1c21 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -3,8 +3,8 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/model/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/ProcedureType.dart'; import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; @@ -17,7 +17,6 @@ import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - import '../../../../widgets/shared/errors/error_message.dart'; class RadiologyHomePage extends StatefulWidget { diff --git a/lib/screens/prescription/new_prescriptions_page.dart b/lib/screens/prescription/new_prescriptions_page.dart index e275e076..93345506 100644 --- a/lib/screens/prescription/new_prescriptions_page.dart +++ b/lib/screens/prescription/new_prescriptions_page.dart @@ -2,22 +2,15 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_in_patient.dart'; -import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_out_patient.dart'; -import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; -import 'package:doctor_app_flutter/utils/date-utils.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; -import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_card.dart'; -import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/lib/screens/prescription/old_prescriptions_page.dart b/lib/screens/prescription/old_prescriptions_page.dart index 71dc4dba..f937c8b1 100644 --- a/lib/screens/prescription/old_prescriptions_page.dart +++ b/lib/screens/prescription/old_prescriptions_page.dart @@ -4,21 +4,15 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_in_patient.dart'; import 'package:doctor_app_flutter/screens/prescription/prescriptions_items/prescription_items_out_patient.dart'; -import 'package:doctor_app_flutter/screens/procedures/ProcedureType.dart'; -import 'package:doctor_app_flutter/screens/procedures/base_add_procedure_tab_page.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/doctor_card.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; -import 'package:doctor_app_flutter/widgets/shared/user-guid/in_patient_doctor_card.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; -import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../utils/utils.dart'; diff --git a/lib/screens/procedures/add-favourite-procedure.dart b/lib/screens/procedures/add_favourite_procedure.dart similarity index 98% rename from lib/screens/procedures/add-favourite-procedure.dart rename to lib/screens/procedures/add_favourite_procedure.dart index 7b0d869a..5e61481a 100644 --- a/lib/screens/procedures/add-favourite-procedure.dart +++ b/lib/screens/procedures/add_favourite_procedure.dart @@ -6,6 +6,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_checkout_screen.dart'; import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; @@ -13,7 +14,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'ProcedureType.dart'; class AddFavouriteProcedure extends StatefulWidget { final ProcedureViewModel previousProcedureViewModel; diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add_procedure_page.dart similarity index 98% rename from lib/screens/procedures/add-procedure-page.dart rename to lib/screens/procedures/add_procedure_page.dart index ca34fc77..e5fd22e8 100644 --- a/lib/screens/procedures/add-procedure-page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -11,9 +12,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; - import '../../config/config.dart'; -import 'ProcedureType.dart'; import 'entity_list_checkbox_search_widget.dart'; class AddProcedurePage extends StatefulWidget { @@ -163,8 +162,6 @@ class _AddProcedurePageState extends State { }); }, addSelectedHistories: () { - //TODO build your fun herr - // widget.addSelectedHistories(); }, isEntityListSelected: (master) => widget.model.isEntityListSelected(master,entityList), diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 6c481658..3cf90da5 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -4,13 +4,14 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription/add_prescription.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_favourite_procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/add_procedure_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/screens/procedures/tab_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; -import 'ProcedureType.dart'; -import 'add-favourite-procedure.dart'; -import 'add-procedure-page.dart'; + class BaseAddProcedureTabPage extends StatefulWidget { final ProcedureViewModel model; diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/entity_list_fav_procedure.dart index 96f88d18..e140824e 100644 --- a/lib/screens/procedures/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/entity_list_fav_procedure.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/screens/procedures/expansion_procedure.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; @@ -9,7 +10,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../config/config.dart'; import '../../widgets/shared/text_fields/app_text_field_custom_serach.dart'; -import 'ExpansionProcedure.dart'; class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { final ProcedureViewModel model; @@ -70,7 +70,6 @@ class _EntityListCheckboxSearchFavProceduresWidgetState @override void initState() { - //items.addAll(widget.masterList); super.initState(); } @@ -105,8 +104,6 @@ class _EntityListCheckboxSearchFavProceduresWidgetState ], inputType: TextInputType.text, hintText: TranslationBase.of(context).searchFavoriteTemplate, - // validationError: TranslationBase.of(context).emptyMessage - // : null, ), SizedBox( height: 15, diff --git a/lib/screens/procedures/ExpansionProcedure.dart b/lib/screens/procedures/expansion_procedure.dart similarity index 100% rename from lib/screens/procedures/ExpansionProcedure.dart rename to lib/screens/procedures/expansion_procedure.dart diff --git a/lib/screens/procedures/ProcedureCard.dart b/lib/screens/procedures/procedure_card.dart similarity index 98% rename from lib/screens/procedures/ProcedureCard.dart rename to lib/screens/procedures/procedure_card.dart index 090d5a7f..afff9a92 100644 --- a/lib/screens/procedures/ProcedureCard.dart +++ b/lib/screens/procedures/procedure_card.dart @@ -1,4 +1,3 @@ -//import 'package:doctor_app_flutter/client/base_app_client.dart'; import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; @@ -13,8 +12,6 @@ import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:flutter_svg/flutter_svg.dart'; - class ProcedureCard extends StatelessWidget { final Function onTap; @@ -42,7 +39,6 @@ class ProcedureCard extends StatelessWidget { return Container( width: double.maxFinite, - //height: MediaQuery.of(context).size.height * .22, margin: EdgeInsets.all(10), padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5), decoration: BoxDecoration( diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index c79ef942..cce174f8 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -4,7 +4,9 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/procedures/update-procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_card.dart'; +import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; +import 'package:doctor_app_flutter/screens/procedures/update_procedure.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; @@ -13,10 +15,7 @@ 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/transitions/slide_up_page.dart'; import 'package:flutter/material.dart'; - import '../../widgets/shared/errors/error_message.dart'; -import 'ProcedureCard.dart'; -import 'ProcedureType.dart'; import 'base_add_procedure_tab_page.dart'; class ProcedureScreen extends StatelessWidget { diff --git a/lib/screens/procedures/ProcedureType.dart b/lib/screens/procedures/procedure_type.dart similarity index 100% rename from lib/screens/procedures/ProcedureType.dart rename to lib/screens/procedures/procedure_type.dart diff --git a/lib/screens/procedures/update-procedure.dart b/lib/screens/procedures/update_procedure.dart similarity index 100% rename from lib/screens/procedures/update-procedure.dart rename to lib/screens/procedures/update_procedure.dart From 9f7cdba8b70545d169d6ef2ada393f07810e2119 Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Sun, 20 Mar 2022 08:37:48 +0300 Subject: [PATCH 05/26] Refactoring procedure pages --- lib/core/viewModel/procedure_View_model.dart | 64 +++-- .../procedures/add_procedure_page.dart | 259 +++++++++--------- .../base_add_procedure_tab_page.dart | 2 +- .../entity_list_checkbox_search_widget.dart | 12 +- .../procedures/expansion_procedure.dart | 1 - .../add_favourite_procedure.dart | 19 +- .../entity_list_fav_procedure.dart | 30 +- .../procedure_checkout_screen.dart | 33 +-- 8 files changed, 186 insertions(+), 234 deletions(-) rename lib/screens/procedures/{ => favorite_procedure}/add_favourite_procedure.dart (89%) rename lib/screens/procedures/{ => favorite_procedure}/entity_list_fav_procedure.dart (85%) rename lib/screens/procedures/{ => favorite_procedure}/procedure_checkout_screen.dart (90%) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 23d90189..26ddeb61 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; +import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; 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'; @@ -68,28 +69,6 @@ class ProcedureViewModel extends BaseViewModel { List get procedureTemplateDetails => _procedureService.templateDetailsList; - List entityList = List(); - - - - Future filterSearchResults(String query,List masterList, List items) async { - List dummySearchList = List(); - dummySearchList.addAll(masterList); - if (query.isNotEmpty) { - List dummyListData = List(); - dummySearchList.forEach((item) { - if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { - dummyListData.add(item); - } - }); - items.clear(); - items.addAll(dummyListData); - } else { - items.clear(); - items.addAll(masterList); - } - } - Future getProcedure({int mrn, String patientType, int appointmentNo}) async { hasError = false; await getDoctorProfile(); @@ -461,7 +440,7 @@ class ProcedureViewModel extends BaseViewModel { return false; } - isProcedureEntityListSelected({ProcedureTempleteDetailsModel masterKey, List entityList }) { + bool isProcedureEntityListSelected(ProcedureTempleteDetailsModel masterKey, List entityList) { Iterable history = entityList.where( (element) => masterKey.templateID == element.templateID && @@ -472,6 +451,8 @@ class ProcedureViewModel extends BaseViewModel { return false; } + + Future addProcedures(ProcedureViewModel model, List items, PatiantInformtion patient, @@ -500,4 +481,41 @@ class ProcedureViewModel extends BaseViewModel { Navigator.pop(context); Navigator.pop(context); } + + Future filterSearchResults(String query,List masterList, List items) async { + List dummySearchList = List(); + dummySearchList.addAll(masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.procedureName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + items.clear(); + items.addAll(dummyListData); + } else { + items.clear(); + items.addAll(masterList); + } + } + + void filterProcedureSearchResults(String query, List masterList, List items) { + List dummySearchList = List(); + dummySearchList.addAll(masterList); + if (query.isNotEmpty) { + List dummyListData = List(); + dummySearchList.forEach((item) { + if (item.templateName.toLowerCase().contains(query.toLowerCase())) { + dummyListData.add(item); + } + }); + items.clear(); + items.addAll(dummyListData); + return; + } else { + items.clear(); + items.addAll(masterList); + } + } } diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index e5fd22e8..03d73f39 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -63,145 +63,144 @@ class _AddProcedurePageState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( isShowAppBar: false, - body: Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Expanded( - child: NetworkBaseView( + body: SingleChildScrollView( + child: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + NetworkBaseView( baseViewModel: model, - child: SingleChildScrollView( - child: Container( - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (procedureType == ProcedureType.PROCEDURE) - Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - ], - ), - SizedBox( - height: - MediaQuery.of(context).size.height * 0.02, - ), - Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * - 0.79, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * - 0.02, + child: Container( + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (procedureType == ProcedureType.PROCEDURE) + Column( + children: [ + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .pleaseEnterProcedure, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], + ), + SizedBox( + height: + MediaQuery.of(context).size.height * 0.02, + ), + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.79, + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .searchProcedureHere, + isTextFieldHasSuffix: false, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, ), - Expanded( - child: InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - patientId: patient.patientId, - categoryName: - procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, - ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * + 0.02, + ), + Expanded( + child: InkWell( + onTap: () { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) + model.getProcedureCategory( + patientId: patient.patientId, + categoryName: + procedureName.text); + else + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + }, + child: Icon( + Icons.search, + size: 25.0, ), ), - ], - ), - ], - ), - if ((procedureType == ProcedureType.PROCEDURE - ? procedureName.text.isNotEmpty - : true) && - model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - model.categoriesList[0].entityList, - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - }, - isEntityListSelected: (master) => - widget.model.isEntityListSelected(master,entityList), - )), - ], - ), + ), + ], + ), + ], + ), + if ((procedureType == ProcedureType.PROCEDURE + ? procedureName.text.isNotEmpty + : true) && + model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: + model.categoriesList[0].entityList, + removeProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () { + }, + isEntityListSelected: (master) => + widget.model.isEntityListSelected(master,entityList), + )), + SizedBox(height: 10,) + ], ), ), ), ), - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: procedureType.getAddButtonTitle(context), - fontWeight: FontWeight.w700, - color: AppGlobal.appGreenColor, - onPressed: () async { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - await this.model.preparePostProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - remarks: remarksController.text); - Navigator.pop(context); - }, - ), - ], + Container( + margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), + child: Wrap( + alignment: WrapAlignment.center, + children: [ + AppButton( + title: procedureType.getAddButtonTitle(context), + fontWeight: FontWeight.w700, + color: AppGlobal.appGreenColor, + onPressed: () async { + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + return; + } + await this.model.preparePostProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + remarks: remarksController.text); + Navigator.pop(context); + }, + ), + ], + ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 3cf90da5..7f37a09c 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -4,7 +4,7 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription/add_prescription.dart'; -import 'package:doctor_app_flutter/screens/procedures/add_favourite_procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/favorite_procedure/add_favourite_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/add_procedure_page.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/screens/procedures/tab_widget.dart'; diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index fc810d56..332300c2 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -13,8 +13,8 @@ import '../../config/config.dart'; class EntityListCheckboxSearchWidget extends StatefulWidget { final ProcedureViewModel model; final Function addSelectedHistories; - final Function(EntityList) removeHistory; - final Function(EntityList) addHistory; + final Function(EntityList) removeProcedure; + final Function(EntityList) addProcedure; final bool Function(EntityList) isEntityListSelected; final List masterList; @@ -22,9 +22,9 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { {Key key, this.model, this.addSelectedHistories, - this.removeHistory, + this.removeProcedure, this.masterList, - this.addHistory, + this.addProcedure, this.isEntityListSelected, }) : super(key: key); @@ -103,11 +103,11 @@ class _EntityListCheckboxSearchWidgetState setState(() { if (widget.isEntityListSelected( historyInfo)) { - widget.removeHistory( + widget.removeProcedure( historyInfo); } else { widget - .addHistory(historyInfo); + .addProcedure(historyInfo); } }); }), diff --git a/lib/screens/procedures/expansion_procedure.dart b/lib/screens/procedures/expansion_procedure.dart index b0593b06..0ba2fa87 100644 --- a/lib/screens/procedures/expansion_procedure.dart +++ b/lib/screens/procedures/expansion_procedure.dart @@ -13,7 +13,6 @@ class ExpansionProcedure extends StatefulWidget { final Function(ProcedureTempleteDetailsModel) removeFavProcedure; final Function(ProcedureTempleteDetailsModel) addFavProcedure; final Function(ProcedureTempleteDetailsModel) selectProcedures; - final bool Function(ProcedureTempleteModel) isEntityListSelected; final bool Function(ProcedureTempleteDetailsModel) isEntityFavListSelected; final bool isProcedure; diff --git a/lib/screens/procedures/add_favourite_procedure.dart b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart similarity index 89% rename from lib/screens/procedures/add_favourite_procedure.dart rename to lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart index 5e61481a..ae98fe96 100644 --- a/lib/screens/procedures/add_favourite_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart @@ -4,8 +4,8 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_checkout_screen.dart'; -import 'package:doctor_app_flutter/screens/procedures/entity_list_fav_procedure.dart'; -import 'package:doctor_app_flutter/screens/procedures/procedure_checkout_screen.dart'; +import 'package:doctor_app_flutter/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart'; +import 'package:doctor_app_flutter/screens/procedures/favorite_procedure/procedure_checkout_screen.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -44,7 +44,7 @@ class _AddFavouriteProcedureState extends State { @override Widget build(BuildContext context) { return BaseView( - builder: (BuildContext context, ProcedureViewModel model_, + builder: (BuildContext context, ProcedureViewModel procedureViewModel, Widget child) => AppScaffold( isShowAppBar: false, @@ -67,7 +67,7 @@ class _AddFavouriteProcedureState extends State { }); }, isEntityFavListSelected: (master) => - isEntityListSelected(master), + procedureViewModel.isProcedureEntityListSelected(master, entityList), groupProcedures: groupProcedures, selectProcedures: (selectedProcedure) { setState(() { @@ -131,15 +131,4 @@ class _AddFavouriteProcedureState extends State { })), ); } - - bool isEntityListSelected(ProcedureTempleteDetailsModel masterKey) { - Iterable history = entityList.where( - (element) => - masterKey.templateID == element.templateID && - masterKey.procedureName == element.procedureName); - if (history.length > 0) { - return true; - } - return false; - } } diff --git a/lib/screens/procedures/entity_list_fav_procedure.dart b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart similarity index 85% rename from lib/screens/procedures/entity_list_fav_procedure.dart rename to lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart index e140824e..6598008b 100644 --- a/lib/screens/procedures/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart @@ -8,8 +8,8 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import '../../config/config.dart'; -import '../../widgets/shared/text_fields/app_text_field_custom_serach.dart'; +import '../../../config/config.dart'; +import '../../../widgets/shared/text_fields/app_text_field_custom_serach.dart'; class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget { final ProcedureViewModel model; @@ -95,7 +95,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState AppTextFieldCustomSearch( searchController: patientFileInfoController, onChangeFun: (value) { - filterSearchResults(value); + widget.model.filterProcedureSearchResults(value, widget.masterList, items); }, marginTop: 5, inputFormatters: [ @@ -140,28 +140,4 @@ class _EntityListCheckboxSearchFavProceduresWidgetState ), ); } - - ///TODO Elham* move it to view model and try to make it work for every search - void filterSearchResults(String query) { - List dummySearchList = List(); - dummySearchList.addAll(widget.masterList); - if (query.isNotEmpty) { - List dummyListData = List(); - dummySearchList.forEach((item) { - if (item.templateName.toLowerCase().contains(query.toLowerCase())) { - dummyListData.add(item); - } - }); - setState(() { - items.clear(); - items.addAll(dummyListData); - }); - return; - } else { - setState(() { - items.clear(); - items.addAll(widget.masterList); - }); - } - } } diff --git a/lib/screens/procedures/procedure_checkout_screen.dart b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart similarity index 90% rename from lib/screens/procedures/procedure_checkout_screen.dart rename to lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart index fdd847f3..9d312604 100644 --- a/lib/screens/procedures/procedure_checkout_screen.dart +++ b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart @@ -1,9 +1,6 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; -import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -13,8 +10,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - -import '../../config/config.dart'; +import '../../../config/config.dart'; class ProcedureCheckOutScreen extends StatefulWidget { final List items; @@ -221,7 +217,7 @@ class _ProcedureCheckOutScreenState extends State { color: AppGlobal.appGreenColor, fontWeight: FontWeight.w700, onPressed: () async { - addProcedures(model); + model.addProcedures(model, widget.items, widget.patient, remarksController, context); }, ), ], @@ -230,29 +226,4 @@ class _ProcedureCheckOutScreenState extends State { ), ); } - - Future addProcedures(ProcedureViewModel model) async { - List entityList = List(); - widget.items.forEach((element) { - entityList.add( - EntityList( - procedureId: element.procedureID, - remarks: element.remarks, - categoryID: element.categoryID, - type: element.type, - ), - ); - }); - await locator().logEvent( - eventCategory: "Procedure Checkout Screen", - eventAction: "Add New Procedure", - ); - Navigator.pop(context); - await model.preparePostProcedure( - entityList: entityList, - patient: widget.patient, - remarks: remarksController.text); - Navigator.pop(context); - Navigator.pop(context); - } } From f84ae8b4e75daba3ed0097ecbf3a6f5984af7570 Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Tue, 5 Apr 2022 14:12:34 +0300 Subject: [PATCH 06/26] Delete add-procedure-page.dart --- .../procedures/add-procedure-page.dart | 212 ------------------ 1 file changed, 212 deletions(-) delete mode 100644 lib/screens/procedures/add-procedure-page.dart diff --git a/lib/screens/procedures/add-procedure-page.dart b/lib/screens/procedures/add-procedure-page.dart deleted file mode 100644 index becd9cca..00000000 --- a/lib/screens/procedures/add-procedure-page.dart +++ /dev/null @@ -1,212 +0,0 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; -import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; -import 'package:flutter/material.dart'; - -import '../../config/config.dart'; -import 'ProcedureType.dart'; -import 'entity_list_checkbox_search_widget.dart'; - -class AddProcedurePage extends StatefulWidget { - final ProcedureViewModel model; - final PatiantInformtion patient; - final ProcedureType procedureType; - - const AddProcedurePage( - {Key key, this.model, this.patient, @required this.procedureType}) - : super(key: key); - - @override - _AddProcedurePageState createState() => _AddProcedurePageState( - patient: patient, model: model, procedureType: this.procedureType); -} - -class _AddProcedurePageState extends State { - int selectedType; - ProcedureViewModel model; - PatiantInformtion patient; - ProcedureType procedureType; - - _AddProcedurePageState({this.patient, this.model, this.procedureType}); - - TextEditingController procedureController = TextEditingController(); - TextEditingController remarksController = TextEditingController(); - List entityList = List(); - List entityListProcedure = List(); - TextEditingController procedureName = TextEditingController(); - - dynamic selectedCategory; - - setSelectedType(int val) { - setState(() { - selectedType = val; - }); - } - - @override - Widget build(BuildContext context) { - return BaseView( - onModelReady: (model) { - model.getProcedureCategory( - categoryName: procedureType.getCategoryName(), - categoryID: procedureType.getCategoryId(), - patientId: patient.patientId); - }, - builder: (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - isShowAppBar: false, - body: Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - Expanded( - child: NetworkBaseView( - baseViewModel: model, - child: SingleChildScrollView( - child: Container( - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (procedureType == ProcedureType.PROCEDURE) - Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - ], - ), - SizedBox( - height: - MediaQuery.of(context).size.height * 0.02, - ), - Row( - children: [ - Container( - width: MediaQuery.of(context).size.width * - 0.79, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * - 0.02, - ), - Expanded( - child: InkWell( - onTap: () { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( - patientId: patient.patientId, - categoryName: - procedureName.text); - else - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - }, - child: Icon( - Icons.search, - size: 25.0, - ), - ), - ), - ], - ), - ], - ), - if ((procedureType == ProcedureType.PROCEDURE - ? procedureName.text.isNotEmpty - : true) && - model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: - model.categoriesList[0].entityList, - /// TODO Elham* use correct name we are not in history - removeHistory: (item) { - setState(() { - entityList.remove(item); - }); - }, - addHistory: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () { - //TODO build your fun herr - }, - isEntityListSelected: (master) => - widget.model.isEntityListSelected(master,entityList), - )), - ], - ), - ), - ), - ), - ), - ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: procedureType.getAddButtonTitle(context), - fontWeight: FontWeight.w700, - color: AppGlobal.appGreenColor, - onPressed: () async { - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - return; - } - await this.model.preparePostProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - remarks: remarksController.text); - Navigator.pop(context); - }, - ), - ], - ), - ), - ], - ), - ), - ); - } -} From 9ecfe896f97227cc422dbdf36b9737f4a5cb1e27 Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Wed, 6 Apr 2022 11:45:43 +0300 Subject: [PATCH 07/26] DAPP-9: remove 25 letter validation --- .../soap_update/subjective/update_subjective_page.dart | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 1523e59b..53195a47 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -293,8 +293,7 @@ class _UpdateSubjectivePageState extends State model.medicationControllerError = ''; model.illnessControllerError = ''; if (complaintsController.text.isNotEmpty && - illnessController.text.isNotEmpty && - complaintsController.text.length > 25) { + illnessController.text.isNotEmpty) { await model.postSubjectServices( patientInfo: widget.patientInfo, complaintsText: complaintsController.text, @@ -312,9 +311,6 @@ class _UpdateSubjectivePageState extends State if (complaintsController.text.isEmpty) { model.complaintsControllerError = TranslationBase.of(context).emptyMessage; - } else if (complaintsController.text.length < 25) { - model.complaintsControllerError = - TranslationBase.of(context).chiefComplaintLength; } if (illnessController.text.isEmpty) { From 041c652b86072ae886462a958e6f1562d7d700ef Mon Sep 17 00:00:00 2001 From: RoaaGhali98 Date: Tue, 12 Apr 2022 12:35:07 +0300 Subject: [PATCH 08/26] Fixing some issues in procedure pages --- lib/core/viewModel/procedure_View_model.dart | 25 ++++++++--- .../subjective/allergies/add_allergies.dart | 3 -- .../procedures/add_procedure_page.dart | 9 +++- .../procedures/expansion_procedure.dart | 8 +++- .../procedure_checkout_screen.dart | 12 ++++- lib/screens/procedures/procedure_screen.dart | 45 ++----------------- 6 files changed, 46 insertions(+), 56 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 26ddeb61..e433f54e 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -25,6 +25,7 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/cupertino.dart'; class ProcedureViewModel extends BaseViewModel { @@ -72,8 +73,6 @@ class ProcedureViewModel extends BaseViewModel { Future getProcedure({int mrn, String patientType, int appointmentNo}) async { hasError = false; await getDoctorProfile(); - - //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); await _procedureService.getProcedure( mrn: mrn, appointmentNo: appointmentNo); @@ -371,7 +370,16 @@ class ProcedureViewModel extends BaseViewModel { String orderType, PatiantInformtion patient, List entityList, - ProcedureType procedureType}) async { + ProcedureType procedureType, + bool isLocalBusy = false, + }) async { + + ///TODO Roaa Move it to function + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); ProcedureValadteRequestModel procedureValadteRequestModel = new ProcedureValadteRequestModel(); @@ -457,7 +465,12 @@ class ProcedureViewModel extends BaseViewModel { List items, PatiantInformtion patient, TextEditingController remarksController, - BuildContext context) async { + {bool isLocalBusy = false,}) async { + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } List entityList = List(); items.forEach((element) { entityList.add( @@ -473,13 +486,11 @@ class ProcedureViewModel extends BaseViewModel { eventCategory: "Procedure Checkout Screen", eventAction: "Add New Procedure", ); - Navigator.pop(context); await model.preparePostProcedure( entityList: entityList, patient: patient, remarks: remarksController.text); - Navigator.pop(context); - Navigator.pop(context); + } Future filterSearchResults(String query,List masterList, List items) async { diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart index 9561fe3b..abcc72ad 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/add_allergies.dart @@ -29,9 +29,6 @@ class AddAllergies extends StatefulWidget { class _AddAllergiesState extends State { List allergiesList; List allergySeverityList; - TextEditingController remarkController = TextEditingController(); - TextEditingController severityController = TextEditingController(); - TextEditingController allergyController = TextEditingController(); List myAllergiesListLocal; @override diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 03d73f39..be3dc059 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; @@ -181,18 +182,24 @@ class _AddProcedurePageState extends State { fontWeight: FontWeight.w700, color: AppGlobal.appGreenColor, onPressed: () async { + GifLoaderDialogUtils.showMyDialog(context); if (entityList.isEmpty == true) { DrAppToastMsg.showErrorToast( TranslationBase.of(context) .fillTheMandatoryProcedureDetails, ); + GifLoaderDialogUtils.hideDialog(context); return; } + GifLoaderDialogUtils.showMyDialog(context); await this.model.preparePostProcedure( orderType: selectedType.toString(), entityList: entityList, patient: patient, - remarks: remarksController.text); + remarks: remarksController.text, + procedureType: ProcedureType.PROCEDURE, + isLocalBusy: true, + ); Navigator.pop(context); }, ), diff --git a/lib/screens/procedures/expansion_procedure.dart b/lib/screens/procedures/expansion_procedure.dart index 0ba2fa87..d7b2eb2a 100644 --- a/lib/screens/procedures/expansion_procedure.dart +++ b/lib/screens/procedures/expansion_procedure.dart @@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -174,11 +175,14 @@ class _ExpansionProcedureState extends State { child: Padding( padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 0), - child: AppText(itemProcedure.procedureName, + child: AppText( + Utils.convertToTitleCase(itemProcedure.procedureName), fontSize: 14.0, variant: "bodyText", bold: true, - color: Color(0xff575757)), + color: Color(0xff575757), + fontFamily: 'Poppins-Bold.ttf', + ), ), ), ], diff --git a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart index 9d312604..fd579208 100644 --- a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart +++ b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; @@ -86,6 +87,8 @@ class _ProcedureCheckOutScreenState extends State { itemCount: widget.items.length, shrinkWrap: true, itemBuilder: (BuildContext ctxt, int index) { + final TextEditingController remarksControllerNew = TextEditingController(text: widget.items[index].remarks); + return Container( margin: EdgeInsets.only(bottom: 15.0), decoration: BoxDecoration( @@ -181,7 +184,7 @@ class _ProcedureCheckOutScreenState extends State { horizontal: 12, vertical: 15.0), child: TextFields( hintText: TranslationBase.of(context).remarks, - controller: remarksController, + controller: remarksControllerNew, onChanged: (value) { widget.items[index].remarks = value; }, @@ -217,7 +220,12 @@ class _ProcedureCheckOutScreenState extends State { color: AppGlobal.appGreenColor, fontWeight: FontWeight.w700, onPressed: () async { - model.addProcedures(model, widget.items, widget.patient, remarksController, context); + GifLoaderDialogUtils.showMyDialog(context); + await widget.model.addProcedures(model, widget.items, widget.patient, remarksController, isLocalBusy: true); + + Navigator.pop(context); + Navigator.pop(context); + GifLoaderDialogUtils.hideDialog(context); }, ), ], diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 000b14c5..cb9514f4 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/screens/procedures/update_procedure.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -71,7 +72,7 @@ class ProcedureScreen extends StatelessWidget { if ((patient.patientStatusType != null && patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) - InkWell( + AddNewOrder( onTap: () { Navigator.push( context, @@ -84,46 +85,8 @@ class ProcedureScreen extends StatelessWidget { settingRoute: 'AddProcedureTabPage'), ); }, - 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, - ), - ), - ), - SizedBox( - height: 10, - ), - AppText( - TranslationBase.of(context).addMoreProcedure, - color: Colors.grey[600], - fontWeight: FontWeight.w600, - ) - ], - ), - ), - ), - ), + label: TranslationBase.of(context) + .addMoreProcedure, ), if (model.procedureList.isNotEmpty) ListView.builder( From 70573d190a14c3e22202940a9af049f8d78dd894 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 14 Apr 2022 10:18:21 +0300 Subject: [PATCH 09/26] first step from procedures --- .../procedure_valadate_request_model.dart | 6 +- .../procedure/procedure_service.dart | 6 +- lib/core/viewModel/procedure_View_model.dart | 28 +- .../profile/lab_result/labs_home_page.dart | 2 +- .../radiology/radiology_home_page.dart | 2 +- .../base_add_procedure_tab_page.dart | 19 +- .../add_favourite_procedure.dart | 3 +- .../procedure_checkout_screen.dart | 286 ++++++++---------- lib/screens/procedures/procedure_screen.dart | 21 +- 9 files changed, 177 insertions(+), 196 deletions(-) diff --git a/lib/core/model/procedure/procedure_valadate_request_model.dart b/lib/core/model/procedure/procedure_valadate_request_model.dart index 0b872b93..93aafbcf 100644 --- a/lib/core/model/procedure/procedure_valadate_request_model.dart +++ b/lib/core/model/procedure/procedure_valadate_request_model.dart @@ -1,18 +1,18 @@ -class ProcedureValadteRequestModel { +class ProcedureValidationRequestModel { String vidaAuthTokenID; int patientMRN; int appointmentNo; int episodeID; List procedure; - ProcedureValadteRequestModel( + ProcedureValidationRequestModel( {this.vidaAuthTokenID, this.patientMRN, this.appointmentNo, this.episodeID, this.procedure}); - ProcedureValadteRequestModel.fromJson(Map json) { + ProcedureValidationRequestModel.fromJson(Map json) { vidaAuthTokenID = json['VidaAuthTokenID']; patientMRN = json['PatientMRN']; appointmentNo = json['AppointmentNo']; diff --git a/lib/core/service/patient_medical_file/procedure/procedure_service.dart b/lib/core/service/patient_medical_file/procedure/procedure_service.dart index 8370e968..2c923694 100644 --- a/lib/core/service/patient_medical_file/procedure/procedure_service.dart +++ b/lib/core/service/patient_medical_file/procedure/procedure_service.dart @@ -183,8 +183,8 @@ class ProcedureService extends BaseService { }, body: updateProcedureRequestModel.toJson()); } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future validationProcedure( + ProcedureValidationRequestModel validationProcedureRequestModel) async { hasError = false; _valadteProcedureList.clear(); await baseAppClient.post(GET_PROCEDURE_VALIDATION, @@ -194,6 +194,6 @@ class ProcedureService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: procedureValadteRequestModel.toJson()); + }, body: validationProcedureRequestModel.toJson()); } } diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index e433f54e..269aeefd 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/filter_type.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/labs/lab_order_result.dart'; @@ -167,9 +168,9 @@ class ProcedureViewModel extends BaseViewModel { } Future postProcedure( - PostProcedureReqModel postProcedureReqModel, int mrn) async { + PostProcedureReqModel postProcedureReqModel, int mrn, {bool isLocalBusy = false}) async { hasError = false; - //_insuranceCardService.clearInsuranceCard(); + if(isLocalBusy) setState(ViewState.BusyLocal); else setState(ViewState.Busy); await _procedureService.postProcedure(postProcedureReqModel); if (_procedureService.hasError) { @@ -181,12 +182,12 @@ class ProcedureViewModel extends BaseViewModel { } } - Future valadteProcedure( - ProcedureValadteRequestModel procedureValadteRequestModel) async { + Future validationProcedure( + ProcedureValidationRequestModel procedureValadteRequestModel) async { hasError = false; //_insuranceCardService.clearInsuranceCard(); setState(ViewState.Busy); - await _procedureService.valadteProcedure(procedureValadteRequestModel); + await _procedureService.validationProcedure(procedureValadteRequestModel); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -381,8 +382,8 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Busy); } PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel(); - ProcedureValadteRequestModel procedureValadteRequestModel = - new ProcedureValadteRequestModel(); + ProcedureValidationRequestModel procedureValadteRequestModel = + new ProcedureValidationRequestModel(); procedureValadteRequestModel.patientMRN = patient.patientMRN; procedureValadteRequestModel.episodeID = patient.episodeNo; procedureValadteRequestModel.appointmentNo = patient.appointmentNo; @@ -415,16 +416,20 @@ class ProcedureViewModel extends BaseViewModel { }); postProcedureReqModel.procedures = controlsProcedure; - await valadteProcedure(procedureValadteRequestModel); + await validationProcedure(procedureValadteRequestModel); if (state == ViewState.Idle) { if (valadteProcedureList[0].entityList.length == 0) { - await postProcedure(postProcedureReqModel, patient.patientMRN); + await postProcedure(postProcedureReqModel, patient.patientMRN, isLocalBusy:isLocalBusy); if (state == ViewState.ErrorLocal) { Utils.showErrorToast(error); getProcedure(mrn: patient.patientMRN); } else if (state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); + if(Navigator.canPop(AppGlobal.CONTEX)) + Navigator.pop(AppGlobal.CONTEX); + if(Navigator.canPop(AppGlobal.CONTEX)) + Navigator.pop(AppGlobal.CONTEX); } } else { if (state == ViewState.ErrorLocal) { @@ -464,8 +469,7 @@ class ProcedureViewModel extends BaseViewModel { Future addProcedures(ProcedureViewModel model, List items, PatiantInformtion patient, - TextEditingController remarksController, - {bool isLocalBusy = false,}) async { + TextEditingController remarksController,{bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -489,7 +493,7 @@ class ProcedureViewModel extends BaseViewModel { await model.preparePostProcedure( entityList: entityList, patient: patient, - remarks: remarksController.text); + remarks: remarksController.text, isLocalBusy: isLocalBusy); } 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 b8684aee..4ac476d0 100644 --- a/lib/screens/patients/profile/lab_result/labs_home_page.dart +++ b/lib/screens/patients/profile/lab_result/labs_home_page.dart @@ -84,7 +84,7 @@ class _LabsHomePageState extends State { MaterialPageRoute( builder: (context) => BaseAddProcedureTabPage( patient: patient, - model: model, + previousProcedureViewModel: model, procedureType: ProcedureType.LAB_RESULT, ), settings: RouteSettings(name: 'AddProcedureTabPage'), diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index c6be1c21..5978dcf7 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -88,7 +88,7 @@ class _RadiologyHomePageState extends State { SlideUpPageRoute( widget: BaseAddProcedureTabPage( patient: patient, - model: model, + previousProcedureViewModel: model, procedureType: ProcedureType.RADIOLOGY, ), settingRoute: 'AddProcedureTabPage'), diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 7f37a09c..76b98849 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -14,14 +14,14 @@ import 'package:flutter/material.dart'; class BaseAddProcedureTabPage extends StatefulWidget { - final ProcedureViewModel model; + final ProcedureViewModel previousProcedureViewModel; final PrescriptionViewModel prescriptionModel; final PatiantInformtion patient; final ProcedureType procedureType; const BaseAddProcedureTabPage( {Key key, - this.model, + this.previousProcedureViewModel, this.prescriptionModel, this.patient, @required this.procedureType}) @@ -29,16 +29,15 @@ class BaseAddProcedureTabPage extends StatefulWidget { @override _BaseAddProcedureTabPageState createState() => _BaseAddProcedureTabPageState( - patient: patient, model: model, procedureType: procedureType); + patient: patient, procedureType: procedureType); } class _BaseAddProcedureTabPageState extends State with SingleTickerProviderStateMixin { - final ProcedureViewModel model; final PatiantInformtion patient; final ProcedureType procedureType; - _BaseAddProcedureTabPageState({this.patient, this.model, this.procedureType}); + _BaseAddProcedureTabPageState({this.patient, this.procedureType}); TabController _tabController; int _activeTab = 0; @@ -68,7 +67,11 @@ class _BaseAddProcedureTabPageState extends State return BaseView( onModelReady: (model) async { - await model.getProcedureTemplate(categoryID: widget.procedureType.getCategoryId()); + if(widget.previousProcedureViewModel == null) { + await model.getProcedureTemplate( + categoryID: widget.procedureType.getCategoryId()); + } + }, builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( @@ -118,7 +121,7 @@ class _BaseAddProcedureTabPageState extends State controller: _tabController, children: [ AddFavouriteProcedure( - previousProcedureViewModel: model, + previousProcedureViewModel: widget.previousProcedureViewModel??model, prescriptionModel: widget.prescriptionModel, patient: patient, @@ -133,7 +136,7 @@ class _BaseAddProcedureTabPageState extends State ) else AddProcedurePage( - model: this.model, + model: widget.previousProcedureViewModel, patient: patient, procedureType: procedureType, ), diff --git a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart index ae98fe96..86f1b801 100644 --- a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart @@ -48,7 +48,6 @@ class _AddFavouriteProcedureState extends State { Widget child) => AppScaffold( isShowAppBar: false, - baseViewModel: model, body: Column(children: [ (widget.previousProcedureViewModel.templateList.length != 0) ? Expanded( @@ -117,7 +116,7 @@ class _AddFavouriteProcedureState extends State { MaterialPageRoute( builder: (context) => ProcedureCheckOutScreen( items: entityList, - model: model, + previousProcedureViewModel: widget.previousProcedureViewModel, patient: widget.patient, addButtonTitle: widget.procedureType .getAddButtonTitle(context), diff --git a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart index fd579208..eb96aeb6 100644 --- a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart +++ b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart @@ -1,9 +1,12 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -15,14 +18,14 @@ import '../../../config/config.dart'; class ProcedureCheckOutScreen extends StatefulWidget { final List items; - final ProcedureViewModel model; + final ProcedureViewModel previousProcedureViewModel; final PatiantInformtion patient; final String addButtonTitle; final String toolbarTitle; ProcedureCheckOutScreen( {this.items, - this.model, + this.previousProcedureViewModel, this.patient, @required this.addButtonTitle, @required this.toolbarTitle}); @@ -43,170 +46,142 @@ class _ProcedureCheckOutScreenState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), - isShowAppBar: false, + isShowAppBar: true, + appBar: PatientSearchHeader( + title: widget.toolbarTitle ?? 'Add Procedure', + ), body: SingleChildScrollView( - child: Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - color: Colors.white, - ), - Container( - color: Colors.white, - child: Padding( - padding: EdgeInsets.all(12.0), - child: Row( - //mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - child: Icon( - Icons.arrow_back_ios_sharp, - size: 24.0, - ), - onTap: () { - Navigator.pop(context); - }, - ), - SizedBox( - width: 5.0, - ), - AppText( - widget.toolbarTitle ?? 'Add Procedure', - fontWeight: FontWeight.w700, - fontSize: 20, - ), - ], + child: Center( + child: FractionallySizedBox( + widthFactor: 0.95, + child: Column( + children: [ + SizedBox( + height: 30, ), - ), - ), - SizedBox( - height: 30, - ), - ListView.builder( - scrollDirection: Axis.vertical, - itemCount: widget.items.length, - shrinkWrap: true, - itemBuilder: (BuildContext ctxt, int index) { - final TextEditingController remarksControllerNew = TextEditingController(text: widget.items[index].remarks); + ListView.builder( + scrollDirection: Axis.vertical, + itemCount: widget.items.length, + physics: BouncingScrollPhysics(), - return 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, + shrinkWrap: true, + itemBuilder: (BuildContext ctxt, int index) { + final TextEditingController remarksControllerNew = TextEditingController(text: widget.items[index].remarks); + + return 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: [ + + Expanded( + child: + AppText(Utils.convertToTitleCase(widget.items[index].procedureName), fontWeight: FontWeight.w700,color: AppGlobal.appTextColor, + )), + ], ), - 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), - child: AppText( - TranslationBase.of(context).orderType, - fontWeight: FontWeight.w700, - color: Color(0xff2B353E), - ), - ), - ], - ), - Row( + children: [ + Container( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, 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, + Row( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + horizontal: 11), + child: AppText( + TranslationBase.of(context).orderType, + fontWeight: FontWeight.w700, + color: Color(0xff2B353E), + ), + ), + ], ), - 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: remarksControllerNew, - onChanged: (value) { - widget.items[index].remarks = value; - }, - minLines: 3, - maxLines: 5, - borderWidth: 0.5, - borderColor: Colors.grey[500], - ), - ), - SizedBox( - height: 19.0, + SizedBox( + height: 2.0, + ), + Padding( + padding: EdgeInsets.symmetric( + horizontal: 12, vertical: 15.0), + child: TextFields( + hintText: TranslationBase.of(context).remarks, + controller: remarksControllerNew, + onChanged: (value) { + widget.items[index].remarks = value; + }, + minLines: 3, + maxLines: 5, + borderWidth: 0.5, + borderColor: Colors.grey[500], + ), + ), + SizedBox( + height: 19.0, + ), + //DividerWithSpacesAround(), + ], ), - //DividerWithSpacesAround(), - ], - ), - ); - }), + ); + }), - SizedBox( - height: 90, + SizedBox( + height: 90, + ), + ], ), - ], + ), ), ), bottomSheet: Container( @@ -221,10 +196,7 @@ class _ProcedureCheckOutScreenState extends State { fontWeight: FontWeight.w700, onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); - await widget.model.addProcedures(model, widget.items, widget.patient, remarksController, isLocalBusy: true); - - Navigator.pop(context); - Navigator.pop(context); + await widget.previousProcedureViewModel.addProcedures(widget.previousProcedureViewModel, widget.items, widget.patient, remarksController, isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); }, ), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index cb9514f4..8e959d91 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-prof import 'package:doctor_app_flutter/widgets/patients/patient_service_title.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/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/material.dart'; import '../../widgets/shared/errors/error_message.dart'; @@ -57,13 +58,8 @@ class ProcedureScreen extends StatelessWidget { SizedBox( height: 12, ), - if (model.procedureList.length == 0 && - patient.patientStatusType != 43) - ServiceTitle( - title: TranslationBase.of(context).orderTestOr, - subTitle: TranslationBase.of(context).procedure, - ), - if (patient.patientStatusType != null && + if ((model.procedureList.length == 0 && + patient.patientStatusType != 43) || patient.patientStatusType != null && patient.patientStatusType == 43) ServiceTitle( title: TranslationBase.of(context).orderTestOr, @@ -73,13 +69,18 @@ class ProcedureScreen extends StatelessWidget { patient.patientStatusType == 43) || (isFromLiveCare && patient.appointmentNo != null)) AddNewOrder( - onTap: () { + onTap: () async { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProcedureTemplate( + categoryID: ProcedureType.PROCEDURE.getCategoryId(), isLocalBusy: true); + GifLoaderDialogUtils.hideDialog(context); + Navigator.push( context, SlideUpPageRoute( widget: BaseAddProcedureTabPage( patient: patient, - model: model, + previousProcedureViewModel: model, procedureType: ProcedureType.PROCEDURE, ), settingRoute: 'AddProcedureTabPage'), @@ -93,6 +94,8 @@ class ProcedureScreen extends StatelessWidget { scrollDirection: Axis.vertical, itemCount: model.procedureList[0].rowcount, shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (BuildContext ctxt, int index) { return ProcedureCard( categoryID: model From 1a3ad32aa503f520789ad7065b71db74bd420722 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 14 Apr 2022 13:44:40 +0300 Subject: [PATCH 10/26] Fix issue on procedure_card.dart --- lib/core/viewModel/procedure_View_model.dart | 132 +++++++++++------- .../procedures/add_procedure_page.dart | 87 ++++++------ lib/screens/procedures/procedure_card.dart | 2 + lib/screens/procedures/procedure_screen.dart | 3 - lib/screens/procedures/update_procedure.dart | 65 ++++----- 5 files changed, 156 insertions(+), 133 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index 269aeefd..d9e77686 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -7,7 +7,8 @@ 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/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; -import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' as cpe; +import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart' + as cpe; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_templateModel.dart'; @@ -71,10 +72,17 @@ class ProcedureViewModel extends BaseViewModel { List get procedureTemplateDetails => _procedureService.templateDetailsList; - Future getProcedure({int mrn, String patientType, int appointmentNo}) async { + Future getProcedure( + {int mrn, + String patientType, + int appointmentNo, + bool isLocalBusy = false}) async { hasError = false; await getDoctorProfile(); - setState(ViewState.Busy); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); await _procedureService.getProcedure( mrn: mrn, appointmentNo: appointmentNo); if (_procedureService.hasError) { @@ -88,10 +96,16 @@ class ProcedureViewModel extends BaseViewModel { } Future getProcedureCategory( - {String categoryName, String categoryID, patientId}) async { + {String categoryName, + String categoryID, + patientId, + bool isLocalBusy = false}) async { if (categoryName == null) return; hasError = false; - setState(ViewState.Busy); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); await _procedureService.getProcedureCategory( categoryName: categoryName, categoryID: categoryID, @@ -115,19 +129,23 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future getProcedureTemplate({String categoryID, bool isLocalBusy = false, BuildContext context}) async { + Future getProcedureTemplate( + {String categoryID, + bool isLocalBusy = false, + BuildContext context}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { - setState(ViewState.Busy); + setState(ViewState.Busy); } - await _procedureService.getProcedureTemplate(categoryID: categoryID, isLocalBusy: false); + await _procedureService.getProcedureTemplate( + categoryID: categoryID, isLocalBusy: false); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); } else setTemplateListDependOnId(); - setState(ViewState.Idle); + setState(ViewState.Idle); } setTemplateListDependOnId() { @@ -167,27 +185,33 @@ class ProcedureViewModel extends BaseViewModel { setState(ViewState.Idle); } - Future postProcedure( - PostProcedureReqModel postProcedureReqModel, int mrn, {bool isLocalBusy = false}) async { + Future postProcedure(PostProcedureReqModel postProcedureReqModel, int mrn, + {bool isLocalBusy = false}) async { hasError = false; - if(isLocalBusy) setState(ViewState.BusyLocal); else - setState(ViewState.Busy); + if (isLocalBusy) + setState(ViewState.BusyLocal); + else + setState(ViewState.Busy); await _procedureService.postProcedure(postProcedureReqModel); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); } else { - await getProcedure(mrn: mrn); + await getProcedure(mrn: mrn, isLocalBusy:isLocalBusy); setState(ViewState.Idle); } } Future validationProcedure( - ProcedureValidationRequestModel procedureValadteRequestModel) async { + ProcedureValidationRequestModel procedureValidateRequestModel, + {bool isLocalBusy = false}) async { hasError = false; - //_insuranceCardService.clearInsuranceCard(); - setState(ViewState.Busy); - await _procedureService.validationProcedure(procedureValadteRequestModel); + if (isLocalBusy) { + setState(ViewState.BusyLocal); + } else { + setState(ViewState.Busy); + } + await _procedureService.validationProcedure(procedureValidateRequestModel); if (_procedureService.hasError) { error = _procedureService.error; setState(ViewState.ErrorLocal); @@ -366,15 +390,14 @@ class ProcedureViewModel extends BaseViewModel { DrAppToastMsg.showSuccesToast(mes); } - Future preparePostProcedure( - {String remarks, - String orderType, - PatiantInformtion patient, - List entityList, - ProcedureType procedureType, - bool isLocalBusy = false, - }) async { - + Future preparePostProcedure({ + String remarks, + String orderType, + PatiantInformtion patient, + List entityList, + ProcedureType procedureType, + bool isLocalBusy = false, + }) async { ///TODO Roaa Move it to function if (isLocalBusy) { setState(ViewState.BusyLocal); @@ -416,19 +439,21 @@ class ProcedureViewModel extends BaseViewModel { }); postProcedureReqModel.procedures = controlsProcedure; - await validationProcedure(procedureValadteRequestModel); + await validationProcedure(procedureValadteRequestModel, + isLocalBusy: isLocalBusy); if (state == ViewState.Idle) { if (valadteProcedureList[0].entityList.length == 0) { - await postProcedure(postProcedureReqModel, patient.patientMRN, isLocalBusy:isLocalBusy); + await postProcedure(postProcedureReqModel, patient.patientMRN, + isLocalBusy: isLocalBusy); if (state == ViewState.ErrorLocal) { Utils.showErrorToast(error); - getProcedure(mrn: patient.patientMRN); + getProcedure(mrn: patient.patientMRN, isLocalBusy: isLocalBusy); } else if (state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been added'); - if(Navigator.canPop(AppGlobal.CONTEX)) - Navigator.pop(AppGlobal.CONTEX); - if(Navigator.canPop(AppGlobal.CONTEX)) + if (Navigator.canPop(AppGlobal.CONTEX)) + Navigator.pop(AppGlobal.CONTEX); + if (Navigator.canPop(AppGlobal.CONTEX)) Navigator.pop(AppGlobal.CONTEX); } } else { @@ -445,18 +470,21 @@ class ProcedureViewModel extends BaseViewModel { } } - bool isEntityListSelected(cpe.EntityList masterKey, List entityList) { - Iterable history = entityList.where((element) => masterKey.procedureId == element.procedureId); + bool isEntityListSelected( + cpe.EntityList masterKey, List entityList) { + Iterable history = entityList + .where((element) => masterKey.procedureId == element.procedureId); if (history.length > 0) { return true; } return false; } - bool isProcedureEntityListSelected(ProcedureTempleteDetailsModel masterKey, List entityList) { + bool isProcedureEntityListSelected(ProcedureTempleteDetailsModel masterKey, + List entityList) { Iterable history = entityList.where( - (element) => - masterKey.templateID == element.templateID && + (element) => + masterKey.templateID == element.templateID && masterKey.procedureName == element.procedureName); if (history.length > 0) { return true; @@ -464,12 +492,12 @@ class ProcedureViewModel extends BaseViewModel { return false; } - - - Future addProcedures(ProcedureViewModel model, + Future addProcedures( + ProcedureViewModel model, List items, PatiantInformtion patient, - TextEditingController remarksController,{bool isLocalBusy = false}) async { + TextEditingController remarksController, + {bool isLocalBusy = false}) async { if (isLocalBusy) { setState(ViewState.BusyLocal); } else { @@ -493,11 +521,12 @@ class ProcedureViewModel extends BaseViewModel { await model.preparePostProcedure( entityList: entityList, patient: patient, - remarks: remarksController.text, isLocalBusy: isLocalBusy); - + remarks: remarksController.text, + isLocalBusy: isLocalBusy); } - Future filterSearchResults(String query,List masterList, List items) async { + Future filterSearchResults(String query, List masterList, + List items) async { List dummySearchList = List(); dummySearchList.addAll(masterList); if (query.isNotEmpty) { @@ -515,7 +544,10 @@ class ProcedureViewModel extends BaseViewModel { } } - void filterProcedureSearchResults(String query, List masterList, List items) { + void filterProcedureSearchResults( + String query, + List masterList, + List items) { List dummySearchList = List(); dummySearchList.addAll(masterList); if (query.isNotEmpty) { @@ -525,12 +557,12 @@ class ProcedureViewModel extends BaseViewModel { dummyListData.add(item); } }); - items.clear(); - items.addAll(dummyListData); + items.clear(); + items.addAll(dummyListData); return; } else { - items.clear(); - items.addAll(masterList); + items.clear(); + items.addAll(masterList); } } } diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index be3dc059..6e174f71 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -1,4 +1,5 @@ import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; @@ -6,6 +7,7 @@ import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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/buttons/app_buttons_widget.dart'; @@ -118,18 +120,33 @@ class _AddProcedurePageState extends State { ), Expanded( child: InkWell( - onTap: () { + onTap: () async { if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) - model.getProcedureCategory( + procedureName.text.length >= 3) { + GifLoaderDialogUtils.showMyDialog(context); + await model.getProcedureCategory( patientId: patient.patientId, categoryName: - procedureName.text); - else + procedureName.text, + isLocalBusy: true + ); + if(model.state == ViewState.ErrorLocal){ + DrAppToastMsg.showErrorToast( + model.error + ); + + } + GifLoaderDialogUtils.hideDialog(context); + + } + + else { DrAppToastMsg.showErrorToast( TranslationBase.of(context) .atLeastThreeCharacters, ); + } + }, child: Icon( Icons.search, @@ -172,43 +189,35 @@ class _AddProcedurePageState extends State { ), ), ), - Container( - margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), - child: Wrap( - alignment: WrapAlignment.center, - children: [ - AppButton( - title: procedureType.getAddButtonTitle(context), - fontWeight: FontWeight.w700, - color: AppGlobal.appGreenColor, - onPressed: () async { - GifLoaderDialogUtils.showMyDialog(context); - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, - ); - GifLoaderDialogUtils.hideDialog(context); - return; - } - GifLoaderDialogUtils.showMyDialog(context); - await this.model.preparePostProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - remarks: remarksController.text, - procedureType: ProcedureType.PROCEDURE, - isLocalBusy: true, - ); - Navigator.pop(context); - }, - ), - ], - ), - ), ], ), ), + bottomSheet: model.state == ViewState.BusyLocal? Container(height: 0,):CustomBottomSheetContainer( + label: procedureType.getAddButtonTitle(context), + onTap: () async { + { + GifLoaderDialogUtils.showMyDialog(context); + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + GifLoaderDialogUtils.hideDialog(context); + return; + } + GifLoaderDialogUtils.showMyDialog(context); + await model.preparePostProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + remarks: remarksController.text, + procedureType: ProcedureType.PROCEDURE, + isLocalBusy: true, + ); + GifLoaderDialogUtils.hideDialog(context); + } + } + ), ), ); } diff --git a/lib/screens/procedures/procedure_card.dart b/lib/screens/procedures/procedure_card.dart index afff9a92..1a213f9c 100644 --- a/lib/screens/procedures/procedure_card.dart +++ b/lib/screens/procedures/procedure_card.dart @@ -13,6 +13,8 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +/// TODO Roaa Add translation and make sure it working fine + class ProcedureCard extends StatelessWidget { final Function onTap; final EntityList entityList; diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 8e959d91..a477e061 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -124,9 +124,6 @@ class ProcedureScreen extends StatelessWidget { .entityList[index].procedureId, limetNo: model.procedureList[0] .entityList[index].lineItemNo); - // } else - // Helpers.showErrorToast( - // 'You Cant Update This Procedure'); }, patient: patient, doctorID: model?.doctorProfile?.doctorID, diff --git a/lib/screens/procedures/update_procedure.dart b/lib/screens/procedures/update_procedure.dart index bad37158..52862163 100644 --- a/lib/screens/procedures/update_procedure.dart +++ b/lib/screens/procedures/update_procedure.dart @@ -7,9 +7,13 @@ import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/widgets/bottom_sheet/bottom_sheet_container.dart'; +import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -89,18 +93,22 @@ class _UpdateProcedureWidgetState extends State { List entityList = List(); dynamic selectedCategory; + /// TODO Roaa Add translation and make sure it working fine @override Widget build(BuildContext context) { - final screenSize = MediaQuery.of(context).size; return StatefulBuilder(builder: (BuildContext context, StateSetter setState /*You can rename this!*/) { return BaseView( onModelReady: (model) => model.getCategory(), builder: (BuildContext context, ProcedureViewModel model, Widget child) => - NetworkBaseView( + AppScaffold( + isShowAppBar: true, baseViewModel: model, - child: SingleChildScrollView( + appBar: PatientSearchHeader( + title: "Update Procedure", + ), + body: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 0.9, child: Form( @@ -165,49 +173,24 @@ class _UpdateProcedureWidgetState extends State { SizedBox( height: 70.0, ), - Container( - margin: - EdgeInsets.all(SizeConfig.widthMultiplier * 2), - child: Column( - children: [ - AppButton( - color: AppGlobal.appGreenColor, - title: TranslationBase.of(context) - .updateProcedure - .toUpperCase(), - onPressed: () { - Navigator.pop(context); - updateProcedure( - limetNO: widget.limetNo, - orderNo: widget.orderNo, - orderType: selectedType.toString(), - categorieId: widget.categoryId, - procedureId: widget.procedureId, - entityList: entityList, - patient: widget.patient, - model: widget.model, - remarks: widget.remarksController.text); - // authorizationForm(context); - }, - ), - SizedBox( - height: 20.0, - ), - AppButton( - title: TranslationBase.of(context).cancel, - color: AppGlobal.appRedColor, - onPressed: () { - Navigator.pop(context); - }, - ) - ], - ), - ), ], ), ), )), ), + bottomSheet: CustomBottomSheetContainer( + label: TranslationBase.of(context).updateProcedure.toUpperCase(), + onTap: () => updateProcedure( + limetNO: widget.limetNo, + orderNo: widget.orderNo, + orderType: selectedType.toString(), + categorieId: widget.categoryId, + procedureId: widget.procedureId, + entityList: entityList, + patient: widget.patient, + model: widget.model, + remarks: widget.remarksController.text), + ), ), ); }); From 33b8d6d78db72209c685121ecb8b78e57f459ac5 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 14 Apr 2022 14:02:32 +0300 Subject: [PATCH 11/26] update procedure --- .../procedures/add_procedure_page.dart | 94 +++++++++---------- .../base_add_procedure_tab_page.dart | 56 +++++------ .../entity_list_checkbox_search_widget.dart | 29 +++--- .../procedures/expansion_procedure.dart | 36 +++---- .../add_favourite_procedure.dart | 8 +- .../entity_list_fav_procedure.dart | 17 ++-- .../procedure_checkout_screen.dart | 57 ++++++----- lib/screens/procedures/procedure_card.dart | 11 ++- lib/screens/procedures/procedure_screen.dart | 18 ++-- lib/screens/procedures/tab_widget.dart | 23 ++--- lib/screens/procedures/update_procedure.dart | 38 ++++---- 11 files changed, 189 insertions(+), 198 deletions(-) diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 6e174f71..a82eaafa 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -1,8 +1,7 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; @@ -10,12 +9,11 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; -import '../../config/config.dart'; + import 'entity_list_checkbox_search_widget.dart'; class AddProcedurePage extends StatefulWidget { @@ -123,30 +121,25 @@ class _AddProcedurePageState extends State { onTap: () async { if (procedureName.text.isNotEmpty && procedureName.text.length >= 3) { - GifLoaderDialogUtils.showMyDialog(context); + GifLoaderDialogUtils.showMyDialog( + context); await model.getProcedureCategory( patientId: patient.patientId, - categoryName: - procedureName.text, - isLocalBusy: true - ); - if(model.state == ViewState.ErrorLocal){ + categoryName: procedureName.text, + isLocalBusy: true); + if (model.state == + ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast( - model.error - ); - + model.error); } - GifLoaderDialogUtils.hideDialog(context); - - } - - else { + GifLoaderDialogUtils.hideDialog( + context); + } else { DrAppToastMsg.showErrorToast( TranslationBase.of(context) .atLeastThreeCharacters, ); } - }, child: Icon( Icons.search, @@ -166,8 +159,7 @@ class _AddProcedurePageState extends State { baseViewModel: model, child: EntityListCheckboxSearchWidget( model: widget.model, - masterList: - model.categoriesList[0].entityList, + masterList: model.categoriesList[0].entityList, removeProcedure: (item) { setState(() { entityList.remove(item); @@ -178,12 +170,13 @@ class _AddProcedurePageState extends State { entityList.add(history); }); }, - addSelectedHistories: () { - }, - isEntityListSelected: (master) => - widget.model.isEntityListSelected(master,entityList), + addSelectedHistories: () {}, + isEntityListSelected: (master) => widget.model + .isEntityListSelected(master, entityList), )), - SizedBox(height: 10,) + SizedBox( + height: 10, + ) ], ), ), @@ -192,32 +185,35 @@ class _AddProcedurePageState extends State { ], ), ), - bottomSheet: model.state == ViewState.BusyLocal? Container(height: 0,):CustomBottomSheetContainer( - label: procedureType.getAddButtonTitle(context), - onTap: () async { - { - GifLoaderDialogUtils.showMyDialog(context); - if (entityList.isEmpty == true) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .fillTheMandatoryProcedureDetails, + bottomSheet: model.state == ViewState.BusyLocal + ? Container( + height: 0, + ) + : CustomBottomSheetContainer( + label: procedureType.getAddButtonTitle(context), + onTap: () async { + { + GifLoaderDialogUtils.showMyDialog(context); + if (entityList.isEmpty == true) { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .fillTheMandatoryProcedureDetails, + ); + GifLoaderDialogUtils.hideDialog(context); + return; + } + GifLoaderDialogUtils.showMyDialog(context); + await model.preparePostProcedure( + orderType: selectedType.toString(), + entityList: entityList, + patient: patient, + remarks: remarksController.text, + procedureType: ProcedureType.PROCEDURE, + isLocalBusy: true, ); GifLoaderDialogUtils.hideDialog(context); - return; } - GifLoaderDialogUtils.showMyDialog(context); - await model.preparePostProcedure( - orderType: selectedType.toString(), - entityList: entityList, - patient: patient, - remarks: remarksController.text, - procedureType: ProcedureType.PROCEDURE, - isLocalBusy: true, - ); - GifLoaderDialogUtils.hideDialog(context); - } - } - ), + }), ), ); } diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index 76b98849..ef36fb97 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -1,18 +1,17 @@ +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/prescription/add_prescription/add_prescription.dart'; -import 'package:doctor_app_flutter/screens/procedures/favorite_procedure/add_favourite_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/add_procedure_page.dart'; +import 'package:doctor_app_flutter/screens/procedures/favorite_procedure/add_favourite_procedure.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/screens/procedures/tab_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/material.dart'; - class BaseAddProcedureTabPage extends StatefulWidget { final ProcedureViewModel previousProcedureViewModel; final PrescriptionViewModel prescriptionModel; @@ -67,24 +66,25 @@ class _BaseAddProcedureTabPageState extends State return BaseView( onModelReady: (model) async { - if(widget.previousProcedureViewModel == null) { + if (widget.previousProcedureViewModel == null) { await model.getProcedureTemplate( categoryID: widget.procedureType.getCategoryId()); } - }, builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: BottomSheetTitle(title: procedureType.getToolbarLabel(context),), - body: NetworkBaseView( + baseViewModel: model, + isShowAppBar: true, + appBar: BottomSheetTitle( + title: procedureType.getToolbarLabel(context), + ), + body: NetworkBaseView( baseViewModel: model, child: Scaffold( extendBodyBehindAppBar: true, appBar: PreferredSize( - preferredSize: Size.fromHeight( - MediaQuery.of(context).size.height * 0.070), + preferredSize: + Size.fromHeight(MediaQuery.of(context).size.height * 0.070), child: TabBar( isScrollable: false, controller: _tabController, @@ -92,24 +92,16 @@ class _BaseAddProcedureTabPageState extends State indicatorWeight: 1.0, indicatorSize: TabBarIndicatorSize.tab, labelColor: Theme.of(context).primaryColor, - labelPadding: EdgeInsets.only( - top: 0, left: 0, right: 0, bottom: 0), + labelPadding: + EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0), unselectedLabelColor: Colors.grey[800], tabs: [ - TabWidget.tabWidget( - screenSize, - _activeTab == 0, - - procedureType - .getFavouriteTabName(context), - isFirst: true,context: context - ), - TabWidget.tabWidget( - screenSize, - _activeTab == 1, + TabWidget.tabWidget(screenSize, _activeTab == 0, + procedureType.getFavouriteTabName(context), + isFirst: true, context: context), + TabWidget.tabWidget(screenSize, _activeTab == 1, procedureType.getAllLabelName(context), - isLast: true,context: context - ), + isLast: true, context: context), ], ), ), @@ -121,14 +113,13 @@ class _BaseAddProcedureTabPageState extends State controller: _tabController, children: [ AddFavouriteProcedure( - previousProcedureViewModel: widget.previousProcedureViewModel??model, - prescriptionModel: - widget.prescriptionModel, + previousProcedureViewModel: + widget.previousProcedureViewModel ?? model, + prescriptionModel: widget.prescriptionModel, patient: patient, procedureType: procedureType, ), - if (widget.procedureType == - ProcedureType.PRESCRIPTION) + if (widget.procedureType == ProcedureType.PRESCRIPTION) AddPrescription( widget.prescriptionModel, widget.patient, @@ -145,8 +136,7 @@ class _BaseAddProcedureTabPageState extends State ), ], ), - ) - ), + )), ), ); } diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index 332300c2..b5a798fe 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -1,13 +1,14 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; + import '../../config/config.dart'; class EntityListCheckboxSearchWidget extends StatefulWidget { @@ -18,16 +19,15 @@ class EntityListCheckboxSearchWidget extends StatefulWidget { final bool Function(EntityList) isEntityListSelected; final List masterList; - EntityListCheckboxSearchWidget( - {Key key, - this.model, - this.addSelectedHistories, - this.removeProcedure, - this.masterList, - this.addProcedure, - this.isEntityListSelected, - }) - : super(key: key); + EntityListCheckboxSearchWidget({ + Key key, + this.model, + this.addSelectedHistories, + this.removeProcedure, + this.masterList, + this.addProcedure, + this.isEntityListSelected, + }) : super(key: key); @override _EntityListCheckboxSearchWidgetState createState() => @@ -80,7 +80,8 @@ class _EntityListCheckboxSearchWidgetState suffixIcon: EvaIcons.search, suffixIconColor: Color(0xff2B353E), onChanged: (value) { - widget.model.filterSearchResults(value, widget.masterList, items); + widget.model.filterSearchResults( + value, widget.masterList, items); }, hasBorder: false, ), @@ -106,8 +107,8 @@ class _EntityListCheckboxSearchWidgetState widget.removeProcedure( historyInfo); } else { - widget - .addProcedure(historyInfo); + widget.addProcedure( + historyInfo); } }); }), diff --git a/lib/screens/procedures/expansion_procedure.dart b/lib/screens/procedures/expansion_procedure.dart index d7b2eb2a..d48ab586 100644 --- a/lib/screens/procedures/expansion_procedure.dart +++ b/lib/screens/procedures/expansion_procedure.dart @@ -64,8 +64,8 @@ class _ExpansionProcedureState extends State { children: [ Expanded( child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + crossAxisAlignment: CrossAxisAlignment.start, + children: [ Icon( Icons.folder, size: 20, @@ -76,17 +76,16 @@ class _ExpansionProcedureState extends State { padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 0), child: AppText( - widget.isProcedure == true - ? "Procedures for " + - widget.procedureTempleteModel.templateName - : "Prescription for " + - widget.procedureTempleteModel.templateName, - letterSpacing: -0.72, - fontSize: 16.0, - color: AppGlobal.appTextColor, - fontWeight: FontWeight.w600, + widget.isProcedure == true + ? "Procedures for " + + widget.procedureTempleteModel.templateName + : "Prescription for " + + widget.procedureTempleteModel.templateName, + letterSpacing: -0.72, + fontSize: 16.0, + color: AppGlobal.appTextColor, + fontWeight: FontWeight.w600, ), - ), ), ], @@ -176,12 +175,13 @@ class _ExpansionProcedureState extends State { padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 0), child: AppText( - Utils.convertToTitleCase(itemProcedure.procedureName), - fontSize: 14.0, - variant: "bodyText", - bold: true, - color: Color(0xff575757), - fontFamily: 'Poppins-Bold.ttf', + Utils.convertToTitleCase( + itemProcedure.procedureName), + fontSize: 14.0, + variant: "bodyText", + bold: true, + color: Color(0xff575757), + fontFamily: 'Poppins-Bold.ttf', ), ), ), diff --git a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart index 86f1b801..ad689e93 100644 --- a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart @@ -1,7 +1,7 @@ +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/prescription/prescription_checkout_screen.dart'; import 'package:doctor_app_flutter/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart'; @@ -66,7 +66,8 @@ class _AddFavouriteProcedureState extends State { }); }, isEntityFavListSelected: (master) => - procedureViewModel.isProcedureEntityListSelected(master, entityList), + procedureViewModel.isProcedureEntityListSelected( + master, entityList), groupProcedures: groupProcedures, selectProcedures: (selectedProcedure) { setState(() { @@ -116,7 +117,8 @@ class _AddFavouriteProcedureState extends State { MaterialPageRoute( builder: (context) => ProcedureCheckOutScreen( items: entityList, - previousProcedureViewModel: widget.previousProcedureViewModel, + previousProcedureViewModel: + widget.previousProcedureViewModel, patient: widget.patient, addButtonTitle: widget.procedureType .getAddButtonTitle(context), diff --git a/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart index 6598008b..3b6537ff 100644 --- a/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/entity_list_fav_procedure.dart @@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; + import '../../../config/config.dart'; import '../../../widgets/shared/text_fields/app_text_field_custom_serach.dart'; @@ -76,7 +77,6 @@ class _EntityListCheckboxSearchFavProceduresWidgetState TextEditingController remarksController = TextEditingController(); TextEditingController patientFileInfoController = TextEditingController(); - @override Widget build(BuildContext context) { return SingleChildScrollView( @@ -88,19 +88,18 @@ class _EntityListCheckboxSearchFavProceduresWidgetState child: Container( margin: EdgeInsets.only(top: 15), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Colors.white), + borderRadius: BorderRadius.circular(8), color: Colors.white), child: ListView( children: [ AppTextFieldCustomSearch( searchController: patientFileInfoController, onChangeFun: (value) { - widget.model.filterProcedureSearchResults(value, widget.masterList, items); + widget.model.filterProcedureSearchResults( + value, widget.masterList, items); }, marginTop: 5, inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(ONLY_LETTERS)) + FilteringTextInputFormatter.allow(RegExp(ONLY_LETTERS)) ], inputType: TextInputType.text, hintText: TranslationBase.of(context).searchFavoriteTemplate, @@ -110,16 +109,14 @@ class _EntityListCheckboxSearchFavProceduresWidgetState ), widget.model.templateList.length != 0 ? Column( - children: - widget.model.templateList.map((historyInfo) { + children: widget.model.templateList.map((historyInfo) { return ExpansionProcedure( procedureTempleteModel: historyInfo, model: widget.model, removeFavProcedure: widget.removeFavProcedure, addFavProcedure: widget.addFavProcedure, selectProcedures: widget.selectProcedures, - isEntityListSelected: - widget.isEntityListSelected, + isEntityListSelected: widget.isEntityListSelected, isEntityFavListSelected: widget.isEntityFavListSelected, isProcedure: widget.isProcedure, diff --git a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart index eb96aeb6..fa1f880d 100644 --- a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart +++ b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart @@ -1,24 +1,24 @@ import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.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/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; + import '../../../config/config.dart'; class ProcedureCheckOutScreen extends StatefulWidget { final List items; - final ProcedureViewModel previousProcedureViewModel; + final ProcedureViewModel previousProcedureViewModel; final PatiantInformtion patient; final String addButtonTitle; final String toolbarTitle; @@ -48,8 +48,8 @@ class _ProcedureCheckOutScreenState extends State { backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), isShowAppBar: true, appBar: PatientSearchHeader( - title: widget.toolbarTitle ?? 'Add Procedure', - ), + title: widget.toolbarTitle ?? 'Add Procedure', + ), body: SingleChildScrollView( child: Center( child: FractionallySizedBox( @@ -63,10 +63,11 @@ class _ProcedureCheckOutScreenState extends State { scrollDirection: Axis.vertical, itemCount: widget.items.length, physics: BouncingScrollPhysics(), - shrinkWrap: true, itemBuilder: (BuildContext ctxt, int index) { - final TextEditingController remarksControllerNew = TextEditingController(text: widget.items[index].remarks); + final TextEditingController remarksControllerNew = + TextEditingController( + text: widget.items[index].remarks); return Container( margin: EdgeInsets.only(bottom: 15.0), @@ -78,11 +79,13 @@ class _ProcedureCheckOutScreenState extends State { initiallyExpanded: true, title: Row( children: [ - Expanded( - child: - AppText(Utils.convertToTitleCase(widget.items[index].procedureName), fontWeight: FontWeight.w700,color: AppGlobal.appTextColor, - )), + child: AppText( + Utils.convertToTitleCase( + widget.items[index].procedureName), + fontWeight: FontWeight.w700, + color: AppGlobal.appTextColor, + )), ], ), children: [ @@ -90,7 +93,8 @@ class _ProcedureCheckOutScreenState extends State { child: Padding( padding: EdgeInsets.symmetric(horizontal: 12), child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Row( children: [ @@ -98,7 +102,8 @@ class _ProcedureCheckOutScreenState extends State { padding: const EdgeInsets.symmetric( horizontal: 11), child: AppText( - TranslationBase.of(context).orderType, + TranslationBase.of(context) + .orderType, fontWeight: FontWeight.w700, color: Color(0xff2B353E), ), @@ -110,10 +115,11 @@ class _ProcedureCheckOutScreenState extends State { Radio( activeColor: Color(0xFFD02127), value: 0, - groupValue: - widget.items[index].selectedType, + groupValue: widget + .items[index].selectedType, onChanged: (value) { - widget.items[index].selectedType = 0; + widget.items[index].selectedType = + 0; setState(() { widget.items[index].type = value.toString(); @@ -127,11 +133,12 @@ class _ProcedureCheckOutScreenState extends State { ), Radio( activeColor: Color(0xFFD02127), - groupValue: - widget.items[index].selectedType, + groupValue: widget + .items[index].selectedType, value: 1, onChanged: (value) { - widget.items[index].selectedType = 1; + widget.items[index].selectedType = + 1; setState(() { widget.items[index].type = value.toString(); @@ -175,7 +182,6 @@ class _ProcedureCheckOutScreenState extends State { ), ); }), - SizedBox( height: 90, ), @@ -196,7 +202,12 @@ class _ProcedureCheckOutScreenState extends State { fontWeight: FontWeight.w700, onPressed: () async { GifLoaderDialogUtils.showMyDialog(context); - await widget.previousProcedureViewModel.addProcedures(widget.previousProcedureViewModel, widget.items, widget.patient, remarksController, isLocalBusy: true); + await widget.previousProcedureViewModel.addProcedures( + widget.previousProcedureViewModel, + widget.items, + widget.patient, + remarksController, + isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); }, ), diff --git a/lib/screens/procedures/procedure_card.dart b/lib/screens/procedures/procedure_card.dart index 1a213f9c..9f61d556 100644 --- a/lib/screens/procedures/procedure_card.dart +++ b/lib/screens/procedures/procedure_card.dart @@ -1,12 +1,12 @@ import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart'; import 'package:flutter/cupertino.dart'; @@ -202,9 +202,10 @@ class ProcedureCard extends StatelessWidget { children: [ Expanded( child: AppText( - entityList.remarks!= null?Utils.convertToTitleCase( - entityList.remarks.toString()) : - '', + entityList.remarks != null + ? Utils.convertToTitleCase( + entityList.remarks.toString()) + : '', fontSize: 12, ), ), diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index a477e061..76947d00 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -1,22 +1,22 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; -import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_card.dart'; import 'package:doctor_app_flutter/screens/procedures/procedure_type.dart'; import 'package:doctor_app_flutter/screens/procedures/update_procedure.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; -import 'package:doctor_app_flutter/widgets/patients/patient_service_title.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/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/transitions/slide_up_page.dart'; import 'package:flutter/material.dart'; + import '../../widgets/shared/errors/error_message.dart'; import 'base_add_procedure_tab_page.dart'; @@ -59,8 +59,9 @@ class ProcedureScreen extends StatelessWidget { height: 12, ), if ((model.procedureList.length == 0 && - patient.patientStatusType != 43) || patient.patientStatusType != null && - patient.patientStatusType == 43) + patient.patientStatusType != 43) || + patient.patientStatusType != null && + patient.patientStatusType == 43) ServiceTitle( title: TranslationBase.of(context).orderTestOr, subTitle: TranslationBase.of(context).procedure, @@ -72,7 +73,8 @@ class ProcedureScreen extends StatelessWidget { onTap: () async { GifLoaderDialogUtils.showMyDialog(context); await model.getProcedureTemplate( - categoryID: ProcedureType.PROCEDURE.getCategoryId(), isLocalBusy: true); + categoryID: ProcedureType.PROCEDURE.getCategoryId(), + isLocalBusy: true); GifLoaderDialogUtils.hideDialog(context); Navigator.push( @@ -86,8 +88,7 @@ class ProcedureScreen extends StatelessWidget { settingRoute: 'AddProcedureTabPage'), ); }, - label: TranslationBase.of(context) - .addMoreProcedure, + label: TranslationBase.of(context).addMoreProcedure, ), if (model.procedureList.isNotEmpty) ListView.builder( @@ -95,7 +96,6 @@ class ProcedureScreen extends StatelessWidget { itemCount: model.procedureList[0].rowcount, shrinkWrap: true, physics: BouncingScrollPhysics(), - itemBuilder: (BuildContext ctxt, int index) { return ProcedureCard( categoryID: model diff --git a/lib/screens/procedures/tab_widget.dart b/lib/screens/procedures/tab_widget.dart index 9683c1b4..23d77ea2 100644 --- a/lib/screens/procedures/tab_widget.dart +++ b/lib/screens/procedures/tab_widget.dart @@ -3,19 +3,17 @@ import 'package:doctor_app_flutter/utils/tab_utils.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; - -class TabWidget { +class TabWidget { static Widget tabWidget( - Size screenSize, - bool isActive, - String title, - { - int counter = -1, - bool isFirst = false, - bool isMiddle = false, - bool isLast = false, - context, - }) { + Size screenSize, + bool isActive, + String title, { + int counter = -1, + bool isFirst = false, + bool isMiddle = false, + bool isLast = false, + context, + }) { ProjectViewModel projectViewModel = Provider.of(context); return Center( child: Container( @@ -29,7 +27,6 @@ class TabWidget { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - TabUtils.getTabText(title: title, isActive: isActive), if (counter != -1) TabUtils.getTabCounter(isActive: isActive, counter: counter) diff --git a/lib/screens/procedures/update_procedure.dart b/lib/screens/procedures/update_procedure.dart index 52862163..5e6bc1c5 100644 --- a/lib/screens/procedures/update_procedure.dart +++ b/lib/screens/procedures/update_procedure.dart @@ -1,23 +1,20 @@ import 'package:doctor_app_flutter/config/config.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/ControlsModel.dart'; import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; -import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; -import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; -import 'package:doctor_app_flutter/widgets/bottom_sheet/bottom_sheet_container.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/text_fields/TextFields.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -103,11 +100,9 @@ class _UpdateProcedureWidgetState extends State { builder: (BuildContext context, ProcedureViewModel model, Widget child) => AppScaffold( - isShowAppBar: true, baseViewModel: model, - appBar: PatientSearchHeader( - title: "Update Procedure", - ), + isShowAppBar: true, + appBar: PatientSearchHeader(title: "Update Procedure"), body: SingleChildScrollView( child: Container( height: MediaQuery.of(context).size.height * 0.9, @@ -181,10 +176,10 @@ class _UpdateProcedureWidgetState extends State { bottomSheet: CustomBottomSheetContainer( label: TranslationBase.of(context).updateProcedure.toUpperCase(), onTap: () => updateProcedure( - limetNO: widget.limetNo, + lineItemNo: widget.limetNo, orderNo: widget.orderNo, orderType: selectedType.toString(), - categorieId: widget.categoryId, + categoryId: widget.categoryId, procedureId: widget.procedureId, entityList: entityList, patient: widget.patient, @@ -199,15 +194,15 @@ class _UpdateProcedureWidgetState extends State { updateProcedure( {ProcedureViewModel model, String remarks, - int limetNO, + int lineItemNo, int orderNo, String newProcedureId, - String newCategorieId, + String newCategoryId, List entityList, String orderType, String procedureId, PatiantInformtion patient, - String categorieId}) async { + String categoryId}) async { UpdateProcedureRequestModel updateProcedureReqModel = new UpdateProcedureRequestModel(); List controls = List(); @@ -217,7 +212,7 @@ class _UpdateProcedureWidgetState extends State { updateProcedureReqModel.episodeID = patient.episodeNo; updateProcedureReqModel.patientMRN = patient.patientMRN; - updateProcedureReqModel.lineItemNo = limetNO; + updateProcedureReqModel.lineItemNo = lineItemNo; updateProcedureReqModel.orderNo = orderNo; { @@ -230,22 +225,23 @@ class _UpdateProcedureWidgetState extends State { ); controlsProcedure.procedure = procedureId; - controlsProcedure.category = '0' + categorieId; + controlsProcedure.category = '0' + categoryId; controlsProcedure.controls = controls; } updateProcedureReqModel.procedureDetail = controlsProcedure; - + GifLoaderDialogUtils.showMyDialog(context); await model.updateProcedure( updateProcedureRequestModel: updateProcedureReqModel, mrn: patient.patientMRN); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); - model.getProcedure(mrn: patient.patientMRN); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been updated'); - model.getProcedure(mrn: patient.patientMRN); + await model.getProcedure(mrn: patient.patientMRN, isLocalBusy: true); } + + GifLoaderDialogUtils.hideDialog(context); } } From 5422472ccc34e32e6a8c52919bdda0206c6b038b Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 19 Apr 2022 12:08:39 +0300 Subject: [PATCH 12/26] update procedure --- lib/core/viewModel/procedure_View_model.dart | 5 +- lib/screens/procedures/procedure_screen.dart | 5 +- lib/screens/procedures/update_procedure.dart | 206 +++++++++---------- 3 files changed, 110 insertions(+), 106 deletions(-) diff --git a/lib/core/viewModel/procedure_View_model.dart b/lib/core/viewModel/procedure_View_model.dart index d9e77686..76571092 100644 --- a/lib/core/viewModel/procedure_View_model.dart +++ b/lib/core/viewModel/procedure_View_model.dart @@ -222,9 +222,9 @@ class ProcedureViewModel extends BaseViewModel { Future updateProcedure( {UpdateProcedureRequestModel updateProcedureRequestModel, - int mrn}) async { + int mrn, bool isLocalBusy = false}) async { hasError = false; - //_insuranceCardService.clearInsuranceCard(); + if(isLocalBusy)setState(ViewState.BusyLocal); else setState(ViewState.Busy); await _procedureService.updateProcedure(updateProcedureRequestModel); if (_procedureService.hasError) { @@ -549,6 +549,7 @@ class ProcedureViewModel extends BaseViewModel { List masterList, List items) { List dummySearchList = List(); + if(masterList!= null) dummySearchList.addAll(masterList); if (query.isNotEmpty) { List dummyListData = List(); diff --git a/lib/screens/procedures/procedure_screen.dart b/lib/screens/procedures/procedure_screen.dart index 76947d00..23424463 100644 --- a/lib/screens/procedures/procedure_screen.dart +++ b/lib/screens/procedures/procedure_screen.dart @@ -123,9 +123,12 @@ class ProcedureScreen extends StatelessWidget { procedureId: model.procedureList[0] .entityList[index].procedureId, limetNo: model.procedureList[0] - .entityList[index].lineItemNo); + .entityList[index].lineItemNo, + + ); }, patient: patient, + doctorID: model?.doctorProfile?.doctorID, ); }), diff --git a/lib/screens/procedures/update_procedure.dart b/lib/screens/procedures/update_procedure.dart index 5e6bc1c5..1885582f 100644 --- a/lib/screens/procedures/update_procedure.dart +++ b/lib/screens/procedures/update_procedure.dart @@ -6,7 +6,7 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dar import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; @@ -38,18 +38,19 @@ void updateProcedureForm(context, remarks: remarks, remarksController: remarksController, patient: patient, - model: model, + previousModel: model, procedureId: procedureId, categoryId: categoreId, orderNo: orderNo, limetNo: limetNo, + selectedType: int.parse(orderType), ); }); } class UpdateProcedureWidget extends StatefulWidget { final PatiantInformtion patient; - final ProcedureViewModel model; + final ProcedureViewModel previousModel; final String procedureName; final String remarks; final TextEditingController remarksController; @@ -57,9 +58,11 @@ class UpdateProcedureWidget extends StatefulWidget { final String categoryId; final int orderNo; final int limetNo; + int selectedType; + UpdateProcedureWidget( - {this.model, + {this.previousModel, this.procedureName, this.remarks, this.remarksController, @@ -67,18 +70,17 @@ class UpdateProcedureWidget extends StatefulWidget { this.procedureId, this.categoryId, this.orderNo, - this.limetNo}); + this.limetNo, this.selectedType}); @override _UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState(); } class _UpdateProcedureWidgetState extends State { - int selectedType = 0; setSelectedType(int val) { setState(() { - selectedType = val; + widget.selectedType = val; }); } @@ -93,102 +95,99 @@ class _UpdateProcedureWidgetState extends State { /// TODO Roaa Add translation and make sure it working fine @override Widget build(BuildContext context) { - return StatefulBuilder(builder: - (BuildContext context, StateSetter setState /*You can rename this!*/) { - return BaseView( - onModelReady: (model) => model.getCategory(), - builder: - (BuildContext context, ProcedureViewModel model, Widget child) => - AppScaffold( - baseViewModel: model, - isShowAppBar: true, - appBar: PatientSearchHeader(title: "Update Procedure"), - body: SingleChildScrollView( - child: Container( - height: MediaQuery.of(context).size.height * 0.9, - child: Form( - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - widget.procedureName.toUpperCase(), - fontWeight: FontWeight.w700, - ), - SizedBox( - height: 30.0, - ), - Container( - child: Row( - children: [ - AppText(TranslationBase.of(context).orderType), - Radio( - activeColor: AppGlobal.appRedColor, - value: 0, - groupValue: selectedType, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text('routine'), - Radio( - activeColor: AppGlobal.appRedColor, - groupValue: selectedType, - value: 1, - onChanged: (value) { - setSelectedType(value); - }, - ), - Text(TranslationBase.of(context).urgent), - ], + return BaseView( + onModelReady: (model) => model.getCategory(), + builder: + (BuildContext context, ProcedureViewModel _model, Widget child) => + AppScaffold( + baseViewModel: widget.previousModel, + isShowAppBar: true, + appBar: BottomSheetTitle(title: "Update Procedure"), + body: SingleChildScrollView( + child: Container( + height: MediaQuery.of(context).size.height * 0.9, + child: Form( + child: Padding( + padding: + EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + Utils.convertToTitleCase(widget.procedureName), + fontWeight: FontWeight.w700, + ), + SizedBox( + height: 30.0, + ), + Container( + child: Row( + children: [ + AppText(TranslationBase.of(context).orderType), + Radio( + activeColor: AppGlobal.appRedColor, + value: 0, + groupValue: widget.selectedType, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text('routine'), + Radio( + activeColor: AppGlobal.appRedColor, + groupValue: widget.selectedType, + value: 1, + onChanged: (value) { + setSelectedType(value); + }, + ), + Text(TranslationBase.of(context).urgent), + ], + ), + ), + SizedBox( + height: 12.0, + ), + Container( + decoration: BoxDecoration( + borderRadius: + BorderRadius.all(Radius.circular(6.0)), + border: Border.all( + width: 1.0, color: HexColor("#CCCCCC"))), + child: TextFields( + fontSize: 15.0, + controller: widget.remarksController, + hintText: widget.remarksController.text.isEmpty + ? 'No Remarks Added' + : '', + maxLines: 3, + minLines: 2, + onChanged: (value) {}, + ), ), - ), - SizedBox( - height: 12.0, - ), - Container( - decoration: BoxDecoration( - borderRadius: - BorderRadius.all(Radius.circular(6.0)), - border: Border.all( - width: 1.0, color: HexColor("#CCCCCC"))), - child: TextFields( - fontSize: 15.0, - controller: widget.remarksController, - hintText: widget.remarksController.text.isEmpty - ? 'No Remarks Added' - : '', - maxLines: 3, - minLines: 2, - onChanged: (value) {}, + SizedBox( + height: 70.0, ), - ), - SizedBox( - height: 70.0, - ), - ], + ], + ), ), - ), - )), + )), + ), + bottomSheet: CustomBottomSheetContainer( + label: TranslationBase.of(context).updateProcedure, + onTap: () => updateProcedure( + lineItemNo: widget.limetNo, + orderNo: widget.orderNo, + orderType: widget.selectedType.toString(), + categoryId: widget.categoryId, + procedureId: widget.procedureId, + entityList: entityList, + patient: widget.patient, + model: widget.previousModel, + remarks: widget.remarksController.text), + ), ), - bottomSheet: CustomBottomSheetContainer( - label: TranslationBase.of(context).updateProcedure.toUpperCase(), - onTap: () => updateProcedure( - lineItemNo: widget.limetNo, - orderNo: widget.orderNo, - orderType: selectedType.toString(), - categoryId: widget.categoryId, - procedureId: widget.procedureId, - entityList: entityList, - patient: widget.patient, - model: widget.model, - remarks: widget.remarksController.text), - ), - ), - ); - }); + ); } updateProcedure( @@ -231,17 +230,18 @@ class _UpdateProcedureWidgetState extends State { } updateProcedureReqModel.procedureDetail = controlsProcedure; GifLoaderDialogUtils.showMyDialog(context); - await model.updateProcedure( + await widget.previousModel.updateProcedure( updateProcedureRequestModel: updateProcedureReqModel, - mrn: patient.patientMRN); + mrn: patient.patientMRN, isLocalBusy: true); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); } else if (model.state == ViewState.Idle) { DrAppToastMsg.showSuccesToast('procedure has been updated'); - await model.getProcedure(mrn: patient.patientMRN, isLocalBusy: true); - } + await widget.previousModel.getProcedure(mrn: patient.patientMRN, isLocalBusy: true); + Navigator.of(context).pop(); + } GifLoaderDialogUtils.hideDialog(context); } } From c30d6bebd86323c9b3eaa236611939373f2abdc1 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 24 Apr 2022 13:50:35 +0300 Subject: [PATCH 13/26] session management update --- lib/client/base_app_client.dart | 12 ++++++++---- lib/config/config.dart | 2 +- lib/core/service/authentication_service.dart | 1 - lib/core/viewModel/authentication_view_model.dart | 12 ++++++------ lib/core/viewModel/dashboard_view_model.dart | 3 ++- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 8cd2692e..4b5b5ccf 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -40,11 +40,17 @@ class BaseAppClient { try { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); + // String doctorID = await sharedPref.getString(DOCTOR_ID); + // if(doctorID != null) + // body['DoctorID'] = int.parse(doctorID); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - if (body['DoctorID'] == null) + if (body['DoctorID'] == null) { body['DoctorID'] = doctorProfile?.doctorID; - if (body['DoctorID'] == "") body['DoctorID'] = null; + + } + if (body['DoctorID'] == "") + body['DoctorID'] = null; if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { @@ -63,7 +69,6 @@ class BaseAppClient { if (body['TokenID'] == null) { body['TokenID'] = token ?? ''; } - // body['TokenID'] = "@dm!n" ?? ''; if (!isFallLanguage) { String lang = await sharedPref.getString(APP_Language); @@ -73,7 +78,6 @@ class BaseAppClient { body['LanguageID'] = 2; } body['stamp'] = DateTime.now().toIso8601String(); - // if(!body.containsKey("IPAdress")) body['IPAdress'] = IP_ADDRESS; if (body['VersionID'] == null) { body['VersionID'] = VERSION_ID; diff --git a/lib/config/config.dart b/lib/config/config.dart index 12ec7ca7..7864a598 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -434,7 +434,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 6.7; +const VERSION_ID = 8.3; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index 4de0a7e4..6b5510a9 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -142,7 +142,6 @@ class AuthenticationService extends BaseService { Future insertDeviceImei(InsertIMEIDetailsModel insertIMEIDetailsModel) async { hasError = false; - // insertIMEIDetailsModel.tokenID = "@dm!n"; _insertDeviceImeiRes = {}; try { await baseAppClient.post(INSERT_DEVICE_IMEI, diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 3dde37c7..af0c0cb3 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -102,9 +102,9 @@ class AuthenticationViewModel extends BaseViewModel { insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN']; insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); - insertIMEIDetailsModel.doctorID = loggedIn != null - ? loggedIn['List_MemberInformation'][0]['MemberID'] - : user.doctorID; + // insertIMEIDetailsModel.doctorID = loggedIn != null + // ? loggedIn['List_MemberInformation'][0]['MemberID'] + // : user.doctorID; insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; insertIMEIDetailsModel.vidaAuthTokenID = @@ -174,6 +174,7 @@ class AuthenticationViewModel extends BaseViewModel { loginDoctorID: loggedUser.listMemberInformation[0].employeeID, otpSendType: authMethodType.getTypeIdService().toString(), ); + await sharedPref.setString(DOCTOR_ID, (loggedUser.listMemberInformation[0].employeeID).toString()); await _authService.sendActivationCodeForDoctorApp(activationCodeModel); if (_authService.hasError) { error = _authService.error; @@ -189,6 +190,7 @@ class AuthenticationViewModel extends BaseViewModel { Future checkActivationCodeForDoctorApp( {String activationCode, bool isSilentLogin = false}) async { setState(ViewState.BusyLocal); + CheckActivationCodeRequestModel checkActivationCodeForDoctorApp = new CheckActivationCodeRequestModel( zipCode: loggedUser != null ? loggedUser.zipCode : user.zipCode, @@ -208,9 +210,7 @@ class AuthenticationViewModel extends BaseViewModel { : user.projectID.toString(), oTPSendType: await sharedPref.getInt(OTP_TYPE), iMEI: localToken, - loginDoctorID: userInfo.userID != null - ? int.parse(userInfo.userID) - : user.editedBy, + loginDoctorID: loggedUser.listMemberInformation[0].employeeID, // loggedUser.listMemberInformation[0].employeeID, isForSilentLogin: isSilentLogin, generalid: "Cs2020@2016\$2958"); diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 0343eaa4..82de3ca3 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -59,7 +59,8 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { // DEVICE_TOKEN = token; - authProvider.insertDeviceImei(token); + ///TODO Elham* return back + // authProvider.insertDeviceImei(token); } }); } From 8069e89a61e8d0c5e500c599e9901f9302d9fa43 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 25 Apr 2022 11:58:37 +0300 Subject: [PATCH 14/26] session management update --- lib/client/base_app_client.dart | 17 ++++++++--------- lib/core/viewModel/dashboard_view_model.dart | 3 +-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 4b5b5ccf..5ccacfc1 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -40,17 +40,13 @@ class BaseAppClient { try { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); - // String doctorID = await sharedPref.getString(DOCTOR_ID); - // if(doctorID != null) - // body['DoctorID'] = int.parse(doctorID); + if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body['DoctorID'] == null) { body['DoctorID'] = doctorProfile?.doctorID; - } - if (body['DoctorID'] == "") - body['DoctorID'] = null; + if (body['DoctorID'] == "") body['DoctorID'] = null; if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile?.doctorID; if (body['ProjectID'] == null) { @@ -59,10 +55,13 @@ class BaseAppClient { if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile?.clinicID; + } else { + String doctorID = await sharedPref.getString(DOCTOR_ID); + if (body['DoctorID'] == '') { + body['DoctorID'] = null; + } else if (doctorID != null) body['DoctorID'] = int.parse(doctorID); } - if (body['DoctorID'] == '') { - body['DoctorID'] = null; - } + if (body['EditedBy'] == '') { body.remove("EditedBy"); } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 82de3ca3..0343eaa4 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -59,8 +59,7 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { // DEVICE_TOKEN = token; - ///TODO Elham* return back - // authProvider.insertDeviceImei(token); + authProvider.insertDeviceImei(token); } }); } From 46760ffc778073a5380c2cf8297c93c2389c81c2 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Apr 2022 10:38:27 +0300 Subject: [PATCH 15/26] session management update --- lib/core/model/auth/insert_imei_model.dart | 8 ++++++-- lib/core/viewModel/authentication_view_model.dart | 13 ++++++++----- lib/core/viewModel/dashboard_view_model.dart | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/core/model/auth/insert_imei_model.dart b/lib/core/model/auth/insert_imei_model.dart index e779da77..dfc15bd9 100644 --- a/lib/core/model/auth/insert_imei_model.dart +++ b/lib/core/model/auth/insert_imei_model.dart @@ -32,6 +32,8 @@ class InsertIMEIDetailsModel { String vidaAuthTokenID; String vidaRefreshTokenID; dynamic password; + int loginDoctorID; + InsertIMEIDetailsModel( {this.iMEI, @@ -66,7 +68,7 @@ class InsertIMEIDetailsModel { this.patientOutSA, this.vidaAuthTokenID, this.vidaRefreshTokenID, - this.password}); + this.password, this.loginDoctorID}); InsertIMEIDetailsModel.fromJson(Map json) { iMEI = json['IMEI']; @@ -102,7 +104,7 @@ class InsertIMEIDetailsModel { vidaAuthTokenID = json['VidaAuthTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID']; password = json['Password']; - } + loginDoctorID = json['LoginDoctorID']; } Map toJson() { final Map data = new Map(); @@ -139,6 +141,8 @@ class InsertIMEIDetailsModel { data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['VidaRefreshTokenID'] = this.vidaRefreshTokenID; data['Password'] = this.password; + data['LoginDoctorID'] = this.loginDoctorID; + return data; } } diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index af0c0cb3..da166bd6 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -102,9 +102,9 @@ class AuthenticationViewModel extends BaseViewModel { insertIMEIDetailsModel.titleDescriptionN = profileInfo['Title_DescriptionN']; insertIMEIDetailsModel.projectID = await sharedPref.getInt(PROJECT_ID); - // insertIMEIDetailsModel.doctorID = loggedIn != null - // ? loggedIn['List_MemberInformation'][0]['MemberID'] - // : user.doctorID; + insertIMEIDetailsModel.doctorID = loggedIn != null + ? loggedIn['List_MemberInformation'][0]['MemberID'] + : user.doctorID; insertIMEIDetailsModel.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA; insertIMEIDetailsModel.vidaAuthTokenID = @@ -112,6 +112,7 @@ class AuthenticationViewModel extends BaseViewModel { insertIMEIDetailsModel.vidaRefreshTokenID = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); insertIMEIDetailsModel.password = userInfo.password; + insertIMEIDetailsModel.loginDoctorID = loggedUser.listMemberInformation[0].employeeID; await _authService.insertDeviceImei(insertIMEIDetailsModel); if (_authService.hasError) { @@ -147,7 +148,8 @@ class AuthenticationViewModel extends BaseViewModel { iMEI: user.iMEI, facilityId: user.projectID, memberID: user.doctorID, - loginDoctorID: int.parse(user.editedBy.toString()), + //TODO Elham* return it dynamic + loginDoctorID: 4709,//int.parse(user.editedBy.toString()), zipCode: user.outSA == true ? '971' : '966', mobileNumber: user.mobile, oTPSendType: authMethodType.getTypeIdService(), @@ -210,7 +212,8 @@ class AuthenticationViewModel extends BaseViewModel { : user.projectID.toString(), oTPSendType: await sharedPref.getInt(OTP_TYPE), iMEI: localToken, - loginDoctorID: loggedUser.listMemberInformation[0].employeeID, + loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation[0].employeeID + : int.parse(user.editedBy),///loggedUser.listMemberInformation[0].employeeID, // loggedUser.listMemberInformation[0].employeeID, isForSilentLogin: isSilentLogin, generalid: "Cs2020@2016\$2958"); diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 0343eaa4..82de3ca3 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -59,7 +59,8 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { // DEVICE_TOKEN = token; - authProvider.insertDeviceImei(token); + ///TODO Elham* return back + // authProvider.insertDeviceImei(token); } }); } From d4f01c19f7f31bf9812c6a409f8057a590cd47c2 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Apr 2022 11:03:29 +0300 Subject: [PATCH 16/26] session management update --- lib/client/base_app_client.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 5ccacfc1..94e7ca41 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -176,6 +176,14 @@ class BaseAppClient { }; String token = await sharedPref.getString(TOKEN); + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + + if (profile != null) { + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + if (body['DoctorID'] == null) { + body['DoctorID'] = doctorProfile?.doctorID; + } + } var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); body['SetupID'] = body.containsKey('SetupID') From d717d9e0cf9e4e4642849529d693cd1bf2cbd582 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Apr 2022 13:21:08 +0300 Subject: [PATCH 17/26] fix in patient_service --- .../PatientSearchRequestModel.dart | 6 +++- lib/core/service/home/scan_qr_service.dart | 2 +- .../patient/patientInPatientService.dart | 2 +- lib/core/service/patient/patient_service.dart | 3 +- .../viewModel/PatientSearchViewModel.dart | 1 + .../viewModel/authentication_view_model.dart | 10 +++--- lib/core/viewModel/dashboard_view_model.dart | 3 +- lib/screens/qr_reader/QR_reader_screen.dart | 34 ++++++++++++++++++- 8 files changed, 50 insertions(+), 11 deletions(-) diff --git a/lib/core/model/patient_muse/PatientSearchRequestModel.dart b/lib/core/model/patient_muse/PatientSearchRequestModel.dart index dcb9b31c..8241f00d 100644 --- a/lib/core/model/patient_muse/PatientSearchRequestModel.dart +++ b/lib/core/model/patient_muse/PatientSearchRequestModel.dart @@ -14,6 +14,8 @@ class PatientSearchRequestModel { String identificationNo; int nursingStationID; int clinicID = 0; + int loginDoctorID; + PatientSearchRequestModel( {this.doctorID, @@ -30,7 +32,7 @@ class PatientSearchRequestModel { this.to = "0", this.clinicID, this.nursingStationID = 0, - this.projectID}); + this.projectID, this.loginDoctorID}); PatientSearchRequestModel.fromJson(Map json) { doctorID = json['DoctorID']; @@ -48,6 +50,7 @@ class PatientSearchRequestModel { nursingStationID = json['NursingStationID']; clinicID = json['ClinicID']; projectID = json['ProjectID']; + loginDoctorID = json['LoginDoctorID']; } Map toJson() { @@ -67,6 +70,7 @@ class PatientSearchRequestModel { data['NursingStationID'] = this.nursingStationID; data['ClinicID'] = this.clinicID; data['ProjectID'] = this.projectID; + data['LoginDoctorID'] = this.loginDoctorID; return data; } } diff --git a/lib/core/service/home/scan_qr_service.dart b/lib/core/service/home/scan_qr_service.dart index 64c02869..c00abd97 100644 --- a/lib/core/service/home/scan_qr_service.dart +++ b/lib/core/service/home/scan_qr_service.dart @@ -11,8 +11,8 @@ class ScanQrService extends BaseService { PatientSearchRequestModel requestModel, bool isMyInpatient) async { hasError = false; await getDoctorProfile(); + requestModel.loginDoctorID = doctorProfile.doctorID; requestModel.doctorID = 0; - await baseAppClient.post( GET_PATIENT_IN_PATIENT_LIST, onSuccess: (dynamic response, int statusCode) { diff --git a/lib/core/service/patient/patientInPatientService.dart b/lib/core/service/patient/patientInPatientService.dart index 86e7d236..9aabbdee 100644 --- a/lib/core/service/patient/patientInPatientService.dart +++ b/lib/core/service/patient/patientInPatientService.dart @@ -11,7 +11,7 @@ class PatientInPatientService extends BaseService { PatientSearchRequestModel requestModel, bool isMyInpatient) async { hasError = false; await getDoctorProfile(isGetProfile: true); - + requestModel.loginDoctorID = doctorProfile.doctorID; if (isMyInpatient) { requestModel.doctorID = doctorProfile.doctorID; } else { diff --git a/lib/core/service/patient/patient_service.dart b/lib/core/service/patient/patient_service.dart index 7db9fd1b..a8eab765 100644 --- a/lib/core/service/patient/patient_service.dart +++ b/lib/core/service/patient/patient_service.dart @@ -168,8 +168,9 @@ class PatientService extends BaseService { Future getInPatient( PatientSearchRequestModel requestModel, bool isMyInpatient) async { hasError = false; - await getDoctorProfile(); + await getDoctorProfile(); + requestModel.loginDoctorID = doctorProfile.doctorID; if (isMyInpatient) { requestModel.doctorID = doctorProfile.doctorID; } else { diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 0c63c11c..72eb876a 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -70,6 +70,7 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Busy); } await getDoctorProfile(isGetProfile: true); + patientSearchRequestModel.loginDoctorID = doctorProfile.doctorID; patientSearchRequestModel.doctorID = doctorProfile.doctorID; await _outPatientService.getOutPatient(patientSearchRequestModel); if (_outPatientService.hasError) { diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index da166bd6..5d4b4479 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -112,7 +112,8 @@ class AuthenticationViewModel extends BaseViewModel { insertIMEIDetailsModel.vidaRefreshTokenID = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); insertIMEIDetailsModel.password = userInfo.password; - insertIMEIDetailsModel.loginDoctorID = loggedUser.listMemberInformation[0].employeeID; + insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser.listMemberInformation[0].employeeID + : int.parse(user.editedBy); await _authService.insertDeviceImei(insertIMEIDetailsModel); if (_authService.hasError) { @@ -148,14 +149,15 @@ class AuthenticationViewModel extends BaseViewModel { iMEI: user.iMEI, facilityId: user.projectID, memberID: user.doctorID, - //TODO Elham* return it dynamic - loginDoctorID: 4709,//int.parse(user.editedBy.toString()), + loginDoctorID: int.parse(user.editedBy.toString()), zipCode: user.outSA == true ? '971' : '966', mobileNumber: user.mobile, oTPSendType: authMethodType.getTypeIdService(), isMobileFingerPrint: 1, vidaAuthTokenID: user.vidaAuthTokenID, vidaRefreshTokenID: user.vidaRefreshTokenID); + await sharedPref.setString(DOCTOR_ID, user.editedBy.toString()); + await _authService .sendActivationCodeVerificationScreen(activationCodeModel); if (_authService.hasError) { @@ -213,7 +215,7 @@ class AuthenticationViewModel extends BaseViewModel { oTPSendType: await sharedPref.getInt(OTP_TYPE), iMEI: localToken, loginDoctorID: loggedUser != null ? loggedUser.listMemberInformation[0].employeeID - : int.parse(user.editedBy),///loggedUser.listMemberInformation[0].employeeID, + : int.parse(user.editedBy.toString()),///loggedUser.listMemberInformation[0].employeeID, // loggedUser.listMemberInformation[0].employeeID, isForSilentLogin: isSilentLogin, generalid: "Cs2020@2016\$2958"); diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 82de3ca3..0343eaa4 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -59,8 +59,7 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { // DEVICE_TOKEN = token; - ///TODO Elham* return back - // authProvider.insertDeviceImei(token); + authProvider.insertDeviceImei(token); } }); } diff --git a/lib/screens/qr_reader/QR_reader_screen.dart b/lib/screens/qr_reader/QR_reader_screen.dart index e5443b04..d1fc601a 100644 --- a/lib/screens/qr_reader/QR_reader_screen.dart +++ b/lib/screens/qr_reader/QR_reader_screen.dart @@ -1,6 +1,8 @@ import 'package:barcode_scan2/barcode_scan2.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; @@ -86,7 +88,8 @@ class _QrReaderScreenState extends State { _scanQrAndGetPatient(BuildContext context, ScanQrViewModel model) async { var result = (await BarcodeScanner.scan()).rawContent; if (result != "") { - List listOfParams = result.split(','); + DoctorProfileModel doctorProfile =await getDoctorProfile(isGetProfile: true); + List listOfParams = result.split(','); int patientID = 0; if (listOfParams[1].length != 0) patientID = int.parse(listOfParams[1]); PatientSearchRequestModel patientSearchRequestModel = @@ -96,6 +99,8 @@ class _QrReaderScreenState extends State { doctorID: 0, projectID: int.parse(listOfParams[0])); + patientSearchRequestModel.loginDoctorID = doctorProfile.doctorID; + await model .getInPatientList(patientSearchRequestModel, isMyInpatient: false) .then((d) { @@ -115,4 +120,31 @@ class _QrReaderScreenState extends State { }); } } + + Future getDoctorProfile( + {bool isGetProfile = false}) async { + + DoctorProfileModel doctorProfile; + if (isGetProfile) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + if (doctorProfile != null) { + return doctorProfile; + } + } + } + if (doctorProfile == null) { + Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + if (profile != null) { + doctorProfile = DoctorProfileModel.fromJson(profile); + if (doctorProfile != null) { + return doctorProfile; + } + } + return null; + } else { + return doctorProfile; + } + } } From 986af6ba9cbd4a4e0257d7a7f9ec1c89fdc5ba09 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Tue, 26 Apr 2022 14:13:17 +0300 Subject: [PATCH 18/26] fix issue --- lib/core/viewModel/authentication_view_model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 5d4b4479..9f0b28e5 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -113,7 +113,7 @@ class AuthenticationViewModel extends BaseViewModel { await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); insertIMEIDetailsModel.password = userInfo.password; insertIMEIDetailsModel.loginDoctorID = loggedUser != null ? loggedUser.listMemberInformation[0].employeeID - : int.parse(user.editedBy); + : int.parse(user.editedBy.toString()); await _authService.insertDeviceImei(insertIMEIDetailsModel); if (_authService.hasError) { From 17f32c4dc8be36cd40eb31748de7fd71bf0eaadb Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 27 Apr 2022 12:53:37 +0300 Subject: [PATCH 19/26] fixes on procedure --- lib/config/localized_values.dart | 2 +- lib/core/viewModel/dashboard_view_model.dart | 3 ++- .../patients/profile/radiology/radiology_home_page.dart | 1 + lib/screens/procedures/add_procedure_page.dart | 2 +- .../procedures/entity_list_checkbox_search_widget.dart | 3 ++- .../favorite_procedure/add_favourite_procedure.dart | 4 ++-- .../favorite_procedure/procedure_checkout_screen.dart | 1 + lib/utils/translations_delegate_base_utils.dart | 2 +- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 4225ed6e..116cab42 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1129,7 +1129,7 @@ const Map> localizedValues = { "VTE_Type": {"en": "VTE Type", "ar": "VTE Type"}, "pharmacology": {"en": "Pharmacology", "ar": "علم العقاقير"}, "reasonsThrombo": {"en": "Reasons Thrombo", "ar": "أسباب ثرومبو"}, - "youDoNotHaveFavoritePrescription": {"en": "You Don't Have Favorite Prescription", "ar": "ليس لديك وصفة طبية مفضلة"}, + "youDoNotHaveFavoriteTemplate": {"en": "You Don't Have Favorite Template", "ar": "ليس لديك وصفة طبية مفضلة"}, "pleaseSelectItem": {"en": "please Select Item", "ar": "الرجاء اختيار عنصر"}, "searchFavoriteTemplate": {"en": "search Favorites Template", "ar": "البحث في قالب المفضلة"}, "sorryNoMatch": {"en": "Sorry No Match", "ar": "عذرا لا يوجد تطابق"}, diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 0343eaa4..9ae198f3 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -59,7 +59,8 @@ class DashboardViewModel extends BaseViewModel { _firebaseMessaging.getToken().then((String token) async { if (token != '') { // DEVICE_TOKEN = token; - authProvider.insertDeviceImei(token); + ///TODO Elham* return it back + // authProvider.insertDeviceImei(token); } }); } diff --git a/lib/screens/patients/profile/radiology/radiology_home_page.dart b/lib/screens/patients/profile/radiology/radiology_home_page.dart index 5978dcf7..12b54a3c 100644 --- a/lib/screens/patients/profile/radiology/radiology_home_page.dart +++ b/lib/screens/patients/profile/radiology/radiology_home_page.dart @@ -96,6 +96,7 @@ class _RadiologyHomePageState extends State { }, label: TranslationBase.of(context).applyForRadiologyOrder, ), + ///TODO Elham * fix this to be list view builder ...List.generate( model.radiologyList.length, (index) => Container( diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index a82eaafa..83f4f6c6 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -185,7 +185,7 @@ class _AddProcedurePageState extends State { ], ), ), - bottomSheet: model.state == ViewState.BusyLocal + bottomSheet: model.state == ViewState.BusyLocal || entityList.isEmpty ? Container( height: 0, ) diff --git a/lib/screens/procedures/entity_list_checkbox_search_widget.dart b/lib/screens/procedures/entity_list_checkbox_search_widget.dart index b5a798fe..3a3f6b09 100644 --- a/lib/screens/procedures/entity_list_checkbox_search_widget.dart +++ b/lib/screens/procedures/entity_list_checkbox_search_widget.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart'; import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; @@ -117,7 +118,7 @@ class _EntityListCheckboxSearchWidgetState padding: const EdgeInsets.symmetric( horizontal: 10, vertical: 0), child: AppText( - historyInfo.procedureName, + Utils.convertToTitleCase( historyInfo.procedureName), fontSize: 14.0, variant: "bodyText", bold: true, diff --git a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart index ad689e93..f69f2c35 100644 --- a/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart +++ b/lib/screens/procedures/favorite_procedure/add_favourite_procedure.dart @@ -78,10 +78,10 @@ class _AddFavouriteProcedureState extends State { ) : ErrorMessage( error: TranslationBase.of(context) - .youDoNotHaveFavoritePrescription, + .youDoNotHaveFavoriteTemplate, ), ]), - bottomSheet: CustomBottomSheetContainer( + bottomSheet: widget.previousProcedureViewModel.templateList.length == 0?Container(height: 0,):CustomBottomSheetContainer( label: widget.procedureType.getAddButtonTitle(context) ?? TranslationBase.of(context).addSelectedProcedures, onTap: () async { diff --git a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart index fa1f880d..4f85827d 100644 --- a/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart +++ b/lib/screens/procedures/favorite_procedure/procedure_checkout_screen.dart @@ -190,6 +190,7 @@ class _ProcedureCheckOutScreenState extends State { ), ), ), + ///TODO Elham* use our custom bottomsheet bottomSheet: Container( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), child: Wrap( diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index e433df63..3ffef41d 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -1698,7 +1698,7 @@ class TranslationBase { String get reasonsThrombo => localizedValues['reasonsThrombo'][locale.languageCode]; - String get youDoNotHaveFavoritePrescription => localizedValues['youDoNotHaveFavoritePrescription'][locale.languageCode]; + String get youDoNotHaveFavoriteTemplate => localizedValues['youDoNotHaveFavoriteTemplate'][locale.languageCode]; String get pleaseSelectItem => localizedValues['pleaseSelectItem'][locale.languageCode]; From 5f7b52a5299b865fff0cb89044ed2e2212586e05 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 27 Apr 2022 13:06:47 +0300 Subject: [PATCH 20/26] fix issue --- lib/screens/procedures/add_procedure_page.dart | 2 +- lib/screens/procedures/base_add_procedure_tab_page.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 83f4f6c6..81640802 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -203,7 +203,7 @@ class _AddProcedurePageState extends State { return; } GifLoaderDialogUtils.showMyDialog(context); - await model.preparePostProcedure( + await widget.model.preparePostProcedure( orderType: selectedType.toString(), entityList: entityList, patient: patient, diff --git a/lib/screens/procedures/base_add_procedure_tab_page.dart b/lib/screens/procedures/base_add_procedure_tab_page.dart index ef36fb97..2b730381 100644 --- a/lib/screens/procedures/base_add_procedure_tab_page.dart +++ b/lib/screens/procedures/base_add_procedure_tab_page.dart @@ -127,7 +127,7 @@ class _BaseAddProcedureTabPageState extends State ) else AddProcedurePage( - model: widget.previousProcedureViewModel, + model: widget.previousProcedureViewModel?? model, patient: patient, procedureType: procedureType, ), From 8b79b0041cc7216ba903638b7875c6c3cbbbb9cd Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 27 Apr 2022 13:43:38 +0300 Subject: [PATCH 21/26] design issue --- .../procedures/add_procedure_page.dart | 219 +++++++++--------- 1 file changed, 112 insertions(+), 107 deletions(-) diff --git a/lib/screens/procedures/add_procedure_page.dart b/lib/screens/procedures/add_procedure_page.dart index 81640802..bedfea99 100644 --- a/lib/screens/procedures/add_procedure_page.dart +++ b/lib/screens/procedures/add_procedure_page.dart @@ -65,124 +65,129 @@ class _AddProcedurePageState extends State { AppScaffold( isShowAppBar: false, body: SingleChildScrollView( - child: Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.070, - ), - NetworkBaseView( - baseViewModel: model, - child: Container( - child: Padding( - padding: EdgeInsets.all(12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (procedureType == ProcedureType.PROCEDURE) - Column( - children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context) - .pleaseEnterProcedure, - fontWeight: FontWeight.w700, - fontSize: 20, - ), - ], - ), - SizedBox( - height: - MediaQuery.of(context).size.height * 0.02, - ), - Row( + child: FractionallySizedBox( + widthFactor: .97, + child: Center( + child: Column( + children: [ + Container( + height: MediaQuery.of(context).size.height * 0.070, + ), + NetworkBaseView( + baseViewModel: model, + child: Container( + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (procedureType == ProcedureType.PROCEDURE) + Column( children: [ - Container( - width: MediaQuery.of(context).size.width * - 0.79, - child: AppTextFieldCustom( - hintText: TranslationBase.of(context) - .searchProcedureHere, - isTextFieldHasSuffix: false, - maxLines: 1, - minLines: 1, - hasBorder: true, - controller: procedureName, - ), + Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + AppText( + TranslationBase.of(context) + .pleaseEnterProcedure, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ], ), SizedBox( - width: MediaQuery.of(context).size.width * - 0.02, + height: + MediaQuery.of(context).size.height * 0.02, ), - Expanded( - child: InkWell( - onTap: () async { - if (procedureName.text.isNotEmpty && - procedureName.text.length >= 3) { - GifLoaderDialogUtils.showMyDialog( - context); - await model.getProcedureCategory( - patientId: patient.patientId, - categoryName: procedureName.text, - isLocalBusy: true); - if (model.state == - ViewState.ErrorLocal) { - DrAppToastMsg.showErrorToast( - model.error); - } - GifLoaderDialogUtils.hideDialog( - context); - } else { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context) - .atLeastThreeCharacters, - ); - } - }, - child: Icon( - Icons.search, - size: 25.0, + Row( + children: [ + Container( + width: MediaQuery.of(context).size.width * + 0.79, + child: AppTextFieldCustom( + hintText: TranslationBase.of(context) + .searchProcedureHere, + isTextFieldHasSuffix: false, + maxLines: 1, + minLines: 1, + hasBorder: true, + controller: procedureName, + ), + ), + SizedBox( + width: MediaQuery.of(context).size.width * + 0.02, + ), + Expanded( + child: InkWell( + onTap: () async { + if (procedureName.text.isNotEmpty && + procedureName.text.length >= 3) { + GifLoaderDialogUtils.showMyDialog( + context); + await model.getProcedureCategory( + patientId: patient.patientId, + categoryName: procedureName.text, + isLocalBusy: true); + if (model.state == + ViewState.ErrorLocal) { + DrAppToastMsg.showErrorToast( + model.error); + } + GifLoaderDialogUtils.hideDialog( + context); + } else { + DrAppToastMsg.showErrorToast( + TranslationBase.of(context) + .atLeastThreeCharacters, + ); + } + }, + child: Icon( + Icons.search, + size: 25.0, + ), + ), ), - ), + ], ), ], ), - ], - ), - if ((procedureType == ProcedureType.PROCEDURE - ? procedureName.text.isNotEmpty - : true) && - model.categoriesList.length != 0) - NetworkBaseView( - baseViewModel: model, - child: EntityListCheckboxSearchWidget( - model: widget.model, - masterList: model.categoriesList[0].entityList, - removeProcedure: (item) { - setState(() { - entityList.remove(item); - }); - }, - addProcedure: (history) { - setState(() { - entityList.add(history); - }); - }, - addSelectedHistories: () {}, - isEntityListSelected: (master) => widget.model - .isEntityListSelected(master, entityList), - )), - SizedBox( - height: 10, - ) - ], + if ((procedureType == ProcedureType.PROCEDURE + ? procedureName.text.isNotEmpty + : true) && + model.categoriesList.length != 0) + NetworkBaseView( + baseViewModel: model, + child: EntityListCheckboxSearchWidget( + model: widget.model, + masterList: model.categoriesList[0].entityList, + removeProcedure: (item) { + setState(() { + entityList.remove(item); + }); + }, + addProcedure: (history) { + setState(() { + entityList.add(history); + }); + }, + addSelectedHistories: () {}, + isEntityListSelected: (master) => widget.model + .isEntityListSelected(master, entityList), + )), + SizedBox( + height: 10, + ) + ], + ), + ), ), ), - ), + ], ), - ], + ), ), ), bottomSheet: model.state == ViewState.BusyLocal || entityList.isEmpty From f2bb245c25b5292094e3898b8026aa9bc2cbdc82 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Wed, 27 Apr 2022 15:05:17 +0300 Subject: [PATCH 22/26] return insert back --- lib/core/viewModel/dashboard_view_model.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 9ae198f3..7b1529fd 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -60,7 +60,7 @@ class DashboardViewModel extends BaseViewModel { if (token != '') { // DEVICE_TOKEN = token; ///TODO Elham* return it back - // authProvider.insertDeviceImei(token); + authProvider.insertDeviceImei(token); } }); } From 092cfbc891c8da8d415f01099f08faf5ad431246 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 28 Apr 2022 11:24:03 +0300 Subject: [PATCH 23/26] fix some issue in prescription --- lib/client/base_app_client.dart | 2 +- .../medical_report/PatientMedicalReportService.dart | 5 ----- .../prescription/prescription_service.dart | 1 - .../prescriptions_items/prescription_items_out_patient.dart | 1 + 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 94e7ca41..0218507f 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -231,7 +231,7 @@ class BaseAppClient { : PATIENT_TYPE_ID : PATIENT_TYPE_ID; - body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] : token; + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID']??token : token; body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN; diff --git a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart index f36959f1..b3bdd149 100644 --- a/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart +++ b/lib/core/service/patient_medical_file/medical_report/PatientMedicalReportService.dart @@ -33,7 +33,6 @@ class PatientMedicalReportService extends BaseService { Future getMedicalReportTemplate() async { hasError = false; Map body = Map(); - body['TokenID'] = "@dm!n"; body['SetupID'] = "91877"; body['TemplateID'] = 43; @@ -54,7 +53,6 @@ class PatientMedicalReportService extends BaseService { Future insertMedicalReport(PatiantInformtion patient, String htmlText) async { hasError = false; Map body = Map(); - // body['TokenID'] = "@dm!n"; body['SetupID'] = "91877"; body['AdmissionNo'] = patient.admissionNo; body['MedicalReportHTML'] = htmlText; @@ -71,7 +69,6 @@ class PatientMedicalReportService extends BaseService { PatiantInformtion patient, MedicalReportModel medicalReport) async { hasError = false; Map body = Map(); - body['TokenID'] = "@dm!n"; body['SetupID'] = "91877"; body['AdmissionNo'] = patient.admissionNo; body['InvoiceNo'] = medicalReport.invoiceNo; @@ -92,7 +89,6 @@ class PatientMedicalReportService extends BaseService { Future addMedicalReport(PatiantInformtion patient, String htmlText) async { hasError = false; Map body = Map(); - // body['TokenID'] = "@dm!n"; body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null ? body['SetupID'] @@ -117,7 +113,6 @@ class PatientMedicalReportService extends BaseService { int limitNumber, String invoiceNumber) async { hasError = false; Map body = Map(); - // body['TokenID'] = "@dm!n"; body['LineItemNo'] = limitNumber; body['InvoiceNo'] = invoiceNumber; diff --git a/lib/core/service/patient_medical_file/prescription/prescription_service.dart b/lib/core/service/patient_medical_file/prescription/prescription_service.dart index 1b084ada..bda8907d 100644 --- a/lib/core/service/patient_medical_file/prescription/prescription_service.dart +++ b/lib/core/service/patient_medical_file/prescription/prescription_service.dart @@ -427,7 +427,6 @@ class PrescriptionService extends LookupService { GetMedicationForInPatientRequestModel( isDentalAllowedBackend: false, admissionNo: int.parse(patient.admissionNo), - tokenID: "@dm!n", projectID: patient.projectId, ); await baseAppClient.postPatient(GET_MEDICATION_FOR_IN_PATIENT, diff --git a/lib/screens/prescription/prescriptions_items/prescription_items_out_patient.dart b/lib/screens/prescription/prescriptions_items/prescription_items_out_patient.dart index 7efcf940..a695b4d8 100644 --- a/lib/screens/prescription/prescriptions_items/prescription_items_out_patient.dart +++ b/lib/screens/prescription/prescriptions_items/prescription_items_out_patient.dart @@ -46,6 +46,7 @@ class PrescriptionItemsPage extends StatelessWidget { ), body: SingleChildScrollView( child: Container( + height: MediaQuery.of(context).size.height * .9, child: Column( children: [ ListView.builder( From 6bdb2a1600eed6c91350efd28345483fe833636b Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 28 Apr 2022 11:50:24 +0300 Subject: [PATCH 24/26] fix operation_report_servive.dart --- lib/core/service/patient/profile/operation_report_servive.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/service/patient/profile/operation_report_servive.dart b/lib/core/service/patient/profile/operation_report_servive.dart index 0ef6a503..e4de18d9 100644 --- a/lib/core/service/patient/profile/operation_report_servive.dart +++ b/lib/core/service/patient/profile/operation_report_servive.dart @@ -20,7 +20,7 @@ class OperationReportService extends BaseService { {GetReservationsRequestModel getReservationsRequestModel, int patientId}) async { getReservationsRequestModel = - GetReservationsRequestModel(patientID: patientId, doctorID: ""); + GetReservationsRequestModel(patientID: patientId); hasError = false; await baseAppClient.post(GET_RESERVATIONS, From bcb1e90ae6a89d80698b77276b0b95374915bff1 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Sun, 8 May 2022 14:58:33 +0300 Subject: [PATCH 25/26] ER Done form our side --- lib/config/config.dart | 4 + lib/config/localized_values.dart | 4 + .../doctor_ER_sign_assessment_req_model.dart | 25 ++ .../ER_signin/ER_signin_service.dart | 49 ++++ .../ER_sign_in/ER_sign_in_view_model.dart | 41 ++++ lib/locator.dart | 5 + lib/screens/ER_singin/ER_singin_screen.dart | 227 ++++++++++++++++++ lib/screens/home/home_screen.dart | 19 ++ .../notes/note/progress_note_screen.dart | 2 + .../translations_delegate_base_utils.dart | 1 + 10 files changed, 377 insertions(+) create mode 100644 lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart create mode 100644 lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart create mode 100644 lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart create mode 100644 lib/screens/ER_singin/ER_singin_screen.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 7864a598..2195aff2 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -384,6 +384,10 @@ const SET_ACCEPTED_OR_REJECTED = const GET_STP_MASTER_LIST = "Services/DoctorApplication.svc/REST/DoctorApp_GetSTPMasterList"; + +const DOCTOR_ER_SIGN_ASSESSMENT = + "Services/DoctorApplication.svc/REST/DoctorApp_DoctorERSignAssessment"; + var selectedPatientType = 1; //*********change value to decode json from Dropdown ************ diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 116cab42..98607cff 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -93,6 +93,10 @@ const Map> localizedValues = { "en": "scan Qr code to retrieve patient profile", "ar": "مسح رمزاال QR لاسترداد ملف تعريف المريض" }, + "scanERQrCode": { + "en": "Scan Qr code to Handle Er Sign In", + "ar": "امسح رمز ال ER للتعامل مع تسجيل الدخول" + }, "scanQr": {"en": "Scan Qr", "ar": "اقراء ال QR"}, "profile": {"en": "Profile", "ar": "ملفي الشخصي"}, "gender": {"en": "Gender", "ar": "الجنس"}, diff --git a/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart b/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart new file mode 100644 index 00000000..19996bd4 --- /dev/null +++ b/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart @@ -0,0 +1,25 @@ +class DoctorErSignAssessmentReqModel { + String setupID; + int signInType; + int loginDoctorID; + int patientID; + + DoctorErSignAssessmentReqModel( + {this.setupID, this.signInType, this.loginDoctorID, this.patientID}); + + DoctorErSignAssessmentReqModel.fromJson(Map json) { + setupID = json['SetupID']; + signInType = json['SignInType']; + loginDoctorID = json['LoginDoctorID']; + patientID = json['PatientID']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['SignInType'] = this.signInType; + data['LoginDoctorID'] = this.loginDoctorID; + data['PatientID'] = this.patientID; + return data; + } +} diff --git a/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart b/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart new file mode 100644 index 00000000..9e1de604 --- /dev/null +++ b/lib/core/service/patient_medical_file/ER_signin/ER_signin_service.dart @@ -0,0 +1,49 @@ +import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_request_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_in_patient.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescriptions_order.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_get_list_pharmacy_for_prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/request_prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; +import 'package:doctor_app_flutter/core/model/calculate_box_request_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/item_by_medicine_request_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/search_drug_model.dart'; +import 'package:doctor_app_flutter/core/model/search_drug/search_drug_request_model.dart'; +import 'package:doctor_app_flutter/core/service/base/lookup-service.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/utils/date-utils.dart'; +import 'package:flutter/cupertino.dart'; + +class ERSignInService extends LookupService { + + + Future signInERPatient({DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel}) async { + + + hasError = false; + + await baseAppClient.post(DOCTOR_ER_SIGN_ASSESSMENT, + onSuccess: (dynamic response, int statusCode) { + + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: doctorErSignAssessmentReqModel.toJson()); + } + +} diff --git a/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart b/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart new file mode 100644 index 00000000..0bf10e76 --- /dev/null +++ b/lib/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart @@ -0,0 +1,41 @@ +import 'package:doctor_app_flutter/core/enum/filter_type.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/Prescriptions.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/get_medication_for_inpatient_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/perscription_pharmacy.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_entity_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart'; +import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report_enh.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart'; +import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; +import 'package:doctor_app_flutter/core/model/patient/vital_sign/patient-vital-sign-data.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/ER_signin/ER_signin_service.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart'; +import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:flutter/cupertino.dart'; + +class ERSignInViewModel extends BaseViewModel { + bool hasError = false; + + ERSignInService _ERSignInService = locator(); + + Future signInERPatient({int patientId, int signInType}) async { + hasError = false; + await getDoctorProfile(); + DoctorErSignAssessmentReqModel doctorErSignAssessmentReqModel = new DoctorErSignAssessmentReqModel(setupID:"010266", signInType:signInType, loginDoctorID:doctorProfile.doctorID, patientID: patientId ); + setState(ViewState.BusyLocal); + await _ERSignInService.signInERPatient(doctorErSignAssessmentReqModel: doctorErSignAssessmentReqModel); + if (_ERSignInService.hasError) { + error = _ERSignInService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + +} diff --git a/lib/locator.dart b/lib/locator.dart index 0bdfe8e9..0001354e 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/core/service/authentication_service.dart'; import 'package:doctor_app_flutter/core/service/home/scan_qr_service.dart'; import 'package:doctor_app_flutter/core/service/patient/profile/discharge_summary_servive.dart'; +import 'package:doctor_app_flutter/core/service/patient_medical_file/ER_signin/ER_signin_service.dart'; import 'package:doctor_app_flutter/core/service/pending_order_service.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/hospitals_view_model.dart'; @@ -50,6 +51,7 @@ import 'core/service/patient_medical_file/ucaf/patient-ucaf-service.dart'; import 'core/service/patient_medical_file/vital_sign/patient-vital-signs-service.dart'; import 'core/service/special_clinics/special_clinic_service.dart'; import 'core/viewModel/DischargedPatientViewModel.dart'; +import 'core/viewModel/ER_sign_in/ER_sign_in_view_model.dart'; import 'core/viewModel/InsuranceViewModel.dart'; import 'core/viewModel/LiveCarePatientViewModel.dart'; import 'core/viewModel/PatientMedicalReportViewModel.dart'; @@ -114,6 +116,8 @@ void setupLocator() { locator.registerLazySingleton(() => DischargeSummaryService()); locator.registerLazySingleton(() => VteAssessmentService()); locator.registerLazySingleton(() => InterventionMedicationService()); + locator.registerLazySingleton(() => ERSignInService()); + /// View Model locator.registerFactory(() => DoctorReplayViewModel()); @@ -147,4 +151,5 @@ void setupLocator() { locator.registerFactory(() => DischargeSummaryViewModel()); locator.registerFactory(() => VteAssessmentViewModel()); locator.registerFactory(() => InterventionMedicationViewModel()); + locator.registerFactory(() => ERSignInViewModel()); } diff --git a/lib/screens/ER_singin/ER_singin_screen.dart b/lib/screens/ER_singin/ER_singin_screen.dart new file mode 100644 index 00000000..1a65e3dc --- /dev/null +++ b/lib/screens/ER_singin/ER_singin_screen.dart @@ -0,0 +1,227 @@ +import 'package:barcode_scan2/barcode_scan2.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/core/enum/view_state.dart'; +import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; +import 'package:doctor_app_flutter/core/service/AnalyticsService.dart'; +import 'package:doctor_app_flutter/core/viewModel/ER_sign_in/ER_sign_in_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; +import 'package:doctor_app_flutter/core/viewModel/scan_qr_view_model.dart'; +import 'package:doctor_app_flutter/locator.dart'; +import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart'; +import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/utils/utils.dart'; +import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.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/buttons/app_buttons_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; +import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../../routes.dart'; +import '../base/base_view.dart'; + +Utils helpers = Utils(); + +class ErSignInScreen extends StatefulWidget { + @override + _ErSignInScreenState createState() => _ErSignInScreenState(); +} + +class _ErSignInScreenState extends State { + ProjectViewModel projectViewModel; + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + + return BaseView( + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: true, + appBar: PatientSearchHeader(title: "ER Sign In",) + , + body: Center( + child: Container( + margin: EdgeInsets.only(top: SizeConfig.realScreenHeight / 7), + child: FractionallySizedBox( + widthFactor: 0.9, + child: ListView( + children: [ + AppText( + TranslationBase.of(context).startScanning, + fontSize: 18, + fontWeight: FontWeight.bold, + textAlign: TextAlign.center, + ), + SizedBox( + height: 7, + ), + AppText(TranslationBase.of(context).scanERQrCode, + fontSize: 14, + fontWeight: FontWeight.w400, + textAlign: TextAlign.center), + SizedBox( + height: 15, + ), + Container( + height: 150, + child: Image.asset('assets/images/qr_code.png'), + ), + SizedBox( + height: 35, + ), + AppButton( + title: TranslationBase.of(context).scanQr, + onPressed: () async { + await locator().logEvent( + eventCategory: "ErSigninScreen", + eventAction: "Scan QR", + ); + _scanQrAndGetPatient(context, model); + }, + icon: Image.asset('assets/images/qr_code_white.png'), + ), + ], + ), + ), + ), + ), + ), + ); + } + + _scanQrAndGetPatient(BuildContext context, ERSignInViewModel model) async { + var result = (await BarcodeScanner.scan()).rawContent; + if (result != "") { + try{ + List listOfParams = result.split(','); + int patientID = 0; + if (listOfParams[0].length != 0) + patientID = int.parse(listOfParams[0]); + showMyDialog(context:context, firstAction: (){ + signInERPatient(context: context, model: model, patientId: patientID, signInType: 1); + } , secondAction: (){ + signInERPatient(context: context, model: model, patientId: patientID, signInType: 2); + + } ); + }catch(e){ + Utils.showErrorToast("Please Enter Valid Code"); + } + + } + } + + + signInERPatient ({BuildContext context, ERSignInViewModel model, patientId, signInType}) async { + GifLoaderDialogUtils.showMyDialog(context); + await model.signInERPatient(patientId:patientId, signInType: signInType ); + if(model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + /// TODO Elham* Create this in Utils + DrAppToastMsg.showSuccesToast("Add successfully"); + } + GifLoaderDialogUtils.hideDialog(context); + Navigator.of(context).pop(); + + } + + /// TODO Elham* Make this as custom Dialog + showMyDialog({BuildContext context, Function firstAction,Function secondAction, }) { + showDialog( + context: context, + builder: (ctx) => Center( + child: Container( + width: MediaQuery.of(context).size.width * 0.8, + height: 200, + child: AppScaffold( + isShowAppBar: false, + body: Container( + color: Colors.white, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // SizedBox(height: 20,), + SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + TranslationBase.of(context).noteConfirm, + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), + ], + ), + SizedBox( + height: 10, + ), + DividerWithSpacesAround(), + SizedBox( + height: 12, + ), + + Container( + padding: EdgeInsets.all(20), + color: Colors.white, + child: AppText( + projectViewModel.isArabic + ? "الرجاء اختيار الإجراء الذي تريد القيام به" + : 'Please choose the action you want to do ', + fontSize: 15, + textAlign: TextAlign.center, + ), + ), + + SizedBox( + height: 8, + ), + DividerWithSpacesAround(), + FractionallySizedBox( + widthFactor: 0.75, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FlatButton( + child: AppText( + "Sing In", + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), //Text("Cancel"), + onPressed: () async { + await firstAction(); + + + }), + FlatButton( + child: AppText( + "Sing Out", + fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16, + ), //Text("Confirm", ), + onPressed: () async { + await secondAction(); + }) + ], + ), + ) + ], + ), + ), + ), + ), + ), + )); + } + + +} diff --git a/lib/screens/home/home_screen.dart b/lib/screens/home/home_screen.dart index a30c2325..b361d1fe 100644 --- a/lib/screens/home/home_screen.dart +++ b/lib/screens/home/home_screen.dart @@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; +import 'package:doctor_app_flutter/screens/ER_singin/ER_singin_screen.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/home/dashboard_slider-item-widget.dart'; import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart'; @@ -405,6 +406,24 @@ class _HomeScreenState extends State { changeColorIndex(); } + patientCards.add(HomePatientCard( + gradient: backgroundColors[colorIndex], + backgroundIconColor: backgroundIconColors[colorIndex], + cardIcon: DoctorApp.qr_reader, + textColor: textColors[colorIndex], + text: "ER sign In" , + onTap: () { + Navigator.push( + context, + FadePage( + page: ErSignInScreen( + ), + ), + ); + }, + )); + changeColorIndex(); + patientCards.add(HomePatientCard( gradient: backgroundColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex], diff --git a/lib/screens/patients/profile/notes/note/progress_note_screen.dart b/lib/screens/patients/profile/notes/note/progress_note_screen.dart index 561faece..19882b9c 100644 --- a/lib/screens/patients/profile/notes/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/notes/note/progress_note_screen.dart @@ -592,6 +592,8 @@ class _ProgressNoteState extends State { ); } + + /// TODO Elham* Make this as custom Dialog showMyDialog({BuildContext context, Function confirmFun, String actionName}) { showDialog( context: context, diff --git a/lib/utils/translations_delegate_base_utils.dart b/lib/utils/translations_delegate_base_utils.dart index 3ffef41d..ae709ba2 100644 --- a/lib/utils/translations_delegate_base_utils.dart +++ b/lib/utils/translations_delegate_base_utils.dart @@ -159,6 +159,7 @@ class TranslationBase { String get startScanning => localizedValues['startScanning'][locale.languageCode]; String get scanQrCode => localizedValues['scanQrCode'][locale.languageCode]; + String get scanERQrCode => localizedValues['scanERQrCode'][locale.languageCode]; String get scanQr => localizedValues['scanQr'][locale.languageCode]; From 3a9c64779ef7ce0fde1f74f7a420cc279ba9b482 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Mon, 9 May 2022 10:50:30 +0300 Subject: [PATCH 26/26] small fix --- lib/config/localized_values.dart | 2 +- lib/screens/ER_singin/ER_singin_screen.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 98607cff..c9b9a9a6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -94,7 +94,7 @@ const Map> localizedValues = { "ar": "مسح رمزاال QR لاسترداد ملف تعريف المريض" }, "scanERQrCode": { - "en": "Scan Qr code to Handle Er Sign In", + "en": "Scan Qr code to handle ER Sign In", "ar": "امسح رمز ال ER للتعامل مع تسجيل الدخول" }, "scanQr": {"en": "Scan Qr", "ar": "اقراء ال QR"}, diff --git a/lib/screens/ER_singin/ER_singin_screen.dart b/lib/screens/ER_singin/ER_singin_screen.dart index 1a65e3dc..0d9dbc5e 100644 --- a/lib/screens/ER_singin/ER_singin_screen.dart +++ b/lib/screens/ER_singin/ER_singin_screen.dart @@ -135,7 +135,7 @@ class _ErSignInScreenState extends State { builder: (ctx) => Center( child: Container( width: MediaQuery.of(context).size.width * 0.8, - height: 200, + height: 250, child: AppScaffold( isShowAppBar: false, body: Container( @@ -153,7 +153,7 @@ class _ErSignInScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ AppText( - TranslationBase.of(context).noteConfirm, + "Select option", fontWeight: FontWeight.w600, color: Colors.black, fontSize: 16,