Liferay.Loader.define("account-admin-web@2.0.66/account_entries_admin/js/PersonAccountEntryEventHandler.es",["module","exports","require","frontend-js-web"],(function(e,t,s){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s("frontend-js-web");class PersonAccountEntryEventHandler extends n.PortletBase{attached(){this.selectUserButton.addEventListener("click",this._handleSelectUserButtonClicked),this._removeUserButtonHandle=(0,n.delegate)(this.container,"click",this.removeUserLinkSelector,this._handleRemoveUserButtonClicked.bind(this))}created(e){this.container=this._setElement(e.container),this.removeUserIconMarkup=e.removeUserIconMarkup,this.removeUserLinkSelector=e.removeUserLinkSelector,this.searchContainerId=e.searchContainer,this.selectUserButton=this._setElement(e.selectUserButton),this.selectUserEventName=e.selectUserEventName,this.selectUserURL=e.selectUserURL,this.userIdInput=this._setElement(e.userIdInput),this._handleOnSelect=this._handleOnSelect.bind(this),this._handleSelectUserButtonClicked=this._handleSelectUserButtonClicked.bind(this)}detached(){super.detached(),this.selectUserButton.removeEventListener("click",this._handleSelectUserButtonClicked),this._removeUserButtonHandle.dispose()}_handleOnSelect(e){this._setSearchContainerUser(e)}_handleRemoveUserButtonClicked(){const e=this._getSearchContainer();e.deleteRow(1,e.getData()),this.userIdInput.value=null}_handleSelectUserButtonClicked(){this._selectAccountUser()}_getSearchContainer(){return Liferay.SearchContainer.get(this.ns(this.searchContainerId))}_selectAccountUser(){(0,n.openSelectionModal)({containerProps:{className:""},id:this.ns(this.selectUserEventName),iframeBodyCssClass:"",onSelect:this._handleOnSelect,selectEventName:this.ns(this.selectUserEventName),selectedData:[this.userIdInput.value],title:Liferay.Language.get("assign-user"),url:this.selectUserURL})}_setSearchContainerUser({emailaddress:e,entityid:t,entityname:s,jobtitle:n}){this.userIdInput.value=t;const r=this._getSearchContainer();r.deleteRow(1,r.getData()),r.addRow([s,e,n,this.removeUserIconMarkup],t),r.updateDataStore([t])}_setElement(e){return this.one(e)}}var r=PersonAccountEntryEventHandler;t.default=r}}));
//# sourceMappingURL=PersonAccountEntryEventHandler.es.js.map