Skip to content

Commit

Permalink
feat : #3 #4 #7 연동 추가 및 기능 수정 작업
Browse files Browse the repository at this point in the history
  • Loading branch information
leestana01 committed Aug 16, 2024
1 parent 66ee5e2 commit 6a99b25
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 77 deletions.
19 changes: 11 additions & 8 deletions src/event/eventList/EventList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,17 @@ export default function EventList(){

<ElementContainer>
{
eventList.eventList.map((e,i) => (
<EventElement
key={i}
eventId={e.eventId}
title={e.name}
cash={e.balance}
/>
))
eventList.eventList.length === 0
? <p>현재 설정된 이벤트가 없습니다 {":("}</p> : (
eventList.eventList.map((e,i) => (
<EventElement
key={i}
eventId={e.eventId}
title={e.name}
cash={e.balance}
/>
))
)
}
</ElementContainer>

Expand Down
94 changes: 29 additions & 65 deletions src/event/eventMain/EventMain.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import EventElement from "../components/EventElement";
import { useEffect, useState } from "react";
import { getEventList, getEventsUnfinished } from "../../server/event";
import { useParams } from "react-router-dom";
import { mockForClubAlert, mockForEventList, mockForEventUnfinished, mockForEventUnfinishedCount } from "./EventMain.mock";
import { getUnclassfiedBillCount } from "../../server/bills";

const MainContainer = styled.div`
display: flex;
Expand Down Expand Up @@ -53,73 +55,31 @@ const Button = styled.button`
background-color: white;
`

const mockForClubAlert = [
{
id: 1,
type: "toast",
content: "[구현 안됨]\n현재 납부하지 않은 회비가 1건 있습니다. \n - MT 비용",
color: "#FF4E4E"
},
{
id: 2,
type: "toast",
content: "[구현 안됨]\n분류되지 않은 입출금 내역이 2건 있습니다.",
color: "#8F94A8"
}
]

const mockForRemainedFee = [
{
id: 1,
title: "구현 안됨, 임시 데이터 - MT 회비",
duedate: "2024-11-01T00:00",
amount: 50000,
state: 0,
},
{
id: 2,
title: "구현 안됨, 임시 데이터 - 임의 회비",
duedate: "2023-11-01T00:00",
amount: 10000,
state: 1,
}
]


const mockForEventList = {
"eventList" : [
{
"uuid": 1,
"name" : "로딩중...",
"balance" : 0
}
]
};

const mockForEventUnfinished = {
"eventFundingListDto": [
{
"eventId": "string",
"name": "string",
"totalPaymentAmount": 0,
"paymentDeadline": "2024-07-23"
}
]
}

export default function EventMain(){
const [clubAlert, setClubAlert] = useState(mockForClubAlert);
const [eventList, setEventList] = useState(mockForEventList);
const [eventUnfinished, setEventUnfinished] = useState(mockForEventUnfinished);
// const [eventUnfinishedCount, setEventUnfinishedCount] = useState(mockForEventUnfinishedCount);
const params = useParams();

useEffect(() => {
const fetchData = async () => {
Promise.all([
getEventList(params.clubId, 3),
getEventsUnfinished(params.clubId)
getEventsUnfinished(params.clubId),
getUnclassfiedBillCount(params.clubId)
]).then((values) => {
setEventList(values[0]);
setEventUnfinished(values[1]);

if(values[2].count > 0) {
setClubAlert([...clubAlert, {
id: -1,
type: "toast",
content: `분류되지 않은 입출금 내역이 ${values[2].count}건 있습니다.`,
color: "#8F94A8"
}]);
}
});

const response = await getEventList(params.clubId, 3);
Expand All @@ -132,7 +92,7 @@ export default function EventMain(){
<MainContainer>
<AlertContainer>
{
mockForClubAlert.map((item) => (
clubAlert.map((item) => (
<Alert
key={item.id}
$color={item.color}
Expand All @@ -143,15 +103,19 @@ export default function EventMain(){
<Title>현재 모임에서 접수중인 이벤트</Title>
<RemainedFeeContainer>
{
eventUnfinished.eventFundingListDto.map((item) => (
<RemainedFee
key={item.eventId}
$title={item.name}
$duedate={item.paymentDeadline}
$amount={item.totalPaymentAmount}
$state={0}
/>
))
eventUnfinished.eventFundingListDto.length === 0 ? (
<p>접수중인 이벤트가 없습니다</p>
) : (
eventUnfinished.eventFundingListDto.map((item) => (
<RemainedFee
key={item.eventId}
$title={item.name}
$duedate={item.paymentDeadline}
$amount={item.totalPaymentAmount}
$state={0}
/>
))
)
}
</RemainedFeeContainer>

Expand Down
33 changes: 33 additions & 0 deletions src/event/eventMain/EventMain.mock.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export const mockForClubAlert = [
{
id: 1,
type: "toast",
content: "[구현 안됨]\n현재 납부하지 않은 회비가 1건 있습니다. \n - MT 비용",
color: "#FF4E4E"
}
]

export const mockForEventList = {
"eventList" : [
{
"uuid": 1,
"name" : "로딩중...",
"balance" : 0
}
]
};

export const mockForEventUnfinished = {
"eventFundingListDto": [
{
"eventId": "string",
"name": "string",
"totalPaymentAmount": 0,
"paymentDeadline": "2024-07-23"
}
]
}

export const mockForEventUnfinishedCount = {
"count": 0
}
9 changes: 5 additions & 4 deletions src/event/eventTotal/EventTotal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ const mock = {
"paidAt": "2000-01-01T00:00:00"
}
],
"totalBalance": 7000000,
"totalDeposit": 10000000,
"totalWithdrawal": 3000000
"isLast": false,
"totalBalance": -1,
"totalDeposit": -1,
"totalWithdraw": -1
}

export default function EventTotal() {
Expand Down Expand Up @@ -108,7 +109,7 @@ export default function EventTotal() {
</SummaryItem>
<SummaryItem>
<span>총 출금</span>
<SummaryValue color="#ff0000">{totalData.totalWithdrawal?.toLocaleString()}</SummaryValue>
<SummaryValue color="#ff0000">{totalData.totalWithdraw?.toLocaleString()}</SummaryValue>
</SummaryItem>
</SummaryContainer>
</InfoContainer>
Expand Down
11 changes: 11 additions & 0 deletions src/server/bills.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,15 @@ export async function getUnclassifiedBillList(clubId) {
console.error(e);
return mockBillList;
}
}

export async function getUnclassfiedBillCount(clubId) {
try {
const response = await axiosInstance.get(
`/api/v1/transactionHistories/unClassification/count?clubId=${clubId}`);
return response.data;
} catch (e) {
console.error(e);
return mockBillList;
}
}

0 comments on commit 6a99b25

Please sign in to comment.