File manager - Edit - /home/autoph/public_html/pms_v1/config/activate-deactivateAccount.php
Back
<?php include_once("../../../cfg/conn.php"); //error_reporting(0); if(isset($_POST['asgn'])){ $myUserID = $_POST['myUserID']; echo "<input type='hidden' id='myUserID' value='$myUserID'>"; //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== $roleID = userProfileID($userID); include ("../functions/users.php"); $roleID = userProfileID($myUserID); $moduleID = 22; $add =checkViewAccessM1024($roleID, $moduleID)[1]; $edit =checkViewAccessM1024($roleID, $moduleID)[2]; $delete =checkViewAccessM1024($roleID, $moduleID)[3]; $print =checkViewAccessM1024($roleID, $moduleID)[4]; $download =checkViewAccessM1024($roleID, $moduleID)[5]; echo "<input type='hidden' id='addAccess' value='$add'>"; echo "<input type='hidden' id='editAccess' value='$edit'>"; echo "<input type='hidden' id='deleteAccess' value='$delete'>"; echo "<input type='hidden' id='printAccess' value='$print'>"; echo "<input type='hidden' id='downloadAccess' value='$download'>"; if($add == 1){$addButton = '';}else{$addButton='Disabled';} if($edit == 1){$editButton = '';}else{$editButton='Disabled';} if($delete == 1){$deletButton = '';}else{$deletButton='Disabled';} if($print == 1){$printButton = '';}else{$printButton='Disabled';} if($download == 1){$downloadButton = '';}else{$downloadButton='Disabled';} if(checkViewAccessM1024($roleID, $moduleID)[0] == 0){ echo " <center><img src='./images/locked_out_icon.png' width='100' style='margin-top:100px'><img></center> "; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p>"; exit(); } //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== ?> <div class="shadow-sm mb-3 pageHeaderContainer content-justify-right pt-2 pb-3" style="padding:0px;height:50px" > <div class="pageSearchHeader bg-white p-3 pt-1 col-lg-12 col-md-6 col-sm-12" > <h4 class="ml-1 mt-1"><i class="fa fa-arrows-alt text-danger"> Active / DeActivate Account: </i></h4> </div> <div class="pageSearchHeader bg-white p-1 col-lg-12 col-md-12 col-sm-12 float-right"> <button type="button" class="btn btn-info float-right" id="goSearchRecord" style="float:rigth;width:20%;margin-left:3px">Search</button> <input class="form-control border p-3 float-right" type="search" onKeyUp="SearchEmployees()" placeholder="Search by Lastname / Firstname / Employee ID" id="searchText" style="margin:0px;min-width:250px;width:75%;float:left"> </div> </div> <!--########################################################################################--> <!--########################################################################################--> <div id="employeeData" class="col-xl-12 overflow-auto" style='height:600px'> <!--########################################################################################--> <!--########################################################################################--> <table class='table w-100'> <thead> <th>ID</th> <th>EMP. ID</th> <th>EMPLOYEE NAME</th> <th>COMPANY</th> <th>POSITION</th> <th>STATUS</th> <th></th> </thead> <?php $getEmp = "SELECT * FROM `pms_employee_data` WHERE deleted=0 ORDER BY last_name ASC LIMIT 50"; $qEmp = mysqli_query($conn,$getEmp); $statRow = mysqli_num_rows($qEmp); if($statRow > 0){ while($row = mysqli_fetch_array($qEmp)){ $myCompID = $row['comp_id']; $myDealID = $row['branch_id']; $myPosID = $row['position']; $role = $row['access_role']; $accSta = $row['account_status']; if($accSta==0){ $textColor = '#A09E9E'; }else{ $textColor = '#494A4B'; } ?><tr onclick="javascript:getInfo(this);"><?php echo "<td style='width:5%;color:$textColor'>".$row['id']."</td>"; echo "<td style='width:8%;color:$textColor'>".$row['emp_id']."</td>"; echo "<td style='width:23%;color:$textColor'>".$row['last_name'].", ".$row['first_name']."</td>"; echo "<td style='width:8%;color:$textColor'>"; $getCompany = "SELECT `comp_code` FROM `vts_company` WHERE `comp_id`='$myCompID'"; $getC = mysqli_query($conn,$getCompany); while($rowX = mysqli_fetch_array($getC)){ echo $rowX['comp_code']; } echo "</td>"; echo "<td style='width:16%;color:$textColor'>"; $getPos = "SELECT `position_name` FROM `pms_positions_tbl` WHERE `id`='$myPosID'"; $getP = mysqli_query($conn,$getPos); while($rowP = mysqli_fetch_array($getP)){ echo $rowP['position_name']; } echo "</td>"; echo "<td style='width:16%;color:$textColor'>"; if($accSta == 0){ echo "Inactive"; }else{ echo "Active"; } echo "</td>"; echo "<td style='width:3%;color:$textColor'>";?> <!--<abbr title='View KRA'><i class='fa fa-plus-circle' aria-hidden='true' style='cursor:pointer;color:green;float:right;font-size:18px'></i> </abbr>--> <i data-toggle="modal" data-target="#myModal" class="fa fa-list-ol" style='cursor:pointer;float:right;font-size:14px;color:$textColor'></i> <?php echo "</td>"; echo "<tr>"; } } ?> </table> <!--########################################################################################--> <!--########################################################################################--> </div> <!-- The Modal --> <div class="modal fade " id="myModal"> <div class="modal-dialog modal-md"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="FormTitle">ACCESS ROLE ASSIGNMENT</h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body p-4"> <div class="form-group"> <label for="employeeID">EMPLOYEE REC.#:</label> <input disabled type="text" class="form-control w-75" id="employeeID" name="employeeID"> </div> <div class="form-group"> <label for="employeeComp">COMPANY:</label> <input disabled type="text" class="form-control radius-sm" id="employeeComp" name="employeeComp"> </div> <div class="form-group"> <label for="employeeName">EMPLOYEE NAME:</label> <input disabled type="text" class="form-control radius-sm" id="employeeName" name="employeeName"> </div> <div class="form-group"> <label for="employeePosition">POSITION:</label> <input disabled type="text" class="form-control radius-sm" id="employeePosition" name="employeePosition"> </div> </div> <!-- Modal footer --> <div class="form-group p-3"><center> <button <?php echo $editButton;?> data-dismiss="modal" type="button" class="btn btn-success float-left w-100 p-3 border" id="ActivateAcc"> <span class="btn-label"><i class="fa fa-play float-left "></i>ACTIVATE ACCOUNT</button> <button <?php echo $editButton;?> data-dismiss="modal" type="button" class="btn btn-danger float-left w-100 p-3 border" id="DeActivateAcc"> <span class="btn-label"><i class="fa fa-stop float-left "></i>DE-ACTIVATE ACCOUNT</button></center> </div> </div> </div> </div> <!--END OF MODAL FORM FOR ADD NEW AREA--> <?php } $conn->close(); ?> <script language="javascript" type="text/javascript"> $("#goSearchRecord").click(function(){ var myUserID = $("#myUserID").val(); var searchText = $("#searchText").val(); ShowUploadBar(); $.ajax({ url: "./config/loadEmployeeData.php", type: "POST", async: true, data: { "myUserID":myUserID, "searchText":searchText, "find": 1 }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); } }) }); $("#saveNewPropile").click(function(){ var myUserID = $("#myUserID").val(); var newRoleID = $("#newRoleID").val(); var employeeID = $("#employeeID").val(); ShowUploadBar(); $.ajax({ url: "./config/saveNewRole.php", type: "POST", async: true, data: { "myUserID":myUserID, "newRoleID":newRoleID, "employeeID":employeeID, "find": 2 //save profile }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); } }) }); function SearchEmployees(){ var myUserID = $("#myUserID").val(); var searchText = $("#searchText").val(); ShowUploadBar(); $.ajax({ url: "./config/loadEmployeeData.php", type: "POST", async: true, data: { "myUserID":myUserID, "searchText":searchText, "find": 1 }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); } }) } function getInfo(row) { var x=row.cells; var actv = x[5].innerHTML; document.getElementById("employeeComp").value = x[3].innerHTML; document.getElementById("employeePosition").value = x[4].innerHTML; document.getElementById("employeeName").value = x[2].innerHTML; document.getElementById("employeeID").value = x[0].innerHTML; if(actv ==="Inactive" || actv ==="Default") { document.getElementById('ActivateAcc').style.display = 'block'; document.getElementById('DeActivateAcc').style.display = 'none'; } else { document.getElementById('ActivateAcc').style.display = 'none'; document.getElementById('DeActivateAcc').style.display = 'block'; } } $("#ActivateAcc").click(function(){ var employeeID = $("#employeeID").val(); var myUserID = $("#myUserID").val(); Swal.fire({ title: 'Are you sure you want ACTIVATE this account?', // text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, Activate Account!' }).then((result) => { if (result.isConfirmed) { ShowUploadBar(); $.ajax({ url: "./config/actDeActivateAccount.php", type: "POST", async: true, data: { "myUserID":myUserID, "employeeID":employeeID, "stat": 1 }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); Swal.fire({ icon: 'success', title: 'Account Activated' }) } }) } }) }); $("#DeActivateAcc").click(function(){ var employeeID = $("#employeeID").val(); var myUserID = $("#myUserID").val(); Swal.fire({ title: 'Are you sure you want DE-ACTIVATE this account?', // text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, De-Activate Account!' }).then((result) => { if (result.isConfirmed) { ShowUploadBar(); $.ajax({ url: "./config/actDeActivateAccount.php", type: "POST", async: true, data: { "myUserID":myUserID, "employeeID":employeeID, "stat": 0 }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); Swal.fire({ icon: 'success', title: 'Account De-Activated' }) } }) } }) }); </script>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings