<?php require_once('../auth/auth.php'); ?>
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
                <div class="card-header" style="padding: 5px 8px;"><h3 class="card-title">New Designation</h3> <div class="card-tools"> <button type="button" class="btn btn-tool" data-card-widget="remove"> <i class="fas fa-times"></i>  </button> </div>
                </div>
                <form id="desig_form" action="#" method="post" autocomplete="off">
                     <input type="hidden" name="newdesig" required="true">
	                <div class="card-body">
	                    <div class="col-md-12">
	                        <div class="row">
	                            <div class="col-md-9">
	                                <div class="form-group">
	                                  <label>Designation Name<b class="text-danger"> *</b></label>
	                                  <input type="text" name="desig_name"  class="form-control form-control-sm inputselect" placeholder="Designation Name" style="text-align:center;" required="true">
	                              </div>
	                            </div>
	                            <div class="col-md-3">
	                             <div class="card" style="margin:16px 0px 0px 0px  ;">
			                       <button type="submit" id="save" class="btn btn-success btn-xs"> Save</button>
			                     </div>
			                    </div>
	                        </div>
	                    </div>
	                </div>
			          
	            </form>
				<div class="card-body p-1">
				    <tr>
				      <th rowspan="3"  class="text-center" >
				        <input type="text" id="search" class="form-control form-control-sm search"  placeholder="searching" required="true" style="border-radius: ;border:1px solid primary;width:100%; text-align:center; padding:; ">
				      </th>
				    </tr>
				    <table id="trbl_table" class="ttable searchtable" cellpadding="0" cellspacing="0">
				        <thead>
				            <tr class="sticky-top">
				               <th class="text-center" style="width:5%;">S/l</th>
				               <th style="width:50%;">Designation Name</th>
				               <th class="text-center" style="width:5%;">#</th>
				            </tr>
				        </thead>
							<tbody id="colview">
							    <?php
							    $desid_query= mysqli_query($conn,"SELECT * FROM em_designation WHERE em_desid AND coid='$coid'  ") or die (mysql_error());
							    $i=0;
							    while ($rowdes= mysqli_fetch_array ($desid_query) ){
							        ?>
							        <tr onclick="vprofile('<?php echo $rowdes['em_desid']?>')">
							            <td  style="font-size: 11.5px;text-align: center;"><?php echo ++$i ?></td>
							            <td  style="font-size: 11.5px"><?php echo $rowdes['desig_name'] ?>  </td>
							            <td  style="font-size: 11.5px"> <i class="fa fa-trash"></i> </td>
							        </tr>
							    <?php } ?>
							</tbody>
                    </table>
                </div>
           </div>
        </div>
		<div class="col-md-9">
		   <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
		     <div class="card-header" style="padding: 5px 8px;"><h3 class="card-title">New Company  Add</h3> <div class="card-tools"> <button type="button" class="btn btn-tool" data-card-widget="remove"> <i class="fas fa-times"></i>  </button> </div>
		 </div>
		 <center>please wait for new feature</center>
		</div>
		</div>
	</div>
</div>
</section>
<script>
 $(document).ready(function(){
    $('.search').on('keyup',function(){
      var searchTerm = $(this).val().toLowerCase();
      $('.searchtable tr').each(function(){
        var lineStr = $(this).text().toLowerCase();
        if(lineStr.indexOf(searchTerm) === -1){
          $(this).hide();
      }else{
          $(this).show();
      }
  });
  });

    $('th').each(function (col) {
      $(this).hover(
        function () {
          $(this).addClass('focus');
      },
      function () {
          $(this).removeClass('focus');
      }
      );
      $(this).click(function () {
        if ($(this).is('.asc')) {
          $(this).removeClass('asc');
          $(this).addClass('desc selected');
          sortOrder = -1;
      } else {
          $(this).addClass('asc selected');
          $(this).removeClass('desc');
          sortOrder = 1;
      }
      $(this).siblings().removeClass('asc selected');
      $(this).siblings().removeClass('desc selected');
      var arrData = $('table').find('tbody >tr:has(td)').get();
      arrData.sort(function (a, b) {
          var val1 = $(a).children('td').eq(col).text().toUpperCase();
          var val2 = $(b).children('td').eq(col).text().toUpperCase();
          if ($.isNumeric(val1) && $.isNumeric(val2))
            return sortOrder == 1 ? val1 - val2 : val2 - val1;
        else
            return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0;
    });
      $.each(arrData, function (index, row) {
          $('tbody').append(row);
      });
  });
  });
});
</script>




<script>
 $(document).ready(function() {
    $("#symble").select2();
   $('#desig_form').on('submit', function(e){
     $('#save').prop('disabled', true);
     $('#save').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+'Loading...');
     e.preventDefault();  
     $.post("../hr_manage/designation_db.php",$(this).serialize(),function(data){
      $('#desig_form')[0].reset();
      $('#save').prop('disabled', false);
      $('#save').html('Company Save');
      $.post('../hr_manage/designation_index.php?running='+1,{},function(res){
       $('#hrhome').html(res);
       toastr.success(Showing, '<?php echo "Data Load Succefully " ?>');
     }); 
    });
   });




});  
</script>


