praiadeseselle/wire/modules/Process/ProcessTemplate/ProcessTemplateFieldCreator.min.js

1 line
1.6 KiB
JavaScript
Raw Permalink Normal View History

2022-03-08 15:55:41 +01:00
function TemplateFieldAddDialog(){var b=$(this);var a=false;var c=pwModalWindow(b.attr("href"),{},"large");c.load(function(){var e;var d=[];var f=c.contents();var g=0;f.find("#breadcrumbs ul.nav, #Inputfield_submit_save_field_copy").hide();f.find("#content form button.ui-button[type=submit]").each(function(){var k=$(this).text();var j=false;e=$(this);for(var h=0;h<d.length;h++){if(d[h].text==k||k.length<1){j=true}}if(!j){d[g]={text:k,"class":(e.hasClass("ui-priority-secondary")?"ui-priority-secondary":""),click:function(){e.click();a=true}};g++}e.hide()});if(a){d[g]={text:$("#fieldgroup_fields").attr("data-closeAddLabel"),"class":(e&&e.hasClass("ui-priority-secondary")?"ui-priority-secondary":""),click:function(){setTimeout(function(){var j=f.find("#Inputfield_id:last").val();c.dialog("close");var h=$("#fieldgroup_fields option");var i=h.length;h.eq(1).before($("<option></option>").val(j).text(f.find("#Inputfield_name").val()));$('#fieldgroup_fields option[value="'+j+'"]').attr("id","asm0option"+i).attr("data-desc",(f.find("#field_label").val())).attr("data-status",(f.find("#Inputfield_type option:selected").text()));$("#asmSelect0 option").eq(1).before($("<option></option>").val(j).text(f.find("#Inputfield_name").val()));$("#asmSelect0").find("option:selected").removeAttr("selected");$('#asmSelect0 option[value="'+j+'"]').attr("rel","asm0option"+i).attr("selected","selected").addClass("asmOptionDisabled").attr("disabled","disabled").trigger("change").removeAttr("selected")},500)}}}c.setButtons(d)});return false}$(document).ready(function(){$("#wrap_fieldgroup_fields p.description a").click(TemplateFieldAddDialog)});