강좌명: {currentCourse.name}
설명: {currentCourse.description}
-
총 학생수: 35명
+
학생수: {attendanceBook[0].length}명
setPage(newPage)}
+ localeText={{
+ toolbarColumns: '열',
+ columnsPanelTextFieldLabel: '열 찾기',
+ columnsPanelTextFieldPlaceholder: '열 이름을 입력해주세요.',
+ columnsPanelShowAllButton: '모든 열 보이기',
+ columnsPanelHideAllButton: '모든 열 감추기',
+ toolbarExport: '추출',
+ toolbarExportCSV: 'CSV로 다운로드',
+ }}
+ components={{
+ Toolbar: CustomToolbar,
+ Pagination: CustomPagination,
+ }}
+ columnBuffer={10}
+ pagenation
autoHeight
rows={rows}
columns={columns}
pageSize={10}
rowsPerPageOptions={[10]}
disableSelectionOnClick
+ disableColumnMenu
/>
diff --git a/src/components/Attendance/style.jsx b/src/components/Attendance/style.jsx
index 1fc1050..a9a0223 100644
--- a/src/components/Attendance/style.jsx
+++ b/src/components/Attendance/style.jsx
@@ -1,20 +1,15 @@
import styled from 'styled-components'
const Attendance = styled.div`
- div {
- .datagrid {
- items-align: center;
- display: flex;
- height: 100%;
- width: 100%;
- max-width: 30rem;
- @media screen and (max-width: 30rem) {
- flex-direction: column;
- .gridparent {
- flexgrow: 1;
- width: 30rem;
- }
- }
+ .datagrid {
+ items-align: center;
+ display: flex;
+ height: 100%;
+ width: 100%;
+ max-width: 30rem;
+ .gridparent {
+ flexgrow: 1;
+ width: 40rem;
}
}
`
diff --git a/src/components/addmemberList/addmember/index.jsx b/src/components/addmemberList/addmember/index.jsx
index edd2b9c..f4388d5 100644
--- a/src/components/addmemberList/addmember/index.jsx
+++ b/src/components/addmemberList/addmember/index.jsx
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types'
const Member = ({ member, removeMember }) => {
Member.propTypes = {
- member: PropTypes.func.isRequired,
+ member: PropTypes.objectOf(PropTypes.shape).isRequired,
removeMember: PropTypes.func.isRequired,
}
diff --git a/src/components/addmemberList/modal/index.jsx b/src/components/addmemberList/modal/index.jsx
index 33f4038..31d428f 100644
--- a/src/components/addmemberList/modal/index.jsx
+++ b/src/components/addmemberList/modal/index.jsx
@@ -12,9 +12,8 @@ import StyledAddmemberModal from './style'
import { createMemberlist, retrieveMemberlist, findMemberByName } from '../../../actions/memberlist'
import { retrieveUsers, findUserByName } from '../../../actions/userlist'
-function getModalStyle() {
- // 여기서부터 modal style
- return {
+const useStyles = makeStyles(theme => ({
+ paper: {
top: `50%`,
left: `50%`,
WebkitTransform: `translate(-50%, -50%)`,
@@ -22,18 +21,11 @@ function getModalStyle() {
MozTransform: `translate(-50%, -50%)`,
OTransform: `translate(-50%, -50%)`,
transform: `translate(-50%, -50%)`,
- }
-}
-
-const useStyles = makeStyles(theme => ({
- paper: {
position: 'absolute',
- width: '80vw',
+ width: '60vw',
maxWidth: '100%',
- height: '42vh',
- backgroundColor: theme.palette.background.paper,
- border: '2px solid #000',
- boxShadow: theme.shadows[5],
+ height: '45vh',
+ backgroundColor: 'white',
padding: theme.spacing(2, 4, 3),
},
}))
@@ -43,17 +35,26 @@ const columns = [
{
field: 'studentId',
headerName: '학번',
- // width: '20rem',
+ align: 'center',
+ headAlign: 'center',
+ editable: false,
+ width: 150,
},
{
field: 'name',
headerName: '이름',
- // width: '20rem',
+ align: 'center',
+ headAlign: 'center',
+ editable: false,
+ width: 150,
},
{
field: 'userId',
headerName: '학생 ID',
- // width: '20rem',
+ align: 'center',
+ headAlign: 'center',
+ editable: false,
+ width: 150,
},
]
@@ -70,7 +71,6 @@ export default function AddmemberModal({ courseId, submitted, cookies }) {
const [submitable, setSubmitable] = useState(false) // 멤버리스트 생성 준비 상태를 나타냄
const classes = useStyles()
- const [modalStyle] = useState(getModalStyle)
const [open, setOpen] = useState(false)
const dispatch = useDispatch()
@@ -89,8 +89,6 @@ export default function AddmemberModal({ courseId, submitted, cookies }) {
console.log(rows)
}, [rows])
- // const userlist = useSelector(state => state.userlist[0]) // userlist 목록 가져온다.
-
const userlistReducer = users => users.reduce((acc, cur, index) => [...acc, { id: index, ...cur }], []) // id 넘버를 포함한 객체 배열 반환
const getUserlist = () => {
@@ -208,7 +206,7 @@ export default function AddmemberModal({ courseId, submitted, cookies }) {
)
const body = ( // 모달에 들어갈 내용
-
+
{rows.length !== 0 ? (
-
({
- ...column,
- sortable: false,
- }))}
- pageSize={pageSize}
- onPageSizeChange={newPageSize => setPageSize(newPageSize)}
- rowsPerPageOptions={[5, 10, 20]}
- pagination
- checkboxSelection
- selectionModel={selectionModel}
- onSelectionModelChange={e => {
- console.log(reduxmemberList)
- console.log(selectionModel)
- onChangeCheck(e)
- }}
- disableSelectionOnClick
- />
+
+
({
+ ...column,
+ sortable: false,
+ }))}
+ pageSize={pageSize}
+ onPageSizeChange={newPageSize => setPageSize(newPageSize)}
+ pagination
+ autoHeight
+ disableColumnMenu
+ checkboxSelection
+ disableSelectionOnClick
+ selectionModel={selectionModel}
+ onSelectionModelChange={e => {
+ console.log(reduxmemberList)
+ console.log(selectionModel)
+ onChangeCheck(e)
+ }}
+ />
+ {submitable === true ? (
+
+ ) : (
+ 수강생을 추가해주세요.
+ )}
+
) : (
로딩 중..
)}
- {submitable === true ? (
-
- ) : (
-
수강생을 추가해주세요.
- )}
)
return (
-
-
-
-
학생명단을 등록 및 수정하려면 버튼을 눌러주세요.
-
-
- {body}
-
+
+
+
학생명단을 등록 및 수정하려면 버튼을 눌러주세요.
+
+ {body}
+
)
}
diff --git a/src/components/addmemberList/modal/style.jsx b/src/components/addmemberList/modal/style.jsx
index 68f0f8e..3137388 100644
--- a/src/components/addmemberList/modal/style.jsx
+++ b/src/components/addmemberList/modal/style.jsx
@@ -1,9 +1,20 @@
import styled from 'styled-components'
const Addmembermodal = styled.div`
- .grid{
- height: 30vh; width: 20vw;
- align-content: center;
+ .modal{
+ top: 50%,
+ left: 50%,
+ -webkit-transform: translate(-50%, -50%),
+ -ms-transform: translate(-50%, -50%),
+ -moz-transform: translate(-50%, -50%),
+ -o-transform: translate(-50%, -50%),
+ transform: translate(-50%, -50%),
+ position: absolute,
+ width: 60vw,
+ maxWidth: 100%,
+ height: 45vh,
+ backgroundColor: white,
+ padding: spacing(2, 4, 3),
}
`
diff --git a/src/components/course/index.jsx b/src/components/course/index.jsx
index e8ba42b..685c988 100644
--- a/src/components/course/index.jsx
+++ b/src/components/course/index.jsx
@@ -12,7 +12,7 @@ import MemberList from '../addmemberList'
import QrScanner from '../QrScanner'
import Attendance from '../Attendance'
import StyledCourse from './style'
-import { history } from '../../helpers/history'
+import { history } from '../../utils/history'
function Courses({ cookies }) {
Courses.propTypes = {
diff --git a/src/modules/attendance.js b/src/modules/attendance.js
new file mode 100644
index 0000000..e0026c0
--- /dev/null
+++ b/src/modules/attendance.js
@@ -0,0 +1,34 @@
+import { GET_COURSEDATES, GET_ATTENDANCEBOOK, PUT_COURSEDATES, PUT_ATTENDANCEBOOK } from '../actions/types'
+
+const courseState = []
+const attendanceState = []
+
+export function courseDates(courseDates = courseState, action) {
+ const { type, payload } = action
+
+ switch (type) {
+ case GET_COURSEDATES:
+ return [...payload]
+
+ case PUT_COURSEDATES:
+ return [...payload]
+
+ default:
+ return courseDates
+ }
+}
+
+export function attendanceBook(attendanceBook = attendanceState, action) {
+ const { type, payload } = action
+
+ switch (type) {
+ case GET_ATTENDANCEBOOK:
+ return [...payload]
+
+ case PUT_ATTENDANCEBOOK:
+ return [...payload]
+
+ default:
+ return attendanceBook
+ }
+}
diff --git a/src/modules/index.js b/src/modules/index.js
index 0e2be8e..a9bffa2 100644
--- a/src/modules/index.js
+++ b/src/modules/index.js
@@ -3,6 +3,7 @@ import auth from './auth'
import message from './message'
import memberlist from './memberlist'
import userlist from './userlist'
+import { courseDates, attendanceBook } from './attendance'
import { combineReducers } from 'redux'
const rootReducer = combineReducers({
@@ -11,6 +12,8 @@ const rootReducer = combineReducers({
courses,
memberlist,
userlist,
+ courseDates,
+ attendanceBook,
})
export default rootReducer
diff --git a/src/services/AttendanceService.js b/src/services/AttendanceService.js
new file mode 100644
index 0000000..c707e87
--- /dev/null
+++ b/src/services/AttendanceService.js
@@ -0,0 +1,15 @@
+import http from '../common/http'
+
+const getCourseDates = courseId => http.get(`v1/courseDates/getCourseDates/${courseId}`)
+
+const putCourseDates = courseDateId => http.put(`v1/courseDates/${courseDateId}`)
+
+const getAttendanceBook = courseId => http.get(`v1/attendance/getAttendanceBook/${courseId}`)
+
+const AttendanceService = {
+ putCourseDates,
+ getCourseDates,
+ getAttendanceBook,
+}
+
+export default AttendanceService
diff --git a/src/style.js b/src/styles/AppStyle.js
similarity index 100%
rename from src/style.js
rename to src/styles/AppStyle.js
diff --git a/src/utils/courseDateIdtoString.js b/src/utils/courseDateIdtoString.js
new file mode 100644
index 0000000..014138b
--- /dev/null
+++ b/src/utils/courseDateIdtoString.js
@@ -0,0 +1,5 @@
+export default function courseDate(courseDates, idx) {
+ return `${courseDates[idx].courseDateId.slice(0, 4)}년 ${courseDates[idx].courseDateId.slice(-6, -4)}월 ${courseDates[
+ idx
+ ].courseDateId.slice(-4, -2)}일 ${courseDates[idx].courseDateId.slice(-2)}시`
+}
diff --git a/src/helpers/history.js b/src/utils/history.js
similarity index 100%
rename from src/helpers/history.js
rename to src/utils/history.js