    
<?php $__env->startSection('page_title','Admin User Add'); ?>
<?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-user me-1 mb-1"></i>
                            <span>Admin User Add</span>
                        </div>
                    </div>
	<div class="page-content">
	    <div class="card">
	        
	        
	            	<div class="bg-light border-bottom-0 pb-0 px-0">
								  <div class="nav nav-tabs" id="nav-tab" role="tablist">
    <button class="nav-link active" id="nav-details-tab" data-bs-toggle="tab" data-bs-target="#nav-details" type="button" role="tab" aria-controls="nav-details" aria-selected="true">Details</button>
    <button class="nav-link" id="nav-permission-tab" data-bs-toggle="tab" data-bs-target="#nav-permission" type="button" role="tab" aria-controls="nav-permission" aria-selected="false">Permission</button>
  </div>
							</div>
						    
	        
	      <div class="card-body px-4 pb-4">
	          
	          
	          <form class="tab-content  needs-validation" onsubmit="return myckediter()" novalidate id="nav-tabContent" method="POST" enctype="multipart/form-data" action="<?php echo e(asset('superadmin/adminusercreate')); ?>">
	                <div class="tab-pane fade show active" id="nav-details" role="tabpanel" aria-labelledby="nav-details-tab">
 <div class="form-group row ">
                       <?php echo csrf_field(); ?>
                             <div class="col-md-6 col-lg-4 mt-3">
                                <label class="form-label" for="f_name">First Name<span class="text-danger">*</span></label>
                                <input class="form-control" id="f_name" type="text"  name="f_name" required>
                            </div>
                              <div class="col-md-6 mt-3 col-lg-4">
                                <label class="form-label" for="l_name">Last Name<span class="text-danger">*</span></label>
                                <input class="form-control" id="l_name" type="text"  name="l_name" required>
                            </div>
                            <div class="col-md-6 mt-3 col-lg-4">
                                <label class="form-label" for="email">Email<span class="text-danger">*</span></label>
                                <input class="form-control" id="email" type="email"  name="email" required oninput="this.value = this.value.replace(/\s+/g, '')">
                            </div>
                              <div class="col-md-6 mt-3 col-lg-4">
                                <label class="form-label" for="number">Mobile Number<span class="text-danger">*</span></label>
                                <input class="form-control" id="number" type="text"  name="number" required oninput="this.value = this.value.replace(/[^0-9]/g, '')" maxlength = "10">
                            </div>
                               <div class="col-md-6 mt-3 col-lg-4">
                                <label class="form-label" for="email">Password<span class="text-danger">*</span></label>
                                <input class="form-control" id="password" type="password"  name="password" required>
                            </div>
                            <div class="col-md-6 mt-3 col-lg-4">
                                <label class="form-label" for="profile">Image<span class="text-danger">*(Only Upload Jpg,Png,WEBP)</span></label>
                                <input data-value="imageerror1" class="form-control image" id="profile" type="file" name="image" required accept=".jpg,.png"> 
                                 <div class="error-message" id="imageerror1" style="color: red;"></div>
                            </div>
                             <div class="col-md-6 mt-3 col-lg-4">
                  <div class="form-group mb-3">
                               <label class="form-label" for="role">Role </label>
                                <select class=" form-control"  name="role" id="role" >
                                    <option value="">Select</option>
                                    <?php $__currentLoopData = $role; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $roleData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                        <option value="<?php echo e($roleData->id); ?>" ><?php echo e($roleData->role); ?></option>
                                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                                        
                                                                    </select>
                                
                           </div>
                           </div>
                           
                            <div class="col-12 mt-3">
                     <button type="submit" class="btn btn-primary">Submit</button>
                    </div>
                    
                       
                    </div>
                      </div>
                        <div class="tab-pane fade" id="nav-permission" role="tabpanel" aria-labelledby="nav-permission-tab">
         <div class="row">
          <div class="col-12">
             
                           <div class="mt-4 col-12">
                               <label class="form-label" for="state">Permission</label>
                                <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
                                    
                                
                                
                              
                                                                </ul>
                                
                                <div class="tab-content" id="pills-tabContent">
  
   <div class="tab-pane fade show active" id="project1" role="tabpanel" aria-labelledby="pills-home-tab">
       
      <table class="table table-bordered">
    <thead>
        <tr>
            <th scope="col">
                Features
            </th>
            <th scope="col" class="text-center">Capabilities</th>
        </tr>
        <tr>
            <th>Select All</th>
            <th class="d-flex justify-content-between flex-wrap">
                <label><input type="checkbox" onclick="toggleColumn('viewOwn[]')"></label>
                <label><input type="checkbox" onclick="toggleColumn('viewGlobal[]')"></label>
       
                <label><input type="checkbox" onclick="toggleColumn('create[]')"> </label>
                <label><input type="checkbox" onclick="toggleColumn('edit[]')"> </label>
                <label><input type="checkbox" onclick="toggleColumn('delete[]')"></label>
            </th>
        </tr>
    </thead>
    <tbody>
        <?php $__currentLoopData = $feature; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $featureData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <tr>
            <td>
                <input type="checkbox" class="row-check" onclick="toggleRow(this)">
                <?php echo e($featureData->feature); ?>

                <input type="hidden" name="feature[]" value="<?php echo e($featureData->id); ?>">
            </td>
            <td class="d-flex align-items-center justify-content-between flex-wrap">
                <div class="form-check">
                    <input class="form-check-input viewOwn" type="checkbox" name="viewOwn[]" value="1" onchange="updateHidden(this, 'hideview<?php echo e($featureData->id); ?>')">
                    <label class="form-check-label">View (Own)</label>
                    <input type="hidden" id="hideview<?php echo e($featureData->id); ?>" name="viewOwnHidden[]" value="0">
                </div>
                <div class="form-check">
                    <input class="form-check-input viewGlobal" type="checkbox" name="viewGlobal[]" value="1" onchange="updateHidden(this, 'hideviewg<?php echo e($featureData->id); ?>')">
                    <label class="form-check-label">View (Global)</label>
                    <input type="hidden" id="hideviewg<?php echo e($featureData->id); ?>" name="viewgHidden[]" value="0">
                </div>
                <div class="form-check">
                    <input class="form-check-input create" type="checkbox" name="create[]" value="1" onchange="updateHidden(this, 'hideadd<?php echo e($featureData->id); ?>')">
                    <label class="form-check-label">Create</label>
                    <input type="hidden" id="hideadd<?php echo e($featureData->id); ?>" name="addHidden[]" value="0">
                </div>
                <div class="form-check">
                    <input class="form-check-input edit" type="checkbox" name="edit[]" value="1" onchange="updateHidden(this, 'hideedit<?php echo e($featureData->id); ?>')">
                    <label class="form-check-label">Edit</label>
                    <input type="hidden" id="hideedit<?php echo e($featureData->id); ?>" name="editHidden[]" value="0">
                </div>
                <div class="form-check">
                    <input class="form-check-input delete" type="checkbox" name="delete[]" value="1" onchange="updateHidden(this, 'hidedelete<?php echo e($featureData->id); ?>')">
                    <label class="form-check-label">Delete</label>
                    <input type="hidden" id="hidedelete<?php echo e($featureData->id); ?>" name="deleteHidden[]" value="0">
                </div>
            </td>
        </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </tbody>
