{% extends 'layout-externe.twig' %}

{% block header %}{% endblock %}

{% block body %}

    <div class="contenu" style="width: 80%;   margin: auto;">
    
        <h1>
            {{ 'Diags' }}


            <button class="button principal" onClick="chargeDiags();">{{ 'Relancer le diagnostic' }}</button>
            {% if OXAUSER %}
                <a class="button secondaire" href="{{ path('Index.Diags.perfRequete') }}">{{ 'Évaluation des performances de requête' }}</a>
                <button class="button secondaire" onClick="$.redirect('{{ path('Systeme.GestionSysteme.index') }}')">{{ 'Systeme Oxaproc' }}</button>
            {% endif %}
        </h1>

        <ul id="mainAriane" class="nav nav-tabs">
            <li class="active ">
                <a class="onglet_ephemere" data-toggle="tab" onclick="desactiveHiddenDiv();">
                    {{ 'Diagnostic de l\'installation Oxaproc' | trad }}

                </a>
            </li>        
        </ul>

        <div class="diags">
        
            <table class="table table-hover" id="mainTableCde">
            <thead class="thead-dark"><tr><th colspan="3" style="text-align:center"></th></tr></thead>
                <tbody>
                    <tr>
                        <td>L'intégrité de l'installation de l'application est respectée</td>
                        <td id="lib_INTEGRITE_INSTALL"></td>
                        <td id="INTEGRITE_INSTALL" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Version à jour</td>
                        <td id="lib_VERSION_A_JOUR"></td>
                        <td id="VERSION_A_JOUR" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Lecture du fichier base1.ini</td>
                        <td id="lib_BASE1_LECTURE"></td>
                        <td id="BASE1_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            {{ inputAdvance('TEXTAREA', {
                                'name': 'base1',
                                'option':'disalbed',
                                'value': base1,
                                'addStyle' : 'height:500px',
                            }) }}
                        </td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Environnement</th></tr></thead>
                <tbody>
                    <tr>
                        <td>Type de l'environnement (/oxadata/fic_pj_environnement/parametres.json)</td>
                        <td id="lib_TYPE_ENV"></td>
                        <td id="TYPE_ENV" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Type de l'environnement BDD</td>
                        <td id="lib_TYPE_ENV_BDD"></td>
                        <td id="TYPE_ENV_BDD" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Rewrite activé</td>
                        <td id="lib_REWRITE_ENV"></td>
                        <td id="REWRITE_ENV" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire de stockage des fichiers temporaires</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_REPTMP_LECTURE"></td>
                        <td id="REPTMP_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                    <td>Accès en écriture</td>
                        <td id="lib_REPTMP_ECRITURE"></td>
                        <td id="REPTMP_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire de stockage des pièces jointes</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_REPPJ_LECTURE"></td>
                        <td id="REPPJ_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_REPPJ_ECRITURE"></td>
                        <td id="REPPJ_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire de stockage des fichiers log</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_REPLOG_LECTURE"></td>
                        <td id="REPLOG_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_REPLOG_ECRITURE"></td>
                        <td id="REPLOG_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire de stockage SESSION PHP</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_REPSESSION_LECTURE"></td>
                        <td id="REPSESSION_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_REPSESSION_ECRITURE"></td>
                        <td id="REPSESSION_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire partagé CATA de Oxadata</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_cata_LECTURE"></td>
                        <td id="cata_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_cata_ECRITURE"></td>
                        <td id="cata_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire partagé FIC_PJ de Oxadata</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_fic_pj_LECTURE"></td>
                        <td id="fic_pj_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_fic_pj_ECRITURE"></td>
                        <td id="fic_pj_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire partagé IMG_ART de Oxadata</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_img_art_LECTURE"></td>
                        <td id="img_art_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_img_art_ECRITURE"></td>
                        <td id="img_art_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Répertoire partagé LAD de Oxadata</th></tr>
                <tbody>
                    <tr>
                        <td>Accès en lecture</td>
                        <td id="lib_lad_LECTURE"></td>
                        <td id="lad_LECTURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès en écriture</td>
                        <td id="lib_lad_ECRITURE"></td>
                        <td id="lad_ECRITURE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Bases de données</th></tr>
                <tbody>
                    <tr>
                        <td>Connexion à la base OXASQLDB</td>
                        <td id="lib_CONNEXION_OXASQLDB"></td>
                        <td id="CONNEXION_OXASQLDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion à la base OXACATDB</td>
                        <td id="lib_CONNEXION_OXACATDB"></td>
                        <td id="CONNEXION_OXACATDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion à la base OXAPROCDB</td>
                        <td id="lib_CONNEXION_OXAPROCDB"></td>
                        <td id="CONNEXION_OXAPROCDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion à la base OXAFTDB</td>
                        <td id="lib_CONNEXION_OXAFTDB"></td>
                        <td id="CONNEXION_OXAFTDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion PDO à la base OXASQLDB</td>
                        <td id="lib_CONNEXION_PDO_OXASQLDB"></td>
                        <td id="CONNEXION_PDO_OXASQLDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion PDO à la base OXACATDB</td>
                        <td id="lib_CONNEXION_PDO_OXACATDB"></td>
                        <td id="CONNEXION_PDO_OXACATDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion PDO à la base OXAPROCDB</td>
                        <td id="lib_CONNEXION_PDO_OXAPROCDB"></td>
                        <td id="CONNEXION_PDO_OXAPROCDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Connexion PDO à la base OXAFTDB</td>
                        <td id="lib_CONNEXION_PDO_OXAFTDB"></td>
                        <td id="CONNEXION_PDO_OXAFTDB" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Recherche full-text</th></tr>
                <tbody>
                    <tr>
                        <td>CATAPROC</td>
                        <td id="lib_CATAPROC"></td>
                        <td id="CATAPROC" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>DALIBRE</td>
                        <td id="lib_DALIBRE"></td>
                        <td id="DALIBRE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>HISTOCDE</td>
                        <td id="lib_HISTOCDE"></td>
                        <td id="HISTOCDE" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Correcteur d'orthographe</td>
                        <td id="lib_CORRECTEUR"></td>
                        <td id="CORRECTEUR" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Web-Services</th></tr>
                <tbody>
                    <tr>
                        <td>Connexion aux Web-Services</td>
                        <td id="lib_CONNEXION_WEBSERVICE"></td>
                        <td id="CONNEXION_WEBSERVICE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Moteur Oxaproc</th></tr>
                <tbody>
                    <tr>
                        <td>Moteur activé</td>
                        <td id="lib_OXAPROC_MOTEUR"></td>
                        <td id="OXAPROC_MOTEUR" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Version Oxaproc</td>
                        <td id="lib_VERSION_MOTEUR_OXAPROC"></td>
                        <td id="VERSION_MOTEUR_OXAPROC" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès à la base de données</td>
                        <td id="lib_OXAPROC_BDD"></td>
                        <td id="OXAPROC_BDD" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Moteur Oxabatch</th></tr>
                <tbody>
                    <tr>
                        <td>Moteur activé</td>
                        <td id="lib_OXABATCH_MOTEUR"></td>
                        <td id="OXABATCH_MOTEUR" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Version Oxabatch</td>
                        <td id="lib_VERSION_MOTEUR_OXABATCH"></td>
                        <td id="VERSION_MOTEUR_OXABATCH" class="check" ><span class="waiting"></span></td>
                    </tr>
                    <tr>
                        <td>Accès à la base de données</td>
                        <td id="lib_OXABATCH_BDD"></td>
                        <td id="OXABATCH_BDD" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Paramétrage PHP</th></tr>
                <tbody>
                    <tr>
                        <td>Vérification des extensions chargées</td>
                        <td id="lib_EXTENSION_CHARGEE"></td>
                        <td id="EXTENSION_CHARGEE" class="check" ><span class="waiting"></span></td>
                    </tr>
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Principales variables de paramétrage du fichier php.ini</th></tr>
                <tbody class="php_ini">
                </tbody>
                <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">Moteur Oxabatch</th></tr>
                <tbody class="">
                    <tr>
                        <td colspan="3">
                            <iframe style="height: 75vh;   width: 100%;" src="{{ path('Index.Diags.phpinfo') }}"></iframe>
                        </td>
                    </tr>
                </tbody>
                {# <thead class="thead-dark"><tr><th colspan="3" style="text-align:center">DIAGS OXAREPORT</th></tr>
                <tbody class="">
                    <tr>
                        <td colspan="3">
                            <iframe style="height: 75vh;   width: 100%;" src="{{ path('Index.Diags.oxaReport') }}"></iframe>
                        </td>
                    </tr>
                </tbody> #}
            </table>
        
        </div>
    
    </div>

    <style>

        table tr td:first-child {
            width:60%;
        }

        table tr td:last-child {
            width:30px;
        }

        .bloc {
            box-shadow: var(--box-shadow);
            width: 100%;
            border-radius: 10px;
            border-top: 10px solid var(--main-color-client1);
            padding:10px;
            margin-top:10px;
        }

        .waiting {
            width: 20px;
            height: 20px;
            display: flex;
            border: 5px solid #f3f3f3;
            border-radius: 50%;
            border-top: 5px solid #3498db;
            animation: spin 2s linear infinite;
        }
    </style>

    <script>

        function chargeDiags()
        {

            $('.check').html('<span class="waiting"></span>');

            $.ajax({
                dataType : 'JSON',
                url: '{{ path('Diags.Diags.diagsExcel', {json:1}) }}',
                data: {},
                type: 'POST',
                success: function(data) {
                    $.each(data, function(mainK, items) {
                        $.each(items, function(k, item) {
                                                
                            if (mainK == 'PHP_INI') {
                                $('.php_ini').append('<tr><td>'+item.libelle+'</td><td>'+item.value+'</td><td></td></tr>');
                            } else {
                                $('#lib_'+k).html(item.text);
                                $('#'+k).html(item.value? '<span class="icone-validate"></span>':'<span class="bloquant"></span>');
                            }
                        })
                    });
                },
            });
        }

        chargeDiags();


    </script>

{% endblock %}