<?php 

   /*var_dump($data->pricelist_id);

   die('s');*/

   

   $extra_sum = 0;

   if(!empty($data->priclist_detail)){

       $price_new_arr = json_decode($data->priclist_detail);

   

      /* var_dump($price_new_arr);

       die('stop');*/

   

       if($price_new_arr != NULL){

           $price_new_arr = array_column($price_new_arr, 'value_field');

           $extra_sum = array_sum($price_new_arr);    

       }

   }

   

   $is_finance_display_filds = 1;

   

   if($user_role == 'KEC' ||  $user_role == 'Team leader'){

       $is_finance_display_filds = 0;    

   }

   

   /*echo "<pre>";

   print_r($price_new_arr);

       die('stop');*/

   

   /*$view_enable = 1; //display all

   if(auth()->user()->can('obf-view') == true && auth()->user()->can('obf-rtoview') == false && auth()->user()->can('obf-insuranceview') == false && auth()->user()->can('obf-fasttagview') == false){

       $view_enable = 2; // not display Insurance Details,RTO Department,Fasttag Department

   }*/

   

   ?>

@extends('template.app') 

@section('meta')

@endsection

@section('title')

Obf Summary

@endsection

@section('styles')

<link href="{{ asset('assets/css/dropify.min.css') }}" rel="stylesheet">

<link href="{{ asset('assets/css/sweetalert2.bundle.css') }}" rel="stylesheet">

<link href="{{ asset('assets/css/select2.css') }}" rel="stylesheet">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
<link href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css">

<style type="text/css">
    .card {
        background-color: rgba(0, 0, 0, 0.24) !important;
        border: none!important;
        box-shadow: none!important;
        color: #fff!important;
        text-align: center!important;
        display: flex!important;
        flex-direction: column!important;
        justify-content: center!important;
        align-items: normal!important; 
        padding: 20px!important;
        box-shadow: 0 23px 20px -20px rgba(9, 10, 18, .1), 0 0 15px rgba(9, 10, 18, .06)!important;
        border-radius: 10px!important;
        border-left: unset !important;
    }

   /*#galeria{

   display: flex;

   }*/

   #galeria img{

   width: 85px;

   height: 85px;

   border-radius: 10px;

   box-shadow: 0 0 8px rgba(0,0,0,0.2);

   opacity: 85%;

   padding: 3px;

   }

   /* #pan_image_multi{

   display: flex;

   }*/

   #pan_image_multi img{

   width: 85px;

   height: 85px;

   border-radius: 10px;

   box-shadow: 0 0 8px rgba(0,0,0,0.2);

   opacity: 85%;

   padding: 3px;

   }

   /*#adhar_image_multi{

   display: flex;

   }*/

   #adhar_image_multi img{

   width: 85px;

   height: 85px;

   border-radius: 10px;

   box-shadow: 0 0 8px rgba(0,0,0,0.2);

   opacity: 85%;

   padding: 3px;

   }

   /*#documents_multi{

   display: flex;

   }*/

   #documents_multi img{

   width: 85px;

   height: 85px;

   border-radius: 10px;

   box-shadow: 0 0 8px rgba(0,0,0,0.2);

   opacity: 85%;

   padding: 3px;

   }

   /*#licance_image_multi{

   display: flex;

   }*/

   #licance_image_multi img{

   width: 85px;

   height: 85px;

   border-radius: 10px;

   box-shadow: 0 0 8px rgba(0,0,0,0.2);

   opacity: 85%;

   padding: 3px;

   }

   .row > .column {

   padding: 0 8px;

   }

   .row:after {

   content: "";

   display: table;

   clear: both;

   }

   /* Create four equal columns that floats next to eachother */

   .column {

   float: left;

   width: 25%;

   }

   /* The Modal (background) */

   .modal {

   display: none;

   position: fixed;

   z-index: 1;

   padding-top: 100px;

   left: 0;

   top: 0;

   width: 100%;

   height: 100%;

   overflow: auto;

   background-color: black;

   }

   /* Modal Content */

   .modal-content {

   position: relative;

   background-color: #fefefe;

   margin: auto;

   padding: 0;

   width: 100%;

   max-width: 700px;

   }

   /* The Close Button */

   .close {

   color: white;

   position: absolute;

   top: 10px;

   right: 25px;

   font-size: 35px;

   font-weight: bold;

   }

   .close:hover,

   .close:focus {

   color: #999;

   text-decoration: none;

   cursor: pointer;

   }

   /* Hide the slides by default */

   .mySlides {

   display: none;

   }

   /* Next & previous buttons */

   .prev,

   .next {

   cursor: pointer;

   position: absolute;

   top: 50%;

   width: auto;

   padding: 16px;

   margin-top: -50px;

   color: white;

   font-weight: bold;

   font-size: 20px;

   transition: 0.6s ease;

   border-radius: 0 3px 3px 0;

   user-select: none;

   -webkit-user-select: none;

   }

   /* Position the "next button" to the right */

   .next {

   right: 0;

   border-radius: 3px 0 0 3px;

   }

   /* On hover, add a black background color with a little bit see-through */

   .prev:hover,

   .next:hover {

   background-color: rgba(0, 0, 0, 0.8);

   }

   /* Number text (1/3 etc) */

   .numbertext {

   color: #f2f2f2;

   font-size: 12px;

   padding: 8px 12px;

   position: absolute;

   top: 0;

   }

   /* Caption text */

   .caption-container {

   text-align: center;

   background-color: black;

   padding: 2px 16px;

   color: white;

   }

   img.demo {

   opacity: 0.6;

   }

   .active,

   .demo:hover {

   opacity: 1;

   }

   /*img.hover-shadow {

   transition: 0.3s;

   height: 100px;

   width: 100px;

   }*/

   .hover-shadow:hover {

   box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);

   }
   
   .modal {
        position: fixed!important;
        z-index: 1!important;
        padding-top: 100px!important;
        left: 0!important;
        top: 0!important;
        width: 100%!important;
        height: 100%!important;
        overflow: auto!important;
        background-color: #00000091!important;
    }
   
   .modal-content {
        position: relative!important;
        background-color: #fefefe!important;
        margin: auto!important;
        padding: 0!important;
        width: 1300px!important;
        max-width: 1300px!important;
        margin-left: -50px!important;
    }
    
    .btn-outline-primary {
        color: #ffffff!important;
        border-color: #ffffff!important;
    } 
    
    #makeDealModal table {
        color: black;
    }
    
    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    input[type="number"] {
        -moz-appearance: textfield; /* For Firefox */
    }
    
    .right-align{
        text-align:right!important;
    }
    
    .mt-7 {
        border: 1px solid black;
        margin-top: 7px;
    }
</style>

@endsection

@section('content')

<div class="page-breadcrumb">

   <div class="row">

      <div class="col-7 align-self-center">

         <h4 class="page-title text-truncate text-dark font-weight-medium mb-1">OBF Summary</h4>

         <div class="d-flex align-items-center">

            <nav aria-label="breadcrumb">

               <ol class="breadcrumb m-0 p-0">

                  <li class="breadcrumb-item"><a href="{{ route('dashboard') }}" class="text-muted">Dashboard</a></li>

                  <li class="breadcrumb-item"><a href="{{ route('obf') }}" class="text-muted">OBF</a></li>

                  <li class="breadcrumb-item text-muted active" aria-current="page">Summary</li>

               </ol>
    
            </nav>

         </div>

      </div>

      <div class="col-5 align-self-center">

        <div class="customize-input float-right">
            <!--@if(isset($make_deal_condition) && !empty($make_deal_condition))-->
            <!--    <a href="{{ route('obf.make-deal',['id' => base64_encode($data->id)]) }}"  class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" target="_blank">Make Deal Details</a>-->
            <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" onclick="openMakeDealModal('this')">Make Deal Details</button>
            <!--@endif--> 
            <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" onclick="openLogModal('this')">Log Details</button>
            <button class="btn waves-effect waves-light btn-rounded btn-outline-primary pull-right" onclick="printDiv('content-to-print')">Print Content</button>
        </div>

      </div>

   </div>

</div>

<!--Log Model Code -->
<div class="modal fade" id="logModal" role="dialog">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title" id="Cancel_module_title">Log Details</h3> 
                <button type="button" class="btn btn-outline-dark" data-bs-dismiss="modal" aria-label="Close">&times;</button>
            </div> 
            <div class="modal-body" style="max-height: 600px; overflow-y: auto; overflow-x: auto;">
                <div class="row">
                    <table class="table table-bordered table-striped">
                        <thead  style="color:black;">
                            <tr style="text-align:center;">
                                <th>No.</th>
                                <th>Designation</th>
                                <th>Name</th>
                                <th>Status</th>
                                <th>Remark</th>
                                <th>Date & Time</th>
                            </tr>
                        </thead>
                        <tbody  style="color:black;">
                            @if($logs_data->isNotEmpty())
                                @foreach($logs_data as $key => $val)
                                    <tr style="text-align:center;">
                                        <th>{{$key+1}}</th>
                                        <th>{{ucwords($val->designation)}}</th>
                                        <th>{{ucwords($val->logs_creator)}}</th>
                                        <th>{{ucwords(str_replace('_', ' ', $val->status))}}</th>
                                        <th>{{ucwords($val->remark)}}</th>
                                        <th>{{ \Carbon\Carbon::parse($val->created_at)->format('d-m-Y h:i A') }}</th>
                                    </tr>
                                @endforeach    
                            @else
                                <tr style="text-align:center;">
                                    <th colspan="6">Logs Not Created...</th>
                                </tr>
                            @endif     
                        </tbody>
                    </table>    
                </div>   
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<!--Make Deal Model Code -->
<div class="modal fade" id="makeDealModal" role="dialog">
    <div class="modal-dialog modal-xl">
        <div class="modal-content">
            <div class="modal-header">
                <h3 class="modal-title" id="Cancel_module_title">Make Deal Details</h3> 
                <button type="button" class="btn btn-outline-dark" data-bs-dismiss="modal" aria-label="Close">&times;</button>
            </div> 
            <div class="modal-body" style="max-height: 800px; overflow-y: auto; overflow-x: auto;">
                <div class="row">
                    <div class="col-md-12">
                        <table class="table table-bordered table-striped" style="color:black!important;">
                            <tr> 
                                <td colspan="6" class="text-center"><b>Reverse Calculation</b></td>
                            </tr>
                            <tr>
                                <td><b>Booking Date</b></td>
                                <td colspan="2">{!! \Carbon\Carbon::parse($make_deal_data->booking_date)->format('d-m-Y') !!}</td>
                                <td><b>KEC</b></td>
                                <td colspan="2">{!! $make_deal_data->sales_person_name !!}</td>
                            </tr>
                            <tr>
                                <td><b>Customer Name</b></td>
                                <td colspan="2">{!! $make_deal_data->customer_name !!}</td>
                                <td><b>TL</b></td>
                                <td colspan="2">{!! strtoupper($make_deal_data->team_name) !!}</td>
                            </tr>
                            <tr>
                                <td><b>Location (Branch)</b></td>
                                <td colspan="5">{!! strtoupper($make_deal_data->branch_name) !!}</td>
                            </tr>
                            <tr>
                                <td><b>Vin No.</b></td>
                                <td colspan="5">{!! $make_deal_data->vin_number !!}</td>
                            </tr>
                            <tr class="light_gray">
                                <td class="text-center"><b>{!! $make_deal_data->car_model_name !!}</b></td>
                                <td class="text-center"><b>Purchase Price</b></td>
                                <td class="text-center"><b>Aging Days</b></td>
                                <td class="text-center"><b>Remark</b></td>
                                <td class="text-center"><b>Ex Showroom Price</b></td>
                                <td class="text-center"><b>Deal</b></td>
                            </tr>
                            <tr>
                                <td><b>{!! $make_deal_data->car_varient_name !!}</b></td>
                                <td class="right-align purchase_price">{!! $make_deal_data->purchase_price !!}</td>
                                <td class="right-align">{!! $make_deal_data->aging_days !!}</td>
                                <td class="right-align">{!! $make_deal_data->remark !!}</td>
                                <td class="right-align ex_showroom_price">{!! $price_list_name_data->basic ?? 0 !!}</td>
                                <td class="right-align ex_showroom_price_deal">{{ $make_deal_data->deal_amt ?? 0 }}</td>
                                
                            </tr>
                            <tr>
                                <input type="hidden" name="gst_tax" id="hidden_gst_tax" value="{{ rtrim($price_list_name_data->gst_percentage, '.0') }}">
                                <td><b>GST @ {!! $price_list_name_data->gst_percentage !!}%</b></td>
                                <td class="right-align">{{ $make_deal_data->purchase_gst_tax_deal ?? 0 }}</td>
                                <td class="right-align gst_price" colspan="3">{!! $price_list_name_data->gst_amount !!}</td>
                                <td class="right-align gst_tax_deal">{{ $make_deal_data->gst_tax_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <input type="hidden" name="cess_tax" id="hidden_cess_tax" value="{{ rtrim($price_list_name_data->cess_percentage, '.0') }}">
                                <td><b>Cess @ {!! $price_list_name_data->cess_percentage !!}%</b></td>
                                <td class="right-align cess_price" colspan="4">{!! $price_list_name_data->cess_amount !!}</td>
                                <td class="right-align cess_tax_deal">{{ $make_deal_data->cess_tax_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <input type="hidden" name="tcs_tax_amt" id="hidden_tcs_tax_amt" value="{{ $make_deal_data->tcs_tax_id }}">
                                <input type="hidden" name="tcs_tax" id="hidden_tcs_tax" value="1">
                                <td><b>TCS @ 1%</b></td>
                                <td class="right-align tcs_price" colspan="4">{!! $make_deal_data->tcs_tax_id !!}</td>
                                <td class="right-align tcs_tax_deal">{{ $make_deal_data->tcs_tax_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td><b>Municipal Tax</b></td>
                                <td class="right-align municipal_price" colspan="4">{!! $make_deal_data->municipal_tax_id !!}</td>
                                <td class="right-align municipal_tax_deal">{{ $make_deal_data->municipal_tax_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td><b>Municipal Custom Handling Charges</b></td>
                                <td class="right-align municipal_custom_handling_charges" colspan="4">{!! $make_deal_data->municipal_custom_handling_charges !!}</td>
                                <td class="right-align municipal_custom_handling_charges_deal">{{ $make_deal_data->municipal_custom_handling_charges_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td><b>RTO</b></td>
                                <td class="right-align rto_price" colspan="4">{!! $make_deal_data->registration_tax_id !!}</td>
                                <td class="right-align rto_deal">{{ $make_deal_data->rto_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td><b>RTO Custom Handling Charges</b></td>
                                <td class="right-align rto_custom_handling_charges_price" colspan="4">{!! $make_deal_data->rto_custom_handling_charges ?? 0 !!}</td>
                                <td class="right-align rto_custom_handling_charges_deal">{{ $make_deal_data->rto_cutom_handling_charges_deal  ?? '' }}</td>
                            </tr>
                            <tr>
                                <td><b>INSURANCE</b></td>
                                <td class="right-align insurance_price" colspan="4">{!! $make_deal_data->insurance_id ?? 0 !!}</td>
                                <td class="right-align insurance_deal">{{ $make_deal_data->insurance_deal ?? 0 }}</td>
                            </tr>
                            <tr>
                                <td><b>Fastag</b></td>
                                <td class="right-align fastage_price" colspan="4">{!! $make_deal_data->fasttag_amount_new ?? 0 !!}</td>
                                <td class="right-align fastage_amt_deal">{!! $make_deal_data->fasttag_amount_new ?? 0 !!}</td>
                            </tr>
                            <tr>
                                <td><b>EW</b></td>
                                <td class="right-align extended_warranty" colspan="4">{!! $make_deal_data->extand_warranties_amount ?? 0!!}</td>
                                <td class="right-align ew_deal">{!! $make_deal_data->extand_warranties_amount ?? 0 !!}</td>
                            </tr>
                            <tr>
                                <td><b>Accessories</b></td>
                                <td class="right-align accessories_price" colspan="4">{!! $accessory_sum ?? 0 !!}</td>
                                <td class="right-align accessories_deal">{!! $accessory_sum ?? 0 !!}</td>
                            </tr>
                            <tr>
                                <td><b>Other Accessories</b></td>
                                <td class="right-align other_price" colspan="4">{!! $make_deal_data->other_accesssories_prise ?? 0 !!}</td>
                                <td class="right-align other_deal">{!! $make_deal_data->other_accesssories_prise ?? 0 !!}</td>
                            </tr>
                            <tr>
                                <td><b>
                                    {{ $make_deal_data->rsa_type == 'RSA' ? 'RSA' : ($make_deal_data->ccs_type == 'CCS' ? 'CCS' : 'RSA / CCS') }}
                                </b></td>
                            
                                <td class="right-align rsa_price" colspan="4">{!! $make_deal_data->rsa_amount ?? $make_deal_data->ccs_amount ?? 0 !!}</td>
                                <td class="right-align rsa_deal">{!! $make_deal_data->rsa_amount ?? $make_deal_data->ccs_amount ?? 0 !!}</td> 
                            </tr>
                            <tr>
                                <td><b>MCP</b></td>
                                <td class="right-align mcp_price" colspan="4">{!! $make_deal_data->mcp_amount ?? 0 !!}</td>
                                <td class="right-align mcp_deal">{!! $make_deal_data->mcp_amount ?? 0 !!}</td>
                            </tr>
                            <tr>
                                <td colspan="6"> </td>
                            </tr>
                            <tr class="light_gray">
                                <td><b>Total On Road Price</b></td>
                                <td class="right-align on_road_price" colspan="4"></td>
                                <td class="right-align on_road_price_deal"></td>
                            </tr>
                            <tr class="final-deal">
                                <td><b>Accepted Deal</b></td>
                                <td class="right-align final_deal_amt" colspan="4">{{ $make_deal_data->final_deal_amt ?? $make_deal_data->final_on_road_price_after_way_off }}</td>
                                <td class="right-align final_deal_deal">{!! $make_deal_data->final_deal_amt  ?? '' !!}</td>
                            </tr>
                            <tr>
                                <td><b>Difference</b></td>
                                <td class="right-align diff_amount" colspan="4"></td>
                                <td class="right-align diff_amount_deal"></td>
                            </tr>
                        </table>
                        
                        <table class="table table-bordered table-striped" style="color:black!important;margin-top:7px;">
                            <tr>
                                <td class="left-align" colspan="6"><b>Remark : </b>{{ $make_deal_data->remark ?? '' }}</td>
                            </tr>
                        </table>
                    </div> 
                </div>   
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>

<div class="container-fluid" id="content-to-print">

<div class="row">

   <div class="col-12">

      <div class="card">

         <div class="card-body">

            <div class="col-md-offset-3">

               <form role="form"  enctype="multipart/form-data">

                  <input type="hidden" name="id" value="{{ $data->id }}" >

                  <div class="row">

                     <div class="col-lg-12 ">

                        <div class="col-md-12">

                           <h3> Personal Details</h3>

                           <hr style="border:1px solid grey;">

                           <!--<div class="row">-->

                           <table style="width:100%;">

                              <tbody>

                                 <tr>

                                    <td> 

                                       <label class="control-label"><b>Booking Date</b></label>

                                    </td>

                                    <td> : </td>

                                    <td> 

                                       <span class="form-label">{{ date('d-m-Y',strtotime($data->booking_date)) ?? 'N/A' }}</span>

                                    </td>

                                    <div class="vl"></div>

                                    <td> 

                                       <label class="control-label"><b>Customer Name</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->customer_name ?? 'N/A' }}</span>

                                    </td>

                                    <!-- <input type="text"  name="customer_name" id="customer_name" class="form-control" placeholder="Enter Customer Name" value="{{ $data->customer_name ?? '' }}" disabled>

                                       <span class="kt-form__help error customer_name"></span> -->

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Branch</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->branch_name ?? 'N/A' }}</span>


                                    </td>

                                    <td>

                                       <label class="control-label"><b>RTO Type </b></label>

                                    </td>

                                    <td> : </td>

                                    <td>
                                        @php
                                            $customer_type = $data->customer_type;
                                            if ($customer_type == 'bh_parsing') {
                                                $rto_type = 'BH Passing';
                                            } else {
                                                $rto_type = ucwords(str_replace('_', ' ', $data->customer_type));
                                            }
                                       @endphp
                                       <span class="form-label">{{ $rto_type ?? 'N/A' }}</span> 

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Customer Type </b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->customer_type_nm ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Company Name </b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->company_name ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>E-Invoice Applicable</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ ucwords($data->einvoicing_applicable) ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>GST</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->gst ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Address Correspondence</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->address ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Registration Correspondence</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->registration ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>E-Mail</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->email ?? 'N/A' }}</span>

                                    </td>

                                    <td> 

                                       <label class="control-label"><b>Mobile Number</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->contact_number ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>PAN No</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->pan_number ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Aadhar No</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->adhar_number ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                <tr>

                                    <td>

                                       <label class="control-label"><b>Voter ID No</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->licance_number ?? 'N/A' }}</span>
                                    </td>

                                    <td>

                                       <label class="control-label"><b>Date of Birth</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->dob ? \Carbon\Carbon::parse($data->dob)->format('d-m-Y') : 'N/A' }}</span>

                                    </td>

                                </tr>

                                <tr>

                                    <td>

                                       <label class="control-label"><b>Nominee Name</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->nominee_name ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Nominee Relation</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->nominee_reletion ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Nominee Age</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->nominee_age ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Occupation</b></label>

                                    </td>

                                    <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->occupation ?? 'N/A' }}</span>

                                    </td>
                                    <tr>
                                        <td>
                                            <label class="control-label"><b>Nominee DOB</b></label>
                                        </td>
                                        <td> : </td>
                                        <td>

                                       <span class="form-label">{{ $data->nominee_dob ? \Carbon\Carbon::parse($data->nominee_dob)->format('d-m-Y') : 'N/A' }}</span>

                                    </td>
                                    
                                        <td>
                                            <label class="control-label"><b>Anniversary DOB</b></label>
                                        </td>
                                        <td> : </td>
                                        <td>
                                            <span class="form-label">{{ $data->anniversary_date ? \Carbon\Carbon::parse($data->anniversary_date)->format('d-m-Y') : 'N/A' }}</span>
                                        </td>
                    
                                    </tr>

                                 </tr>

                              </tbody>

                           </table>

                           <!--</div>-->

                        </div>

                     </div>

                  </div>

                  <hr style="border: 1px solid grey;">

                  <div class="row">

                     <div class="col-lg-12">

                        <div class="col-md-12">

                           <h3> Car Details</h3>

                           <hr style="border:1px solid grey;">
                           
                               <table style="width:100%;">
    
                                    <tbody>
    
                                        <tr>
                                            <td> 
        
                                               <label class="control-label"><b>Car Model</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td> 
        
                                               <span class="form-label">{{ $data->car_model_name ?? 'N/A' }}</span>
        
                                            </td>
        
                                            <td>
        
                                               <label class="control-label"><b>Sales Person Name</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td> 
        
                                               <span class="form-label">{{ $data->sales_person_name ?? 'N/A' }}</span>
        
                                            </td>
        
                                        <tr>

                                            <td>
        
                                               <label for="veriant"><b>Car Variant</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{ $data->car_varient_name ?? 'N/A' }}</span>
        
                                            </td>
                                            
                                            <td>
        
                                               <label for="veriant"><b>Team Leader Name</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{ $data->team_name ?? 'N/A' }}</span>
        
                                            </td>
        
                                        </tr>
                                        <tr>

                                            <td>
        
                                               <label for="exterior_color"><b>Exterior Color</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{ $data->exteriorcolor_name ?? 'N/A' }}</span>
        
                                            </td>
                                            
                                            <td>

                                               <label for="fule_type"><b>Fuel Type</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{ $fule->fule_name ?? 'N/A' }}</span>  
        
                                            </td>
                                        </tr>    
                                        <tr>
                                            <td>

                                               <label for="interior_color"><b>Interior Color</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{$data->interiorcolor_name ?? 'N/A' }}</span>
        
                                            </td>
                                            
                                            <td>

                                               <label for="interior_color"><b>Key Number</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{$data->key_number ?? 'N/A' }}</span>
        
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>

                                               <label for="interior_color"><b>VIN Number</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{$data->vin_number ?? 'N/A' }}</span>
        
                                            </td>
                                            <td>

                                               <label for="interior_color"><b>MFG Year</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{$data->manufacturing_year ?? 'N/A' }}</span>
        
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>

                                               <label for="interior_color"><b>Engine Number</b></label>
        
                                            </td>
        
                                            <td> : </td>
        
                                            <td>
        
                                               <span class="form-label">{{$data->engine_number ?? 'N/A' }}</span>
        
                                            </td>
                                            <td>
                                                <label class="control-label"><b>Remarks</b></label>
                                            </td>
                                            <td> : </td>
                                            <td>
    
                                               <span class="form-label">{{ $data->step1_remarks ?? 'N/A' }}</span>
        
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>    

                           <!--<div class="row">-->

                           <table style="width:100%;">

                                <tbody>
                                    <table border="1" cellspacing="0" cellpadding="8" style="width: 100%; background-color:#313761; margin-top:5px;">
                                    <thead>
                                       <tr>
                                             <th colspan="2">On Road Price</th>
                                       </tr>
                                    </thead>
                                 </table>  
                                 
                                 <div style="display: flex; justify-content: space-between; width: 100%; gap: 10px; margin-top:15px;"> 
                                    <!-- Left Table -->
                                    <table border="1" class="left-table" cellspacing="0" cellpadding="8" style="width: 60%; line-height: 1.1; background-color:rgb(155, 229, 229);color:black;">
                                       <tbody>
                                          @php
                                            $on_road_price = $data->on_road_price ?? 0;
                                            $total_discount = $data->offer_amount ?? 0;
                                        
                                            $total_payment_received = 
                                                ($data->booking_amount ?? 0) + 
                                                ($data->dp_amount ?? 0) + 
                                                ($data->net_disbusment ?? 0) + 
                                                ($data->total_exchange_amount ?? 0);
                                        
                                            $finance_dis = 
                                                ($data->offer_ib_amount ?? 0) + 
                                                ($data->offer_kin_amount ?? 0) + 
                                                ($data->finance_discount ?? 0) + 
                                                ($data->way_off ?? 0) + 
                                                ($data->tl_discount ?? 0) + 
                                                ($data->sm_discount ?? 0) + 
                                                ($data->gm_discount ?? 0) + 
                                                ($data->bh_discount ?? 0) + 
                                                ($data->ceo_discount ?? 0) + 
                                                ($data->md_discount ?? 0) + 
                                                ($data->foc_accessories ?? 0);
                                        
                                            $due_amount = $on_road_price - $total_payment_received - $finance_dis;
                                        
                                            $total_ofr_discount = 
                                                ($data->offer_ib_amount ?? 0) + 
                                                ($data->offer_kin_amount ?? 0) + 
                                                ($data->exchange_bonus ?? 0) + 
                                                ($data->finance_discount ?? 0) + 
                                                ($data->way_off ?? 0) + 
                                                ($data->tl_discount ?? 0) + 
                                                ($data->sm_discount ?? 0) + 
                                                ($data->gm_discount ?? 0) + 
                                                ($data->bh_discount ?? 0) + 
                                                ($data->ceo_discount ?? 0) + 
                                                ($data->md_discount ?? 0) + 
                                                ($data->foc_accessories ?? 0);
                                        
                                            $final_total = $on_road_price - $total_ofr_discount;
                                        
                                            $total_accessories = 
                                                ($accessory_sum ?? 0) + 
                                                ($data->other_accesssories_prise ?? 0);
                                        
                                            $rto_tax = 
                                                ($data->registration_tax_id ?? 0) + 
                                                ($data->rto_custom_handling_charges ?? 0);
                                          @endphp
                                          <tr style="line-height: 1.5;"><td>Ex Showroom</td><td>{{ $data->ex_showroom_price ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 1.3;"><td>TCS 1% (5% if Link Status No.)</td><td>{{ $data->tcs_tax_id ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 3.8;"><td>RTO (6%/12%/5%)</td><td>{{ $rto_tax }}</td></tr>
                                          <tr style="line-height: 1.5;"><td>Municipal Tax</td><td>{{ $data->municipal_tax_id ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 1.5;"><td>Municipal Custom Handling Charges</td><td>{{ $data->municipal_custom_handling_charges ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 3.9;"><td>Insurance</td><td>{{ $data->insurance_id ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 1.3;"><td>Road Side Assist</td><td>{{ $data->rsa_amount ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 1.5;"><td>CCS</td><td>{{ $data->ccs_amount ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 1.4;"><td>Extended Warranty</td><td>{{ $data->extand_warranties_amount ?? 'N/A' }}</td></tr>
                                          <tr style="line-height: 1.4;"><td>MCP / MCP +</td><td></td></tr>
                                          <tr style="line-height: 1.4;"><td>Fastag</td><td>{{ $data->brand_name ?? 'N/A' }}</td></tr>
                                          <tr><td>Accessories</td><td>{{$total_accessories ?? '0'}}</td></tr>
                                          <tr><td>Other_1</td><td>{{ $data->other_one_name ?? 'N/A' }}</td></tr>
                                          <tr><td>Other_2</td><td>{{ $data->other_two_name ?? 'N/A' }}</td></tr>
                                          <tr><td><strong>On Road Price (A)</strong></td><td><strong>{{ $data->on_road_price ?? 'N/A' }}</strong></td></tr>
                                          <tr style="background-color:#f0b7ed"><td>Less: Total Discount (B)</td><td>{{ $total_ofr_discount ?? 'N/A' }}</td></tr>
                                          <tr><td><strong>Final Deal On Road (A - B = C)</strong></td><td><strong>{{$final_total}}</strong></td></tr>
                                          <tr style="background-color: white; border-right:none; "><td></td><td></td></tr>
                                          <tr><th colspan="2" style="background-color:#9ca6ec;"><b>Customer Payment Status<b></th></tr>
                                          <tr style="background-color:#9ca6ec;"><td>Booking Amt.</td><td>{{ $data->booking_amount ?? 'N/A' }}</td></tr>
                                          <tr style="background-color:#9ca6ec;"><td>Down Payment</td><td>{{ $data->dp_amount ?? 'N/A' }}</td></tr>
                                          <tr style="background-color:#9ca6ec;"><td>Finance Disb. Amt.</td><td>{{$data->net_disbusment ?? 'N/A'}}</td></tr>
                                          <tr style="background-color:#9ca6ec;"><td>Exchange Amt.</td><td>{{ $data->total_exchange_amount ?? 'N/A' }}</td></tr>
                                          <tr style="background-color:#9ca6ec;"><td><strong>Total Payment Received (D)</strong></td><td><strong>{{ $total_payment_received }}</strong></td></tr>
                                          <tr style="background-color:#9ca6ec;"><td><strong>Due Amount (+)/Refund (-) (C - D)</strong></td><td><strong>{{$due_amount}}</strong></td></tr>
                                       </tbody>
                                    </table>

                                    <!-- Right Table -->
                                    <table border="1" cellspacing="0" cellpadding="8" style="width: 40%; background-color:#e2e97d; color:black;">
                                       <tbody>
                                           @php
                                                $customer_type = $data->customer_type;
                                                if ($customer_type == 'bh_parsing') {
                                                    $rto_type = 'BH Passing';
                                                } else {
                                                    $rto_type = ucwords(str_replace('_', ' ', $data->customer_type));
                                                }
                                           @endphp
                                          <tr><td>Price List</td><td>{{ $price_list_name[0]->price_list_name ?? 'N/A' }}</td></tr>
                                          <tr><td>Adhar/Pan Link Status</td><td>{{ucwords($data->aadhar_pan_link)}}</td></tr>
                                          <tr><td>RTO Type</td><td>{{ $rto_type ?? 'N/A' }}</td></tr>
                                          <tr><td>Customer Type</td><td>{{ ucwords($data->customer_type_nm) ?? 'N/A' }}</td></tr>
                                          <tr><td>Customer Address</td><td>RMC ({{ ucwords(str_replace('_', '-', $data->municipal_tax_type)) }})</td></tr>
                                          <tr><td colspan="2">{{$data->registration}}</td></tr>
                                          <tr><td>Insurance Company</td><td>{{ $ObfInsurance->company_name ?? 'N/A' }}</td></tr>
                                          <tr><td>Insurance Remark</td><td>{{ $data->step3_remarks ?? 'N/A' }}</td></tr>
                                          <tr><td>Package (RSA)</td><td>{{ $data->rsa_name ?? 'N/A' }}</td></tr>
                                          <tr><td>Package (CCS)</td><td>{{ $data->ccs_name ?? 'N/A' }}</td></tr>
                                          <tr><td>Package (EW)</td><td>{{ $data->extand_warranties_years}}</td></tr>
                                          <tr><td>Package (MCP)</td><td></td></tr>
                                          <tr><td>Fastag Com. Name</td><td>{{ $data->brand_name ?? 'N/A' }}</td></tr>
                                          <tr style="background-color: white; border-right:none; "><td></td><td></td></tr>
                                          <tr style="background-color:#f0b7ed"><th colspan="2">Discount Breakdown</th></tr>
                                          <tr style="background-color:#f0b7ed"><td>Shimav Kia Offer</td><td>{{ $data->offer_ib_amount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>KIN Offer</td><td>{{ $data->offer_kin_amount ?? '0' }}</td></tr>
                                          <!--<tr style="background-color:#f0b7ed"><td>Exchange Bonus</td><td>{{ $data->exchange_bonus ?? '0' }}</td></tr>-->
                                          <tr style="background-color:#f0b7ed"><td>Finance Disc</td><td>{{ $data->finance_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>FOC Accessories</td><td>{{ $data->foc_accessories ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>KEC Discount</td><td>{{ $data->way_off ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>TL Discount</td><td>{{ $data->tl_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>SM Discount</td><td>{{ $data->sm_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>GM Discount</td><td>{{ $data->gm_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>BH Discount</td><td>{{ $data->bh_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>C.E.O Discount</td><td>{{ $data->ceo_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td>MD Discount</td><td>{{ $data->md_discount ?? '0' }}</td></tr>
                                          <tr style="background-color:#f0b7ed"><td><strong>Total Discount (B)</strong></td><td><strong>{{$total_ofr_discount}}</strong></td></tr>
                                          <tr style="background-color: white; border-right:none; "><td></td><td></td></tr>
                                          <tr style="background-color:#77adcc"><td>Bank Name</td><td>{{ $data->finance_name }}</td></tr>
                                          <tr style="background-color:#77adcc"><td>Finance By</td><td>{{ ucwords(str_replace("_", " ", $data->finance_type))}}</td></tr>
                                          <tr style="background-color:#77adcc"><td>Exchange Car Name</td><td>{{ $data->trade_car_name }}</td></tr>
                                       </tbody>
                                    </table>
                                 </div>
                                </tbody>

                           </table>

                           <!-- </div>-->

                        </div>

                     </div>

                  </div>

                  <hr style="border: 1px solid white;">

                  <div class="row">

                     <div class="col-lg-12 ">

                        <div class="col-md-12">

                           <h3> Finance Details</h3>

                           <hr style="border:1px solid grey;"> 

                           <!-- <div class="row">-->

                           <table style="width:100%;">

                            

                              <tbody>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Finance Required</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{ucwords($data->finance_required)}} </td>

                                    <div class="vl3"></div>

                                    <td>

                                       <label class="control-label"><b>Finance</b></label>

                                    </td>

                                     <td> : </td>

                                    <td> 

                                       <span class="form-label">{{ $data->finance_name ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 @if($is_finance_display_filds == 1)

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Repo Rate</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->repo_rate ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Net Disbusment Amount</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->net_disbusment ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Loan Amount</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->loan_amount ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Processing Fee</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ $data->processing_fee ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Finance Discount</b></label>

                                    </td>

                                     <td> : </td>

                                    <td> 

                                       <span class="form-label">{{ $data->finance_discount ?? 'N/A' }}</span>

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Payout</b></label>

                                    </td>

                                     <td> : </td>

                                    <td> 

                                       <span class="form-label">{{ $data->payout ?? 'N/A' }}</span>

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Pay Booster</b></label>

                                    </td>

                                     <td> : </td>

                                    <td> 

                                        {{ucwords($data->pay_booster)}}

                                    </td>

                                    @if(!empty($Inventory_data))

                                    <td>

                                       <label class="control-label"><b>Allocation Date</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ date('d-m-Y',strtotime($Inventory_data->updated_at)) ?? 'N/A' }}</span>

                                       <!-- <input type="text" class="form-control" value="{{ date('d-m-Y',strtotime($Inventory_data->updated_at)) ?? '' }}" disabled="disabled"> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Aging Days</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ now()->diffInDays($Inventory_data->kin_invoice_date) ?? '' }}</span>

                                       <!--  <input type="text" class="form-control" value="{{ now()->diffInDays($Inventory_data->kin_invoice_date) ?? '' }}" disabled="disabled"> -->

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Kin Invoice Date</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>

                                       <span class="form-label">{{ date('d-m-Y',strtotime($Inventory_data->kin_invoice_date)) ?? 'N/A' }}</span>

                                       <!-- <input type="text" class="form-control" value="{{ date('d-m-Y',strtotime($Inventory_data->kin_invoice_date)) ?? '' }}" disabled="disabled"> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Allocation Count:</b></label>

                                       <span class="form-label">{{ $Inventory_data->allocation_count ?? 'N/A' }}</span>

                                       <!-- <input type="text" class="form-control" value="{{ $Inventory_data->allocation_count ?? '' }}" disabled="disabled"> -->

                                    </td>

                                    @endif
                                    <td>

                                       <label class="control-label"><b>Disbursement Field</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{ucwords($data->disbursement)}} </td>
                                 </tr>
                                 <tr>
                                    <td>

                                       <label class="control-label"><b>Finance Type</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{ucwords(str_replace('_', ' ', $data->finance_type))}} </td>
                                    
                                    <td>

                                       <label class="control-label"><b>Payout Amount</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{$data->payout_amount}} </td>
                                 </tr>
                                 <tr>
                                    
                                    <td>

                                       <label class="control-label"><b>Lumsum Amount</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{$data->lumsum_amount}} </td>
                                    
                                    <td>

                                       <label class="control-label"><b>Total Payout</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{$data->total_payout_amount}} </td>
                                 </tr>
                                 <tr>
                                    <td>

                                       <label class="control-label"><b>Remarks</b></label>

                                    </td>

                                     <td> : </td>

                                    <td>{{$data->step2_remarks ?? 'N/A'}} </td>
                                 </tr>

                              </tbody>

                           </table>

                           <!--  </div>-->

                        </div>

                     </div>

                  </div>

                  @endif

                  <hr style="border: 1px solid black;">

                  <div class="row">

                     <div class="col-lg-12 ">

                        <div class="col-md-12">

                           <h3> Insurance Details</h3>

                           <!-- <div class="row">-->

                            <hr style="border:1px solid grey;">

                           <table style="width:100%;">

                              <tbody>

                                 <tr>

                                    <input type="hidden" name="obf_insurance_id" value="{{ $ObfInsurance->id ?? '' }}">

                                    <td>

                                       <label class="control-label"><b>Insurance</b></label>

                                    </td>

                                    <td> :</td>

                                    <td> 
                                        @if(isset($ObfInsurance) && !empty($ObfInsurance))
                                            @if($ObfInsurance->insurance_exist == 1) Yes 
                                            @else if($ObfInsurance->insurance_exist == 2) No
                                            @endif
                                        @else 
                                            No
                                        @endif
                                    </td>

                                    <div class="vl4"></div>

                                    @php                                            

                                    $ncb = '';

                                    if(isset($ObfInsurance->ncb) && $ObfInsurance->ncb != null){

                                    $ncb = $ObfInsurance->ncb;

                                    }

                                    @endphp

                                    <td>

                                       <label class="control-label"><b>NCB - No Claim Bonus</b></label>

                                    </td>

                                    <td> :</td>

                                    <td> 

                                        @if($ncb =='yes' || $ncb == '') Yes @endif

                                        @if($ncb == 'no') No @endif


                                    </td>

                                 </tr>

                                 <tr>

                                    @php                                            

                                    $documents = [];

                                    if(isset($ObfInsurance->documents) && $ObfInsurance->documents != null){

                                    $documents = $ObfInsurance->documents;

                                    }

                                    @endphp

                                    <!-- <td class="insurance_exist_c">

                                       <!--<div id="myModal2" class="modal">

                                          <span class="close cursor" onclick="closeModal2()">&times;</span>

                                          <div class="modal-content">

                                             <img class="image_set" src="" style="width:100%;height:470px;">

                                          </div>

                                          </div>  -->  

                                       <!--<div class="row">->

                                       <p><b>Upload Document:</b></p>

                                    </td> -->

                                    <!-- <td>

                                       <!-- <div id="documents_multi">->

                                       <?php

                                          if(!empty($documents))

                                          {

                                              $other_documents_arr = explode(',', $documents);

                                              foreach ($other_documents_arr as $value) {

                                                  if(file_exists(public_path('/uploads/kyc/'.$value))) { ?>

                                       <img src="{{asset('uploads/kyc/'. $value )}}" class="hover-shadow2">

                                       <?php }

                                          }

                                          }

                                          ?>

                                       <!--</div>->

                                    </td> -->

                                    <!--</div>  -->                                         

                                    <!-- </td> -->

                                    <td>

                                       <label class="control-label"><b>Date of Insurance</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $ObfInsurance->date_of_insurance ?? 'N/A' }}</span>

                                       <!-- <input type="date"  name="date_of_insurance" id="date_of_insurance" class="form-control" placeholder="Date Of Insurance" value="{{ $ObfInsurance->date_of_insurance ?? '' }}" disabled>

                                          <span class="kt-form__help error date_of_insurance"></span> -->

                                    </td>

                                 

                                    <td>

                                       @php                                            

                                       $time_of_insurance = '';

                                       if(isset($ObfInsurance->time_of_insurance) && $ObfInsurance->time_of_insurance != null){

                                       $time_of_insurance = $ObfInsurance->time_of_insurance;

                                       }

                                       @endphp

                                       <label class="control-label"><b>Time of Insurance</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $ObfInsurance->time_of_insurance ?? 'N/A' }}</span>

                                       <!--  <select name="time_of_insurance" id="time_of_insurance" class="form-control" disabled>

                                          <option value="" selected disabled>Please Select Year</option>

                                          <option value="1" @if($time_of_insurance == '1') selected @endif>1 Year</option>

                                          <option value="3" @if($time_of_insurance == '3') selected @endif>3 Year</option>

                                          

                                          </select>

                                          <span class="kt-form__help error time_of_insurance"></span> -->

                                    </td>

                                    </tr>

                                    <tr>



                                    <td>

                                       <label class="control-label"><b>Last Date of Insurance</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $ObfInsurance->last_time_of_insurance ?? '' }}</span>

                                       <!-- <input type="text" name="last_time_of_insurance" id="last_time_of_insurance" value="{{ $ObfInsurance->last_time_of_insurance ?? '' }}" hidden>

                                          <input type="text"  name="last_time_of_insurance1" id="last_time_of_insurance1" class="form-control" placeholder="last time of insurance" value="{{ $ObfInsurance->last_time_of_insurance ?? '' }}" disabled>

                                          <span class="kt-form__help error last_time_of_insurance1"></span> -->

                                    </td>

                                

                                    <td>

                                       <label class="control-label"><b>Company Name</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $ObfInsurance->company_name ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="insurance_company_name" id="insurance_company_name" class="form-control" placeholder="Enter Company Name" value="{{ $ObfInsurance->company_name ?? '' }}" disabled>

                                          <span class="kt-form__help error insurance_company_name"></span> -->

                                    </td>

                                     </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Amount</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $ObfInsurance->ncb_amount ?? 'N/A' }}</span>

                                       <!-- <input type="number"  name="ncb_amount" id="ncb_amount" class="form-control" placeholder="Enter NCB Amount" value="{{ $ObfInsurance->ncb_amount ?? '' }}" disabled>

                                          <span class="kt-form__help error ncb_amount"></span> -->

                                    </td>

                                 

                                    <td>

                                       <label class="control-label"><b>Policy Number</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $ObfInsurance->policy_number ?? 'N/A' }}</span>

                                       <!--  <input type="text"  name="policy_number" id="policy_number" class="form-control" placeholder="Enter Policy Number" value="{{ $ObfInsurance->policy_number ?? '' }}" disabled>

                                          <span class="kt-form__help error policy_number"></span> -->

                                    </td>
                                    

                                    </tr>

                                 <tr>

                                    <!--<div class="form-group col-md-6 insurance_exist_c"></div>-->

                                    <td>

                                       @php                                            

                                       $insurance_status = '';

                                       if(isset($ObfInsurance->insurance_status) && $ObfInsurance->insurance_status != null){

                                       $insurance_status = $ObfInsurance->insurance_status;

                                       }

                                       @endphp

                                       <label class="control-label"><b>Status</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                       @if($insurance_status == '1' || $insurance_status == '')  

                                       Activate

                                       @endif

                                       @if($insurance_status == '0')  

                                       Deactivate

                                       @endif

                                       </span>

                                       <!-- <select name="insurance_status" id="insurance_status" class="form-control" disabled>

                                          <option value="1" @if($insurance_status == '1' || $insurance_status == '') selected @endif>Activate</option>

                                          <option value="0" @if($insurance_status == '0') selected @endif>Deactivate</option>

                                          </select>

                                          <span class="kt-form__help error rto_type"></span> -->

                                    </td>

                                 </tr>
                                 
                                 
                                 <tr>

                                    <td>

                                     

                                       <label class="control-label"><b>Tyer 1</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                      {{ $ObfInsurance->tyre_no1 ?? 'N/A' }}
                                       </span>

                                    

                                    </td>
                                     <td>

                                     

                                       <label class="control-label"><b>Tyer 2</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                      {{ $ObfInsurance->tyre_no2 ?? 'N/A' }}
                                       </span>

                                    

                                    </td>
                                    
                                    

                                 </tr>
                                 <tr>
                                     
                                     <td>

                                     

                                       <label class="control-label"><b>Tyer 3</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                      {{ $ObfInsurance->tyre_no3 ?? 'N/A' }}
                                       </span>

                                    

                                    </td>
                                    <td>

                                     

                                       <label class="control-label"><b>Tyer 4</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                      {{ $ObfInsurance->tyre_no4 ?? 'N/A' }}
                                       </span>

                                    

                                    </td>
                                 </tr>
                                 <tr>
                                     <td>

                                     

                                       <label class="control-label"><b>Tyer 5</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                      {{ $ObfInsurance->tyre_no5 ?? 'N/A' }}
                                       </span>

                                    

                                    </td>
                                    <td>

                                     

                                       <label class="control-label"><b>Remarks</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->step3_remarks ?? 'N/A' }}</span>

                                    </td>
                                 </tr>

                                 <!--<tr>

                                    <td>

                                       <a href="{{url('policy_list/'.$data->id)}}" name="insurance_policy1" id="insurance_policy1" class="btn btn-primary btn-sm"> View All Insurance Policy</a>

                                    </td>  

                                    </tr>-->

                              </tbody>

                           </table>

                           <!--  <div class="form-group col-md-6">

                              <label class="control-label">Remarks</label>

                              <textarea  name="step3_remarks" id="step3_remarks" class="form-control" placeholder="Enter Remarks" disabled>{{ $data->step3_remarks ?? '' }}</textarea>

                              <span class="kt-form__help error step3_remarks"></span>

                              </div> -->

                           <!--</div>-->

                        </div>

                     </div>

                  </div>

                  <hr style="border: 1px solid black;">

                  <div class="row">

                     <div class="col-lg-12 ">

                        <div class="col-md-12">

                           <h3> RTO Details</h3>

                            <hr style="border:1px solid grey;">

                           <!--<div class="row">-->

                           <table style="width:100%;">

                           

                              <tbody>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>RTO Type</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">

                                        {{ucwords(str_replace('_', ' ', $data->rto_type))}}

                                      <!--  @if($data->rto_type == 'sales_rto') Sales RTO @endif

                                       @if($data->rto_type == 'in_house') In house RTO @endif -->

                                       </span>

                                       <!-- <select name="rto_type" id="rto_type" class="form-control" readonly>

                                          <option value="">Select RTO TYPE</option>

                                          <option value="sales_rto" @if($data->rto_type == 'sales_rto') selected @endif>Sales RTO</option>

                                          <option value="in_house" @if($data->rto_type == 'in_house') selected @endif>In house RTO</option>

                                          </select>

                                          <span class="kt-form__help error rto_type"></span> -->

                                    </td>

                                    <div class="vl5"></div>

                                    <td>

                                       <label class="control-label"><b>Registration Date</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->registration_date ?? 'N/A' }}</span>

                                       <!-- <input type="date"  name="registration_date" id="registration_date" class="form-control" value="{{ $data->registration_date ?? '' }}" readonly>

                                          <span class="kt-form__help error registration_date"></span> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Application Number</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->application_number ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="application_number" id="application_number" class="form-control" placeholder="Application Number" value="{{ $data->application_number ?? '' }}" readonly>

                                          <span class="kt-form__help error application_number"></span> -->

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Temporary Number</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->temporary_number ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="temporary_number" id="temporary_number" class="form-control" placeholder="Temporary Number" value="{{ $data->temporary_number ?? '' }}" readonly>

                                          <span class="kt-form__help error temporary_number"></span> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Final amount</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->final_amount ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="final_amount" id="final_amount" class="form-control" placeholder="Final Amount" value="{{ $data->final_amount ?? '' }}" readonly>

                                          <span class="kt-form__help error final_amount"></span> -->

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Vehicle Number</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->vehicle_number ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="vehicle_number" id="vehicle_number" class="form-control" placeholder="Add Vehicle Number" value="{{ $data->vehicle_number ?? '' }}" readonly>

                                          <span class="kt-form__help error vehicle_number"></span> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Status</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       @if($data->rto_status == '1') Activate @endif

                                       @if($data->rto_status != '1') Deactivate @endif

                                       <!-- <select name="rto_status" id="rto_status" class="form-control">

                                          <option value="1" @if($data->rto_status == '1') selected @endif>Activate</option>

                                          <option value="0" @if($data->rto_status != '1') selected @endif>Deactivate</option>

                                          </select>

                                          <span class="kt-form__help error rto_type"></span> -->

                                    </td>
                                    <td>

                                       <label class="control-label"><b>Number Plate</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->number_plate ?? '' }}</span>
                                    </td>

                                 </tr>
                                 <tr>
                                     <td>

                                       <label class="control-label"><b>Remarks</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->step4_remarks ?? 'N/A' }}</span>

                                    </td>
                                 </tr>

                              </tbody>

                           </table>

                           <!--<div class="form-group col-md-6">-->

                           <!--    <label class="control-label">Status</label>-->

                           <!--    <input type="text"  name="registration_tax" id="registration_tax" class="form-control" value="Active" readonly>-->

                           <!--    <span class="kt-form__help error registration_tax"></span>-->

                           <!--</div>-->

                           <!--</div>-->

                        </div>

                     </div>

                  </div>

                  <hr style="border: 1px solid black;">

                  <div class="row">

                     <div class="col-lg-12 ">

                        <div class="col-md-12">

                           <h3> Fasttag Details</h3>

                           <hr style="border:1px solid grey;">

                           <!--<div class="row">-->

                           <table style="width:100%;">

                            

                              <tbody>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Fasttag number</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->fasttag_number ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="fasttag_number" id="fasttag_number" class="form-control" placeholder="Fasttag number"value="{{ $data->fasttag_number ?? '' }}" readonly>

                                          <span class="kt-form__help error fasttag_number"></span> -->

                                    </td>

                                    <div class="vl6"></div>

                                    <td>

                                       <label class="control-label"><b>Brand</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->fasttag_brand ?? 'N/A' }}</span>

                                       <!-- <input type="text"  name="fasttag_brand" id="fasttag_brand" class="form-control" placeholder="Brand" value="{{ $data->fasttag_brand ?? '' }}" readonly>

                                          <span class="kt-form__help error fasttag_brand"></span> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Date of issue</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ date('d-m-Y',strtotime($data->date_of_issue)) ?? 'N/A' }}</span>

                                       <!-- <input type="date"  name="date_of_issue" id="date_of_issue" class="form-control" value="{{ $data->date_of_issue ?? '' }}" readonly>

                                          <span class="kt-form__help error date_of_issue"></span> -->

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Amount</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->fasttag_amount ?? 'N/A' }}</span>

                                       <!-- <input type="number"  name="fasttag_amount" id="fasttag_amount" class="form-control" placeholder="Amount" value="{{ $data->fasttag_amount ?? '' }}" readonly>

                                          <span class="kt-form__help error fasttag_amount"></span> -->

                                    </td>

                                 </tr>

                                 <tr>

                                    <td>

                                       <label class="control-label"><b>Opening stock</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->opening_stock ?? 'N/A' }}</span>

                                       <!-- <input type="number"  name="opening_stock" id="opening_stock" class="form-control" placeholder="Stock" value="{{ $data->opening_stock ?? '' }}" readonly>

                                          <span class="kt-form__help error opening_stock"></span> -->

                                    </td>

                                    <td>

                                       <label class="control-label"><b>Status</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       @if($data->fasttag_status == '1') Activate @endif

                                       @if($data->fasttag_status != '1') Deactivate @endif

                                       <!-- <select name="fasttag_status" id="fasttag_status" class="form-control">

                                          <option value="1" @if($data->fasttag_status == '1') selected @endif>Activate</option>

                                          <option value="0" @if($data->fasttag_status != '1') selected @endif>Deactivate</option>

                                          </select>

                                          <span class="kt-form__help error rto_type"></span> -->

                                    </td>

                                 </tr>
                                 <tr>
                                     <td>

                                       <label class="control-label"><b>Remarks</b></label>

                                    </td>

                                    <td> :</td>

                                    <td>

                                       <span class="form-label">{{ $data->step5_remarks ?? 'N/A' }}</span>

                                    </td>
                                 </tr>

                              </tbody>

                           </table>

                           <!--</div>-->

                        </div>

                     </div>

                  </div>



               </form>



            </div>

         </div>

      </div>

   </div>

