2016-07-20 11:38:19 +02:00
|
|
|
$(document).on('page:load', init_admin);
|
|
|
|
$(document).ready(init_admin);
|
|
|
|
|
|
|
|
function init_admin(){
|
|
|
|
destroy_action();
|
|
|
|
on_change_type_de_champ_select();
|
|
|
|
}
|
2016-02-09 12:23:49 +01:00
|
|
|
|
|
|
|
function destroy_action(){
|
2016-03-16 10:55:03 +01:00
|
|
|
$(".delete").on('click', function(){
|
|
|
|
$(this).hide();
|
|
|
|
$(this).closest('td').find(".confirm").show();
|
2016-02-09 12:23:49 +01:00
|
|
|
});
|
|
|
|
|
2016-03-16 10:55:03 +01:00
|
|
|
$(".cancel").on('click', function(){
|
|
|
|
$(this).closest('td').find(".delete").show();
|
|
|
|
$(this).closest('td').find(".confirm").hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
$("#liste_gestionnaire #libelle").on('click', function(){
|
|
|
|
setTimeout(destroy_action, 500);
|
2016-02-09 12:23:49 +01:00
|
|
|
});
|
2016-07-20 11:38:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function on_change_type_de_champ_select (){
|
|
|
|
$("select.form-control.type_champ").on('change', function(e){
|
|
|
|
|
2016-08-09 16:21:39 +02:00
|
|
|
parent = $(this).parent().parent();
|
|
|
|
|
|
|
|
parent.removeClass('header_section');
|
|
|
|
parent.children(".drop_down_list").removeClass('show_inline');
|
2017-03-14 13:58:21 +01:00
|
|
|
$('.mandatory', parent).show();
|
2016-08-09 16:21:39 +02:00
|
|
|
|
|
|
|
switch(this.value){
|
|
|
|
case 'header_section':
|
|
|
|
parent.addClass('header_section');
|
|
|
|
break;
|
|
|
|
case 'drop_down_list':
|
2017-03-15 17:47:26 +01:00
|
|
|
case 'multiple_drop_down_list':
|
2016-08-09 16:21:39 +02:00
|
|
|
parent.children(".drop_down_list").addClass('show_inline');
|
|
|
|
break;
|
2017-03-14 13:58:21 +01:00
|
|
|
case 'explication':
|
|
|
|
$('.mandatory', parent).hide();
|
|
|
|
break;
|
2016-07-20 11:38:19 +02:00
|
|
|
}
|
2017-03-14 13:58:21 +01:00
|
|
|
});
|
2016-11-23 16:17:29 +01:00
|
|
|
}
|