fix the filter page

merge-requests/623/head
Mohammad Aljammal 5 years ago
parent 2c81941428
commit 27a3dd1eb4

@ -71,7 +71,7 @@ class BaseAppClient {
(body['ProjectID'] == 2 || body['ProjectID'] == 3)) { (body['ProjectID'] == 2 || body['ProjectID'] == 3)) {
body['PatientOutSA'] = true; body['PatientOutSA'] = true;
} }
body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2;
print("URL : $url"); print("URL : $url");
print("Body : ${json.encode(body)}"); print("Body : ${json.encode(body)}");
var asd = json.encode(body); var asd = json.encode(body);

@ -49,7 +49,8 @@ class PatientSearchViewModel extends BaseViewModel{
} else { } else {
setState(ViewState.Busy); setState(ViewState.Busy);
} }
await getDoctorProfile(isGetProfile: true);
patientSearchRequestModel.doctorID = doctorProfile.doctorID;
await _outPatientService.getOutPatient( await _outPatientService.getOutPatient(
patientSearchRequestModel); patientSearchRequestModel);
if (_outPatientService.hasError) { if (_outPatientService.hasError) {

@ -22,7 +22,17 @@ class BaseViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
Future<DoctorProfileModel> getDoctorProfile() async { Future<DoctorProfileModel> getDoctorProfile({bool isGetProfile = false}) async {
if(isGetProfile)
{
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) {
doctorProfile = DoctorProfileModel.fromJson(profile);
if (doctorProfile != null) {
return doctorProfile;
}
}
}
if (doctorProfile == null) { if (doctorProfile == null) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
if (profile != null) { if (profile != null) {
@ -35,5 +45,5 @@ class BaseViewModel extends ChangeNotifier {
} else { } else {
return doctorProfile; return doctorProfile;
} }
} }
} }

@ -240,6 +240,11 @@ class _FilterDatePageState extends State<FilterDatePage> {
if (isFromDate) { if (isFromDate) {
setState(() { setState(() {
this.widget.patientSearchViewModel.selectedFromDate = picked; this.widget.patientSearchViewModel.selectedFromDate = picked;
var date = picked.add(Duration(days: 30));
if(date.isBefore(lastDate)){
this.widget.patientSearchViewModel.selectedToDate = date;
}else
this.widget.patientSearchViewModel.selectedToDate = lastDate;
}); });
} else { } else {
setState(() { setState(() {

@ -132,7 +132,10 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
setState(() { setState(() {
_activeLocation = _times.indexOf(item); _activeLocation = _times.indexOf(item);
outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==0?OutPatientFilterType.Today:OutPatientFilterType.NextWeek; outPatientFilterType= _activeLocation==0?OutPatientFilterType.Previous:_activeLocation==0?OutPatientFilterType.Today:OutPatientFilterType.NextWeek;
_controller.text="";
}); });
model.searchData("");
FocusScope.of(context).requestFocus(new FocusNode());
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await model.getPatientBasedOnDate(item: item, await model.getPatientBasedOnDate(item: item,
selectedPatientType: widget.selectedPatientType, selectedPatientType: widget.selectedPatientType,
@ -222,6 +225,7 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
SizedBox( SizedBox(
height: 10.0, height: 10.0,
), ),
Expanded( Expanded(
child: Container( child: Container(
child: model.filterData.isEmpty child: model.filterData.isEmpty
@ -236,7 +240,9 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.filterData.length, itemCount: model.filterData.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
return Padding( if(_activeLocation !=0 || (model.filterData[index].patientStatusType !=null && model.filterData[index].patientStatusType==43))
return
Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
patientInfo: model.filterData[index], patientInfo: model.filterData[index],
@ -264,6 +270,8 @@ class _OutPatientsScreenState extends State<OutPatientsScreen> {
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),
); );
else
return SizedBox();
})), })),
), ),
], ],

@ -94,6 +94,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
Column( Column(
children: [ children: [
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
patient, patient,
arrivalType ?? '0', arrivalType ?? '0',
patientType, patientType,
@ -104,6 +105,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
: isDischargedPatient : isDischargedPatient
? 240 ? 240
: 0, : 0,
isDischargedPatient:isDischargedPatient
), ),
Container( Container(
height: !isSearchAndOut height: !isSearchAndOut

@ -18,9 +18,10 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
final String arrivalType; final String arrivalType;
final double height; final double height;
final bool isInpatient; final bool isInpatient;
final bool isDischargedPatient;
PatientProfileHeaderNewDesignAppBar( PatientProfileHeaderNewDesignAppBar(
this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false}); this.patient, this.patientType, this.arrivalType, {this.height = 0.0, this.isInpatient=false, this.isDischargedPatient=false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -302,10 +303,16 @@ class PatientProfileHeaderNewDesignAppBar extends StatelessWidget
"${TranslationBase.of(context).numOfDays}: ", "${TranslationBase.of(context).numOfDays}: ",
fontSize: 15, fontSize: 15,
), ),
if(isDischargedPatient)
AppText( AppText(
"${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", "${DateUtils.getDateTimeFromServerFormat(patient.dischargeDate).difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15, fontSize: 15,
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700)
else
AppText(
"${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}",
fontSize: 15,
fontWeight: FontWeight.w700),
], ],
), ),
], ],

@ -62,119 +62,91 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return Container( return Container(
child: Expanded( child: Column(
child: Column( children: [
children: [ Expanded(
Expanded( child: Container(
child: Container( height: MediaQuery.of(context).size.height * 0.70,
height: MediaQuery.of(context).size.height * 0.70, child: Center(
child: Center( child: Container(
child: Container( decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(12),
borderRadius: BorderRadius.circular(12), color: Colors.white),
color: Colors.white), child: Column(
child: Column( children: [
children: [ AppTextFieldCustom(
AppTextFieldCustom( // height:
// height: // MediaQuery.of(context).size.height * 0.070,
// MediaQuery.of(context).size.height * 0.070, hintText:
hintText: TranslationBase.of(context).selectAllergy,
TranslationBase.of(context).selectAllergy, isTextFieldHasSuffix: true,
isTextFieldHasSuffix: true, hasBorder: false,
hasBorder: false, // controller: filteredSearchController,
// controller: filteredSearchController, onChanged: (value) {
onChanged: (value) { filterSearchResults(value);
filterSearchResults(value); },
}, suffixIcon: IconButton(
suffixIcon: IconButton( icon: Icon(
icon: Icon( Icons.search,
Icons.search, color: Colors.black,
color: Colors.black, )),
)), ),
), DividerWithSpacesAround(),
DividerWithSpacesAround(), SizedBox(
SizedBox( height: 10,
height: 10, ),
), Expanded(
Expanded( child: FractionallySizedBox(
child: FractionallySizedBox( widthFactor: 0.9,
widthFactor: 0.9, child: Container(
child: Container( height:
height: MediaQuery.of(context).size.height * 0.60,
MediaQuery.of(context).size.height * 0.60, child: ListView.builder(
child: ListView.builder( itemCount: items.length,
itemCount: items.length, itemBuilder: (context, index) {
itemBuilder: (context, index) { bool isSelected = widget
bool isSelected = widget .isServiceSelected(items[index]);
.isServiceSelected(items[index]); MySelectedAllergy mySelectedAllergy;
MySelectedAllergy mySelectedAllergy; if (isSelected) {
if (isSelected) { mySelectedAllergy =
mySelectedAllergy = widget.getServiceSelectedAllergy(
widget.getServiceSelectedAllergy( items[index]);
items[index]); }
} TextEditingController remarkController =
TextEditingController remarkController = TextEditingController(
TextEditingController( text: isSelected
text: isSelected ? mySelectedAllergy.remark
? mySelectedAllergy.remark : null);
: null); TextEditingController severityController =
TextEditingController severityController = TextEditingController(
TextEditingController( text: isSelected
text: isSelected ? mySelectedAllergy
? mySelectedAllergy .selectedAllergySeverity !=
.selectedAllergySeverity != null
null ? projectViewModel
? projectViewModel .isArabic
.isArabic ? mySelectedAllergy
? mySelectedAllergy .selectedAllergySeverity
.selectedAllergySeverity .nameAr
.nameAr : mySelectedAllergy
: mySelectedAllergy .selectedAllergySeverity
.selectedAllergySeverity .nameEn
.nameEn : null
: null : null);
: null); return HeaderBodyExpandableNotifier(
return HeaderBodyExpandableNotifier( headerWidget: Row(
headerWidget: Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, children: [
children: [ Row(
Row( children: [
children: [ Checkbox(
Checkbox( value: widget
value: widget .isServiceSelected(
.isServiceSelected( items[index]),
items[index]), activeColor:
activeColor: Colors.red[800],
Colors.red[800], onChanged: (bool newValue) {
onChanged: (bool newValue) {
setState(() {
if (widget
.isServiceSelected(
items[index])) {
widget.removeAllergy(
items[index]);
} else {
MySelectedAllergy
mySelectedAllergy =
new MySelectedAllergy(
selectedAllergy:
items[
index],
selectedAllergySeverity:
_selectedAllergySeverity,
remark: null,
isChecked:
true,
isExpanded:
true);
widget.addAllergy(
mySelectedAllergy);
}
});
}),
InkWell(
onTap: () {
setState(() { setState(() {
if (widget if (widget
.isServiceSelected( .isServiceSelected(
@ -182,9 +154,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
widget.removeAllergy( widget.removeAllergy(
items[index]); items[index]);
} else { } else {
// TODO add Allergy MySelectedAllergy
mySelectedAllergy =
MySelectedAllergy mySelectedAllergy =
new MySelectedAllergy( new MySelectedAllergy(
selectedAllergy: selectedAllergy:
items[ items[
@ -192,208 +163,234 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState
selectedAllergySeverity: selectedAllergySeverity:
_selectedAllergySeverity, _selectedAllergySeverity,
remark: null, remark: null,
isChecked: true, isChecked:
true,
isExpanded: isExpanded:
true); true);
widget.addAllergy( widget.addAllergy(
mySelectedAllergy); mySelectedAllergy);
} }
}); });
}, }),
child: Padding( InkWell(
padding: const EdgeInsets
.symmetric(
horizontal: 10,
vertical: 0),
child: Container(
child: AppText(
projectViewModel
.isArabic
? items[index]
.nameAr !=
""
? items[index]
.nameAr
: items[index]
.nameEn
: items[index]
.nameEn,
color:
Color(0xFF575757),
fontSize: 16,
fontWeight:
FontWeight.w600,
),
width:
MediaQuery.of(context)
.size
.width *
0.55,
),
),
),
],
),
InkWell(
onTap: () { onTap: () {
if (mySelectedAllergy != setState(() {
null) { if (widget
setState(() { .isServiceSelected(
mySelectedAllergy items[index])) {
.isExpanded = widget.removeAllergy(
mySelectedAllergy items[index]);
.isExpanded } else {
? false
: true; MySelectedAllergy mySelectedAllergy =
}); new MySelectedAllergy(
} selectedAllergy:
items[
index],
selectedAllergySeverity:
_selectedAllergySeverity,
remark: null,
isChecked: true,
isExpanded:
true);
widget.addAllergy(
mySelectedAllergy);
}
});
}, },
child: Icon((mySelectedAllergy != child: Padding(
null padding: const EdgeInsets
? mySelectedAllergy .symmetric(
.isExpanded horizontal: 10,
: false) vertical: 0),
? EvaIcons child: Container(
.arrowIosUpwardOutline child: AppText(
: EvaIcons projectViewModel
.arrowIosDownwardOutline)) .isArabic
], ? items[index]
), .nameAr !=
bodyWidget: Center( ""
child: FractionallySizedBox( ? items[index]
widthFactor: 0.9, .nameAr
child: Center( : items[index]
child: Column( .nameEn
children: [ : items[index]
AppTextFieldCustom( .nameEn,
onClick: widget.model color:
.allergySeverityList != Color(0xFF575757),
null fontSize: 16,
? () { fontWeight:
MasterKeyDailog FontWeight.w600,
dialog =
MasterKeyDailog(
list: widget.model
.allergySeverityList,
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
mySelectedAllergy
.selectedAllergySeverity =
selectedValue;
});
},
);
showDialog(
barrierDismissible:
false,
context: context,
builder:
(BuildContext
context) {
return dialog;
},
);
}
: null,
isTextFieldHasSuffix: true,
hintText:
TranslationBase.of(
context)
.selectSeverity,
enabled: false,
maxLines: 2,
minLines: 2,
controller:
severityController,
),
SizedBox(
height: 5,
),
if (isSubmitted &&
mySelectedAllergy !=
null &&
mySelectedAllergy
.selectedAllergySeverity ==
null)
Row(
children: [
CustomValidationError(),
],
mainAxisAlignment:
MainAxisAlignment
.start,
), ),
SizedBox( width:
height: 10, MediaQuery.of(context)
), .size
Container( .width *
margin: EdgeInsets.only( 0.55,
left: 0,
right: 0,
top: 15),
child: NewTextFields(
hintText:
TranslationBase.of(
context)
.remarks,
fontSize: 13.5,
// hintColor: Colors.black,
fontWeight:
FontWeight.w600,
maxLines: 25,
minLines: 3,
initialValue: isSelected
? mySelectedAllergy
.remark
: '',
// controller: remarkControlle
onChanged: (value) {
if (isSelected) {
mySelectedAllergy
.remark = value;
}
},
validator: (value) {
if (value == null)
return TranslationBase
.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(
height: 10,
), ),
], ),
), ),
],
),
InkWell(
onTap: () {
if (mySelectedAllergy !=
null) {
setState(() {
mySelectedAllergy
.isExpanded =
mySelectedAllergy
.isExpanded
? false
: true;
});
}
},
child: Icon((mySelectedAllergy !=
null
? mySelectedAllergy
.isExpanded
: false)
? EvaIcons
.arrowIosUpwardOutline
: EvaIcons
.arrowIosDownwardOutline))
],
),
bodyWidget: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
child: Column(
children: [
AppTextFieldCustom(
onClick: widget.model
.allergySeverityList !=
null
? () {
MasterKeyDailog
dialog =
MasterKeyDailog(
list: widget.model
.allergySeverityList,
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
mySelectedAllergy
.selectedAllergySeverity =
selectedValue;
});
},
);
showDialog(
barrierDismissible:
false,
context: context,
builder:
(BuildContext
context) {
return dialog;
},
);
}
: null,
isTextFieldHasSuffix: true,
hintText:
TranslationBase.of(
context)
.selectSeverity,
enabled: false,
maxLines: 2,
minLines: 2,
controller:
severityController,
),
SizedBox(
height: 5,
),
if (isSubmitted &&
mySelectedAllergy !=
null &&
mySelectedAllergy
.selectedAllergySeverity ==
null)
Row(
children: [
CustomValidationError(),
],
mainAxisAlignment:
MainAxisAlignment
.start,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.only(
left: 0,
right: 0,
top: 15),
child: NewTextFields(
hintText:
TranslationBase.of(
context)
.remarks,
fontSize: 13.5,
// hintColor: Colors.black,
fontWeight:
FontWeight.w600,
maxLines: 25,
minLines: 3,
initialValue: isSelected
? mySelectedAllergy
.remark
: '',
// controller: remarkControlle
onChanged: (value) {
if (isSelected) {
mySelectedAllergy
.remark = value;
}
},
validator: (value) {
if (value == null)
return TranslationBase
.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(
height: 10,
),
],
), ),
), ),
), ),
isExpand: mySelectedAllergy != null ),
? mySelectedAllergy.isExpanded isExpand: mySelectedAllergy != null
: false, ? mySelectedAllergy.isExpanded
); : false,
}, );
), },
), ),
), ),
), ),
], ),
))), ],
), ))),
),
SizedBox(
height: 10,
), ),
], ),
), SizedBox(
height: 10,
),
],
), ),
); );
} }

Loading…
Cancel
Save