Compare commits

...

2 Commits

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

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

@ -49,13 +49,15 @@ 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: '85%',
width: '55%',
selector: (row: ITabuladorConceptos) => row.concepto,
sortable: true,
},
@ -67,7 +69,7 @@ export default function CatTabuladores (props: IProps) {
id={row.id}
value={row.costo}
postCost={(id, value) => {
postCost(id, value, row.costoCorresponsal)
postCost(id, value, row.costoCorresponsal, row.idConcepto)
}}
/>
),
@ -80,11 +82,28 @@ export default function CatTabuladores (props: IProps) {
id={row.id}
value={row.costoCorresponsal}
postCost={(id, value) => {
postCost(id, row.costo, value)
postCost(id, row.costo, value, row.idConcepto)
}}
/>
),
},
{
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 = [
@ -100,7 +119,7 @@ export default function CatTabuladores (props: IProps) {
},
{
name: 'Editar',
width: '10%',
width: '15%',
cell: (row: ITabulador) => (
<div
style={{ textAlign: 'center', cursor: 'pointer' }}
@ -108,6 +127,8 @@ 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' }}>
@ -118,6 +139,7 @@ export default function CatTabuladores (props: IProps) {
},
{
name: 'Elimina',
width: '15%',
cell: (row: ITabulador) => (
<div
style={{ textAlign: 'center', cursor: 'pointer' }}
@ -135,11 +157,11 @@ export default function CatTabuladores (props: IProps) {
},
]
const postCost = (id: number, costoCliente: number, costoCorresponsal: number) => {
const postCost = (id: number, costoCliente: number, costoCorresponsal: number, idConcepto: number) => {
const data: ITabuladorConceptos = {
id: id,
idTabulador: Tabulador,
idConcepto: Concepto,
idConcepto: idConcepto,
concepto: '',
costo: costoCliente,
activo: 1,
@ -182,6 +204,19 @@ 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) => {
@ -265,7 +300,9 @@ export default function CatTabuladores (props: IProps) {
id: Tabulador,
idCliente: Cliente,
nombre: NombreTabulador,
idCorresponsal:Corresponsal
idCorresponsal:Corresponsal,
tipo: Tipo,
moneda: Moneda
}
CTabDataService.Append(data)
.then((response) => {
@ -303,20 +340,20 @@ export default function CatTabuladores (props: IProps) {
}
}
const addConcept = () => {
const addConcept = (idConcepto: number) => {
if (Tabulador === 0) {
setHeader('Error')
setMsg('Por favor, primero seleccione el tabulador')
setShowMsg(true)
return
}
if (Concepto === 0) {
if (idConcepto === 0) {
setHeader('Error')
setMsg('Por favor, primero seleccione el concepto')
setShowMsg(true)
return
}
postCost(0, 0, 0)
postCost(0, 0, 0, idConcepto)
}
const clearForm = () => {
@ -331,7 +368,6 @@ 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'>
@ -365,9 +401,10 @@ export default function CatTabuladores (props: IProps) {
</Row>
</Alert>
<Row>
<Col xs={6}>
<Col xs={5}>
<Card style={{}}>
<Card.Body>
<Card.Header><h5>Tabuladores</h5></Card.Header>
<Card.Body>
<Card.Subtitle className='mb-2 text-muted'>
<Row>
<Col
@ -379,12 +416,7 @@ export default function CatTabuladores (props: IProps) {
<FaEraser />
</IconContext.Provider>
</Col>
<Col xs={2} style={{ paddingTop: '5px' }}>
<div>
<h5>Tabulador</h5>
</div>
</Col>
<Col xs={8}>
<Col xs={10}>
<h4>
<Form.Control
type='text'
@ -399,7 +431,7 @@ export default function CatTabuladores (props: IProps) {
/>
</h4>
</Col>
<Col style={{ paddingTop: '5px' }}>
<Col xs={1} style={{ paddingTop: '5px' }}>
<IconContext.Provider value={{ color: 'green', size: '30px' }}>
<FaSave onClick={() => saveForm()} style={{ cursor: 'pointer' }}/>
</IconContext.Provider>
@ -418,13 +450,14 @@ export default function CatTabuladores (props: IProps) {
</Card.Body>
</Card>
</Col>
<Col xs={6}>
<Col xs={7}>
<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={9}>
<Col xs={3} style={{ paddingTop: '5px' }}>Corresponsal</Col>
<Col xs={8}>
<Form.Control
disabled={Tabulador===0}
as='select'
@ -447,17 +480,86 @@ 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={9}>
<Col xs={10}>
<Form.Control
disabled={Tabulador===0}
as='select'
onChange={(e) => setConcepto(parseInt(e.target.value))}
onChange={(e) => addConcept(parseInt(e.target.value))}
className='form-select form-select-sm'
style={{ fontSize: '17px' }}
value={Concepto}
@ -474,7 +576,7 @@ export default function CatTabuladores (props: IProps) {
: null}
</Form.Control>
</Col>
<Col style={{ paddingTop: '5px' }}>
{/* <Col style={{ paddingTop: '5px' }}>
<Form.Label
onClick={() => {
addConcept()
@ -485,7 +587,7 @@ export default function CatTabuladores (props: IProps) {
<BsPlusSquareFill />
</IconContext.Provider>
</Form.Label>
</Col>
</Col> */}
</Row>
</Card.Subtitle>
<DataTable
@ -543,6 +645,42 @@ 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,4 +3,6 @@ export default interface ITabulador {
idCliente: number
nombre: string
idCorresponsal?: number
tipo: number
moneda: number
}
Loading…
Cancel
Save