<?php echo doctype('html5'); ?>
<html>

<head>
<style>
    .panel-group{
            margin-bottom: 0px !important;
    }
    .panel-default {
        border-color: #DDD;
        padding-bottom: 0px;
    }
    .panel {
        margin-bottom: 20px;
        background-color: #FFF;
        border: 1px solid transparent;
        border-radius: 4px;
        box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.05);
    }
    .panel-body .btn:not(.btn-block) { width:120px;}

    /*form cupom*/
    /*
/* Created by Filipe Pina
 * Specific styles of signin, register, component
 */
/*
 * General styles
 */
 @media (min-width: 47em){/* 1088px desktop*/
     .login-button{
	/*margin-top: 22px;*/
}
 }

 @media only screen and (max-width: 768px) {
     .login-button{
	margin-top: 6px;
        width:100%;
    }
 }
#playground-container {
    height: 500px;
    overflow: hidden !important;
    -webkit-overflow-scrolling: touch;
}

/*.main{
 	margin:50px 15px;
}*/

hr{
	width: 10%;
	color: #fff;
}

/*.form-group{
	margin-bottom: 15px;
}*/

label{
    /*margin-bottom: 15px;*/
    color: #000;
    padding-bottom: 5px !important;
}

/*input,
input::-webkit-input-placeholder {
    font-size: 11px;
    padding-top: 3px;
}*/

.main-login{
 	background-color: #fff;
    /* shadows and rounded borders */
    -moz-border-radius: 2px;
    -webkit-border-radius: 2px;
    border-radius: 2px;
    -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
    /*-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);*/
    /*box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);*/

}
/*.form-control {
    height: auto!important;
padding: 8px 12px !important;
}*/
.input-group {
    -webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.21)!important;
    -moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.21)!important;
    box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.21)!important;
}
#button {
    border: 1px solid #ccc;
    margin-top: 28px;
    padding: 6px 12px;
    color: #666;
    text-shadow: 0 1px #fff;
    cursor: pointer;
    -moz-border-radius: 3px 3px;
    -webkit-border-radius: 3px 3px;
    border-radius: 3px 3px;
    -moz-box-shadow: 0 1px #fff inset, 0 1px #ddd;
    -webkit-box-shadow: 0 1px #fff inset, 0 1px #ddd;
    box-shadow: 0 1px #fff inset, 0 1px #ddd;
    background: #f5f5f5;
    background: -moz-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(100%, #eeeeee));
    background: -webkit-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: -o-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: -ms-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    background: linear-gradient(top, #f5f5f5 0%, #eeeeee 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#eeeeee', GradientType=0);
}
.main-center{
 	/*margin-top: 30px;*/
 	/*margin: 0 auto;*/
 	max-width: 830;
    padding: 10px 10px;
	/*background:#f1f1f1;*/
        /*#999;*/
	    color: #FFF;
    text-shadow: none;
	/*-webkit-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.31);*/
/*-moz-box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.31);*/
/*box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.31);*/

}
span.input-group-addon i {
    color: #555;
    font-size: 17px;
}



.login-register{
	font-size: 11px;
	text-align: center;
}
/*button progress*/
@-webkit-keyframes ld {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@-moz-keyframes ld {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@-o-keyframes ld {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes ld {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.m-progress {
    position: relative;
    opacity: .8;
    color: transparent !important;
    text-shadow: none !important;
    /*margin-top: 22px;*/
}

.m-progress:hover,
.m-progress:active,
.m-progress:focus {
    cursor: default;
    color: transparent;
    outline: none !important;
    box-shadow: none;
}

.m-progress:before {
    content: '';

    display: inline-block;

    position: absolute;
    background: transparent;
    border: 1px solid #fff;
    border-top-color: transparent;
    border-bottom-color: transparent;
    border-radius: 50%;

    box-sizing: border-box;

    top: 50%;
    left: 50%;
    margin-top: -12px;
    margin-left: -12px;

    width: 24px;
    height: 24px;

    -webkit-animation: ld 1s ease-in-out infinite;
    -moz-animation:    ld 1s ease-in-out infinite;
    -o-animation:      ld 1s ease-in-out infinite;
    animation:         ld 1s ease-in-out infinite;
}

.btn-default.m-progress:before {
    border-left-color: #333333;
    border-right-color: #333333;
}

.btn-lg.m-progress:before {
    margin-top: -16px;
    margin-left: -16px;

    width: 32px;
    height: 32px;
}




#blanket,
#aguarde {
    position: fixed;
    display: none;
}
#blanket {
    left: 0;
    top: 0;
    background-color: #f0f0f0;
    filter: alpha(opacity=65);
    height: 100%;
    width: 100%;
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=65)";
    opacity: 0.65;
    z-index: 9998;
    display: none;
}

#aguarde {
    width: 50%;
    height: 30px;
    top: 40%;
    left: 24%;
    line-height: 30px;
    z-index: 9999;
    padding-left: 27px;
    display: none;
}
#aguarde > p {
    font-weight: bold;
    font-family: Arial, Helvetica, sans-serif;
    margin-top: -10px;
    text-align: center;
}

