src/Services/MailerCore.php line 1250

Open in your IDE?
  1. <?php
  2. namespace App\Services;
  3. use App\Entity\ComCargarOficioAutorizacion;
  4. use App\Entity\ComProspecto;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use DoctrineExtensions\Query\Mysql\Date;
  7. use Symfony\Component\Filesystem\Filesystem;
  8. use Symfony\Component\HttpFoundation\File\UploadedFile;
  9. use Symfony\Component\HttpFoundation\RequestStack;
  10. use Symfony\Component\HttpKernel\KernelInterface;
  11. use Symfony\Component\Routing\RouterInterface;
  12. use Twig\Environment;
  13. use Symfony\Component\Mailer\MailerInterface;
  14. use Symfony\Component\Mime\Email;
  15. use Symfony\Bridge\Twig\Mime\TemplatedEmail;
  16. use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
  17. class MailerCore
  18. {
  19.     private $em null;
  20.     private $request null;
  21.     private $kernel;
  22.     //  private $template;
  23.     //   private $router;
  24.     private $mailer;
  25.     private $transport;
  26.     private $config = ['subject' => '''text' => '''atachment' => [], 'to' => '''cc' => [], 'template' => '''extras' => []];
  27.     private $baseRoute;
  28.     public function __construct(EntityManagerInterface $entityManagerRequestStack $requestStackKernelInterface $kernelMailerInterface $mailer\Symfony\Component\Mailer\Transport\TransportInterface $transportInterface)
  29.     {
  30.         $this->em $entityManager;
  31.         $this->request $requestStack;
  32.         // this->template = $templating; Environment $templating, RouterInterface $router,
  33.         //$this->router = $router;
  34.         $this->kernel $kernel;
  35.         $this->mailer $mailer;
  36.         $this->transport $transportInterface;
  37.         $this->baseRoute $kernel->getProjectDir() . '/public_html/';
  38.     }
  39.     private function send()
  40.     {
  41.         try {
  42.             if (filter_var($this->config['to'], FILTER_VALIDATE_EMAIL)) {
  43.                 $email = (new TemplatedEmail())
  44.                     ->to($this->config['to'])
  45.                     ->subject($this->config['subject'])
  46.                     ->htmlTemplate("mailing/{$this->config['template']}")
  47.                     ->context([
  48.                         'titulo' => $this->config['subject'],
  49.                         'entity' => $this->config['entity'],
  50.                         'extras' => $this->config['extras']
  51.                     ]);
  52.                 // Return-Path
  53.                 $email->returnPath('notificaciones@it-systems.com.co');
  54.                 // Copias
  55.                 if (!empty($this->config['cc'])) {
  56.                     foreach ($this->config['cc'] as $copia) {
  57.                         if (filter_var($copiaFILTER_VALIDATE_EMAIL)) {
  58.                             $email->addCc($copia);
  59.                         }
  60.                     }
  61.                 }
  62.                 // Adjuntos
  63.                 if (!empty($this->config['atachment'])) {
  64.                     foreach ($this->config['atachment'] as $file) {
  65.                         // 🟢 Caso 1: archivo binario (PDF generado en caliente)
  66.                         if (is_array($file) && isset($file['contenido'])) {
  67.                             $email->attach(
  68.                                 base64_decode($file['contenido']),        // 👈 decodificar antes de adjuntar
  69.                                 $file['nombre'] ?? 'archivo.pdf',
  70.                                 $file['mime'] ?? 'application/pdf'
  71.                             );
  72.                         }
  73.                         // 🟢 Caso 2: ruta relativa (archivo físico en public_html)
  74.                         else {
  75.                             dump($file);
  76.                             $rutaCompleta $this->baseRoute $file;
  77.                             if (file_exists($rutaCompleta)) {
  78.                                 $email->attachFromPath($rutaCompleta);
  79.                             } else {
  80.                                 // Loguear advertencia (útil en debug)
  81.                                 // logger opcional: $this->logger?->warning("Archivo no encontrado: {$rutaCompleta}");
  82.                             }
  83.                         }
  84.                     }
  85.                 }
  86.                 // Enviar correo
  87.                 $sentMessage $this->transport->send($email);
  88.                 return [
  89.                     'message_id' => $sentMessage->getMessageId(),
  90.                     'status' => 'sent',
  91.                     'to' => $this->config['to']
  92.                 ];
  93.             }
  94.         } catch (TransportExceptionInterface $e) {
  95.             return [
  96.                 'status' => 'error',
  97.                 'to' => $this->config['to'],
  98.                 'error' => $e->getMessage()
  99.             ];
  100.         }
  101.         return [
  102.             'status' => 'invalid_email',
  103.             'to' => $this->config['to'],
  104.             'error' => 'Invalid email address'
  105.         ];
  106.     }
  107.     public function notificarUsuario($tipo$usuario = [], $cc = [],$idPerfil null)
  108.     {
  109.         $template "";
  110.         $subject "";
  111.         // Validar el id del perfil
  112.         $this->config['extras'] = [
  113.             'id' => $idPerfil
  114.         ];
  115.         switch ($tipo) {
  116.             case 'requestPassword':
  117.                 $subject "Solicitud Cambio Contraseña";
  118.                 $template "requestPassword.html.twig";
  119.                 break;
  120.             case 'confirmChange':
  121.                 $subject "Contraseña Actualizada";
  122.                 $template "confirmChangePassword.html.twig";
  123.                 break;
  124.             case 'updateInfo':
  125.                 $subject "Actualizar Datos Personales";
  126.                 $template "actualizarInformacionUsuario.html.twig";
  127.                 break;
  128.             case 'solicitaCarnet':
  129.                 $subject "Solicitud Carnetizacion";
  130.                 $template "notificarCarnetizacion.html.twig";
  131.                 break;
  132.             case 'controlInstalaciones':
  133.                 $documento $this->em->getRepository(\App\Entity\DocDocumento::class)->find(16);
  134.                 $subject "Solicitud Control Instalaciones";
  135.                 $template "solicitarControlInst.html.twig";
  136.                 $this->config['atachment'] = ['documento' => "Repository/GHDocumentos/{$documento->getArchivo()}"];
  137.                 break;
  138.             case 'solicitudAccesos':
  139.                 $documento $this->em->getRepository(\App\Entity\DocDocumento::class)->find(16);
  140.                 $subject "Solicitud Accesos";
  141.                 $template "solicitarAccesos.html.twig";
  142.                 //$this->config['atachment'] = ["Repository/GHDocumentos/{$documento->getArchivo()}"];
  143.                 break;
  144.         }
  145.         $this->config['subject'] = $subject;
  146.         $this->config['template'] = $template;
  147.         $this->config['cc'] = $cc;
  148.         foreach ($usuario as $u) {
  149.             $this->config['entity'] = $u;
  150.             $this->config['to'] = $u->getEmail();
  151.             $this->send();
  152.         }
  153.     }
  154.     public function notificarVacante($tipo$vacante = [], $cc = [])
  155.     {
  156.         $template "";
  157.         $subject "";
  158.         foreach ($vacante as $v) {
  159.             switch ($tipo) {
  160.                 case 'notificar':
  161.                     $subject "Creación Vacante {$v->getPerfilCargo()->getCargo()}{$v->getFecha()->format('Y-m-d')}  ";
  162.                     $template "notificarVacante.html.twig";
  163.                     $this->config['to'] = $v->getPersonaSolicita()->getEmail();
  164.                     break;
  165.                 case 'gestionar':
  166.                     $subject "Solicitud Aprobación Vacante {$v->getPerfilCargo()->getCargo()->getNombre()}";
  167.                     $template "gestionarVacante.html.twig";
  168.                     $emailPersona $v->getPerfilCargo()?->getCargoAprueba()?->getEmail() ?? 'gestion.humana@logisticazf.com.co';
  169.                     $this->config['to'] = $emailPersona;
  170.                     break;
  171.                 case 'rechazar':
  172.                     $subject "Notificación de Rechazo Vacante {$v->getPerfilCargo()->getCargo()}{$v->getFecha()->format('Y-m-d')}";
  173.                     $template "rechazarVacante.html.twig";
  174.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  175.                     break;
  176.                 case 'reaperturar':
  177.                     $fechaCreacion $v->getFecha() ? $v->getFecha()->format('Y-m-d') : 'N/A';
  178.                     $subject "Reapertura Vacante {$v->getPerfilCargo()->getCargo()} {$fechaCreacion}";
  179.                     $template "reaperturarVacante.html.twig";
  180.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  181.                     break;
  182.             }
  183.             $this->config['entity'] = $v;
  184.             $this->config['subject'] = $subject;
  185.             $this->config['template'] = $template;
  186.             $this->config['cc'] = $cc;
  187.             $this->send();
  188.         }
  189.     }
  190.     public function notificarAspirante($tipo$aspirante = [], $cc = [])
  191.     {
  192.         $template "";
  193.         $subject "";
  194.         $docHabeasData $this->em->getRepository(\App\Entity\DocDocumento::class)->find(5);
  195.         switch ($tipo) {
  196.             case 'notificar':
  197.                 if (!empty($aspirante)) {
  198.                     $vacante $aspirante [0]->getVacante();
  199.                     $cargo $vacante->getPerfilCargo()->getCargo();
  200.                     $subject " Participación Proceso Selección - " $cargo;
  201.                     $template "notificarAspirante.html.twig";
  202.                     $this->config['atachment'] = ['habeas_data' => "Repository/DocDocumento/{$docHabeasData->getArchivo()}"];
  203.                     break;
  204.                 }
  205.             case 'rechazo':
  206.                 if (!empty($aspirante)) {
  207.                     $vacante $aspirante [0]->getVacante();
  208.                     $cargo $vacante->getPerfilCargo()->getCargo();
  209.                     $subject "Participación Proceso Selección - " $cargo;
  210.                     $template "notificarAspiranteRechazo.html.twig";
  211.                     array_push($cc'gestion.humana@logisticazf.com.co');
  212.                 }
  213.                 break;
  214.         }
  215.         $this->config['subject'] = $subject;
  216.         $this->config['template'] = $template;
  217.         $this->config['cc'] = $cc;
  218.         foreach ($aspirante as $a) {
  219.             $this->config['entity'] = $a;
  220.             $this->config['to'] = $a->getCorreoElectronico(); // o $a->getEmail() según tu entidad
  221.             // Asegúrate de no duplicar el correo en cc
  222.             if (!in_array('gestion.humana@logisticazf.com.co'$cc)) {
  223.                 $cc[] = 'gestion.humana@logisticazf.com.co';
  224.             }
  225.             $this->config['cc'] = $cc;
  226.             $this->send();
  227.         }
  228.         //foreach ($aspirante as $a) {
  229.         //   $this->config['entity'] = $a;
  230.         //    $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  231.         //    $this->send();
  232.         //}
  233.     }
  234.     public function notificarPruebaTecnica($tipo$pruebaTec = [], $cc = [])
  235.     {
  236.         $template "";
  237.         $subject "";
  238.         $this->config['cc'] = $cc;
  239.         foreach ($pruebaTec as $pt) {
  240.             $this->config['entity'] = $pt;
  241.             switch ($tipo) {
  242.                 case 'notificar':
  243.                     $subject "Prueba Técnica {$pt->getCandidato()->getNombres()}";
  244.                     $template "notificarPruTec.html.twig";
  245.                     if ($pt->getResponsablePrueba() == 'GH') {
  246.                         $this->config['atachment'][] = "Repository/GHPruebasTecnicas/{$pt->getArchivo()}";
  247.                     } elseif ($pt->getResponsablePrueba() == 'JD') {
  248.                         $this->config['atachment'][] = "Repository/GHPerfilCargo/{$pt->getCandidato()->getVacante()->getPerfilCargo()->getArchivo()}";
  249.                     }
  250.                     $this->config['to'] = $pt->getCandidato()->getVacante()->getPersonaSolicita()->getEmail();
  251.                     $this->config['subject'] = $subject;
  252.                     $this->config['template'] = $template;
  253.                     break;
  254.                 case 'rechazo':
  255.                     $subject "Notificación Aspirante";
  256.                     $template "notificarAspiranteRechazo.html.twig";
  257.                     $this->config['to'] = $pt->getCandidato()->getVacante()->getPersonaSolicita()->getEmail();
  258.                     $this->config['subject'] = $subject;
  259.                     $this->config['template'] = $template;
  260.                     break;
  261.             }
  262.             $this->send();
  263.         }
  264.     }
  265.     public function periodoPrueba($tipo$periodoPrueba = [], $cc = [],$archivosAdjuntos = [])
  266.     {
  267.         $template "";
  268.         $subject "";
  269.         $this->config['cc'] = $cc;
  270.         foreach ($periodoPrueba as $pp) {
  271.             $this->config['entity'] = $pp;
  272.             switch ($tipo) {
  273.                 case 'notificacionRetraso':
  274.                     $subject "Vence Periodo de Prueba {$pp->getPersona()->getNombres()}";
  275.                     $template "periodoPruebaNotificacionRetraso.html.twig";
  276.                     $gh 'gestion.humana@logisticazf.com.co';
  277.                     $destinatarios = [$pp->getJefeInmediato()?->getEmail() ?? 'na@gmail.com'];
  278.                     $this->config['to'] = $gh;
  279.                     $this->config['cc'] = $destinatarios;
  280.                     $this->config['subject'] = $subject;
  281.                     $this->config['template'] = $template;
  282.                     break;
  283.                 case 'notificacion':
  284.                     $subject "Periodo de Prueba {$pp->getPersona()->getNombres()}";
  285.                     $template "periodoPruebaNotificacion.html.twig";
  286.                     $gh 'gestion.humana@logisticazf.com.co';
  287. //                    $destinatarios = [$gh, $pp->getJefeInmediato()?->getEmail()  ?? 'na@gmail.com'];
  288.                     $this->config['to'] = $gh;
  289.                     $this->config['subject'] = $subject;
  290.                     $this->config['template'] = $template;
  291.                     break;
  292.                 case 'rechazo':
  293.                     $subject "Desvinculación {$pp->getPersona()->getNombres()}";
  294.                     $template "periodoPruebaRechazo.html.twig";
  295.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  296.                     $this->config['subject'] = $subject;
  297.                     $this->config['template'] = $template;
  298. //                    $this->config['atachment'] = ['carta_periodo_prueba' => "Repository/GHPeriodoPrueba/{$pp->getCarta()}"];
  299.                     $this->config['atachment'] = $archivosAdjuntos// Enviar pdfs en caliente
  300.                     break;
  301.             }
  302.             return $this->send();
  303.         }
  304.     }
  305.     //notificacion Antecedenstes Retraso
  306.     public function contratacion($tipo$contrato = [], $cc = [])
  307.     {
  308.         $template "";
  309.         $subject "";
  310.         $this->config['cc'] = $cc;
  311.         foreach ($contrato as $c) {
  312.             $this->config['entity'] = $c;
  313.             switch ($tipo) {
  314.                 case 'notificacionRetrasos':
  315.                     $this->config['subject'] = "Recordatorio: Verificación Anual de Antecedentes {$c->getCandidato()->getNombres()}";
  316.                     $this->config['template'] = "notificarAntecedentesRetraso.html.twig";
  317.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  318.                     break;
  319.             }
  320.             $this->send();
  321.         }
  322.     }
  323.     public function NotificarUser($tipo$persona = [], $cc = [])
  324.     {
  325.         $template "";
  326.         $subject "";
  327.         $this->config['cc'] = $cc;
  328.         foreach ($persona as $p) {
  329.             $this->config['entity'] = $p;
  330.             switch ($tipo) {
  331.                 case 'notificacionUltimoRegistro':
  332.                     $this->config['subject'] = "Notificacion Anual: Actualizacion de Datos Personales " $p->getNombres();
  333.                     $this->config['template'] = "NotificacionUltimoRegistro.html.twig";
  334.                     $correo $p->getEmail();
  335.                     $this->config['to'] = $correo;
  336.                     break;
  337.             }
  338.             $this->send();
  339.         }
  340.     }
  341.     public function RecordatoriosDesvinculacion($tipo$desvinculacion = [], $cc = [])
  342.     {
  343.         $template "";
  344.         $subject "";
  345.         $this->config['cc'] = $cc;
  346.         foreach ($desvinculacion as $d) {
  347.             $this->config['entity'] = $d;
  348.             switch ($tipo) {
  349.                 case 'notificarRetraso2D':
  350.                     $this->config['subject'] = "Recordatorio: Desvinculacion " $d->getPersona()->getNombres();
  351.                     $this->config['template'] = "notificacionRetraso2D.html.twig";
  352.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  353.                     break;
  354.                 case 'notificarRetraso3D':
  355.                     $this->config['subject'] = "Recordatorio: Desvinculacion liquidacion " $d->getPersona()->getNombres();
  356.                     $this->config['template'] = "notificacionRetraso3D.html.twig";
  357.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  358.                     break;
  359.             }
  360.             $this->send();
  361.         }
  362.     }
  363.     public function notificarEntrevistaJefe($tipo$entrevistaJefe = [], $cc = [])
  364.     {
  365.         $template "";
  366.         $subject "";
  367.         $this->config['cc'] = $cc;
  368.         foreach ($entrevistaJefe as $ej) {
  369.             $this->config['entity'] = $ej;
  370.             switch ($tipo) {
  371.                 case 'notificar':
  372.                     $candidato $ej->getCandidato();
  373.                     $subject "Programación Entrevista " $candidato;
  374.                     $template "notificarEntJef.html.twig";
  375.                     $this->config['to'] = $ej->getCandidato()->getCorreoElectronico();
  376.                     $this->config['subject'] = $subject;
  377.                     $this->config['template'] = $template;
  378.                     break;
  379.                 case 'rechazo':
  380.                     $subject "Notificación Aspirante";
  381.                     $template "notificarAspiranteRechazo.html.twig";
  382.                     $this->config['to'] = $ej->getCandidato()->getVacante()->getPersonaSolicita()->getEmail();
  383.                     $this->config['subject'] = $subject;
  384.                     $this->config['template'] = $template;
  385.                     break;
  386.             }
  387.             $this->send();
  388.         }
  389.     }
  390.     public function notificarExamenesMedicos($tipo$examenes = [], $cc = [])
  391.     {
  392.         $template "";
  393.         $subject "";
  394.         $this->config['cc'] = $cc;
  395.         foreach ($examenes as $ex) {
  396.             $this->config['entity'] = $ex;
  397.             switch ($tipo) {
  398.                 case 'notificar':
  399.                     $candidato $ex->getCandidato()->getNombres();
  400.                     $cargo $ex->getCandidato()->getVacante()->getPerfilCargo()->getCargo()->getNombre();
  401.                     $subject "Documentos Contratación $candidato - $cargo";
  402.                     $template "notificarExamenes.html.twig";
  403.                     $this->config['atachment'] = ['carta_examenes' => "Repository/GHExamenes/{$ex->getCarta()}"];
  404.                     $this->config['to'] = $ex->getCandidato()->getCorreoElectronico();
  405.                     $this->config['subject'] = $subject;
  406.                     $this->config['template'] = $template;
  407.                     break;
  408.             }
  409.             $this->send();
  410.         }
  411.     }
  412.     public function notificarDotacion($tipo$dotacion = [], $cc = [], $asunto = [])
  413.     {
  414.         $procesosConcatenados "";
  415.         if(count($asunto) > 0)
  416.             foreach ($asunto as $as) {
  417.                 $procesosConcatenados .= $as ", "// Concatenar los procesos del asunto
  418.             }
  419.         $template "";
  420.         $subject "";
  421.         $this->config['cc'] = $cc;
  422.         $this->config['extras'] = [
  423.             'procesos' => $procesosConcatenados,
  424.         ];
  425.         foreach ($dotacion as $d) {
  426.             $this->config['entity'] = $d;
  427.             switch ($tipo) {
  428.                 case 'notificar':
  429.                     $candidato $d->getCandidato()->getNombres();
  430.                     $cargo $d->getCandidato()->getVacante()->getPerfilCargo()->getCargo()->getNombre();
  431.                     $subject "Solicitud Asignación  $candidato - $cargo";
  432.                     $template "notificarDotacion.html.twig";
  433.                     $this->config['to'] = $cc[0];
  434.                     // Eliminar el correo que ya se fue de principal
  435.                     $correoEliminar $cc[0];
  436.                     $cc array_filter($cc, function($c) use ($correoEliminar) {
  437.                         return $c !== $correoEliminar;
  438.                     });
  439.                     $this->config['cc'] = $cc;
  440.                     $this->config['subject'] = $subject;
  441.                     $this->config['template'] = $template;
  442.                     break;
  443.             }
  444.             $this->send();
  445.         }
  446.     }
  447.     public function notificarContratacion($tipo$contratacion = [], $cc = [], $correoPa null$data = [])
  448.     {
  449.         $template "";
  450.         $subject "";
  451.         $this->config['cc'] = $cc;
  452.         foreach ($contratacion as $con) {
  453.             $this->config['entity'] = $con;
  454.             switch ($tipo) {
  455.                 case 'notificar':
  456.                     $cargo $con->getVacante()->getPerfilCargo()->getCargo()->getNombre();
  457.                     $subject "Solicitud Aprobación Contratación {$cargo} {$data['fecha']}";
  458.                     $template "notificarContratacion.html.twig";
  459.                     dump($correoPa);
  460.                     $this->config['to'] = $correoPa;
  461.                     $this->config['subject'] = $subject;
  462.                     $this->config['template'] = $template;
  463.                     break;
  464.                 case 'gestionar':
  465. //                    $para = $con->getCandidato()->getCorreoElectronico();
  466. //                    $otros = $con->getAprobador()->getEmail();
  467.                     $candidato $con->getCandidato()->getNombres();
  468.                     $cargo $con->getVacante()?->getPerfilCargo()?->getCargo()?->getNombre() ?? 'N/A';
  469.                     $subject "Contratación $cargo - $candidato";
  470.                     $template "gestionarContratacion.html.twig";
  471.                     $this->config['to'] = $correoPa;
  472.                     $this->config['subject'] = $subject;
  473.                     $this->config['template'] = $template;
  474.                     break;
  475.             }
  476.             return $this->send();
  477.         }
  478.     }
  479.     public function induccion($tipo$induccionProceso = [], $cc = [], $induccion = [], $empresaId null)
  480.     {
  481.         $template "";
  482.         $subject "";
  483.         $this->config['cc'] = $cc;
  484.         $docHabeasData $this->em->getRepository(\App\Entity\DocDocumento::class)->find(5);
  485.         foreach ($induccionProceso as $ind) {
  486.             $this->config['entity'] = $ind;
  487.             switch ($tipo) {
  488.                 case 'notificacion':
  489.                     $subject "Documentos Inducción";
  490.                     $template "induccionNotificar.html.twig";
  491.                     if ($empresaId === ) { // si la empresa es igual a 1 es Logistica
  492.                         $this->config['atachment'] = [
  493.                             'reglamento_interno_de_trabajo_logistica' => "Repository/GHInduccion/REGLAMENTO INTERNO LOGISTICA.pdf",
  494.                             'codigo_de_etica_logistica' => "Repository/GHInduccion/CÓDIGO DE ÉTICA - LOG-SVF.pdf",
  495.                             'politica_de_usuarios_informaticos_logistica' => "Repository/GHInduccion/POLÍTICA RECURSOS INFORMÁTICOS.pdf",
  496.                         ];
  497.                     } elseif ($empresaId === ) { // si la empresa es igual a 2 es Agencia
  498.                         $this->config['atachment'] = [
  499.                             'reglamento_interno_de_trabajo_agencia' => "Repository/GHInduccion/REGLAMENTO INTERNO DE TRABAJO AGENCIA.pdf",
  500.                             'codigo_de_etica_agencia' => "Repository/GHInduccion/CÓDIGO DE ÉTICA.pdf",
  501.                             'politica_de_usuarios_informaticos_agencia' => "Repository/GHInduccion/POLÍTICA RECURSOS INFORMÁTICOS.pdf",
  502.                         ];
  503.                     } elseif ($empresaId === 3) { // si la empresa es igual a 2 es Servifranca
  504.                         $this->config['atachment'] = [
  505.                             'reglamento_interno_de_trabajo_servifranca' => "Repository/GHInduccion/REGLAMENTO INTERNO SERVIFRANCA.pdf",
  506.                             'codigo_de_etica_servifranca' => "Repository/GHInduccion/CÓDIGO DE ÉTICA - LOG-SVF.pdf",
  507.                             'politica_de_usuarios_informaticos_servifranca' => "Repository/GHInduccion/POLÍTICA RECURSOS INFORMÁTICOS.pdf",
  508.                         ];
  509.                     }
  510.                     $this->config['to'] = $ind->getPersona()->getEmail();
  511.                     $this->config['subject'] = $subject;
  512.                     $this->config['template'] = $template;
  513.                     break;
  514.                 case 'confirmar':
  515.                     $subject "Inducción Programada";
  516.                     $template "induccionConfirmar.html.twig";
  517.                     foreach ($induccion as $i) {
  518.                         $this->config['to'] = $i->getPersona()->getEmail();
  519.                     }
  520.                     $this->config['subject'] = $subject;
  521.                     $this->config['template'] = $template;
  522.                     break;
  523.                 case 'resultado':
  524.                     $subject "Inducción {$ind->getInduccion()->getPersona()->getNombres()}";
  525.                     $template "induccionResultado.html.twig";
  526.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  527.                     $this->config['subject'] = $subject;
  528.                     $this->config['template'] = $template;
  529.                     break;
  530.             }
  531.             $this->send();
  532.         }
  533.     }
  534.     public function entrenamiento($tipo$entrenamientoProceso = [], $cc = [], $entrenamiento = [])
  535.     {
  536.         $template "";
  537.         $subject "";
  538.         $this->config['cc'] = $cc;
  539.         $docHabeasData $this->em->getRepository(\App\Entity\DocDocumento::class)->find(5);
  540.         foreach ($entrenamientoProceso as $ind) {
  541.             $this->config['entity'] = $ind;
  542.             switch ($tipo) {
  543.                 case 'notificacion':
  544.                     $subject "Entrenamiento {$ind->getProceso()->getNombre()} {$ind->getEntrenamiento()->getPersona()->getNombres()}";
  545.                     $template "entrenamientoNotificar.html.twig";
  546.                     $this->config['to'] = $ind->getEntrenamiento()->getPersona()->getEmail();
  547.                     $this->config['subject'] = $subject;
  548.                     $this->config['template'] = $template;
  549.                     break;
  550.                 case 'resultado':
  551.                     $subject "Entrenamiento {$entrenamiento->getPersona()->getNombres()}";
  552.                     $template "entrenamientoConfirmar.html.twig";
  553.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  554.                     $this->config['subject'] = $subject;
  555.                     $this->config['template'] = $template;
  556.                     // 👇 Meter todas las variables en un array
  557.                     $this->config['extras'] = [
  558.                         'entrenamiento' => $entrenamiento,
  559.                     ];
  560.                     break;
  561.                 case 'consolidado':
  562.                     $subject "Entrenamiento {$ind->getPersona()->getNombres()}";
  563.                     $template "entrenamientoConsolidado.html.twig";
  564.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  565.                     $this->config['subject'] = $subject;
  566.                     $this->config['template'] = $template;
  567.                     // 👇 Meter todas las variables en un array
  568.                     $this->config['extras'] = [
  569.                         'entrenamiento' => $entrenamiento,
  570.                     ];
  571.                     break;
  572.             }
  573.             $this->send();
  574.         }
  575.     }
  576.     public function examenPeriodico($tipo$examenPeriodico = [], $cc = [])
  577.     {
  578.         $template "";
  579.         $subject "";
  580.         $this->config['cc'] = $cc;
  581.         foreach ($examenPeriodico as $ep) {
  582.             $this->config['entity'] = $ep;
  583.             switch ($tipo) {
  584.                 case 'notificacion':
  585.                     $subject "Recomendaciones Medicas Examen {$ep->getTipoExamen()->getNombre()} {$ep->getFecha()->format('Y-m-d')}";
  586.                     $template "notificacionExamPeri.html.twig";
  587.                     $this->config['to'] = $ep->getPersona()->getEmail();
  588.                     $this->config['subject'] = $subject;
  589.                     $this->config['template'] = $template;
  590.                     if ($ep->getSoporte()) {
  591.                         $this->config['atachment'] = ['evidencia_resultado' => "Repository/GHExamenPeriodico/{$ep->getSoporte()}"];
  592.                     }
  593.                     break;
  594.                 case 'notificacionGerencia':
  595.                     $subject "Notificación Examen Periodico";
  596.                     $template "notificacionExamPeriGerente.html.twig";
  597.                     $this->config['to'] = $ep->getColaboradorNotificacion()?->getEmail() ?? 'na@gmail.com';
  598.                     $this->config['subject'] = $subject;
  599.                     $this->config['template'] = $template;
  600.                     break;
  601.                 case 'desvinculacion':
  602.                     $subject "Notificación Desvinculacion";
  603.                     $template "notificarExamPeriDesvinculacion.html.twig";
  604.                     $this->config['to'] = $ep->getPersona()->getEmail();
  605.                     $this->config['subject'] = $subject;
  606.                     $this->config['template'] = $template;
  607.                     break;
  608.             }
  609.             $this->send();
  610.         }
  611.     }
  612.     public function visitaPeriodica($tipo$visitaPeriodica = [], $cc = [])
  613.     {
  614.         $template "";
  615.         $subject "";
  616.         $this->config['cc'] = $cc;
  617.         foreach ($visitaPeriodica as $vp) {
  618.             $this->config['entity'] = $vp;
  619.             switch ($tipo) {
  620.                 case 'rechazo':
  621.                     $subject "Validación Visita Domiciliaria {$vp->getPersona()->getNombres()}";
  622.                     $template "visPeriRechazo.html.twig";
  623.                     $this->config['to'] = $vp->getColaboradorNotificacion()->getEmail();
  624.                     $this->config['subject'] = $subject;
  625.                     $this->config['template'] = $template;
  626.                     break;
  627.                 case 'desvinculacion':
  628.                     $subject "Notificación Desvinculacion";
  629.                     $template "visPeriDesvinculacion.html.twig";
  630.                     $this->config['to'] = $vp->getPersona()->getEmail();
  631.                     $this->config['subject'] = $subject;
  632.                     $this->config['template'] = $template;
  633.                     break;
  634.             }
  635.             $this->send();
  636.         }
  637.     }
  638.     public function procesoDisciplinario($tipo$procesoDisciplinario = [], $cc = [])
  639.     {
  640.         $template "";
  641.         $subject "";
  642.         $this->config['cc'] = $cc;
  643.         foreach ($procesoDisciplinario as $pd) {
  644.             $this->config['entity'] = $pd;
  645.             switch ($tipo) {
  646.                 case 'notificacion':
  647.                     $subject "Proceso Disciplinario {$pd->getPersona()->getNombres()}";
  648.                     $template "proDisciNotificar.html.twig";
  649.                     $this->config['to'] = 'asoto@interlogisticazf.com';
  650.                     $this->config['subject'] = $subject;
  651.                     $this->config['template'] = $template;
  652.                     break;
  653.                 case 'aprobacion':
  654.                     $subject "Proceso Disciplinario {$pd->getPersona()->getNombres()}";
  655.                     $template "proDisciAprobado.html.twig";
  656.                     $this->config['to'] = $pd->getPersonaSolicita()->getEmail();
  657.                     $this->config['subject'] = $subject;
  658.                     $this->config['template'] = $template;
  659.                     break;
  660.                 case 'rechazo':
  661.                     $subject "Novedad Proceso Disciplinario {$pd->getPersona()->getNombres()}";
  662.                     $template "proDisciRechazo.html.twig";
  663.                     $this->config['to'] = $pd->getPersonaSolicita()->getEmail();
  664.                     $this->config['subject'] = $subject;
  665.                     $this->config['template'] = $template;
  666.                     break;
  667.                 case 'notificacionJuridica':
  668.                     $subject "Notificación Proceso Disciplinario";
  669.                     $template "proDisciNotificarJuridica.html.twig";
  670.                     $this->config['atachment'] = ['acta_descargos' => "Repository/GHProcesoDisciplinario/{$pd->getActa()}"];
  671.                     $this->config['to'] = $pd->getPersonaSolicita()->getEmail();
  672.                     $this->config['subject'] = $subject;
  673.                     $this->config['template'] = $template;
  674.                     break;
  675.                 case 'cierre':
  676.                     $subject "Proceso Disciplinario {$pd->getPersona()->getNombres()}";
  677.                     $template "proDisciCierre.html.twig";
  678.                     $this->config['to'] = $pd->getPersonaSolicita()->getEmail();
  679.                     $this->config['subject'] = $subject;
  680.                     $this->config['template'] = $template;
  681.                     break;
  682.             }
  683.             $this->send();
  684.         }
  685.     }
  686.     public function novedadNomina($tipo$novedadNomina = [], $cc = [], $personas = [])
  687.     {
  688.         $template "";
  689.         $subject "";
  690.         $this->config['cc'] = $cc;
  691.         $this->config['extras'] = [
  692.             'personas' => $personas# Para iterar
  693.         ];
  694.         foreach ($novedadNomina as $nn) {
  695.             $this->config['entity'] = $nn;
  696.             switch ($tipo) {
  697.                 case 'notificacion':
  698.                     $subject "Novedad Nomina {$nn->getPersona()->getNombres()} {$nn->getCreateAt()->format('Y-m-d')}"// Enviar asunto con fecha de novedad
  699.                     !
  700.                     $template "novedadNominaNotificar.html.twig";
  701.                     $conceptos $nn->getConceptoNomina();
  702.                     foreach ($conceptos as $concepto) {
  703.                         if ($concepto->getId() == 9) {
  704.                             $this->config['to'] = 'abenitez@interlogisticazf.com';
  705.                             $this->config['cc'] = ['acantor@interlogisticazf.com'];
  706.                         } else {
  707.                             $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  708.                         }
  709.                     }
  710.                     $this->config['subject'] = $subject;
  711.                     $this->config['template'] = $template;
  712.                     break;
  713.                 case 'rechazo':
  714.                     $subject "Rechazo Novedad Nomina";
  715.                     $template "novedadNominaRechazo.html.twig";
  716.                     $this->config['to'] = $nn->getPersona()->getEmail();
  717.                     $this->config['subject'] = $subject;
  718.                     $this->config['template'] = $template;
  719.                     break;
  720.                 case 'revision':
  721.                     $solicitante $nn->getPersona()->getNombres() ? $nn->getPersona()->getNombres() : 'N/A';
  722.                     $conceptos $nn->getConceptoNomina()->last() ? $nn->getConceptoNomina()->last()->getNombre() : 'N/A';
  723.                     $this->config['extras'] = [
  724.                         'concepto' => $conceptos,
  725.                     ];
  726.                     $subject "Revisión Novedad Nomina {$solicitante} {$nn->getCreateAt()->format('Y-m-d')}";
  727.                     $template "/GHNovedadNomina/revisionNoevdadNomina.html.twig";
  728.                     $this->config['to'] = $nn->getPersonaSolicita() && $nn->getPersonaSolicita()->getEmail() ? $nn->getPersonaSolicita()->getEmail() : 'na@gmail.com';
  729.                     $this->config['subject'] = $subject;
  730.                     $this->config['template'] = $template;
  731.                     break;
  732.                 case 'aprobacion':
  733.                     $solicitante $nn->getPersonaSolicita() ? $nn->getPersonaSolicita()->getEmail() : 'N/A';
  734.                     $subject "Aprobación Novedad Nomina";
  735.                     $template "novedadNominaAprobacion.html.twig";
  736.                     $this->config['to'] = $solicitante;
  737.                     $this->config['subject'] = $subject;
  738.                     $this->config['template'] = $template;
  739.                     break;
  740.                 case 'notificacionCargueMasivo':
  741.                     $hoy = (new \DateTime())->format('Y-m-d'); # Validar el dia que se realizo la carga masiva
  742.                     $subject "Notificación Novedades Nomina (Cargue Masivo) {$hoy}";
  743.                     $template "/GHNovedadNomina/notificacionCargaMasiva.html.twig";
  744.                     $this->config['to'] = "gestion.humana@logisticazf.com.co";
  745.                     $this->config['subject'] = $subject;
  746.                     $this->config['template'] = $template;
  747.                     break;
  748.             }
  749.             $this->send();
  750.         }
  751.     }
  752.     public function retiroCesantias($tipo$retiroCesantias = [], $cc = [])
  753.     {
  754.         $template "";
  755.         $subject "";
  756.         $this->config['cc'] = $cc;
  757.         foreach ($retiroCesantias as $rc) {
  758.             $this->config['entity'] = $rc;
  759.             switch ($tipo) {
  760.                 case 'notificacion':
  761.                     $subject "Solicitud Retiro Cesantias {$rc->getPersona()->getNombres()}";
  762.                     $template "retiroCesantiasNotificar.html.twig";
  763.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co'//$nn->getPersona()->getEmail();
  764.                     $this->config['subject'] = $subject;
  765.                     $this->config['template'] = $template;
  766.                     break;
  767.                 case 'rechazo':
  768.                     $subject "Novedad Retiro Cesantias {$rc->getPersona()->getNombres()}";
  769.                     $template "retiroCesantiasRechazo.html.twig";
  770.                     $this->config['to'] = $rc->getPersona()->getEmail();
  771.                     $this->config['subject'] = $subject;
  772.                     $this->config['template'] = $template;
  773.                     break;
  774.                 case 'aprobacion':
  775.                     $subject "Aprobación Retiro Cesantias {$rc->getPersona()->getNombres()}";
  776.                     $template "retiroCesantiasAprobacion.html.twig";
  777.                     // Validar que soporte tenga valor
  778.                     if($rc->getSoporte())
  779.                         $this->config['atachment'][] = "Repository/GHRetiroCesantias/{$rc->getSoporte()}";
  780.                     $this->config['to'] = $rc->getPersona()->getEmail();
  781.                     $this->config['subject'] = $subject;
  782.                     $this->config['template'] = $template;
  783.                     break;
  784.             }
  785.             $this->send();
  786.         }
  787.     }
  788.     public function desvinculacion($tipo$desvinculacion = [], $cc = [])
  789.     {
  790.         $template "";
  791.         $subject "";
  792.         $this->config['cc'] = $cc;
  793.         foreach ($desvinculacion as $d) {
  794.             $this->config['entity'] = $d;
  795.             switch ($tipo) {
  796.                 case 'notificacion':
  797.                     $subject "Retiro de personal {$d->getPersona()->getNombres()}";
  798.                     $template "desvinculacionNotificar.html.twig";
  799.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  800.                     $this->config['subject'] = $subject;
  801.                     $this->config['template'] = $template;
  802.                     break;
  803.                 case 'confirmar':
  804.                     $subject "Retiro de personal {$d->getFechaDesvinculacion()->format('Y-m-d')} {$d->getPersona()->getNombres()}";
  805.                     $template "desvinculacionConfirmar.html.twig";
  806.                     $this->config['to'] = 'coordinadores@interlogisticazf.com';
  807.                     $this->config['subject'] = $subject;
  808.                     $this->config['template'] = $template;
  809.                     break;
  810.                 case 'iniciar':
  811.                     $subject "Información Desvinculación {$d->getPersona()->getNombres()}";
  812.                     $template "desvinculacionIniciar.html.twig";
  813.                     $docEntregaCargo $this->em->getRepository(\App\Entity\DocDocumento::class)->find(17);
  814.                     $docPazSalvo $this->em->getRepository(\App\Entity\DocDocumento::class)->find(18);
  815.                     // dump($docEntregaCargo->getArchivo());
  816.                     $this->config['atachment'] = ['entrega_cargo' => "Repository/DocDocumento/{$docEntregaCargo->getArchivo()}"'paz_salvo' => "Repository/DocDocumento/{$docPazSalvo->getArchivo()}"]; //, 'paz_salvo' => "Repository/DocDocumento/{$docPazSalvo->getArchivo()}"
  817.                     $this->config['to'] = $d->getPersona()->getEmail();
  818.                     $this->config['subject'] = $subject;
  819.                     $this->config['template'] = $template;
  820.                     break;
  821.                 case 'notificarDestruccionDianCarnet':
  822.                     $subject "Desvinculación DIAN {$d->getPersona()}";
  823.                     $template "GHDesvinculacion/notificarDestruccionCarnetDian.html.twig";
  824.                     // dump($docEntregaCargo->getArchivo());
  825.                     $this->config['to'] = "gestion.humana@logisticazf.com.co";
  826.                     $this->config['subject'] = $subject;
  827.                     $this->config['template'] = $template;
  828.                     break;
  829.                 case 'registroInicial':
  830.                     $subject "Proceso de Desvinculación";
  831.                     $template "desvinculacionRegistroDian.html.twig";
  832.                     $this->config['to'] = $d->getPersona()->getEmail();
  833.                     $this->config['subject'] = $subject;
  834.                     $this->config['template'] = $template;
  835.                     break;
  836.                 case 'notificarLiquidacion':
  837.                     $subject "Liquidación {$d->getPersona()->getNombres()}";
  838.                     $template "desvinculacionLiquidacion.html.twig";
  839.                     $this->config['to'] = 'ealvarez@logisticazf.com.co'//$d->getPersona()->getEmail();
  840.                     $this->config['subject'] = $subject;
  841.                     $this->config['template'] = $template;
  842.                     break;
  843.                 case 'notificarLiquidacionRechazo':
  844.                     $subject "Liquidación {$d->getPersona()->getNombres()}";
  845.                     $template "desvinculacionLiquidacionRechazo.html.twig";
  846.                     $this->config['to'] = 'acantor@linterogisticazf.com';
  847.                     $this->config['subject'] = $subject;
  848.                     $this->config['template'] = $template;
  849.                     break;
  850.                 case 'notificarPago':
  851.                     $subject "Solicitud Pago Liquidación {$d->getPersona()->getNombres()}";
  852.                     $template "desvinculacionLiquidacionPago.html.twig";
  853.                     $this->config['to'] = 'gestion.humana@logisticazf.com.co';
  854.                     $this->config['subject'] = $subject;
  855.                     $this->config['template'] = $template;
  856.                     break;
  857.             }
  858.             return $this->send();
  859.         }
  860.     }
  861.     public function norma($tipo$norma = [], $cc = [])
  862.     {
  863.         $template "";
  864.         $subject "";
  865.         $this->config['cc'] = $cc;
  866.         foreach ($norma as $n) {
  867.             $this->config['entity'] = $n;
  868.             switch ($tipo) {
  869.                 case 'notificacion':
  870.                     $usuarios $this->em->getRepository(\App\Entity\TerPersona::class)->findBy(['estado' => 1]);
  871.                     $destinatarios = [];
  872.                     foreach ($usuarios as $u) {
  873.                         $destinatarios[] = $u->getEmail();
  874.                     }
  875.                     $this->config['to'] = $destinatarios[0];
  876.                     if (count($cc) == 0) {
  877.                         $this->config['cc'] = $destinatarios;
  878.                     }
  879.                     $subject "Notificación Normativa {$n->getConsNorma()}";
  880.                     $template "normaNotificar.html.twig";
  881.                     $this->config['subject'] = $subject;
  882.                     $this->config['template'] = $template;
  883.                     break;
  884.             }
  885.             $this->send();
  886.         }
  887.     }
  888.     public function JurProceso($tipo$proceso = [], $cc = [])
  889.     {
  890.         $template "";
  891.         $subject "";
  892.         $this->config['cc'] = $cc;
  893.         foreach ($proceso as $p) {
  894.             $this->config['entity'] = $p;
  895.             switch ($tipo) {
  896.                 case 'vencimiento':
  897.                     //   $usuarios = $this->em->getRepository(\App\Entity\TerPersona::class)->findBy(['estado' => 1]);
  898. //                    $destinatarios = [];
  899. //                    foreach ($usuarios as $u) {
  900.                     $this->config['to'] = 'ccasstaneda@it-systems.com.co';
  901.                     //     $destinatarios[] = $u->getEmail();
  902.                     // }
  903.                     //   $this->config['cc'] = $destinatarios;
  904.                     $subject "Notificación Vencimiento Proceso";
  905.                     $template "jurProcesoVencimiento.html.twig";
  906.                     $this->config['subject'] = $subject;
  907.                     $this->config['template'] = $template;
  908.                     break;
  909.             }
  910.             $this->send();
  911.         }
  912.     }
  913.     public function operacionSospechosa($tipo$operacion = [], $cc = [])
  914.     {
  915.         $template "";
  916.         $subject "";
  917.         $this->config['cc'] = $cc;
  918.         foreach ($operacion as $os) {
  919.             $this->config['entity'] = $os;
  920.             switch ($tipo) {
  921.                 case 'creacion':
  922.                     $usuarioReporta $this->em->getRepository(\App\Entity\TerPersona::class)->findOneBy(['numeroDocumento' => $os->getCreateUser()]);
  923.                     //  foreach ($usuarios as $u) {
  924.                     $this->config['to'] = 'fcastiblanco@interlogisticazf.com';
  925.                     //    $destinatarios[] = $u->getEmail();
  926.                     //  }
  927.                     //$this->config['cc'] = $destinatarios;
  928.                     $this->config['extras'] = ['procesoSolicitante' => $usuarioReporta->getPerfilCargo()->getParProceso()->getNombre()];
  929.                     $subject "Operación Sospechosa {$usuarioReporta->getPerfilCargo()->getParProceso()->getNombre()}";
  930.                     $template "operacionSospechosaNueva.html.twig";
  931.                     $this->config['subject'] = $subject;
  932.                     $this->config['template'] = $template;
  933.                     break;
  934.                 case 'notificacion':
  935.                     //$usuarios = $this->em->getRepository(\App\Entity\TerPersona::class)->findBy(['estado' => 1]);
  936.                     $destinatarios = ['nneuta@interlogisticazf.com''icuellar@interlogisticazf.com''ealvarez@logisticazf.com''fcastiblanco@interlogisticazf.com'];
  937.                     //  foreach ($usuarios as $u) {
  938.                     $this->config['to'] = $destinatarios[0];
  939.                     //    $destinatarios[] = $u->getEmail();
  940.                     //  }
  941.                     $this->config['cc'] = $destinatarios;
  942.                     $subject "Notificación Reporte UIAF";
  943.                     $template "operacionSospechosaNotificar.html.twig";
  944.                     $this->config['subject'] = $subject;
  945.                     $this->config['template'] = $template;
  946.                     break;
  947.             }
  948.             $this->send();
  949.         }
  950.     }
  951.     public function cambioContrato($tipo$cambioContrato = [], $cc = [])
  952.     {
  953.         $template "";
  954.         $subject "";
  955.         $this->config['cc'] = $cc;
  956.         foreach ($cambioContrato as $ccon) {
  957.             $this->config['entity'] = $ccon;
  958.             switch ($tipo) {
  959.                 case 'notificacion':
  960.                     $destinatarios = [];
  961.                     if ($ccon->getColaborador()->getPerfilCargo()) {
  962.                         foreach ($ccon->getColaborador()->getPerfilCargo()->getPersona() as $usuario) {
  963.                             if ($usuario->hasNivelDirector()) {
  964.                                 $destinatarios[] = $usuario->getEmail();
  965.                             }
  966.                         }
  967.                     }
  968.                     $this->config['to'] = 'icuellar@interlogisticazf.com';
  969.                     $this->config['cc'] = ['nneuta@interlogisticazf.com'];
  970.                     $subject "Solicitud Cambio Condiciones {$ccon->getColaborador()->getNombres()}";
  971.                     $template "notificarCambioContrato.html.twig";
  972.                     $this->config['subject'] = $subject;
  973.                     $this->config['template'] = $template;
  974.                     break;
  975.                 case 'notificacionGH':
  976.                     $this->config['to'] = "gestion.humana@logisticazf.com.co";
  977.                     $currentDate date("d/m/Y");
  978.                     $subject " Solicitud de Modificación Condiciones de Contrato {$ccon->getColaborador()->getNombres()} {$currentDate}";
  979.                     $template "notificarCambioContratoGH.html.twig";
  980.                     $this->config['subject'] = $subject;
  981.                     $this->config['template'] = $template;
  982.                     break;
  983.                 case 'rechazo':
  984.                     $destinatarios = ['gestion.humana@logisticazf.com.co'];
  985.                     $this->config['to'] = $ccon->getUsuarioSolicita()->getEmail();
  986.                     $this->config['cc'] = $destinatarios;
  987.                     $subject "Rechazo Cambio Condiciones {$ccon->getColaborador()->getNombres()}";
  988.                     $template "rechazarCambioContrato.html.twig";
  989.                     $this->config['subject'] = $subject;
  990.                     $this->config['template'] = $template;
  991.                     break;
  992.             }
  993.             $this->send();
  994.         }
  995.     }
  996.     public function diligencia($tipo$diligencia = [], $cc = [])
  997.     {
  998.         $template "";
  999.         $subject "";
  1000.         $this->config['cc'] = $cc;
  1001.         foreach ($diligencia as $entity) {
  1002.             $this->config['entity'] = $entity;
  1003.             switch ($tipo) {
  1004.                 case 'notificacion':
  1005.                     $destinatarios = [];
  1006.                     if ($entity->getPersonaSolicita()->getPerfilCargo()) {
  1007.                         foreach ($entity->getPersonaSolicita()->getPerfilCargo()->getPersona() as $usuario) {
  1008.                             if ($usuario->hasNivelDirector()) {
  1009.                                 $destinatarios[] = $usuario->getEmail();
  1010.                             }
  1011.                         }
  1012.                     }
  1013.                     $this->config['to'] = count($destinatarios) > $destinatarios[0] : $entity->getPersonaSolicita()->getEmail();
  1014.                     $this->config['cc'] = $destinatarios;
  1015.                     $subject "Solicitud Autorización Diligencia {$entity->getfechaSolicitud()->format('Y-m-d')}";
  1016.                     $template "notificarDiligencia.html.twig";
  1017.                     $this->config['subject'] = $subject;
  1018.                     $this->config['template'] = $template;
  1019.                     break;
  1020.                 case 'aprobar':
  1021.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1022.                     //  foreach ($usuarios as $u) {
  1023.                     $this->config['to'] = $entity->getPersonaSolicita()->getEmail();
  1024.                     $destinatarios[] = 'mensajeria@interlogisticazf.com';
  1025.                     //  }
  1026.                     $this->config['cc'] = $destinatarios;
  1027.                     $subject "Solicitud Autorización Diligencia {$entity->getfechaDiligencia()->format('Y-m-d')}";
  1028.                     $template "aprobarDiligencia.html.twig";
  1029.                     $this->config['subject'] = $subject;
  1030.                     $this->config['template'] = $template;
  1031.                     break;
  1032.                 case 'rechazo':
  1033.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1034.                     //  foreach ($usuarios as $u) {
  1035.                     $this->config['to'] = $entity->getPersonaSolicita()->getEmail();
  1036.                     $destinatarios[] = 'mensajeria@interlogisticazf.com';
  1037.                     //  }
  1038.                     $this->config['cc'] = $destinatarios;
  1039.                     $subject "Solicitud Autorización Diligencia {$entity->getfechaDiligencia()->format('Y-m-d')}";
  1040.                     $template "rechazarDiligencia.html.twig";
  1041.                     $this->config['subject'] = $subject;
  1042.                     $this->config['template'] = $template;
  1043.                     break;
  1044.             }
  1045.             $this->send();
  1046.         }
  1047.     }
  1048.     public function envioCorrespondencia($tipo$entities = [], $cc = [])
  1049.     {
  1050.         $template "";
  1051.         $subject "";
  1052.         $this->config['cc'] = $cc;
  1053.         foreach ($entities as $entity) {
  1054.             $this->config['entity'] = $entity;
  1055.             switch ($tipo) {
  1056.                 case 'notificacion':
  1057.                     $this->config['to'] = 'mensajeria@interlogisticazf.com';
  1058.                     $subject "Solicitud Correspondencia {$entity->getParCiudadesCorrespondencia()->getNombre()}";
  1059.                     $template "notificarEnvioCorrespondencia.html.twig";
  1060.                     $this->config['subject'] = $subject;
  1061.                     $this->config['template'] = $template;
  1062.                     break;
  1063.                 case 'notificacionGuia':
  1064.                     $this->config['to'] = $entity->getRemitente()->getEmail() ?? 'N/A';
  1065.                     $subject "Envío Correspondencia Sucursal No. {$entity->getId()} {$entity->getCliente()->getNombre()}";
  1066.                     $template "notificarEnvioCorrespondenciaGuia.html.twig";
  1067.                     $this->config['subject'] = $subject;
  1068.                     $this->config['template'] = $template;
  1069.                     break;
  1070.                 case 'finalizacion':
  1071.                     $this->config['to'] = $entity->getRemitente()->getEmail() ?? 'N/A';
  1072.                     $subject "Entrega Correspondencia Sucursal No. {$entity->getId()} {$entity->getCliente()->getNombre()}";
  1073.                     $template "finalizacionEnvioCorrespondencia.html.twig";
  1074.                     $this->config['subject'] = $subject;
  1075.                     $this->config['template'] = $template;
  1076.                     break;
  1077.             }
  1078.             $this->send();
  1079.         }
  1080.     }
  1081.     public function solicitudSuministro($tipo$entities = [], $tipoSuministro$cc = [])
  1082.     {
  1083.         $template "";
  1084.         $subject "";
  1085.         $this->config['cc'] = $cc;
  1086.         foreach ($entities as $entity) {
  1087.             $this->config['entity'] = $entity;
  1088.             switch ($tipo) {
  1089.                 case 'notificacion':
  1090.                     $this->config['to'] = 'recursofisico@interlogisticazf.com';
  1091.                     $this->config['cc'] = ['archivo.bog@interlogisticazf.com'];
  1092.                     //    $destinatarios[] = $u->getEmail();
  1093.                     //  }
  1094.                     $subject "Solicitud de Suministros de Archivo {$entity->getProceso()->getNombre()}";
  1095.                     $template "notificarSolicitudSuministro.html.twig";
  1096.                     $this->config['subject'] = $subject;
  1097.                     $this->config['template'] = $template;
  1098.                     //  Meter todas las variables en un array
  1099.                     //para acceder seria {{ extras.tipoSuministro }}
  1100.                     $this->config['extras'] = [
  1101.                         'tipoSumistro' => $tipoSuministro,
  1102.                     ];
  1103.                     break;
  1104.                 case 'aprobacion':
  1105.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1106.                     //  foreach ($usuarios as $u) {
  1107.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1108.                     //    $destinatarios[] = $u->getEmail();
  1109.                     //  }
  1110.                     //$this->config['cc'] = $destinatarios;
  1111.                     $subject "Solicitud de Suministro de Archivo {$entity->getProceso()->getNombre()}";
  1112.                     $template "aprobacionSolicitudSuministro.html.twig";
  1113.                     $this->config['subject'] = $subject;
  1114.                     $this->config['template'] = $template;
  1115.                     break;
  1116.             }
  1117.             $this->send();
  1118.         }
  1119.     }
  1120.     public function tablaRetencion($tipo$entities = [], $cc = [])
  1121.     {
  1122.         $template "";
  1123.         $subject "";
  1124.         $this->config['cc'] = $cc;
  1125.         foreach ($entities as $entity) {
  1126.             $this->config['entity'] = $entity;
  1127.             switch ($tipo) {
  1128.                 case 'notificacion':
  1129.                     $destinatarios = [];
  1130.                     //$revisionDirectorProceso as perfilCargo por edicion.
  1131.                     foreach ($entity->getRevisionDirectorProceso()->getPersona() as $usuario) {
  1132.                         //foreach ($pc->getPersona() as $usuario) {
  1133.                         if ($usuario->hasNivelDirector()) {
  1134.                             $destinatarios[] = $usuario->getEmail();
  1135.                         }
  1136.                         //}
  1137.                     }
  1138.                     $this->config['to'] = count($destinatarios) > $destinatarios[0] : 'recursofisico@interlogisticazf.com';
  1139.                     //$this->config['cc'] = ['archivo.bog@interlogisticazf.com'];
  1140.                     //    $destinatarios[] = $u->getEmail();
  1141.                     //  }
  1142.                     $subject "Solicitud de Aprobación Tabla de Retención Documental {$entity->getProceso()->getNombre()}";
  1143.                     $template "notificarTablaRetencion.html.twig";
  1144.                     $this->config['subject'] = $subject;
  1145.                     $this->config['template'] = $template;
  1146.                     break;
  1147.                 case 'rechazo':
  1148.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1149.                     //  foreach ($usuarios as $u) {
  1150.                     $this->config['to'] = 'recursofisico@interlogisticazf.com';
  1151.                     //    $destinatarios[] = $u->getEmail();
  1152.                     //  }
  1153.                     //$this->config['cc'] = $destinatarios;
  1154.                     $subject "Observación Tabla de Retención";
  1155.                     $template "rechazarTablaRetencion.html.twig";
  1156.                     $this->config['subject'] = $subject;
  1157.                     $this->config['template'] = $template;
  1158.                     break;
  1159.                 case 'actualizacion':
  1160.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1161.                     //  foreach ($usuarios as $u) {
  1162.                     $this->config['to'] = 'recursofisico@interlogisticazf.com';
  1163.                     //    $destinatarios[] = $u->getEmail();
  1164.                     //  }
  1165.                     //$this->config['cc'] = $destinatarios;
  1166.                     $subject "Actualización tabla de retención";
  1167.                     $template "actualizarTablaRetencion.html.twig";
  1168.                     $this->config['subject'] = $subject;
  1169.                     $this->config['template'] = $template;
  1170.                     break;
  1171.             }
  1172.             $this->send();
  1173.         }
  1174.     }
  1175.     public function FUID($tipo$entities = [], $cc = [])
  1176.     {
  1177.         $template "";
  1178.         $subject "";
  1179.         $this->config['cc'] = $cc;
  1180.         foreach ($entities as $entity) {
  1181.             $this->config['entity'] = $entity;
  1182.             switch ($tipo) {
  1183.                 case 'notificacion':
  1184.                     $destinatarios = [];
  1185.                     $this->config['to'] = $entity->getUsuarioElabora()->getEmail();
  1186.                     $this->config['cc'] = [' recursofisico@interlogisticazf.com''archivo.bog@interlogisticazf.com'];
  1187.                     //    $destinatarios[] = $u->getEmail();
  1188.                     //  }
  1189.                     $subject "Creación FUID Caja No. {$entity->getCaja()->getCodigo()}";
  1190.                     $template "notificarFUID.html.twig";
  1191.                     $this->config['subject'] = $subject;
  1192.                     $this->config['template'] = $template;
  1193.                     break;
  1194.                 case 'rechazo':
  1195.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1196.                     //  foreach ($usuarios as $u) {
  1197.                     $this->config['to'] = $entity->getUsuarioElabora()->getEmail();
  1198.                     //    $destinatarios[] = $u->getEmail();
  1199.                     //  }
  1200.                     //$this->config['cc'] = $destinatarios;
  1201.                     $subject "Devolución FUID Caja No. {$entity->getCaja()->getCodigo()}";
  1202.                     $template "rechazarFUID.html.twig";
  1203.                     $this->config['subject'] = $subject;
  1204.                     $this->config['template'] = $template;
  1205.                     break;
  1206.                 case 'actualizacion':
  1207.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1208.                     //  foreach ($usuarios as $u) {
  1209.                     $this->config['to'] = 'recursofisico@interlogisticazf.com';
  1210.                     //    $destinatarios[] = $u->getEmail();
  1211.                     //  }
  1212.                     //$this->config['cc'] = $destinatarios;
  1213.                     $subject "Actualización tabla de retención";
  1214.                     $template "actualizarTablaRetencion.html.twig";
  1215.                     $this->config['subject'] = $subject;
  1216.                     $this->config['template'] = $template;
  1217.                     break;
  1218.             }
  1219.             $this->send();
  1220.         }
  1221.     }
  1222.     public function solicitudDocumento($tipo$entities = [], $cc = [], $obj null)
  1223.     {
  1224.         $template "";
  1225.         $subject "";
  1226.         $this->config['cc'] = $cc;
  1227.         foreach ($entities as $entity) {
  1228.             $this->config['entity'] = $entity;
  1229.             $numDoc $obj?->getId() ?? null;
  1230.             if ($obj instanceof \App\Entity\RFInventarioDocumentalComex) {
  1231.                 $numDoc strip_tags("<b>DO:</b>{$obj->getNumeroDO()}");
  1232.             } else if ($obj instanceof \App\Entity\RFInventarioDocumentalComercial) {
  1233.                 $numDoc strip_tags("<b>NIT:</b>{$obj->getNit()} ");
  1234.             } else if ($obj instanceof \App\Entity\RFInventarioDocumentalGesHum) {
  1235.                 $numDoc strip_tags("<b>No. Cédula:</b>{$obj->getNumeroDocumento()} ");
  1236.             } else if ($obj instanceof \App\Entity\RFInventarioDocumentalSST) {
  1237.                 $numDoc strip_tags("<b>Año:</b>{$obj->getAno()} ");
  1238.             } else if ($obj instanceof \App\Entity\RFInventarioDocumentalFinanzas) {
  1239.                 $numDoc strip_tags("<b>Numero Inicial:</b>{$obj->getNumeroInicial()} ");
  1240.             }
  1241.             $this->config['extras'] = ['numeroDocumento' => $numDoc];
  1242.             switch ($tipo) {
  1243.                 case 'notificacion':
  1244.                     $destinatarios = [];
  1245.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1246.                     $this->config['cc'] = ['recursofisico@interlogisticazf.com''archivo.bog@interlogisticazf.com'];
  1247.                     //    $destinatarios[] = $u->getEmail();
  1248.                     //  }
  1249.                     if ($entity->getTipoSolicitud()->getId() == 1) {
  1250.                         $subject "Solicitud Documento Digital {$numDoc}";
  1251.                     } else {
  1252.                         $subject "Solicitud Prestamo Físico {$numDoc}";
  1253.                     }
  1254.                     $template "notificarSolicitudDocumento.html.twig";
  1255.                     $this->config['subject'] = $subject;
  1256.                     $this->config['template'] = $template;
  1257.                     break;
  1258.                 case 'gestionar':
  1259.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1260.                     //  foreach ($usuarios as $u) {
  1261.                     if ($entity->getTipoSolicitud()->getId() == 1) {
  1262.                         $subject "Solicitud Documento Digital {$numDoc}";
  1263.                     } else {
  1264.                         $subject "Solicitud Prestamo Físico {$numDoc}";
  1265.                     }
  1266.                     $template "gestionarSolicitudDocumento.html.twig";
  1267.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1268.                     //    $destinatarios[] = $u->getEmail();
  1269.                     //  }
  1270.                     //$this->config['cc'] = $destinatarios;
  1271.                     $this->config['subject'] = $subject;
  1272.                     $this->config['template'] = $template;
  1273.                     break;
  1274.                 case 'entregar':
  1275.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1276.                     //  foreach ($usuarios as $u) {
  1277.                     $this->config['cc'] = ['archivo.bog@interlogisticazf.com'];
  1278.                     $subject "Confirmación Entrega Documento Físico {$numDoc}";
  1279.                     $template "entregarSolicitudDocumento.html.twig";
  1280.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1281.                     //    $destinatarios[] = $u->getEmail();
  1282.                     //  }
  1283.                     //$this->config['cc'] = $destinatarios;
  1284.                     $this->config['subject'] = $subject;
  1285.                     $this->config['template'] = $template;
  1286.                     break;
  1287.                 case 'recordar':
  1288.                     // $destinatarios = ['gestion.humana@logisticazf.com.co'];
  1289.                     //  foreach ($usuarios as $u) {
  1290.                     if ($entity->getTipoSolicitud()->getId() == 1) {
  1291.                         $subject "Solicitud Documento Digital No. {$numDoc}";
  1292.                     } else {
  1293.                         $subject "Solicitud Prestamo Físico No. {$numDoc}";
  1294.                     }
  1295.                     $template "gestionarSolicitudDocumento.html.twig";
  1296.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1297.                     //    $destinatarios[] = $u->getEmail();
  1298.                     //  }
  1299.                     //$this->config['cc'] = $destinatarios;
  1300.                     $this->config['subject'] = $subject;
  1301.                     $this->config['template'] = $template;
  1302.                     break;
  1303.             }
  1304.             $this->send();
  1305.         }
  1306.     }
  1307.     public function registroInscripcion($tipo$entities = [], $cc = [])
  1308.     {
  1309.         $template "";
  1310.         $subject "";
  1311.         $this->config['cc'] = $cc;
  1312.         foreach ($entities as $entity) {
  1313.             $this->config['entity'] = $entity;
  1314.             switch ($tipo) {
  1315.                 case 'notificar':
  1316.                     $this->config['to'] = "gestion.humana@logisticazf.com.co";
  1317.                     $subject "Solicitud Registro DIAN {$entity->getPersona()->getNombres()}";
  1318.                     $template "notificarRegistroInscripcion.html.twig";
  1319.                     $this->config['subject'] = $subject;
  1320.                     $this->config['template'] = $template;
  1321.                     break;
  1322.             }
  1323.             $this->send();
  1324.         }
  1325.     }
  1326.     public function ingresoVisitante($tipo$entities = [], $cc = [], $visitanteRechazado null)
  1327.     {
  1328.         $template "";
  1329.         $subject "";
  1330.         $this->config['cc'] = $cc;
  1331.         foreach ($entities as $entity) {
  1332.             $this->config['entity'] = $entity;
  1333.             $this->config['extras'] = $visitanteRechazado;
  1334.             switch ($tipo) {
  1335.                 case 'notificar':
  1336.                     $this->config['to'] = "seguridad@logisticazf.com.co";
  1337.                     $ingresoVisitante $entity->getVisitante();
  1338.                     $visitantesActuales count($ingresoVisitante);
  1339.                     // Nombre solicitante
  1340.                     $nombreSolicitante $entity->getUsuarioSolicita()->getNombres();
  1341.                     if ($visitantesActuales $entity->getCantidadVisitantes()) {
  1342.                         $nuevosVisitantes = [];
  1343.                         foreach ($ingresoVisitante as $visitanteNuevo) {
  1344.                             $nuevosVisitantes[] = $visitanteNuevo->getNombres();
  1345.                         }
  1346.                         $visitantesNuevosString implode(", "$nuevosVisitantes);
  1347.                         $subject "Hay Nuevos Visitantes en la Solicitud Ingreso Visitante. {$entity->getFechaVisita()->format('Y-m-d')} $visitantesNuevosString";
  1348.                     } else {
  1349.                         $nombresVisitantes = [];
  1350.                         foreach ($ingresoVisitante as $visitante) {
  1351.                             $nombresVisitantes[] = $visitante->getNombres();
  1352.                         }
  1353.                         $subject "Solicitud Ingreso Visitante. {$entity->getFechaVisita()->format('Y-m-d')},  {$nombreSolicitante}";
  1354.                     }
  1355.                     $template "notificarIngresoVisitante.html.twig";
  1356.                     $this->config['subject'] = $subject;
  1357.                     $this->config['template'] = $template;
  1358.                     break;
  1359.                 case 'confirmar':
  1360.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1361.                     $subject "Visitante {$entity->getEmpresaOrigen()} Autorizado";
  1362.                     $template "confirmarIngresoVisitante.html.twig";
  1363.                     $this->config['subject'] = $subject;
  1364.                     $this->config['template'] = $template;
  1365.                     break;
  1366.                 case 'rechazar':
  1367.                     $this->config['to'] = $entity->getUsuarioSolicita()->getEmail();
  1368.                     $nombre $visitanteRechazado
  1369.                         $visitanteRechazado->getNombres()
  1370.                         : $entity->getVisitante()->last()->getNombres();
  1371.                     $subject "Visitante {$nombre} No Autorizado";
  1372.                     $template "rechazarIngresoVisitante.html.twig";
  1373.                     $this->config['subject'] = $subject;
  1374.                     $this->config['template'] = $template;
  1375.                     break;
  1376.                 case 'cambioVisitante':
  1377.                     $this->config['to'] = "seguridad@logisticazf.com.co";
  1378.                     $subject ' Cambios Solicitud Ingreso Visitante. ' $entity->getUpdateAt()->format('Y-m-d') . ' ' $entity->getUsuarioSolicita()->getNombres();;
  1379.                     $template "cambioSoliVisitante.html.twig";
  1380.                     $this->config['subject'] = $subject;
  1381.                     $this->config['template'] = $template;
  1382.                     break;
  1383.             }
  1384.             $this->send();
  1385.         }
  1386.     }
  1387.     public function solicitudCCTV($tipo$entities = [], $cc = [])
  1388.     {
  1389.         $template "";
  1390.         $subject "";
  1391.         $this->config['cc'] = $cc;
  1392.         foreach ($entities as $entity) {
  1393.             $this->config['entity'] = $entity;
  1394.             switch ($tipo) {
  1395.                 case 'notificar':
  1396.                     $this->config['to'] = "seguridad@logisticazf.com.co";
  1397.                     $subject "Reporte CCTV OT " $entity->getOT();
  1398.                     $template "notificarSolicitudCCTV.html.twig";
  1399.                     $this->config['subject'] = $subject;
  1400.                     $this->config['template'] = $template;
  1401.                     break;
  1402.                 case 'reportar':
  1403.                     $this->config['to'] = $entity->getSolicitante()->getEmail();
  1404.                     $subject "Reporte CCTV OT {$entity->getOT()}";
  1405.                     $template "reportarSolicitudCCTV.html.twig";
  1406.                     $this->config['atachment'] = ['documento' => "Repository/SegSolicitudCCTV/{$entity->getReporteCCTV()}"];
  1407.                     $this->config['subject'] = $subject;
  1408.                     $this->config['template'] = $template;
  1409.                     break;
  1410.                 case 'rechazar':
  1411.                     $this->config['to'] = "seguridad@logisticazf.com.co";
  1412.                     $subject "Reporte CCTV OT {$entity->getOT()}";
  1413.                     $template "rechazarSolicitudCCTV.html.twig";
  1414.                     $this->config['subject'] = $subject;
  1415.                     $this->config['template'] = $template;
  1416.                     break;
  1417.             }
  1418.             $this->send();
  1419.         }
  1420.     }
  1421.     public function precintoRegistro($tipo$entities = [], $cc = [])
  1422.     {
  1423.         $template "";
  1424.         $subject "";
  1425.         $this->config['cc'] = $cc;
  1426.         foreach ($entities as $entity) {
  1427.             $this->config['entity'] = $entity;
  1428.             switch ($tipo) {
  1429.                 case 'reportar':
  1430.                     $this->config['to'] = "recursofisico@interlogisticazf.com";
  1431.                     $subject "Novedad Precinto {$entity->getPrecintoCodigo()->getPrecintoSolicitud()->getSede()->getNombre()}";
  1432.                     $template "notificarPrecintoRegistro.html.twig";
  1433.                     $this->config['subject'] = $subject;
  1434.                     $this->config['template'] = $template;
  1435.                     break;
  1436.             }
  1437.             $this->send();
  1438.         }
  1439.     }
  1440.     public function solicitudCompra($tipo$entities = [], $cc = [])
  1441.     {
  1442.         $template "";
  1443.         $subject "";
  1444.         $this->config['cc'] = $cc;
  1445.         foreach ($entities as $entity) {
  1446.             $this->config['entity'] = $entity;
  1447.             switch ($tipo) {
  1448.                 case 'notificar':
  1449.                     $this->config['to'] = "recursofisico@interlogisticazf.com";
  1450.                     $subject "Solicitud de Compra No. {$entity->getId()}";
  1451.                     $template "notificarSolicitudCompra.html.twig";
  1452.                     $this->config['subject'] = $subject;
  1453.                     $this->config['template'] = $template;
  1454.                     break;
  1455.                 case 'incompleta':
  1456.                     $this->config['to'] = "{$entity->getSolicitante()->getEmail()}";
  1457.                     $subject "Estado Solicitud de Compra No. {$entity->getId()}";
  1458.                     $template "incompletaSolicitudCompra.html.twig";
  1459.                     $this->config['subject'] = $subject;
  1460.                     $this->config['template'] = $template;
  1461.                     break;
  1462.                 case 'sinProveedor':
  1463.                     $this->config['to'] = "{$entity->getSolicitante()->getEmail()}";
  1464.                     $subject "Estado Solicitud de Compra No. {$entity->getId()}";
  1465.                     $template "sinProveedorSolicitudCompra.html.twig";
  1466.                     $this->config['subject'] = $subject;
  1467.                     $this->config['template'] = $template;
  1468.                     break;
  1469.                 case 'aprobar':
  1470.                     $this->config['to'] = "{$entity->getUsuarioAprobacion()->getEmail()}";
  1471.                     $subject "Aprobación de Compra No. {$entity->getId()}";
  1472.                     $template "aprobarSolicitudCompra.html.twig";
  1473.                     $this->config['subject'] = $subject;
  1474.                     $this->config['template'] = $template;
  1475.                     break;
  1476.                 case 'rechazar':
  1477.                     $this->config['to'] = "{$entity->getSolicitante()->getEmail()}";
  1478.                     $subject "Observaciones de Compra No. {$entity->getId()}";
  1479.                     $template "rechazarSolicitudCompra.html.twig";
  1480.                     $this->config['subject'] = $subject;
  1481.                     $this->config['template'] = $template;
  1482.                     break;
  1483.             }
  1484.             $this->send();
  1485.         }
  1486.     }
  1487.     public function ordenCompra($tipo$entities = [], $cc = [])
  1488.     {
  1489.         $template "";
  1490.         $subject "";
  1491.         $this->config['cc'] = $cc;
  1492.         foreach ($entities as $entity) {
  1493.             $this->config['entity'] = $entity;
  1494.             switch ($tipo) {
  1495.                 case 'notificar':
  1496.                     $this->config['to'] = $entity->getSolicitante()->getEmail();
  1497.                     $subject "Notificación Compra No. {$entity->getId()}";
  1498.                     $template "notificarOrdenCompra.html.twig";
  1499.                     $this->config['subject'] = $subject;
  1500.                     $this->config['template'] = $template;
  1501.                     break;
  1502.             }
  1503.             $this->send();
  1504.         }
  1505.     }
  1506.     public function rembolsoCajaMenor($tipo$entities = [], $cc = [])
  1507.     {
  1508.         $template "";
  1509.         $subject "";
  1510.         $this->config['cc'] = $cc;
  1511.         foreach ($entities as $entity) {
  1512.             $this->config['entity'] = $entity;
  1513.             switch ($tipo) {
  1514.                 case 'notificar':
  1515.                     $this->config['to'] = "finanzas@logisticazf.com.co";
  1516.                     $subject "Legalización Caja Menor {$entity->getEmpresaFilial()->getNombre()} {$entity->getFecha()->format('Y-m-d')}";
  1517.                     $template "notificarRembolsoCajaMenor.html.twig";
  1518.                     $this->config['atachment'] = ['documento' => "Repository/RFRembolsoCajaMenor/{$entity->getRembolsoCajaMenorFacturas()[0]->getArchivo()}"];
  1519.                     $this->config['subject'] = $subject;
  1520.                     $this->config['template'] = $template;
  1521.                     break;
  1522.             }
  1523.             $this->send();
  1524.         }
  1525.     }
  1526.     public function HomeOffice($tipo$homeOffice = [], $cc = [])
  1527.     {
  1528.         $template "";
  1529.         $subject "";
  1530.         $this->config['cc'] = $cc;
  1531.         foreach ($homeOffice as $h) {
  1532.             $this->config['entity'] = $h;
  1533.             switch ($tipo) {
  1534.                 case 'notificarDesconexionJefe':
  1535.                     $this->config['subject'] = "Colaborador Desconectado " $h->getUsuario()?->getNombres();
  1536.                     $this->config['template'] = "notificacionDesconexion.html.twig";
  1537.                     $director null;
  1538.                     $usuario $h->getUsuario()?->getGrupoTrabajoColaboradores();
  1539.                     if ($usuario) {
  1540.                         foreach ($usuario as $grupo) {
  1541.                             $director $grupo->getDirector()->getEmail();
  1542.                         }
  1543.                     }
  1544.                     if ($director) {
  1545.                         $this->config['to'] = $director;
  1546.                     } else {
  1547.                         // opcional: log o seguimiento
  1548.                         error_log("No se encontró director con correo para el usuario ID: " $h->getUsuario()?->getId());
  1549.                     }
  1550.                     break;
  1551.             }
  1552.             $this->send();
  1553.         }
  1554.     }
  1555.     // TEST de notificaciones comerciales
  1556.     public function NotiProspectos($tipo$comProspecto = [], $cc = [])
  1557.     {
  1558.         $template "";
  1559.         $subject "";
  1560.         $this->config['cc'] = $cc;
  1561.         foreach ($comProspecto as $cp) {
  1562.             $this->config['entity'] = $cp;
  1563.             switch ($tipo) {
  1564.                 case 'notificarAutorizacion':
  1565.                     $subject "Autorizacion Cliente Potencial {$cp->getRazonSocial()}";
  1566.                     $template "/Comercial/notificacionGerenciaSolicitudAprobacion.html.twig";
  1567.                     $this->config['to'] = "nneuta@interlogisticazf.com";
  1568.                     $this->config['cc'] = ["icuellar@interlogisticazf.com"];
  1569.                     $this->config['subject'] = $subject;
  1570.                     $this->config['template'] = $template;
  1571.                     break;
  1572.             }
  1573.             $this->send();
  1574.         }
  1575.     }
  1576.     // Notifcacion I7
  1577.     public function NotiGestionContactoComercial($tipo$comGestionComercial = [], $cc = [], $documentos = [])
  1578.     {
  1579.         $template "";
  1580.         $subject "";
  1581.         $this->config['cc'] = $cc;
  1582.         foreach ($comGestionComercial as $cgc) {
  1583.             $this->config['entity'] = $cgc;
  1584.             switch ($tipo) {
  1585.                 case 'vertificacionCliente':
  1586.                     $subject "Verificación Cliente Potencial {$cgc->getRazonSocial()}";
  1587.                     $template "/Comercial/notificarC170Verificacion.html.twig";
  1588.                     $this->config['to'] = "circular0170@interlogisticazf.com";
  1589.                     $this->config['subject'] = $subject;
  1590.                     $this->config['template'] = $template;
  1591.                     // Anexar Camara de comercio y RUT
  1592.                     // Inicializa como array vacío
  1593.                     $this->config['atachment'] = [];
  1594.                     // Recorres documentos y vas agregando
  1595.                     foreach ($cgc->getComDocumentosCliente() as $doc) {
  1596.                         if ($doc->getTipoDocumento() === 'RUT') {
  1597.                             $this->config['atachment'][] = "Repository/ComDocumentosCliente/{$doc->getNombreDocumento()}";
  1598.                         }
  1599.                         if ($doc->getTipoDocumento() === 'Camara Comercio') {
  1600.                             $this->config['atachment'][] = "Repository/ComDocumentosCliente/{$doc->getNombreDocumento()}";
  1601.                         }
  1602.                     }
  1603.                     break;
  1604.             }
  1605.             $this->send();
  1606.         }
  1607.     }
  1608.     // Notificacion I9 Coemrcial H1 F8 - Notificacion I11 -> CASO 170
  1609.     public function NotiNovedadCautelar($tipo$listaCautelar = [], $cc = [], $ejecutivaComercial null)
  1610.     {
  1611.         $template "";
  1612.         $subject "";
  1613.         $this->config['cc'] = $cc;
  1614.         foreach ($listaCautelar as $lc) {
  1615.             $this->config['entity'] = $lc;
  1616.             switch ($tipo) {
  1617.                 case 'novedadVerificacion':
  1618.                     $subject "Novedad Verificación Cliente en Prospección {$lc->getTerEmpresaCliente()->getRazonSocial()}";
  1619.                     $template "/Comercial/notificacionEjecutivoComercialI9.html.twig";
  1620.                     $this->config['to'] = $ejecutivaComercial;
  1621.                     $this->config['subject'] = $subject;
  1622.                     $this->config['template'] = $template;
  1623.                     break;
  1624.                 case 'novedadVerificacionCaso170':
  1625.                     $subject "Novedad Verificación Cliente {$lc->getTerEmpresaCliente()->getRazonSocial()}";
  1626.                     $template "/Comercial/notificacionNovedadClienteListaC.html.twig";
  1627.                     $this->config['to'] = $ejecutivaComercial;
  1628.                     $this->config['subject'] = $subject;
  1629.                     $this->config['template'] = $template;
  1630.                     break;
  1631.             }
  1632.             $this->send();
  1633.         }
  1634.     }
  1635.     //Notificaccion I12 Comercial H1
  1636.     public function notiVinculacionCliente($tipo$clientesTarifas = [], $cc = [])
  1637.     {
  1638.         $template "";
  1639.         $subject "";
  1640.         $this->config['cc'] = $cc;
  1641.         foreach ($clientesTarifas as $ct) {
  1642.             $this->config['entity'] = $ct;
  1643.             switch ($tipo) {
  1644.                 case 'vinculacionCliente':
  1645.                     $subject "Vinculación {$ct->getRazonSocial()}";
  1646.                     $template "/Comercial/notiVinculacionCliente.html.twig";
  1647.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1648.                     $this->config['subject'] = $subject;
  1649.                     $this->config['template'] = $template;
  1650.                     break;
  1651.                 case 'vinculacionClienteActualizacion':
  1652.                     $subject "Actualización C170 {$ct->getRazonSocial()}";
  1653.                     $template "/Comercial/notiActualizacionClienteC170.html.twig";
  1654.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1655.                     $this->config['subject'] = $subject;
  1656.                     $this->config['template'] = $template;
  1657.                     break;
  1658.             }
  1659.             $this->send();
  1660.         }
  1661.     }
  1662.     // enviar notificacion I14 H1
  1663.     public function notificacionBievenidaCliente($tipo$entity = [], $cc = [], $correoComisiona null)
  1664.     {
  1665.         $template "";
  1666.         $subject "";
  1667.         $this->config['cc'] = $cc;
  1668.         foreach ($entity as $cb) {
  1669.             $this->config['entity'] = $cb;
  1670.             $this->config['extras'] = $correoComisiona// Asignar el correo de quien comisiona
  1671.             switch ($tipo) {
  1672.                 case 'bienvenidaCliente':
  1673.                     $subject "¡Bienvenido! - Inicia tu proceso de vinculación {$cb->getRazonSocial()}";
  1674.                     $template "/Comercial/notificacionBienvenidaCliente.html.twig";
  1675.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1676.                     $this->config['subject'] = $subject;
  1677.                     $this->config['template'] = $template;
  1678.                     break;
  1679.             }
  1680.             return $this->send();
  1681.         }
  1682.     }
  1683.     //Notificaccion I19 Comercial H1
  1684.     public function notificacionClienteComex($tipo$clientesTarifas = [], $cc = [])
  1685.     {
  1686.         $template "";
  1687.         $subject "";
  1688.         $this->config['cc'] = $cc;
  1689.         foreach ($clientesTarifas as $ct) {
  1690.             $this->config['entity'] = $ct;
  1691.             switch ($tipo) {
  1692.                 case 'VinClienteComex':
  1693.                     $subject "Vinculación Cliente {$ct->getRazonSocial()}";
  1694.                     $template "/Comercial/notiVinClienteComex.html.twig";
  1695.                     $this->config['to'] = 'direccioncomex@interlogisticazf.com';
  1696.                     $this->config['subject'] = $subject;
  1697.                     $this->config['template'] = $template;
  1698.                     break;
  1699.             }
  1700.             $this->send();
  1701.         }
  1702.     }
  1703.     // Notificacion de H3F2 - COMERCIAL -> OFICION AUTORIZACION
  1704.     public function notificacionOficioAutorizacion($tipo$cliente = [], $cc = [], $usuarioRegistra null)
  1705.     {
  1706.         $template "";
  1707.         $subject "";
  1708.         $this->config['cc'] = $cc;
  1709.         // Campos extras
  1710.         $this->config['extras'] = $usuarioRegistra;
  1711.         foreach ($cliente as $ct) {
  1712.             $this->config['entity'] = $ct;
  1713.             switch ($tipo) {
  1714.                 case 'notificacionOficioAutorizacion':
  1715.                     $this->config['atachment'] = [];
  1716.                     $subject "Autorización Vinculación {$ct->getTerEmpresaCliente()->getRazonSocial()}";
  1717.                     $template "/Comercial/notificacionOficioAutorizacionComercial.html.twig";
  1718.                     $this->config['to'] = 'comercial@interlogisticazf.com';
  1719.                     $this->config['subject'] = $subject;
  1720.                     $this->config['template'] = $template;
  1721.                     // Anexar archivo cargado en F2 - COMERCIAL
  1722.                     $this->config['atachment'][] = "Repository/ComCargarOficioAutorizacion/{$ct->getOficioAutorizacion()}";
  1723.                     break;
  1724.             }
  1725.             $this->send();
  1726.         }
  1727.     }
  1728.     // Notificacion de H3F2 - COMERCIAL -> OFICION AUTORIZACION
  1729.     public function notificacionValidacionOficioAutorizacion($tipo$cliente = [], $cc = [], $correo null)
  1730.     {
  1731.         $template "";
  1732.         $subject "";
  1733.         $this->config['cc'] = $cc;
  1734.         foreach ($cliente as $ct) {
  1735.             $this->config['entity'] = $ct;
  1736.             switch ($tipo) {
  1737.                 case 'oficioAprobado':
  1738.                     $subject "Autorización Vinculación {$ct->getComCargarOficioAutorizacion()->getTerEmpresaCliente()->getRazonSocial()}";
  1739.                     $template "/Comercial/notificacionOficioAprobado.html.twig";
  1740.                     $this->config['to'] = $correo;
  1741.                     $this->config['subject'] = $subject;
  1742.                     $this->config['template'] = $template;
  1743.                     break;
  1744.                 case 'oficioRechazado':
  1745.                     $subject "Autorización Vinculación {$ct->getComCargarOficioAutorizacion()->getTerEmpresaCliente()->getRazonSocial()}";
  1746.                     $template "/Comercial/notificacionOficioRechazo.html.twig";
  1747.                     $this->config['to'] = $correo;
  1748.                     $this->config['subject'] = $subject;
  1749.                     $this->config['template'] = $template;
  1750.                     break;
  1751.             }
  1752.             $this->send();
  1753.         }
  1754.     }
  1755.     //Notificaccion I12 Comercial H1
  1756.     public function notiCasoC170($tipo$casoc170 = [], $cc = [])
  1757.     {
  1758.         $template "";
  1759.         $subject "";
  1760.         $this->config['cc'] = $cc;
  1761.         foreach ($casoc170 as $c) {
  1762.             $this->config['entity'] = $c;
  1763.             switch ($tipo) {
  1764.                 case 'notificarC170':
  1765.                     $subject "Vinculación {$c->getRazonSocial()} - {$c->getCreateUser()}";
  1766.                     $template "/Comercial/notiCasoC170.html.twig";
  1767.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1768.                     $this->config['subject'] = $subject;
  1769.                     $this->config['template'] = $template;
  1770.                     break;
  1771.                 case 'creacionCliente':
  1772.                     $subject "Bienvenido Inicia tu proceso de vinculacioon {$c->getRazonSocial()}";
  1773.                     $template "/Comercial/notificacionVinculacionCliente.html.twig";
  1774.                     $this->config['to'] = $c->getEmail();
  1775.                     $this->config['subject'] = $subject;
  1776.                     $this->config['template'] = $template;
  1777.                     break;
  1778.             }
  1779.             $this->send();
  1780.         }
  1781.     }
  1782.     // notificacion H3I8 -> COMERCIAL
  1783.     public function notificacionAduanaAdicional($tipo$cliente = [], $cc = [], $asociado null)
  1784.     {
  1785.         $template "";
  1786.         $subject "";
  1787.         $this->config['cc'] = $cc;
  1788.         $this->config['extras'] = $asociado// Asociado
  1789.         foreach ($cliente as $c) {
  1790.             $this->config['entity'] = $c;
  1791.             switch ($tipo) {
  1792.                 case 'notificarAduanasAdicionales':
  1793.                     $subject "Creación Aduanas {$c->getRazonSocial()}";
  1794.                     $template "/Comercial/notificarAduanasAdicionales.html.twig";
  1795.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1796.                     $this->config['subject'] = $subject;
  1797.                     $this->config['template'] = $template;
  1798.                     break;
  1799.             }
  1800.             $this->send();
  1801.         }
  1802.     }
  1803.     //Notificaccion I6 Comercial H4, I16 Comercial H4, I33 Comercial H4, I35 Comercial H4
  1804.     public function notiPoderesC170($tipo$poderes = [], $cc = [], $sucursal null$terminal null$fechaVencimiento null)
  1805.     {
  1806.         $template "";
  1807.         $subject "";
  1808.         $this->config['cc'] = $cc;
  1809.         foreach ($poderes as $p) {
  1810.             $this->config['entity'] = $p;
  1811.             switch ($tipo) {
  1812.                 case 'notificacionPoderes':
  1813.                     $subject "Poderes de Puerto {$p->getRazonSocial()}";
  1814.                     $template "/Comercial/notiPoderesC170.html.twig";
  1815.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1816.                     $this->config['subject'] = $subject;
  1817.                     $this->config['template'] = $template;
  1818.                     break;
  1819.                 case 'notificacionDocumentosConNovedad':
  1820.                     $subject "Poderes de Puerto {$p->getRazonSocial()}";
  1821.                     $template "/Comercial/notificacionDocumentosConNovedad.html.twig";
  1822.                     $this->config['to'] = $p->getEmail();
  1823.                     $this->config['subject'] = $subject;
  1824.                     $this->config['template'] = $template;
  1825.                     break;
  1826.                 case 'notificacionDocumentosSinNovedad':
  1827.                     $subject "Poderes de Puerto {$p->getRazonSocial()}";
  1828.                     $template "/Comercial/notificacionDocumentosSinNovedad.html.twig";
  1829.                     $this->config['to'] = $p->getEmail();
  1830.                     $this->config['subject'] = $subject;
  1831.                     $this->config['template'] = $template;
  1832.                     break;
  1833.                 case 'notificacionC170revisionDocs':
  1834.                     $subject "{$p->getNit()} {$p->getRazonSocial()}";
  1835.                     $template "/Comercial/notificacionRevisionDocsC170.html.twig";
  1836.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1837.                     $this->config['subject'] = $subject;
  1838.                     $this->config['template'] = $template;
  1839.                     break;
  1840.                 case 'notificarPorSucursal':
  1841.                     $subject "{$p->getNit()} {$p->getRazonSocial()}";
  1842.                     $template "/Comercial/notificacionPorSucursal.html.twig";
  1843.                     // como algunas sucursales no tienen correo o no tienen personas con correo se enviara al circular para descartar errores
  1844.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1845.                     $this->config['subject'] = $subject;
  1846.                     $this->config['template'] = $template;
  1847.                     // 👇 Aquí agregamos la sucursal al contexto
  1848.                     $this->config['sucursal'] = $sucursal;
  1849.                     $this->config['terminal'] = $terminal;
  1850.                     break;
  1851.                 case 'notificarCreacionVenciminetoPuertos':
  1852.                     $subject "{$terminal} {$p->getRazonSocial()}";
  1853.                     $template "/Comercial/notificacionCreacionVencimientosPuerto.html.twig";
  1854.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1855.                     $this->config['subject'] = $subject;
  1856.                     $this->config['template'] = $template;
  1857.                     // 👇 Meter todas las variables en un array
  1858.                     $this->config['extras'] = [
  1859.                         'sucursal' => $sucursal,
  1860.                         'terminal' => $terminal,
  1861.                         'fechaVencimiento' => $fechaVencimiento,
  1862.                     ];
  1863.                     break;
  1864.             }
  1865.             $this->send();
  1866.         }
  1867.     }
  1868.     //Notificaccion I16 Comercial H4
  1869.     public function notificacionRevisionDocumentos($tipo$poder = [], $cc = [], $correoAsociado null)
  1870.     {
  1871.         $template "";
  1872.         $subject "";
  1873.         $this->config['cc'] = $cc;
  1874.         foreach ($poder as $p) {
  1875.             $this->config['entity'] = $p;
  1876.             switch ($tipo) {
  1877.                 case 'notificacionRevisionDocumento':
  1878.                     $subject "Revisión Documentos {$p->getDescripcionIdentificacion()} {$p->getTerEmpresaCliente()->getRazonSocial()}";
  1879.                     $template "/Comercial/notificacionRevisionDocumentos170.html.twig";
  1880.                     $this->config['to'] = $correoAsociado;
  1881.                     $this->config['subject'] = $subject;
  1882.                     $this->config['template'] = $template;
  1883.                     break;
  1884.                 case 'envioRevision':
  1885.                     $subject "Revisión Documentos {$p->getDescripcionIdentificacion()} {$p->getTerEmpresaCliente()->getRazonSocial()}";
  1886.                     $template "/Comercial/notificacionA170.html.twig";
  1887.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1888.                     $this->config['subject'] = $subject;
  1889.                     $this->config['template'] = $template;
  1890.                     break;
  1891.             }
  1892.             $this->send();
  1893.         }
  1894.     }
  1895.     //Notificaccion I13 NOVEDAD AL CLIENTE
  1896.     public function notificacionNovedadCliente($tipo$poder = [], $cc = [], $correoCliente null$novedades = [])
  1897.     {
  1898.         $template "";
  1899.         $subject "";
  1900.         $this->config['cc'] = $cc;
  1901.         foreach ($poder as $c) {
  1902.             $this->config['entity'] = $c;
  1903.             $this->config['extras'] = $novedades// Novedades del formulario
  1904.             switch ($tipo) {
  1905.                 case 'notificacionNovedadCliente':
  1906.                     $subject "{$c->getDescripcionIdentificacion()} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1907.                     $template "/Comercial/notificacionNovedadCliente.html.twig";
  1908.                     $this->config['to'] = $correoCliente;
  1909.                     $this->config['subject'] = $subject;
  1910.                     $this->config['template'] = $template;
  1911.                     break;
  1912.                 case 'notificacionSinNovedadCliente':
  1913.                     $subject "{$c->getDescripcionIdentificacion()} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1914.                     $template "/Comercial/notificacionSinNovedadCliente.html.twig";
  1915.                     $this->config['to'] = $correoCliente;
  1916.                     $this->config['subject'] = $subject;
  1917.                     $this->config['template'] = $template;
  1918.                     break;
  1919.             }
  1920.             $this->send();
  1921.         }
  1922.     }
  1923.     //Notificaccion REVISION DOCUMENTOS 170
  1924.     public function notificacionRevisionDocs170($tipo$poder = [], $cc = [], $descripcionIdentificacion null$correoCliente null$arreglos = [])
  1925.     {
  1926.         $template "";
  1927.         $subject "";
  1928.         $this->config['cc'] = $cc;
  1929.         $this->config['extras'] = $arreglos;
  1930.         foreach ($poder as $c) {
  1931.             $this->config['entity'] = $c->getTerEmpresaCliente();
  1932.             switch ($tipo) {
  1933.                 case 'notificacionRevisionDocumentosOriginales':
  1934.                     $subject "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1935.                     $template "/Comercial/notificacionRevisionDocsC170.html.twig";
  1936.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  1937.                     $this->config['subject'] = $subject;
  1938.                     $this->config['template'] = $template;
  1939.                     break;
  1940.                 case 'notificacionRecepcionDocsPendientes':
  1941.                     $subject "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1942.                     $template "/Comercial/notificacionDocsPendientes.html.twig";
  1943.                     $this->config['to'] = $correoCliente;
  1944.                     $this->config['subject'] = $subject;
  1945.                     $this->config['template'] = $template;
  1946.                     break;
  1947.                 case 'notificacionRecepcionDocsCompletos':
  1948.                     $subject "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1949.                     $template "/Comercial/notificacionDocsCompletos.html.twig";
  1950.                     $this->config['to'] = $correoCliente;
  1951.                     $this->config['subject'] = $subject;
  1952.                     $this->config['template'] = $template;
  1953.                     break;
  1954.             }
  1955.             $this->send();
  1956.         }
  1957.     }
  1958.     // notificaciones fianles del proceso de CASO 170.
  1959.     public function notificacionCreacionVencimientoC170($tipo$poder = [], $cc = [], $descripcionIdentificacion null$correoCliente null$arreglos = [])
  1960.     {
  1961.         $template "";
  1962.         $subject "";
  1963.         $this->config['cc'] = $cc;
  1964.         $this->config['extras'] = $arreglos;
  1965.         foreach ($poder as $c) {
  1966.             $this->config['entity'] = $c;
  1967.             switch ($tipo) {
  1968.                 case 'notificacionCreacionVencimientoC170':
  1969.                     $subject "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1970.                     $template "/Comercial/notificacionCreacionClienteC170.html.twig";
  1971.                     $this->config['to'] = $correoCliente// Enviar notificacion al cliente
  1972.                     $this->config['subject'] = $subject;
  1973.                     $this->config['template'] = $template;
  1974.                     break;
  1975.                 case 'notificacionVinculacionClienteNuevo':
  1976.                     $subject "{$descripcionIdentificacion} {$c->getTerEmpresaCliente()->getRazonSocial()}";
  1977.                     $template "/Comercial/notificacionVinculacionClienteNuevo.html.twig";
  1978.                     $this->config['to'] = $correoCliente;
  1979.                     $this->config['subject'] = $subject;
  1980.                     $this->config['template'] = $template;
  1981.                     break;
  1982.             }
  1983.             return $this->send();
  1984.         }
  1985.     }
  1986.     // Actualizar cliente
  1987.     public function notificacionActualizacionCliente($tipo$poder = [], $cc = [], $descripcionIdentificacion null$correoCliente null$arreglos = [])
  1988.     {
  1989.         $template "";
  1990.         $subject "";
  1991.         $this->config['cc'] = $cc;
  1992.         $this->config['extras'] = $arreglos;
  1993.         foreach ($poder as $c) {
  1994.             $this->config['entity'] = $c;
  1995.             switch ($tipo) {
  1996.                 case 'notificacionActualizacionCliente':
  1997.                     $subject "Actualización {$c->getRazonSocial()}";
  1998.                     $template "/Comercial/notificacionActualizacionCliente.html.twig";
  1999.                     $this->config['to'] = $correoCliente// Enviar notificacion al cliente
  2000.                     $this->config['subject'] = $subject;
  2001.                     $this->config['template'] = $template;
  2002.                     break;
  2003.             }
  2004.             return $this->send();
  2005.         }
  2006.     }
  2007.     // Notificar cambios de hoja de vida a contactos seleccionados
  2008.     public function notificacionCambiosHojaVida($tipo$contactos = [], $cc = [], $arreglos = []){
  2009.         $template "";
  2010.         $subject "";
  2011.         $this->config['cc'] = $cc;
  2012.         $this->config['extras'] = $arreglos;
  2013.         foreach ($contactos as $c) {
  2014.             $this->config['entity'] = $c;
  2015.             switch ($tipo) {
  2016.                 case 'actualizacionHojaVidaCambios':
  2017.                     $subject "Actualización Información {$c->getRazonSocial()}";
  2018.                     $template "/Comercial/actualizacionInformacionCliente.html.twig";
  2019.                     $this->config['to'] = "a@a.com"// Enviar notificacion al cliente
  2020.                     $this->config['subject'] = $subject;
  2021.                     $this->config['template'] = $template;
  2022.                     break;
  2023.             }
  2024.             return $this->send();
  2025.         }
  2026.     }
  2027.     // Notificar las ofertas a los contactos definidos en el formulario
  2028.     public function notificacionOfertasClientes($tipo$ofertas = [], $cc = [], $arreglos = [], $ejecutivoComercial null)
  2029.     {
  2030.         $template "";
  2031.         $subject "";
  2032.         $this->config['cc'] = $cc;
  2033.         $this->config['extras'] = $arreglos;
  2034.         foreach ($ofertas as $c) {
  2035.             $this->config['entity'] = $c;
  2036.             switch ($tipo) {
  2037.                 case 'notificacionOfertasComerciales':
  2038.                     $subject "Oferta Comercial {$c->getRazonSocial()}";
  2039.                     $template "/Comercial/notificacionOfertasComercialesCliente.html.twig";
  2040.                     // Enviar los archivos adjuntos
  2041.                     foreach ($arreglos['ofertasComerciales'] as $oferta) {
  2042.                         $this->config['atachment'][] = "Repository/ComOfertaComercial/{$oferta->getCargarOfertaPdf()}"// Enviar PDF
  2043.                         $this->config['atachment'][] = "Repository/ComOfertaComercial/{$oferta->getOfertaExcel()}"// Enviar EXCEL
  2044.                     }
  2045.                     $this->config['to'] = $ejecutivoComercial// Enviar notificacion al comercial
  2046.                     $this->config['subject'] = $subject;
  2047.                     $this->config['template'] = $template;
  2048.                     break;
  2049.             }
  2050.             return $this->send();
  2051.         }
  2052.     }
  2053.     //Notificaccion I4 Comercial H89
  2054.     public function notiResultados($tipo$cargarInforme = [], $cc = [], $es null)
  2055.     {
  2056.         $template "";
  2057.         $subject "";
  2058.         $this->config['cc'] = $cc;
  2059.         foreach ($cargarInforme as $c) {
  2060.             $this->config['entity'] = $c;
  2061.             switch ($tipo) {
  2062.                 case 'notificarResultados':
  2063.                     $subject "Resultado Encuesta de Satisfacción " $c->getEmpresa() . " " $es->getAno();
  2064.                     $template "/Comercial/notiResultados.html.twig";
  2065.                     $this->config['to'] = 'comercial@interlogisticazf.com';
  2066.                     $this->config['subject'] = $subject;
  2067.                     $this->config['template'] = $template;
  2068.                     // 👇 Meter todas las variables en un array
  2069.                     $this->config['extras'] = [
  2070.                         'ano' => $es->getAno(),
  2071.                         'encuesta' => $es,
  2072.                     ];
  2073.                     break;
  2074.             }
  2075.             $this->send();
  2076.         }
  2077.     }
  2078.     // Notificar Clientes proximos a vencer
  2079.     public function notificacionClientesProximosAVencer($tipo$ofertas = [], $cc = [], $arreglos = [],$ejecutivoComercial null){
  2080.         $template "";
  2081.         $subject "";
  2082.         // Validar los meses
  2083.         $fecha = (new \DateTime('now'))->modify('+1 month'); // o la fecha que necesites
  2084.         $numeroMes = (int)$fecha->format('n'); // devuelve 1 a 12
  2085.         $meses = [
  2086.             => 'Enero',
  2087.             => 'Febrero',
  2088.             => 'Marzo',
  2089.             => 'Abril',
  2090.             => 'Mayo',
  2091.             => 'Junio',
  2092.             => 'Julio',
  2093.             => 'Agosto',
  2094.             => 'Septiembre',
  2095.             10 => 'Octubre',
  2096.             11 => 'Noviembre',
  2097.             12 => 'Diciembre',
  2098.         ];
  2099.         $this->config['cc'] = $cc;
  2100.         $this->config['extras'] = $arreglos;
  2101.         foreach ($ofertas as $c) {
  2102.             $this->config['entity'] = $c;
  2103.             switch ($tipo) {
  2104.                 case 'notificacionClientesVencerComercial':
  2105.                     $subject "Control Vencimientos C170/Poderes Puerto de {$meses[$numeroMes]}";
  2106.                     $template "/Comercial/notificacionControlVencimientoseComercial.html.twig";
  2107.                     $this->config['to'] = "comercial@interlogisticazf.com";
  2108.                     $this->config['subject'] = $subject;
  2109.                     $this->config['template'] = $template;
  2110.                     break;
  2111.                 case 'notificacionClientesVencerAsociado':
  2112.                     $subject "Control Vencimientos C170/Poderes Puerto de {$meses[$numeroMes]}";
  2113.                     $template "/Comercial/notificacionControlVencimientosAsociado.html.twig";
  2114.                     $this->config['to'] = "coordinadoragentes@interlogisticazf.com";
  2115.                     $this->config['subject'] = $subject;
  2116.                     $this->config['template'] = $template;
  2117.                     break;
  2118.             }
  2119.             return $this->send();
  2120.         }
  2121.     }
  2122.     //Notificaccion I4 Comercial H89
  2123.     public function notiSolicitud170($tipo$protocoloExportacion = [], $cc = [], $cliente null$arhivos = [])
  2124.     {
  2125.         $template "";
  2126.         $subject "";
  2127.         $this->config['cc'] = $cc;
  2128.         foreach ($protocoloExportacion as $pe) {
  2129.             $this->config['entity'] = $pe;
  2130.             switch ($tipo) {
  2131.                 case 'notificarSoli170':
  2132.                     $subject "Notificar Protocolo Exportacion " $cliente->getRazonSocial();
  2133.                     $template "/Comercial/notiSolicitud170.html.twig";
  2134.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  2135.                     $this->config['subject'] = $subject;
  2136.                     $this->config['template'] = $template;
  2137.                     // 👇 Meter todas las variables en un array
  2138.                     $this->config['extras'] = [
  2139.                         'cliente' => $cliente->getRazonSocial(),
  2140.                         'url' => 'app_com_generar_protocolo_exportacion_new',
  2141.                         'id' => $pe->getId(),
  2142.                     ];
  2143.                     break;
  2144.                 case 'notificacionProtocoloExportacion':
  2145.                     $subject "Protocolo Exportación " $cliente->getRazonSocial();
  2146.                     $template "/Comercial/notificacionProtocoloExportacion.html.twig";
  2147.                     $this->config['to'] = 'icuellar@interlogisticazf.com';
  2148.                     $this->config['cc'] = ['nneuta@interlogisticazf.com']; // Copia
  2149.                     $this->config['subject'] = $subject;
  2150.                     $this->config['template'] = $template;
  2151.                     // Anexar archivos
  2152.                     $this->config['atachment'] = $arhivos;
  2153.                     $this->config['extras'] = [
  2154.                         'cliente'=>$cliente->getRazonSocial(),
  2155.                     ];
  2156.                     break;
  2157.                 case 'notificarProtoExp':
  2158.                     $subject "Protocolo Exportacion " $cliente->getRazonSocial();
  2159.                     $template "/Comercial/notiProtoExp.html.twig";
  2160.                     $this->config['to'] = 'circular0170@interlogisticazf.com';
  2161.                     $this->config['cc'] = ['exportacionesinterlogistica@interlogisticazf.com'];
  2162.                     $this->config['subject'] = $subject;
  2163.                     $this->config['template'] = $template;
  2164.                     // 👇 Meter todas las variables en un array
  2165.                     $this->config['extras'] = [
  2166.                         'cliente' => $cliente->getRazonSocial(),
  2167.                         'url' => 'app_com_revision_protocolo_new',
  2168.                         'id' => $pe->getId(),
  2169.                     ];
  2170.                     break;
  2171.             }
  2172.             $this->send();
  2173.         }
  2174.     }
  2175.     //Enviar PDF en ZIP en caliente
  2176.     public function enviarRevisionFormatoCliente($tipo$protocoloExportacion = [], $cc = [], $cliente null$arhivos = [])
  2177.     {
  2178.         $template "";
  2179.         $subject "";
  2180.         $this->config['cc'] = $cc;
  2181.         foreach ($protocoloExportacion as $pe) {
  2182.             $this->config['entity'] = $pe;
  2183.             switch ($tipo) {
  2184.                 case 'enviarFormatosClientes':
  2185.                     $subject "Revisión Formatos a " $cliente->getRazonSocial();
  2186.                     $template "/Comercial/formattosCliente.html.twig";
  2187.                     $this->config['to'] = $cliente->getEmail() ?? 'a@gmail.com'// Envio correo a cliente
  2188.                     $this->config['subject'] = $subject;
  2189.                     $this->config['template'] = $template;
  2190.                     // 👇 Meter todas las variables en un array
  2191.                     $this->config['extras'] = [
  2192.                         'cliente' => $cliente->getRazonSocial(),
  2193.                     ];
  2194.                     // Validar envio de archivos adjuntos
  2195.                     if(count($arhivos)>0){
  2196.                         $this->config['atachment'] = $arhivos// Enviar zip en caliente
  2197.                     }
  2198.                     break;
  2199.             }
  2200.            return $this->send();
  2201.         }
  2202.     }
  2203. }