(function(){var e="<span style='font-weight:normal;'>{{text TXT_details_text_36}}</span>"+"{{if uid}}"+"<span id='${id}_caption'> ${caption} </span>"+"<span style='font-weight:normal; font-style: italic;'>(${uid.infoAreaId}#${uid.recordId})</span>"+"{{/if}}";u8.Crm.Widgets.ExpandAllFieldsPopup=function(e,i){this.Widget(e,$.extend({},u8.Crm.Widgets.ExpandAllFieldsPopup.defaults,i));this.popup=$.extend({parent:this},u8.Crm.Widgets.ExpandAllFieldsPopup.defaults.popup,i&&i.popup);this.expandAllFields=$.extend({},u8.Crm.Widgets.ExpandAllFieldsPopup.defaults.expandAllFields,i&&i.expandAllFields);this._isCreated=false;if(!this.popup.id){this.popup.id=this.id+"_popup"}};u8.Crm.Widgets.ExpandAllFieldsPopup.defaults={popup:{position:"center",alignTo:"window",size:{width:720,height:350}},expandAllFields:{},title:""};u8.Crm.Widgets.ExpandAllFieldsPopup.makeClass({name:"ExpandAllFieldsPopup",deriveFrom:u8.Base.Widgets.Widget,events:["Create","Save"]});$.extend(u8.Crm.Widgets.ExpandAllFieldsPopup.prototype,{open:function(){if(this._popup){return this._popup.open()}u8.using({texts:["common_text","details_text"]},this._open.bind(this))},close:function(){if(this._popup){this._popup.close()}},dispose:function(){if(this._isDisposed){return}this.Widget_dispose()},_open:function(){if(this.popup.title){this._createWidgets();return}else if(this.title||!u8.isValidRecordUid(this.expandAllFields.uid)){if(this.title){this.popup.title=this.$("<span />");this.$("<span />").text(this.title).appendTo(this.popup.title)}else{this.popup.title=this.$("<span />").utml({template:e})}this._createWidgets();return}u8.services.tableCaptions.read({uid:this.expandAllFields.uid},function(i,t){var p=t.tableCaption&&t.tableCaption.text;this.popup.title=this.$("<span />").utml({template:e,data:{uid:this.expandAllFields.uid,caption:p||"???"}});this._createWidgets()}.bind(this))},_updateTableCaption:function(){var e=this._popup.title.find("#"+this.id+"_caption");if(!e){return}u8.services.tableCaptions.read({uid:this.expandAllFields.uid},function(i,t){var p=t.tableCaption&&t.tableCaption.text;e.text(p||"???")}.bind(this))},_createWidgets:function(){var e=this,i=new u8.Base.Widgets.Popup(this.$("<div />"),$.extend(this.popup,{onCreate:t}));this._popup=i;i.open();function t(){var t=i.getContent();var p=$w(t).$;var s=p("<img />").wheel().addClass("u8-expandallfields-popup-loading").appendTo(t);var d=p("<div />").appendTo(t);e._expandAllFields=new u8.Crm.Widgets.ExpandAllFields(d,p.extend(e.expandAllFields,{parent:i,onSave:e._onExpandAllFieldsSave.bind(e)}));u8.tools.ready(i.children,function(){t.children("div").css({visibility:"inherit",height:""});s.remove();var p=e._expandAllFields.getDesiredSize();i.setSize(e.popup.size.width,Math.max(e.popup.size.height,p&&p.height||0));u8.tools.created(e)})}},_onExpandAllFieldsSave:function(e,i){this._updateTableCaption()}});$.extend(u8.Crm.Widgets.ExpandAllFieldsPopup,{open:function(e){var i=$w("main"),t=new u8.Crm.Widgets.ExpandAllFieldsPopup(i,{parent:i.page,expandAllFields:{uid:e}});t.open();return t}})})();