<!DOCTYPE html> 
<html>
	<head>
#parse( "azkaban/webapp/servlet/velocity/style.vm" )
		<script type="text/javascript" src="${context}/js/jquery/jquery.js"></script>    
		<script type="text/javascript" src="${context}/js/jqueryui/jquery-ui.custom.min.js"></script>
		<script type="text/javascript" src="${context}/js/namespace.js"></script>
		<script type="text/javascript" src="${context}/js/underscore-1.2.1-min.js"></script>
		<script type="text/javascript" src="${context}/js/backbone-0.5.3-min.js"></script>
		<script type="text/javascript" src="${context}/js/jquery.simplemodal.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.nav.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.main.view.js"></script>
		<script type="text/javascript" src="${context}/js/azkaban.scheduled.view.js"></script>
		<script type="text/javascript">
			var contextURL = "${context}";
			var currentTime = ${currentTime};
			var timezone = "${timezone}";
			var errorMessage = ${error_message};
			var successMessage = ${success_message};
	
		</script>
	</head>
	<body>
#set($current_page="schedule")
#parse( "azkaban/webapp/servlet/velocity/nav.vm" )
		<div class="messaging"><p id="messageClose">X</p><p id="message"></p></div>  

		<div class="content">
		
#if($errorMsg)
                                <div class="box-error-message">$errorMsg</div>
#else
#if($error_message != "null")
                                <div class="box-error-message">$error_message</div>
#elseif($success_message != "null")
                                <div class="box-success-message">$success_message</div>
#end
#end		
		
			<div id="all-scheduledFlows-content">
				<div class="section-hd">
					<h2>Scheduled Flows</h2>
					<form method="get">
						<input type="hidden" name="action" value="search">
						<input type="submit" value="Search" class="search-btn">
						<input id="searchtextbox" type="text" placeholder="by job name or wildcard" value="" class="search-input" name="job">
					</form>
				</div>
			</div>
			
			<div class="scheduledFlows">
				<table id="scheduledFlowsTbl">
					<thead>
						<tr>
							<!--th class="execid">Execution Id</th-->
							<th>Flow</th>
							<th>Project</th>
							<th>User</th>
							<th>Submitted By</th>
							<th class="date">First Scheduled to Run</th>
							<th class="date">Next Execution Time</th>
							<th class="date">Repeats Every</th>
							<!--th class="elapse">Elapsed</th-->
							<th class="status">Status</th>
							<th class="action">Action</th>
						</tr>
					</thead>
					<tbody>
						#if($schedules)
#foreach($sched in $schedules)
						<tr class="row" >

							<td class="tb-name">
								<a href="${context}/manager?project=${sched.projectId}&flow=${sched.flowId}">${sched.flowId}</a>
							</td>
							<td>
								<a href="${context}/manager?project=${sched.projectId}">${sched.projectId}</a>
							</td>
							<td>${sched.user}</td>
							<td>${sched.userSubmit}</td>
							<td>$utils.formatDateTime(${sched.firstSchedTime})</td>
							<td>$utils.formatDateTime(${sched.nextExecTime})</td>
							<td>$utils.formatPeriod(${sched.period})</td>
							<td><div class="status 'READY'">READY</div></td>
							<td><button id="removeSchedBtn" onclick="removeSched('${sched.scheduleId}')" >Remove Schedule</button></td>
						</tr>
#end
#else
						<tr><td class="last">No Scheduled Flow Found</td></tr>
#end
					</tbody>
				</table>
				
				
			</div>
		</div>
	</body>
</html>
