{# {% extends 'layout.twig' %} #}
{% block body %}

{% if popupFrs %}
    <td colspan="100">
{% endif %}
    <div class="clearfix detailFourniss">

        <div class="titre">
            {{ infoFrs.RS }} ({{ infoFrs.CODE }})

            {% if codRegroup %}
                <button 
                    class="principal button" 
                    type="button" 
                    style="font-size: 12px;   float: right;"
                    onClick="ajaxPopupV2('{{ path('RechercheArticles.fournisseur.ajaxValidator', {codRegroup:codRegroup}) }}', 'form_frs_panier');"
                >{{ 'Enregistrer' | trad }}</button>
            {% endif %}
        </div>

        <div class="clearfix">
            <div class="colonne2">
                <div class="informations">
                    {% for chps in listeChamps %}
                        {% if loop.index is odd %} 
                            <p>
                                <span class="champs_label">{{ chps.LIB_CHP | trad }}</span>
                                <span class="resultat">{{ infoFrs[chps.CODE_CHP] }}</span>
                            </p>
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
            <div class="colonne2 last">
                <div class="informations">
                    {% for chps in listeChamps %}
                        {% if loop.index is even %} 
                            <p>
                                <span class="champs_label">{{ chps.LIB_CHP | trad }}</span>
                                <span class="resultat">{{ infoFrs[chps.CODE_CHP] }}</span>
                            </p>
                        {% endif %}
                    {% endfor %}
                </div>
            </div>
        </div>
        {% if codRegroup %}

            <div class="clearfix">
                <div class="colonne2">
                    <h4>{{ 'Adresse' | trad }}</h4>
                        <input type="hidden" name="COD_ADR" id="COD_ADR" value="{{ adressePrincipal.COD_ADR }}"/>
                        <input type="hidden" name="idFourn" id="idFourn" value="{{ idFourn }}"/>
                        
                        <div class="row">
                            {{ inputAdvance('TEXTAREA', {
                                'name' : 'ADRESSE',
                                'titre' : 'Adresse' | trad,
                                'value' : adressePrincipal.ADRESSE,
                                'option': 'readOnly',
                            }) }}
                        </div>
                        <div class="row">
                            {{ inputAdvance('TEXT', {
                                'name' : 'VILLE1',
                                'titre' : 'Ville' | trad,
                                'value' : adressePrincipal.VILLE1,
                                'option': 'readOnly',
                            }) }}
                        </div>
                        <div class="row">
                            {{ inputAdvance('TEXT', {
                                'name' : 'CPOSTAL',
                                'titre' : 'Code postal' | trad,
                                'value' : adressePrincipal.CPOSTAL,
                                'option': 'readOnly',
                            }) }}
                        </div>

                        <div class="row">
                            {{ inputAdvance('SELECT', {
                                'name' : 'CODPAYS',
                                'titre' : 'Pays' | trad,
                                'value' : adressePrincipal.CODPAYS,
                                'listeValue' : listePays(),
                                'option': 'readOnly',
                            }) }}
                        </div>
                </div>
                <div class="colonne2 last">
                    <h4>{{ 'Contact' | trad }}</h4>

                    {% for champsCtc in listeChampsCtc %}
                        <div class="row">
                            {{ inputAdvance(champsCtc.CODE_CHP == 'FONCTION' ? 'ZOOM':'TEXT', {
                                'name' : champsCtc.CODE_CHP,
                                'titre' : champsCtc.LIB_CHP | trad,
                                'value': ctcPrincipal[champsCtc.CODE_CHP],
                                'pathValidator' : validatorCtc[champsCtc.CODE_CHP]['pathValidator'],
                                'paramValidator' : validatorCtc[champsCtc.CODE_CHP]['paramValidator'],

                                'pahtZoom' : (champsCtc.CODE_CHP == 'FONCTION'? path('Ajax.liste.fonction'):''),
                                'titleZoom' : (champsCtc.CODE_CHP == 'FONCTION'? 'Liste fonctions' | trad:''),
                            }) }}
                        </div>
                    {% endfor %}
                </div>
            </div>
        {% else %}
            <div class="clearfix">
                <div class="colonne2">
                    <h4>{{ 'Adresse' | trad }}</h4>
                    <div class="informations">
                        <p>
                            <span class="champs_label">{{ 'Adresse' | trad }}</span>
                            <span class="resultat">{{ adressePrincipal.ADRESSE }}</span>
                        </p>
                        <p>
                            <span class="champs_label">{{ 'Ville' | trad }}</span>
                            <span class="resultat">{{ adressePrincipal.VILLE1 }}</span>
                        </p>
                        <p>
                            <span class="champs_label">{{ 'Code postal' | trad }}</span>
                            <span class="resultat">{{ adressePrincipal.CPOSTAL }}</span>
                        </p>
                        <p>
                            <span class="champs_label">{{ 'Pays' | trad }}</span>
                            <span class="resultat">{% if adressePrincipal.CODPAYS %}{{ adressePrincipal.NOMPAYS }}({{ adressePrincipal.CODPAYS }}){% endif %}</span>
                        </p>
                    </div>
                </div>
                <div class="colonne2 last">
                    <h4>{{ 'Contact' | trad }}</h4>
                    <div class="informations">
                        {% for champsCtc in listeChampsCtc %}
                            <p>
                                <span class="champs_label">{{  champsCtc.LIB_CHP | trad }}</span>
                                <span class="resultat">{{ ctcPrincipal[champsCtc.CODE_CHP] }}</span>
                            </p>
                        {% endfor %}
                    </div>
                </div>
            </div>
        {% endif %}
        <div>
            <ul class="nav nav-tabs" role="tablist" id="tablistArt">
                <li id="ongletAdr" role="presentation" class="perma active"><a href="#Adr{{rand}}" aria-controls="Adr" role="tab" data-toggle="tab">{{ 'Adresse' | trad }}</a></li>
                <li id="ongletCtc" role="presentation" class="perma"><a href="#Ctc{{rand}}" aria-controls="Ctc" role="tab" data-toggle="tab">{{ 'Contact' | trad }}</a></li>
                {% if listeDocument %}
                    <li id="ongletDoc" role="presentation" class="perma"><a href="#Doc{{rand}}" aria-controls="Doc" role="tab" data-toggle="tab">{{ 'Document' | trad }}</a></li>
                {% endif %}
                {% if listeBDD %}
                    <li id="ongletBDD" role="presentation" class="perma"><a href="#BDD{{rand}}" aria-controls="BDD" role="tab" data-toggle="tab">{{ 'BDD' | trad }}</a></li>
                {% endif %}
                <li id="onglet_DivModulableCreation" style="display:none">
                    <a data-toggle="tab" href="#DivModulableCreation" class="ephemere"></a>
                </li> 
            </ul>
        </div>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane clearfix active" id="Adr{{rand}}">
                {% include '@rechercheArticles/Fournisseur/_adresse.twig' %}
            </div>  
            <div role="tabpanel" class="tab-pane clearfix" id="Ctc{{rand}}">
                {% include '@rechercheArticles/Fournisseur/_contact.twig' %}
            </div>    
            <div role="tabpanel" class="tab-pane clearfix" id="Doc{{rand}}">
                {% include '@rechercheArticles/Fournisseur/_document.twig' %}
            </div>  
            <div role="tabpanel" class="tab-pane clearfix" id="BDD{{rand}}">
                <table class="table table-hover tableV2">
                    <thead class="thead-dark" style="display: none;">
                        <th scope="col" colspan="2"></th>
                    </thead>
                    <tbody>
                    {% for BDD in listeBDD %}
                        <tr id="Clause_{{ BDD.NO_PAGE }}">
                            <td>{{ BDD.NO_PAGE}}</td>
                            <td>{{ BDD.TITRE }}</td>
                            <td>{{ BDD.CONTMEMO |nl2br }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div> 
            <div id="DivModulableCreation" class="tab-pane clearfix">
            </div>
        </div>
    </div>


    <style>
        .detailFourniss {
            margin: auto;
            box-shadow: var(--box-shadow);
            border-radius: 15px;
            padding-bottom: 0px;
            padding:15px 15px 5% 15px;
        }

        .detailFourniss .titre {
            font-size: var(--fs-16);
            font-weight: bold;
            color: var(--main-color-client1);
        }
    </style>

    <script>
        $('#tablistArt .perma').click(function(){
            $('#onglet_DivModulableCreation').hide();
            $('#onglet_DivModulableCreation a').html('');
            $('#DivModulableCreation').html('');
        });
    </script>


{% if popupFrs %}   
    </td>
{% endif %}
{% endblock %}