<?php $__env->startSection("content"); ?>
<div class="col-md-12 look_container" style="padding-bottom:100px;">    
	<div class="col-md-10 col-md-offset-1">
    	<div class="row">
        	<div class="col-md-3 page_title" style="padding-right:40px;">
            	<h2>BRAND</h2><h2 style="margin-top:-10px;">INFO</h2>
           	</div>

    		<div class="col-md-6 text-center">
            	<div style="margin:30px 0px;">
                	<a href="#" >
					    <?php echo HTML::image($brand->img_path,"",['class'=>"img-circle",'style'=>'width:100px;height:100px']); ?>

                    </a>
					<h1 style="clear:both;"><?php echo $brand->name; ?></h1>
					<a class="" style="margin-bottom:15px;" href="#">
						<img id="ARTICLE_<?php echo $brand->id; ?>" style="margin-bottom: 2px;" height="16" src="<?php echo asset('images/icons/icon_like_on.png'); ?>" onload="islike(<?php echo $brand->id; ?>)")/>
							<span class="like_count"><?php echo $likes; ?></span>
					</a>
				</div>

				<div class="col-md-12">
					<?php echo $brand->description; ?>

					<br>
					<div id="buynow" class="col-xs-4" style="margin-top:40px;">
                        <a class="info_btn" href="<?php echo $brand->buynow; ?>"><img style="margin-bottom: 2px;" height="34" src="<?php echo asset('images/icons/icon_store.png'); ?>" /><span id="like" class="like_count_button liked">SHOP</span></a>   
                       </div>
                       <div id="website" class="col-xs-4" style="margin-top:40px;">
                        <a class="info_btn" href="<?php echo $brand->url; ?>"><img style="margin-bottom: 2px;" height="34" src="<?php echo asset('images/icons/icon_website.png'); ?>" /><span class="like_count_button">WEBSITE</span></a>                           
                       </div>
                       <div id="location" class="col-xs-4" style="margin-top:40px;">
                        <a id="address" class="info_btn" href="#"><img style="margin-bottom: 2px;" height="34" src="<?php echo asset('images/icons/icon_location.png'); ?>" /><span class="like_count_button">LOCATION</span></a>
                       </div>	

					<br>
                    <br>
                   	<div class="col-md-12" >
                        <?php if($isfollow): ?>
                            <a href="<?php echo URL::to('admin/front/actions/BRAND/'.$brand->id.'/FOLLOW/'.$brand->id); ?>" class="btn btn-default social_btn unactive" style="margin-top:40px;clear:both;">
                                Followed
                        <?php else: ?>
                            <a href="<?php echo URL::to('admin/front/actions/BRAND/'.$brand->id.'/FOLLOW/'.$brand->id); ?>" class="btn btn-default social_btn unactive" style="margin-top:40px;clear:both;">
                                +Follow
                        <?php endif; ?>
                            </a>
                   	</div>

                    <div class="col-md-12 social_link" style="margin-top:40px;clear:both;">
                    	<a href="<?php echo $brand->facebook_url; ?>"><img src="<?php echo asset('images/icons/icon_fb_02.png'); ?>"></a>
						<a href="<?php echo $brand->instagram_url; ?>"><img src="<?php echo asset('images/icons/icon_instagram.png'); ?>"></a>
						<a href="<?php echo $brand->youtube; ?>"><img src="<?php echo asset('images/icons/icon_youtube.png'); ?>"></a>
                   	</div>

             	</div>

			</div>
		</div>
	</div>
</div>
</div>

<div class="col-md-12 brand_info_ban">
	<div class="col-md-4 col-md-offset-4 text-center">

		<div class="col-xs-6 left_wave">
			<a href="#posts" class="posts"><p>Posts</p>
			<h2><?php echo count($articles); ?></h2></a>
		</div>
		<div class="col-xs-6">
			<a href="#followers" class="followers"><p class="followers">Followers</p>
			<h2><?php echo $brand->follow; ?></h2></a>
		</div>
	</div>
