diff --git a/src/entities/settlement/ui/calandar-amount-row.tsx b/src/entities/settlement/ui/calandar-amount-row.tsx
index b2e2900..1aab143 100644
--- a/src/entities/settlement/ui/calandar-amount-row.tsx
+++ b/src/entities/settlement/ui/calandar-amount-row.tsx
@@ -14,10 +14,20 @@ export const CalendarAmountRow = ({
const makeTitle = () => {
let rs = [];
if(settlementStatus === SettlementStatus.SCHEDULED){
- rs.push(예정)
+ rs.push(
+ 예정
+ );
}
else if(settlementStatus === SettlementStatus.COMPLETED){
- rs.push(완료)
+ rs.push(
+ 완료
+ );
}
return rs;
};
diff --git a/src/entities/settlement/ui/calandar-wrap.tsx b/src/entities/settlement/ui/calandar-wrap.tsx
index df1125c..3321233 100644
--- a/src/entities/settlement/ui/calandar-wrap.tsx
+++ b/src/entities/settlement/ui/calandar-wrap.tsx
@@ -127,7 +127,8 @@ export const CalendarWrap = () => {
diff --git a/src/entities/settlement/ui/calendar-grid.tsx b/src/entities/settlement/ui/calendar-grid.tsx
index d1200b1..97b4d6c 100644
--- a/src/entities/settlement/ui/calendar-grid.tsx
+++ b/src/entities/settlement/ui/calendar-grid.tsx
@@ -1,26 +1,38 @@
import moment from 'moment';
import { SettlementDays, SettlementStatus } from '../model/types';
+import { useEffect, useState } from 'react';
export interface CalendarGridProps {
yearMonth: string;
- settlementDays: Array
+ scheduledList: Array;
+ completedList: Array;
};
export const CalendarGrid = ({
yearMonth,
- settlementDays
+ scheduledList,
+ completedList,
}: CalendarGridProps) => {
- const checkData = (val: number) => {
- let rs: SettlementStatus | undefined;
- for(let i=0;i>();
+ const [completedDateList, setCompletedDateList] = useState>();
+ const [assembled, setAssembled] = useState(false);
+
+ const assembleDate = () => {
+ let rsScheduledDate = [];
+ let rsCompletedList = [];
+ for(let i=0;i {
@@ -34,36 +46,54 @@ export const CalendarGrid = ({
let rs = [];
for(let i=0;i{ (lastYearMonthLastDate - startDay + i + 1) }
+ { (lastYearMonthLastDate - startDay + i + 1) }
);
}
for(let i=1;i<=lastDate;i++){
- let ck = checkData(i);
- if(ck === SettlementStatus.SCHEDULED){
+ if(scheduledDateList?.includes(i)){
rs.push(
- { i }
+ { i }
);
}
- else if(ck === SettlementStatus.COMPLETED){
+ else if(completedDateList?.includes(i)){
rs.push(
- { i }
+ { i }
);
}
else{
rs.push(
- { i }
+ { i }
);
}
}
for(let i=0;i{ (i + 1) }
+ { (i + 1) }
);
}
return rs;
}
+ useEffect(() => {
+ assembleDate();
+ }, [yearMonth])
+
return (
<>
@@ -77,7 +107,7 @@ export const CalendarGrid = ({
토
- { makeCalendarDate() }
+ { !!assembled && makeCalendarDate() }
>