

<?php $__env->startSection('content'); ?>

<?php
 $continent=[];
?>

<div class="main-mobile-header doc-mobile-header">
      <a id="menuLink" href="#" class="menu-link"><i class="ri-menu-line"></i></a>
    </div>

   

    



     <div class="main main-app p-3 p-lg-4">
        

        <div class="mb-4">
          <ol class="breadcrumb fs-sm mb-1">
            <li class="breadcrumb-item"><a href="#">Dashboard</a></li>
            <li class="breadcrumb-item active" aria-current="page">Battery Brand List</li>
          </ol>
        </div>



      <div class="">
        <div class="row">

          <div class="col-lg-8">
            <h2 class="main-title">Battery Brand List</h2>
            
          </div>
          <div style="text-align: right;" class="col-lg-4 text-right">
           <!--  <button type="button" class="btn btn-primary">Add Employee</button> -->
            <!-- <a href="/form" class="btn btn-primary">Create Hotel</a> -->
            <button type="button" class="btn btn-primary btn-icon-text mb-2 mb-md-0" data-bs-toggle="modal" data-bs-target="#myFlight">
        Add Battery Brand
      </button>
          </div>

        </div>

        <hr class="main-separator">        
    


<!--         <h5 id="section9" class="main-subtitle">Basic Example</h5>
 -->        <!-- <p>In this examples, we load the data from an existing HTML table.</p> -->

        <div class="card card-example">
          <div class="card-body" style="background-color:white;">
            <div class="table-responsive ">
              <table id="tableGrid1" class="table table-hover">
              <thead class="text-center">
            <tr>
              <th>No</th>
              <th>Brand</th>
              <th>Action</th>
            </tr>
          </thead>
          <tbody>
            <?php $__currentLoopData = $type; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            
            <tr>
              <td><?php echo e($key+1); ?></td>              
              <td><?php echo e($data->name); ?></td>
              <td>
             
                <button style="padding:0;background-color: transparent;  background-repeat: no-repeat;  border: none;    cursor: pointer;    overflow: hidden;    outline: none;" value="/battery_brand/delete/<?php echo e($data->id); ?>" class="  deletebtnpopup"><span style="color:#506fd9;"><i style="font-size: 20px;" class="ri-delete-bin-6-line"></i></span>
                </button>
                <button style="padding:0;background-color: transparent;  background-repeat: no-repeat;  border: none;    cursor: pointer;    overflow: hidden;    outline: none;" value="<?php echo e($data->id); ?>" class="editbtn"><span style="color:#506fd9;"><i style="font-size: 20px;" class="ri-edit-box-line"></i></span>
                </button>

            </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </tbody>
                
              </table>
            </div><!-- table-responsive -->
          </div><!-- card-body -->
          
        </div><!-- card -->

        <br><br><br>

        

      </div><!-- container -->

     
    <style>
    tbody tr:hover {background-color: #F5F5F5;}
    .card-example>.card-body::before {
    content: ""
    }
    </style>

    <script type="text/javascript">
      $("#tableGrid1").Grid({
        className: {
          table: 'table table-bordered mb-0'
        },
        search: true
      });
    </script>


<!-- The Modal -->
<div class="modal" id="myFlight">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <!-- Modal Header -->
      <div class="modal-header" >
        <h4 class="modal-title">Add Battery Brand</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal" style="margin-top: 1px;"></button>
      </div>
      <!-- Modal body -->
      <div class="modal-body" style="margin-top: -15px;">
        <div class="card-body">
          <form action="<?php echo e(route('battery_brand.store')); ?>" method="POST" id="cat" enctype="multipart/form-data">
          <?php echo csrf_field(); ?>
          <br>
          <div class="row">
                       
            <div class="col-sm-12">
                <div class="mb-3">
                    <label class="form-label">Brand
                <span class="required-field">*</span>
              </label>
                <input type="text" name="name" id="name" class="form-control" required>
                </div>
            </div>
            
                                        
          </div><!-- Row -->
          <div class="buttons-alignment mt-4 ml-auto">
            <button type="submit" class="btn btn-primary">Submit</button>
          </div>
                </form>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="modal" id="edit-category">
  <div class="modal-dialog modal-sm">
    <div class="modal-content">
      <!-- Modal Header -->
      <div class="modal-header" >
        <h4 class="modal-title">Edit Battery Brand</h4>
        <button type="button" class="btn-close" data-bs-dismiss="modal" style="margin-top: 1px;"></button>
      </div>
      <!-- Modal body -->
      <div class="modal-body" style="margin-top: -15px;">
        <div class="card-body">
          <form action="<?php echo e(route('battery_brand.update')); ?>" method="POST" id="cat" enctype="multipart/form-data">
          <?php echo csrf_field(); ?>
          <input type="hidden" name="brand_id" id="brand_id">
          <br>
          <div class="row">
            <div class="col-sm-12">
                <div class="mb-12">
                    <label class="form-label">Brand
                <span class="required-field">*</span>
              </label>
                <input type="text" name="name" id="name" class="form-control" required>
                </div>
            </div>



          </div><!-- Row -->
          <div class="buttons-alignment mt-4 ml-auto">
            <button type="submit" class="btn btn-primary">Submit</button>
          </div>
                </form>
        </div>
      </div>
    </div>
  </div>
</div>


<script>
    $(document).ready(function() {
    $(document).on('click', '.editbtn', function() {
      var cat_id = $(this).val();
      //alert(service_id);
      $('#edit-category').modal('show');
             console.log(cat_id)


    var initialData = <?php echo json_encode($type->toArray()); ?>;
    console.log(initialData)

   var filteredData = initialData.filter(function(category) {
       return category.id == cat_id;
      });

       console.log(filteredData)
      
    $('#edit-category #brand_id').val(filteredData[0].id);

    $('#edit-category #name').val(filteredData[0].name);
  


    });
  });

</script>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layout.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/vokks/public_html/tms/resources/views/masters/battery_brand.blade.php ENDPATH**/ ?>