
{% extends '@ajax-layout/layout.twig' %}

{% block body %}
<script>




$("#send").click(function(e) {

   CODE_CTR = '', autorise = '' ;

	//ACD
//     CODE_ACD = $('#RAIS_SOC').text();
//     var res1 = CODE_ACD.replace("(", "");
//     var resf1 = res1.replace(")", "");
//     var CODE_STR_ = resf1.split(" "); 
//     var CODE_STR_f = CODE_STR_[2];

    //CTR
    CODE_CTR = $('#CENTRELIB').text();
    var res2 = CODE_CTR.replace("(", "");
    var resf2 = res2.replace(")", "");
    var CODE_CTR_ = resf2.split(" "); 
    var CODE_CTR_f = CODE_CTR_[1];


    if ($('#input_autorisation').is(":checked"))
    {
 		autorise = 1;
    }
    else
    {
       	autorise = 0;
        CODE_ACD = ''; 
        CODE_STR_f = '';
    }


    $.ajax({
    	url : "{{ path('Contrat.centre-autorise.modifierCentre', {'idacc' : idacc , 'idcentre' :  accliste.CODE_CTR, 'type': type, 'idType': idType }) }}",
        type: 'POST',
	  	dataType : 'HTML',
        data: {'autorise' : autorise, 'CODE_CTR' : CODE_CTR_f },
        success: function (data) 
        { 
	
			    refrechDiv('{{ path('Contrat.centre-autorise.centreEmetteur', {'idacc' : idacc, 'type': type, 'idType': idType}) }}', 'centre_emetteur')
			    desactivePopup(); 
		
        }
    });
});



</script>
<div id="modif_centre_emetteur">

 
<div class="modal-body clearfix">
    <form method="post" name="sendform" id="sendform" class="box-form ">

    	<div class="colonne2">
        	<div class="row">
        	       
                    {# {{ inputSwitch('Autorisé à Cde eProc ?','autorisation_eproc', acc.AUTOCC | boolSql) }} #}    

            {% if accliste.exist == 1 %}                            
                {{ inputSwitch('Autorisé ?' | trad,'autorisation', 1) }}
            {% endif %}
            {% if accliste.exist == 0 %}
                  {{ inputSwitch('Autorisé ?' | trad,'autorisation', 0) }}
            {% endif %}
            
        	</div>
        </div>
    	<div class="colonne2 last">
        	<div class="row">

        		<p  class="informations">
        		<span class="champs_label gras">{{'Société' | trad }} :</span>
        		<span id ="RAIS_SOC" class="resultat">{{ accliste.RAIS_SOC }} ({{ accliste.CODE_STE }})</span>
        		

        		</p>
    		</div>
        	<div class="row">
        	
        	<p class="informations">
            		<span class="champs_label gras">{{'Centre' | trad}} : </span>
            		<span id ="CENTRELIB" class="resultat">{{ accliste.Centre_Libelle}} ({{ accliste.CODE_CTR }})</span>
        		</p>
        	
    		</div>
		</div>

    
    <div class="modal-footer clearfix">
			
         <button type="button" id="send" class="button principal button_right" >{{'Valider' | trad}}</button>
         <button type="button" class="button secondaire button_right" onClick ='desactivePopup()' data-dismiss="modal">{{'Annuler' | trad}}</button>
         
    </div>
    </form>
</div>

{% endblock %}