Commit 7e2c8269 authored by sapn1s's avatar sapn1s
Browse files

Created view event mode upon click on event

parent 0e775bd4
......@@ -101,6 +101,8 @@ public class CalendarController {
JsonObject eventJson = new JsonObject();
eventJson.addProperty("title", allEvents.get(i).getName());
eventJson.addProperty("start", allEvents.get(i).getStartDate() + "T" + allEvents.get(i).getStartTime());
eventJson.addProperty("description", allEvents.get(i).getDescription());
eventJson.addProperty("type", allEvents.get(i).getEventType().name());
eventArray.add(eventJson);
}
models.addAttribute("currentTime", LocalTime.now().toString());
......
......@@ -13,4 +13,5 @@ import com.example.calendar.models.Event;
public interface EventRepo extends CrudRepository<Event, Integer> {
ArrayList<Event> findAllByCalendar(Calendar calendar);
ArrayList<Event> findAllByStartDate(LocalDate startDate);
Event findByCalendarAndStartDate(Calendar calendar, LocalDate startDate);
}
......@@ -58,6 +58,45 @@ a:hover {
background-image: none;
color: white;
}
/* The Modal (background) */
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
<br/>
......@@ -73,6 +112,22 @@ a:hover {
<input type="hidden" id="events" th:value="${allEvents}"/>
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content w-50">
<span class="close">&times;</span>
Title: <span id="evTitle"></span>
<br>
Description: <span id="evDescription"></span>
<br>
Type: <span id="evType"></span>
<br>
Date: <span id="evDate"></span>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
......@@ -95,14 +150,43 @@ $(document).ready(function() {
editable: false,
eventLimit: true, // allow "more" link when too many events
timeFormat: 'H(:mm)',
events: all
events: all,
eventRender: function(info, el, view) {
var modal = document.getElementById("myModal");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
el[0].onclick = function() {
console.log(info)
modal.style.display = "block";
document.getElementById("evTitle").textContent = info.title
document.getElementById("evDescription").textContent = info.description
document.getElementById("evType").textContent = info.type
document.getElementById("evDate").textContent = info.start._i
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
},
});
});
</script>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment