{% extends 'admin/base.html.twig' %}
{% block title %}Votre panier{% endblock %}
{% block CSS %}
<link href="{{ asset('build/frontend/cart.css') }}" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<link href="/assets/plugins/owl.carousel/dist/assets/owl.carousel.min.css" rel="stylesheet" type="text/css" />
<link href="/assets/plugins/owl.carousel/dist/assets/owl.theme.default.min.css" rel="stylesheet" type="text/css" />
{% endblock %}
{% block JS %}
<script src="{{ asset('build/frontend/cart.js') }}"></script>
<script src="/assets/frontend/js/jquery-3.1.1.min.js"></script>
<script src="/assets/plugins/owl.carousel/dist/owl.carousel.min.js"></script>
<script>
jQuery(document).ready(function($) {
//Owl-Multi
$('#owl-multi').owlCarousel({
loop:true,
margin:20,
nav:false,
autoplay:true,
responsiveClass: true,
responsive:{
0:{
items:1
},
480:{
items:2
},
700:{
items:4
},
1000:{
items:3
},
1100:{
items:5
}
}
})
});
{# recupthisSelectforme #}
{# $('#recupthisSelectforme').change(function() {
var conceptName = $('#recupthisSelectforme').val();
console.log(conceptName);
if (conceptName != 'none'){
$.ajax({
type: "POST",
url: '{{ path('subscriptionToProduct',{ 'id': 'conceptName'}) }}',
async: true,
data: {
id: $('#recupthisSelectforme').val()
},
success: function () {
console.log('success');
window.location.reload()
}
});
}
}); #}
$(document).on('change', 'select', function () {
var value = $(this).val();
$(this).find('option[value="' + value + '"]').attr("selected", "selected");
var subscriptionId = $('#recupthisSelectforme').find(":selected").val();
var productId = $('#recupthisSelectforme').find(":selected").attr("data-productId");
console.log(subscriptionId);
console.log(productId);
if (subscriptionId != 'none'){
$.ajax({
type: "POST",
url: '{{ path('subscriptionToProduct',{ 'id': 'subscriptionId'}) }}',
async: true,
data: {
subscriptionId: $('#recupthisSelectforme').find(":selected").val(),
productId : $('#recupthisSelectforme').find(":selected").attr("data-productId"),
},
success: function () {
console.log('success');
window.location.reload()
}
});
}
})
{# $('a[class=deleteProductCart]').on('click', function() {
var getValueinput = $(this).data('id');
if (getValueinput === 6472){
var answer = window.confirm("supression de la boite réutilisable ?");
if (answer) {
//some code
}
else {
//some code
}
}
console.log(getValueinput);
}); #}
</script>
{% endblock %}
{% block content %}
{{form_start(form)}}
<div class="row">
<div class="col-lg-10 col-xl-8 mx-auto">
<div class="product-purchase-list added-cart">
{# Checkout breadcrumb links #}
<div class="row">
<div class="col-sm-12">
<p class="product-subtitle-brand">
<ul class="breadcrumb breadcrump-cart pull-right">
<li><a href="{{path('viewCart')}}" class=""><u>Panier</u></a></li>
{% if noGo is not defined %}
<li><a href="{{path('checkout')}}">Livraison / Cueillette</a></li>
{% if global.getCart.shippingAddress %}
<li><a href="{{path('cartPayment')}}">Paiement</a></li>
{% endif %}
{% endif %}
<li><a href="{{path('home')}}">Retour au magasin</a></li>
</ul>
</p>
</div>
</div>
{# display user's subscriptions #}
{% if app.user and app.user.activeSubscriptions | length > 0 %}
<div class="card-box">
<div class="m-t-40" {% if app.user.validSubscriptions | length==0 %} style="display:none;" {% endif %}>
<h4 class="">
<b>Joindre un abonnement à ma commande</b>
</h4>
<form action="{{path('viewCart')}}" method="post">
<div class="checkout-form">
<select name="subscription" class="form-control" id="recupthisSelectforme">
<option value="none">Aucune</option>
{% for activeSubscription in app.user.activeSubscriptions %}
<option value="{{activeSubscription.id}}" data-productId="{{activeSubscription.product.id}}" data-type="product">{{activeSubscription.product}}</option>
{% endfor %}
</select>
</div>
<form>
<!--end checkout-form-->
</div>
</div>
{% endif %}
<hr>
{# Main section#}
<h4 class="m-b-20 cart-main-title">
{{ form.products | length }} ARTICLE{% if form.products | length > 1%}S{%endif%} DANS VOTRE PANIER
{% if noGo is not defined %}
<input type="submit" value="Passer à la Livraison / Cueillette" class="btn btn-primary float-right phone-fullwidth" onclick="document.getElementById('se-pre-con').style.display='initial';">
{% endif %}
</h4>
{% if not app.user %}
<h5 style="text-align: center;">Vous avez un compte chez Maturin, <a href="{{path('fos_user_security_login')}}">connectez-vous / Inscription</a>.</h5>
<br><br>
{% endif %}
{% if global.getCart.products | length < 1 %}
<div style="background-color: white; padding-top: 15px; padding-bottom: 15px;"> <h5 style="text-align: center;">Votre panier est vide</h5></div>
{% endif %}
<div class="cart_product {% if global.getCart.products | length < 1 %}d-none{% endif %}" style="background-color: white; padding-top: 15px; padding-bottom: 15px;">
{# MATURIN No JIT SHIPPING #}
{% set amountOfShipment = 1 %}
{% if global.getCart.hasMaturinShipping %}
{{include('frontend/cartListingProduct.html.twig', {mode: 'maturin'})}}
{% endif %}
{# CUSTOM SHIPPING #}
{% if global.getCart.hasCustomShipping %}
<br>
<hr/>
<br>
{% if global.getCart.totalOfShipment > 1 %}
{% set amountOfShipment = amountOfShipment + 1 %}
{% endif %}
{{include('frontend/cartListingProduct.html.twig', {mode: 'custom'})}}
{% endif %}
{# PICKUP #}
{% if global.getCart.hasPickup %}
<br>
{# <hr/> #}
<br>
{{include('frontend/cartListingProduct.html.twig', {mode: 'pickup'})}}
{% endif %}
{# {% set route = global.getEstimationShippingRouteForMaturinProducts(global.getCart) %}
{% if route['route'] is not null and not route['route'].isPuro and app.user.hasReusableBox == false %}
<div class="checkout-form mt-3 mb-2" style="text-align: center;">
<input type="checkbox" name="reusableBox" value="addBox" checked>Ajouter une glaciere réutilisable a votre panier ? (consigne 15$)</input>
</div>
{% endif %} #}
</div>
{# INFOS about minimal cart amount #}
{% if global.getCart.hasMaturinDeliveryProducts %}
{% if global.getCart.totalProductsMaturinDeliveryOnly < 25 %}
<h5>Information: Minimum de commande de 25$ pour les produits livrés par Maturin</h5>
{% else %}
<h5>Minimum de commande de 25$ atteint pour les produits livrés par Maturin</h5>
{% endif %}
<h5>Livraison Gratuite à Montréal, Laval, Longueuil sur commande de 75$ et plus, pour les produits livrés par Maturin.</h5>
{% endif %}
{# Navigation links and cart sub-total #}
<div class="row ">
<div class="col-md-6 align-self-center">
<div class="total-calculate">
<a href="{{path('allCategory')}}" class="continue-shopping-link"><i class="ti ti-arrow-left mr-2"></i>Retour au magasin</a>
</div>
</div><!-- end col -->
<div class="col-md-6">
<div class="total-calculate text-right">
<div class="cart-subtotal font-weight-bold">
<p>
<span class="">SOUS-TOTAL </span>{{cart.subTotalToPay(false)|number_format(2)}}$</p>
</div>
{% if noGo is not defined and form.recurring is defined %}
<div class="row">
<div class="col-sm-12">
{{form_row(form.recurring)}}
</div>
</div>
{% endif %}
<div class="row">
<div class="col-sm-12">
{{ form_widget(form.update)}}
{% if noGo is defined %}
{{ form_widget(form.submit, {'attr': { 'style': 'display:none;'}})}}
{% else %}
{{ form_widget(form.submit)}}
{% endif %}
</div>
</div>
</div><!-- end total-calculate -->
</div><!-- end col -->
</div><!-- end row -->
<br>
{# INFOS about minimal cart amount #}
{% if global.getCart.totalProducts < 25 and not global.getCart.hasPromotionalProduct and suggestedProducts is not empty %}
<h4>Voici nos suggestions pour compléter votre panier</h4>
{% elseif suggestedProducts is not empty %}
<h4>Ne passez pas à côté de ces offres exclusives</h4>
{% endif %}
<hr>
{# Suggest some produts#}
{% if suggestedProducts is not empty %}
<div class="row">
<div class="col-sm-12">
<div class="owl-carousel owl-theme" id="owl-multi">
{% for p in suggestedProducts %}
<div class="item">
<a href="{{path('viewProduct', {'producerUrl':p.company.UrlName, 'productName': p.UrlName, 'id': p.Id})}}" style="color: black; font-weight: bold;">
<img src="{{path('getImageAsCroppedThumb', {id: p.mainImage.id, height: '250', width: '250'})}}" alt="{{p.name}}" class="cart-image" style="max-width: 100%;">
{{p.Name}}
</a>
<div class="product-subtitle">
<a href="{{path('companyStore', {'urlname': p.company.urlname, 'id':p.company.id })}}" style="font-size: 12px; color: black;">{{p.company.name}}</a>
</div>
<div class="product-subtitle" style="color: black; font-weight: bold;">
{{p.displayPrice}}
</div>
<div class="product-subtitle">
<a class="btn btn-warning waves-effect waves-light" href="{{path('addProductAtCart', {'id': p.id})}}">
AJOUTER AU PANIER
</a>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div><!-- end product-purchase-list -->
</div><!-- end col -->
</div><!-- end row -->
{% if noGo is defined %}
{{form_end(form, {'render_rest': false}) }}
{% else %}
{% do form.products.setRendered %}
{{form_end(form) }}
{% endif %}
<script src="/assets/admin/js/jquery.min.js" type="text/javascript"></script>
{% endblock %}