finish fix Special Clinical

merge-requests/782/head
Elham Rababh 3 years ago
parent 21f3ab9ac8
commit 3626857317

@ -155,7 +155,7 @@ class PatientSearchViewModel extends BaseViewModel {
setState(ViewState.Error); setState(ViewState.Error);
} }
} else { } else {
// setDefaultInPatientList(); setDefaultInPatientList();
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }

@ -106,7 +106,6 @@ class DashboardViewModel extends BaseViewModel {
GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){ GetSpecialClinicalCareListResponseModel getSpecialClinic(clinicId){
GetSpecialClinicalCareListResponseModel special ; GetSpecialClinicalCareListResponseModel special ;
specialClinicalCareList.forEach((element) { specialClinicalCareList.forEach((element) {
//TODO Elham* make the check == clinicId
if(element.clinicID == clinicId){ if(element.clinicID == clinicId){
special = element; special = element;
} }

@ -16,14 +16,16 @@ import '../../routes.dart';
class InPatientPage extends StatefulWidget { class InPatientPage extends StatefulWidget {
final bool isMyInPatient; final bool isMyInPatient;
final PatientSearchViewModel patientSearchViewModel;
InPatientPage(this.isMyInPatient); InPatientPage(this.isMyInPatient, this.patientSearchViewModel);
@override @override
_InPatientPageState createState() => _InPatientPageState(); _InPatientPageState createState() => _InPatientPageState();
} }
class _InPatientPageState extends State<InPatientPage> { class _InPatientPageState extends State<InPatientPage> {
TextEditingController _searchController = TextEditingController(); TextEditingController _searchController = TextEditingController();
bool isSortDes = false; bool isSortDes = false;
@ -38,7 +40,7 @@ class _InPatientPageState extends State<InPatientPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<PatientSearchViewModel>( return BaseView<PatientSearchViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.setDefaultInPatientList(); await widget.patientSearchViewModel.setDefaultInPatientList();
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
@ -65,7 +67,7 @@ class _InPatientPageState extends State<InPatientPage> {
), ),
controller: _searchController, controller: _searchController,
onChanged: (value) { onChanged: (value) {
model.filterSearchResults(value); widget.patientSearchViewModel.filterSearchResults(value);
}), }),
Positioned( Positioned(
@ -82,7 +84,7 @@ class _InPatientPageState extends State<InPatientPage> {
// padding: EdgeInsets.only(bottom: 30), // padding: EdgeInsets.only(bottom: 30),
onPressed: () { onPressed: () {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
model.sortInPatient(isDes: isSortDes); widget.patientSearchViewModel.sortInPatient(isDes: isSortDes);
isSortDes = !isSortDes; isSortDes = !isSortDes;
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}, },
@ -91,7 +93,7 @@ class _InPatientPageState extends State<InPatientPage> {
], ],
), ),
), ),
model.state == ViewState.Idle?model.filteredInPatientItems.length > 0 widget.patientSearchViewModel.state == ViewState.Idle?widget.patientSearchViewModel.filteredInPatientItems.length > 0
? Expanded( ? Expanded(
child: Container( child: Container(
margin: EdgeInsets.symmetric(horizontal: 16.0), margin: EdgeInsets.symmetric(horizontal: 16.0),
@ -100,18 +102,17 @@ class _InPatientPageState extends State<InPatientPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...List.generate( ...List.generate(
model.filteredInPatientItems.length, (index) { widget.patientSearchViewModel.filteredInPatientItems.length, (index) {
if (!widget.isMyInPatient) if (!widget.isMyInPatient)
return PatientCard( return PatientCard(
patientInfo: patientInfo:
model.filteredInPatientItems[index], widget.patientSearchViewModel.filteredInPatientItems[index],
patientType: "1", patientType: "1",
arrivalType: "1", arrivalType: "1",
isInpatient: true, isInpatient: true,
isMyPatient: model isMyPatient: widget.patientSearchViewModel.filteredInPatientItems[index]
.filteredInPatientItems[index]
.doctorId == .doctorId ==
model.doctorProfile.doctorID, widget.patientSearchViewModel.doctorProfile.doctorID,
onTap: () { onTap: () {
FocusScopeNode currentFocus = FocusScopeNode currentFocus =
FocusScope.of(context); FocusScope.of(context);
@ -122,8 +123,8 @@ class _InPatientPageState extends State<InPatientPage> {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
PATIENTS_PROFILE, PATIENTS_PROFILE,
arguments: { arguments: {
"patient": model "patient": widget.patientSearchViewModel.
.filteredInPatientItems[index], filteredInPatientItems[index],
"patientType": "1", "patientType": "1",
"from": "0", "from": "0",
"to": "0", "to": "0",
@ -133,20 +134,20 @@ class _InPatientPageState extends State<InPatientPage> {
}); });
}, },
); );
else if (model.filteredInPatientItems[index] else if (widget.patientSearchViewModel.filteredInPatientItems[index]
.doctorId == .doctorId ==
model.doctorProfile.doctorID && widget.patientSearchViewModel.doctorProfile.doctorID &&
widget.isMyInPatient) widget.isMyInPatient)
return PatientCard( return PatientCard(
patientInfo: patientInfo:
model.filteredInPatientItems[index], widget.patientSearchViewModel.filteredInPatientItems[index],
patientType: "1", patientType: "1",
arrivalType: "1", arrivalType: "1",
isInpatient: true, isInpatient: true,
isMyPatient: model isMyPatient: widget.patientSearchViewModel
.filteredInPatientItems[index] .filteredInPatientItems[index]
.doctorId == .doctorId ==
model.doctorProfile.doctorID, widget.patientSearchViewModel.doctorProfile.doctorID,
onTap: () { onTap: () {
FocusScopeNode currentFocus = FocusScopeNode currentFocus =
FocusScope.of(context); FocusScope.of(context);
@ -157,8 +158,7 @@ class _InPatientPageState extends State<InPatientPage> {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
PATIENTS_PROFILE, PATIENTS_PROFILE,
arguments: { arguments: {
"patient": model "patient": widget.patientSearchViewModel.filteredInPatientItems[index],
.filteredInPatientItems[index],
"patientType": "1", "patientType": "1",
"from": "0", "from": "0",
"to": "0", "to": "0",

@ -265,8 +265,8 @@ class _PatientInPatientScreenState extends State<PatientInPatientScreen>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: [ children: [
InPatientPage(false), InPatientPage(false, model),
InPatientPage(true), InPatientPage(true,model),
DischargedPatient(), DischargedPatient(),
], ],
), ),

Loading…
Cancel
Save