Spaces:
Running
Running
Download data.html from raibaebe/datavault-pro: direct link, hf CLI and curl.
- Browser
- Download file 6.83 kB
-
https://huggingface.co/spaces/raibaebe/datavault-pro/resolve/main/data.html
- Command line
-
hf download hf://spaces/raibaebe/datavault-pro/data.html
-
curl -L -o data.html https://huggingface.co/spaces/raibaebe/datavault-pro/resolve/main/data.html
6.83 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Data View | DataVault Pro</title> | |
| <link rel="stylesheet" href="style.css"> | |
| <script src="https://cdn.tailwindcss.com"> | |
| // Fetch report details data | |
| async function loadReportDetails() { | |
| try { | |
| const response = await fetch('https://jsonplaceholder.typicode.com/comments'); | |
| const comments = await response.json(); | |
| const detailsTable = document.querySelectorAll('.data-table')[1]; | |
| const tableBody = detailsTable.querySelector('tbody'); | |
| tableBody.innerHTML = ''; | |
| // Format and display the data | |
| comments.slice(0, 5).forEach(comment => { | |
| const status = ['In Stock', 'Low Stock', 'Out of Stock'][Math.floor(Math.random() * 3)]; | |
| const statusClass = { | |
| 'In Stock': 'bg-green-100 text-green-800', | |
| 'Low Stock': 'bg-yellow-100 text-yellow-800', | |
| 'Out of Stock': 'bg-red-100 text-red-800' | |
| }[status]; | |
| const row = document.createElement('tr'); | |
| row.innerHTML = ` | |
| <td>${comment.id}</td> | |
| <td>${comment.name.split(' ')[0]} Product</td> | |
| <td>${comment.email.split('@')[0]}</td> | |
| <td>${Math.floor(Math.random() * 500)}</td> | |
| <td>${(Math.random() * 100).toFixed(2)}</td> | |
| <td><span class="px-2 py-1 ${statusClass} text-xs rounded-full">${status}</span></td> | |
| `; | |
| tableBody.appendChild(row); | |
| }); | |
| } catch (error) { | |
| console.error('Error loading report details:', error); | |
| } | |
| } | |
| loadReportDetails(); | |
| </script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <custom-navbar></custom-navbar> | |
| <main class="container mx-auto px-4 py-8"> | |
| <div class="max-w-6xl mx-auto"> | |
| <div class="bg-white rounded-lg shadow-sm p-6 mb-8"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <div class="flex items-center"> | |
| <i data-feather="database" class="text-blue-600 mr-3"></i> | |
| <h1 class="text-2xl font-semibold text-gray-800">Data Reports</h1> | |
| </div> | |
| <div class="text-sm text-gray-500"> | |
| Last updated: <span id="last-updated">Loading...</span> | |
| </div> | |
| </div> | |
| <div class="overflow-x-auto"> | |
| <table class="data-table w-full"> | |
| <thead> | |
| <tr> | |
| <th>Report ID</th> | |
| <th>Report Name</th> | |
| <th>Category</th> | |
| <th>Date</th> | |
| <th>Records</th> | |
| <th>Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <!-- Reports will be loaded dynamically --> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <div class="bg-white rounded-lg shadow-sm p-6"> | |
| <h2 class="text-lg font-medium text-gray-800 mb-4 flex items-center"> | |
| <i data-feather="file-text" class="text-gray-600 mr-2"></i> Report Details | |
| </h2> | |
| <div class="overflow-x-auto"> | |
| <table class="data-table w-full"> | |
| <thead> | |
| <tr> | |
| <th>ID</th> | |
| <th>Product</th> | |
| <th>Category</th> | |
| <th>Qty</th> | |
| <th>Price</th> | |
| <th>Status</th> | |
| </tr> | |
| </thead> | |
| <tbody> | |
| <!-- Report details will be loaded dynamically --> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| <custom-footer></custom-footer> | |
| <script src="components/navbar.js"></script> | |
| <script src="components/footer.js"></script> | |
| <script src="script.js"></script> | |
| <script> | |
| feather.replace(); | |
| // Fetch reports data from API | |
| async function loadReports() { | |
| try { | |
| const response = await fetch('https://jsonplaceholder.typicode.com/posts'); | |
| const reports = await response.json(); | |
| const tableBody = document.querySelector('.data-table tbody'); | |
| tableBody.innerHTML = ''; | |
| // Format and display the data | |
| reports.slice(0, 5).forEach(report => { | |
| const row = document.createElement('tr'); | |
| row.innerHTML = ` | |
| <td>RPT-${report.id}</td> | |
| <td>${report.title}</td> | |
| <td>${report.userId === 1 ? 'Finance' : report.userId === 2 ? 'Marketing' : 'Operations'}</td> | |
| <td>2023-${Math.floor(Math.random() * 12) + 1}-${Math.floor(Math.random() * 28) + 1}</td> | |
| <td>${Math.floor(Math.random() * 5000) + 100}</td> | |
| <td> | |
| <a href="/report-detail.html?id=RPT-${report.id}" class="text-blue-600 hover:text-blue-800 flex items-center"> | |
| <i data-feather="eye" class="w-4 h-4 mr-1"></i> View | |
| </a> | |
| </td> | |
| `; | |
| tableBody.appendChild(row); | |
| }); | |
| // Update last updated time | |
| document.getElementById('last-updated').textContent = new Date().toLocaleString(); | |
| feather.replace(); | |
| } catch (error) { | |
| console.error('Error loading reports:', error); | |
| document.getElementById('last-updated').textContent = 'Error loading data'; | |
| } | |
| } | |
| loadReports(); | |
| </script> | |
| </body> | |
| </html> |