Liferay.Loader.define("@liferay/object-web@1.0.108/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({deletionTypes:e,hasUpdateObjectDefinitionPermission:a,objectRelationship:t,parameterEndpoint:d,parameterRequired:u}){const{errors:c,handleChange:p,handleSubmit:g,setValues:f,values:b}=(0,s.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({message:e}){(0,r.openToast)({message:e,type:"danger"})}},parameterRequired:u}),y=!a||b.reverse;return i.default.createElement(r.SidePanelForm,{customLabel:Liferay.FeatureFlags["LPS-158478"]?{displayType:b.reverse?"info":"success",message:b.reverse?Liferay.Language.get("child"):Liferay.Language.get("parent")}:void 0,onSubmit:g,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,{disabled:y,error:c.label,label:Liferay.Language.get("label"),onChange:e=>f({label:e}),required:!0,translations:b.label}),i.default.createElement(s.ObjectRelationshipFormBase,{errors:c,handleChange:p,readonly:!0,setValues:f,values:b}),i.default.createElement(r.SingleSelect,{disabled:y,label:Liferay.Language.get("deletion-type"),onChange:e=>f({deletionType:e.value}),options:e,required:!0,value:(0,l.firstLetterUppercase)(b.deletionType)})),u&&b.type===s.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:d}),i.default.createElement(o.default,{error:c.parameterObjectFieldId,objectDefinitionId:b.objectDefinitionId2,onChange:e=>f({parameterObjectFieldId:e}),value:b.parameterObjectFieldId})))};var n=d(t("@frontend-taglib-clay$clayui/alert")),r=t("@liferay/object-js-components-web"),i=d(t("liferay!frontend-js-react-web$react")),l=t("../../utils/string"),s=t("./ObjectRelationshipFormBase"),o=d(t("./SelectRelationship"));function d(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=EditRelationship.js.map