<?php
if (!defined('ABSPATH'))
  exit;

  
$allowed_html = array(
  'br' => array(),
  'strong' => array(),
  'p' => array(),
  'span' => array(),
  'div' => array(),
  'ul' => array(),
  'li' => array(),
  'a' => array(
    'href' => array(),
    'title' => array()
  ),
  'img' => array(
    'src' => array(),
    'alt' => array()
  ),
  'table' => array(),
  'tr' => array(),
  'td' => array(),
  'th' => array(),
  'tbody' => array(),
  'thead' => array(),
  'h1' => array(),
  'h2' => array(),
  'h3' => array(),
  'br' => array(),
  'small' => array(),
);
$options = get_option($this->plugin_name);

$accepted_languages = array('nl', 'de', 'en', 'fr', 'es');
$lang_data      = eurostocks_get_language_details();
$languages      = $lang_data['languages'];
$language_codes = $lang_data['language_codes'];
$default_lang   = $lang_data['default_lang'];
$current_lang   = $lang_data['current_lang'];
$diflang        = $lang_data['diflang'];
$show_lang      = $lang_data['show_lang'];


if ($language_codes && count($language_codes) > 1) {
  $show_lang = true;
} else {
  $show_lang = false;
}


if (isset($data['vehicle'])) {

  $vehicle = $data['vehicle'];

  if (isset($options['only_fl']) && $options['only_fl'] == 1 || isset($options['enable_fl']) && $options['enable_fl'] == 1){
    $eurostocks_fl = $options['enable_fl'];
    $eurostocks_only_fl = $options['only_fl'];
    $eurostocks_fl_interest = $options['fl_percentage'];
    $eurostocks_fl_duration = $options['fl_duration'];
    $eurostocks_fl_rest = $options['fl_restschuld'];
  } else {
    $eurostocks_fl = 0;
    $eurostocks_only_fl = 0;
  }
  ?>

  <head>
    <title>
      <?php echo esc_html($vehicle['make']) . ' ' . esc_html($vehicle['modelDescription']); ?>
    </title>
    <style>
      *,
      html,
      body {
        font-family: Helvetica, Arial, sans-serif;
        font-size: 10pt;
      }

      img {
        max-width: 100%;
      }

      tr td:first {
        width: 40%;
        background-color: red;
      }

      table,
      tr {
        width: 100%;
      }

      .euro-price {
        font-size: 1.6em;
      }

      .euro-modal-title {
        font-size: 1.6em;
      }

      .car-image {
        float: left;
        max-width: 33%;
        padding-top: 15px;
      }

      .general-info {
        width: 66%;
        float: left;
      }

      .euro-modal-header {
        width: 100%;
      }

      .clear {
        clear: both;
        width: 100%;
      }

      .column {
        width: 33%;
        float: left;
      }

      .bold {
        font-weight: bold;
      }

      .bar {
        width: 100%;
        display: block;
        height: 2px;
        margin-bottom: 15px;
        background-color: #cccccc;
      }

      .logo {
        max-width: 80%;
      }

      .mw-100 {
        max-width: 40px;
        margin-bottom: 10px;
        float: left;
        display: block;
        padding-right: 20px;
      }

      .voordeeltxt {
        font-size: 1.2em;
        line-height: 40px;
        float: left;
        width: calc(100% - 90px);
        display: block;
        height: 52px;
      }

      .price-info {
        padding-top: 20px;
      }

      .es-float-right {
        float: right;
        color: #cccccc;
        width: 200px;
        white-space: nowrap;
        line-height: 40px;
        vertical-align: middle;
      }

      .es-float-right img {
        max-width: 40px;
        margin-left: 5px;
      }

      .bold {
        font-weight: bold;
      }
    </style>
  </head>

  <body>

    <div>
      <div>
        <div class="eurocol-12">
          <h3>
            <?php esc_html_e("Provider", 'eurostocks'); ?>
          </h3>
        </div>
      </div>
      <div class="bar"></div>
      <div class="column">
        <?php
        if (isset($options["logo"])) {
          $eurostocks_image = wp_get_attachment_image_url($options["logo"], 'medium');
          ?>
          <img class="logo" src="<?php echo esc_url($eurostocks_image); ?>">
          <?php
        }
        ?>

      </div>
      <div class="column">
        <?php
        if (isset($options["contactaddress"])) {
          if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['contactaddress']) && $options[esc_html($current_lang)]['contactaddress'] != ""  ){
            echo wp_kses($options[esc_html($current_lang)]['contactaddress'], $allowed_html);
          } else {
            echo wp_kses($options["contactaddress"], $allowed_html);
          }
        }
        ?>
      </div>
      <div class="column">
        <?php
        if (isset($options["contacttimes"])) {
          if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['contacttimes']) && $options[esc_html($current_lang)]['contacttimes'] != ""  ){
            echo wp_kses($options[esc_html($current_lang)]['contacttimes'], $allowed_html);
          } else {
          echo wp_kses($options["contacttimes"], $allowed_html);
          }
        }
        ?>
      </div>
      <br><br><br><br><br><br>
      <div class="clear"></div>


    </div>
    <div class="clear"></div>




    <div class="euro-modal-header">
      <span class="euro-modal-title bold">
        <?php echo esc_html($vehicle['make'] . ' ' . $vehicle['modelDescription']); ?>
      </span>
    </div>

    <div class="clear"></div>
    <div class="euro-modal-body">
      <div class="euro-container">
        <div class="euro-car-details">
          <div class="general-info">
            <div>
              <div>
                <h3>
                  <?php esc_html_e("General", 'eurostocks'); ?>
                </h3>
              </div>
            </div>
            <table>
              <tr>
                <td>
                  <?php esc_html_e("Make", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['make']); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Model", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['model']); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Listing id.", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['vehicleId']); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Fuel type", 'eurostocks'); ?>
                </td>
                <td>
                  <?php
                  if ($vehicle['fuelType'] == "Hybride (benzine/elektrisch)") {
                    echo "Hybride benzine";
                  } elseif ($vehicle['fuelType'] == "Hybride (diesel/elektrisch)") {
                    echo "Hybride diesel";
                  } else {
                    echo esc_html($vehicle['fuelType']);
                  }
                  ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Registration date", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['firstRegistrationDate']); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Transmission", 'eurostocks'); ?>
                </td>
                <td>
                  <?php if ($vehicle['gearBox'] == "Automatische transmissie") {
                    echo "Automaat";
                  } else {
                    echo esc_html($vehicle['gearBox']);
                  } ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Mileage", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html(number_format(floatval($vehicle['mileage']), 0, ',', '.')); ?> KM
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("HP", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['power']); ?> kW (
                  <?php echo esc_html(intval($vehicle['power']) * 1.362); ?> <?php esc_html_e("HP", 'eurostocks'); ?>)
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("CO2 emissions", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html(intval($vehicle['attributes']['co2Emission'])); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Emission class", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['features']['emissionClass']); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("Interior", 'eurostocks'); ?>
                </td>
                <td>
                  <?php echo esc_html($vehicle['features']['interiorType']); ?>
                </td>
              </tr>
              <tr>
                <td>
                  <?php esc_html_e("VAT/Margin", 'eurostocks'); ?>
                </td>
                <td>
                  
                   <?php if($vehicle['priceInfo']['IsVatable'] == "Nee") { ?>
                    <?php esc_html_e("Margin-car", 'eurostocks'); ?>
                  <?php } elseif($vehicle['priceInfo']['IsVatable'] == "Ja") { ?>
                    <?php esc_html_e("VAT-car", 'eurostocks'); ?>
                  <?php }else{
                    echo esc_html($vehicle['priceInfo']['IsVatable']);
                  } ?>
                </td>
              </tr>
            </table>
            <div>
              <br>
              <?php 
              if($diflang){
                echo esc_url(get_site_url()) . "/" . esc_html($current_lang) . "/auto/" . esc_html($vehicle['vehicleId']);
              }else{
                echo esc_url(get_site_url()) . "/auto/" . esc_html($vehicle['vehicleId']);
              } ?>
            </div>
          </div>

          <?php
          if ($vehicle['images'] && $vehicle['images'][0]) {
            $img_zero = $vehicle['images'][0];
            $key_l = array_search('XXXL', array_column($img_zero['images'], 'size'));
            $image_url = $img_zero['images'][$key_l]['url'];
            ?>
            <div class="car-image"><img src="<?php echo esc_url($image_url); ?>" alt="Image" />
            </div>

              <div class="price-info">


                
                  
                  <?php
                if (isset($vehicle['priceInfo']['TransportCosts']) && $vehicle['priceInfo']['TransportCosts'] != '') {
            $transportCosts = $vehicle['priceInfo']['TransportCosts'];
          } else {
            $transportCosts = 0;
          }
          if ($options['country'] != 'nl' && $options['country'] != 'nl21') {
            if (isset($vehicle['priceInfo']['ImportMargin']) && $vehicle['priceInfo']['ImportMargin'] != '') {
              $importMargin = $vehicle['priceInfo']['ImportMargin'];
            } else {
              $importMargin = 0;
            }
            if (isset($vehicle['priceInfo']['ImportCosts']) && $vehicle['priceInfo']['ImportCosts'] != '') {
              $importCosts = $vehicle['priceInfo']['ImportCosts'];
            } else {
              $importCosts = 0;
            }
            $price = $vehicle['priceInfo']['PriceMobiledeBruto'] + $importMargin + $importCosts + $transportCosts;
          } elseif ($options['country'] == 'nl21') {
                    if (isset($vehicle['priceInfo']['PriceNlWithVatNl']) && $vehicle['priceInfo']['PriceNlWithVatNl'] != '') {
                        $price = $vehicle['priceInfo']['PriceNlWithVatNl'];
                    } else {
                        if(isset($vehicle['priceInfo']['FallbackPriceNlWithVatNl']) && $vehicle['priceInfo']['FallbackPriceNlWithVatNl'] != '' && isset($options['co2_fallback_display']) && $options['co2_fallback_display'] == 1) {
                            $price = $vehicle['priceInfo']['FallbackPriceNlWithVatNl'];
                        }else{
                            $price = false;
                        }
                    }
                } else {
                    if($options['country'] == 'nl') {
                      if (isset($vehicle['priceInfo']['PriceNlWithVatMobilede']) && $vehicle['priceInfo']['PriceNlWithVatMobilede'] != '') {
                            $price = $vehicle['priceInfo']['PriceNlWithVatMobilede'];
                        }
                        elseif(isset($vehicle['priceInfo']['FallbackPriceNlWithVatMobilede']) && $vehicle['priceInfo']['FallbackPriceNlWithVatMobilede'] != '' && isset($options['co2_fallback_display']) && $options['co2_fallback_display'] == 1) {
                            $price = $vehicle['priceInfo']['FallbackPriceNlWithVatMobilede'];
                        } else {
                            $price = false;
                        }
                    } else {
                            $price = false;
                        
                    }
                }

          if (isset($price)) {
            if (!isset($options['only_fl']) || (isset($options['only_fl']) && $options['only_fl'] != 1)) {
            ?>
              <div class="euro-price-wrapper">
                <div class="euro-price">
                  <?php esc_html_e('Price', 'eurostocks'); ?>
                </div>
                <div class="euro-price bold">
                  €
                  <?php

                  echo esc_html(number_format(floatval($price), 0, ',', '.'));
                  ?>,-
                  <br>
                  <?php if ($vehicle['priceInfo']['IsVatable'] == "Nee") { ?>
                    <small>
                      <?php 
                      if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['kosten_vraagprijs_no_tax']) && $options[esc_html($current_lang)]['kosten_vraagprijs_no_tax'] != '') {
                        echo esc_html($options[esc_html($current_lang)]['kosten_vraagprijs_no_tax']);
                      } else {
                        echo esc_html($options['kosten_vraagprijs_no_tax']);
                      } 
                      ?>
                    </small>
                  <?php } else { ?>
                    <small>
                      <?php 
                      if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['kosten_vraagprijs_tax']) && $options[esc_html($current_lang)]['kosten_vraagprijs_tax'] != '') {
                        echo esc_html($options[esc_html($current_lang)]['kosten_vraagprijs_tax']);
                      } else {
                        echo esc_html($options['kosten_vraagprijs_tax']);
                      } 
                      ?>
                    </small>
                  <?php } ?>

                </div>
              </div>
            <?php
            } else { ?>
              <div class="euro-price-wrapper">
                <div class="euro-price">
                  <?php esc_html_e('Lease from', 'eurostocks'); ?>
                </div>
                <div class="euro-price bold">
                  €
                  <?php

                  echo esc_html($this->eurostocks_financial_lease($eurostocks_fl_interest, $eurostocks_fl_duration, $eurostocks_fl_rest, $price));
                  ?>,-

                </div>
              </div>
            <?php }
            if (isset($price) && (isset($options['enable_fl']) && $options['enable_fl'] == 1) && (!isset($options['only_fl']) || $options['only_fl'] == 0)) { ?>
              <span class="euro-price-wrapper euro-fl"><span class="euro-helper-text"><?php esc_html_e('Lease from', 'eurostocks'); ?></span> <span
                  class="euro-price bold">€
                  <?php echo esc_html($this->eurostocks_financial_lease($eurostocks_fl_interest, $eurostocks_fl_duration, $eurostocks_fl_rest, $price)); ?>,-
                </span></span>
            <?php }
          } else { ?>
            <div class="euro-price bold">
              <?php 
                if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['txt_priceonrequest']) && $options[esc_html($current_lang)]['txt_priceonrequest'] != ""  ){ 
                  echo esc_html($options[esc_html($current_lang)]['txt_priceonrequest']); 
                }else{ 
                  if (isset($options['txt_priceonrequest']) && $options['txt_priceonrequest'] != "") {
                    echo esc_html($options['txt_priceonrequest']);
                  } else {
                    esc_html_e("Price on request", 'eurostocks');
                  } 
                }
              ?><br>
          <?php } ?>



              </div>

            </div>
            <?php

          }
          ?>

          <div class="clear"></div>




          <div>
            <div class="eurocol-12">
              <h3>
                <?php esc_html_e("Options", 'eurostocks'); ?>
              </h3>
            </div>
          </div>
          <div class="bar"></div>

          <?php
          $options_array = array();
          ?>
          <?php
          if (isset($vehicle['features']['airco']) && $vehicle['features']['airco'] != '') {
            $options_array[] = $vehicle['features']['airco'];
          }
          if (isset($vehicle['features']['speedControl']) && $vehicle['features']['speedControl'] != '') {
            $options_array[] = $vehicle['features']['speedControl'];
          }
          if (isset($vehicle['features']['trailerCouplingType']) && $vehicle['features']['trailerCouplingType'] != '') {
            $options_array[] = $vehicle['features']['trailerCouplingType'];
          }
          if (isset($vehicle['features']['daytimeRunningLamps']) && $vehicle['features']['daytimeRunningLamps'] != '') {
            $options_array[] = $vehicle['features']['daytimeRunningLamps'];
          }
          if (isset($vehicle['features']['bendingLightsType']) && $vehicle['features']['bendingLightsType'] != '') {
            $options_array[] = $vehicle['features']['bendingLightsType'];
          }
          if (isset($vehicle['radio']) && $vehicle['radio'] != '') {
            foreach ($vehicle['radio'] as $radio) {
              $options_array[] = $radio;
            }
          }
          if (isset($vehicle['features']['breakdownService']) && $vehicle['features']['breakdownService'] != '') {
            $options_array[] = $vehicle['features']['breakdownService'];
          }
          if (isset($vehicle['features']['airbags']) && $vehicle['features']['airbags'] != '') {
            $options_array[] = $vehicle['features']['airbags'];
          }
          if (isset($vehicle['features']['centralDoorLock']) && $vehicle['features']['centralDoorLock'] != '') {
            $options_array[] = esc_html__("Central door lock", 'eurostocks');
          }
          if (isset($vehicle['features']['rangeExtender']) && $vehicle['features']['rangeExtender'] != '') {
            $options_array[] = esc_html__("Range extender", 'eurostocks');
          }
          if (isset($vehicle['features']['laneDepartureWarning']) && $vehicle['features']['laneDepartureWarning'] != '') {
            $options_array[] = esc_html__("Lane Departure Warning", 'eurostocks');
          }
          if (isset($vehicle['features']['wifiHotSpot']) && $vehicle['features']['wifiHotSpot'] != '') {
            $options_array[] = esc_html__("Wifi hotspot", 'eurostocks');
          }
          if (isset($vehicle['features']['allSeasonTires']) && $vehicle['features']['allSeasonTires'] != '') {
            $options_array[] = esc_html__("All-season tires", 'eurostocks');
          }
          if (isset($vehicle['features']['keyLessEntry']) && $vehicle['features']['keyLessEntry'] != '') {
            $options_array[] = esc_html__("Keyless-entry", 'eurostocks');
          }
          if (isset($vehicle['features']['roofRails']) && $vehicle['features']['roofRails'] != '') {
            $options_array[] = esc_html__("Roof rails", 'eurostocks');
          }
          if (isset($vehicle['features']['metallic']) && $vehicle['features']['metallic'] != '') {
            $options_array[] = esc_html__("Metallic", 'eurostocks');
          }
          if (isset($vehicle['features']['distanceWarningSystem']) && $vehicle['features']['distanceWarningSystem'] != '') {
            $options_array[] = esc_html__("Distance Warning System", 'eurostocks');
          }
          if (isset($vehicle['features']['alarm']) && $vehicle['features']['alarm'] != '') {
            $options_array[] = esc_html__("Alarm", 'eurostocks');
          }
          if (isset($vehicle['features']['sportPackage']) && $vehicle['features']['sportPackage'] != '') {
            $options_array[] = esc_html__("Sport package", 'eurostocks');
          }
          if (isset($vehicle['features']['steelWheels']) && $vehicle['features']['steelWheels'] != '') {
            $options_array[] = esc_html__("Steel wheels", 'eurostocks');
          }
          if (isset($vehicle['features']['alloyWheels']) && $vehicle['features']['alloyWheels'] != '') {
            $options_array[] = esc_html__("Alloy wheels", 'eurostocks');
          }
          if (isset($vehicle['features']['headUpDisplay']) && $vehicle['features']['headUpDisplay'] != '') {
            $options_array[] = esc_html__("Heads-up display", 'eurostocks');
          }
          if (isset($vehicle['features']['dimmingInteriorMirror']) && $vehicle['features']['dimmingInteriorMirror'] != '') {
            $options_array[] = esc_html__("Dimming Interior mirror", 'eurostocks');
          }
          if (isset($vehicle['features']['nightVision']) && $vehicle['features']['nightVision'] != '') {
            $options_array[] = esc_html__("Night vision", 'eurostocks');
          }
          if (isset($vehicle['features']['collisionAvoidance']) && $vehicle['features']['collisionAvoidance'] != '') {
            $options_array[] = esc_html__("Collision avoidance system", 'eurostocks');
          }
          if (isset($vehicle['features']['e10Enabled']) && $vehicle['features']['e10Enabled'] != '') {
            $options_array[] = esc_html__("e10 Enabled", 'eurostocks');
          }
          if (isset($vehicle['features']['esp']) && $vehicle['features']['esp'] != '') {
            $options_array[] = esc_html__("ESP", 'eurostocks');
          }
          if (isset($vehicle['features']['sportSeats']) && $vehicle['features']['sportSeats'] != '') {
            $options_array[] = esc_html__("Sport seats", 'eurostocks');
          }
          if (isset($vehicle['features']['multiFunctionalSteeringwheel']) && $vehicle['features']['multiFunctionalSteeringwheel'] != '') {
            $options_array[] = esc_html__("Mutlifunctional Steering Wheel", 'eurostocks');
          }
          if (isset($vehicle['features']['nonSmokerVehicle']) && $vehicle['features']['nonSmokerVehicle'] != '') {
            $options_array[] = esc_html__("Non-smoker vehicle", 'eurostocks');
          }
          if (isset($vehicle['features']['hillStartAssist']) && $vehicle['features']['hillStartAssist'] != '') {
            $options_array[] = esc_html__("Hill start-assist", 'eurostocks');
          }
          if (isset($vehicle['features']['electricExteriorMirrors']) && $vehicle['features']['electricExteriorMirrors'] != '') {
            $options_array[] = esc_html__("Electric Exterior Mirrors", 'eurostocks');
          }
          if (isset($vehicle['features']['bioDieselSuitable']) && $vehicle['features']['bioDieselSuitable'] != '') {
            $options_array[] = esc_html__("Bio Diesel Suitable", 'eurostocks');
          }
          if (isset($vehicle['features']['airSuspension']) && $vehicle['features']['airSuspension'] != '') {
            $options_array[] = esc_html__("Air suspension", 'eurostocks');
          }
          if (isset($vehicle['features']['fourWheelDrive']) && $vehicle['features']['fourWheelDrive'] != '') {
            $options_array[] = esc_html__("4-wheel drive", 'eurostocks');
          }
          if (isset($vehicle['features']['performanceHandlingSystem']) && $vehicle['features']['performanceHandlingSystem'] != '') {
            $options_array[] = esc_html__("Performance handling system", 'eurostocks');
          }
          if (isset($vehicle['features']['appleCarplay']) && $vehicle['features']['appleCarplay'] != '') {
            $options_array[] = esc_html__("Apple car play", 'eurostocks');
          }
          if (isset($vehicle['features']['navigationSystem']) && $vehicle['features']['navigationSystem'] != '') {
            $options_array[] = esc_html__("Navigation system", 'eurostocks');
          }
          if (isset($vehicle['features']['panoramicGlassRoof']) && $vehicle['features']['panoramicGlassRoof'] != '') {
            $options_array[] = esc_html__("Panoramic glass roof", 'eurostocks');
          }
          if (isset($vehicle['features']['bluetooth']) && $vehicle['features']['bluetooth'] != '') {
            $options_array[] = esc_html__("Bluetooth", 'eurostocks');
          }
          if (isset($vehicle['features']['vegetableOilFuelSuitable']) && $vehicle['features']['vegetableOilFuelSuitable'] != '') {
            $options_array[] = esc_html__("Vegetable Oil Fuel suitable", 'eurostocks');
          }
          if (isset($vehicle['features']['electricHeatedSeats']) && $vehicle['features']['electricHeatedSeats'] != '') {
            $options_array[] = esc_html__("Electric Heated seats", 'eurostocks');
          }
          if (isset($vehicle['features']['trafficSignRecognition']) && $vehicle['features']['trafficSignRecognition'] != '') {
            $options_array[] = esc_html__("Traffic Sign Recognition", 'eurostocks');
          }
          if (isset($vehicle['features']['smokersPackage']) && $vehicle['features']['smokersPackage'] != '') {
            $options_array[] = esc_html__("Smokers package", 'eurostocks');
          }
          if (isset($vehicle['features']['blindSpotDetection']) && $vehicle['features']['blindSpotDetection'] != '') {
            $options_array[] = esc_html__("Blind spot detection", 'eurostocks');
          }
          if (isset($vehicle['features']['taxi']) && $vehicle['features']['taxi'] != '') {
            $options_array[] = esc_html__("Taxi", 'eurostocks');
          }
          if (isset($vehicle['features']['winterPackage']) && $vehicle['features']['winterPackage'] != '') {
            $options_array[] = esc_html__("Winter package", 'eurostocks');
          }
          if (isset($vehicle['features']['lumbarSupport']) && $vehicle['features']['lumbarSupport'] != '') {
            $options_array[] = esc_html__("Lumbar support", 'eurostocks');
          }
          if (isset($vehicle['features']['foldFlatPassengerSeat']) && $vehicle['features']['foldFlatPassengerSeat'] != '') {
            $options_array[] = esc_html__("Fold flat passengerseat", 'eurostocks');
          }
          if (isset($vehicle['features']['startStopSysteem']) && $vehicle['features']['startStopSysteem'] != '') {
            $options_array[] = esc_html__("Start-stop system", 'eurostocks');
          }
          if (isset($vehicle['features']['skiBag']) && $vehicle['features']['skiBag'] != '') {
            $options_array[] = esc_html__("Ski bag", 'eurostocks');
          }
          if (isset($vehicle['features']['cdPlayer']) && $vehicle['features']['cdPlayer'] != '') {
            $options_array[] = esc_html__("CD player", 'eurostocks');
          }
          if (isset($vehicle['features']['handsFreePhoneSystem']) && $vehicle['features']['handsFreePhoneSystem'] != '') {
            $options_array[] = esc_html__("Handsfree Phone system", 'eurostocks');
          }
          if (isset($vehicle['features']['electricBackseatAdjustment']) && $vehicle['features']['electricBackseatAdjustment'] != '') {
            $options_array[] = esc_html__("Electric Backseat adjustment", 'eurostocks');
          }
          if (isset($vehicle['features']['centerArmRest']) && $vehicle['features']['centerArmRest'] != '') {
            $options_array[] = esc_html__("Center arm rest", 'eurostocks');
          }
          if (isset($vehicle['features']['interiorColor']) && $vehicle['features']['interiorColor'] != '') {
            $options_array[] = esc_html__("Interior color", 'eurostocks');
          }
          if (isset($vehicle['features']['disabledAccessible']) && $vehicle['features']['disabledAccessible'] != '') {
            $options_array[] = esc_html__("Disabled Accessible", 'eurostocks');
          }
          if (isset($vehicle['features']['speedLimiter']) && $vehicle['features']['speedLimiter'] != '') {
            $options_array[] = esc_html__("Speed limiter", 'eurostocks');
          }
          if (isset($vehicle['features']['androidAuto']) && $vehicle['features']['androidAuto'] != '') {
            $options_array[] = esc_html__("Android car", 'eurostocks');
          }
          if (isset($vehicle['features']['isofix']) && $vehicle['features']['isofix'] != '') {
            $options_array[] = esc_html__("Isofix", 'eurostocks');
          }
          if (isset($vehicle['features']['ambientLighting']) && $vehicle['features']['ambientLighting'] != '') {
            $options_array[] = esc_html__("Ambient lighting", 'eurostocks');
          }
          if (isset($vehicle['features']['integratedMusicStreaming']) && $vehicle['features']['integratedMusicStreaming'] != '') {
            $options_array[] = esc_html__("Integrated music streaming", 'eurostocks');
          }
          if (isset($vehicle['features']['highBeamAssist']) && $vehicle['features']['highBeamAssist'] != '') {
            $options_array[] = esc_html__("High beam assist", 'eurostocks');
          }
          if (isset($vehicle['features']['onboardComputer']) && $vehicle['features']['onboardComputer'] != '') {
            $options_array[] = esc_html__("Onboard computer", 'eurostocks');
          }
          if (isset($vehicle['features']['massageSeats']) && $vehicle['features']['massageSeats'] != '') {
            $options_array[] = esc_html__("Massage seats", 'eurostocks');
          }
          if (isset($vehicle['features']['tv']) && $vehicle['features']['tv'] != '') {
            $options_array[] = esc_html__("TV", 'eurostocks');
          }
          if (isset($vehicle['features']['abs']) && $vehicle['features']['abs'] != '') {
            $options_array[] = esc_html__("ABS", 'eurostocks');
          }
          if (isset($vehicle['features']['headlightWasherSystem']) && $vehicle['features']['headlightWasherSystem'] != '') {
            $options_array[] = esc_html__("Headlight washer system", 'eurostocks');
          }
          if (isset($vehicle['features']['auxiliaryHeating']) && $vehicle['features']['auxiliaryHeating'] != '') {
            $options_array[] = esc_html__("Auxiliary Heating", 'eurostocks');
          }
          if (isset($vehicle['features']['powerAssistedSteering']) && $vehicle['features']['powerAssistedSteering'] != '') {
            $options_array[] = esc_html__("Power assisted steering", 'eurostocks');
          }
          if (isset($vehicle['features']['glareFreeHighBeam']) && $vehicle['features']['glareFreeHighBeam'] != '') {
            $options_array[] = esc_html__("Glare free high beam", 'eurostocks');
          }
          if (isset($vehicle['features']['cargoBarrier']) && $vehicle['features']['cargoBarrier'] != '') {
            $options_array[] = esc_html__("Cargo barrier", 'eurostocks');
          }
          if (isset($vehicle['features']['electricHeatedRearSeats']) && $vehicle['features']['electricHeatedRearSeats'] != '') {
            $options_array[] = esc_html__("Electric heated rear seats", 'eurostocks');
          }
          if (isset($vehicle['features']['leatherSteeringWheel']) && $vehicle['features']['leatherSteeringWheel'] != '') {
            $options_array[] = esc_html__("Leather steering wheel", 'eurostocks');
          }
          if (isset($vehicle['features']['summerTires']) && $vehicle['features']['summerTires'] != '') {
            $options_array[] = esc_html__("Summer tires", 'eurostocks');
          }
          if (isset($vehicle['features']['cdMultichanger']) && $vehicle['features']['cdMultichanger'] != '') {
            $options_array[] = esc_html__("CD multichanger", 'eurostocks');
          }
          if (isset($vehicle['features']['usb']) && $vehicle['features']['usb'] != '') {
            $options_array[] = esc_html__("USB", 'eurostocks');
          }
          if (isset($vehicle['features']['soundSystem']) && $vehicle['features']['soundSystem'] != '') {
            $options_array[] = esc_html__("Sound system", 'eurostocks');
          }
          if (isset($vehicle['features']['voiceControl']) && $vehicle['features']['voiceControl'] != '') {
            $options_array[] = esc_html__("Voice control", 'eurostocks');
          }
          if (isset($vehicle['features']['digitalCockpit']) && $vehicle['features']['digitalCockpit'] != '') {
            $options_array[] = esc_html__("Digital cockpit", 'eurostocks');
          }
          if (isset($vehicle['features']['lightSensor']) && $vehicle['features']['lightSensor'] != '') {
            $options_array[] = esc_html__("Light sensor", 'eurostocks');
          }
          if (isset($vehicle['features']['tractionControlSystem']) && $vehicle['features']['tractionControlSystem'] != '') {
            $options_array[] = esc_html__("Traction control system", 'eurostocks');
          }
          if (isset($vehicle['features']['immobilizer']) && $vehicle['features']['immobilizer'] != '') {
            $options_array[] = esc_html__("Immobilizer", 'eurostocks');
          }
          if (isset($vehicle['features']['heatedWindshield']) && $vehicle['features']['heatedWindshield'] != '') {
            $options_array[] = esc_html__("Heated Windshields", 'eurostocks');
          }
          if (isset($vehicle['features']['emergencyCallSystem']) && $vehicle['features']['emergencyCallSystem'] != '') {
            $options_array[] = esc_html__("Emergency Call system", 'eurostocks');
          }
          if (isset($vehicle['features']['electricAdjustableSeats']) && $vehicle['features']['electricAdjustableSeats'] != '') {
            $options_array[] = esc_html__("Electric adjustable Seats", 'eurostocks');
          }
          if (isset($vehicle['features']['winterTires']) && $vehicle['features']['winterTires'] != '') {
            $options_array[] = esc_html__("Winter tires", 'eurostocks');
          }
          if (isset($vehicle['features']['touchScreen']) && $vehicle['features']['touchScreen'] != '') {
            $options_array[] = esc_html__("Touchscreen", 'eurostocks');
          }
          if (isset($vehicle['features']['ventilatedSeats']) && $vehicle['features']['ventilatedSeats'] != '') {
            $options_array[] = esc_html__("Ventilated seats", 'eurostocks');
          }
          if (isset($vehicle['features']['particulateFilterDiesel']) && $vehicle['features']['particulateFilterDiesel'] != '') {
            $options_array[] = esc_html__("Particulate Filter Diesel", 'eurostocks');
          }
          if (isset($vehicle['features']['tirePressureMonitoring']) && $vehicle['features']['tirePressureMonitoring'] != '') {
            $options_array[] = esc_html__("Tire Pressure Monitoring", 'eurostocks');
          }
          if (isset($vehicle['features']['fullServiceHistory']) && $vehicle['features']['fullServiceHistory'] != '') {
            $options_array[] = esc_html__("Full service history", 'eurostocks');
          }
          if (isset($vehicle['features']['electricWindows']) && $vehicle['features']['electricWindows'] != '') {
            $options_array[] = esc_html__("Electrisc windows", 'eurostocks');
          }
          if (isset($vehicle['features']['sunroof']) && $vehicle['features']['sunroof'] != '') {
            $options_array[] = esc_html__("sunroof", 'eurostocks');
          }
          if (isset($vehicle['features']['heatedSteeringWheel']) && $vehicle['features']['heatedSteeringWheel'] != '') {
            $options_array[] = esc_html__("Heated steering wheel", 'eurostocks');
          }
          if (isset($vehicle['features']['warranty']) && $vehicle['features']['warranty'] != '') {
            $options_array[] = esc_html__("Warranty", 'eurostocks');
          }
          sort($options_array);
          $j = 0;

          ?>
  

          <?php
          // cut the options_array in 3 parts based on the length of the array
          $options_array_length = count($options_array);
          $options_array_length = $options_array_length / 3;
          $options_array_length = round($options_array_length);
          $options_column_1 = array_slice($options_array, 0, $options_array_length);
          $options_column_2 = array_slice($options_array, $options_array_length, $options_array_length);
          $options_column_3 = array_slice($options_array, $options_array_length * 2, $options_array_length);


          ?>
          <div class="column">
            <?php
            foreach ($options_column_1 as $roption) {
              echo '<div><div class="eurocol-12 eurocol-sm-12">' . esc_html($roption) . '</div></div>';
            }
            ?>
          </div>
          <div class="column">
            <?php
            foreach ($options_column_2 as $roption) {
              echo '<div><div class="eurocol-12 eurocol-sm-12">' . esc_html($roption) . '</div></div>';
            }
            ?>
          </div>
          <div class="column">
            <?php
            foreach ($options_column_3 as $roption) {
              echo '<div><div class="eurocol-12 eurocol-sm-12">' . esc_html($roption) . '</div></div>';
            }
            ?>
          </div>



          <div class="clear"><br><br></div>

          <div class="voordelen">
            <?php if (isset($options['txt_voordeel1']) && $options['txt_voordeel1'] != '') { ?>
              <div>
                <img class="mw-100" src="<?php echo esc_url(plugin_dir_url(__DIR__)); ?>images/checkmark.png">
                <div class="voordeeltxt">
                  <?php 
                  if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['txt_voordeel1']) && $options[esc_html($current_lang)]['txt_voordeel1'] != ''){
                    echo esc_html($options[esc_html($current_lang)]['txt_voordeel1']);
                  } else {
                    echo esc_html($options['txt_voordeel1']); 
                  }
                  ?>
                </div>

                <div class="clear"></div>
              </div>
            <?php } ?>
            <?php if (isset($options['txt_voordeel2']) && $options['txt_voordeel2'] != '') { ?>
              <div>
                <img class="mw-100" src="<?php echo esc_url(plugin_dir_url(__DIR__)); ?>images/checkmark.png">
                <span class="voordeeltxt">
                  <?php 
                  if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['txt_voordeel2']) && $options[esc_html($current_lang)]['txt_voordeel2'] != ''){
                    echo esc_html($options[esc_html($current_lang)]['txt_voordeel2']);
                  } else {
                    echo esc_html($options['txt_voordeel2']); 
                  }
                  ?>
                </span>
                <div class="clear"></div>
              </div>
            <?php } ?>
            <?php if (isset($options['txt_voordeel3']) && $options['txt_voordeel3'] != '') { ?>
              <div>
                <img class="mw-100" src="<?php echo esc_url(plugin_dir_url(__DIR__)); ?>images/checkmark.png">
                <span class="voordeeltxt">
                  <?php if($diflang && isset($options[esc_html($current_lang)]) && isset($options[esc_html($current_lang)]['txt_voordeel3']) && $options[esc_html($current_lang)]['txt_voordeel3'] != ''){
                    echo esc_html($options[esc_html($current_lang)]['txt_voordeel3']);
                  } else {
                    echo esc_html($options['txt_voordeel3']); 
                  } ?>
                </span>
                <div class="clear"></div>
              </div>
            <?php } ?>
          </div>
        </div>
      </div>
    </div>

    <?php if (isset($options['show_powered_by']) && $options['show_powered_by'] > 0) { ?>
      <div class="eurocol-12">
        <div class="es-float-right">
          <small style="height:40px; line-height:40px; margin-top:-10px;">Powered by</small>
          <a href="https://www.eurostocks.com/nl-nl/cms/onze-diensten/importsoftware" target="_blank"><img
              style="display:inline-block;margin-top:10px;"
              src="<?php echo esc_url(plugin_dir_url(__DIR__)) . 'images/eurostocks.png'; ?>" alt="Eurostocks"></a>
        </div>
      </div>
    <?php } ?>
    </div>


    <?php
}
elseif($data == '404'){
  ?>

<div class="euro-modal-header">
    <h2 class="euro-modal-title"><span class="es-text-primary">
      <?php esc_html_e('Car not available', 'eurostocks'); ?>
    </h2>
  
  </div>
  <div class="euro-modal-body">
    <div class="es-404">
      <p><?php esc_html_e('The car you are looking for is no longer available.', 'eurostocks'); ?></p>
    </div>
  </div>


  <?php
}
?>
</body>