<div class="row mt-4 mb-4">
    <div class="col-lg-12">
        <div class="form-group">
            <button class="btn btn-primary cancel-button b10 voltar_pagina" type="button" id="cancel-button"><i class="icon-action-undo"></i> Voltar a listagem</button>
        </div>
    </div>
</div>

<div class="row">
    <?php //if (in_array($state,['add'])){ ?>
    <div class="col-lg-4">
        <div class="card mb-4">
            <h5 class="card-header">Dados do interessado</h5>
            <div class="card-body">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="form-group">
                            <label class="control-label">Perfil</label>
                            <input type="text" name="nome" value="<?php e(($interessado->comprador==1)?'Comprador':''); ?> <?php e(($interessado->vendedor==1)?'Vendedor':''); ?>" class="form-control" readonly="readonly">
                        </div>
                        <div class="form-group">
                            <label class="control-label">Nome</label>
                            <input type="text" name="nome" value="<?php e($interessado->nome); ?>" class="form-control" readonly="readonly">
                        </div>
                        <div class="form-group">
                            <label class="control-label">E-mail</label>
                            <input type="email" name="email" value="<?php e($interessado->email); ?>" class="form-control" readonly="readonly">
                        </div>
                        <div class="form-group">
                            <label class="control-label">Telefone</label>
                            <input type="text" name="telefone" value="<?php e($interessado->telefone); ?>" class="form-control" readonly="readonly">
                        </div>
                        <div class="row">
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <label class="control-label">CPF</label>
                                    <input type="text" name="telefone" value="<?php e($interessado->cpf); ?>" class="form-control" readonly="readonly">
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="form-group">
                                    <label class="control-label">Data nascimento</label>
                                    <input type="text" name="telefone" value="<?php e($interessado->data_nascimento); ?>" class="form-control" readonly="readonly">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="card">
            <h5 class="card-header">Últimos atendimentos - TAG: <?php e($tipo_interesse) ?></h5>
            <div class="card-body">
                <?php if($atendimentos??false){ ?>
                <div class="row">
                    <div class="col-lg-12">
                        <div id="accordion" role="tablist">
                            <?php $i = 1; foreach($atendimentos as $atendimento){ ?>
                            <div class="card card-accent-info">
                                <div class="card-header" id="heading-<?php e($i); ?>" role="tab">
                                    <h5 class="mb-0">
                                    <a data-toggle="collapse" href="#collapse-<?php e($i); ?>" aria-expanded="true" aria-controls="collapse-<?php e($i); ?>" class="collapsed">
                                        <?php e(date('d/m/Y - H:i:s', strtotime($atendimento->data_hora))); ?>
                                    </a>
                                    </h5>
                                </div>
                                <div class="collapse" id="collapse-<?php e($i); ?>" role="tabpanel" aria-labelledby="heading-<?php e($i); ?>" data-parent="#accordion" style="">
                                    <div class="card-body">
                                        <div class="row">
                                            <div class="col-lg-12">
                                                <div class="form-group">
                                                    <label class="control-label">Atendente</label>
                                                    <input type="text" name="atendente" value="<?php e($atendimento->atendente); ?>" class="form-control" readonly="readonly">
                                                </div>
                                                <div class="form-group">
                                                    <label class="control-label">Tipo de interesse</label>
                                                    <input type="text" name="tipo_interesse" value="<?php e($atendimento->tipo_interesse); ?>" class="form-control" readonly="readonly">
                                                </div>
                                                <div class="form-group">
                                                    <label class="control-label">Observação</label>
                                                    <textarea name="observacao" class="form-control" rows="3" readonly="readonly"><?php e(strip_tags($atendimento->observacao)); ?></textarea>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <?php $i++; } ?>
                        </div>
                    </div>
                </div>
                <?php }else{ ?>
                <div class="row">
                    <div class="col-lg-12">
                        <p>Ainda não houve atendimento</p>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
        
        
        
        <div class="card">
            <h5 class="card-header">Outros atendimentos</h5>
            <div class="card-body">
                <?php if($outrosPorAssunto??false){ ?>
                    <?php foreach ($outrosPorAssunto as $key => $atendimentos){ ?>
                        
                        <label class="control-label m-0">TAG: <?php e($key) ?></label>
                        <hr class="mt-1">
                    
                        <div class="row">
                            <div class="col-lg-12">
                                <div id="accordion" role="tablist">
                                    <?php ; foreach($atendimentos as $k=>$atendimento){ $i = $key.'_'.$k ?>
                                    <div class="card card-accent-info">
                                        <div class="card-header" id="heading-<?php e($i); ?>" role="tab">
                                            <h5 class="mb-0">
                                            <a data-toggle="collapse" href="#collapse-<?php e($i); ?>" aria-expanded="true" aria-controls="collapse-<?php e($i); ?>" class="collapsed">
                                                <?php e(date('d/m/Y - H:i:s', strtotime($atendimento->data_hora))); ?>
                                            </a>
                                            </h5>
                                        </div>
                                        <div class="collapse" id="collapse-<?php e($i); ?>" role="tabpanel" aria-labelledby="heading-<?php e($i); ?>" data-parent="#accordion" style="">
                                            <div class="card-body">
                                                <div class="row">
                                                    <div class="col-lg-12">
                                                        <div class="form-group">
                                                            <label class="control-label">Atendente</label>
                                                            <input type="text" name="atendente" value="<?php e($atendimento->atendente); ?>" class="form-control" readonly="readonly">
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="control-label">Tipo de interesse</label>
                                                            <input type="text" name="tipo_interesse" value="<?php e($atendimento->tipo_interesse); ?>" class="form-control" readonly="readonly">
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="control-label">Observação</label>
                                                            <textarea name="observacao" class="form-control" rows="3" readonly="readonly"><?php e(strip_tags($atendimento->observacao)); ?></textarea>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <?php  } ?>
                                </div>
                            </div>
                        </div>
                    <?php } ?>
                <?php }else{ ?>
                <div class="row">
                    <div class="col-lg-12">
                        <p>Ainda não houve atendimento</p>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
        
    </div>
    <?php //} ?>
    <div class="col-lg-8">
        
        <?php if(isset($empreendimento)){ ?>
        
        <div class="card">
            <div class="card-header">
                <div class="row">
                    <div class="col-10">
                        <a href="#collapseRoteiro" data-toggle="collapse" aria-expanded="true">
                            </h5>Empreendimento</h5>
                        </a>
                    </div>
                    <div class="col-2">
                        <div class="card-header-actions">
                            <a href="#collapseRoteiro" data-toggle="collapse" aria-expanded="true"><i class="icon-arrow-up"></i></a>
                        </div>
                    </div>
                </div>
            </div>
            <div class="collapse show" id="collapseRoteiro" aria-labelledby="collapseRoteiro">
                <div class="card-body">
                    <div class="form-group">
                        <label class="control-label">Informações</label>
                        <ul>
                            <!--<li><strong>Plano: </strong> <?php e($planos[0]->plano); ?></li>-->
                            <li><strong>Proposta: </strong> <?php e($proposta->tipo_proposta); ?></li>
                            <li><strong>Investimento mídia: </strong> <?php e($proposta->pg_midia == 0 ? "Incorporadora":"Comdono"); ?></li>
                        </ul>
                    </div>
                    <hr>
                    <div class="form-group">
                        <label class="control-label">Roteiro de atendimento</label>
                        <?php if(!empty($empreendimento->roteiro_atendimento)){ ?>
                        <div class="display-block"><?php e($empreendimento->roteiro_atendimento) ?></div>
                        <?php }else{ ?>
                        <div class="alert alert-warning alert-dismissible fade show m-0" role="alert">
                            <h4 class="alert-heading">Não há roteiro de atendimento para este empreendimento!</h4>
                            Favor entrar em contato com o Tático do CS.
                        </div>
                        <?php } ?>
                    </div>
                </div>
            </div>
        </div>
        <?php } ?>
        
        <!-- Interesses --> 
        <div class="card">
            <h5 class="card-header">
                <a class="collapsed" data-toggle="collapse" href="#addInteresse" aria-expanded="false" aria-controls="addInteresse">
                    Adicionar novo anúncio de interesse
                </a>
            </h5>
            <div class="collapse" id="addInteresse">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-6">
                        <form class="text-dark form-anunciar-interesse">
                            <input type="hidden" name="id_captura" value="<?php e($objetoAtendido->id_captura) ?>">
                            <input type="hidden" name="id_cadastro" value="<?php e($objetoAtendido->id_cadastro) ?>">
                            <input type="hidden" name="email" value="<?php e($cadastro->email) ?>">
                            
                            <div class="form-group row">
                                <div class="col-6">
                                   <label for="interessadoEM">Interessado em:</label>
                                    <select name="tipo_interesse" class="form-control interForm" id="interessadoEM">
                                      <option value="compra" <?php e(($interesseP->tipo_interesse??'') == 'compra' ? 'selected' : '') ?>>Comprar</option>
                                      <option value="venda" <?php e(($interesseP->tipo_interesse??'') == 'venda' ? 'selected' : '') ?>>Vender</option>
                                      <option value="comprar e vender" <?php e(($interesseP->tipo_interesse??'') == 'comprar e vender' ? 'selected' : '') ?>>Comprar e vender</option>
                                    </select> 
                                </div>
                              <div class="col-6">
                                    <label for="interesse1">Tipo de imóvel</label>
                                    <select name="tipo_imovel" id="tipo_imovel" class="form-control">
                                        <option value="">Todos</option>
                                        <?php
                                            foreach (HBusca::getSelectTiposImovel() as $grupo=>$options)
                                            {
                                                echo("<optgroup label='$grupo'>");
                                                foreach ($options as $value=>$text)
                                                {
                                                    $selected = '';
                                                    if($value == ($interesseP->tipo_imovel??''))
                                                        $selected = 'selected';
                                                    echo("<option value='$value' $selected >$text</option>");
                                                }
                                                echo("</optgroup>");
                                            }
                                        ?>
                                    </select>
                              </div>
                                
                            </div>
                            <div class="form-group row">
                                <div class="col-4">
                                    <label for="interesse2">Quartos</label>
                                    <select name="quartos" class="form-control interForm" id="interesse2">
                                      <option <?php e(($interesseP->quartos??'') == 0 ? 'selected' : '') ?>>0</option>
                                      <option <?php e(($interesseP->quartos??'') == 1 ? 'selected' : '') ?>>1</option>
                                      <option <?php e(($interesseP->quartos??'') == 2 ? 'selected' : '') ?>>2</option>
                                      <option <?php e(($interesseP->quartos??'') == 3 ? 'selected' : '') ?>>3</option>
                                      <option value="4" <?php e(($interesseP->quartos??'') == 4 ? 'selected' : '') ?>>4 ou +</option>
                                    </select>
                                </div>
                                <div class="col-4">
                                    <label for="interesse3" class="col-form-label">Banheiros:</label>
                                    <select name="banheiro" class="form-control interForm" id="interesse3">
                                      <option <?php e(($interesseP->banheiro??'') == 0 ? 'selected' : '') ?>>0</option>
                                      <option <?php e(($interesseP->banheiro??'') == 1 ? 'selected' : '') ?>>1</option>
                                      <option <?php e(($interesseP->banheiro??'') == 2 ? 'selected' : '') ?>>2</option>
                                      <option <?php e(($interesseP->banheiro??'') == 3 ? 'selected' : '') ?>>3</option>
                                      <option value="4" <?php e(($interesseP->banheiro??'') == 4 ? 'selected' : '') ?>>4 ou +</option>
                                    </select>                                
                                </div>  
                                <div class="col-4">
                                    <label for="interesse4" class="col-form-label">Vagas:</label>
                                    <select name="vagas" class="form-control interForm" id="interesse4">
                                      <option <?php e(($interesseP->vagas??'') == 0 ? 'selected' : '') ?>>0</option>
                                      <option <?php e(($interesseP->vagas??'') == 1 ? 'selected' : '') ?>>1</option>
                                      <option <?php e(($interesseP->vagas??'') == 2 ? 'selected' : '') ?>>2</option>
                                      <option <?php e(($interesseP->vagas??'') == 3 ? 'selected' : '') ?>>3</option>
                                      <option value="4" <?php e(($interesseP->vagas??'') == 4 ? 'selected' : '') ?>>4 ou +</option>
                                    </select>                                    
                                </div> 
                            </div>
                            <div class="form-group">
                                <label for="interesse55" class="col-form-label">Tipo de empreendimento do cliente:</label>
                                <select class="form-control interForm tipo_emp_anunciar_interesse" name="tipo_emp_cliente[]" multiple="multiple" id="interesse55">
                                  <option value="pronto" <?php e(in_array('pronto',($interesseP_tipo_emp??[])) ? 'selected' : '') ?>>Pronto</option>
                                  <option value="lancamento" <?php e(in_array('lancamento',($interesseP_tipo_emp??[])) ? 'selected' : '') ?>>Lançamento</option>
                                  <option value="Terreno" <?php e(in_array('Terreno',($interesseP_tipo_emp??[])) ? 'selected' : '') ?>>Terreno</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="interesse5" class="col-form-label">Bairro:</label>
                                <!--<input name="bairro[]" type="text" multiple="multiple" class="form-control interForm bairro_anunciar_interesse" id="interesse5">-->
                                <?php $bairros = HBairros::getSelect2()->items;  ?>
                                <select class="form-control interForm bairro_anunciar_interesse" name="bairro[]" multiple="multiple" id="interesse5">
                                    <option value="Brasília" <?php e(in_array('Brasília',($interesseP_bairros??[])) ? 'selected' : '')?> >Brasília</option>
                                    <?php foreach($bairros as $b){ ?>
                                        <option value="<?php e($b->id) ?>" <?php e(in_array($b->id,($interesseP_bairros??[])) ? 'selected' : '')?> ><?php e($b->text) ?></option> 
                                    <?php } ?>
                                </select>
                            </div>  
                            <div class="form-group">
                                <label for="interesse6" class="col-form-label">Faixa de preço:</label>
                                <div class="row">
                                    <div class="col-6 d-flex align-items-center pr-2">
                                        De
                                        <input name="faixa_preco_inicio" type="text" class="form-control ml-2 interForm faixa_preco_anunciar_interesse" id="interesse6" value="<?php e(($interesseP->faixa_preco_inicio??'')) ?>">
                                    </div>
                                    <div class="col-6 d-flex align-items-center pl-0">
                                        até
                                        <input name="faixa_preco_fim" type="text" class="form-control ml-2 interForm faixa_preco_anunciar_interesse" id="interesse6" value="<?php e(($interesseP->faixa_preco_fim??'')) ?>">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleFormControlTextarea1">Descrição</label>
                                <textarea name="descricao" class="form-control interForm" style="resize: none;" id="exampleFormControlTextarea1" rows="2"><?php e(($interesseP->descricao??'')) ?></textarea>
                            </div>
                            <!--
                            <div class="form-group">
                                <label for="deseja_enviar_email_checkbox">Deseja enviar Email com os imóveis do Interesse?</label>
                                <div class="form-inline deseja_enviar_email_checkbox">
                                    <div class="form-check form-check-inline mr-5">
                                        <input class="form-check-input" type="radio" name="deseja_enviar_email_anunciar_inter" value="1">
                                        <label class="form-check-label font-weight-normal" for="inline-radio1">Sim</label>
                                    </div>
                                    <div class="form-check form-check-inline mr-5">
                                        <input class="form-check-input" type="radio" name="deseja_enviar_email_anunciar_inter" value="0" checked>
                                        <label class="form-check-label font-weight-normal" for="inline-radio2">Não</label>
                                    </div>
                                </div>
                            </div>-->
                            
                            <div class="row">
                                <div class="col">
                                    <button type="button" class="btn btn-block btn-outline-success salvarInter">Salvar</button>
                                </div>
                                <div class="col">
                                     <button type="button" class="btn btn-block btn-outline-success getSugestoesImoveis">Sugestões</button>
                                </div>
                            </div>
                            
                            <div class="resultado_anunciar_interesse"></div>
                            
                            <div class="result_envio_anunciar_interesse"></div>
                        </form>
                    </div>
                    <div class="col-md-6">
                        <div class="card bg-light h-100">
                            <div class="card-header">
                                    <h5>Sugestões de imóveis</h5>
                                    <p>Foram encontrados <b class="cont_imoveis_sugestoes"> 0 </b> imóveis para essas especificações</p>
                                    <div class="float-right">
                                        <label for="checkbox_sugestoes_imoveis_todos">Selecionar Todos</label>
                                        <input type="checkbox" class="checkbox_sugestoes_imoveis_todos" >
                                    </div>
                            </div>
                            <div class="card-body pb-0" id="card-interesse-sujestao" style="overflow-y: auto; max-height: 400px;">
                                <!--<div class="card-text text-muted">
                                <h5>Sugestões de imóveis</h5>
                                
                                </div>-->
                                
                            </div>
                            
                            <div class="card-footer">
                                <div class="row">
                                    <div class="col-md-6">
                                        <button class="btn btn-block btn-success btn-enviar-whats-anunciar-interesse-v1" type="button" data-telefone="<?php e($cadastro->telefone); ?>" data-toggle="tooltip" data-placement="top" title="Contactar a TI para Liberar a Função">Enviar whatsapp</button>
                                    </div>
                                    <div class="col-md-6">
                                        <button class="btn btn-block btn-primary btn-enviar-email-anunciar-interesse-v1" type="button" data-email="<?php e($cadastro->email); ?>">Enviar E-mail</button>
                                    </div>
                                </div>    
                            </div>
                            
                            <div class="result_envia_whats_interesse"></div>
                        </div> 
                    </div>
                </div>  
            </div>
            </div>
        </div>
        
        <div class="card">
            <h5 class="card-header">Adicionar Atendimento</h5>
            <div class="card-body">
                <div class="row">
                    <div class="col-lg-12">
                        <form class="formHistoricoAtendimento" name="formHistoricoAtendimento" action="" method="post">
                            <input type="hidden" class="id_atendimento" name="id_atendimento" value="<?php e($id_atendimento); ?>">
                            <input type="hidden" class="id_user" name="id_user" value="<?php e($id_user); ?>">
                            <div class="form-group">
                                <label class="control-label">Tipo de interesse*</label>
                                <input type="text" name="tipo_interesse" class="form-control tipo_interesse" value="<?php e($tipo_interesse); ?>" readonly="readonly">
                            </div>
                            <div class="form-group">
                                <label class="control-label">Observação*</label>
                                <textarea  name="observacao" class="observacao form-control" rows="3" required="required"></textarea>
                            </div>
                            <!--<div class="form-group">
                                <label class="control-label">Proximo Atendimento</label>
                                <input type="date" name="proximo_contato" value="" class="proximo_contato form-control">
                            </div>-->
                            <div class="form-group">
                                <label for="novo_contato">Tentar um novo contato?</label>
                                <div class="radio">
                                    <label class="radio-inline mr-2"><input type="radio" name="novo_contato" value="sim" id="novo_contato" checked> Sim</label>
                                    <label class="radio-inline"><input type="radio" name="novo_contato" value="nao"> Não, já finalizei.</label>
                                </div>
                            </div>
                            <div class="divProximoContato">
                                <div class="form-group mb-0">
                                    <label for="novo_contato">Proximo contato</label>
                                    <div class="radio">
                                        <label class="radio-inline mr-2"><input class="dias" type="radio" name="dias" id="dias1" value="1" checked> Amanhã</label>
                                        <label class="radio-inline mr-2"><input class="dias" type="radio" name="dias" id="dias2" value="2"> 2 Dias</label>
                                        <label class="radio-inline"><input class="dias" type="radio" name="dias" id="dias3" value="personalizado"> Prersonalizado</label>
                                    </div>
                                </div>
                                <div class="form-group divQuando d-none col-md-6 p-0">
                                    <div class="row">
                                        <div class="col-lg-6">
                                           <label for="proximo_contato">Quando?</label>
                                           <div class="input-group date dateTimeAgenda">
                                                <input type="date" name="proximo_contato" class="form-control" id="proximo_contato">
                                                <div class="input-group-append">
                                                    <span class="input-group-text input-group-addon"><i class="fa fa-calendar" aria-hidden="true"></i></span>
                                                </div>
                                            </div>
                                           <!--<input type="date" name="proximo_contato"  class="form-control">-->
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <?php if(($boxAgendamento??false)){ ?>
                            
                                    <div class="box-agendamento ">
                                        <div class="box-title-section my-4">
                                            <h5 class="text-primary">Agendamento</h5>
                                            <hr>
                                        </div>
                                        <div class="form-group mb-0">
                                            <label for="novo_contato">Agendar visita</label>
                                            <div class="radio">
                                                <label class="radio-inline mr-2"><input type="radio" name="agendar_visita" id="agendar_visita1" value="sim"> Sim</label>
                                                <label class="radio-inline mr-2"><input type="radio" name="agendar_visita" id="agendar_visita2" value="nao" checked> Agora não</label>
                                            </div>
                                        </div>
                                        <div class="divAgendarVisita d-none">
                                            
                                            <input type="hidden" name="id_participantes[]" id="id_participantes" value="<?php e($id_participantes) ?>">
                                            <input type="hidden" name="origem"           id="origem" value="4">
                                            <input type="hidden" name="id_origem"        id="id_origem" value="<?php e($objetoAtendido->id_captura) ?>">
                                            <input type="hidden" name="id_parceiro"      id="id_origem" value="<?php e($objetoAtendido->id_parceiro) ?>">
                                            <input type="hidden" name="destino"          id="destino" value="1">
                                            <input type="hidden" name="id_destino"       id="id_destino" value="<?php e($id_destino??0) ?>">
                                            <input type="hidden" name="id_interessado"   id="id_interessado" value="<?php e($cadastro->id_cadastro??0) ?>">
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for="data_hora_agendamento">Data e hora</label>
                                                        <div class="input-group date dateTimeAgenda">
                                                            <input type="text" name="data_hora_agendamento" class="form-control">
                                                            <div class="input-group-append">
                                                                <span class="input-group-text input-group-addon"><i class="fa fa-calendar" aria-hidden="true"></i></span>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for="tipo_agendamento">Tipo</label>
                                                        <select name="tipo_agendamento" id="tipo_agendamento" class="form-control">
                                                            <option value="">Selecione</option>
                                                            <option value="1">Presencial</option>
                                                            <option value="2">Visita virtual</option>
                                                        </select>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="descricao_agenda">Descrição da agenda</label>
                                                <textarea  name="descricao_agenda" class="form-control" id="descricao_agenda" rows="3"></textarea>
                                            </div>
                                            <!--<div class="box-title-section">
                                                <h5>Envolvidos</h5>
                                                <hr>
                                            </div>-->
                                            <div class="row">
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for="responsavel">Responsável</label>
                                                        <input type="text" name="responsavel" class="form-control" id="responsavel" value="Respnsavel empreendimento" readonly="readonly">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6">
                                                    <div class="form-group">
                                                        <label for="interessado">Interessado</label>
                                                        <input type="text" name="interessado" class="form-control" id="interessado" value="<?php e($interessado->nome); ?>" readonly="readonly">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                            
                            <?php } ?>
                            
                            <div class="form-group mt-5">
                                <small>(*) Campos obrigatórios</small>
                            </div>
                            <div class="form-group text-right">
                                <button class="btn btn-default btn-success b10 salvar_atendimento" type="submit" id="form-button-save">
                                    <i class="fa fa-check"></i> Adicionar e voltar 
                                </button>
                                <button class="btn btn-default cancel-button b10 voltar_pagina" type="button" id="cancel-button">
                                    <i class="fa fa-warning"></i> Voltar
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Histórico -->
<div class="row">
    <div class="col-md-12 mb-5">
        <hr>
        <div class="card-body p-0">
            <ul class="nav nav-tabs" id="historico1Tab1" role="tablist">
                <li class="nav-item">
                    <a class="nav-link active" id="interesse-tab" data-toggle="tab" href="#interesse" role="tab" aria-controls="interesse" aria-selected="true">Histórico de Interesses</a>
                </li>
            </ul>
            <div class="tab-content" id="myTab1Content">
                
                <div class="tab-pane fade show active" id="interesse" role="tabpanel" aria-labelledby="interesse-tab">
                    
                    <form class="form-inline justify-content-end d-none">
                    
                        <label class="font-weight-normal mr-2" for="inputEmpreendimento">Data e Hora:</label>
                      
                        <div class="input-group date dateTimeAgenda mr-2">
                            <div class="input-group-prepend">
                                <div class="input-group-text input-group-addon">
                                  <i class="fa fa-calendar" aria-hidden="true"></i>
                                </div>
                            </div>
                            <input type="text" class="form-control" style="max-width: 120px;"  id="dataHistorico" placeholder="dd/mm/ano">
                         </div>
                         
                         
                        <button type="submit" class="btn btn-primary my-auto">Filtrar</button>
                        
                    </form>
                    <hr>
                    <table id="historico_interesse_table" class="display table table-striped table-bordered" style="width:100%">
                        <thead>
                            <tr>
                                <th>Interesse em</th>
                                <th>Tipo de imovel</th>
                                <th>Tipo de empreendimento</th>
                                <th>Faixa de Preço</th>
                                <th>Momento</th>
                                <th>Bairros</th>
                                <th>Quartos</th>
                                <th>Ações</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php if(isset($interesses)) { ?>
                            <?php foreach($interesses as $inter) { ?>
                            <?php if($inter->ativo == 1 && $inter->interesse_painel_cs == 0) { ?>
                            <tr class="trData" >
                              <td><?php e($inter->tipo_interesse) ?></td>
                              <td><?php e($inter->tipo_imovel) ?></td>
                              <td><?php foreach($inter->tipo_emp as $tipo_emp){ ?><span class="badge badge-secondary"><?php echo $tipo_emp->tipo_emp; ?></span> <?php } ?></td>
                              <td><?php e(money($inter->faixa_preco_inicio) . ' a ' . money($inter->faixa_preco_fim)) ?></td>
                              <td><?php e($inter->momento_interesse) ?></td>
                              <td><?php foreach($inter->bairros as $bairro){ ?><span class="badge badge-secondary"><?php echo $bairro->bairro; ?></span> <?php } ?></td>
                              <td><?php e($inter->quartos) ?></td>
                              <td>
                                  <a href="<?php e(base_url('atendimento/interesse/visualizar/'.$inter->id_interesse)) ?>" target="_blank" class="btn btn-outline-primary" data-toggle="tooltip" data-original-title="Visualizar"><i class="fa fa-eye" aria-hidden="true"></i></a>
                                  <button class="btn btn-outline-warning btn_editar_interesse_v1" data-toggle="tooltip" data-original-title="Editar" data-interesse='<?php e(json_encode($inter)); ?>'><i class="fa fa-pencil" aria-hidden="true"></i></button>
                                  <button class="btn btn-outline-danger btn_excluir_interesse_v1" data-toggle="tooltip" data-original-title="Excluir" data-interesse="<?php e($inter->id_interesse); ?>"><i class="fa fa-times" aria-hidden="true"></i></button>
                              </td>
                            </tr>
                            <?php } } }?>
                        </tbody>
                    </table>                 
                </div>
            </div>
        </div>        
    </div>    
</div>

<!-- Modal --> 
<div class="modal fade" id="editInteresseModal" tabindex="-1" role="dialog" aria-labelledby="editInteresseModal" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" style="max-width: 800px;" role="document">
<div class="modal-content">
  <div class="modal-header">
    <h4 class="modal-title" id="exampleModalLabel">Editar Interesse</h4>
    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
      <span aria-hidden="true">&times;</span>
    </button>
  </div>
  <div class="modal-body">
    <div class="row">
        <div class="col">
            <form class="text-dark form-edit-interesse">
                
                <input class="edit_interesse_id_captura" type="hidden" name="id_captura">
                <input class="edit_interesse_id_interesse" type="hidden" name="id_interesse">
                <input type="hidden" name="id_cadastro" value="<?php e($objetoAtendido->id_cadastro) ?>">
                <input type="hidden" name="id_responsavel" value="<?php e($id_user) ?>">
                
                <div class="form-group row">
                    <div class="col-6">
                       <label for="interessadoEM">Interessado em:</label>
                        <select name="tipo_interesse" class="form-control interForm edit_interesse_tipo_interesse" id="interessado90">
                          <option value="compra">Comprar</option>
                          <option value="venda">Vender</option>
                          <option value="comprar e vender">Comprar e vender</option>
                        </select> 
                    </div>
                  <div class="col-6">
                        <label for="interesse1">Tipo de imóvel</label>
                        <select name="tipo_imovel" id="tipo_imovel" class="form-control edit_interesse_tipo_imovel">
                            <option value="">Todos</option>
                            <optgroup label="Apartamento">
                                <option value="Apartamento Padrão">Padrão</option>
                                <option value="Kitnet">Kitnet</option>
                                <option value="Studio">Studio</option>
                                <option value="Loft">Loft</option>
                                <option value="Flat">Flat</option>
                                <option value="Cobertura">Cobertura</option>
                                <option value="Duplex">Duplex</option>
                                <option value="Triplex">Triplex</option>
                            </optgroup>
                            <optgroup label="Casa">
                                <option value="Casa Padrão">Padrão</option>
                                <option value="Casa de Condomínio">Casa de Condomínio</option>
                                <option value="Casa de Vila">Casa de Vila</option>
                            </optgroup>
                            <optgroup label="Outros">
                                <option value="Comercial">Comercial</option>
                                <option value="Rural">Rural</option>
                                <option value="Terreno">Terreno</option>
                                <option value="Vaga de Garagem">Vaga de Garagem</option>
                                </optgroup>
                        </select>
                  </div>
                    
                </div>
                <div class="form-group row">
                    <div class="col-4">
                        <label for="interesse2">Quartos</label>
                        <select name="quartos" class="form-control interForm edit_interesse_quartos" id="interesse91">
                          <option value="0">0</option>
                          <option value="1">1</option>
                          <option value="2">2</option>
                          <option value="3">3</option>
                          <option value="4">4 ou +</option>
                        </select>
                    </div>
                    <div class="col-4">
                        <label for="interesse3" class="col-form-label">Banheiros:</label>
                        <select name="banheiro" class="form-control interForm edit_interesse_banheiro" id="interesse92">
                          <option value="0">0</option>
                          <option value="1">1</option>
                          <option value="2">2</option>
                          <option value="3">3</option>
                          <option value="4">4 ou +</option>
                        </select>                                
                    </div>  
                    <div class="col-4">
                        <label for="interesse4" class="col-form-label">Vagas:</label>
                        <select name="vagas" class="form-control interForm edit_interesse_vagas" id="interesse93">
                          <option value="0">0</option>
                          <option value="1">1</option>
                          <option value="2">2</option>
                          <option value="3">3</option>
                          <option value="4">4 ou +</option>
                        </select>                                    
                    </div> 
                </div>
                <div class="form-group">
                    <label for="interesse97" class="col-form-label">Tipo de empreendimento:</label>
                    <select class="form-control interForm tipo_emp_editar_interesse" name="tipo_emp_cliente[]" multiple="multiple" id="interesse97">
                      <option value="pronto">Pronto</option>
                      <option value="lancamento">Lançamento</option>
                      <option value="Terreno">Terreno</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="interesse94" class="col-form-label">Bairro:</label>
                    <?php $bairros = HBairros::getSelect2()->items;  ?>
                    <select class="form-control interForm bairro_editar_interesse edit_interesse_bairro" name="bairro[]" multiple="multiple" id="interesse94">
                      <option value="Brasília">Brasília</option>
                      <?php
                        foreach($bairros as $b){
                            ?><option value="<?php e($b->id) ?>"><?php e($b->text) ?></option> <?php
                        }
                      ?>
                    </select>
                </div>  
                <div class="form-group">
                    <label for="interesse95" class="col-form-label">Faixa de preço:</label>
                    <div class="row">
                        <div class="col-6 d-flex align-items-center pr-2">
                            De
                            <input name="faixa_preco_inicio" type="text" class="form-control ml-2 interForm faixa_preco_anunciar_interesse edit_interesse_faixa_preco_inicio" id="interesse95">
                        </div>
                        <div class="col-6 d-flex align-items-center pl-0">
                            até
                            <input name="faixa_preco_fim" type="text" class="form-control ml-2 interForm faixa_preco_anunciar_interesse edit_interesse_faixa_preco_fim" id="interesse95">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <label for="exampleFormControlTextarea96">Descrição</label>
                    <textarea name="descricao" class="form-control interForm edit_interesse_descricao" style="resize: none;" id="exampleFormControlTextarea96" rows="2"></textarea>
                </div>
                <button type="button" class="btn btn-block btn-outline-success editInteresse">Salvar</button>
                
                <div class="result_edit_interesse"></div>
            </form>
        </div>
        
    </div>  
  </div>
</div>
</div>
</div>