diff --git a/src/Components/Corresponsales/Anticipos/Anticipos.tsx b/src/Components/Corresponsales/Anticipos/Anticipos.tsx index 697a4a1..ef16370 100644 --- a/src/Components/Corresponsales/Anticipos/Anticipos.tsx +++ b/src/Components/Corresponsales/Anticipos/Anticipos.tsx @@ -10,6 +10,7 @@ import { BsFillXCircleFill, BsPencilFill, BsQuestionOctagonFill, + BsTrash, } from 'react-icons/bs' import { MsgInformativo } from '../../Utils/Toast/msgInformativo' import 'react-flexy-table/dist/index.css' @@ -65,9 +66,11 @@ export const Anticipos: FC = (props) => { const [show, setShowMsg] = useState(false) const [msg, setMsg] = useState('') const [msgDialog, setMsgDialog] = useState(false) + const [msgDeleteDialog, setMsgDeleteDialog] = useState(false) const [MsgDialogFileManager, setMsgDialogFileManager] = useState(false) const [msgDialogFileManagerConta, setMsgDialogFileManagerConta] = useState(false) const gridRef = React.useRef(null) + const btnSaveRef = React.useRef(null) const [deleteFile, setDeleteFile] = useState(false) const [columnDefs] = useState([ Depto === 'Corresponsalias' @@ -97,7 +100,20 @@ export const Anticipos: FC = (props) => { }} style={{ cursor: 'pointer' }} /> - +     + { params.data.autoriza === 0 ? + + { + setIdAnticipo(params.data.id) + setConcepto(params.data.concepto) + setAnticipo(params.data.anticipo) + setMsgDeleteDialog(true) + }} + style={{ cursor: 'pointer' }} + /> + : "" + } ) }, @@ -239,12 +255,14 @@ export const Anticipos: FC = (props) => { const saveForm = () => { if (Concepto.length < 5) { + btnSaveRef.current!.disabled = false; setHeader('Error') setMsg('Para poder guardar la informacion, proporcione el concepto') setShowMsg(true) return } if (Anticipo === 0) { + btnSaveRef.current!.disabled = false; setHeader('Error') setMsg('Para poder guardar la informacion, proporcione el monto del anticipo') setShowMsg(true) @@ -263,6 +281,7 @@ export const Anticipos: FC = (props) => { CAnticiposDataService.Append(data) .then((response) => { if (response.status === 200) { + btnSaveRef.current!.disabled = false; setHeader('Informativo') setMsg('La informcion se guardo correctamente') setShowMsg(true) @@ -271,6 +290,7 @@ export const Anticipos: FC = (props) => { } }) .catch((e: Error) => { + btnSaveRef.current!.disabled = false; setHeader('Error') setMsg('Ocurrio un error: ' + e) setShowMsg(true) @@ -325,7 +345,7 @@ export const Anticipos: FC = (props) => { .then((response) => { if (response.status == 200) { dispatch(deleteCorresponsalesAnticipos(IdAnticipo)) - setMsgDialog(false) + setMsgDeleteDialog(false) } }) .catch((e: Error) => { @@ -440,8 +460,10 @@ export const Anticipos: FC = (props) => { variant='primary' size='sm' onClick={() => { + btnSaveRef.current!.disabled = true; saveForm() }} + ref={btnSaveRef} >  Guardar @@ -475,7 +497,7 @@ export const Anticipos: FC = (props) => { setShowMsg(false) }} > - setMsgDialog(false)} size='lg'> + setMsgDeleteDialog(false)} size='lg'> ¿Esta seguro de eliminar ?: ' @@ -497,7 +519,7 @@ export const Anticipos: FC = (props) => { -