</div>

</div>
@endsection

@section('scripts')
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>

    <script>
        function openLogModal() {
            $('#logModal').modal('show');
            setTimeout(function () {
                $('.modal-backdrop').remove();
            }, 300);
        }
        
        function openMakeDealModal() { 
            $('#makeDealModal').modal('show');
            setTimeout(function () {
                $('.modal-backdrop').remove();
            }, 300);
        }
        
        jQuery(document).ready(function(){
            //For GST Calculation For Purchase Price
            var purchase_price = parseFloat(jQuery('.purchase_price').text().replace(/,/g, '')) || 0;
            var hidden_gst_tax = parseFloat(jQuery('#hidden_gst_tax').val()) || 0;
            var purchase_gst_calculation = purchase_price * hidden_gst_tax / 100;
            purchase_gst_calculation = Math.round(purchase_gst_calculation);
            jQuery('#purchase_gst_tax_deal').val(purchase_gst_calculation);

            //For Get Total On Road Price With Extended Warranty
            var ex_showroom_price = parseFloat(jQuery('.ex_showroom_price').text().replace(/,/g, '')) || 0;
            var gst_price = parseFloat(jQuery('.gst_price').text().replace(/,/g, '')) || 0;
            var cess_price = parseFloat(jQuery('.cess_price').text().replace(/,/g, '')) || 0;
            var tcs_price = parseFloat(jQuery('.tcs_price').text().replace(/,/g, '')) || 0;
            var municipal_price = parseFloat(jQuery('.municipal_price').text().replace(/,/g, '')) || 0;
            var municipal_custom_handling_charges = parseFloat(jQuery('.municipal_custom_handling_charges').text().replace(/,/g, '')) || 0;
            var rto_price = parseFloat(jQuery('.rto_price').text().replace(/,/g, '')) || 0;
            var rto_custom_handling_charges_price = parseFloat(jQuery('.rto_custom_handling_charges_price').text().replace(/,/g, '')) || 0;
            var insurance_price = parseFloat(jQuery('.insurance_price').text().replace(/,/g, '')) || 0;
            var fastage_price = parseFloat(jQuery('.fastage_price').text().replace(/,/g, '')) || 0;
            var extended_warranty = parseFloat(jQuery('.extended_warranty').text().replace(/,/g, '')) || 0;
            var accessories_price = parseFloat(jQuery('.accessories_price').text().replace(/,/g, '')) || 0;
            var rsa_price = parseFloat(jQuery('.rsa_price').text().replace(/,/g, '')) || 0;
            var mcp_price = parseFloat(jQuery('.mcp_price').text().replace(/,/g, '')) || 0;
            var other_price = parseFloat(jQuery('.other_price').text().replace(/,/g, '')) || 0;

            var final_on_road_price = ex_showroom_price + gst_price + cess_price + tcs_price + municipal_price + municipal_custom_handling_charges + rto_price + rto_custom_handling_charges_price + insurance_price + fastage_price + extended_warranty + accessories_price + rsa_price + mcp_price + other_price;
            jQuery('.on_road_price').text(final_on_road_price.toLocaleString());


            var on_road_price = parseFloat(jQuery('.on_road_price').text().replace(/,/g, '')) || 0;
            var final_deal_amt = parseFloat(jQuery('.final_deal_amt').text().replace(/,/g, '')) || 0;
            var difference = on_road_price - final_deal_amt;
            jQuery('.diff_amount').text(difference.toLocaleString());

            jQuery('.final_deal_deal').text(final_deal_amt);
            
            
            var ex_showroom_price_deal = parseFloat(jQuery('.ex_showroom_price_deal').text().replace(/,/g, '')) || 0;
            var gst_tax_deal = parseFloat(jQuery('.gst_tax_deal').text().replace(/,/g, '')) || 0;
            var cess_tax_deal = parseFloat(jQuery('.cess_tax_deal').text().replace(/,/g, '')) || 0;
            var tcs_tax_deal = parseFloat(jQuery('.tcs_tax_deal').text().replace(/,/g, '')) || 0;
            var municipal_tax_deal = parseFloat(jQuery('.municipal_tax_deal').text().replace(/,/g, '')) || 0;
            var municipal_custom_handling_charges_deal = parseFloat(jQuery('.municipal_custom_handling_charges_deal').text().replace(/,/g, '')) || 0;
            var rto_deal = parseFloat(jQuery('.rto_deal').text().replace(/,/g, '')) || 0;
            var rto_custom_handling_charges_deal = parseFloat(jQuery('.rto_custom_handling_charges_deal').text().replace(/,/g, '')) || 0;
            var insurance_deal = parseFloat(jQuery('.insurance_deal').text().replace(/,/g, '')) || 0;
            var fastage_amt_deal = parseFloat(jQuery('.fastage_amt_deal').text().replace(/,/g, '')) || 0;
            var ew_deal = parseFloat(jQuery('.ew_deal').text().replace(/,/g, '')) || 0;
            var accessories_deal = parseFloat(jQuery('.accessories_deal').text().replace(/,/g, '')) || 0;
            var rsa_deal = parseFloat(jQuery('.rsa_deal').text().replace(/,/g, '')) || 0;
            var mcp_deal = parseFloat(jQuery('.mcp_deal').text().replace(/,/g, '')) || 0;
            var other_deal = parseFloat(jQuery('.other_deal').text().replace(/,/g, '')) || 0;

            var on_road_price = ex_showroom_price_deal + gst_tax_deal + cess_tax_deal + tcs_tax_deal + municipal_tax_deal + municipal_custom_handling_charges_deal + rto_deal + rto_custom_handling_charges_deal + insurance_deal + fastage_amt_deal + ew_deal + accessories_deal + rsa_deal + mcp_deal + other_deal;
            jQuery('.on_road_price_deal').text(on_road_price.toLocaleString());

            //For Deal Side Showing Difference
            var on_road_price_deal = parseFloat(jQuery('.on_road_price_deal').text().replace(/,/g, '')) || 0;
            var final_deal_deal = parseFloat(jQuery('.final_deal_deal').text().replace(/,/g, '')) || 0;
            var deal_difference = on_road_price_deal - final_deal_deal;
            jQuery('.diff_amount_deal').text(deal_difference.toLocaleString());

        });    

        function printDiv(divId, watermarkURL) {
            // Get the content of the div
            var content = document.getElementById(divId).innerHTML;
            
            // Open a new window for printing
            var printWindow = window.open('', '', 'height=600,width=800');
            
            // Start building the document
            printWindow.document.write('<html><head><title>Print Content</title>');
            
            // Add styles including watermark
            printWindow.document.write('<style>');
            printWindow.document.write(`
                body {
                    font-family: Arial, sans-serif;
                    margin: 0;
                    padding: 0;
                    position: relative;
                }
                .watermark {
                    position: fixed;
                    width: 250px;
                    opacity: 0.06;
                    z-index: 0;
                    pointer-events: none;
                }
                .wm1 { top: 15%; left: 5%; }
                .wm2 { top: 30%; left: 25%; }
                .wm3 { top: 50%; left: 45%; }
                .wm4 { top: 70%; left: 65%; }
                @media print {
                    .watermark {
                        display: block;
                    }
                }
            `);
            printWindow.document.write('</style>');
            printWindow.document.write('</head><body>');

            printWindow.document.write(
                '<img src="' + watermarkURL + '" class="watermark wm1">' +
                '<img src="' + watermarkURL + '" class="watermark wm2">' +
                '<img src="' + watermarkURL + '" class="watermark wm3">' +
                '<img src="' + watermarkURL + '" class="watermark wm4">'
            );

            // Add the content to be printed
            printWindow.document.write('<div style="position: relative; z-index: 1;">');
            printWindow.document.write(content);
            printWindow.document.write('</div>');

            // End of document
            printWindow.document.write('</body></html>');
            
            printWindow.document.close();

            // Wait for the content and images to load before printing
            printWindow.onload = function () {
                printWindow.focus();
                printWindow.print();
                printWindow.close();
            };
        }

    </script>

@endsection