<?php 
session_start();
ob_start();
include("../../pidbco/pidbjoin.php");
$sujpath="./";
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Projects</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>font-awesome/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>font-awesome/ionicons.min.css">
    <!-- DataTables -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>plugins/datatables/dataTables.bootstrap.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="<?php echo $sujpath; ?>dist/css/skins/_all-skins.min.css">
    
   <script>
    function add_new_company(){
             var ccompany = $('#ccompany').val();
             var cprefix = $('#cprefix').val();
             var ccontact = $('#ccontact').val();
             var cmob = $('#cmob').val();
             var cemail = $('#cemail').val();
             var caddress = $('#caddress').val();
             var ccountry = $('#ccountry').val();
             var cstate = $('#cstate').val();
             var cdistrict = $('#cdistrict').val();
             var cstatus = $('#cstatus').val();
             if(ccompany == ''){
                alert("Enter The Company");   	
             } else if(cmob == ''){
             	alert("Enter Mobile");
             } else if(caddress == ''){
             	alert("Enter Address");
             } else {                    
                  $.ajax({
                    type: "POST",
                    url: "ajaxmarket.php",
                     data: {
                          add_new_company: 1,
                          ccompany     : ccompany,
                          cprefix      : cprefix,
                          ccontact     : ccontact,
                          cmob         : cmob,
                          cemail       : cemail,
                          caddress     : caddress,
                          ccountry     : ccountry,
                          cstate       : cstate,
                          cdistrict    : cdistrict,
                          cstatus     : cstatus
                     },
                     cache: true,
                     success: function(res23)
                     {
                     	   	$('#ccompany').val('');
                     	   	$('#cprefix').val('');
                     	   	$('#ccontact').val('');
                           	$('#cmob').val('');
                           	$('#cemail').val('');
                           	$('#cstate').val('');
                           	$('#cdistrict').val('');
                           	$('#caddress').val('');
                           	$('#ccountry').val('');
                           	
                           	$('#cstatus').val('');   
                           	$("#marketingdiv123").load("company.php #marketingdiv123");   
                            datat2();                    
                      }
                   }); 
    	    }
        }
              
    	
    	
   function edit_news_company()
   {
             var ccompany = $('#ccompany').val();
             var cprefix = $('#cprefix').val();
             var ccontact = $('#ccontact').val();
             var cmob = $('#cmob').val();
             var cemail = $('#cemail').val();
             var caddress = $('#caddress').val();
             var ccountry = $('#ccountry').val();
             var cstate = $('#cstate').val();
             var cdistrict = $('#cdistrict').val();
             var cstatus = $('#cstatus').val();
             var hidvall = $('#hidvall').val();
             
             if(ccompany == ''){
                alert("Enter Company Name");   	
             } else if(cmob == ''){
             	alert("Enter Mobile");
             } else if(caddress == ''){
             	alert("Enter Address");
             } else {                    
                  $.ajax({
                    type: "POST",
                    url: "ajaxmarket.php",
                     data: {
                          edit_new_company: 1,
                          ccompany     : ccompany,
                          cprefix      : cprefix,
                          ccontact     : ccontact,
                          cmob         : cmob,
                          cemail       : cemail,
                          caddress     : caddress,
                          ccountry     : ccountry,
                          cstate       : cstate,
                          cdistrict    : cdistrict,
                          cstatus      : cstatus,
                          hidvall      : hidvall
                     },
                     cache: true,
                     success: function(res23)
                     {
                     	   	$('#ccompany').val('');
                     	   	$('#cprefix').val('');
                     	   	$('#ccontact').val('');
                           	$('#cmob').val('');
                           	$('#cemail').val('');
                           	$('#cstate').val('');
                           	$('#cdistrict').val('');
                           	$('#caddress').val('');
                           	$('#ccountry').val('');
                           	$('#cstatus').val('');   
                           	$("#marketingdiv123").load("company.php #marketingdiv123");   
                            datat2();                    
                      }
                   }); 
    	       }   
        }
        
        
    	
    	    	
    	function delete_company(id)
    	{
    		var result = confirm("Want to delete?");
			if (result) 
			{
     		$.ajax({
			type: "POST",
			url: "ajaxmarket.php",
			data: {
			btn_delete_company: 1,
			id:id
			},
			cache: true,
			success: function(res)
			{
			      $("#marketingdiv123").load("company.php #marketingdiv123");
			      datat();
        	}  
			});
   			}
    	}
    	
    	
    	function edit_company(id)
    	{
    		$.ajax({
			type: "POST",
			url: "ajaxmarket.php",
			data: {
			btn_edit_market: 1,
			id:id
			},
			cache: true,
			success: function(res)
			{
		     	$("#marketingdiv2").load("company.php?idd2="+id+" #marketingdiv2"); 	
			}  
			});
    	}
    	
    	
