<?php 
	require_once('Connections/conn_ama.php');

		if(!isset($_SESSION)){
					session_start();
			} 

		//Retrieve News Articles
		$query_rsCategories = "SELECT categoryID, category  FROM eventcategory";
		$rsCategories = mysqli_query($conn_ama, $query_rsCategories ) or die(mysqli_error($conn_ama));
		$row_rsCategories = mysqli_fetch_assoc($rsCategories);
		$totalRows_rsCategories = mysqli_num_rows($rsCategories);/**/

 ?>

<div class="col-md-9 data-area">
	<div class="data-area-wrap">
		<div class="form-wrapper">
			<form id="new-event" method="post">
			  	<fieldset>
			  	<legend>Add Event: <?php //print_r($_SESSION); ?></legend>
			  		<div class="form-group">
					    <label for="eventname">Event</label>
					    <input type="text" name="eventname" class="form-control" id="eventname" >
						</div>
						<div class="form-group">
							<label for="categoryID">Event Category</label>
							<select name="categoryID" id="categoryID" class="form-control">
									<option value="">-Select Category-</option>
									<?php do { ?>	
										<option value="<?php echo $row_rsCategories['categoryID']; ?>"><?php echo ucwords($row_rsCategories['category']); ?></option>
									<?php } while($row_rsCategories = mysqli_fetch_assoc($rsCategories)) ?>
									
							</select>
						</div>

				  	<div class="form-group">
					    <label for="eventdate">Event Date, eg. June 22, 2019 | 6pm - 8:30pm</label>
							<input type="text" name="eventdate" class="form-control" id="eventdate" >

							<label for="eventvenue">Event Venue</label>
							<input type="text" name="eventvenue" class="form-control" id="eventvenue" >
				  	</div>

				  	<div class="form-group">
					    <label for="eventdesc">Event Description</label>
					  	<textarea name="eventdesc" class="tinymce"  id="eventdesc"></textarea>
						</div>

												
						<div class="form-group">
						<label for="priority">Priority</label>
							<select name="priority" class="form-control"  id="priority">
									<option value="">-Select Priority-</option>
									<?php for($i=1; $i<11; $i++) { ?>	
										<option value="<?php echo $i; ?>"><?php echo $i; ?></option>
									<?php } ?>
							</select>
						</div>

						<div class="form-group">
							<label for="fileUpload">News Image</label>
							<input type="file" id="eventImgUpload" class="form-control fileUpload" name="image" multiple accept="image/*">
							<button type="button" class=" delete-btn close" aria-label="Close">
								<span aria-hidden="true">&times;</span>
							</button>
							<div id="image-holder"></div>	
						</div>
			  	</fieldset>
				<hr>
			  <button type="submit" id="add-event" class="btn btn-success">Submit</button>
			  <input type="hidden" name="MM_insert" value="save-event" />
			  <div class="error_msg"></div>
			</form>
		</div><!-- End .form-wrapper-->
	</div><!-- End .data-area-wrap-->	
</div><!-- End .data-area -->

<script type="text/javascript" src="_/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript" src="_/js/tinymce/jquery.tinymce.min.js"></script>
        
                
<!-- TinyMCE -->
        
            
	<script type="text/javascript">
		$(function(){
			tinymce.init({
			selector: 'textarea#eventdesc',
			height: 500,
			mobile: {
					theme: 'mobile',
					plugins: [ 'autosave', 'lists', 'autolink' ]
				}
			});
		});
	</script>