<?php 
   $extra_sum = 0;
   if(!empty($data->priclist_detail)){
       $price_new_arr = json_decode($data->priclist_detail);
       if($price_new_arr != NULL){
           $price_new_arr = array_column($price_new_arr, 'value_field');
           $extra_sum = array_sum($price_new_arr);    
       }
   }
?>


@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;
        }
       
    
        .row > .column {
            padding: 0 8px;
        }
    
        .row:after {
            content: "";
            display: table;
            clear: both;
        }
    
        .column {
            float: left;
            width: 25%;
        }
    
        .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 {
            position: relative;
            background-color: #fefefe;
            margin: auto;
            padding: 0;
            width: 100%;
            max-width: 700px;
        }
    
        .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;
        }
    
        .mySlides {
            display: none;
        }
    
        .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;
        }
    
        .next {
            right: 0;
            border-radius: 3px 0 0 3px;
        }
        
        .prev:hover,
        .next:hover {
            background-color: rgba(0, 0, 0, 0.8);
        }
       
        .numbertext {
            color: #f2f2f2;
            font-size: 12px;
            padding: 8px 12px;
            position: absolute;
            top: 0;
        }
       
        .caption-container {
            text-align: center;
            background-color: black;
            padding: 2px 16px;
            color: white;
        }
       
        .active,
        .demo:hover {
            opacity: 1;
        }
       
        .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

