<?php require_once('header.php'); 
 if($allPermissions['userManagement']['update']=="1"){ 
$permissions=array();

?>
<style>
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.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: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #dd4b39;
}

input:focus + .slider {
  box-shadow: 0 0 1px #dd4b39;
}

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: 50%;
}
h4{
    color:blue;
}
</style>

<?php
if(isset($_POST['form1'])) {
	$valid = 1;
	
    
    	if(empty($_POST['role_name'])) {
		$valid = 0;
		$error_message .= 'Role Name can not be empty<br>';
	}
    
    
    $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['pincode'] = array("create" => isset($_POST['add_pincode']) ? 1 : 0,"read" => isset($_POST['view_pincode']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_pincode']) ? 1 : 0,"delete" => isset($_POST['delete_pincode']) ? 1 : 0);
                                    
   $permissions['hsncode'] = array("create" => isset($_POST['add_hsncode']) ? 1 : 0,"read" => isset($_POST['view_hsncode']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_hsncode']) ? 1 : 0,"delete" => isset($_POST['delete_hsncode']) ? 1 : 0);                                 
                                    
     $permissions['3plAwbList'] = array("create" => isset($_POST['add_3plAwbList']) ? 1 : 0,"read" => isset($_POST['view_3plAwbList']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_3plAwbList']) ? 1 : 0,"delete" => isset($_POST['delete_3plAwbList']) ? 1 : 0);  
                                    
     $permissions['transport'] = 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['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['pod'] = array("create" => isset($_POST['add_pod']) ? 1 : 0,"read" => isset($_POST['view_pod']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_pod']) ? 1 : 0,"delete" => isset($_POST['delete_pod']) ? 1 : 0);
                                    
    $permissions['pickupentry'] = array("create" => isset($_POST['add_pickupentry']) ? 1 : 0,"read" => isset($_POST['view_pickupentry']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_pickupentry']) ? 1 : 0,"delete" => isset($_POST['delete_pickupentry']) ? 1 : 0,"bulk_update" => isset($_POST['3pl_pickupentry_bulkupdation']) ? 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("readShipment" => isset($_POST['view_shipmentTracking']) ? 1 : 0,"readPod" => isset($_POST['view_podTracking']) ? 1 : 0);   
     
     $permissions['statusChange'] = array("create" => isset($_POST['add_statusChange']) ? 1 : 0,"read" => isset($_POST['view_statusChange']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_statusChange']) ? 1 : 0,"delete" => isset($_POST['delete_statusChange']) ? 1 : 0);      
                                    
       $permissions['userManagement'] = array("create" => isset($_POST['add_userManagement']) ? 1 : 0,"read" => isset($_POST['view_userManagement']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_userManagement']) ? 1 : 0,"delete" => isset($_POST['delete_userManagement']) ? 1 : 0);
                                    
        $permissions['reports'] = array("read_total" => isset($_POST['view_totalReports']) ? 1 : 0,"read_client" => isset($_POST['view_clientReports']) ? 1 : 0,
        "read_delivered" => isset($_POST['view_deliveredReports']) ? 1 : 0,"read_day" => isset($_POST['view_dayReports']) ? 1 : 0);      
        
       $permissions['backup'] = array("read" => isset($_POST['view_administratorBackup']) ? 1 : 0);
       
       
       
       $permissions['barcode'] = array("create" => isset($_POST['add_barcode']) ? 1 : 0,"read" => isset($_POST['view_barcode']) ? 1 : 0);
        $permissions['vehicle_tracking'] = array("create" => isset($_POST['add_vehicle_tracking']) ? 1 : 0,"read" => isset($_POST['view_vehicle_tracking']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_vehicle_tracking']) ? 1 : 0,"delete" => isset($_POST['delete_vehicle_tracking']) ? 1 : 0);
        $permissions['vendor'] = array("create" => isset($_POST['add_vendor']) ? 1 : 0,"read" => isset($_POST['view_vendor']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_vendor']) ? 1 : 0,"delete" => isset($_POST['delete_vendor']) ? 1 : 0);
        $permissions['vehicle_model'] = array("create" => isset($_POST['add_vehicle_model']) ? 1 : 0,"read" => isset($_POST['view_vehicle_model']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_vehicle_model']) ? 1 : 0,"delete" => isset($_POST['delete_vehicle_model']) ? 1 : 0);
        $permissions['delivery_category'] = array("create" => isset($_POST['add_delivery_category']) ? 1 : 0,"read" => isset($_POST['view_delivery_category']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_delivery_category']) ? 1 : 0,"delete" => isset($_POST['delete_delivery_category']) ? 1 : 0);
        $permissions['delivery_route'] = array("create" => isset($_POST['add_delivery_route']) ? 1 : 0,"read" => isset($_POST['view_delivery_route']) ? 1 : 0, 
                                    "update" => isset($_POST['edit_delivery_route']) ? 1 : 0,"delete" => isset($_POST['delete_delivery_route']) ? 1 : 0);
                                    
                                    $permissions = json_encode($permissions);
                                    

    if($valid==1)
    {
    
		$statement = $pdo->prepare("UPDATE tbl_role set role_name=?,permission=? WHERE id=?");
		$statement->execute(array($_POST['role_name'],$permissions,$_REQUEST['id']));
			
		$success_message = 'Role is updated successfully!';

		unset($_POST['role_name']);
		
    }
	
}
?>

<section class="content-header">
	<div class="content-header-left">
		<h1>Add Role</h1>
	</div>
	<div class="content-header-right">
		<a href="userRoles.php" class="btn btn-primary btn-sm">View All</a>
	</div>
</section>

<?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'];
                            } else {
                                return 0;
                            }
	?>
<section class="content">

	<div class="row">
		<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; ?>
			
			<form class="form-horizontal" action="" method="post" enctype="multipart/form-data">
				<div class="box box-info">
					<div class="box-body">
						<div class="form-group">
							<label for="" class="col-sm-2 control-label">Role Name<span>*</span></label>
							<div class="col-sm-6">
								<input type="text" autocomplete="off" class="form-control" name="role_name" value="<?php if(isset($roleName)){echo $roleName;} ?>">
							</div>
						</div>
						<hr>
						<center><h3 style="color:#dd4b39;">Select Permissions</h3></center>
						<hr>
						<div class="row">
						     <div class="col-md-4">
						        <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" value="0" name="view_client" <?php if($resPerm['client']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Client</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_client" <?php if($resPerm['client']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Client</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_client" <?php if($resPerm['client']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Client</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_client" <?php if($resPerm['client']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>Pincode</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Pincode</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_pincode" <?php if($resPerm['pincode']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Pincode</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_pincode" <?php if($resPerm['pincode']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Pincode</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_pincode" <?php if($resPerm['pincode']['update']=="1"){ echo"checked"; }?>> 
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Pincode</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_pincode" <?php if($resPerm['pincode']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>HSN Code</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View HSN Code</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_hsncode" <?php if($resPerm['hsncode']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add HSN Code</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_hsncode" <?php if($resPerm['hsncode']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit HSN Code</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_hsncode" <?php if($resPerm['hsncode']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete HSN Code</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_hsncode" <?php if($resPerm['hsncode']['delete']=="1"){ echo"checked"; }?>> 
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                        </div>
                        <hr>
                        <div class="row">
						     <div class="col-md-4">
						        <h4><b>3PL AWB List</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View 3PL AWB List</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_3plAwbList" <?php if($resPerm['3plAwbList']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add 3PL AWB List</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_3plAwbList" <?php if($resPerm['3plAwbList']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit 3PL AWB List</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_3plAwbList" <?php if($resPerm['3plAwbList']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete 3PL AWB List</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_3plAwbList" <?php if($resPerm['3plAwbList']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>Mode Of Transport</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Transport</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_transport" <?php if($resPerm['transport']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Transport</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_transport" <?php if($resPerm['transport']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Transport</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_transport" <?php if($resPerm['transport']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Transport</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_transport" <?php if($resPerm['transport']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>Logistics</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Logistics</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_logistics" <?php if($resPerm['logistics']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Logistics</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_logistics" <?php if($resPerm['logistics']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Logistics</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_logistics" <?php if($resPerm['logistics']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Logistics</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_logistics" <?php if($resPerm['logistics']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                        </div>
                        <hr>
                        <div class="row">
						     <div class="col-md-4">
						        <h4><b>POD</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View POD</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_pod" <?php if($resPerm['pod']['read']=="1"){ echo"checked"; }?>> 
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add POD</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_pod" <?php if($resPerm['pod']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit POD</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_pod" <?php if($resPerm['pod']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete POD</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_pod" <?php if($resPerm['pod']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>PickUp Entry</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View PickUp Entry</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_pickupentry" <?php if($resPerm['pickupentry']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add PickUp Entry</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_pickupentry" <?php if($resPerm['pickupentry']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit PickUp Entry</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_pickupentry" <?php if($resPerm['pickupentry']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete PickUp Entry</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_pickupentry" <?php if($resPerm['pickupentry']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                  <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Pickup Entry 3PL AWB Bulk Updation</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="3pl_pickupentry_bulkupdation" <?php if($resPerm['pickupentry']['bulk_update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>Manifest</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Manifest</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_manifest" <?php if($resPerm['manifest']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Manifest</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_manifest" <?php if($resPerm['manifest']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Manifest</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_manifest" <?php if($resPerm['manifest']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Manifest</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_manifest" <?php if($resPerm['manifest']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                        </div>
                        <hr>
                     <div class="row">
						     <div class="col-md-4">
						        <h4><b>Tracking</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Shipment</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_shipmentTracking" <?php if($resPerm['tracking']['readShipment']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View POD</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_podTracking" <?php if($resPerm['tracking']['readPod']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>Status Change</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Status Change</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_statusChange" <?php if($resPerm['statusChange']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add Status Change</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_statusChange" <?php if($resPerm['statusChange']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit Status Change</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_statusChange" <?php if($resPerm['statusChange']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete Status Change</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_statusChange" <?php if($resPerm['statusChange']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>User Management</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View User</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_userManagement" <?php if($resPerm['userManagement']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Add User</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="add_userManagement" <?php if($resPerm['userManagement']['create']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Edit User</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="edit_userManagement" <?php if($resPerm['userManagement']['update']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">Delete User</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="delete_userManagement" <?php if($resPerm['userManagement']['delete']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                        </div>
                        <hr>
                               <div class="row">
						     <div class="col-md-4">
						        <h4><b>Reports</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Total Reports</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_totalReports" <?php if($resPerm['reports']['read_total']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Client wise Reports</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_clientReports" <?php if($resPerm['reports']['read_client']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Delivered Reports</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_deliveredReports" <?php if($resPerm['reports']['read_delivered']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                                 <div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Day wise Reports</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_dayReports" <?php if($resPerm['reports']['read_day']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             <div class="col-md-4">
						        <h4><b>Administrator Backup</b></h4>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Administrator Backup</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" name="view_administratorBackup" <?php if($resPerm['backup']['read']=="1"){ echo"checked"; }?>>
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
                             </div>
                             
                             
                              <div class="col-md-4">
						        <h4><b>Vehicle Tracking</b></h4>
						        
						        <label for=""  style="color:red;">Branch Barcode</label><br>
						        
						                <div class="form-group">
                						    <label for="" class="col-sm-6 control-label"> Branch Barcode View</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="view_barcode" class="child_barcode" <?php if($resPerm['barcode']['read']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Branch Barcode Add</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="add_barcode" class="child_barcode" <?php if($resPerm['barcode']['create']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                 
                                 <label for=""  style="color:red;">Vehicle Tracking</label><br>
						        
						       	        <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Tracking View</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="view_vehicle_tracking" class="child_vehicle_tracking" <?php if($resPerm['vehicle_tracking']['read']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Tracking Add</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="add_vehicle_tracking" class="child_vehicle_tracking" <?php if($resPerm['vehicle_tracking']['create']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Tracking Edit</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="edit_vehicle_tracking" class="child_vehicle_tracking" <?php if($resPerm['vehicle_tracking']['update']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Tracking Delete</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="delete_vehicle_tracking" class="child_vehicle_tracking" <?php if($resPerm['vehicle_tracking']['delete']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
						        
						        
						        <label for=""  style="color:red;">Vendor Details</label><br>
						        
						      	        <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vendor View</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="view_vendor" class="child_vendor" <?php if($resPerm['vendor']['read']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vendor Add</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="add_vendor" class="child_vendor" <?php if($resPerm['vendor']['create']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vendor Edit</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="edit_vendor" class="child_vendor" <?php if($resPerm['vendor']['update']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vendor Delete</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="delete_vendor" class="child_vendor" <?php if($resPerm['vendor']['delete']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
						        
						        	
						        	<label for=""  style="color:red;">Vehicle Model</label><br>
						       
        						        <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Model View</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="view_vehicle_model" class="child_vehicle_model" <?php if($resPerm['vehicle_model']['read']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Model Add</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="add_vehicle_model" class="child_vehicle_model" <?php if($resPerm['vehicle_model']['create']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Model Edit</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="edit_vehicle_model" class="child_vehicle_model" <?php if($resPerm['vehicle_model']['update']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Vehicle Model Delete</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="delete_vehicle_model" class="child_vehicle_model" <?php if($resPerm['vehicle_model']['delete']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>

						        
						        	<label for=""  style="color:red;">Delivery Category</label><br>
						      
        						        <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Category View</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="view_delivery_category" class="child_delivery_category" <?php if($resPerm['delivery_category']['read']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Category Add</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="add_delivery_category" class="child_delivery_category" <?php if($resPerm['delivery_category']['create']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Category Edit</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="edit_delivery_category" class="child_delivery_category" <?php if($resPerm['delivery_category']['update']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Category Delete</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="delete_delivery_category" class="child_delivery_category" <?php if($resPerm['delivery_category']['delete']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>							        
						        
						        
						        	<label for=""  style="color:red;">Delivery Route</label><br>
						       
        						        <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Route View</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="view_delivery_route" class="child_delivery_route" <?php if($resPerm['delivery_route']['read']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Route Add</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="add_delivery_route" class="child_delivery_route" <?php if($resPerm['delivery_route']['create']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Route Edit</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="edit_delivery_route" class="child_delivery_route" <?php if($resPerm['delivery_route']['update']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>
                                         <div class="form-group">
                						    <label for="" class="col-sm-6 control-label">Delivery Route Delete</label>
                        						<label class="switch">
                                                  <input type="checkbox" value="0" name="delete_delivery_route" class="child_delivery_route" <?php if($resPerm['delivery_route']['delete']=="1"){ echo"checked"; }?>>
                                                  <span class="slider round"></span>
                                                </label>
                                         </div>									        
	                             </div>
                             
                             
                     
                        </div>
                        <hr>
						<div class="form-group">
							<label for="" class="col-sm-2 control-label"></label>
							<div class="col-sm-6">
								<button type="submit" class="btn btn-success pull-left" name="form1">Update</button>
							</div>
						</div>
					</div>
				</div>
			</form>
		</div>
	</div>

</section>
<!--<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></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>
		<?php }else{ ?>
<center><h4 style="color:red;">You don't have permission to add role </h4></center>
<?php } ?>

<?php require_once('footer.php'); ?>