<?php



?>


 <!DOCTYPE html>
 <html lang="en">
   <head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <!--<meta name="viewport" content="width=device-width, initial-scale=1">-->
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <title><?= $config['CompanyName'] ?></title>
 
     <!-- Bootstrap -->
     <link href="../css/bootstrap.min.css" rel="stylesheet">
     <link rel="stylesheet" href="../css/bootstrap-combobox.css" />
 
     <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
     <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
     <!--[if lt IE 9]>
       <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
       <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
       <script src="../js/functions.js"></script>
       <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
       <script src="../js/functions.js"></script>
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
           <!-- Include all compiled plugins (below), or include individual files as needed -->
           <script src="../js/bootstrap.min.js"></script>
       	 <script src="../js/bootstrap-combobox.js"></script>
       	 <script src="../js/excellentexport.js"></script>
           <script type="text/javascript">
             $(document).ready(function(){
             
             });
           </script>
					<link rel="stylesheet" href="../css/jquery.filthypillow.css" type="text/css" />
					<script src="../js/jquery.filthypillow.min.js" type="text/javascript"></script>
					<script src="../js/moment.js" type="text/javascript"></script>
     <![endif]-->
	<link rel="stylesheet" href="../css/styles.css"/>
   </head>
   <body>
<?php 
	include("navbar.php");
?>
        <br /><br />
   <!-- Stack the columns on mobile by making one full-width and the other half-width -->
    
	<div class="container" style="padding-top: 10px;">
		<link href="../css/fileinput.min.css" media="all" rel="stylesheet" type="text/css" />
		<script src="../js/fileinput.js" type="text/javascript"></script>
		
		<div class="panel panel-default">
			<div class="panel-heading form-inline" style=" padding-bottom: 30px;">
				<div style="margin-right: 10px; float: right;">
					
					<button class="btn btn-primary" onclick="changeStripHeader()" >Upload New Strip Header</button>
				</div>
				<h3 class="panel-title">Strip Header</h3>
				<span>Changing the Strip Header will replace the current </span>
			</div>
			<div class="panel-body">
				<img src="../img/banner.jpg?time=<?= time() ?>" class="img-responsive center-block" />
			</div>
		</div>
	</div>
	
	
	   <div class="modal fade" id="UploadStripHeaderModal">
		 <div class="modal-dialog">
		   <div class="modal-content">
			 <div class="modal-header">
			   <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
			   <h4 class="modal-title" id="AddEditTitle">Upload Strip Header Image</h4>
			 </div>
			 <div class="modal-body">
			   <form class="stripHeaderForm">
					 <div class="form-group" id="StripHeaderUploadDiv" >
							<div id="stripHeaderPreviewDiv" style="height: 150px; text-align: center; vertical-align: middle;" id="">
								<img id="stripHeaderPreview" style="max-height: 100%; max-width: 100%;"src="" alt="" />
							</div>
							<div class="alert alert-info" style="display: none;" id="uploadButtonSuccess" role="alert">
								File has been uploaded successfully!
							</div>
					   <label for="stripHeaderImage">Strip Header</label>
					   <input type="file" class="file form-control" name="stripHeaderImage" autocomplete="off" id="stripHeaderImage">
				   </div>
			   </form>
			 </div>
			 <div class="modal-footer">
			   <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
			   <button type="button" class="btn btn-primary" id="saveButton" onclick="">Save</button>
			 </div>
		   </div><!-- /.modal-content -->
		 </div><!-- /.modal-dialog -->
	   </div><!-- /.modal -->
		 
	   <script type="text/javascript">
		 
		   function clearModal() {
			   $('#stripHeaderImage').attr('src', '');
		   }
		   function changeStripHeader() {
			   clearModal();
			   $('#UploadStripHeaderModal').modal('toggle');
		   }
		   
		   $("#stripHeaderImage").fileinput({
			   'showUpload':true, 
			   'showPreview': false,
			   'uploadUrl':"mod.php?p=headerbanner&a=upload_image",
			   'fileTypeSettings':'image',
			   'elErrorContainer':'#uploadError',
		   });
		   $('#stripHeaderImage').on('filebatchuploadsuccess', function(event, data, previewId, index) {
			   response = data.response;
			   if(response.fileuploaded === true){
			   console.log(response);
				   $("#uploadButtonSuccess").text(response.message);
				   $("#uploadButtonSuccess").css('display', "");
				   $('#stripHeaderPreviewDiv').css('display', '');
				   $('#stripHeaderPreview').attr('src', response.url);
					 $('#saveButton').unbind('click');
					 $('#saveButton').on('click', function(){
							$.get('mod.php?p=headerbanner&a=functions&f=saveBanner&file=' + response.target_file + '&time=<?= time() ?>', function(data){
									if(data){
										location.reload();
									}
								});
								
						});
			   }
		   });
		
				
		   </script>
	
	 </div>    
     
   </body>
 </html>