{"version":3,"sources":["components/OperatorGroups/FormView.jsx","containers/OperatorGroups/FormView.js"],"names":["FormView","React","constructor","props","_this","super","this","state","getItemId","_this$state$item","_this$props$linkTarge","item","id","linkTargetRecord","operatorGroupId","find","Boolean","fetchItem","async","itemId","arguments","length","undefined","responses","Promise","all","getItem","catch","error","_this$props$onCancel","_this$props","onCancel","call","resourceNotFound","newItem","getSettings","type","settingsType","setState","value","data","fieldSettings","showError","handleSubmit","createHandleSubmit","componentDidMount","render","_jsx","_Spin","createLabel","createLabelFactory","createFieldDecorator","createFieldFactory","form","readOnly","isReadOnly","_jsxs","_Form","layout","colon","onSubmit","stopEvent","children","className","ValidationError","errors","validationErrors","Item","label","_Input","autoFocus","FormButtons","saveButtonLoading","saveAndCloseButtonLoading","create","createFormViewContainer","actions","Component"],"mappings":"uQAOA,MAAMA,UAAiBC,YAGrBC,YAAYC,GAAQ,IAADC,EACjBC,MAAMF,GAAMC,EAAAE,KAAA,KAHdC,MAAQ,CAAC,EAAC,KAYVC,UAAY,SAAAC,EAAAC,EAAA,MAAM,CAAgB,QAAhBD,EAACH,KAAKC,MAAMI,YAAI,IAAAF,OAAA,EAAfA,EAAiBG,GAA+B,QAA7BF,EAAEJ,KAAKH,MAAMU,wBAAgB,IAAAH,OAAA,EAA3BA,EAA6BI,iBAAiBC,KAAKC,QAAQ,OAEnGC,UAAYC,iBAA+C,IAAxC,OAAEC,EAASf,EAAKI,aAAaY,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAC,EAClD,IACE,MAAMG,QAAkBC,QAAQC,IAAI,CAClCN,EACIf,EAAKD,MAAMuB,QAAQP,GAAQQ,OAAOC,IAAW,IAADC,EAAAC,EAE1C,MADmB,QAAnBD,GAAAC,EAAA1B,EAAKD,OAAM4B,gBAAQ,IAAAF,GAAnBA,EAAAG,KAAAF,GACMF,CAAK,IAEZxB,EAAKD,MAAMU,iBAEVoB,YAAiB7B,GADjBA,EAAKD,MAAM+B,QAAQ,CAAC,GAE1B9B,EAAKD,MAAMgC,YAAY,CAAEC,KAAMhC,EAAKD,MAAMkC,iBAG5CjC,EAAKkC,SAAS,CACZ3B,KAAMY,EAAU,GAAGgB,MAAMC,KACzBC,cAAelB,EAAU,GAAGgB,MAAMC,KAAKC,eAE3C,CAAE,MAAOb,GACPc,YAAU,CAAEd,SACd,CACF,EA9BEtB,KAAKqC,aAAeC,YAAmBtC,KACzC,CAEAuC,oBACEvC,KAAKW,WACP,CA2BA6B,SACE,MAAM,KAAEnC,EAAI,cAAE8B,GAAkBnC,KAAKC,MAErC,IAAKI,IAAS8B,EACZ,OAAOM,cAAAC,IAAA,IAGT,MAAMC,EAAcC,YAAmBT,GACjCU,EAAuBC,YAAmB9C,KAAKH,MAAMkD,KAAM1C,EAAM8B,GACjEa,EAAWC,YAAWjD,MAE5B,OACEkD,eAAAC,IAAA,CAAMC,OAAO,WAAWC,OAAO,EAAOC,SAAUN,EAAWO,IAAYvD,KAAKqC,aAAamB,SAAA,CACvFN,eAAA,OAAKO,UAAU,uBAAsBD,SAAA,CACnCf,cAACiB,IAAe,CAACC,OAAQ3D,KAAKC,MAAM2D,mBACpCnB,cAAAU,IAAMU,KAAI,CAACC,MAAOnB,EAAY,eAAea,SAC1CX,EAAqB,cAArBA,CAAoCJ,cAAAsB,IAAA,CAAOC,WAAS,UAGzDvB,cAAA,OAAKgB,UAAU,yBAAwBD,SACrCf,cAACwB,IAAW,CACVjB,SAAUA,EACVvB,SAAUzB,KAAKH,MAAM4B,SACrB6B,SAAUtD,KAAKqC,aACf6B,kBAAmBlE,KAAKC,MAAMiE,kBAC9BC,0BAA2BnE,KAAKC,MAAMkE,gCAKhD,EAGahB,UAAKiB,QAALjB,CAAczD,GC1Ed2E,sBAAwB,CAAEC,aAA1BD,CAAqCE,E","file":"static/js/46.09c34d9b.chunk.js","sourcesContent":["import * as React from 'react'\r\nimport { Form, Input, Spin } from 'antd'\r\nimport { showError, resourceNotFound, ValidationError } from 'helpers/errors'\r\nimport { createLabelFactory, createFieldFactory, createHandleSubmit, isReadOnly } from 'helpers/formViews'\r\nimport { stopEvent } from 'helpers/events'\r\nimport FormButtons from 'elements/FormButtons'\r\n\r\nclass FormView extends React.Component {\r\n  state = {}\r\n\r\n  constructor(props) {\r\n    super(props)\r\n\r\n    this.handleSubmit = createHandleSubmit(this)\r\n  }\r\n\r\n  componentDidMount() {\r\n    this.fetchItem()\r\n  }\r\n\r\n  getItemId = () => [this.state.item?.id, this.props.linkTargetRecord?.operatorGroupId].find(Boolean)\r\n\r\n  fetchItem = async ({ itemId = this.getItemId() } = {}) => {\r\n    try {\r\n      const responses = await Promise.all([\r\n        itemId\r\n          ? this.props.getItem(itemId).catch((error) => {\r\n              this.props.onCancel?.()\r\n              throw error\r\n            })\r\n          : !this.props.linkTargetRecord\r\n            ? this.props.newItem({})\r\n            : resourceNotFound(this),\r\n        this.props.getSettings({ type: this.props.settingsType }),\r\n      ])\r\n\r\n      this.setState({\r\n        item: responses[0].value.data,\r\n        fieldSettings: responses[1].value.data.fieldSettings,\r\n      })\r\n    } catch (error) {\r\n      showError({ error })\r\n    }\r\n  }\r\n\r\n  render() {\r\n    const { item, fieldSettings } = this.state\r\n\r\n    if (!item || !fieldSettings) {\r\n      return <Spin />\r\n    }\r\n\r\n    const createLabel = createLabelFactory(fieldSettings)\r\n    const createFieldDecorator = createFieldFactory(this.props.form, item, fieldSettings)\r\n    const readOnly = isReadOnly(this)\r\n\r\n    return (\r\n      <Form layout=\"vertical\" colon={false} onSubmit={readOnly ? stopEvent : this.handleSubmit}>\r\n        <div className=\"form-items-container\">\r\n          <ValidationError errors={this.state.validationErrors} />\r\n          <Form.Item label={createLabel('description')}>\r\n            {createFieldDecorator('description')(<Input autoFocus />)}\r\n          </Form.Item>\r\n        </div>\r\n        <div className=\"form-buttons-container\">\r\n          <FormButtons\r\n            readOnly={readOnly}\r\n            onCancel={this.props.onCancel}\r\n            onSubmit={this.handleSubmit}\r\n            saveButtonLoading={this.state.saveButtonLoading}\r\n            saveAndCloseButtonLoading={this.state.saveAndCloseButtonLoading}\r\n          />\r\n        </div>\r\n      </Form>\r\n    )\r\n  }\r\n}\r\n\r\nexport default Form.create()(FormView)\r\n","import actions from 'actions/operatorGroups'\r\nimport { createFormViewContainer } from 'factories/FormView'\r\nimport Component from 'components/OperatorGroups/FormView'\r\n\r\nexport default createFormViewContainer({ actions })(Component)\r\n"],"sourceRoot":""}