source: src/main/resources/static/ViewReport.html@ 62bba0c

Last change on this file since 62bba0c was 62bba0c, checked in by ste08 <sjovanoska@…>, 3 months ago

Report working, Wishlist partly working.

  • Property mode set to 100644
File size: 5.0 KB
Line 
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 <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
7 <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
8 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
9 <link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css'>
10
11 <style>
12 body {
13 background: url('images/flight.jpg') no-repeat center center fixed;
14 background-size: cover;
15 font-family: Arial, sans-serif;
16 margin: 20px;
17 padding: 20px;
18 text-align: center;
19 }
20
21 h1 {
22 color: white;
23 font-size: 20px;
24 padding-top:50px;
25 }
26 .header {
27 position: absolute;
28 top: 0;
29 left: 0;
30 display: flex;
31 align-items: center;
32 background-color: rebeccapurple;
33 padding: 10px;
34 width: 100%;
35 z-index: 10;
36 }
37 .header img {
38 width: 40px;
39 height: 40px;
40 margin-right: 20px;
41 }
42
43 .header h1 {
44 color: white;
45 margin: 0;
46 font-size: 15px;
47 padding-right: 50px;
48 }
49
50 .header button {
51 background-color: transparent;
52 border: none;
53 color: white;
54 font-size: 14px;
55 }
56
57 .header button:hover {
58 background-color: transparent;
59 cursor: pointer;
60 }
61 table {
62 width: 80%;
63 margin: 20px auto;
64 border-collapse: collapse;
65 background-color: #fff;
66 box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
67 }
68
69 th, td {
70 padding: 12px;
71 border: 1px solid #ddd;
72 text-align: left;
73 }
74
75 th {
76 background-color: rebeccapurple;
77 color: white;
78 }
79
80 tr:hover {
81 background-color: #f1f1f1;
82 }
83 .popup-overlay {
84 position: fixed;
85 top: 0;
86 left: 0;
87 width: 100%;
88 height: 100%;
89 background: rgba(0, 0, 0, 0.7);
90 display: flex;
91 align-items: center;
92 justify-content: center;
93 z-index: 1000;
94 overflow: hidden;
95 }
96
97 .popup textarea{
98 width: 100%;
99 padding: 10px;
100 margin-top: 10px;
101 border: 1px solid #ccc;
102 border-radius: 4px;
103 resize: vertical;
104 box-sizing: border-box;
105 }
106
107 .popup {
108 background-color: white;
109 padding: 20px;
110 width: 300px;
111 border-radius: 10px;
112 z-index: 1001; /* Ensure it's above the overlay */
113 }
114
115 .popup button {
116 margin-top: 10px;
117 background-color: rebeccapurple;
118 color: white;
119 border: none;
120 padding: 5px;
121 cursor: pointer;
122 }
123
124 .popup button:hover {
125 background-color: mediumpurple;
126 }
127 </style>
128 <title>Database Views</title>
129</head>
130<body>
131<div id="app">
132 <header class="header">
133 <button @click="home"><img src="/images/home.png" alt="Home Icon"></button>
134 <button @click="goToWishlistPage">🤍</button>
135 <button @click="goToReports">Monthly Report</button>
136 <button @click="home">Log Out</button>
137 </header>
138 <h1>Top Monthly Report</h1>
139 <table>
140 <thead>
141 <tr>
142 <th>Month</th>
143 <th>Category</th>
144 <th>Name</th>
145 <th>Count</th>
146 </tr>
147 </thead>
148 <tbody>
149 <tr v-for="(report, index) in reports" :key="index">
150 <td>{{ report.month }}</td>
151 <td>{{ report.category }}</td>
152 <td>{{ report.name }}</td>
153 <td>{{ report.count }}</td>
154 </tr>
155 </tbody>
156 </table>
157</div>
158
159<script>
160 new Vue({
161 el: '#app',
162 data: {
163 reports: []
164 },
165 mounted() {
166 this.fetchReport();
167 },
168 methods: {
169 async fetchReport() {
170 try {
171 const response = await fetch('http://localhost:8080/api/views');
172 this.reports = await response.json();
173 console.log("Fetched data:", this.reports);
174 } catch (error) {
175 console.error("Error fetching reports:", error);
176 }
177 },
178 home() {
179 window.location.href = '/';
180 },
181 goToReports() {
182 window.location.href = '/views'
183 },
184 async goToWishlistPage() {
185 window.location.href = `/wishlists?userId=${encodeURIComponent(this.userId)}`;
186 }
187 }
188 });
189</script>
190</body>
191</html>
Note: See TracBrowser for help on using the repository browser.