|
|
|
|
@ -25,9 +25,15 @@ class FilterDatePage extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _FilterDatePageState extends State<FilterDatePage> {
|
|
|
|
|
bool showResetButton = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
// TODO: implement initState
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
showResetButton = widget.patientSearchViewModel
|
|
|
|
|
.selectedFromDate != null;
|
|
|
|
|
});
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -47,6 +53,14 @@ class _FilterDatePageState extends State<FilterDatePage> {
|
|
|
|
|
children: [
|
|
|
|
|
BottomSheetTitle(
|
|
|
|
|
title: TranslationBase.of(context).filterInPatient,
|
|
|
|
|
onCrossClicked: (){
|
|
|
|
|
if(showResetButton == false){
|
|
|
|
|
widget.patientSearchViewModel
|
|
|
|
|
.selectedFromDate = null;
|
|
|
|
|
widget.patientSearchViewModel
|
|
|
|
|
.selectedToDate = null;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10.0,
|
|
|
|
|
@ -130,35 +144,84 @@ class _FilterDatePageState extends State<FilterDatePage> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
padding: 10,
|
|
|
|
|
color: AppGlobal.appGreenColor,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (widget.patientSearchViewModel.selectedFromDate ==
|
|
|
|
|
null ||
|
|
|
|
|
widget.patientSearchViewModel.selectedToDate ==
|
|
|
|
|
null) {
|
|
|
|
|
Utils.showErrorToast(
|
|
|
|
|
"Please Select All The date Fields ");
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
await widget.patientSearchViewModel.getInPatientList(
|
|
|
|
|
PatientSearchRequestModel(
|
|
|
|
|
from:
|
|
|
|
|
"${AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedFromDate!, "yyyy-MM-dd")} 00:00:00",
|
|
|
|
|
to: "${AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedToDate!, "yyyy-MM-dd")} 00:00:00",
|
|
|
|
|
searchType: null)..transformDataForVidaPlus(),
|
|
|
|
|
isForceFullRefresh: true);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
padding: 10,
|
|
|
|
|
color: AppGlobal.appGreenColor,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (widget.patientSearchViewModel.selectedFromDate ==
|
|
|
|
|
null ||
|
|
|
|
|
widget.patientSearchViewModel.selectedToDate ==
|
|
|
|
|
null) {
|
|
|
|
|
Utils.showErrorToast(
|
|
|
|
|
"Please Select All The date Fields ");
|
|
|
|
|
} else {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
await widget.patientSearchViewModel.getInPatientList(
|
|
|
|
|
PatientSearchRequestModel(
|
|
|
|
|
from:
|
|
|
|
|
"${AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedFromDate!, "yyyy-MM-dd")} 00:00:00",
|
|
|
|
|
to: "${AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedToDate!, "yyyy-MM-dd")} 00:00:00",
|
|
|
|
|
searchType: null)..transformDataForVidaPlus(),
|
|
|
|
|
isForceFullRefresh: true, isVidaPlusProject: true);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: showResetButton,
|
|
|
|
|
child: Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).reset,
|
|
|
|
|
padding: 10,
|
|
|
|
|
color: AppGlobal.appRedColor,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
this.widget.patientSearchViewModel.selectedToDate = null;
|
|
|
|
|
this.widget.patientSearchViewModel.selectedFromDate = null;
|
|
|
|
|
|
|
|
|
|
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
|
|
|
|
|
DateTime dateTime = DateTime.now();
|
|
|
|
|
String currentDate = AppDateUtils.convertDateToFormat(
|
|
|
|
|
dateTime,
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
print("the current date is $currentDate");
|
|
|
|
|
requestModel.from = "$currentDate 00:00:00";
|
|
|
|
|
|
|
|
|
|
dateTime = dateTime.add(Duration(days: 1));
|
|
|
|
|
currentDate = AppDateUtils.convertDateToFormat(
|
|
|
|
|
dateTime,
|
|
|
|
|
'yyyy-MM-dd');
|
|
|
|
|
requestModel.to = "$currentDate 00:00:00";
|
|
|
|
|
requestModel.pageSize = 10;
|
|
|
|
|
requestModel.pageIndex = 0;
|
|
|
|
|
requestModel.searchType = null;
|
|
|
|
|
requestModel.transformDataForVidaPlus();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
await widget.patientSearchViewModel.getInPatientList(
|
|
|
|
|
requestModel,
|
|
|
|
|
isForceFullRefresh: true,isVidaPlusProject: true);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
|