fix permits UI and content upload/delete API

This commit is contained in:
Dobromir Popov
2024-05-07 21:03:34 +03:00
parent cbf9cf9485
commit 7b741afa06
2 changed files with 85 additions and 140 deletions

View File

@ -44,17 +44,25 @@ const PDFViewerPage = ({ pdfFiles }) => {
<Layout>
<h1 className="text-3xl font-bold p-4 pt-8">Разрешителни</h1>
<ProtectedRoute allowedRoles={[UserRole.ADMIN]} deniedMessage="">
<input type="file" onChange={handleFileUpload} className="mb-4" />
{files.map((file, index) => (
<div key={file.name} className="py-2">
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
{file.name}
</a>
<button onClick={() => handleFileDelete(file.name)} className="ml-4 bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded">
изтрий
</button>
<div className="border border-blue-500 border-solid p-2">
<div className="mb-4">
За да качите файл кликнете на бутона по-долу и изберете файл от вашия компютър.
</div>
))}
<input type="file" onChange={handleFileUpload} className="mb-4" />
<div className="mb-4">
Съществуващи файлове:
</div>
{files.map((file, index) => (
<div key={file.name} className="py-2">
<a href={file.url} className="text-blue-600 hover:text-blue-800 visited:text-purple-600 underline" target='_blank'>
{file.name}
</a>
<button onClick={() => handleFileDelete(file.name)} className="ml-4 bg-red-500 hover:bg-red-700 text-white font-bold py-1 px-2 rounded">
изтрий
</button>
</div>
))}
</div>
</ProtectedRoute>
<div style={{ width: '100%', height: 'calc(100vh - 100px)' }}> {/* Adjust the 100px based on your header/footer size */}