<?php  session_start();
error_reporting(0);
$log=$_SESSION['login_user'];
if(empty($log)) {
   echo "<script type='text/javascript'>window.location.href = 'index.php';</script>";	
}
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">

   <link rel="icon" href="img/logo.png" type="image/x-icon">
<title>Welcome to Kalpana </title>

<!-- datepicker starts-->
  <link href="css/bootstrap.css" rel="stylesheet">

  <!-- jQuery -->
    <script src="js/jquery-1.11.2.js" type=""></script>
    
    <script src="js/bootstrap.js" type=""></script>

  
	<!--rich text box start-->
	<link type="text/css" rel="stylesheet" href="css/jquery-te-1.4.0.css">

<script type="text/javascript" src="http://code.jquery.com/jquery.min.js" charset="utf-8"></script>

<script type="text/javascript" src="js/jquery-te-1.4.0.min.js" charset="utf-8"></script>

	<!-- Rich text box end-->
	
	
	
<!-- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>-->
    <link href="css/jquery-ui.css" rel="stylesheet">

  
  
  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
	

<link rel="text/javascript" src="">
	<!-- datepicker ends-->
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.0/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.0/js/bootstrap-toggle.min.js"></script>


<!-- datepicker starts-->
<link href="../css/loader.css" rel="stylesheet">
  <link href="css/bootstrap.css" rel="stylesheet">

  <!-- jQuery -->
    <script src="js/jquery-1.11.2.js" type=""></script>
    <!-- bootstrap -->
    <script src="js/bootstrap.js" type=""></script>

    <link href="css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" /> 
    <link href="css/jquery-ui.css" rel="stylesheet">

  <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
	

<link rel="text/javascript" src="">
	<!-- datepicker ends-->


<!-- Number with dot start-->
<script type="text/javascript">
    
	function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode != 46 && charCode > 31 
            && (charCode < 48 || charCode > 57))
		{
        return false;
    }
    return true;
}	
    </script>
	
<!-- Number with dot end-->	




<script type="text/javascript">

