Update interface
This commit is contained in:
parent
1fe9e31066
commit
2111a1367a
|
@ -98,8 +98,8 @@
|
|||
<p class="text-muted text-form-info mb-0 mt-2"><small>(1: Very Low - 10: Very High)</small></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-12 text-center text-danger" id="note_info"><b>Merci de donner des détails concernant les scores.</b></label>
|
||||
<div class="form-group row mb-0">
|
||||
<label class="col-12 text-center text-danger mb-0" id="note_info"><b>Please provide details regarding the scores.</b></label>
|
||||
</div>
|
||||
<div class="form-group row ">
|
||||
<label for="id_information" class="col-4 col-sm-3 col-md-4 col-lg-4 col-xl-3 col-form-label">Informations <span class="text-danger" id="span_info_required"><b>*</b></span></label>
|
||||
|
@ -111,7 +111,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-center">
|
||||
<div class="form-group text-center" id="div_submit">
|
||||
<input type="submit" value="{% if wellbeing_id %}Update{% else %}Add{% endif %}" class="btn btn-warning" />
|
||||
</div>
|
||||
</form>
|
||||
|
@ -127,7 +127,7 @@
|
|||
$("#note_info").hide();
|
||||
$("#span_info_required").hide();
|
||||
|
||||
function are_informations_too_short()
|
||||
function is_information_field_too_short()
|
||||
{
|
||||
if($('#id_informations').val().length < 10)
|
||||
return true;
|
||||
|
@ -135,7 +135,7 @@
|
|||
return false;
|
||||
};
|
||||
|
||||
function check_form_values()
|
||||
function is_informations_needed()
|
||||
{
|
||||
var test = is_value_lower($('#id_mindstate').val());
|
||||
test = test || is_value_lower($('#id_sleep').val());
|
||||
|
@ -164,25 +164,30 @@
|
|||
};
|
||||
|
||||
$('#id_mindstate, #id_sleep, #id_stress, #id_fatigue, #id_muscle_soreness').on('keyup', function(){
|
||||
test = check_form_values();
|
||||
informations_needed = is_informations_needed();
|
||||
|
||||
if(test) {
|
||||
if(informations_needed) {
|
||||
$("#note_info").show();
|
||||
$("#span_info_required").show();
|
||||
$("#div_submit").hide();
|
||||
} else {
|
||||
$("#note_info").hide();
|
||||
$("#span_info_required").hide();
|
||||
$("#note_info").show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#id_informations').on('keyup', function(){
|
||||
test = check_form_values();
|
||||
test = test && are_informations_too_short()
|
||||
test = is_informations_needed();
|
||||
test = test && is_information_field_too_short()
|
||||
|
||||
if(test)
|
||||
if(test) {
|
||||
$("#note_info").show();
|
||||
else
|
||||
$("#div_submit").hide();
|
||||
} else {
|
||||
$("#note_info").hide();
|
||||
$("#div_submit").show();
|
||||
}
|
||||
});
|
||||
|
||||
const csrf_token = "{{ csrf_token|escapejs }}";
|
||||
|
|
Loading…
Reference in New Issue