ok
Direktori : /home2/selectio/public_html/lilyexpresslive/software/admin/ |
Current File : /home2/selectio/public_html/lilyexpresslive/software/admin/role-add.php |
<?php require_once('header.php'); ?> <style> .switch { position: relative; display: inline-block; width: 45px; height: 25px; } .switch input { opacity: 0; width: 0; height: 0; } .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; -webkit-transition: .4s; transition: .4s; } .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; -webkit-transition: .4s; transition: .4s; } input:checked + .slider { background-color: #4caf50; padding-right: 50px; } input:focus + .slider { box-shadow: 0 0 1px #4caf50; } input:checked + .slider:before { -webkit-transform: translateX(26px); -ms-transform: translateX(26px); transform: translateX(26px); } /* Rounded sliders */ .slider.round { border-radius: 34px; } .slider.round:before { border-radius: 30%; } h4{ color:blue; } </style> <?php if(isset($_POST['submits'])){ $valid = 1; $rolename=$_POST['role_name']; $branch=$_POST['branch']; $stmt = $pdo->prepare("SELECT * FROM tbl_role WHERE role_name=?"); $stmt->execute([$rolename]); $total = $stmt->rowCount(); if($total > 0){ $valid = 0; $error_message .= "This role name is already exist.<br>"; } if($rolename==""){ $valid = 0; $error_message .= "This role name isCan't Be Empty.<br>"; } if($branch==""){ $valid = 0; $error_message .= "Select Employee Type isCan't Be Empty.<br>"; } if($valid == 1){ $permissions['branch'] = array("create" => isset($_POST['add_branch']) ? 1 : 0,"read" => isset($_POST['view_branch']) ? 1 : 0, "update" => isset($_POST['edit_branch']) ? 1 : 0,"delete" => isset($_POST['delete_branch']) ? 1 : 0); $permissions['role'] = array("create" => isset($_POST['add_role_of_user']) ? 1 : 0,"read" => isset($_POST['view_role']) ? 1 : 0, "update" => isset($_POST['edit_role']) ? 1 : 0,"delete" => isset($_POST['delete_role']) ? 1 : 0); $permissions['client'] = array("create" => isset($_POST['add_client']) ? 1 : 0,"read" => isset($_POST['view_client']) ? 1 : 0, "update" => isset($_POST['edit_client']) ? 1 : 0,"delete" => isset($_POST['delete_client']) ? 1 : 0); $permissions['system_user'] = array("create" => isset($_POST['add_system_user']) ? 1 : 0,"read" => isset($_POST['view_system_user']) ? 1 : 0, "update" => isset($_POST['edit_system_user']) ? 1 : 0,"delete" => isset($_POST['delete_system_user']) ? 1 : 0); $permissions['awb_count_details'] = array("read" => isset($_POST['view_awb_count_details']) ? 1 : 0); $permissions['awb_number_details'] = array("create" => isset($_POST['add_awb_number_details']) ? 1 : 0,"read" => isset($_POST['view_awb_number_details']) ? 1 : 0); $permissions['awb_list'] = array("create" => isset($_POST['add_awb_list']) ? 1 : 0,"read" => isset($_POST['view_awb_list']) ? 1 : 0, "delete" => isset($_POST['delete_awb_list']) ? 1 : 0); $permissions['logistics'] = array("create" => isset($_POST['add_logistics']) ? 1 : 0,"read" => isset($_POST['view_logistics']) ? 1 : 0, "update" => isset($_POST['edit_logistics']) ? 1 : 0,"delete" => isset($_POST['delete_logistics']) ? 1 : 0); $permissions['pin_code'] = array("create" => isset($_POST['add_pin_code']) ? 1 : 0,"read" => isset($_POST['view_pin_code']) ? 1 : 0, "update" => isset($_POST['edit_pin_code']) ? 1 : 0,"delete" => isset($_POST['delete_pin_code']) ? 1 : 0,"bulkupload" => isset($_POST['bulk_upload_pin_code']) ? 1 : 0); $permissions['customer'] = array("create" => isset($_POST['add_customer']) ? 1 : 0,"read" => isset($_POST['view_customer']) ? 1 : 0, "update" => isset($_POST['edit_customer']) ? 1 : 0,"bulkupload" => isset($_POST['bulk_upload_customer']) ? 1 : 0); $permissions['one_time_customer'] = array("create" => isset($_POST['add_onetime_customer']) ? 1 : 0); $permissions['add_pickup_entry'] = array("create" => isset($_POST['add_add_pickup_entery']) ? 1 : 0); $permissions['manifest'] = array("create" => isset($_POST['add_manifest']) ? 1 : 0,"read" => isset($_POST['view_manifest']) ? 1 : 0, "update" => isset($_POST['edit_manifest']) ? 1 : 0,"delete" => isset($_POST['delete_manifest']) ? 1 : 0); $permissions['tracking'] = array("read" => isset($_POST['view_tracking']) ? 1 : 0); $permissions['reports'] = array("read" => isset($_POST['view_reports']) ? 1 : 0); $permissions['transports'] = array("create" => isset($_POST['add_transport']) ? 1 : 0,"read" => isset($_POST['view_transport']) ? 1 : 0, "update" => isset($_POST['edit_transport']) ? 1 : 0,"delete" => isset($_POST['delete_transport']) ? 1 : 0); $permissions['contents'] = array("create" => isset($_POST['add_contents']) ? 1 : 0,"read" => isset($_POST['view_contents']) ? 1 : 0, "update" => isset($_POST['edit_contents']) ? 1 : 0,"delete" => isset($_POST['delete_contents']) ? 1 : 0); $permissions['backups'] = array("read" => isset($_POST['view_backup']) ? 1 : 0); /* $permissions['gold_account_report'] = array("read" => isset($_POST['view_gold_account_report']) ? 1 : 0); $permissions['customer_report'] = array("read" => isset($_POST['view_customer_report']) ? 1 : 0); $permissions['scheme_completed_report'] = array("read" => isset($_POST['view_scheme_completed_report']) ? 1 : 0); $permissions['pending_payment_report'] = array("read" => isset($_POST['view_pending_payment_report']) ? 1 : 0); $permissions['employee_collection_report'] = array("read" => isset($_POST['view_employee_collection_report']) ? 1 : 0); $permissions['overall_collection_report'] = array("read" => isset($_POST['view_overall_collection_report']) ? 1 : 0); $permissions['administrator_backup'] = array("read" => isset($_POST['view_administrator_backup']) ? 1 : 0);*/ $permissions = json_encode($permissions); $branch_ids=""; if(isset($_POST['branch'])){ if(count($_POST['branch'])>1){ $branch_ids = implode(',', $_POST['branch']);}else{ $branch_ids = $_POST['branch'][0];} } $statement = $pdo->prepare("INSERT INTO tbl_role (role_name,roles,status,branch_id) VALUES (?,?,?,?)"); $statement->execute(array($rolename,$permissions,1,$branch_ids)); $success_message = 'New role is added successfully!'; unset($_POST['role_name']); // header("Location:listroles.php"); } } ?> <section class="content-header" style="background-color: white;"> <div class="row"> <div class="col-md-12" style="text-align: center;"> <h4><i class="fa fa-user-plus"></i> Add Roles</h4> </div> </div> </section> <section class="content" style="background-color: white;"> <div class="row"> <!-- left column --> <div class="col-md-12"> <?php if($error_message): ?> <div class="callout callout-danger"> <p> <?php echo $error_message; ?> </p> </div> <?php endif; ?> <?php if($success_message): ?> <div class="callout callout-success"> <p><?php echo $success_message; ?></p> </div> <?php endif; ?> <div> <!-- form start --> <form role="form" method="post" action="" enctype="multipart/form-data"> <div class="box-body"> <div class="form-group col-sm-4"> <label for="exampleInputEmail1" class="required">Role Name</label> <input type="text" class="form-control" id="txtuppercase" name="role_name" placeholder="Enter the Role Name" required="Please enter the Role Name"> </div> <div class="col-md-4"> <label for="exampleInputEmail1" class="required">Branch Name</label> <?php if(isset($_GET['id'])){ $branch=$_GET['id']; } else{ $branch=0; } ?> <select class="form-control select2" name="branch[]" id="branch_id" multiple> <option value="0" <?php if($branch==0){echo "selected";}?>>All Branch</option> <?php $statement = $pdo->prepare("SELECT * FROM tbl_branch WHERE role_type=2 ORDER BY id ASC"); $statement->execute(); $result = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { ?> <option value="<?php echo $row['id']; ?>" <?php if($branch==$row['id']){echo "selected";}?> ><?php echo $row['branch_name']; ?></option> <?php } ?> </select> </div> <table style="width:100%"> <tr> <th>Access Name</th> <th>Select All</th> <th>View</th> <th>Add</th> <th>Edit</th> <th>Delete</th> <th>Bulk Upload</th> <th>Easy Edit</th> </tr> <tr> <td> <i class="fa fa-users"></i><span> BRANCH</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_branch"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_branch" value="0" name="view_branch"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_branch" value="0" name="add_branch"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_branch" value="0" name="edit_branch"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_branch" value="0" name="delete_branch"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span> Role</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_role"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_role" value="0" name="view_role"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_role" value="0" name="add_role_of_user"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_role" value="0" name="edit_role"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_role" value="0" name="delete_role"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span>System User</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_system_user"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_system_user" value="0" name="view_system_user"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_system_user" value="0" name="add_system_user"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_system_user" value="0" name="edit_system_user"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_system_user" value="0" name="delete_system_user"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span> Client</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_client"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_client" value="0" name="view_client"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_client" value="0" name="add_client"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_client" value="0" name="edit_client"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_client" value="0" name="delete_client"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span> AWB Count Details</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_awb_count_details"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_awb_count_details" value="0" name="view_awb_count_details"> <span class="slider round"></span> </label> </td> <td>-</td> <td>-</td> <td>-</td> </tr> <tr> <td> <i class="fa fa-users"></i><span> AWB Number Details</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_awb_number_details"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_awb_number_details" value="0" name="view_awb_number_details"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_awb_number_details" value="0" name="add_awb_number_details"> <span class="slider round"></span> </label> </td> <td>-</td> <td>-</td> </tr> <tr><td> <i class='fa fa-user-tie '></i> <span>AWB List</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_awb_list"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_awb_list" value="0" name="view_awb_list"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_awb_list" value="0" name="add_awb_list"> <span class="slider round"></span> </label> </td> <td> - </td> <td> <label class="switch"> <input type="checkbox" class="child_awb_list" value="0" name="delete_awb_list"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span> Logistics</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_logistics"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_logistics" value="0" name="view_logistics"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_logistics" value="0" name="add_logistics"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_logistics" value="0" name="edit_logistics"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_logistics" value="0" name="delete_logistics"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span> Pin Code</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_pin_code"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_pin_code" value="0" name="view_pin_code"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_pin_code" value="0" name="add_pin_code"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_pin_code" value="0" name="edit_pin_code"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_pin_code" value="0" name="delete_pin_code"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_pin_code" value="0" name="bulk_upload_pin_code"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span>Customer</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_customer"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_customer" value="0" name="view_customer"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_customer" value="0" name="add_customer"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_customer" value="0" name="edit_customer"> <span class="slider round"></span> </label> </td> <td>-</td> <td> <label class="switch"> <input type="checkbox" class="child_customer" value="0" name="bulk_upload_customer"> <span class="slider round"></span> </label> </td> </tr> <tr><td colspan="8" style="text-align:center;color:green;font-weight:bolder;"><h4 style="color:green;font-weight:bolder;">POD DETAILS</h4></td></tr> <tr> <td> <i class="fa fa-users"></i><span>One Time Customer</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_onetime_customer"> <span class="slider round"></span> </label> </td> <td> - </td> <td> <label class="switch"> <input type="checkbox" class="child_onetime_customer" value="0" name="add_onetime_customer"> <span class="slider round"></span> </label> </td> <td>-</td> <td>-</td> <td>-</td> </tr> <tr><td> <i class='fa fa-user-tie '></i> <span>Add Pickup Enter</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_add_pickup_entery"> <span class="slider round"></span> </label> </td> <td>-</td> <td> <label class="switch"> <input type="checkbox" class="child_add_pickup_entery" value="0" name="add_add_pickup_entery"> <span class="slider round"></span> </label> </td> <td> - </td> <td>-</td> </tr> <tr><td> <i class='fa fa-user-tie '></i> <span>Manifest</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_manifest"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_manifest" value="0" name="view_manifest"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_manifest" value="0" name="add_manifest"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_manifest" value="0" name="edit_manifest"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_manifest" value="0" name="delete_manifest"> <span class="slider round"></span> </label> </td> </tr> <tr><td colspan="8" style="text-align:center;color:green;font-weight:bolder;"><h4 style="color:green;font-weight:bolder;">TRACKING</h4></td></tr> <tr><td> <i class='fa fa-user-tie '></i> <span>Tracking</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_tracking"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_tracking" value="0" name="view_tracking"> <span class="slider round"></span> </label> </td> <td>-</td> <td>-</td> <td> -</td> </tr> <tr><td colspan="8" style="text-align:center;color:green;font-weight:bolder;"><h4 style="color:green;font-weight:bolder;">REPORTS</h4></td></tr> <tr><td> <i class='fa fa-user-tie '></i> <span>Reports</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_reports"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_reports" value="0" name="view_reports"> <span class="slider round"></span> </label> </td> <td>-</td> <td>-</td> <td> -</td> </tr> <tr><td colspan="8" style="text-align:center;color:green;font-weight:bolder;"><h4 style="color:green;font-weight:bolder;">SETTINGS</h4></td></tr> <tr> <td> <i class="fa fa-users"></i><span>Transports</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_transport"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_transport" value="0" name="view_transport"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_transport" value="0" name="add_transport"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_transport" value="0" name="edit_transport"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_transport" value="0" name="delete_transport"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span>Contents</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_contents"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_contents" value="0" name="view_contents"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_contents" value="0" name="add_contents"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_contents" value="0" name="edit_contents"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_contents" value="0" name="delete_contents"> <span class="slider round"></span> </label> </td> </tr> <tr> <td> <i class="fa fa-users"></i><span>Backup</span> </td> <td> <label class="switch"> <input type="checkbox" class="master_child" name="child_backup"> <span class="slider round"></span> </label> </td> <td> <label class="switch"> <input type="checkbox" class="child_backup" value="0" name="view_backup"> <span class="slider round"></span> </label> </td> <td>-</td> <td>-</td> <td>-</td> </tr> </table> <style> table,th,td{ padding:4px 5px; text-align:center; } </style> <div class="form-group col-sm-12"> </div> <br><br> <!--role details Start--> <div class="form-group col-sm-12"></div> <div class="form-group col-sm-12"></div> <div class="form-group col-sm-12"></td> </b> </center> <!--role Details End--> </div> <!-- /.box-body --> <div class="box-footer"> <center> <button type="submit" name="submits" class="btn btn-success">Submit</button></center> </div> </form> </div> <!-- /.box --> </div> <!-- /.box-body --> </div> <!-- /.box --> </div> <!--/.col (right) --> </div> </section> <script type="text/javascript"> function JSalert(){ swal("Congrats!", " Your Package is added succesfully!", "success"); } </script> <script> jQuery(document).ready(function() { // 1 Capitalize string - convert textbox user entered text to uppercase jQuery('#txtuppercase').keyup(function() { $(this).val($(this).val().toUpperCase()); }); }); </script> <script> $(document).ready(function() { $('input[type=checkbox]').on('click',function(){ var current_value = $(this).val(); // console.log(current_value); if(current_value==1) { $(this).val(0); } else { $(this).val(1); } } ); } ); </script> <script type="text/javascript"> $(document).ready(function(){ $('.master_child').on('change',function(){ var values=$(this).attr("name"); if(this.checked){ $('.'+values).each(function(){ this.checked = true; }); }else{ $('.'+values).each(function(){ this.checked = false; }); } }); }); </script> <?php require_once('footer.php'); ?>