change download file name

This commit is contained in:
Mohamed Nouffer
2021-11-17 13:55:09 +05:30
parent f88ed1524d
commit bc0829f1fc
9 changed files with 19 additions and 12 deletions

View File

@ -43,6 +43,7 @@ function Index() {
const [startDate, setStartDate] = useState(null);
const [validDates, setValidDates] = useState([]);
const [downloadUrl, setDownloadUrl] = useState('');
useEffect(() => {
async function fetchData() {
@ -101,6 +102,7 @@ function Index() {
else{
url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons+ "&construction_date="+getDateWithFormat(startDate);
}
setDownloadUrl(url)
downloadReport(url);
}
else {
@ -110,6 +112,7 @@ function Index() {
else{
url = baseUrl + "/generate" + report + "?construction_id=" +selectedcons;
}
setDownloadUrl(url)
downloadReport(url);
}
}
@ -263,7 +266,11 @@ function Index() {
</CCardBody>
<CCardFooter>
{isDownload() === true ?
<p>
<CButton type="submit" size="sm" color="primary" onClick={doGetReport}><CIcon name="cil-scrubber" /> ダウンロード</CButton>
<br/>
<a href={downloadUrl}>Download</a>
</p>
:
<CButton disabled type="submit" size="sm" color="primary" onClick={doGetReport}><CIcon name="cil-scrubber" /> ダウンロード</CButton>
}