ok
Direktori : /home2/selectio/www/thedentalpark.com/admin/ |
Current File : /home2/selectio/www/thedentalpark.com/admin/role-create.php |
<?php include "header.php";$permissions=array(); if(isset($_POST['add_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); $branch_ids=""; if(isset($_POST['branch_ids'])){ if(count($_POST['branch_ids'])>1){ $branch_ids = implode(',', $_POST['branch_ids']);}else{ $branch_ids = $_POST['branch_ids'][0];} } //$date = date('Y-m-d h:i:s a', time()); $statement = $pdo->prepare("INSERT INTO `tbl_role`(`role_name`, `permission`, `status`, `created_by`, `branch_ids`, `branch_id`, `usertype_id`) VALUES (?,?,?,?,?,?,?)"); $result=$statement->execute(array($_POST['role_name'],$permissions,1,$_SESSION['hrm']['id'],1,1,$_POST['usertype'])); if($result){ $message = 'Role is added successfully!'; 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> <section class="content"> <div class="row"> <div class="col-xs-12"> <div > <div class="box-header"> <h3 class="box-title"><b>Add New Role :</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"> <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> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_employee"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Employee</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_employee"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Employee</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_employee"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Employee</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_employee"> </span> </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> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_role"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Add Role</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="add_role"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Edit Role</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="edit_role"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Delete Role</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_role"> </span> </div> </div> <div class="col-md-4"> <!--<div class="col-md-12">--> <div class="form-group"> <lable class="required" for="name">Role Name</lable> <input type="text" name="role_name" value="" placeholder="Enter Role Name" class="form-control tip" id="name" required="required" /> <!--</div>--> </div> <div class="col-md-8"> <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(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $data) { echo "<option value=".$data['id'].">".$data['user_type']."</option>"; }?> </select> </div> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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="upload_holidays"> </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"> </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"> </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"> </span> </div> <div class="form-group"> <span for="" class="col-sm-6 control-label">Bulk Upload Attendance</span> <span class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="bulk_upload_attendance"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </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"> </span> </div> </div> </div> </div> <div class="form-group" style="text-align:center;"> <br><input type="submit" name="add_role" value="Add Role" class="btn btn-success" /> </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";?>