Liferay.Loader.define("@liferay/object-web@1.0.153/js/components/ObjectDetails/AccountRestrictionContainer",["module","exports","require","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/panel","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","../../utils/constants"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.AccountRestrictionContainer=function AccountRestrictionContainer({errors:e,isApproved:t,objectFields:n,setValues:o,values:u}){const[d,s]=(0,i.useState)([]),[f,y]=(0,i.useState)(),[b,g]=(0,i.useState)(!1),[p,j]=(0,i.useState)(!1);return(0,i.useEffect)((()=>{const e=n.filter((e=>"Relationship"===e.businessType)).filter((e=>{var t;return null===(t=e.objectFieldSettings)||void 0===t?void 0:t.find((e=>"AccountEntry"===e.value))}));if(e.length){var a;s(e.map((e=>({label:e.label[l.defaultLanguageId],value:e.name}))));const n=e.find((e=>e.name===u.accountEntryRestrictedObjectFieldName));y(null!==(a=null==n?void 0:n.label[l.defaultLanguageId])&&void 0!==a?a:""),t&&u.accountEntryRestricted&&g(!0),t&&u.accountEntryRestrictedObjectFieldName&&j(!0)}}),[n]),(0,i.useEffect)((()=>{var e;const t=null===(e=d.find((e=>e.value===u.accountEntryRestrictedObjectFieldName)))||void 0===e?void 0:e.label;y(null!=t?t:"")}),[u.accountEntryRestrictedObjectFieldName,d]),i.default.createElement(r.default,{collapsable:!0,defaultExpanded:!0,displayTitle:Liferay.Language.get("account-restriction"),displayType:"unstyled"},i.default.createElement(r.default.Body,null,i.default.createElement(a.ClayToggle,{disabled:!d.length||b,label:Liferay.Language.get("active"),name:"accountEntryRestricted",onToggle:()=>o({accountEntryRestricted:!u.accountEntryRestricted,accountEntryRestrictedObjectFieldName:!1==!u.accountEntryRestricted?"":u.accountEntryRestrictedObjectFieldName}),toggled:u.accountEntryRestricted}),i.default.createElement(c.SingleSelect,{disabled:!d.length||!u.accountEntryRestricted||p,error:e.accountEntryRestrictedObjectFieldName,label:Liferay.Language.get("account-entry-restricted-object-field-id"),onChange:({value:e})=>{o({accountEntryRestrictedObjectFieldName:e})},options:d,required:!!d.length&&u.accountEntryRestricted&&!p,value:f})))};var a=n("@frontend-taglib-clay$clayui/form"),r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(n("@frontend-taglib-clay$clayui/panel")),c=n("@liferay/object-js-components-web"),i=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var c=a?Object.getOwnPropertyDescriptor(e,r):null;c&&(c.get||c.set)?Object.defineProperty(n,r,c):n[r]=e[r]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),l=n("../../utils/constants");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}}}));
//# sourceMappingURL=AccountRestrictionContainer.js.map