Skip to content

Commit

Permalink
Merge pull request #34 from SoluxProject/feature/#33
Browse files Browse the repository at this point in the history
Feature/#33
  • Loading branch information
Sae-byeol authored Aug 18, 2021
2 parents 1649cf1 + 69b8853 commit 909f27b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
9 changes: 8 additions & 1 deletion src/ExamDday.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

.ExamDdayHeadBlock{
padding-top: 48px;

padding-left: 32px;
padding-right: 32px;
padding-bottom: 24px;
Expand Down Expand Up @@ -121,7 +122,13 @@
opacity: 0.5;
}
#EditExamDay{

width: 60px;
}
#EditExamMonth{
width: 60px;
}
.EditDdayContent{
width: 150px;
}
.Examchild{
display: flex;
Expand Down
30 changes: 15 additions & 15 deletions src/component/ExamDday.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ export default function ExamDday({location}){

const id=location.state.id;

const [month, setMonth] = useState(0);
const [date, setDate] = useState(0);

const [month, setMonth] = useState('');
const [date, setDate] = useState('');
const [exam,setExam]=useState('');
const [year, setYear]=useState(2021);

Expand All @@ -33,27 +34,25 @@ export default function ExamDday({location}){
}, []);

const showExamList = (res)=>{
if(res.data.success===undefined) {
setExamListExist(true);
console.log(res.data);
setExamList(res.data);
}
else {
setExamListExist(false);
alert(res.data.message);
}
}

const submitExam = ()=>{
console.log("submit");
axios.post("/manage/insert",{
manageid:id,
date: new Date(year, month-1, date+1),
subject: exam
})
.then(()=>{
setMonth(0);
setDate(0);
.then((res)=>{
setMonth('');
setDate('');
setExam('');
showExamList(res);
})

}
const calcMonth =(date) =>{
var date = new Date(Date.parse(date));
Expand Down Expand Up @@ -139,12 +138,12 @@ export default function ExamDday({location}){
</div>
<div className="InsertFormPositioner">
<div className="InsertForm ExamInsertForm">
<input className="ExamInputDay" id="InputMonth" placeholder="월" onChange = {(e) => {setMonth(Number(e.target.value))}} />
<input className="ExamInputDay" id="InputDate" placeholder="일" onChange = {(e) => {setDate(Number(e.target.value))}}/>
<input className="ExamDdayInput" placeholder="시험" onChange = {(e) => {setExam(e.target.value)}}/>
<input className="ExamInputDay" id="InputMonth" autoFocus placeholder="월" value={month} onChange = {(e) => {setMonth(Number(e.target.value))}} />
<input className="ExamInputDay" id="InputDate" autoFocus placeholder="일" value={date} onChange = {(e) => {setDate(Number(e.target.value))}}/>
<input className="ExamDdayInput" autoFocus placeholder="시험" value={exam} onChange = {(e) => {setExam(e.target.value)}}/>
</div>
</div>
<button className="CircleButton" onClick={()=>submitExam} >
<button className="CircleButton" onClick={submitExam} >
<MdAdd />
</button>
{examListExist ?
Expand All @@ -166,6 +165,7 @@ export default function ExamDday({location}){
{isEdit && (index === val.index) &&
(
<div className="Examchild">

<input className="EditDday" id="EditExamMonth" placeholder="월" onChange = {(e) => {setNewMonth(Number(e.target.value))}} />
<input className="EditDday" id="EditExamDay" placeholder="일" onChange = {(e) => {setNewDate(Number(e.target.value))}} />
<button className="DdayEditButton" onClick={()=>changeExamDate(val.index)}>
Expand Down

0 comments on commit 909f27b

Please sign in to comment.