<?php $_shouldextend[1]=1; ?>

<?php $this->startSection('content'); ?>
	
	<?php $this->startPush("metadata"); ?>
 <?php echo $metadata; ?>

	<?php $this->stopPush(); ?>

	<div class="container-fluid first-tip position-relative" style="margin-top: 75px;" id="begin" >
 <div id="img-container" class="carousel slide mt-0 mb-0" data-ride="carousel" data-interval="false">

 <!-- Indicators -->


 <!-- The slideshow -->
 <div class="carousel-inner">
 <div class="carousel-item active" >
 <div class="sm-banner w-100 img" style="
 height:35vh;
 background: url('assets/img/<?php echo static::e($project->base_img); ?>') 100% 100%;
 background-size: cover;
 background-attachment: fixed;
 ">

 </div>
 </div>
 </div>
 </div>
 <div class="w-100 h-100 position-absolute on-top-0" style="
 background: linear-gradient(to bottom, rgba(0,0,0,.3),rgba(0,0,0,.5));
 ">
 <div class="container h-100">
 <div class="row align-items-center justify-content-center h-100 pt-3">

 <div class="col-12 col-lg-7">
 <div class="grid-container">

 <h5 class="text-light text-from-top text-center font-weight-normal text-justify text-uppercase big-font">
 <?php echo static::e($project->name); ?>

 </h5>
 </div>
 </div>


 </div>
 </div>


 </div>

	</div>

	<div class="">
 <section class="container-fluid py-5">
 <div class="container">
 <div class="d-flex justify-content-center">
 <div class="col-12 col-lg-10">
 <?php
 $numOfParaphs = preg_split("/\r|\r\n|\n/", $project->description);
 for ($i = 0; $i < count($numOfParaphs); $i++) {
 ?>

 <p class="text-justify"><?= $numOfParaphs[$i] ?></p>

 <?php } ?>
 </div>
 </div>

 <p class="font-weight-bold pt-5 mt-5 border-top text-center mb-4 text-std-2">Partilhar projecto</p>
 <div class="d-flex justify-content-center">
 <div class="fb-share-button pl-0 mr-1"
  data-href="<?php echo static::e(BASE_URL ."projecto/".$project->id_project); ?>"
  data-layout="button_count" data-size="small" data-mobile-iframe="true">
 <a class="d-flex border-0 justify-content-center big-font btn rounded-0 btn-outline-dark align-items-center mr-2 pr-2"
    href="https://www.facebook.com/sharer/sharer.php?u=<?php echo static::e(urlencode(BASE_URL . "projecto/".$project->id_project."/")); ?>&amp;src=sdkpreparse"
    target="_blank">
 <i class="fa fa-facebook-official	 mr-2"></i>
 <p class="m-0 hidden-sm ">Facebook</p>
 </a>
 </div>

 <a class="d-flex border-0 justify-content-center big-font btn rounded-0 btn-outline-dark align-items-center"
    href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo static::e(urlencode(BASE_URL."projecto/".$project->id_project."/&title=".substr($project->name, 0, 200)."&summary=".substr($project->description, 0, 256)."&source=gka")); ?>"
    target="_blank">
 <i class="fa fa-linkedin	 mr-2"></i>
 <p class="m-0 hidden-sm">Linkedin</p>
 </a>


 <a class="d-flex border-0 ml-2 justify-content-center big-font btn rounded-0 btn-outline-dark align-items-center"
    href="https://wa.me/?text=<?php echo static::e(BASE_URL . "projecto/".$project->id_project."/"); ?>"
    data-action="share/whatsapp/share"
    target="_blank">
 <i class="fa fa-whatsapp mr-2"></i>
 <p class="m-0 hidden-sm">WhatsApp</p>
 </a>
 </div>
 </div>
 </section>
 <section class="container-fluid pt-5 pb-5  position-relative " id="projects" >
 <div class="">

 <div class="row justify-content-center align-items-top ">


 <?php if(count($project->attachments) > 1): ?>
 <?php ($totalItems = count($project->attachments)); ?>

 <?php ($limit = ($totalItems > 3) ? 3 : 1); ?>
 <?php for($eIndex = 0,$auxIndex = ceil($totalItems/3), $auxI =0; $eIndex < $limit; $eIndex++): ?>

 <div class="col-lg-4 col-12 pb-3" >

 <?php
 for ($i = $auxI; $i < $auxIndex;$i++) {
 if($i == $totalItems)
 break;

 $random =$i;
 $attachment = $project->attachments[$random];
 ?>
 <div class="scale-item-1 pb-1 " data-rand="<?php echo static::e($random); ?>">
 <div class=" img-card position-relative">
 <img src="assets/img/<?php echo static::e($attachment->url); ?>" class="w-100">
 <div class= "hidden img-card-holder position-absolute  on-top-0 on-left-0 w-100 h-100 card-dark" data-toggle="modal" data-target="#see-img-modal" data-src = "<?php echo static::e($i); ?>">
 <div class="d-flex align-items-center justify-content-center h-100 w-100">
 <i class="text-light material-icons big-font">remove_red_eye</i>
 </div>
 </div>
 </div>
 </div>
 <?php

 }
 ?>

 </div>
 <?php 
 $auxI = $auxIndex;
 $auxIndex += ceil($totalItems/3);

  ?>


 <?php endfor; ?>

 <?php endif; ?>
 </div>

 </div>
 </section>
	</div>

	<!-- The Modal -->
	<div class="modal" id="see-img-modal">
 <div class="modal-dialog modal-dialog-centered modal-xl">
 <div class="modal-content rounded-0 bg-darker">

 <!-- Modal Header -->
 <div class="modal-header border-x-bottom-dark">
 <h6 class="modal-title text-light text-std-2 sm-font">IMAGEM - <?php echo static::e($project->name); ?></h6>
 <div class="mx-auto">
 <a class="btn btn-dark border-x rounded-0 mr-2"
    href="#img-slider" data-slide="prev"
 >
 <i class="fa fa-long-arrow-left"></i>
 </a>
 <a class="btn btn-dark border-x rounded-0 mr-2"
    href="#img-slider" data-slide="next"
 >
 <i class="fa fa-long-arrow-right"></i>
 </a>
 </div>
 <button type="button" class="close ml-0 text-light" data-dismiss="modal">&times;</button>
 </div>

 <!-- Modal body -->
 <div class="modal-body px-0 py-0">
 <div id="img-slider" class="carousel slide carousel-fade my-0" data-interval="false" data-ride="carousel">
 <ul class="hidden carousel-indicators">
 <?php $__currentLoopData = $project->attachments; $this->addLoop($__currentLoopData); foreach($__currentLoopData as $attachment): $this->incrementLoopIndices(); $loop = $this->getFirstLoop(); ?>
 <li data-target="#img-slider" data-slide-to="<?php echo static::e($loop->index-1); ?>"></li>
 <?php endforeach; $this->popLoop(); $loop = $this->getFirstLoop(); ?>
 </ul>
 <?php $__currentLoopData = $project->attachments; $this->addLoop($__currentLoopData); foreach($__currentLoopData as $attachment): $this->incrementLoopIndices(); $loop = $this->getFirstLoop(); ?>
 <div class="carousel-item <?php echo static::e($loop->index == 1 ? 'active' : ''); ?>">
 <img src="assets/img/<?php echo static::e($attachment->url); ?>" class="w-100">
 </div>
 <?php endforeach; $this->popLoop(); $loop = $this->getFirstLoop(); ?>
 </div>
 </div>

 <!-- Modal footer -->
 <div class="modal-footer border-x-top-dark">
 </div>

 </div>
 </div>
	</div>
	<?php $this->startPush("scripts"); ?>

 <script type="text/javascript">

 /*document.getElementById("video1").addEventListener("loadedmetadata", function() {
 this.currentTime = 2.5;
 }, false);*/

 $('#btn-sign-up-project').on('click', function(e){


 console.log("Entrou em condição");

 });

 const carouselItemTo = carouselItem => {
 // $("#form-steps-holder").carousel(carouselItem);
 $(`[data-target='#img-slider'][data-slide-to=${carouselItem}]`).click();

 };

 $('.img-card').mouseenter( function () {
 $('.img-card').find('.img-card-holder').fadeOut();
 $(this).find('.img-card-holder').fadeToggle('fast');
 });

 $('.img-card-holder').on('click', function(){

 carouselItemTo($(this).data('src'));
 });
 $('.app-selection').on('click', function(){

 if($(this).hasClass("active")){

 //  console.log("Imgame: "+$(this).find("img").attr("src") + "Tamanho: " +$(this).find("img").attr("src").indexOf("c"));
 if($(this).find("img").attr("src").indexOf("c") > 0){
 $(this).find("img").attr("src",$(this).find("img").attr("src").split("_")[0]+".svg");
 console.log("Imgame2: "+$(this).find("img").attr("src") );


 }

 $(this).find("input").click();

 $(this).css('background-color','#fff');
 $(this).removeClass('active');
 $(this).find("h6").css("color","#000");

 }else{


 if($(this).find("img").attr("src").indexOf("_") == -1){
 $(this).find("img").attr("src",$(this).find("img").attr("src").split(".")[0]+"_branco.svg");

 // console.log("Imgame2323: "+$(this).find("img").attr("src") + "Tamanho: " +$(this).find("img").attr("src").indexOf("c"));
 }

 $(this).find("input").click();
 $(this).css('background-color','rgba(2,119,189 ,1)');
 $(this).addClass('active');
 $(this).find("h6").css("color","#fff");



 }


 });

 $('.btn-move-to-slide').on('click', function(){

 $("#form-slider").find(".carousel-item").removeClass("active");
 $($("#form-slider").find(".carousel-item").eq(0)).addClass("active");

 });

 $("a.scroll-link").click(function (event) {
 event.preventDefault();

 if($($(this).attr('href')).hasClass('is-new'))
 $("html, body").animate({scrollTop: $($(this).attr("href")).offset().top + 70}, 600);
 else
 $("html, body").animate({scrollTop: $($(this).attr("href")).offset().top}, 600);

 });


 $('.btn-show-enterprise').on('click', function(){

 if(!$(this).hasClass('shown')){
 $(this).parent().parent().parent().parent().find('.carousel').show('fast');
 $(this).addClass('shown');
 $(this).text("Esconder empresas");
 }
 else{
 $(this).parent().parent().parent().parent().find('.carousel').hide('fast');
 $(this).removeClass('shown');
 $(this).text("Ver empresas");
 }
 });

 $('.btn-see-img').on('click', function(e){

 $('#img-displayer').attr('src',  $(this).parents('.img-advertising').find('img').attr('src'));

 });



 </script>

	<?php $this->stopPush(); ?>
	<?php  $this->startComponent("components/solicitateBudget"); ?><?php  echo $this->renderComponent(); ?>
<?php $this->stopSection(); ?>

<?php if (@$_shouldextend[1]) { echo $this->runChild('guest.layouts.guestApp', ["title" => "".$project->name]); } ?>