$( document ).ready(function() {
	$("#preloader").hide();	
	$("#preloader1").hide();	
//$("#date").datepicker({ dateFormat: 'dd/mm/yy', maxDate : 0  });
 
$("#date").datepicker({ dateFormat: 'dd/mm/yy', changeYear:true,changeMonth: true, yearRange: "-100:+100",changehour:true });


//$("#tdate").datepicker({ dateFormat: 'dd/mm/yy', changeYear:true,changeMonth: true, yearRange: "-100:+100" });

var editor2 = $("#txtEditor2");
				editor2.Editor();
				
$('#package').DataTable({
				 "bProcessing": true,
         "serverSide": true,
		 "responsive": true,
         "ajax":{
            url :"latest_news_grid.php", // json datasource
            type: "post",  // type of method  ,GET/POST/DELETE
            error: function(){
              $("#employee_grid_processing").css("display","none");
			  
            }
			
          }
        });	
	
	
$("#photo").change(function(){
		
			$("#preloader").show();		
			var fd=new FormData();
			fd.append('photo',$('#photo').prop('files')[0]);
		setTimeout(function(){	
			$.ajax({
			type:'POST',
			url:'latest_news_upload.php',
			data:fd ,
			cache:false,
			contentType:false,
			processData:false,
			
			dataType: 'JSON',
			success: function(result) {
				$("#preloader").hide();	
							},
							async:false

		});
	},2000);	
  });


  
  
  $("#photo1").change(function(){
			
			$("#preloader").show();	
			var fd=new FormData();
			fd.append('photo1',$('#photo1').prop('files')[0]);
			$.ajax({
			type:'POST',
			url:'policy_category_img_update.php',
			data:fd ,
			cache:false,
			contentType:false,
			processData:false,
			
			dataType: 'JSON',
			success: function(result) {
			$("#preloader").hide();	
						$("#photo3").val(result.op)
							},
							async:false

		});
		
  });	
  

	$("#submit").click(function(e){
		
		if($("#photo").val()=="" || $("#pro_cat").val()=="" || $("#date").val()=="" || $("#poster").val()==""){
			$("#popup_msg").html('Title,Image,Date,Time Is MANDATORY');
								$('#myModal1').modal('show');
			return false;
		}
		else{
			
			
		$("#preloader").show();	
			e.preventDefault();
			
		var des1 = editor2.Editor("getText");
			$("#about").val(des1);	
			
		$("#submit").attr("disabled","disabled");	
	setTimeout(function(){	
			$.ajax({
			type:'POST',
			data:$("#frmSignIn").serialize(),
			url:'latest_news_insert.php',
			dataType: 'JSON',
			success: function(result) {
                                         console.log(result.op);
						if(result.op==1){
						$("#pro_cat,#photo,#date,#time,#desc").val("");
								$("#preloader").hide();	
								//$('#').modal('show');
								$("#popup_msg").html('NEWS SAVED SUCCESSFULLY');
								$('#myModal1').modal('show');
								location.reload();
								
								}
								else{
								$("#popup_msg").html('NOT SAVED SUCCESSFULLY');	
								}
							},
							error:function(xhr,status,error){
							alert(xhr.respanseText);	
							},
							async:false

		});

},2000);

		}
    });	
	





			
  				$('#deleteTriger').on("click", function(event){
					$("#preloader").show();	
	
	setTimeout(function(){
					
				 // triggering delete one by one
					if( $('.deleteRow:checked').length > 0 ){  // at-least one checkbox checked
					
						var ids = [];
						$('.deleteRow').each(function(){
							if($(this).is(':checked')) { 
								ids.push($(this).val());
							}
						});
						var ids_string = ids.toString();  // array to string conversion 
						
						
						$.ajax({
							type: "POST",
							url: "latest_news_delete.php",
							
							data: {data_ids:ids_string},
							success: function(result) {
								$("#preloader").hide();	
								
								$("#popup_msg").html('DELETED SUCCESSFULLY');
								$('#myModal1').modal('show');
							},
							async:false
							
						});
						$('#package').DataTable().ajax.reload();
					}
					else{
						alert("Please select only one row");
					}
					},2000);
				});
  
  
  
  


  $('#demo_time').on("click", function(event){
	
				//alert("test");
				 // triggering delete one by one
					if( $('.deleteRow:checked').length == 1 )
					{  // at-least one checkbox checked
			
						var ids = [];
						$('.deleteRow').each(function(){
							if($(this).is(':checked')) { 
								ids.push($(this).val());
							}
						});
						var ids_string = ids.toString();
						// array to string conversion 
						
						$('.signin').attr("data-toggle",'modal');
						$.ajax({
							type: "POST",
							url: "product_category_autobind.php",
							dataType:'json',
							data: {data1:ids_string},
							success: function(result) {
					
					
					$("#pcat_id1").val(result.pcat_id);
					$("#pro_cat1").val(result.pname); 
					$("#photo2").val(result.img); 
					 
				
													
							},
							
							
						});
						
					}
					else 
					{
						alert("Please select only one row");
						//$(".modalbox").fancybox.close();
						$('.signin').attr("data-toggle",'');
						
					}
					$('#package').DataTable().ajax.reload();
				});
				
				
	$("#submit1").click(function(e){
		
		
		
		
		$("#preloader1").show();	
			e.preventDefault();
	setTimeout(function(){	
			$.ajax({
			type:'POST',
			data:$("#pro_cat_update").serialize(),
			url:'product_category_update.php',
			dataType: 'JSON',
			success: function(result) {

								if(result.op==1){
									
								$("#preloader1").hide();	
								//$('#').modal('show');
								$("#popup_msg1").html('POLICY UPDATED SUCCESSFULLY');
								$('#myModal2').modal('show');
								$(".close").click(function(e){
								window.location.href ='epolicycategoryDetials.php';
								});
								
								}
								else{
								$("#popup_msg").html('NOT UPDATED SUCCESSFULLY');	
								}
							},
							error:function(xhr,status,error){
								
							},
							async:false

		});
	
$("#package").DataTable().ajax.reload();
this.reset();
},2000);
		
    });		
				
		
					
				});
</script>

<script>
$(document).ready(function(){
	
	var emails = $.trim($("#email").val());

	$( "#rupees" ).change(function() {
var price=parsefloat($("rupees").val());

		if(price==null){
			
		}

	});

	
});
</script>


<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css"/>
	 
<script type="text/javascript" src="https://cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js"></script>

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/1.0.3/css/dataTables.responsive.css">

<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/responsive/1.0.3/js/dataTables.responsive.js"></script>


<!-- Bootstrap core CSS -->
	<script src="js/editor.js"></script>
<link href="css/editor.css" type="text/css" rel="stylesheet"/>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="fonts/css/font-awesome.min.css" rel="stylesheet">
    <link href="css/animate.min.css" rel="stylesheet">

    <!-- Custom styling plus plugins -->
    <link href="css/custom.css" rel="stylesheet">
    <link href="css/icheck/flat/green.css" rel="stylesheet">
    <!-- editor -->
    <link href="../../../netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css" rel="stylesheet">
    <link href="css/editor/external/google-code-prettify/prettify.css" rel="stylesheet">
    <link href="css/editor/index.css" rel="stylesheet">
    <!-- select2 -->
    <link href="css/select/select2.min.css" rel="stylesheet">
    <!-- switchery -->
    <link rel="stylesheet" href="css/switchery/switchery.min.css" />

</head>
<body class="nav-md">


