|
@@ -1,5 +1,5 @@
|
|
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
import React, { useEffect, useState, useCallback } from 'react';
|
|
|
-import { Table, Modal, Button, message, Input, Row, Col, Tabs, Divider } from 'antd';
|
|
|
|
|
|
|
+import { Table, Modal, Button, message, Input, Row, Col, Tabs, Divider } from 'antd';
|
|
|
import { EditOutlined, DeleteOutlined, BarChartOutlined, PlusCircleOutlined, ExclamationCircleOutlined, DeliveredProcedureOutlined } from "@ant-design/icons";
|
|
import { EditOutlined, DeleteOutlined, BarChartOutlined, PlusCircleOutlined, ExclamationCircleOutlined, DeliveredProcedureOutlined } from "@ant-design/icons";
|
|
|
import { useHistory } from 'react-router-dom';
|
|
import { useHistory } from 'react-router-dom';
|
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
@@ -8,6 +8,9 @@ import { ActionsButton } from '../../../components';
|
|
|
import { SimpleTableLayout } from '../../../components/layouts';
|
|
import { SimpleTableLayout } from '../../../components/layouts';
|
|
|
import { collection, limit, orderBy, updateDoc, doc, getDocs, query, where, addDoc } from "firebase/firestore";
|
|
import { collection, limit, orderBy, updateDoc, doc, getDocs, query, where, addDoc } from "firebase/firestore";
|
|
|
import { useAuth } from '../../../hooks';
|
|
import { useAuth } from '../../../hooks';
|
|
|
|
|
+import Tabla from '../../../components/Tabla';
|
|
|
|
|
+import HttpService from '../../../services/httpService';
|
|
|
|
|
+import { respuestas } from '../../../utilities';
|
|
|
|
|
|
|
|
const { REACT_APP_WEB_URL } = process.env;
|
|
const { REACT_APP_WEB_URL } = process.env;
|
|
|
|
|
|
|
@@ -19,18 +22,18 @@ const EventosListado = () => {
|
|
|
const url = "/administracion/eventos";
|
|
const url = "/administracion/eventos";
|
|
|
const history = useHistory();
|
|
const history = useHistory();
|
|
|
const { confirm } = Modal;
|
|
const { confirm } = Modal;
|
|
|
-
|
|
|
|
|
- const [ eventos, setEventos ] = useState([]);
|
|
|
|
|
- const [ grupoEventos, setGrupoEventos ] = useState([]);
|
|
|
|
|
- const [ filteredResults, setFilteredResults ] = useState([]);
|
|
|
|
|
- const [ searchInput, setSearchInput ] = useState('');
|
|
|
|
|
- const [ visible, setVisible ] = useState(false);
|
|
|
|
|
- const [ textAreaData, setTextAreaData ] = useState('');
|
|
|
|
|
- const [ evento, setEvento ] = useState(null);
|
|
|
|
|
- const [ procesando, setProcesando ] = useState(false);
|
|
|
|
|
- const [ eventosPorPagina, setEventosPorPagina] = useState(10);
|
|
|
|
|
- const [ currentPage, setCurrentPage] = useState(1);
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const [eventos, setEventos] = useState([]);
|
|
|
|
|
+ const [grupoEventos, setGrupoEventos] = useState([]);
|
|
|
|
|
+ const [filteredResults, setFilteredResults] = useState([]);
|
|
|
|
|
+ const [searchInput, setSearchInput] = useState('');
|
|
|
|
|
+ const [visible, setVisible] = useState(false);
|
|
|
|
|
+ const [textAreaData, setTextAreaData] = useState('');
|
|
|
|
|
+ const [evento, setEvento] = useState(null);
|
|
|
|
|
+ const [procesando, setProcesando] = useState(false);
|
|
|
|
|
+ const [eventosPorPagina, setEventosPorPagina] = useState(10);
|
|
|
|
|
+ const [currentPage, setCurrentPage] = useState(1);
|
|
|
|
|
+
|
|
|
const defaultText = prop => prop || <span style={{ color: '#c7c3c3' }}>---</span>;
|
|
const defaultText = prop => prop || <span style={{ color: '#c7c3c3' }}>---</span>;
|
|
|
|
|
|
|
|
const pageSizeOptions = ['10', '20', '30', '40', '50', '60', '70', '80'];
|
|
const pageSizeOptions = ['10', '20', '30', '40', '50', '60', '70', '80'];
|
|
@@ -42,20 +45,20 @@ const EventosListado = () => {
|
|
|
key: "id",
|
|
key: "id",
|
|
|
align: "center",
|
|
align: "center",
|
|
|
width: 100,
|
|
width: 100,
|
|
|
- render: (_, item ) => (
|
|
|
|
|
|
|
+ render: (_, item) => (
|
|
|
<ActionsButton
|
|
<ActionsButton
|
|
|
key={item}
|
|
key={item}
|
|
|
options={[
|
|
options={[
|
|
|
{
|
|
{
|
|
|
name: "Editar",
|
|
name: "Editar",
|
|
|
icon: <EditOutlined />,
|
|
icon: <EditOutlined />,
|
|
|
- onClick: () => history.push(url+'/detalle?id='+item.id)
|
|
|
|
|
|
|
+ onClick: () => history.push(url + '/detalle?id=' + item.id)
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "Ver resultados",
|
|
name: "Ver resultados",
|
|
|
disabled: !item?.resultado,
|
|
disabled: !item?.resultado,
|
|
|
icon: <BarChartOutlined />,
|
|
icon: <BarChartOutlined />,
|
|
|
- onClick: () => history.push(url+'/resultado-acciones?id='+item?.id),
|
|
|
|
|
|
|
+ onClick: () => history.push(url + '/resultado-acciones?id=' + item?.id),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
name: "Procesador",
|
|
name: "Procesador",
|
|
@@ -69,7 +72,7 @@ const EventosListado = () => {
|
|
|
{
|
|
{
|
|
|
name: "Eliminar",
|
|
name: "Eliminar",
|
|
|
icon: <DeleteOutlined />,
|
|
icon: <DeleteOutlined />,
|
|
|
- onClick: () => eliminarRegistro(item, 'eventos'),
|
|
|
|
|
|
|
+ onClick: () => eliminarRegistro(item, 'evento'),
|
|
|
styleProps: { color: '#e91e63' },
|
|
styleProps: { color: '#e91e63' },
|
|
|
},
|
|
},
|
|
|
]}
|
|
]}
|
|
@@ -87,30 +90,30 @@ const EventosListado = () => {
|
|
|
dataIndex: "redSocial",
|
|
dataIndex: "redSocial",
|
|
|
key: "redSocial",
|
|
key: "redSocial",
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- render: ( _, item ) => (
|
|
|
|
|
- <img src={ '/assets/'+item?.redSocial+'.png' } width='40' alt="Red social" />
|
|
|
|
|
|
|
+ render: (_, item) => (
|
|
|
|
|
+ <img src={'/assets/' + item?.redSocial + '.png'} width='40' alt="Red social" />
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: "Creado",
|
|
title: "Creado",
|
|
|
- dataIndex: "timestamp",
|
|
|
|
|
- key: "timestamp",
|
|
|
|
|
|
|
+ dataIndex: "creado",
|
|
|
|
|
+ key: "creado",
|
|
|
render: (_, item) => (
|
|
render: (_, item) => (
|
|
|
- moment(item?.timestamp?.toDate()).format('DD-MM-YYYY')
|
|
|
|
|
|
|
+ moment(item?.creado).format('DD-MM-YYYY')
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- title: 'URL Laud',
|
|
|
|
|
|
|
+ title: 'URL Laud',
|
|
|
dataIndex: "id",
|
|
dataIndex: "id",
|
|
|
key: "id",
|
|
key: "id",
|
|
|
align: "center",
|
|
align: "center",
|
|
|
width: 100,
|
|
width: 100,
|
|
|
- render: (_, item ) => (
|
|
|
|
|
|
|
+ render: (_, item) => (
|
|
|
<Button
|
|
<Button
|
|
|
type='link'
|
|
type='link'
|
|
|
- onClick={ () => obtenerEnlaceYager(item) }
|
|
|
|
|
|
|
+ onClick={() => obtenerEnlaceYager(item)}
|
|
|
>
|
|
>
|
|
|
- <img src="/assets/LAUD-Avatar.png" width='40' alt="icono" style={{ position: 'relative', marginTop: -11 }} />
|
|
|
|
|
|
|
+ <img src="/assets/LAUD-Avatar.png" width='40' alt="icono" style={{ position: 'relative', marginTop: -11 }} />
|
|
|
</Button>
|
|
</Button>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -123,7 +126,7 @@ const EventosListado = () => {
|
|
|
key: "id",
|
|
key: "id",
|
|
|
align: "center",
|
|
align: "center",
|
|
|
width: 100,
|
|
width: 100,
|
|
|
- render: (_, item ) => (
|
|
|
|
|
|
|
+ render: (_, item) => (
|
|
|
<ActionsButton
|
|
<ActionsButton
|
|
|
key={item}
|
|
key={item}
|
|
|
options={[
|
|
options={[
|
|
@@ -153,16 +156,16 @@ const EventosListado = () => {
|
|
|
dataIndex: "redes",
|
|
dataIndex: "redes",
|
|
|
key: "redes",
|
|
key: "redes",
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
- render: ( _, item ) => {
|
|
|
|
|
- return item?.redes.map( (i, index) => Array.from(item.redes.keys()).pop() !== index ? i.redSocial + ', ' : i.redSocial + '' )
|
|
|
|
|
|
|
+ render: (_, item) => {
|
|
|
|
|
+ return item?.redes/* .map((i, index) => Array.from(item.redes.keys()).pop() !== index ? i.redSocial + ', ' : i.redSocial + '') */
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: "Creado",
|
|
title: "Creado",
|
|
|
- dataIndex: "timestamp",
|
|
|
|
|
- key: "timestamp",
|
|
|
|
|
|
|
+ dataIndex: "creado",
|
|
|
|
|
+ key: "creado",
|
|
|
render: (_, item) => (
|
|
render: (_, item) => (
|
|
|
- moment(item?.timestamp?.toDate()).format('DD-MM-YYYY')
|
|
|
|
|
|
|
+ moment(item?.creado).format('DD-MM-YYYY')
|
|
|
),
|
|
),
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -175,12 +178,12 @@ const EventosListado = () => {
|
|
|
const multipleButtonData = [
|
|
const multipleButtonData = [
|
|
|
{
|
|
{
|
|
|
text: "Agregar",
|
|
text: "Agregar",
|
|
|
- to: () => history.push(url+'/nuevo'),
|
|
|
|
|
|
|
+ to: () => history.push(url + '/nuevo'),
|
|
|
icon: <PlusCircleOutlined />,
|
|
icon: <PlusCircleOutlined />,
|
|
|
props: { disabled: false, type: 'primary', }
|
|
props: { disabled: false, type: 'primary', }
|
|
|
- },
|
|
|
|
|
|
|
+ },
|
|
|
];
|
|
];
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
const ModalProcesar = () => {
|
|
const ModalProcesar = () => {
|
|
|
return (
|
|
return (
|
|
|
<Modal
|
|
<Modal
|
|
@@ -219,7 +222,15 @@ const EventosListado = () => {
|
|
|
|
|
|
|
|
const TablaGrupos = () => {
|
|
const TablaGrupos = () => {
|
|
|
return (
|
|
return (
|
|
|
- <Table
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Tabla
|
|
|
|
|
+ nameURL={'v1/evento/por-grupo'}
|
|
|
|
|
+ columns={columnasGrupos}
|
|
|
|
|
+ extraParams={{ q: searchInput }}
|
|
|
|
|
+ order={'creado-desc'}
|
|
|
|
|
+ scroll={{ x: "30vw" }}
|
|
|
|
|
+ />
|
|
|
|
|
+ {/* <Table
|
|
|
dataSource={searchInput.length > 1 ? filteredResults : grupoEventos}
|
|
dataSource={searchInput.length > 1 ? filteredResults : grupoEventos}
|
|
|
rowKey={"id"}
|
|
rowKey={"id"}
|
|
|
columns={columnasGrupos}
|
|
columns={columnasGrupos}
|
|
@@ -235,41 +246,51 @@ const EventosListado = () => {
|
|
|
setEventosPorPagina(pageSize)
|
|
setEventosPorPagina(pageSize)
|
|
|
}
|
|
}
|
|
|
}}
|
|
}}
|
|
|
- />
|
|
|
|
|
|
|
+ /> */}
|
|
|
|
|
+ </>
|
|
|
)
|
|
)
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const TablaEventos = () => {
|
|
const TablaEventos = () => {
|
|
|
return (
|
|
return (
|
|
|
- <Table
|
|
|
|
|
|
|
+ <>
|
|
|
|
|
+ <Tabla
|
|
|
|
|
+ nameURL={'v1/evento'}
|
|
|
|
|
+ columns={columnasEventos}
|
|
|
|
|
+ extraParams={{ q: searchInput }}
|
|
|
|
|
+ order={'creado-desc'}
|
|
|
|
|
+ scroll={{ x: "30vw" }}
|
|
|
|
|
+ />
|
|
|
|
|
+ {/* <Table
|
|
|
dataSource={searchInput.length > 1 ? filteredResults : eventos}
|
|
dataSource={searchInput.length > 1 ? filteredResults : eventos}
|
|
|
rowKey={"id"}
|
|
rowKey={"id"}
|
|
|
columns={columnasEventos}
|
|
columns={columnasEventos}
|
|
|
size='small'
|
|
size='small'
|
|
|
scroll={{ x: 700 }}
|
|
scroll={{ x: 700 }}
|
|
|
- pagination={{
|
|
|
|
|
|
|
+ pagination={{
|
|
|
current: currentPage,
|
|
current: currentPage,
|
|
|
- defaultPageSize: eventosPorPagina,
|
|
|
|
|
- showSizeChanger: true,
|
|
|
|
|
|
|
+ defaultPageSize: eventosPorPagina,
|
|
|
|
|
+ showSizeChanger: true,
|
|
|
pageSizeOptions: pageSizeOptions,
|
|
pageSizeOptions: pageSizeOptions,
|
|
|
onChange: (page, pageSize) => {
|
|
onChange: (page, pageSize) => {
|
|
|
setCurrentPage(page)
|
|
setCurrentPage(page)
|
|
|
setEventosPorPagina(pageSize)
|
|
setEventosPorPagina(pageSize)
|
|
|
}
|
|
}
|
|
|
}}
|
|
}}
|
|
|
- />
|
|
|
|
|
|
|
+ /> */}
|
|
|
|
|
+ </>
|
|
|
)
|
|
)
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
- function b64_to_utf8( str ) {
|
|
|
|
|
- return decodeURIComponent(escape(window.atob( str )));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ function b64_to_utf8(str) {
|
|
|
|
|
+ return decodeURIComponent(escape(window.atob(str)));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const guardarRegistro = async () => {
|
|
const guardarRegistro = async () => {
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
const json = JSON.parse(textAreaData);
|
|
const json = JSON.parse(textAreaData);
|
|
|
- const accion = b64_to_utf8(json.accion).split(".");
|
|
|
|
|
|
|
+ const accion = b64_to_utf8(json.accion).split(".");
|
|
|
const lista = json[json.tipo][accion[0]];
|
|
const lista = json[json.tipo][accion[0]];
|
|
|
|
|
|
|
|
const body = {
|
|
const body = {
|
|
@@ -296,30 +317,30 @@ const EventosListado = () => {
|
|
|
const usuarios = await obtenerUsuariosGrupo();
|
|
const usuarios = await obtenerUsuariosGrupo();
|
|
|
|
|
|
|
|
const json = JSON.parse(textAreaData);
|
|
const json = JSON.parse(textAreaData);
|
|
|
- const accion = b64_to_utf8(json.accion).split(".");
|
|
|
|
|
|
|
+ const accion = b64_to_utf8(json.accion).split(".");
|
|
|
const lista = json[json.tipo][accion[0]];
|
|
const lista = json[json.tipo][accion[0]];
|
|
|
|
|
|
|
|
- if( json?.tipo !== evento?.redSocial?.toLowerCase() ) {
|
|
|
|
|
|
|
+ if (json?.tipo !== evento?.redSocial?.toLowerCase()) {
|
|
|
message.warning({
|
|
message.warning({
|
|
|
content: 'La red social es incorrecta',
|
|
content: 'La red social es incorrecta',
|
|
|
});
|
|
});
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let resultado = {...evento.resultado};
|
|
|
|
|
- for( let u = 0; u < usuarios?.length; u++ ) {
|
|
|
|
|
|
|
+ let resultado = { ...evento.resultado };
|
|
|
|
|
+ for (let u = 0; u < usuarios?.length; u++) {
|
|
|
let usuarioTipo = usuarios[u][json.tipo]?.toLowerCase();
|
|
let usuarioTipo = usuarios[u][json.tipo]?.toLowerCase();
|
|
|
|
|
|
|
|
- if( resultado[usuarios[u]?.uid] === undefined ) {
|
|
|
|
|
|
|
+ if (resultado[usuarios[u]?.uid] === undefined) {
|
|
|
resultado[usuarios[u]?.uid] = [];
|
|
resultado[usuarios[u]?.uid] = [];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if( usuarioTipo?.toLowerCase() ) {
|
|
|
|
|
- for( let i = 0; i < lista.length; i++ ) {
|
|
|
|
|
|
|
+ if (usuarioTipo?.toLowerCase()) {
|
|
|
|
|
+ for (let i = 0; i < lista.length; i++) {
|
|
|
const nick = lista[i]?.replace("@", "").toLowerCase();
|
|
const nick = lista[i]?.replace("@", "").toLowerCase();
|
|
|
|
|
|
|
|
- if(nick?.includes(usuarios[u][json.tipo])) {
|
|
|
|
|
- if( !resultado[usuarios[u]?.uid].includes(accion[0]) ) {
|
|
|
|
|
|
|
+ if (nick?.includes(usuarios[u][json.tipo])) {
|
|
|
|
|
+ if (!resultado[usuarios[u]?.uid].includes(accion[0])) {
|
|
|
resultado[usuarios[u]?.uid].push(accion[0])
|
|
resultado[usuarios[u]?.uid].push(accion[0])
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -333,10 +354,10 @@ const EventosListado = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
await updateDoc(doc(firestore, "eventos", evento?.id), body);
|
|
await updateDoc(doc(firestore, "eventos", evento?.id), body);
|
|
|
- if(evento?.tag){
|
|
|
|
|
- history.push( url+'/resultado-grupo-evento?id='+evento?.id+"&tag="+evento?.tag);
|
|
|
|
|
- } else {
|
|
|
|
|
- history.push( url+'/resultado?id='+evento?.id);
|
|
|
|
|
|
|
+ if (evento?.tag) {
|
|
|
|
|
+ history.push(url + '/resultado-grupo-evento?id=' + evento?.id + "&tag=" + evento?.tag);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ history.push(url + '/resultado?id=' + evento?.id);
|
|
|
}
|
|
}
|
|
|
setVisible(false);
|
|
setVisible(false);
|
|
|
|
|
|
|
@@ -345,7 +366,7 @@ const EventosListado = () => {
|
|
|
message.warning({
|
|
message.warning({
|
|
|
content: 'Atención: hubo un problema al procesar la información',
|
|
content: 'Atención: hubo un problema al procesar la información',
|
|
|
});
|
|
});
|
|
|
- } finally {
|
|
|
|
|
|
|
+ } finally {
|
|
|
setProcesando(false);
|
|
setProcesando(false);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -357,7 +378,7 @@ const EventosListado = () => {
|
|
|
const _grupos = evento?.grupos;
|
|
const _grupos = evento?.grupos;
|
|
|
|
|
|
|
|
// Verificar que el evento no tenga grupos
|
|
// Verificar que el evento no tenga grupos
|
|
|
- if( _grupos?.length === 0 ) {
|
|
|
|
|
|
|
+ if (_grupos?.length === 0) {
|
|
|
message.warning({
|
|
message.warning({
|
|
|
content: 'Atención: el evento no tiene grupos.',
|
|
content: 'Atención: el evento no tiene grupos.',
|
|
|
});
|
|
});
|
|
@@ -365,27 +386,27 @@ const EventosListado = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
-
|
|
|
|
|
- const q = query(collection(firestore, "usuarios"), where('grupos', 'array-contains-any', _grupos ));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const q = query(collection(firestore, "usuarios"), where('grupos', 'array-contains-any', _grupos));
|
|
|
const querySnapshot = await getDocs(q);
|
|
const querySnapshot = await getDocs(q);
|
|
|
const docs = []
|
|
const docs = []
|
|
|
|
|
|
|
|
querySnapshot.forEach((doc) => {
|
|
querySnapshot.forEach((doc) => {
|
|
|
const data = doc.data();
|
|
const data = doc.data();
|
|
|
- if(data?.estatus) {
|
|
|
|
|
- docs.push({
|
|
|
|
|
- grupos: data?.grupos,
|
|
|
|
|
- facebook: data?.facebook?.toLowerCase().trim(),
|
|
|
|
|
- twitter: data?.twitter?.toLowerCase().trim(),
|
|
|
|
|
|
|
+ if (data?.estatus) {
|
|
|
|
|
+ docs.push({
|
|
|
|
|
+ grupos: data?.grupos,
|
|
|
|
|
+ facebook: data?.facebook?.toLowerCase().trim(),
|
|
|
|
|
+ twitter: data?.twitter?.toLowerCase().trim(),
|
|
|
instagram: data?.instagram?.toLowerCase().trim(),
|
|
instagram: data?.instagram?.toLowerCase().trim(),
|
|
|
- telefono: data?.telefono,
|
|
|
|
|
- nombre: data?.nombre,
|
|
|
|
|
|
|
+ telefono: data?.telefono,
|
|
|
|
|
+ nombre: data?.nombre,
|
|
|
uid: data?.uid,
|
|
uid: data?.uid,
|
|
|
- id:doc.id
|
|
|
|
|
|
|
+ id: doc.id
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return docs;
|
|
return docs;
|
|
|
|
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -395,7 +416,7 @@ const EventosListado = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const obtenerEnlaceYager = (item) => {
|
|
const obtenerEnlaceYager = (item) => {
|
|
|
- const url = REACT_APP_WEB_URL+'evento-laud?id='+item?.id;
|
|
|
|
|
|
|
+ const url = REACT_APP_WEB_URL + 'evento-laud?id=' + item?.id;
|
|
|
navigator.clipboard.writeText(url);
|
|
navigator.clipboard.writeText(url);
|
|
|
message.info({
|
|
message.info({
|
|
|
content: 'Se ha copiado el enlace al portapapeles.',
|
|
content: 'Se ha copiado el enlace al portapapeles.',
|
|
@@ -411,32 +432,44 @@ const EventosListado = () => {
|
|
|
content: '¿Seguro que desea eliminar este registro?',
|
|
content: '¿Seguro que desea eliminar este registro?',
|
|
|
onOk: async () => {
|
|
onOk: async () => {
|
|
|
try {
|
|
try {
|
|
|
- await updateDoc(doc(firestore, docs, item?.id), {estatus: false});
|
|
|
|
|
|
|
+ if (docs === "gruposEvento") {
|
|
|
|
|
+ // await updateDoc(doc(firestore, docs, item?.id), { estatus: false });
|
|
|
|
|
+ const res = await HttpService.post('v1/evento/eliminar-grupo', { tag: item?.tag });
|
|
|
|
|
+ respuestas(res);
|
|
|
|
|
+ if (res?.status === 200) {
|
|
|
|
|
+ window.location.reload(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (docs === 'evento') {
|
|
|
|
|
+ const res = await HttpService.post('v1/evento/eliminar', { id: item?.id });
|
|
|
|
|
+ respuestas(res);
|
|
|
|
|
+ if (res?.status === 200) {
|
|
|
|
|
+ window.location.reload(false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.log('error al eliminar: ', error);
|
|
console.log('error al eliminar: ', error);
|
|
|
- } finally {
|
|
|
|
|
- window.location.reload(false);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ } /* finally {
|
|
|
|
|
+ } */
|
|
|
},
|
|
},
|
|
|
- onCancel() {},
|
|
|
|
|
|
|
+ onCancel() { },
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const onSearch = (searchValue) => {
|
|
const onSearch = (searchValue) => {
|
|
|
setSearchInput(searchValue);
|
|
setSearchInput(searchValue);
|
|
|
- if( searchValue !== '' ){
|
|
|
|
|
|
|
+ if (searchValue !== '') {
|
|
|
const filteredData = eventos.filter((item) => {
|
|
const filteredData = eventos.filter((item) => {
|
|
|
return Object.values(item).join('').toLowerCase().includes(searchValue.toLowerCase());
|
|
return Object.values(item).join('').toLowerCase().includes(searchValue.toLowerCase());
|
|
|
})
|
|
})
|
|
|
setFilteredResults(filteredData);
|
|
setFilteredResults(filteredData);
|
|
|
- }else{
|
|
|
|
|
|
|
+ } else {
|
|
|
setFilteredResults(eventos)
|
|
setFilteredResults(eventos)
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const obtenerRegistrosFirebase = useCallback(async (coleccion) => {
|
|
|
|
|
|
|
+ const obtenerRegistrosFirebase = useCallback(async (coleccion) => {
|
|
|
|
|
|
|
|
- if(!coleccion) {
|
|
|
|
|
|
|
+ if (!coleccion) {
|
|
|
console.log('Se necesita coleccion');
|
|
console.log('Se necesita coleccion');
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
@@ -447,7 +480,7 @@ const EventosListado = () => {
|
|
|
const querySnapshot = await getDocs(q);
|
|
const querySnapshot = await getDocs(q);
|
|
|
const docs = [];
|
|
const docs = [];
|
|
|
querySnapshot.forEach((doc) => {
|
|
querySnapshot.forEach((doc) => {
|
|
|
- if( doc.data()?.estatus ) {
|
|
|
|
|
|
|
+ if (doc.data()?.estatus) {
|
|
|
docs.push({ ...doc.data(), id: doc.id });
|
|
docs.push({ ...doc.data(), id: doc.id });
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|