.panel-collapse{
    overflow: hidden; 
}

</style>
<script>fbq('track', 'AddToCart');</script>
<script>fbq('track', 'InitiateCheckout');</script>
<div class="row">


   

    <div id="blanket"></div> 
            <div id="aguarde">
                <div class="progress" style="height: 23px;">
                    <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%;"><p style="font-size: 12pt;"><b>Aguarde</b></p></div>
                </div>
            </div>
    
    <div class="col-md-12" id="pedido_i">

   
        
        <div class="col-md-12">
            <div class="container">
                
                
                <div class="row">
                    <div class="col-md-7">
                        
                        <div class="card">
                            <div class="alert alert-warning" role="alert" style="margin-bottom:0px; padding: 5px;">
     <b>Parabéns! Você ganhou um super desconto na compra de mais um curso.</b><a href="<?="cursos_indicacao/".$indicacao?>"> <b>Clique aqui</b></a>
     <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>
                            <div class="form-group"  style=" margin-left: 15px">
                 <?php
        //echo '<pre>';var_dump($this->session->userdata());
    $descricao_cart ='';
    foreach ($cart as $car)
    {
        $descricao_cart .= $car['descricao'].', ';
    }
?>
 


</head>
<body>

<div class="row">
    <div class="col-md-12">

        <?php
		require_once APPPATH . 'libraries/CarrinhoDeComprasComum.php';
		$carrinhoComum = new CarrinhoDeComprasComum();
        $total = 0;
        $qtd=0;
        $this->table->set_template(array('table_open' => '<table id="table-pagamento" class="table table-condensed">'));
        $this->table->set_heading('Itens', 'Valor');
        foreach ($carrinhoComum->contents() as $c) {
			$bt = '<a href="' . base_url() . 'site/delCarrinho/' . base64_encode($c['rowid']) . '"  onclick="return confirm(\'Deseja realmente excluir o curso ' . $c['name'] . '?\')" type="button" class="btn btn-danger">Remover</button>';
	$descricao = str_replace(['Matrícula no '], '', $c['name']);
			$this->table->add_row($descricao. ' <b>('.$c['ch'].'h)</b>' , 'R$' . format_number($c['price']));
                        if($c['ch']>=100){
                        $this->table->add_row('CURSO BÔNUS'. ' <b>('.$c['ch'].'h)</b>' , 'R$0,00');    
                        }
			$total += $c['price'];
                        $qtd=$qtd+1;
        }
       
        if($qtd>=2){
            
        $desconto=floatval($total * 0.1);
        $desconto=floor($desconto*100)/100;
        $t=$total-($desconto);
        $desconto = number_format($desconto, 2, ',', '.');
        
        
        $this->table->add_row('<b>Desconto de 10%</b>','R$ '.$desconto);
        
        
        //$t=floatval($t);
        //$t=floor($t*100)/100;
        $t= number_format($t, 2, ',', '.');
       
        }
        else{
        $t=$total; 
        //$t=floatval($t);
        //$t=floor($t*100)/100;
//        $t= number_format($t, 2, ',', '.');
        }

        $this->table->add_row('<strong class="cupom-desconto">Desconto aplicado</strong>', '<strong class="cupom-desconto-valor">R$' . $this->session->userdata('valor').',00</strong>' );
        $this->table->add_row('<b>Total</b>', 'R$' . $t);
        echo $this->table->generate();?>
        <a href="<?=base_url('limpar_carrinho')?>" class="btn btn-danger">Limpar Carrinho</a> 

        
        
    </div>
