{"version":3,"sources":["components/IssueLimitLists/Items/FormView.jsx","containers/IssueLimitLists/Items/FormView.js","actions/issueLimitLists/issueLimitListItems.js"],"names":["FormView","React","constructor","props","_this","super","this","state","getItemId","_this$state$item","_this$props$linkTarge","item","id","linkTargetRecord","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","disabled","Row","Col","half","InputNumber","min","autoFocus","_Button","onClick","t","_Tooltip","title","placement","htmlType","loading","saveAndCloseButtonLoading","create","createChildFormViewContainer","actions","Component","entityName","entityNames","issueLimitLists","ENTITY_NAME","snakeCase","toUpperCase","childName","CHILD_NAME","createChildActions","populateIssueLimitListItems","parentId","params","concat","payload","createChildPost","action"],"mappings":"uUASA,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,EAA6BE,IAAIE,KAAKC,QAAQ,OAEtFC,UAAYC,iBAA+C,IAAxC,OAAEC,EAASd,EAAKI,aAAaW,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAC,EAClD,IACE,MAAMG,QAAkBC,QAAQC,IAAI,CAClCN,EACId,EAAKD,MAAMsB,QAAQP,GAAQQ,OAAOC,IAAW,IAADC,EAAAC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AACyB,IAAG,CAACC,MAAI,EAAAX,SACPf,cAAAU,IAAMU,KAAI,CAACC,MAAOnB,EAAY,cAAca,SACzCX,EAAqB,aAArBA,CAAmCJ,cAAC2B,IAAW,CAACC,IAAK,EAAGrB,SAAUA,eAK3EE,eAAA,OAAKO,UAAU,yBAAwBD,SAAA,CACrCf,cAAA8B,IAAA,CAAQC,QAASvE,KAAKH,MAAM2B,SAAS+B,SAAEiB,YAAEzB,EAAW,QAAU,YAAoB,KAChFA,GACAP,cAAAiC,IAAA,CAASC,MAAOF,YAAE,uBAAwBG,UAAU,UAASpB,SAC3Df,cAAA8B,IAAA,CAAQzC,KAAK,UAAU+C,SAAS,SAASC,QAAS7E,KAAKC,MAAM6E,0BAA0BvB,SACnFvD,KAAKH,MAAMU,iBAA8BiE,YAAE,UAAbA,YAAE,gBAOhD,EAGatB,UAAK6B,QAAL7B,CAAcxD,GCzFdsF,sBAA6B,CAAEC,aAA/BD,CAA0CE,E,oCCJzD,mCAKA,MAAMC,EAAaC,IAAYC,gBACzBC,EAAcC,oBAAUJ,GAAYK,cAEpCC,EAAY,sBACZC,EAAaH,oBAAUE,GAAWD,cAEzB,QACVG,YAAmBR,EAAYM,GAElCG,4BAA6BA,CAACC,EAAUC,KAAM,CAC5CjE,KAAK,GAADkE,OAAKT,EAAW,KAAAS,OAAIL,EAAU,aAClCM,QAASC,YAAgBd,EAAYM,EAAW,CAAES,OAAQ,YAAjDD,CAA+DJ,EAAUC,K","file":"static/js/17.0eb26466.chunk.js","sourcesContent":["import * as React from 'react'\r\nimport { Form, Input, Spin, Button, Tooltip } from 'antd'\r\nimport { showError, resourceNotFound, ValidationError } from 'helpers/errors'\r\nimport { createLabelFactory, createFieldFactory, createHandleSubmit, isReadOnly } from 'helpers/formViews'\r\nimport { t } from 'helpers/i18n'\r\nimport { stopEvent } from 'helpers/events'\r\nimport InputNumber from 'elements/InputNumber'\r\nimport { Row, Col } from 'elements/Grid'\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?.id].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 \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('barcode')()}\r\n \r\n \r\n \r\n \r\n {createFieldDecorator('quantityLimit')()}\r\n \r\n \r\n \r\n \r\n {createFieldDecorator('periodDays')()}\r\n \r\n \r\n \r\n
\r\n
\r\n {' '}\r\n {!readOnly && (\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/issueLimitLists/issueLimitListItems'\r\nimport { createChildFormViewContainer } from 'factories/ChildFormView'\r\nimport Component from 'components/IssueLimitLists/Items/FormView'\r\n\r\nexport default createChildFormViewContainer({ actions })(Component)\r\n","import { snakeCase } from 'lodash'\r\nimport { createChildActions } from 'helpers/actions'\r\nimport entityNames from 'options/entityNames'\r\nimport { createChildPost } from 'helpers/api'\r\n\r\nconst entityName = entityNames.issueLimitLists\r\nconst ENTITY_NAME = snakeCase(entityName).toUpperCase()\r\n\r\nconst childName = 'issueLimitListItems'\r\nconst CHILD_NAME = snakeCase(childName).toUpperCase()\r\n\r\nexport default {\r\n ...createChildActions(entityName, childName),\r\n\r\n populateIssueLimitListItems: (parentId, params) => ({\r\n type: `${ENTITY_NAME}_${CHILD_NAME}_POPULATE`,\r\n payload: createChildPost(entityName, childName, { action: 'populate' })(parentId, params),\r\n }),\r\n}\r\n"],"sourceRoot":""}