<div class="row page-margin wo_event_profile" data-id="<?php echo $wo['event']['id'];?>">
	<div class="profile-container">
		<div class="card hovercard">
			<div class="cardheader user-cover">
				<div class="intrst_btn">
					<?php echo Wo_GetInterestedButton($wo['event']['id']);?>
					<?php if ($wo['event']['is_owner']): ?>
						<button class="btn btn-default delete-event" id="<?php echo $wo['event']['id']?>" title="<?php echo $wo['lang']['delete'];?>">
							<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M20.37,8.91L19.37,10.64L7.24,3.64L8.24,1.91L11.28,3.66L12.64,3.29L16.97,5.79L17.34,7.16L20.37,8.91M6,19V7H11.07L18,11V19A2,2 0 0,1 16,21H8A2,2 0 0,1 6,19Z" /></svg>
						</button>
					<?php endif ?>
				</div>
				<?php if($wo['event']['is_owner']) { ?>
					<form action="#" method="post" class="profile-cover-changer" id="event-cover-changer">
						<div class="input-group">
							<span class="input-group-btn">
								<span class="btn btn-upload-image btn-file">
									<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"></path><circle cx="12" cy="13" r="4"></circle></svg>
									<input type="file" name="cover" accept="image/x-png, image/jpeg" onchange="Wo_UpdateEventCover()">
								</span>
							</span>
						</div>
						<input type="hidden" name="event_id" id="event_id" value="<?php echo $wo['event']['id'];?>">
					</form>
				<?php } ?>
				<div class="user-cover-uploading-container"></div>
				<div class="user-cover-uploading-progress">
					<div class="pace-activity-parent"><div class="pace-activity"></div></div>
				</div>
				<img id="cover-image" src="<?php echo $wo['event']['cover']?>" alt="<?php echo $wo['event']['name']?> Cover Image"/>

				<div class="event-info-cont">
					<div class="info">
						<span class="short_start_dt">
							<p><?php echo date('M',strtotime($wo['event']['start_edit_date'])); ?></p>
							<b><?php echo date('d',strtotime($wo['event']['start_edit_date'])); ?></b>
						</span>
						<h3><?php echo $wo['event']['name']; ?></h3>
					</div>
					<div class="options-btns">
						<?php echo Wo_GetGoingButton($wo['event']['id']);?>
						<?php if ($wo['event']['is_owner']): ?>
							<a href="<?php echo Wo_SeoLink('index.php?link1=edit-event&eid='.$wo['event']['id']); ?>" class="btn btn-default"><?php echo $wo['lang']['edit']; ?></a>
						<?php endif ?>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div class="col-md-8">
		<?php if (!empty($_GET['type']) && $_GET['type'] == 'interested') { ?>

			<div class="list-group profile-lists sun_side_widget">
				<h3 class="sun_side_widget_title mainpage">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#E91E63" d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z" /></svg> <?php echo $wo['lang']['interested_people']; ?>
				</h3>
				<div id="following-list" class="row" style="margin: 0;">
					<?php
					    $interested = Wo_GetInterestedEventsUsers($wo['event']['id']);
						if (empty($interested)) {
							echo '<h5 class="search-filter-center-text empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="feather"><path fill="currentColor" d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z" /></svg>' . $wo['lang']['no_interested_people'] . '</h5>';
						} else {
							foreach ($interested as $wo['UsersList']) {
								echo Wo_LoadPage('events/includes/users-list');
							}
						}
					?>
				</div>
				<div class="clear"></div>
			</div>

		<?php }elseif (!empty($_GET['type']) && $_GET['type'] == 'going') { ?>
			<div class="list-group profile-lists sun_side_widget">
				<h3 class="sun_side_widget_title mainpage">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="feather" viewBox="0 0 24 24"><path fill="#E91E63" d="M16,13C15.71,13 15.38,13 15.03,13.05C16.19,13.89 17,15 17,16.5V19H23V16.5C23,14.17 18.33,13 16,13M8,13C5.67,13 1,14.17 1,16.5V19H15V16.5C15,14.17 10.33,13 8,13M8,11A3,3 0 0,0 11,8A3,3 0 0,0 8,5A3,3 0 0,0 5,8A3,3 0 0,0 8,11M16,11A3,3 0 0,0 19,8A3,3 0 0,0 16,5A3,3 0 0,0 13,8A3,3 0 0,0 16,11Z" /></svg> <?php echo $wo['lang']['going_people']; ?>
				</h3>
				<div id="following-list" class="row" style="margin: 0;">
					<?php
					    $interested = Wo_GetGoingEventsUsers($wo['event']['id']);
						if (empty($interested)) {
							echo '<h5 class="search-filter-center-text empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="feather"><path fill="currentColor" d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z" /></svg>' . $wo['lang']['no_going_people'] . '</h5>';
						} else {
							foreach ($interested as $wo['UsersList']) {
								echo Wo_LoadPage('events/includes/users-list');
							}
						}
					?>
				</div>
				<div class="clear"></div>
			</div>

		<?php } else{ ?>
		<?php if ($wo['loggedin'] == true) { echo Wo_LoadPage('story/publisher-box'); } ?>

		<?php if ($wo['loggedin'] == true) { echo Wo_LoadPage('story/filter-by'); } ?>

		<div id="posts" data-story-event="<?php echo $wo['event']['id'];?>">
			<div class="pinned-post-container">
				<?php
				$pinedstory = Wo_GetPinnedPost($wo['event']['id'], 'event');
				if (count($pinedstory) == 1) {
					foreach ($pinedstory  as $wo['story']) {
						echo Wo_LoadPage('story/content');
					}
				}
				?>
			</div>
			<div id="posts-hashtag">	     
				<?php
					$stories = Wo_GetPosts(array('filter_by' => 'all', 'event_id' => $wo['event']['id'])); 
					if (count($stories) == 0 ) {
						echo Wo_LoadPage('story/no-event-stories');
					} else {
					foreach ($stories as $wo['story']) {
						echo Wo_LoadPage('story/content');
					}
					}
				?>
			</div>
		</div>
        <?php if (!empty($stories)) { ?>
        
		<div class="load-more pointer" id="load-more-posts" onclick="">
			<span class="btn btn-default"><i class="fa fa-chevron-circle-down progress-icon" data-icon="chevron-circle-down"></i> <?php echo $wo['lang']['load_more_posts']; ?><span>
		</div>
		<?php } ?>
		<div id="load-more-filter">
			<span class="filter-by-more hidden" data-filter-by="all"></span>
		</div>
	<?php } ?>
	</div>

	<!-- Side Bar -->
	<div class="col-md-4">
		<ul class="list-group event-options-list">
			<li class="list-group-item hidden"></li>
			<div class="event_two_blocks">
				<li>
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#4CAF50" d="M7,10H12V15H7M19,19H5V8H19M19,3H18V1H16V3H8V1H6V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3Z" /></svg>
					<span><?php echo $wo['lang']['start_date']; ?></span>
					<time><?php echo $wo['event']['start_date'] . ' - ' . date('H:i',strtotime($wo['event']['start_time'])); ?></time>
				</li>
				<li>
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#e91e63" d="M19,19H5V8H19M16,1V3H8V1H6V3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3H18V1M17,12H12V17H17V12Z" /></svg>
					<span><?php echo $wo['lang']['end_date']; ?></span>
					<time><?php echo $wo['event']['end_date'] . ' - ' . date('H:i',strtotime($wo['event']['end_time'])); ?></time>
				</li>
			</div>
			<ul class="event_cdown">
				<li><span id="days"></span>days</li>
				<li><span id="hours"></span>Hours</li>
				<li><span id="minutes"></span>Minutes</li>
				<li><span id="seconds"></span>Seconds</li>
			</ul>
			<div class="event_invite_frnd">
				<li class="form-group inner-addon" style="margin-bottom: 0px;padding: 5px;">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user-add glyphicon" color="gray"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><line x1="20" y1="8" x2="20" y2="14"></line><line x1="23" y1="11" x2="17" y2="11"></line></svg>
					<input type="text" class="form-control search-for-posts event-people-invite" placeholder="<?php echo $wo['lang']['invite_your_frineds']; ?>" />
				</li>
				<li class="event-people-invition-list"></li>
			</div>
		</ul>
		
		<ul class="list-group event-options-list right_user_info" style="padding-top: 5px;">
			<li class="list-group-item hidden"></li>
			<li class="list-group-item text-muted widget-heading" contenteditable="false">
				<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-info" style="background:#047cac;"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12" y2="8"></line></svg> <?php echo $wo['lang']['info']; ?>			
			</li>
			<li class="list-group-item user-desc-field"><?php echo $wo['event']['description']?></li>
			<li class="list-group-item">
				<a href="<?php echo $wo['event']['url']; ?>?type=going">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="feather" viewBox="0 0 24 24"><path fill="currentColor" d="M16,13C15.71,13 15.38,13 15.03,13.05C16.19,13.89 17,15 17,16.5V19H23V16.5C23,14.17 18.33,13 16,13M8,13C5.67,13 1,14.17 1,16.5V19H15V16.5C15,14.17 10.33,13 8,13M8,11A3,3 0 0,0 11,8A3,3 0 0,0 8,5A3,3 0 0,0 5,8A3,3 0 0,0 8,11M16,11A3,3 0 0,0 19,8A3,3 0 0,0 16,5A3,3 0 0,0 13,8A3,3 0 0,0 16,11Z" /></svg> <?php echo $wo['event']['going']; ?> <?php echo $wo['lang']['going_people']; ?>
				</a>
			</li>
			<li class="list-group-item">
				<a href="<?php echo $wo['event']['url']; ?>?type=interested">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="feather" viewBox="0 0 24 24"><path fill="currentColor" d="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z" /></svg> <?php echo $wo['event']['interested']; ?> <?php echo $wo['lang']['interested_people']; ?>
				</a>
				
			</li>
			<?php if (!empty($wo['event']['location'])): ?>
				<li class="list-group-item text-muted" contenteditable="false">
					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="feather" viewBox="0 0 24 24"><path fill="currentColor" d="M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z" /></svg>
					<?php echo $wo['event']['location']; ?>
				</li>
				<?php if ($wo['config']['google_map'] == 1) { ?>
				<li class="list-group-item user-social-links">
					<iframe width="100%" frameborder="0" src="https://www.google.com/maps/embed/v1/place?key=<?php echo $wo['config']['google_map_api']; ?>&q=<?php echo $wo['event']['location']; ?>&language=en"></iframe>
				</li>
				<?php } ?>
			<?php endif; ?>
		</ul>

		<?php echo Wo_LoadPage('events/includes/delete-event')?>
		<?php echo Wo_LoadPage('footer/sidebar-footer')?>
	</div>
