<?php 	
		include_once('../../config.php');        
		
			if(isset($_POST['submit']))
			{     
				$BazzarRst = mysql_query("select * from  Bazzar where is_active = 1 order by id");   	
				while($rw = mysql_fetch_object($BazzarRst))
				{
					if(isset($_POST['Id_'.$rw->id]))
						mysql_query("update  Bazzar set AppActive = 1 where id = $rw->id ");   	
					else
						mysql_query("update  Bazzar set AppActive = 0 where id = $rw->id ");   		
				}   
			} 
	$BazzarRst = mysql_query("select * from  Bazzar where is_active = 1 order by id");   
	include ABS_PATH.'/admin/header.php';	
?>  


 <script>
	$(function() {
		$( "#datepicker" ).datepicker(); 
		$("#ShowSingleAn").hide();
		$("#ShowJodi").hide();
		$("#ShowPanni").hide();
		
            $('#OptionSelect').on('change', function() 
            {
                if($(this).val()==1)
                {
                    $("#ShowSingleAn").show(500);
                	$("#ShowJodi").hide(500);
            		$("#ShowPanni").hide(500);
            		$("#AddValue").val(1);
                    
                }else if($(this).val()=='')
                {
                    
                    $("#ShowSingleAn").hide(500);
                	$("#ShowJodi").hide(500);
            		$("#ShowPanni").hide(500);
                }
            });

	}); 
  
	$(document).ready(function()
	{   

	
	$("#product_frm").validate({
		
		errorElement:'div',
		rules:{ 
			OpenAnk:{
				required:true,
				number:true,
				minlength:1,
				maxlength:1
			},
			OpenPatti:{
    			required:true,
    			number:true,
    			minlength:3,
    			maxlength:3
    		},
			CloseAnk:{
    			required:true,
    			number:true,
    			minlength:1,
    			maxlength:1
    		} ,
			ClosePatti:{
    			required:true,
    			number:true,
    			minlength:3,
    			maxlength:3
    		}
		},
		messages:{				
			 
			 city:{
				required:"Enter Ank"				 
			} 
		}
	});


	});
 


</script>
		 
		 <div class="col-md-10">

	  			<div class="row">
	  				<div class="col-md-12">
	  					<div class="content-box-large">
							<div class="panel-heading">
								<div class="panel-title"> <h3>   App Bazzar Display </h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='bazzar.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm" autocomplete ="off"> 
                                    
                                    <?php 
                                        while($rw = mysql_fetch_object($BazzarRst))
                                        {
                                    ?> 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label"><?php echo $rw->name; ?></label>
								    <div class="col-sm-3">  
							            <input type="checkbox" class="form-control"    name="Id_<?php echo $rw->id;?>"   <?php if ($rw->AppActive==1) echo "checked";?>  />  
								    </div>
								 </div>
								 <hr>
								 <?php  } ?> 
								  
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Update</label>
										<div class="col-sm-10">
										  <input type="submit"    class="btn btn-primary"  name="submit" value="Update">
										  <input type="hidden" name="AddValue" id="AddValue">
										  
										  
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div> 
	  			</div>   

	  		<!--  Page content -->
		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    