<?php echo $__env->make('Admin.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

<br>
<br>
<br>
<br>
<?php echo $__env->make('Admin.modal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

<div class="main-content">
  <div class="container">

    
    <div class="row-fluid">
      <div class="span10">
<?php echo $__env->make('msg.flash', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
 <div class="widget-box">
          <div class="widget-title">
            <ul class="nav nav-tabs">
              <li class="active"><a data-toggle="tab" href="#tab1" class="btn btn-primary">ADD</a></li>&nbsp;&nbsp;
              <li><a data-toggle="tab" href="#tab2" class="btn btn-primary">View</a></li>
             
            </ul>
          </div>
          <div class="widget-content tab-content">
            <div id="tab1" class="tab-pane active">
              <p>
    <div class="widget-box">
              <div class="widget-title"> <span class="icon"> <i class="icon-info-sign"></i> </span>
            <h5>Add Sub Menu</h5>
          </div>
              			 <div class="widget-content nopadding">
            <form class="form-horizontal" method="post" action="<?php echo e(URL::to('AdminSubLinkSave')); ?>" name="basic_validate" id="basic_validate" novalidate="novalidate">
             <?php echo e(csrf_field()); ?>

              
              <div class="control-group" id="staticParent">
                <label class="control-label">Serial No (<strong class="text-danger">Must Be English</strong>)</label>
                <div class="controls">
                  <input type="text"  placeholder="Serial No"  class="form-control"  
                   value="<?php echo e(old('serial')); ?>" placeholder="Serial No" id="child" name="serial">
                </div>
              </div>

         
            <div class="control-group">
              <label class="control-label">Main Menu Name</label>
              <div class="controls">
                <select  name ="mainMenuName"  id="countryId" class="form-control">
                  <option >Select One</option>
              <?php if(count($mainmenu) > 0): ?>
              <?php $__currentLoopData = $mainmenu; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $showData): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e($showData->id); ?>" ><?php echo e($showData->Link_Name); ?></option>

              <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
              <?php endif; ?>      
               
                </select>
               <span id="loader"></span>
              </div>
            </div>



              <div class="control-group">
              
                <label class="control-label">Sub Menu Name </label>
            
                <div class="controls">
                  <input type="text" placeholder="Sub Menu Name English"
                   name="SubMenuEn" id="SubMenuEn" class="form-control" value="<?php echo e(old('SubMenuEn')); ?>">
                </div>
              </div>
         
          
     
           
             <div class="control-group" id="staticParent">
                <label class="control-label">Route Name (<strong class="text-danger"> Must Be English</strong>)</label>
                <div class="controls">
                  <input type="text"   
                  value="<?php echo e(old('Route')); ?>" placeholder="Route Name " class='form-control' 
                   id="child" name="Route" onkeypress="return (event.charCode >= 65 && event.charCode <= 90) || (event.charCode >= 97 && event.charCode <= 122) || (event.charCode >= 48 && event.charCode <= 57)">
                </div>
              </div>


              <div class="form-actions">
                <input type="submit" value="Save" class="btn btn-success">
              </div>
            </form>
          </div>
             </div>  </p>
            </div>
            <div id="tab2" class="tab-pane">
              <p>
              						 <div class="widget-box">
          <div class="widget-title"> <span class="icon"><i class="icon-th"></i></span>
            <h5>View All Data</h5>
          </div>
          <div class="widget-content nopadding">
            <table class="table table-bordered data-table" id="example" class="display nowrap">
              <thead>

                <tr>
                  <th>Serial NO</th>
                  <th>Main Menu Name </th>
                  <th>Sub Menu  Name </th>
                  <th> Route  Name </th>
                  <th>Action</th>
                 
                </tr>
              </thead>
              <tfoot>

                <tr>
                  <th>Serial NO</th>
                  <th>Main Menu Name </th>
                  <th>Sub Menu  Name </th>
                  <th> Route  Name </th>
                  <th>Action</th>
                 
                </tr>
              </tfoot>
              <tbody>
                  
                <?php if(count($users) > 0): ?>
                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $showDataSub): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <tr  id="tr-<?php echo e($showDataSub->id); ?>">
                      <td><?php echo e($showDataSub->serialno); ?></td>
                      <td><?php echo e($showDataSub->Link_Name); ?></td>
                      <td><?php echo e($showDataSub->submenuname); ?></td>
                      <td><?php echo e($showDataSub->routeName); ?></td>
                      <td>
                      <div class="fr"> 
                  <a href="#" onclick="loadModel('<?php echo e($showDataSub->id); ?>')"
                      class="btn btn-primary btn-mini" data-toggle="modal" data-target="#myModal" >Edit</a>
                    <a class="btn btn-danger btn-mini" onclick="deleteData('<?php echo e($showDataSub->id); ?>')" >
                      Delete</a></div>
                    </td>
                  </tr> 
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  <?php endif; ?>





             
              </tbody>
            </table>
          </div>
        </div>
  
           </p>
            </div>
           
          </div>
        </div>
        </div>
        </div></div>
        </div>

        <?php echo $__env->make('Admin.footer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
         <meta name="_token" content="<?php echo csrf_token(); ?>" />
        <script type="text/javascript">
        function loadModel(id)
        {
        	$(".modal-body").load("<?php echo e(URL::to('adminSubModelEdit')); ?>"+'/'+id);
        }


 $(function() {
  $('#staticParent').on('keydown', '#child', function(e){-1!==$.inArray(e.keyCode,[46,8,9,27,13,110,190])||/65|67|86|88/.test(e.keyCode)&&(!0===e.ctrlKey||!0===e.metaKey)||35<=e.keyCode&&40>=e.keyCode||(e.shiftKey||48>e.keyCode||57<e.keyCode)&&(96>e.keyCode||105<e.keyCode)&&e.preventDefault()});
})


function deleteData(getId){
            
            $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
            }
            })

             $.ajax({

            type: "POST",
            url: "<?php echo e(URL::to('AdminSubmenuDelete')); ?>/"+getId,
            data: {id:getId},
            dataType: 'json',
            success: function (data) {
               //console.log(data);
               $("#tr-"+getId).hide();
              
            },
            error: function (data) {
                console.log('Error:', data);
            }
        });

          }



        </script>
        <script src="<?php echo e(URL::to('/')); ?>/public/js/matrix.tables.js"></script>
<?php /**PATH /home2/hpecmqif/public_html/resources/views/Admin/developermenu/SubMenu.blade.php ENDPATH**/ ?>