fix cambio de estados en el tabulador

feature/ConsolidarPedimentos_20231229
Felix Morales 1 year ago
parent 8e605bae23
commit 0bf28d24eb
  1. 13
      src/Components/Corresponsales/Tabulador/Tabulador.tsx

@ -56,11 +56,12 @@ export const Tabulador: FC<IProps> = (props) => {
name: 'Costo', name: 'Costo',
width: '15%', width: '15%',
cell: (row: ITabuladorConceptos) => { cell: (row: ITabuladorConceptos) => {
return row.activo === 1 ? ( return <ControlledInput id={row.id} value={row.costo} disabled={true} postCost={(id, value) => {}} />
/*return row.activo === 1 ? (
<ControlledInput id={row.id} value={row.costo} disabled={true} postCost={(id, value) => {}} /> <ControlledInput id={row.id} value={row.costo} disabled={true} postCost={(id, value) => {}} />
) : ( ) : (
<ControlledInput id={row.id} value={0} disabled={true} postCost={(id, value) => {}} /> <ControlledInput id={row.id} value={0} disabled={true} postCost={(id, value) => {}} />
) )*/
}, },
}, },
{ {
@ -72,9 +73,9 @@ export const Tabulador: FC<IProps> = (props) => {
<Form.Check <Form.Check
type='checkbox' type='checkbox'
label='' label=''
checked={row.activo === 1 ? true : false} defaultChecked={row.activo === 1 ? true : false}
onClick={() => { onChange={() => {
switchConcept(row.id, 1) switchConcept(row.id, row.activo ? 0 : 1)
}} }}
/> />
</Form.Group> </Form.Group>
@ -113,7 +114,7 @@ export const Tabulador: FC<IProps> = (props) => {
if (response.status === 200) { if (response.status === 200) {
let tmp = DetalleConceptos let tmp = DetalleConceptos
let idx = tmp.findIndex((obj) => obj.id == id) let idx = tmp.findIndex((obj) => obj.id == id)
tmp[idx].activo = status === 1 ? 0 : 1 tmp[idx].activo = status
setDetalleConceptos(tmp) setDetalleConceptos(tmp)
setHeader('Confirmacion') setHeader('Confirmacion')
setMsg(response.data.respuesta) setMsg(response.data.respuesta)

Loading…
Cancel
Save