Changeset c064a42
- Timestamp:
- 02/24/25 23:48:34 (3 months ago)
- Branches:
- master
- Children:
- 8a947b9
- Parents:
- 07fe0be
- Location:
- src/main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/skychasemk/controller/SupportTicketController.java
r07fe0be rc064a42 39 39 } 40 40 41 @PutMapping("/{ticketI D}/status")42 public ResponseEntity<SupportTicket> updateTicket(@PathVariable("ticketI D") Integer ticketID, @RequestBodyString status) {41 @PutMapping("/{ticketId}/{status}") 42 public ResponseEntity<SupportTicket> updateTicket(@PathVariable("ticketId") Integer ticketId, @PathVariable String status) { 43 43 try { 44 44 SupportTicket.TicketStatus newStatus = SupportTicket.TicketStatus.valueOf(status.toUpperCase()); 45 return ResponseEntity.ok(supportTicketService.updateTicket(ticketI D, newStatus));45 return ResponseEntity.ok(supportTicketService.updateTicket(ticketId, newStatus)); 46 46 } catch (IllegalArgumentException e) { 47 47 return ResponseEntity.badRequest().build(); -
src/main/java/com/example/skychasemk/model/SupportTicket.java
r07fe0be rc064a42 11 11 public class SupportTicket { 12 12 13 @Setter14 13 @Id 15 14 @GeneratedValue(strategy = GenerationType.IDENTITY) 16 @Column(name = "TicketID") 15 @Column(name = "ticketid") 16 private Integer ticketId; 17 17 18 private Integer ticketID; 18 public Integer getTicketId() { 19 return ticketId; 20 } 21 22 public void setTicketId(Integer ticketId) { 23 this.ticketId = ticketId; 24 } 25 19 26 @Setter 20 27 @Getter -
src/main/java/com/example/skychasemk/repository/SupportTicketRepository.java
r07fe0be rc064a42 2 2 3 3 import com.example.skychasemk.model.SupportTicket; 4 import org.springframework.data.jpa.repository.EntityGraph; 4 5 import org.springframework.data.jpa.repository.JpaRepository; 5 6 import org.springframework.data.jpa.repository.Query; -
src/main/java/com/example/skychasemk/services/SupportTicketService.java
r07fe0be rc064a42 26 26 } 27 27 public List<SupportTicket> getAllTickets() { 28 return supportTicketRepository.findTickets(); 28 List<SupportTicket> tickets = supportTicketRepository.findTickets(); 29 tickets.forEach(ticket -> System.out.println(ticket.getTicketId() + " - " + ticket.getStatus())); 30 return tickets; 29 31 } 30 32 public List<SupportTicket> getResolvedTickets() { 31 return supportTicketRepository.findResolvedTickets(); 33 List<SupportTicket> tickets = supportTicketRepository.findResolvedTickets(); 34 tickets.forEach(ticket -> System.out.println(ticket.getTicketId() + " - " + ticket.getStatus())); 35 return tickets; 32 36 } 33 37 -
src/main/resources/static/SupportTickets.html
r07fe0be rc064a42 8 8 <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> 9 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> 10 137 <body> 11 138 12 139 <div id="app" class="support-ticket-container"> 13 <button @click="fetchResolved">Fetch Resolved Tickets</button> 14 <button @click="fetchTickets">Fetch Unresolved Tickets</button> 140 <header class="header"> 141 <button @click="fetchResolved">Fetch Resolved Tickets</button> 142 <button @click="fetchTickets">Fetch Unresolved Tickets</button> 143 </header> 144 15 145 <h1>Support Tickets</h1> 16 146 <div class="ticket-list"> 17 <div class="ticket-item" v-for="ticket in tickets" :key="ticket.ticketI D">147 <div class="ticket-item" v-for="ticket in tickets" :key="ticket.ticketId"> 18 148 <div class="ticket-info"> 19 149 <p><strong>Subject:</strong> {{ ticket.subject }}</p> … … 22 152 </div> 23 153 <div class="ticket-actions"> 24 <button @click="resolveTicket(ticket.ticketI D)">Resolve</button>154 <button @click="resolveTicket(ticket.ticketId)">Resolve</button> 25 155 </div> 26 156 </div> … … 61 191 }); 62 192 }, 63 resolveTicket(ticketI D) {64 console.log(ticketI D);193 resolveTicket(ticketId) { 194 console.log(ticketId); 65 195 const status = 'RESOLVED'; 66 axios.put(` http://localhost:8080/api/support-tickets/${ticketID}/status`, status,196 axios.put(`api/support-tickets/${ticketId}/${status}`, {}, 67 197 { 68 198 headers: { 69 'Content-Type': ' text/plain'199 'Content-Type': 'application/json' 70 200 } 71 201 }) 72 202 .then(() => { 73 alert(`Ticket ${ticketI D} resolved.`);203 alert(`Ticket ${ticketId} resolved.`); 74 204 this.fetchTickets(); 75 205 })
Note:
See TracChangeset
for help on using the changeset viewer.