<div class="row">
    <div class="col-12">
        <div class="card">
            <hr style="border: 1px solid grey;width: 250px;">
            <h3><i>Summary</i></h3>
            <hr style="border: 1px solid grey;width: 250px;">
            <div class="card-body mt-2">
                <div class="col-md-offset-3">
                    
                    <div class="row">
                        <div class="col-lg-12 ">
                            <div class="col-md-12">
                                <h3> Personal Details</h3>
                                <hr style="border:1px solid grey;">
                                <table style="width:100%;">
                                    <tbody>
                                        <tr>
                                            <td>
                                               <label class="control-label" style="color:black;"><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" style="color:black;"><b>Customer Name</b></label>
                                            </td>
                                            <td> : </td>
                                            <td>
                                               <span class="form-label">{{ $data->customer_name ?? 'N/A' }}</span>
                                            </td>
                                        </tr>
                                        
                                        <tr>
                                            <td>
                                               <label class="control-label" style="color:black;"><b>Branch</b></label>
                                            </td>
                                            <td> : </td>
                                            <td>
                                               <span class="form-label">{{ $data->branch_name ?? 'N/A' }}</span>
                                            </td>
        
                                            <td>
                                               <label class="control-label" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><b>Address Correspondence</b></label>
                                            </td>
                                            <td> : </td>
                                            <td>
                                               <span class="form-label">{{ $data->address ?? 'N/A' }}</span>
                                            </td>
                                            
                                            <td>
                                               <label class="control-label" style="color:black;"><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" style="color:black;"><b>E-Mail</b></label>
                                            </td>
                                            <td> : </td>
                                            <td>
                                               <span class="form-label">{{ $data->email ?? 'N/A' }}</span>
                                            </td>
                                            
                                            <td>
                                               <label class="control-label" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><b>Occupation</b></label>
                                            </td>
                                            <td> : </td>
                                            <td>
                                               <span class="form-label">{{ $data->occupation ?? 'N/A' }}</span>
                                            </td>
                                            <tr>
                                                <td>
                                                    <label class="control-label" style="color:black;"><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" style="color:black;"><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>
                    
                    <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" style="color:black;"><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" style="color:black;"><b>Sales Person Name</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>
                                                   <span class="form-label">{{ $data->sales_person_name ?? 'N/A' }}</span>
                                                </td>
                                            </tr>    
            
                                            <tr>
                                                <td>
                                                   <label for="veriant"  style="color:black;"><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"  style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><b>Remarks</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>
                                                   <span class="form-label">{{ $data->step1_remarks ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                    
                                    <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->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->foc_accessories ?? 0);
                                                        
                                                            $final_total = $on_road_price - $total_ofr_discount;
                                                        
                                                            $total_accessories = 
                                                                ($summary_accessory_sum ?? 0) + 
                                                                ($data->other_accesssories_prise ?? 0);
                                                        
                                                            $rto_tax = 
                                                                ($data->registration_tax_id ?? 0) + 
                                                                ($data->rto_custom_handling_charges ?? 0);
                                                        ?>
                                                        
                                                        <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->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>Cash Discount</td><td>{{ $data->way_off }}</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>
                        
                        <hr style="border: 1px solid grey;">
                        
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="col-md-12">
                                    <h3> Finance Details</h3>
                                    <hr style="border:1px solid grey;">
                                    <table style="width:100%;">
                                        <tbody>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Finance Required</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{ucwords($data->finance_required)}} </td>
        
                                                <div class="vl3"></div>
        
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Finance</b></label>
                                                </td>
                                                <td> : </td>
                                                <td> 
                                                   <span class="form-label">{{ $data->finance_name ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><b>Pay Booster</b></label>
                                                </td>
                                                <td> : </td>
                                                <td> 
                                                    {{ucwords($data->pay_booster)}}
                                                </td>
            
                                                
                                                <td>
                                                   <label class="control-label" style="color:black;"><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>
                                                </td>
                                            </tr>
            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Aging Days</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>
                                                   <span class="form-label">{{ now()->diffInDays($Inventory_data->kin_invoice_date) ?? '' }}</span>
                                                </td>
            
                                                <td>
                                                   <label class="control-label" style="color:black;"><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>
                                                </td>
                                            </tr>
            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Allocation Count</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>
                                                    <span class="form-label">{{ $Inventory_data->allocation_count ?? 'N/A' }}</span>
                                                </td>
            
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Disbursement Field</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{ucwords($data->disbursement)}} </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label"  style="color:black;"><b>Finance Type</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{ucwords(str_replace('_', ' ', $data->finance_type))}} </td>
                                                
                                                <td>
                                                   <label class="control-label"  style="color:black;"><b>Payout Amount</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{$data->payout_amount}} </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Lumsum Amount</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{$data->lumsum_amount}} </td>
            
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Total Payout</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{$data->total_payout_amount}} </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Remarks</b></label>
                                                </td>
                                                <td> : </td>
                                                <td>{{$data->step2_remarks ?? 'N/A'}} </td>
                                            </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> Insurance Details</h3>
                                    <hr style="border:1px solid grey;">
                                    <table style="width:100%;">
                                        <tbody>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><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" style="color:black;"><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>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Date of Insurance</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $ObfInsurance->date_of_insurance ?? 'N/A' }}</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" style="color:black;"><b>Time of Insurance</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                    <span class="form-label">{{ $ObfInsurance->time_of_insurance ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Last Date of Insurance</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $ObfInsurance->last_time_of_insurance ?? '' }}</span>
                                                </td>
                                                
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Company Name</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $ObfInsurance->company_name ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Amount</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $ObfInsurance->ncb_amount ?? 'N/A' }}</span>
                                                </td>
                                                
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Policy Number</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $ObfInsurance->policy_number ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                    @php
                                                        $insurance_status = '';
                                                        if(isset($ObfInsurance->insurance_status) && $ObfInsurance->insurance_status != null){
                                                            $insurance_status = $ObfInsurance->insurance_status;
                                                        }
                                                   @endphp
                                                   <label class="control-label" style="color:black;"><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>
                                                </td>
                                            </tr>
                                            
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><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" style="color:black;"><b>Remarks</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->step3_remarks ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        
                        <hr style="border: 1px solid grey;">
                        
                        <div class="row">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> RTO Details</h3>
                                    <hr style="border:1px solid grey;">
                                    <table style="width:100%;">
                                        <tbody>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>RTO Type</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                    <span class="form-label">
                                                        {{ucwords(str_replace('_', ' ', $data->rto_type))}}
                                                   </span>
                                                </td>
        
                                                <div class="vl5"></div>
        
                                                <td>
                                                    <label class="control-label" style="color:black;"><b>Registration Date</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                    <span class="form-label">{{ $data->registration_date ?? 'N/A' }}</span> 
                                                </td>
                                            </tr>
        
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Application Number</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->application_number ?? 'N/A' }}</span>
                                                </td>
        
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Temporary Number</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->temporary_number ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
        
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Final amount</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->final_amount ?? 'N/A' }}</span>
                                                </td>
        
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Vehicle Number</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->vehicle_number ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Status</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   @if($data->rto_status == '1') Activate @endif
                                                   @if($data->rto_status != '1') Deactivate @endif
                                                </td>
                                                <td>
                                                   <label class="control-label" style="color:black;"><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" style="color:black;"><b>Remarks</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->step4_remarks ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
        
                        <hr style="border: 1px solid grey;">
        
                        <div class="row">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> Fasttag Details</h3>
                                    <hr style="border:1px solid grey;">
                                    <table style="width:100%;">
                                        <tbody>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Fasttag number</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->fasttag_number ?? 'N/A' }}</span>
                                                </td>
        
                                                <div class="vl6"></div>
        
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Brand</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->fasttag_brand ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><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>
                                                </td>
        
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Amount</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->fasttag_amount ?? 'N/A' }}</span>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Opening stock</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   <span class="form-label">{{ $data->opening_stock ?? 'N/A' }}</span>
                                                </td>
        
                                                <td>
                                                   <label class="control-label" style="color:black;"><b>Status</b></label>
                                                </td>
                                                <td> :</td>
                                                <td>
                                                   @if($data->fasttag_status == '1') Activate @endif
                                                   @if($data->fasttag_status != '1') Deactivate @endif
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <label class="control-label" style="color:black;"><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>
                </div>
            </div>
        </div>      
    </div>   
</div>    
                                            