このリポジトリは2023-09-09にアーカイブされています。 ファイルの閲覧とクローンは可能ですが、プッシュ、イシューの作成、プルリクエストはできません。
kikikan/backend/resources/js/parent/meeting/edit.jsx

173 行
9.6 KiB
React
Raw 通常表示 履歴

2021-10-01 17:45:39 +09:00
import React, { useEffect, useState } from 'react';
2021-10-05 00:35:47 +09:00
import axios from 'axios';
2021-10-01 17:45:39 +09:00
2021-10-05 00:35:47 +09:00
const MeetingEdit = (props) => {
const [meeting, setMeeting] = useState(null);
const [title, setTitle] = useState(null);
const [memo, setMemo] = useState(null);
const [text, setText] = useState(null);
const fatherId = document.getElementById('father_id').value;
2021-10-05 00:35:47 +09:00
useEffect(() => {
axios.get(`/api/meetings/detail/${props.match.params?.id}`, {params: { father_id: 1 }}).then((response) => {
if(response.data.status_code==200){
console.log(response.data.params[0]);
setMeeting(response.data.params[0]);
setTitle(response.data.params[0]?.title);
setMemo(response.data.params[0]?.memo);
setText(response.data.params[0]?.text);
2021-10-05 00:35:47 +09:00
} else if(response.data.status_code==400){
//TODO
}
});
}, []);
async function handleClick() {
// setErrors({
// title:'',
// memo:'',
// text:'',
// pdf:'',
// images:''
// });
try {
const formdata = new FormData();
formdata.append('father_id', fatherId);
formdata.append('title', title);
formdata.append('memo', memo);
formdata.append('text', text);
// formdata.append('pdf', pdf);
// formdata.append('images', images);
// axios.post('/api/meetings/register', formdata)
// .then(response => {
// if(response.data.status_code==200){
// history.push({
// pathname: "/p-account/meetings/detail/1",
// state: {message : "ミーティングを作成しました!"}
// });
// } else {
// setMessageAlert('error');
// setShowAlert(true);
// }
// });
} catch (error) {
console.log('error', error);
}
}
2021-10-05 00:35:47 +09:00
if (!meeting) return null;
2021-10-01 17:45:39 +09:00
return (
<div className="l-content">
<div className="l-content__ttl">
<div className="l-content__ttl__left">
<h2>ミーティング作成</h2>
</div>
<div className="p-notification">
<div className="p-notification-icon">
<div className="p-notification-icon-wrap">
<div className="count">1</div>
<div className="p-notification-icon-bg"></div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22.742 19.855" className="icon svg-icon svg-fill svg-y50" ><g fill="none" stroke="#080808" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5" data-name="Icon feather-alert-triangle" transform="translate(0.777 0.75)"><path d="M11.188,5.322,2.6,19.659A2.028,2.028,0,0,0,4.334,22.7H21.51a2.028,2.028,0,0,0,1.734-3.042L14.656,5.322a2.028,2.028,0,0,0-3.468,0Z" data-name="パス 3" transform="translate(-2.328 -4.346)"/><path d="M18,13.5v6.91" data-name="パス 4" transform="translate(-7.406 -8.547)"/><path d="M18,25.5h0" data-name="パス 5" transform="translate(-7.406 -11.2)"/></g></svg>
2021-10-01 17:45:39 +09:00
</div>
</div>
</div>
</div>
<div className="l-content-wrap">
<div className="p-article">
<div className="p-article-wrap">
<article className="p-article__body">
<div className="p-article__content">
<div className="p-article__context">
<form action="" className="edit-form">
<div className="edit-set">
<label className="control-label" htmlFor="title">タイトル</label>
<input type="text" name="title" value={ title } onChange={e=>setTitle(e.target.value)} className="input-default input-title input-h60 input-w480" id="title" />
</div>
<div className="edit-set">
<label className="control-label" htmlFor="meeting_textarea">本文</label>
<textarea value={ text } onChange={e=>setText(e.target.value)} rows="8" className="textarea-default" id="meeting_textarea" />
2021-10-01 17:45:39 +09:00
</div>
<div className="edit-set">
<label className="control-label" htmlFor="meeting_textarea">メモ</label>
<textarea value={ memo } onChange={e=>setMemo(e.target.value)} rows="8" className="textarea-default" id="meeting_textarea" />
2021-10-01 17:45:39 +09:00
</div>
<div className="edit-set edit-set-mt15">
<label className="edit-set-file-label" htmlFor="file_pdf">
2021-10-01 17:45:39 +09:00
PDFアップロード
<input type="file" name="file_pdf" accept=".pdf" id="file_pdf" />
</label>
</div>
<div className="edit-set edit-set-mt15">
<label className="edit-set-file-label" htmlFor="file_image">
2021-10-01 17:45:39 +09:00
画像アップロード
<input type="file" name="file_image" accept=".png, .jpg, .jpeg" id="file_image" />
</label>
</div>
<div className="p-file-image">
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy01.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy02.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy03.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy04.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy05.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy01.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy02.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy03.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy04.jpg" alt="" /></figure>
<figure className="image-upload"><img src="../../../assets/img/dummy/post-dummy05.jpg" alt="" /></figure>
</div>
<div className="edit-set edit-set-send">
<label htmlFor="allmember_send">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="allmember_send" id="allmember_send" />全員に送信</label>
</div>
<div className="edit-set-mt5 edit-set-send">
<label htmlFor="pickup_send">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="pickup_send" id="pickup_send" />選んで送信</label>
</div>
<div className="checkbox-wrap edit-bg">
<div className="checkbox">
<label htmlFor="user_name01">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="chk[]" id="user_name01" />田中 達也</label>
</div>
<div className="checkbox">
<label htmlFor="user_name02">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="chk[]" id="user_name02" />田中 達也</label>
</div>
<div className="checkbox">
<label htmlFor="user_name03">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="chk[]" id="user_name03" />田中 達也</label>
</div>
<div className="checkbox">
<label htmlFor="user_name04">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="chk[]" id="user_name04" />田中 達也</label>
</div>
<div className="checkbox">
<label htmlFor="user_name05">
2021-10-01 17:45:39 +09:00
<input className="boolean optional" type="checkbox" name="chk[]" id="user_name05" />田中 達也</label>
</div>
</div>
<button
type="button"
onClick={e => {
e.preventDefault();
handleClick();
}}
className="btn-edit btn-default btn-h70 btn-r14 btn-yellow">ミーティングを更新</button>
2021-10-01 17:45:39 +09:00
</form>
</div>
</div>
</article>
</div>
</div>
</div>
</div>
)
}
export default MeetingEdit;