63 lines
2.0 KiB
HTML
63 lines
2.0 KiB
HTML
{% load bootstrap3 %}
|
|
<div class="form-inline well well-sm text-center">
|
|
{% if form.id %}{% bootstrap_field form.id %}{% endif %}
|
|
{% bootstrap_field form.lieu layout="inline" size="small" %}
|
|
<div class="input-group">{% bootstrap_field form.heure_debut layout="inline" size="small" %}
|
|
<span class="input-group-btn">
|
|
<button id="minus-5" class="btn btn-default btn-sm" type="button"><strong>-5</strong></button>
|
|
<button id="plus-5" class="btn btn-default btn-sm" type="button"><strong>+5</strong></button>
|
|
</span></div>
|
|
{% bootstrap_field form.duree layout="inline" size="small" %}
|
|
</div>
|
|
<div class="form-horizontal">
|
|
{{ inline_formset.management_form }}
|
|
{{ inline_formset.media.js }}
|
|
{{ inline_formset.media.css }}
|
|
{% for form in inline_formset %}
|
|
<div class="dynamic-formset">
|
|
{% if form.id %}{% bootstrap_field form.id %}{% endif %}
|
|
{% if form.instance.pk %}{% bootstrap_field form.note_ptr %}{% endif %}
|
|
|
|
{% bootstrap_field form.sujet size="small" layout="horizontal" %}
|
|
{% if inline_formset.instance.pk %}
|
|
{% bootstrap_field form.DELETE layout="horizontal" %}
|
|
{% endif %}
|
|
{% bootstrap_field form.text size="small" layout="horizontal" %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(function() {
|
|
|
|
var input = $('#id_heure_debut')
|
|
var min_value = input.attr('value').split(":")
|
|
|
|
$.fn.editHeureValue = function(mod) {
|
|
var input = $('#id_heure_debut');
|
|
var value = input.attr('value').split(":");
|
|
value[1] = parseInt(value[1]) + mod;
|
|
|
|
do_change = true
|
|
for (i=0; i < 3; i++){
|
|
if (value[i] < min_value[i]){
|
|
do_change = false
|
|
};
|
|
};
|
|
new_value = value.join(":");
|
|
if (do_change){
|
|
input.attr('value', new_value);
|
|
};
|
|
};
|
|
|
|
$('#minus-5').click(function() {
|
|
$.fn.editHeureValue(-5)
|
|
console.log('minus 5')
|
|
});
|
|
$('#plus-5').click(function() {
|
|
$.fn.editHeureValue(5)
|
|
console.log('plus 5')
|
|
});
|
|
});
|
|
</script>
|