Merge remote-tracking branch 'origin/main' into production
This commit is contained in:
@@ -22,7 +22,7 @@ export default function Reports() {
|
|||||||
|
|
||||||
const deleteReport = (id) => {
|
const deleteReport = (id) => {
|
||||||
axiosInstance
|
axiosInstance
|
||||||
.delete(`api/data/reports/${id}`)
|
.delete(`/api/data/reports/${id}`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
toast.success("Успешно изтрит отчет");
|
toast.success("Успешно изтрит отчет");
|
||||||
// router.push("/cart/reports/list");
|
// router.push("/cart/reports/list");
|
||||||
@@ -43,12 +43,12 @@ export default function Reports() {
|
|||||||
const { data } = await axiosInstance.get("/api/data/locations");
|
const { data } = await axiosInstance.get("/api/data/locations");
|
||||||
setLocations(data);
|
setLocations(data);
|
||||||
console.log(data);
|
console.log(data);
|
||||||
axiosInstance.get(`/api/data/reports`)
|
axiosInstance.get(`/api/data/reports?include=publisher,location`)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
let reports = res.data;
|
// let reports = res.data;
|
||||||
reports.forEach((report) => {
|
// reports.forEach((report) => {
|
||||||
report.location = data.find((loc) => loc.id === report.locationId);
|
// report.location = data.find((loc) => loc.id === report.locationId);
|
||||||
});
|
// });
|
||||||
setReports(res.data);
|
setReports(res.data);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
@@ -78,6 +78,7 @@ export default function Reports() {
|
|||||||
<table className="w-full table-auto">
|
<table className="w-full table-auto">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th className="px-4 py-2 text-left">От</th>
|
||||||
<th className="px-4 py-2 text-left">Дата</th>
|
<th className="px-4 py-2 text-left">Дата</th>
|
||||||
<th className="px-4 py-2 text-left" >Място</th>
|
<th className="px-4 py-2 text-left" >Място</th>
|
||||||
<th className="px-4 py-2 text-left">Отчет</th>
|
<th className="px-4 py-2 text-left">Отчет</th>
|
||||||
@@ -87,9 +88,10 @@ export default function Reports() {
|
|||||||
<tbody>
|
<tbody>
|
||||||
{reports.map((report) => (
|
{reports.map((report) => (
|
||||||
<tr key={report.id}>
|
<tr key={report.id}>
|
||||||
<td className="border px-4 py-2">{common.getDateFormated(new Date(report.date))}</td>
|
<td className="border px-2 py-2">{report.publisher.firstName + " " + report.publisher.lastName}</td>
|
||||||
<td className="border px-4 py-2">{report.location?.name}</td>
|
<td className="border px-2 py-2">{common.getDateFormated(new Date(report.date))}</td>
|
||||||
<td className="border px-4 py-2">
|
<td className="border px-2 py-2">{report.location?.name}</td>
|
||||||
|
<td className="border px-2 py-2">
|
||||||
{(report.experienceInfo === null || report.experienceInfo === "")
|
{(report.experienceInfo === null || report.experienceInfo === "")
|
||||||
? (
|
? (
|
||||||
<>
|
<>
|
||||||
@@ -99,12 +101,19 @@ export default function Reports() {
|
|||||||
Клипове: {report.videoCount} <br />
|
Клипове: {report.videoCount} <br />
|
||||||
Адреси / Телефони: {report.returnVisitInfoCount} <br />
|
Адреси / Телефони: {report.returnVisitInfoCount} <br />
|
||||||
</>
|
</>
|
||||||
|
) : (report.placementCount > 0) ? (
|
||||||
|
<>
|
||||||
|
<div><strong>Отзив</strong></div>
|
||||||
|
<div dangerouslySetInnerHTML={{ __html: report.experienceInfo }} />
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div><strong>Случка</strong></div>
|
<div><strong>Случка</strong></div>
|
||||||
<div dangerouslySetInnerHTML={{ __html: report.experienceInfo }} />
|
<div dangerouslySetInnerHTML={{ __html: report.experienceInfo }} />
|
||||||
</>
|
</>
|
||||||
)}
|
)
|
||||||
|
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td className="border px-4 py-2">
|
<td className="border px-4 py-2">
|
||||||
|
|
||||||
@@ -122,8 +131,8 @@ export default function Reports() {
|
|||||||
</div>
|
</div>
|
||||||
</div >
|
</div >
|
||||||
</div >
|
</div >
|
||||||
</ProtectedRoute>
|
</ProtectedRoute >
|
||||||
</Layout>
|
</Layout >
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,19 @@ const PDFViewerPage = ({ pdfFiles }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<h1 className="text-3xl font-bold">Разрешителни</h1>
|
<h1 className="text-3xl font-bold p-4 pt-8">Разрешителни</h1>
|
||||||
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}
|
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}
|
||||||
|
{/* <p className="p-1">
|
||||||
|
{pdfFiles.map((file, index) => (
|
||||||
|
<p className="p-2">
|
||||||
|
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
|
||||||
|
Свали: {file.name}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
))}
|
||||||
|
</p> */}
|
||||||
{pdfFiles.map((file, index) => (
|
{pdfFiles.map((file, index) => (
|
||||||
|
|
||||||
// <React.Fragment key={file.name}>
|
// <React.Fragment key={file.name}>
|
||||||
// {index > 0 && <div className="bg-gray-400 w-px h-6"></div>} {/* Vertical line separator */}
|
// {index > 0 && <div className="bg-gray-400 w-px h-6"></div>} {/* Vertical line separator */}
|
||||||
// <a
|
// <a
|
||||||
@@ -23,13 +32,18 @@ const PDFViewerPage = ({ pdfFiles }) => {
|
|||||||
// {file.name}
|
// {file.name}
|
||||||
// </a>
|
// </a>
|
||||||
// </React.Fragment>
|
// </React.Fragment>
|
||||||
<div style={{ width: 'calc(100% - 1rem)', height: '100%' }} className='py-2'>
|
<> <p className="pt-2">
|
||||||
< object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}>
|
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
|
||||||
<p>Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: <a href={file.url}>Свали {file.name}</a>.</p>
|
Свали: {file.name}
|
||||||
<p>Your browser does not support PDFs. Please download the PDF to view it: <a href={file.url}> {file.name}</a>.</p>
|
</a>
|
||||||
</object>
|
</p>
|
||||||
</div>
|
<div style={{ width: 'calc(100% - 1rem)', height: '100%' }} className='py-2'>
|
||||||
|
< object data={file.url} type="application/pdf" style={{ width: '100%', height: '100%' }}>
|
||||||
|
<p>Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: <a href={file.url}>Свали {file.name}</a>.</p>
|
||||||
|
<p>Your browser does not support PDFs. Please download the PDF to view it: <a href={file.url}> {file.name}</a>.</p>
|
||||||
|
</object>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</Layout >
|
</Layout >
|
||||||
|
|||||||
Reference in New Issue
Block a user