<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
?>
<h4>Efetuar Pagamento</h4>
<hr/>
<div>
    <form action="<?= base_url('index.php/planos/efetua_pagamento'); ?>" method="post">
        <input type="hidden" name="id_plano" id="id_plano" value="<?= $plano['id']; ?>"/>
        <div class="form-group">        
            <label>Plano: </label>
            <input type="" name="desc_plano" value="<?= $plano['desc_plano']; ?>" readonly="true" class="form-control"/>
        </div>
        <div class="form-group">
            <label>Qtd Logins: </label>
            <input type="" name="qtd_login" value="<?= $plano['qtd_login']; ?>" readonly="true" class="form-control"/>
        </div>
        <div class="form-group">
            <label>Valor a Ser Pago: </label>
            <input type="" name="valor_cobrado" value="<?= $plano['valor_cobrado']; ?>" readonly="true" class="form-control"/>
        </div>
        <div class="form-group">
            <label>Forma de pagamento: </label>
            <select name="forma_pagamento" class="form-control">
                <option value="2">Boleto Fácil</option>         
            </select>
        </div>
        <div class="form-group">
            <label>Nome ou Fantasia: </label>
            <input name="nome" id="nome" class="form-control"/>
        </div>
        <div class="form-group">
            <label>CPF/CNPJ: </label>&nbsp;<input type="checkbox" name="is_cpnj" id="is_cpnj"/>&nbsp;<span style="font-size: 8pt">CNPJ?</span>
            <input name="cpf_cnpj" id="cpf_cnpj" class="form-control"/>
        </div>
        <div class="form-group">
            <button class="btn btn-success">Iniciar Pagamento</button>       
        </div>
    </form>
</div>
<script>
    $(document).ready(function () {

        // inicia com a mascara de cpf
        var state = $('#is_cpnj').is(':checked') ? 1 : 0;

        if (state === 1) {

            $("#cpf_cnpj").mask("99.999.999/9999-99");

        } else {

            $("#cpf_cnpj").mask("999.999.999-99");

        }

        $('#is_cpnj').on('click', function () {

            var state = $(this).is(':checked') ? 1 : 0;

            if (state === 1) {

                $("#cpf_cnpj").mask("99.999.999/9999-99");

            } else {

                $("#cpf_cnpj").mask("999.999.999-99");

            }

        });
    });
</script>