</div>


<div class="col-md-12 comments look_container">
	<div class="col-md-10 col-md-offset-1">

		<div class="col-md-10 col-md-offset-1 page_title" style="padding-bottom:20px;">
			<div class="append">
<?php $count = 0;?>
						<?php if(isset($articles)): ?>
						<?php foreach($articles as $article): ?>
<?php 
	if($count == 6)
		break;
	$count++;
?>
		                    <div class="window col-md-4">
        		                <div class="post">
									<div>	
                        		        <div class="col-xs-2 narrow">
                                			<a href="<?php echo URL::to('admin/front/lookerinfo/'.$article->blogger_id); ?>">
												<?php echo HTML::image($userphoto[$article->blogger_id],"",['class'=>"media-object img-circle",'style'=>'width:35px;height:35px']); ?>

                			                </a>
                     	       			</div>

		                                <div class="col-xs-6 narrow">
        		                            <div style="margin-left:7px;">
                		                        <p class="looker_name media-heading"><?php echo $username[$article->blogger_id]; ?></p>
                        		                <p class="post_date">
                                					<?php echo date("d M Y",strtotime($article->updated_at)); ?>

												</p>
                                    		</div>
                                		</div>

                                		<div class="col-xs-4 narrow">
		                                    <a class="like" href="#like" onclick="oneAction('ARTICLE','<?php echo $article->id; ?>','LIKE','<?php echo $article->blogger_id; ?>');"  <?php /*"<?php echo URL::to('admin/article/like/'.$article->id.'/'.$article->blogger_id); ?>" */ ?>>
												<img id="ARTICLE_<?php echo $article->id; ?>" style="margin-bottom: 2px;" height="16" src="<?php echo asset('images/icons/icon_like_off.png'); ?>" onload="islike(<?php echo $article->id; ?>)")/>
												<span class="like_count" id="like_<?php echo $article->id; ?>">
													<?php if( empty($likearticle[$article->id]) ): ?>  0
													<?php else: ?> <?php echo $likearticle[$article->id]; ?>

													<?php endif; ?>
												</span>
											</a>
		                                </div>

        			                </div>	
                        		<a href="<?php echo URL::to('admin/front/video/'.$article->id); ?>">
									<h2 class="post_title"><?php echo $article->title; ?></h2>
								</a>
                            	<a href="<?php echo URL::to('admin/front/video/'.$article->id); ?>">
                        			<div class="screen">
										<div class="product">
											<?php echo HTML::image($article->img_path,"",['class'=>"media-object",'style'=>'width:100%;height:100%']); ?>

											<img class="newest_post" src="<?php echo asset('images/icons/new_bg.png'); ?>">
        		                    	</div>
            		                	<div class="cover">
                		            		<img style="margin-top: 45%;" src="<?php echo asset('images/icons/logo_white.png'); ?>" />
	                	    	        </div>
									</div>
								</a>
							</div>
                        </div>
					<?php endforeach; ?>
					<?php endif; ?>
				</div>
		<div class="col-xs-12 text-center">
		<a href="#more" class="more">
	    	<span>LOOOK</span></a>
    	</div>

		<div id="follower" class="col-md-12">
			<div id="follower2">
				<?php foreach($followers as $follower): ?>
					<div class="follower_list text-center">
                    	<a href="#">
							<?php echo HTML::image($follower->img_path,"",['class'=>"img-circle",'style'=>'width:100%']); ?>

<?php /*                        	<img width="100%" class="img-circle" src="<?php echo asset('$follower->img_path'); ?>">	*/ ?>
                        </a>
                    </div>
				<?php endforeach; ?>
			</div>
		</div>
	</div>
</div>
<!--end all article-->
        
        <!-- follower -->
        <div class="container hide">
            <div class="row">
		<?php foreach($followers as $follower): ?>	
                <div class="grid8 align-center">
			<?php echo HTML::image($follower->img_path,"",['class' => "img-responsive img-circle",'style'=>'width:50px;height:50px']); ?>

                        <p><?php echo $follower->name; ?></p>
                </div>
		<?php endforeach; ?>
            </div>
       </div>
        <!-- end follow -->
        <!-- stop contain -->

