ok
Direktori : /proc/thread-self/root/home2/selectio/www/lilyexpresslive/expense-invoice/ |
Current File : //proc/thread-self/root/home2/selectio/www/lilyexpresslive/expense-invoice/role-edit.php |
<?php include "header.php";$permissions=array(); if(isset($_POST['update_role'])){ try{ $permissions['user'] = array("create" => isset($_POST['add_user']) ? 1 : 0,"read" => isset($_POST['view_user']) ? 1 : 0, "update" => isset($_POST['edit_user']) ? 1 : 0,"delete" => isset($_POST['delete_user']) ? 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['expense'] = array("create" => isset($_POST['add_expense']) ? 1 : 0,"read" => isset($_POST['view_expense']) ? 1 : 0, "update" => isset($_POST['edit_expense']) ? 1 : 0,"delete" => isset($_POST['delete_expense']) ? 1 : 0); $permissions['cash'] = array("create" => isset($_POST['add_cash']) ? 1 : 0,"read" => isset($_POST['view_cash']) ? 1 : 0, "update" => isset($_POST['edit_cash']) ? 1 : 0,"delete" => isset($_POST['delete_cash']) ? 1 : 0); $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['location'] = array("create" => isset($_POST['add_location']) ? 1 : 0,"read" => isset($_POST['view_location']) ? 1 : 0, "update" => isset($_POST['edit_location']) ? 1 : 0,"delete" => isset($_POST['delete_location']) ? 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['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['invoice'] = array("create" => isset($_POST['add_invoice']) ? 1 : 0,"read" => isset($_POST['view_invoice']) ? 1 : 0, "update" => isset($_POST['edit_invoice']) ? 1 : 0,"delete" => isset($_POST['delete_invoice']) ? 1 : 0); $permissions['invoice_payment'] = array("create" => isset($_POST['add_invoice_payment']) ? 1 : 0,"read" => isset($_POST['view_invoice_payment']) ? 1 : 0, "update" => isset($_POST['edit_invoice_payment']) ? 1 : 0,"delete" => isset($_POST['delete_invoice_payment']) ? 1 : 0); $permissions['vendor_client'] = array("create" => isset($_POST['vendor_add_client']) ? 1 : 0,"read" => isset($_POST['vendor_view_client']) ? 1 : 0, "update" => isset($_POST['vendor_edit_client']) ? 1 : 0,"delete" => isset($_POST['vendor_delete_client']) ? 1 : 0); $permissions['vendor_invoice'] = array("create" => isset($_POST['vendor_add_invoice']) ? 1 : 0,"read" => isset($_POST['vendor_view_invoice']) ? 1 : 0, "update" => isset($_POST['vendor_edit_invoice']) ? 1 : 0,"delete" => isset($_POST['vendor_delete_invoice']) ? 1 : 0); $permissions['vendor_invoice_payment'] = array("create" => isset($_POST['vendor_add_invoice_payment']) ? 1 : 0,"read" => isset($_POST['vendor_view_invoice_payment']) ? 1 : 0, "update" => isset($_POST['vendor_edit_invoice_payment']) ? 1 : 0,"delete" => isset($_POST['vendor_delete_invoice_payment']) ? 1 : 0); $permissions = json_encode($permissions); //$date = date('Y-m-d h:i:s a', time()); $statement = $pdo->prepare("UPDATE tbl_role SET role_name=?, permission=?, status=? WHERE id=?"); $result=$statement->execute(array($_POST['role_name'],$permissions,$_POST['status'],$_REQUEST['id'])); if($result){ $message = 'Role Updated successfully!'; unset($_POST); }else{ $warning="Something went wrong try again..."; } }catch(Exception $e){ $error=$e; } } ?> <div class="content-wrapper"> <section class="content-header"> <h1>Add Role</h1> <ol class="breadcrumb"> <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active">Add Role</li> </ol> </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) { ?> <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']; } else { return 0; } ?> <section class="content"> <div class="row"> <div class="col-xs-12"> <div class="box box-primary"> <div class="box-header"> <h3 class="box-title">Please fill in the information below</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 blue;margin-top:5px;"> <center> <h4><b>User & Role Management System</b></h4></center> <div class="col-md-4"> <h4><b>Users</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View User</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_user" <?php if($resPerm['user']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add User</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_user" <?php if($resPerm['user']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit User</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_user" <?php if($resPerm['user']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete User</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_user" <?php if($resPerm['user']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-4"> <h4><b>Roles</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Role</label> <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"> <label for="" class="col-sm-6 control-label">Add Role</label> <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"> <label for="" class="col-sm-6 control-label">Edit Role</label> <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"> <label for="" class="col-sm-6 control-label">Delete Role</label> <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="col-md-12"> <div class="form-group"> <label class="required" for="name">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-12" hidden> <div class="form-group"> <label class="required" for="name">Role Status</label> <select name="status" id="" class="form-control tip"> <option value="1" <?php if($roleStatus==1){echo "selected";}?>>Active</option> <option value="2" <?php if($roleStatus==2){echo "selected";}?>>In-Active</option> </select> </div> </div> </div> </div> <div class="col-md-12" style="border: 2px solid blue;margin-top:5px;"> <center> <h4><b>Expense Management System</b></h4></center> <div class="col-md-4"> <h4><b>Expense</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Expense</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_expense" <?php if($resPerm['expense']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Expense</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_expense" <?php if($resPerm['expense']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Expense</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_expense" <?php if($resPerm['expense']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Expense</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_expense" <?php if($resPerm['expense']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-4"> <h4><b>Manage Cash</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Cash</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_cash" <?php if($resPerm['cash']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Cash</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_cash" <?php if($resPerm['cash']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Cash</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_cash" <?php if($resPerm['cash']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Cash</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_cash" <?php if($resPerm['cash']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-4"> <h4><b>Employee</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Employee</label> <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"> <label for="" class="col-sm-6 control-label">Add Employee</label> <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"> <label for="" class="col-sm-6 control-label">Edit Employee</label> <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"> <label for="" class="col-sm-6 control-label">Delete Employee</label> <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>Location</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Location</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_location" <?php if($resPerm['location']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Location</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_location" <?php if($resPerm['location']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Location</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_location" <?php if($resPerm['location']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Location</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_location" <?php if($resPerm['location']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-4"> <h4><b>Expense Category</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Category</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_category" <?php if($resPerm['category']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Category</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_category" <?php if($resPerm['category']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Category</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_category" <?php if($resPerm['category']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Category</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_category" <?php if($resPerm['category']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> </div> <div class="col-md-12" style="border: 2px solid blue;margin-top:5px;"> <center> <h4><b>Invoice Management System</b></h4></center> <div class="col-md-6"> <h4><b>Clients</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Client</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_client" <?php if($resPerm['client']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Client</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_client" <?php if($resPerm['client']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Client</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_client" <?php if($resPerm['client']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Client</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_client" <?php if($resPerm['client']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-6"> <h4><b>Invoice</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Invoice</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_invoice" <?php if($resPerm['invoice']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Invoice</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_invoice" <?php if($resPerm['invoice']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Invoice</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_invoice" <?php if($resPerm['invoice']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Invoice</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_invoice" <?php if($resPerm['invoice']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-8"> <h4><b>Invoice Payment</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Invoice Payment</label> <label> <input type="checkbox" style="width:35%;" value="0" name="view_invoice_payment" <?php if($resPerm['invoice_payment']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Invoice Payment</label> <label> <input type="checkbox" style="width:35%;" value="0" name="add_invoice_payment" <?php if($resPerm['invoice_payment']['create']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Invoice Payment</label> <label> <input type="checkbox" style="width:35%;" value="0" name="edit_invoice_payment" <?php if($resPerm['invoice_payment']['update']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Invoice Payment</label> <label> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="delete_invoice_payment" <?php if($resPerm['invoice_payment']['delete']=="1"){ echo"checked"; }?>> </label> </div> </div> </div> <div class="col-md-12" style="border: 2px solid blue;margin-top:5px;"> <center> <h4><b>Vendor Invoice Management System</b></h4></center> <div class="col-md-6"> <h4><b>Vendor Clients</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Vendor Client</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_view_client" <?php if($resPerm['vendor_client']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Vendor Client</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_add_client" <?php if($resPerm['vendor_client']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Vendor Client</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_edit_client" <?php if($resPerm['vendor_client']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Vendor Client</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="vendor_delete_client" <?php if($resPerm['vendor_client']['read']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-6"> <h4><b>Invoice</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Vendor Invoice</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_view_invoice" <?php if($resPerm['vendor_invoice']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Vendor Invoice</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_add_invoice" <?php if($resPerm['vendor_invoice']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Vendor Invoice</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_edit_invoice" <?php if($resPerm['vendor_invoice']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Vendor Invoice</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="vendor_delete_invoice" <?php if($resPerm['vendor_invoice']['read']=="1"){ echo"checked"; }?>> </label> </div> </div> <div class="col-md-8"> <h4><b>Invoice Payment</b></h4> <div class="form-group"> <label for="" class="col-sm-6 control-label">View Vendor Invoice Payment</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_view_invoice_payment" <?php if($resPerm['vendor_invoice_payment']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Add Vendor Invoice Payment</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_add_invoice_payment" <?php if($resPerm['vendor_invoice_payment']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Edit Vendor Invoice Payment</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client" value="0" name="vendor_edit_invoice_payment" <?php if($resPerm['vendor_invoice_payment']['read']=="1"){ echo"checked"; }?>> </label> </div> <div class="form-group"> <label for="" class="col-sm-6 control-label">Delete Vendor Invoice Payment</label> <label class="switch"> <input type="checkbox" style="width:35%;" class="child_client " value="0" name="vendor_delete_invoice_payment" <?php if($resPerm['vendor_invoice_payment']['read']=="1"){ echo"checked"; }?>> </label> </div> </div> </div> <div class="form-group" style="text-align:center;"> <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";?>