{{ form_start(form, {'attr': {'id': 'form_client'}}) }}
<div class="row">
{% include 'formErrors.html.twig' %}
<div class="col-md-6">
{{ form_row(form.lastname) }}
{{ form_row(form.civilite) }}
</div>
<div class="col-md-6">
{{ form_row(form.firstname) }}
{{ form_row(form.birthday) }}
</div>
<div class="col-md-6">
{{ form_row(form.site) }}
{{ form_row(form.roomNumber) }}
</div>
<div class="col-md-6">
{{ form_row(form.deathday) }}
{{ form_row(form.statusProspect) }}
</div>
<div class="col-md-6">
{{ form_row(form.consignesClient) }}
</div>
<div class="col-md-6">
{{ form_row(form.comments) }}
</div>
<div class="col-md-6">
{{ form_row(form.daysOfWeek) }}
</div>
{% if client %}
<div class="row col-md-12">
<div class="col-md-6" style="display: flex;column-gap: 10px">
{% if client.statusProspect != 'Inactif' and client.statusProspect !='Parti' and client.statusProspect !='Décès' %}
<a href="{{ path('app_planning_liste', {'client_id': client.id}) }}" class="btn btn-primary">Voir le planning</a>
{% if client.id %}
<a href="{{ path('app_client_recurrence', {'id': client.id}) }}" class="btn btn-primary" target="_blank">
Recurrence Coiffure✂️
</a>
{% endif %}
{% if client.id %}
<a href="{{ path('app_client_recurrenceesthetique', {'id': client.id}) }}" class="btn btn-primary" target="_blank">
Recurrence Esthetique 💄</a>
{% endif %}
{% endif %}
{# <div>#}
{# <button class="btn btn-success open-envoi-facture" data-target="#modalEnvoiFacture">Envoi facture</button>#}
{# </div>#}
</div>
</div>
{% endif %}
</div>
{% include 'requiredFields.html.twig' %}
<div class="row">
<div class="col-md-12">
<ul class="nav nav-tabs">
<li class="{{ (isBilling is defined and isBilling) or (isReg is defined and isReg) ? '' : 'active' }}">
<a href="#contacts" data-toggle="tab">Contact principal</a>
</li>
<li>
<a href="#famille" data-toggle="tab">Proches</a>
</li>
{# <li class="">#}
{# <a href="#prestations" data-toggle="tab">Contrat de prestations</a>#}
{# </li>#}
<li class="">
<a href="#facturation" data-toggle="tab">Gestion facturation</a>
</li>
<li class="{{ isBilling is defined and isBilling ? 'active' : '' }}">
<a href="#factures" data-toggle="tab" aria-expanded="{{ isBilling is defined and isBilling ? 'true' : 'false' }}">Factures</a>
</li>
<li class="{{ isReg is defined and isReg ? 'active' : '' }}">
<a href="#reglements" data-toggle="tab" aria-expanded="{{ isReg is defined and isReg ? 'true' : 'false' }}">Réglements</a>
</li>
{# <li class="">#}
{# <a href="#recurrence" data-toggle="tab">Récurrence</a>#}
{# </li>#}
</ul>
<div class="tab-content clearfix">
<!-- contact -->
<div class="tab-pane {{ (isBilling is defined and isBilling) or (isReg is defined and isReg) ? '' : 'active' }}" id="contacts">
<div class="panel-heading">
Contact principal
</div>
<div class="panel-body">
<div class="col-md-12">
<div class="col-md-6">
{{ form_row(form.nomTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.prenomTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.civiliteTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.commentTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.numeroTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.emailTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.addressTuteur) }}
</div>
<div class="col-md-6">
{{ form_row(form.addressTuteur2) }}
</div>
<div class="col-md-6">
{{ form_row(form.zipcode) }}
</div>
<div class="col-md-6">
{{ form_row(form.city) }}
</div>
</div>
</div>
</div>
<!-- famille -->
<div class="tab-pane" id="famille">
<div class="panel-heading">
Proches
</div>
<div class="panel-body">
<ul class="familyList" style="list-style: none"
data-prototype="{% apply escape %}{% include 'client/familyPrototype.html.twig' with {'form': form.familyMembers.vars.prototype} %}{% endapply %}">
{% for famille in form.familyMembers %}
<div class="row family-item">
<div class="col-md-6">
{{ form_row(famille.firstname) }}
</div>
<div class="col-md-6">
{{ form_row(famille.lastname) }}
</div>
<div class="col-md-6">
{{ form_row(famille.email) }}
</div>
<div class="col-md-6">
{{ form_row(famille.phone) }}
</div>
<div class="col-md-6">
{{ form_row(famille.type) }}
</div>
<div class="col-md-12">
<button type="button" class="btn btn-danger btnDeleteFamily">Suppresion d'un membre de la famille</button>
</div>
</div>
<hr>
{% endfor %}
</ul>
</div>
<div class="text-center col-md-12">
<button type="button" class="btn btn-success btnAddFamily">Ajout d'un membre de la famille</button>
</div>
</div>
<!-- contract -->
{# <div class="tab-pane" id="prestations">#}
{# <ul class="contratList" style="list-style: none"#}
{# data-prototype="{% apply escape %}{% include 'client/contractPrototype.html.twig' with {'form': form.contract.vars.prototype} %}{% endapply %}">#}
{# {% for contract in form.contract %}#}
{# Référence contrat : {{ contract.vars.data.id }}#}
{# <div class="row contract-item">#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.dateDebutRelation) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.dateFinRelation) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.typeRDV) }}#}
{# </div>#}
{# #}{#<div class="col-md-6">#}
{# #}{#{{ form_row(contract.libellePrestation) }}#}
{# #}{#</div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.recurrence) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.products) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.priorite) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.foumulaireReservation) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.heure) }}#}
{# </div>#}
{# <div class="col-md-6">#}
{# {{ form_row(contract.remarque ) }}#}
{# </div>#}
{# <div class="col-md-12">#}
{# <button type="button" class="btn btn-danger btnDeleteContract">Suppresion du contrat</button>#}
{# </div>#}
{# <div class="col-md-12">#}
{# <hr>#}
{# </div>#}
{# </div>#}
{# {% endfor %}#}
{# </ul>#}
{# <div class="text-center col-md-12">#}
{# <button type="button" class="btn btn-success btnAddContrat">Ajout d'un contrat</button>#}
{# </div>#}
{# </div>#}
<div class="tab-pane" id="facturation">
<div class="panel-heading">
Gestion facturation
</div>
<div class="panel-body">
<div class="col-md-6">
{{ form_row(form.billingInfos.company) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.billingMode) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.email) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.phone) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.discount) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.sendMode) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.payMode) }}
</div>
<div class="col-md-6">
{{ form_row(form.civiliteFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.nomFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.prenomFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.addressFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.ComplementAdresseFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.villeFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.codePostalFacturation) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.account) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.bankName) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.iban) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.bic) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.rum) }}
</div>
<div class="col-md-6">
{{ form_row(form.billingInfos.dateSignatureMandat) }}
</div>
</div>
</div>
<div class="tab-pane {{ isBilling is defined and isBilling ? 'active' : '' }}" id="factures">
<div class="panel panel-default">
<div class="panel-heading">
Factures
</div>
{% if factures is defined %}
<div class="row">
{{ form_start(formFilter) }}
<div class="col-md-2">
{{ form_row(formFilter.status) }}
</div>
<div class="col-md-2">
{{ form_row(formFilter.dateDebut) }}
</div>
<div class="col-md-2">
{{ form_row(formFilter.dateFin) }}
</div>
<div class="col-md-2" style="padding-top: 23px;">
<button type="submit" class="btn btn-success">Filtrer</button>
</div>
{{ form_end(formFilter) }}
<div class="col-md-2" style="padding-top: 23px;">
<button class="btn btn-success" id="envoiFacture">Envoi factures</button>
</div>
</div>
{% endif %}
<div class="panel-body">
<table class="table table-hover">
<thead>
<th style="padding: 20px"><input type="checkbox" class="checkAll" id="checkAllFactures" /></th>
<th style="padding: 20px">Référence</th>
<th style="padding: 20px">Statut</th>
<th style="padding: 20px">Date</th>
<th style="padding: 20px">TTC</th>
<th style="padding: 20px">Solde</th>
<th style="padding: 20px">Lien paiement paytweak</th>
<th style="padding: 20px">Societé facturante</th>
<th style="padding: 20px">Réglement</th>
</thead>
{% if factures is defined %}
{% for facture in factures %}
<tr>
<td>
<input type="checkbox" class="calcul" data-billing="{{ facture.id }}" data-ttc="{{ facture.ttc }}" data-solde="{% if facture.solde %}{{ facture.solde }}{% else %}0{% endif %}" />
</td>
<td>
<a href="{{ path('billing_edit', {id : facture.id}) }}">{{ facture.code }}</a>
</td>
<td>
{{ facture.status }}
</td>
<td>
{{ facture.dateBilling|date('d/m/Y') }}
</td>
<td style="text-align: right">
{{ facture.ttc|number_format(2, '.', ',') }}
</td>
<td style="text-align: right">
{{ facture.solde|number_format(2, '.', ',') }}
</td>
<td>
{% if facture.linkPaytweak %}
{% if facture.company.id == 2 %}
<a href="https://silver-beaute.link/{{ facture.linkPaytweak }}">https://silver-beaute.link/{{ facture.linkPaytweak }}</a>
{% else %}
<a href="https://paytweak.link/{{ facture.linkPaytweak }}">https://silver-beaute.link/{{ facture.linkPaytweak }}</a>
{% endif %}
{% endif %}
</td>
<td>
{{ facture.company ? facture.company.name : ''}}
</td>
<td>
<a {% if facture.reglement and facture.reglement.status == 'Annulé' %} style="color:red;text-decoration:line-through;"{% endif %} href="{{ facture.reglement ? path('reglement_edit', {'id': facture.reglement.id}) : '#' }}">
{{ facture.reglement ? facture.reglement.id : ''}}
</a>
</td>
</tr>
{% endfor %}
{% endif %}
</table>
<div>
<div><b>Total TTC:</b> <span class="calcul-total"></span></div>
<div><b>Total Solde:</b> <span class="calcul-solde"></span></div>
</div>
</div>
</div>
</div>
<div class="tab-pane {{ isReg is defined and isReg ? 'active' : '' }}" id="reglements">
<div class="panel panel-default">
<div class="panel-heading">
Réglements
</div>
{% if reglements is defined %}
<div class="row">
{{ form_start(formFilterReglement) }}
<div class="col-md-2">
{{ form_row(formFilterReglement.statut) }}
</div>
<div class="col-md-2">
{{ form_row(formFilterReglement.mode) }}
</div>
<div class="col-md-2">
{{ form_row(formFilterReglement.date) }}
</div>
<div class="col-md-2">
{{ form_row(formFilterReglement.dateEnd) }}
</div>
<div class="col-md-2">
{{ form_row(formFilterReglement.billing) }}
</div>
<div class="col-md-2">
{{ form_row(formFilterReglement.reference) }}
</div>
<div class="col-md-2">
{{ form_row(formFilterReglement.ttc) }}
</div>
<div class="col-md-2" style="padding-top: 23px;">
<button type="submit" class="btn btn-success">Filtrer</button>
</div>
{{ form_end(formFilterReglement) }}
</div>
{% endif %}
<div class="panel-body">
<table class="table table-hover">
<thead>
<th style="padding: 20px"><input type="checkbox" id="checkAllReglements" class="checkAllReglement" /></th>
<th style="padding: 20px">N° règlement</th>
<th style="padding: 20px">Date</th>
<th style="padding: 20px;text-align: right">Montant TTC</th>
<th style="padding: 20px">Mode de règlement</th>
<th style="padding: 20px">Référence</th>
<th style="padding: 20px">Statut</th>
<th style="padding: 20px">Numéro facture</th>
<th style="padding: 20px"></th>
</thead>
{% if reglements is defined %}
{% for reglement in reglements %}
<tr>
<td>
<input type="checkbox" class="calculReglement" data-ttc="{{ reglement.ttc }}" />
</td>
<td>
<a href="{{ path('reglement_edit', {id : reglement.id}) }}">{{ reglement.id }}</a>
</td>
<td>
{{ reglement.date|date('d/m/Y') }}
</td>
<td>
{{ reglement.ttc|number_format(2, '.', ',') }}
</td>
<td>
{{ reglement.mode }}
</td>
<td>
{{ reglement.reference }}
</td>
<td>
{{ reglement.status }} ({{ reglement.motifCancel }})
</td>
<td>
{%for billing in reglement.billings%}{{ billing.code }}, {%endfor%}
</td>
<td>
<a href="{{ path('reglement_edit', {'id': reglement.id}) }}" target="_blank">Edition</a>
</td>
</tr>
{% endfor %}
{% else %}
{% for reglement in client.reglements %}
<tr>
<td>
<input type="checkbox" class="calculReglement" data-ttc="{{ reglement.ttc }}" />
</td>
<td>
<a href="{{ path('reglement_edit', {id : reglement.id}) }}">{{ reglement.id }}</a>
</td>
<td>
{{ reglement.date|date('d/m/Y') }}
</td>
<td>
{{ reglement.ttc|number_format(2, '.', ',') }}
</td>
<td>
{{ reglement.mode }}
</td>
<td>
{{ reglement.reference }}
</td>
<td>
{{ reglement.status }} ({{ reglement.motifCancel }})
</td>
<td>
{%for billing in reglement.billings%}{{ billing.code }}, {%endfor%}
</td>
<td>
<a href="{{ path('reglement_edit', {'id': reglement.id}) }}" target="_blank">Edition</a>
</td>
</tr>
{% endfor %}
{% endif %}
</table>
<div>
<div><b>Total TTC:</b> <span class="calcul-total-reglement"></span></div>
{# <div><b>Total Solde:</b> <span class="solde-total-reglement"></span></div>#}
</div>
</div>
</div>
<!--recurrence -->
{# <div class="tab-pane" id="recurrence">#}
{# <div class="panel panel-default">#}
{# <div class="panel-heading">#}
{# Récurrence#}
{# </div>#}
{# </div>#}
{# </div>#}
</div>
</div>
</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) }}
</div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
var validationButton = document.querySelector('.btn-valid');
validationButton.addEventListener('click', function (event) {
event.preventDefault();
{% if isContact is defined and isContact %}
var userConfirmation = confirm('Voulez-vous modifier les infos dans la gestion de facturation ?');
if (userConfirmation) {
var form = document.getElementById('form_client');
form.submit();
}
{% else %}
var form = document.getElementById('form_client');
form.submit();
{% endif %}
});
});
var checkboxes = document.querySelectorAll('.calcul');
checkboxes.forEach(function (checkbox) {
checkbox.addEventListener('change', calculateTotal);
});
var checkboxesReglement = document.querySelectorAll('.calculReglement');
checkboxesReglement.forEach(function (checkbox) {
checkbox.addEventListener('change', calculateTotalReglement);
});
var checkAllFactures = document.getElementById('checkAllFactures');
checkAllFactures.addEventListener('change', function () {
checkboxes.forEach(function (checkbox) {
checkbox.checked = checkAllFactures.checked;
});
calculateTotal();
});
var checkAllReglements = document.getElementById('checkAllReglements');
checkAllReglements.addEventListener('change', function () {
checkboxesReglement.forEach(function (checkbox) {
checkbox.checked = checkAllReglements.checked;
});
calculateTotalReglement();
});
function isNumber(value) {
return typeof value === 'number';
}
function calculateTotal() {
var total = 0;
var solde = 0;
checkboxes.forEach(function (checkbox) {
console.log( checkbox.getAttribute('data-solde'));
var soldeGet = checkbox.getAttribute('data-solde');
if(soldeGet ==''){
soldeGet = 0;
}
if(soldeGet == undefined){
soldeGet = 0;
}
if (checkbox.checked) {
total += parseFloat(!isNaN(checkbox.getAttribute('data-ttc')) ? checkbox.getAttribute('data-ttc') : 0) || 0;
solde += parseFloat(soldeGet)|| 0;
}
});
document.querySelector('.calcul-total').textContent = total.toFixed(2);
document.querySelector('.calcul-solde').textContent = solde.toFixed(2);
}
function calculateTotalReglement() {
var total = 0;
var solde = 0;
checkboxesReglement.forEach(function (checkbox) {
if (checkbox.checked) {
total += parseFloat(checkbox.getAttribute('data-ttc'))|| 0;
solde += parseFloat(checkbox.getAttribute('data-solde'))|| 0;
}
});
document.querySelector('.calcul-total-reglement').textContent = total.toFixed(2);
//document.querySelector('.calcul-solde-reglement').textContent = solde.toFixed(2);
}
</script>