deleteperson.blade.php 1.88 KB
<?php
$empid=Input::get("deleteid");
$person=$wakka->getPerson($empid);
if($person&&$wakka->IsAdmin())
{
  //backup record
  $wakka->Query("insert into records_bk set id='$empid',created=now(),modified=now(),peopledata='".serialize($person['peopledata'])."',modifylog='".serialize($person['modifylog'])."',dirty='".serialize($person['dirty'])."',hrstatus='DELETED',accountstatus='DELETED'");

  $wakka->Query("delete from records where id='$empid' limit 1;");
}
?>


<div class="layout-app"><!-- row-app -->
    <div class="row row-app">

    <div class="col-md-12">
      
        <div class="col-separator col-separator-first col-unscrollable box">
            <div class=innerAll>
          

  <fieldset>
    <input type=hidden name=_token value='<?php echo csrf_token(); ?>'>
		<p><label class='label-small_new' style='width:15%'>Enter Employee ID</label><input class='form_new' type=text name=deleteid id=deleteid></p>
    <p><label></label><input type=button class='btn btn-denim' value="Delete Employee" onclick='hrmsDelEmp();return false;'></p>
  </fieldset>

  <?php 
  if(isset($_POST['deleteid']))
  {
    if(!$person)echo "<h1>No Record Found!!</h1>";
    else if(!($wakka->IsAdmin()))echo "<h1>You Dont Have Delete Rights</h1>";
    else
    {
      echo "<h1>Deleted Record :-</h1>";
      echo "<table id=mytasktab class=fullwidth cellpadding=0 cellspacing=0 border=0><thead><tr><td><b>Name</b></td><td><b>AssignedTo</b></td></tr></thead>";
      foreach($person['peopledata'] as $key=>$val)
      {
	if($val!='')echo "<tr><td>$key</td><td>$val</td></tr>";
      }
      echo "</table>";
    }
  }
  ?>
    
                
<script>
function hrmsDelEmp()
{
    doAjax("hr?action=DeletePerson","deleteid="+$("#deleteid").val(),"content","ajaxDelEmp","varajax","POST");
}
</script>
                
                
            </div>
        </div>
    </div>
    
    </div>
</div><!-- // END row-app -->