Liferay.Loader.define("@liferay/object-web@1.0.181/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 r.API.updateRelationship(e),(0,r.saveAndReload)(),(0,r.openToast)({message:Liferay.Language.get("the-object-relationship-was-updated-successfully")})}catch(e){const{message:a}=e;(0,r.openToast)({message:a,type:"danger"})}},parameterRequired:d}),y=!a||b.reverse;return i.default.createElement(r.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")},i.default.createElement(r.Card,{title:Liferay.Language.get("basic-info")},b.reverse&&i.default.createElement(n.default,{displayType:"warning",title:"".concat(Liferay.Language.get("warning"),":")},Liferay.Language.get("reverse-object-relationships-cannot-be-updated")),i.default.createElement(r.InputLocalized,{disableFlag:y,disabled:y,error:c.label,label:Liferay.Language.get("label"),onChange:e=>g({label:e}),required:!0,translations:b.label}),i.default.createElement(o.ObjectRelationshipFormBase,{errors:c,handleChange:p,readonly:!0,setValues:g,values:b}),i.default.createElement(r.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&&i.default.createElement(r.Card,{title:Liferay.Language.get("parameters")},i.default.createElement(r.Input,{label:Liferay.Language.get("api-endpoint"),readOnly:!0,value:u}),i.default.createElement(s.default,{error:c.parameterObjectFieldName,objectDefinitionExternalReferenceCode:b.objectDefinitionExternalReferenceCode2,onChange:e=>g({parameterObjectFieldName:e}),value:b.parameterObjectFieldName})))};var n=_interopRequireDefault(t("@frontend-taglib-clay$clayui/alert")),r=t("@liferay/object-js-components-web"),i=_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