</div>

  </div>
                        </div>
                        
                                  
                     </div>
                    
                    
                    
                    
                    <div class="col-md-5">
                        
                        <div class="card">
                            <div class="card-header">
                                <b>Pagamentos com Cartão ou PIX o curso e o certificado disponível em até 5 minutos.</b>
                        </div>
                            <div class="form-group"  style=" margin-left: 15px; margin-bottom:0px;">
                                
                            
                            <div class="radio">
                                <span id="test_d" data-toggle="collapse" data-parent="#accordion" style=" background-color: #32bcad;" href="#pix" aria-expanded="false" aria-controls="collapseOne" class="btn btn-secondary mais-carga-horaria">
                                    <i class="glyphicon glyphicon-qrcode"></i> Pix
                                </span><div class="inner-buttons-finalizar"></div>
                                <span id="test_b" data-toggle="collapse" data-parent="#accordion" href="#boleto" aria-expanded="false" aria-controls="collapseTwo" class="btn btn-primary mais-carga-horaria">
                                    <i class="glyphicon glyphicon-barcode"></i> Boleto
                                </span><div class="inner-buttons-finalizar"></div>
                                <span id="botaox" class="collapsed btn btn-warning mais-carga-horaria"  data-toggle="collapse" data-parent="#accordion" href="#cartao" aria-expanded="false" aria-controls="collapseThree">
                                    <i class="glyphicon glyphicon-credit-card"></i> Cartão
                                </span><div class="inner-buttons-finalizar"></div>
                                <span class="btn btn-info mais-carga-horaria" role="button" data-toggle="collapse" data-parent="#accordion" href="#debito" aria-expanded="false" aria-controls="collapseFour">
                                    <i class="glyphicon glyphicon-credit-card"></i> Débito
                                </span>
                                
                            </div>
                           </div>
                            
                            
                            
                            <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true" >
    <div class="panel panel-default" style=" margin-top: -10px; margin-bottom: ">
        <div id="boleto" class="panel-collapse collapse" role="button" aria-expanded="false"  aria-labelledby="headingOne">
            <div class="panel-body" style=" padding-top:10px;">
                <span><b>Pagamento com Boleto</b></span>
                <form action="<?php echo base_url(); ?>Site/obrigado" target="_blank" method="post" id="formulario">
                    <div class="form-group">
                        <label for="Identidade">CPF:</label>
                        <input name="Identidade" id="Identidade" autocomplete="off" maxlength="11" minlength="11" type="tel" class="form-control input_cpf_b" required>
                    </div>

                    <input name="Valor" id="Valor" value="<?php echo (isset($total)) ? $total : ''; ?>" type="hidden">
                    <div class="cpf-boleto-alert-danger"></div>
                    <input type="hidden" name="Forma" value="6"/>
                    <?php
                    if ($this->session->userdata('aluno_logado_imazon')) {
                        echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_b" value="Finalizar">';
                    } else {
                        echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_b" value="Finalizar" disabled>';
                    }
                    ?>
                </form>
            </div>
        </div>
    </div>
    
     <div class="panel panel-default">
        <div id="pix" class="panel-collapse collapse in" role="button" aria-expanded="false"  aria-labelledby="headingOne">
            <div class="panel-body" style=" padding-top:10px;">
                <span><b>Pagamento com Pix</b></span>
                <form action="<?php echo base_url(); ?>Site/obrigado" target="_blank" method="post" id="formulario">
                    
                    
                    <div class="form-group row" style=" margin-left: 5px; margin-top: 5px;">
     <label for="Identidade">CPF:</label>
    <div class="col-sm-8">
      <input name="Identidade" id="Identidade" autocomplete="off" maxlength="11" minlength="11" type="tel" class="form-control input_cpf_b" required>
    </div>
  </div>

                    <input name="Valor" id="Valor" value="<?php echo (isset($total)) ? $total : ''; ?>" type="hidden">
                    <div class="cpf-boleto-alert-danger"></div>
                    <input type="hidden" name="Forma" value="71"/>
                    <?php
                    if ($this->session->userdata('aluno_logado_imazon')) {
                        echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_b" value="Finalizar">';
                    } else {
                        echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_b" value="Finalizar" disabled>';
                    }
                    ?>
                </form>
            </div>
        </div>
    </div>                            
                                
    <div class="panel panel-default">
        <div id="debito" class="panel-collapse collapse"  aria-labelledby="headingOne">
            <div class="panel-body">
                <form action="<?php echo base_url(); ?>Site/obrigado" target="_blank" method="post" id="formulario">
                    <div class="container-fluid">
                        <div class="row">
                                
                                <label class="radio-inline">
                          <input name="Forma" id="Forma" value="22" required="" type="radio">
                          <img src="<?php echo ROOT_URL; ?>imgs/ico-bradesco.jpg">
								</label>
                        <label class="radio-inline">
                           <input name="Forma" id="Forma" value="23" required="" type="radio">
                           <img src="<?php echo ROOT_URL; ?>imgs/ico-bb.jpg">
                        </label>
                        <label class="radio-inline">
                          <input name="Forma" id="Forma" value="7" required="" type="radio">
                          <img src="<?php echo ROOT_URL; ?>imgs/ico-itau.jpg">
                        </label>
