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
f9eab7b0
Commit
f9eab7b0
authored
Nov 05, 2020
by
Kim, Subin
Browse files
강의실 인원수 제한
parent
f924382a
Changes
6
Hide whitespace changes
Inline
Side-by-side
server/client/src/Pages/ACheckPage.js
View file @
f9eab7b0
...
@@ -29,15 +29,6 @@ function ACheck(props) {
...
@@ -29,15 +29,6 @@ function ACheck(props) {
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
if
(
state
)
return
<
Redirect
to
=
"
/
"
/>
;
function
remove
(
index
)
{
function
remove
(
index
)
{
// axios.delete(`/reserves/${reserve[index]._id}`)
// .then(res => {
// if (res.status === 404) return alert(res.data.error)
// alert("삭제되었습니다!");
// getReserve();
// })
// .catch(err => {
// alert(err.error)
// });
axios
.
put
(
`/reserves/
${
reserve
[
index
].
_id
}
`
)
axios
.
put
(
`/reserves/
${
reserve
[
index
].
_id
}
`
)
.
then
(
res
=>
{
.
then
(
res
=>
{
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
if
(
res
.
status
===
404
)
return
alert
(
res
.
data
.
error
)
...
...
server/client/src/Pages/ApplyPage.js
View file @
f9eab7b0
...
@@ -9,6 +9,7 @@ import { Col, Container, Row } from 'react-bootstrap';
...
@@ -9,6 +9,7 @@ import { Col, Container, Row } from 'react-bootstrap';
function
Apply
(
props
)
{
function
Apply
(
props
)
{
const
[
state
,
setState
]
=
useState
();
const
[
state
,
setState
]
=
useState
();
const
[
user
,
setUser
]
=
useState
({
name
:
""
});
const
[
user
,
setUser
]
=
useState
({
name
:
""
});
const
[
room_Num
,
setRoom_Num
]
=
useState
({
"
9-116
"
:
5
,
"
7-234
"
:
7
,
"
25-101
"
:
10
});
useEffect
(()
=>
{
useEffect
(()
=>
{
getUser
();
getUser
();
...
@@ -59,6 +60,14 @@ function Apply(props) {
...
@@ -59,6 +60,14 @@ function Apply(props) {
});
});
}
}
function
addRoomInfo
(
values
)
{
for
(
let
room
in
room_Num
)
{
if
(
room
===
values
.
room
)
{
values
.
roomInfo
=
room_Num
[
room
]
}
};
}
return
(
return
(
<
div
>
<
div
>
<
Menu
/>
<
Menu
/>
...
@@ -86,7 +95,7 @@ function Apply(props) {
...
@@ -86,7 +95,7 @@ function Apply(props) {
.
required
(
'
대관목적을 입력해주세요.
'
),
.
required
(
'
대관목적을 입력해주세요.
'
),
})}
})}
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
onSubmit
=
{(
values
,
{
setSubmitting
})
=>
{
console
.
log
(
values
)
addRoomInfo
(
values
)
;
axios
({
axios
({
method
:
'
post
'
,
method
:
'
post
'
,
url
:
'
/reserves
'
,
url
:
'
/reserves
'
,
...
...
server/client/src/Pages/ChangePage.js
View file @
f9eab7b0
...
@@ -9,7 +9,6 @@ import styled from 'styled-components';
...
@@ -9,7 +9,6 @@ import styled from 'styled-components';
const
Check
=
styled
.
div
`
const
Check
=
styled
.
div
`
& #reCheck::after {
& #reCheck::after {
content: '새로운 비밀번호를 다시 입력하세요';
content: '새로운 비밀번호를 다시 입력하세요';
}
}
...
...
server/client/src/Pages/HomePage.js
View file @
f9eab7b0
...
@@ -18,6 +18,14 @@ function Home() {
...
@@ -18,6 +18,14 @@ function Home() {
<
li
>
주말
:
이용
불가
<
/li
>
<
li
>
주말
:
이용
불가
<
/li
>
<
/ul
>
<
/ul
>
<
/p
>
<
/p
>
<
p
>
<
strong
>
유의사항
<
/strong
>
<
ul
className
=
"
pl-4
"
>
<
li
>
강의실을
대관하는
대표자를
기준으로
최대
주
6
시간까지
대관이
가능합니다
.
<
/li
>
<
li
>
1
회
대관시
최대
3
시간까지
이용이
가능합니다
.
(
1
시간
단위로
대관
가능
)
<
/li
>
<
li
><
strong
style
=
{{
color
:
"
red
"
}}
>
대관
시간
이외
강의실을
이용하다
적발될
경우
한달
간
강의실
이용이
불가합니다
.
<
/strong></
li
>
<
/ul
>
<
/p
>
<
Tabs
defaultActiveKey
=
"
9-116
"
id
=
"
uncontrolled-tab-example
"
onSelect
=
{(
k
)
=>
setKey
(
k
)}
>
<
Tabs
defaultActiveKey
=
"
9-116
"
id
=
"
uncontrolled-tab-example
"
onSelect
=
{(
k
)
=>
setKey
(
k
)}
>
<
Tab
eventKey
=
"
9-116
"
title
=
"
9-116
"
>
<
Tab
eventKey
=
"
9-116
"
title
=
"
9-116
"
>
<
Schedule
room
=
{
key
}
/
>
<
Schedule
room
=
{
key
}
/
>
...
@@ -29,14 +37,6 @@ function Home() {
...
@@ -29,14 +37,6 @@ function Home() {
<
Schedule
room
=
{
key
}
/
>
<
Schedule
room
=
{
key
}
/
>
<
/Tab
>
<
/Tab
>
<
/Tabs
>
<
/Tabs
>
<
p
>
<
strong
>
유의사항
<
/strong
>
<
ul
className
=
"
pl-4
"
>
<
li
>
강의실을
대관하는
대표자를
기준으로
최대
주
6
시간까지
대관이
가능합니다
.
<
/li
>
<
li
>
1
회
대관시
최대
3
시간까지
이용이
가능합니다
.
(
1
시간
단위로
대관
가능
)
<
/li
>
<
li
><
strong
style
=
{{
color
:
"
red
"
}}
>
대관
시간
이외
강의실을
이용하다
적발될
경우
한달
간
강의실
이용이
불가합니다
.
<
/strong></
li
>
<
/ul
>
<
/p
>
<
/Container
>
<
/Container
>
<
/div
>
<
/div
>
)
)
...
...
server/client/src/Pages/LoginPage.js
View file @
f9eab7b0
...
@@ -159,7 +159,7 @@ function Login() {
...
@@ -159,7 +159,7 @@ function Login() {
<
div
className
=
{
"
form-group m-0
"
+
(
mobile
?
"
mb-2
"
:
"
"
)}
>
<
div
className
=
{
"
form-group m-0
"
+
(
mobile
?
"
mb-2
"
:
"
"
)}
>
<
input
<
input
className
=
{(
touched
.
id
&&
errors
.
id
?
'
form-control is-invalid
'
:
"
form-control
"
)}
className
=
{(
touched
.
id
&&
errors
.
id
?
'
form-control is-invalid
'
:
"
form-control
"
)}
type
=
"
number
"
type
=
"
text
"
name
=
"
id
"
name
=
"
id
"
{...
getFieldProps
(
'
id
'
)}
{...
getFieldProps
(
'
id
'
)}
placeholder
=
"
Input Student Id
"
placeholder
=
"
Input Student Id
"
...
...
server/routes/reserves.js
View file @
f9eab7b0
...
@@ -7,6 +7,16 @@ const router = express.Router();
...
@@ -7,6 +7,16 @@ const router = express.Router();
router
.
post
(
'
/
'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'
/
'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'
/reserve post req.body
'
,
req
.
body
)
console
.
log
(
'
/reserve post req.body
'
,
req
.
body
)
let
num
=
req
.
body
.
students
.
length
+
1
;
for
(
let
ele
of
req
.
body
.
students
)
{
if
(
ele
.
member
===
''
)
{
num
-=
1
;
};
};
if
(
req
.
body
.
roomInfo
>
num
)
return
res
.
status
(
404
).
json
({
error
:
"
사용할 강의실의 최소 인원을 맞춰주세요.
"
})
const
reserve
=
new
Reserve
({
const
reserve
=
new
Reserve
({
user
:
req
.
body
.
_id
,
user
:
req
.
body
.
_id
,
date
:
req
.
body
.
date
,
date
:
req
.
body
.
date
,
...
@@ -69,7 +79,6 @@ router.get('/room/:room', function (req, res, next) {
...
@@ -69,7 +79,6 @@ router.get('/room/:room', function (req, res, next) {
})
})
})
})
// router.get('/:_id', verifyToken, function (req, res, next) {
router
.
get
(
'
/:_id
'
,
function
(
req
,
res
,
next
)
{
router
.
get
(
'
/:_id
'
,
function
(
req
,
res
,
next
)
{
console
.
log
(
'
/reserves get req.params
'
,
req
.
params
)
console
.
log
(
'
/reserves get req.params
'
,
req
.
params
)
Reserve
.
find
({
user
:
req
.
params
.
_id
},
function
(
err
,
reserve
)
{
Reserve
.
find
({
user
:
req
.
params
.
_id
},
function
(
err
,
reserve
)
{
...
...
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