    
<?php $__env->startSection('page_title','Role'); ?>
<?php $__env->startSection('content'); ?>
		
<!--start page wrapper -->
<div class="page-wrapper">
     <div class="page-breadcrumb d-flex justify-content-between mt-3 main_header card p-1">
                        <div class="breadcrumb-title d-flex align-items-center ms-3">
                            <i class="bx bx-shield me-1 mb-1"></i>
                            <span>Role</span>
                        </div>
                    </div>
	<div class="page-content">
	    	<div class="row">
					<div class="col-xl-4">
						<div class="card">
							<div class="card-header px-2 py-2 text-capitalize usbb ">
								<h6 class="mb-0 text-white" >Role Add</h6>
							</div>
							<div class="card-body p-4">
								<form class="row g-3 needs-validation" id="formatDistrict-update" method="POST" action="<?php echo e(asset('superadmin/rolecreate')); ?>" novalidate>
								    <?php echo csrf_field(); ?>
									
									<div class="col-md-12">
										<label for="Vehicletitle" class="form-label">Role <span class="text-danger">*</span></label>
										<input type="text" name="title" class="form-control" id="title" placeholder="" required >
                                        <?php $__errorArgs = ['title'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                                        <div class="text-danger"><?php echo e($message); ?></div>
                                    <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
									
	<input type="hidden" name="id" class="form-control" id="id" >
									</div>
									<div class="col-md-12">
										  <div class="d-md-flex d-grid align-items-center gap-3 mt-2">
				  <?php if(permission(session('SUPERADMIN_ID'), '3', 'action_add')): ?>						      
        <button type="submit" name="submit" value="submit" class="btn btn-primary submitbtn">Submit</button>
        <?php endif; ?>
    </div>
									</div>
								</form>
							</div>
						</div>
					</div>
					
					
					   
					<div class="col-xl-8">
					    
					    
					        <div class="card">
	                <div class="card-header ss1 usbb">
								<h6 class="mb-0  text-white">Role View</h6>
							</div>
					<div class="card-body">
					    <div class="table-responsive">
							<table id="basic21" class="table table-striped  dataTable border table-bordered no-footer" style="width:100%">
								<thead>
									<tr>
											<th>ID</th>
                                        <th>Role</th>
                                        <th>Status</th>
                                        <th>Action</th>
									</tr>
								</thead>
								<tbody>
								</tbody>
							</table>
						</div>
					
					</div>
				</div>
                
				
					</div>
					
			


				

				</div>
	    
	    </div>
</div>



	
<?php $__env->stopSection(); ?>



<?php $__env->startPush('scripts'); ?>
<script>
	    $(document).ready(function(){
   
    $.ajaxSetup({
    headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
    });  

    $('#basic21').DataTable({
        'processing': true,
        'serverSide': true,
        'serverMethod': 'POST',
        'ajax': {
        'url': "<?php echo e(asset('superadmin/roleajax')); ?>",
        
beforeSend: function () {
                    $('#loader').show(); 
                    },
                    complete: function () {
                    $('#loader').hide(); 
                   
                     }
        },
        'columns': [
            { data: 'id' },
            { data: 'role' },
			{ data: 'status' },
			{ data: 'action' },
        ]
    });
});
	</script>
<script>
    function categoryupdate( id,role) {
      
      
       var url =  "<?php echo e(asset('superadmin/roleedit/')); ?>";
    $('#formatDistrict-update').attr('action',url);
  
    $('#id').val(id);
    $('#title').val(role);
     $('label span.text-danger').hide();
      $('.submitbtn').val('update');
        $('.submitbtn').text('Update');
    }
</script>


	<script>
	    	$(document).on('change', '.toggle-flip input[type="checkbox"]', function () {
    let status = $(this).prop('checked') ? 1 : 0;
    let userId = $(this).data('id');

    $.ajax({
        type: "POST",
        url: "<?php echo e(asset('superadmin/rolestatus')); ?>",
        data: {
            status: status,
            id: userId,
            _token: '<?php echo e(csrf_token()); ?>',
        },
        success: function (response) {
            console.log("Status updated", response);
        },
        error: function (xhr) {
            console.log("AJAX Error:", xhr);
            alert("Something went wrong");
        }
    });
});
	</script>
	

<?php $__env->stopPush(); ?>
<?php echo $__env->make('superadmin.include.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/indianpressnetwo/public_html/resources/views/superadmin/role/role.blade.php ENDPATH**/ ?>