Skip to content

Commit

Permalink
Minor fix in column association
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubervila committed Aug 10, 2023
1 parent 6daaa21 commit 66e2a8f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions frontend/components/newProduct/Step3.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ InputUcd.propTypes = {
}

export function InputAlias({ pc, onChange, onChangeInputType }) {
const [value, setValue] = useState('')
const [value, setValue] = useState(pc.alias !== null ? pc.alias : '')

// Using lodash debounce to Delay search by 600ms
// Exemplo: https://www.upbeatcode.com/react/how-to-use-lodash-in-react/
Expand Down Expand Up @@ -180,14 +180,22 @@ export default function NewProductStep3({ productId, onNext, onPrev }) {

setProductColumns(response.results)

// Ao carregar as colunas identifica os campos que
// sao do tipo alias e que ja tenham valor.
response.results.forEach(pc => {
if (pc.ucd === null && pc.alias !== null) {
inputsType.push(pc.column_name)
}
})

setLoading(false)
} catch (error) {
setLoading(false)
if (error.response && error.response.status === 500) {
catchFormError(error.response.data)
}
}
}, [productId])
}, [productId, inputsType])

const changeProductContent = (pc, ucd, alias) => {
if (pc.ucd === ucd && pc.alias === alias) {
Expand Down Expand Up @@ -276,7 +284,7 @@ export default function NewProductStep3({ productId, onNext, onPrev }) {
const createFields = pc => {
const avoptions = getAvailableUcds()

if (pc.alias !== null) {
if (pc.ucd !== null) {
return (
<InputReadOnly
name={pc.column_name}
Expand Down

0 comments on commit 66e2a8f

Please sign in to comment.