From 3e26c7350a0fbafe96d1bda3ca25afb9e7f0f475 Mon Sep 17 00:00:00 2001 From: Takkun0310 Date: Sat, 11 May 2024 15:57:27 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E3=83=81=E3=83=BC=E3=83=A0?= =?UTF-8?q?=E8=A9=B3=E7=B4=B0=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(authenticated)/teams/[id]/page.tsx | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/(authenticated)/teams/[id]/page.tsx diff --git a/app/(authenticated)/teams/[id]/page.tsx b/app/(authenticated)/teams/[id]/page.tsx new file mode 100644 index 0000000..fdbda39 --- /dev/null +++ b/app/(authenticated)/teams/[id]/page.tsx @@ -0,0 +1,32 @@ +import { Breadcrumbs, Link, Stack, Typography} from "@mui/material"; +import CardBackground from "@/components/layout/cardBackground"; +import React from "react"; +import UserEditor from "@/components/users/userEditor"; +import {teamFactory} from "@/src/models/TeamModel"; +import TeamEditor from "@/components/teams/teamEditor"; +import {classFactory} from "@/src/models/ClassModel"; + +export default async function TeamDetailPage({ params }: { params: { id: string } }) { + const teamId = parseInt(params.id, 10) + const teamInfo = await teamFactory().show(teamId) + const classes = await classFactory().show(teamInfo.classId) + const teamUsers = await teamFactory().getTeamUsers(teamId); + + return ( + + + + 管理者のダッシュボード + + + チーム管理 + + {teamInfo .name} + + + + + + + ) +} From 10421d074b92ebffc7a5999e5a69bf7da4848cae Mon Sep 17 00:00:00 2001 From: Takkun0310 Date: Sat, 11 May 2024 15:59:30 +0900 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20team=E7=B7=A8=E9=9B=86=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/teams/teamEditor.tsx | 143 ++++++++++++++++++++++++++++++++ components/teams/teamsTable.tsx | 16 +++- 2 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 components/teams/teamEditor.tsx diff --git a/components/teams/teamEditor.tsx b/components/teams/teamEditor.tsx new file mode 100644 index 0000000..8d37896 --- /dev/null +++ b/components/teams/teamEditor.tsx @@ -0,0 +1,143 @@ +'use client' +import { + Box, + Button, + FormControl, InputLabel, MenuItem, Paper, Select, + Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, + Typography +} from "@mui/material"; +import {HiCheck, HiTrash} from "react-icons/hi2"; +import React, {useState} from "react"; +import {useRouter} from "next/navigation"; +import {Team, teamFactory} from "@/src/models/TeamModel"; +import {Class} from "@/src/models/ClassModel"; +import {User} from "@/src/models/UserModel"; + +type TeamEditorProps = { + team : Team; + class : Class; + teamUser : User[]; +} + + +export default function TeamEditor(props: TeamEditorProps) { + const router = useRouter() + const [teamName, setTeamName] = useState(props.team.name) + const [classId, setClassId] = useState(props.team.classId) + + + const handleSubmit = async () => { + await teamFactory().update(props.team.id, { + name: props.team.name, + description: props.team.description, + classId: props.team.classId, + teamTagId: props.team.teamTagId + }) + + router.push('/teams') + } + + return ( + <> + + + + + + + + + + + + + 所属クラス + + + {props.class.name} + + + + + + + + チームメンバー + + + + + + + 学籍番号 + 名前 + 性別 + + + + {props.teamUser.map((member) => { + return ( + + {member.id} + {member.name} + + + {member.gender === "male" ? "男性" : "女性"} + + + + ); + })} + +
+
+
+ + + + + +
+ + ) +} \ No newline at end of file diff --git a/components/teams/teamsTable.tsx b/components/teams/teamsTable.tsx index 58c4577..add2fc0 100644 --- a/components/teams/teamsTable.tsx +++ b/components/teams/teamsTable.tsx @@ -4,11 +4,13 @@ import {AgGridReact} from 'ag-grid-react'; import "ag-grid-community/styles/ag-grid.css"; // Mandatory CSS required by the grid import "ag-grid-community/styles/ag-theme-quartz.css"; // Optional Theme applied to the grid -import {ColDef, ModuleRegistry} from 'ag-grid-community'; +import {ColDef, ModuleRegistry, RowClickedEvent} from 'ag-grid-community'; import {ClientSideRowModelModule} from 'ag-grid-community'; import {Team} from "@/src/models/TeamModel"; import {Class} from '@/src/models/ClassModel'; import {TeamTag} from "@/src/models/TeamTagModel"; +import {router} from "next/client"; +import {useRouter} from "next/navigation"; ModuleRegistry.registerModules([ClientSideRowModelModule]); @@ -30,6 +32,7 @@ type IRow = { // Create new GridExample component const TeamsAgGrid = (props: TeamsAgGridProps) => { const height = 'calc(100vh - 230px)'; + const router = useRouter() // Row Data: The data to be displayed. const [rowData, setRowData] = useState([]); @@ -60,6 +63,16 @@ const TeamsAgGrid = (props: TeamsAgGridProps) => { [props.classes, props.teams, props.teamTags] ) + const handleRowClick = (e: RowClickedEvent) => { + const data = e.data + + // ignore undefined + if (!data) return + + // redirect + router.push(`/teams/${data.teamId}`) + } + // Container: Defines the grid's theme & dimensions. return ( @@ -67,6 +80,7 @@ const TeamsAgGrid = (props: TeamsAgGridProps) => { ); From 9341ea18e6311058b09e168930e2e0e9630ef651 Mon Sep 17 00:00:00 2001 From: Takkun0310 Date: Sun, 12 May 2024 02:18:13 +0900 Subject: [PATCH 3/6] =?UTF-8?q?change:=20teamEditor=E3=81=AEprops=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/(authenticated)/teams/[id]/page.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/(authenticated)/teams/[id]/page.tsx b/app/(authenticated)/teams/[id]/page.tsx index fdbda39..4da4fba 100644 --- a/app/(authenticated)/teams/[id]/page.tsx +++ b/app/(authenticated)/teams/[id]/page.tsx @@ -1,7 +1,6 @@ import { Breadcrumbs, Link, Stack, Typography} from "@mui/material"; import CardBackground from "@/components/layout/cardBackground"; import React from "react"; -import UserEditor from "@/components/users/userEditor"; import {teamFactory} from "@/src/models/TeamModel"; import TeamEditor from "@/components/teams/teamEditor"; import {classFactory} from "@/src/models/ClassModel"; @@ -21,11 +20,15 @@ export default async function TeamDetailPage({ params }: { params: { id: string チーム管理 - {teamInfo .name} + {teamInfo.name} - + ) From f6354ae9709bf176fc4b410ced2708c7d12f8c19 Mon Sep 17 00:00:00 2001 From: Takkun0310 Date: Sun, 12 May 2024 02:19:45 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20team=E3=81=AE=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E5=85=A5=E5=8A=9B=E7=94=BB=E9=9D=A2=E3=81=AE=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/teams/teamEditor.tsx | 44 +++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/components/teams/teamEditor.tsx b/components/teams/teamEditor.tsx index 8d37896..c085302 100644 --- a/components/teams/teamEditor.tsx +++ b/components/teams/teamEditor.tsx @@ -14,33 +14,31 @@ import {Class} from "@/src/models/ClassModel"; import {User} from "@/src/models/UserModel"; type TeamEditorProps = { - team : Team; class : Class; + team : Team; teamUser : User[]; } - export default function TeamEditor(props: TeamEditorProps) { const router = useRouter() const [teamName, setTeamName] = useState(props.team.name) - const [classId, setClassId] = useState(props.team.classId) - const handleSubmit = async () => { await teamFactory().update(props.team.id, { - name: props.team.name, + name: teamName, description: props.team.description, classId: props.team.classId, teamTagId: props.team.teamTagId }) router.push('/teams') + router.refresh() + } return ( <> - { + setTeamName(t.target.value) + }} /> - - + 所属クラス @@ -80,12 +88,23 @@ export default function TeamEditor(props: TeamEditorProps) { - - + + チームメンバー - + @@ -102,7 +121,6 @@ export default function TeamEditor(props: TeamEditorProps) { {member.name} {member.gender === "male" ? "男性" : "女性"} From ce81159f667ce840d83eb628ac94622f6363f59f Mon Sep 17 00:00:00 2001 From: Takkun0310 Date: Sun, 12 May 2024 02:31:36 +0900 Subject: [PATCH 5/6] =?UTF-8?q?change:=20=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E3=81=AE=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=AE=E5=AE=A3=E8=A8=80=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/teams/teamEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/teams/teamEditor.tsx b/components/teams/teamEditor.tsx index c085302..942add0 100644 --- a/components/teams/teamEditor.tsx +++ b/components/teams/teamEditor.tsx @@ -2,7 +2,7 @@ import { Box, Button, - FormControl, InputLabel, MenuItem, Paper, Select, + FormControl, InputLabel, Paper, Stack, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TextField, Typography } from "@mui/material"; From 73718d13d3665981ac61f23cdcbfa386ed902ccf Mon Sep 17 00:00:00 2001 From: Takkun0310 Date: Sun, 12 May 2024 02:31:42 +0900 Subject: [PATCH 6/6] =?UTF-8?q?change:=20=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E3=81=AE=E3=82=B3=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=8D=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=81=AE=E5=AE=A3=E8=A8=80=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/teams/teamsTable.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/teams/teamsTable.tsx b/components/teams/teamsTable.tsx index add2fc0..fb8775e 100644 --- a/components/teams/teamsTable.tsx +++ b/components/teams/teamsTable.tsx @@ -9,7 +9,6 @@ import {ClientSideRowModelModule} from 'ag-grid-community'; import {Team} from "@/src/models/TeamModel"; import {Class} from '@/src/models/ClassModel'; import {TeamTag} from "@/src/models/TeamTagModel"; -import {router} from "next/client"; import {useRouter} from "next/navigation"; ModuleRegistry.registerModules([ClientSideRowModelModule]);