<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
 <head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Meetup</title>
	<link href="/dist/css/bootstrap.min.css" rel="stylesheet">    
</head>
<body>
	<header>
	  <div class="collapse bg-dark" id="navbarHeader">
	    <div class="container">
	    </div>
	  </div>
	  <div class="navbar navbar-dark bg-dark shadow-sm">
	    <div class="container">
	
	    </div>
	  </div>
	</header>
	<main>
		<section class="py-5 text-center container">
		  <div class="row py-lg-5">
		    <div class="col-lg-6 col-md-8 mx-auto">
		      <h1 class="fw-light">Meetup</h1>
		      <p>
		        <span class="btn btn-primary my-2" data-bs-toggle="modal" data-bs-target="#newMeetingModal">Add Meeting</span>
		      </p>
		    </div>
		  </div>
		</section>

		<div class="album py-5 bg-light">
		  <div class="container">
		    <div class="row row-cols-1 row-cols-sm-2 row-cols-md-3 g-3">
		      <div class="col" th:each="item : ${meetings}">
		        <div class="card shadow-sm">
		          <div class="card-body">
		            <p class="card-text" th:text="${item.subject}">Meeting subject</p>
		            <p class="card-text" th:text="${item.date}">Meeting date</p>
		            <div class="d-flex justify-content-between align-items-center">
		              <div class="btn-group">
		                <a type="button" class="btn btn-sm btn-outline-secondary" th:href="@{'/remove/' + ${item.id}}">Remove</a>
		              </div>
		            </div>
		          </div>
		        </div>
		      </div>
		    </div>
		  </div>
		</div>

	</main>
	
	<div class="modal fade" id="newMeetingModal" role="dialog" aria-labelledby="newMeetingModal" aria-hidden="true">
	  <div class="modal-dialog modal-lg">
	    <div class="modal-content">
		    <div class="modal-header">
		        <h5 class="modal-title">New Meeting</h5>
		        <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
		        	<span aria-hidden="true">&times;</span>
		        </button>
	        </div>
	        <div class="modal-body">
	        	<div class="container-fluid">
			    	<form id="newMeetingForm" enctype='multipart/form-data' method="POST" action="/" style="margin-top:25px;">
						<div class="form-group">
							<label>Subject</label>
							<input class="form-control" type="text" value="" name="subject">
						</div>
						<div class="form-group">
							<label>Date</label>
							<input class="form-control" type="text" value="" name="date" placeholder="DD/MM/YYYY HH:MM">
						</div>
					</form>
				</div>
			</div>
			<div class="modal-footer">
		        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
		        <button class="btn btn-success" type="submit" form="newMeetingForm">Confirm</button>
	        </div>
	    </div>
	  </div>
	</div>
	
    <script src="/dist/js/bootstrap.bundle.min.js"></script>   
</body>
</html>
