Fixed report page
This commit is contained in:
parent
fb0ce999f6
commit
21fe443d05
@ -132,6 +132,8 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
margin-bottom: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__form {
|
&__form {
|
||||||
|
@ -27,8 +27,8 @@ export const ProfileCalendarComponent = React.memo(
|
|||||||
const [currentDay] = useState(moment());
|
const [currentDay] = useState(moment());
|
||||||
const [calendar, setCalendar] = useState([]);
|
const [calendar, setCalendar] = useState([]);
|
||||||
const [month, setMonth] = useState("");
|
const [month, setMonth] = useState("");
|
||||||
|
const [dayReport, setDayReport] = useState("");
|
||||||
const [shortReport, setShortReport] = useState(false);
|
const [shortReport, setShortReport] = useState(false);
|
||||||
const [dayTest, setDayTest] = useState("");
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCalendar(calendarHelper(value));
|
setCalendar(calendarHelper(value));
|
||||||
@ -148,7 +148,7 @@ export const ProfileCalendarComponent = React.memo(
|
|||||||
dispatch(setReportDate(day));
|
dispatch(setReportDate(day));
|
||||||
dispatch(setSendRequest(true));
|
dispatch(setSendRequest(true));
|
||||||
setShortReport(true);
|
setShortReport(true);
|
||||||
setDayTest(day);
|
setDayReport(day);
|
||||||
}}
|
}}
|
||||||
key={day}
|
key={day}
|
||||||
className={dayStyles(day)}
|
className={dayStyles(day)}
|
||||||
@ -171,9 +171,13 @@ export const ProfileCalendarComponent = React.memo(
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Link to={correctRoute(dayTest)}>
|
|
||||||
|
{shortReport && (
|
||||||
|
<Link to={correctRoute(dayReport)}>
|
||||||
<button className="calendar__btn">Посмотреть подробнее</button>
|
<button className="calendar__btn">Посмотреть подробнее</button>
|
||||||
</Link>
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
{shortReport && <ShortReport />}
|
{shortReport && <ShortReport />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -18,7 +18,7 @@ import "./shortReport.scss";
|
|||||||
export const ShortReport = ({}) => {
|
export const ShortReport = ({}) => {
|
||||||
const reportDate = useSelector(getReportDate);
|
const reportDate = useSelector(getReportDate);
|
||||||
|
|
||||||
const sendTest = useSelector(getSendRequest);
|
const sendReport = useSelector(getSendRequest);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const [taskText, setTaskText] = useState([]);
|
const [taskText, setTaskText] = useState([]);
|
||||||
@ -26,7 +26,6 @@ export const ShortReport = ({}) => {
|
|||||||
const [tomorrowTask, setTomorrowTask] = useState([]);
|
const [tomorrowTask, setTomorrowTask] = useState([]);
|
||||||
const [totalHours, setTotalHours] = useState(0);
|
const [totalHours, setTotalHours] = useState(0);
|
||||||
const [loader, setLoader] = useState(false);
|
const [loader, setLoader] = useState(false);
|
||||||
const [reportDay] = useState(new Date(getCreatedDate(reportDate)));
|
|
||||||
|
|
||||||
function getReportFromDate(day) {
|
function getReportFromDate(day) {
|
||||||
setLoader(true);
|
setLoader(true);
|
||||||
@ -39,7 +38,6 @@ export const ShortReport = ({}) => {
|
|||||||
"cardId"
|
"cardId"
|
||||||
)}&date=${day}`
|
)}&date=${day}`
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
console.log(res);
|
|
||||||
let spendTime = 0;
|
let spendTime = 0;
|
||||||
for (const item of res) {
|
for (const item of res) {
|
||||||
if (item.difficulties) {
|
if (item.difficulties) {
|
||||||
@ -66,14 +64,14 @@ export const ShortReport = ({}) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendTest) {
|
if (sendReport) {
|
||||||
dispatch(setSendRequest(false));
|
dispatch(setSendRequest(false));
|
||||||
getReportFromDate(getCreatedDate(reportDate));
|
getReportFromDate(getCreatedDate(reportDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="viewReport__info">
|
<div className="viewReport__info short-report">
|
||||||
<h2 className="viewReport__title">
|
<h2 className="viewReport__title">
|
||||||
Ваши отчеты - <span>просмотр отчета за день</span>
|
Ваши отчеты - <span>просмотр отчета за день</span>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
.short-report {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user