Compare commits

..

No commits in common. '3444834b2c34a0c6c9f4b710c8d33e9db680e24c' and '120696eff1f31e93e135b5fb94a38e824d44c426' have entirely different histories.

  1. 2
      package.json
  2. 192
      src/Components/Catalogos/CatTabulador/CatTabulador.tsx
  3. 2
      src/Interfaces/Catalogos/ITabulador.ts

@ -1,6 +1,6 @@
{
"name": "corresponsalfrontend",
"version": "2.0.1",
"version": "2.0.0",
"private": true,
"dependencies": {
"@reduxjs/toolkit": "^1.9.5",

@ -49,15 +49,13 @@ export default function CatTabuladores (props: IProps) {
const [show, setShowMsg] = useState(false)
const [msg, setMsg] = useState('')
const [DialogTabs, setDialogTabs] = useState(false)
const [ConceptoDialogTabs, setConceptoDialogTabs] = useState(false)
const [Corresponsal, setCorresponsal] = useState(0)
const [Corresponsales, setCorresponsales] = useState<ICatCorresponsales[]>([])
const [Tipo, setTipo] = useState(0)
const [Moneda, setMoneda] = useState(0)
const columnsConcepts = [
{
name: 'Concepto',
width: '55%',
width: '85%',
selector: (row: ITabuladorConceptos) => row.concepto,
sortable: true,
},
@ -69,7 +67,7 @@ export default function CatTabuladores (props: IProps) {
id={row.id}
value={row.costo}
postCost={(id, value) => {
postCost(id, value, row.costoCorresponsal, row.idConcepto)
postCost(id, value, row.costoCorresponsal)
}}
/>
),
@ -82,28 +80,11 @@ export default function CatTabuladores (props: IProps) {
id={row.id}
value={row.costoCorresponsal}
postCost={(id, value) => {
postCost(id, row.costo, value, row.idConcepto)
postCost(id, row.costo, value)
}}
/>
),
},
{
name: 'Elimina',
width: '15%',
cell: (row: ITabuladorConceptos) => (
<div
style={{ textAlign: 'center', cursor: 'pointer' }}
onClick={() => {
setConcepto(row.id)
setConceptoDialogTabs(true)
}}
>
<IconContext.Provider value={{ color: 'red', size: '25px' }}>
<FaTimesCircle />
</IconContext.Provider>
</div>
),
},
]
const columnsTabs = [
@ -119,7 +100,7 @@ export default function CatTabuladores (props: IProps) {
},
{
name: 'Editar',
width: '15%',
width: '10%',
cell: (row: ITabulador) => (
<div
style={{ textAlign: 'center', cursor: 'pointer' }}
@ -127,8 +108,6 @@ export default function CatTabuladores (props: IProps) {
setTabulador(row.id)
setNombreTabulador(row.nombre)
setCorresponsal(row.idCorresponsal!)
setTipo(row.tipo)
setMoneda(row.moneda)
}}
>
<IconContext.Provider value={{ color: 'blue', size: '25px' }}>
@ -139,7 +118,6 @@ export default function CatTabuladores (props: IProps) {
},
{
name: 'Elimina',
width: '15%',
cell: (row: ITabulador) => (
<div
style={{ textAlign: 'center', cursor: 'pointer' }}
@ -157,11 +135,11 @@ export default function CatTabuladores (props: IProps) {
},
]
const postCost = (id: number, costoCliente: number, costoCorresponsal: number, idConcepto: number) => {
const postCost = (id: number, costoCliente: number, costoCorresponsal: number) => {
const data: ITabuladorConceptos = {
id: id,
idTabulador: Tabulador,
idConcepto: idConcepto,
idConcepto: Concepto,
concepto: '',
costo: costoCliente,
activo: 1,
@ -204,19 +182,6 @@ export default function CatTabuladores (props: IProps) {
})
}
const deleteConcepto = () => {
CTabDetDataService.Delete(Concepto)
.then((resp) => {
if(resp.status === 200){
setHeader('Informativo')
setMsg(resp.data.respuesta)
setShowMsg(true)
setConceptoDialogTabs(false)
setDetalleConceptos(DetalleConceptos.filter(concepto => concepto.id != Concepto))
}
})
}
useEffect(() => {
CTabDetDataService.getAllConcepts()
.then((response) => {
@ -300,9 +265,7 @@ export default function CatTabuladores (props: IProps) {
id: Tabulador,
idCliente: Cliente,
nombre: NombreTabulador,
idCorresponsal:Corresponsal,
tipo: Tipo,
moneda: Moneda
idCorresponsal:Corresponsal
}
CTabDataService.Append(data)
.then((response) => {
@ -340,20 +303,20 @@ export default function CatTabuladores (props: IProps) {
}
}
const addConcept = (idConcepto: number) => {
const addConcept = () => {
if (Tabulador === 0) {
setHeader('Error')
setMsg('Por favor, primero seleccione el tabulador')
setShowMsg(true)
return
}
if (idConcepto === 0) {
if (Concepto === 0) {
setHeader('Error')
setMsg('Por favor, primero seleccione el concepto')
setShowMsg(true)
return
}
postCost(0, 0, 0, idConcepto)
postCost(0, 0, 0)
}
const clearForm = () => {
@ -368,6 +331,7 @@ export default function CatTabuladores (props: IProps) {
<Card>
<Card.Body>
<Card style={{ height: '100%' }}>
<Card.Header as='h4'>Tabuladores Clientes</Card.Header>
<Card.Body>
<Container fluid>
<Alert variant='primary'>
@ -401,9 +365,8 @@ export default function CatTabuladores (props: IProps) {
</Row>
</Alert>
<Row>
<Col xs={5}>
<Col xs={6}>
<Card style={{}}>
<Card.Header><h5>Tabuladores</h5></Card.Header>
<Card.Body>
<Card.Subtitle className='mb-2 text-muted'>
<Row>
@ -416,7 +379,12 @@ export default function CatTabuladores (props: IProps) {
<FaEraser />
</IconContext.Provider>
</Col>
<Col xs={10}>
<Col xs={2} style={{ paddingTop: '5px' }}>
<div>
<h5>Tabulador</h5>
</div>
</Col>
<Col xs={8}>
<h4>
<Form.Control
type='text'
@ -431,7 +399,7 @@ export default function CatTabuladores (props: IProps) {
/>
</h4>
</Col>
<Col xs={1} style={{ paddingTop: '5px' }}>
<Col style={{ paddingTop: '5px' }}>
<IconContext.Provider value={{ color: 'green', size: '30px' }}>
<FaSave onClick={() => saveForm()} style={{ cursor: 'pointer' }}/>
</IconContext.Provider>
@ -450,14 +418,13 @@ export default function CatTabuladores (props: IProps) {
</Card.Body>
</Card>
</Col>
<Col xs={7}>
<Col xs={6}>
<Card style={{}}>
<Card.Header><h5>Datos del Tabulador: {NombreTabulador}</h5></Card.Header>
<Card.Body>
<Card.Subtitle className='mb-2 text-muted'>
<Row>
<Col xs={3} style={{ paddingTop: '5px' }}>Corresponsal</Col>
<Col xs={8}>
<Col xs={3} style={{ paddingTop: '5px' }}>Corresponsal:</Col>
<Col xs={9}>
<Form.Control
disabled={Tabulador===0}
as='select'
@ -480,86 +447,17 @@ export default function CatTabuladores (props: IProps) {
: null}
</Form.Control>
</Col>
<Col style={{ paddingTop: '5px' }}>
<IconContext.Provider value={{ color: 'green', size: '30px' }}>
<FaSave onClick={() => saveForm()} style={{ cursor: 'pointer' }}/>
</IconContext.Provider>
</Col>
</Row>
<Row style={{ paddingTop: '5px' }}>
<Col xs={6}>
<Row>
<Col xs={3}>Tipo: </Col>
<Col xs={9}>
<Form>
<Form.Check
type='radio'
id='radio-Impo'
value={1}
label='Impo'
inline
name='grupo'
onChange={e => setTipo(parseInt(e.target.value))}
checked={Tipo === 1}
disabled={Tabulador===0}
/>
<Form.Check
type='radio'
id='radio-Expo'
value={2}
label='Expo'
inline
name='grupo'
onChange={e => setTipo(parseInt(e.target.value))}
checked={Tipo === 2}
disabled={Tabulador===0}
/>
</Form>
</Col>
</Row>
</Col>
<Col xs={6}>
<Row>
<Col xs={4}>Moneda:</Col>
<Col xs={8}>
<Form>
<Form.Check
type='radio'
id='radio-USD'
value={1}
label='USD'
inline
name='grupo'
onChange={e => setMoneda(parseInt(e.target.value))}
checked={Moneda === 1}
disabled={Tabulador===0}
/>
<Form.Check
type='radio'
id='radio-MXN'
value={2}
label='MXN'
inline
name='grupo'
onChange={e => setMoneda(parseInt(e.target.value))}
checked={Moneda === 2}
disabled={Tabulador===0}
/>
</Form>
</Col>
</Row>
</Col>
</Row>
<hr />
<Row>
<Col xs={2} style={{ paddingTop: '8px' }}>
Conceptos
</Col>
<Col xs={10}>
<Col xs={9}>
<Form.Control
disabled={Tabulador===0}
as='select'
onChange={(e) => addConcept(parseInt(e.target.value))}
onChange={(e) => setConcepto(parseInt(e.target.value))}
className='form-select form-select-sm'
style={{ fontSize: '17px' }}
value={Concepto}
@ -576,7 +474,7 @@ export default function CatTabuladores (props: IProps) {
: null}
</Form.Control>
</Col>
{/* <Col style={{ paddingTop: '5px' }}>
<Col style={{ paddingTop: '5px' }}>
<Form.Label
onClick={() => {
addConcept()
@ -587,7 +485,7 @@ export default function CatTabuladores (props: IProps) {
<BsPlusSquareFill />
</IconContext.Provider>
</Form.Label>
</Col> */}
</Col>
</Row>
</Card.Subtitle>
<DataTable
@ -645,42 +543,6 @@ export default function CatTabuladores (props: IProps) {
</Row>
</Modal.Footer>
</Modal>
<Modal
show={ConceptoDialogTabs}
onHide={() => {
setConceptoDialogTabs(false)
}}
size='sm'
>
<Modal.Body>
¿Esta seguro de eliminar este concepto?
</Modal.Body>
<Modal.Footer>
<Row>
<Col xs={6} style={{ textAlign: 'left', paddingRight: '100px' }}>
<Button
variant='danger'
onClick={deleteConcepto}
size='sm'
style={{ paddingRight: '20px', paddingLeft: '20px' }}
>
Si
</Button>
</Col>
<Col xs={6} style={{ textAlign: 'right' }}>
<Button
variant='secondary'
onClick={() => {
setConceptoDialogTabs(false)
}}
size='sm'
>
Cerrar
</Button>
</Col>
</Row>
</Modal.Footer>
</Modal>
<MsgInformativo
show={show}
msg={msg}

@ -3,6 +3,4 @@ export default interface ITabulador {
idCliente: number
nombre: string
idCorresponsal?: number
tipo: number
moneda: number
}
Loading…
Cancel
Save