Commit ef357565 authored by Lucas Henrique's avatar Lucas Henrique
Browse files

Adiciona campo para customização da pontuação total na avaliação por barema

parent 27cc6adc
...@@ -455,6 +455,11 @@ ...@@ -455,6 +455,11 @@
</div> </div>
<div class="row justify-content-center" style="margin-top:10px; display: none" id="displayCampos"> <div class="row justify-content-center" style="margin-top:10px; display: none" id="displayCampos">
<div class="row align-items-end mb-4">
<label class="col-sm-3" for="pontuacao">Valor total da pontuação por Barema:<span style="color:red; font-weight:bold;">*</span></label>
<input type="number" name="pontuacao" min="1" class="col-sm-1 form-control" id="pontuacao" value="{{old('pontuacao')}}"/>
</div>
<label>Campos do Barema:</label>
<table class="table table-bordered col-sm-12" id="dynamicAddRemove"> <table class="table table-bordered col-sm-12" id="dynamicAddRemove">
<tr> <tr>
<th>Nome<span style="color:red; font-weight:bold;">*</span></th> <th>Nome<span style="color:red; font-weight:bold;">*</span></th>
...@@ -507,7 +512,7 @@ ...@@ -507,7 +512,7 @@
@endif @endif
<div class="col-sm-12 alert alert-danger" style="display: none" id="nota_maxima_invalida"> <div class="col-sm-12 alert alert-danger" style="display: none" id="nota_maxima_invalida">
A soma das notas máximas não pode ser maior que 10. A soma das notas máximas deve ser igual a pontuação total definida.
</div> </div>
<input type="checkbox" id="checkB[0]" checked name="campos[]" value="0" hidden> <input type="checkbox" id="checkB[0]" checked name="campos[]" value="0" hidden>
...@@ -683,27 +688,42 @@ ...@@ -683,27 +688,42 @@
}); });
$("#dynamicAddRemove").on('input', '.nota_maxima', function () { $('#pontuacao').on('input', function () {
somaNotas = 0; validateNotas();
})
$(".nota_maxima").each(function() { $("#dynamicAddRemove").on('input', '.nota_maxima', function () {
valor = Number($(this).val()); validateNotas();
if (valor != 0) { });
somaNotas += valor;
}
});
$('#somaNotas').val(somaNotas); function validateNotas() {
pontuacao = $("#pontuacao").val();
if (somaNotas > 10) { if (pontuacao == "") {
$('.nota_maxima').css('border', '1px solid red'); alert("Escolha o valor total da pontuação antes de adicionar as notas máximas!")
document.getElementById("nota_maxima_invalida").style.display = ""; $('.nota_maxima').val("");
} else { } else {
$('.nota_maxima').css('border', ''); somaNotas = 0;
document.getElementById("nota_maxima_invalida").style.display = "none";
$(".nota_maxima").each(function() {
valor = Number($(this).val());
if (valor != 0) {
somaNotas += valor;
}
});
$('#somaNotas').val(somaNotas);
if (somaNotas != pontuacao) {
$('.nota_maxima').css('border', '1px solid red');
document.getElementById("nota_maxima_invalida").style.display = "";
} else {
$('.nota_maxima').css('border', '');
document.getElementById("nota_maxima_invalida").style.display = "none";
}
} }
}); }
// Tipo de avaliação // Tipo de avaliação
......
...@@ -477,6 +477,11 @@ ...@@ -477,6 +477,11 @@
</div> </div>
<div class="row justify-content-center" style="margin-top:10px; display: none" id="displayCampos"> <div class="row justify-content-center" style="margin-top:10px; display: none" id="displayCampos">
<div class="row align-items-end mb-4">
<label class="col-sm-3" for="pontuacao">Valor total da pontuação por Barema:<span style="color:red; font-weight:bold;">*</span></label>
<input type="number" name="pontuacao" min="1" class="col-sm-1 form-control" id="pontuacao" value="{{old('pontuacao')?old('pontuacao'):$pontuacao}}"/>
</div>
<label>Campos do Barema:</label>
<table class="table table-bordered col-sm-12" id="dynamicAddRemove"> <table class="table table-bordered col-sm-12" id="dynamicAddRemove">
<tr> <tr>
<th>Nome<span style="color:red; font-weight:bold;">*</span></th> <th>Nome<span style="color:red; font-weight:bold;">*</span></th>
...@@ -611,7 +616,7 @@ ...@@ -611,7 +616,7 @@
@endif @endif
<div class="col-sm-12 alert alert-danger" style="display: none" id="nota_maxima_invalida"> <div class="col-sm-12 alert alert-danger" style="display: none" id="nota_maxima_invalida">
A soma das notas máximas não pode ser maior que 10. A soma das notas máximas deve ser igual a pontuação total definida.
</div> </div>
<input type="checkbox" id="checkB[0]" checked name="campos[]" value="0" hidden> <input type="checkbox" id="checkB[0]" checked name="campos[]" value="0" hidden>
...@@ -834,27 +839,42 @@ ...@@ -834,27 +839,42 @@
displayPrioridades(selectId, newOption); displayPrioridades(selectId, newOption);
}); });
$("#dynamicAddRemove").on('input', '.nota_maxima', function () { $('#pontuacao').on('input', function () {
somaNotas = 0; validateNotas();
})
$(".nota_maxima").each(function() { $("#dynamicAddRemove").on('input', '.nota_maxima', function () {
valor = Number($(this).val()); validateNotas();
if (valor != 0) { });
somaNotas += valor;
}
});
$('#somaNotas').val(somaNotas); function validateNotas() {
pontuacao = $("#pontuacao").val();
if (somaNotas > 10) { if (pontuacao == "") {
$('.nota_maxima').css('border', '1px solid red'); alert("Escolha o valor total da pontuação antes de adicionar as notas máximas!")
document.getElementById("nota_maxima_invalida").style.display = ""; $('.nota_maxima').val("");
} else { } else {
$('.nota_maxima').css('border', ''); somaNotas = 0;
document.getElementById("nota_maxima_invalida").style.display = "none";
$(".nota_maxima").each(function() {
valor = Number($(this).val());
if (valor != 0) {
somaNotas += valor;
}
});
$('#somaNotas').val(somaNotas);
if (somaNotas != pontuacao) {
$('.nota_maxima').css('border', '1px solid red');
document.getElementById("nota_maxima_invalida").style.display = "";
} else {
$('.nota_maxima').css('border', '');
document.getElementById("nota_maxima_invalida").style.display = "none";
}
} }
}); }
// Tipo de avaliação // Tipo de avaliação
......
Markdown is supported
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