<?php
    session_start();
    $usuarioSession = $_SESSION['USUARIO'];
    $grupo = $_SESSION['GRUPO'];
    $contacto = $_SESSION['CONTACTO'];
    $awa_session_id = $_SESSION['AWA_SESION_ID'];
    include('../includes/conex.php');
    include('../includes/eat.php');
    include('../class/Schema.php');
    include('../class/MotherCar.php');
    include('../class/PuzzleHTML.php');
    include('../class/Static.php');
    if(!isset($usuarioSession) or $awa_session_id != $awa_id)
    {
      eatCookies();
      header('Location:../index.php');
    }
    if(isset($_COOKIE['usuario']) AND $_COOKIE['usuario'] != $staticUsu )
    {
      eatCookies();
      header('Loction:../index.php');
    }
    if(isset($_COOKIE['idioma']))
    {
      include('../lg/LG_' . $_COOKIE['idioma'] . '.php');
    }
    else
    {
      include('../lg/LG_SP.php');
    }

    $valor = Statics::SafeInput($con, $_POST['valor']);
    $aria_label = Statics::SafeInput($con, $_POST['aria_label']);

    $titulo = $valor == 'FOTO' ? '<i class="fas fa-image fa-lg mr-2"></i>' . $imagenes_lg : '<i class="fas fa-folder fa-lg mr-2"></i>' . $documentos_lg;
    

    $html = '<div class="modal fade" id="' . $valor . '" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">';
        $html .= '<div class="modal-dialog modal-xl" role="document">';
        $html .= '<div class="modal-content">';
            $html .= '<div class="modal-header">';
                $html .= '<h5 class="modal-title text-dark" id="exampleModalLabel">' . $aria_label . '</h5>';
                $html .= '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
            $html .= '</div>';  
            $html .= '<form action="php_o/vn-doc-img.php" method="post" enctype="multipart/form-data" class="needs-validation" novalidate>';
                $html .= '<div class="modal-body row">';

                    

                    switch ($valor) {
                        case 'FOTO':
                            $html .= PuzzleHTML::input_file('accept="image/*"');
                            $html .= PuzzleHTML::inputSinIcono('youCantSeeMe', '', 'hidden', 'value="FOTO"');
                        break;
                        default:
                            $html .= PuzzleHTML::input_file('accept="image/*,application/pdf"');
                            $html .= PuzzleHTML::inputSinIcono('youCantSeeMe', '', 'hidden', 'value="' . $valor . '"');
                    }

                    
                $html .= '</div>';
            
                $html .= '<div class="modal-footer">';
                    $html .= '<button type="button" class="btn btn-secondary" data-dismiss="modal">' . $cerrar_lg . '</button>';
                    $html .= '<button class="btn btn-primary" type="submit">' . $cargar_lg . '</button>';
                $html .= '</div>';

        $html .= '</form>';
        $html .= '</div>';
        $html .= '</div>';
    $html .= '</div>';


    echo $html;
    
?>

