<?php
$v->layout("_themesis");
?>
<div class="container-fluid nav-hidden" id="content">
    <div id="">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <div class="box">
                        <div class="box-title">
                            <h3>
                                Contato
                                <a href="<?php echo url('company/index');?>" class="btn btn-primary">VOLTAR</a>
                            </h3>
                        </div>
                        <div class="box-content">
                            <p>Você realmente deseja que seja deletado?</p>
                            <form class="wc_form" action="" method="POST">
                                <div class="row">
                                    <div class="form-group col-lg-12">
                                        <button class="btn btn-primary">SIM</button>
                                        <a href="<?php echo url('company/index');?>" class="btn btn-primary">NÃO</a>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $('.wc_form').submit(function () {
        var Form = $(this);
        var Param = "&id=<?php echo $param['uri'];?>";
        var Data = Form.serialize()+Param;

        $.ajax({
            url: "<?= $router->route("company.eliminate"); ?>",
            data: Data,
            type: 'POST',
            dataType: 'json',
            beforeSend: load_in(),
            success: function (data) {
                if(data[0].type === 'error'){
                    notify(data[0].title, data[0].message);
                }else{
                    notify(data[0].title, data[0].message);
                    setTimeOutPage('<?php echo url('company/index');?>');
                }
                load_out();
            },
            error: function (request, status, error) {
                notify('Opss', 'Operação não pode ser finalizada!!');
                setTimeOutPage('<?php echo url('company/index');?>');
            }
        });
        return false;
    });
</script>