<!--                        <label class="radio-inline">
                          <input name="Forma" id="Forma" value="21" required="" type="radio">
														  <img src="<?php echo ROOT_URL; ?>imgs/ico-hsbc.jpg">
														</label>-->
<!--                        <label class="radio-inline">
                          <input name="Forma" id="Forma" value="14" required="" type="radio">
                          <img src="<?php echo ROOT_URL; ?>imgs/ico-peela.jpg">
                        </label>                                        -->

                            </div>
                    </div>
                    <br>
                    <div class="form-group">
                        
                        <input name="Identidade" id="Identidade"  placeholder = 'CPF' autocomplete="off" maxlength="11" minlength="11" type="tel" class="form-control input_cpf_d" required>           </div>

                    <input name="Valor" id="Valor" value="<?php echo (isset($total)) ? $total : ''; ?>" type="hidden">
                    <div class="cpf-debito-alert-danger"></div>
                    <?php
                    if ($this->session->userdata('aluno_logado_imazon')) {
                        echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_d" value="Finalizar">';
                    } else {
                        echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_d" value="Finalizar" disabled>';
                    }
                    ?>
                </form>
                
            </div>
            
            
        </div>
    
        
    </div>
    

    <div class="panel panel-default" style="">
        <div id="cartao" class="panel-collapse collapse"  aria-labelledby="headingTwo">
            <div class="panel-body">

                <form action="<?php echo base_url(); ?>Site/obrigado" target="_blank" method="post" id="formulario">

            <div class="form-group">
                
                <input name="CartaoNumero" autocomplete="off"  id="CartaoNumero" minlength="14" maxlength="22" type="tel" class="form-control" placeholder = 'Número do Cartão' required>
        
            </div>

            <div class="form-group">
                
                <input name="NomePortador" id="NomePortador" placeholder = 'Nome do Portador (Igual ao do Cartão)' autocomplete="off" type="text" class="form-control" required>
            </div>

                    <div class="form-row" style=" margin-left: 0px;">
                <div class="form-group col-md-4">
                <select required name="ExpiracaoMES" class="form-control" id="ExpiracaoMES">
                    <?php
                    $validade_mes = ['01','02','03','04','05','06','07','08','09','10','11','12'];
                    //date("m");
                    echo '<option value="">Mês</option>';
                    for ($i=0; $i<12; $i++)
                    {
                         echo '<option value='.$validade_mes[$i].'>'.$validade_mes[$i].'</option>';
                    }
                    ?>
                  </select>
                </div>
               <div class="form-group col-md-4">
                <select required name="ExpiracaoANO" class="form-control" id="ExpiracaoANO">
                    <?php
                    $ano =  date("y");
                    echo '<option value="">Ano</option>';
                    for ($i=0; $i<=10; $i++)
                    {
                        echo '<option value='.$ano.'>'.$ano.'</option>';
                        $ano++;
                    }
                    ?>
                </select>
               </div>
                <div class="form-group col-md-4">
                   
                    <input name="CodigoSeguranca" placeholder = 'CVV' id="CodigoSeguranca" autocomplete="off" maxlength="4" type="text" class="form-control" required>
               
                </div>
                <!--<input name="Expiracao" id="Expiracao"  onKeyPress="formataCampo(Expiracao, '99/99', event);"  autocomplete="off" maxlength="5" type="text" class="form-control" required> -->
            </div>
             <div class="form-group">
                <select required name="Parcelas" class="form-control" id="Parcelas">
                    <?php
                    $parcelamento = ['1','2','3','4','5']; 
                    //date("m");
                  
                    for ($i=0; $i<5; $i++)
                    {
                        if($total/$parcelamento[$i]>=5){
                        
                         echo '<option value='.$parcelamento[$i].'>'.'Parcelado de '.$parcelamento[$i].' x de R$'.number_format($total/$parcelamento[$i],2,",",".").'</option>';
                        }
                         
                        }
                    ?>
                  </select>
            </div>        
                    
            <div class="form-group">
                
                <div class="cpf-boleto-alert-danger"></div>
                <input name="Identidade" id="Identidade" placeholder = 'CPF'  autocomplete="off" maxlength="11" minlength="11" type="tel" class="form-control input_cpf_b" required>
            </div>


            <input name="TipoCartao" id="TipoCartao" type="hidden" value="Parcelado">
            <input name="Valor" id="Valor" value="<?php echo (isset($total)) ? $total : ''; ?>" type="hidden">
            <?php
            if ($this->session->userdata('aluno_logado_imazon')) {
                echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_b" value="Finalizar" disabled>';
            } else {
                echo '<input type="submit" class="btn btn-success mais-carga-horaria btn_cpf_b" value="Finalizar" disabled>';
            }
            ?>
            </form>

            </div>
           
        </div>
       
        <div class="form-group"  style=" margin-left: 15px;">
            <details>
                  <summary style="cursor: pointer">Possui cupom de desconto? <b style="color: #3366BB"><u>Clique aqui</u></b></summary>

            <div class="main-login main-center">
                <!--<h5>Digite o Código do Cupom.</h5>-->
                <div class="feedback-cupom"></div>
                <div class="row form-inline">

                    
                    <div class="form-group">
                        <div class="cols-sm-10">
                            <div class="input-group">
                                
                                <input type="text" class="form-control" autocomplete="off" size="20" id="ov_cupom" autofocus title="Preencha este campo com o código do cupom" placeholder="Digite o código do Cupom"/>
                            </div>
                        </div>
                    </div>

                    <div class="form-group ">
                        <div class="btn-load"><button class="btn btn-default btn-block m-progress">validando</button></div>
                    </div>
                    <button type="submit" class="btn btn-default btn-block9 login-button" >Validar <i class="fa fa-arrow-circle-right" aria-hidden="true"></i></button>

                </div>
                
            </div>
        </details>
         
        
        </div>
    </div>

    

</div>

                        </div>
                     </div>
                    
                    <div class="col-md-12" style=" margin-top:20px;">
                     <div class="card">
                        <div class="card-header">
                            <h4><b>Indicações para você, adicione mais cursos e ganhe descontos!</b></h4>
                        </div>
                        
                        
                        <div id="evento">
                            
                                
                            
                        <section class="eventos" style="background-color: #fafafa; padding:2%;">
                        <div class="row">
                           
                            <?php 
                                  $j=0;
                                foreach ($cursos_indicacao as $c) {
                                $j=$j+1;
                                
                               $imagem="https://www.imazoncursos.com.br/imgs/cursos/curso0".$j.".jpeg";
                             
                                
                                ?>
                            <div class="col-md-3" style="margin-bottom: 10px; min-height: 400px;">
                    <div class="card card-margin">
                        <div class="card-header" style=" min-height:100px; text-align:  center;">
                              <b style="text-align:center;"><?=$c->nome?></b>
                        </div>
                        <img src="<?=$imagem?>" alt="alt" style="width: 100%"/><BR>
                        <div class="card-body pt-0" style="min-height: 100px;">
                            <div class="widget-49">
                                <div class="widget-49-title-wrapper">
                                    
                                 
                                     <form action="https://www.imazoncursos.com.br/matricular_curso_carrinho" method="post">
                                         <input type="hidden" value="<?=codifica($c->id_curso)?>" name="curso" id="curso">
                                     
                                          <div class="col-md-12" style=" margin-top:20px;">
                                         
                                           
                                            
                                         <select class="form-control input-sm" name="carga_horaria"  required="" style=" width: 100%;" >
                                                <option   value="<?=codifica('120')?>" >120 horas </option>
                                              <?php 
                                              $i=10;
                                              while ($i <= 360) {
                                                echo  '<option   value="'.codifica($i).' " >'.$i.'  horas </option>';
                                                $i=$i+10;
                                               
                                                } ?>
                                            </select>
                                     </div>    
                                     
                                     <button value=""type="submit" class="btn btn-success mais-carga-horaria" style="margin-top:10px; width: 100%;" > <span class="glyphicon glyphicon-shopping-cart"></span> Matricular</button>
                                    </form>
                                   
                                </div>

                               
                                                                    
                                                                                                
                                    
                                    
                                  
                            </div>
                            
                        </div>
                    </div>
                </div>
                        <?php    
                        
                        if( $j==4){
                            break;
                        }
                                              } ?>
                                        </div>

</section></div>


                         
                          </div>
                      </div>   
                    </div>
                </div>
            </div>
        </div>    
        
        
    </div>
</div>


<br /><br /><br /><br /><br />
</div>

<div class="modal fade preloader-modal" tabindex="-1" role="dialog">

  <div class="modal-dialog">

    <div class="modal-content">

      <div class="modal-body">

      </div>

    </div><!-- /.modal-content -->

  </div><!-- /.modal-dialog -->

</div><!-- /.modal -->

</body>

</html>
<!-- Global site tag (gtag.js) - Google AdWords: 1036809317 -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-1036809317"></script>
<script>
  window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', 'AW-1036809317');

</script>
<!-- Event snippet for Pareto.Carrinho conversion page -->
<script>
    gtag('event', 'conversion', { 'send_to': 'AW-1036809317/fhQ9CMjhrowBEOXose4D', 'value': '<?php echo $carrinhoComum->total(); ?>', 'currency': 'BRL', 'transaction_id': '' });
</script>
<script>
    $(document).ready(function() {
        $(".cupom-desconto").hide();
        $(".cupom-desconto-valor").hide();
        $(".btn-load").hide();
    });

    $(".btn-block9").click( function(){

        var base_url = "<?php echo base_url() ?>";
        var cupom= $("#ov_cupom").val();

        if(cupom.length>0)
        {

            $.ajax({
                method: "POST",
                url: base_url+"Site/consulta_cupom",
                timeout:10000,
                data: { cupom: cupom},
                beforeSend: function() {
                    // <button class="btn btn-lg btn-default m-progress">Button</button>
                    $(".login-button").hide();
                    $(".btn-load").show();
                },
                success: function(response) {


                    var resposta = JSON.parse(response);
                    console.log(resposta);
                    if (resposta.status==1) {
                    $(".login-button").show();
                    $(".btn-load").hide();

                    $('.btn-block9').prop('disabled', true);
                    $('#ov_cupom').prop('disabled', true);

                        $(".cupom-desconto").show();

                        var desconto=$("#total-desconto").text();
                        var resposta_desconto = desconto.replace("Total: R$", "");

                        var resposta_desconto_float = resposta_desconto.replace(",", ".");
                        var total_descontado= parseFloat(resposta.total) - resposta.valor;
                        
                       console.log(total_descontado);
                       if(total_descontado<=0){
                           total_descontado=0;
                           $("#aguarde").css("display", "block");
                        $("#blanket").css("display", "block");
                           
                           window.location.href = "cupom_consulta";
                           
                           
                       }

                        $(".cupom-desconto-valor").show();
                        $(".cupom-desconto-valor").text("R$"+resposta.valor);

                        //login-button
                        $(".login-button").remove();

                        $("#total-desconto").text("Total: R$"+total_descontado.toFixed(2) );
                        $(".feedback-cupom").html('<div class="alert alert-success"> Desconto aplicado.<strong></strong>. Finalize sua Compra!<strong></strong></div>');
                        
} else {
                        $(".login-button").show();
                        $(".btn-load").hide();
                       $(".feedback-cupom").html('<div class="alert alert-danger">'+resposta.mensagem+'</div>');
                    }
                },
                timeout: 10000
            });
        }
        else
        {
            $(".feedback-cupom").html('<div class="alert alert-danger">Código do Cupom vazio.</div>');
        }
    });
</script>
<script>

