Commit 3ef60774 authored by Kim, Subin's avatar Kim, Subin
Browse files

스케쥴, 신청, 홈 페이지

parent cd650135
...@@ -5,6 +5,9 @@ import "tui-date-picker/dist/tui-date-picker.css"; ...@@ -5,6 +5,9 @@ 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'; import moment from 'moment';
import axios from 'axios'; import axios from 'axios';
import { Image, Button } from 'react-bootstrap';
import leftArrow from '../caret-left-fill.svg';
import rightArrow from '../caret-right-fill.svg';
function Cal(props) { function Cal(props) {
const calendarRef = useRef(null); const calendarRef = useRef(null);
...@@ -76,17 +79,17 @@ function Cal(props) { ...@@ -76,17 +79,17 @@ function Cal(props) {
return ( return (
<div> <div>
<div id="menu"> <div id="menu" className="p-2">
<span id="menu-navi" onClick={(e) => onClickNavi(e)}> <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> <Button variant="default" size="sm" className="move-today" data-action="move-today">Today</Button>
<button type="button" className="btn btn-default btn-sm move-day" data-action="move-prev"> <Button variant="default" size="sm" className="move-day" data-action="move-prev">
<i class="calendar-icon ic-arrow-line-left" data-action="move-prev"></i> <Image class="calendar-icon" src={leftArrow} data-action="move-prev"></Image>
</button> </Button>
<button type="button" className="btn btn-default btn-sm move-day" data-action="move-next"> <Button variant="default" size="sm" className="move-day" data-action="move-next">
<i className="calendar-icon ic-arrow-line-right" data-action="move-next"></i> <Image className="calendar-icon" src={rightArrow} data-action="move-next"></Image>
</button> </Button>
</span> </span>
<span id="renderRange" className="render-range" style={{ height: "5em" }}>{period}</span> <span id="renderRange" className="render-range ml-2" style={{ height: "5em" }}>{period}</span>
</div> </div>
<Calendar <Calendar
ref={calendarRef} ref={calendarRef}
......
...@@ -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()
......
...@@ -2,9 +2,9 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,9 +2,9 @@ import React, { useState, useEffect } from 'react';
import { Formik, Field, ErrorMessage, FieldArray } from 'formik'; import { Formik, Field, ErrorMessage, FieldArray } from 'formik';
import Menu from '../Components/Menu'; import Menu from '../Components/Menu';
import axios from 'axios'; import axios from 'axios';
import 'bootstrap/dist/css/bootstrap.css';
import * as Yup from 'yup'; import * as Yup from 'yup';
import { Redirect } from 'react-router-dom'; import { Redirect } from 'react-router-dom';
import { Col, Container, Row } from 'react-bootstrap';
function Apply(props) { function Apply(props) {
const [state, setState] = useState(); const [state, setState] = useState();
...@@ -23,25 +23,24 @@ function Apply(props) { ...@@ -23,25 +23,24 @@ function Apply(props) {
function time(starttime) { function time(starttime) {
if (starttime == 21) { if (starttime == 21) {
return (<Field as="select" name="usetime"> return (<Field as="select" name="usetime" className="col-12">
<option value="">이용시간 선택하세요</option> <option value="">이용시간선택</option>
<option value="1">1시간</option> <option value="1">1시간</option>
</Field>) </Field>)
} }
if (starttime == 20) { if (starttime == 20) {
return (<Field as="select" name="usetime"> return (<Field as="select" name="usetime" className="col-12">
<option value="">이용시간 선택하세요</option> <option value="">이용시간선택</option>
<option value="1">1시간</option> <option value="1">1시간</option>
<option value="2">2시간</option> <option value="2">2시간</option>
</Field>) </Field>)
} }
return (<Field as="select" name="usetime"> return (<Field as="select" name="usetime" className="col-12">
<option value="">이용시간 선택하세요</option> <option value="">이용시간선택</option>
<option value="1">1시간</option> <option value="1">1시간</option>
<option value="2">2시간</option> <option value="2">2시간</option>
<option value="3">3시간</option> <option value="3">3시간</option>
</Field>) </Field>)
} }
function getUser() { function getUser() {
...@@ -63,6 +62,9 @@ function Apply(props) { ...@@ -63,6 +62,9 @@ function Apply(props) {
return ( return (
<div> <div>
<Menu /> <Menu />
<Container fluid className="mt-3">
<Row className="justify-content-center">
<Col md={5}>
<Formik <Formik
initialValues={{ initialValues={{
_id: `${props.match.params.id}`, _id: `${props.match.params.id}`,
...@@ -80,8 +82,6 @@ function Apply(props) { ...@@ -80,8 +82,6 @@ function Apply(props) {
validationSchema={Yup.object({ validationSchema={Yup.object({
date: Yup.string() date: Yup.string()
.required('날짜를 입력해주세요.'), .required('날짜를 입력해주세요.'),
room: Yup.string()
.required('강의실 번호를 입력해주세요.'),
reason: Yup.string() reason: Yup.string()
.required('대관목적을 입력해주세요.'), .required('대관목적을 입력해주세요.'),
})} })}
...@@ -117,14 +117,13 @@ function Apply(props) { ...@@ -117,14 +117,13 @@ function Apply(props) {
getFieldProps, getFieldProps,
isSubmitting, isSubmitting,
}) => ( }) => (
<div className="row justify-content-center align-items-center"> <form onSubmit={handleSubmit} className="d-flex flex-column">
<form onSubmit={handleSubmit} className="col-sm-3"> <h3 className="form-group font-weight-bold">
<div className="form-group mb-4"> <label className="pr-2">대표자 :</label>{user.name}
<label>대표자</label> </h3>
<div>{user.name}</div>
</div>
<div className="form-group mb-4"> <div className="form-group mb-4">
<label>신청날짜</label> <div className={touched.date && errors.date ? "text-danger" : ""}>신청날짜</div>
<input <input
className={(touched.date && errors.date ? 'form-control is-invalid' : "form-control")} className={(touched.date && errors.date ? 'form-control is-invalid' : "form-control")}
type="text" type="text"
...@@ -132,15 +131,15 @@ function Apply(props) { ...@@ -132,15 +131,15 @@ function Apply(props) {
{...getFieldProps('date')} {...getFieldProps('date')}
placeholder="yyyy-mm-dd" placeholder="yyyy-mm-dd"
/> />
{touched.date && errors.date ? (
<div className="invalid-feedback text-left">{errors.date}</div>
) : null}
</div> </div>
<div className="form-group mb-4">
<Row className="form-group mb-4">
<div className="col-6 pr-0">
<label>이용시작시간</label> <label>이용시작시간</label>
<Field as="select" name="starttime"> <div>
<Field as="select" name="starttime" className="col-12">
<option value="">이용시작시간</option> <option value="">이용시작시간</option>
<option value="9">9</option> <option value="09">9</option>
<option value="10">10</option> <option value="10">10</option>
<option value="11">11</option> <option value="11">11</option>
<option value="12">12</option> <option value="12">12</option>
...@@ -155,25 +154,27 @@ function Apply(props) { ...@@ -155,25 +154,27 @@ function Apply(props) {
<option value="21">21</option> <option value="21">21</option>
</Field> </Field>
</div> </div>
<div className="form-group mb-4"> </div>
<div className="col-6 pl-0">
<label>이용시간</label> <label>이용시간</label>
<div>
{time(values.starttime)} {time(values.starttime)}
</div> </div>
</div>
</Row>
<div className="form-group mb-4"> <div className="form-group mb-4">
<label>강의실</label> <div className={touched.room && errors.room ? "text-danger" : ""}>강의실</div>
<input <Field as="select" name="room" className="col-6">
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>
/>
{touched.room && errors.room ? (
<div className="invalid-feedback text-left">{errors.room}</div>
) : null}
</div> </div>
<div className="form-group mb-4"> <div className="form-group mb-4">
<label>대관목적</label> <div className={touched.reason && errors.reason ? "text-danger" : ""}>대관 목적</div>
<input <input
className={(touched.reason && errors.reason ? 'form-control is-invalid' : "form-control")} className={(touched.reason && errors.reason ? 'form-control is-invalid' : "form-control")}
type="text" type="text"
...@@ -181,23 +182,20 @@ function Apply(props) { ...@@ -181,23 +182,20 @@ function Apply(props) {
{...getFieldProps('reason')} {...getFieldProps('reason')}
placeholder="대관목적을 입력해 주세요." placeholder="대관목적을 입력해 주세요."
/> />
{touched.reason && errors.reason ? (
<div className="invalid-feedback text-left">{errors.reason}</div>
) : null}
</div> </div>
<div className="form-group mb-4"> <div className="form-group mb-4">
<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) => ( <div key={index}>
<div className="row" key={index}>
<div className="col">
<Field <Field
name={`students.${index}.member`} name={`students.${index}.member`}
placeholder="이용자 성함을 입력하세요." placeholder="이용자 이름 입력"
type="text" type="text"
className="col-6 mr-1"
/> />
<ErrorMessage <ErrorMessage
name={`friends.${index}.name`} name={`friends.${index}.name`}
...@@ -208,19 +206,14 @@ function Apply(props) { ...@@ -208,19 +206,14 @@ function Apply(props) {
type="button" type="button"
className="secondary" className="secondary"
onClick={() => remove(index)} onClick={() => remove(index)}
> >X</button>
X
</button>
</div>
</div> </div>
))} ))}
<button <button
type="button" type="button"
className="btn btn-primary" className="btn btn-primary"
onClick={() => push({ member: '' })} onClick={() => push({ member: '' })}
> >추가</button>
추가
</button>
</div> </div>
)} )}
</FieldArray> </FieldArray>
...@@ -229,9 +222,11 @@ function Apply(props) { ...@@ -229,9 +222,11 @@ function Apply(props) {
신청하기 신청하기
</button> </button>
</form> </form>
</div>
)} )}
</Formik> </Formik>
</Col>
</Row>
</Container>
</div> </div>
) )
} }
......
import React, { useState, useEffect } 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 Tabs from 'react-bootstrap/Tabs'; import { Container, Tabs, Tab } from 'react-bootstrap';
import Tab from 'react-bootstrap/Tab';
function Home() { function Home() {
const [key, setKey] = useState('9-116'); const [key, setKey] = useState('9-116');
...@@ -10,7 +9,7 @@ function Home() { ...@@ -10,7 +9,7 @@ function Home() {
return ( return (
<div> <div>
<Menu /> <Menu />
<div className="container mt-3"> <Container className="col-md-10 mt-3">
<h2>대관 현황</h2> <h2>대관 현황</h2>
<p> <p>
<strong>대관 가능 시간</strong> <strong>대관 가능 시간</strong>
...@@ -41,7 +40,7 @@ function Home() { ...@@ -41,7 +40,7 @@ function Home() {
<div className="bg-white"> <div className="bg-white">
<h6>고려대학교 대관시스템</h6> <h6>고려대학교 대관시스템</h6>
</div> </div>
</div> </Container>
</div> </div>
) )
} }
......
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-caret-left-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M3.86 8.753l5.482 4.796c.646.566 1.658.106 1.658-.753V3.204a1 1 0 0 0-1.659-.753l-5.48 4.796a1 1 0 0 0 0 1.506z"/>
</svg>
\ No newline at end of file
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-caret-right-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path d="M12.14 8.753l-5.482 4.796c-.646.566-1.658.106-1.658-.753V3.204a1 1 0 0 1 1.659-.753l5.48 4.796a1 1 0 0 1 0 1.506z"/>
</svg>
\ No newline at end of file
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