= (props) => {
>
{MasterData.refAgenciaAduanal}
+ {
+ setIDViaje(MasterData.id)
+ setShowDocumentsDialog(true)
+ }}
+ >
+
+
+
+ |
= (props) => {
+
+ {
+ setShowDocumentsDialog(false)
+ }}
+ dialogClassName='modal-90w'
+ backdrop='static'
+ >
+
+ Documentos del viaje
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
)
}
diff --git a/src/Components/ResetAccount/ResetAccount.tsx b/src/Components/ResetAccount/ResetAccount.tsx
new file mode 100644
index 0000000..4e24dd9
--- /dev/null
+++ b/src/Components/ResetAccount/ResetAccount.tsx
@@ -0,0 +1,123 @@
+import { FC, useEffect, useState } from 'react'
+import { Link, Navigate, useNavigate } from 'react-router-dom'
+import IAuth from '../../Interfaces/Auth/IAuth'
+import DSAuth from '../../Services/Auth/Auth.Services'
+import DSUsers from '../../Services/Catalogos/CatUsuarios.Services'
+import { useDispatch, useSelector } from 'react-redux'
+import { populateUserProfile } from '../../store/features/Auth/UserProfileSlice'
+import { populateMenuItems } from '../../store/features/Auth/MenuItemsSlice'
+import { RootState } from '../../store/store'
+import Leyend from '../../images/leyend.png'
+import jwt_decode from 'jwt-decode'
+
+interface IProps {}
+
+export const ResetAccount: FC = (props) => {
+ const navigate = useNavigate()
+ const dispatch = useDispatch()
+ const UserLogued = useSelector((state: RootState) => state.UserProfile.UserProfile.logueado)
+ const [Usuario, setUsuario] = useState('')
+ const [Contrasena, setContrasena] = useState('')
+ const [Contrasena2, setContrasena2] = useState('')
+ const [token, setToken] = useState(
+ (window.localStorage.getItem('token') ? window.localStorage.getItem('token') : '')!
+ )
+ const [menuStr, setMenuStr] = useState(
+ (window.localStorage.getItem('menu') ? window.localStorage.getItem('menu') : '')!
+ )
+
+ const Reset = async () => {
+ if (Contrasena !== Contrasena2) {
+ alert('Las contraseñas no coinciden entre si')
+ return false
+ }
+ const data: IAuth = {
+ usuario: Usuario,
+ contrasena: Contrasena,
+ }
+ DSAuth.ResetPassword(data)
+ .then((response) => {
+ console.log(response.data)
+ alert('El cambio de contraseña se realizo exitosamente!')
+ navigate('/', { replace: true })
+ })
+ .catch((e: Error) => {
+ alert('Credenciales invalidas! ')
+ })
+ }
+
+ const validateToken = () => {
+ DSAuth.Validate()
+ .then((response) => {
+ navigate('/login', { replace: true })
+ })
+ .catch((e: Error) => {
+ alert('Ocurrio un error!')
+ })
+ }
+
+ useEffect(() => {
+ if (token.length > 5) {
+ validateToken()
+ }
+ }, [token])
+
+ return (
+
+ )
+}
diff --git a/src/Components/Utils/MFileManager/MFileManager.tsx b/src/Components/Utils/MFileManager/MFileManager.tsx
new file mode 100644
index 0000000..39e5425
--- /dev/null
+++ b/src/Components/Utils/MFileManager/MFileManager.tsx
@@ -0,0 +1,333 @@
+import React, { FC, useEffect, useState } from 'react'
+import MFileManagerDS from '../../../Services/Utils/MFileManager.Service'
+import IFileManager from '../../../Interfaces/Utils/IFileManager'
+import { Alert, Button, Card, Col, ListGroup, Modal, Row } from 'react-bootstrap'
+import { IconContext } from 'react-icons'
+import { BsFillXCircleFill } from 'react-icons/bs'
+import { MsgInformativo } from '../Toast/MsgInformativo'
+import { TargetURL } from '../../../Constants/TargetURL'
+
+interface IProps {
+ IDTrafico: number
+ Proceso: number
+ Leyenda?: string
+ showPreview: number
+ fileType: string
+ canEdit: boolean
+}
+
+export const MFileManager: FC = (props) => {
+ const [UserId, setUserId] = useState(() => {
+ const stickyValue = window.localStorage.getItem('UserId')
+ return stickyValue !== null ? JSON.parse(stickyValue) : 0
+ })
+ const [IDTrafico, setIDTrafico] = useState(props.IDTrafico ? props.IDTrafico : 0)
+ const [Proceso, setProceso] = useState(props.Proceso ? props.Proceso : 0)
+ const [ListaArchivos, setListaArchivos] = useState()
+ const [NombreArchivo, setNombreArchivo] = useState('')
+ const [MsgDialogDelete, setMsgDialogDelete] = useState(false)
+ const [IDArchivo, setIDArchivo] = useState(0)
+ const [header, setHeader] = useState('')
+ const [show, setShowMsg] = useState(false)
+ const [msg, setMsg] = useState('')
+ const URL = new TargetURL()
+ const msgColor = 'primary'
+
+ const selectedFiles = (selectorFiles: any) => {
+ var formData = new FormData()
+ for (let i = 0; i < selectorFiles.files.length; i++) {
+ formData.append('FileList', selectorFiles.files[i])
+ }
+ MFileManagerDS.Append(formData, IDTrafico, Proceso, UserId)
+ .then((response) => {
+ setListaArchivos(response.data)
+ })
+ .catch((e: Error) => {
+ alert('Ocurrio un error: ' + e)
+ return
+ })
+ return false
+ }
+
+ useEffect(() => {
+ setIDTrafico(props.IDTrafico)
+ setProceso(props.Proceso)
+ MFileManagerDS.Get(props.IDTrafico, props.Proceso)
+ .then((response) => {
+ setListaArchivos(response.data)
+ })
+ .catch((e: Error) => {
+ alert('Ocurrio un error: ' + e)
+ return
+ })
+ }, [props.IDTrafico, props.Proceso])
+
+ const confirmDelete = (row: IFileManager) => {
+ setIDArchivo(row.id)
+ setNombreArchivo(row.nombreArchivo)
+ setMsgDialogDelete(true)
+ }
+
+ const deleteItem = () => {
+ MFileManagerDS.DeleteFile(IDArchivo)
+ .then((response) => {
+ var arrArchivos = ListaArchivos!.filter(function (el) {
+ return el.id !== IDArchivo
+ })
+ setListaArchivos(arrArchivos)
+ setHeader('Informtivo')
+ setMsg(response.data.Respuesta)
+ setMsgDialogDelete(false)
+ setShowMsg(false)
+ return
+ })
+ .catch((e: Error) => {
+ setHeader('Error')
+ setMsg('Ocurrio un error, no se elimino el archivo')
+ setMsgDialogDelete(false)
+ setShowMsg(false)
+ return
+ })
+ return false
+ }
+
+ const getFileContent = (row: IFileManager) => {
+ MFileManagerDS.getFileContentById(row.id, row.proceso)
+ .then((response: any) => {
+ if (response.status === 200) {
+ if (row.nombreArchivo.toLowerCase().endsWith('.pdf')) {
+ // console.log(response.data)
+ const blob = new Blob([response.data], { type: 'application/pdf' })
+ const url = window.URL.createObjectURL(blob)
+ window.open(url)
+ } else if (
+ row.nombreArchivo.toLowerCase().endsWith('.png') ||
+ row.nombreArchivo.toLowerCase().endsWith('.jpg')
+ ) {
+ const blob = new Blob([response.data], { type: 'image/png' })
+ const url = window.URL.createObjectURL(blob)
+ window.open(url)
+ } else {
+ const url = window.URL.createObjectURL(new Blob([response.data]))
+ const link = document.createElement('a')
+ link.href = url
+ link.setAttribute('download', NombreArchivo ? NombreArchivo : 'Archivo.zip')
+ document.body.appendChild(link)
+ link.click()
+ }
+ } else {
+ setHeader('Error')
+ setMsg('A este concepto no se le ha anexado PDF')
+ setShowMsg(true)
+ return
+ }
+ })
+ .catch((e: Error) => {
+ setHeader('Error')
+ setMsg('A este concepto no se le ha anexado PDF')
+ setShowMsg(true)
+ return
+ })
+ }
+
+ return (
+
+
+
+
+
+ {props.Leyenda ? props.Leyenda : ''}
+ {props.canEdit ? (
+ selectedFiles(e.target)}
+ />
+ ) : (
+ ''
+ )}
+
+ {ListaArchivos && props.showPreview === 1 ? (
+
+
+ {ListaArchivos
+ ? ListaArchivos.map((rec) => {
+ return (
+
+
+
+
+
+
+ {
+ getFileContent(rec)
+ }}
+ />
+
+
+
+ {
+ confirmDelete(rec)
+ }}
+ style={{ cursor: 'pointer' }}
+ />
+
+
+
+
+
+
+
+
+ {rec.nombreArchivo}
+
+
+
+
+ )
+ })
+ : ''}
+
+
+ ) : ListaArchivos && props.showPreview === 2 ? (
+
+
+ {ListaArchivos
+ ? ListaArchivos.map((rec) => {
+ return (
+
+
+
+
+
+ {rec.nombreArchivo}
+
+
+ {
+ confirmDelete(rec)
+ }}
+ style={{ cursor: 'pointer' }}
+ />
+
+
+
+
+
+
+
+ )
+ })
+ : ''}
+
+
+ ) : ListaArchivos && props.showPreview === 3 ? (
+
+ {ListaArchivos
+ ? ListaArchivos.map((rec) => {
+ return (
+
+
+
+
+ {
+ getFileContent(rec)
+ }}
+ >
+ {rec.nombreArchivo.substring(0, 40)}
+
+
+
+
+
+ {
+ confirmDelete(rec)
+ }}
+ style={{ cursor: 'pointer' }}
+ />
+
+
+
+
+
+
+ )
+ })
+ : ''}
+
+ ) : (
+ ''
+ )}
+
+
+ setMsgDialogDelete(false)} size='lg'>
+
+
+ Favor de confirmar
+
+
+
+
+ ¿Esta seguro de eliminar el archivo:
+ {NombreArchivo}?
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ setShowMsg(false)
+ }}
+ />
+
+ )
+}
diff --git a/src/Components/Utils/Toast/MsgInformativo.tsx b/src/Components/Utils/Toast/MsgInformativo.tsx
new file mode 100644
index 0000000..ca41a64
--- /dev/null
+++ b/src/Components/Utils/Toast/MsgInformativo.tsx
@@ -0,0 +1,51 @@
+import React, { FC } from 'react'
+import { Toast, ToastContainer } from 'react-bootstrap'
+import { IconContext } from 'react-icons'
+import { BsFillExclamationSquareFill, BsXOctagonFill } from 'react-icons/bs'
+
+interface IProps {
+ show: boolean
+ msg: string
+ header: string
+ msgColor: string
+ time?: number
+ closeToast: (arg: boolean) => void
+}
+
+export const MsgInformativo: FC = (props) => {
+ return (
+
+
+ {
+ props.closeToast(false)
+ }}
+ >
+
+
+ {props.header.toString().includes('Error') ? (
+
+
+
+ ) : null}
+ {props.header.toString().includes('Informativo') ? (
+
+
+
+ ) : null}
+
+ {props.header}
+
+
+
+ {props.msg}
+
+
+
+
+ )
+}
diff --git a/src/Interfaces/Catalogos/ICatUsuarios.ts b/src/Interfaces/Catalogos/ICatUsuarios.ts
new file mode 100644
index 0000000..5725082
--- /dev/null
+++ b/src/Interfaces/Catalogos/ICatUsuarios.ts
@@ -0,0 +1,9 @@
+export default interface ICatUsuarios {
+ id: number
+ usuario: string
+ nombre: string
+ contrasena: string,
+ tipoUsuario : number
+ activo: number
+ idPerfil: number
+}
\ No newline at end of file
diff --git a/src/Interfaces/Utils/IFileManager.ts b/src/Interfaces/Utils/IFileManager.ts
new file mode 100644
index 0000000..5186c25
--- /dev/null
+++ b/src/Interfaces/Utils/IFileManager.ts
@@ -0,0 +1,9 @@
+export default interface IFileManager {
+ id: number,
+ idUsuario: number,
+ proceso: number,
+ nombreArchivo: string,
+ fechaRegistro: string,
+ tags: string,
+ size: number,
+}
\ No newline at end of file
diff --git a/src/Services/Auth/Auth.Services.ts b/src/Services/Auth/Auth.Services.ts
index f181bc7..8b35f50 100644
--- a/src/Services/Auth/Auth.Services.ts
+++ b/src/Services/Auth/Auth.Services.ts
@@ -2,7 +2,7 @@ import http from "../../Services/Auth/config/http-common";
import IAuth from "../../Interfaces/Auth/IAuth"
//import ItemMenuData from "../../Interfaces/Auth/IMenu";
import IPermisos from "../../Interfaces/Auth/IPermisos";
-//import Token from '../../Interfaces/token'
+import IRespuesta from "../../Interfaces/Respuestas/IRespuesta";
class authDataService {
async login(data: IAuth) {
@@ -11,5 +11,8 @@ class authDataService {
async Validate() {
return await http.get("Auth/Validate");
}
+ ResetPassword(data: IAuth) {
+ return http.post(`Auth/ResetPassword`, data);
+ }
}
export default new authDataService();
\ No newline at end of file
diff --git a/src/Services/Catalogos/CatUsuarios.Services.ts b/src/Services/Catalogos/CatUsuarios.Services.ts
new file mode 100644
index 0000000..8f059d6
--- /dev/null
+++ b/src/Services/Catalogos/CatUsuarios.Services.ts
@@ -0,0 +1,17 @@
+import http from "../../Services/Auth/config/http-common";
+import ICatUsuarios from "../../Interfaces/Catalogos/ICatUsuarios";
+import IRespuesta from "../../Interfaces/Respuestas/IRespuesta";
+import IAuth from "../../Interfaces/Auth/IAuth";
+
+class CatUsuariosDataService {
+ async GetAll() {
+ return await http.get("Catalogos/Usuarios/GetAll");
+ }
+ Append(data: ICatUsuarios) {
+ return http.post(`Catalogos/Usuarios/Append`,data);
+ }
+ Delete(id: number) {
+ return http.delete(`Catalogos/Usuarios/Delete/${id}`);
+ }
+}
+export default new CatUsuariosDataService();
\ No newline at end of file
diff --git a/src/Services/Utils/MFileManager.Service.ts b/src/Services/Utils/MFileManager.Service.ts
new file mode 100644
index 0000000..adc32d0
--- /dev/null
+++ b/src/Services/Utils/MFileManager.Service.ts
@@ -0,0 +1,26 @@
+import http from "../Auth/config/http-common";
+import IRespuesta from "../../Interfaces/Respuestas/IRespuesta"
+import IFileManager from "../../Interfaces/Utils/IFileManager";
+
+class MFileManagerDataService {
+
+ Append(formData: any, IDTrafico: number, Proceso: number, Usuario: number) {
+ return http.post(`/Utils/MFileManager/Append?Tags=${IDTrafico}&Proceso=${Proceso}&Usuario=${Usuario}`, formData)
+ }
+ DeleteFile(id: number) {
+ return http.delete(`/FileManager/DeleteById/${id}`);
+ }
+ Get(IDTrafico: number, Proceso: number) {
+ return http.get(`/Utils/MFileManager/GetFilesFromLog?Tags=${IDTrafico}&Proceso=${Proceso}`)
+ }
+ getFileContentById(id: number, Proceso: number) {
+ return http.get(`/Utils/MFileManager/GetFileContentById?id=${id}&Proceso=${Proceso}`, {responseType: 'arraybuffer'})
+ .then(function (response) {
+ return response
+ })
+ .catch(function (error) {
+ console.log(error)
+ })
+ }
+}
+export default new MFileManagerDataService();
\ No newline at end of file
diff --git a/src/css/masterDetail.css b/src/css/masterDetail.css
index 1d4a46f..f0850f9 100644
--- a/src/css/masterDetail.css
+++ b/src/css/masterDetail.css
@@ -188,3 +188,9 @@
position: relative; */
display: inline-block;
}
+
+.modal-90w {
+ width: 90%;
+ max-width: none !important;
+ max-height: none !important;
+}
diff --git a/src/images/Clean.png b/src/images/Clean.png
new file mode 100644
index 0000000..ca15cd4
Binary files /dev/null and b/src/images/Clean.png differ
|