Liferay.Loader.define("@liferay/object-web@1.0.181/js/components/ObjectDetails/AccountRestrictionContainer",["module","exports","require","@liferay/object-js-components-web","frontend-js-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:l}){const[u,s]=(0,a.useState)([]),[d,f]=(0,a.useState)(),[b,y]=(0,a.useState)(!1),[g,p]=(0,a.useState)(!1);return(0,a.useEffect)((()=>{const e=n.filter((e=>{var t;return l.storageType&&"default"!==l.storageType?"Integer"===e.businessType||"LongInteger"===e.businessType||"Text"===e.businessType:"Relationship"===e.businessType&&(null===(t=e.objectFieldSettings)||void 0===t?void 0:t.find((e=>"AccountEntry"===e.value)))}));if(e.length){var r;s(e.map((e=>({label:e.label[i.defaultLanguageId],value:e.name}))));const n=e.find((e=>e.name===l.accountEntryRestrictedObjectFieldName));f(null!==(r=null==n?void 0:n.label[i.defaultLanguageId])&&void 0!==r?r:""),t&&l.accountEntryRestricted&&y(!0),t&&l.accountEntryRestrictedObjectFieldName&&p(!0)}}),[n]),(0,a.useEffect)((()=>{var e;const t=null===(e=u.find((e=>e.value===l.accountEntryRestrictedObjectFieldName)))||void 0===e?void 0:e.label;f(null!=t?t:"")}),[l.accountEntryRestrictedObjectFieldName,u]),a.default.createElement(a.default.Fragment,null,a.default.createElement(r.Toggle,{disabled:!u.length||b,label:(0,c.sub)(Liferay.Language.get("enable-x"),Liferay.Language.get("account-restriction")),name:"accountEntryRestricted",onToggle:()=>o({accountEntryRestricted:!l.accountEntryRestricted,accountEntryRestrictedObjectFieldName:!1==!l.accountEntryRestricted?"":l.accountEntryRestrictedObjectFieldName}),toggled:l.accountEntryRestricted}),a.default.createElement(r.SingleSelect,{disabled:!u.length||!l.accountEntryRestricted||g,error:e.accountEntryRestrictedObjectFieldName,label:Liferay.Language.get("account-entry-restricted-object-field-id"),onChange:({value:e})=>{o({accountEntryRestrictedObjectFieldName:e})},options:u,required:!!u.length&&l.accountEntryRestricted&&!g,value:d}))};var r=n("@liferay/object-js-components-web"),c=n("frontend-js-web"),a=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={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in e)if(Object.prototype.hasOwnProperty.call(e,c)){var a=r?Object.getOwnPropertyDescriptor(e,c):null;a&&(a.get||a.set)?Object.defineProperty(n,c,a):n[c]=e[c]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),i=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