<?php require_once('header.php'); 
 if($allPermissions['userManagement']['create']=="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);
                                    
                                 

    $role_name=$_POST['role_name'];
	$statement = $pdo->prepare("SELECT * FROM tbl_role where role_name='$role_name'");
							$statement->execute();
							$result = $statement->fetchAll(PDO::FETCH_ASSOC);
							
                            if($result)
                            {
                                $valid=0;
                                $error_message .= 'Role Alreay Exist<br>';
                            }
							

    if($valid==1)
    {
    
		$statement = $pdo->prepare("INSERT INTO tbl_role (role_name,permission) VALUES (?,?)");
		$statement->execute(array($role_name,$permissions));
			
		$success_message = 'New role is added 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>


<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($_POST['role_name'])){echo $_POST['role_name'];} ?>">
							</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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_client">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Client</label>
                						<label class="switch">
                                          <input type="checkbox" class="child_client" value="0" name="view_client">
                                          <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" class="child_client" value="0" name="add_client">
                                          <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" class="child_client" value="0" name="edit_client">
                                          <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" class="child_client" value="0" name="delete_client">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_pincode">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Pincode</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" class="child_pincode" name="view_pincode">
                                          <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" class="child_pincode" name="add_pincode">
                                          <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" class="child_pincode" name="edit_pincode">
                                          <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" class="child_pincode" name="delete_pincode">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_hsncode">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View HSN Code</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" class="child_hsncode" name="view_hsncode">
                                          <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" class="child_hsncode" name="add_hsncode">
                                          <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" class="child_hsncode" name="edit_hsncode">
                                          <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" class="child_hsncode" name="delete_hsncode">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_3plAwbList">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_3plAwbList" name="view_3plAwbList">
                                          <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" class="child_3plAwbList" name="add_3plAwbList">
                                          <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" class="child_3plAwbList" name="edit_3plAwbList">
                                          <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" class="child_3plAwbList" name="delete_3plAwbList">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_transport">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Transport</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" class="child_transport" name="view_transport">
                                          <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" class="child_transport" name="add_transport">
                                          <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" class="child_transport" name="edit_transport">
                                          <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" class="child_transport" name="delete_transport">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_logistics">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<div class="form-group">
        						    <label for="" class="col-sm-6 control-label">View Logistics</label>
                						<label class="switch">
                                          <input type="checkbox" value="0" class="child_logistics" name="view_logistics">
                                          <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" class="child_logistics" name="add_logistics">
                                          <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" class="child_logistics" name="edit_logistics">
                                          <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" class="child_logistics" name="delete_logistics">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_pod">
                                          <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_pod" class="child_pod">
                                          <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" class="child_pod">
                                          <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" class="child_pod">
                                          <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" class="child_pod">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_pickupentry">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_pickupentry">
                                          <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" class="child_pickupentry">
                                          <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" class="child_pickupentry">
                                          <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" class="child_pickupentry">
                                          <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" class="child_pickupentry">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_manifest">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_manifest">
                                          <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" class="child_manifest">
                                          <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" class="child_manifest">
                                          <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" class="child_manifest">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_track">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_track">
                                          <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" class="child_track">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_statusChange">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_statusChange">
                                          <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" class="child_statusChange">
                                          <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" class="child_statusChange"> 
                                          <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" class="child_statusChange">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_userManagement">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_userManagement">
                                          <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" class="child_userManagement">
                                          <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" class="child_userManagement">
                                          <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" class="child_userManagement">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_totalReports">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						<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" class="child_totalReports">
                                          <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" class="child_totalReports">
                                          <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" class="child_totalReports">
                                          <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" class="child_totalReports">
                                          <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">
                                          <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_barcode">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
						        
        						        <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">
                                                  <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">
                                                  <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_vehicle_tracking">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						        <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">
                                                  <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">
                                                  <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">
                                                  <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">
                                                  <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_vendor">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
						        
        						        <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">
                                                  <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">
                                                  <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">
                                                  <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">
                                                  <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_vehicle_model">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						        <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">
                                                  <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">
                                                  <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">
                                                  <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">
                                                  <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_delivery_category">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						        <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">
                                                  <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">
                                                  <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">
                                                  <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">
                                                  <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" style="color:red;">Select All</label>
                						<label class="switch">
                                          <input type="checkbox" class="master_child"  name="child_delivery_route">
                                          <span class="slider round"></span>
                                        </label>
                                 </div>
        						        <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">
                                                  <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">
                                                  <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">
                                                  <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">
                                                  <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">Submit</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>
<script type="text/javascript">
$(document).ready(function(){
    $('.master_child').on('change',function(){
        var values=$(this).attr("name");
        if(this.checked){
            $('.'+values).each(function(){
                this.checked = true;
            });
        }else{
             $('.'+values).each(function(){
                this.checked = false;
            });
        }
    });
    
    // $('.checkbox').on('click',function(){
    //     if($('.checkbox:checked').length == $('.checkbox').length){
    //         $('#select_all').prop('checked',true);
    //     }else{
    //         $('#select_all').prop('checked',false);
    //     }
    // });
});
</script>


		<?php }else{ ?>
<center><h4 style="color:red;">You don't have permission to add role </h4></center>
<?php } ?>

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