update date selection

This commit is contained in:
Mohamed Nouffer
2021-09-03 17:53:54 +05:30
parent b93bdc461b
commit 599d1325c2
2 changed files with 38 additions and 19 deletions

View File

@ -28,7 +28,6 @@ const TheContent = () => {
async function fetchSession() { async function fetchSession() {
// You can await here
//setSsoSession('{ "expiration": 468, "client_address": "111.223.144.163", "protocol": "urn:oasis:names:tc:SAML:2.0:protocol", "identity_provider": "https://sso.ts.bizside.biz/idp/shibboleth", "authn_instant": "2021-09-03T08:26:41.248Z", "authncontext_class": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", "attributes": [ { "name": "mail", "values": [ "akira.miyata@mobilous.com" ] } ] }') //setSsoSession('{ "expiration": 468, "client_address": "111.223.144.163", "protocol": "urn:oasis:names:tc:SAML:2.0:protocol", "identity_provider": "https://sso.ts.bizside.biz/idp/shibboleth", "authn_instant": "2021-09-03T08:26:41.248Z", "authncontext_class": "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport", "attributes": [ { "name": "mail", "values": [ "akira.miyata@mobilous.com" ] } ] }')
const result = await axios('https://fsbsso.sumasen.net/Shibboleth.sso/Session'); const result = await axios('https://fsbsso.sumasen.net/Shibboleth.sso/Session');
if(JSON.stringify(SsoSession) !== JSON.stringify(result.data)) { if(JSON.stringify(SsoSession) !== JSON.stringify(result.data)) {
@ -93,6 +92,7 @@ const TheContent = () => {
} }
function get_token_from_storage_or_cookie() { function get_token_from_storage_or_cookie() {
//return true;
const cookies = new Cookies(); const cookies = new Cookies();
const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468') const shib = cookies.get('_shibsession_64656661756c7468747470733a2f2f66736273736f2e73756d6173656e2e6e65742f73686962626f6c657468')
if (shib !== undefined) { if (shib !== undefined) {

View File

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