import React, { useEffect, useState } from 'react'; import { CircularProgress } from '@material-ui/core'; import moment from 'moment'; import axios from 'axios'; import { useHistory, Link } from 'react-router-dom'; import IconButton from '@mui/material/IconButton'; import SearchIcon from '@mui/icons-material/Search'; import { areIntervalsOverlapping } from 'date-fns'; import Alert from '../../component/alert'; const Meeting = () => { const history = useHistory(); const [keyword, setKeyword] = useState('') const [loaded, setLoaded] = useState(false); const [finish, setFinish] = useState(false); const [meeting_list, setMeetingList ] = useState(null); const [_422errors, set422errors] = useState({keyword:''}); const [_400error, set400error] = useState(''); useEffect(() => { setLoaded(false); axios.get('/api/admin/meetings/list').then((response) => { setLoaded(true); if(response.data.status_code==200){ //------------Calculate Numerator & Denominator-------------- var list = response.data.params; var arr = []; for(var i in list){ var total=0, num=0; for(var j in list[i].approval) { if(list[i].approval[j].approval_at) num ++; total ++; } arr.push({...list[i], denominator:total, numerator:num}) } //------------------------------------------------------------ setMeetingList(arr); } else if(response.data.status_code==400){ //TODO } }); }, []); const handleSearch = (e) => { e.preventDefault(); initErrors(); if(keyword == '') { document.getElementById('keyword').focus(); return; } setLoaded(false); setMeetingList(null); const formdata = new FormData(); formdata.append('keyword', keyword); axios.post('/api/admin/meetings/search',formdata) .then((response) => { setLoaded(true); if(response.data.status_code==200){ //------------Calculate Numerator & Denominator-------------- var list = response.data.params; var arr = []; for(var i in list){ var total=0, num=0; for(var j in list[i].approval) { if(list[i].approval[j].approval_at) num ++; total ++; } arr.push({...list[i], denominator:total, numerator:num}) } //------------------------------------------------------------ setMeetingList(arr); } else if(response.data.status_code==400){ //TODO } }); } const initErrors = () => { set422errors({keyword:''}); } return (

ミーティング一覧

setKeyword(e.target.value)} />
{ !loaded && } { loaded && ( meeting_list && meeting_list.length > 0 ? meeting_list.map((item, ki) =>

{ item.title }

{ item.text }

  • {item.numerator}
  • {item.denominator}
    { item.approval?.map((x, kj)=>
  • name
  • ) }
) :

データが存在していません。

) }
{ _400error && {_400error} }
) } export default Meeting;