ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/old/role-edit.php |
<?php include "header.php";$permissions=array(); if(isset($_POST['update_role'])){ try{ $permissions['employee'] = array("create" => isset($_POST['add_employee']) ? 1 : 0,"read" => isset($_POST['view_employee']) ? 1 : 0, "update" => isset($_POST['edit_employee']) ? 1 : 0,"delete" => isset($_POST['delete_employee']) ? 1 : 0); $permissions['role'] = array("create" => isset($_POST['add_role']) ? 1 : 0,"read" => isset($_POST['view_role']) ? 1 : 0, "update" => isset($_POST['edit_role']) ? 1 : 0,"delete" => isset($_POST['delete_role']) ? 1 : 0); $permissions['leave'] = array("create" => isset($_POST['add_leave']) ? 1 : 0,"read" => isset($_POST['view_leave']) ? 1 : 0, "update" => isset($_POST['edit_leave']) ? 1 : 0,"delete" => isset($_POST['delete_leave']) ? 1 : 0); $permissions['permission'] = array("create" => isset($_POST['add_permission']) ? 1 : 0,"read" => isset($_POST['view_permission']) ? 1 : 0, "update" => isset($_POST['edit_permission']) ? 1 : 0,"delete" => isset($_POST['delete_permission']) ? 1 : 0); $permissions['payslip'] = array("create" => isset($_POST['add_payslip']) ? 1 : 0,"read" => isset($_POST['view_payslip']) ? 1 : 0, "read_own" => isset($_POST['view_own_payslip']) ? 1 : 0, "update" => isset($_POST['edit_payslip']) ? 1 : 0,"delete" => isset($_POST['delete_payslip']) ? 1 : 0); $permissions['settings'] = array("createcl" => isset($_POST['view_common_leaves']) ? 1 : 0, "read" => isset($_POST['view_holidays']) ? 1 : 0, "create" => isset($_POST['create_holidays']) ? 1 : 0, "update" => isset($_POST['edit_holidays']) ? 1 : 0, "delete" => isset($_POST['delete_holidays']) ? 1 : 0, "upload" => isset($_POST['upload_holidays']) ? 1 : 0); $permissions['attendance'] = array("create" => isset($_POST['view_own_attendance']) ? 1 : 0,"read" => isset($_POST['list_own_attendance']) ? 1 : 0, "update" => isset($_POST['update_own_attendance']) ? 1 : 0,"upload" => isset($_POST['bulk_upload_attendance']) ? 1 : 0); $permissions['department'] = array("create" => isset($_POST['add_department']) ? 1 : 0,"read" => isset($_POST['view_department']) ? 1 : 0, "update" => isset($_POST['edit_department']) ? 1 : 0,"delete" => isset($_POST['delete_department']) ? 1 : 0); $permissions['designation'] = array("create" => isset($_POST['add_designation']) ? 1 : 0,"read" => isset($_POST['view_designation']) ? 1 : 0, "update" => isset($_POST['edit_designation']) ? 1 : 0,"delete" => isset($_POST['delete_designation']) ? 1 : 0); $permissions['pfstructure'] = array("create" => isset($_POST['add_pfstructure']) ? 1 : 0); // $permissions['category'] = array("create" => isset($_POST['add_category']) ? 1 : 0,"read" => isset($_POST['view_category']) ? 1 : 0, // "update" => isset($_POST['edit_category']) ? 1 : 0,"delete" => isset($_POST['delete_category']) ? 1 : 0); // $permissions['mode_of_source'] = array("create" => isset($_POST['add_mode_of_source']) ? 1 : 0,"read" => isset($_POST['view_mode_of_source']) ? 1 : 0, // "update" => isset($_POST['edit_mode_of_source']) ? 1 : 0,"delete" => isset($_POST['delete_mode_of_source']) ? 1 : 0); // $permissions['branch_report'] = array("read" => isset($_POST['view_branch_report']) ? 1 : 0); // $permissions['follow_up_report'] = array("read" => isset($_POST['view_follow_up_report']) ? 1 : 0); // $permissions['employee_follow_up_report'] = array("read" => isset($_POST['view_employee_follow_up_report']) ? 1 : 0); // $permissions['employee_lead_report'] = array("read" => isset($_POST['view_employee_lead_report']) ? 1 : 0); // $permissions['employee_report'] = array("read" => isset($_POST['view_employee_report']) ? 1 : 0); // $permissions['student_fees_report'] = array("read" => isset($_POST['view_student_fees_report']) ? 1 : 0); $permissions = json_encode($permissions); //$date = date('Y-m-d h:i:s a', time()); $branch_ids=""; if(isset($_POST['branch_ids'])){ $branch_ids = implode(',', $_POST['branch_ids']); } $statement = $pdo->prepare("UPDATE tbl_role SET role_name=?,permission=?,status=?,updated_by=?,branch_ids=?,branch_id=?,usertype_id=? WHERE id=?"); $result=$statement->execute(array($_POST['role_name'],$permissions,1,$_SESSION['hrm']['id'],$branch_ids,1,$_POST['usertype'],$_POST['ids'])); if($result){ $message = 'Role Updated successfully!'.$branch_ids; unset($_POST); }else{ $warning="Something went wrong try again..."; } }catch(Exception $e){ $error=$e; } } ?> <div class="content-wrapper" style="background:white;"> <section class="content-header"> <a href="role.php" class="btn btn-danger btn-sm pull-left"><i class="fa fa-arrow-left"></i> Back to Role List</a> </section> <div class="col-lg-12 alerts"> <div id="custom-alerts" style="display:none;"> <div class="alert alert-dismissable"> <div class="custom-msg"></div> </div> </div> <?php if ($error) { ?> <div class="alert alert-danger alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-ban"></i> Error</h4> <?= $error; ?> </div> <?php $error=0;} if ($warning) { ?> <div class="alert alert-warning alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4><i class="icon fa fa-warning"></i> warning</h4> <?= $warning; ?> </div> <?php $warning=0;} if ($message) { ?> <br> <div class="alert alert-success alert-dismissable"> <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button> <h4> <i class="icon fa fa-check"></i> Success</h4> <?= $message; ?> </div> <?php $message=0; } ?> </div> <div class="clearfix"></div> <?php $statement = $pdo->prepare("SELECT * FROM tbl_role where id=?"); $statement->execute([$_REQUEST['id']]); $result = $statement->fetchAll(PDO::FETCH_ASSOC); if (!empty($result) && isset($result[0]['permission'])) { $resPerm= json_decode($result[0]['permission'], true); $roleName=$result[0]['role_name']; $roleStatus=$result[0]['status']; $branch_ids = explode(',', $result[0]['branch_ids']); $branch_id = $result[0]['branch_id']; $role_id = $result[0]['usertype_id']; } else { return 0; } ?> <section class="content"> <div class="row"> <div class="col-xs-12"> <div > <div class="box-header"> <h3 class="box-title"><b>Update Role Details</b></h3> </div> <div class="box-body"> <div class="col-lg-12"> <form action="" class="validation" enctype="multipart/form-data" method="post" accept-charset="utf-8"> <input type='hidden' name="ids" value="<?=$_REQUEST['id']?>" > <div class="row"> <div class="col-md-12" style="border: 2px solid #efefef;border-style: dashed;margin-top:5px;"> <center> <h4><b>Employee & Role Management System</b></h4></center> <div class="col-md-4"> <h4><b>Employees</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Employee</span> <label> <input type="checkbox" style="width:35%;" value="0" name="view_employee" <?php if($resPerm['employee']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Employee</span> <label> <input type="checkbox" style="width:35%;" value="0" name="add_employee" <?php if($resPerm['employee']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Employee</span> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_employee" <?php if($resPerm['employee']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Employee</span> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_employee" <?php if($resPerm['employee']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-4"> <h4><b>Roles</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Role</span> <label> <input type="checkbox" style="width:35%;" value="0" name="view_role" <?php if($resPerm['role']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Role</span> <label> <input type="checkbox" style="width:35%;" value="0" name="add_role" <?php if($resPerm['role']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Role</span> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_role" <?php if($resPerm['role']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Role</span> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_role" <?php if($resPerm['role']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="required" for="location">Role Name</label> <input type="text" name="role_name" placeholder="Enter Role Name" class="form-control tip" id="name" value="<?php if(isset($roleName)){echo $roleName;} ?>" required="required" /> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="required" for="usertype">User Type</label> <select name="usertype" id="usertype" class="form-control tip select2"> <?php $statement = $pdo->prepare("SELECT * FROM `tbl_user_type`"); $statement->execute(); $location_result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($location_result as $result) { ?> <option value="<?=$result['id']?>" <?php if($result['id']==$role_id){echo "selected";} ?>><?=$result['user_type']?></option>"; <?php }?> </select> </div> </div> </div> <div class="col-md-12" style="border: 2px solid #efefef;border-style: dashed;margin-top:5px;"> <center> <h4><b>Leaves & Permission Management System</b></h4></center> <div class="col-md-4"> <h4><b>LEAVES</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Leaves</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_leave" <?php if($resPerm['leave']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Leaves</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_leave" <?php if($resPerm['leave']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Leaves</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_leave" <?php if($resPerm['leave']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Leaves</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_leave" <?php if($resPerm['leave']['delete']=="1"){ echo"checked"; }?>> </span> </div> </div> <div class="col-md-4"> <h4><b>Permission</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Permission</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_permission" <?php if($resPerm['permission']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Permission</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_permission" <?php if($resPerm['permission']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Permission</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_permission" <?php if($resPerm['permission']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Permission</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_permission" <?php if($resPerm['permission']['delete']=="1"){ echo"checked"; }?>> </span> </div> </div> </div> <div class="col-md-12" style="border: 2px solid #efefef;border-style: dashed;margin-top:5px;"> <center> <h4><b>Payslip,Provident Fund (PF) & Settings Management System</b></h4></center> <div class="col-md-4"> <h4><b>PAYSLIP</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Payslip</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_payslip" <?php if($resPerm['payslip']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Own Payslip</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_own_payslip" <?php if(isset($resPerm['payslip']['read_own']) && $resPerm['payslip']['read_own']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Payslip</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_payslip" <?php if($resPerm['payslip']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Payslip</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_payslip" <?php if($resPerm['payslip']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Payslip</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_payslip" <?php if($resPerm['payslip']['delete']=="1"){ echo"checked"; }?>> </span> </div> </div> <div class="col-md-4"> <h4><b>Provident Fund (PF)</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label"> PF-Structure</span> <span class="switch"> <!--<input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_pfstructure">--> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_pfstructure" <?php if($resPerm['pfstructure']['create']=="1"){ echo"checked"; }?>> </span> </div> </div> <div class="col-md-4"> <h4><b>SETTINGS</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">Common Leaves</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_common_leaves" <?php if($resPerm['settings']['createcl']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Holidays</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_holidays" <?php if($resPerm['settings']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Create Holidays </span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="create_holidays" <?php if($resPerm['settings']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Holidays</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_holidays" <?php if($resPerm['settings']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Holidays</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="delete_holidays" <?php if($resPerm['settings']['delete']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Bulk Upload Holidays</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="upload_holidays" <?php if($resPerm['settings']['upload']=="1"){ echo"checked"; }?>> </span> </div> </div> </div> <div class="col-md-12" style="border: 2px solid #efefef;border-style: dashed;margin-top:5px;"> <center> <h4><b>Attendance, Department, Designation Mangement System</b></h4></center> <div class="col-md-4"> <h4><b>Attendance</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">Own Attendance</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_own_attendance" <?php if($resPerm['attendance']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">List Attendance</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="list_own_attendance" <?php if($resPerm['attendance']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Update Attendance</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="update_own_attendance" <?php if($resPerm['attendance']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Holiday's Bulk Upload</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="bulk_upload_attendance" <?php if($resPerm['attendance']['upload']=="1"){ echo"checked"; }?>> </span> </div> </div> <div class="col-md-4"> <h4><b>Departments</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label">View Department</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_department" <?php if($resPerm['department']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Department</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_department" <?php if($resPerm['department']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Department</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_department" <?php if($resPerm['department']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Department</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="delete_department" <?php if($resPerm['department']['delete']=="1"){ echo"checked"; }?>> </span> </div> </div> <div class="col-md-4"> <h4><b>Designation</b></h4> <div class="form-group"> <span for="" class="col-sm-6 control-label"> View Designation</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_designation" <?php if($resPerm['designation']['read']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label"> Add Designation</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_designation" <?php if($resPerm['designation']['create']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label"> Edit Designation</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_designation" <?php if($resPerm['designation']['update']=="1"){ echo"checked"; }?>> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label"> Delete Designation</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="delete_designation" <?php if($resPerm['designation']['delete']=="1"){ echo"checked"; }?>> </span> </div> </div> </div> <div class="form-group" style="text-align:center;"> <br><input type="submit" name="update_role" value="Update Role" class="btn btn-success" /> </div> </div> </form> </div> <div class="clearfix"></div> </div> </div> </div> </div> </section> <script type="text/javascript"> $(document).ready(function(){ /*$('.master_childs').on('click',function(){ var current_value = $(this).val(); var click_status=0; var click_css="warning"; if(current_value=='Show') { $(this).val('Hide'); click_status="Hide"; click_css="warning"; $(this).attr("class", values+" "); } else { $(this).val('Show'); click_status='Show'; click_css="success"; $(this).attr("class", values+" btn btn-success btn-sm"); } var values=$(this).attr("name"); if(values.charAt(0)=="c"){ $('.'+values).each(function(){ $(this).val(click_status); $(this).attr("class", values+" btn btn-"+click_css+" btn-sm"); }); } } ); $('.master_childs').on('click',function(){ });*/ }); </script> <?php include "footer.php";?>