raibaebe commited on
Commit
16f0082
·
verified ·
1 Parent(s): 0658440

action View is workable

Browse files
Files changed (4) hide show
  1. components/navbar.js +2 -2
  2. data.html +6 -6
  3. report-detail.html +144 -0
  4. style.css +23 -1
components/navbar.js CHANGED
@@ -56,10 +56,10 @@ class CustomNavbar extends HTMLElement {
56
  </a>
57
  <div class="nav-links">
58
  <a href="/">Home</a>
59
- <a href="/data/">View Data</a>
60
  <a href="/admin/">Admin</a>
61
  <a href="/logout/">Logout</a>
62
- </div>
63
  </div>
64
  </nav>
65
  `;
 
56
  </a>
57
  <div class="nav-links">
58
  <a href="/">Home</a>
59
+ <a href="/data.html">View Data</a>
60
  <a href="/admin/">Admin</a>
61
  <a href="/logout/">Logout</a>
62
+ </div>
63
  </div>
64
  </nav>
65
  `;
data.html CHANGED
@@ -45,10 +45,10 @@
45
  <td>2023-10-15</td>
46
  <td>1,245</td>
47
  <td>
48
- <a href="#" class="text-blue-600 hover:text-blue-800 flex items-center">
49
  <i data-feather="eye" class="w-4 h-4 mr-1"></i> View
50
  </a>
51
- </td>
52
  </tr>
53
  <tr>
54
  <td>RPT-2023-044</td>
@@ -57,10 +57,10 @@
57
  <td>2023-10-10</td>
58
  <td>892</td>
59
  <td>
60
- <a href="#" class="text-blue-600 hover:text-blue-800 flex items-center">
61
  <i data-feather="eye" class="w-4 h-4 mr-1"></i> View
62
  </a>
63
- </td>
64
  </tr>
65
  <tr>
66
  <td>RPT-2023-043</td>
@@ -69,10 +69,10 @@
69
  <td>2023-10-05</td>
70
  <td>3,421</td>
71
  <td>
72
- <a href="#" class="text-blue-600 hover:text-blue-800 flex items-center">
73
  <i data-feather="eye" class="w-4 h-4 mr-1"></i> View
74
  </a>
75
- </td>
76
  </tr>
77
  </tbody>
78
  </table>
 
45
  <td>2023-10-15</td>
46
  <td>1,245</td>
47
  <td>
48
+ <a href="/report-detail.html?id=RPT-2023-045" class="text-blue-600 hover:text-blue-800 flex items-center">
49
  <i data-feather="eye" class="w-4 h-4 mr-1"></i> View
50
  </a>
51
+ </td>
52
  </tr>
53
  <tr>
54
  <td>RPT-2023-044</td>
 
57
  <td>2023-10-10</td>
58
  <td>892</td>
59
  <td>
60
+ <a href="/report-detail.html?id=RPT-2023-044" class="text-blue-600 hover:text-blue-800 flex items-center">
61
  <i data-feather="eye" class="w-4 h-4 mr-1"></i> View
62
  </a>
63
+ </td>
64
  </tr>
65
  <tr>
66
  <td>RPT-2023-043</td>
 
69
  <td>2023-10-05</td>
70
  <td>3,421</td>
71
  <td>
72
+ <a href="/report-detail.html?id=RPT-2023-043" class="text-blue-600 hover:text-blue-800 flex items-center">
73
  <i data-feather="eye" class="w-4 h-4 mr-1"></i> View
74
  </a>
75
+ </td>
76
  </tr>
77
  </tbody>
78
  </table>
report-detail.html ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Report Detail | DataVault Pro</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ </head>
12
+ <body class="bg-gray-50 min-h-screen">
13
+ <custom-navbar></custom-navbar>
14
+
15
+ <main class="container mx-auto px-4 py-8">
16
+ <div class="max-w-6xl mx-auto">
17
+ <div class="bg-white rounded-lg shadow-sm p-6 mb-8">
18
+ <div class="flex justify-between items-center mb-6">
19
+ <div class="flex items-center">
20
+ <i data-feather="file-text" class="text-blue-600 mr-3"></i>
21
+ <h1 class="text-2xl font-semibold text-gray-800" id="report-title">Report Details</h1>
22
+ </div>
23
+ <a href="/data.html" class="text-sm text-blue-600 hover:text-blue-800 flex items-center">
24
+ <i data-feather="arrow-left" class="mr-1"></i> Back to reports
25
+ </a>
26
+ </div>
27
+
28
+ <div class="grid md:grid-cols-3 gap-6 mb-8">
29
+ <div class="bg-gray-50 p-4 rounded-lg">
30
+ <p class="text-sm text-gray-500">Report ID</p>
31
+ <p class="font-medium" id="report-id">RPT-2023-045</p>
32
+ </div>
33
+ <div class="bg-gray-50 p-4 rounded-lg">
34
+ <p class="text-sm text-gray-500">Category</p>
35
+ <p class="font-medium" id="report-category">Finance</p>
36
+ </div>
37
+ <div class="bg-gray-50 p-4 rounded-lg">
38
+ <p class="text-sm text-gray-500">Last Updated</p>
39
+ <p class="font-medium" id="report-date">2023-10-15</p>
40
+ </div>
41
+ </div>
42
+
43
+ <div class="overflow-x-auto">
44
+ <table class="data-table w-full">
45
+ <thead>
46
+ <tr>
47
+ <th>ID</th>
48
+ <th>Name</th>
49
+ <th>Value</th>
50
+ <th>Change</th>
51
+ <th>Status</th>
52
+ </tr>
53
+ </thead>
54
+ <tbody id="report-data">
55
+ <!-- Data will be populated by JavaScript -->
56
+ </tbody>
57
+ </table>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </main>
62
+
63
+ <custom-footer></custom-footer>
64
+
65
+ <script src="components/navbar.js"></script>
66
+ <script src="components/footer.js"></script>
67
+ <script src="script.js"></script>
68
+ <script>
69
+ feather.replace();
70
+
71
+ // Get report ID from URL
72
+ const urlParams = new URLSearchParams(window.location.search);
73
+ const reportId = urlParams.get('id');
74
+
75
+ // Sample report data (in a real app, this would come from an API)
76
+ const reports = {
77
+ 'RPT-2023-045': {
78
+ title: 'Quarterly Financial Summary',
79
+ category: 'Finance',
80
+ date: '2023-10-15',
81
+ data: [
82
+ {id: 'Q1-2023', name: 'Q1 Revenue', value: '$1,250,000', change: '+12%', status: 'positive'},
83
+ {id: 'Q2-2023', name: 'Q2 Revenue', value: '$1,450,000', change: '+16%', status: 'positive'},
84
+ {id: 'Q3-2023', name: 'Q3 Revenue', value: '$1,320,000', change: '-9%', status: 'negative'},
85
+ {id: 'Q3-2023', name: 'Operating Costs', value: '$980,000', change: '+5%', status: 'neutral'},
86
+ {id: 'Q3-2023', name: 'Net Profit', value: '$340,000', change: '-18%', status: 'negative'}
87
+ ]
88
+ },
89
+ 'RPT-2023-044': {
90
+ title: 'Customer Satisfaction Survey',
91
+ category: 'Marketing',
92
+ date: '2023-10-10',
93
+ data: [
94
+ {id: 'CS-001', name: 'Overall Satisfaction', value: '4.2/5', change: '+0.3', status: 'positive'},
95
+ {id: 'CS-002', name: 'Product Quality', value: '4.5/5', change: '+0.1', status: 'positive'},
96
+ {id: 'CS-003', name: 'Customer Support', value: '3.8/5', change: '-0.2', status: 'negative'},
97
+ {id: 'CS-004', name: 'Likely to Recommend', value: '4.0/5', change: '0.0', status: 'neutral'}
98
+ ]
99
+ },
100
+ 'RPT-2023-043': {
101
+ title: 'Inventory Status Report',
102
+ category: 'Operations',
103
+ date: '2023-10-05',
104
+ data: [
105
+ {id: 'INV-1001', name: 'Premium Widget', value: '150 units', change: '-20', status: 'neutral'},
106
+ {id: 'INV-1002', name: 'Standard Gadget', value: '89 units', change: '-45', status: 'negative'},
107
+ {id: 'INV-1003', name: 'Deluxe Component', value: '0 units', change: '-120', status: 'negative'},
108
+ {id: 'INV-1004', name: 'Basic Model', value: '320 units', change: '+80', status: 'positive'}
109
+ ]
110
+ }
111
+ };
112
+
113
+ // Populate report data
114
+ if (reportId && reports[reportId]) {
115
+ const report = reports[reportId];
116
+ document.getElementById('report-title').textContent = report.title;
117
+ document.getElementById('report-id').textContent = reportId;
118
+ document.getElementById('report-category').textContent = report.category;
119
+ document.getElementById('report-date').textContent = report.date;
120
+
121
+ const tableBody = document.getElementById('report-data');
122
+ report.data.forEach(item => {
123
+ const row = document.createElement('tr');
124
+ row.innerHTML = `
125
+ <td>${item.id}</td>
126
+ <td>${item.name}</td>
127
+ <td>${item.value}</td>
128
+ <td class="${getStatusClass(item.status)}">${item.change}</td>
129
+ <td><span class="status-badge ${getStatusClass(item.status)}">${item.status}</span></td>
130
+ `;
131
+ tableBody.appendChild(row);
132
+ });
133
+ }
134
+
135
+ function getStatusClass(status) {
136
+ switch(status) {
137
+ case 'positive': return 'text-green-600';
138
+ case 'negative': return 'text-red-600';
139
+ default: return 'text-gray-600';
140
+ }
141
+ }
142
+ </script>
143
+ </body>
144
+ </html>
style.css CHANGED
@@ -26,11 +26,33 @@ body {
26
  border-bottom: 1px solid #e2e8f0;
27
  color: #475569;
28
  }
29
-
30
  .data-table tr:hover td {
31
  background-color: #f8fafc;
32
  }
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  /* Login error message */
35
  .error-message {
36
  color: #dc2626;
 
26
  border-bottom: 1px solid #e2e8f0;
27
  color: #475569;
28
  }
 
29
  .data-table tr:hover td {
30
  background-color: #f8fafc;
31
  }
32
 
33
+ .status-badge {
34
+ display: inline-block;
35
+ padding: 0.25rem 0.5rem;
36
+ border-radius: 0.25rem;
37
+ font-size: 0.75rem;
38
+ font-weight: 500;
39
+ text-transform: capitalize;
40
+ }
41
+
42
+ .status-badge.text-green-600 {
43
+ background-color: #ecfdf5;
44
+ color: #059669;
45
+ }
46
+
47
+ .status-badge.text-red-600 {
48
+ background-color: #fee2e2;
49
+ color: #dc2626;
50
+ }
51
+
52
+ .status-badge.text-gray-600 {
53
+ background-color: #f3f4f6;
54
+ color: #4b5563;
55
+ }
56
  /* Login error message */
57
  .error-message {
58
  color: #dc2626;