</div>

<style type="text/css">
.posts, .posts:link, .posts:visited, .posts:hover{
	color: white;
}
.followers, .followers:link, .followers:visited, .followers:hover{
	color: white;
}
</style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" charset="utf-8">

$(document).ready(function(){
	var articles = <?php echo $articles; ?>;
	var username = <?php echo json_encode($username); ?>;
	var userphoto = <?php echo json_encode($userphoto); ?>;
	var From = 6;
	var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
];
//	console.log(articles);
	if(articles.length < 6)
		$(".more").hide();

	$(".more").click(function(){
		console.log(From);
		var contents = "";

		for(i = From ; i<articles.length ; i++)	{
			var lookerurl = "<?php echo URL::to('admin/front/lookerinfo/'); ?>"+articles[i].blogger_id;
			var likeurl = "<?php echo URL::to('admin/article/like/'); ?>"+articles[i].id+'/'+articles[i].blogger_id ;
			var articleurl= "<?php echo URL::to('admin/front/video/'); ?>"+articles[i].id;
			var dates = new Date(articles[i].created_at);
			var datess = dates.getDate()+' '+monthNames[dates.getMonth()]+' '+dates.getFullYear();
			var action = "oneAction('ARTICLE','"+articles[i].id+"','LIKE','"+articles[i].blogger_id+"');";

				contents += '<div class="window col-md-4"><div class="post"><div><div class="col-xs-2 narrow"><a href="'+lookerurl+'"><img class="media-object img-circle" src="../../../'+userphoto[articles[i].blogger_id]+'" style="width:35px;height:35px"></a></div><div class="col-xs-6 narrow"><div style="margin-left:7px;"><p class="looker_name media-heading">'+username[articles[i].blogger_id]+'</p><p class="post_date">'+datess+'</p></div></div><div class="col-xs-4 narrow"><a class="like" href="#like" onclick="'+action+'"><img id="ARTICLE_'+articles[i].id+'" style="margin-bottom: 2px;" height="16" src="../../../images/icons/icon_like_off.png" /><span class="like_count" id="like_'+articles[i].id+'">'+articles[i].likes+'</span></a></div></div><a href="'+articleurl+'"><h2 class="post_title">'+articles[i].title+'</h2></a><a href="'+articleurl+'"><div class="screen"><div class="product"><img src="../../../'+articles[i].img_path+'" style="width:100%"><img class="newest_post" src="../../../images/icons/new_bg.png"></div><div class="cover"><img style="margin-top: 45%;" src="../../../images/icons/logo_white.png" /></div></div></a></div></div>';

			if(i == From+5)
				break;
		}

//		var str = '<div class="row" id="row">'+contents+'</div>';
//		$("#clean").html("");
		$(".append").append(contents);
		From+=6;
		if(From >= articles.length)
			$(".more").hide();
	});

	var address = "<?php echo $brand->location; ?>";
	var geocoder = new google.maps.Geocoder();	
	$("#address").click(function(){
		console.log(address);
		geocoder.geocode( { 'address': address}, function(results, status) {

		if (status == google.maps.GeocoderStatus.OK) {
		    var latitude = results[0].geometry.location.lat();
		    var longitude = results[0].geometry.location.lng();
			console.log(latitude+" "+longitude);
			var url = "<?php echo URL::to('admin/front/shopmap'); ?>"+"/"+latitude+"/"+longitude+"?near=0";
			window.location = url;
		}

		}); 
	});

	$(".posts").click(function(){
		$("#follower").fadeOut();
		$(".append").fadeIn();
	});

	$(".followers").click(function(){
		$("#follower").fadeIn();
		$(".append").fadeOut();
	});

});
</script>

<?php $__env->stopSection(); ?>




<?php echo $__env->make('layout.basic_front', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>