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": { "kindlySelectCondition": {
"en": "Kindly select condition", "en": "Kindly select condition",
"ar": "يرجى تحديد الشرط" "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 { 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; if(this.requestModel == null) return;
PatientSearchRequestModel requestModel = this.requestModel!; PatientSearchRequestModel requestModel = this.requestModel!;

@ -25,9 +25,15 @@ class FilterDatePage extends StatefulWidget {
} }
class _FilterDatePageState extends State<FilterDatePage> { class _FilterDatePageState extends State<FilterDatePage> {
bool showResetButton = false;
@override @override
void initState() { void initState() {
// TODO: implement initState
setState(() {
showResetButton = widget.patientSearchViewModel
.selectedFromDate != null;
});
super.initState(); super.initState();
} }
@ -47,6 +53,14 @@ class _FilterDatePageState extends State<FilterDatePage> {
children: [ children: [
BottomSheetTitle( BottomSheetTitle(
title: TranslationBase.of(context).filterInPatient, title: TranslationBase.of(context).filterInPatient,
onCrossClicked: (){
if(showResetButton == false){
widget.patientSearchViewModel
.selectedFromDate = null;
widget.patientSearchViewModel
.selectedToDate = null;
}
},
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
@ -130,35 +144,84 @@ class _FilterDatePageState extends State<FilterDatePage> {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( Row(
child: FractionallySizedBox( children: [
widthFactor: .80, Expanded(
child: Center( child: Container(
child: AppButton( child: FractionallySizedBox(
title: TranslationBase.of(context).search, widthFactor: .80,
padding: 10, child: Center(
color: AppGlobal.appGreenColor, child: AppButton(
onPressed: () async { title: TranslationBase.of(context).search,
if (widget.patientSearchViewModel.selectedFromDate == padding: 10,
null || color: AppGlobal.appGreenColor,
widget.patientSearchViewModel.selectedToDate == onPressed: () async {
null) { if (widget.patientSearchViewModel.selectedFromDate ==
Utils.showErrorToast( null ||
"Please Select All The date Fields "); widget.patientSearchViewModel.selectedToDate ==
} else { null) {
Navigator.pop(context); Utils.showErrorToast(
await widget.patientSearchViewModel.getInPatientList( "Please Select All The date Fields ");
PatientSearchRequestModel( } else {
from: Navigator.pop(context);
"${AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedFromDate!, "yyyy-MM-dd")} 00:00:00", await widget.patientSearchViewModel.getInPatientList(
to: "${AppDateUtils.convertDateToFormat(widget.patientSearchViewModel.selectedToDate!, "yyyy-MM-dd")} 00:00:00", PatientSearchRequestModel(
searchType: null)..transformDataForVidaPlus(), from:
isForceFullRefresh: true); "${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( SizedBox(
height: 5, height: 5,

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

Loading…
Cancel
Save