Skip to content

Commit

Permalink
fix: devide table
Browse files Browse the repository at this point in the history
  • Loading branch information
pbc1017 committed Jun 15, 2024
1 parent a394b94 commit 5e832a0
Show file tree
Hide file tree
Showing 4 changed files with 348 additions and 56 deletions.
6 changes: 3 additions & 3 deletions back/routes/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ router.get("/club_activity_list", async (req, res) => {
],
});

console.log(
filteredActivities[0].ActivityFeedbackExecutive.student.student.name
);
// console.log(
// filteredActivities[0].ActivityFeedbackExecutive.student.student.name
// );

// Process and return the response
const responseArray = filteredActivities.map((activity) => {
Expand Down
75 changes: 58 additions & 17 deletions front/src/pages/admin/ClubActivityList/ClubActivityList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,71 @@ export const ClubActivityList = (): JSX.Element => {
<div className="frame-13">
<SubTitle
className="sub-title-instance"
text="활동 보고서 검토 현황"
text="2024 봄 활동 보고서 검토"
/>
<div className="frame-14">
<DashboardActivity
type="zero"
activityStateProperty1="default"
/>
{Array.isArray(activities) &&
activities.map((activity, index) => (
<DashboardActivity
key={index}
type="one"
clubId={parseInt(id ? id : "0")}
activityId={activity.activityId}
number={(index + 1).toString()}
title={activity.title}
editedTime={activity.recent_edit}
feedbackTime={activity.recent_feedback}
feedbackName={activity.feedbackMemberName}
executiveName={activity.executiveName}
executiveId={activity.executive_id}
feedbackState={activity.feedbackType}
/>
))}
activities
?.filter((activity) => {
const recentDate = new Date(activity.recent_edit);
const targetDate = new Date("2024-06-01");
return recentDate > targetDate;
})
.map((activity, index) => (
<DashboardActivity
key={index}
type="one"
clubId={parseInt(id ? id : "0")}
activityId={activity.activityId}
number={(index + 1).toString()}
title={activity.title}
editedTime={activity.recent_edit}
feedbackTime={activity.recent_feedback}
feedbackName={activity.feedbackMemberName}
executiveName={activity.executiveName}
executiveId={activity.executive_id}
feedbackState={activity.feedbackType}
/>
))}
</div>
</div>
<div className="frame-13">
<SubTitle
className="sub-title-instance"
text="2023 가을 활동 보고서 검토"
/>
<div className="frame-14">
<DashboardActivity
type="zero"
activityStateProperty1="default"
/>
{Array.isArray(activities) &&
activities
?.filter((activity) => {
const recentDate = new Date(activity.recent_edit);
const targetDate = new Date("2024-06-01");
return recentDate <= targetDate;
})
.map((activity, index) => (
<DashboardActivity
key={index}
type="one"
clubId={parseInt(id ? id : "0")}
activityId={activity.activityId}
number={(index + 1).toString()}
title={activity.title}
editedTime={activity.recent_edit}
feedbackTime={activity.recent_feedback}
feedbackName={activity.feedbackMemberName}
executiveName={activity.executiveName}
executiveId={activity.executive_id}
feedbackState={activity.feedbackType}
/>
))}
</div>
</div>
</div>
Expand Down
113 changes: 94 additions & 19 deletions front/src/pages/admin/ClubFundingList/ClubFundingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const ClubFundingList = (): JSX.Element => {
const [clubName, setClubName] = useState("");
const [totalExpenditureAmount, setTotalExpenditureAmount] = useState(0);
const [totalApprovedAmount, setTotalApprovedAmount] = useState(0);
const [springExpenditureAmount, setSpringExpenditureAmount] = useState(0);
const [springApprovedAmount, setSpringApprovedAmount] = useState(0);

useEffect(() => {
const fetchActivities = async () => {
Expand All @@ -40,6 +42,32 @@ export const ClubFundingList = (): JSX.Element => {
setClubName(data.clubName);
setTotalExpenditureAmount(data.totalExpenditureAmount);
setTotalApprovedAmount(data.totalApprovedAmount);
setSpringExpenditureAmount(
data.fundings
?.filter((funding: Funding) => {
const recentDate = new Date(funding.recent_edit);
const targetDate = new Date("2024-06-01");
return recentDate > targetDate;
})
.reduce(
(total: number, funding: Funding) =>
total + funding.expenditureAmount,
0
)
);
setSpringApprovedAmount(
data.fundings
?.filter((funding: Funding) => {
const recentDate = new Date(funding.recent_edit);
const targetDate = new Date("2024-06-01");
return recentDate > targetDate;
})
.reduce(
(total: number, funding: Funding) =>
total + funding.approvedAmount,
0
)
);
},
(error) => console.error("Failed to fetch activities:", error)
);
Expand All @@ -59,31 +87,78 @@ export const ClubFundingList = (): JSX.Element => {
<div className="frame-13">
<SubTitle
className="sub-title-instance"
text="지원금 신청 검토 현황"
text="2024 봄 지원금 신청 검토"
/>
<div className="frame-14">
<ClubFundingElement type="zero" />
{Array.isArray(fundings) &&
fundings.map((funding, index) => (
<ClubFundingElement
key={index}
type="one"
clubId={parseInt(id ? id : "0")}
fundingId={funding.fundingId}
number={(index + 1).toString()}
name={funding.name}
expenditureAmount={`${funding.expenditureAmount}원`}
approvedAmount={`${funding.approvedAmount}원`}
feedbackName={funding.feedbackMemberName}
executiveName={funding.executiveName}
executiveId={funding.executive_id}
feedbackState={funding.feedbackType}
/>
))}
fundings
?.filter((activity) => {
const recentDate = new Date(activity.recent_edit);
const targetDate = new Date("2024-06-01");
return recentDate > targetDate;
})
.map((funding, index) => (
<ClubFundingElement
key={index}
type="one"
clubId={parseInt(id ? id : "0")}
fundingId={funding.fundingId}
number={(index + 1).toString()}
name={funding.name}
expenditureAmount={`${funding.expenditureAmount}원`}
approvedAmount={`${funding.approvedAmount}원`}
feedbackName={funding.feedbackMemberName}
executiveName={funding.executiveName}
executiveId={funding.executive_id}
feedbackState={funding.feedbackType}
/>
))}
<ClubFundingElement
type="two"
expenditureAmount={`${totalExpenditureAmount}원`}
approvedAmount={`${totalApprovedAmount}원`}
expenditureAmount={`${springExpenditureAmount}원`}
approvedAmount={`${springApprovedAmount}원`}
/>
</div>
</div>
<div className="frame-13">
<SubTitle
className="sub-title-instance"
text="2023 가을 지원금 신청 검토"
/>
<div className="frame-14">
<ClubFundingElement type="zero" />
{Array.isArray(fundings) &&
fundings
?.filter((activity) => {
const recentDate = new Date(activity.recent_edit);
const targetDate = new Date("2024-06-01");
return recentDate <= targetDate;
})
.map((funding, index) => (
<ClubFundingElement
key={index}
type="one"
clubId={parseInt(id ? id : "0")}
fundingId={funding.fundingId}
number={(index + 1).toString()}
name={funding.name}
expenditureAmount={`${funding.expenditureAmount}원`}
approvedAmount={`${funding.approvedAmount}원`}
feedbackName={funding.feedbackMemberName}
executiveName={funding.executiveName}
executiveId={funding.executive_id}
feedbackState={funding.feedbackType}
/>
))}
<ClubFundingElement
type="two"
expenditureAmount={`${
totalExpenditureAmount - springExpenditureAmount
}원`}
approvedAmount={`${
totalApprovedAmount - springApprovedAmount
}원`}
/>
</div>
</div>
Expand Down
Loading

0 comments on commit 5e832a0

Please sign in to comment.