Skip to content
Snippets Groups Projects
Commit 1385ecdb authored by 이권민's avatar 이권민
Browse files

[ADD] UserTimeInfo 투표 시간 설정 반영

parent 9213ca77
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,7 @@ function CaculateWeek({ nowYear, nowMonth, week, availableSchedules, availableTi ...@@ -83,7 +83,7 @@ function CaculateWeek({ nowYear, nowMonth, week, availableSchedules, availableTi
const d = (week - 1) * 7 + j - firstDay+1; const d = (week - 1) * 7 + j - firstDay+1;
const newDate = new Date(nowYear, nowMonth-1, d,9); const newDate = new Date(nowYear, nowMonth-1, d,9);
if(i===0){ if(i===startTime){
let cn = "cella"; let cn = "cella";
if(d < 1)cn = "cellb" if(d < 1)cn = "cellb"
else if(d > lastDate)cn = "cellb" else if(d > lastDate)cn = "cellb"
......
...@@ -57,10 +57,12 @@ function HomeParticipateForm() { ...@@ -57,10 +57,12 @@ function HomeParticipateForm() {
const response = await axios.get(`http://localhost:3000/meetings/${id}/`); const response = await axios.get(`http://localhost:3000/meetings/${id}/`);
const startDate = response.data.startDate; const startDate = response.data.startDate;
const endDate = response.data.endDate; const endDate = response.data.endDate;
const startTime = response.data.availableVotingStartTime;
const endTime = response.data.availableVotingEndTime;
try{ try{
const response = await axios.get(`http://localhost:3000/meetings/${id}/my/schedules`); const response = await axios.get(`http://localhost:3000/meetings/${id}/my/schedules`);
// console.log(startDate, endDate); // console.log(startDate, endDate);
navigate('UserTimeInfo', { state: { id:id, startDate: startDate, endDate: endDate, schedules:response.data.schedules }}); navigate('UserTimeInfo', { state: { id:id, startTime:startTime, endTime:endTime, startDate: startDate, endDate: endDate, schedules:response.data.schedules }});
} }
catch(e){ catch(e){
console.log(e); console.log(e);
...@@ -114,10 +116,12 @@ function HomeParticipateForm() { ...@@ -114,10 +116,12 @@ function HomeParticipateForm() {
const response = await axios.get(`http://localhost:3000/meetings/${id}/`); const response = await axios.get(`http://localhost:3000/meetings/${id}/`);
const startDate = response.data.startDate; const startDate = response.data.startDate;
const endDate = response.data.endDate; const endDate = response.data.endDate;
const startTime = response.data.availableVotingStartTime;
const endTime = response.data.availableVotingEndTime;
try{ try{
const response = await axios.get(`http://localhost:3000/meetings/${id}/my/schedules`); const response = await axios.get(`http://localhost:3000/meetings/${id}/my/schedules`);
// console.log(startDate, endDate); // console.log(startDate, endDate);
navigate('UserTimeInfo', { state: { id:id, startDate: startDate, endDate: endDate, schedules:response.data.schedules }}); navigate('UserTimeInfo', { state: { id:id, startTime:startTime, endTime:endTime, startDate: startDate, endDate: endDate, schedules:response.data.schedules }});
} }
catch(e){ catch(e){
console.log(e); console.log(e);
......
...@@ -21,8 +21,23 @@ function UserTimeInfo() { ...@@ -21,8 +21,23 @@ function UserTimeInfo() {
const [availableTimes, setAvailableTimes] = useState(at); const [availableTimes, setAvailableTimes] = useState(at);
const {id} = useParams(); const {id} = useParams();
const [startTime, setStartTime] = useState(0); let st = 0;
const [endTime, setEndTime] = useState(10); let et = 48;
if(location.state.startTime){
st = location.state.startTime;
const sta = st.split(':');
st = sta[0]*2+sta[1]/30;
}
if(location.state.endTime){
et = location.state.endTime;
const eta = et.split(':');
et = eta[0]*2+eta[1]/30;
}
const [startTime, setStartTime] = useState(st);
const [endTime, setEndTime] = useState(et);
const [today, setToday] = useState(new Date(location.state.startDate)); const [today, setToday] = useState(new Date(location.state.startDate));
const [startDate, setStartDate] = useState(new Date(location.state.startDate)); const [startDate, setStartDate] = useState(new Date(location.state.startDate));
...@@ -69,7 +84,6 @@ function UserTimeInfo() { ...@@ -69,7 +84,6 @@ function UserTimeInfo() {
sat.push(...availableTimes); sat.push(...availableTimes);
} }
sat.sort(); sat.sort();
console.log(state, sat);
const aa = []; const aa = [];
let t = []; let t = [];
...@@ -104,6 +118,7 @@ function UserTimeInfo() { ...@@ -104,6 +118,7 @@ function UserTimeInfo() {
const response = await axios.put(`http://localhost:3000/meetings/${id}/my/schedules/bulk`,{ const response = await axios.put(`http://localhost:3000/meetings/${id}/my/schedules/bulk`,{
schedules: compressedData schedules: compressedData
}); });
alert("제출 완료");
} }
catch (error) { catch (error) {
if (error.response) { if (error.response) {
...@@ -121,6 +136,7 @@ function UserTimeInfo() { ...@@ -121,6 +136,7 @@ function UserTimeInfo() {
} else { } else {
console.error(error); console.error(error);
} }
alert("제출 실패");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment