<?php $__env->startSection('content'); ?>
<style>
    th.text-center.hd {
    background: #bae0e0;
    color: #0073a4;
}
    .head-table {
    background: #bae0e0 !important;
}
    .machine-history-card tbody {
    border: 1px solid #cccccca6;
}
 th {
    text-align: left;
}   
 .table {
    border: 1px solid #ccc !important;
}   
tr.head-table th {
    border: 1px solid #ccc !important;
}

.head-table {
    background: #bae0e0 !important;
    border: 1px solid #ccc !important;
}    
 th.head-table {
    width: 250px;
}   
    
    
    
    
</style>
<div class="common-content">
          <div class="page-content">
                <div class="page-heading">
                    <div class="headings">
                        <h6>Product details</h6>
                    </div>
                </div>

      <div class="dashboard-cnts">

       <div class="d-flex justify-content-end">
            <button class="save_print" onclick="printData()">SAVE AND PRINT</button>
          </div>

        <?php if(!empty($complaintlist)): ?>

<div class="mt-3 row">
    <div class="col-lg-4">
         Filter By Year
        <select class="form-control selectmanufacturer invoiceselect" id="equipment_filter" name="equipment_filter">
            <option value="all">All</option>
            <?php $__currentLoopData = $yearlist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $yearl): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e($yearl); ?>"><?php echo e($yearl); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </select>
    </div>
    <div class="col-lg-4">

      Filter By Nature of Break Down
        <select class="form-control selectmanufacturer inselect" id="equipment_filter1" name="equipment_filter1">
                  <option value="all">All</option>
                  <?php $__currentLoopData = $complaintlist2; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $complaint): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                      <?php if($complaint->complaint_type=='manual'): ?>
                      <option value="Equipment Malfunction"> Equipment Malfunction</option>
                      <?php elseif($complaint->complaint_type=='amc_cmc_activation'): ?>
                      <option value="<?php echo e(strtoupper($complaint->activate_val)); ?> Activation"><?php echo e(strtoupper($complaint->activate_val)); ?> Activation</option>
                      <?php elseif($complaint->complaint_type=='amc_cmc_rene'): ?>
                      <option value="Renew <?php echo e(strtoupper($complaint->activate_val)); ?>">Renew <?php echo e(strtoupper($complaint->activate_val)); ?></option>
                        <?php elseif($complaint->complaint_type=='validation_date'): ?>
            
                      <option value="Validation Request">Validation Request</option>
                      
                      <?php elseif($complaint->complaint_type=='installation_date'): ?>
                  
                      <option value="Installation request"> Installation request</option>
                    
                      <?php elseif($complaint->complaint_type=='preventive_contract'): ?>
                  
                      <option value="Preventive_main">Preventive Maintenance Contract </option>
                      
                      <?php else: ?>
                      <?php endif; ?>
            
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
       <?php endif; ?>
    </div>
</div>

<div id="customers">
 <table class="table mt-3" id="styledTable" border="1" style="border-collapse: collapse" >
<!--
<thead>
<tr>
<th colspan="6" scope="col">Sr.No.</th>
</tr>
</thead>
<thead>
<tr>
<th colspan="2" scope="col">Sr.No.</th>
<th colspan="3" scope="col">:</th>


<th colspan="1" rowspan="3" scope="col">Sr.No.</th>
</tr>
</thead>
<thead>
<tr>
<th colspan="6" scope="col">Sr.No.</th>
</tr>
</thead>          
      
<thead>
<tr>
<th scope="col">Sr.No.</th>
<th scope="col">Date</th>
<th scope="col">Break down details</th>
<th scope="col">Nature of Break Down</th>
<th scope="col">Doc No. Ref.No</th>
<th scope="col">Break Down Time</th>
</tr>
</thead>
-->
<tbody>
<tr>
<th colspan="6" class="text-center hd" scope="col">Machine History Card</th>
</tr>

<tr>
<th class="head-table" colspan="2" scope="col">M/C Name</th>
<th colspan="5" scope="col"><?php echo e(ucfirst($product_name)); ?></th>
</tr>  
<tr>
<th class="head-table" colspan="2" scope="col">Model / Make</th>
<th colspan="5" scope="col"><?php echo e($model_no); ?></th>

