update for graph

This commit is contained in:
2021-07-19 11:29:05 +05:30
parent 32e12ced9b
commit 610976464e

View File

@ -24,7 +24,7 @@ import {
CInputRadio,
CLabel,
CSelect,
CSwitch
CSwitch,
} from '@coreui/react'
import CIcon from '@coreui/icons-react'
import Downloader from '../downloader';
@ -45,6 +45,7 @@ function Index() {
const [sdate, setSdate] = useState(cdate);
const [report, setReport] = useState('');
const [selectedcons, setSelectedCons] = useState('');
const [graph, setGraph] = useState(false);
useEffect(() => {
async function fetchData() {
@ -66,15 +67,26 @@ function Index() {
setSelectedCons(e.target.value);
}
function setingGraph(e){
setGraph(e.target.checked);
}
function doGetReport(){
if(report == "" || selectedcons == ""){
alert("建設とレポートの両方を選択してください");
return;
}
var url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate;
console.log(selectedcons);
console.log(sdate);
console.log(report);
var url = "";
if(graph){
url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate+"&graph=true";
}
else{
url = baseUrl + "/" + report + "?construction_id=" +selectedcons+ "&construction_date="+sdate;
}
console.log(url);
//console.log(selectedcons);
//console.log(sdate);
//console.log(report);
downloadReport(url);
}
@ -150,6 +162,20 @@ function Index() {
</CFormGroup>
{report == 'generateMachineControl' ?
<CFormGroup variant="checkbox" className="checkbox">
<CInputCheckbox
id="checkbox1"
name="checkbox1"
checked = {graph}
value='graph'
onChange={setingGraph}
/>
<CLabel variant="checkbox" className="form-check-label" htmlFor="checkbox1">Show Graph</CLabel>
</CFormGroup>
:
("")}
</CForm>
</CCardBody>
<CCardFooter>