clear filter issue fix

ipd-changes-for-vida-plus
parent d0557215bb
commit a4b24dad12

@ -1266,5 +1266,9 @@ const Map<String, Map<String, String>> localizedValues = {
"kindlySelectCondition": {
"en": "Kindly select condition",
"ar": "يرجى تحديد الشرط"
},
"reset": {
"en": "Reset",
"ar": "إعادة تعيين"
}
};

@ -191,7 +191,7 @@ class PatientSearchViewModel extends BaseViewModel {
}
FutureOr<void> paginatedInPatientCall(String? selectedClinicName, String? query, bool? isSortDes,{bool isMyInPatient = false,bool isAllClinic = false }) async {
if(isVidaPlusProject = false) return;
if(isVidaPlusProject == false) return;
if(this.requestModel == null) return;
PatientSearchRequestModel requestModel = this.requestModel!;

@ -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,

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:flutter/material.dart';
@ -6,10 +7,12 @@ class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget {
BottomSheetTitle({
Key? key,
this.title = '',
this.isClose =true
this.isClose =true,
this.onCrossClicked
}) : super(key: key);
bool isClose;
final String title;
final VoidCallback? onCrossClicked;
double headerHeight = SizeConfig.heightMultiplier! * 15;
@override
@ -41,6 +44,7 @@ class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget {
InkWell(
onTap: () {
Navigator.pop(context);
onCrossClicked?.call();
},
child: isClose ? Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2B353E)) :SizedBox())
],

@ -2000,6 +2000,7 @@ class TranslationBase {
String get remarksNotAdded => localizedValues['remarksNotAdded']![locale.languageCode]!;
String get addDoctorRemarks => localizedValues['addDoctorRemarks']![locale.languageCode]!;
String get kindlySelectCondition => localizedValues['kindlySelectCondition']![locale.languageCode]!;
String get reset => localizedValues['reset']![locale.languageCode]!;
}
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save