Issue #0001674:
This commit is contained in:
parent
8d46b8cf9c
commit
ee0b820a3a
@ -248,10 +248,19 @@ $('div#blocIdLocal').on('click', 'a.addIdLocal', function(e){
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var country = $('select[name=adresse_pays]').val();
|
var country = $('select[name=adresse_pays]').val();
|
||||||
AddSelectCountry(country, $(this).attr('href'));
|
AddSelectCountry(country, $(this).attr('href'));
|
||||||
|
$('.addIdLocal').hide();
|
||||||
|
$('.removeIdLocal').hide();
|
||||||
|
});
|
||||||
|
$('div#blocIdLocal').on('click', 'a.removeIdLocal', function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
var prevId = $(this).attr('href')-1;
|
||||||
|
$('a#ad'+prevId).show();
|
||||||
|
$('a#rm'+prevId).show();
|
||||||
|
$(this).parent().parent().remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
function AddSelectCountry(code, n){
|
function AddSelectCountry(code, n){
|
||||||
if (!n) { n=1; }
|
if (!n) { n=1; } else {n++;}
|
||||||
if (n<=3){
|
if (n<=3){
|
||||||
var html = 'Aucun identifiant !';
|
var html = 'Aucun identifiant !';
|
||||||
$.getJSON('/saisie/countryid', {code: code}, function(data){
|
$.getJSON('/saisie/countryid', {code: code}, function(data){
|
||||||
@ -261,8 +270,10 @@ function AddSelectCountry(code, n){
|
|||||||
});
|
});
|
||||||
if (option!=''){
|
if (option!=''){
|
||||||
html = '<div class="fieldgrp"><label>Identifiant local</label>'+
|
html = '<div class="fieldgrp"><label>Identifiant local</label>'+
|
||||||
'<div class="field"><input type="text" name="idLoc'+n+'Num"/>'+
|
'<div class="field"><input size="35" type="text" name="idLoc'+n+'Num"/>'+
|
||||||
'<select name="idLoc'+n+'Type">'+option+'</select><a href="'+n+'" class="addIdLocal">[+]</a></div></div>';
|
'<select name="idLoc'+n+'Type">'+option+'</select>';
|
||||||
|
if (n<3) { html = html+'<a href="'+n+'" class="addIdLocal" id="ad'+n+'">[+]</a>';}
|
||||||
|
html = html+'<a href="'+n+'" class="removeIdLocal" id="rm'+n+'">[-]</a></div></div>';
|
||||||
}
|
}
|
||||||
$('div#blocIdLocal').append(html);
|
$('div#blocIdLocal').append(html);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user