<?php
if(get_theme_mod('problock1_area_disable') != 'on' ){
	?>
	<!-- problock1 Start -->
	<?php 
		if( get_theme_mod('problock1_areaTpadding',true) ) {
			$problock1_areaTpadding = 'padding-top:'.esc_attr(get_theme_mod('problock1_areaTpadding')).';';
		}
		if( get_theme_mod('problock1_areaBpadding',true) ) {
			$problock1_areaBpadding = 'padding-bottom:'.esc_attr(get_theme_mod('problock1_areaBpadding')).';';
		}
		if( get_theme_mod('problock1_featuredprosliderHeight',true) ) {
			$problock1_featuredprosliderHeight = 'height:'.esc_attr(get_theme_mod('problock1_featuredprosliderHeight')).';';
		}
	?>			
	<div class="problock1-area bg-img-1" id="problock1">  
		<div class="container">
			<div class="row row-eq-height">
				<div class="col-md-3 col-sm-6 col-xs-12">
					<div class="inside-full-height">
						<div class="pro-b-area wow zoomIn" >
							<?php
								$pro_b_page_id = get_theme_mod('pro_b_page');
								$probtitle = get_theme_mod('pro_b_title', 'Adjustable Noise Cancelling');
								$probtext = get_theme_mod('pro_b_text', 'WIRELESS HEADPHONES');
								?>
							<h4><?php echo ($probtitle);  ?></h4>
							<p><?php echo ($probtext);  ?></p>
							<div class="clearfix"></div>
								<div class="pro-b-img">
										<?php
					                    $static=true;
					                    for($i=1;$i<2;$i++){
					                        $link = get_theme_mod('pro_b_link'.$i);
					                        $img = get_theme_mod('pro_b_image'.$i);
					                        if (!empty($img) || !empty($link)){
					                            $static=false;
					                        }
					                    }

					                    if(function_exists('get_woocommerce_term_meta')){
					                        for($i=1;$i<2;$i++){

					                            if($static==false){
					                                $link = get_theme_mod('pro_b_link'.$i);
					                                $img = get_theme_mod('pro_b_image'.$i);
					                                $url = get_theme_mod('pro_b_url_'.$i, '#');
					                                $category = get_term_by( 'id', $link, 'product_cat' );

					                                $img = !empty($img)?$img:get_template_directory_uri().'/images/pro-b.png';

					                                if( !empty($url) || !empty($category) ){
					                                    //echo $term->name;
					                                    ?>
					                                        <a href="<?php echo esc_url(!empty($url)?$url:'#');?>">
					                                            <img src="<?php echo esc_url($img);?>" alt="">
					                                        </a>
					                                    <?php
					                                }
					                            }
					                        }
					                    }else{ ?>
					                    <div class="alert alert-warning">
					                        Kindly Install or Activate the WooCommerce plugin.
					                    </div>
					                    <?php }

					                    if($static==true){
					                        ?>
					                            <a href="#">
					                                <img class="img-responsive secondry-bg-img" src="<?php echo get_template_directory_uri(); ?>/images/pro-b.png" alt="">
					                            </a>
					                        <?php
					                    }?>
									</div>
							<div class="clearfix"></div>
						</div>
						<div class="clearfix"></div>
						<div class="pro-support">
							<?php
								$showStatic = true;
								for( $i = 1; $i < 11; $i++ ){
									$pro_b_page_id = get_theme_mod('pro_b_page_icon'.$i); 
									if(!empty($pro_b_page_id)){
										$showStatic = false;
										break;
									}
								}
								?>
									<?php
									$cols = get_theme_mod('pro_b_npp_count', 1);
									$cols++;
									// echo '$cold: '.$cols;
									switch($cols){
										case 1:
										$colCls = 'col-md-12 col-sm-12 col-xs-12';
										break;
										case 2:
										case 4:
										$colCls = 'col-md-12 col-sm-12 col-xs-12';
										break;
										default: 
										$colCls = 'col-md-12 col-sm-12 col-xs-12';
										break;
									}
									$icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');
									?>
									<div class="row">
										<?php
										for( $i = 1; $i <= $cols; $i++ ){
										if($showStatic === false){
											
											$pro_b_page_title = get_theme_mod('pro_b_page_title'.$i, 'Free Shipping.');
											$pro_b_page_description = get_theme_mod('pro_b_page_description'.$i,'Mauris quis fringilla dui.');
											$pro_b_page_id = get_theme_mod('pro_b_page'.$i); 
											$pro_b_page_icon = get_theme_mod('pro_b_page_icon'.$i);
											if($pro_b_page_icon){
												
											?>
											<div class="<?php echo $colCls;?> pd-0 support-area">
												<div class="pro_b-single wow zoomIn" data-wow-duration="3s">
													<div class="col-md-2 col-sm-1 col-xs-2 pd-0 pro-b-btn">
														<div class="hi-icon">
															<span class="<?php echo $pro_b_page_icon; ?>"></span>
														</div>
													</div>
													<div class="col-md-10 col-sm-10 col-xs-10">
															<div class="pro_b-area-data">
															<h4 class="inner-area-title"><?php echo $pro_b_page_title; ?></h4>
															<div class="section-area-text">
																<?php echo $pro_b_page_description; ?>
															</div>	
														</div>
													</div>


													<div class="clearfix"></div>						
												</div>



												<div class="clearfix"></div>
											</div>
											<?php
													
											}
										}else{?>
											<div class="<?php echo $colCls;?> pd-0 support-area">
												<div class="pro_b-single wow zoomIn" data-wow-duration="3s">
													<div class="col-md-2 col-sm-1 col-xs-2 pd-0 pro-b-btn">
														<div class="hi-icon">
															<span class="fa fa-car"></span>
														</div>
													</div>
													<div class="col-md-10 col-sm-10 col-xs-10">
															<div class="pro_b-area-data">
															<h4 class="inner-area-title">Free Shipping.</h4>
															<div class="section-area-text">
																Mauris quis fringilla dui.
															</div>	
														</div>
													</div>


													<div class="clearfix"></div>						
												</div>
												<div class="clearfix"></div>
											</div>
										<?php }

										}?>
										<div class="clearfix"></div>
									</div>
							<div class="clearfix"></div>
						</div>
					</div>
				</div>
				<div class="col-md-9 col-sm-6 col-xs-12">
					<div class="inside-full-height">
						<div class="row row-eq-height">
						<div class="col-md-5 pd-0">
			            <div class="pro-box1-area wow zoomIn">
									<div class="inside-full-height">
									<div class="col-md-6 col-sm-6 col-xs-6">
										
									<div class="pro-b-img">
										<?php
					                    $static=true;
					                    for($i=1;$i<2;$i++){
					                        $link = get_theme_mod('probox1_link'.$i);
					                        $img = get_theme_mod('probox1_image'.$i);
					                        if (!empty($img) || !empty($link)){
					                            $static=false;
					                        }
					                    }

					                    if(function_exists('get_woocommerce_term_meta')){
					                        for($i=1;$i<2;$i++){

					                            if($static==false){
					                                $link = get_theme_mod('probox1_link'.$i);
					                                $img = get_theme_mod('probox1_image'.$i);
					                                $url = get_theme_mod('probox1_url_'.$i, '#');
					                                $category = get_term_by( 'id', $link, 'product_cat' );

					                                $img = !empty($img)?$img:get_template_directory_uri().'/images/probox1.png';

					                                if( !empty($url) || !empty($category) ){
					                                    //echo $term->name;
					                                    ?>
					                                        <a href="<?php echo esc_url(!empty($url)?$url:'#');?>">
					                                            <img src="<?php echo esc_url($img);?>" alt="">
					                                        </a>
					                                    <?php
					                                }
					                            }
					                        }
					                    }else{ ?>
					                    <div class="alert alert-warning">
					                        Kindly Install or Activate the WooCommerce plugin.
					                    </div>
					                    <?php }

					                    if($static==true){
					                        ?>
					                            <a href="#">
					                                <img class="img-responsive" src="<?php echo get_template_directory_uri(); ?>/images/probox1.png" alt="">
					                            </a>
					                        <?php
					                    }?>
									</div>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6">

										<?php 
										$pro_box_page_id = get_theme_mod('pro_box1_page');
										$probox1title = get_theme_mod('pro_box1_title', 'CC CAMERA');
										$probox1text = get_theme_mod('probox_text', 'JVS-H510-Plus 1.3MP Wi-Fi Cloudsee.');
										$proboxprice = get_theme_mod('probox_price', 'From: <span>$99.00</span>');
										 ?>
										<h4> 
											<?php echo ($probox1title);  ?>
										</h4>
										<p><?php echo ($probox1text);  ?></p>
										<div class="pro-box-price"><?php echo ($proboxprice);  ?></div>
									</div>
									<div class="clearfix"></div>
								</div>
							</div>

							

							
								
						</div>
						<div class="col-md-7 pd-0">
							<?php
								$probox2title = get_theme_mod('pro_box2_title', 'CLOCK-RADIO');
								$probox2text = get_theme_mod('probox2_text', 'FM/AM Alarm Clock ICF-C1 configuration, set alarm, time.');
								?>
							
								<div class="pro-box2-area wow zoomIn">
									<div class="inside-full-height">
									<div class="col-md-6 col-sm-6 col-xs-6">
										<div class="pro-b-img">
										<?php
					                    $static=true;
					                    for($i=1;$i<2;$i++){
					                        $link = get_theme_mod('probox2_link'.$i);
					                        $img = get_theme_mod('probox2_image'.$i);
					                        if (!empty($img) || !empty($link)){
					                            $static=false;
					                        }
					                    }

					                    if(function_exists('get_woocommerce_term_meta')){
					                        for($i=1;$i<2;$i++){

					                            if($static==false){
					                                $link = get_theme_mod('probox2_link'.$i);
					                                $img = get_theme_mod('probox2_image'.$i);
					                                $url = get_theme_mod('probox2_url_'.$i, '#');
					                                $category = get_term_by( 'id', $link, 'product_cat' );

					                                $img = !empty($img)?$img:get_template_directory_uri().'/images/probox2.png';

					                                if( !empty($url) || !empty($category) ){
					                                    //echo $term->name;
					                                    ?>
					                                        <a href="<?php echo esc_url(!empty($url)?$url:'#');?>">
					                                            <img src="<?php echo esc_url($img);?>" alt="">
					                                        </a>
					                                    <?php
					                                }
					                            }
					                        }
					                    }else{ ?>
					                    <div class="alert alert-warning">
					                        Kindly Install or Activate the WooCommerce plugin.
					                    </div>
					                    <?php }

					                    if($static==true){
					                        ?>
					                            <a href="#">
					                                <img class="img-responsive" src="<?php echo get_template_directory_uri(); ?>/images/probox2.png" alt="">
					                            </a>
					                        <?php
					                    }?>
									</div>
									</div>
									<div class="col-md-5 col-md-offset-1 col-md-6 col-sm-6 col-xs-6">
										<h4><?php echo ($probox2title);  ?></h4>
										<p><?php echo ($probox2text);  ?></p>
									</div>
									<div class="clearfix"></div>
								</div>
							</div>
						</div>
							<div class="clearfix"></div>
						</div>
						<div class="clearfix"></div>
						<div class="pro-featured-area">
							<?php
							$showStatic = true;
							for( $i = 1; $i < 4; $i++ ){
								$luzuk_featuredpro_page_id = get_theme_mod('luzuk_featuredpro_page'.$i); 
								if(!empty($luzuk_featuredpro_page_id)){
									$showStatic = false;
									break;
								}
							}
							$featuredpro_title = get_theme_mod('featuredpro_title', 'FEATURED PRODUCTS');	
							
							?>
							<div class="row">
								<div class="section-title pd-0">
									<h2><?php echo ($featuredpro_title);  ?></h2>

								</div>
							</div>
							<div class="row s-border">
								<button class="slide-prev ctrl-btn pro-prev fa fa-chevron-left"></button>
								<button class="ctrl-btn pro-next fa fa-chevron-right slide-next"></button>
								<!-- Wrapper for slides -->
								<div class="slider" id="slider">
									<div class="slides" id="slide">
							    <!-- <div class="row-fluid">
							    	<div class="recent-box">-->
				    		<?php
				    		if(function_exists('woocommerce_template_loop_add_to_cart') && function_exists('WC')){
				    			$args = array( 'post_type' => 'product', 'stock' => 1, 'posts_per_page' => 4, 'orderby' =>'date','order' => 'DESC' );
				    			$meta_query   = WC()->query->get_meta_query();
				    			$tax_query   = WC()->query->get_tax_query();
				    			$tax_query[] = array(
				    				'taxonomy' => 'product_visibility',
				    				'field'    => 'name',
				    				'terms'    => 'featured',
				    				'operator' => 'IN',
				    			);
				    			$args = array(
				    				'post_type'   =>  'product',
				    				'stock'       =>  1,
				    				'posts_per_page' => -1, 
				    				'orderby'     =>  'date',
				    				'order'       =>  'DESC',
				    				'meta_query'  =>  $meta_query,
				    				'tax_query'   => $tax_query,
				    			);
				    			$loop = new WP_Query( $args );
				    			if($loop->post_count > 0){
				    				while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
				    					<div class="col-md-3 slide-item padding0"> 
				    						<div id="recent-porduct" class="wow zoomIn">
				    							<div class="pro-img text-center">
				    								<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="img">
				    									<div class="pro-img-b">
				    									<?php if (has_post_thumbnail( $loop->post->ID )) 
				    									echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog');
				    									else
				    										echo '<img src="'.get_template_directory_uri().'/images/default.png" alt="Placeholder" width="100%" height="200px" />'; ?>	
				    									</div>
				    								</a>
				    								<div class="ht-featured-social-id"> 
				    									<ul>
				    										<li>
				    											<?php
				    											$product->is_icon = true;
				    											woocommerce_template_loop_add_to_cart( $product ); ?>
				    										</li>
				    										<li>
				    											<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><i class="fa fa-eye"></i></a>
				    										</li>
				    									</ul>
				    								</div>
				    							</div>
				    							
				    							<div class="total-product-title-wrap">
				    								<?php
				    									$taxonomyName = "product_cat";
				    									$terms = wp_get_post_terms( get_the_id(), 'product_cat' );
														 $term  = reset($terms);
														foreach ($terms as $term) {
															if( isset( $term->name ) ){
															$img_ll = get_term_link($term->name, $taxonomyName);
															if ( is_wp_error( $img_ll ) ) {
															continue;
															}

														echo '<a class="pro-cat" href="' . $img_ll . '"> ' . $term->name . '</a>';
														}
													}
													?>
				    								<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">	
				    									<h6><?php the_title(); ?></h6></a>
				    									<span class="price"><?php echo $product->get_price_html(); ?></span>
				    								</div>
				    								
				    							</div>
				    						</div><!-- /span3 -->
				    						<?php
				    					endwhile; 
				    				}else{ ?>
				    					<div class="alert alert-warning text-center">
				    						<strong>Sorry, no featured product to show.</strong>
				    					</div>
				    					<?php
				    				}
				    				?>
				    				<!-- </div>-->
				    				<!-- </div>-->
				    				<?php
				    				wp_reset_query(); 
				    			}else{ ?>
				    				<div class="alert alert-warning text-center">
				    					Kindly Install or Activate the WooCommerce plugin.
				    				</div>
				    				<?php
				    			}?>
				    		</div>
				    		
				    	</div><!-- /row-fluid -->
				    </div>

						</div>
						<div class="clearfix"></div>
						<div class="ourclient-area text-center">
							<?php
							$showStatic = true;
							for( $i = 1; $i < 3; $i++ ){
								$url = get_theme_mod('ourclient_page_url_'.$i, '#');
								$link = get_theme_mod('ourclient_page_link'.$i);
								$ourclient_page_id = get_theme_mod('ourclient_page_icon'.$i); 
								if(!empty($ourclient_page_id)){
									$showStatic = false;
									break;
								}
							}
							?> 
								<div class=" wow bounceInUp">  
									<?php
									$cols = get_theme_mod('ourclient_npp_count', 3);
									$cols++;
												// echo '$cold: '.$cols;
									switch($cols){
										case 1:
										$colCls = 'col-md-12 col-sm-12 col-xs-12';
										break;
										case 2:	
										$colCls = 'col-md-6 col-sm-6 col-xs-6';
										break;
										case 3:
										case 9:
										$colCls = 'col-md-4 col-sm-6 col-xs-6';
										break;
										case 5:
										case 6:
										case 9:
										case 10:
										case 11:
										case 12:
										$colCls = 'col-md-4 col-sm-6 col-xs-6';
										break;
										default: 
										$colCls = 'col-md-3 col-sm-6 col-xs-6';
										break;
									}
									$icons = array(1=>'heart', 2=>'star', 3=>'flash', 4=>'bell',5=>'heart', 6=>'star', 7=>'flash', 8=>'bell');
									?>

									<?php
									for( $i = 1; $i <= $cols; $i++ ){


										if($showStatic === false){
											$ourclient_page_id = get_theme_mod('ourclient_page'.$i); 
											$ourclient_page_icon = get_theme_mod('ourclient_page_icon'.$i);
											if($ourclient_page_icon){
												?>
												<div class="<?php echo $colCls;?> wow zoomIn pd-0 ourclient-single-area" data-wow-duration="2s">
													<div class="ourclients-post">
														<figure class="clientlogobx">
															<img src="<?php echo esc_url($ourclient_page_icon); ?>" class="img-responsive" />								
														</figure>
														<div class="clearfix"></div>
													</div>
												</div>
												<?php
											}
										}else{?>
											<div class="<?php echo $colCls;?> wow zoomIn pd-0 ourclient-single-area" data-wow-duration="2s">
												<div class="ourclients-post">
													<figure class="clientlogobx">
														<img src="<?php echo esc_html(get_template_directory_uri()); ?>/images/clogo5.png" class="img-responsive" />
													</figure>
													<div class="clearfix"></div>	
												</div>
												
											</div>
										<?php }

									}?>
								</div>
								<div class="clearfix"></div>
						</div> 
					</div>
				</div>
			</div>
		<div class="clearfix"></div>
		</div>
	</div>

	<script>
		jQuery.noConflict();
		$(function(){
			function ourclientsingleareaHeight(){
				var ht = 0;
				$('.ourclient-area .ourclient-single-area').each(function(i){
					var tHt = $(this).height();
					if(ht<tHt){
						ht=tHt;
					}
				});
				$('.ourclient-area .ourclient-single-area').height(ht+'px');
			}
			ourclientsingleareaHeight();
		});
		$( window ).resize(function(){
			ourclientsingleareaHeight();
		});
	</script>
	<!-- problock1 Area End -->
<?php }  