From e1188f7e1cab292dedb76c24d15ede5a90d1295d Mon Sep 17 00:00:00 2001
From: jspark2000
Date: Thu, 14 Mar 2024 11:47:38 +0000
Subject: [PATCH] feat: implements survey-unsubmit-list page
---
backend/prisma/seed.ts | 45 ++++++++++++++++---
.../_components/SurveyGroupCardSection.tsx | 28 +++++++-----
.../account/_component/UserListTable.tsx | 6 +--
.../AthleteAttendanceListTable.tsx | 30 ++++++++++---
.../src/app/console/schedule/[id]/page.tsx | 2 -
.../_components/SurveyUnsubmitListTable.tsx | 22 +++++++++
.../app/console/survey/[id]/unsubmit/page.tsx | 28 ++++++++++++
.../_components/SurveyGroupListTable.tsx | 11 ++++-
frontend/src/lib/actions.ts | 9 +++-
frontend/src/lib/types/roster.ts | 6 +++
frontend/src/lib/types/survey.ts | 5 +++
11 files changed, 160 insertions(+), 32 deletions(-)
create mode 100644 frontend/src/app/console/survey/[id]/unsubmit/_components/SurveyUnsubmitListTable.tsx
create mode 100644 frontend/src/app/console/survey/[id]/unsubmit/page.tsx
diff --git a/backend/prisma/seed.ts b/backend/prisma/seed.ts
index 28eafc5..606a8a2 100644
--- a/backend/prisma/seed.ts
+++ b/backend/prisma/seed.ts
@@ -5,7 +5,8 @@ import {
AccountStatus,
RosterStatus,
RosterType,
- ScheduleType
+ ScheduleType,
+ AttendanceLocation
} from '@prisma/client'
import { hash } from 'argon2'
@@ -268,29 +269,34 @@ const seedingDatabase = async () => {
{
scheduleId: 1,
rosterId: 1,
- response: 'Present'
+ response: 'Present',
+ location: AttendanceLocation.Seoul
},
{
scheduleId: 1,
rosterId: 2,
- response: 'Present'
+ response: 'Present',
+ location: AttendanceLocation.Seoul
},
{
scheduleId: 1,
rosterId: 3,
- response: 'Present'
+ response: 'Present',
+ location: AttendanceLocation.Seoul
},
{
scheduleId: 1,
rosterId: 5,
response: 'Tardy',
- reason: '수업'
+ reason: '수업',
+ location: AttendanceLocation.Suwon
},
{
scheduleId: 1,
rosterId: 6,
response: 'Tardy',
- reason: '수업'
+ reason: '수업',
+ location: AttendanceLocation.Suwon
},
{
scheduleId: 1,
@@ -314,6 +320,33 @@ const seedingDatabase = async () => {
await prisma.attendance.createMany({
data: attendances
})
+
+ const surveyTargets: Prisma.SurveyTargetCreateManyInput[] = [
+ {
+ surveyGroupId: 2,
+ rosterId: 1
+ },
+ {
+ surveyGroupId: 2,
+ rosterId: 2
+ },
+ {
+ surveyGroupId: 2,
+ rosterId: 3
+ },
+ {
+ surveyGroupId: 2,
+ rosterId: 4
+ },
+ {
+ surveyGroupId: 2,
+ rosterId: 5
+ }
+ ]
+
+ await prisma.surveyTarget.createMany({
+ data: surveyTargets
+ })
}
const main = async () => {
diff --git a/frontend/src/app/(public)/survey/_components/SurveyGroupCardSection.tsx b/frontend/src/app/(public)/survey/_components/SurveyGroupCardSection.tsx
index a3c8386..d647217 100644
--- a/frontend/src/app/(public)/survey/_components/SurveyGroupCardSection.tsx
+++ b/frontend/src/app/(public)/survey/_components/SurveyGroupCardSection.tsx
@@ -25,6 +25,14 @@ export default async function SurveyGroupCardSection() {
return
}
+ const isClosedSurvey = (surveyGroup: SurveyGroupListItem) => {
+ const now = new Date()
+ return (
+ now <= new Date(surveyGroup.startedAt) ||
+ now >= new Date(surveyGroup.endedAt)
+ )
+ }
+
return (
<>
출석조사 목록
@@ -48,27 +56,27 @@ export default async function SurveyGroupCardSection() {
시작:{' '}
마감:{' '}
-
-