{% extends 'layout_website.html.twig' %}
{% block title %} {{ vehicule.getMetaTitle }} - Fiche vehicule - {{parent()}}{% endblock %}
{% block stylesheets %}
{{parent()}}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/default-skin/default-skin.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css"/>
<style type="text/css">
#titleproduct{
display:none;
}
.nav-top{
padding:18px 7px;
}
.wrapper-list{
padding-bottom: 20px;
}
.wrapper-gallery{
background: #fff
}
.wrapper-item{
padding: 0 0;
}
.preview-image .img-item:not(:first-child){
margin-top: 6rem;
}
.preview-image{
/* height: 75vh; */
height: auto;
max-height: 65vh;
}
.preview-image .slick-list{
height: 100%
}
.preview-image .slick-track{
height: 100%
}
.preview-image .slick-track img{
width: auto;
height: auto;
max-width: 100%;
/* max-height: 100%; */
max-height: 50vh;
margin: auto;
}
.blockimgslid{
height: 100%;
display: block;
text-align: center;
}
.wrap-infos{
text-align: center;
color: #000;
background: #fff;
padding: 30px;
padding-bottom: 9rem;
}
.wrap-infos .title-product{
text-align: center;
color: #000;
font-weight: 700;
font-size: 1.8rem;
}
.btn.action{
border: 1px solid transparent;
border-radius: 30px;
background-color: #51c5a1;
font-weight: normal;
font-style: normal;
color: #fff;
cursor: pointer;
padding: 12px 27px;
font-size: 1.6rem;
/* box-shadow: -250px 0px 100px -180px #687FED inset; */
transition: all 0.2s ease-in;
}
.btn.action:hover{
background : #fff;
color: #51c5a1;
border: 1px solid #51c5a1;
box-shadow: none;
}
.btn.action.voir-detail{
margin-top:2rem;
}
.ref {
font-size:1.5rem;
}
.ref .iconify{
vertical-align: middle;
font-size:1.5rem;
}
.box-cart >.content{display: none;text-align:left;}
.box-cart {
box-shadow: 1px 5px 19px 0px #51c5a1 ;
border-radius: 10px;
padding: 1rem;
font-size: .9rem;
line-height: 1.6em;
margin: auto;
margin-top: 2rem;
background: #fff;
max-width: 60rem;
}
.box-cart:not(.open){
background: #fff;
box-shadow: 0px 0px 5px 3px #51c5a1;
}
.box-cart > .title{cursor: pointer;margin:0;text-align: center;}
.details-wrapper{display:none;}
.details-wrapper .box-cart {
background: #fff!important;
padding: 0;
}
.details-wrapper .box-cart > .title {
font-size: 1.4rem;
font-weight: 600;
padding: 1.5rem 0;
margin: 0;
}
.details-wrapper .box-cart > .title {
font-size: 1.4rem;
font-weight: 600;
padding: 1.5rem 0;
margin: 0;
}
.details-wrapper .box-cart.open > .title {
box-shadow: 0px 3px 7px 0px rgba(0, 0, 255, .2);
}
.details-wrapper .box-cart >.content {
padding: 1.4rem;
}
.blockprice{
display: flex;
flex-direction: column;
}
.blockprice .prx{
text-align:center;
color: #51c5a1;
font-size: 2.2rem;
}
.blockprice .prxttc{
text-align:right;
font-size: 1.2rem;
}
@media (min-width: 1400px){
.container {
width: 1400px;
}
}
.nav-stape {
display: none;
background: #51c5a1;
padding: 21px 18px;
text-align: center;
color: #fff;
}
.nav-stape .content{
max-width: 600px;
margin: auto;
display: flex;
align-items: center;
justify-content: space-around;
}
.nav-stape .btn-nav{
border: 1px solid #fff;
padding: 8px 30px;
border-radius: 24px;
color: #fff;
transition: all 0.2s ease;
}
.nav-stape .btn-nav:hover{
background: #fff;
color: #000;
}
.btn-nav.next{
background: #fff;
color: #000;
}
.btn-nav.next:hover{
color: #fff;
background: #000;
border: 1px solid #fff;
}
.faq {
background: #FFFFFF;
box-shadow: 0 2px 48px 0 rgba(0, 0, 0, 0.1);
border-radius: 4px;
margin:2rem 0;
}
.faq .card {
border: none;
background: none;
border-bottom: 1px dashed #CEE1F8;
}
.faq .card .card-header {
padding: 0px;
border: none;
background: none;
-webkit-transition: all 0.3s ease 0s;
-moz-transition: all 0.3s ease 0s;
-o-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
}
.faq .card .card-header:hover {
background: rgba(42, 30, 233, 0.1);
padding-left: 10px;
}
.faq .card .card-header .faq-title {
width: 100%;
text-align: left;
padding: 0px;
padding-left: 30px;
padding-right: 30px;
font-weight: 400;
font-size: 1.2rem;
letter-spacing: 1px;
color: #3B566E;
text-decoration: none !important;
-webkit-transition: all 0.3s ease 0s;
-moz-transition: all 0.3s ease 0s;
-o-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
cursor: pointer;
padding-top: 20px;
padding-bottom: 20px;
display: flex;
align-content: center;
align-items: center;
}
.faq .card .card-header .faq-title .badge {
display: inline-block;
width: 20px;
height: 20px;
line-height: 14px;
float: left;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
text-align: center;
background: #337ab7;
color: #fff;
font-size: 12px;
margin-right: 20px;
}
.faq .card .card-body {
padding: 2rem;
font-weight: 400;
font-size: 16px;
color: #6F8BA4;
line-height: 28px;
letter-spacing: 1px;
border-top: 1px solid #F3F8FF;
text-align: left;
}
.faq .card .card-body p {
margin-bottom: 14px;
}
@media (max-width: 991px) {
.faq {
margin-bottom: 30px;
}
.faq .card .card-header .faq-title {
line-height: 26px;
margin-top: 10px;
}
}
.wrap-infos .title.tarif {
font-size: 1.6rem;
font-weight: 300;
}
.table{
border-collapse: separate;
border-spacing: 0 0.5em;
}
.descr{
text-align: justify;
}
.caract ul {
list-style-type: none;
padding: 0 !important;
}
.caract ul li{
text-align: left;
}
/*
.details-wrapper strong.title {
padding: 0 11rem;
text-align: center;
display: block;
font-size: 1rem;
font-weight: 400;
font-style: italic;
}
.details-wrapper #calendar {
padding: 0 11rem;
margin-top: 2rem;
}
.details-wrapper #calendar .table-header {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.details-wrapper #calendar #left-arrow, .details-wrapper #calendar #right-arrow {
display: flex;
align-items: center;
}
.details-wrapper #calendar #left-arrow:hover,.details-wrapper #calendar #right-arrow:hover{
font-weight: 800;
cursor: pointer;
}
.details-wrapper #calendar #month-year {
text-transform: uppercase;
font-style: italic;
font-weight: 400;
}
.details-wrapper #calendar .iconify.arrow {
font-size: 2.5rem;
}
.details-wrapper #calendar .table>thead>tr>th,
.details-wrapper #calendar .table>thead>tr>td,
.details-wrapper #calendar .table>tbody>tr>th,
.details-wrapper #calendar .table>tbody>tr>td{
border:none;
text-align: center;
margin-top: 1rem;
}
.details-wrapper #calendar .table>tbody>tr>th.select-date.active.start,
.details-wrapper #calendar .table>tbody>tr>td.select-date.active.start{
border-top-left-radius: 2rem;
border-bottom-left-radius: 2rem;
}
.details-wrapper #calendar .table>tbody>tr>th.select-date.active.end,
.details-wrapper #calendar .table>tbody>tr>td.select-date.active.end{
border-top-right-radius: 2rem;
border-bottom-right-radius: 2rem;
}
.details-wrapper #calendar .table>tbody>tr>th.empty:hover,
.details-wrapper #calendar .table>tbody>tr>td.empty:hover{
cursor:not-allowed;
background:initial;
color:initial;
}
.details-wrapper #calendar .table>tbody>tr>th.active,
.details-wrapper #calendar .table>tbody>tr>td.active{
background: #000;
color: rgb(255, 255, 255);
}
.details-wrapper #calendar .table>tbody>tr>th:hover,
.details-wrapper #calendar .table>tbody>tr>td:hover{
background: #000;
color: rgb(255, 255, 255);
cursor: pointer;
}
.details-wrapper #calendar tr td{
font-size: 1rem;
}
.details-wrapper #calendar sup {
font-size: .8rem;
color: #c1c1c1;
font-style: italic;
}
.details-wrapper .range{
margin-top:2rem;
text-align:center;
}
.details-wrapper div.title{
margin-bottom:1rem;
text-align:center;
}
.details-wrapper .total{
text-align:center;
font-size:1.4rem;
font-weight:500;
position: relative;
}
.details-wrapper .total .prix{
font-weight:300;
}
.details-wrapper .nb_vehicules{
text-align:center;
margin:2rem 0;
}
.details-wrapper .box-cart > .title.location,
.details-wrapper .box-cart > .title.equipement,
.details-wrapper .box-cart > .title.covering {
display: flex;
align-items: center;
align-content: center;
justify-content: center;
position: relative;
}
.details-wrapper .box-cart > .title svg.iconify{
position: absolute;
left: 2rem;
}
.details-wrapper .box-cart > .title.location svg.iconify {
font-size: 5rem;
height: 100%;
top: -0.5rem;
}
.details-wrapper .box-cart > .title.equipement svg.iconify {
font-size: 2rem;
height: 100%;
top: 0;
}
.details-wrapper .box-cart > .title.covering svg.iconify {
font-size: 2rem;
height: 100%;
top: 0;
}
.details-wrapper .box-cart.open > .title svg.iconify{
color: #59b18c;
}*/
.modal_bloc {
height: 100%;
left: 0;
top: 0;
}
.modal_bloc img {
max-height: 550px;
}
/*
.slick-next {
top: 49% !important;
right: 10px !important;
z-index: 1800;
background-image: url("{{asset('img/arrow.png')}}") !important;
background-size: contain !important;
background-repeat: no-repeat !important;
background-position: center !important;
transform: rotate(180deg) !important;
}
.slick-next::before {
content: '' !important;
}
.slick-prev {
left: 10px !important;
z-index: 1800;
background-image: url("{{asset('img/arrow.png')}}") !important;
background-size: contain !important;
background-repeat: no-repeat !important;
background-position: center !important;
}
.slick-prev::before {
content: '' !important;
}*/
.modal {
z-index: 1800;
}
.img-modal-content {
background: transparent;
padding: 0;
margin: 0;
box-shadow: none;
border: none;
}
.img-modal-body {
padding: 0;
width: 100%;
}
.close {
font-size: 4rem;
font-weight: 500;
}
.img-zoom:hover {
cursor: zoom-in;
}
.content label {
color: #556d89;
font-weight: normal;
font-style: normal;
}
.selelem {
width: 30px;
margin-left: 10px;
border: none;
background-color: #ffffff;
color: #556d89;
font-weight: 600;
font-style: normal;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.details-wrapper #calendar .table>thead>tr>th.disable, .details-wrapper #calendar .table>thead>tr>td.disable, .details-wrapper #calendar .table>tbody>tr>th.disable, .details-wrapper #calendar .table>tbody>tr>td.disable{
color:#e0e0e0;
}
.details-wrapper #calendar .table>tbody>tr>th.disable:hover, .details-wrapper #calendar .table>tbody>tr>td.disable:hover {
background: transparent;
color:#e0e0e0;
cursor: not-allowed;
}
.pswp {
z-index: 9999;
}
#openPreview{
cursor:pointer;
}
@media screen and (max-width: 570px) {
.details-wrapper .box-cart > .content {
padding: 1rem;
}
.details-wrapper strong.title {
padding: 0 4rem;
}
.details-wrapper #calendar {
padding: 0 4rem;
}
}
@media screen and (max-width: 470px) {
.details-wrapper #calendar {
padding: 0 2rem;
}
}
@media screen and (max-width: 767px) {
.detailequip .prix {
top: -4rem;
}
}
@media screen and (max-width: 396px) {
.detailequip .prix {
top: -6rem;
}
}
html,
body {
}
.material-icons {
font-size:inherit;
}
/* header {
box-shadow: 1px 5px 19px 0 rgba(0, 0, 255, 0.2);
padding-bottom: 2rem;
}
header .logo-container {
text-align: center;
font-size: 37px;
font-weight: 900;
font-style: italic;
padding: 16px 10px 5px;
background: linear-gradient(to right, #e02608 100%, #545252 0%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
header .nav.list-item {
margin: auto;
display: flex;
align-items: center;
justify-content: space-around;
font-size: 18px;
max-width: 1100px;
color: #576f8a;
flex-wrap: wrap;
}
header .nav.list-item {
margin-top: 2rem;
padding: 0 2rem;
}*/
.nav.list-item .item-menu.active {
font-weight: 700
}
.item-menu .img-drap {
border-radius: 50%;
width: 23px;
height: 23px;
}
#photocov{
display:none;
}
.minitexthover{
font-size: .8em;
}
.pagenextform{
position: inherit;
}
.blockpriceprx {
text-align: center;
color: #51c5a1;
font-size: 1.8rem;
margin-top: 0;
}
.caracdeon h5{
text-align: left;
cursor: pointer;
}
.caracdeon .caract{
overflow: hidden;
height : 0;
}
.caracdeon .caract ul{
margin: 5px 0 0;
}
.prxnbvehic{
line-height: 1rem;
}
</style>
{% endblock %}
{% block body_container %}
<div id="pages"></div>
<div class="body-container container">
<div class="wrapper-list">
<div class="wrapper-item row">
<div class="wrapper-gallery col-md-6">
<div id="devisvalid" class="{{devisvalid}}"><h3>Votre devis a été transmis, après validation<br />Vous le recevrez directement dans votre boite email</h3></div>
<div class="nav-top">
<div></div>
<img src="{{asset('img/icons/zoom-visionbox.png')}}" style="float: right;" id="openPreview">
</div>
<div class="preview-image">
{% set idximages = 0 %}
{% for img in Imagesjson %}
<div class="blockimgslid">
<img src="{{asset('uploads/images/optimise/'~img.Name)}}" data-index="{{idximages}}" alt="{{ img.Alt }}" class="img-responsive img-zoom">
</div>
{% set idximages = idximages + 1 %}
{% endfor %}
</div>
<div style="display: flex; justify-content:space-around;">
{% if 'Location' in vehicule.cat %}
<div class="blockprice">
<a href="{{ path('home') }}?location&filtre_nom={{ vehicule.getNom }}&catsel" id="showblock" class="btn action voir-detail">Location</a>
{% set prxtbl = vehicule.PrixTable|json_decode %}
<span class="prx">1 jour {{vehicule.prixLoc}} €<span class="prxttc"> HT</span></span>
<span class="prx">7 jours {{prxtbl[7]}} €<span class="prxttc"> HT</span></span>
<span class="prx">30 jours {{prxtbl[30]}} €<span class="prxttc"> HT</span></span>
<span class="prx prxnbvehic"><span class="prxttc">{{VersionVehicules|length}} véhicule(s) en stock</span></span>
</div>
{% endif %}
{% if 'Occasion' in vehicule.cat or 'Achat' in vehicule.cat %}
{% set prxmin = 0 %}
<div class="blockprice">
<a href="{{ path('home') }}?achat&filtre_nom={{ vehicule.getNom }}&catsel" id="showblock2" class="btn action voir-detail" style="margin-top: 2rem;">Achat</a>
{% if vehicule.prix > 0 %}
{% set prxmin = vehicule.prix %}
{% if 'Achat' in vehicule.cat %}
<span class="prx">Neuf {{vehicule.prix}} €<span class="prxttc"> HT</span></span>
{% endif %}
{% endif %}
{% if vehicule.prixoccas > 0 %}
{% set prxmin = vehicule.prixoccas %}
{% if 'Occasion' in vehicule.cat %}
<span class="prx">Occasion {{vehicule.prixoccas}} €<span class="prxttc"> HT</span></span>
<span class="prx prxnbvehic"><span class="prxttc">{{vehicule.NbOccasion}} véhicule(s) en stock</span></span>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
<p class="blockpriceprx">Hors éventuelles remises</p>
<div class="box-cart lienimg">
<h4 class="title">Photos en situation</h4>
<div class="listim content">
{% set dexphot = 0 %}
{% for Photos in vehicule.getPhotos|json_decode %}
<div class="">
<div class="image-wrapper">
<img src="/uploads/images/optimise/{{Photos.Name}}" onclick="openPhotoSwipes({{dexphot}}, photocov)" alt="" class="" >
</div>
</div>
{% set dexphot = dexphot + 1 %}
{% endfor %}
</div>
<div id="photocov">
{% for Photos in vehicule.getPhotos|json_decode %}
<img src="/uploads/images/optimise/{{Photos.Name}}" alt="" class="" >
{% endfor %}
</div>
</div>
<div class="box-cart">
<h4 class="title">Dossier technique</h4>
<div class="content">
<ul>
{% for media in vehicule.getMedias|json_decode %}
<li>
<a href="{{asset('uploads/images/'~media.ImgFile)}}">{{ media.Name }}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="box-cart">
<h4 class="title">FAQ et conseils</h4>
<div class="content faq" id="accordion">
{% for faq in Faqs %}
<div class="card">
<div class="card-header" id="faqHeading-{{ loop.index }}">
<div class="mb-0">
<h5 class="faq-title" data-toggle="collapse" data-target="#faqCollapse-{{ loop.index }}" data-aria-expanded="{% if loop.index == 1 %}true{% else %}false{% endif %}" data-aria-controls="faqCollapse-{{ loop.index }}">
<span class="badge">{{ loop.index }}</span>{{ faq.Titre | raw }}
</h5>
</div>
</div>
<div id="faqCollapse-{{ loop.index }}" class="collapse" aria-labelledby="faqHeading-{{ loop.index }}" data-parent="#accordion">
<div class="card-body">
{{ faq.Detail | raw }}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="wrap-infos col-md-6">
<h1 class="title-product">
{{ vehicule.getNom }}
</h1>
<div class="descr">
{{ vehicule.getBlocText | raw }}
</div>
{% for caractli in caractlistesArray %}
{% if caractli.caractvehicule.getType == "Accordeon" %}
{% set nameaccord = caractli.caractvehicule.getName %}
{% set isused = false %}
{% for caractliste in caractlistesArray %}
{% if caractliste.caractvehicule.getType == nameaccord %}
{% set isused = true %}
{% endif %}
{% endfor %}
{% if isused == true %}
<div class="caracdeon">
<h5 onclick="caracdeon(this)">{{caractli.caractvehicule.getName}}</h5>
<div class="caract">
<ul>
{% for caractliste in caractlistesArray %}
{% if caractliste.caractvehicule.getType == nameaccord %}
<li>
<b>{{ caractliste.caractvehicule.getName }} :</b> {{ caractliste.value }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
<div class="caract">
<ul>
{% for caractliste in caractlistesArray %}
{% if caractliste.caractvehicule.getType == '' %}
<li>
<b>{{ caractliste.caractvehicule.getName }} :</b> {{ caractliste.value }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
<br />
<br />
<div class="shareblock">
<span>Partagez :</span>
{% set currentPath = absolute_url( path(app.request.attributes.get('_route'),
app.request.attributes.get('_route_params')) ) %}
<!-- Facebook -->
<a target="_blank" title="Facebook" href="https://www.facebook.com/sharer.php?u={{currentPath}}" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;"><img class="iconshare" src="{{asset('/img/logo-fb-black.svg')}}" alt="Facebook" /></a>
<!-- //Facebook -->
<!-- Twitter -->
<a target="_blank" title="Twitter" href="https://twitter.com/share?url={{currentPath}}" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;"><img class="iconshare" src="{{asset('/img/logo-twitter-black.svg')}}" alt="Twitter" /></a>
<!-- //Twitter -->
<!-- Linkedin -->
<a target="_blank" title="Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&url={{currentPath}}" rel="nofollow" onclick="javascript:window.open(this.href, '','menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"><img class="iconshare" src="{{asset('/img/linkedin-icon.svg')}}" alt="Linkedin" /></a>
<!-- //Linkedin -->
<a target="_blank" title="Pinterest" href="http://pinterest.com/pin/create/button/?url={{currentPath}}&media=http%3A%2F%2Fwww.aliasdmc.com%2Fimages%2Fthumbnail.jpg" rel="nofollow" onclick="javascript:window.open(this.href, '','menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"><img class="iconshare" src="{{asset('/img/pinterest-1.svg')}}" alt="Pinterest" /></a>
</div>
</div>
</div>
</div>
</div>
<div class="details-wrapper">
<div id="findevis" style="text-align: center;width: 100% !important;margin-left: 0 !important;"></div>
<!-- style="background: #f7f8f9;padding-top: 9rem;" -->
<!-- <div>
<div class="nav-stape">
<div class="content">
<a href="javascript:void(0)" id="prev" class="prev btn-nav btn">Précédent</a>
<span class="value" id="etapenb">
Etape 1/4
</span>
<span class="value" id="prixTotal">
HT : {{ vehicule.getPrixLoc|default(0) }} €
</span>
<span class="value" id="prixTotalTTC">
{% set prxttc = vehicule.getPrixLoc|default(0) + ((vehicule.getPrixLoc|default(0) * 20) / 100) %}
TTC : {{ prxttc|number_format(2) }} €
</span>
<a href="javascript:void(0)" id="next" class="next btn-nav btn">Suivant</a>
</div>
</div>
</div> -->
<input type="hidden" name="prixVehicule" id="prixVehicule" value="{{ vehicule.getPrixLoc|default(0) }}">
<input type="hidden" name="prixTable" id="prixTable" value="{{ vehicule.getPrixTable }}">
<input type="hidden" name="prixmoisplus" id="prixmoisplus" value="{{ vehicule.getPrixmoisplus|default(0) }}">
{% set carac = vehicule.Caractliste %}
<input type="hidden" name="caractliste" id="caractliste" value="{{ carac }}">
</div>
<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<!-- Background of PhotoSwipe.
It's a separate element as animating opacity is faster than rgba(). -->
<div class="pswp__bg"></div>
<!-- Slides wrapper with overflow:hidden. -->
<div class="pswp__scroll-wrap">
<!-- Container that holds slides.
PhotoSwipe keeps only 3 of them in the DOM to save memory.
Don't modify these 3 pswp__item elements, data is added later on. -->
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<!-- Controls are self-explanatory. Order can be changed. -->
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
{# <button class="pswp__button pswp__button--share" title="Share"></button> #}
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader--active when preloader is running -->
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
{% set firstimg = '' %}
{% set isfirstimg = 0 %}
{% for img in vehicule.getImg %}
{% if isfirstimg == 0 %}
{% set firstimg = img.getImgFile %}
{% set isfirstimg = 1 %}
{% endif %}
{% endfor %}
<input type="hidden" id="jsondata" value='[{"id":{{ vehicule.getId }},"nb":0,"name":"{{ vehicule.getNom }}","ImgFile":"{{ firstimg }}","datedeb":"","datefin":"","nbjours":0,"service":"Location","soustot":0,"equip":[],"cover":[],"origine":"{{ vehicule.origine }}"}]'>
<div class="modal fade" id="imagemodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" data-dismiss="modal">
<div class="modal-content img-modal-content" >
<div class="modal-body img-modal-body">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fermer</span></button>
<img src="" id="imagePreview" class="imagepreview" style="width: 100%;" >
</div>
</div>
</div>
<div id="titleproduct">{{vehicule.getNom}}</div>
<div id="localock">{{ LocationLockjson }}</div>
{% endblock %}
{% block javascripts %}
{{parent()}}
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
<script type="text/javascript">
/*
<scr ipt type="text/javascript" src="https://momentjs.com/downloads/moment.min.js"></scr ipt>
<scr ipt type="text/javascript" src="https://momentjs.com/downloads/moment-with-locales.min.js"></scr ipt>*/
function caracdeon(el){
if( $(el).parent().find('.caract').height() == 0 ){
$(el).parent().find('.caract').height('auto')
}else{
$(el).parent().find('.caract').height(0)
}
}
function formatDate(date) {
//var d = new Date(date),
//ou si envoyé au format date:
var d = date
let month = '' + (d.getMonth() + 1)
let day = '' + d.getDate()
let year = d.getFullYear()
if (month.length < 2)
month = '0' + month;
if (day.length < 2)
day = '0' + day;
return [year, month, day].join('-');
}
/*
let jsondata = $('#jsondata').val()
jsondata = JSON.parse(jsondata);
let jsondatastring = JSON.stringify( jsondata )
$('#jsondata').val(jsondatastring)
*/
/* 'equip':[{'name':'','nbmax':'0','TypePrix':'','PrixTable':'[]','Prixmoisplus':null,'prix':'0','id':0,'texte':null,'img':[],'modal':{'display':'none'},'nbchoisi':0}] */
/*'cover':[{'name':'','nbmax':null,'TypePrix':'','PrixTable':'[]','Prixmoisplus':null,'prix':'0','id':0,'texte':null,'img':[],'modal':{'display':'none'},'nbchoisi':'0'}]*/
function openopt(trg){
if( $( '#'+ trg+ ' > .accordbot').height() == 0){
$( '#'+ trg+ ' > .accordbot').height('auto')
$( '#'+ trg+ ' > .accordbot').css('overflow', 'initial')
$( '#'+ trg+ ' > .accordtop > img').css('transform', 'rotate(0deg)')
}else{
$( '#'+ trg+ ' > .accordbot').height(0)
$( '#'+ trg+ ' > .accordbot').css('overflow', 'hidden')
$( '#'+ trg+ ' > .accordtop img').css('transform', 'rotate(180deg)')
}
}
$(document).on('click','.box-cart .title',function(){
$(this).parent().toggleClass('open');
$(this).parent().find('.content').slideToggle();
});
var start_date = 0;
var end_date = 0;
var prixVehicule = parseFloat($('#prixVehicule').val()) || 0;
$(document).ready(function(){
let queryString = window.location.search;
if( queryString == '?location' ){
$('.body-container').hide()
$('.details-wrapper').show()
$('.nav-stape').show()
}
/*$('.img-zoom').on('click', function() {
$('#imagePreview').attr('src', $(this).attr('src'));
$('#imagemodal').modal('show');
});*/
$(document).on('click','#openPreview',function(){
$('.slick-slide.slick-current.slick-active').children().click();
})
$("table tr td.disabled").click(function(event) {
this.onclick = null;
event.preventDefault();
event.returnValue = false;
return false;
});
/*$('.preview-image').slick({
dots: true,
infinite: true,
speed: 500,
fade: true,
cssEase: 'linear'
});*/
SlickZoom({selector:'.preview-image',item:'.img-zoom'});
$(document).on("click",".minus",function(){
$val = parseInt($(this).next().val()) || 0;
nbmax = parseInt($(this).parents('.detailequip').data('nbmax'));
nbmax = nbmax - parseInt($(this).parents('.detailequip').find('.nbsel').val());
if($val<1){
$val = 0;
}
else{
$val--;
}
let Maxpv = parseInt($(this).parents('.detailequip').data('maxpv'));
let nbve = Maxpv * parseInt($(this).parents('.detailequip').find('.nbvehicsel').val());
if($('#nbJours').val() == 0){
$val = 0;
toastr.error("Attention ! Vous devez d'abord sélectionner vos dates ou une durée de location");
}else if ($val>nbve) {
$(this).val(nbve);
$val = nbve;
//nb max : nbve
toastr.error("Attention ! Vous avez déjà atteint le nombre maximum pour ce type d'option");
}else if ($val>nbmax) {
$(this).next().val(nbmax);
$val = nbmax;
toastr.error("Attention ! Vous avez déjà atteint le nombre maximum pour ce type d'option");
} else {
$(this).next().val($val);
}
if($val==0){
$(this).parents('.detailequip').find('.prix').addClass('opaclair');
}
else{
$(this).parents('.detailequip').find('.prix').removeClass('opaclair');
}
});
$(document).on("click",".plus",function(){
$val = parseInt($(this).prev().val()) || 0;
Maxpv = parseInt($(this).parents('.detailequip').data('maxpv'));
nbmax = parseInt($(this).parents('.detailequip').data('nbmax'));
nbmax = nbmax - parseInt($(this).parents('.detailequip').find('.nbsel').val());
$val++;
if($val<1){
$val = 0;
}
let nbve
if( Maxpv > 0){
nbve = Maxpv * parseInt($(this).parents('.detailequip').find('.nbvehicsel').val());
}else{
nbve = parseInt($(this).parents('.detailequip').find('.nbvehicsel').val());
}
if($('#nbJours').val() == 0){
$val = 0;
toastr.error("Attention ! Vous devez d'abord sélectionner vos dates ou une durée de location");
}else if ($val>nbve) {
$(this).val(nbve);
$val = nbve;
toastr.error("Attention ! Vous avez déjà atteint le nombre maximum pour ce type d'option");
}else if ($val>nbmax) {
$(this).prev().val(nbmax);
$val = nbmax;
toastr.error("Attention ! Vous avez déjà atteint le nombre maximum pour ce type d'option");
} else {
$(this).prev().val($val);
}
if($val==0){
$(this).parents('.detailequip').find('.prix').addClass('opaclair');
}
else{
$(this).parents('.detailequip').find('.prix').removeClass('opaclair');
}
});
$(document).on('change','.chkbx',function(){
if($(this).is(':checked')){
$(this).parents('.detailequip').find('.prix').removeClass('opaclair');
}
else{
$(this).parents('.detailequip').find('.prix').addClass('opaclair');
}
});
/*
$(document).on('click','.select-date',function(){
var temp_date = new Date();
var temp_day = parseInt(temp_date.getDate());
var temp_month = parseInt(temp_date.getMonth());
var temp_year = parseInt(temp_date.getFullYear());
if(parseInt($(this).data('timestamp')) < (+new Date(temp_year, temp_month,temp_day))){
return false;
}
if(start_date==0){
start_date = $(this).attr('id');
}
else if(end_date==0){
end_date = $(this).attr('id');
}
else{
end_date = 0;
start_date = $(this).attr('id');
}
if(end_date != 0 && $("#"+start_date).data('timestamp') > $("#"+end_date).data('timestamp') ){
let temp = start_date;
start_date = end_date;
end_date = temp;
}
$('.select-date').removeClass('active');
$('.select-date').removeClass('start');
$('.select-date').removeClass('end');
if(start_date!=0){
let day = $("#"+start_date).data('day');
if(day<10)
day = "0"+day;
let month = parseInt($("#"+start_date).data('month'))+1;
if(month<10)
month = "0"+month;
let year = $("#"+start_date).data('year');
$('#start_date').text(day+"/"+month+"/"+year);
$("#"+start_date).addClass('active');
$("#"+start_date).addClass('start');
}
else{
$('#start_date').text("--/--/---");
}
if(end_date!=0){
let day = $("#"+end_date).data('day');
if(day<10)
day = "0"+day;
let month = parseInt($("#"+end_date).data('month'))+1;
if(month<10)
month = "0"+month;
let year = $("#"+end_date).data('year');
$('#end_date').text(day+"/"+month+"/"+year);
$("#"+end_date).addClass('active');
$("#"+end_date).addClass('end');
$('#nbJours').val(datediff($('#start_date').text(), $('#end_date').text()));
}
else{
$('#nbJours').val(0);
$('#end_date').text("--/--/---");
}
let jsondatas = $('#jsondata').val()
jsondata = JSON.parse(jsondatas);
if(start_date!=0 && end_date!=0){
start_date_day = parseInt($("#"+start_date).data('day'));
if(start_date_day<10)
start_date_day = "0"+start_date_day;
start_date_month = parseInt($("#"+start_date).data('month'))+1;
if(start_date_month<10)
start_date_month = "0"+start_date_month;
start_date_string = $("#"+start_date).data('year')+"-"+start_date_month+"-"+start_date_day;
end_date_day = parseInt($("#"+end_date).data('day'));
if(end_date_day<10)
end_date_day = "0"+end_date_day;
end_date_month = parseInt($("#"+end_date).data('month'))+1;
if(end_date_month<10)
end_date_month = "0"+end_date_month;
end_date_string = $("#"+end_date).data('year')+"-"+end_date_month+"-"+end_date_day;
start_date_string = $("#"+start_date).data('year')+"-"+start_date_month+"-"+start_date_day;
end_date_string = $("#"+end_date).data('year')+"-"+end_date_month+"-"+end_date_day;
dates = enumerateDaysBetweenDates(start_date_string,end_date_string);
for (let i = 0; i < dates.length; i++) {
$('#'+dates[i].getFullYear()+"-"+(dates[i].getMonth())+"-"+dates[i].getDate()).addClass('active');
}
jsondata[0].datedeb = start_date_string
jsondata[0].datefin = end_date_string
jsondata[0].nbjours = datediff( $('#start_date').text(), $('#end_date').text() )
jsondata[0].soustot = $('#nb_vehicules').val()
//add dimentions véhicule
jsondata[0].dimentions = $('#caractliste').val()
}
let jsondatastring = JSON.stringify( jsondata )
$('#jsondata').val(jsondatastring)
let id_vehicule = {{ vehicule.getId }}
let Nb_max = {{ vehicule.nbVehicules }}
let locationlock = $('#localock').text()
locationlock = JSON.parse(locationlock)
for (let index = ( locationlock.length -1 ); index >= 0 ; index--) {
const element = locationlock[index];
if( element.VehicId != id_vehicule ){
locationlock.splice(index, 1)
}
}
let disp_max = Nb_max
dates = []
if( typeof(start_date_string) !== 'undefined' && typeof(end_date_string) !== 'undefined' ){
dates = getDates(start_date_string,end_date_string);
}
dates.forEach(element => {
let nb_dispo = Nb_max
for (let index = 0; index < locationlock.length; index++) {
let deb_date = new Date( locationlock[index].DateDeb.timestamp * 1000 )
let fin_date = new Date( locationlock[index].DateFin.timestamp * 1000 )
if( new Date( deb_date ) <= new Date(element) && new Date( fin_date ) >= new Date(element) ){
nb_dispo = nb_dispo - locationlock[index].Nbsel
}
}
if( disp_max >= nb_dispo){
disp_max = nb_dispo
}
});
$('#nb_vehicules').empty();
if( disp_max > 0){
for (let index = 1; index <= disp_max; index++) {
var option = document.createElement('option');
option.text = option.value = index;
document.getElementById("nb_vehicules").add(option, 0);
}
}
MiseAJourPrix();
});*/
function getDates(startDate, stopDate) {
var dateArray = [];
var currentDate = moment(startDate);
var stopDate = moment(stopDate);
while (currentDate <= stopDate) {
dateArray.push( moment(currentDate).format('YYYY-MM-DD') )
currentDate = moment(currentDate).add(1, 'days');
}
return dateArray;
}
$(document).on('change','#nbJours', function() {
if(start_date!=0){
$('.select-date').removeClass('active');
$('.select-date').removeClass('start');
$('.select-date').removeClass('end');
start_date_day = parseInt($("#"+start_date).data('day'));
if(start_date_day<10)
start_date_day = "0"+start_date_day;
start_date_month = parseInt($("#"+start_date).data('month'))+1;
if(start_date_month<10)
start_date_month = "0"+start_date_month;
start_date_string = $("#"+start_date).data('year')+"-"+start_date_month+"-"+start_date_day;
$('#start_date').text(start_date_day+"/"+start_date_month+"/"+$("#"+start_date).data('year'));
$("#"+start_date).addClass('active');
$("#"+start_date).addClass('start');
nbJours = parseInt($('#nbJours').val())||0;
if(nbJours<0){
nbJours = 0;
}
if(nbJours>0){
nbJours--;
}
end_date = moment(start_date_string).add(nbJours,'days');
end_date_day = parseInt(end_date.format('D'));
end_date_month = (parseInt(end_date.format('M'))||0)-1;
end_date_year = end_date.format('YYYY')
end_date = end_date.format('YYYY')+'-'+end_date_month+'-'+end_date.format('D');
end_date_day = end_date_day;
if(end_date_day<10)
end_date_day = "0"+end_date_day;
if(end_date_month<10)
end_date_month = "0"+end_date_month;
end_date_string = end_date_year+"-"+(end_date_month +1 )+"-"+end_date_day;
/* end_date_day = parseInt($("#"+end_date).data('day'));
if(end_date_day<10)
end_date_day = "0"+end_date_day;
end_date_month = parseInt($("#"+end_date).data('month'))+1;
if(end_date_month<10)
end_date_month = "0"+end_date_month;
end_date_string = $("#"+end_date).data('year')+"-"+end_date_month+"-"+end_date_day;*/
$('#end_date').text(end_date_day+"/"+(end_date_month +1 )+"/"+end_date_year);
$("#"+end_date).addClass('active');
$("#"+end_date).addClass('end');
dates = enumerateDaysBetweenDates(start_date_string,end_date_string);
for (let i = 0; i < dates.length; i++) {
$('#'+dates[i].getFullYear()+"-"+(dates[i].getMonth())+"-"+dates[i].getDate()).addClass('active');
}
}
else{
let jsondatas = $('#jsondata').val()
jsondata = JSON.parse(jsondatas);
jsondata[0].datedeb = ''
jsondata[0].datefin = ''
jsondata[0].nbjours = $('#nbJours').val()
let jsondatastring = JSON.stringify( jsondata )
$('#jsondata').val(jsondatastring)
// console.log( $(this).val() );
}
MiseAJourPrix();
});
if($('.devisvalid').length > 0){
setTimeout(() => {
$('#devisvalid').removeClass('devisvalid');
$('#devisvalid').addClass('devisvalid_hide');
document.cookie = "devis_page_{{ vehicule.getId }}=-1 ; path=/";
document.cookie = "validevis_page_{{ vehicule.getId }}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
}, 5000);
}
});
$('.voir-detail').click(function(){
// $('html, body').animate({scrollTop:($(".details-wrapper").offset().top)}, 800);
$('.body-container').hide()
$('.details-wrapper').show()
$('.nav-stape').show()
});
/* $('.prev').click(function(){
// $('html, body').animate({scrollTop:($(".details-wrapper").offset().top)}, 800);
$('.body-container').show()
$('.nav-stape').hide()
$('.details-wrapper').hide()
});*/
function getAllEvents(element) {
var result = [];
for (var key in element) {
if (key.indexOf('on') === 0) {
result.push(key.slice(2));
}
}
return result.join(' ');
}
/*
var el = $('input').bind(getAllEvents($('input')[0]), function(e) {
MiseAJourPrix();
});
var el = $('select').bind(getAllEvents($('select')[0]), function(e) {
MiseAJourPrix();
});
var el = $('.minus').bind(getAllEvents($('.minus')[0]), function(e) {
MiseAJourPrix();
});
var el = $('.plus').bind(getAllEvents($('.plus')[0]), function(e) {
MiseAJourPrix();
});
var el = $('.select-date').bind(getAllEvents($('.select-date')[0]), function(e) {
MiseAJourPrix();
});
var el = $('.nbequ').bind(getAllEvents($('.nbequ')[0]), function(e) {
$val = parseInt($(this).val()) || 0;
nbmax = parseInt($(this).parents('.detailequip').data('nbmax'));
nbmax = nbmax - parseInt($(this).parents('.detailequip').find('.nbsel').val());
let Maxpv = parseInt($(this).parents('.detailequip').data('maxpv'));
let nbve = Maxpv * parseInt($(this).parents('.detailequip').find('.nbvehicsel').val());
if($val<0){
$val = 0;
$(this).val($val);
}
if( $('#nbJours').val() == 0){
$val = 0;
toastr.error("Attention ! Vous devez d'abord sélectionner vos dates ou une durée de location");
}else if ($val>nbve) {
$(this).val(nbve);
$val = nbve;
toastr.error("Attention ! Vous avez déjà atteint le nombre maximum pour ce type d'option");
}else if ($val>nbmax) {
$(this).val(nbmax);
$val = nbmax;
toastr.error("Attention ! Vous avez déjà atteint le nombre maximum pour ce type d'option");
} else {
$(this).val($val);
}
if($val==0){
$(this).parents('.detailequip').find('.prix').addClass('opaclair');
}
else{
$(this).parents('.detailequip').find('.prix').removeClass('opaclair');
}
MiseAJourPrix();
});*/
/* function MiseAJourPrix(){
let nbvehicule = parseInt($('#nb_vehicules').val()) || 0;
// let nbjours = datediff($('#start_date').text(), $('#end_date').text())
let nbjours = $('#nbJours').val()
let prixObject = calculPrixTotal();
try {
var PrixTable = JSON.parse( $("#prixTable").val() )
} catch (error) {
var PrixTable = $("#prixTable").val()
}
let prixmoisplus = parseFloat($('#prixmoisplus').val()) || 0;
let prixLocation = 0;
if(PrixTable !== null){
if( nbjours >= 31 ){
let nbrestant = nbjours - 30
let prixunitsupp = prixmoisplus
prixLocation = ( (parseInt( PrixTable[30] , 10)|| 0) + ( prixunitsupp * nbrestant ) ) * nbvehicule ;
}
else{
prixLocation = (parseFloat(PrixTable[nbjours])||0) * nbvehicule
}
}
let jsondatas = $('#jsondata').val()
jsondata = JSON.parse(jsondatas);
jsondata[0].nbjours = $('#nbJours').val()
//add dimentions véhicule
jsondata[0].dimentions = $('#caractliste').val()
jsondata[0].soustot = prixLocation
jsondata[0].nb = parseInt($('#nb_vehicules').val()) || 0;
let jsondatastring = JSON.stringify( jsondata )
$('#jsondata').val(jsondatastring)
let prxttc = (prixObject.prix + prixLocation) + (((prixObject.prix + prixLocation) * 20) / 100)
$('#prixTotal').html('HT : '+(prixObject.prix + prixLocation)+' €');
$('#prixTotalTTC').html('TTC : ' + prxttc.toFixed(2) +' €');
$('#prixLocationttc').html( calcttc(prixLocation) + ' € TTC');
$('#prixLocation').html(prixLocation+' € HT');
$('#prixCovering').html(prixObject.prixCovering+' € HT');
$('#prixCoveringttc').html( calcttc(prixObject.prixCovering )+' € TTC');
$('#prixEquipement').html(prixObject.prixEquipement+' € HT');
$('#prixEquipementttc').html( calcttc(prixObject.prixEquipement )+' € TTC');
}
function calculPrixTotal(){
let nbvehicule = parseInt($('#nb_vehicules').val()) || 0;
$('.nbvehicsel').val(nbvehicule)
let nbjours = parseInt($('#nbJours').val())||0;
let start_date = $('#start_date').text()
start_date = start_date.split('/');
start_date = start_date[2] +'-'+ start_date[1] +'-'+start_date[0]
start_date = new Date( start_date )
let end_date = $('#end_date').text()
end_date = end_date.split('/');
end_date = end_date[2] +'-'+ end_date[1] +'-'+end_date[0]
end_date = new Date( end_date )
prixObject = { prix:0, prix0:0, prixCovering:0, prixEquipement:0 }
let jsondata = $('#jsondata').val()
jsondata = JSON.parse(jsondata);
for (var i = 0 ; i < $('.detailequip').length ; i++) {
value = $('.detailequip')[i];
let prix = 0
let prix0 = 0
let prixmoisplus = parseFloat($(value).data('prixmoisplus')) || 0;
let prixmois = parseFloat($(value).data('prixmois')) || 0;
let prixUn;
let localock = JSON.parse( $('#localock').text())
let nbsel = 0
localock.forEach(element => {
if( element.vehictrue == false){
if( element.OptionId == $(value).data('idoption')){
let DateDeb = new Date( element.DateDeb.timestamp * 1000 )
let DateFin = new Date( element.DateFin.timestamp * 1000 )
if( start_date <= DateFin && end_date >= DateDeb){
nbsel = nbsel + parseInt( element.Nbsel )
}
}
}
});
$(value).find('.nbsel').val(nbsel)
//$(value).attr( "data-nbsel", nbsel)
if ($(value).data('typeprix') == 'Variable') {
let nbchoisi = parseInt($(value).find('.nbequ').val()) || 0;
if(nbchoisi<0){
nbchoisi = 0;
}
try {
var PrixTable = JSON.parse( $(value).data('prixtable') )
} catch (error) {
var PrixTable = $(value).data('prixtable')
}
if(PrixTable !== null){
if( nbjours >= 31 ){
let nbrestant = nbjours - 30
let prixunitsupp = prixmoisplus
prix = ( (parseInt( PrixTable[30] , 10)|| 0) + ( prixunitsupp * nbrestant ) ) * nbchoisi ;
prix0 = ( (parseInt( PrixTable[30] , 10)|| 0) + ( prixunitsupp * nbrestant ) ) * nbchoisi ;
prixUn = ( (parseInt( PrixTable[30] , 10)|| 0) + ( prixunitsupp * nbrestant ) );
}
else{
prix = (parseFloat(PrixTable[nbjours])||0) * nbchoisi
prix0 = (parseFloat(PrixTable[nbjours])||0) * nbchoisi
prixUn = (parseFloat(PrixTable[nbjours])||0) ;
}
}
if(nbchoisi>0){
$(value).find('.prix').html(prix+" €");
}
else{
$(value).find('.prix').html(prixUn+" €");
}
}
else if ($(value).data('typeprix') == 'Fixe par véhicule') {
let nbchoisi = parseInt($(value).find('.nbequ').val()) || 0;
if(nbchoisi<0){
nbchoisi = 0;
}
let prixunit = parseFloat($(value).data('prix')) || 0;
prix = parseInt( nbchoisi, 10) * prixunit ;
prix0 = prixunit ;
if(nbchoisi>0){
$(value).find('.prix').html(prix+" €");
}
else{
$(value).find('.prix').html(prix0+" €");
}
}
else if ($(value).data('typeprix') == 'base + fixe par vehicule') {
let nbchoisi = parseInt($(value).find('.nbequ').val()) || 0;
if(nbchoisi<0){
nbchoisi = 0;
}
let prixunit = parseFloat($(value).data('prix')) || 0;
let prxbase = parseFloat($(value).data('prixmoisplus')) || 0;
prix = parseInt( nbchoisi, 10) * prixunit ;
prix = prix + prxbase
prix0 = prixunit + prxbase;
if(nbchoisi>0){
$(value).find('.prix').html(prix+" €");
}
else{
$(value).find('.prix').html(prix0+" €");
}
}
else {
let nbchoisi = 0;
if($(value).find('.chkbx').is(':checked')){
nbchoisi = 1;
}
let prixunit = parseFloat($(value).data('prix')) || 0;
prix = nbchoisi * prixunit ;
prix0 = prixunit ;
if($(value).find('.chkbx').is(':checked')){
$(value).find('.prix').html(prix+" €");
}
else{
$(value).find('.prix').html(prix0+" €");
}
}
//type
//nbchois
prixObject.prix = prixObject.prix + prix
prixObject.prix0 = prixObject.prix0 + prix0
let nbch = 0
if($(value).find('.chkbx').is(':checked') ){
nbch = 1
}
if( parseInt($(value).find('.nbequ').val()) > 0){
nbch = parseInt($(value).find('.nbequ').val())
}
let detequ = {
name: $(value).data('name'),
nbmax:null,
TypePrix: $(value).data('typeprix'),
PrixTable: $(value).data('prixtable'),
Prixmoisplus: parseFloat($(value).data('prixmois')),
prix: $(value).data('prix'),
id: $(value).data('idoption'),
texte:null,
img:[],
modal:{'display':'none'},
nbchoisi: nbch
}
if($(value).data('option')=="covering"){
prixObject.prixCovering = prixObject.prixCovering + prix
let coverex = -1
for (let index = 0; index < jsondata[0].cover.length; index++) {
if( jsondata[0].cover[index].id == $(value).data('idoption') ){
jsondata[0].cover[index] = detequ
coverex = index
}
}
if(nbch > 0){
if( coverex == -1 ){
jsondata[0].cover.push(detequ)
}else{
jsondata[0].cover[coverex] = detequ
}
}else{
if( coverex >= 0){
jsondata[0].cover.splice( coverex , 1)
}
}
}
else{
prixObject.prixEquipement = prixObject.prixEquipement + prix
let equipex = -1
for (let index = 0; index < jsondata[0].equip.length; index++) {
if( jsondata[0].equip[index].id == $(value).data('idoption') ){
jsondata[0].equip[index] = detequ
equipex = index
}
}
if(nbch > 0){
if( equipex == -1 ){
jsondata[0].equip.push(detequ)
}else{
jsondata[0].equip[equipex] = detequ
}
}else{
if( equipex >= 0){
jsondata[0].equip.splice( equipex , 1)
}
}
}
}
let jsondatastring = JSON.stringify( jsondata )
$('#jsondata').val(jsondatastring)
return prixObject;
}
function datediff(first, second) {
first = moment(first, "DD/MM/YYYY");
second = moment(second, "DD/MM/YYYY");
days = parseInt(second.diff(first, 'days')) || 0;
return days+1;
}
function enumerateDaysBetweenDates(startDate, endDate) {
var dates = [];
var currDate = moment(startDate).startOf('day');
var lastDate = moment(endDate).startOf('day');
while(currDate.add(1, 'days').diff(lastDate) < 0) {
dates.push(currDate.clone().toDate());
}
return dates;
}*/
// openPhotoSwipes(0, photocov);
let photocov = $('#photocov').slick({
dots: true,
infinite: true,
speed: 500,
fade: true,
cssEase: 'linear'
});
function parseThumbnailElementss(el) {
var data = [];
el.find( 'img:not(.slick-cloned)').each(function() {
var img = this;
data.push({
el: img,
src: img.src,
msrc: img.src,
w: img.naturalWidth,
h: img.naturalHeight
});
});
return data;
};
function openPhotoSwipes(index, $gallery) {
if (isNaN(parseInt(index, 10))) { return; }
slickInstance = $('#photocov')
var pswpElement = $('.pswp')[0];
var gallery;
var items = parseThumbnailElementss($gallery);
// define options (if needed)
var options = {
galleryUID: $gallery.attr('data-pswp-uid'),
getThumbBoundsFn: function(index) {
// See Options->getThumbBoundsFn section of docs for more info
var thumbnail = items[index].el,
pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
rect = thumbnail.getBoundingClientRect();
return {
x: rect.left,
y: rect.top + pageYScroll,
w: rect.width
};
}
};
options.index = parseInt(index, 10);
options.fullscreenEl = false;
// Pass data to PhotoSwipe and initialize it
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.listen('beforeChange', function() {
var slideItem = $(gallery.currItem.el);
var currentIndex = slideItem.index() - (slideItem.siblings('.slick-slide.slick-cloned').length / 2);
if (slickInstance) {
slickInstance.slick('slickGoTo', currentIndex);
}
});
gallery.init();
};
function SlickZoom(options) {
options = options || {};
if (!(options.selector && options.item)) {
return console.error('selector and item required');
}
$(options.selector).each(function(i) {
var container = $(this);
var items = container.find(options.item);
var slickInstance = null;
var slickOption = options.slickOption || {
dots: true,
infinite: true,
speed: 500,
fade: true,
cssEase: 'linear'
};
// init slick carousel if more than 2 items
if (items.length >= 2) {
slickInstance = container.slick(slickOption);
}
// init photoswipe
container
.attr('data-pswp-uid', i+1)
.on('click', options.item, function (e) {
e.preventDefault();
var slideItem = $(this);
// var index = slideItem.index() - (slideItem.siblings('.slick-slide.slick-cloned').length / 2);
var index = slideItem[0].dataset.index
openPhotoSwipe(index, container);
});
function parseThumbnailElements(el) {
var data = [];
el.find(options.item + ':not(.slick-cloned)').each(function() {
var img = this;
data.push({
el: img,
src: img.src,
msrc: img.src,
w: img.naturalWidth,
h: img.naturalHeight
});
});
return data;
};
function openPhotoSwipe(index, $gallery) {
if (isNaN(parseInt(index, 10))) { return; }
var pswpElement = $('.pswp')[0];
var gallery;
var items = parseThumbnailElements($gallery);
// define options (if needed)
var options = {
galleryUID: $gallery.attr('data-pswp-uid'),
getThumbBoundsFn: function(index) {
// See Options->getThumbBoundsFn section of docs for more info
var thumbnail = items[index].el,
pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
rect = thumbnail.getBoundingClientRect();
return {
x: rect.left,
y: rect.top + pageYScroll,
w: rect.width
};
}
};
options.index = parseInt(index, 10);
options.fullscreenEl = false;
// Pass data to PhotoSwipe and initialize it
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.listen('beforeChange', function() {
var slideItem = $(gallery.currItem.el);
var currentIndex = slideItem.index() - (slideItem.siblings('.slick-slide.slick-cloned').length / 2);
if (slickInstance) {
slickInstance.slick('slickGoTo', currentIndex);
}
});
gallery.init();
};
});
}
$('.koikes').hover(function() {
const image = $( this ).parent().find( ".onover" )[0]
const config = {
rootMargin: '0px 0px 0px 0px',
threshold: [0, 0.25, 0.75, 1]
};
observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
console.log( entry.intersectionRatio )
if (entry.intersectionRatio < 1) {
let classlist = entry.target.classList
if( classlist.contains('changehover') ){
entry.target.classList.remove('changehover');
}else{
entry.target.classList.add('changehover');
}
} else {
observer.unobserve(image);
}
});
}, config);
observer.observe(image);
});
function parseThumbnailinfoimg(el) {
var data = [];
var img = el;
data.push({
el: img,
src: img.src,
msrc: img.src,
w: img.naturalWidth,
h: img.naturalHeight
});
return data;
};
function openinfoimgSwipes(item) {
console.log(item)
var gallery;
var items = parseThumbnailinfoimg(item);
var options = {
galleryUID: $(item).attr('data-pswp-uid'),
getThumbBoundsFn: function(index) {
// See Options->getThumbBoundsFn section of docs for more info
var thumbnail = item,
pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
rect = thumbnail.getBoundingClientRect();
return {
x: rect.left,
y: rect.top + pageYScroll,
w: rect.width
};
}
};
options.fullscreenEl = false;
var pswpElement = $('.pswp')[0];
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init()
}
$(document).ready(function () {
// MiseAJourPrix();
});
function calcttc(prix){
let prxttc = prix + (( prix * 20) / 100)
return prxttc
}
$('.faq-title').on('click', function () {
let trg = $(this).attr('data-target')
if( $( trg ).hasClass( "collapse" ) ){
$( trg ).removeClass('collapse')
}else{
$( trg ).addClass('collapse')
}
})
</script>
{{ encore_entry_script_tags('app') }}
{{ encore_entry_script_tags('formulaire') }}
{% endblock %}