Commit 6633471a authored by THEO GUILLON's avatar THEO GUILLON
Browse files

Merge branch '549-pb-de-suppression-d-un-champs-de-sous-finalite' into '2.1.0'

Resolve "pb de suppression d'un champs de sous-finalité"

See merge request libriciel/pole-citoyens/web-DPO/web-DPO!546
parents 75b501b5 3ab69c4c
Pipeline #15395 passed with stage
in 2 minutes
......@@ -9,8 +9,8 @@ let addSousFinalite = function(idField) {
+ 'Sous finalité ' + idField
+'</label>'
+'<input name="data[WebdpoFiche][sousFinalite][]" id="sousFinalite_'+ idField +'" class="form-control" type="text">'
+'<a href="#" class="removeclass">'
+'<i class="fa fa-trash fa-lg fa-danger"></i>'
+'<a href="#" class="removeclass btn btn-outline-danger borderless">'
+'<i class="fa fa-trash fa-lg"></i>'
+'</a>'
+'</div>');
......@@ -19,16 +19,16 @@ let addSousFinalite = function(idField) {
//user click on remove text
$('body').on('click', '.removeclass', function(e) {
let idInputDelete = $(this).siblings().first().attr('id');
let idInputDelete = $(this).prevAll("input[type=text]").attr('id');
let intIdInputDelete = parseInt(idInputDelete.substr(idInputDelete.indexOf("_") + 1));
let i = intIdInputDelete + 1;
$(this).parent('div').parent('div').remove(); //remove text box
$(this).parent('div').remove(); //remove text box
while (i <= idField) {
let newValue = (i - 1);
$('#sousFinalite_'+i).parent('div').siblings().first().text('Sous finalité '+ newValue);
$('#sousFinalite_'+i).siblings().first().text('Sous finalité '+ newValue);
$('#sousFinalite_'+i).attr('id', 'sousFinalite_'+newValue);
i++;
......
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