diff --git a/pages/cart/reports/list.tsx b/pages/cart/reports/list.tsx index d16e9a2..03c3d78 100644 --- a/pages/cart/reports/list.tsx +++ b/pages/cart/reports/list.tsx @@ -22,7 +22,7 @@ export default function Reports() { const deleteReport = (id) => { axiosInstance - .delete(`api/data/reports/${id}`) + .delete(`/api/data/reports/${id}`) .then((res) => { toast.success("Успешно изтрит отчет"); // router.push("/cart/reports/list"); @@ -43,12 +43,12 @@ export default function Reports() { const { data } = await axiosInstance.get("/api/data/locations"); setLocations(data); console.log(data); - axiosInstance.get(`/api/data/reports`) + axiosInstance.get(`/api/data/reports?include=publisher,location`) .then((res) => { - let reports = res.data; - reports.forEach((report) => { - report.location = data.find((loc) => loc.id === report.locationId); - }); + // let reports = res.data; + // reports.forEach((report) => { + // report.location = data.find((loc) => loc.id === report.locationId); + // }); setReports(res.data); }) .catch((err) => { @@ -78,6 +78,7 @@ export default function Reports() { + @@ -87,9 +88,10 @@ export default function Reports() { {reports.map((report) => ( - - - + + +
От Дата Място Отчет
{common.getDateFormated(new Date(report.date))}{report.location?.name} + {report.publisher.firstName + " " + report.publisher.lastName}{common.getDateFormated(new Date(report.date))}{report.location?.name} {(report.experienceInfo === null || report.experienceInfo === "") ? ( <> @@ -99,12 +101,19 @@ export default function Reports() { Клипове: {report.videoCount}
Адреси / Телефони: {report.returnVisitInfoCount}
+ ) : (report.placementCount > 0) ? ( + <> +
Отзив
+
+ ) : ( <>
Случка
- )} + ) + + }
@@ -122,8 +131,8 @@ export default function Reports() { - - + + ); }