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>Support Tickets</title>
|
---|
7 | <link rel="stylesheet" href="/css/main.css">
|
---|
8 | <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
|
---|
9 | </head>
|
---|
10 | <style>
|
---|
11 | body {
|
---|
12 | background: url('images/flight.jpg') no-repeat center center fixed;
|
---|
13 | background-size: cover;
|
---|
14 | display: flex;
|
---|
15 | flex-direction: column;
|
---|
16 | align-items: center;
|
---|
17 | justify-content: center;
|
---|
18 | height: 100vh;
|
---|
19 | margin: 0;
|
---|
20 | font-family: Arial, sans-serif;
|
---|
21 | padding-top: 30px;
|
---|
22 | margin-top: 10px;
|
---|
23 | }
|
---|
24 |
|
---|
25 | .header {
|
---|
26 | position: absolute;
|
---|
27 | top: 0;
|
---|
28 | left: 0;
|
---|
29 | display: flex;
|
---|
30 | align-items: center;
|
---|
31 | background-color: rebeccapurple;
|
---|
32 | padding: 10px;
|
---|
33 | width: 100%;
|
---|
34 | z-index: 10;
|
---|
35 | margin-bottom: 10px;
|
---|
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 |
|
---|
62 | select {
|
---|
63 | -webkit-appearance: none;
|
---|
64 | -moz-appearance: none;
|
---|
65 | appearance: none;
|
---|
66 | border: 0;
|
---|
67 | outline: 0;
|
---|
68 | font: inherit;
|
---|
69 | width: 20em;
|
---|
70 | height: 3em;
|
---|
71 | padding: 0 4em 0 1em;
|
---|
72 | background: url(https://upload.wikimedia.org/wikipedia/commons/9/9d/Caret_down_font_awesome_whitevariation.svg) no-repeat right 0.8em center/1.4em, linear-gradient(to left, rgba(255, 255, 255, 0.3) 3em, rgba(255, 255, 255, 0.2) 3em);
|
---|
73 | color: white;
|
---|
74 | border-radius: 0.25em;
|
---|
75 | box-shadow: 0 0 1em 0 rgba(0, 0, 0, 0.2);
|
---|
76 | cursor: pointer;
|
---|
77 | }
|
---|
78 | select option {
|
---|
79 | color: inherit;
|
---|
80 | background-color: #320a28;
|
---|
81 | }
|
---|
82 | select:focus {
|
---|
83 | outline: none;
|
---|
84 | }
|
---|
85 | select::-ms-expand {
|
---|
86 | display: none;
|
---|
87 | }
|
---|
88 |
|
---|
89 | .search-form-container h2 {
|
---|
90 | color: white;
|
---|
91 | padding-top: 110px;
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | .flights-list-container h2{
|
---|
96 | padding-top: 110px;
|
---|
97 | }
|
---|
98 | .flights-list .flight-item {
|
---|
99 | margin-bottom: 15px;
|
---|
100 | }
|
---|
101 |
|
---|
102 | .flights-list .flight-item span {
|
---|
103 | margin-right: 15px;
|
---|
104 | }
|
---|
105 |
|
---|
106 |
|
---|
107 | .popup textarea{
|
---|
108 | width: 100%;
|
---|
109 | padding: 10px;
|
---|
110 | margin-top: 10px;
|
---|
111 | border: 1px solid #ccc;
|
---|
112 | border-radius: 4px;
|
---|
113 | resize: vertical;
|
---|
114 | box-sizing: border-box;
|
---|
115 | }
|
---|
116 |
|
---|
117 |
|
---|
118 | .popup button {
|
---|
119 | margin-top: 10px;
|
---|
120 | background-color: rebeccapurple;
|
---|
121 | color: white;
|
---|
122 | border: none;
|
---|
123 | padding: 5px;
|
---|
124 | cursor: pointer;
|
---|
125 | }
|
---|
126 |
|
---|
127 | .popup button:hover {
|
---|
128 | background-color: mediumpurple;
|
---|
129 | }
|
---|
130 | .ticket-list{
|
---|
131 | margin-top:20px;
|
---|
132 | padding-top:60px;
|
---|
133 | }
|
---|
134 |
|
---|
135 |
|
---|
136 | </style>
|
---|
137 | <body>
|
---|
138 |
|
---|
139 | <div id="app" class="support-ticket-container">
|
---|
140 | <header class="header">
|
---|
141 | <button @click="fetchResolved">Fetch Resolved Tickets</button>
|
---|
142 | <button @click="fetchTickets">Fetch Unresolved Tickets</button>
|
---|
143 | </header>
|
---|
144 |
|
---|
145 | <h1>Support Tickets</h1>
|
---|
146 | <div class="ticket-list">
|
---|
147 | <div class="ticket-item" v-for="ticket in tickets" :key="ticket.ticketId">
|
---|
148 | <div class="ticket-info">
|
---|
149 | <p><strong>Subject:</strong> {{ ticket.subject }}</p>
|
---|
150 | <p><strong>Description:</strong> {{ ticket.description }}</p>
|
---|
151 | <p><strong>Date Resolved:</strong> {{ ticket.dateResolved }}</p>
|
---|
152 | </div>
|
---|
153 | <div class="ticket-actions">
|
---|
154 | <button @click="resolveTicket(ticket.ticketId)">Resolve</button>
|
---|
155 | </div>
|
---|
156 | </div>
|
---|
157 | </div>
|
---|
158 | </div>
|
---|
159 |
|
---|
160 | <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
|
---|
161 | <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
---|
162 |
|
---|
163 | <script>
|
---|
164 | new Vue({
|
---|
165 | el: '#app',
|
---|
166 | data: {
|
---|
167 | tickets: []
|
---|
168 | },
|
---|
169 | mounted() {
|
---|
170 | this.fetchTickets();
|
---|
171 | },
|
---|
172 | methods: {
|
---|
173 | fetchTickets() {
|
---|
174 | axios.get('http://localhost:8080/api/support-tickets')
|
---|
175 | .then(response => {
|
---|
176 | this.tickets = response.data;
|
---|
177 | console.log(response.data);
|
---|
178 | })
|
---|
179 | .catch(error => {
|
---|
180 | console.error("Error fetching tickets:", error);
|
---|
181 | });
|
---|
182 | },
|
---|
183 | fetchResolved() {
|
---|
184 | axios.get('http://localhost:8080/api/support-tickets/resolved')
|
---|
185 | .then(response => {
|
---|
186 | this.tickets = response.data;
|
---|
187 | console.log(response.data);
|
---|
188 | })
|
---|
189 | .catch(error => {
|
---|
190 | console.error("Error fetching resolved tickets:", error);
|
---|
191 | });
|
---|
192 | },
|
---|
193 | resolveTicket(ticketId) {
|
---|
194 | console.log(ticketId);
|
---|
195 | const status = 'RESOLVED';
|
---|
196 | axios.put(`api/support-tickets/${ticketId}/${status}`, {},
|
---|
197 | {
|
---|
198 | headers: {
|
---|
199 | 'Content-Type': 'application/json'
|
---|
200 | }
|
---|
201 | })
|
---|
202 | .then(() => {
|
---|
203 | alert(`Ticket ${ticketId} resolved.`);
|
---|
204 | this.fetchTickets();
|
---|
205 | })
|
---|
206 | .catch(error => {
|
---|
207 | console.error("Error resolving ticket:", error.response.data);
|
---|
208 | });
|
---|
209 | }
|
---|
210 |
|
---|
211 | }
|
---|
212 | });
|
---|
213 | </script>
|
---|
214 |
|
---|
215 |
|
---|
216 | </body>
|
---|
217 | </html>
|
---|