File "assignPermission.php"
Full Path: /home/krishnamexports/public_html/panel/scss/mixins/assignPermission.php
File size: 14.65 KB
MIME-type: text/x-php; charset=us-ascii
Charset: utf-8
<?php
error_reporting(0);
if(isset($_POST['save']))
{
$sqlSubject = mysqli_query($cn,"UPDATE `tbl_permission` SET `assign_permission`='".$_POST['assign_permission']."',`home_setting`='".$_POST['home_setting']."',`slider`='".$_POST['slider']."',`designation_master`='".$_POST['designation_master']."',`currency_master`='".$_POST['currency_master']."',`state`='".$_POST['state']."',`city`='".$_POST['city']."',`pincode`='".$_POST['pincode']."',`employee_registration`='".$_POST['employee_registration']."',`employee_list`='".$_POST['employee_list']."',`signup_list`='".$_POST['signup_list']."',`category`='".$_POST['category']."',`subcategory`='".$_POST['subcategory']."',`add_product`='".$_POST['add_product']."',`product_list`='".$_POST['product_list']."',`polish`='".$_POST['polish']."',`size`='".$_POST['size']."', `order_list`='".$_POST['order_list']."', `custom_order`='".$_POST['custom_order']."', `page`='".$_POST['page']."',`page_list`='".$_POST['page_list']."',`testimonials`='".$_POST['testimonials']."',`social_links`='".$_POST['social_links']."', `contact_enquiry`='".$_POST['contact_enquiry']."' WHERE `employee_id`='".$_POST['employee_id']."'");
if($sqlSubject){
echo '<div class="alert alert-success"><strong>Success!</strong> Permission Update Successfully.</div>';
}
else
{
echo '<div class="alert alert-danger"><strong>Danger!</strong> Permission Not Update. Try Again.</div>';
}
}
?>
<div class="col-md-12">
<div class="card">
<div class="card-body">
<h4 class="card-title">Assign Access</h4>
<form class="forms-sample" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label for="exampleInputCity1">Select Employee</label>
<input type="hidden" name="id" value="<?php if(isset($_GET['edit_id'])) {echo $sqlData['id'];}?>">
<select class="form-control" name="employee_id" >
<option value="">Select Employee</option>
<?php
$sqlEmployee = mysqli_query($cn, "select * from `tbl_employee` where `status`=1 and `id`!=1 and `designation_id` NOT IN(2,3,4) order by name");
while($sqlEmployeeData = mysqli_fetch_array($sqlEmployee)){?>
<option value="<?php echo $sqlEmployeeData['id'];?>" <?php if(isset($_GET['edit_id'])){ if($sqlData['category']==$sqlEmployeeData['id']){ echo "selected";}}?>><?php echo $sqlEmployeeData['name'];?></option>
<?php }?>
</select>
</div>
</div>
</div>
<button type="submit" class="btn btn-success mr-2" name="search">Search</button>
</form>
</div>
</div>
</div>
<br><br>
<?php
if(isset($_POST['search'])){?>
<div class="col-lg-12 grid-margin stretch-card">
<div class="card">
<div class="card-body">
<?php
$sqlEmployee = mysqli_query($cn, "select * from `tbl_employee` where `id`='".$_POST['employee_id']."'");
$sqlEmployeeData = mysqli_fetch_array($sqlEmployee);
$sqlEmployeePer = mysqli_query($cn, "select * from `tbl_permission` where `employee_id`='".$_POST['employee_id']."'");
$sqlEmployeeDataPer = mysqli_fetch_array($sqlEmployeePer);
?>
<h4 class="card-title">Assign Permisssion to <strong><?php echo $sqlEmployeeData['name'];?></strong></h4>
<div class="table-responsive">
<form method="post">
<input type="hidden" name="employee_id" value="<?php echo $_POST['employee_id'];?>"/>
<table class="table table-striped">
<tbody>
<tr>
<th colspan="3">Role Access</th>
<th><!--<div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="slider" class="form-check-input"> Select All</label></div>--></th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="assign_permission" value="1" <?php if($sqlEmployeeDataPer['assign_permission']==1){ echo "checked";}?> class="form-check-input"> Assign Permission</label></div></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<th colspan="4">Master</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="home_setting" value="1" <?php if($sqlEmployeeDataPer['home_setting']==1){ echo "checked";}?> class="form-check-input"> Home Setting</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="slider" value="1" <?php if($sqlEmployeeDataPer['slider']==1){ echo "checked";}?> class="form-check-input"> Slider</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="designation_master" value="1" <?php if($sqlEmployeeDataPer['designation_master']==1){ echo "checked";}?> class="form-check-input"> Designation Master</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="currency_master" value="1" <?php if($sqlEmployeeDataPer['currency_master']==1){ echo "checked";}?> class="form-check-input"> Currency</label></div></td>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="state" value="1" <?php if($sqlEmployeeDataPer['state']==1){ echo "checked";}?> class="form-check-input"> State</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="city" value="1" <?php if($sqlEmployeeDataPer['city']==1){ echo "checked";}?> class="form-check-input"> City</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="pincode" value="1" <?php if($sqlEmployeeDataPer['pincode']==1){ echo "checked";}?> class="form-check-input"> Pincode</label></div></td>
<td width="25%"></td>
</tr>
<tr>
<th colspan="4">Employee Section</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="employee_registration" value="1" <?php if($sqlEmployeeDataPer['employee_registration']==1){ echo "checked";}?> class="form-check-input"> Employee Registration</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="employee_list" value="1" <?php if($sqlEmployeeDataPer['employee_list']==1){ echo "checked";}?> class="form-check-input"> Employee List</label></div></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
<tr>
<th colspan="4">Customer Section</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="signup_list" value="1" <?php if($sqlEmployeeDataPer['signup_list']==1){ echo "checked";}?> class="form-check-input"> Signup User</label></div></td>
<td width="25%"></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
<tr>
<th colspan="4">Product Section</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="category" value="1" <?php if($sqlEmployeeDataPer['category']==1){ echo "checked";}?> class="form-check-input"> Category</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="subcategory" value="1" <?php if($sqlEmployeeDataPer['subcategory']==1){ echo "checked";}?> class="form-check-input"> Subcategory</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="polish" value="1" <?php if($sqlEmployeeDataPer['polish']==1){ echo "checked";}?> class="form-check-input"> Polish</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="size" value="1" <?php if($sqlEmployeeDataPer['size']==1){ echo "checked";}?> class="form-check-input"> Size</label></div></td>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="add_product" value="1" <?php if($sqlEmployeeDataPer['add_product']==1){ echo "checked";}?> class="form-check-input"> Add Product</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="product_list" value="1" <?php if($sqlEmployeeDataPer['product_list']==1){ echo "checked";}?> class="form-check-input"> Product List</label></div></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
<tr>
<th colspan="5">Order Section</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="order_list" value="1" <?php if($sqlEmployeeDataPer['order_list']==1){ echo "checked";}?> class="form-check-input"> Order List</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="custom_order" value="1" <?php if($sqlEmployeeDataPer['custom_order']==1){ echo "checked";}?> class="form-check-input"> Custom Order List</label></div></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
<tr>
<th colspan="5">Page / Other Section</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="page" value="1" <?php if($sqlEmployeeDataPer['page']==1){ echo "checked";}?> class="form-check-input"> Page</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="page_list" value="1" <?php if($sqlEmployeeDataPer['page_list']==1){ echo "checked";}?> class="form-check-input"> Page List</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="testimonials" value="1" <?php if($sqlEmployeeDataPer['testimonials']==1){ echo "checked";}?> class="form-check-input"> Testimonials</label></div></td>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="social_links" value="1" <?php if($sqlEmployeeDataPer['social_links']==1){ echo "checked";}?> class="form-check-input"> Social Links</label></div></td>
</tr>
<tr>
<th colspan="5">Enquiry Section</th>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><label class="form-check-label"><input type="checkbox" name="contact_enquiry" value="1" <?php if($sqlEmployeeDataPer['contact_enquiry']==1){ echo "checked";}?> class="form-check-input"> Contact Enquiry</label></div></td>
<td width="25%"></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
<tr>
<td width="25%"><div class="form-check form-check-flat"><button type="submit" class="btn btn-success mr-2" name="save">Save</button> </div></td>
<td width="25%"></td>
<td width="25%"></td>
<td width="25%"></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
</div>
<?php }?>