- Timestamp:
- 10/12/24 21:32:15 (5 weeks ago)
- Branches:
- master
- Parents:
- 743de55
- Location:
- src/main
- Files:
-
- 5 added
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/finki/it/terapijamkbackend/spring/controllers/AppointmentController.java
r743de55 r43c9090 94 94 try { 95 95 Long userId = appointmentService.updateAppointment(term); 96 System.out.println(userId);97 96 return ResponseEntity.ok(userId.toString()); 98 97 } catch (Exception e) { … … 120 119 try { 121 120 appointmentService.deleteAppointmentByTerm(term); 122 return ResponseEntity.noContent().build(); // Returns 204 No Content on success121 return ResponseEntity.noContent().build(); 123 122 } catch (IllegalArgumentException e) { 124 return ResponseEntity.notFound().build(); // Returns 404 Not Found if appointment doesn't exist123 return ResponseEntity.notFound().build(); 125 124 } 126 125 } … … 149 148 } 150 149 151 152 150 } -
src/main/java/finki/it/terapijamkbackend/spring/controllers/AuthController.java
r743de55 r43c9090 3 3 import finki.it.terapijamkbackend.spring.dto.LoginResponse; 4 4 import finki.it.terapijamkbackend.spring.entities.User; 5 import finki.it.terapijamkbackend.spring.entities.UserRole;6 5 import finki.it.terapijamkbackend.spring.services.UserService; 7 6 import jakarta.servlet.http.Cookie; … … 49 48 Cookie usernameCookie = new Cookie("username", temp.getUsername()); 50 49 usernameCookie.setPath("/"); 51 usernameCookie.setMaxAge(60 *5);50 usernameCookie.setMaxAge(600); 52 51 response.addCookie(usernameCookie); 52 53 Cookie roleCookie = new Cookie("role", temp.getUserRole().toString()); 54 roleCookie.setPath("/"); 55 roleCookie.setMaxAge(600); 56 response.addCookie(roleCookie); 53 57 54 58 return ResponseEntity.ok(loginResponse); -
src/main/java/finki/it/terapijamkbackend/spring/controllers/CouponController.java
r743de55 r43c9090 3 3 import finki.it.terapijamkbackend.spring.services.CouponsService; 4 4 import jakarta.persistence.EntityNotFoundException; 5 import jakarta.transaction.Transactional;6 5 import org.springframework.beans.factory.annotation.Autowired; 7 6 import org.springframework.http.HttpStatus; … … 20 19 @PutMapping("/createCoupon") 21 20 public ResponseEntity<Coupon> updateCoupon(@RequestBody Coupon couponItem) { 22 System.out.println(couponItem);23 21 if (couponItem.getTitle() == null || couponItem.getCode() == null) { 24 22 return ResponseEntity.badRequest().build(); … … 53 51 coupon.setCode(newCouponData.getCode()); 54 52 coupon.setDescription(newCouponData.getDescription()); 55 couponService.save(coupon); // Save the updated coupon53 couponService.save(coupon); 56 54 57 55 return ResponseEntity.ok().build(); 58 56 } 57 58 59 @GetMapping("/getCouponNames") 60 public ResponseEntity<List<String>> getCouponNames() { 61 List<String> couponNames = couponService.getCouponNames(); 62 return ResponseEntity.ok(couponNames); 63 } 59 64 } -
src/main/java/finki/it/terapijamkbackend/spring/controllers/EventController.java
r743de55 r43c9090 1 1 package finki.it.terapijamkbackend.spring.controllers; 2 2 3 import finki.it.terapijamkbackend.spring.entities.Coupon;4 3 import finki.it.terapijamkbackend.spring.entities.Event; 5 import finki.it.terapijamkbackend.spring.services.AppointmentService;6 4 import finki.it.terapijamkbackend.spring.services.EventService; 7 5 import jakarta.persistence.EntityNotFoundException; … … 23 21 @PutMapping("/createEvent") 24 22 public ResponseEntity<Event> updateEvent(@RequestBody Event eventItem) { 25 System.out.println(eventItem);26 23 if (eventItem.getTitle() == null || eventItem.getText() == null) { 27 24 return ResponseEntity.badRequest().build(); … … 57 54 event.setText(newEventData.getText()); 58 55 event.setImgSrc(newEventData.getImgSrc()); 59 eventService.saveEvent(event); // Save the updated coupon56 eventService.saveEvent(event); 60 57 61 58 return ResponseEntity.ok().build(); -
src/main/java/finki/it/terapijamkbackend/spring/controllers/RequestController.java
r743de55 r43c9090 37 37 @GetMapping("/listAll") 38 38 public List<TermsResponse> getRequestsByUser(@RequestParam("username") String username) { 39 System.out.println(username);40 39 List<Request>terms=requestService.findRequestsByUsername(username); 41 40 return terms.stream() -
src/main/java/finki/it/terapijamkbackend/spring/controllers/UserController.java
r743de55 r43c9090 45 45 response = new HashMap<>(); 46 46 response.put("message", "User created successfully!"); 47 System.out.println(response);48 47 return ResponseEntity.ok(response); 49 48 } catch (Exception e) { … … 54 53 @GetMapping("/editUser") 55 54 public ResponseEntity<User> getUser(@RequestParam String username) { 56 User user = userService.getUserByUsername(username); // Fetch user data from service55 User user = userService.getUserByUsername(username); 57 56 if (user != null) { 58 return ResponseEntity.ok(user); // Return user data as JSON57 return ResponseEntity.ok(user); 59 58 } else { 60 return ResponseEntity.notFound().build(); // Handle user not found59 return ResponseEntity.notFound().build(); 61 60 } 62 61 } … … 76 75 String oldUsername=getCookieValue(request, "username"); 77 76 User user = userService.updateUser(oldUsername, updatedUser); 78 return ResponseEntity.ok(user); // Return the updated user in the response77 return ResponseEntity.ok(user); 79 78 } catch (UserNotFoundException e) { 80 return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); // Return a 404 if user is not found79 return ResponseEntity.status(HttpStatus.NOT_FOUND).build(); 81 80 } catch (Exception e) { 82 return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); // Return a 500 for other errors81 return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build(); 83 82 } 84 83 } -
src/main/java/finki/it/terapijamkbackend/spring/controllers/WebController.java
r743de55 r43c9090 1 1 package finki.it.terapijamkbackend.spring.controllers; 2 2 3 import finki.it.terapijamkbackend.spring.services.UserService; 4 import org.springframework.beans.factory.annotation.Autowired; 3 5 import org.springframework.stereotype.Controller; 4 6 import org.springframework.web.bind.annotation.GetMapping; 5 7 8 6 9 @Controller 7 10 public class WebController { 8 9 11 @GetMapping(path="/") 10 12 public String index() { … … 51 53 return "html/adminCoupons"; 52 54 } 55 56 @GetMapping(path="/userInfo.html") 57 public String userInfo() { 58 return "html/userInfo"; 59 } 53 60 } -
src/main/java/finki/it/terapijamkbackend/spring/entities/Appointment.java
r743de55 r43c9090 26 26 private Long id; 27 27 28 @ManyToOne(fetch = FetchType.LAZY) // Fetch the related entity lazily to avoid loading all properties28 @ManyToOne(fetch = FetchType.LAZY) 29 29 @JoinColumn(name="request_id", referencedColumnName = "id") 30 30 @JsonIgnore -
src/main/java/finki/it/terapijamkbackend/spring/entities/Event.java
r743de55 r43c9090 25 25 26 26 private String title; 27 @Lob 28 @Column(name = "text", columnDefinition = "TEXT") 27 29 private String text; 28 @Lob // Indicates that this field can hold large data29 @Column(name = "img_src", columnDefinition = "TEXT") // Ensure column type is TEXT in database30 @Lob 31 @Column(name = "img_src", columnDefinition = "TEXT") 30 32 private String imgSrc; 31 33 -
src/main/java/finki/it/terapijamkbackend/spring/services/CouponsService.java
r743de55 r43c9090 9 9 import java.util.List; 10 10 import java.util.Optional; 11 import java.util.stream.Collectors; 11 12 12 13 @Service … … 33 34 return couponRepository.findByTitle(identifier); 34 35 } 36 public List<String> getCouponNames() { 37 return couponRepository.findAll().stream() 38 .map(Coupon::getCode) 39 .collect(Collectors.toList()); 40 } 35 41 36 42 public void save(Coupon coupon) { -
src/main/java/finki/it/terapijamkbackend/spring/services/EventService.java
r743de55 r43c9090 1 1 package finki.it.terapijamkbackend.spring.services; 2 2 3 import finki.it.terapijamkbackend.spring.entities.Coupon;4 3 import finki.it.terapijamkbackend.spring.entities.Event; 5 4 import finki.it.terapijamkbackend.spring.repositories.EventRepository; 6 import finki.it.terapijamkbackend.spring.repositories.UserRepository;7 5 import jakarta.persistence.EntityNotFoundException; 8 6 import org.springframework.beans.factory.annotation.Autowired; -
src/main/java/finki/it/terapijamkbackend/spring/services/RequestService.java
r743de55 r43c9090 41 41 public List<Request> findRequestsByUsername(String username) { 42 42 User user=userRepository.findByUsername(username).orElse(null); 43 System.out.println(user.getId());44 43 return requestRepository.findRequestsForFreeAppointments(user.getId()); 45 44 } -
src/main/java/finki/it/terapijamkbackend/spring/services/UserService.java
r743de55 r43c9090 58 58 } 59 59 60 return userRepository.save(existingUser); // Save the updated user back to the database60 return userRepository.save(existingUser); 61 61 } else { 62 62 throw new UserNotFoundException("User not found with username: " + username); -
src/main/resources/static/css/admin-terms.css
r743de55 r43c9090 44 44 } 45 45 #active{ 46 margin: 15px 0;46 padding: 15px; 47 47 display: flex; 48 48 flex-direction: column; 49 49 gap: 10px; 50 border: 1px solid #ccc; 51 border-radius: 5px; 52 background-color: #f9f9f9; 50 53 } 51 54 #frame{ … … 79 82 position: relative; 80 83 overflow: hidden; 81 /* transform: scale(1.25); */82 84 } 83 85 … … 131 133 cursor: pointer; 132 134 animation: to-top 1s forwards; 133 /* border-radius: 50%; */134 135 } 135 136 #frame > *:hover{ 136 137 background-color:white; 137 transition: background-color 0.3s, transform 0.3s;138 138 } 139 139 … … 276 276 font-size: 14px; 277 277 height: 30px; 278 width: 55px;278 width: 70px; 279 279 padding: 5px; 280 overflow: hidden; /* Hide overflow if needed */280 overflow: hidden; 281 281 } 282 282 … … 291 291 width: 100%; 292 292 height: 100%; 293 background-color: rgba(0, 0, 0, 0.5); /* Dark background */293 background-color: rgba(0, 0, 0, 0.5); 294 294 justify-content: center; 295 295 align-items: center; … … 320 320 } 321 321 322 #cancelBtn 323 background-color: #f 44336; /* Red */322 #cancelBtn, #temporal-deletion, #delete-approval{ 323 background-color: #ff6666; 324 324 color: white; 325 } 326 327 #approveBtn { 328 background-color: #4CAF50; /* Green */ 325 max-width: fit-content; 326 } 327 328 #approveBtn, #confirm-approval, #approve-carried-out{ 329 background-color: #4CAF50; 329 330 color: white; 330 331 } … … 390 391 background-color: #f9f9f9; 391 392 } 393 392 394 #creation > * { 393 395 padding-bottom: 10px; … … 405 407 } 406 408 407 #delete-all-free button { 408 padding: 10px; 409 background-color: #ff6666; 409 #authButton{ 410 position: absolute; 411 left: 1145px; 412 top: 21px; 413 width: 150px; 410 414 color: white; 415 background-color: red; 416 padding: 10px; 411 417 border: none; 412 418 border-radius: 5px; 413 cursor: pointer;414 419 } 415 420 … … 423 428 } 424 429 425 426 427 /* Table styles */428 430 table { 429 width: 320px; 431 padding-top: 10px; 432 width: fit-content; 430 433 border-collapse: collapse; 431 434 margin-bottom: 20px; 432 435 } 433 436 434 /* Table header styles */ 435 thead { 436 background-color: #007BFF; 437 color: white; 438 } 439 440 th { 437 438 thead > tr { 441 439 padding: 10px; 442 440 text-align: left; 443 441 } 444 445 446 442 447 443 tbody tr { … … 451 447 452 448 tbody tr:hover { 453 background-color: #f1f1f1; /* Highlight row on hover */449 background-color: #f1f1f1; 454 450 } 455 451 … … 457 453 padding: 10px; 458 454 } 455 456 #request-assets, #appointment-assets 457 { 458 display: flex; 459 flex-direction: row; 460 gap: 10px; 461 } 462 463 h3{ 464 padding-top: 20px; 465 } 466 #summary{ 467 margin-top: 20px; 468 padding: 15px; 469 display: flex; 470 flex-direction: column; 471 border: 1px solid #ccc; 472 border-radius: 5px; 473 background-color: #f9f9f9; 474 } 475 #authButton{ 476 position: absolute; 477 left: 1145px; 478 top: 21px; 479 width: 150px; 480 } -
src/main/resources/static/css/admin.css
r743de55 r43c9090 41 41 padding: 30px; 42 42 display: grid; 43 grid-template-columns: repeat(2, 1fr); /* Create two equal columns */ 44 gap: 20px; /* Space between grid items */ 43 44 grid-template-columns: repeat(2, 1fr); 45 gap: 20px; 45 46 } 46 47 #menu a { 47 display: flex; /* Enable Flexbox for a */48 flex-direction: column; /* Align icon and text vertically */49 align-items: center; /* Center items horizontally */48 display: flex; 49 flex-direction: column; 50 align-items: center; 50 51 justify-content: center; 51 text-decoration: none; /* Remove underline from links */52 padding: 15px; /* Add padding inside each link */53 border: 1px solid #ccc; /* Optional: border around each link */52 text-decoration: none; 53 padding: 15px; 54 border: 1px solid #ccc; 54 55 border-radius: 5px; 55 56 font-size: 30px; ; 56 57 } 57 58 #menu a:hover { 58 background-color: white; /* Light blue background on hover */59 background-color: white; 59 60 transition: background-color 0.3s ease; 60 61 border: 1px solid black; … … 62 63 63 64 #menu img { 64 max-width: 50px; /* Limit the width of images */65 margin-bottom: 5px; /* Space between image and text */65 max-width: 50px; 66 margin-bottom: 5px; 66 67 } 68 #authButton{ 69 position: absolute; 70 left: 1145px; 71 top: 21px; 72 width: 150px; 73 color: white; 74 background-color: red; 75 padding: 10px; 76 border: none; 77 border-radius: 5px; 78 } -
src/main/resources/static/css/adminNews.css
r743de55 r43c9090 27 27 } 28 28 .news-item{ 29 display: flex; /* Aligns image and text in a row */30 flex-direction: column; /* Change to 'row' for horizontal layout */31 width: 260px;29 display: flex; 30 flex-direction: column; 31 width: 420px; 32 32 align-items: center; 33 33 justify-content: center; 34 34 margin: 0 15px 10px 0; 35 35 padding: 20px; 36 border: 1px solid #ddd; /* Optional: Adds a border */36 border: 1px solid #ddd; 37 37 box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); 38 38 } 39 .news-item > *{ 40 text-align: left; 41 } 39 42 img{ 40 width: 100%; /* Make image responsive */41 max-width: 400px; /* Set a maximum width for the image */42 height: auto; /* Maintain aspect ratio */43 border-radius: 10px; /* Optional: Adds rounded corners */43 width: 100%; 44 max-width: 400px; 45 height: auto; 46 border-radius: 10px; 44 47 margin-bottom: 15px; 45 48 } … … 47 50 font-size: 1.2rem; 48 51 line-height: 1.5; 49 text-align: center; /* Center the text */52 text-align: center; 50 53 color: #333; 51 54 margin: 0; … … 53 56 @media (max-width: 768px) { 54 57 .news-item { 55 flex-direction: column; /* Stack elements on smaller screens */58 flex-direction: column; 56 59 } 57 60 } … … 98 101 } 99 102 100 /* Style for the upload button */101 103 #open-popup { 102 104 padding: 10px 20px; … … 110 112 111 113 #image-popup { 112 width: 400px; /* Set a width for the modal */114 width: 400px; 113 115 background-color: white; 114 116 border-radius: 8px; … … 126 128 } 127 129 128 /* Image preview area */129 130 #image-preview { 130 131 margin-top: 10px; … … 133 134 } 134 135 135 /* Style for buttons inside the popup */136 136 #image-popup button { 137 137 padding: 8px 15px; … … 147 147 148 148 #edit-button, #save-button { 149 background-color: #17a2b8; /* Blueish color */149 background-color: #17a2b8; 150 150 } 151 151 152 152 153 /* Overlay */154 153 #overlay { 155 background: rgba(0, 0, 0, 0.5); /* Semi-transparent background */156 z-index: 999; /* Ensure it is behind the modal but above everything else */154 background: rgba(0, 0, 0, 0.5); 155 z-index: 999; 157 156 } 158 157 159 /* Button hover effects */160 158 #image-popup button:hover, #open-popup:hover { 161 159 opacity: 0.9; 162 160 } 163 161 164 165 166 /* Cancel button */167 162 #cancel-button { 168 background-color: #dc3545; /* Red color */163 background-color: #dc3545; 169 164 } 170 165 171 166 #authButton{ 167 position: absolute; 168 left: 1145px; 169 top: 21px; 170 width: 150px; 171 color: white; 172 background-color: red; 173 padding: 10px; 174 border: none; 175 border-radius: 5px; 176 } -
src/main/resources/static/css/calendar.css
r743de55 r43c9090 1 /* Modal background */2 1 #confirmation-modal { 3 display: none; /* Hidden by default */4 position: absolute; /* Fixed positioning to center it on the page */5 z-index: 1000; /* Sit on top */2 display: none; 3 position: absolute; 4 z-index: 1000; 6 5 left: 38%; 7 6 top: 40%; 8 width: 400px; /* Full width */9 overflow: auto; /* Enable scroll if needed */10 background-color: #fff; /* White background for the content */11 border-radius: 8px; /* Rounded corners */12 box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Subtle shadow for depth */13 text-align: center; /* Center align text */7 width: 400px; 8 overflow: auto; 9 background-color: #fff; 10 border-radius: 8px; 11 box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 12 text-align: center; 14 13 } 15 14 .model-content{ … … 24 23 } 25 24 26 /* Buttons */27 25 button { 28 background-color: #3498db; /* Primary button color */26 background-color: #3498db; 29 27 border: none; 30 28 color: #fff; … … 38 36 39 37 button:hover { 40 background-color: #2980b9; /* Darker shade for hover effect */41 transform: scale(1.05); /* Slight scale effect on hover */38 background-color: #2980b9; 39 transform: scale(1.05); 42 40 } 43 41 44 42 button:active { 45 background-color: #1f77e4; /* Even darker shade when active */ 46 } 47 48 /* Cancel button with different color */ 43 background-color: #1f77e4; 44 } 45 49 46 #cancel-booking { 50 background-color: #e74c3c; /* Different color for cancel button */47 background-color: #e74c3c; 51 48 } 52 49 53 50 #cancel-booking:hover { 54 background-color: #c0392b; /* Darker shade for hover effect */51 background-color: #c0392b; 55 52 } 56 53 … … 118 115 #right-side > *{ 119 116 margin:10px; 117 } 118 #right-side{ 119 position: relative; 120 top: 50px; 121 padding: 16px; 122 } 123 #hourly-terms{ 124 display: flex; 125 flex-wrap: wrap; 126 gap: 10px; 127 } 128 #right-side > *{ 129 margin-bottom: 5px; 120 130 } 121 131 … … 176 186 position: relative; 177 187 overflow: hidden; 178 /* transform: scale(1.25); */179 188 } 180 189 … … 232 241 cursor: pointer; 233 242 animation: to-top 1s forwards; 234 /* border-radius: 50%; */235 243 } 236 244 … … 239 247 } 240 248 241 .calendar-days div:hover span {242 transition: width 0.2s ease-in-out, height 0.2s ease-in-out;243 }244 249 245 250 .calendar-days div span:nth-child(1), … … 250 255 } 251 256 252 .calendar-days div:hover span:nth-child(1),253 .calendar-days div:hover span:nth-child(3) {254 height: 100%;255 }256 257 257 .calendar-days div span:nth-child(1) { 258 258 bottom: 0; … … 272 272 } 273 273 274 .calendar-days div:hover span:nth-child(2),275 .calendar-days div:hover span:nth-child(4) {276 width: 100%;277 }278 274 279 275 .calendar-days div span:nth-child(2) { … … 287 283 } 288 284 289 .calendar-days div:hover span:nth-child(2) { 290 transition-delay: 0.2s; 291 } 292 293 .calendar-days div:hover span:nth-child(3) { 294 transition-delay: 0.4s; 295 } 296 297 .calendar-days div:hover span:nth-child(4) { 298 transition-delay: 0.6s; 299 } 300 301 .calendar-days div.curr-date, 302 .calendar-days div.curr-date:hover { 285 .curr-date{ 303 286 background-color: var(--blue); 304 287 color: var(--white); … … 391 374 } 392 375 } 393 394 395 396 376 #authButton{ 377 position: absolute; 378 left: 1145px; 379 top: 21px; 380 width: 150px; 381 color: white; 382 background-color: red; 383 padding: 10px; 384 border: none; 385 border-radius: 5px; 386 } 387 388 389 -
src/main/resources/static/css/index.css
r743de55 r43c9090 66 66 67 67 .dropdown-content { 68 display: none; /* Hide dropdown by default */69 position: absolute; /* Position relative to the list item */68 display: none; 69 position: absolute; 70 70 left: 0; 71 top: 100%; /* Position below the list item */72 background-color: white; /* Background color of the dropdown */73 border: 1px solid #ddd; /* Border of the dropdown */74 padding: 10px; /* Padding inside the dropdown */75 box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Optional shadow for dropdown */76 width: 100%; /* Full width of the list item */71 top: 100%; 72 background-color: white; 73 border: 1px solid #ddd; 74 padding: 10px; 75 box-shadow: 0 2px 5px rgba(0,0,0,0.1); 76 width: 100%; 77 77 } 78 78 .icon-search{ … … 98 98 justify-content: center; 99 99 height: 350px; 100 /*background-color: #F3F0E7;*/101 100 background-color: #F7F7F5; 102 101 } … … 108 107 .items-register{ 109 108 font-family: "Kumbh Sans", sans-serif; 109 position: absolute; 110 left: 900px; 110 111 } 111 112 .items-register p{ … … 117 118 } 118 119 119 . items-register{120 display: flex;120 .form-imp{ 121 display: flex; 121 122 flex-direction: column; 122 123 align-items: center; 123 /*background-color: #F3F0E7;*/124 }125 126 .form-imp{127 display: flex;128 flex-direction: column;129 align-items: center;130 124 width: auto; 131 125 padding: 10px; 132 126 } 133 127 input , button { 134 border-radius: 5px; /* Adjust the value to make the corners more or less rounded */135 padding: 7px; /* Optional: adds padding inside the input */136 border: 1px solid #9D9D9D; /* Optional: adds a border around the input */128 border-radius: 5px; 129 padding: 7px; 130 border: 1px solid #9D9D9D; 137 131 } 138 132 button{ … … 140 134 color:white; 141 135 } 136 #personalised{ 137 font-size: xx-large; 138 font-family: "Caveat", cursive; 139 } 142 140 .white-part{ 141 display: flex; 142 flex-direction: column; 143 143 background-color: white; 144 144 width: 415px; 145 145 border-radius: 5px; 146 padding: 7px; 146 padding: 20px; 147 } 148 a { 149 text-decoration: none; 150 } 151 .logged-in{ 152 padding: 20px; 153 font-family: "Kumbh Sans", sans-serif; 147 154 } 148 155 .split-title{ … … 179 186 align-items: center; 180 187 background-color: #F7F7F5; 181 /*background-color: #F3F0E7;*/182 188 } 183 189 .part2 > div{ … … 187 193 } 188 194 .part2 > div:first-child { 189 justify-content: flex-end; /* Align the content to the right */195 justify-content: flex-end; 190 196 } 191 197 … … 217 223 background-color: transparent; 218 224 color: darkgreen; 219 border: 2px solid darkgreen; /* Set the border color and make it bold */220 border-radius: 12px; /* Make the borders rounded */221 font-weight: bold; /* Make the text bold */222 padding: 10px 20px; /* Add some padding for better appearance */223 cursor: pointer; /* Change the cursor to a pointer when hovered */224 font-family: "Kumbh Sans", sans-serif; /* Match the font family */225 font-size: 16px; /* Adjust font size as needed */225 border: 2px solid darkgreen; 226 border-radius: 12px; 227 font-weight: bold; 228 padding: 10px 20px; 229 cursor: pointer; 230 font-family: "Kumbh Sans", sans-serif; 231 font-size: 16px; 226 232 } 227 233 … … 248 254 } 249 255 .icons li img:hover { 250 background-color: white; /* Change background color on hover */251 border-color: darkslategrey; /* Change border color on hover */256 background-color: white; 257 border-color: darkslategrey; 252 258 } 253 259 .footer-left p img{ … … 272 278 } 273 279 274 275 /*login*/276 277 280 .popup { 278 display: none; /* Hide the form */279 position: fixed; /* Position it relative to the viewport */280 z-index: 2; /* Ensure it appears above other content */281 display: none; 282 position: fixed; 283 z-index: 2; 281 284 left: 50%; 282 285 top: 50%; 283 transform: translate(-50%, -50%); /* Center it horizontally and vertically */ 284 width: 500px; /* Set a fixed width for the form */ 285 padding: 25px; /* Add some padding */ 286 background-color: white; /* Background color of the form */ 287 box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); /* Add a shadow for better visibility */ 288 border-radius: 10px; /* Slightly round the corners */ 289 } 290 291 /* Style the close button */ 286 transform: translate(-50%, -50%); 287 width: 500px; 288 height: auto; 289 padding: 25px; 290 background-color: white; 291 box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5); 292 border-radius: 10px; 293 font-family: "Kumbh Sans", sans-serif; 294 } 295 292 296 .popup .close-btn { 293 297 position: absolute; … … 297 301 cursor: pointer; 298 302 } 299 300 /* Add some basic styling for the form content */ 303 #submit-btn{ 304 width: 120px; 305 background-color: #10B981; 306 } 307 #loginForm > div > h2{ 308 text-align: center; 309 } 310 301 311 .popup-content { 302 display: flex; /* Use flexbox for layout */ 303 flex-direction: column; /* Stack children vertically */ 304 align-items: stretch; /* Ensure all elements take the full width */ 305 text-align: center; /* Center the content */ 312 padding: 20px; 313 width: 100%; 314 display: flex; 315 flex-direction: column; 316 align-items: stretch; 306 317 } 307 318 308 319 .popup-content h2 { 309 margin-bottom: 20px; /* Add some space below the title */320 margin-bottom: 20px; 310 321 } 311 322 312 323 .popup-content label { 313 display: block; /* Make the labels block elements */314 margin-bottom: 10px; /* Add some space below the labels */315 text-align: left; /* Align the text to the left */324 display: block; 325 margin-bottom: 10px; 326 text-align: left; 316 327 } 317 328 318 329 .popup-content input { 319 width: 100%; /* Make the inputs take up the full width */320 padding: 8px; /* Add some padding inside the inputs */321 margin-bottom: 20px; /* Add space below the inputs */322 border: 1px solid #ccc; /* Light border around inputs */323 border-radius: 5px; /* Slightly round the input corners */330 width: 100%; 331 padding: 8px; 332 margin-bottom: 20px; 333 border: 1px solid #ccc; 334 border-radius: 5px; 324 335 } 325 336 326 337 .popup-content button { 327 padding: 10px 20px; /* Add padding to the button */328 background-color: #007BFF; /* Button background color */329 color: white; /* Button text color */330 border: none; /* Remove the default border */331 border-radius: 5px; /* Round the button corners */332 cursor: pointer; /* Add a pointer cursor on hover */338 padding: 10px 20px; 339 background-color: #007BFF; 340 color: white; 341 border: none; 342 border-radius: 5px; 343 cursor: pointer; 333 344 } 334 345 335 346 .popup-content button:hover { 336 background-color: #0056b3; /* Darken the button on hover */347 background-color: #0056b3; 337 348 } 338 349 body.no-scroll { … … 340 351 } 341 352 .dataForms{ 342 display: flex; /* Use flexbox for layout */ 343 flex-direction: column; /* Stack children vertically */ 344 align-items: stretch; /* Ensure all elements take the full width */ 345 text-align: center; /* Center the content */ 346 } 353 display: flex; 354 flex-direction: column; 355 align-items: stretch; 356 text-align: center; 357 358 } 359 #links{ 360 padding: 10px; 361 display: flex; 362 flex-direction: column; 363 gap: 5px; 364 color: darkgreen; 365 } 366 .logged-in{ 367 position: absolute; 368 left: 900px; 369 padding: 30px; 370 } 371 a img{ 372 transform: rotate(-90deg); 373 height: 20px; 374 margin-right: 10px; 375 } 376 #signInForm{ 377 height: 500px; 378 width: 700px; 379 } 380 #signInForm > div > form{ 381 display: grid; 382 grid-template-columns: repeat(2, 1fr); 383 grid-template-rows: repeat(3, 1fr); 384 gap: 10px; 385 } 386 #authButton{ 387 position: absolute; 388 left: 1145px; 389 top: 21px; 390 width: 150px; 391 color: white; 392 background-color: red; 393 padding: 10px; 394 border: none; 395 border-radius: 5px; 396 } 397 398 #create{ 399 width: 200px; 400 padding: 15px; 401 background-color: #10B981; 402 position: absolute; 403 top: 80%; 404 left: 50%; 405 transform: translate(-50%, -50%); 406 margin-top: 20px; 407 } -
src/main/resources/static/css/terms.css
r743de55 r43c9090 4 4 body{ 5 5 font-family: var(--font-family); 6 background-color: #f3f8fe; 6 7 } 7 #outer-frame{ 8 background-color: #f3f8fe; 9 width: 100%; 10 height: 100vh; 11 } 8 12 9 #header{ 13 10 display: flex; … … 16 13 #menu{ 17 14 display: flex; 15 gap: 10px; 18 16 } 19 17 #menu *{ 20 padding: 8px; 18 padding: 10px; 19 background-color: #17a2b8; 20 border: 0; 21 border-radius: 5px; 22 color: white; 21 23 } 22 24 table td, … … 24 26 padding: 10px; 25 27 } 26 table{ 27 /*margin: 0 auto;*/ 28 width: 920px; 29 } 28 30 29 31 30 #popup { … … 67 66 color: #fff; 68 67 } 68 69 table{ 70 border-collapse: collapse; 71 table-layout: fixed; 72 width: max-content; 73 } 74 75 th, td { 76 width: fit-content; 77 text-align: center; 78 border: 1px solid #ddd; 79 padding: 12px; 80 } 81 82 th { 83 background-color: lightslategray; 84 color: #fff; 85 86 } 87 #frame{ 88 display: flex; 89 flex-direction: column; 90 gap: 10px; 91 } 92 #requestsTableBody{ 93 background-color: #eeeded; 94 } 95 #authButton{ 96 position: absolute; 97 left: 1145px; 98 top: 21px; 99 width: 150px; 100 color: white; 101 background-color: red; 102 padding: 10px; 103 border: none; 104 border-radius: 5px; 105 } -
src/main/resources/static/css/users-view.css
r743de55 r43c9090 1 /* General reset */ 1 2 2 * { 3 3 margin: 0; … … 6 6 } 7 7 8 /* Styling for the entire page */9 8 body { 10 9 font-family: Arial, sans-serif; … … 20 19 } 21 20 22 /* Frame that contains the whole content */23 21 #frame { 24 22 width: 80%; … … 30 28 } 31 29 32 /* Header section */33 30 #header-part { 34 31 display: flex; … … 39 36 } 40 37 41 /* Dropdown and labels styling */42 38 label { 43 39 font-weight: bold; … … 60 56 } 61 57 62 /* Main part: the table */63 58 #main-part { 64 59 margin-top: 20px; … … 96 91 } 97 92 98 /* For responsiveness */99 93 @media (max-width: 768px) { 100 94 #header-part { … … 111 105 display: none; 112 106 } 113 /*.news-item{*/ 114 /* display: flex; !* Aligns image and text in a row *!*/ 115 /* !*flex-direction: column; !* Change to 'row' for horizontal layout *!*!*/ 116 /* width: 300px;*/ 117 /* align-items: center;*/ 118 /* justify-content: center;*/ 119 /* max-width: 800px; !* Limit max width to prevent stretching *!*/ 120 /* margin: 0 auto; !* Centers the container *!*/ 121 /* padding: 20px;*/ 122 /* border: 1px solid #ddd; !* Optional: Adds a border *!*/ 123 /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);*/ 124 /*}*/ 125 /*img{*/ 126 /* width: 100%; !* Make image responsive *!*/ 127 /* max-width: 400px; !* Set a maximum width for the image *!*/ 128 /* height: auto; !* Maintain aspect ratio *!*/ 129 /* border-radius: 10px; !* Optional: Adds rounded corners *!*/ 130 /* margin-bottom: 15px;*/ 131 /*}*/ 132 /*p{*/ 133 /* font-size: 1.2rem;*/ 134 /* line-height: 1.5;*/ 135 /* text-align: center; !* Center the text *!*/ 136 /* color: #333;*/ 137 /* margin: 0;*/ 138 /*}*/ 139 /*@media (max-width: 768px) {*/ 140 /* .news-item {*/ 141 /* flex-direction: column; !* Stack elements on smaller screens *!*/ 142 /* }*/ 143 /*}*/ 107 button{ 108 padding: 5px; 109 } 110 #authButton{ 111 position: absolute; 112 left: 1280px; 113 top: 21px; 114 width: 127px; 115 color: white; 116 background-color: red; 117 padding: 10px; 118 border: none; 119 border-radius: 5px; 120 } -
src/main/resources/static/js/admin-terms.js
r743de55 r43c9090 1 1 import { deleteAppointment, confirmCarriedOut, getUsersByTermExcept, removeRequestAndUpdateUser, removeAppointment, makeReservation ,displayDiv} from './shared.js'; 2 2 3 let lastClickedItem=null; 3 4 let calendar = document.querySelector('.calendar') 4 5 let importantDate; … … 109 110 })); 110 111 111 await fetch(`/api/appointments/create`, {112 const response=await fetch(`/api/appointments/create`, { 112 113 method: 'POST', 113 114 headers: { 114 115 'Content-Type': 'application/json', 115 116 }, 116 body: JSON.stringify(requestBody) // Send all appointments in one request117 body: JSON.stringify(requestBody) 117 118 }); 119 if(response.ok){ 120 location.reload(); 121 } 122 118 123 } 119 124 document.getElementById('create-appointments').addEventListener('click', async function () { … … 124 129 const interval = parseInt(document.getElementById('time-interval').value); 125 130 126 if (!startDate || !endDate || !startTime || !endTime || !interval) {131 if (!startDate || !endDate || !startTime || !endTime || isNaN(interval)) { 127 132 alert("Please fill out all the fields."); 128 133 return; … … 142 147 const existingTimes = existingMapped.get(date); 143 148 if (checkOverlap(existingTimes, time)) { 144 conflictingAppointments.push(newAppointment); // Add to conflict list if overlaps149 conflictingAppointments.push(newAppointment); 145 150 } else { 146 151 successfulAppointments.push(newAppointment); … … 240 245 requestedRow.appendChild(couponCodeTd); 241 246 requestedElement.appendChild(requestedRow); 242 displayDiv(dateTime);243 247 }) 248 displayDiv(dateTime); 244 249 } 245 250 function getAllRequests(dateTime,containerId){ … … 277 282 278 283 itemDiv.addEventListener('click', async () => { 284 document.getElementById("summary").style.display='none'; 279 285 try{ 280 286 if(lastClickedItem){ 287 lastClickedItem.style.backgroundColor="#f9f9f9"; 288 } 289 lastClickedItem=itemDiv; 290 itemDiv.style.backgroundColor="grey"; 281 291 const isReserved=await isAppointmentReserved(item.localDateTime); 282 292 const isEmpty=await isAppointmentEmpty(item.localDateTime); … … 285 295 cleanData("requested") 286 296 if (isReserved) { 297 document.getElementById("summary").style.display='block'; 287 298 document.getElementById("approved-table").style.display = 'block'; 288 299 document.getElementById("requested-table").style.display = 'none'; … … 292 303 deleteBtn.setAttribute("term",item.localDateTime); 293 304 deleteBtn.setAttribute("type","cancelledAppointmentByAdmin"); 294 //da go isprogramirash delete-approval295 305 document.getElementById("delete-approval").addEventListener('click', function() { 296 306 removeAppointment(item.localDateTime,"cancelledAppointmentByAdmin"); … … 307 317 } 308 318 else if(!isEmpty){ 319 document.getElementById("summary").style.display='block'; 309 320 document.getElementById("approved-table").style.display = 'none'; 310 321 document.getElementById("requested-table").style.display = 'block'; … … 316 327 } 317 328 else{ 329 document.getElementById("summary").style.display='none'; 318 330 document.getElementById("approved-table").style.display = 'none'; 319 331 document.getElementById("requested-table").style.display = 'none'; … … 365 377 let currDate = new Date() 366 378 367 // if (!month) month = currDate.getMonth()368 379 console.log(month); 369 380 if (typeof month !== 'number') month = currDate.getMonth(); … … 374 385 calendar_header_year.innerHTML = year 375 386 376 // get first day of month377 387 378 388 let first_day = new Date(year, month, 1) … … 395 405 } 396 406 day.addEventListener('click', () => { 407 document.getElementById("summary").style.display='none'; 397 408 let temp=document.getElementsByClassName('curr-date'); 398 409 Array.from(temp).forEach(element => { … … 458 469 const otherPickersInterval = 30; 459 470 460 for (let hour = 7; hour < 22; hour++) { // 0 to 23 for 24-hour format471 for (let hour = 7; hour < 22; hour++) { 461 472 for (let minutes = 0; minutes < 60; minutes++) { 462 473 const formattedHour = hour.toString().padStart(2, '0'); … … 504 515 .then(data => { 505 516 console.log(data.message); 517 location.reload(); 506 518 }) 507 519 .catch(error => { … … 525 537 if (response.ok) { 526 538 alert("Free appointments for the selected date range were deleted."); 539 location.reload(); 527 540 } else { 528 541 alert("An error occurred while trying to delete the appointments."); -
src/main/resources/static/js/adminNewsCoupons.js
r743de55 r43c9090 6 6 let selectedImage; 7 7 let questionable; 8 let helper; 8 9 9 10 let pageType; … … 38 39 imagePreview.style.display='inline'; 39 40 imagePreview.innerHTML = `<img src="${e.target.result}" style="width: 100%; height: auto;">`; 40 selectedImage =e.target.result ; // Store the selected file41 selectedImage =e.target.result ; 41 42 42 43 console.log(selectedImage); … … 300 301 document.getElementById('text').value = param2; 301 302 let importantValue=newsItem.querySelector('img').getAttribute("data-attribute"); 303 selectedImage=importantValue; 302 304 document.getElementById('main-image').innerHTML=`<img src="${importantValue}" style="width: 20%; height: 20%;">`; 303 305 } -
src/main/resources/static/js/authentication-shared.js
r743de55 r43c9090 9 9 10 10 function phoneCheck(phone){ 11 const phonePattern = /^07\d -\d{3}-\d{3}$/;11 const phonePattern = /^07\d\d{3}\d{3}$/; 12 12 if (!phonePattern.test(phone)) { 13 13 return false; … … 32 32 return regex.test(password); 33 33 } 34 export async function verificationCheck(userData ) {34 export async function verificationCheck(userData,condition) { 35 35 if (!usernameCheck(userData.username)) { 36 36 alert("Invalid username"); … … 56 56 } 57 57 } 58 const response = await fetch(`/api/users/checkDifferentUser`, { 59 method: "POST", 60 headers: { 61 'Content-Type': 'application/json' 62 }, 63 body: JSON.stringify(userData) 64 }); 65 if (response.ok) { 66 return true; 67 } else { 68 return false; 58 if(condition!==false){ 59 const response = await fetch(`/api/users/checkDifferentUser`, { 60 method: "POST", 61 headers: { 62 'Content-Type': 'application/json' 63 }, 64 body: JSON.stringify(userData) 65 }); 66 if (response.ok) { 67 return true; 68 } else { 69 return false; 70 } 69 71 } 70 72 return true; 71 73 } -
src/main/resources/static/js/calendar.js
r743de55 r43c9090 1 let lastClickedItem=null; 1 2 let calendar = document.querySelector('.calendar') 2 3 … … 19 20 document.getElementById("last-check").innerHTML=window.selectedTime; 20 21 showModal(); 22 document.getElementById("coupon-type").selectedIndex=0; 23 document.getElementById("medical-condition").innerHTML=''; 24 21 25 } 22 26 … … 71 75 function displayFreeAppointments(appointments) { 72 76 const container = document.getElementById('hourly-terms'); 73 container.innerHTML = ''; // Clear previous appointments77 container.innerHTML = ''; 74 78 75 79 appointments.forEach(appointment => { … … 88 92 89 93 appointmentDiv.textContent = formattedTime; 90 appointmentDiv.dataset.time = formattedDate+" "+formattedTime; // Store full date-time94 appointmentDiv.dataset.time = formattedDate+" "+formattedTime; 91 95 92 96 appointmentDiv.addEventListener('click', () => { 97 if(lastClickedItem){ 98 lastClickedItem.style.backgroundColor="white"; 99 } 100 lastClickedItem=appointmentDiv; 101 lastClickedItem.style.backgroundColor="grey"; 93 102 window.selectedTime = appointmentDiv.dataset.time; 94 103 document.getElementById('book-button').disabled = false; … … 109 118 110 119 let currDate = new Date() 111 if (!month) month = currDate.getMonth() 120 121 if (typeof month !== 'number') month = currDate.getMonth(); 112 122 if (!year) year = currDate.getFullYear() 113 123 … … 129 139 <span></span>`; 130 140 let selectedDate = `${year}-${(month + 1).toString().padStart(2, '0')}-${(i - first_day.getDay() + 1).toString().padStart(2, '0')}`; 131 day.addEventListener('click', () => fetchFreeOrPendingAppointments(selectedDate)); 141 day.addEventListener('click', () => { 142 let temp=document.getElementsByClassName('curr-date'); 143 Array.from(temp).forEach(element => { 144 element.classList.remove('curr-date'); 145 }); 146 day.classList.add('curr-date'); 147 document.getElementById("coupon-type").selectedIndex=0; 148 document.getElementById("medical-condition").value=''; 149 fetchFreeOrPendingAppointments(selectedDate); 150 }) 132 151 133 152 if (i - first_day.getDay() + 1 === currDate.getDate() && year === currDate.getFullYear() && month === currDate.getMonth()) { … … 176 195 177 196 178 197 window.onload = async function () { 198 temp=document.getElementById("coupon-type"); 199 try{ 200 const response = await fetch(`/api/coupons/getCouponNames`); 201 if (response.ok) { 202 const couponNames = await response.json(); 203 console.log("Coupons:", couponNames); 204 205 couponNames.forEach(coupon => { 206 const option = document.createElement("option"); 207 option.value = coupon; 208 option.textContent = coupon; 209 temp.appendChild(option); 210 }); 211 } else { 212 console.log(response.statusText); 213 } 214 } 215 catch(error){ 216 console.error("Error fetching coupons:", error); 217 } 218 219 }; -
src/main/resources/static/js/editUser.js
r743de55 r43c9090 3 3 import { verificationCheck } from './authentication-shared.js'; 4 4 5 let loggedPerson ;5 let loggedPerson,checkDifferent; 6 6 const modal = document.getElementById('popupModal'); 7 7 const cancelBtn = document.getElementById('cancelBtn'); … … 71 71 counter= user.carriedOut.length; 72 72 } 73 console.log(counter);74 73 return counter; 75 74 } … … 122 121 buttonCell.appendChild(button1); 123 122 button2.textContent = "Потврди одржан"; 124 button 2.addEventListener('click',()=>125 function(){123 buttonCell.appendChild(button2); 124 button2.addEventListener('click',()=> { 126 125 modal.style.display='flex'; 127 approveBtn.addEventListener('click', () => { 128 const userInput = document.getElementById('userInput').value; 129 confirmCarriedOut(request.term,userInput); 130 modal.style.display = 'none'; // Close the modal after approval 131 }); 126 document.getElementById("userInput").disabled=false; 132 127 }); 133 buttonCell.appendChild(button2); 128 approveBtn.addEventListener('click', () => { 129 const userInput = document.getElementById('userInput').value; 130 confirmCarriedOut(request.term,userInput); 131 modal.style.display = 'none'; 132 }); 133 134 134 } 135 135 … … 146 146 if(selectedValue==="requests"){ 147 147 url=`/api/requests/listAll?username=${loggedPerson.username}`; 148 tHeadArray=["Термин", 148 tHeadArray=["Термин","Медицинска состојба","Опции"]; 149 149 createHeader(tHeadArray); 150 150 getAll(url); … … 153 153 let testTemp="RESERVED"; 154 154 url=`/api/appointments/listAll?username=${loggedPerson.username}&status=${testTemp}`; 155 tHeadArray=["Термин", "Опции"];155 tHeadArray=["Термин","Медицинска состојба", "Опции"]; 156 156 createHeader(tHeadArray); 157 157 getAll(url); … … 230 230 .catch(error => { 231 231 console.error('Error fetching user data:', error); 232 return { name: '', surname: '' }; // return empty values on error232 return { name: '', surname: '' }; 233 233 }); 234 234 } … … 267 267 if (cookieUsername) { 268 268 fetchUserData(cookieUsername,"USER").then(userData => { 269 const fullName = `${userData.name} ${userData.surname}`; 270 document.getElementById('cookie-name').innerHTML = fullName; 269 console.log("success") 271 270 }); 272 } else {273 document.getElementById('cookie-name').textContent = 'Default Name';274 271 } 275 272 } … … 277 274 function saveProfileChanges() { 278 275 const userName = document.querySelector('input[name="username"]').value; 279 console.log(userName); 276 const phoneNum=document.querySelector('input[name="phone"]').value.replace(/-/g,"") 277 console.log(phoneNum); 280 278 const updatedData = { 281 279 username: userName, 282 280 name: document.querySelector('input[name="firstName"]').value, 283 281 surname: document.querySelector('input[name="lastName"]').value, 284 phone: document.querySelector('input[name="phone"]').value,282 phone: phoneNum, 285 283 age: document.querySelector('input[name="age"]').value 286 284 }; 287 if(!verificationCheck(updatedData )){285 if(!verificationCheck(updatedData,checkDifferent)){ 288 286 return; 289 287 } … … 299 297 .then(data => { 300 298 alert('Profile updated successfully!'); 301 toggleEditing(false); // Disable fields after saving changes299 toggleEditing(false); 302 300 updateCookieUsername(userName); 303 301 }) … … 313 311 }; 314 312 } 313 function removeOptions(){ 314 if(getRoleFromCookie()!=="ADMIN"){ 315 let temp=this; 316 temp.removeChild(document.getElementById("requests")); 317 temp.removeChild(document.getElementById("appointments")) 318 } 319 } 315 320 316 321 function toggleEditing(isEnabled) { … … 322 327 323 328 window.onload = function(){ 329 checkDifferent=true; 324 330 updateProfile(); 325 331 toggleEditing(false); 326 332 document.getElementById('edit-profile').addEventListener('click', function() { 327 333 const role=getQueryParams(); 328 if(role.param1 ==='ADMIN') 329 toggleEditing(true); 334 if(role.param1 ==='ADMIN'){ 335 toggleEditing(true); 336 checkDifferent=false; 337 } 338 330 339 }); 331 340 document.getElementById('saveChanges').addEventListener('click', saveProfileChanges); 332 341 document.getElementById("statusDropdown").addEventListener('change',createRowsBasedOnType); 333 334 } 342 document.getElementById("statusDropdown").addEventListener('click',removeOptions); 343 } -
src/main/resources/static/js/index.js
r743de55 r43c9090 1 1 import { verificationCheck } from "./authentication-shared.js"; 2 3 2 function toggleForm(formId, show) { 4 3 const form = document.getElementById(formId); … … 60 59 }); 61 60 } 61 else{ 62 alert("Sign in successfull! Now log in!") 63 } 62 64 return response.json(); 63 65 }) 64 66 .then(data => { 65 console.log(data.message); // Handle success message67 console.log(data.message); 66 68 }) 67 69 .catch(error => { … … 97 99 console.log('Parsed data:', data); 98 100 if (data.success) { 99 const name=data.name;100 const surname=data.surname;101 const personalisedSection=document.getElementById("personalised");102 personalisedSection.innerHTML=`Добредојде, ${name} ${surname}!`;103 101 updateUIBasedOnRole(data.userRole); 104 102 } … … 108 106 }) 109 107 .finally(() => { 110 // Close the form after handling the response111 108 toggleForm('loginForm', false); 112 109 }); -
src/main/resources/static/js/shared.js
r743de55 r43c9090 21 21 if (!response.ok) { 22 22 throw new Error('Failed to delete the appointment'); 23 } 24 else{ 25 location.reload(); 23 26 } 24 27 }) … … 47 50 48 51 if (updateResponse.ok) { 52 location.reload(); 49 53 console.log(`User updated successfully in carried_out`); 50 54 } else { … … 136 140 137 141 } 142 location.reload(); 138 143 139 144 } else { … … 149 154 if (response.ok) { 150 155 console.log('Appointment added successfully.'); 156 location.reload(); 151 157 } else { 152 158 const text = await response.text(); … … 160 166 export function displayDiv(dateTime,username){ 161 167 if (typeof username !== 'undefined'){ 162 makeReservation(dateTime, username);168 makeReservation(dateTime, username); 163 169 } 164 170 else{ 165 const inputValue = document.getElementById("username-approval"); 166 const approvedUser = inputValue.value; 167 document.getElementById("confirm-approval").addEventListener('click',makeReservation(dateTime,approvedUser)); 171 let temp=document.getElementById("confirm-approval"); 172 temp.addEventListener('click',()=>{ 173 const approvedUser = document.getElementById("username-approval").value; 174 makeReservation(dateTime,approvedUser) 175 }); 168 176 } 169 177 } -
src/main/resources/static/js/terms.js
r743de55 r43c9090 50 50 dialog.setAttribute("id","dialogPopUp"); 51 51 const message = document.createElement('p'); 52 message.textContent = ' Are you sure you want to cancel the reservation?';52 message.textContent = 'Дали сте сигурни дека сакате да откажете?'; 53 53 dialog.appendChild(message); 54 54 const yesButton = document.createElement('button'); … … 107 107 row.appendChild(termCell); 108 108 const nameCell = document.createElement('td'); 109 nameCell.textContent = request.name; // Format date109 nameCell.textContent = request.name; 110 110 row.appendChild(nameCell); 111 111 const surnameCell = document.createElement('td'); 112 surnameCell.textContent = request.surname; // Format date112 surnameCell.textContent = request.surname; 113 113 row.appendChild(surnameCell); 114 114 const couponCodeCell = document.createElement('td'); … … 119 119 row.appendChild(additionalInfoCell); 120 120 const usernameCell = document.createElement('td'); 121 usernameCell.textContent = request.username; // Format date121 usernameCell.textContent = request.username; 122 122 row.appendChild(usernameCell); 123 123 const buttonCell = document.createElement('td'); … … 139 139 const oldHead = document.getElementById('initial-head'); 140 140 if (thead) { 141 console.log("cleaned")142 141 thead.innerHTML = ''; 143 142 } … … 165 164 const row = document.createElement('tr'); 166 165 const termCell = document.createElement('td'); 167 termCell.textContent = replaceWithSpace(request.dateTime); // Format date166 termCell.textContent = replaceWithSpace(request.dateTime); 168 167 row.appendChild(termCell); 169 168 const userCell = document.createElement('td'); … … 171 170 row.appendChild(userCell); 172 171 const adminCell = document.createElement('td'); 173 adminCell.textContent = request.adminNote; // Format date172 adminCell.textContent = request.adminNote; 174 173 row.appendChild(adminCell); 175 174 const statusCell = document.createElement('td'); -
src/main/resources/static/js/users-view.js
r743de55 r43c9090 12 12 } 13 13 function calculateAge(dateBirth){ 14 console.log(dateBirth);15 14 const [year, month, day] = dateBirth.split('-').map(Number); 16 15 const birthDate = new Date(year, month - 1, day); … … 55 54 button.addEventListener('click',()=>{ 56 55 let temp=user.username; 57 console.log(temp);58 56 const params = new URLSearchParams({ param1: 'ADMIN', param2: temp }).toString(); 59 57 window.location.href = `editUser.html?${params}`; … … 90 88 document.getElementById("search-input-container").style.display = 'none'; 91 89 const selectedValue = event.currentTarget.value; 92 console.log(selectedValue);93 90 if(selectedValue!=='defaultValue') 94 91 filterUsers("status",selectedValue).then(r => console.log(r)); … … 98 95 setInitialSelectValue(userStatusElement); 99 96 const dataCheck = event.currentTarget.value; 100 console.log(dataCheck);101 97 updateSearchInputVisibility(dataCheck); 102 98 103 99 document.getElementById("search-button").addEventListener('click',function (){ 104 100 let filterTemp=document.getElementById("search-input"); 105 console.log(filterTemp.value);106 101 filterUsers(dataCheck,filterTemp.value).then(r => console.log(r)); 107 102 filterTemp.value=''; -
src/main/resources/templates/html/admin-terms.html
r743de55 r43c9090 8 8 Calendar 9 9 </title> 10 <script src="/js/cookie.js" defer></script> 10 11 <link rel="stylesheet" href="/css/admin-terms.css"> 11 12 </head> 12 13 <body class="light"> 14 <button id="authButton" style="display: none;"></button> 13 15 <div id="content"> 14 16 <h1>Преглед и менаџирање со термини</h1> 17 <h3>Со клик врз датумот од календарот добивате преглед за термините</h3> 15 18 <div id="left-side"> 16 19 <div id="calendar-main"> … … 83 86 <div id="right-side"> 84 87 <div id="active"> 85 < p>Тековни термини за ден <span id="insert-date"></span></p>88 <h3>Тековни термини за ден <span id="insert-date"></span></h3> <p>(доколку постои термин, со клик врз време, се добиваат информации и овозоможува менаџирање со термин)</p> 86 89 <div id="frame"></div> 90 <button id="temporal-deletion" style="display: none;">Целосно бришење термин</button> 87 91 </div> 88 <div id="summary" >92 <div id="summary" style="display: none;"> 89 93 <table id="requested-table" style="display: none;"> 90 <thead><t h>Предложени</th></thead><tbody id="requested"></tbody>94 <thead><tr><th>Предложени</th></tr></thead><tbody id="requested"></tbody> 91 95 </table> 92 96 <table id="approved-table" style="display: none;"> 93 <thead><t h>Одобрени</th></thead><tbody id="approved"></tbody>97 <thead><tr><th>Одобрени</th></tr></thead><tbody id="approved"></tbody> 94 98 </table> 95 99 <div id="request-assets" style="display: none;"> … … 113 117 </div> 114 118 </div> 115 <button id="temporal-deletion" style="display: none;">Целосно бришење термин</button>116 119 </div> 117 120 </div> -
src/main/resources/templates/html/admin.html
r743de55 r43c9090 8 8 <link href="https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&display=swap" rel="stylesheet"> 9 9 <link rel="stylesheet" href="/css/admin.css"> 10 <script src="/js/cookie.js" defer></script> 10 11 </head> 11 12 <body> 13 <button id="authButton" style="display: none;"></button> 12 14 <img id="second-image" src="/images/physiotherapy.jpg"> 13 15 <div id="frame"> -
src/main/resources/templates/html/adminCoupons.html
r743de55 r43c9090 4 4 <meta charset="UTF-8"> 5 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <script src="/js/cookie.js" defer></script> 6 7 <link rel="stylesheet" href="/css/adminNews.css"> 7 8 </head> 8 9 <body data-page="coupons"> 10 <button id="authButton" style="display: none;"></button> 9 11 <h2>Купони...</h2> 10 12 <div class="coupons-container"> -
src/main/resources/templates/html/adminNews.html
r743de55 r43c9090 4 4 <meta charset="UTF-8"> 5 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <script src="/js/cookie.js" defer></script> 6 7 <link rel="stylesheet" href="/css/adminNews.css"> 7 8 </head> 8 9 <body data-page="events"> 10 <button id="authButton" style="display: none;"></button> 9 11 <h2>Настани, новости...</h2> 10 12 <div class="news-container"> -
src/main/resources/templates/html/calendar.html
r743de55 r43c9090 8 8 Calendar 9 9 </title> 10 <script src="/js/cookie.js" defer></script> 10 11 <link rel="stylesheet" href="/css/calendar.css"> 11 12 </head> 12 13 <body class="light"> 14 <button id="authButton" style="display: none;"></button> 13 15 <div id="content"> 14 16 <div id="personal-info"> 15 17 <img id="admin-photo" src="/images/chicho-round.png"> 16 18 <div id="first-box" class="white-space"> 17 <a ><img src="/images/down.png">Кориснички профил</a>18 <a ><img src="/images/down.png">Мои термини</a>19 <a href="editUser.html"><img src="/images/down.png">Кориснички профил</a> 20 <a href="terms.html"><img src="/images/down.png">Мои термини</a> 19 21 </div> 20 22 </div> … … 55 57 </div> 56 58 <div id="right-side"> 57 <div id="hourly-terms">58 59 </div>60 59 <div> 61 <label>Код на купон:</label><input id="coupon-type" type="text"> 60 <label>Код на купон:</label> 61 <select id="coupon-type"> 62 <option></option> 63 </select> 62 64 </div> 63 65 <div> 64 66 <label>Медицинска состојба:</label> <input id="medical-condition" type="text"> 65 67 </div> 68 <div id="hourly-terms"></div> 66 69 <button id="book-button" disabled>Закажи</button> 67 70 </div> -
src/main/resources/templates/html/coupons.html
r743de55 r43c9090 13 13 } 14 14 </style> 15 <script src="/js/cookie.js" defer></script> 15 16 </head> 16 17 <body> 17 18 <button id="authButton" style="display: none;"></button> 18 19 <table> 19 20 -
src/main/resources/templates/html/editUser.html
r743de55 r43c9090 4 4 <meta charset="UTF-8"> 5 5 <title>Title</title> 6 <link rel="stylesheet" href="/css/editUser.css"> 7 <script src="/js/cookie.js" defer></script> 6 8 </head> 7 9 <body> 8 <div id="user-info" style="display: none;"> 9 <img/> 10 <h1>Здраво <span id="cookie-name">име</span></h1> 11 <h2>Ова е твојата профилна страница. Тука имаш преглед кон твоите лични податоци, а воедно можеш и да ги модифицираш</h2> 12 </div> 13 <button id="edit-profile">Измени профил</button> 14 <div> 15 <p>Информации за корисникот</p> 16 <div> 17 <p>Корисничко име</p> 18 <input type="text" name="username" id="usernameSignIn"/> 10 <button id="authButton" style="display: none;"></button> 11 <h2>Информации за корисникот</h2> 12 <div id="content"> 13 <div id="main-part"> 14 <div id="container"> 15 <div id="left-side"> 16 <div> 17 <p>Корисничко име</p> 18 <input type="text" name="username" id="usernameSignIn"/> 19 </div> 20 <div> 21 <p>Име</p> 22 <input type="text" id="name" name="firstName"/> 23 </div> 24 <div> 25 <p>Презиме</p> 26 <input type="text" id="surname" name="lastName"/> 27 </div> 28 <div> 29 <p>Година на раѓање</p> 30 <input type="date" id="age" name="age"/> 31 </div> 32 </div> 33 <div id="right-side"> 34 <div> 35 <p>Телефон</p> 36 <input type="tel" id="phone" placeholder="07_-___-___" name="phone"/> 37 </div> 38 <button id="block-account" style="display: none;">Блокирај к.сметка</button> 39 <button id="edit-profile">Измени профил</button> 40 <button id="saveChanges">Зачувај</button> 41 </div> 42 </div> 43 <div id="adminInfo-block" style="display: none;"> 44 <table id="stat-table"> 45 <thead> 46 <tr> 47 <th>Состојба на термин</th> 48 <th>Број</th> 49 </tr> 50 </thead> 51 <tbody> 52 <tr> 53 <td>Одржани термини</td> 54 <td><span id="carried-out"></span></td> 55 </tr> 56 <tr> 57 <td>Одбиени предлози</td> 58 <td><span id="rejected"></span></td> 59 </tr> 60 <tr> 61 <td>Откажани предлози</td> 62 <td><span id="cancelledReqByUser"></span></td> 63 </tr> 64 <tr> 65 <td>Откажани термини(корисник)</td> 66 <td><span id="cancelledAppByUser"></span></td> 67 </tr> 68 <tr> 69 <td>Откажани термини(админ)</td> 70 <td><span id="cancelledAppByAdmin"></span></td> 71 </tr> 72 </tbody> 73 </table> 74 </div> 19 75 </div> 20 <div> 21 <p>Име</p> 22 <input type="text" id="name" name="firstName"/> 23 </div> 24 <div> 25 <p>Презиме</p> 26 <input type="text" id="surname" name="lastName"/> 27 </div> 28 <div> 29 <p>Телефон</p> 30 <input type="tel" id="phone" placeholder="07_-___-___" name="phone"/> 31 </div> 32 <div> 33 <p>Година на раѓање</p> 34 <input type="date" id="age" name="age"/> 76 <div id="table-part"> 77 <p>Информации за термини на корисникот</p> 78 <select id="statusDropdown"> 79 <option value=""></option> 80 <option value="requests" id="requests">Предложени термини</option> 81 <option value="appointments" id="appointments">Прифатени термини</option> 82 <option value="not-completed" id="not-completed">Неодржани термини</option> 83 <option value="completed" id="completed">Одржени термини</option> 84 </select> 85 <table id="additional-table"> 86 <thead id="active-tableHead"></thead> 87 <tbody id="active-table"></tbody> 88 </table> 35 89 </div> 36 90 </div> 37 <button id="saveChanges">Зачувај</button> 38 <p id="paramsDisplay"></p> 39 <select id="statusDropdown"> 40 <option value=""></option> 41 <option value="requests" id="requests">Предложени термини</option> 42 <option value="appointments" id="appointments">Прифатени термини</option> 43 <option value="not-completed" id="not-completed">Неодржани термини</option> 44 <option value="completed" id="completed">Одржени термини</option> 45 </select> 46 <table> 47 <thead id="active-tableHead"></thead> 48 <tbody id="active-table"></tbody> 49 </table> 50 <div id="adminInfo-block" style="display: none;"> 51 <p>Број на одржани термини <span id="carried-out"></span></p> 52 <p>Број на одбиени предлози за термин <span id="rejected"></span></p> 53 <p>Број на откажани предлози за термин <span id="cancelledReqByUser"></span></p> 54 <p>Број на откажани термини(корисник) <span id="cancelledAppByUser"></span></p> 55 <p>Број на откажани термини(админ) <span id="cancelledAppByAdmin"></span></p> 56 </div> 91 57 92 <div id="popupModal" class="modal" style="display: none;"> 58 93 <div class="modal-content"> 59 94 <span class="close">×</span> 60 95 <h2>Enter Your Details</h2> 61 <input type="text" id="userInput" placeholder="Enter something...">96 <input type="text" id="userInput" required> 62 97 <div class="buttons"> 63 98 <button id="cancelBtn">Cancel</button> … … 66 101 </div> 67 102 </div> 68 <button id="block-account" style="display: none;">Блокирај к.сметка</button> 103 69 104 <script type="module" src="/js/editUser.js"></script> 70 105 </body> -
src/main/resources/templates/html/index.html
r743de55 r43c9090 14 14 <link href="https://fonts.googleapis.com/css2?family=Caveat:wght@400..700&family=Dancing+Script:wght@400..700&family=Kumbh+Sans:wght@100..900&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Libre+Bodoni:ital,wght@0,400..700;1,400..700&display=swap" rel="stylesheet"> 15 15 <link rel="stylesheet" href="/css/index.css"> 16 <script src="/js/cookie.js" defer></script> 16 17 </head> 17 18 <body> … … 57 58 </nav> 58 59 </div> 60 <button id="authButton" style="display: none;"></button> 59 61 </header> 60 61 62 62 <div class="main-content"> 63 63 <div class="title">Енергијата зборува <span class="split-title">погласно од зборовите...</span></div> … … 80 80 <div class="white-part"> 81 81 <p id="personalised"></p> 82 <a href="calendar.html">Закажи термин</a> 83 <a href="terms.html">Мои термини</a> 84 <a href="editUser.html">Кориснички профил</a> 82 <div id="links"> 83 <a href="calendar.html"><img src="/images/down.png">Закажи термин</a> 84 <a href="terms.html"><img src="/images/down.png"> Мои термини</a> 85 <a href="editUser.html"><img src="/images/down.png"> Кориснички профил</a> 86 <a href="userInfo.html"><img src="/images/down.png"> Новости и купони</a> 87 </div> 85 88 </div> 86 89 </div> … … 153 156 <label for="password">Лозинка:</label> 154 157 <input type="password" id="password" name="password" required> 155 <button type="submit">Логирање</button>158 <button id="submit-btn" type="submit">Логирање</button> 156 159 </form> 157 160 </div> … … 163 166 <h2>Креирајте корисничка сметка</h2> 164 167 <form class="dataForms" method="post"> 165 <label for="name">Име:</label> 166 <input type="name" id="name" name="name" required> 167 <label for="surname">Презиме:</label> 168 <input type="surname" id="surname" name="surname" required> 169 <label for="phone">Телефон:</label> 170 <input type="tel" id="phone" name="phone" placeholder="07_-___-___" required> 171 <label for="age">Датум на раѓање:</label> 172 <input type="date" id="age" name="age" required> 173 <label for="usernameSignIn">Корисничко име:</label> 174 <input type="username" id="usernameSignIn" name="username" required> 175 <label for="passwordSignIn">Лозинка:</label> 176 <input type="password" id="passwordSignIn" name="password" required> 177 <button type="submit">Креирај</button> 168 <div> 169 <label for="name">Име:</label> 170 <input type="name" id="name" name="name" required> 171 </div> 172 <div> 173 <label for="surname">Презиме:</label> 174 <input type="surname" id="surname" name="surname" required> 175 </div> 176 <div> 177 <label for="phone">Телефон:</label> 178 <input type="tel" id="phone" name="phone" placeholder="07_-___-___" required> 179 </div> 180 <div> 181 <label for="age">Датум на раѓање:</label> 182 <input type="date" id="age" name="age" required> 183 </div> 184 <div> 185 <label for="usernameSignIn">Корисничко име:</label> 186 <input type="username" id="usernameSignIn" name="username" required> 187 </div> 188 <div> 189 <label for="passwordSignIn">Лозинка:</label> 190 <input type="password" id="passwordSignIn" name="password" required> 191 </div> 178 192 </form> 193 <button id="create" type="submit">Креирај</button> 179 194 </div> 180 195 </div> -
src/main/resources/templates/html/terms.html
r743de55 r43c9090 5 5 <title>Title</title> 6 6 <link rel="stylesheet" href="/css/terms.css"> 7 <script src="/js/cookie.js" defer></script> 7 8 </head> 8 9 <body> 9 < div id="outer-frame">10 <button id="authButton" style="display: none;"></button> 10 11 <div id="frame"> 11 12 <div id="header"> 12 <div>Резервации</div> 13 <div> 14 <button>Кориснички профил</button> 15 <button>Закажи термин</button> 16 </div> 13 <h2>Резервации</h2> 17 14 </div> 18 15 … … 25 22 26 23 <table> 27 <thead id="table-head"> 28 <tr id="initial-head"> 29 <!-- <th>Термин</th>--> 30 <!-- <th>Име</th>--> 31 <!-- <th>Презиме</th>--> 32 <!-- <th>Купон</th>--> 33 <!-- <th>Дополнителни информации</th>--> 34 <!-- <th>Корисник</th>--> 35 <!-- <th>Откажи</th>--> 36 </tr> 37 </thead> 38 <tbody id="requestsTableBody"> 39 40 </tbody> 24 <thead id="table-head"><tr id="initial-head"></tr></thead> 25 <tbody id="requestsTableBody"></tbody> 41 26 </table> 42 43 44 27 </div> 45 </div>46 28 <script src="/js/terms.js"></script> 47 29 </body> -
src/main/resources/templates/html/users-view.html
r743de55 r43c9090 5 5 <title>Title</title> 6 6 <link rel="stylesheet" href="/css/users-view.css"> 7 <script src="/js/cookie.js" defer></script> 7 8 </head> 8 9 <body> 10 <button id="authButton" style="display: none;"></button> 9 11 <div id="frame"> 10 12 <div id="header-part">
Note:
See TracChangeset
for help on using the changeset viewer.