!function(a,b){"use strict";function c(a,c){var d=this;c=b.extend({},c),ConcreteAjaxSearch.call(d,a,c)}c.prototype=Object.create(ConcreteAjaxSearch.prototype),c.launchDialog=function(a,c){var d=b(window).width()-53;b.fn.dialog.open({width:d,height:"100%",href:CCM_DISPATCHER_FILENAME+"/ccm/system/dialogs/express/entry/search?exEntityID="+a,modal:!0,title:ccmi18n_express.entriesTitle,onClose:function(){ConcreteEvent.fire("ExpressEntrySelectorClose")},onOpen:function(){ConcreteEvent.unsubscribe("SelectExpressEntry"),ConcreteEvent.subscribe("SelectExpressEntry",function(a,b){jQuery.fn.dialog.closeTop(),c(b)})}})},c.getEntryDetails=function(a,c){b.ajax({type:"post",dataType:"json",url:CCM_DISPATCHER_FILENAME+"/ccm/system/express/entry/get_json",data:{exEntryID:a},error:function(a){ConcreteAlert.dialog(ccmi18n.error,a.responseText)},success:function(a){c(a)}})},b.fn.concreteExpressPageAjaxSearch=function(a){return b.each(b(this),function(d,e){new c(b(this),a)})},a.ConcreteExpressEntryAjaxSearch=c}(window,$),!function(a,b){"use strict";function c(a,c){var d=this,c=b.extend({chooseText:ccmi18n_express.chooseEntry,loadingText:ccmi18n.loadingText,inputName:"entryID",entityID:!1,entryID:0},c);d.$element=a,d.options=c,d._chooseTemplate=_.template(d.chooseTemplate,{options:d.options}),d._loadingTemplate=_.template(d.loadingTemplate),d._entryLoadedTemplate=_.template(d.entryLoadedTemplate),d.$element.append(d._chooseTemplate),d.$element.on("click","a[data-express-entry-selector-link=choose]",function(a){a.preventDefault(),ConcreteExpressEntryAjaxSearch.launchDialog(c.entityID,function(a){d.loadEntry(a.exEntryID)})}),d.options.exEntryID&&d.loadEntry(d.options.exEntryID)}c.prototype={chooseTemplate:'<div class="ccm-item-selector"><input type="hidden" name="<%=options.inputName%>" value="0" /><a href="#" data-express-entry-selector-link="choose"><%=options.chooseText%></a></div>',loadingTemplate:'<div class="ccm-item-selector"><div class="ccm-item-selector-choose"><input type="hidden" name="<%=options.inputName%>" value="<%=exEntryID%>"><i class="fa fa-spin fa-spinner"></i> <%=options.loadingText%></div></div>',entryLoadedTemplate:'<div class="ccm-item-selector"><div class="ccm-item-selector-item-selected"><input type="hidden" name="<%=inputName%>" value="<%=entry.exEntryID%>" /><a data-express-entry-selector-action="clear" href="#" class="ccm-item-selector-clear"><i class="fa fa-close"></i></a><div class="ccm-item-selector-item-selected-title"><%=entry.label%></div></div></div>',loadEntry:function(a){var b=this;b.$element.html(b._loadingTemplate({options:b.options,exEntryID:a})),ConcreteExpressEntryAjaxSearch.getEntryDetails(a,function(a){var c=a.entries[0];b.$element.html(b._entryLoadedTemplate({inputName:b.options.inputName,entry:c})),b.$element.on("click","a[data-express-entry-selector-action=clear]",function(a){a.preventDefault(),b.$element.html(b._chooseTemplate)})})}},b.fn.concreteExpressEntrySelector=function(a){return b.each(b(this),function(d,e){new c(b(this),a)})},a.ConcreteExpressEntrySelector=c}(this,$);