Liferay.Loader.define("@liferay/object-web@1.0.153/js/components/ObjectRelationship/EditRelationship",["module","exports","require","@frontend-taglib-clay$clayui/alert","@liferay/object-js-components-web","liferay!frontend-js-react-web$react","../../utils/string","./ObjectRelationshipFormBase","./SelectRelationship"],(function(e,a,t){window;{Object.defineProperty(a,"__esModule",{value:!0}),a.default=function EditRelationship({deletionTypes:e,hasUpdateObjectDefinitionPermission:a,objectRelationship:t,parameterEndpoint:u,parameterRequired:d}){const{errors:c,handleChange:p,handleSubmit:f,setValues:g,values:b}=(0,o.useObjectRelationshipForm)({initialValues:t,onSubmit:async e=>{try{await i.API.updateRelationship(e),(0,i.saveAndReload)(),(0,i.openToast)({message:Liferay.Language.get("the-object-relationship-was-updated-successfully")})}catch({message:e}){(0,i.openToast)({message:e,type:"danger"})}},parameterRequired:d}),y=!a||b.reverse;return n.default.createElement(i.SidePanelForm,{customLabel:{displayType:b.reverse?"info":"success",message:b.reverse?Liferay.Language.get("child"):Liferay.Language.get("parent")},onSubmit:f,readOnly:y,title:Liferay.Language.get("relationship")},n.default.createElement(i.Card,{title:Liferay.Language.get("basic-info")},b.reverse&&n.default.createElement(r.default,{displayType:"warning",title:"".concat(Liferay.Language.get("warning"),":")},Liferay.Language.get("reverse-object-relationships-cannot-be-updated")),n.default.createElement(i.InputLocalized,{disableFlag:y,disabled:y,error:c.label,label:Liferay.Language.get("label"),onChange:e=>g({label:e}),required:!0,translations:b.label}),n.default.createElement(o.ObjectRelationshipFormBase,{errors:c,handleChange:p,readonly:!0,setValues:g,values:b}),n.default.createElement(i.SingleSelect,{disabled:y,label:Liferay.Language.get("deletion-type"),onChange:e=>g({deletionType:e.value}),options:e,required:!0,value:(0,l.firstLetterUppercase)(b.deletionType)})),d&&b.type===o.ObjectRelationshipType.ONE_TO_MANY&&n.default.createElement(i.Card,{title:Liferay.Language.get("parameters")},n.default.createElement(i.Input,{label:Liferay.Language.get("api-endpoint"),readOnly:!0,value:u}),n.default.createElement(s.default,{error:c.parameterObjectFieldName,objectDefinitionExternalReferenceCode:b.objectDefinitionExternalReferenceCode2,onChange:e=>g({parameterObjectFieldName:e}),value:b.parameterObjectFieldName})))};var r=_interopRequireDefault(t("@frontend-taglib-clay$clayui/alert")),i=t("@liferay/object-js-components-web"),n=_interopRequireDefault(t("liferay!frontend-js-react-web$react")),l=t("../../utils/string"),o=t("./ObjectRelationshipFormBase"),s=_interopRequireDefault(t("./SelectRelationship"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=EditRelationship.js.map