update date selection
This commit is contained in:
@ -56,7 +56,7 @@ function Index() {
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
// You can await here
|
||||
if(selectedcons !== "" && report !== "") {
|
||||
if(selectedcons !== "" && report !== "" && isDate() == true) {
|
||||
const result = await axios('https://fsbsso.sumasen.net/getDateToHaveData?construction_id=' + selectedcons + '&sheetname=' + report);
|
||||
setValidDates(result.data.record);
|
||||
}
|
||||
@ -132,10 +132,27 @@ function Index() {
|
||||
}
|
||||
};
|
||||
|
||||
function isDateEnable() {
|
||||
function isDownload() {
|
||||
if(isDate() === false && report !== '') {
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
if(startDate !== null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isDate() {
|
||||
if(report === 'BoxDisplacement' || report === 'MachineControl' || report === 'MachineSheet'){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<CRow>
|
||||
<CCol xs="12" sm="12" md="12">
|
||||
@ -175,22 +192,24 @@ function Index() {
|
||||
</CSelect>
|
||||
</CCol>
|
||||
</CFormGroup>
|
||||
{isDate() === true ?
|
||||
<CFormGroup row>
|
||||
<CCol md="3">
|
||||
<CLabel htmlFor="select">報告日</CLabel>
|
||||
</CCol>
|
||||
<CCol xs="12" md="9">
|
||||
|
||||
<DatePicker
|
||||
dateFormat="yyyy/MM/dd"
|
||||
selected={startDate}
|
||||
onChange={(date) => setStartDate(date)}
|
||||
filterDate={checkAvilable}
|
||||
placeholderText='日付を選択'
|
||||
/>
|
||||
</CCol>
|
||||
</CFormGroup>
|
||||
|
||||
<CCol md="3">
|
||||
<CLabel htmlFor="select">報告日</CLabel>
|
||||
</CCol>
|
||||
<CCol xs="12" md="9">
|
||||
<DatePicker
|
||||
dateFormat="yyyy/MM/dd"
|
||||
selected={startDate}
|
||||
onChange={(date) => setStartDate(date)}
|
||||
filterDate={checkAvilable}
|
||||
placeholderText='日付を選択'
|
||||
/>
|
||||
</CCol>
|
||||
</CFormGroup>
|
||||
:
|
||||
<div></div>
|
||||
}
|
||||
|
||||
{report == 'MachineControl' ?
|
||||
<CFormGroup variant="checkbox" className="checkbox">
|
||||
@ -209,7 +228,7 @@ function Index() {
|
||||
</CForm>
|
||||
</CCardBody>
|
||||
<CCardFooter>
|
||||
{startDate != null ?
|
||||
{isDownload() === true ?
|
||||
<CButton type="submit" size="sm" color="primary" onClick={doGetReport}><CIcon name="cil-scrubber" /> ダウンロード</CButton>
|
||||
:
|
||||
<CButton disabled type="submit" size="sm" color="primary" onClick={doGetReport}><CIcon name="cil-scrubber" /> ダウンロード</CButton>
|
||||
|
||||
Reference in New Issue
Block a user