Commit 7d9a695e authored by Lee Jin Ju's avatar Lee Jin Ju
Browse files

Merge remote-tracking branch 'origin/cherry' into hijinju

parents 55560869 ae1406c4
import axios from 'axios';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import styled from 'styled-components'; import styled from 'styled-components';
......
...@@ -3,10 +3,18 @@ import Calendar from '@toast-ui/react-calendar'; ...@@ -3,10 +3,18 @@ import Calendar from '@toast-ui/react-calendar';
import "tui-calendar/dist/tui-calendar.css"; import "tui-calendar/dist/tui-calendar.css";
import "tui-date-picker/dist/tui-date-picker.css"; import "tui-date-picker/dist/tui-date-picker.css";
import "tui-time-picker/dist/tui-time-picker.css"; import "tui-time-picker/dist/tui-time-picker.css";
<<<<<<< HEAD
function Cal(calledday) { function Cal(calledday) {
=======
import axios from 'axios';
function Cal(props) {
>>>>>>> origin/cherry
const calendarRef = useRef(); const calendarRef = useRef();
const [day, setDay] = useState(calledday); const [reserve, setReserve] = useState([]);
// const [day, setDay] = useState(props.calledday);
const [day, setDay] = useState(props.day);
const [myTheme, setMyTheme] = useState({ const [myTheme, setMyTheme] = useState({
'common.dayname.color': '#333', 'common.dayname.color': '#333',
'common.today.color': '#333', 'common.today.color': '#333',
...@@ -15,6 +23,7 @@ function Cal(calledday) { ...@@ -15,6 +23,7 @@ function Cal(calledday) {
// Theme object to extends default dark theme. // Theme object to extends default dark theme.
}); });
<<<<<<< HEAD
function getDataAction(target) { function getDataAction(target) {
return target.dataset ? target.dataset.action : target.getAttribute('data-action'); return target.dataset ? target.dataset.action : target.getAttribute('data-action');
} }
...@@ -46,6 +55,59 @@ function Cal(calledday) { ...@@ -46,6 +55,59 @@ function Cal(calledday) {
cal.setDate(new Date(day)); cal.setDate(new Date(day));
cal.changeView('week', true); cal.changeView('week', true);
cal.today(new Date(day)); cal.today(new Date(day));
=======
const yj = [
{
id: 'a',
calendarId: 'Subject',
category: 'time',
start: '2020-10-27T11:00:00',
end: '2020-10-27T12:00:00',
},
{
id: 'b',
calendarId: 'Subject',
category: 'time',
start: '2020-10-28T10:00:00',
end: '2020-10-28T11:00:00',
},
{
id: '3',
calendarId: 'Subject',
category: 'time',
start: '2020-10-29T11:00:00',
end: '2020-10-29T15:00:00',
}
]
function getReserve(room) {
console.log("room", room)
// setReserve({
// id: room,
// calendarId: 'Subject',
// category: 'time',
// })
axios.get(`/reserves/room/${room}`, {
headers: { authorization: localStorage.getItem('token') },
})
.then(res => {
const reserves = res.data.map(item => ({
id: item._id,
start: item.start,
end: item.end,
calendarId: 'Subject',
category: 'time',
}))
console.log("room list", res.data);
setReserve(reserves);
// console.log("room list",res.data);
})
.catch(err => {
alert(err.error)
});
>>>>>>> origin/cherry
} }
useEffect(() => { useEffect(() => {
...@@ -72,9 +134,20 @@ function Cal(calledday) { ...@@ -72,9 +134,20 @@ function Cal(calledday) {
// return (console.log(isFocused)) // return (console.log(isFocused))
// }); // });
// setReserve([
// {
// id: '3',
// calendarId: 'Subject',
// category: 'time',
// start: '2020-10-29T11:00:00',
// end: '2020-10-29T15:00:00',
// }
// ])
getReserve(props.room);
}, [day]) }, [day])
return ( return (
<<<<<<< HEAD
<div className="container mt-3"> <div className="container mt-3">
<div class="tui-datepicker-input tui-datetime-input tui-has-focus"> <div class="tui-datepicker-input tui-datetime-input tui-has-focus">
<input type="text" id="datepicker-input" aria-label="Date-Time"></input> <input type="text" id="datepicker-input" aria-label="Date-Time"></input>
...@@ -145,6 +218,79 @@ function Cal(calledday) { ...@@ -145,6 +218,79 @@ function Cal(calledday) {
hourEnd: 23 hourEnd: 23
}} }}
/> />
=======
<div>{
console.log("reserve", reserve)}
<Calendar
height="100%"
calendars={[
{
id: 'Subject',
bgColor: '#a9a9a9',
borderColor: '#a9a9a9',
isReadOnly: 'true'
}
]}
view="week"
disableDblClick={false}
disableClick={true}
isReadOnly={false}
// template={
// popupIsAllDay=function {
// return display: "none"
// }
// }
schedules={ reserve
// reserve.map(item=>({id: item._id,
// start: item.start,
// end: item.end,
// calendarId: 'Subject',
// category: 'time',}))
// [
// {
// id: 'a',
// calendarId: 'Subject',
// category: 'time',
// start: '2020-10-27T11:00:00',
// end: '2020-10-27T12:00:00',
// },
// {
// id: 'b',
// calendarId: 'Subject',
// category: 'time',
// start: '2020-10-28T10:00:00',
// end: '2020-10-28T11:00:00',
// },
// {
// id: '3',
// calendarId: 'Subject',
// category: 'time',
// start: '2020-10-29T11:00:00',
// end: '2020-10-29T15:00:00',
// }
// ]
}
scheduleView={['time']}
taskView={false}
theme={myTheme}
timezones={[
{
timezoneOffset: 540,
displayLabel: 'GMT+09:00',
tooltip: 'Seoul'
},
]}
useDetailPopup
useCreationPopup
view={"week"}
week={{
workweek: true,
hourStart: 8,
hourEnd: 23
}}
/>
>>>>>>> origin/cherry
</div> </div>
) )
} }
......
...@@ -6,13 +6,15 @@ const router = express.Router(); ...@@ -6,13 +6,15 @@ const router = express.Router();
router.get('/', function (req, res, next) { router.get('/', function (req, res, next) {
Notice.find({}).sort({ post_date: -1 }) Notice.find({}).sort({ post_date: -1 })
.then((notices) => { .then((notices) => {
res.json(notices); res.status(201).json(notices);
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
next(err); next(err);
}); });
// res.status(404).json({error:"없음."})
res.status(201).json(notices);
}); });
module.exports = router; module.exports = router;
\ No newline at end of file
...@@ -5,7 +5,11 @@ module.exports = () => { ...@@ -5,7 +5,11 @@ module.exports = () => {
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
mongoose.set('debug', true); mongoose.set('debug', true);
} }
<<<<<<< HEAD
mongoose.connect('mongodb://hijinju:highlight@localhost:27017/admin', { mongoose.connect('mongodb://hijinju:highlight@localhost:27017/admin', {
=======
mongoose.connect('mongodb://cherry:1q2w3e4r@localhost:27017/admin', {
>>>>>>> origin/cherry
dbName: 'ku_rental', useNewUrlParser: true, useUnifiedTopology: true, dbName: 'ku_rental', useNewUrlParser: true, useUnifiedTopology: true,
}, (error) => { }, (error) => {
if (error) { if (error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment