{% extends 'base.html.twig' %}
{% block title %}Edition Règlement{% endblock %}
{% block body %}
<ol class="breadcrumb">
<li>
<i class="clip-grid-6"></i>
<a href="#">
Règlement
</a>
</li>
<li class="active">
Edition
</li>
</ol>
<div class="page-header">
<h1>Règlement</h1>
</div>
<div class="row">
<div class="col-md-12">
{{ form_start(form, {'attr': {'id': 'form_billing'}}) }}
<div class="row topPart">
{% include 'formErrors.html.twig' %}
<div class="col-md-6">
{#<div>Numéro facture : {{ billing.id }}</div>#}
<div>Date de règlement : {{ form_row(form.date) }}</div>
<div>Mode de règlement : {{ form_row(form.mode) }}</div>
<div>Montant TTC : {{ form_row(form.ttc) }}</div>
<div>Reference : {{ form_row(form.reference) }}</div>
<div>Statut : {{ form_row(form.status) }}</div>
<div>Nom client : {% if reglement.client %}{{ reglement.client.firstname }} {{ reglement.client.lastname }}{% endif %}</div>
<div>Adresse facturation : {% if reglement.client %}{% endif %}</div>
<div>Remise client : {{ reglement.client and reglement.client.billingInfos ? reglement.client.billingInfos.discount : 0 }} % </div>
</div>
<div class="col-md-6">
<div>Mode de paiement : {{ reglement.client and reglement.client.billingInfos ? reglement.client.billingInfos.getPayModeString : '' }}</div>
<div>Banque: {{ reglement.client and reglement.client.billingInfos ? reglement.client.billingInfos.bankName : '' }} IBAN: {{ reglement.client and reglement.client.billingInfos ? reglement.client.billingInfos.iban : '' }}</div>
<div>Montant règlement : </div>
</div>
</div>
<div class="row topPart" style="padding: 20px">
<table class="product-table">
<thead>
<tr>
<th>Date</th>
<th>Référence</th>
</tr>
</thead>
<tbody>
{% for billing in reglement.billings %}
<tr class="billingItem">
<td>{{ billing.dateBilling|date('d/m/Y') }}</td>
<td>{{ billing.code }}</td>
</tr>
{% else %}
<tr>
<td colspan="4">Aucun enregistrement trouvé</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="row" style="margin-top:20px;">
<div class="col-md-12">
<button class="btn btn-success btn-block btn-valid" type="submit">
Validation <i class="fa fa-arrow-circle-right"></i>
</button>
</div>
</div>
{{ form_end(form) }}
<style>
.topPart .form-group {
display:inline-block;
}
</style>
</div>
</div>
<a href="{{ path('app_reglement_index') }}" class="btn btn-outline-info back-button">Revenir à la liste</a>
<div>
{% if reglement.status != 'Annulé' %}
{{ form_start(cancelForm, {'attr': {'id': 'form-cancel'}}) }}
{{ form_row(cancelForm.motifCancel) }}
<button href="#" target="_blank" class="btn btn-danger back-button btn-cancel">ATTENTION : Annuler un réglement</button>
{{ form_end(cancelForm) }}
{% endif %}
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="application/javascript">
$('.btn-cancel').on('click', function (e) {
e.preventDefault();
notie.confirm({
text: "Etes-vous sur d'annuler ce réglement?",
submitText: 'Confirmer', // optional, default = 'Yes'
cancelText: 'Annuler', // optional, default = 'Cancel'
position: 'top', // optional, default = 'top', enum: ['top', 'bottom']
submitCallback: function () {
//let pathCancel ="{{ path('reglement_cancel',{'id' : reglement.id }) }}";
//window.location = pathCancel;
$('#form-cancel').submit();
}, // optional
cancelCallback: function () {
} // optional
}, function () {
}, function () {
})
})
function addTagForm($collectionHolder) {
// Get the data-prototype explained earlier
var prototype = $collectionHolder.data('prototype');
// get the new index
var index = $collectionHolder.data('index');
var newForm = prototype;
// You need this only if you didn't set 'label' => false in your tags field in TaskType
// Replace '__name__label__' in the prototype's HTML to
// instead be a number based on how many items we have
// newForm = newForm.replace(/__name__label__/g, index);
// Replace '__name__' in the prototype's HTML to
// instead be a number based on how many items we have
newForm = newForm.replace(/__name__/g, index);
// increase the index with one for the next item
$collectionHolder.data('index', index + 1);
// Display the form in the page in an li, before the "Add a tag" link li
var $newFormLi = $('<div></div>').append(newForm);
//$newLinkLi.before($newFormLi);
$collectionHolder.after($newFormLi);
$newFormLi.find(".flatpicker").flatpickr({
'dateFormat' : 'd-m-Y',
"locale": "fr"
});
}
var $collectionHolder;
// setup an "add a tag" link
var $addTagButton = jQuery('.btnAddContrat');
jQuery(document).ready(function() {
// Get the ul that holds the collection of tags
$collectionHolder = jQuery('ul.contratList');
// count the current form inputs we have (e.g. 2), use that as the new
// index when inserting a new item (e.g. 2)
$collectionHolder.data('index', $collectionHolder.find(':input').length);
$addTagButton.on('click', function(e) {
// add a new tag form (see next code block)
addTagForm($collectionHolder);
});
$(document).on('click','.btnDeleteContract', function(e) {
// add a new tag form (see next code block)
$(e.target).parents('.contract-item').remove();
var index = $collectionHolder.data('index');
$collectionHolder.data('index', index - 1);
});
});
</script>
{% endblock %}