Commit fd2237cd authored by Ha YeaJin's avatar Ha YeaJin
Browse files

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

parents a22a38ea 915eaee4
...@@ -1431,9 +1431,9 @@ ...@@ -1431,9 +1431,9 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
}, },
"@popperjs/core": { "@popperjs/core": {
"version": "2.5.3", "version": "2.5.4",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.5.3.tgz", "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.5.4.tgz",
"integrity": "sha512-RFwCobxsvZ6j7twS7dHIZQZituMIDJJNHS/qY6iuthVebxS3zhRY+jaC2roEKiAYaVuTcGmX6Luc6YBcf6zJVg==" "integrity": "sha512-ZpKr+WTb8zsajqgDkvCEWgp6d5eJT6Q63Ng2neTbzBO76Lbe91vX/iVIW9dikq+Fs3yEo+ls4cxeXABD2LtcbQ=="
}, },
"@restart/context": { "@restart/context": {
"version": "2.1.4", "version": "2.1.4",
...@@ -8764,9 +8764,9 @@ ...@@ -8764,9 +8764,9 @@
} }
}, },
"moment": { "moment": {
"version": "2.29.0", "version": "2.29.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.0.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
"integrity": "sha512-z6IJ5HXYiuxvFTI6eiQ9dm77uE0gyy1yXNApVHqTcnIKfY9tIwEjlzsZ6u1LQXvVgKeTnv9Xm7NDvJ7lso3MtA==" "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
}, },
"move-concurrently": { "move-concurrently": {
"version": "1.0.1", "version": "1.0.1",
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"bootstrap": "^4.5.3", "bootstrap": "^4.5.3",
"formik": "^2.1.5", "formik": "^2.1.5",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"moment": "^2.29.0", "moment": "^2.29.1",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"react": "^16.13.1", "react": "^16.13.1",
"react-bootstrap": "^1.4.0", "react-bootstrap": "^1.4.0",
......
...@@ -3,107 +3,127 @@ import Calendar from '@toast-ui/react-calendar'; ...@@ -3,107 +3,127 @@ 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";
import moment from 'moment';
function Cal(calledday) { import axios from 'axios';
const calendarRef = useRef();
const [day, setDay] = useState(calledday); function Cal(props) {
const calendarRef = useRef(null);
const [reserve, setReserve] = useState([]);
const [period, setPeriod] = useState();
const [myTheme, setMyTheme] = useState({ const [myTheme, setMyTheme] = useState({
'common.dayname.color': '#333', 'common.dayname.color': '#333',
'common.today.color': '#333', 'common.today.color': '#333',
// 'common.creationGuide.color': 'white',
'common.creationGuide.backgroundColor': 'gray', 'common.creationGuide.backgroundColor': 'gray',
// Theme object to extends default dark theme.
}); });
useEffect(() => { function getReserve(room) {
// const cal = calendarRef.current.getInstance(); axios.get(`/reserves/room/${room}`, {
// cal.setDate(new Date(day)); headers: { authorization: localStorage.getItem('token') },
// cal.changeView('week', false); })
// cal.today(new Date(day)); .then(res => {
const reserves = res.data.map(item => ({
id: item._id,
start: item.start,
end: item.end,
calendarId: 'Subject',
category: 'time',
}))
setReserve(reserves);
})
.catch(err => {
alert(err.error)
});
}
function getDataAction(target) {
return target.dataset ? target.dataset.action : target.getAttribute('data-action');
}
// calendar.on('clickSchedule', function (event) { function onClickNavi(e) {
// const schedule = event.schedule; const cal = calendarRef.current.getInstance();
const action = getDataAction(e.target);
// if (lastClickSchedule) { switch (action) {
// calendar.updateSchedule(lastClickSchedule.id, lastClickSchedule.calendarId, { case 'move-prev':
// isFocused: false, cal.prev();
// }); break;
// } case 'move-next':
// calendar.updateSchedule(schedule.id, schedule.calendarId, { cal.next();
// isFocused: true, break;
// }); case 'move-today':
cal.today();
break;
default:
return;
}
// lastClickSchedule = schedule; setRenderRangeText();
// // open detail view }
// return (console.log(isFocused)) function setRenderRangeText() {
// }); const cal = calendarRef.current.getInstance();
let html = [];
html.push(moment(cal.getDateRangeStart().getTime()).format('YYYY.MM.DD'));
html.push(' ~ ');
html.push(moment(cal.getDateRangeEnd().getTime()).format(' MM.DD'));
setPeriod(html.join(''))
}
}, [day]) useEffect(() => {
setRenderRangeText();
getReserve(props.room);
}, [props.room])
return ( return (
<Calendar <div>
height="100%" <div id="menu">
calendars={[ <span id="menu-navi" onClick={(e) => onClickNavi(e)}>
{ <button type="button" className="btn btn-default btn-sm move-today" data-action="move-today">Today</button>
id: 'Subject', <button type="button" className="btn btn-default btn-sm move-day" data-action="move-prev">
bgColor: '#a9a9a9', <i class="calendar-icon ic-arrow-line-left" data-action="move-prev"></i>
borderColor: '#a9a9a9', </button>
isReadOnly: 'true' <button type="button" className="btn btn-default btn-sm move-day" data-action="move-next">
} <i className="calendar-icon ic-arrow-line-right" data-action="move-next"></i>
]} </button>
</span>
view="week" <span id="renderRange" className="render-range" style={{ height: "5em" }}>{period}</span>
disableDblClick={false} </div>
disableClick={true} <Calendar
isReadOnly={false} ref={calendarRef}
// template={ height="100%"
// popupIsAllDay=function { calendars={[
// return display: "none" {
// } id: 'Subject',
// } bgColor: '#a9a9a9',
schedules={[ borderColor: '#a9a9a9',
{ isReadOnly: 'true'
id: '1', }
calendarId: 'Subject', ]}
category: 'time', view="week"
start: '2020-10-05T11:00:00', disableDblClick={false}
end: '2020-10-05T12:00:00', disableClick={true}
}, isReadOnly={true}
{ schedules={reserve}
id: '2', scheduleView={['time']}
calendarId: 'Subject', taskView={false}
category: 'time', theme={myTheme}
start: '2020-10-09T10:00:00', timezones={[
end: '2020-10-09T11:00:00', {
}, timezoneOffset: 540,
{ displayLabel: 'GMT+09:00',
id: '3', tooltip: 'Seoul'
calendarId: 'Subject', },
category: 'time', ]}
start: '2020-10-08T11:00:00', useDetailPopup
end: '2020-10-08T15:00:00', useCreationPopup
} view={"week"}
]} week={{
scheduleView={['time']} workweek: true,
taskView={false} hourStart: 8,
theme={myTheme} hourEnd: 23
timezones={[ }}
{ />
timezoneOffset: 540, </div>
displayLabel: 'GMT+09:00',
tooltip: 'Seoul'
},
]}
useDetailPopup
useCreationPopup
view={"week"}
week={{
workweek: true,
hourStart: 8,
hourEnd: 23
}}
/>
) )
} }
......
...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,7 +2,6 @@ import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import 'bootstrap/dist/css/bootstrap.css';
function ACheck(props) { function ACheck(props) {
const [state, setState] = useState() const [state, setState] = useState()
......
...@@ -166,13 +166,12 @@ function Apply(props) { ...@@ -166,13 +166,12 @@ function Apply(props) {
<div className="form-group mb-4"> <div className="form-group mb-4">
<div className={touched.room && errors.room ? "text-danger" : ""}>강의실</div> <div className={touched.room && errors.room ? "text-danger" : ""}>강의실</div>
<input <Field as="select" name="room">
className={(touched.room && errors.room ? 'form-control is-invalid' : "form-control")} <option value="">강의실을 선택하세요</option>
type="text" <option value="9-116">9-116</option>
name="room" <option value="7-234">7-234</option>
{...getFieldProps('room')} <option value="25-101">25-101</option>
placeholder="bn-nnn" </Field>
/>
</div> </div>
<div className="form-group mb-4"> <div className="form-group mb-4">
...@@ -190,27 +189,26 @@ function Apply(props) { ...@@ -190,27 +189,26 @@ function Apply(props) {
<FieldArray name="students"> <FieldArray name="students">
{({ insert, remove, push }) => ( {({ insert, remove, push }) => (
<div> <div>
<label>이용자</label> <div className={touched.date && errors.date ? "text-danger" : ""}>이용자</div>
{ {values.students.map((student, index) => (
values.students.map((student, index) => ( <Row key={index}>
<Row key={index}> <Field
<Field name={`students.${index}.member`}
name={`students.${index}.member`} placeholder="이용자 성함을 입력하세요."
placeholder="이용자 성함을 입력하세요." type="text"
type="text" />
/> <ErrorMessage
<ErrorMessage name={`friends.${index}.name`}
name={`friends.${index}.name`} component="div"
component="div" className="field-error"
className="field-error" />
/> <button
<button type="button"
type="button" className="secondary"
className="secondary" onClick={() => remove(index)}
onClick={() => remove(index)} >X</button>
>X</button> </Row>
</Row> ))}
))}
<button <button
type="button" type="button"
className="btn btn-primary" className="btn btn-primary"
...@@ -222,10 +220,9 @@ function Apply(props) { ...@@ -222,10 +220,9 @@ function Apply(props) {
</div> </div>
<button type="submit" className="btn btn-dark" disabled={isSubmitting}> <button type="submit" className="btn btn-dark" disabled={isSubmitting}>
신청하기 신청하기
</button> </button>
</form> </form>
)} )}
</Formik> </Formik>
</Col> </Col>
</Row> </Row>
...@@ -234,4 +231,4 @@ function Apply(props) { ...@@ -234,4 +231,4 @@ function Apply(props) {
) )
} }
export default Apply export default Apply
\ No newline at end of file
...@@ -4,7 +4,7 @@ import * as Yup from 'yup'; ...@@ -4,7 +4,7 @@ import * as Yup from 'yup';
import axios from 'axios'; import axios from 'axios';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import { Link, Redirect } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import { Container, Button, Col } from 'react-bootstrap'; import { Container, Button, Navbar, Col } from 'react-bootstrap';
import styled from 'styled-components'; import styled from 'styled-components';
const Check = styled.div` const Check = styled.div`
...@@ -30,7 +30,13 @@ function Change(props) { ...@@ -30,7 +30,13 @@ function Change(props) {
// console.log(props) // console.log(props)
return ( return (
<div className=""> <div className="">
<Menu /> {(localStorage.getItem("token") !== null) ? (
<Menu />
) : (
<Menu expand="md" variant="dark">
<Navbar.Brand>회원가입</Navbar.Brand>
</Menu>
)}
<Container fluid className="p-0 vh-90"> <Container fluid className="p-0 vh-90">
<Check className="row justify-content-center m-0"> <Check className="row justify-content-center m-0">
<Col md={4} className="pt-5"> <Col md={4} className="pt-5">
......
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.css';
function Check(props) { function Check(props) {
const [reserve, setReserve] = useState([]); const [reserve, setReserve] = useState([]);
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import Schedule from '../Components/Schedule'; import Schedule from '../Components/Schedule';
import styled from 'styled-components'; import Tabs from 'react-bootstrap/Tabs';
import moment from 'moment'; import Tab from 'react-bootstrap/Tab';
import "moment/locale/ko";
moment.locale("ko", {
week: {
dow: 1
}
});
const Drop = styled.div`
& button {
border solid 1px;
}
`
const Tab = styled.ul`
& a, a:hover, a:active {
color: black;
}
`
function Home() { function Home() {
const [show, setShow] = useState(false); const [key, setKey] = useState('9-116');
const [weeks, setWeeks] = useState([]);
const [days, setDays] = useState([]);
const [sendDate, setSendDate] = useState(null);
useEffect(() => {
Dateform();
}, []);
function Dateform() {
let today = moment();
let weeks = [];
let dates = [];
let sendDates = [];
for (let i = 0; i < 6; i++) {
if (i !== 0) {
today.add(7, 'd');
}
let date = { start: null, end: null };
date.start = today.startOf('week').format("MMM Do");
date.end = today.endOf('week').weekday(4).format("MMM Do");
dates.push(date);
const week = date.start + " ~ " + date.end;
weeks.push(week);
let sendDate = today.startOf('week').format("YYYY-MM-DD");
sendDates.push(sendDate);
};
setWeeks([...weeks])
setDays([...sendDates])
};
function choose(e, index) {
setShow(true)
setSendDate(days[index])
}
return ( return (
<div> <div>
...@@ -75,38 +19,17 @@ function Home() { ...@@ -75,38 +19,17 @@ function Home() {
<li>주말: 이용 불가</li> <li>주말: 이용 불가</li>
</ul> </ul>
</p> </p>
<Drop className="row dropdown mt-1 mb-2"> <Tabs defaultActiveKey="9-116" id="uncontrolled-tab-example" onSelect={(k) => setKey(k)}>
<button className="btn btn-lg dropdown-toggle mx-auto col-5" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <Tab eventKey="9-116" title="9-116">
기간을 선택해주십시오. <Schedule room={key}/>
</button> </Tab>
<div className="dropdown-menu col-5" aria-labelledby="dropdownMenuButton"> <Tab eventKey="7-234" title="7-234">
{weeks.map((week, index) => ( <Schedule room={key}/>
<a className="dropdown-item" id={index} onClick={(e) => choose(e, index)}>{week}</a> </Tab>
))} <Tab eventKey="25-101" title="25-101">
</div> <Schedule room={key}/>
</Drop> </Tab>
<Tab className="nav nav-tabs nav-justified mt-4" id="myTab" role="tablist" style={show ? {} : { display: "none" }}> </Tabs>
<li className="nav-item">
<a className="nav-link active" id="7-tab" data-toggle="tab" href="#tab-7" role="tab" aria-controls="7" aria-selected="true"> 7-223 </a>
</li>
<li className="nav-item">
<a className="nav-link" id="9-tab" data-toggle="tab" href="#tab-9" role="tab" aria-controls="9" aria-selected="false"> 9-116 </a>
</li>
<li className="nav-item">
<a className="nav-link" id="25-tab" data-toggle="tab" href="#tab-25" role="tab" aria-controls="25" aria-selected="false"> 25-307 </a>
</li>
</Tab>
<div className="tab-content row justify-content-center" id="myTabContent" style={show ? {} : { display: "none" }}>
<div className="tab-pane fade show active col-md-11 col-12" id="tab-7" role="tabpanel" aria-labelledby="7-tab">
<Schedule day={sendDate}/>
</div>
<div className="tab-pane fade col-md-11 col-12" id="tab-9" role="tabpanel" aria-labelledby="9-tab">
<Schedule day={sendDate}/>
</div>
<div className="tab-pane fade col-md-11 col-12" id="tab-25" role="tabpanel" aria-labelledby="25-tab">
<Schedule day={sendDate}/>
</div>
</div>
<h3>유의사항</h3> <h3>유의사항</h3>
<p> <p>
<ul> <ul>
......
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect } from 'react';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
...@@ -9,8 +9,6 @@ function Notice() { ...@@ -9,8 +9,6 @@ function Notice() {
const [user, setUser] = useState({ role: "" }) const [user, setUser] = useState({ role: "" })
const [notices, setNotices] = useState([]); const [notices, setNotices] = useState([]);
// const [show, setShow] = useState(false);
useEffect(() => { useEffect(() => {
acheck(); acheck();
getNotice(); getNotice();
...@@ -39,6 +37,7 @@ function Notice() { ...@@ -39,6 +37,7 @@ function Notice() {
alert(err.error) alert(err.error)
}); });
} }
return ( return (
<div> <div>
<Menu /> <Menu />
...@@ -50,16 +49,6 @@ function Notice() { ...@@ -50,16 +49,6 @@ function Notice() {
<Accordion> <Accordion>
{notices.map((notice, index) => <CARD card_index={index} title={notice.notice_title} date={notice.post_date} content={notice.notice_content} /> {notices.map((notice, index) => <CARD card_index={index} title={notice.notice_title} date={notice.post_date} content={notice.notice_content} />
)} )}
{/* <Card>
<Card.Header className="d-flex justify-content-space-between">
<Accordion.Toggle as={Button} variant="link" eventKey={index + 1} className={"d-inline-block " + (show ? "text-wrap" : "text-truncate")} onClick={() => setShow(!show)}>{notice.notice_title}</Accordion.Toggle>
<span className="d-flex align-items-center" style={{ width: "50%" }}>{dateForm(notice.post_date)}</span>
</Card.Header>
<Accordion.Collapse eventKey={index + 1}>
<Card.Body><pre>{notice.notice_content}</pre></Card.Body>
</Accordion.Collapse>
</Card> */}
</Accordion> </Accordion>
</Col> </Col>
</Row> </Row>
......
...@@ -52,21 +52,6 @@ function Write() { ...@@ -52,21 +52,6 @@ function Write() {
getFieldProps, // contain values, handleChange, handleBlur getFieldProps, // contain values, handleChange, handleBlur
isSubmitting, isSubmitting,
}) => ( }) => (
// <Form onSubmit={handleSubmit}>
// <Form.Group>
// <Form.Label variant={touched.name && errors.name ? "danger" : ""}>제목</Form.Label>
// <Form.Control className={(touched.name && errors.name ? 'form-control is-invalid' : "form-control")}
// type="text"
// placeholder="제목"
// title="title"
// {...getFieldProps('title')} />
// </Form.Group>
// <Form.Group>
// <Form.Label>내용</Form.Label>
// <Form.Control as="textarea" rows={10} />
// </Form.Group>
// </Form>
<form onSubmit={handleSubmit} className="d-flex flex-column"> <form onSubmit={handleSubmit} className="d-flex flex-column">
<div className="form-group"> <div className="form-group">
<div className={touched.name && errors.name ? "text-danger" : ""}>제목</div> <div className={touched.name && errors.name ? "text-danger" : ""}>제목</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
...@@ -38,8 +38,8 @@ router.post('/', function (req, res, next) { ...@@ -38,8 +38,8 @@ router.post('/', function (req, res, next) {
const strt = new Date(reserve.start) const strt = new Date(reserve.start)
const endt = new Date(reserve.end) const endt = new Date(reserve.end)
const reserveArr = reserves.map(item => ( const reserveArr = reserves.map(item => (
(strt >= new Date(item.start) && strt <= new Date(item.end)) || (strt >= new Date(item.start) && strt < new Date(item.end)) ||
(endt >= new Date(item.start) && endt <= new Date(item.end)) ? (endt > new Date(item.start) && endt <= new Date(item.end)) ?
"item" : "item" :
null null
)) ))
......
...@@ -5,7 +5,7 @@ module.exports = () => { ...@@ -5,7 +5,7 @@ module.exports = () => {
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
mongoose.set('debug', true); mongoose.set('debug', true);
} }
mongoose.connect('mongodb://hyj:hyj3657@localhost:27017/admin', { mongoose.connect('mongodb://cherry:1q2w3e4r@localhost:27017/admin', {
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