{"version":3,"sources":["components/OverstockLocations/FormView.jsx","containers/OverstockLocations/FormView.js"],"names":["FormView","React","constructor","props","_this","super","this","state","getItemId","_this$state$item","_this$props$linkTarge","item","id","linkTargetRecord","overstockLocationId","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","getLocationGroups","includeAllLocationGroups","setState","value","data","fieldSettings","locationGroups","items","showError","handleSubmit","createHandleSubmit","componentDidMount","render","_this$state$locationG","_jsx","_Spin","createLabel","createLabelFactory","createFieldDecorator","createFieldFactory","form","readOnly","isReadOnly","_jsxs","_Form","layout","colon","onSubmit","stopEvent","children","className","ValidationError","errors","validationErrors","Item","label","_Input","autoFocus","Select","placeholder","t","map","each","Option","getOptionProps","displayName","FormButtons","saveButtonLoading","saveAndCloseButtonLoading","create","createFormViewContainer","actions","extraDispatchToProps","dispatch","params","locationGroupActions","getOptions","Component"],"mappings":"6RASA,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,qBAAqBC,KAAKC,QAAQ,OAEvGC,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,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,mBAAmBa,SAC9CX,EAAqB,kBAArBA,CACCJ,cAACwB,IAAM,CAACC,YAAaC,YAAE,UAAUX,UACJ,QAA1BhB,EAAC7C,KAAKC,MAAMqC,sBAAc,IAAAO,IAAI,IAAI4B,KAAKC,GACtC5B,cAAC6B,IAAM,CAAexC,MAAOuC,EAAKpE,GAAGuD,SACnCf,cAAA,WAAU8B,YAAeF,GAAKb,SAAGa,EAAKG,eAD3BH,EAAKpE,cAQ5BwC,cAAA,OAAKgB,UAAU,yBAAwBD,SACrCf,cAACgC,IAAW,CACVzB,SAAUA,EACV5B,SAAUzB,KAAKH,MAAM4B,SACrBkC,SAAU3D,KAAKyC,aACfsC,kBAAmB/E,KAAKC,MAAM8E,kBAC9BC,0BAA2BhF,KAAKC,MAAM+E,gCAKhD,EAGaxB,UAAKyB,QAALzB,CAAc9D,GC3FdwF,sBAAwB,CACrCC,YACAC,qBAAsBA,CAACC,EAAUxF,KAAK,CACpCmC,kBAAoBsD,GAAWD,EAASE,IAAqBC,WAAWF,OAH7DJ,CAKZO,E","file":"static/js/50.c782811d.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 { t } from 'helpers/i18n'\r\nimport FormButtons from 'elements/FormButtons'\r\nimport Select, { Option, getOptionProps } from 'elements/Select'\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?.overstockLocationId].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 this.props.getLocationGroups({ includeAllLocationGroups: true }),\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 locationGroups: responses[2].value.data.items,\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 \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
\r\n
\r\n \r\n \r\n {createFieldDecorator('name')()}\r\n \r\n \r\n {createFieldDecorator('barcode')()}\r\n \r\n \r\n {createFieldDecorator('locationGroupId')(\r\n \r\n )}\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n )\r\n }\r\n}\r\n\r\nexport default Form.create()(FormView)\r\n","import actions from 'actions/overstockLocations'\r\nimport locationGroupActions from 'actions/locationGroups'\r\nimport { createFormViewContainer } from 'factories/FormView'\r\nimport Component from 'components/OverstockLocations/FormView'\r\n\r\nexport default createFormViewContainer({\r\n actions,\r\n extraDispatchToProps: (dispatch, props) => ({\r\n getLocationGroups: (params) => dispatch(locationGroupActions.getOptions(params)),\r\n }),\r\n})(Component)\r\n"],"sourceRoot":""}