function state_change(str)
{
var xmlhttp;
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("cdistrict").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ajaxmarket.php?state_idd="+str,true);
xmlhttp.send();
}
    </script>
    
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
     <div class="wrapper">
  <?php include("head.php");
    include("left.php"); ?> 
	 
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper" >
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1> Asset Register
          	<small>- Control panel</small>
          	</h1>
          <ol class="breadcrumb">
            <li><a href="dash_board.php"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Asset Register</li> 
          </ol>
        </section>
  <!-- Main content -->
        <section class="content" >
   



<div class="box-body" id="marketingdiv2">
 <?php
 if (isset($_GET['idd2']))
 {
    $idd2 = strip_tags(base64_decode($_GET['idd2']));
 }
 else
 {
  $idd2='';
 }
	  $sq = mysqli_query($con, "SELECT * FROM `p_company` WHERE `cid`='$idd2' " );
	  $rs = mysqli_fetch_assoc($sq);	  
 ?>	  	
 	
			  	
<div class="box-body" >


<div class="row" >	
<div class="col-md-12" style="" >
	


<div class="col-md-3"  style=" padding-left: 2px; padding-right: 0px; ">			
<div class="form-group">
   <input type="text" name="" id="" class="form-control" placeholder="Item Name">		
</div></div>
			
<div class="col-md-2"  style=" padding-left: 2px; padding-right: 0px; ">			
<div class="form-group">
 <input type="text" name="" id="" class="form-control" placeholder="Qty">
</div></div>

<div class="col-md-3" >					
<div class="form-group">
<input type="text" name="" id="" class="form-control" placeholder="Location">
</div></div>
	
<div class="col-md-3" >					
<div class="form-group">
<textarea name="" id="" class="form-control" placeholder="Descreption" style=" height: 35px;"></textarea>
</div></div>
	
<div class="col-md-1" >					
<div class="form-group">
  <?php if($idd2 != ''){ ?>
<input type="hidden" name="hidvall" id="hidvall" value="<?php echo $rs['cid']; ?>" />
<input type="submit" class="btn btn-primary" name="frasubmit" id="frasubmit" value="Update" onclick="edit_news_company();" style=" float: right;margin-right: 5px; " /> 

<?php } else { ?>
<input type="submit" class="btn btn-primary" name="frasubmit" id="frasubmit" value="Submit" onclick="add_new_company();" style=" float: right; 
margin-right: 5px; " />	
<?php } ?> 
</div>
</div>


</div></div>



</div>
  </div>
  
  
  
  
  
  
<div id="marketingdiv123">


<div class="box" >
   <div class="box-body" >
        <div class="box-body table-responsive no-padding" >
   
  	                 	
                  <table id="example1" class="table table-bordered table-striped" >
                    <thead >
                    <tr >
                    <th>#</th>                    	
                    <th>Item Name</th>
                    <th>Qty</th>
                    <th>Location</th>
                    <th>Date</th>
                    <th></th>
                    </tr>
                    </thead>
                    <tbody>
   
   
   
                    </tbody>
                    </table>
  
         		  </div>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
	
	
</div>
	
		
			
			
			








                           
          
        </section><!-- /.content -->
  </div><!-- /.content-wrapper -->
  </div>
	<!-- <?php include("footer.php"); ?> -->
 <!-- jQuery 2.1.4 -->
    <script src="<?php echo $sujpath; ?>plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="<?php echo $sujpath; ?>bootstrap/js/bootstrap.min.js"></script>
    <!-- DataTables -->
	<script src="<?php echo $sujpath; ?>plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<?php echo $sujpath; ?>plugins/datatables/dataTables.bootstrap.min.js"></script>
    <!-- SlimScroll -->
    <script src="<?php echo $sujpath; ?>plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- FastClick -->
    <script src="<?php echo $sujpath; ?>plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="<?php echo $sujpath; ?>dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="<?php echo $sujpath; ?>dist/js/demo.js"></script>
    <!-- page script -->
    
   <script>
      $(document).ready(function() {
        $("#example1").DataTable();
      });
      
	function datat(){
	  alert("Data Deleted Successfully.");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
    function datat2(){
	  alert("Data Added Successfully");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
    function datat3(){
	  alert("Updated Successfully");
      $(document).ready(function() {
        $("#example1").DataTable();
       
      });
    }
   </script>  
   
  </body>
</html>
