ok

Mini Shell

Direktori : /home2/selectio/www/lilyexpresslive/expense-invoice/
Upload File :
Current File : /home2/selectio/www/lilyexpresslive/expense-invoice/role-add.php

<?php  include "header.php";$permissions=array();


if(isset($_POST['add_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("INSERT INTO `tbl_role`(`role_name`, `permission`, `status`) VALUES (?,?,?)");
            $result=$statement->execute(array($_POST['role_name'],$permissions,$_POST['status']));
                    
                    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">
        <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>







<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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_user">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add User</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_user">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit User</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_user">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete User</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_user">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_role">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Role</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_role">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Role</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_role">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Role</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_role">
                                          
                                        </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" value="" placeholder="Enter Role Name" class="form-control tip" id="name"  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">Active</option>
                                        <option value="2">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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_expense">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Expense</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_expense">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Expense</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_expense">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Expense</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_expense">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_cash">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Cash</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_cash">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Cash</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_cash">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Cash</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_cash">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_employee">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Employee</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_employee">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Employee</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_employee">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Employee</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_employee">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_location">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Location</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_location">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Location</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_location">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Location</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_location">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_category">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Category</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_category">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Category</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_category">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Category</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_category">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_client">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Client</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_client">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Client</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_client">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Client</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_client">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_invoice">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Invoice</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_invoice">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Invoice</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_invoice">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Invoice</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_invoice">
                                          
                                        </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 class="switch">
                                          <input type="checkbox" style="width:35%;" class="child_client" value="0" name="view_invoice_payment">
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Invoice Payment</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="add_invoice_payment">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Invoice Payment</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client" value="0" name="edit_invoice_payment">
                                          
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Invoice Payment</label>
                						<label class="switch">
                                          <input type="checkbox"  style="width:35%;" class="child_client " value="0" name="delete_invoice_payment">
                                          
                                        </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">
                                        </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">
                                          
                                        </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">
                                          
                                        </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">
                                          
                                        </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">
                                        </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">
                                          
                                        </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">
                                          
                                        </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">
                                          
                                        </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">
                                        </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">
                                          
                                        </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">
                                          
                                        </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">
                                          
                                        </label>
                                 </div>
                             </div>
                        </div>
                    </div>
                    <div class="form-group" style="text-align:center;">
                            <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";?>

Zerion Mini Shell 1.0