<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<?php $allParams = $this->allParams; ?>
<div class="landing_page_container landing_inspira_counter">
  <div class="row">
		<div class="col-md-7">
			<div class="counter_left wow slideInLeft">
				<?php if(!empty($allParams['heading'])) { ?>
					<h3 class="custom_heading"><?php echo $this->translate($allParams['heading']); ?></h3>
				<?php } ?>
				<?php if(!empty($allParams['description'])) { ?>
					<p class="custom_des"><?php echo $this->translate($allParams['description']); ?></p>
				<?php } ?>
				<ul class="landing_inspira_counter_box">
					<?php for($i=1;$i<=4;$i++) { ?>
						<?php if(!empty($allParams['counter'.$i]) || !empty($allParams['counter'.$i.'text']) || !empty($allParams['counter'.$i.'font'])) { ?>
							<li>
								<div class="landing_inspira_counter_detail">
									<?php if($allParams['counter'.$i]) { ?>
										<h3> <span class="count" data-count="<?php echo $allParams['counter'.$i]; ?>"> 0 </span> + </h3>
									<?php } ?>
									<?php if($allParams['counter'.$i.'text']) { ?>
										<p><?php echo $this->translate($allParams['counter'.$i.'text']); ?></p>
									<?php } ?>
								</div>
							</li>
						<?php } ?>
					<?php } ?>
				</ul>
			</div>
		</div>
		<div class="col-md-5">
			<div class="counter_right wow slideInRight">
				<?php if(!empty($allParams['rightmage'])) { ?>
					<?php $path = Engine_Api::_()->core()->getFileUrl($allParams['rightmage'], true); ?>
					<img src="<?php echo $path['image']; ?>" alt="<?php echo $path['alt_text'] ? $path['alt_text'] : 'img'; ?>">
				<?php } else { ?>
					<?php $rightmage = 'application/modules/Inspira/externals/images/counter.jpg'; ?>
					<img src="<?php echo $this->layout()->staticBaseUrl . $rightmage; ?>" alt="img">
				<?php } ?>
			</div>
		</div> 
  </div>
</div>
<?php $bgImage = $allParams['backgroundimage'] ? $allParams['backgroundimage'] : 'application/modules/Inspira/externals/images/counter-bg.jpg'; ?>
<style>
.generic_layout_container.layout_inspira_landing_page_counter{
  background-image:url(<?php echo $this->layout()->staticBaseUrl . $bgImage; ?>) !important;
}
</style>
<script type="text/javascript">
   var counted = 0;
   $(window).scroll(function() {
   
   var oTop = $('.landing_inspira_counter_box').offset().top - window.innerHeight;
    if (counted == 0 && $(window).scrollTop() > oTop) {
     $('.count').each(function() {
       var $this = $(this),
         countTo = $this.attr('data-count');
       $({
         countNum: $this.text()
       }).animate({
           countNum: countTo
         },
   
         {
   
           duration: 5000,
           easing: 'swing',
           step: function() {
             $this.text(Math.floor(this.countNum));
           },
           complete: function() {
             $this.text(this.countNum);
             //alert('finished');
           }
   
         });
     });
     counted = 1;
    }
  });
</script>
