This repository has been archived by the owner on Dec 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement attendance statistic service
- Loading branch information
1 parent
6b181b4
commit a99ab92
Showing
8 changed files
with
208 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
frontend/src/app/console/schedule/[id]/_components/AttendanceStatisticSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { getAttendanceStatistic } from '@/lib/actions' | ||
import AttendanceStatisticTable from './AttendanceStatisticTable' | ||
|
||
export default async function AttendanceStatisticSection({ | ||
params | ||
}: { | ||
params: { | ||
id: number | ||
} | ||
}) { | ||
const statistic = await getAttendanceStatistic(params.id) | ||
|
||
return <AttendanceStatisticTable {...statistic} /> | ||
} |
48 changes: 48 additions & 0 deletions
48
frontend/src/app/console/schedule/[id]/_components/AttendanceStatisticTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use client' | ||
|
||
import { DataTable } from '@/components/DataTable' | ||
import type { | ||
AttendanceStatistic, | ||
AttendanceStatisticItem | ||
} from '@/lib/types/attendance' | ||
import type { ColumnDef } from '@tanstack/react-table' | ||
|
||
interface Row extends AttendanceStatisticItem { | ||
title: string | ||
} | ||
|
||
export default function AttendanceStatisticTable( | ||
statistic: AttendanceStatistic | ||
) { | ||
const statisticList: Row[] = [ | ||
{ ...statistic.athlete, title: '선수 (재학생)' }, | ||
{ ...statistic.athleteNewbie, title: '선수 (신입생)' }, | ||
{ ...statistic.staff, title: '스태프 (재학생)' }, | ||
{ ...statistic.staffNewbie, title: '스태프 (신입생)' } | ||
] | ||
|
||
const columns: ColumnDef<Row>[] = [ | ||
{ | ||
accessorKey: 'title', | ||
header: '구분' | ||
}, | ||
{ | ||
accessorKey: 'total', | ||
header: '합계' | ||
}, | ||
{ | ||
accessorKey: 'seoul', | ||
header: '명륜' | ||
}, | ||
{ | ||
accessorKey: 'suwon', | ||
header: '율전' | ||
}, | ||
{ | ||
accessorKey: 'absence', | ||
header: '불참' | ||
} | ||
] | ||
|
||
return <DataTable columns={columns} data={statisticList} /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters