Commit c59c0e4f authored by Mat's avatar Mat
Browse files

le date range slider dans une fonction, on lui passe les date debut et fin

parent 1b49b26f
......@@ -54,8 +54,6 @@
</div>
</div>
<div class="form-group row">
<div class="col-sm-4">
{{ form_label(formLettre.startedAt) }}
......@@ -76,6 +74,9 @@
</div>
</div>
<div id="dateRuleSlider" class="mb-4"></div>
{# TODO résoudre ptit bug d'affichage du slider #}
<div class="form-group row">
<div class="col-sm-4">
{{ form_label(formLettre.status) }}
......
......@@ -48,7 +48,6 @@
<div class="clearfix"></div>
</div>
<div id="dateRuleSlider" class="mb-4"></div>
</section>
{% endblock %}
......@@ -131,6 +130,10 @@
{% include '@Potage/LettreInfos/ajaxDisplay.js' %}
console.log('hop:');
console.log(new Date(2018, 5, 1));
</script>
{% endblock %}
......@@ -165,12 +165,16 @@ function editBlocLettre()
function(request) {
let json = JSON.parse(request.responseText);
formTitle.textContent = "Modifier l'lettre " + json.reference;
formTitle.textContent = "Modifier la lettre " + json.reference;
form.querySelector('#lettre_groupe').value = json.groupe.id;
form.querySelector('#lettre_offre').value = json.offre.id;
form.querySelector('#lettre_subject').value = json.subject;
form.querySelector('#lettre_startedAt').value = formatDateISO(json.started_at);
form.querySelector('#lettre_endedAt').value = formatDateISO(json.ended_at);
console.log('ajax get read_one:');
displayDateRangeSlider(json.started_at, json.ended_at);
form.querySelector('#lettre_status').value = json.status;
submitURL = Routing.generate('api_lettre_update', {'id': id_lettre});
});
......@@ -205,19 +209,25 @@ form.addEventListener('submit', function(e)
*
*/
function displayDateRangeSlider(minDate, maxDate)
{
let months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
let dows = ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'];
let firstDay = 1; //lundi
let months = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"];
let dows = ['di', 'lu', 'ma', 'me', 'je', 've', 'sa'];
let firstDay = 1; //lundi
console.log(new Date(minDate).getDate());
$("#dateRuleSlider").dateRangeSlider({
let minD = new Date(minDate);
let maxD = new Date(maxDate);
$("#dateRuleSlider").dateRangeSlider({
bounds: {
min: new Date(2018, 5, 1),
max: new Date(2018, 8, 20)
max: new Date(2018, 8, 1)
},
defaultValues: {
min: new Date(2018, 5, 29),
max: new Date(2018, 6, 6)
min: new Date(minD.getFullYear(), minD.getMonth(), minD.getDate()),
max: new Date(maxD.getFullYear(), maxD.getMonth(), maxD.getDate())
},
arrows: true,
step:{
......@@ -283,6 +293,5 @@ $("#dateRuleSlider").dateRangeSlider({
}
}]
});
});
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment