|
@@ -18,14 +18,16 @@ import {
|
|
|
DeliveredProcedureOutlined,
|
|
DeliveredProcedureOutlined,
|
|
|
BarChartOutlined,
|
|
BarChartOutlined,
|
|
|
BellFilled,
|
|
BellFilled,
|
|
|
|
|
+ // PlusCircleOutlined,
|
|
|
|
|
+ SaveOutlined,
|
|
|
} from "@ant-design/icons";
|
|
} from "@ant-design/icons";
|
|
|
import { useHistory } from "react-router-dom";
|
|
import { useHistory } from "react-router-dom";
|
|
|
import {
|
|
import {
|
|
|
addDoc,
|
|
addDoc,
|
|
|
collection,
|
|
collection,
|
|
|
- doc,
|
|
|
|
|
- getDoc,
|
|
|
|
|
- updateDoc,
|
|
|
|
|
|
|
+ // doc,
|
|
|
|
|
+ // getDoc,
|
|
|
|
|
+ // updateDoc,
|
|
|
query as firebaseQuery,
|
|
query as firebaseQuery,
|
|
|
getDocs,
|
|
getDocs,
|
|
|
where,
|
|
where,
|
|
@@ -75,6 +77,7 @@ const EventoDetalleGrupo = () => {
|
|
|
felicitacion: false,
|
|
felicitacion: false,
|
|
|
condensado: false,
|
|
condensado: false,
|
|
|
});
|
|
});
|
|
|
|
|
+ const [editandoRed, setEditandoRed] = useState(null);
|
|
|
|
|
|
|
|
const [request, setRequest] = useState(emptyRequest);
|
|
const [request, setRequest] = useState(emptyRequest);
|
|
|
|
|
|
|
@@ -89,7 +92,7 @@ const EventoDetalleGrupo = () => {
|
|
|
}), [requestExtraParams])
|
|
}), [requestExtraParams])
|
|
|
|
|
|
|
|
const [
|
|
const [
|
|
|
- models, modelsLoading, , , ,
|
|
|
|
|
|
|
+ models, modelsLoading, , , refreshModels,
|
|
|
] = useModels(request);
|
|
] = useModels(request);
|
|
|
|
|
|
|
|
const acciones = [
|
|
const acciones = [
|
|
@@ -98,6 +101,16 @@ const EventoDetalleGrupo = () => {
|
|
|
{ id: 2, value: "Compartir", label: "Compartir", icon: "🔄" },
|
|
{ id: 2, value: "Compartir", label: "Compartir", icon: "🔄" },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ const redesSociales = [
|
|
|
|
|
+ "Facebook",
|
|
|
|
|
+ "Twitter",
|
|
|
|
|
+ "Instagram",
|
|
|
|
|
+ "Whatsapp",
|
|
|
|
|
+ "YouTube",
|
|
|
|
|
+ "TikTok",
|
|
|
|
|
+ "Otro",
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
const buttons = [
|
|
const buttons = [
|
|
|
{
|
|
{
|
|
|
text: "Notificar nuevo evento",
|
|
text: "Notificar nuevo evento",
|
|
@@ -145,7 +158,7 @@ const EventoDetalleGrupo = () => {
|
|
|
return decodeURIComponent(escape(window.atob(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(".");
|
|
@@ -167,14 +180,15 @@ const EventoDetalleGrupo = () => {
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.log("error al guardar registro: ", error);
|
|
console.log("error al guardar registro: ", error);
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ }; */
|
|
|
|
|
|
|
|
const procesarUsuarios = async () => {
|
|
const procesarUsuarios = async () => {
|
|
|
try {
|
|
try {
|
|
|
setProcesando(true);
|
|
setProcesando(true);
|
|
|
// let usuarios = evento?.grupos.map((g) => g?.usuarios?.map((u) => u));
|
|
// let usuarios = evento?.grupos.map((g) => g?.usuarios?.map((u) => u));
|
|
|
let usuarios = [];
|
|
let usuarios = [];
|
|
|
- evento?.grupos.forEach((g) => {
|
|
|
|
|
|
|
+ // evento?.grupos.forEach((g) => {
|
|
|
|
|
+ models[0]?.grupos.forEach((g) => {
|
|
|
let _usrs = g?.usuarios;
|
|
let _usrs = g?.usuarios;
|
|
|
|
|
|
|
|
if (_usrs?.length > 0) {
|
|
if (_usrs?.length > 0) {
|
|
@@ -235,7 +249,7 @@ const EventoDetalleGrupo = () => {
|
|
|
*/
|
|
*/
|
|
|
let body = {
|
|
let body = {
|
|
|
// usuarios,
|
|
// usuarios,
|
|
|
- id: evento.id,
|
|
|
|
|
|
|
+ id: models[0].id,
|
|
|
resultado,
|
|
resultado,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -311,7 +325,7 @@ const EventoDetalleGrupo = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const obtenerEnlaceYager = (e) => {
|
|
const obtenerEnlaceYager = (e) => {
|
|
|
- const url = REACT_APP_WEB_URL + "evento-laud?id=" + e?.id;
|
|
|
|
|
|
|
+ const url = `${REACT_APP_WEB_URL}evento-laud?id=${models[0]?.id}&k=${e.key}`;
|
|
|
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.",
|
|
@@ -851,6 +865,63 @@ const EventoDetalleGrupo = () => {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ const leerLink = (evento) => {
|
|
|
|
|
+ let link = evento?.target?.value;
|
|
|
|
|
+ const facebook =
|
|
|
|
|
+ /https?:\/\/(www\.)?facebook\.com\/[a-zA-Z0-9.-]+\/?/ ||
|
|
|
|
|
+ /https?:\/\/(www\.)?fb\.com\/[a-zA-Z0-9.-]+\/?/;
|
|
|
|
|
+ const x = /https?:\/\/(www\.)?x\.com\/[a-zA-Z0-9.-]+\/?/;
|
|
|
|
|
+ const instagram = /https?:\/\/(www\.)?instagram\.com\/[a-zA-Z0-9.-]+\/?/;
|
|
|
|
|
+ const whatsapp = /https?:\/\/(www\.)?wa\.me\/[a-zA-Z0-9.-]+\/?/;
|
|
|
|
|
+ const youtube = /https?:\/\/(www\.)?youtube\.com\/[a-zA-Z0-9.-]+\/?/g;
|
|
|
|
|
+ const ytShort = /https?:\/\/(www\.)?youtu\.be\/[a-zA-Z0-9.-]+\/?/g;
|
|
|
|
|
+ const tiktok = /https?:\/\/(?:www\.)?tiktok\.com\/.*?/g;
|
|
|
|
|
+
|
|
|
|
|
+ if (facebook.test(link)) {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "Facebook" });
|
|
|
|
|
+ } else if (x.test(link)) {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "Twitter" });
|
|
|
|
|
+ } else if (instagram.test(link)) {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "Instagram" });
|
|
|
|
|
+ } else if (whatsapp.test(link)) {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "Whatsapp" });
|
|
|
|
|
+ } else if (youtube.test(link) || ytShort.test(link)) {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "YouTube" });
|
|
|
|
|
+ } else if (tiktok.test(link)) {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "TikTok" });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ form.setFieldsValue({ redSocial: "Otro" });
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const guardarRedSocial = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ debugger
|
|
|
|
|
+ const { url, redSocial, etiqueta } = form.getFieldsValue(true);
|
|
|
|
|
+ let _redes = models[0]?.urls;
|
|
|
|
|
+ const editado = _redes.find((r) => r.key === editandoRed.key);
|
|
|
|
|
+ const index = _redes.indexOf(editado);
|
|
|
|
|
+
|
|
|
|
|
+ const edit = {
|
|
|
|
|
+ key: editandoRed.key,
|
|
|
|
|
+ url,
|
|
|
|
|
+ redSocial,
|
|
|
|
|
+ etiqueta
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _redes.splice(index, 1, edit);
|
|
|
|
|
+
|
|
|
|
|
+ const res = await HttpService.post('v1/evento/editar-redes', { id: models[0]?.id, urls: _redes });
|
|
|
|
|
+ respuestas(res);
|
|
|
|
|
+ if (res?.status === 200) {
|
|
|
|
|
+ setEditandoRed(null);
|
|
|
|
|
+ refreshModels();
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
setRequest(requestParams);
|
|
setRequest(requestParams);
|
|
|
return () => setRequest(emptyRequest);
|
|
return () => setRequest(emptyRequest);
|
|
@@ -942,7 +1013,7 @@ const EventoDetalleGrupo = () => {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
procesarUsuarios();
|
|
procesarUsuarios();
|
|
|
- guardarRegistro();
|
|
|
|
|
|
|
+ // guardarRegistro();
|
|
|
}}
|
|
}}
|
|
|
onCancel={() => {
|
|
onCancel={() => {
|
|
|
setVisible(false);
|
|
setVisible(false);
|
|
@@ -1152,9 +1223,72 @@ const EventoDetalleGrupo = () => {
|
|
|
</Col>
|
|
</Col>
|
|
|
</Row>
|
|
</Row>
|
|
|
|
|
|
|
|
|
|
+ {editandoRed !== null && (
|
|
|
|
|
+ <Row gutter={10}>
|
|
|
|
|
+ <Col
|
|
|
|
|
+ className="gutter-row"
|
|
|
|
|
+ xs={{ span: 24 }}
|
|
|
|
|
+ sm={{ span: 24 }}
|
|
|
|
|
+ md={{ span: 12 }}
|
|
|
|
|
+ lg={{ span: 12 }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Form.Item label="URL" name="url">
|
|
|
|
|
+ <Input onChange={(v) => leerLink(v)} />
|
|
|
|
|
+ </Form.Item>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+
|
|
|
|
|
+ <Col
|
|
|
|
|
+ className="gutter-row"
|
|
|
|
|
+ xs={{ span: 24 }}
|
|
|
|
|
+ sm={{ span: 24 }}
|
|
|
|
|
+ md={{ span: 5 }}
|
|
|
|
|
+ lg={{ span: 5 }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Form.Item label="Red social" name="redSocial">
|
|
|
|
|
+ <Select style={{ width: "100%" }} placeholder="Selecciona">
|
|
|
|
|
+ {redesSociales?.map((item) => (
|
|
|
|
|
+ <Option key={item} value={item}>
|
|
|
|
|
+ {item === "Twitter" ? "X" : item}
|
|
|
|
|
+ </Option>
|
|
|
|
|
+ ))}
|
|
|
|
|
+ </Select>
|
|
|
|
|
+ </Form.Item>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+
|
|
|
|
|
+ <Col
|
|
|
|
|
+ className="gutter-row"
|
|
|
|
|
+ xs={{ span: 24 }}
|
|
|
|
|
+ sm={{ span: 24 }}
|
|
|
|
|
+ md={{ span: 5 }}
|
|
|
|
|
+ lg={{ span: 5 }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Form.Item label="Etiqueta" name="etiqueta">
|
|
|
|
|
+ <Input />
|
|
|
|
|
+ </Form.Item>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+
|
|
|
|
|
+ <Col
|
|
|
|
|
+ className="gutter-row"
|
|
|
|
|
+ xs={{ span: 24 }}
|
|
|
|
|
+ sm={{ span: 24 }}
|
|
|
|
|
+ md={{ span: 2 }}
|
|
|
|
|
+ lg={{ span: 2 }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <Form.Item label=" ">
|
|
|
|
|
+ <Button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ icon={<SaveOutlined />}
|
|
|
|
|
+ block
|
|
|
|
|
+ onClick={guardarRedSocial}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Form.Item>
|
|
|
|
|
+ </Col>
|
|
|
|
|
+ </Row>
|
|
|
|
|
+ )}
|
|
|
|
|
+
|
|
|
{/* Redes sociales */}
|
|
{/* Redes sociales */}
|
|
|
<Row gutter={10}>
|
|
<Row gutter={10}>
|
|
|
- {eventos.map((e, index) => (
|
|
|
|
|
|
|
+ {models[0]?.urls.map((e, index) => (
|
|
|
<Col
|
|
<Col
|
|
|
key={`evento-${index}`}
|
|
key={`evento-${index}`}
|
|
|
xs={{ span: 24 }}
|
|
xs={{ span: 24 }}
|
|
@@ -1179,11 +1313,13 @@ const EventoDetalleGrupo = () => {
|
|
|
</Button>,
|
|
</Button>,
|
|
|
<Button
|
|
<Button
|
|
|
type="text"
|
|
type="text"
|
|
|
- onClick={() =>
|
|
|
|
|
- history.push(
|
|
|
|
|
- urlweb + "/detalle?id=" + e?.id + "&tag=" + e?.tag,
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ onClick={() => {
|
|
|
|
|
+ setEditandoRed(e);
|
|
|
|
|
+ form.setFieldsValue({ ...e });
|
|
|
|
|
+ // history.push(
|
|
|
|
|
+ // urlweb + "/detalle?id=" + e?.id + "&tag=" + e?.tag,
|
|
|
|
|
+ // )
|
|
|
|
|
+ }}
|
|
|
icon={<EditOutlined />}
|
|
icon={<EditOutlined />}
|
|
|
>
|
|
>
|
|
|
Editar
|
|
Editar
|