diff --git a/src/Components/Catalogos/CatTabulador/CatTabulador.tsx b/src/Components/Catalogos/CatTabulador/CatTabulador.tsx index f868833..7138847 100644 --- a/src/Components/Catalogos/CatTabulador/CatTabulador.tsx +++ b/src/Components/Catalogos/CatTabulador/CatTabulador.tsx @@ -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([]) - + 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) => ( +
{ + setConcepto(row.id) + setConceptoDialogTabs(true) + }} + > + + + +
+ ), + }, ] const columnsTabs = [ @@ -100,7 +119,7 @@ export default function CatTabuladores (props: IProps) { }, { name: 'Editar', - width: '10%', + width: '15%', cell: (row: ITabulador) => (
@@ -118,6 +139,7 @@ export default function CatTabuladores (props: IProps) { }, { name: 'Elimina', + width: '15%', cell: (row: ITabulador) => (
{ + 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) { - Tabuladores Clientes @@ -365,9 +401,10 @@ export default function CatTabuladores (props: IProps) { - + - +
Tabuladores
+ - -
-
Tabulador
-
- - +

- + saveForm()} style={{ cursor: 'pointer' }}/> @@ -418,13 +450,14 @@ export default function CatTabuladores (props: IProps) {
- + +
Datos del Tabulador: {NombreTabulador}
- Corresponsal: - + Corresponsal + + + + saveForm()} style={{ cursor: 'pointer' }}/> + + + + + + + Tipo: + +
+ setTipo(parseInt(e.target.value))} + checked={Tipo === 1} + disabled={Tabulador===0} + /> + setTipo(parseInt(e.target.value))} + checked={Tipo === 2} + disabled={Tabulador===0} + /> + + +
+ + + + Moneda: + +
+ setMoneda(parseInt(e.target.value))} + checked={Moneda === 1} + disabled={Tabulador===0} + /> + setMoneda(parseInt(e.target.value))} + checked={Moneda === 2} + disabled={Tabulador===0} + /> + + +
+

Conceptos - + 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} - + {/* { addConcept() @@ -485,7 +587,7 @@ export default function CatTabuladores (props: IProps) { - + */}
+ { + setConceptoDialogTabs(false) + }} + size='sm' + > + + ¿Esta seguro de eliminar este concepto? + + + + + + + + + + + +