Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
reservation-service
Commits
400397ec
Commit
400397ec
authored
Oct 10, 2020
by
Choi Ga Young
Browse files
Merge remote-tracking branch 'origin/on_submit' into rkyoung7
parents
4e10c469
7ebd7f6e
Changes
9
Hide whitespace changes
Inline
Side-by-side
server/client/src/Components/Menu.js
View file @
400397ec
...
...
@@ -9,6 +9,10 @@ const Nav = styled.nav`
a {
color: #ffffff;
}
& .logoutBtn:hover {
text-decoration: underline;
}
`
function
Menu
()
{
...
...
@@ -35,7 +39,6 @@ function Menu() {
<
Link
to
=
"
/notice
"
className
=
"
nav-link
"
>
공지사항
<
/Link
>
<
/li
>
<
li
className
=
"
nav-item
"
>
{
console
.
log
(
name
)}
<
Link
to
=
"
/home
"
className
=
"
nav-link
"
>
대관
현황
<
/Link
>
<
/li
>
<
li
className
=
"
nav-item
"
>
...
...
@@ -59,9 +62,13 @@ function Menu() {
대관
확인
/
취소
(
관리자
)
<
/Link
>
<
/li
>
<
/ul
>
<
div
>
<
div
>
{
name
}
님
안녕하세요
.
<
/div
>
<
button
onClick
=
{
logout
}
type
=
"
button
"
>
로그아웃
<
/button
>
<
div
className
=
"
h-100 mr-3
"
>
<
div
className
=
"
text-white text-right font-weight-light
"
><
small
>
{
name
}
님
안녕하세요
<
/small></
div
>
<
div
className
=
"
text-white text-right font-weight-light
"
><
small
>
<
Link
to
=
{{
pathname
:
`/change/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
state
:
{
id
:
localStorage
.
getItem
(
'
_id
'
)
},
}}
>
비밀번호
변경
<
/Link> /
<
span
className
=
"
logoutBtn
"
onClick
=
{
logout
}
>
로그아웃
<
/span></
small
><
/div
>
<
/div
>
<
/div
>
<
/Nav
>
...
...
server/client/src/Pages/ApplyPage.js
View file @
400397ec
...
...
@@ -21,6 +21,30 @@ function Apply(props) {
}}
/>
;
}
function
time
(
starttime
)
{
console
.
log
(
starttime
)
if
(
starttime
==
21
)
{
return
(
<
Field
as
=
"
select
"
name
=
"
usetime
"
>
<
option
value
=
""
>
이용시간을
선택하세요
<
/option
>
<
option
value
=
"
1
"
>
1
시간
<
/option
>
<
/Field>
)
}
if
(
starttime
==
20
)
{
return
(
<
Field
as
=
"
select
"
name
=
"
usetime
"
>
<
option
value
=
""
>
이용시간을
선택하세요
<
/option
>
<
option
value
=
"
1
"
>
1
시간
<
/option
>
<
option
value
=
"
2
"
>
2
시간
<
/option
>
<
/Field>
)
}
return
(
<
Field
as
=
"
select
"
name
=
"
usetime
"
>
<
option
value
=
""
>
이용시간을
선택하세요
<
/option
>
<
option
value
=
"
1
"
>
1
시간
<
/option
>
<
option
value
=
"
2
"
>
2
시간
<
/option
>
<
option
value
=
"
3
"
>
3
시간
<
/option
>
<
/Field>
)
}
function
getUser
()
{
axios
.
get
(
`/users/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
...
...
@@ -44,7 +68,8 @@ function Apply(props) {
initialValues
=
{{
_id
:
`
${
props
.
match
.
params
.
id
}
`
,
date
:
''
,
time
:
''
,
starttime
:
''
,
usetime
:
''
,
room
:
''
,
reason
:
''
,
students
:
[
...
...
@@ -56,8 +81,6 @@ function Apply(props) {
validationSchema
=
{
Yup
.
object
({
date
:
Yup
.
string
()
.
required
(
'
날짜를 입력해주세요.
'
),
time
:
Yup
.
string
()
.
required
(
'
시간을 입력해주세요.
'
),
room
:
Yup
.
string
()
.
required
(
'
강의실 번호를 입력해주세요.
'
),
reason
:
Yup
.
string
()
...
...
@@ -92,7 +115,6 @@ function Apply(props) {
isSubmitting
,
})
=>
(
<
div
className
=
"
row justify-content-center align-items-center
"
>
{
console
.
log
(
user
)}
<
form
onSubmit
=
{
handleSubmit
}
className
=
"
col-sm-3
"
>
<
div
className
=
"
form-group mb-4
"
>
<
label
>
대표자
<
/label
>
...
...
@@ -102,27 +124,37 @@ function Apply(props) {
<
label
>
신청날짜
<
/label
>
<
input
className
=
{(
touched
.
date
&&
errors
.
date
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
number
"
type
=
"
text
"
name
=
"
date
"
{...
getFieldProps
(
'
date
'
)}
placeholder
=
"
2020
mmdd
"
placeholder
=
"
yyyy-
mm
-
dd
"
/>
{
touched
.
date
&&
errors
.
date
?
(
<
div
className
=
"
invalid-feedback text-left
"
>
{
errors
.
date
}
<
/div
>
)
:
null
}
<
/div
>
<
div
className
=
"
form-group mb-4
"
>
<
label
>
이용시작시간
<
/label
>
<
Field
as
=
"
select
"
name
=
"
starttime
"
>
<
option
value
=
""
>
이용시작시간
<
/option
>
<
option
value
=
"
9
"
>
9
시
<
/option
>
<
option
value
=
"
10
"
>
10
시
<
/option
>
<
option
value
=
"
11
"
>
11
시
<
/option
>
<
option
value
=
"
12
"
>
12
시
<
/option
>
<
option
value
=
"
13
"
>
13
시
<
/option
>
<
option
value
=
"
14
"
>
14
시
<
/option
>
<
option
value
=
"
15
"
>
15
시
<
/option
>
<
option
value
=
"
16
"
>
16
시
<
/option
>
<
option
value
=
"
17
"
>
17
시
<
/option
>
<
option
value
=
"
18
"
>
18
시
<
/option
>
<
option
value
=
"
19
"
>
19
시
<
/option
>
<
option
value
=
"
20
"
>
20
시
<
/option
>
<
option
value
=
"
21
"
>
21
시
<
/option
>
<
/Field
>
<
/div
>
<
div
className
=
"
form-group mb-4
"
>
<
label
>
이용시간
<
/label
>
<
input
className
=
{(
touched
.
time
&&
errors
.
time
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
text
"
name
=
"
time
"
{...
getFieldProps
(
'
time
'
)}
placeholder
=
"
ex) 11:00~14:00
"
/>
{
touched
.
time
&&
errors
.
time
?
(
<
div
className
=
"
invalid-feedback text-left
"
>
{
errors
.
time
}
<
/div
>
)
:
null
}
{
time
(
values
.
starttime
)}
<
/div
>
<
div
className
=
"
form-group mb-4
"
>
<
label
>
강의실
<
/label
>
...
...
server/client/src/Pages/CheckPage.js
View file @
400397ec
...
...
@@ -8,7 +8,7 @@ function Check(props) {
useEffect
(()
=>
{
getReserve
();
},
[])
function
getReserve
()
{
axios
.
get
(
`/reserves/
${
props
.
match
.
params
.
id
}
`
,
{
headers
:
{
authorization
:
localStorage
.
getItem
(
'
token
'
)
},
...
...
@@ -56,10 +56,10 @@ function Check(props) {
return
(
<
tr
key
=
{
index
}
>
<
td
>
{
reserve
.
date
}
<
/td
>
<
td
>
{
reserve
.
time
}
<
/td
>
<
td
>
{
reserve
.
starttime
}
시
~
{(
Number
(
reserve
.
starttime
)
+
reserve
.
usetime
)}
시
<
/td
>
<
td
>
{
reserve
.
room
}
<
/td
>
<
td
>
{
reserve
.
num
}
<
/td
>
<
td
>
{
reserve
.
approve
?
"
사용허가
"
:
"
글쎄...
"
}
<
/td
>
<
td
>
{
reserve
.
approve
?
"
사용허가
"
:
"
글쎄...
"
}
<
/td
>
<
td
>
<
button
onClick
=
{()
=>
remove
(
index
)}
className
=
"
btn btn-danger
"
>
취소
...
...
server/client/src/Pages/HomePage.js
View file @
400397ec
...
...
@@ -10,10 +10,6 @@ function Home() {
home
<
button
><
Link
to
=
"
/login
"
>
로그인
<
/Link></
button
>
<
button
><
Link
to
=
"
/signup
"
>
회원가입
<
/Link></
button
>
<
button
><
Link
to
=
{{
pathname
:
`/change/
${
localStorage
.
getItem
(
'
_id
'
)}
`
,
state
:
{
id
:
localStorage
.
getItem
(
'
_id
'
)
},
}}
>
비밀번호
수정
<
/Link></
button
>
<
/div
>
<
/div
>
)
...
...
server/client/src/Pages/LoginPage.js
View file @
400397ec
...
...
@@ -109,7 +109,7 @@ function Login() {
<
div
className
=
{
mobile
?
"
mob-head
"
:
""
}
>
<
img
className
=
{
mobile
?
"
mob-img
"
:
"
img-fluid
"
}
src
=
{
Logo
}
/
>
<
div
className
=
{
"
d-flex
"
+
(
mobile
?
"
align-items-center
"
:
"
justify-content-center
"
)}
>
<
h1
className
=
"
font-weight-bold text-white
"
>
고려대학교
<
br
/>
대관
서비스
<
/h1
>
<
h1
className
=
"
font-weight-bold text-white
text-center
"
>
고려대학교
<
br
/>
대관
서비스
<
/h1
>
<
/div
>
<
/div
>
<
/Asd
>
...
...
server/client/src/Pages/NoticePage.js
View file @
400397ec
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
React
,
{
useState
,
useEffect
,
useRef
}
from
'
react
'
;
import
Menu
from
'
../Components/Menu
'
;
import
axios
from
'
axios
'
;
import
styled
from
'
styled-components
'
;
function
Notice
()
{
const
[
notices
,
setNotices
]
=
useState
([]);
...
...
@@ -9,6 +10,19 @@ function Notice() {
getNotice
();
},
[]);
function
dateForm
(
day
)
{
const
post_day
=
new
Date
(
day
);
let
year
=
post_day
.
getFullYear
();
let
month
=
post_day
.
getMonth
()
+
1
;
let
date
=
post_day
.
getDate
();
month
=
month
<
10
?
'
0
'
+
month
:
month
;
date
=
date
<
10
?
'
0
'
+
date
:
date
;
const
new_date
=
year
+
"
-
"
+
month
+
"
-
"
+
date
;
return
new_date
}
function
getNotice
()
{
axios
.
get
(
`/notices`
)
.
then
(
res
=>
{
...
...
@@ -25,13 +39,32 @@ function Notice() {
return
(
<
div
>
<
Menu
/>
<
div
className
=
"
container
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-12
"
>
{
notices
.
map
((
notice
)
=>
<
div
>
{
notice
.
notice_title
}
<
/div>
)
}
<
div
className
=
"
container-fluid
"
>
<
div
className
=
"
row justify-content-center vw-100 vh-90
"
>
<
div
className
=
"
col-md-7 col-12
"
>
<
h2
className
=
"
p-3 border-bottom
"
>
공지사항
<
/h2
>
<
div
id
=
"
accordion w-90 pt-1
"
>
{
notices
.
map
((
notice
,
index
)
=>
<
div
className
=
"
card
"
>
<
div
className
=
"
card-header collapsed card-link w-100 row m-0 p-1
"
id
=
{
"
Hnotice_
"
+
index
}
data
-
toggle
=
"
collapse
"
href
=
{
"
#notice_
"
+
index
}
>
<
div
>
<
div
className
=
"
col-6 p-0
"
>
{
notice
.
notice_title
}
<
/div
>
<
div
className
=
"
col-3 p-0 text-center
"
>
{
notice
.
notice_author
}
<
/div
>
<
div
className
=
"
col-3 p-0 text-right
"
>
{
dateForm
(
notice
.
post_date
)}
<
/div
>
<
/div
>
<
/div
>
<
div
id
=
{
"
notice_
"
+
index
}
aria
-
labelledby
=
{
"
Hnotice_
"
+
index
}
className
=
"
collapse
"
data
-
parent
=
"
#accordion
"
>
<
div
className
=
"
card-body
"
>
{
notice
.
notice_content
}
<
/div
>
<
/div
>
<
/div
>
)}
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
)
}
...
...
server/client/src/index.js
View file @
400397ec
...
...
@@ -2,8 +2,8 @@ import React from 'react';
import
ReactDOM
from
'
react-dom
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
import
{
BrowserRouter
as
Router
,
Route
,
Redirect
,
Switch
}
from
'
react-router-dom
'
;
//
import 'bootstrap';
//
import 'bootstrap/dist/css/bootstrap.css';
import
'
bootstrap
'
;
import
'
bootstrap/dist/css/bootstrap.css
'
;
import
axios
from
'
axios
'
;
import
{
PrivateRoute
}
from
'
./Components/PrivateRoute
'
;
...
...
server/routes/reserves.js
View file @
400397ec
...
...
@@ -11,9 +11,11 @@ router.post('/', function (req, res, next) {
const
reserve
=
new
Reserve
({
user
:
req
.
body
.
_id
,
date
:
req
.
body
.
date
,
time
:
req
.
body
.
time
,
starttime
:
Number
(
req
.
body
.
starttime
),
usetime
:
Number
(
req
.
body
.
usetime
),
start
:
`
${
req
.
body
.
date
}
T`
+
`
${
req
.
body
.
starttime
}
:00:00`
,
end
:
`
${
req
.
body
.
date
}
T`
+
`
${
Number
(
req
.
body
.
starttime
)
+
Number
(
req
.
body
.
usetime
)}
:00:00`
,
room
:
req
.
body
.
room
,
name
:
req
.
body
.
name
,
reason
:
req
.
body
.
reason
,
students
:
req
.
body
.
students
,
approve
:
req
.
body
.
approve
,
...
...
@@ -35,6 +37,7 @@ router.post('/', function (req, res, next) {
router
.
get
(
'
/:_id
'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'
/reserves get req.params
'
,
req
.
params
)
Reserve
.
find
({
user
:
req
.
params
.
_id
},
function
(
err
,
reserve
)
{
console
.
log
(
'
id.name
'
,
reserve
)
if
(
err
)
return
res
.
status
(
500
).
json
({
error
:
err
});
console
.
log
(
'
reserve list
'
,
reserve
)
res
.
status
(
201
).
json
(
reserve
);
...
...
server/schemas/reserve.js
View file @
400397ec
...
...
@@ -11,15 +11,20 @@ const reserveSchema = new Schema({
date
:
{
type
:
String
,
},
time
:
{
starttime
:
{
type
:
Number
,
},
usetime
:
{
type
:
Number
,
},
start
:
{
type
:
String
,
},
room
:
{
end
:
{
type
:
String
,
},
name
:
{
//대표자 이름
room
:
{
type
:
String
,
},
...
...
@@ -39,8 +44,6 @@ const reserveSchema = new Schema({
num
:
{
type
:
Number
,
},
});
module
.
exports
=
mongoose
.
model
(
'
Reserve
'
,
reserveSchema
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment