{*
* 2007-2016 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2019 PrestaShop SA

*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript">
	$(document).ready(function(){
		var id_section = {$section_adminpage};
		//$("#discount").attr("disabled","disabled");
		$("#discount").removeAttr("disabled","disabled");

		var section = ["general", "control_fraude", "medios_pago", "cms_entidades","cms_medios_pago", "cms_planes", "cms_interes"];
		var tabs = ["tab1", "tab2", "tab3", "tab4", "tab5", "tab6", "tab7"];

		switch(id_section) {
		    case 4:
		        sectindex = "cms_medios_pago";
		        tabindex = "tab5";
		        break;
		    case 5:
		    	sectindex = "cms_entidades";
		        tabindex = "tab4";
		        break;
		    case 1:
		    	sectindex = "general";
		        tabindex = "tab1";
		        break;
		    default:
		    	sectindex = "general";
		        tabindex = "tab1";
		        break;
		}

		loop_section(sectindex, tabindex);

		//click tab event
		$("#general_tab").click(function(){
			loop_section("general", "tab1");
		});

		$("#control_fraude_tab").click(function(){
			loop_section("control_fraude", "tab2");
		});

		$("#cms_medios_pago_tab").click(function(){
			loop_section("cms_medios_pago", "tab5");
		});
		$("#medios_pago_tab").click(function(){
			loop_section("medios_pago", "tab3");
		});
		$("#cms_entidades_tab").click(function(){
			loop_section("cms_entidades", "tab4");
		});

		$("#cms_planes_tab").click(function(){
			loop_section("cms_planes", "tab6");
		});
		$("#cms_interes_tab").click(function(){
			loop_section("cms_interes", "tab7");
		});

               


		//visibility of select 
		/*if($("#module_form_8").is(':visible')){
			$("#pmethod_select_interes").hide();
		}else{
			$("#pmethod_select_interes").show();
		}*/

		//hide select
		if($("#fieldset_0_5_5").is(":visible")){
		  $("#pmethod_select_interes").hide();		
		}

		function loop_section(contentindex, tab){

			//index of section
			var index;
			for (index = 0; index < section.length; ++index) {
			    console.log(section[index]+"=="+contentindex);

			    if(section[index] == contentindex){
			    	$("#"+contentindex).addClass("active");
			    }else{
			    	$("#"+section[index]).removeClass("active");
			    }
			}

			var indextab;
			for (indextab = 0; indextab < tabs.length; ++indextab) {
			    console.log(tabs[indextab]+"=="+tab);

			    if(tabs[indextab] == tab){
			    	console.log("#"+tab);

			    	$("#"+tab).addClass("active");
			    }else{
			    	$("#"+tabs[indextab]).removeClass("active");
			    }
			}
		}
	});	


	//promo datepickers
    $(function(){
        $("#TRdatepicker").datepicker({
						                dateFormat:"yyyy-mm-dd"
						              });
    });
</script>

<script>
    $(document).ready(function(){
        
            function populateMultiSelect(data,selector){
                $.each(data.split(','), function(i,e){
                    $(selector+" option[value='" + e + "']").prop("selected", true);
                });
            }
            
      
        
    });
</script>



<!-- Tab nav -->
<style>
	@media (max-width: 992px) {
			.table-responsive-row td:nth-of-type(1):before {
				content: "Id";
			}
					.table-responsive-row td:nth-of-type(2):before {
				content: "Cuotas";
			}
					.table-responsive-row td:nth-of-type(3):before {
				content: "Marca";
			}
					.table-responsive-row td:nth-of-type(4):before {
				content: "Tarjetas";
			}
					.table-responsive-row td:nth-of-type(5):before {
				content: "Coeficiente";
			}
					.table-responsive-row td:nth-of-type(6):before {
				content: "Activado";
			}
	}
	#pmethod_select_interes{
		margin:5px 0 15px 0;
	}
	#date_from.datepicker, #date_to.datepicker{
		width: 100% !important;			
	}
</style>

<ul class="nav nav-tabs" id="todopagoConfig">				
	<li id="tab1" class="active">
		<a href="#" id="general_tab">
			<i class="icon-home"></i>
			  {l s='Dashboard' mod='prestaspeed'}
		</a>
	</li>
	<li id="tab2">
		<a href="#" id="control_fraude_tab">
			<i class="icon-database"></i>
			  {l s='Database' mod='prestaspeed'}
		</a>
	</li>
	<li id="tab3">
		<a href="#" id="medios_pago_tab">
			<i class="icon-cogs"></i>
			  {l s='General optimization' mod='prestaspeed'}
		</a>
	</li>
	<li id="tab5">
		<a href="#" id="cms_medios_pago_tab">
			<i class="icon-file"></i>
			  {l s='Log files' mod='prestaspeed'}
		</a>
	</li>
	<li id="tab4">
		<a href="#" id="cms_entidades_tab">
			<i class="icon-image"></i>
			  {l s='Image optimization' mod='prestaspeed'}
		</a>
	</li>
	<li id="tab6">
		<a href="#" id="cms_planes_tab">
			<i class="icon-trash"></i>
			  {l s='Automatic clean' mod='prestaspeed'}
		</a>
	</li>

</ul>
<div class="tab-content panel">	
	<!-- Tab Configuracion -->
	<div class="tab-pane active" id="general">
	
		{$_displayInfo2}	
	</div>
	<!-- Tab Cybersource -->
	<div class="tab-pane" id="control_fraude">
		{$renderForm}
	</div>
	<!-- Tab Medios de pago -->
	<div class="tab-pane" id="medios_pago">
		{$renderFormO}
	</div>	<!-- Tab CMS Medios de pago -->
	<div class="tab-pane" id="cms_medios_pago">
			{$renderForm4}
	</div>
	<!-- Tab CMS entidad -->
	<div class="tab-pane" id="cms_entidades">
	 {$renderForm2}
     {$_displayInfo3}	
     {$renderForm3}
     {$renderFormRed}
	</div>

	<!-- Tab CMS planes de pago -->
	<div class="tab-pane" id="cms_planes">
		{$_displayInfo}
	</div>
	<!-- Tab CMS intereses -->
</div>