<div class="container body">


        <div class="main_container">

            <div class="col-md-3 left_col">
                <div class="left_col scroll-view">

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


                    <!-- menu prile quick info -->
                    <div class="profile">
                       <div class="profile_pic">
                            <img src="img/logo.png" alt="..." class="img-circle profile_img">
                        </div>
                        <div class="profile_info">
                            <span>Welcome</span>
                            <h2>onkarate</h2>
                        </div>
                    </div>
                    <!-- /menu prile quick info -->

                    <br />

                <!-- sidebar menu -->
                                   <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">

                        <div class="menu_section">
                             <h3 style="visibility:hidden;">General</h3>
                            <ul class="nav side-menu">
							<li><a href="superadmin.php"><i class="fa fa-edit"></i> Super Admin  </a></li> 
								<li><a href="news.php"><i class="fa fa-file"></i>Blogs </a></li>

						   <li><a href="logout.php"><i class="fa fa-sign-out"></i> Logout </a></li>   
                        </div>
                    </div>
                    <!-- /sidebar menu -->

                    <!-- /menu footer buttons -->
                    <div class="sidebar-footer hidden-small">
                        <a data-toggle="tooltip" data-placement="top" title="Settings">
                            <span class="glyphicon glyphicon-cog" aria-hidden="true"></span>
                        </a>
                        <a data-toggle="tooltip" data-placement="top" title="FullScreen">
                            <span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>
                        </a>
                        <a data-toggle="tooltip" data-placement="top" title="Lock">
                            <span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>
                        </a>
                        <a data-toggle="tooltip" data-placement="top" title="Logout">
                            <span class="glyphicon glyphicon-off" aria-hidden="true"></span>
                        </a>
                    </div>
                    <!-- /menu footer buttons -->
                </div>
            </div>

   <!-- top navigation -->
            <div class="top_nav">

                <div class="nav_menu">
                    <nav class="" role="navigation">
                        <div class="nav toggle">
                            <a id="menu_toggle"><i class="fa fa-bars"></i></a>
                        </div>

                     
                    </nav>
                </div>

            </div>
            <!-- /top navigation -->
            <!-- page content -->
            <div class="right_col" role="main">
                <div class="">

                    <div class="page-title">
                        <div class="title_left">
                            <h3>Our Blogs</h3>
                        </div>
                     
                    </div>
                    <div class="clearfix"></div>
						
                    <div class="row">
                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>Our Blogs</h2>
                                    <ul class="nav navbar-right panel_toolbox">
                                        <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                        </li>
                                   
                                    </ul>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content">
								
                                    <br />
<div class="btnalign">
		 
		<!-- <button class=" btn btn-primary" id="deleteTriger">Delete</button>-->
		
		
</div>			
<div class="modal fade"  id="myModal1"  data-backdrop="static" data-keyboard="false"  role="dialog" aria-labelledby="#myModal" aria-hidden="true" >
  <div class="modal-dialog modal-sm">

    <!-- Modal content-->
    <div class="modal-content my-modal-style" id="close" style="border-radius:0px!important;margin-top:200px;">
      <div class="modal-header"style="background-color:#2A3F54;color:#fff;">
        
        <h4 class="modal-title"><b>Message</b></h4>
      </div>
      <div class="modal-body text-center"style="margin-top:0px;padding:0px;"> 
		
		<h5 id="popup_msg" style="font-size:12px;font-weight:bold;"></h5>
		
		<div class="modal-footer"style="padding:5px;">
		<button type="button" class="close" data-dismiss="modal"style="border:1px solid gray;background-color:#2A3F54;color:#fff;padding:5px;font-size:10px;opacity:1.0;">OK</button>
		</div>
		
		
		
		
		
		
								</div>
							</div>
						</div>   
  </div>
  
  <div class="modal fade"  id="myModal2"  data-backdrop="static" data-keyboard="false"  role="dialog" aria-labelledby="#myModal" aria-hidden="true" style="z-index:999999;">
  <div class="modal-dialog modal-sm">

    <!-- Modal content-->
    <div class="modal-content my-modal-style" id="close" style="border-radius:0px!important;margin-top:200px;">
      <div class="modal-header"style="background-color:#2A3F54;color:#fff;">
        
        <h4 class="modal-title"><b>Message</b></h4>
      </div>
      <div class="modal-body text-center"style="margin-top:0px;padding:0px;"> 
		
		<h5 id="popup_msg1" style="font-size:12px;font-weight:bold;"></h5>
		
		<div class="modal-footer"style="padding:5px;">
		<button type="button" class="close" data-dismiss="modal"style="border:1px solid gray;background-color:#2A3F54;color:#fff;padding:5px;font-size:10px;opacity:1.0;">OK</button>
		</div>
		
		
		
		
		
		
								</div>
							</div>
						</div>   
  </div>
