diff --git a/lib/core/viewModel/PatientSearchViewModel.dart b/lib/core/viewModel/PatientSearchViewModel.dart index 0ee76cb4..29bbc6aa 100644 --- a/lib/core/viewModel/PatientSearchViewModel.dart +++ b/lib/core/viewModel/PatientSearchViewModel.dart @@ -155,7 +155,7 @@ class PatientSearchViewModel extends BaseViewModel { setState(ViewState.Error); } } else { - // setDefaultInPatientList(); + setDefaultInPatientList(); setState(ViewState.Idle); } } diff --git a/lib/core/viewModel/dashboard_view_model.dart b/lib/core/viewModel/dashboard_view_model.dart index 611ffc4f..8346e33d 100644 --- a/lib/core/viewModel/dashboard_view_model.dart +++ b/lib/core/viewModel/dashboard_view_model.dart @@ -106,7 +106,6 @@ class DashboardViewModel extends BaseViewModel { GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ GetSpecialClinicalCareListResponseModel special ; specialClinicalCareList.forEach((element) { - //TODO Elham* make the check == clinicId if(element.clinicID == clinicId){ special = element; } diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index a88d3007..f06aabac 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -16,14 +16,16 @@ import '../../routes.dart'; class InPatientPage extends StatefulWidget { final bool isMyInPatient; + final PatientSearchViewModel patientSearchViewModel; - InPatientPage(this.isMyInPatient); + InPatientPage(this.isMyInPatient, this.patientSearchViewModel); @override _InPatientPageState createState() => _InPatientPageState(); } class _InPatientPageState extends State { + TextEditingController _searchController = TextEditingController(); bool isSortDes = false; @@ -38,7 +40,7 @@ class _InPatientPageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - await model.setDefaultInPatientList(); + await widget.patientSearchViewModel.setDefaultInPatientList(); }, builder: (_, model, w) => AppScaffold( baseViewModel: model, @@ -65,7 +67,7 @@ class _InPatientPageState extends State { ), controller: _searchController, onChanged: (value) { - model.filterSearchResults(value); + widget.patientSearchViewModel.filterSearchResults(value); }), Positioned( @@ -82,7 +84,7 @@ class _InPatientPageState extends State { // padding: EdgeInsets.only(bottom: 30), onPressed: () { GifLoaderDialogUtils.showMyDialog(context); - model.sortInPatient(isDes: isSortDes); + widget.patientSearchViewModel.sortInPatient(isDes: isSortDes); isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, @@ -91,7 +93,7 @@ class _InPatientPageState extends State { ], ), ), - model.state == ViewState.Idle?model.filteredInPatientItems.length > 0 + widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0 ? Expanded( child: Container( margin: EdgeInsets.symmetric(horizontal: 16.0), @@ -100,18 +102,17 @@ class _InPatientPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ ...List.generate( - model.filteredInPatientItems.length, (index) { + widget.patientSearchViewModel.filteredInPatientItems.length, (index) { if (!widget.isMyInPatient) return PatientCard( patientInfo: - model.filteredInPatientItems[index], + widget.patientSearchViewModel.filteredInPatientItems[index], patientType: "1", arrivalType: "1", isInpatient: true, - isMyPatient: model - .filteredInPatientItems[index] + isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index] .doctorId == - model.doctorProfile.doctorID, + widget.patientSearchViewModel.doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); @@ -122,8 +123,8 @@ class _InPatientPageState extends State { Navigator.of(context).pushNamed( PATIENTS_PROFILE, arguments: { - "patient": model - .filteredInPatientItems[index], + "patient": widget.patientSearchViewModel. + filteredInPatientItems[index], "patientType": "1", "from": "0", "to": "0", @@ -133,20 +134,20 @@ class _InPatientPageState extends State { }); }, ); - else if (model.filteredInPatientItems[index] + else if (widget.patientSearchViewModel.filteredInPatientItems[index] .doctorId == - model.doctorProfile.doctorID && + widget.patientSearchViewModel.doctorProfile.doctorID && widget.isMyInPatient) return PatientCard( patientInfo: - model.filteredInPatientItems[index], + widget.patientSearchViewModel.filteredInPatientItems[index], patientType: "1", arrivalType: "1", isInpatient: true, - isMyPatient: model + isMyPatient: widget.patientSearchViewModel .filteredInPatientItems[index] .doctorId == - model.doctorProfile.doctorID, + widget.patientSearchViewModel.doctorProfile.doctorID, onTap: () { FocusScopeNode currentFocus = FocusScope.of(context); @@ -157,8 +158,7 @@ class _InPatientPageState extends State { Navigator.of(context).pushNamed( PATIENTS_PROFILE, arguments: { - "patient": model - .filteredInPatientItems[index], + "patient": widget.patientSearchViewModel.filteredInPatientItems[index], "patientType": "1", "from": "0", "to": "0", diff --git a/lib/screens/patients/PatientsInPatientScreen.dart b/lib/screens/patients/PatientsInPatientScreen.dart index d5d7d758..aaa50783 100644 --- a/lib/screens/patients/PatientsInPatientScreen.dart +++ b/lib/screens/patients/PatientsInPatientScreen.dart @@ -265,8 +265,8 @@ class _PatientInPatientScreenState extends State physics: BouncingScrollPhysics(), controller: _tabController, children: [ - InPatientPage(false), - InPatientPage(true), + InPatientPage(false, model), + InPatientPage(true,model), DischargedPatient(), ], ),