<div class="animated fadeIn">
    <div class="row">
        <div class="col-md-6 col-lg-4">
            <div class="card card-accent-success">
                <div class="card-header"><i class="icon-user"></i> Dados do perfil</div>
                <div class="card-body">
                    <?php if($cadastro == NULL){ ?>
                    Ainda não há cadastro
                    <?php }else{ ?>
                    <div class="row">
                        <div class="col-md-12">
                            <div class="align-box-img">
                                <div class="container-img custom-file container-img-img <?php e($cadastro->img_perfil != "" ? "" : "d-none"); ?>">
                                    <div class="box-doc divImgPerfil" <?php if ($cadastro->img_perfil != ""){ ?> style="background-image: url('<?php e($cadastro->img_perfil_uri.$cadastro->img_perfil)?>');" <?php } ?>></div>
                                    <div class="box-ico-text">
                                        <div class="text">
                                            <div class="txt">
                                                <i class="material-icons">
                                                   <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                                                       <path fill="none" d="M0 0h24v24H0V0z"/>
                                                       <path d="M14.12 4l1.83 2H20v12H4V6h4.05l1.83-2h4.24M15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm-3 7c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5z"/>
                                                    </svg>
                                                </i>
                                                <a href="javascript:;" class="act-remover-img">Remover foto</a> 
                                                <a href="javascript:;" class="act-pergunta-img act-remover_img_perfil d-none">Remover foto?</a> 
                                            </div>
                                        </div>
                                    </div>
                                </div> 
                                <div class="box-doc text-center container-img-load d-none">
                                    <label><i class='fa fa-circle-o-notch fa-spin'></i></label>
                                </div>
                                <div id="dn_img_div" class="container-img custom-file container-img-input <?php echo $cadastro->img_perfil != "" ? "d-none" : ""; ?>">
                                    <input type="file" name="dn_img" class="custom-file-input" id="dn_img" value="">
                                    <label class="custom-file-label label-img-input" for="customFile">
                                        <div class="box-ico-text">
                                            <div class="ico">
                                                <i class="material-icons">
                                                    <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                                                        <path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
                                                        <path d="M0 0h24v24H0z" fill="none"/>
                                                    </svg>
                                                </i>
                                            </div>
                                            <div class="text">
                                                <div class="txt">
                                                <i class="material-icons">
                                                   <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                                                       <path fill="none" d="M0 0h24v24H0V0z"/>
                                                       <path d="M14.12 4l1.83 2H20v12H4V6h4.05l1.83-2h4.24M15 2H9L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm-3 7c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5z"/>
                                                    </svg>
                                                </i>
                                                Adicionar foto
                                                </div>
                                            </div>
                                        </div>
                                    </label>
                                </div>
                            </div>
                            <!-- ------- NÃO REMOVER O ESPAÇO EM BRANCO ENTRE AS TAGS ------- -->
                            <script id="template-download" type="text/x-tmpl"> </script>
                            <!-- ------- NÃO REMOVER O ESPAÇO EM BRANCO ENTRE AS TAGS ------- -->
                            <!-- /.box-info-->
                            <div class="box-info-perfil">
                                <input type="hidden" name="" id="dados_perfil" data-dados_perfil='<?php e(json_encode($cadastro)) ?>'>
                                <?php e(($cadastro->etapa < 8)?'<div><span class="badge badge-warning">Cadastro incompleto</span></div>':''); ?>
                                <div><strong>Nome:</strong> <?php e($cadastro->nome); ?></div>
                                <div><strong>Perfil:</strong> <?php e(($cadastro->comprador==1)?'Comprador':''); ?> <?php e(($cadastro->vendedor==1)?'Vendedor':''); ?></div>
                                <div><strong>E-mail:</strong> <?php e($cadastro->email); ?></div>
                                <div><strong>Telefone:</strong> <?php e($cadastro->telefone); ?></div>
                                <div><strong>CPF:</strong> <?php e($cadastro->cpf); ?></div>
                                <div><strong>Data de nascimento:</strong> <?php e($cadastro->data_nascimento); ?></div>
                                <div class="btn-group btn-group-sm mt-2 d-none-1024" role="group">
                                    <a href="#" class="btn btn-success collapsed" data-toggle="collapse" data-target="#collapseCadastro" aria-expanded="false">Detalhes do perfil</a>
                                    <?php if($capturas !== NULL && !(empty($capturas))){ ?>
                                    <a href="#" class="btn btn-primary collapsed" data-toggle="collapse" data-target="#collapseCaptura" aria-expanded="false">Detalhes da captura</a>
                                    <?php } ?>
                                </div>
                                
                                <div class="btn-group-sm btn-group-vertical mt-2 d-block-1024" role="group">
                                    <a href="#" class="btn btn-success collapsed" data-toggle="collapse" data-target="#collapseCadastro" aria-expanded="false">Detalhes do perfil</a>
                                    <?php if($capturas !== NULL && !(empty($capturas))){ ?>
                                    <a href="#" class="btn btn-primary collapsed" data-toggle="collapse" data-target="#collapseCaptura" aria-expanded="false">Detalhes da captura</a>
                                    <?php } ?>
                                </div>
                                
                                <input type="hidden" name="" id="id_cadastro" value="<?php e($cadastro->id_cadastro); ?>">
                            </div>
                        </div>
                    </div>
                    <?php } ?>
                </div>
            </div>
            
            
            
            
            <?php if($cadastro != NULL){ ?>
            <div class="card card-accent-success d-none">
                <div class="card-header"><i class="icon-user"></i> Dados do perfil Premium</div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-lg-12">
                            <!--depoimento em audio-->
                            <div class="form-group">
                                <label for="name">Depoimento em áudio</label>
                            </div>
                            
                            <div id="depoimento_file_div" class="container-file custom-file container-doc-file <?php echo $cadastro->depoimento_file != "" ? "d-none" : "d-block"; ?>">
                                <input type="file" name="depoimento_file" class="custom-file-input" id="depoimento_file" data-value="<?php echo $cadastro->depoimento_file; ?>" value="">
                                <label class="custom-file-label label-doc-file" for="customFile">
                                    <div class="row d-flex justify-content-center">
                                        <div class="col-lg-3 p-0">
                                            <div class="container-box-doc text-right <?php echo $cadastro->depoimento_file != "" ? "d-block" : "d-none"; ?>">
                                                <div class="divDoc">
                                                    <?php 
                                                        if ($cadastro->depoimento_file != ""){
                                                            
                                                        $pdf = explode(".",$cadastro->depoimento_file);
                                                        
                                                        if (end($pdf) == "pdf"){
                                                    ?>
                                                    <img src="<?php e(base_url('themes/comdono/img/ico-file-pdf.png')); ?>">
                                                    
                                                    <?php } else { ?>
                                                    <img src="<?php e(base_url().'themes/comdono/img/ico-file-img.png'); ?>">
                                                    
                                                    <?php } } ?>
                                                </div>
                                            </div>
                                            <div class="container-doc-load text-right d-none">
                                                <i class="fa fa-circle-o-notch fa-spin"></i>
                                            </div>
                                            <div class="box-icons-doc text-right <?php echo $cadastro->depoimento_file != "" ? "d-none" : "d-block"; ?>">
                                                <div class="ico arrow">
            								        <i class="material-icons">
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                                                           <path fill="none" d="M0 0h24v24H0V0z"></path>
                                                           <path d="M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"></path>
                                                        </svg>
                                                    </i>
            								    </div>
            								    <div class="ico space">
            								        <i class="material-icons">
                                                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
                                                           <path fill="none" d="M0 0h24v24H0V0z"></path>
                                                           <path d="M18 9v4H6V9H4v6h16V9h-2z"></path>
                                                        </svg>
                                                    </i>
            								    </div>
                                            </div>
    								    </div>
    								    <div class="col-lg-7 p-0">
    								        <div class="text">
    								            Arquivo de áudio</span>
    								        </div>
    								    </div>
								    </div>
                                </label>
                            </div>
                        
                            <!--loading-->
                            <div id="depoimento_file_div_load" class="container-file custom-file container-doc-file d-none">
                                <label class="custom-file-label label-doc-file" for="customFile">
                                    <div class="row d-flex justify-content-center">
                                        <div class="col-lg-3 p-0">
                                            <div class="text-right mt-15 mr-20">
                                                <i class="fa fa-circle-o-notch fa-spin fa-2x"></i>
                                            </div>
    								    </div>
    								    <div class="col-lg-7 p-0">
    								        <div class="text mt-15">
    								            Carregando...
    								        </div>
    								    </div>
								    </div>
                                </label>
                            </div>
                            
                            <!--documento-->
                            <a href="<?php e($cadastro->depoimento_file); ?>" class="link_divDoc cursor-pointer" target="_blank">
                            <div id="depoimento_file_div_doc" class="container-file custom-file container-doc-file <?php e($cadastro->depoimento_file != "" ? "" : "d-none"); ?>">
                                <label class="custom-file-label label-doc-file cursor-pointer" for="customFile">
                                    <div class="row d-flex justify-content-center">
                                        <div class="col-lg-3 p-0">
                                            <div class="container-box-doc text-right <?php echo $cadastro->depoimento_file != "" ? "d-block" : "d-none"; ?>">
                                                <div class="divDoc">
                                                    <?php 
                                                        if ($cadastro->depoimento_file != ""){
                                                            
                                                        $pdf = explode(".",$cadastro->depoimento_file);
                                                        
                                                        if (end($pdf) == "pdf"){
                                                    ?>
                                                    <img src="<?php e(base_url('themes/comdono/img/ico-file-pdf.png')); ?>">
                                                    <?php } else { ?>
                                                    <img src="<?php e(base_url().'themes/comdono/img/ico-file-img.png'); ?>">
                                                    <?php } } ?>
                                                </div>
                                            </div>
    								    </div>
    								    <div class="col-lg-7 p-0">
    								        <div class="text mt-15 c-blue">Ver documento</div>
    								    </div>
								    </div>
                                </label>
                            </div>
                            </a>
                            
                            <div class="container-remover">
                                <div class="row d-flex justify-content-center">
                                    <div class="col-lg-3 p-0">
                                        <div class="box-act-remover-doc <?php echo $cadastro->depoimento_file != "" ? "d-block" : "d-none"; ?>">
                                            <a href="javascript:;" class="act-text act-remover-doc">Remover</a> 
                                            <a href="javascript:;" class="act-text act-pergunta-doc act-remover_doc" style="display: none;">Remover?</a>
                                        </div>
                                    </div><div class="col-lg-7 p-0"></div>
                                </div>
                            </div>
                            
                            <!--depoimento em video-->
                            <div class="form-group mt-4">
                                <label for="name">Link depoimento em vídeo</label>
                                <input type="text" name="depoimento_video" class="form-control" id="depoimento_text" placeholder="https://www.youtube.com/channel/UCSP_pCBJortkEyQlYM36b6A">
                            </div>
                            
                            <!--depoimento de texto-->
                            <div class="form-group">
                                <label for="name">Depoimento em texto</label>
                                <textarea name="depoimento_text" class="form-control" id="textarea-input" rows="5" placeholder="Depoimento..."></textarea>
                            </div>
                            
                        </div>
                    </div>
                </div>
            </div>
            <?php } ?>
            
            <?php if($cadastro == NULL && $capturado !== NULL){ ?>
            <input type="hidden" name="" id="dados_perfil" data-dados_perfil='<?php e(json_encode($capturado)) ?>'>
            <div class="card card-accent-primary">
                <div class="card-header"><i class="icon-user"></i> Dados da captura</div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-12">
                            <!-- /.box-info-->
                            <div class="box-info-perfil m-0">
                                <div><strong>Nome:</strong> <?php e($capturado->nome); ?></div>
                                <div><strong>E-mail:</strong> <?php e($capturado->email); ?></div>
                                <div><strong>Telefone:</strong> <?php e($capturado->telefone); ?></div>
                                <div><a href="#" data-toggle="collapse" data-target="#collapseCaptura" aria-expanded="false" class="collapsed">Ver detalhes da captura</a></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php } ?>
        </div>
        <!-- /.col-->
        <div class="col-md-6 col-lg-8">
            <div id="accordion">
                <div class="card card-accent-success">
                    <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseCadastro" aria-expanded="false" class="collapsed">Detalhes do perfil</a>
                        <div class="card-header-actions">
                            <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseCadastro" aria-expanded="false" class="collapsed">
                                <i class="icon-arrow-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="collapse show" id="collapseCadastro" data-parent="#accordion">
                        <div class="card-body">
                            <?php if($cadastro == NULL){ ?>
                            Ainda não há detalhes
                            <?php }else{ ?>
                            
                            <?php if(true){ ?>
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-md-12 col-lg-4">
                                    <div class="card">
                                        <div class="card-body p-0 d-flex align-items-center">
                                            <i class="icon-home bg-primary p-4 font-2xl mr-3"></i>
                                            <div>
                                                <div class="text-value-sm text-info"><?php e(count($imoveis)); ?></div>
                                                <div class="text-muted text-uppercase font-weight-bold small">Imoveis</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-12 col-lg-4">
                                    <div class="card">
                                        <div class="card-body p-0 d-flex align-items-center">
                                            <i class="icon-magnifier _fa _fa-laptop bg-warning p-4 font-2xl mr-3"></i>
                                            <div>
                                                <div class="text-value-sm text-info"><?php e(count($pesquisou)); ?></div>
                                                <div class="text-muted text-uppercase font-weight-bold small">Pesquisas no Site</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-12 col-lg-4">
                                    <div class="card">
                                        <div class="card-body p-0 d-flex align-items-center">
                                            <i class="icon-heart bg-danger p-4 font-2xl mr-3"></i>
                                            <div>
                                                <div class="text-value-sm text-info"><?php e(count($favoritos)); ?></div>
                                                <div class="text-muted text-uppercase font-weight-bold small">Favoritos</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-12 col-lg-4">
                                    <div class="card">
                                        <div class="card-body p-0 d-flex align-items-center">
                                            <i class="icon-heart bg-sucess p-4 font-2xl mr-3"></i>
                                            <div>
                                                <div class="text-value-sm text-info"><?php e(count($interesses)); ?></div>
                                                <div class="text-muted text-uppercase font-weight-bold small">Interesses</div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" class="collapsed"><i class="icon-home"></i> Imoveis - <?php e(count($imoveis)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapseExample">
                                            <div class="card-body">
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Imóvel</th>
                                                                <th>ID</th>
                                                                <th>Bairro</th>
                                                                <th>Endereco</th>
                                                                <th>data</th>
                                                                <th>status</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($imoveis as $imovel) { ?>
                                                            <tr class="trData" >
                                                                <td class="text-center">
                                                                    <a href="<?php e(base_url("imovel/".$imovel->id_imovel)); ?>" target="_blank">
                                                                    <div class="avatar">
                                                                        <img class="img-avatar" src="<?php HImg::ref($imovel->imagens[0]??''); ?>">
                                                                    </div>
                                                                    </a>
                                                                </td>
                                                                <td><a href="<?php e(base_url("imovel/".$imovel->id_imovel)); ?>" target="_blank"><?php e($imovel->id_imovel); ?></a></td>
                                                                <td><?php e($imovel->bairro); ?></td>
                                                                <td><?php e($imovel->endereco); ?></td>
                                                                <td><?php e($imovel->data_hora_imovel); ?></td>
                                                                <td>
                                                                    <span class='badge <?php e(HImovel::getStatus($imovel->status)->bdg); ?>'><?php e(HImovel::getStatus($imovel->status)->text); ?></span>
                                                                </td>
                                                            </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseFinanciamento" aria-expanded="false" class="collapsed"><i class="icon-wallet"></i> Financiamento - <?php e(count($financiamentos)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseFinanciamento" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapseFinanciamento">
                                            <div class="card-body">
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Imóvel</th>
                                                                <th>Valor imóvel</th>
                                                                <th>Valor entrada</th>
                                                                <th>Parcelas</th>
                                                                <th>Ação</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($financiamentos as $financiamento) { ?>
                                                            <tr>
                                                                <td class="text-center">
                                                                    <div class="avatar">
                                                                    <img class="img-avatar" src="<?php e(getenv('MEDIA_URL'));?>/anunciante/2/perfil/bg-avaliacao-rs.jpg" alt="admin@bootstrapmaster.com">
                                                                    <span class="avatar-status badge-success"></span>
                                                                    </div>
                                                                </td>
                                                                <td>R$ 448.999,00</td>
                                                                <td>R$ 112.899,90</td>
                                                                <td>180</td>
                                                                <td><a href="<?php e(base_url('administrativo/financiamentos/bancos/52')); ?>" target="_blank"><i class="icon-credit-card font-2xl"></i></a>
                                                            </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseAtendimento" aria-expanded="false" class="collapsed"><i class="icon-people"></i> Atendimento - <?php e(count($atendimentos)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseAtendimento" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapseAtendimento">
                                            <div class="card-body">
                                                <?php if (empty($atendimentos)):?>
                                                    <!--<a href="javascript:;" class="addAtendimento btn btn-primary mb-4 float-right">Adicionar atendimento</a>-->
                                                <?php else: ?>
                                                    <!--<a href="<?php e(base_url())?>administrativo/atendimento/atendimentos/<?php e($atendimentos[0]->id_atendimento)?>/add" target="_blank" class="btn btn-primary mb-4 float-right">Adicionar atendimento</a>-->
                                                <?php endif; ?>
                                                
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Atendente</th>
                                                                <th>Interesse</th>
                                                                <th>Data/Hora</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($atendimentos as $atendimento) { ?>
                                                                <tr>
                                                                    <td><?php e($atendimento->id_user); ?></td>
                                                                    <td><?php e($atendimento->tipo_interesse); ?></td>
                                                                    <td><?php e(date('d/m/Y - H:i:s', strtotime($atendimento->data_hora))); ?></td>
                                                                </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php } ?>
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapsePesquisas" aria-expanded="false" class="collapsed"><i class="icon-magnifier"></i> Pesquisas no Site  - <?php e(count($pesquisou)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapsePesquisas" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapsePesquisas">
                                            <div class="card-body">
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Qnt</th>
                                                                <th>Pesquisa</th>
                                                                <th>Bairro</th>
                                                                <th>quartos</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($pesquisou as $pesquisa) { ?>
                                                            <tr class="trData" >
                                                                <td><?php e($pesquisa->cont); ?></td>
                                                                <td><?php e($pesquisa->pesquisa); ?></td>
                                                                <td><?php e($pesquisa->bairro); ?></td>
                                                                <td><?php e($pesquisa->quartos); ?></td>
                                                            </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>  
                                </div>
                            </div>
                            
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseNegocCompras" aria-expanded="false" class="collapsed"><i class="icon-magnifier"></i> Negociacoes de Compras  - <?php e(count($negociacoes_compras)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseNegocCompras" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapseNegocCompras">
                                            <div class="card-body">
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Bairro</th>
                                                                <th>Imovel</th>
                                                                <th>Status</th>
                                                                <th>Etapa</th>
                                                                <th>nº msgs</th>
                                                                <th>Ultima msg</th>
                                                                <th></th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($negociacoes_compras as $id_chat=>$chat) { ?>
                                                                <tr class="trData">
                                                                    <td><?php e($chat->imovel->bairro); ?></td>
                                                                    <td><a href="<?php e(base_url().'imovel/'.$chat->id_imovel); ?>" target="_blank"> <?php e($chat->imovel->endereco); ?></a></td>
                                                                    <td><?php e($chat->chat_status); ?></td>
                                                                    <td><?php e($chat->etapa); ?></td>
                                                                    <td><?php e(count($chat->msgs) -1); ?></td>
                                                                    <td><?php e(end($chat->msgs)->dt_msg); ?></td>
                                                                    <td><a href="<?php e(base_url().'administrativo/braco_direito/chat/'.$chat->id_imovel.'/'.$id_chat); ?>" target="_blank">Chat</a></td>
                                                                </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>  
                                </div>
                            </div>
                            
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseFavoritos" aria-expanded="false" class="collapsed"><i class="icon-heart"></i> Favoritos - <?php e(count($favoritos)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseFavoritos" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapseFavoritos">
                                            <div class="card-body">
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Imóvel</th>
                                                                <th>ID</th>
                                                                <th>Bairro</th>
                                                                <th>Endereco</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($favoritos as $favorito) { ?>
                                                            <tr class="trData" >
                                                                <td class="text-center">
                                                                    <a href="<?php e(base_url("imovel/".$favorito->id_imovel)); ?>" target="_blank">
                                                                    <div class="avatar">
                                                                        <img class="img-avatar" src="<?php HImg::ref($favorito->imagens[0]??''); ?>">
                                                                    </div>
                                                                    </a>
                                                                </td>
                                                                <td><a href="<?php e(base_url("imovel/".$favorito->id_imovel)); ?>" target="_blank"><?php e($favorito->id_imovel); ?></a></td>
                                                                <td><?php e($favorito->bairro); ?></td>
                                                                <td><?php e($favorito->endereco); ?></td>
                                                            </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <!-- /.row-->
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="card">
                                        <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseInteresses" aria-expanded="false" class="collapsed"><i class="icon-heart"></i> Interesses - <?php e(count($interesses)); ?></a>
                                            <div class="card-header-actions">
                                                <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseInteresses" aria-expanded="false" class="collapsed">
                                                    <i class="icon-arrow-up"></i>
                                                </a>
                                            </div>
                                        </div>
                                        <div class="collapse" id="collapseInteresses">
                                            <div class="card-body">
                                                <div class="table-container table-responsive">
                                                    <table class="display table table-striped table-bordered" style="width:100%">
                                                        <thead>
                                                            <tr>
                                                                <th>Interesse em</th>
                                                                <th>Tipo de imovel</th>
                                                                <th>Faixa de Preço</th>
                                                                <th>Momento</th>
                                                                <th>Bairros</th>
                                                                <th>Quartos</th>
                                                                <th>Visualizar</th>
                                                            </tr>
                                                        </thead>
                                                        <tbody>
                                                            <?php foreach($interesses as $interesse) { ?>
                                                            <tr class="trData" >
                                                              <td><?php e($interesse->tipo_interesse) ?></td>
                                                              <td><?php e($interesse->tipo_imovel) ?></td>
                                                              <td><?php e($interesse->faixa_preco_inicio . ' a ' . $interesse->faixa_preco_fim) ?></td>
                                                              <td><?php e($interesse->momento_interesse) ?></td>
                                                              <td><?php foreach($interesse->bairros as $bairro){ ?><span class="badge badge-secondary"><?php echo $bairro->bairro; ?></span> <?php } ?></td>
                                                              <td><?php e($interesse->quartos) ?></td>
                                                              <td><a href="<?php e(base_url('atendimento/atendimento/visualizar_interesse/'.$interesse->id_interesse)) ?>" target="_blank" class="btn btn btn-default"><i class="fa fa fa-home"></i></a></td>
                                                            </tr>
                                                            <?php } ?>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php } ?>
                        </div>
                    </div>
                </div>
                <?php if(!empty($capturas)){ ?>
                <div class="card card-accent-primary">
                    <div class="card-header"><a href="#" data-toggle="collapse" data-target="#collapseCaptura" aria-expanded="false" class="collapsed">Detalhes da captura</a>
                        <div class="card-header-actions">
                            <a class="card-header-action btn-minimize" href="#" data-toggle="collapse" data-target="#collapseCaptura" aria-expanded="false" class="collapsed">
                                <i class="icon-arrow-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="collapse" id="collapseCaptura" data-parent="#accordion">
                        <div class="card-body">
                            <div class="table-container table-responsive">
                                <table class="display table table-striped table-bordered" style="width:100%">
                                    <thead>
                                        <tr>
                                            <th>Origem captura</th>
                                            <th>Data captura</th>
                                            <th>Nome</th>
                                            <th>E-mail</th>
                                            <th>telefone</th>
                                            <th>cpf</th>
                                            <!--<th>renda_mensal</th>
                                            <th>possui_conjuje</th>
                                            <th>nome_conjuje</th>
                                            <th>cpf_conjuje</th>
                                            <th>renda_mensal_casal</th>-->
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php foreach($capturas as $captura) { ?>
                                        <tr>
                                            <td><?php e($captura->origem_captura); ?></td>
                                            <td><?php e($captura->datetime_captura); ?></td>
                                            <td><?php e($captura->nome); ?></td>
                                            <td><?php e($captura->email); ?></td>
                                            <td><?php e($captura->telefone); ?></td>
                                            <td><?php e($captura->cpf); ?></td>
                                            <!--<td><?php e($captura->renda_mensal); ?></td>
                                            <td><?php e($captura->possui_conjuje); ?></td>
                                            <td><?php e($captura->nome_conjuje); ?></td>
                                            <td><?php e($captura->cpf_conjuje); ?></td>
                                            <td><?php e($captura->renda_mensal_casal); ?></td>-->
                                        </tr>
                                        <?php } ?>
                                    </tbody>
                                </table>
                            </div>
                            
                            <!--
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="table-container table-responsive">
                                        <table class="display table table-striped table-bordered" style="width:100%">
                                            <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Origem</th>
                                                    <th>Data/Hora</th>
                                                    <th>Link</th>
                                                    <th>Ação</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td>200</td>
                                                    <td>Avaliação</td>
                                                    <td><?php e(date('d/m/Y - H:i:s', strtotime("2019-10-21 15:36:40"))); ?></td>
                                                    <td><a href="<?php e(base_url("avaliacao/resultado/3ksfae8q"))?>" target="_blank">Link</a></td>
                                                    <td><a href="#">Atendimento</a></td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                            -->
                            
                        </div>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>  
    </div>
 </div>