<?php /* Smarty version Smarty-3.1.8, created on 2019-12-24 16:25:18
         compiled from "/home/stg70/public_html/agmc-v2/application/core/views/frontend/mini/LeaseCalculator.tpl" */ ?>
<?php /*%%SmartyHeaderCode:271150635ddb92915da5c9-99945309%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'ababf7cf847655a303648b84bb16437d9e39dee0' => 
    array (
      0 => '/home/stg70/public_html/agmc-v2/application/core/views/frontend/mini/LeaseCalculator.tpl',
      1 => 1577180532,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '271150635ddb92915da5c9-99945309',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_5ddb9291648729_40804612',
  'variables' => 
  array (
    'SelCurrLanguage' => 0,
    'languageDirection' => 0,
    'commonMetaTitle' => 0,
    'language' => 0,
    'commonMetaDescription' => 0,
    'resBrandCategories' => 0,
    'staticBlock' => 0,
    'view_public_path' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5ddb9291648729_40804612')) {function content_5ddb9291648729_40804612($_smarty_tpl) {?><!DOCTYPE html>
<html lang="<?php echo $_smarty_tpl->tpl_vars['SelCurrLanguage']->value;?>
" dir="<?php echo $_smarty_tpl->tpl_vars['languageDirection']->value;?>
">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title><?php if ($_smarty_tpl->tpl_vars['commonMetaTitle']->value){?><?php echo $_smarty_tpl->tpl_vars['commonMetaTitle']->value;?>
<?php }else{ ?><?php echo $_smarty_tpl->tpl_vars['language']->value['lblLeaseCalculator'];?>
<?php }?></title>
<meta name="Description" content="<?php echo $_smarty_tpl->tpl_vars['commonMetaDescription']->value;?>
" />
<meta name="viewport" content="width=device-width">
<?php echo $_smarty_tpl->getSubTemplate ('CommonJavaScript.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?>

<?php echo $_smarty_tpl->getSubTemplate ('CommonStyles.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?>


<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->rootpath_script(array(),$_smarty_tpl);?>

<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->basepath_script(array(),$_smarty_tpl);?>


</head>
<body ng-controller="SearchCtrl" class="<?php echo $_smarty_tpl->tpl_vars['languageDirection']->value;?>
">
<!-- Begin : Outer Pane -->
<div id="main"> 
  <!-- Begin : Header Pane--> 
  <?php echo $_smarty_tpl->getSubTemplate ('CommonTop.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?>
 
  <!-- End : Header -->
  <div id="content-wrapper" ng-show="!query" >
    <div class="wrapper clearfix">
      <div id="common_message"></div>
      <div id="common_message_forgot" ></div>
      <div id="invalid_email"></div>
      <div class="full-width-div clearfix">
       

        </div>
      </div>

    <div id="lease-calculator-blk">
      <div class="container pt-4 pb-5">
        <div class="row mt-3">
          <div class="col-lg-12 col-md-12 col-sm-12">
            <h4 class="font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblLeaseCalculator'];?>
</h4>
            <p class="font-family-primary mb-lg-5 mb-4"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblLeaseInTwoStepsMini'];?>
</p>
          </div>
          <div class="col-lg-6 col-md-6 col-sm-12">
            <div class="lease-calculator-box form-blk col-md-9 col-12 p-0">
              <h6 class="font-weight-bold f15 mb-4"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblStepOneSelectMini'];?>
</h6>
              <div class="col-12 p-0 mb-4">
                <label class="font-normal text-secondary mb-1 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblModel'];?>
</label>

				<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->select(array('name'=>"series",'caption'=>"->".($_smarty_tpl->tpl_vars['language']->value['lblSelect']),'class'=>"form-control",'options'=>$_smarty_tpl->tpl_vars['resBrandCategories']->value),$_smarty_tpl);?>
 
              </div>
              <div class="col-12 p-0 mb-4">
                <label class="font-normal text-secondary mb-1 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblShortDescription'];?>
</label>

				<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->select(array('name'=>"shortDesc",'caption'=>"->".($_smarty_tpl->tpl_vars['language']->value['lblSelect']),'class'=>"form-control"),$_smarty_tpl);?>
 
              </div>
              <div class="col-12 p-0 mb-4">
                <label class="font-normal text-secondary mb-1 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblVariant'];?>
</label>

				<?php echo $_smarty_tpl->smarty->registered_objects['form'][0]->select(array('name'=>"variant",'caption'=>"->".($_smarty_tpl->tpl_vars['language']->value['lblSelect']),'class'=>"form-control"),$_smarty_tpl);?>
 
              </div>
              <div class="col-12 p-0 mb-4">
			  <div id="leasestaticBlock">
				<?php if ((($tmp = @$_smarty_tpl->tpl_vars['staticBlock']->value)===null||$tmp==='' ? '' : $tmp)){?>
					<?php echo htmlspecialchars_decode($_smarty_tpl->tpl_vars['staticBlock']->value, ENT_QUOTES);?>

				<?php }?> 
				</div>
                <img id="vehicleImage" src="" class="img-fluid"/>
                <h6 id="productTitle" class="text-secondary font-weight-bold mt-0 mb-3"></h6>
                <div id="regularPrice" class="text-secondary font-weight-bold mt-0 mb-3 h4"></div>
               
              </div>
            </div>
          </div>
          <div class="col-lg-6 col-md-6 col-sm-12">
          <h6 class="font-weight-bold f15 mb-4"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblLeaseStepTwoLeaseMileageMini'];?>
</h6>
          <div class="lease-calculator-box form-blk col-md-9 col-12 p-0">
              <div class="col-12 p-0 mb-4">
                <label class="font-normal text-secondary mb-0 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblDurationOfLease'];?>
</label>
                <div class="row align-items-center">
                  <div class="col-sm-8 col-12" dir="ltr">
                    <div id="durationrangeslider" class="mb-3 mt-4"></div>
                    <div class="d-flex justify-content-between font-xsmall text-muted">
                      <span>12</span>
                      <span>36</span>
                    </div>
                  </div>
                  <div class="col-sm-4 col-12">
                    <div id="duration" class="h6 font-weight-bold m-0"></div>
                    <span class="font-xsmall text-muted"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblMonths'];?>
</span>
                  </div>
                </div>
              </div>
              <div class="col-12 p-0 mb-4">
                <label class="font-normal text-secondary mb-0 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblMileage'];?>
</label>
                <div class="row align-items-center">
                  <div class="col-sm-8 col-12" dir="ltr">
                    <div id="mileagerangeslider" class="mb-3 mt-4" ></div>
                    <div class="d-flex justify-content-between font-xsmall text-muted">
                      <span>10K</span>
                      <span>25K</span>
                    </div>
                  </div>
                  <div class="col-sm-4 col-12">
                    <div id="mileage" class="h6 font-weight-bold m-0"></div>
                    <span class="font-xsmall text-muted"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblMileage'];?>
</span>
                  </div>
                </div>
              </div>
              <div class="col-12 p-0 mb-4">
                <label class="font-normal text-secondary mb-2 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblTireChange'];?>
</label>
                <div class="row align-items-center">
                  <div class="col-auto">
                    <input type="radio" id="yes" name="tirechange" value="yes" class="tirechange" checked="checked"/>
                    <label for="yes"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblYes'];?>
</label>
                  </div>
                  <div class="col-auto">
                    <input type="radio" id="no" name="tirechange"  value="no"  class="tirechange"/>
                    <label for="no"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblNo'];?>
</label>
                  </div>
                </div>
              </div>
              <div class="col-sm-8 col-12 p-0 mb-5">
                <label class="font-normal text-secondary mb-1 font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblAmount'];?>
</label>
                <input type="text" class="form-control" id="leaseRate"  readonly="readonly"/>
              </div>
			   <div class="col-12 p-0 mb-5">
                <h6 class="font-normal text-secondary font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblDisclaimer'];?>
</h6>
                <p class="font-family-primary"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblLeaseDisclaimer'];?>
</p>
              </div>
              <div class="col-12 p-0 mb-4">
                <button class="btn-primary continue-btn cursor-pointer py-3 px-5 border-0 font-small font-weight-bold"><?php echo $_smarty_tpl->tpl_vars['language']->value['lblContinue'];?>
</button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- End : Content Pane --> 
  </div>
  <!-- Begin : Footer	Pane --> 
  <?php echo $_smarty_tpl->getSubTemplate ('CommonBottom.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?>
 
  <!-- End : Footer Pane --> 
</div>
<!-- End : Outer Pane --> 
<?php echo $_smarty_tpl->getSubTemplate ('CommonJavaScriptBottom.tpl', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0); ?>
 

<?php echo $_smarty_tpl->smarty->registered_objects['html'][0]->messages_script(array('id'=>"common_message"),$_smarty_tpl);?>
 

<script>
 var view_public_path 		= '<?php echo $_smarty_tpl->tpl_vars['view_public_path']->value;?>
';
  var redirectPath			= '';
  $( function() {
          $( "#durationrangeslider" ).slider({
              range: 'min',
              min: 12,
              max: 36,
              step: 12,
              slide: function(event, ui) {
				$( "#duration" ).html(ui.value);
				leaseCalculator();
              }
          });
          $( "#duration" ).html($( "#durationrangeslider" ).slider( "values", 1 ));
          $( "#mileagerangeslider" ).slider({
              range: 'min',
              min: 10,
              max: 25,
			  step: 5,
              slide: function(event, ui) {
				$( "#mileage" ).html(ui.value*1000);
				leaseCalculator();
              }
          });
          $( "#mileage" ).html($( "#mileagerangeslider" ).slider( "values", 1 )*1000);
		  
		  $('#series').change(function(){ 
			if($(this).val() != ''){
				$.ajax({
					type: "POST",
					url: GLOBAL_BASE_PATH + "/financecalculator/ajaxGetShortDesc/",
					data: 'category='+$(this).val(),
					success: function (data) 
					{          		
						  $( "#shortDesc" ).html(data);
					}
				});
			}
		});
		$('#shortDesc').change(function(){ 
			if($(this).val() != ''){
				$.ajax({
					type: "POST",
					url: GLOBAL_BASE_PATH + "/financecalculator/ajaxGetProducts/",
					data: 'shortDesc='+$(this).val(),
					success: function (data) 
					{          		
						  $( "#variant" ).html(data);
					}
				});
			}
		});
		$('#variant').change(function(){ 
			leaseCalculator();
			var product_id 	= $('#variant option:selected').attr("product_id"); 
			if(typeof product_id !== "undefined") {
			$.ajax({
					type: "POST",
					url: GLOBAL_BASE_PATH + "/leasecalculator/ajaxgetProductDetails/",
					data: 'product_id='+product_id,
					success: function (data) 
					{          		
					  var obj = JSON.parse(data);
						$( "#productTitle" ).html(obj.productTitle);
						$( "#regularPrice" ).html($.getFormattedCurrency(obj.productOptionRegularPrice));
						$( "#vehicleImage" ).attr('src',view_public_path+'/uploads/catalog/vehicles/thumb/'+obj.vehicleImage);
						redirectPath = obj.requestPath;
						$( "#leasestaticBlock" ).hide();
					}
				});
			} else {
				$( "#leasestaticBlock" ).show();
			}
			
      });
	  $('.tirechange').change(function(){ 
		leaseCalculator();
      });
	  $('.continue-btn').click(function(){
			var link = siteUrl;
			link = link.replace(/\/$/, "")
			if(redirectPath!='')
				link += '/'+redirectPath;
			window.location =   link;
			
		});
});
function leaseCalculator() {
if($('#variant').val()!= '') {
	var duration 		= $( "#duration" ).text();
	var mileage  		= ($( "#mileage" ).text())/1000;
	var variantCode  	= $('#variant').val();
	var tyreChange		= $('input[name=tirechange]:checked').val();
	$.ajax({
		type: "POST",
		url: GLOBAL_BASE_PATH + "/leasecalculator/ajaxGetLeaseRate/",
		data: 'variantCode='+variantCode+'&duration='+duration+'&mileage='+mileage+'&tyreChange='+tyreChange,
		success: function (rate) 
		{   
			if(rate!='')		
			$( "#leaseRate" ).val($.getFormattedCurrency(rate));
			else 
			$( "#leaseRate" ).val('');
		}
	});
}
}
$(document).ready(function(){
 //while coming back to this page on browser back button press, the dropdowns populated
		 if($('#series').val()>0) {
			$('#series').trigger("change");
			
		 }	
});
</script>
</body>
</html>
<?php }} ?>