</table>

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


   <?php $__env->startPush('scripts'); ?>

 <script>
    // Toggle all rows at once
    function toggleAllRows(master) {
        const allRowChecks = document.querySelectorAll('.row-check');
        allRowChecks.forEach(rowCheck => {
            rowCheck.checked = master.checked;
            toggleRow(rowCheck);
        });
    }

    // Toggle all checkboxes in a row
    function toggleRow(checkbox) {
        const row = checkbox.closest('tr');
        const inputs = row.querySelectorAll('.form-check-input');
        inputs.forEach(input => {
            if (input.type === 'checkbox') {
                input.checked = checkbox.checked;
                const hiddenId = input.getAttribute('onchange')?.match(/'([^']+)'/);
                if (hiddenId && document.getElementById(hiddenId[1])) {
                    document.getElementById(hiddenId[1]).value = checkbox.checked ? 1 : 0;
                }
            }
        });
    }

    // Toggle all checkboxes in a specific column
    function toggleColumn(name) {
        const inputs = document.getElementsByName(name);
        const master = event.target.checked;
        inputs.forEach((input) => {
            input.checked = master;
            const hiddenId = input.getAttribute('onchange')?.match(/'([^']+)'/);
            if (hiddenId && document.getElementById(hiddenId[1])) {
                document.getElementById(hiddenId[1]).value = master ? 1 : 0;
            }
        });
    }

    // Update hidden field based on checkbox state
    function updateHidden(checkbox, hiddenFieldId) {
        document.getElementById(hiddenFieldId).value = checkbox.checked ? 1 : 0;
    }
</script>



 <script>
    $(document).ready(function () {
    function initSelect2(selector, options = {}) {
    let defaultOptions = {
    theme: "bootstrap-5",
    width: $(selector).data('width') ? $(selector).data('width') : $(selector).hasClass('w-100') ? '100%' : 'style',
    placeholder: $(selector).data('placeholder'),
    };
    
    $(selector).select2($.extend({}, defaultOptions, options));
    }

    initSelect2('#role');
    
    
    
    });
    </script>

    
	
<?php $__env->stopPush(); ?> 
<?php $__env->stopSection(); ?>
<?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/adminuser/adminuseradd.blade.php ENDPATH**/ ?>