<? global $vis_language; ?>
<section  class="container m-t-md">
   <div class="row">
      <div class="col-md-12">
         <section class="panel shadow-none">
            <div id="service_item_list">
             
                  <div class="panel-heading b-b">
                    
                        <div class="row">
                           
                           <div class="col-sm-9 col-md-9 padder-v">
                              <form role="form" method="post" id="filter_service_item" name="filter_service_item">
                                 <div class="input-group b-a b-2x">
                                    <input type="text" id="search_language_variables" placeholder="<?=$vis_language['TXTSEARCHSERVICEITEM'];?>" class="form-control rounded input-sm no-border">
                                    <span class="input-group-btn ">
                                    <button type="button" onclick="vis_apply_filter();" class="btn btn-sm btn-rounded bg-white b-white btn-icon">
                                    <i class="vh vh-search"></i>
                                    </button>
                                    </span>
                                 </div>
                              </form>
                           </div>
                           <div class="col-sm-3 col-md-3 padder-v">
                              <div class="btn-group pull-right ">
                                 <a href="index.php?/setting/services_category" class="btn btn-sm btn-link vis_link_button link padder"><? echo $vis_language['TXTSERVICECATEGORY']; ?></a>
                                 <a href="index.php?/setting/view_services" class="btn btn-sm btn-link link vis_link_button padder"><? echo $vis_language['TXTALL']; ?></a>
                              </div>
                           </div>
                        </div>
                     
                  </div>
                  <div class="panel-body" id="service_item">
                     <? if($service_details==-1 && isset($operation['vis_filter_enable'])){   
                        echo '<section class="wrapper fullFrame">
                        		<div class="fullMiddle m-xl text-center h4">'.$vis_language['TXTNOMATCHFOUND'].'</div>
                        </section>';
                        echo '<script> $("#no_record_found").hide(); </script>'; 
                        }else if($service_details==-1 && !isset($operation['vis_filter_enable'])){   
                        echo '<script> $("#no_record_found").show(); </script>';
                        }else { 
                        echo '<script> $("#no_record_found").hide(); </script>'; 
                        ?>
                     <div class="col-md-12">
                        <div class="row row-sm">
                           <? for($i=0;$i<count($service_details);$i++) { 
                              if($service_details[$i]['domain_id']==0) $domain_id = VIS_DOMAIN; else $domain_id = $service_details[$i]['domain_id'];
                              	list($dpinf, $domain)=$object->get_domain(VIS_TABLE_PREFIX.'domain.is_enabled=1 and '.VIS_TABLE_PREFIX.'domain.domain_id='. $domain_id, '', 0, '', VIS_STAFF_ID, VIS_LOCATION_AREA);
                              
                              	 if($service_details[$i]['item_image']=='')
                              	 	$image_name = 'item_default.png';
                              	 else
                              	 	$image_name = $service_details[$i]['item_image'];
                              		
                              	if($service_details[$i]['domain_id']==VIS_DOMAIN || $service_details[$i]['domain_id']==0){?>    
                           <div class="col-xs-6 col-sm-4 col-md-3">
                              <div class="thumbnail">
                                 <a href="index.php?/setting/view_service_detail/<?= $service_details[$i]['item_id'];?>"><img style="max-height: 128px;" src="<?= VIS_PATH_PROFILE.$image_name;?>" title="Item Image"></a>
                                 <div class="caption">
                                    <p class="text-ellipsis m-b-none"><strong><?= ucfirst($service_details[$i]['name']);?></strong></p>
                                    <p class="text-ellipsis m-b-none"><?= $service_details[$i]['description'];?></p>
                                    <div class="line b-b line-lg pull-in"></div>
                                    <?  if($service_details[$i]['cost_status']==1){?>     
                                    <p class="text-ellipsis m-b-none"><strong><?= $service_details[$i]['cost'].' '.$domain[0]['currency'];?></strong></p>
                                    <? }else{?>
                                    <p class="text-ellipsis m-b-none"><strong>&nbsp;</strong></p>
                                    <? }?>    
                                    <p class="text-ellipsis m-b-none text-center"> 
                                       <a href="index.php?/setting/view_service_detail/<?= $service_details[$i]['item_id'];?>"><button type="button" class="btn btn-primary" ><? echo $vis_language['TXTITILREQUEST']; ?></button></a>
                                    </p>
                                 </div>
                              </div>
                           </div>
                           <? }}?>     
                        </div>
                     </div>
                     <? }?>
                  </div>
             
            </div>
      </section>
		 <section class="wrapper fullFrame" id="no_record_found" <? if($service_details!=-1) echo 'style="display:none;"'; ?>>
         <div class="fullMiddle m-xl text-center h4"><?= $vis_language['TXTNOTHINGTODISPLAY']; ?></div>
      </section>
      </div>
    </div>
</section>

<script>
   function vis_apply_filter(){
   	//alert('tejas');
       var filter = $("#search_language_variables").val();
	   if(filter=='')
	   {
		   return false;
	   }
   	//alert(filter);
   	var data = {'vis_filter_enable':'1', 'vis_action': 'vis_filter='+filter+''};
   	//alert(data);   
       $.ajax({
   		url: 'index.php?vis_module=setting&vis_operation=filter_services',
   		data: data,
   		type: "POST",
   		success: function(data){
   			//alert(data);
   			$('#service_item_list').html(data);
   			
   		},
   		error: function(xhr, ajaxOptions, thrownError) {$("#vis_global_msg_div").visInterface("load_global_message", "Error: "+xhr.status+" - "+thrownError);}
   	});    
   }
   $("#search_language_variables").keypress(function (event) {	
       var keycode = (event.keyCode ? event.keyCode : event.which);
       if(keycode == '13') {
   	   event.preventDefault();
          vis_apply_filter();    
       }
   });
</script>

