<?php
namespace App\Services;
use App\Entity\ComCargarOficioAutorizacion;
use App\Entity\ComProspecto;
use Doctrine\ORM\EntityManagerInterface;
use DoctrineExtensions\Query\Mysql\Date;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\RouterInterface;
use Twig\Environment;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
class MailerCore
{
private $em = null;
private $request = null;
private $kernel;
// private $template;
// private $router;
private $mailer;
private $transport;
private $config = ['subject' => '', 'text' => '', 'atachment' => [], 'to' => '', 'cc' => [], 'template' => '', 'extras' => []];
private $baseRoute;
public function __construct(EntityManagerInterface $entityManager, RequestStack $requestStack, KernelInterface $kernel, MailerInterface $mailer, \Symfony\Component\Mailer\Transport\TransportInterface $transportInterface)
{
$this->em = $entityManager;
$this->request = $requestStack;
// this->template = $templating; Environment $templating, RouterInterface $router,
//$this->router = $router;
$this->kernel = $kernel;
$this->mailer = $mailer;
$this->transport = $transportInterface;
$this->baseRoute = $kernel->getProjectDir() . '/public_html/';
}
private function send()
{
try {
if (filter_var($this->config['to'], FILTER_VALIDATE_EMAIL)) {
$email = (new TemplatedEmail())
->to($this->config['to'])
->subject($this->config['subject'])
->htmlTemplate("mailing/{$this->config['template']}")
->context([
'titulo' => $this->config['subject'],
'entity' => $this->config['entity'],
'extras' => $this->config['extras']
]);
// Return-Path
$email->returnPath('notificaciones@it-systems.com.co');
// Copias
if (!empty($this->config['cc'])) {
foreach ($this->config['cc'] as $copia) {
if (filter_var($copia, FILTER_VALIDATE_EMAIL)) {
$email->addCc($copia);
}
}
}
// Adjuntos
if (!empty($this->config['atachment'])) {
foreach ($this->config['atachment'] as $file) {
// 🟢 Caso 1: archivo binario (PDF generado en caliente)
if (is_array($file) && isset($file['contenido'])) {
$email->attach(
base64_decode($file['contenido']), // 👈 decodificar antes de adjuntar
$file['nombre'] ?? 'archivo.pdf',
$file['mime'] ?? 'application/pdf'
);
}
// 🟢 Caso 2: ruta relativa (archivo físico en public_html)
else {
dump($file);
$rutaCompleta = $this->baseRoute . $file;
if (file_exists($rutaCompleta)) {
$email->attachFromPath($rutaCompleta);
} else {
// Loguear advertencia (útil en debug)
// logger opcional: $this->logger?->warning("Archivo no encontrado: {$rutaCompleta}");
}
}
}
}
// Enviar correo
$sentMessage = $this->transport->send($email);
return [
'message_id' => $sentMessage->getMessageId(),
'status' => 'sent',
'to' => $this->config['to']
];
}
} catch (TransportExceptionInterface $e) {
return [
'status' => 'error',
'to' => $this->config['to'],
'error' => $e->getMessage()
];
}
return [
'status' => 'invalid_email',
'to' => $this->config['to'],
'error' => 'Invalid email address'
];
}
public function notificarUsuario($tipo, $usuario = [], $cc = [],$idPerfil = null)
{
$template = "";
$subject = "";
// Validar el id del perfil
$this->config['extras'] = [
'id' => $idPerfil
];
switch ($tipo) {
case 'requestPassword':
$subject = "Solicitud Cambio Contraseña";
$template = "requestPassword.html.twig";
break;
case 'confirmChange':
$subject = "Contraseña Actualizada";
$template = "confirmChangePassword.html.twig";
break;
case 'updateInfo':
$subject = "Actualizar Datos Personales";
$template = "actualizarInformacionUsuario.html.twig";
break;
case 'solicitaCarnet':
$subject = "Solicitud Carnetizacion";
$template = "notificarCarnetizacion.html.twig";
break;
case 'controlInstalaciones':
$documento = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(16);
$subject = "Solicitud Control Instalaciones";
$template = "solicitarControlInst.html.twig";
$this->config['atachment'] = ['documento' => "Repository/GHDocumentos/{$documento->getArchivo()}"];
break;
case 'solicitudAccesos':
$documento = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(16);
$subject = "Solicitud Accesos";
$template = "solicitarAccesos.html.twig";
//$this->config['atachment'] = ["Repository/GHDocumentos/{$documento->getArchivo()}"];
break;
}
$this->config['subject'] = $subject;
$this->config['template'] = $template;
$this->config['cc'] = $cc;
foreach ($usuario as $u) {
$this->config['entity'] = $u;
$this->config['to'] = $u->getEmail();
$this->send();
}
}
public function notificarVacante($tipo, $vacante = [], $cc = [])
{
$template = "";
$subject = "";
foreach ($vacante as $v) {
switch ($tipo) {
case 'notificar':
$subject = "Creación Vacante {$v->getPerfilCargo()->getCargo()}, {$v->getFecha()->format('Y-m-d')} ";
$template = "notificarVacante.html.twig";
$this->config['to'] = $v->getPersonaSolicita()->getEmail();
break;
case 'gestionar':
$subject = "Solicitud Aprobación Vacante {$v->getPerfilCargo()->getCargo()->getNombre()}";
$template = "gestionarVacante.html.twig";
$emailPersona = $v->getPerfilCargo()?->getCargoAprueba()?->getEmail() ?? 'gestion.humana@logisticazf.com.co';
$this->config['to'] = $emailPersona;
break;
case 'rechazar':
$subject = "Notificación de Rechazo Vacante {$v->getPerfilCargo()->getCargo()}, {$v->getFecha()->format('Y-m-d')}";
$template = "rechazarVacante.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
break;
case 'reaperturar':
$fechaCreacion = $v->getFecha() ? $v->getFecha()->format('Y-m-d') : 'N/A';
$subject = "Reapertura Vacante {$v->getPerfilCargo()->getCargo()} {$fechaCreacion}";
$template = "reaperturarVacante.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
break;
}
$this->config['entity'] = $v;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
$this->config['cc'] = $cc;
$this->send();
}
}
public function notificarAspirante($tipo, $aspirante = [], $cc = [])
{
$template = "";
$subject = "";
$docHabeasData = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(5);
switch ($tipo) {
case 'notificar':
if (!empty($aspirante)) {
$vacante = $aspirante [0]->getVacante();
$cargo = $vacante->getPerfilCargo()->getCargo();
$subject = " Participación Proceso Selección - " . $cargo;
$template = "notificarAspirante.html.twig";
$this->config['atachment'] = ['habeas_data' => "Repository/DocDocumento/{$docHabeasData->getArchivo()}"];
break;
}
case 'rechazo':
if (!empty($aspirante)) {
$vacante = $aspirante [0]->getVacante();
$cargo = $vacante->getPerfilCargo()->getCargo();
$subject = "Participación Proceso Selección - " . $cargo;
$template = "notificarAspiranteRechazo.html.twig";
array_push($cc, 'gestion.humana@logisticazf.com.co');
}
break;
}
$this->config['subject'] = $subject;
$this->config['template'] = $template;
$this->config['cc'] = $cc;
foreach ($aspirante as $a) {
$this->config['entity'] = $a;
$this->config['to'] = $a->getCorreoElectronico(); // o $a->getEmail() según tu entidad
// Asegúrate de no duplicar el correo en cc
if (!in_array('gestion.humana@logisticazf.com.co', $cc)) {
$cc[] = 'gestion.humana@logisticazf.com.co';
}
$this->config['cc'] = $cc;
$this->send();
}
//foreach ($aspirante as $a) {
// $this->config['entity'] = $a;
// $this->config['to'] = 'gestion.humana@logisticazf.com.co';
// $this->send();
//}
}
public function notificarPruebaTecnica($tipo, $pruebaTec = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($pruebaTec as $pt) {
$this->config['entity'] = $pt;
switch ($tipo) {
case 'notificar':
$subject = "Prueba Técnica {$pt->getCandidato()->getNombres()}";
$template = "notificarPruTec.html.twig";
if ($pt->getResponsablePrueba() == 'GH') {
$this->config['atachment'][] = "Repository/GHPruebasTecnicas/{$pt->getArchivo()}";
} elseif ($pt->getResponsablePrueba() == 'JD') {
$this->config['atachment'][] = "Repository/GHPerfilCargo/{$pt->getCandidato()->getVacante()->getPerfilCargo()->getArchivo()}";
}
$this->config['to'] = $pt->getCandidato()->getVacante()->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$subject = "Notificación Aspirante";
$template = "notificarAspiranteRechazo.html.twig";
$this->config['to'] = $pt->getCandidato()->getVacante()->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function periodoPrueba($tipo, $periodoPrueba = [], $cc = [],$archivosAdjuntos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($periodoPrueba as $pp) {
$this->config['entity'] = $pp;
switch ($tipo) {
case 'notificacionRetraso':
$subject = "Vence Periodo de Prueba {$pp->getPersona()->getNombres()}";
$template = "periodoPruebaNotificacionRetraso.html.twig";
$gh = 'gestion.humana@logisticazf.com.co';
$destinatarios = [$pp->getJefeInmediato()?->getEmail() ?? 'na@gmail.com'];
$this->config['to'] = $gh;
$this->config['cc'] = $destinatarios;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacion':
$subject = "Periodo de Prueba {$pp->getPersona()->getNombres()}";
$template = "periodoPruebaNotificacion.html.twig";
$gh = 'gestion.humana@logisticazf.com.co';
// $destinatarios = [$gh, $pp->getJefeInmediato()?->getEmail() ?? 'na@gmail.com'];
$this->config['to'] = $gh;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$subject = "Desvinculación {$pp->getPersona()->getNombres()}";
$template = "periodoPruebaRechazo.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// $this->config['atachment'] = ['carta_periodo_prueba' => "Repository/GHPeriodoPrueba/{$pp->getCarta()}"];
$this->config['atachment'] = $archivosAdjuntos; // Enviar pdfs en caliente
break;
}
return $this->send();
}
}
//notificacion Antecedenstes Retraso
public function contratacion($tipo, $contrato = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($contrato as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificacionRetrasos':
$this->config['subject'] = "Recordatorio: Verificación Anual de Antecedentes {$c->getCandidato()->getNombres()}";
$this->config['template'] = "notificarAntecedentesRetraso.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
break;
}
$this->send();
}
}
public function NotificarUser($tipo, $persona = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($persona as $p) {
$this->config['entity'] = $p;
switch ($tipo) {
case 'notificacionUltimoRegistro':
$this->config['subject'] = "Notificacion Anual: Actualizacion de Datos Personales " . $p->getNombres();
$this->config['template'] = "NotificacionUltimoRegistro.html.twig";
$correo = $p->getEmail();
$this->config['to'] = $correo;
break;
}
$this->send();
}
}
public function RecordatoriosDesvinculacion($tipo, $desvinculacion = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($desvinculacion as $d) {
$this->config['entity'] = $d;
switch ($tipo) {
case 'notificarRetraso2D':
$this->config['subject'] = "Recordatorio: Desvinculacion " . $d->getPersona()->getNombres();
$this->config['template'] = "notificacionRetraso2D.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
break;
case 'notificarRetraso3D':
$this->config['subject'] = "Recordatorio: Desvinculacion liquidacion " . $d->getPersona()->getNombres();
$this->config['template'] = "notificacionRetraso3D.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
break;
}
$this->send();
}
}
public function notificarEntrevistaJefe($tipo, $entrevistaJefe = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entrevistaJefe as $ej) {
$this->config['entity'] = $ej;
switch ($tipo) {
case 'notificar':
$candidato = $ej->getCandidato();
$subject = "Programación Entrevista " . $candidato;
$template = "notificarEntJef.html.twig";
$this->config['to'] = $ej->getCandidato()->getCorreoElectronico();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$subject = "Notificación Aspirante";
$template = "notificarAspiranteRechazo.html.twig";
$this->config['to'] = $ej->getCandidato()->getVacante()->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function notificarExamenesMedicos($tipo, $examenes = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($examenes as $ex) {
$this->config['entity'] = $ex;
switch ($tipo) {
case 'notificar':
$candidato = $ex->getCandidato()->getNombres();
$cargo = $ex->getCandidato()->getVacante()->getPerfilCargo()->getCargo()->getNombre();
$subject = "Documentos Contratación $candidato - $cargo";
$template = "notificarExamenes.html.twig";
$this->config['atachment'] = ['carta_examenes' => "Repository/GHExamenes/{$ex->getCarta()}"];
$this->config['to'] = $ex->getCandidato()->getCorreoElectronico();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function notificarDotacion($tipo, $dotacion = [], $cc = [], $asunto = [])
{
$procesosConcatenados = "";
if(count($asunto) > 0)
foreach ($asunto as $as) {
$procesosConcatenados .= $as . ", "; // Concatenar los procesos del asunto
}
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = [
'procesos' => $procesosConcatenados,
];
foreach ($dotacion as $d) {
$this->config['entity'] = $d;
switch ($tipo) {
case 'notificar':
$candidato = $d->getCandidato()->getNombres();
$cargo = $d->getCandidato()->getVacante()->getPerfilCargo()->getCargo()->getNombre();
$subject = "Solicitud Asignación $candidato - $cargo";
$template = "notificarDotacion.html.twig";
$this->config['to'] = $cc[0];
// Eliminar el correo que ya se fue de principal
$correoEliminar = $cc[0];
$cc = array_filter($cc, function($c) use ($correoEliminar) {
return $c !== $correoEliminar;
});
$this->config['cc'] = $cc;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function notificarContratacion($tipo, $contratacion = [], $cc = [], $correoPa = null, $data = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($contratacion as $con) {
$this->config['entity'] = $con;
switch ($tipo) {
case 'notificar':
$cargo = $con->getVacante()->getPerfilCargo()->getCargo()->getNombre();
$subject = "Solicitud Aprobación Contratación {$cargo} {$data['fecha']}";
$template = "notificarContratacion.html.twig";
dump($correoPa);
$this->config['to'] = $correoPa;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'gestionar':
// $para = $con->getCandidato()->getCorreoElectronico();
// $otros = $con->getAprobador()->getEmail();
$candidato = $con->getCandidato()->getNombres();
$cargo = $con->getVacante()?->getPerfilCargo()?->getCargo()?->getNombre() ?? 'N/A';
$subject = "Contratación $cargo - $candidato";
$template = "gestionarContratacion.html.twig";
$this->config['to'] = $correoPa;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
public function induccion($tipo, $induccionProceso = [], $cc = [], $induccion = [], $empresaId = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$docHabeasData = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(5);
foreach ($induccionProceso as $ind) {
$this->config['entity'] = $ind;
switch ($tipo) {
case 'notificacion':
$subject = "Documentos Inducción";
$template = "induccionNotificar.html.twig";
if ($empresaId === 1 ) { // si la empresa es igual a 1 es Logistica
$this->config['atachment'] = [
'reglamento_interno_de_trabajo_logistica' => "Repository/GHInduccion/REGLAMENTO INTERNO LOGISTICA.pdf",
'codigo_de_etica_logistica' => "Repository/GHInduccion/CÓDIGO DE ÉTICA - LOG-SVF.pdf",
'politica_de_usuarios_informaticos_logistica' => "Repository/GHInduccion/POLÍTICA RECURSOS INFORMÁTICOS.pdf",
];
} elseif ($empresaId === 2 ) { // si la empresa es igual a 2 es Agencia
$this->config['atachment'] = [
'reglamento_interno_de_trabajo_agencia' => "Repository/GHInduccion/REGLAMENTO INTERNO DE TRABAJO AGENCIA.pdf",
'codigo_de_etica_agencia' => "Repository/GHInduccion/CÓDIGO DE ÉTICA.pdf",
'politica_de_usuarios_informaticos_agencia' => "Repository/GHInduccion/POLÍTICA RECURSOS INFORMÁTICOS.pdf",
];
} elseif ($empresaId === 3) { // si la empresa es igual a 2 es Servifranca
$this->config['atachment'] = [
'reglamento_interno_de_trabajo_servifranca' => "Repository/GHInduccion/REGLAMENTO INTERNO SERVIFRANCA.pdf",
'codigo_de_etica_servifranca' => "Repository/GHInduccion/CÓDIGO DE ÉTICA - LOG-SVF.pdf",
'politica_de_usuarios_informaticos_servifranca' => "Repository/GHInduccion/POLÍTICA RECURSOS INFORMÁTICOS.pdf",
];
}
$this->config['to'] = $ind->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'confirmar':
$subject = "Inducción Programada";
$template = "induccionConfirmar.html.twig";
foreach ($induccion as $i) {
$this->config['to'] = $i->getPersona()->getEmail();
}
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'resultado':
$subject = "Inducción {$ind->getInduccion()->getPersona()->getNombres()}";
$template = "induccionResultado.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function entrenamiento($tipo, $entrenamientoProceso = [], $cc = [], $entrenamiento = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$docHabeasData = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(5);
foreach ($entrenamientoProceso as $ind) {
$this->config['entity'] = $ind;
switch ($tipo) {
case 'notificacion':
$subject = "Entrenamiento {$ind->getProceso()->getNombre()} {$ind->getEntrenamiento()->getPersona()->getNombres()}";
$template = "entrenamientoNotificar.html.twig";
$this->config['to'] = $ind->getEntrenamiento()->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'resultado':
$subject = "Entrenamiento {$entrenamiento->getPersona()->getNombres()}";
$template = "entrenamientoConfirmar.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'entrenamiento' => $entrenamiento,
];
break;
case 'consolidado':
$subject = "Entrenamiento {$ind->getPersona()->getNombres()}";
$template = "entrenamientoConsolidado.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'entrenamiento' => $entrenamiento,
];
break;
}
$this->send();
}
}
public function examenPeriodico($tipo, $examenPeriodico = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($examenPeriodico as $ep) {
$this->config['entity'] = $ep;
switch ($tipo) {
case 'notificacion':
$subject = "Recomendaciones Medicas Examen {$ep->getTipoExamen()->getNombre()} {$ep->getFecha()->format('Y-m-d')}";
$template = "notificacionExamPeri.html.twig";
$this->config['to'] = $ep->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
if ($ep->getSoporte()) {
$this->config['atachment'] = ['evidencia_resultado' => "Repository/GHExamenPeriodico/{$ep->getSoporte()}"];
}
break;
case 'notificacionGerencia':
$subject = "Notificación Examen Periodico";
$template = "notificacionExamPeriGerente.html.twig";
$this->config['to'] = $ep->getColaboradorNotificacion()?->getEmail() ?? 'na@gmail.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'desvinculacion':
$subject = "Notificación Desvinculacion";
$template = "notificarExamPeriDesvinculacion.html.twig";
$this->config['to'] = $ep->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function visitaPeriodica($tipo, $visitaPeriodica = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($visitaPeriodica as $vp) {
$this->config['entity'] = $vp;
switch ($tipo) {
case 'rechazo':
$subject = "Validación Visita Domiciliaria {$vp->getPersona()->getNombres()}";
$template = "visPeriRechazo.html.twig";
$this->config['to'] = $vp->getColaboradorNotificacion()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'desvinculacion':
$subject = "Notificación Desvinculacion";
$template = "visPeriDesvinculacion.html.twig";
$this->config['to'] = $vp->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function procesoDisciplinario($tipo, $procesoDisciplinario = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($procesoDisciplinario as $pd) {
$this->config['entity'] = $pd;
switch ($tipo) {
case 'notificacion':
$subject = "Proceso Disciplinario {$pd->getPersona()->getNombres()}";
$template = "proDisciNotificar.html.twig";
$this->config['to'] = 'asoto@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'aprobacion':
$subject = "Proceso Disciplinario {$pd->getPersona()->getNombres()}";
$template = "proDisciAprobado.html.twig";
$this->config['to'] = $pd->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$subject = "Novedad Proceso Disciplinario {$pd->getPersona()->getNombres()}";
$template = "proDisciRechazo.html.twig";
$this->config['to'] = $pd->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionJuridica':
$subject = "Notificación Proceso Disciplinario";
$template = "proDisciNotificarJuridica.html.twig";
$this->config['atachment'] = ['acta_descargos' => "Repository/GHProcesoDisciplinario/{$pd->getActa()}"];
$this->config['to'] = $pd->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'cierre':
$subject = "Proceso Disciplinario {$pd->getPersona()->getNombres()}";
$template = "proDisciCierre.html.twig";
$this->config['to'] = $pd->getPersonaSolicita()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function novedadNomina($tipo, $novedadNomina = [], $cc = [], $personas = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = [
'personas' => $personas, # Para iterar
];
foreach ($novedadNomina as $nn) {
$this->config['entity'] = $nn;
switch ($tipo) {
case 'notificacion':
$subject = "Novedad Nomina {$nn->getPersona()->getNombres()} {$nn->getCreateAt()->format('Y-m-d')}"; // Enviar asunto con fecha de novedad
!
$template = "novedadNominaNotificar.html.twig";
$conceptos = $nn->getConceptoNomina();
foreach ($conceptos as $concepto) {
if ($concepto->getId() == 9) {
$this->config['to'] = 'abenitez@interlogisticazf.com';
$this->config['cc'] = ['acantor@interlogisticazf.com'];
} else {
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
}
}
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$subject = "Rechazo Novedad Nomina";
$template = "novedadNominaRechazo.html.twig";
$this->config['to'] = $nn->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'revision':
$solicitante = $nn->getPersona()->getNombres() ? $nn->getPersona()->getNombres() : 'N/A';
$conceptos = $nn->getConceptoNomina()->last() ? $nn->getConceptoNomina()->last()->getNombre() : 'N/A';
$this->config['extras'] = [
'concepto' => $conceptos,
];
$subject = "Revisión Novedad Nomina {$solicitante} {$nn->getCreateAt()->format('Y-m-d')}";
$template = "/GHNovedadNomina/revisionNoevdadNomina.html.twig";
$this->config['to'] = $nn->getPersonaSolicita() && $nn->getPersonaSolicita()->getEmail() ? $nn->getPersonaSolicita()->getEmail() : 'na@gmail.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'aprobacion':
$solicitante = $nn->getPersonaSolicita() ? $nn->getPersonaSolicita()->getEmail() : 'N/A';
$subject = "Aprobación Novedad Nomina";
$template = "novedadNominaAprobacion.html.twig";
$this->config['to'] = $solicitante;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionCargueMasivo':
$hoy = (new \DateTime())->format('Y-m-d'); # Validar el dia que se realizo la carga masiva
$subject = "Notificación Novedades Nomina (Cargue Masivo) {$hoy}";
$template = "/GHNovedadNomina/notificacionCargaMasiva.html.twig";
$this->config['to'] = "gestion.humana@logisticazf.com.co";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function retiroCesantias($tipo, $retiroCesantias = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($retiroCesantias as $rc) {
$this->config['entity'] = $rc;
switch ($tipo) {
case 'notificacion':
$subject = "Solicitud Retiro Cesantias {$rc->getPersona()->getNombres()}";
$template = "retiroCesantiasNotificar.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co'; //$nn->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$subject = "Novedad Retiro Cesantias {$rc->getPersona()->getNombres()}";
$template = "retiroCesantiasRechazo.html.twig";
$this->config['to'] = $rc->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'aprobacion':
$subject = "Aprobación Retiro Cesantias {$rc->getPersona()->getNombres()}";
$template = "retiroCesantiasAprobacion.html.twig";
// Validar que soporte tenga valor
if($rc->getSoporte())
$this->config['atachment'][] = "Repository/GHRetiroCesantias/{$rc->getSoporte()}";
$this->config['to'] = $rc->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function desvinculacion($tipo, $desvinculacion = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($desvinculacion as $d) {
$this->config['entity'] = $d;
switch ($tipo) {
case 'notificacion':
$subject = "Retiro de personal {$d->getPersona()->getNombres()}";
$template = "desvinculacionNotificar.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'confirmar':
$subject = "Retiro de personal {$d->getFechaDesvinculacion()->format('Y-m-d')} {$d->getPersona()->getNombres()}";
$template = "desvinculacionConfirmar.html.twig";
$this->config['to'] = 'coordinadores@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'iniciar':
$subject = "Información Desvinculación {$d->getPersona()->getNombres()}";
$template = "desvinculacionIniciar.html.twig";
$docEntregaCargo = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(17);
$docPazSalvo = $this->em->getRepository(\App\Entity\DocDocumento::class)->find(18);
// dump($docEntregaCargo->getArchivo());
$this->config['atachment'] = ['entrega_cargo' => "Repository/DocDocumento/{$docEntregaCargo->getArchivo()}", 'paz_salvo' => "Repository/DocDocumento/{$docPazSalvo->getArchivo()}"]; //, 'paz_salvo' => "Repository/DocDocumento/{$docPazSalvo->getArchivo()}"
$this->config['to'] = $d->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificarDestruccionDianCarnet':
$subject = "Desvinculación DIAN {$d->getPersona()}";
$template = "GHDesvinculacion/notificarDestruccionCarnetDian.html.twig";
// dump($docEntregaCargo->getArchivo());
$this->config['to'] = "gestion.humana@logisticazf.com.co";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'registroInicial':
$subject = "Proceso de Desvinculación";
$template = "desvinculacionRegistroDian.html.twig";
$this->config['to'] = $d->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificarLiquidacion':
$subject = "Liquidación {$d->getPersona()->getNombres()}";
$template = "desvinculacionLiquidacion.html.twig";
$this->config['to'] = 'ealvarez@logisticazf.com.co'; //$d->getPersona()->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificarLiquidacionRechazo':
$subject = "Liquidación {$d->getPersona()->getNombres()}";
$template = "desvinculacionLiquidacionRechazo.html.twig";
$this->config['to'] = 'acantor@linterogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificarPago':
$subject = "Solicitud Pago Liquidación {$d->getPersona()->getNombres()}";
$template = "desvinculacionLiquidacionPago.html.twig";
$this->config['to'] = 'gestion.humana@logisticazf.com.co';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
public function norma($tipo, $norma = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($norma as $n) {
$this->config['entity'] = $n;
switch ($tipo) {
case 'notificacion':
$usuarios = $this->em->getRepository(\App\Entity\TerPersona::class)->findBy(['estado' => 1]);
$destinatarios = [];
foreach ($usuarios as $u) {
$destinatarios[] = $u->getEmail();
}
$this->config['to'] = $destinatarios[0];
if (count($cc) == 0) {
$this->config['cc'] = $destinatarios;
}
$subject = "Notificación Normativa {$n->getConsNorma()}";
$template = "normaNotificar.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function JurProceso($tipo, $proceso = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($proceso as $p) {
$this->config['entity'] = $p;
switch ($tipo) {
case 'vencimiento':
// $usuarios = $this->em->getRepository(\App\Entity\TerPersona::class)->findBy(['estado' => 1]);
// $destinatarios = [];
// foreach ($usuarios as $u) {
$this->config['to'] = 'ccasstaneda@it-systems.com.co';
// $destinatarios[] = $u->getEmail();
// }
// $this->config['cc'] = $destinatarios;
$subject = "Notificación Vencimiento Proceso";
$template = "jurProcesoVencimiento.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function operacionSospechosa($tipo, $operacion = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($operacion as $os) {
$this->config['entity'] = $os;
switch ($tipo) {
case 'creacion':
$usuarioReporta = $this->em->getRepository(\App\Entity\TerPersona::class)->findOneBy(['numeroDocumento' => $os->getCreateUser()]);
// foreach ($usuarios as $u) {
$this->config['to'] = 'fcastiblanco@interlogisticazf.com';
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$this->config['extras'] = ['procesoSolicitante' => $usuarioReporta->getPerfilCargo()->getParProceso()->getNombre()];
$subject = "Operación Sospechosa {$usuarioReporta->getPerfilCargo()->getParProceso()->getNombre()}";
$template = "operacionSospechosaNueva.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacion':
//$usuarios = $this->em->getRepository(\App\Entity\TerPersona::class)->findBy(['estado' => 1]);
$destinatarios = ['nneuta@interlogisticazf.com', 'icuellar@interlogisticazf.com', 'ealvarez@logisticazf.com', 'fcastiblanco@interlogisticazf.com'];
// foreach ($usuarios as $u) {
$this->config['to'] = $destinatarios[0];
// $destinatarios[] = $u->getEmail();
// }
$this->config['cc'] = $destinatarios;
$subject = "Notificación Reporte UIAF";
$template = "operacionSospechosaNotificar.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function cambioContrato($tipo, $cambioContrato = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($cambioContrato as $ccon) {
$this->config['entity'] = $ccon;
switch ($tipo) {
case 'notificacion':
$destinatarios = [];
if ($ccon->getColaborador()->getPerfilCargo()) {
foreach ($ccon->getColaborador()->getPerfilCargo()->getPersona() as $usuario) {
if ($usuario->hasNivelDirector()) {
$destinatarios[] = $usuario->getEmail();
}
}
}
$this->config['to'] = 'icuellar@interlogisticazf.com';
$this->config['cc'] = ['nneuta@interlogisticazf.com'];
$subject = "Solicitud Cambio Condiciones {$ccon->getColaborador()->getNombres()}";
$template = "notificarCambioContrato.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionGH':
$this->config['to'] = "gestion.humana@logisticazf.com.co";
$currentDate = date("d/m/Y");
$subject = " Solicitud de Modificación Condiciones de Contrato {$ccon->getColaborador()->getNombres()} {$currentDate}";
$template = "notificarCambioContratoGH.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
$destinatarios = ['gestion.humana@logisticazf.com.co'];
$this->config['to'] = $ccon->getUsuarioSolicita()->getEmail();
$this->config['cc'] = $destinatarios;
$subject = "Rechazo Cambio Condiciones {$ccon->getColaborador()->getNombres()}";
$template = "rechazarCambioContrato.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function diligencia($tipo, $diligencia = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($diligencia as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificacion':
$destinatarios = [];
if ($entity->getPersonaSolicita()->getPerfilCargo()) {
foreach ($entity->getPersonaSolicita()->getPerfilCargo()->getPersona() as $usuario) {
if ($usuario->hasNivelDirector()) {
$destinatarios[] = $usuario->getEmail();
}
}
}
$this->config['to'] = count($destinatarios) > 0 ? $destinatarios[0] : $entity->getPersonaSolicita()->getEmail();
$this->config['cc'] = $destinatarios;
$subject = "Solicitud Autorización Diligencia {$entity->getfechaSolicitud()->format('Y-m-d')}";
$template = "notificarDiligencia.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'aprobar':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = $entity->getPersonaSolicita()->getEmail();
$destinatarios[] = 'mensajeria@interlogisticazf.com';
// }
$this->config['cc'] = $destinatarios;
$subject = "Solicitud Autorización Diligencia {$entity->getfechaDiligencia()->format('Y-m-d')}";
$template = "aprobarDiligencia.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = $entity->getPersonaSolicita()->getEmail();
$destinatarios[] = 'mensajeria@interlogisticazf.com';
// }
$this->config['cc'] = $destinatarios;
$subject = "Solicitud Autorización Diligencia {$entity->getfechaDiligencia()->format('Y-m-d')}";
$template = "rechazarDiligencia.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function envioCorrespondencia($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificacion':
$this->config['to'] = 'mensajeria@interlogisticazf.com';
$subject = "Solicitud Correspondencia {$entity->getParCiudadesCorrespondencia()->getNombre()}";
$template = "notificarEnvioCorrespondencia.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionGuia':
$this->config['to'] = $entity->getRemitente()->getEmail() ?? 'N/A';
$subject = "Envío Correspondencia Sucursal No. {$entity->getId()} {$entity->getCliente()->getNombre()}";
$template = "notificarEnvioCorrespondenciaGuia.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'finalizacion':
$this->config['to'] = $entity->getRemitente()->getEmail() ?? 'N/A';
$subject = "Entrega Correspondencia Sucursal No. {$entity->getId()} {$entity->getCliente()->getNombre()}";
$template = "finalizacionEnvioCorrespondencia.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function solicitudSuministro($tipo, $entities = [], $tipoSuministro, $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificacion':
$this->config['to'] = 'recursofisico@interlogisticazf.com';
$this->config['cc'] = ['archivo.bog@interlogisticazf.com'];
// $destinatarios[] = $u->getEmail();
// }
$subject = "Solicitud de Suministros de Archivo {$entity->getProceso()->getNombre()}";
$template = "notificarSolicitudSuministro.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// Meter todas las variables en un array
//para acceder seria {{ extras.tipoSuministro }}
$this->config['extras'] = [
'tipoSumistro' => $tipoSuministro,
];
break;
case 'aprobacion':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$subject = "Solicitud de Suministro de Archivo {$entity->getProceso()->getNombre()}";
$template = "aprobacionSolicitudSuministro.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function tablaRetencion($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificacion':
$destinatarios = [];
//$revisionDirectorProceso as perfilCargo por edicion.
foreach ($entity->getRevisionDirectorProceso()->getPersona() as $usuario) {
//foreach ($pc->getPersona() as $usuario) {
if ($usuario->hasNivelDirector()) {
$destinatarios[] = $usuario->getEmail();
}
//}
}
$this->config['to'] = count($destinatarios) > 0 ? $destinatarios[0] : 'recursofisico@interlogisticazf.com';
//$this->config['cc'] = ['archivo.bog@interlogisticazf.com'];
// $destinatarios[] = $u->getEmail();
// }
$subject = "Solicitud de Aprobación Tabla de Retención Documental {$entity->getProceso()->getNombre()}";
$template = "notificarTablaRetencion.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = 'recursofisico@interlogisticazf.com';
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$subject = "Observación Tabla de Retención";
$template = "rechazarTablaRetencion.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'actualizacion':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = 'recursofisico@interlogisticazf.com';
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$subject = "Actualización tabla de retención";
$template = "actualizarTablaRetencion.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function FUID($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificacion':
$destinatarios = [];
$this->config['to'] = $entity->getUsuarioElabora()->getEmail();
$this->config['cc'] = [' recursofisico@interlogisticazf.com', 'archivo.bog@interlogisticazf.com'];
// $destinatarios[] = $u->getEmail();
// }
$subject = "Creación FUID Caja No. {$entity->getCaja()->getCodigo()}";
$template = "notificarFUID.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazo':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = $entity->getUsuarioElabora()->getEmail();
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$subject = "Devolución FUID Caja No. {$entity->getCaja()->getCodigo()}";
$template = "rechazarFUID.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'actualizacion':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['to'] = 'recursofisico@interlogisticazf.com';
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$subject = "Actualización tabla de retención";
$template = "actualizarTablaRetencion.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function solicitudDocumento($tipo, $entities = [], $cc = [], $obj = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
$numDoc = $obj?->getId() ?? null;
if ($obj instanceof \App\Entity\RFInventarioDocumentalComex) {
$numDoc = strip_tags("<b>DO:</b>{$obj->getNumeroDO()}");
} else if ($obj instanceof \App\Entity\RFInventarioDocumentalComercial) {
$numDoc = strip_tags("<b>NIT:</b>{$obj->getNit()} ");
} else if ($obj instanceof \App\Entity\RFInventarioDocumentalGesHum) {
$numDoc = strip_tags("<b>No. Cédula:</b>{$obj->getNumeroDocumento()} ");
} else if ($obj instanceof \App\Entity\RFInventarioDocumentalSST) {
$numDoc = strip_tags("<b>Año:</b>{$obj->getAno()} ");
} else if ($obj instanceof \App\Entity\RFInventarioDocumentalFinanzas) {
$numDoc = strip_tags("<b>Numero Inicial:</b>{$obj->getNumeroInicial()} ");
}
$this->config['extras'] = ['numeroDocumento' => $numDoc];
switch ($tipo) {
case 'notificacion':
$destinatarios = [];
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
$this->config['cc'] = ['recursofisico@interlogisticazf.com', 'archivo.bog@interlogisticazf.com'];
// $destinatarios[] = $u->getEmail();
// }
if ($entity->getTipoSolicitud()->getId() == 1) {
$subject = "Solicitud Documento Digital {$numDoc}";
} else {
$subject = "Solicitud Prestamo Físico {$numDoc}";
}
$template = "notificarSolicitudDocumento.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'gestionar':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
if ($entity->getTipoSolicitud()->getId() == 1) {
$subject = "Solicitud Documento Digital {$numDoc}";
} else {
$subject = "Solicitud Prestamo Físico {$numDoc}";
}
$template = "gestionarSolicitudDocumento.html.twig";
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'entregar':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
$this->config['cc'] = ['archivo.bog@interlogisticazf.com'];
$subject = "Confirmación Entrega Documento Físico {$numDoc}";
$template = "entregarSolicitudDocumento.html.twig";
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'recordar':
// $destinatarios = ['gestion.humana@logisticazf.com.co'];
// foreach ($usuarios as $u) {
if ($entity->getTipoSolicitud()->getId() == 1) {
$subject = "Solicitud Documento Digital No. {$numDoc}";
} else {
$subject = "Solicitud Prestamo Físico No. {$numDoc}";
}
$template = "gestionarSolicitudDocumento.html.twig";
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
// $destinatarios[] = $u->getEmail();
// }
//$this->config['cc'] = $destinatarios;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function registroInscripcion($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificar':
$this->config['to'] = "gestion.humana@logisticazf.com.co";
$subject = "Solicitud Registro DIAN {$entity->getPersona()->getNombres()}";
$template = "notificarRegistroInscripcion.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function ingresoVisitante($tipo, $entities = [], $cc = [], $visitanteRechazado = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
$this->config['extras'] = $visitanteRechazado;
switch ($tipo) {
case 'notificar':
$this->config['to'] = "seguridad@logisticazf.com.co";
$ingresoVisitante = $entity->getVisitante();
$visitantesActuales = count($ingresoVisitante);
// Nombre solicitante
$nombreSolicitante = $entity->getUsuarioSolicita()->getNombres();
if ($visitantesActuales > $entity->getCantidadVisitantes()) {
$nuevosVisitantes = [];
foreach ($ingresoVisitante as $visitanteNuevo) {
$nuevosVisitantes[] = $visitanteNuevo->getNombres();
}
$visitantesNuevosString = implode(", ", $nuevosVisitantes);
$subject = "Hay Nuevos Visitantes en la Solicitud Ingreso Visitante. {$entity->getFechaVisita()->format('Y-m-d')} $visitantesNuevosString";
} else {
$nombresVisitantes = [];
foreach ($ingresoVisitante as $visitante) {
$nombresVisitantes[] = $visitante->getNombres();
}
$subject = "Solicitud Ingreso Visitante. {$entity->getFechaVisita()->format('Y-m-d')}, {$nombreSolicitante}";
}
$template = "notificarIngresoVisitante.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'confirmar':
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
$subject = "Visitante {$entity->getEmpresaOrigen()} Autorizado";
$template = "confirmarIngresoVisitante.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazar':
$this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
$nombre = $visitanteRechazado
? $visitanteRechazado->getNombres()
: $entity->getVisitante()->last()->getNombres();
$subject = "Visitante {$nombre} No Autorizado";
$template = "rechazarIngresoVisitante.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'cambioVisitante':
$this->config['to'] = "seguridad@logisticazf.com.co";
$subject = ' Cambios Solicitud Ingreso Visitante. ' . $entity->getUpdateAt()->format('Y-m-d') . ' ' . $entity->getUsuarioSolicita()->getNombres();;
$template = "cambioSoliVisitante.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function solicitudCCTV($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificar':
$this->config['to'] = "seguridad@logisticazf.com.co";
$subject = "Reporte CCTV OT " . $entity->getOT();
$template = "notificarSolicitudCCTV.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'reportar':
$this->config['to'] = $entity->getSolicitante()->getEmail();
$subject = "Reporte CCTV OT {$entity->getOT()}";
$template = "reportarSolicitudCCTV.html.twig";
$this->config['atachment'] = ['documento' => "Repository/SegSolicitudCCTV/{$entity->getReporteCCTV()}"];
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazar':
$this->config['to'] = "seguridad@logisticazf.com.co";
$subject = "Reporte CCTV OT {$entity->getOT()}";
$template = "rechazarSolicitudCCTV.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function precintoRegistro($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'reportar':
$this->config['to'] = "recursofisico@interlogisticazf.com";
$subject = "Novedad Precinto {$entity->getPrecintoCodigo()->getPrecintoSolicitud()->getSede()->getNombre()}";
$template = "notificarPrecintoRegistro.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function solicitudCompra($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificar':
$this->config['to'] = "recursofisico@interlogisticazf.com";
$subject = "Solicitud de Compra No. {$entity->getId()}";
$template = "notificarSolicitudCompra.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'incompleta':
$this->config['to'] = "{$entity->getSolicitante()->getEmail()}";
$subject = "Estado Solicitud de Compra No. {$entity->getId()}";
$template = "incompletaSolicitudCompra.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'sinProveedor':
$this->config['to'] = "{$entity->getSolicitante()->getEmail()}";
$subject = "Estado Solicitud de Compra No. {$entity->getId()}";
$template = "sinProveedorSolicitudCompra.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'aprobar':
$this->config['to'] = "{$entity->getUsuarioAprobacion()->getEmail()}";
$subject = "Aprobación de Compra No. {$entity->getId()}";
$template = "aprobarSolicitudCompra.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'rechazar':
$this->config['to'] = "{$entity->getSolicitante()->getEmail()}";
$subject = "Observaciones de Compra No. {$entity->getId()}";
$template = "rechazarSolicitudCompra.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function ordenCompra($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificar':
$this->config['to'] = $entity->getSolicitante()->getEmail();
$subject = "Notificación Compra No. {$entity->getId()}";
$template = "notificarOrdenCompra.html.twig";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function rembolsoCajaMenor($tipo, $entities = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entities as $entity) {
$this->config['entity'] = $entity;
switch ($tipo) {
case 'notificar':
$this->config['to'] = "finanzas@logisticazf.com.co";
$subject = "Legalización Caja Menor {$entity->getEmpresaFilial()->getNombre()} {$entity->getFecha()->format('Y-m-d')}";
$template = "notificarRembolsoCajaMenor.html.twig";
$this->config['atachment'] = ['documento' => "Repository/RFRembolsoCajaMenor/{$entity->getRembolsoCajaMenorFacturas()[0]->getArchivo()}"];
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
public function HomeOffice($tipo, $homeOffice = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($homeOffice as $h) {
$this->config['entity'] = $h;
switch ($tipo) {
case 'notificarDesconexionJefe':
$this->config['subject'] = "Colaborador Desconectado " . $h->getUsuario()?->getNombres();
$this->config['template'] = "notificacionDesconexion.html.twig";
$director = null;
$usuario = $h->getUsuario()?->getGrupoTrabajoColaboradores();
if ($usuario) {
foreach ($usuario as $grupo) {
$director = $grupo->getDirector()->getEmail();
}
}
if ($director) {
$this->config['to'] = $director;
} else {
// opcional: log o seguimiento
error_log("No se encontró director con correo para el usuario ID: " . $h->getUsuario()?->getId());
}
break;
}
$this->send();
}
}
// TEST de notificaciones comerciales
public function NotiProspectos($tipo, $comProspecto = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($comProspecto as $cp) {
$this->config['entity'] = $cp;
switch ($tipo) {
case 'notificarAutorizacion':
$subject = "Autorizacion Cliente Potencial {$cp->getRazonSocial()}";
$template = "/Comercial/notificacionGerenciaSolicitudAprobacion.html.twig";
$this->config['to'] = "nneuta@interlogisticazf.com";
$this->config['cc'] = ["icuellar@interlogisticazf.com"];
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
// Notifcacion I7
public function NotiGestionContactoComercial($tipo, $comGestionComercial = [], $cc = [], $documentos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($comGestionComercial as $cgc) {
$this->config['entity'] = $cgc;
switch ($tipo) {
case 'vertificacionCliente':
$subject = "Verificación Cliente Potencial {$cgc->getRazonSocial()}";
$template = "/Comercial/notificarC170Verificacion.html.twig";
$this->config['to'] = "circular0170@interlogisticazf.com";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// Anexar Camara de comercio y RUT
// Inicializa como array vacío
$this->config['atachment'] = [];
// Recorres documentos y vas agregando
foreach ($cgc->getComDocumentosCliente() as $doc) {
if ($doc->getTipoDocumento() === 'RUT') {
$this->config['atachment'][] = "Repository/ComDocumentosCliente/{$doc->getNombreDocumento()}";
}
if ($doc->getTipoDocumento() === 'Camara Comercio') {
$this->config['atachment'][] = "Repository/ComDocumentosCliente/{$doc->getNombreDocumento()}";
}
}
break;
}
$this->send();
}
}
// Notificacion I9 Coemrcial H1 F8 - Notificacion I11 -> CASO 170
public function NotiNovedadCautelar($tipo, $listaCautelar = [], $cc = [], $ejecutivaComercial = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($listaCautelar as $lc) {
$this->config['entity'] = $lc;
switch ($tipo) {
case 'novedadVerificacion':
$subject = "Novedad Verificación Cliente en Prospección {$lc->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionEjecutivoComercialI9.html.twig";
$this->config['to'] = $ejecutivaComercial;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'novedadVerificacionCaso170':
$subject = "Novedad Verificación Cliente {$lc->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionNovedadClienteListaC.html.twig";
$this->config['to'] = $ejecutivaComercial;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
//Notificaccion I12 Comercial H1
public function notiVinculacionCliente($tipo, $clientesTarifas = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($clientesTarifas as $ct) {
$this->config['entity'] = $ct;
switch ($tipo) {
case 'vinculacionCliente':
$subject = "Vinculación {$ct->getRazonSocial()}";
$template = "/Comercial/notiVinculacionCliente.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'vinculacionClienteActualizacion':
$subject = "Actualización C170 {$ct->getRazonSocial()}";
$template = "/Comercial/notiActualizacionClienteC170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
// enviar notificacion I14 H1
public function notificacionBievenidaCliente($tipo, $entity = [], $cc = [], $correoComisiona = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($entity as $cb) {
$this->config['entity'] = $cb;
$this->config['extras'] = $correoComisiona; // Asignar el correo de quien comisiona
switch ($tipo) {
case 'bienvenidaCliente':
$subject = "¡Bienvenido! - Inicia tu proceso de vinculación {$cb->getRazonSocial()}";
$template = "/Comercial/notificacionBienvenidaCliente.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
//Notificaccion I19 Comercial H1
public function notificacionClienteComex($tipo, $clientesTarifas = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($clientesTarifas as $ct) {
$this->config['entity'] = $ct;
switch ($tipo) {
case 'VinClienteComex':
$subject = "Vinculación Cliente {$ct->getRazonSocial()}";
$template = "/Comercial/notiVinClienteComex.html.twig";
$this->config['to'] = 'direccioncomex@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
// Notificacion de H3F2 - COMERCIAL -> OFICION AUTORIZACION
public function notificacionOficioAutorizacion($tipo, $cliente = [], $cc = [], $usuarioRegistra = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
// Campos extras
$this->config['extras'] = $usuarioRegistra;
foreach ($cliente as $ct) {
$this->config['entity'] = $ct;
switch ($tipo) {
case 'notificacionOficioAutorizacion':
$this->config['atachment'] = [];
$subject = "Autorización Vinculación {$ct->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionOficioAutorizacionComercial.html.twig";
$this->config['to'] = 'comercial@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// Anexar archivo cargado en F2 - COMERCIAL
$this->config['atachment'][] = "Repository/ComCargarOficioAutorizacion/{$ct->getOficioAutorizacion()}";
break;
}
$this->send();
}
}
// Notificacion de H3F2 - COMERCIAL -> OFICION AUTORIZACION
public function notificacionValidacionOficioAutorizacion($tipo, $cliente = [], $cc = [], $correo = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($cliente as $ct) {
$this->config['entity'] = $ct;
switch ($tipo) {
case 'oficioAprobado':
$subject = "Autorización Vinculación {$ct->getComCargarOficioAutorizacion()->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionOficioAprobado.html.twig";
$this->config['to'] = $correo;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'oficioRechazado':
$subject = "Autorización Vinculación {$ct->getComCargarOficioAutorizacion()->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionOficioRechazo.html.twig";
$this->config['to'] = $correo;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
//Notificaccion I12 Comercial H1
public function notiCasoC170($tipo, $casoc170 = [], $cc = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($casoc170 as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificarC170':
$subject = "Vinculación {$c->getRazonSocial()} - {$c->getCreateUser()}";
$template = "/Comercial/notiCasoC170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'creacionCliente':
$subject = "Bienvenido Inicia tu proceso de vinculacioon {$c->getRazonSocial()}";
$template = "/Comercial/notificacionVinculacionCliente.html.twig";
$this->config['to'] = $c->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
// notificacion H3I8 -> COMERCIAL
public function notificacionAduanaAdicional($tipo, $cliente = [], $cc = [], $asociado = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = $asociado; // Asociado
foreach ($cliente as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificarAduanasAdicionales':
$subject = "Creación Aduanas {$c->getRazonSocial()}";
$template = "/Comercial/notificarAduanasAdicionales.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
//Notificaccion I6 Comercial H4, I16 Comercial H4, I33 Comercial H4, I35 Comercial H4
public function notiPoderesC170($tipo, $poderes = [], $cc = [], $sucursal = null, $terminal = null, $fechaVencimiento = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($poderes as $p) {
$this->config['entity'] = $p;
switch ($tipo) {
case 'notificacionPoderes':
$subject = "Poderes de Puerto {$p->getRazonSocial()}";
$template = "/Comercial/notiPoderesC170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionDocumentosConNovedad':
$subject = "Poderes de Puerto {$p->getRazonSocial()}";
$template = "/Comercial/notificacionDocumentosConNovedad.html.twig";
$this->config['to'] = $p->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionDocumentosSinNovedad':
$subject = "Poderes de Puerto {$p->getRazonSocial()}";
$template = "/Comercial/notificacionDocumentosSinNovedad.html.twig";
$this->config['to'] = $p->getEmail();
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionC170revisionDocs':
$subject = "{$p->getNit()} {$p->getRazonSocial()}";
$template = "/Comercial/notificacionRevisionDocsC170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificarPorSucursal':
$subject = "{$p->getNit()} {$p->getRazonSocial()}";
$template = "/Comercial/notificacionPorSucursal.html.twig";
// como algunas sucursales no tienen correo o no tienen personas con correo se enviara al circular para descartar errores
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Aquí agregamos la sucursal al contexto
$this->config['sucursal'] = $sucursal;
$this->config['terminal'] = $terminal;
break;
case 'notificarCreacionVenciminetoPuertos':
$subject = "{$terminal} {$p->getRazonSocial()}";
$template = "/Comercial/notificacionCreacionVencimientosPuerto.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'sucursal' => $sucursal,
'terminal' => $terminal,
'fechaVencimiento' => $fechaVencimiento,
];
break;
}
$this->send();
}
}
//Notificaccion I16 Comercial H4
public function notificacionRevisionDocumentos($tipo, $poder = [], $cc = [], $correoAsociado = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($poder as $p) {
$this->config['entity'] = $p;
switch ($tipo) {
case 'notificacionRevisionDocumento':
$subject = "Revisión Documentos {$p->getDescripcionIdentificacion()} {$p->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionRevisionDocumentos170.html.twig";
$this->config['to'] = $correoAsociado;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'envioRevision':
$subject = "Revisión Documentos {$p->getDescripcionIdentificacion()} {$p->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionA170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
//Notificaccion I13 NOVEDAD AL CLIENTE
public function notificacionNovedadCliente($tipo, $poder = [], $cc = [], $correoCliente = null, $novedades = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($poder as $c) {
$this->config['entity'] = $c;
$this->config['extras'] = $novedades; // Novedades del formulario
switch ($tipo) {
case 'notificacionNovedadCliente':
$subject = "{$c->getDescripcionIdentificacion()} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionNovedadCliente.html.twig";
$this->config['to'] = $correoCliente;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionSinNovedadCliente':
$subject = "{$c->getDescripcionIdentificacion()} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionSinNovedadCliente.html.twig";
$this->config['to'] = $correoCliente;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
//Notificaccion REVISION DOCUMENTOS 170
public function notificacionRevisionDocs170($tipo, $poder = [], $cc = [], $descripcionIdentificacion = null, $correoCliente = null, $arreglos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = $arreglos;
foreach ($poder as $c) {
$this->config['entity'] = $c->getTerEmpresaCliente();
switch ($tipo) {
case 'notificacionRevisionDocumentosOriginales':
$subject = "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionRevisionDocsC170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionRecepcionDocsPendientes':
$subject = "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionDocsPendientes.html.twig";
$this->config['to'] = $correoCliente;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionRecepcionDocsCompletos':
$subject = "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionDocsCompletos.html.twig";
$this->config['to'] = $correoCliente;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
$this->send();
}
}
// notificaciones fianles del proceso de CASO 170.
public function notificacionCreacionVencimientoC170($tipo, $poder = [], $cc = [], $descripcionIdentificacion = null, $correoCliente = null, $arreglos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = $arreglos;
foreach ($poder as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificacionCreacionVencimientoC170':
$subject = "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionCreacionClienteC170.html.twig";
$this->config['to'] = $correoCliente; // Enviar notificacion al cliente
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionVinculacionClienteNuevo':
$subject = "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
$template = "/Comercial/notificacionVinculacionClienteNuevo.html.twig";
$this->config['to'] = $correoCliente;
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
// Actualizar cliente
public function notificacionActualizacionCliente($tipo, $poder = [], $cc = [], $descripcionIdentificacion = null, $correoCliente = null, $arreglos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = $arreglos;
foreach ($poder as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificacionActualizacionCliente':
$subject = "Actualización {$c->getRazonSocial()}";
$template = "/Comercial/notificacionActualizacionCliente.html.twig";
$this->config['to'] = $correoCliente; // Enviar notificacion al cliente
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
// Notificar cambios de hoja de vida a contactos seleccionados
public function notificacionCambiosHojaVida($tipo, $contactos = [], $cc = [], $arreglos = []){
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = $arreglos;
foreach ($contactos as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'actualizacionHojaVidaCambios':
$subject = "Actualización Información {$c->getRazonSocial()}";
$template = "/Comercial/actualizacionInformacionCliente.html.twig";
$this->config['to'] = "a@a.com"; // Enviar notificacion al cliente
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
// Notificar las ofertas a los contactos definidos en el formulario
public function notificacionOfertasClientes($tipo, $ofertas = [], $cc = [], $arreglos = [], $ejecutivoComercial = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
$this->config['extras'] = $arreglos;
foreach ($ofertas as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificacionOfertasComerciales':
$subject = "Oferta Comercial {$c->getRazonSocial()}";
$template = "/Comercial/notificacionOfertasComercialesCliente.html.twig";
// Enviar los archivos adjuntos
foreach ($arreglos['ofertasComerciales'] as $oferta) {
$this->config['atachment'][] = "Repository/ComOfertaComercial/{$oferta->getCargarOfertaPdf()}"; // Enviar PDF
$this->config['atachment'][] = "Repository/ComOfertaComercial/{$oferta->getOfertaExcel()}"; // Enviar EXCEL
}
$this->config['to'] = $ejecutivoComercial; // Enviar notificacion al comercial
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
//Notificaccion I4 Comercial H89
public function notiResultados($tipo, $cargarInforme = [], $cc = [], $es = null)
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($cargarInforme as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificarResultados':
$subject = "Resultado Encuesta de Satisfacción " . $c->getEmpresa() . " " . $es->getAno();
$template = "/Comercial/notiResultados.html.twig";
$this->config['to'] = 'comercial@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'ano' => $es->getAno(),
'encuesta' => $es,
];
break;
}
$this->send();
}
}
// Notificar Clientes proximos a vencer
public function notificacionClientesProximosAVencer($tipo, $ofertas = [], $cc = [], $arreglos = [],$ejecutivoComercial = null){
$template = "";
$subject = "";
// Validar los meses
$fecha = (new \DateTime('now'))->modify('+1 month'); // o la fecha que necesites
$numeroMes = (int)$fecha->format('n'); // devuelve 1 a 12
$meses = [
1 => 'Enero',
2 => 'Febrero',
3 => 'Marzo',
4 => 'Abril',
5 => 'Mayo',
6 => 'Junio',
7 => 'Julio',
8 => 'Agosto',
9 => 'Septiembre',
10 => 'Octubre',
11 => 'Noviembre',
12 => 'Diciembre',
];
$this->config['cc'] = $cc;
$this->config['extras'] = $arreglos;
foreach ($ofertas as $c) {
$this->config['entity'] = $c;
switch ($tipo) {
case 'notificacionClientesVencerComercial':
$subject = "Control Vencimientos C170/Poderes Puerto de {$meses[$numeroMes]}";
$template = "/Comercial/notificacionControlVencimientoseComercial.html.twig";
$this->config['to'] = "comercial@interlogisticazf.com";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
case 'notificacionClientesVencerAsociado':
$subject = "Control Vencimientos C170/Poderes Puerto de {$meses[$numeroMes]}";
$template = "/Comercial/notificacionControlVencimientosAsociado.html.twig";
$this->config['to'] = "coordinadoragentes@interlogisticazf.com";
$this->config['subject'] = $subject;
$this->config['template'] = $template;
break;
}
return $this->send();
}
}
//Notificaccion I4 Comercial H89
public function notiSolicitud170($tipo, $protocoloExportacion = [], $cc = [], $cliente = null, $arhivos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($protocoloExportacion as $pe) {
$this->config['entity'] = $pe;
switch ($tipo) {
case 'notificarSoli170':
$subject = "Notificar Protocolo Exportacion " . $cliente->getRazonSocial();
$template = "/Comercial/notiSolicitud170.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'cliente' => $cliente->getRazonSocial(),
'url' => 'app_com_generar_protocolo_exportacion_new',
'id' => $pe->getId(),
];
break;
case 'notificacionProtocoloExportacion':
$subject = "Protocolo Exportación " . $cliente->getRazonSocial();
$template = "/Comercial/notificacionProtocoloExportacion.html.twig";
$this->config['to'] = 'icuellar@interlogisticazf.com';
$this->config['cc'] = ['nneuta@interlogisticazf.com']; // Copia
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// Anexar archivos
$this->config['atachment'] = $arhivos;
$this->config['extras'] = [
'cliente'=>$cliente->getRazonSocial(),
];
break;
case 'notificarProtoExp':
$subject = "Protocolo Exportacion " . $cliente->getRazonSocial();
$template = "/Comercial/notiProtoExp.html.twig";
$this->config['to'] = 'circular0170@interlogisticazf.com';
$this->config['cc'] = ['exportacionesinterlogistica@interlogisticazf.com'];
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'cliente' => $cliente->getRazonSocial(),
'url' => 'app_com_revision_protocolo_new',
'id' => $pe->getId(),
];
break;
}
$this->send();
}
}
//Enviar PDF en ZIP en caliente
public function enviarRevisionFormatoCliente($tipo, $protocoloExportacion = [], $cc = [], $cliente = null, $arhivos = [])
{
$template = "";
$subject = "";
$this->config['cc'] = $cc;
foreach ($protocoloExportacion as $pe) {
$this->config['entity'] = $pe;
switch ($tipo) {
case 'enviarFormatosClientes':
$subject = "Revisión Formatos a " . $cliente->getRazonSocial();
$template = "/Comercial/formattosCliente.html.twig";
$this->config['to'] = $cliente->getEmail() ?? 'a@gmail.com'; // Envio correo a cliente
$this->config['subject'] = $subject;
$this->config['template'] = $template;
// 👇 Meter todas las variables en un array
$this->config['extras'] = [
'cliente' => $cliente->getRazonSocial(),
];
// Validar envio de archivos adjuntos
if(count($arhivos)>0){
$this->config['atachment'] = $arhivos; // Enviar zip en caliente
}
break;
}
return $this->send();
}
}
}