<commit_before><jsp:include page="WEB-INF/classes/header.jsp"/>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:if test="${empty user}">
	<% response.sendRedirect("LoginError"); %>
</c:if>

<%	String[] airlines = {"AA", "DL", "UA", "WN", "B6", "AS", "NK", "F9"};

	String[] airports = {"ATL", "ANC", "AUS", "BWI", "BOS", 
		"CLT", "MDW", "ORD", "CVG", "CLE", "CMH", "DFW", 
		"DEN", "DTW", "FLL", "RSW", "BDL", "HNL", "IAH", 
		"HOU", "IND", "MCI", "LAS", "LAX", "MEM", "MIA", 
		"MSP", "BNA", "MSY", "JFK", "LGA", "EWR", "OAK", 
		"ONT", "MCO", "PHL", "PHX", "PIT", "PDX", "RDU", 
		"SMF", "SLC", "SAT", "SAN", "SFO", "SJC", "SNA", 
		"SEA", "STL", "TPA", "IAD", "DCA"}; 
%>

<script type="text/javascript" src="js/masked_input_1.3.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
  

<div class="well well-sm span4">
    <h4>Details of your travel: </h4>
	<form class="form-horizontal form-group-sm" role="form" name="input" action="FlightSearchQuery" method="post" id="input">
		<div class="form-group">
  			<label class="col-sm-2 control-label" for="source">From</label>
  			<select name="source" form="input" id="source" required>
  				<option value=""> </option>
  				<c:forEach items="<%=airports%>" var="airport" >
  					<option value= <c:out value="${airport}"/>>
  						<c:out value="${airport}"/>
  					</option>
  				</c:forEach>
  			</select>
		</div>
		<div class="form-group">
  			<label class="col-sm-2 control-label" for="destination">To</label>
  			<select name="destination" form="input" id="destination" required>
  				<option value=""> </option>
  				<c:forEach items="<%=airports%>" var="airport" >
  					<option value= <c:out value="${airport}"/>>
  						<c:out value="${airport}"/>
  					</option>
  				</c:forEach>
  			</select>
		</div>
		<div class="form-group">
  			<label class="col-sm-2 control-label" for="departure">Departure</label>
  			<input type="text" style="margin-left:1px" class="form-group" id="departure" name="departure" readonly="readonly" required >
		</div>
    	<button type="submit" class="btn btn-primary btn-sm col-md-offset-2" value="Search" data-toggle="modal" data-target=".bs-example-modal-sm">Search</button>
		<button type="button" class="btn btn-danger btn-sm" value="Exit" onClick="window.location='login.jsp'">Exit</button>
	</form>    
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%)">
    <div class="modal-content">
      <div class="modal-body">
        Please, wait while we load the results! <img alt="Wait symbol" src="style/wait.gif" style="width: 50px;height: 50px;margin-left: 5%">
      </div>
    </div>
  </div>
</div>


<script>
$( "form" ).submit(function( event ) {
	$('#myModal').modal({
		show:true,
		backdrop: 'static'
	});
});

$.datepicker.setDefaults({
	  showOn: "both"
	});

$( "#departure" ).datepicker({ 
	appendText: "&nbsp; (mm-dd-yyyy)",
	autoSize: true,
	minDate: 0, 
	maxDate: "+365D",
	changeMonth: true,
    changeYear: true
});

</script>

<jsp:include page="WEB-INF/classes/bottom.jsp"/>

<commit_msg>#5 Validacao js na pagina<commit_after><jsp:include page="WEB-INF/classes/header.jsp"/>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:if test="${empty user}">
	<% response.sendRedirect("LoginError"); %>
</c:if>

<%	String[] airlines = {"AA", "DL", "UA", "WN", "B6", "AS", "NK", "F9"};

	String[] airports = {"ATL", "ANC", "AUS", "BWI", "BOS", 
		"CLT", "MDW", "ORD", "CVG", "CLE", "CMH", "DFW", 
		"DEN", "DTW", "FLL", "RSW", "BDL", "HNL", "IAH", 
		"HOU", "IND", "MCI", "LAS", "LAX", "MEM", "MIA", 
		"MSP", "BNA", "MSY", "JFK", "LGA", "EWR", "OAK", 
		"ONT", "MCO", "PHL", "PHX", "PIT", "PDX", "RDU", 
		"SMF", "SLC", "SAT", "SAN", "SFO", "SJC", "SNA", 
		"SEA", "STL", "TPA", "IAD", "DCA"}; 
%>

<script type="text/javascript" src="js/masked_input_1.3.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
  

<div class="well well-sm span4">
    <h4>Details of your travel: </h4>
	<form class="form-horizontal form-group-sm" role="form" name="input" action="FlightSearchQuery" method="post" id="input">
		<div class="form-group">
  			<label class="col-sm-2 control-label" for="source">From</label>
  			<select name="source" form="input" id="source" required>
  				<option value=""> </option>
  				<c:forEach items="<%=airports%>" var="airport" >
  					<option value= <c:out value="${airport}"/>>
  						<c:out value="${airport}"/>
  					</option>
  				</c:forEach>
  			</select>
		</div>
		<div class="form-group">
  			<label class="col-sm-2 control-label" for="destination">To</label>
  			<select name="destination" form="input" id="destination" required>
  				<option value=""> </option>
  				<c:forEach items="<%=airports%>" var="airport" >
  					<option value= <c:out value="${airport}"/>>
  						<c:out value="${airport}"/>
  					</option>
  				</c:forEach>
  			</select>
		</div>
		<div class="form-group">
  			<label class="col-sm-2 control-label" for="departure">Departure</label>
  			<input type="text" style="margin-left:1px" class="form-group" id="departure" name="departure" readonly="readonly" required >
		</div>
    	<button type="submit" class="btn btn-primary btn-sm col-md-offset-2" value="Search" data-toggle="modal" data-target=".bs-example-modal-sm">Search</button>
		<button type="button" class="btn btn-danger btn-sm" value="Exit" onClick="window.location='login.jsp'">Exit</button>
	</form>    
</div>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%, -50%)">
    <div class="modal-content">
      <div class="modal-body">
        Please, wait while we load the results or hit <strong>ESC</strong> to redo your search! <img alt="Wait symbol" src="style/wait.gif" style="width: 50px;height: 50px;margin-left: 5%">
      </div>
    </div>
  </div>
</div>


<script>
$( "form" ).submit(function( event ) {
	 if ($.trim($("#source").val()) === "" || $.trim($("#destination").val()) === "" || $.trim($("#departure").val()) === "") {
	        alert('Please, fill all the input fields');
	    return false;
	    }
	
	$('#myModal').modal({
		show:true,
		backdrop: 'static'
	});
	
	$('#myModal').hide(5000);
});

$.datepicker.setDefaults({
	  showOn: "both"
	});

$( "#departure" ).datepicker({ 
	appendText: "&nbsp; (mm-dd-yyyy)",
	autoSize: true,
	minDate: 0, 
	maxDate: "+365D",
	changeMonth: true,
    changeYear: true
});

</script>

<jsp:include page="WEB-INF/classes/bottom.jsp"/>


{'fraction_non_alphanumeric': 0.2389491242702252, 'fraction_numerical': 0.011259382819015847, 'mean_word_length': 3.600383631713555, 'pattern_counts': {'":': 0, '<': 143, '<?xml version=': 0, '>': 143, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503053', 'n_tokens_mistral': 2982, 'n_tokens_neox': 2725, 'n_words': 534}