</tr> 
<tr>
<th class="head-table" colspan="2" scope="col">M/C No</th>
<th colspan="5" scope="col"><?php echo e($serial_no); ?></th>
</tr> 
<tr>
<th class="head-table" colspan="2" scope="col">Manufacturer</th>
<th colspan="5" scope="col"><?php echo e($manuname); ?></th>
</tr>
    <tr>
<th class="head-table" colspan="2" scope="col">Address</th>
<th colspan="5" scope="col"><?php echo e($address); ?></th>
</tr>
<tr>
<th class="head-table" colspan="2" scope="col">Warranty Date</th>
<th colspan="5" scope="col"><?php echo e($warranty); ?></th>
</tr>  
<tr>
<th class="head-table" colspan="2" scope="col">Discard Date</th>
<th colspan="5" scope="col"><?php echo e($discard_date); ?></th>
</tr>  
<tr>
<th class="head-table" colspan="2" scope="col">Preventive Maintenace</th>
<th colspan="5" scope="col"><?php echo e($preventive); ?></th>
</tr>  
<tr>
<th class="head-table" colspan="2" scope="col">Validation Date</th>
<th colspan="5" scope="col"><?php echo e($validation_date); ?></th>
</tr> 
<tr>
<th class="head-table" colspan="2" scope="col">Govt doc renewal date</th>
<th colspan="5" scope="col"><?php echo e($renewal_date); ?></th>
</tr>  
<tr>
<th class="head-table" colspan="2" scope="col">Product Status</th>
<th colspan="5" scope="col"><?php
echo $warranty_status;
echo $status_amc;
?></th>
</tr>  
<tr>
<th colspan="6" scope="col"></th>
</tr>  




<tr class="head-table">
<th scope="col">Sr.No.</th>
<th scope="col">Date</th>
<th scope="col">Break down details</th>
<th scope="col">Nature of Break Down</th>
<th scope="col">Complaint Id</th>

<th scope="col">Repaired details</th>
</tr>

<tr class=""  >
  <td  colspan="6"  >
      <div class="nodata">
          <span class="not text-center" style="display:none;" >Result Not Found</span>
      </div>
    </td>
</tr>


<?php if(!empty($complaintlist)): ?>
<?php $i = 1; ?>
  <?php $__currentLoopData = $complaintlist; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $complaint): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>


  <?php
$date = $complaint->date;
$fulldate = explode("-", $date);
$year1 = $fulldate[0];

if ($complaint->complaint_type == "manual")
{
    $nature_break = "Equipment Malfunction";
}
elseif ($complaint->complaint_type == "amc_cmc_activation")
{
    $nature_break = strtoupper($complaint->activate_val) . " " . "Activation";
}
elseif ($complaint->complaint_type == "amc_cmc_rene")
{
    $nature_break = "Renew" . " " . strtoupper($complaint->activate_val);
}
elseif ($complaint->complaint_type == "validation_date")
{
    $nature_break = "Validation Request";
}
elseif ($complaint->complaint_type == "installation_date")
{
    $nature_break = "Installation request";
}
elseif ($complaint->complaint_type == "preventive_contract")
{
    $nature_break = "Preventive_main";
}
else
{
}
?>
    <tr class="js-category-filterable" data-category="<?php echo $year1; ?>"  data-nature="<?php echo $nature_break; ?>"  data-full="<?php echo $year1 . "-" . $nature_break; ?>">
      <th scope="row"><?php echo e($i); ?></th>
      <td><?php echo e(date('d-m-Y', strtotime($complaint->date))); ?></td>
      <td><?php echo e(ucfirst($complaint->complaint)); ?></td>
      <td>
        <?php if($complaint->complaint_type=='manual'): ?>
          Equipment Malfunction
        <?php elseif($complaint->complaint_type=='amc_cmc_activation'): ?>
            <?php echo e(strtoupper($complaint->activate_val)); ?> Activation
        <?php elseif($complaint->complaint_type=='amc_cmc_rene'): ?>
        Renew <?php echo e(strtoupper($complaint->activate_val)); ?>

        <?php elseif($complaint->complaint_type=='validation_date'): ?>
        Validation Request
        <?php elseif($complaint->complaint_type=='installation_date'): ?>
        Installation request
        <?php elseif($complaint->complaint_type=='preventive_contract'): ?>
        Preventive Maintenance Contract 
        <?php else: ?>
        <?php endif; ?>

      </td>
      <td><?php echo e($complaint->id); ?></td>
     
      <td>
        <?php if(!empty($complaint->description)): ?>
        
           <?php echo e(ucfirst($complaint->description)); ?>

        <?php else: ?>

        --

        <?php endif; ?>
        
        </td>
    </tr>
    <?php $i++; ?>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php endif; ?>

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

