{% extends 'base_back.html.twig' %}
{% block title %}Edition {% endblock %}
{% block body %}
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0">Pages produits</h1>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<section class="content">
<div class="container-fluid">
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Ajout d'une Page produit</h3>
</div>
<!-- /.card-header -->
<div class="card-body">
{{ include('back/product_page/_form.html.twig') }}
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock %}
{% block javascript %}
{{ parent() }}
<script>
jQuery(document).ready(function () {
jQuery('.add-another-collection-widget').click(function (e) {
var list = jQuery(jQuery(this).attr('data-list-selector'));
// Try to find the counter of the list or use the length of the list
var counter = list.data('widget-counter') || list.children().length;
// grab the prototype template
var newWidget = list.attr('data-prototype');
// replace the "__name__" used in the id and name of the prototype
// with a number that's unique to your emails
// end name attribute looks like name="contact[emails][2]"
newWidget = newWidget.replace(/__name__/g, counter);
// Increase the counter
counter++;
// And store it, the length cannot be used if deleting widgets is allowed
list.data('widget-counter', counter);
// create a new list element and add it to the list
var newElem = jQuery(list.attr('data-widget-tags')).html(newWidget);
newElem.appendTo(list);
addTagFormDeleteLink(newElem);
});
function addTagFormDeleteLink($tagFormLi) {
var $removeItem = $('<button type="button" class="btn btn-danger">Supprimer</button>');
$tagFormLi.append($removeItem);
$removeItem.on('click', function(e) {
var $list = $tagFormLi.parent();
var count = $list.data('count') - 1;
e.preventDefault();
$list = $list.data('count', count);
$($list.data('counter-element')).text(count);
$tagFormLi.remove();
enableAddToTheList($($list.data('add-element')));
});
}
// Summernote
$('#product_page_description').summernote({
height: 150
});
$('#product_page_benefit').summernote({
height: 150
});
});
</script>
{% endblock %}