File "employeeList.php"

Full Path: /home/krishnamexports/public_html/panel/pages/signup/employeeList.php
File size: 3.1 KB
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8

<?php

if(isset($_GET['delete_id']))

{

	$id      = $_GET['delete_id'];

	$sql     = mysqli_query($cn, "update `tbl_employee` SET `status`=0 where id='$id'");

	echo '<div class="alert alert-danger"><strong>Danger!</strong> Employee Deleted Successfully.</div>';

}



if(isset($_GET['updatestatus']))

{

	$id      = $_GET['updatestatus'];

	$status  = $_GET['status'];

	$sql     = mysqli_query($cn, "update `tbl_employee` SET `status`='".$status."' where id='$id'");

	echo '<div class="alert alert-sucess"><strong>Danger!</strong> Employee Status Updated Successfully.</div>';

}																	

?> 

<div class="col-lg-12 grid-margin stretch-card">	

	<div class="card">      			    	

        <div class="card-body">

          <h4 class="card-title">Employee List</h4>			

          <div class="table-responsive">

            <table class="table table-striped" id="example">

              <thead>

                <tr>

                  <th width="5%">S.No.</th>

                  <th width="10%">Name</th>

                  <th width="15%">Mobile/Username</th>

                  <th width="10%">Password</th>

                  <th width="30%">Address</th>

                  <th width="20%">Action</th>

                </tr>

              </thead>

              <tbody>              

                <?php

                $i = 1;						  

                $sqlEmployee = mysqli_query($cn,"SELECT * FROM `tbl_employee` where `status` IN(1,2) and `id`!=1 and `designation_id` NOT IN(2,3,4) order by name");

                while($sqlEmployeeData = mysqli_fetch_array($sqlEmployee))

				{?>

                    <tr>

                      <td><?php echo $i++;?></td>

                      <td><?php echo $sqlEmployeeData['name'];?></td>

                      <td><?php echo $sqlEmployeeData['mobile'];?></td>

                      <td><?php echo decryptIt($sqlEmployeeData['password']);?></td>

                      <td><?php echo substr($sqlEmployeeData['address'],0,40)."...";?></td> 

                      <td>

                      	<?php

						if($sqlEmployeeData['status']==2){?>

                        	<a href="home.php?pages=employeeList&updatestatus=<?php echo $sqlEmployeeData['id'];?>&status=1" class="btn btn-outline-danger btn-sm">Inactive</a>                             

                        <?php }else if($sqlEmployeeData['status']==1){?>

                        	<a href="home.php?pages=employeeList&updatestatus=<?php echo $sqlEmployeeData['id'];?>&status=2" class="btn btn-outline-success btn-sm">Active</a>

                        <?php }?>

                        <a href="home.php?pages=employeeRegistration&edit_id=<?php echo $sqlEmployeeData['id'];?>" class="btn btn-outline-success btn-sm">Edit</a> 

                        <a href="home.php?pages=employeeList&delete_id=<?php echo $sqlEmployeeData['id'];?>" class="btn btn-outline-danger btn-sm" onclick="return deleteConfirm();">Delete</a></td>

                    </tr>

                <?php }?> 

              </tbody>

            </table>

          </div>

        </div>

	</div>

</div>