


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

<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">Install Rim</li>
          </ol>
        </div>

      

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

          <div class="col-lg-8">
            <h2 class="main-title">Install Rim to <?php echo e($position); ?> Position</h2>
            
          </div>
          <div style="text-align: right;" class="col-lg-4 text-right">
           <!--  <button type="button" class="btn btn-primary">Add Taxmaster</button> -->
            <!-- <a href="/form" class="btn btn-primary">Add Taxmaster</a> -->
          </div>

        </div>

        <hr class="main-separator">        
    
            
        <div class="card card-shadow-apply">
    <div class="card-body">
        <form action="<?php echo e(route('vehicle.install_rim')); ?>" method="POST" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
            
            <input type="hidden" name="vehicle_id" value="<?php echo e($id); ?>">
            <input type="hidden" name="rim_position" value="<?php echo e($position); ?>">
            <div class="row">
                <div class="col-sm-4">
                    <div class="mb-3">
                        <label class="form-label">Rim ID</label>
                        <select class="form-select select_rim" name="rim_id">
                            <?php $__currentLoopData = $tyres; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option><?php echo e($data->rim_id); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                        <!--<input type="text" name="tire_id" class="form-control" required />-->
                    </div>
                </div>

                
            </div>
            <div class="buttons-alignment mt-4">
                <div>
                    <button type="submit" class="btn btn-primary submit-button-alignment">Submit</button>
                </div>
            </div>
        </form>
        
<div style="margin-top: 20px;" id="data">
    <div class="row">
        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Brand</label>
                <input type="text" name="brand" id="brand" class="form-control" readonly>
            </div>
        </div>

        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Model</label>
                <input type="text" name="model" id="model" class="form-control" readonly>
            </div>
        </div>

        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Size</label>
                <input type="text" name="size" id="size" class="form-control" readonly>
            </div>
        </div>

        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Bolt Pattern</label>
                <input type="text" name="bolt_pattern" id="bolt_pattern" class="form-control" readonly>
            </div>
        </div>

        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Offset</label>
                <input type="text" name="offset" id="offset" class="form-control" readonly>
            </div>
        </div>

        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Material</label>
                <input type="text" name="material" id="material" class="form-control" readonly>
            </div>
        </div>

        <div class="col-md-4">
            <div class="mb-3">
                <label class="form-label">Color/Finish</label>
                <input type="text" name="color_finish" id="color_finish" class="form-control" readonly>
            </div>
        </div>
    </div>
</div>

        
    </div>
</div>







        <br><br><br>

        

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

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


<script>

</script>


<script>
  $(document).ready(function() {
    $(document).on('change', '.select_rim', function() {
      var tire_id = $(this).val();
    //   alert(tire_id);
        console.log(tire_id)


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

   var filteredData = initialData.filter(function(data) {
       return data.rim_id == tire_id;
      });

       console.log(filteredData)
      
// Access the filteredData object and populate the fields
$('#data #brand').val(filteredData[0].brand);
$('#data #model').val(filteredData[0].model);
$('#data #size').val(filteredData[0].size);
$('#data #bolt_pattern').val(filteredData[0].bolt_pattern);
$('#data #offset').val(filteredData[0].offset);
$('#data #material').val(filteredData[0].material);
$('#data #color_finish').val(filteredData[0].color_finish);



       console.log(filteredData)



    });
  });

</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/vehicle/add_rim.blade.php ENDPATH**/ ?>