$('.input_cpf_b').on('keyup touchend', function(){
    var base_url = "<?php echo base_url() ?>";
    var cpf_boleto= $(this).val();

    if(cpf_boleto.length==11)
    {

        $.ajax({
            method: "POST",
            url: base_url+"Site/valida_cpf",
            data: { cpf: cpf_boleto},
            success: function(response) {

                resposta = JSON.parse(response);

                if (resposta.status==1) {
                    $('.btn_cpf_b').prop('disabled', false);
                    $(".cpf-boleto-alert-danger").hide();
                } else if(resposta.status==0) {
                    $('.btn_cpf_b').prop('disabled', true);

                    $(".cpf-boleto-alert-danger").show();

                    $(".cpf-boleto-alert-danger").html('<div class="col-12"><div class="alert alert-danger" role="alert">'+resposta.mensagem+'</div></div>');
                    setTimeout(function(){$(".cpf-boleto-alert-danger").hide(); }, 5000);
                }
            }
        });
    }
    else
    {
        $('.btn_cpf_b').prop('disabled', true);
    }


});

$('.input_cpf_d').on('keyup touchend', function(){
    var base_url = "<?php echo base_url(); ?>";
    var cpf_debito= $(this).val();

    if(cpf_debito.length==11)
    {

        $.ajax({
            method: "POST",
            url: base_url+"Site/valida_cpf",
            data: { cpf: cpf_debito},
            success: function(response) {

                resposta = JSON.parse(response);

                if (resposta.status==1) {
                    $('.btn_cpf_d').prop('disabled', false);
                    $(".cpf-debito-alert-danger").hide();
                } else if(resposta.status==0) {
                    $('.btn_cpf_d').prop('disabled', true);

                    $(".cpf-debito-alert-danger").show();

                    $(".cpf-debito-alert-danger").html('<div class="col-12"><div class="alert alert-danger" role="alert">'+resposta.mensagem+'</div></div>');
                    setTimeout(function(){$(".cpf-debito-alert-danger").hide(); }, 5000);
                }
            }
        });
    }
    else
    {
        $('.btn_cpf_d').prop('disabled', true);
    }


});

</script>


<script>
    //$(document).ready(function () {
  //$('span[href*=#]').on('click', function(e) {
//  $('.mais-carga-horaria').on('click', function(e) {
//    window.location.href ="finalizarPedido_v2#pedido_i";
////    e.preventDefault();
////    $('html, body').animate({ scrollTop: $( $(this).attr('href') ).offset().top}, 0, 'linear');
//  });
  //});
</script>
<script>
//  $("#button_saldo").click( function(){

    var saldo = <?php echo $saldo;?>;
    var preco = <?php echo $preco;?>;
    var cart = <?php echo json_encode($cart); ?>;

    var base_url = "<?php echo base_url(); ?>";

//    /<div class="alert alert-warning" role="alert">...</div>
    if(saldo >=preco)
    {
        $("#container_saldo").show("slow");

        $("input#finalizar_saldo").click( function(){
            $("#finalizar_saldo").remove();
             $("#loading").html("<button  class='btn btn-success loading'>Aguarde <i class='fa fa-spinner fa-spin'></i></button>");
            $('.loading').prop('disabled', true);
            var idq_u = $("#idq_u").val();
            var idq_p = $("#idq_p").val();

            $.ajax({
                    method: "POST",
                    url: base_url+"api/auth",
                    data: { idq_u: idq_u, idq_p: idq_p, cart: cart },
                    success: function(response) {

                        if(response==='sucesso')
                        {
                            window.location.href = base_url+'site/finalizar_compra_saldo';
                        }
                        else if(response==='saldo_insuficiente')
                        {
                             $(".loading").remove();
                             $("#loading").html("<button  class='btn btn-warning'>Saldo Insuficiente <i class='fa fa-frown-o'></i></button>");
                             setTimeout(function() { window.location=window.location;},5000);
                        }
                        else if(response==='falha')
                        {
                            $(".loading").remove();
                            $("#loading").html("<button  class='btn btn-danger'>Falha na Operação <i class='fa fa-thumbs-down'></i></button>");

                            setTimeout(function() { window.location=window.location;},3000);
                        }
                        else if(response==='client_inexistente')
                        {
                            $(".loading").remove();
                            $("#loading").html("<button  class='btn btn-danger'>Cliente não existe <i class='fa fa-exclamation-triangle'></i></button>");
                            location.reload();
                        }

                    }
                  });


        } );
    }
    else
    {
        $("#warning_saldo").show("slow");
    }

//} );
</script>
