<?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 View
@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">
<style type="text/css">
    /*#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);
    }


</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 View</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">View</li>
                    </ol>
                </nav>
            </div>
        </div>
        <div class="col-5 align-self-center">
            <div class="customize-input float-right">
            </div>
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="stepwizard col-md-offset-3">
                        <div class="stepwizard-row setup-panel">
                            <div class="stepwizard-step">
                                <a href="#step-1" type="button" class="btn btn-primary btn-circle">1</a>
                                <p>Personal Details</p>
                            </div>
                            <div class="stepwizard-step">
                                <a href="#step-2" type="button" class="btn btn-default btn-circle" disabled="disabled">2</a>
                                <p>Car Details</p>
                            </div>

                            <?php //if($view_enable != 2) { ?>

                            @canany(['obf-finance'])
                            <div class="stepwizard-step">
                                <a href="#step-3" type="button" class="btn btn-default btn-circle" disabled="disabled">3</a>
                                <p>Finance Details</p>
                            </div>
                            @endcanany  

                            @canany(['obf-insuranceview'])
                            <div class="stepwizard-step">
                                <a href="#step-4" type="button" class="btn btn-default btn-circle" disabled="disabled">4</a>
                                <p>Insurance Details</p>
                            </div>
                            @endcanany  

                            @canany(['obf-rtoview'])
                            <div class="stepwizard-step">
                                <a href="#step-5" type="button" class="btn btn-default btn-circle" disabled="disabled">5</a>
                                <p>RTO Department</p>
                            </div>
                            @endcanany  
                            
                            @canany(['obf-fasttagview'])
                            <div class="stepwizard-step">
                                <a href="#step-6" type="button" class="btn btn-default btn-circle" disabled="disabled">6</a>
                                <p>Fasttag Department</p>
                            </div>
                            @endcanany  

                        </div>
                    </div>
                    <form role="form"  enctype="multipart/form-data">
                      
                        <input type="hidden" name="id" value="{{ $data->id }}" >
                        <div class="row setup-content" id="step-1">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> Personal Details</h3>
                                    <div class="row">
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Booking Date</label>
                                            <input type="date" name="booking_date" id="booking_date" class="form-control" value="{{ $data->booking_date ?? '' }}" disabled>
                                            <span class="kt-form__help error booking_date"></span>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Customer Name</label>
                                            <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>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Branch</label>
                                            <select name="branch" id="branch" class="form-control" disabled>
                                                <option value="">Select Branch</option>
                                                @if(isset($branch) && $branch->isNotEmpty())
                                                    @foreach($branch AS $branch)
                                                        <option value="{{ $branch->id }}" @if($data->branch_id == $branch->id) selected @endif >{{ $branch->name }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error branch"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">RTO Type</label>
                                            <select  name="customer_type" id="customer_type" class="form-control" placeholder="Enter RTO Type" disabled>
                                                <option value="">Select RTO Type</option>
                                                <option value="individual" @if($data->customer_type == 'individual') selected @endif>Individual</option>
                                                <option value="corporate" @if($data->customer_type == 'corporate') selected @endif>Corporate</option>
                                                <option value="govt" @if($data->customer_type == 'govt') selected @endif>Govt.</option>
                                            </select>
                                            <span class="kt-form__help error customer_type"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Customer Type</label>
                                            <select name="customer_type_new" id="customer_type_new" class="form-control" disabled>
                                             <option value="">Please Customer Type</option>
                                                @if(isset($CustomerTypeMaster) && $CustomerTypeMaster->isNotEmpty())
                                                    @foreach($CustomerTypeMaster AS $row)
                                                        <option value="{{ $row->id }}" @if($data->customer_type_new == $row->id) selected @endif>{{ $row->name ??'' }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error customer_type_new"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Company Name</label>
                                            <input type="text"  name="company_name" id="company_name" class="form-control" placeholder="Enter Company Name" value="{{ $data->company_name ?? '' }}" disabled>
                                            <span class="kt-form__help error company_name"></span>
                                        </div>
                                       
                                        <div class="form-group col-md-3">
                                            <!-- <label class="control-label">EInvoicing Applicable</label> -->
                                            <label class="control-label">e-Invoice Applicable</label>
                                            <select name="einvoapp" id="einvoapp" class="form-control" disabled>
                                                 <option value="{{ $data->einvoicing_applicable }}">{{ $data->einvoicing_applicable ?? '' }}</option>
                                            </select>
                                            <span class="kt-form__help error einvoapp"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">GST</label>
                                            <input type="text"  name="gst" id="gst" class="form-control" placeholder="Enter GSTIN" value="{{ $data->gst ?? '' }}" disabled>
                                            <span class="kt-form__help error gst"></span>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label mt-3">Address Correspondence</label>
                                            <textarea  name="address_1" id="address_1" class="form-control" placeholder="Enter Address Correspondence" disabled>{{ $data->address ?? '' }}</textarea>
                                            <span class="kt-form__help error address_1"></span>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Registration Correspondence</label>
                                            <span class="btn btn-outline-secondary ml-5 mb-2">&nbsp;&nbsp;&nbsp;<input id="chek_address" type="checkbox" class="form-check-input mr-0" value=""><b>Same AS Above</b></span>
                                            <textarea  name="address_2" id="address_2" class="form-control" placeholder="Enter Registration Correspondence" disabled>{{ $data->registration ??  '' }}</textarea>
                                            <span class="kt-form__help error address_2"></span>
                                        </div>

                                        

                                        <div class="form-group col-md-3">
                                            <!-- <label class="control-label">Email</label> -->
                                            <label class="control-label">e-Mail</label>
                                            <input type="email"  name="email" id="email" class="form-control" placeholder="Enter Email Address" value="{{ $data->email ?? '' }}" disabled>
                                            <span class="kt-form__help error email"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Mobile Number</label>
                                            <input type="number"  name="contact_number" id="contact_number" class="form-control" placeholder="Enter Mobile Number" value="{{ $data->contact_number ?? '' }}" disabled>
                                            <span class="kt-form__help error contact_number"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">PAN No.</label>
                                            <input type="pannumber"  name="pan_number" id="pan_number" class="form-control" placeholder="Enter PAN Number" value="{{ $data->pan_number ?? '' }}" disabled>
                                            <span class="kt-form__help error pan_number"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Aadhar No.</label>
                                            <input type="number"  name="adhar_number" id="aadhar_number" class="form-control" placeholder="Enter Aadhar Number" value="{{ $data->adhar_number ?? '' }}" disabled>
                                            <span class="kt-form__help error aadhar_number"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">License No.</label>
                                            <input type="text"  name="license_number" id="license_number" class="form-control" placeholder="Enter License Number" value="{{ $data->licance_number ?? '' }}" disabled>
                                            <span class="kt-form__help error license_number"></span>
                                        </div>

                                        

                                        <div class="form-group col-md-3">
                                            <div class="row">
                                                <div class="form-group col-md-12">
                                                     <p>Upload PAN</p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <div id="pan_image_multi">
                                                    <?php
                                                         if(!empty($data->pan_image))
                                                        {
                                                            $other_documents_arr = explode(',', $data->pan_image);
                                                            foreach ($other_documents_arr as $value) {
                                                                if(file_exists(public_path('/uploads/kyc/'.$value))) { ?>
                                                                    <img src="{{asset('uploads/kyc/'. $value )}}" class="hover-shadow">
                                                                <?php }
                                                            }
                                                        }
                                                    ?>
                                                    </div>
                                                </div>
                                            </div>                                           
                                        </div>


                                        <div id="myModal" class="modal">
                                          <span class="close cursor" onclick="closeModal()">&times;</span>
                                          <div class="modal-content">
                                             <img class="image_set" src="" style="width:100%;height:470px;">
                                          </div>
                                        </div>    
                                        
                                        <div class="form-group col-md-3">
                                            <div class="row">
                                                <div class="form-group col-md-12">
                                                     <p>Upload Aadhar</p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <div id="adhar_image_multi">
                                                    <?php
                                                         if(!empty($data->adhar_image))
                                                            {
                                                                $other_documents_arr = explode(',', $data->adhar_image);
                                                                foreach ($other_documents_arr as $value) {
                                                                    if(file_exists(public_path('/uploads/kyc/'.$value))) { ?>
                                                                        <img src="{{asset('uploads/kyc/'. $value )}}" class="hover-shadow">
                                                                    <?php }
                                                                }
                                                            }
                                                    ?>
                                                    </div>
                                                </div>
                                            </div>                                           
                                        </div>


                                        <div class="form-group col-md-3">
                                            <div class="row">
                                                <div class="form-group col-md-12">
                                                     <p>Upload Voter ID</p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <div id="licance_image_multi">
                                                    <?php
                                                        if(!empty($data->licance_image))
                                                        {
                                                            $other_documents_arr = explode(',', $data->licance_image);
                                                            foreach ($other_documents_arr as $value) {
                                                                if(file_exists(public_path('/uploads/kyc/'.$value))) { ?>
                                                                    <img src="{{asset('uploads/kyc/'. $value )}}" class="hover-shadow">
                                                                <?php }
                                                            }
                                                        }
                                                    ?>
                                                    </div>
                                                </div>
                                            </div>                                           
                                        </div>


                                        
                                        <div class="form-group col-md-3">
                                            <div class="row">
                                                <div class="form-group col-md-12">
                                                     <p>Upload Other Documents</p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <div id="galeria">
                                                    <?php
                                                        if(!empty($data->other_documents))
                                                        {
                                                            $other_documents_arr = explode(',', $data->other_documents);
                                                            foreach ($other_documents_arr as $value) {
                                                                if(file_exists(public_path('/uploads/kyc/'.$value))) { ?>
                                                                    <img src="{{asset('uploads/kyc/'. $value )}}" class="hover-shadow">
                                                                <?php }
                                                            }
                                                        }
                                                    ?>
                                                    </div>
                                                </div>
                                            </div>                                           
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Date of Birth</label>
                                            <input type="date"  name="dob" id="dob" class="form-control" value="{{ $data->dob ?? '' }}" disabled>
                                            <span class="kt-form__help error dob"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Nominee Name</label>
                                            <input type="text"  name="nominee_name" id="nominee_name" class="form-control" placeholder="Enter Nominee Name" value="{{ $data->nominee_name ?? '' }}" disabled>
                                            <span class="kt-form__help error nominee_name"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Nominee Relation</label>
                                            <input type="text"  name="nominee_relation" id="nominee_relation" class="form-control" placeholder="Enter Nominee Relation" value="{{ $data->nominee_reletion ?? ''}}" disabled>
                                            <span class="kt-form__help error nominee_relation"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Nominee Age</label>
                                            <input type="number"  name="nominee_age" id="nominee_age" class="form-control" placeholder="Enter Nominee Age" value="{{ $data->nominee_age ?? '' }}" disabled>
                                            <span class="kt-form__help error nominee_age"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Occupation</label>
                                            <input type="text"  name="occupation" id="occupation" class="form-control" placeholder="Enter Occupation" value="{{ $data->occupation ?? '' }}" disabled>
                                            <span class="kt-form__help error occupation"></span>
                                        </div>
                                      
                                    </div>
                                    <a href="{{ route('obf') }}"><button class="btn btn-outline-secondary btn-lg pull-right" type="button">Back</button></a>
                                    <button class=" btn waves-effect waves-light btn-rounded btn-outline-primary nextBtn btn-lg pull-right" type="button">Next</button>
                                </div>
                            </div>
                        </div>
                        <div class="row setup-content" id="step-2">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> Car Details</h3>
                                    <div class="row">
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Sales Person Name</label>
                                            <select name="sales_person_name" id="sales_person_name" class="form-control" disabled>
                                                <?php
                                                if($data->sales_person_id == ''){
                                                    $data->sales_person_id = $user_new->id;
                                                }
                                                ?>
                                                <option value="">Select Sales Person</option>
                                                @if(isset($sales) && $sales->isNotEmpty())
                                                    @foreach($sales AS $row)
                                                        <option value="{{ $row->id }}"  @if($data->sales_person_id == $row->id) selected @endif>{{ $row->sales_person_name ??'' }}</option>
                                                        @endforeach
                                                @else        
                                                    <option value="1" selected>Super Admin</option>
                                                @endif
                                            </select>
                                            <span class="kt-form__help error sales_person_name"></span>
                                        </div>
                                        
                                        <!-- <div class="form-group col-sm-3">
                                <label for="name">Select Car</label>
                                <select class="form-control" name="name" id="name" onchange="car_mveriant(this);" disabled>
                                    <option value="">Select Car</option>
                                    @if(isset($carmodel))
                                        @foreach($carmodel as $car_model)
                                          <option value="{{ $car_model->car_id }}" @if(!empty($data) && $data->product_id == $car_model->car_id) selected @endif> {{ $car_model->car_name }} | {{$car_model->varient_name}} {{$car_model->exterior_color}} {{$car_model->interior_color}} </option>
                                        @endforeach
                                    @endif
                                </select>
                                <span class="kt-form__help error branch_id"></span>
                            </div> -->
                            <div class="form-group col-sm-3">
                                <label for="car_name">Car Model</label>
                                <input type="text" class="form-control" name="car_name" id="car_name" value="{{$Cardata->car_name}}" readonly>
                                       
                                <span class="kt-form__help error car_name"></span>
                            </div>

                            <!-- <div class="form-group col-sm-3">
                                <label for="fule_type">Fuel Type</label>
                                <input type="text" class="form-control" name="fule_type" id="fule_type" value="{{ $data->fule_type_name ?? '' }}" readonly>
                                <span class="kt-form__help error fule_type"></span>
                            </div> -->

                            <div class="form-group col-sm-3">
                                <label for="veriant">Car Variant</label><br>
                                <input type="text" class="form-control" name="veriant" id="veriant" value="{{$Cardata->varient_name}}" readonly>
                                <span class="kt-form__help error veriant"></span>
                            </div>

                            <div class="form-group col-sm-3" id="fule_type">
                                <label for="fule_type">Fuel Type</label>  
                                <input type="text"  name="fule_type" id="fule_type" value="{{$fule->fule_name}}" class="form-control" placeholder="Fuel Type" readonly>
                                <span class="kt-form__help error fule_type"></span>
                            </div>


                            <div class="form-group col-sm-3">
                                <label for="exterior_color">Exterior Color</label><br>
                                <input type="text" class="form-control" name="exterior_color" id="exterior_color" value="{{$Cardata->exterior_color}}" readonly>
                                <span class="kt-form__help error exterior_color"></span>
                            </div>
                            <div class="form-group col-sm-3">
                                <label for="interior_color">Interior Color</label><br>
                                <input type="text" class="form-control" name="interior_color" id="interior_color" value="{{$Cardata->interior_color}}" readonly>
                                <span class="kt-form__help error interior_color"></span>
                            </div>  
                            <div class="form-group col-md-3" >
                                            <label class="control-label">Pricelist</label>
                                            <select name="pricelist_manager_id" id="pricelist_manager_id" class="form-control" onchange="Getpricelist(this);" readonly>
                                                <option value="">Select pricelist</option>
                                                <!-- @if(isset($pricelist_master) && $pricelist_master->isNotEmpty())
                                                    @foreach($pricelist_master AS $pricelist_master_row)
                                                        <option value="{{ $pricelist_master_row->id }}" @if($data->pricelist_id == $pricelist_master_row->id) selected @endif> </option>
                                                    @endforeach
                                                @endif -->
                                            </select>
                                            <span class="kt-form__help error pricelist_manager_id"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Standard Ex-Showroom Price</label>
                                            <input type="number"  name="ex_showroom_price" id="ex_showroom_price" class="form-control" placeholder="Enter Standard Ex-Showroom Price" value="{{ $data->ex_showroom_price ?? '' }}" disabled>
                                            <span class="kt-form__help error ex_showroom_price"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Registration Tax</label>
                                            <input type="text"  name="registration_tax" id="registration_tax" class="form-control" placeholder="Enter Registration Tax" value="{{ $data->registration_tax_id ?? '' }}" disabled>
                                            <span class="kt-form__help error registration_tax"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Insurance</label>
                                            <input type="text"  name="insurance" id="insurance" class="form-control" placeholder="Enter Insurance" value="{{ $data->insurance_id ?? '' }}" disabled>
                                            <!--<select name="insurance" id="insurance" class="form-control"disabled >-->
                                            <!--    <option value="">Select Insurance</option>-->
                                            <!--    @if(isset($insurance) && $insurance->isNotEmpty())-->
                                            <!--        @foreach($insurance AS $row)-->
                                            <!--            <option value="{{ $row->id }}"  @if($data->insurance_id == $row->id) selected @endif>{{ $row->name ??'' }}</option>-->
                                            <!--        @endforeach-->
                                            <!--    @endif-->
                                            <!--</select>-->
                                            <span class="kt-form__help error insurance"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Municipal Tax</label>
                                            <input type="text"  name="municipal_tax" id="municipal_tax" class="form-control" placeholder="Enter Municipal Tax" value="{{ $data->municipal_tax_id ?? '' }}" disabled>
                                            <span class="kt-form__help error municipal_tax"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">1% for TCS Tax</label>
                                            <input type="text"  name="tcs_tax" id="tcs_tax" class="form-control" placeholder="Enter TCS Tax" value="{{ $data->tcs_tax_id ?? '' }}" disabled>
                                            <span class="kt-form__help error tcs_tax"></span>
                                        </div>

                                         <div class="form-group col-md-3">
                                            <label class="control-label">Extras</label>
                                        
                                            <select name="priclist_detail[]" id="priclist_detail" class="form-control select_priclist disabled" style="width:100%" multiple disabled>
                                            </select>                                           
                                            <span class="kt-form__help error priclist_detail"></span>
                                            <span>Extras Total -</span>
                                            <span id="extras_total">{{$extra_sum}}</span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Accessories</label>
                                      
                                            <select name="accessories[]" id="accessories" class="form-control select2 disabled" style="width:100%" multiple disabled>
                                            <option value="">Select Accessory</option>
                                                @if(isset($accessory) && $accessory->isNotEmpty())
                                                <option value="">Select Accessory</option>
                                                    @foreach($accessory AS $row)
                                                        <option value="{{ $row->id }}" @if( in_array($row->id, explode(" ," ,$data->accessory_id))) selected @endif data-price="{{ $row->price }}">{{ $row->name ??'' }} - {{ $row->price }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error accessories"></span>
                                            <span>Accessories Total -</span>
                                             <span id="total">{{$accessory_sum + $data->other_accesssories_prise}}</span>
                                        </div>
                                        
                                         <div class="form-group col-md-3">
                                              <label class="control-label">Other Accessories Detail</label>
                                               <input type="text"  readonly name="other_accesssories_detail" id="other_accesssories_detail" class="form-control" placeholder="Enter Trade In Car Name" value="{{ $data->other_accesssories_detail ?? '' }}">

                                         </div>
                                         
                                         <div class="form-group col-md-3">
                                              <label class="control-label">Other Accessories Prise</label>
                                               <input type="text"  readonly name="other_accesssories_prise" id="other_accesssories_prise" class="form-control" placeholder="Enter Trade In Car Name" value="{{ $data->other_accesssories_prise ?? '' }}">

                                         </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Fastag</label>
                                            <select name="fasttag_brand_name" id="fasttag_brand_name" class="form-control" disabled >
                                                <option value="">Select FastTag</option>
                                                @if(isset($fasttag) && $fasttag->isNotEmpty())
                                                    @foreach($fasttag AS $row)
                                                        <option value="{{ $row->id }}" @if($data->fasttag_brand_name == $row->id) selected @endif >{{ $row->brand_name ??'' }} - {{ $row->amount }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error fasttag_brand_name"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Trade In Car Name</label>
                                            <input type="text"  name="trade_car_name" id="trade_car_name" class="form-control" placeholder="Enter Trade In Car Name" value="{{ $data->trade_car_name ?? '' }}" disabled>
                                            
                                            <span class="kt-form__help error trade_car_name"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Trade In Car Value</label>
                                            <input type="text"  name="trade_car_value" id="trade_car_value" class="form-control" placeholder="Enter Trade In Car Value" value="{{ $data->trade_car_value ?? '' }}" disabled>
                                            <span class="kt-form__help error trade_car_value"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">On Road Price</label>
                                            <input type="number" name="on_road_price" id="on_road_price" class="form-control" placeholder="Enter On Road Price" value="{{ $data->on_road_price ?? '' }}" disabled>
                                            <span class="kt-form__help error on_road_price"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">On Road Price (In Words)</label>
                                            <input type="text" name="on_road_price_word" id="on_road_price_word" class="form-control" placeholder="Enter On Road Price In Words" value="{{ $data->on_road_price_word ?? '' }}" disabled>
                                            <span class="kt-form__help error on_road_price_word"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Extended Warranty</label>
                                            <select name="extended_warranty" id="extended_warranty" class="form-control"disabled >
                                                <option value="">Select Extanded Warranty</option>
                                                @if(isset($extanded_warranty) && $extanded_warranty->isNotEmpty())
                                                    @foreach($extanded_warranty AS $row)
                                                        <option value="{{ $row->id }}" @if($data->extanded_warranty_id == $row->id) selected @endif>{{ $row->years ??'' }} - {{ $row->amount }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error extended_warranty"></span>
                                        </div>
                                        <!-- <div class="form-group col-md-3">
                                            <label class="control-label">Finance Bank Name</label>
                                            <select name="finance_name" id="finance_name" class="form-control" disabled>
                                                <option value="">Select Finance Bank Name</option>
                                                @if(isset($finance) && $finance->isNotEmpty())
                                                    @foreach($finance AS $row)
                                                        <option value="{{ $row->id }}" @if($data->finance_id == $row->id) selected @endif>{{ $row->name ??'' }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error finance_bank_name"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Finance Branch Name</label>
                                            <select name="finance_branch_name" id="finance_branch_name" class="form-control" disabled>
                                                <option value="">Select Finance Branch Name</option>
                                                @if(isset($finance) && $finance->isNotEmpty())
                                                    @foreach($finance AS $row)
                                                        <option value="{{ $row->branch_id }}" @if($data->finance_id == $row->id) selected @endif>{{ $row->branch_name ??'' }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error finance_branch_name"></span>
                                        </div> -->
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Lead Source</label>
                                            <select name="lead" id="lead" class="form-control" disabled >
                                                <option value="">Select Lead Source</option>
                                                @if(isset($lead) && $lead->isNotEmpty())
                                                    @foreach($lead AS $row)
                                                        <option value="{{ $row->id }}" @if($data->lead_id == $row->id) selected @endif>{{ $row->name ??'' }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error lead_source"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Sub Lead Source</label>
                                            <select name="sub_lead_id" id="sub_lead_id" class="form-control" disabled>
                                            </select>
                                            <span class="kt-form__help error sub_lead_id"></span>
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Mode of Payment</label>
                                            <select name="mode_of_payment" id="mode_of_payment" class="form-control" disabled>
                                                <option value="">Select Mode Of Payment</option>
                                                <option value="cash_on_delivery"@if($data->mode_of_payment == 'cash_on_delivery') selected @endif>Cash On Delivery</option>
                                                <option value="online" @if($data->mode_of_payment == 'online') selected @endif>Online/Cradit Card/Debit Card/UPI</option>
                                            </select>
                                            <span class="kt-form__help error mode_of_payment"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Tentative Delivery Date</label>
                                            <input type="date" name="tentative_delivery_date" id="tentative_delivery_date" class="form-control" value="{{ $data->tentative_delivery_date ?? '' }}" disabled>
                                            <span class="kt-form__help error tentative_delivery_date"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Booking Amount</label>
                                            <input type="number"  name="booking_amount" id="booking_amount" class="form-control" placeholder="Enter Booking Amount" value="{{ $data->booking_amount ?? '' }}" disabled>
                                            <span class="kt-form__help error booking_amount"></span>
                                        </div>
                                        <div class="form-group col-md-3"> 
                                            <label class="control-label">My Convinience Program</label>
                                            <input type="checkbox" name="convinience_program">
                                            <select name="convinience_program" id="convinience_program" class="form-control" disabled>
                                                @if(isset($mcp) && $mcp->isNotEmpty())
                                                    @foreach($mcp AS $row)
                                                        <option value="{{ $row->id }}" @if($data->convinience_program == $row->id) selected @endif>{{ $row->name ??'' }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error convinience_program"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Other Details 1</label>
                                            <select name="other_details_1[]" id="other_details_1" class="form-control select2 disabled" style="width:100%" multiple disabled>
                                            <option value="">Select Data</option>
                                                @if(isset($OtherOne) && $OtherOne->isNotEmpty())
                                                <option value="">Select Data</option>
                                                    @foreach($OtherOne AS $row)
                                                        <option value="{{ $row->id }}" @if( in_array($row->id, explode("," ,$data->other_details_1))) selected @endif">{{ $row->name }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error other_details_1"></span>
                                            
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Other Details 2</label>
                                            <select name="other_details_2[]" id="other_details_2" class="form-control select2 disabled" style="width:100%" multiple disabled>
                                            <option value="">Select Data</option>
                                                @if(isset($OtherTwo) && $OtherTwo->isNotEmpty())
                                                <option value="">Select Data</option>
                                                    @foreach($OtherTwo AS $row)
                                                        <option value="{{ $row->id }}" @if( in_array($row->id, explode("," ,$data->other_details_2))) selected @endif">{{ $row->name }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error other_details_2"></span>
                                            
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">RSA MASTER</label>
                                            <select name="rsa_master_obf" id="rsa_master_obf" class="form-control" disabled>
                                                <option value="">Select RSA</option>
                                                @if(isset($rsa) && $rsa->isNotEmpty())
                                                    @foreach($rsa AS $row)
                                                        <option value="{{ $row->id }}" @if($data->rsa_master_obf == $row->id) selected @endif>{{ $row->amount ??'' }} - {{ $row->name }}</option>
                                                    @endforeach
                                                @endif
                                            </select>
                                            <span class="kt-form__help error rsa_master_obf"></span>
                                        </div>

                                    </div>
                                    <button class="btn  btn-outline-secondary prevBtn btn-lg pull-left" type="button">Previous</button>
                                     @if(auth()->user()->can('obf-finance') == false && auth()->user()->can('obf-insuranceview') == false && auth()->user()->can('obf-rtoview') == false && auth()->user()->can('obf-fasttagview') == false)                                   
                                        <!-- <button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button> -->
                                    @else                                        
                                        <button class="btn waves-effect waves-light btn-rounded btn-outline-primary nextBtn btn-lg pull-right" type="button">Next</button>
                                    @endif
                                </div>
                            </div>
                        </div>

                        @if(auth()->user()->can('obf-finance'))
                        <div class="row setup-content" id="step-3">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> Finance Details</h3>
                                    <div class="row">
                                      <div class="form-group col-md-3">
                                          <label class="control-label">Finance Required</label><br/>
                                          <label class="checkbox-inline">
                                              <input type="radio" value="yes" name="finance_required" class="chk_ncb" @if($data->finance_required == 'yes') checked @endif disabled> Yes</label>
                                          <label class="checkbox-inline">
                                              <input type="radio" value="no" name="finance_required" class="chk_ncb" @if($data->finance_required == 'no') checked @endif disabled> No</label>
                                          <span class="kt-form__help error finance_required"></span>
                                      </div>


                                        <div class="form-group col-md-3">
                                            <label class="control-label col-sm-12">Finance</label>

                                            <select name="finance_name" id="finance_name" class="form-control" disabled>
                                                <option value="">Select Finance Type</option>
                                                @if(isset($finance) && $finance->isNotEmpty())
                                                    @foreach($finance AS $row)
                                                        <option value="{{ $row->id }}" @if($data->finance_name == $row->id) selected @endif>{{ $row->name ??'' }}</option>
                                                    @endforeach
                                                @endif        
                                            </select>
                                            <span class="kt-form__help error finance_name"></span>
                                        </div>

                                        @if($is_finance_display_filds == 1)
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Repo Rate</label>
                                            <input type="number" class="form-control" name="repo_rate" id="repo_rate" placeholder="Enter Repo Rate" value="{{ $data->repo_rate ?? '' }}" readonly>
                                            <span class="kt-form__help error repo_rate"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Net Disbusment Amount</label>
                                            <input type="number" class="form-control" name="net_disbusment" id="net_disbusment" placeholder="Enter Net Disbusment Amount" value="{{ $data->net_disbusment ?? '' }}" readonly>
                                            <span class="kt-form__help error net_disbusment"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Loan Amount</label>
                                            <input type="number" class="form-control" name="loan_amount" id="loan_amount" placeholder="Enter Loan Amount" value="{{ $data->loan_amount ?? '' }}" readonly>
                                            <span class="kt-form__help error loan_amount"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Processing Fee</label>
                                            <input type="number" class="form-control" name="processing_fee" id="processing_fee" placeholder="Enter Processing Fee" value="{{ $data->processing_fee ?? '' }}" readonly>
                                            <span class="kt-form__help error processing_fee"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Finance Discount</label>
                                            <input type="number" class="form-control" name="finance_discount" id="finance_discount" placeholder="Enter Finance Discount" value="{{ $data->finance_discount ?? '' }}" readonly>
                                            <span class="kt-form__help error finance_discount"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Payout</label>
                                            <input type="number" class="form-control" name="payout" id="payout" placeholder="Enter Payout" value="{{ $data->payout ?? '' }}" readonly>
                                            <span class="kt-form__help error payout"></span>
                                        </div>
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Pay Booster</label>
                                            <label class="checkbox-inline">
                                                <input type="radio" value="yes" name="pay_booster" class="chk_ncb" @if($data->pay_booster == 'yes') checked @endif> Yes</label>
                                            <label class="checkbox-inline">
                                                <input type="radio" value="no" name="pay_booster" class="chk_ncb" @if($data->pay_booster != 'yes') checked @endif> No</label>
                                            <span class="kt-form__help error pay_booster"></span>
                                        </div>

                                        @if(!empty($Inventory_data))
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Allocation Date</label>
                                            <input type="text" class="form-control" value="{{ date('d-m-Y',strtotime($Inventory_data->updated_at)) ?? '' }}" disabled="disabled">
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Aging Days</label>
                                            <input type="text" class="form-control" value="{{ now()->diffInDays($Inventory_data->kin_invoice_date) ?? '' }}" disabled="disabled">
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Kin Invoice Date</label>
                                            <input type="text" class="form-control" value="{{ date('d-m-Y',strtotime($Inventory_data->kin_invoice_date)) ?? '' }}" disabled="disabled">
                                        </div>

                                        <div class="form-group col-md-3">
                                            <label class="control-label">Allocation Count</label>
                                            <input type="text" class="form-control" value="{{ $Inventory_data->allocation_count ?? '' }}" disabled="disabled">
                                        </div>
                                        @endif

                                        @endif
                                        
                                    </div>
                                    <button class="btn  btn-outline-secondary prevBtn btn-lg pull-left" type="button">Previous</button>
                                    <!--<button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button>-->

                                    @if(auth()->user()->can('obf-insuranceview') == false && auth()->user()->can('obf-rtoview') == false && auth()->user()->can('obf-fasttagview') == false)                                   
                                       <!--  <button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button> -->
                                    @else                                        
                                        <button class="btn waves-effect waves-light btn-rounded btn-outline-primary nextBtn btn-lg pull-right" type="button">Next</button>
                                    @endif
                                </div>
                            </div>
                        </div>
                        @endif
                        
                        <div class="row setup-content" id="step-4">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> Insurance Details</h3>
                                    <div class="row">
                                        <input type="hidden" name="obf_insurance_id" value="{{ $ObfInsurance->id ?? '' }}">


                                        <div class="form-group col-md-3">
                                            <label class="control-label col-sm-12">Insurance</label>
                                            <label class="checkbox-inline"><input type="radio" value="1" name="insurance_exist" class="chk_ncb insurance_exist" @if($ObfInsurance->insurance_exist == 1) checked @endif disabled> Yes</label>
                                            <label class="checkbox-inline"><input type="radio" value="2" name="insurance_exist"  class="chk_ncb insurance_exist" @if($ObfInsurance->insurance_exist == 2) checked @endif disabled> No</label>
                                            <span class="kt-form__help error insurance_exist"></span>
                                        </div>


                                        <div class="form-group col-md-3 insurance_exist_c">
                                            @php                                            
                                            $ncb = '';
                                            if(isset($ObfInsurance->ncb) && $ObfInsurance->ncb != null){
                                                $ncb = $ObfInsurance->ncb;
                                            }
                                            @endphp
                                            <label class="control-label col-sm-12">NCB - No Claim Bonus</label>
                                            <label class="checkbox-inline"><input type="radio" value="yes" name="ncb" class="chk_ncb" @if($ncb == 'yes' || $ncb == '') checked @endif disabled> Yes</label>
                                            <label class="checkbox-inline"><input type="radio" value="no" name="ncb" class="chk_ncb" @if($ncb == 'no') checked @endif disabled> No</label>
                                            <span class="kt-form__help error occupation"></span>
                                        </div>

                                     

                                        <div class="form-group col-md-3 insurance_exist_c">
                                            @php                                            
                                            $documents = [];
                                            if(isset($ObfInsurance->documents) && $ObfInsurance->documents != null){
                                                $documents = $ObfInsurance->documents;
                                            }
                                            @endphp

                                            <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">
                                                <div class="form-group col-md-12">
                                                     <p>Upload OLD RC Book</p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <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>
                                                </div>
                                                 <div class="form-group col-md-12">
                                                     <p>Upload Original Policy</p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <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>
                                                </div>
                                                 <div class="form-group col-md-12">
                                                     <p>Upload NCB Certificate Original </p>
                                                </div>
                                                <div class="form-group col-md-12">
                                                    <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>
                                                </div>
                                            </div>                                           
                                        </div>

<div class="form-group col-md-3 insurance_exist_c">
    <label class="control-label">Date of Insurance</label>
    <input type="date" name="date_of_insurance" id="date_of_insurance" class="form-control" placeholder="Date Of Insurance" value="{{ isset($ObfInsurance->date_of_insurance) ? date('Y-m-d', strtotime($ObfInsurance->date_of_insurance)) : '' }}">
    <span class="kt-form__help error date_of_insurance"></span>
</div>
<div class="form-group col-md-3 insurance_exist_c">
    @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">Time of Insurance</label>
    <select name="time_of_insurance" id="time_of_insurance" class="form-control">
        <option value="" selected disabled>Please Select Year</option>
        <option value="4" @if($time_of_insurance == '4') selected @endif>1+3 Year</option>
    </select>
    <span class="kt-form__help error time_of_insurance"></span>
</div>
<div class="form-group col-md-3 insurance_exist_c">
    <label class="control-label">1 Year last date of insurance</label>
    <input type="text" name="last_time_of_insurance1" id="last_time_of_insurance1" class="form-control" placeholder="1 Year End Date" value="{{ isset($ObfInsurance->date_of_insurance) ? date('d-m-y', strtotime($ObfInsurance->date_of_insurance . '+1 year')) : '' }}" readonly>
    <span class="kt-form__help error last_time_of_insurance1"></span>
</div>
<div class="form-group col-md-3 insurance_exist_c">
    <label class="control-label">3 Year last date of insurance</label>
    <input type="text" name="last_time_of_insurance3" id="last_time_of_insurance3" class="form-control" placeholder="3 Year End Date" value="{{ isset($ObfInsurance->date_of_insurance) ? date('d-m-y', strtotime($ObfInsurance->date_of_insurance . '+3 years')) : '' }}" readonly>
    <span class="kt-form__help error last_time_of_insurance3"></span>
</div>

                                       
                                        <div class="form-group col-md-3 insurance_not_exist_c">
                                            <label class="control-label">Insurance Company Name</label>
                                            <input type="text"  name="insurance_company_name" id="insurance_company_name" class="form-control" placeholder="Enter Insurance Company" value="{{ $ObfInsurance->company_name ?? '' }}" disabled>
                                            <span class="kt-form__help error insurance_company_name"></span>
                                        </div>
                                        <div class="form-group col-md-3 insurance_not_exist_c">
                                            <label class="control-label">Amount</label>
                                            <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>
                                        </div>
                                        <div class="form-group col-md-3 insurance_exist_c">
                                            <label class="control-label">Policy Number</label>
                                            <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>
                                        </div>
                                        
                                        <div class="form-group col-md-3 insurance_exist_c"></div>
                                        <div class="form-group col-md-3 insurance_exist_c">
                                            @php                                            
                                            $insurance_status = '';
                                            if(isset($ObfInsurance->insurance_status) && $ObfInsurance->insurance_status != null){
                                                $insurance_status = $ObfInsurance->insurance_status;
                                            }
                                            @endphp

                                            <label class="control-label">Status</label>
                                            <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>
                                        </div>

                                       <!--  <div class="form-group col-md-3">
                                            <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 class="form-group col-md-12 text-right mt-3">
                                            <a href="{{url('policy_list/'.$data->id)}}" name="insurance_policy1" id="insurance_policy1" class="btn btn-primary btn-sm"> View All Insurance Policy</a>
                                        </div>
                                        
                                            
                                        <div class="row">
                                            
                                        <div class="form-group col-md-3 ">
                                            <label class="control-label"> Tyre no 1</label>
                                            <input type="text"  name="tyre_no1" id="tyre_no1" class="form-control" placeholder="Enter Tyre 1" readonly value="{{ $ObfInsurance->tyre_no1 ?? '' }}">
                                            <span class="kt-form__help error "></span>
                                        </div>
                                        
                                        <div class="form-group col-md-3 ">
                                            <label class="control-label">Tyer no 2</label>
                                            <input type="text"  name="tyre_no2" id="tyre_no2" class="form-control" placeholder="Enter Tyre 2" readonly value="{{ $ObfInsurance->tyre_no2 ?? '' }}">
                                            <span class="kt-form__help error "></span>
                                        </div>
                                        
                                        <div class="form-group col-md-3 ">
                                            <label class="control-label">Tyer no 3</label>
                                            <input type="text"  name="tyre_no3" id="tyre_no3" class="form-control" placeholder="Enter Tyre 3" readonly value="{{ $ObfInsurance->tyre_no3 ?? '' }}">
                                            <span class="kt-form__help error "></span>
                                        </div>
                                        
                                        <div class="form-group col-md-3 ">
                                            <label class="control-label">Tyer no 4</label>
                                            <input type="text"  name="tyre_no4" id="tyre_no4" class="form-control" placeholder="Enter Tyre 4" readonly value="{{ $ObfInsurance->tyre_no4 ?? '' }}">
                                            <span class="kt-form__help error "></span>
                                        </div>
                                        
                                          <div class="form-group col-md-3 ">
                                            <label class="control-label">Tyer no 5</label>
                                            <input type="text"  name="tyre_no5" id="tyre_no5" class="form-control" placeholder="Enter Tyre 5" readonly value="{{ $ObfInsurance->tyre_no5 ?? '' }}">
                                            <span class="kt-form__help error "></span>
                                        </div>
                                        
                                        </div>
                                    </div>
                                    <button class="btn  btn-outline-secondary prevBtn btn-lg pull-left" type="button">Previous</button>
                                    @if(auth()->user()->can('obf-rtoview') == false && auth()->user()->can('obf-fasttagview') == false)                                   
                                        <!-- <button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button> -->
                                    @else                                        
                                        <button class="btn waves-effect waves-light btn-rounded btn-outline-primary nextBtn btn-lg pull-right" type="button">Next</button>
                                    @endif
                                    <!--<button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button>-->
                                </div>
                            </div>
                        </div>
                        
                        <div class="row setup-content" id="step-5">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> RTO Details</h3>
                                    <div class="row">
                                        <div class="form-group col-md-3">
                                            <label class="control-label">RTO Type</label>
                                            <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>
                                        </div>
                                       
                                        <div class="form-group col-md-3">
                                    <label class="control-label">Registration Date</label>
                                    <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>
                                    </div>
                                    
                                    <div class="form-group col-md-3">
                                    <label class="control-label">Application Number</label>
                                    <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>
                                    </div>
                                    
                                    <div class="form-group col-md-3">
                                    <label class="control-label">Temporary Number</label>
                                    <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>
                                    </div>
                                    
                                    <div class="form-group col-md-3">
                                    <label class="control-label">Final amount</label>
                                    <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>
                                    </div>
                                    
                                    <div class="form-group col-md-3">
                                    <label class="control-label">Vehicle Number</label>
                                    <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>
                                    </div>
                                    
                                    
                                    <div class="form-group col-md-3">
                                            <label class="control-label">Status</label>
                                            <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>
                                        </div>
                                        
                                        
                                        <!--<div class="form-group col-md-3">-->
                                        <!--    <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>
                                    <button class="btn  btn-outline-secondary prevBtn btn-lg pull-left" type="button">Previous</button>
                                    @if(auth()->user()->can('obf-fasttagview') == false)                                   
                                       <!--  <button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button> -->
                                    @else                                        
                                        <button class="btn waves-effect waves-light btn-rounded btn-outline-primary nextBtn btn-lg pull-right" type="button">Next</button>
                                    @endif
                                    <!--<button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button>-->
                                </div>
                            </div>
                        </div>
                        
                        <div class="row setup-content" id="step-6">
                            <div class="col-lg-12 ">
                                <div class="col-md-12">
                                    <h3> Fasttag Details</h3>
                                    <div class="row">
                                        
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Fasttag number</label>
                                            <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>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Brand</label>
                                            <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>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Date of issue</label>
                                            <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>
                                        </div>
                                        
                                        
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Amount</label>
                                            <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>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Opening stock</label>
                                            <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>
                                        </div>
                                        
                                        <div class="form-group col-md-3">
                                            <label class="control-label">Status</label>
                                            <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>
                                        </div>
                                        
                                        
                                        
                                        
                                    </div>
                                    <button class="btn  btn-outline-secondary prevBtn btn-lg pull-left" type="button">Previous</button>

                                   <!--  <button class="btn btn-outline-primary nextBtn btn-lg pull-right" type="submit">Submit</button> -->
                                   
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('scripts')
<script src="{{ asset('assets/js/dropify.min.js') }}"></script>
<script src="{{ asset('assets/js/promise.min.js') }}"></script>
<script src="{{ asset('assets/js/sweetalert2.bundle.js') }}"></script>
<script src="{{ asset('assets/js/select2.js') }}"></script>

<?php
    if(!empty($data->priclist_detail)){
        $data->priclist_detail = json_decode($data->priclist_detail);
    }
 ?>


<script>
    function insurance_exist(){
       var insurance_exist =  $('input[name="insurance_exist"]:checked').val();

        if(insurance_exist == 1){
            $('.insurance_exist_c').show();
            $('.insurance_not_exist_c').show();
        }else{
            $('.insurance_exist_c').hide();
            $('.insurance_not_exist_c').show();
        }
    }

    $(document).on('change','.insurance_exist',function(){
        insurance_exist();
    });

    insurance_exist();

    $(document).ready(function(){
        if($('#address_1').val() == $('#address_2').val()){
            $("#chek_address").attr("checked" ,true);
        }

        var copyData = '';
        $('#chek_address').on('click', function(){
            if($('#chek_address').is(":checked")){
                copyData = $('#address_1').val();
                $('#address_2').val(copyData);
            }else{
                $('#address_2').val('');
            }
        })
        $('.dropify').dropify({
            messages: {
                'default': 'Drag and drop profile image here or click',
                'remove':  'Remove',
                'error':   'Ooops, something wrong happended.'
            }
        });

        var drEvent = $('.dropify').dropify();

        var dropifyElements = {};
        $('.dropify').each(function () {
            dropifyElements[this.id] = false;
        });

        drEvent.on('dropify.beforeClear', function(event, element){
            id = event.target.id;
            if(!dropifyElements[id]){
                var url = "{!! route('obf.profile.remove') !!}";
                <?php if(isset($data) && isset($data->id)){ ?>
                    var id_encoded = "{{ base64_encode($data->id) }}";

                    Swal.fire({
                        title: 'Are you sure want delete this image?',
                        text: "",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                    }).then(function (result){
                        if (result.value){
                            $.ajax({
                                url: url,
                                type: "POST",
                                data:{
                                    id: id_encoded,
                                    _token: "{{ csrf_token() }}"
                                },
                                dataType: "JSON",
                                success: function (data){
                                    if(data.code == 200){
                                        Swal.fire('Deleted!', 'Deleted Successfully.', 'success');
                                        dropifyElements[id] = true;
                                        element.clearElement();
                                    }else{
                                        Swal.fire('', 'Failed to delete', 'error');
                                    }
                                },
                                error: function (jqXHR, textStatus, errorThrown){
                                    Swal.fire('', 'Failed to delete', 'error');
                                }
                            });
                        }
                    });

                    return false;
                <?php } else { ?>
                    Swal.fire({
                        title: 'Are you sure want delete this image?',
                        text: "",
                        type: 'warning',
                        showCancelButton: true,
                        confirmButtonColor: '#3085d6',
                        cancelButtonColor: '#d33',
                        confirmButtonText: 'Yes'
                    }).then(function (result){
                        if (result.value){
                            Swal.fire('Deleted!', 'Deleted Successfully.', 'success');
                            dropifyElements[id] = true;
                            element.clearElement();
                        }else{
                            Swal.fire('Cancelled', 'Discard Last Operation.', 'error');
                        }
                    });
                    return false;
                <?php } ?>
            } else {
                dropifyElements[id] = false;
                return true;
            }
        });
    });
</script>
<script>
    $(document).ready(function(){
        $('.select2').select2({
            placeholder:"Select Accessory",
        })

         $('.select_priclist').select2({
            placeholder:"Select Pricelist Detail",
        })
    }); 
     


    $('#accessories').on('change' , function(){
        var sum = 0;
        $('#accessories :selected').each(function() {
            sum  += parseInt($(this).data("price"));
        })
        //console.log(sum);
        $('#total').html(sum);
    });

     $('#pricelist_manager_id').attr('disabled',true);

       function car_mveriant(e){
          var id = e.value;
            $.ajax({
                url : "{{ url('obf/carvarient/') }}",
                data : {'id' : id},
                type : 'get',
                dataType : 'json',

                success : function(resp){
                    
                   
                    var html = ihtml = ehtml = vhtml = '';
                        
                    jQuery.each(resp.cardeails, function(key, val){ 
                        html = val.car_name;
                        vhtml = val.varient_name;
                        ehtml = val.exterior_color;
                        ihtml = val.interior_color;
                    });
                    jQuery("#exterior_color").val(ehtml);
                    jQuery("#interior_color").val(ihtml);
                    jQuery("#veriant").val(vhtml);
                    jQuery("#car_name").val(html);

                    var e_row = resp.data.pricelist_arr;

                   console.log(e_row);

                    html = '';
                    jQuery.each(e_row, function(key, val){ 
                        $('#pricelist_manager_id').removeAttr('disabled');
                        html += '<option value="'+val.price_id+'">'+val.price_list_name+' | '+val.transmission+'</option>';
                    });
                    console.log(html);
                    jQuery("#pricelist_manager_id").empty();
                    jQuery("#pricelist_manager_id").html(html);

                }
            });
            
        }



        function car_mveriant_edit(value){

          var id = value;
                $.ajax({
                   url : "{{ url('obf/carvarient/') }}",
                   data : {'id' : id},
                   type : 'get',
                   dataType : 'json',

                   success : function(resp){
                       
                       var html = ihtml = ehtml = vhtml = '';
                          
                       jQuery.each(resp.cardeails, function(key, val){ 
                           html = val.car_name;
                           vhtml = val.varient_name;
                           ehtml = val.exterior_color;
                           ihtml = val.interior_color;
                       });
                       jQuery("#exterior_color").val(ehtml);
                       jQuery("#interior_color").val(ihtml);
                       jQuery("#veriant").val(vhtml);
                       jQuery("#car_name").val(html);

                       var e_row = resp.data.pricelist_arr;

                       console.log(e_row);

                       var data_veriant = "<?php echo $data->product_id ?>"; 

                       html = '';

                       

                       var pricelist_id = "<?php echo $data->pricelist_id ?>"; 

                       jQuery.each(e_row, function(key, val){ 
                            var selected = '';
                            if(pricelist_id != '' && pricelist_id == val.id){
                                selected = "selected";
                            }

                           $('#pricelist_manager_id').removeAttr('disabled');
                           html += '<option value="'+val.id+'" '+selected+'>'+val.price_list_name+' | '+val.transmission+'</option>';
                       });
                       console.log(html);
                       jQuery("#pricelist_manager_id").empty();
                       jQuery("#pricelist_manager_id").html(html);
                   }
               });
               
           }
                                
            var data_veriant = "<?php echo $data->product_id ?>"; 
                console.log(data_veriant);
        if(data_veriant != ''){
            car_mveriant_edit(data_veriant);
        }

        var priclist_detail_arr_f = <?php echo json_encode($data->priclist_detail); ?>;
        const arrayColumn = (array, column) => {
            return array.map(item => item[column]);
        };
        const priclist_detail_arr = arrayColumn(priclist_detail_arr_f, 'detail_field');

        function Getpricelist_edit_get(id){

            if(id != ''){
                var URL='{{route('obf.getpricelist')}}';
                $.ajax({
                        url: URL,
                        type: 'post',
                        data: {id:id,_token: "{{ csrf_token() }}"},
                        cache: false,
                        success: function(data) {
                            if(data.detail_value != ''){
                                var e_row = jQuery.parseJSON(data.detail_value);

                               console.log("===--5555");
                                    console.log(priclist_detail_arr);
                                    console.log("===");

                                var html = '';                     

                                if(e_row.length > 0){
                                    // html +='<option value="">Select Veriant</option>';
                                    jQuery.each(e_row, function(key, val){
                                        console.log("---");
                                        console.log(val.value_field);
                                        console.log("---");
                                        var selected = '';

                                        // if(jQuery.inArray(val.value_field, priclist_detail_arr)) {
                                        if(jQuery.inArray(val.detail_field, priclist_detail_arr) != -1) {
                                            console.log('selected');
                                             selected = 'selected';
                                        }
                                       html +='<option value="'+val.detail_field+'__'+val.value_field+'" '+selected+' data-value_field="'+val.value_field+'">'+val.detail_field+' - '+val.value_field+'</option>';
                                    });


                                    jQuery("#priclist_detail").empty();
                                    jQuery("#priclist_detail").html(html);
                                }
                            }              
                        },
                        error: function(data) {
                            
                        }
                });
            }
        }

        Getpricelist_edit_get("<?php echo $data->pricelist_id; ?>");

         jQuery(document).on('change', '#lead', function(e){
            var id = $('#lead').val();
            sub_lead_html(id);
        });

        function sub_lead_html(id){
          $.ajax({
              url : "{{ url('obf/sub_lead_html/') }}",
              data : {'id' : id},
              type : 'get',
              dataType : 'json',
              success : function(resp){  
                  var c_row = resp.data.sub_lead_html; 
                  var html = '';
                  html +='<option value="">Select Sub Lead</option>';
                  jQuery.each(c_row, function(key, val){
                      var selected = '';
                      if("{{$data->sub_lead_id}}" == val.id){
                          selected = 'selected';
                      }

                      html +='<option value="'+val.id+'" '+selected+'>'+val.name+'</option>';
                  });                 
                  jQuery("#sub_lead_id").empty();
                  jQuery("#sub_lead_id").html(html);
              }
          });
        }

        if('{{$data->lead_id}}' != ''){
            sub_lead_html('{{$data->lead_id}}');
        }


    
</script>

<script>
// Open the Modal


$( ".hover-shadow" ).click(function() {
    document.getElementById("myModal").style.display = "block";
    console.log($(this).attr('src'));
    $('.image_set').attr('src',$(this).attr('src'));
}); 

$( ".hover-shadow2" ).click(function() {
    document.getElementById("myModal2").style.display = "block";
    console.log($(this).attr('src'));
    $('.image_set').attr('src',$(this).attr('src'));
});


// Close the Modal
function closeModal() {
    document.getElementById("myModal").style.display = "none";
}

function closeModal2() {
    document.getElementById("myModal2").style.display = "none";
}
$(document).ready(function() {
    $('#time_of_insurance').change(function() {
        var start_date = document.getElementById("date_of_insurance").value;
        var currentDate = moment().format('DD-MM-YYYY');

        var date1Year = moment(start_date, "YYYY-MM-DD").add(1, 'year').subtract(1, 'day').format('DD-MM-YYYY');
        var date3Year = moment(start_date, "YYYY-MM-DD").add(3, 'year').subtract(1, 'day').format('DD-MM-YYYY');

        $("#last_time_of_insurance1").val(date1Year);
        $("#last_time_of_insurance3").val(date3Year);
    });
});
</script>

@endsection