<form id="frmSignIn" method="POST" action="" enctype="multipart/form-data" >
<div class="row">

	
				<!--<legend>Customer Details Insert</legend>-->
				<br/>
				
				<div class="form-group col-sm-12 col-md-12">
			
				   
							
									 
									 
									<div class="col-md-6 col-sm-12 col-xs-12">
                                        <label>Title:</label>
                                         <input type="text" id="pro_cat" name="pro_cat" class="date-picker form-control" placeholder="Enter Title" required="required" /> 
									 </div>
									 
									
									
								
								<div class="col-md-6 col-sm-12 col-xs-12">
                                        <label>Date:</label>
                                         <input type="text" id="date" name="date" class="date-picker form-control" onkeypress="return isNumber(event)" placeholder="Select Date" required="required" /> 
									 </div>
									 
									<!-- <div class="col-md-6 col-sm-12 col-xs-12">
                                        <label>Image:&nbsp;<span style="color:#000;">(Image Size:&nbsp;<span style="color:red;">500X500</span>&nbsp;)</span></label>
                                         <input type="file" id="photo" name="photo" class="date-picker form-control" required="required" / > 
									 </div>	 
						
									
									<div class="col-md-6 col-sm-12 col-xs-12">
                                        <label>Posted By:</label>
                                         <input type="text" id="poster" name="poster" class="date-picker form-control" placeholder="Enter Title" required="required" /> 
									 </div>--->
								
									 
								<div class="col-md-12 col-sm-12 col-xs-12" >
								   <label>Answers:</label>
                                         <textarea id="txtEditor2" class="clear"></textarea>
										<input type="hidden" name="about" id="about" value="">
								</div>	

									
								
  <br/>		
    <br/>	  <br/>	  <br/>	
										<div class="col-md-12 col-sm-12 col-xs-12 text-center" style="margin-top:20px;">
									   <button type="submit" name="submit" id="submit"  class="btn btn-primary">Save</button>
									 </div>
										
									 </div>
								
								
								
								
	
				</div>	
				
				
				</form>							
	<button name="deleteTriger" id="deleteTriger" class="btn btn-primary mb-xl printHide">Delete</button>																		
<table id="package" class="display" width="100%" cellspacing="0">
        <thead>
            <tr>
              <th>S.No</th>
                <th>Title</th>
				 <th>Date and Time</th>
				 <th>Content</th>
				
            </tr>
			
        </thead>
  </table>
  
 

 
	
                        
					
	
                                      
	

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

                   
                <!-- /page content -->

                <!-- footer content -->
             
                <!-- /footer content -->

            </div>

        </div>
    </div>
	
	
	
        <div id="custom_notifications" class="custom-notifications dsp_none">
            <ul class="list-unstyled notifications clearfix" data-tabbed_notifications="notif-group">
            </ul>
            <div class="clearfix"></div>
            <div id="notif-group" class="tabbed_notifications"></div>
        </div>
	
	</script>	

		
	
			
							
				
			
			</form>
			
          </div>
         <!-- <div class="modal-footer">
            
            <input type="submit" id="btnsubmit" name="insertsubmit" class="btn btn-success btn-block btn-lg" value="Submit">
          </div>-->
        </div>
      </div>
    </div>
    <!-- end:modal-signin -->
	

	

        </div>
      </div>
    </div>
    <!-- end:modal-signup -->
	
	
	
		<!-- hidden inline form -->
	


        <script src="js/bootstrap.min.js"></script>

        <!-- chart js -->
        <script src="js/chartjs/chart.min.js"></script>
        <!-- bootstrap progress js -->
        <script src="js/progressbar/bootstrap-progressbar.min.js"></script>
        <script src="js/nicescroll/jquery.nicescroll.min.js"></script>
        <!-- icheck -->
        <script src="js/icheck/icheck.min.js"></script>
        <!-- tags -->
        <script src="js/tags/jquery.tagsinput.min.js"></script>
        <!-- switchery -->
        <script src="js/switchery/switchery.min.js"></script>
        <!-- daterangepicker -->
        <script type="text/javascript" src="js/moment.min2.js"></script>
        <script type="text/javascript" src="js/datepicker/daterangepicker.js"></script>
        <!-- richtext editor -->
        <!-- richtext editor -->
        <script src="js/editor/bootstrap-wysiwyg.js"></script>
        <script src="js/editor/external/jquery.hotkeys.js"></script>
        <script src="js/editor/external/google-code-prettify/prettify.js"></script>
        <!-- select2 -->
        <script src="js/select/select2.full.js"></script>
        <!-- form validation -->
        <script type="text/javascript" src="js/parsley/parsley.min.js"></script>
        <!-- textarea resize -->
        <script src="js/textarea/autosize.min.js"></script>
        <script>
            autosize($('.resizable_textarea'));
        </script>
       
        <script src="js/custom.js"></script>
		


	






</body>
</html>