import React, { useEffect, useState } from 'react'; import { CircularProgress } from '@material-ui/core'; import Notification from '../../component/notification'; import moment from 'moment'; import axios from 'axios'; import { useHistory } from 'react-router-dom' const Meeting = () => { const history = useHistory(); const fatherId = document.getElementById('father_id').value; const [loading, setLoading] = useState(true); const [finish, setFinish] = useState(false); const [completeOfFather, setCompleteOfFather ] = useState(null); const [inCompleteOfFather, setInCompleteOfFather ] = useState(null); useEffect(() => { axios.get('/api/meetings/listOfCompleteOfFather', {params: { father_id: fatherId }}).then((response) => { if(response.data.status_code==200){ console.log(response.data.params); setCompleteOfFather(response.data.params); } else if(response.data.status_code==400){ //TODO } setCompleteOfFather(response.data.params); }); }, []); useEffect(() => { axios.get('/api/meetings/listOfIncompleteOfFather', {params: { father_id: 1 }}).then((response) => { if(response.data.status_code==200){ console.log(response.data.params); setInCompleteOfFather(response.data.params); setLoading(false); } else if(response.data.status_code==400){ //TODO } }); }, []); async function handleFavorite(meetingId, currentFavorite, stateName) { const formdata = new FormData(); formdata.append('meeting_id', meetingId); formdata.append('is_favorite', currentFavorite == 1 ? 0 : 1); axios.post('/api/meetings/registerFavorite', formdata).then((response) => {}) if(stateName == "inCompleteOfFather") { const newList = inCompleteOfFather.map((item) => { if (item.id === meetingId) { const updatedItem = { ...item, is_favorite: currentFavorite == 1 ? 0 : 1, }; return updatedItem; } return item; }); setInCompleteOfFather(newList); } else { const newList = completeOfFather.map((item) => { if (item.id === meetingId) { const updatedItem = { ...item, is_favorite: currentFavorite == 1 ? 0 : 1, }; return updatedItem; } return item; }); setCompleteOfFather(newList); } }; return (

ミーティング一覧

{ e.preventDefault(); history.push({ pathname: '/p-account/meeting/new', state: {} }); }} data-v-ade1d018="" className="btn-default btn-yellow btn-meeting btn-shadow btn-r8 btn-h48 btn-fz14"> ミーティングを追加
{ !loading ? inCompleteOfFather?.map((item, index1) => { return (
{ e.preventDefault(); history.push({ pathname: `/p-account/meeting/detail/${item.id}`, state: {} }); }} >

{ item.title }

{ item.text }

  • {item?.approvals.length}
  • {item?.total}
    { item?.approvals.map((v, inx1) => { return (
  • name
  • ); }) }
); }) : }
{ completeOfFather?.length > 0 && completeOfFather.map((item, index2) => { return (
{ e.preventDefault(); history.push({ pathname: `/p-account/meeting/detail/${item.id}`, state: {} }); }} >

{ item.title }

{ item.text }

  • {item?.approvals.length}
  • {item?.total}
    { item?.approvals.map((v, inx2) => { return (
  • name
  • ); }) }
); }) }
) } export default Meeting;