| @@ -43,7 +43,7 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { | |||||
| const marginBottom = 2.5; | const marginBottom = 2.5; | ||||
| const { reset, register, handleSubmit } = useForm() | |||||
| const { reset, register, handleSubmit, getValues } = useForm() | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| setFromDateValue(minDate); | setFromDateValue(minDate); | ||||
| @@ -53,21 +53,26 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { | |||||
| setToDateValue(maxDate); | setToDateValue(maxDate); | ||||
| }, [maxDate]); | }, [maxDate]); | ||||
| const onSubmit = (data) => { | |||||
| /** Same filter fields as the list API; must reflect current form/UI state (not parent `searchCriteria`). */ | |||||
| const getCurrentFilterParams = () => { | |||||
| let sentDateFrom = ""; | let sentDateFrom = ""; | ||||
| let sentDateTo = ""; | let sentDateTo = ""; | ||||
| if (fromDateValue != "dd / mm / yyyy" && toDateValue != "dd / mm / yyyy") { | if (fromDateValue != "dd / mm / yyyy" && toDateValue != "dd / mm / yyyy") { | ||||
| sentDateFrom = DateUtils.dateValue(fromDateValue) | |||||
| sentDateTo = DateUtils.dateValue(toDateValue) | |||||
| sentDateFrom = DateUtils.dateValue(fromDateValue); | |||||
| sentDateTo = DateUtils.dateValue(toDateValue); | |||||
| } | } | ||||
| const temp = { | |||||
| username: data.userName, | |||||
| return { | |||||
| username: getValues("userName"), | |||||
| modifiedTo: sentDateTo, | modifiedTo: sentDateTo, | ||||
| modifiedFrom: sentDateFrom, | modifiedFrom: sentDateFrom, | ||||
| start:0, | |||||
| limit:10 | |||||
| }; | |||||
| }; | |||||
| const onSubmit = () => { | |||||
| const temp = { | |||||
| ...getCurrentFilterParams(), | |||||
| start: 0, | |||||
| limit: 10, | |||||
| }; | }; | ||||
| applySearch(temp); | applySearch(temp); | ||||
| }; | }; | ||||
| @@ -81,7 +86,7 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { | |||||
| setOnDownload(true) | setOnDownload(true) | ||||
| HttpUtils.fileDownload({ | HttpUtils.fileDownload({ | ||||
| url: UrlUtils.AUDIT_LOG_EXPORT, | url: UrlUtils.AUDIT_LOG_EXPORT, | ||||
| params: searchCriteria, | |||||
| params: getCurrentFilterParams(), | |||||
| onResponse:()=>{ | onResponse:()=>{ | ||||
| setOnDownload(false) | setOnDownload(false) | ||||
| }, | }, | ||||