{% extends 'base.html.twig' %}
{% block title %}- Mise à jour d'une bulle{% endblock %}
{% block breadcrumb %}
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="page-breadcrumb">
<div class="row custom-between">
<div class="align-self-center">
<h1 class="page-title text-dark font-weight-medium mb-1 text-break">{% trans %}Modifier une bulle{% endtrans %}</h1>
<div class="d-flex align-items-center">
<nav aria-label="breadcrumb">
<ol class="breadcrumb m-0 p-0">
<li class="breadcrumb-item">
<li class="breadcrumb-item"><a href="{{ path('home') }}">{% trans %}Page d'accueil{% endtrans %}</a> > > <a href="{{ path('bubble') }}">{% trans %}Mes bulles{% endtrans %}</a> > <span>{% trans %}Modifier une bulle{% endtrans %}</span>
</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
{% endblock %}
{% block content %}
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header mc-bg text-white">
{% trans %}Informations de la bulle{% endtrans %}
</div>
<div class="card-body">
{{ form_start(bubbleForm) }}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="tag"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.bubble_name, { 'attr' : {
'placeholder' : 'Nom de la bulle'
}}) }}
</div>
{% if form_errors(bubbleForm.bubble_name)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.bubble_name) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="mail"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.b_address, { 'attr' : {
'placeholder' : 'Adresse'
}}) }}
</div>
{% if form_errors(bubbleForm.b_address)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.b_address) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="map-pin"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.b_postal_code, { 'attr' : {
'placeholder' : 'Code postal'
}}) }}
</div>
{% if form_errors(bubbleForm.b_postal_code)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.b_postal_code) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="home"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.b_city_name, { 'attr' : {
'placeholder' : 'Ville'
}}) }}
</div>
{% if form_errors(bubbleForm.b_city_name)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.b_city_name) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="map"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.b_country, { 'attr' : {
'placeholder' : 'Pays'
}}) }}
</div>
{% if form_errors(bubbleForm.b_country)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.b_country) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="check-square"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.is_qc_updatable, { 'attr' : {
'placeholder' : 'Contrôle qualité'
}}) }}
</div>
{% if form_errors(bubbleForm.is_qc_updatable)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.is_qc_updatable) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="user"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.stripe_customer_id, { 'attr' : {
'placeholder' : 'Identifiant du client'
}}) }}
</div>
{% if form_errors(bubbleForm.stripe_customer_id)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.stripe_customer_id) }}</div>
{% endif %}
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="credit-card"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.stripe_pay_method_id, { 'attr' : {
'placeholder' : 'Méthode de paiement'
}}) }}
</div>
{% if form_errors(bubbleForm.stripe_pay_method_id)%}
<div class="alert alert-danger">{{ form_errors(bubbleForm.stripe_pay_method_id) }}</div>
{% endif %}
{# Number of crédit Field >>> #}
<div class="number-credit-error" style="color: red; display: none">{% trans %}Veuillez entrer une valeur supérieure ou égale à 0,01.{% endtrans %}</div>
<div class="number-credit-error-dec" style="color: red; display: none">{% trans %}Merci d'indiquer un nombre à deux décimales maximum{% endtrans %}</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="hash"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.number_credit, { 'attr' : {
'placeholder' : 'Nombre de crédits'
}}) }}
</div>
{% if form_errors(bubbleForm.number_credit) %}
<div class="alert alert-danger">{{ form_errors(bubbleForm.number_credit) }}</div>
{% endif %}
{# <<< Number of crédit Field #}
{# Credit value Field >>> #}
<div class="credit-value-error" style="color: red; display: none">{% trans %}Veuillez entrer une valeur supérieure ou égale à 0,01.{% endtrans %}</div>
<div class="credit-value-error-dec" style="color: red; display: none">{% trans %}Merci d'indiquer un nombre à deux décimales maximum{% endtrans %}</div>
<div class="credits mb-3">
{{ form_widget(bubbleForm.credit_value, { 'attr' : {
'placeholder' : 'Valeur d\'un crédit'
}}) }}
</div>
{% if form_errors(bubbleForm.credit_value) %}
<div class="alert alert-danger">{{ form_errors(bubbleForm.credit_value) }}</div>
{% endif %}
{# <<< Credit value Field #}
{# Ad valorem value Field >>> #}
{# <div class="ad-valorem-error" style="color: red; display: none">{% trans %}Veuillez entrer une valeur supérieure ou égale à 0,01.{% endtrans %}</div>
<div class="ad-valorem-error-dec" style="color: red; display: none">{% trans %}Merci d'indiquer un nombre à deux décimales maximum{% endtrans %}</div> #}
{# <div class="input-group ad-valorem mb-3">
<div class="input-group-prepend">
<label class="input-group-text" ><i data-feather="plus-square"
class="feather-icon"></i></label>
</div>
{{ form_widget(bubbleForm.ad_valorem, { 'attr' : {
'placeholder' : "Valeur de l'ad valorem Vistory (en %)"
}}) }}
</div> #}
{# {% if form_errors(bubbleForm.ad_valorem) %}
<div class="alert alert-danger">{{ form_errors(bubbleForm.ad_valorem) }}</div>
{% endif %} #}
{# <<< Ad valorem value Field #}
<button class="btn btn-primary btn-mc-to-load update-bubble-button" type="submit">
<span class="btn-mc-loader d-none spinner-grow spinner-grow-sm" role="status" aria-hidden="true"></span>
<span class="btn-mc-loading-text">{% trans %}Valider{% endtrans %}
</button>
{{ form_end(bubbleForm) }}
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(function() {
var numberCredit = true;
var creditValue = true;
var numberCreditDec = true;
var creditValueDec = true;
var adValoremDec = true;
//----- NUMBER CREDIT -----/
$('#bubble_edit_number_credit').blur(function(){
if($('#bubble_edit_number_credit').val() < 0.01 && $('#bubble_edit_number_credit').val() != 0) {
if($('#bubble_edit_number_credit').val() != ''){
$('#bubble_edit_number_credit').css('border', 'solid red 1px');
$('.update-bubble-button').attr('disabled', true);
$('.number-credit-error').show()
numberCredit = false
}
} else {
$('#bubble_edit_number_credit').css('border', '1px solid #e9ecef');
$('.number-credit-error').hide()
numberCredit = true
}
if ($('#bubble_edit_number_credit').val() > 0.01 && (/\.\d{3,}/.test($('#bubble_edit_number_credit').val()) || /\,\d{3,}/.test($('#bubble_number_credit').val()))) {
$('#bubble_edit_number_credit').css('border', 'solid red 1px');
$('.update-bubble-button').attr('disabled', true)
$('.number-credit-error-dec').show();
numberCreditDec = false
} else {
$('#bubble_number_credit').css('border', '1px solid #e9ecef');
$('.number-credit-error-dec').hide();
numberCreditDec = true
}
if(numberCredit == true && creditValue == true && numberCreditDec == true && creditValueDec == true && adValoremDec == true) {
$('.update-bubble-button').attr('disabled', false)
}
})
//----- CREDIT VALUE -----//
$('#bubble_edit_credit_value').blur(function(){
if($('#bubble_edit_credit_value').val() < 0.01) {
if($('#bubble_edit_credit_value').val() != ''){
$('#bubble_edit_credit_value').css('border', 'solid red 1px');
$('.update-bubble-button').attr('disabled', true);
$('.credit-value-error').show()
creditValue = false
}
} else {
$('#bubble_edit_credit_value').css('border', '1px solid #e9ecef');
$('.credit-value-error').hide()
creditValue = true
}
if ($('#bubble_edit_credit_value').val() > 0.01 && (/\.\d{3,}/.test($('#bubble_edit_credit_value').val()) || /\,\d{3,}/.test($('#bubble_credit_value').val()))) {
$('#bubble_edit_credit_value').css('border', 'solid red 1px');
$('.update-bubble-button').attr('disabled', true)
$('.credit-value-error-dec').show();
creditValueDec = false
} else {
$('#bubble_edit_credit_value').css('border', '1px solid #e9ecef');
$('.credit-value-error-dec').hide();
creditValueDec = true
}
if(numberCredit == true && creditValue == true && numberCreditDec == true && creditValueDec == true && adValoremDec == true) {
$('.update-bubble-button').attr('disabled', false)
}
})
//----- AD VALOREM -----//
/*$('#bubble_edit_ad_valorem').blur(function(){
if($('#bubble_edit_ad_valorem').val() < 0) {
if($('#bubble_edit_ad_valorem').val() != ''){
$('#bubble_edit_ad_valorem').css('border', 'solid red 1px');
$('.update-bubble-button').attr('disabled', true)
$('.ad-valorem-error').show()
}
} else {
$('#bubble_edit_ad_valorem').css('border', '1px solid #e9ecef');
$('.ad-valorem-error').hide()
}
if ($('#bubble_edit_ad_valorem').val() >= 0 && (/\.\d{3,}/.test($('#bubble_edit_ad_valorem').val()) || /\,\d{3,}/.test($('#bubble_edit_ad_valorem').val()))) {
$('#bubble_edit_ad_valorem').css('border', 'solid red 1px');
$('.update-bubble-button').attr('disabled', true)
$('.ad-valorem-error-dec').show();
adValoremDec = false
} else {
$('#bubble_edit_ad_valorem').css('border', '1px solid #e9ecef');
$('.ad-valorem-error-dec').hide();
adValoremDec = true
}
if(numberCredit == true && creditValue == true && numberCreditDec == true && creditValueDec == true && adValoremDec == true) {
$('.update-bubble-button').attr('disabled', false)
}
})*/
$('#bubble_edit_ad_valorem').on('input', function() {
let adValorem = $(this).val();
let adValoremError = $('.ad-valorem-error');
/* if (/\.\d{3,}/.test(adValorem) || /\,\d{3,}/.test(adValorem)) {
adValoremError.show();
const twoDecimalPlacesMessage = '<span style="color: red; font-size: 11px; padding: 0 0 0 20px; ">' +
'{% trans %}Veuillez entrer une valeur supérieure à 0.01.{% endtrans %}' +
'</span>';
adValoremError.html(twoDecimalPlacesMessage)
} else {
adValoremError.hide();
} */
});
const credictsElt = $(".credits");
credictsElt.find('.input-group-text').remove();
credictsElt.find('.input-group-prepend').remove();
credictsElt.find('.input-group-append').remove();
const credictsIcon = "<span class='credicts-icon'>€</span>";
credictsElt.find('.input-group').prepend(credictsIcon);
});
$('.js-example-basic-single').select2();
</script>
{% endblock %}