</div>
<!-- JS Pages functions -->
<script>
const second = 1000,
      minute = second * 60,
      hour = minute * 60,
      day = hour * 24;

let countDown = new Date('<?php echo date("m/d/y", strtotime($wo['event']['start_date_js'])) . ' ' . date('H:i',strtotime($wo['event']['start_time'])) ?>').getTime(),
    x = setInterval(function() {

      let now = new Date().getTime(),
          distance = countDown - now;

      document.getElementById('days').innerHTML = Math.floor(distance / (day)),
        document.getElementById('hours').innerHTML = Math.floor((distance % (day)) / (hour)),
        document.getElementById('minutes').innerHTML = Math.floor((distance % (hour)) / (minute)),
        document.getElementById('seconds').innerHTML = Math.floor((distance % (minute)) / second);
      
      //do something later when date is reached
      if (distance < 0) {
       clearInterval(x);
        $('.event_cdown').html('').addClass('hidden');
      }

    }, second)

$(function () {

	if($(window).width() > 600) {
	    $(".user-avatar").hover(function () {
	      $('.profile-avatar-changer').fadeIn(100);
	    }, function () {
	      $('.profile-avatar-changer').fadeOut(100);
	    });
	}

	if($(window).width() > 600) {
	    $(".user-cover").hover(function () {
	      $('.profile-cover-changer').fadeIn(100);
	    }, function () {
	      $('.profile-cover-changer').fadeOut(100);
	    });
	}

	$(".event-people-invite").keyup(function(event) {
	  	var filter = $(this).val();
	  	var event_id = $('#event_id').val();
	  	if (filter.length > 1) {
		  	$.ajax({
		  		url: Wo_Ajax_Requests_File(),
		  		type: 'GET',
		  		dataType: 'json',
		  		data: {f: 'search-my-followers',filter:filter, event_id: <?php echo $_GET['eid']; ?>},
		  	}).done(function(data) {
		  		if (data['status'] == 200) {
		  			$(".event-people-invition-list").css("display","block").html(data['html'])
		  		}
		  		else{
		  			$(".event-people-invition-list").css("display","block").html('<h5 class="text-center">' + data['html'] + '</h5>')
		  		}
		  		
		  	}).fail(function() {
		  		console.log("error");
		  	})
	    }else{
	    	$(".event-people-invition-list").css("display","none").html('')
	    }

	  	
	});

	$(".delete-event").click(function(event) {
	  	$("#delete-event").attr('data-event-ident', $(this).attr('id')).modal("show")
	});

	$("form#event-cover-changer").ajaxForm({
	    url: Wo_Ajax_Requests_File() + '?f=update_event_cover_picture',

	    beforeSend: function () {
	      $('.user-cover-uploading-container,.user-cover-uploading-progress').fadeIn(200);
	    },
	    success: function (data) {
	      if(data.status == 200) {
	        $('[id^=cover-image]').attr("src", data.img);
	      }
	      $('.user-cover-uploading-container,.user-cover-uploading-progress').fadeOut(200);
	    }
	  });
	});

	$(document).on("click",".going-to-event",function(event) {
		var eid = $(this).attr('data-event-ident');
		$.ajax({
			url: Wo_Ajax_Requests_File(),
			type: 'GET',
			dataType: 'json',
			data: {f: 'going-to-event',eid:eid},
			success:function(data){
				if (data['status'] == 200) {
					$("[data-suggested-event=" + eid + "]").addClass('disabled')
					$(".suggest-event-action-" + eid).html('<span class="main">'+data['html']+'</span>')
				}
			}
		})
		
	});

	$(document).on("click",".interested-in-event",function(event) {
		var eid = $(this).attr('data-event-ident');
		$.ajax({
			url: Wo_Ajax_Requests_File(),
			type: 'GET',
			dataType: 'json',
			data: {f: 'interested-in-event',eid:eid},
			success:function(data){
				if (data['status'] == 200) {
					$("[data-suggested-event=" + eid + "]").addClass('disabled')
					$(".suggest-event-action-" + eid).html('<span class="main">'+data['html']+'</span>')
				}
			}
		})
	});

	function Wo_SendEventInvation(user_id){
		if (!user_id) {
			return false;
		}
		else{
			$.ajax({
				url: Wo_Ajax_Requests_File(),
				type: 'GET',
				dataType: 'json',
				data: {f: 'register_event_invite',event_id:<?php echo $_GET['eid']; ?>,user_id:user_id},
				success:function(data){
					if (data['status'] == 200) {
						$("[data-hide-invited-user=" + user_id + "]").slideUp("fast")
					}else{
						$("[data-hide-invited-user=" + user_id + "]").find('button').remove();
					}
				}
			})
		}
	}
	


	function Wo_UpdateEventCover() {
	  $("form#event-cover-changer").submit();
	}

	function Wo_DeleteEvent(id) {
	  if (!id) {
	   return false;
	  }

	  else{
	      $.get(Wo_Ajax_Requests_File(),{f:'delete-event',id: id}, function(data) {
	       if (data.status == 200) {
	         $("#delete-event").modal('hide')
	         window.location = "<?php echo Wo_SeoLink('index.php?link1=welcome')?>";
	       }
	     });
	  }
	  
	}
</script>