Jarvis/jarvis/objective/templates/combinations/create.html

87 lines
4.6 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="row justify-content-center">
<div class="col-12 col-sm-12 col-md-8 col-lg-7 col-xl-6">
<div class="card">
<div class="card-header">
<h4 class="">{% if combination_id %}Edit{% else %}Add{% endif %} Combination</h4>
</div>
<div class="card-body">
<form action="{% if combination_id %}{% url 'combination_update' combination_id %}{% else %}{% url 'combination_create' %}{% endif %}" method="post" class="form-horizontal" id="formulaire" name="formulaire">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<div class="form-group row {% if form.long_label.errors %}has-error has-feedback{% endif %}">
<label for="id_long_label" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-3 col-form-label">Long label <span class="text-danger"><b>*</b></span></label>
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9">
{{ form.long_label }}&nbsp;{% if form.long_label.errors %}
{% for error in form.long_label.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
<div class="form-group row {% if form.short_label.errors %}has-error has-feedback{% endif %}">
<label for="id_short_label" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-3 col-form-label">Short label <span class="text-danger"><b>*</b></span></label>
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9">
{{ form.short_label }}&nbsp;{% if form.short_label.errors %}<span class="btn btn-sm btn-danger-outline">{% for error in form.short_label.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
<div class="form-group row {% if form.is_routine.errors %}has-error has-feedback{% endif %}">
<label for="id_is_routine" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-3 col-form-label">Is routine ? <span class="text-danger"><b>*</b></span></label>
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9">
{{ form.is_routine }}&nbsp;{% if form.is_routine.errors %}<span class="btn btn-sm btn-danger-outline">{% for error in form.is_routine.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
<div class="form-group row {% if form.is_competitive.errors %}has-error has-feedback{% endif %}">
<label for="id_is_competitive" class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-3 col-form-label">Is Competitive ? <span class="text-danger"><b>*</b></span></label>
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9">
{{ form.is_competitive }}&nbsp;{% if form.is_competitive.errors %}<span class="btn btn-sm btn-danger-outline">{% for error in form.is_competitive.errors %}{{ error }}{% endfor %}</span>{% endif %}
</div>
</div>
<div class="form-group row ">
<label for="id_information" class="col-4 col-sm-2 col-md-3 col-lg-3 col-xl-3 col-form-label">Informations</label>
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9 {% if form.id_information.errors %}has-danger{% endif %}">
{{ form.informations }}
</div>
</div>
<div class="form-group text-center">
<input type="submit" value="Save" class="btn btn-warning" />
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function(){
$('#id_long_label').keyup(function(){
$('#id_short_label').val($('#id_long_label').val());
});
$('#id_difficulty').val(0);
$('#id_level').val(0);
$('#id_active').val(1);
$('#id_is_routine').change(function(){
if($(this).is(":checked")) {
// pass
} else {
$('#id_is_competitive').prop("checked", false);
}
});
$('#id_is_competitive').change(function(){
if($(this).is(":checked")) {
$('#id_is_routine').prop("checked", true);
}
});
});
</script>
{% endblock %}