<div class="machine-history-footer">
  <div class="prepared" >
      <span>Prepared by</span>
      <span> : </span>
      <span> <?php echo e(ucfirst(Auth::user()->name)); ?></span>
  </div>
  <div class="prepared" >
      <span>Verified by</span>
      <span> : </span>
      <span><?php echo e(ucfirst(Auth::user()->name)); ?></span>
  </div>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>

function printData()
{
   var divToPrint=document.getElementById("styledTable");
   newWin= window.open("");
   newWin.document.write(divToPrint.outerHTML);
   newWin.print();
   newWin.close();
}






$(function() {

 // document.querySelector('#jsPDF1').addEventListener('click', downloadPDFWithjsPDF);
  $(".invoiceselect").select2();
  $(".inselect").select2();



  $('#equipment_filter').change(function() {
var $select = $(this);
if (($select.val() == 'all')&&($('#equipment_filter1').val()=='all')) {
  // No filter selected.  Show all categories
  $('.js-category-filterable').show();
  //$('.js-current-category').text('All');
}
else if(($select.val() == 'all')&&($('#equipment_filter1').val()!='all')){
  var t=0;
 $('.js-category-filterable').each(function() {
    if ($(this).data('nature') == $('#equipment_filter1').val()) {
      $(this).show();
        t=1;
      }else {
        $(this).hide();
     }
     if(t==0){
        $(".not").css("display","block");
      }
      else{
        $(".not").css("display","none");
      }

  });

}

else if (($select.val() != 'all')&&($('#equipment_filter1').val()!='all')){

  var t=0;
 $('.js-category-filterable').each(function() {
      if ($(this).data('full') == $select.val()+'-'+$('#equipment_filter1').val()) {
        $(this).show();
        t=1;
      } else {
        $(this).hide();
      
      }
    if(t==0){
        $(".not").css("display","block");
      }
      else{
        $(".not").css("display","none");
      }


  });

  

}
else if (($select.val() != 'all')&&($('#equipment_filter1').val()=='all')){
  var t=0;
  $('.js-category-filterable').each(function() {
      if ($(this).data('category') == $select.val()) {
        
        $(this).show();
        t=1;
          
        } else {
          $(this).hide();
         
        }

        if(t==0){
          $(".not").css("display","block");
        }
        else{
          $(".not").css("display","none");
        }

  });

}
else{

}
});


$('#equipment_filter1').change(function() {
var $select = $(this);
if (($select.val() == 'all')&&($('#equipment_filter').val()=='all')) {
  // No filter selected.  Show all categories
  $('.js-category-filterable').show();
  //$('.js-current-category').text('All');
}

else if(($select.val() == 'all')&&($('#equipment_filter').val()!='all')){
  var t=0;
 $('.js-category-filterable').each(function() {
    if ($(this).data('category') == $('#equipment_filter').val()) {
      $(this).show();
      t=1;
    } else {
      $(this).hide();
      
    }
       if(t==0){
          $(".not").css("display","block");
        }
        else{
          $(".not").css("display","none");
        }


  });

}

else if (($select.val() != 'all')&&($('#equipment_filter').val()!='all')){

  var t=0;

  $('.js-category-filterable').each(function() {
    if ($(this).data('full') == $('#equipment_filter').val()+'-'+$select.val()) {
      $(this).show();
     t=1;
    } else {
      $(this).hide();
      
    }

        if(t==0){
          $(".not").css("display","block");
        }
        else{
          $(".not").css("display","none");
        }
  });


}

else if (($select.val() != 'all')&&($('#equipment_filter').val()=='all')){

  var t=0;

$('.js-category-filterable').each(function() {
  if ($(this).data('nature') == $('#equipment_filter1').val()) {
    $(this).show();
    t=1;
  } else {
    $(this).hide();
   
  }

  if(t==0){
          $(".not").css("display","block");
        }
        else{
          $(".not").css("display","none");
        }



});


}




else{

}


});

});

</script>

<?php echo $__env->make('layouts.main_assetmanage', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/meddbot/public_html/resources/views/buyers/preventive_card_buyer.blade.php ENDPATH**/ ?>