Liferay.Loader.define("@liferay/object-js-components-web@1.0.58/components/ManagementToolbar/ModalEditExternalReferenceCode",["module","exports","require","@frontend-taglib-clay$clayui/alert","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","liferay!frontend-js-react-web$react","../../hooks/useForm","../../utils/api","../../utils/constants","../Input","../SidePanelContent"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.ModalEditExternalReferenceCode=function ModalEditExternalReferenceCode({externalReferenceCode:e,helpMessage:t,observer:r,onClose:y,onExternalReferenceCodeChange:p,onGetEntity:b,saveURL:g,setExternalReferenceCode:m}){const[R,O]=(0,c.useState)(""),{errors:j,handleChange:C,handleSubmit:E,values:_}=(0,u.useForm)({initialValues:{externalReferenceCode:e},onSubmit:async({externalReferenceCode:e})=>{try{const t=await b();await(0,i.save)("".concat(g),_objectSpread(_objectSpread({},t),{},{externalReferenceCode:e})),m(e),p&&p(e),y(),(0,s.openToast)({message:Liferay.Language.get("your-request-completed-successfully")})}catch(e){O(e.message)}},validate:({externalReferenceCode:e})=>{const t={};return""===e&&(t.externalReferenceCode=f.REQUIRED_MSG),t}});return c.default.createElement(o.default,{center:!0,observer:r},c.default.createElement(l.default,{onSubmit:E},c.default.createElement(o.default.Header,null,Liferay.Util.sub(Liferay.Language.get("edit-x"),Liferay.Language.get("external-reference-code"))),c.default.createElement(o.default.Body,null,R&&c.default.createElement(a.default,{displayType:"danger"},R),c.default.createElement(d.Input,{error:j.externalReferenceCode,feedbackMessage:t,id:"externalReferenceCode",label:Liferay.Language.get("external-reference-code"),name:"externalReferenceCode",onChange:C,required:!0,value:_.externalReferenceCode})),c.default.createElement(o.default.Footer,{last:c.default.createElement(n.default.Group,{key:1,spaced:!0},c.default.createElement(n.default,{displayType:"secondary",onClick:()=>y()},Liferay.Language.get("cancel")),c.default.createElement(n.default,{displayType:"primary",type:"submit"},Liferay.Language.get("save")))})))};var a=_interopRequireDefault(r("@frontend-taglib-clay$clayui/alert")),n=_interopRequireDefault(r("@frontend-taglib-clay$clayui/button")),l=_interopRequireDefault(r("@frontend-taglib-clay$clayui/form")),o=_interopRequireDefault(r("@frontend-taglib-clay$clayui/modal")),c=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 r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),u=r("../../hooks/useForm"),i=r("../../utils/api"),f=r("../../utils/constants"),d=r("../Input"),s=r("../SidePanelContent");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}}}));
//# sourceMappingURL=ModalEditExternalReferenceCode.js.map