|
|
|
@@ -43,7 +43,7 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { |
|
|
|
|
|
|
|
const marginBottom = 2.5; |
|
|
|
|
|
|
|
const { reset, register, handleSubmit } = useForm() |
|
|
|
const { reset, register, handleSubmit, getValues } = useForm() |
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
setFromDateValue(minDate); |
|
|
|
@@ -53,21 +53,26 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { |
|
|
|
setToDateValue(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 sentDateTo = ""; |
|
|
|
|
|
|
|
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, |
|
|
|
modifiedFrom: sentDateFrom, |
|
|
|
start:0, |
|
|
|
limit:10 |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const onSubmit = () => { |
|
|
|
const temp = { |
|
|
|
...getCurrentFilterParams(), |
|
|
|
start: 0, |
|
|
|
limit: 10, |
|
|
|
}; |
|
|
|
applySearch(temp); |
|
|
|
}; |
|
|
|
@@ -81,7 +86,7 @@ const AuditLogSearchForm = ({ applySearch, searchCriteria, onGridReady}) => { |
|
|
|
setOnDownload(true) |
|
|
|
HttpUtils.fileDownload({ |
|
|
|
url: UrlUtils.AUDIT_LOG_EXPORT, |
|
|
|
params: searchCriteria, |
|
|
|
params: getCurrentFilterParams(), |
|
|
|
onResponse:()=>{ |
|
|
|
setOnDownload(false) |
|
|
|
}, |
|
|
|
|