|
@@ -336,13 +336,14 @@ const EventoDetalleGrupo = () => {
|
|
|
try {
|
|
try {
|
|
|
setGuardando({ ...guardando, nuevo: true });
|
|
setGuardando({ ...guardando, nuevo: true });
|
|
|
const _usuarios = grupoEvento?.usuarios;
|
|
const _usuarios = grupoEvento?.usuarios;
|
|
|
- const _redesEvento = grupoEvento?.redes;
|
|
|
|
|
|
|
+ // const _redesEvento = grupoEvento?.redes;
|
|
|
|
|
+ const _redesEvento = models[0]?.urls;
|
|
|
const plantilla = "nuevo_evento";
|
|
const plantilla = "nuevo_evento";
|
|
|
|
|
|
|
|
- if (_usuarios?.length < 1) {
|
|
|
|
|
|
|
+ /* if (_usuarios?.length < 1) {
|
|
|
message.info("Este evento no ha sido procesado aún.");
|
|
message.info("Este evento no ha sido procesado aún.");
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
|
|
+ } */
|
|
|
|
|
|
|
|
const arrUsuarios = [];
|
|
const arrUsuarios = [];
|
|
|
|
|
|
|
@@ -355,6 +356,9 @@ const EventoDetalleGrupo = () => {
|
|
|
const eventoTw = _redesEvento.find((i) => i?.redSocial === "Twitter")
|
|
const eventoTw = _redesEvento.find((i) => i?.redSocial === "Twitter")
|
|
|
? true
|
|
? true
|
|
|
: false;
|
|
: false;
|
|
|
|
|
+ const eventoTt = _redesEvento.find((i) => i?.redSocial === "TikTok")
|
|
|
|
|
+ ? true
|
|
|
|
|
+ : false;
|
|
|
|
|
|
|
|
_usuarios?.forEach((u) => {
|
|
_usuarios?.forEach((u) => {
|
|
|
const uid = u?.uid;
|
|
const uid = u?.uid;
|
|
@@ -373,22 +377,24 @@ const EventoDetalleGrupo = () => {
|
|
|
fb: eventoFb && tieneFb,
|
|
fb: eventoFb && tieneFb,
|
|
|
ig: eventoIg && tieneIg,
|
|
ig: eventoIg && tieneIg,
|
|
|
tw: eventoTw && tieneTw,
|
|
tw: eventoTw && tieneTw,
|
|
|
|
|
+ tt: eventoTt /* && tieneTw */,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
arrUsuarios.push(usuario);
|
|
arrUsuarios.push(usuario);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const body = {
|
|
const body = {
|
|
|
- // idEvento: id,
|
|
|
|
|
|
|
+ id: models[0].id,
|
|
|
plantilla: plantilla,
|
|
plantilla: plantilla,
|
|
|
- titulo: grupoEvento?.nombre,
|
|
|
|
|
|
|
+ titulo: models?.[0]?.nombre,
|
|
|
estatus: "Nuevo",
|
|
estatus: "Nuevo",
|
|
|
enviado: null,
|
|
enviado: null,
|
|
|
fecha: new Date(),
|
|
fecha: new Date(),
|
|
|
- urlFB: `${REACT_APP_WEB_URL}evento-laud?id=${eventos?.find((e) => e.redSocial === "Facebook")?.id}`,
|
|
|
|
|
- urlIG: `${REACT_APP_WEB_URL}evento-laud?id=${eventos?.find((e) => e.redSocial === "Instagram")?.id}`,
|
|
|
|
|
- urlTW: `${REACT_APP_WEB_URL}evento-laud?id=${eventos?.find((e) => e.redSocial === "Twitter")?.id}`,
|
|
|
|
|
- usuarios: arrUsuarios,
|
|
|
|
|
|
|
+ url: _redesEvento.map((e) => `${REACT_APP_WEB_URL}evento-laud?id=${models[0]?.id}&k=${e?.key}`),
|
|
|
|
|
+ // urlFB: `${REACT_APP_WEB_URL}evento-laud?id=${eventos?.find((e) => e.redSocial === "Facebook")?.id}`,
|
|
|
|
|
+ // urlIG: `${REACT_APP_WEB_URL}evento-laud?id=${eventos?.find((e) => e.redSocial === "Instagram")?.id}`,
|
|
|
|
|
+ // urlTW: `${REACT_APP_WEB_URL}evento-laud?id=${eventos?.find((e) => e.redSocial === "Twitter")?.id}`,
|
|
|
|
|
+ // usuarios: arrUsuarios,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
if (!eventoFb) {
|
|
if (!eventoFb) {
|
|
@@ -420,8 +426,11 @@ const EventoDetalleGrupo = () => {
|
|
|
return;
|
|
return;
|
|
|
} */
|
|
} */
|
|
|
|
|
|
|
|
- await addDoc(collection(firestore, "notificaciones"), body);
|
|
|
|
|
- message.success("Recordatorio enviado.");
|
|
|
|
|
|
|
+ // await addDoc(collection(firestore, "notificaciones"), body);
|
|
|
|
|
+ const res = await HttpService.post('v1/evento/notificar', body);
|
|
|
|
|
+ if (res?.status === 200) {
|
|
|
|
|
+ message.success("Recordatorio enviado.");
|
|
|
|
|
+ }
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
message.error("Error al enviar la notificacion");
|
|
message.error("Error al enviar la notificacion");
|
|
|
console.log("error al notificar: ", error);
|
|
console.log("error al notificar: ", error);
|