<!---Dashboard Incorporadora--->

<div class="row">
    <!--Cabeçalho-->
    <div class="col-md-12">
        <div class="d-flex">
            <label class="my-auto text-value-lg text-primary">Dashboard de Atendimento</label>
            <div class="input-group date dateTimeAgenda ml-auto" style="width: 180px;">
                <input type="text" name="proximo_contato" class="form-control h-100" 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>
        </div>
        <hr>
    </div>
    <!--DASH PARTE 1-->
    <div class="col-lg-6 col-xl-3">
        <div class="card border-success filaatendimento">
            
        </div>
    </div>
    
    <!--DASH PARTE 2-->
    <div class="col-lg-6 col-xl-3">
        <div class="d-flex">
            <div class="card text-white bg-primary w-100 mr-1 mb-2">
                <div class="card-body">
                    <div class="h1 text-muted text-right mb-1">
                        <i class="icon-people"></i>
                    </div>
                    <div class="d-flex">
                        <div class="text-value-lg">0</div><span class="text-value ml-1 mt-1">+0</span>
                    </div>
                    <div>Total de <b>Atendimentos</b></div>
                    <div class="progress progress-white progress-xs mt-3">
                        <div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                </div>
            </div>

        </div>
        <div class="card d-none">
            <div class="card-header">Ofertas de Financiamentos</div>
            <div class="card-body">
                
                <div class="card bg-light">
                    <div class="card-text p-2">
                            <div class="text-muted mb-2">
                                <b>Nome:</b> Marcos Fernandes Barbosa
                            </div>
                            <div class="text-muted mb-1">
                                <b>Data de entrada:</b> 01/03/2020
                            </div>
                            <div class="text-muted mb-1">
                                <b>Data da chave:</b> 12/03/2020
                            </div>
                            <div class="text-muted">
                                <b>Empreendimento:</b> Elleven
                            </div>
                    </div>
                </div>
                <button type="button" class="btn btn-outline-success btn-lg btn-block">Ofertar financiamento</button>
            </div>
        </div>
        
    </div>
    <!--DASH PARTE 3-->
    <div class="col-12 col-xl-6">
        
        <div class="card text-white bg-success mb-2">
            <div class="card-body pb-0">
            <div class="d-flex">
                <div class="text-value-lg">0%</div><span class="text-value ml-1 mt-1">+0%</span>
            </div>        
            
            <div>Taxa de <b>Sucesso</b></div>
            </div>
            <div class="my-2 mx-3">
                <canvas id="taxaSucesso" height="87" width="235"></canvas>
            </div>
        </div>
        <div class="d-flex mb-2">
            
            <div class="d-flex flex-column mr-2" >
                <div class="card w-100 h-100 mb-1" style="min-width: 120px;">
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0%</div><span class="ml-1 text-success">+0</span>
                    </div>
                    <p class="card-text text-muted font-weight-bold mb-1">Insucesso</p>
                    <div class="progress progress-xs mb-0">
                        <div class="progress-bar bg-danger" role="progressbar" style="width: 100%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                  </div>
                </div>
                <div class="card w-100  h-100 mt-1 mb-0">
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20">0</div><span class="ml-1 text-danger">-0</span>
                    </div>
                    <p class="card-text text-muted font-weight-bold mb-1">FCR</p>
                    <div class="progress progress-xs mb-0">
                        <div class="progress-bar" role="progressbar" style="width:100%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
                    </div>
                  </div>
                </div>
            </div>
            
            <div class="card-group d-flex flex-grow w-100">
                <div class="card" style="min-width: 130px;">
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20" ><?php e($negociacoes_andamento); ?></div><span class="ml-1 text-success" title="Negociações Hoje">+<?php e($novas_negociacoes); ?></span>
                    </div>
                    <p class="card-text text-danger"><b class="font-weight-bold text-muted">Negociações</b><br>Em andamento</p>
                    <hr>
                    <div class="d-flex">  
                        <div class="text-muted f-20" ><?php e($negociacoes_concluida); ?></div><span class="ml-1 text-success">+<?php e($novas_negociacoes_concluida); ?></span>
                    </div>
                    <p class="card-text text-success"><b class="font-weight-bold text-muted">Negociações</b><br>Convertidas</p>
                  </div>
                </div>
                <div class="card">
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-success">+0</span>
                    </div>
                    <p class="card-text text-danger"><b class="font-weight-bold text-muted">Reuniões</b><br>Agendadas</p>
                    <hr>
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-success">+0</span>
                    </div>
                    <p class="card-text text-success"><b class="font-weight-bold text-muted">Reuniões</b><br>Realizadas</p>
                  </div>
                </div>
                <div class="card" style="min-width: 160px;">
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-success">+0</span>
                    </div>
                    <p class="card-text text-danger"><b class="font-weight-bold text-muted">Criações de conta</b><br>Em andamento</p>
                    <hr>
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-success">+0</span>
                    </div>
                    <p class="card-text text-success"><b class="font-weight-bold text-muted">Criações de conta</b><br>Convertidas</p>
                  </div>
                </div>
            </div>
            
        </div>
        
        <div class="card-group d-flex flex-grow w-100">
                <div class="card">
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-danger">-0</span>
                    </div>
                    <p class="card-text text-danger"><b class="font-weight-bold text-muted">Créditos</b><br>Em andamento</p>
                    <hr>
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-danger">-0</span>
                    </div>
                    <p class="card-text text-success"><b class="font-weight-bold text-muted">Créditos</b><br>Aprovados</p>
                  </div>
                </div>
                <div class="card" >
                  <div class="card-body">
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-danger">-0</span>
                    </div>
                    <p class="card-text text-danger"><b class="font-weight-bold text-muted">Interesses</b><br>Em andamento</p>
                    <hr>
                    <div class="d-flex">  
                        <div class="text-muted f-20" >0</div><span class="ml-1 text-danger">-0</span>
                    </div>
                    <p class="card-text text-success"><b class="font-weight-bold text-muted">Interesses</b><br>Convertidos</p>
                  </div>
                </div>

        </div>
        
    </div>
    
    <!--PORTAIS-->
    <div class="col-md-12 d-none">
        <hr>
        <div class="d-flex flex-wrap flex-xl-nowrap justify-content-center">
        
            <!--Wimóveis-->
            <div class="card mr-1 w-100" style="min-width: 270px;">
                
                <div class="card-header font-weight-bold bg-light content-center">
                    
                    <img src="https://img10.naventcdn.com/home/RPHOMv2.25.3-RC1/images/logo-wimoveis.png" class="img-fluid" style="max-height: 23px;" alt="Responsive image">
    
                    <span class="badge badge-pill badge-danger">0</span>
                    <div class="card-header-actions">
                        <button class="btn btn-block btn-primary" type="button">Responder</button>
                    </div>
                </div>
                  
                <div class="card-body row text-center" style="font-weight: 500!important;">
                    
                    <div class="col-6 pr-1 mb-2" >  
                      <button class="btn btn-block btn-danger" style="min-height: 79px;">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase">Pendentes</div>
                      </button>
                    </div>  
                    
                    
                    <div class="col-6 pl-1 mb-2">  
                        <div class="card border-danger text-danger p-1 mb-0">
                            <div class="text-value">0 Dia<br>00:00:00</div>
                            <div>
                                <i class="fa fa-bullhorn"></i>
                            </div>
                        </div>                   
                    </div>
                    <div class="col-6 pr-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg ">N/A</div>
                            <div class="text-uppercase text-muted">Atendidos</div>
                      </div>
                    </div>                   
                    <div class="col-6 pl-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase  text-muted">Convertidos</div>
                      </div>
                    </div>                   
                        
                </div>
                
            </div>
            <!--Zap-->
            <div class="card mx-1 w-100" style="min-width: 270px;">
                
                <div class="card-header font-weight-bold bg-light content-center">
                    <img src="https://blog.gohouse.com.br/wp-content/uploads/2018/09/zap-imoveis-logo.png" class="img-fluid" style="max-height: 30px;" alt="Responsive image">
                    <span class="badge badge-pill badge-danger">0</span>
                    <div class="card-header-actions">
                        <button class="btn btn-block btn-primary" type="button">Responder</button>
                    </div>
                </div>
                
                <div class="card-body row text-center" style="font-weight: 500!important;">
                    
                    <div class="col-6 pr-1 mb-2">  
                      <button class="btn btn-block btn-outline-secondary disabled" style="min-height: 79px;">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase">Pendentes</div>
                      </button>
                    </div>  
                    <div class="col-6 pl-1 mb-2">  
                        <div class="card border-secondary text-secondary p-1 mb-0">
                            <div class="text-value">0 Dia<br>00:00:00</div>
                            <div>
                                <i class="fa fa-bullhorn"></i>
                            </div>
                        </div>                   
                    </div>
                    <div class="col-6 pr-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg ">N/A</div>
                            <div class="text-uppercase text-muted">Atendidos</div>
                      </div>
                    </div>                   
                    <div class="col-6 pl-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase  text-muted">Convertidos</div>
                      </div>
                    </div>                   
                     
                </div>
                
            </div>
            <!--Viva Real-->
            <div class="card mx-1 w-100" style="min-width: 270px;">
    
                <div class="card-header font-weight-bold bg-light content-center">
                    <img src="https://d1.awsstatic.com/case-studies/LATAM/logo-vivareal-azul-claro-min-1.e29ca11ed519734dabe2a7fd14cb6588e4a95c8c.png" class="img-fluid" style="max-height: 35px;" alt="Responsive image">
                    <span class="badge badge-pill badge-danger">0</span>
                    <div class="card-header-actions">
                        <button class="btn btn-block btn-primary" type="button">Responder</button>
                    </div>
                </div>
                
                <div class="card-body row text-center" style="font-weight: 500!important;">
                    
                    <div class="col-6 pr-1 mb-2">  
                      <button class="btn btn-block btn-outline-secondary disabled" style="min-height: 79px;">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase">Pendentes</div>
                      </button>
                    </div>  
                    <div class="col-6 pl-1 mb-2">  
                        <div class="card border-secondary text-secondary p-1 mb-0">
                            <div class="text-value">0 Dia<br>00:00:00</div>
                            <div>
                                <i class="fa fa-bullhorn"></i>
                            </div>
                        </div>                   
                    </div>
                    <div class="col-6 pr-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg ">N/A</div>
                            <div class="text-uppercase text-muted">Atendidos</div>
                      </div>
                    </div>                   
                    <div class="col-6 pl-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase  text-muted">Convertidos</div>
                      </div>
                    </div>                   
                        
                </div>
                
            </div>
            <!--OLX-->
            <div class="card mx-1 w-100" style="min-width: 270px;">
    
                <div class="card-header font-weight-bold bg-light content-center">
                    <img src="https://logodownload.org/wp-content/uploads/2016/10/olx-logo-1-1.png" class="img-fluid" style="max-height: 30px;" alt="Responsive image">
                    <span class="badge badge-pill badge-danger">0</span>
                    <div class="card-header-actions">
                        <button class="btn btn-block btn-primary" type="button">Responder</button>
                    </div>
                </div>
                
                <div class="card-body row text-center" style="font-weight: 500!important;">
                    
                    <div class="col-6 pr-1 mb-2 text-secondary">  
                      <button class="btn btn-block btn-outline-secondary disabled" style="min-height: 79px;">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase">Pendentes</div>
                      </button>
                    </div>  
                    <div class="col-6 pl-1 mb-2">  
                        <div class="card border-secondary text-secondary p-1 mb-0">
                            <div class="text-value">0 Dia<br>00:00:00</div>
                            <div>
                                <i class="fa fa-bullhorn"></i>
                            </div>
                        </div>                   
                    </div>
                    <div class="col-6 pr-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg ">N/A</div>
                            <div class="text-uppercase text-muted">Atendidos</div>
                      </div>
                    </div>                   
                    <div class="col-6 pl-1 mb-1">  
                      <div class="card border-success text-success p-1 mb-0">
                            <div class="text-value-lg">N/A</div>
                            <div class="text-uppercase  text-muted">Convertidos</div>
                      </div>
                    </div>                   
                                     
                     
                </div>
                
            </div>          
            
        </div>
    </div>
    
    <!--LISTAS-->
    <div class="col-md-12 mb-bottom">
        <hr>
        <div class="card-body p-0">
            <!--TABS-->
            <ul class="nav nav-tabs" id="myTab1" role="tablist">
                <li class="nav-item">
                    <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Agenda</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Histórico</a>
                </li>
            </ul>
            <div class="tab-content" id="myTab1Content">
                <!--TAB 1-->
                <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
                    
                        <div class="leg-calendar"></div>
                        
                    <!--Filtro-->
                    <form class="form-inline justify-content-end form-busca-agenda-geral">
                        
                        <label class="font-weight-normal mr-2" for="inputEmpreendimento">Por Empreendimento:</label>
                        
                        <div class="form-group mr-2">
                            <select class="form-control" style="min-width: 120px;" id="inputEmpreendimento" name="uuid_empreendimento">
                                <option value="todos">Todos</option>
                                <?php foreach($empreendimentos as $empreendimento){ ?>
                                    <option value="<?php e($empreendimento->uuid_empreendimento) ?>"><?php e($empreendimento->emp_nome_fantasia) ?></option>  
                                <?php } ?>
                            </select>
                        </div>
                    
                        <!--<label class="font-weight-normal mr-2" for="inputEmpreendimento">Por Data e Hora:</label>
                      
                        <div class="input-group date dateTimeAgenda mr-2" style="min-width: 120px;">
                            <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" id="dataHistorico" name="intervalo" placeholder="dd/mm/ano">
                         </div>
                         -->
                         
                        <button type="button" class="btn btn-primary my-auto btn-buscar-agenda">Filtrar</button>
                        
                    </form>
                    
                    <hr>
                    <!--CalendaioS-->
                    <div class="card-body -0">
                        <div id='calendar'></div>
                    </div>
                    </div>
                
                <!--TAB 2-->
                <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
                    <!--Filtro-->
                    <form class="form-inline justify-content-end form-pesquisa-filtro">
                        
                        <label class="font-weight-normal mr-2" for="inputEmpreendimento">Por Empreendimento:</label>
                        
                            <div class="form-group mr-2">
                                <select class="form-control" style="min-width: 120px;" id="inputEmpreendimento" name="empreendimento">
                                    <option value="todos">Todos</option>
                                    <?php foreach($empreendimentos as $empreendimento){ ?>
                                        <option value="<?php e($empreendimento->uuid_empreendimento) ?>"><?php e($empreendimento->emp_nome_fantasia) ?></option>  
                                    <?php } ?>
                                </select>
                            </div>
                        
                            <label class="font-weight-normal mr-2" for="inputEmpreendimento">Por Data e Hora:</label>
                          
                            <div class="input-group date dateTimeAgenda mr-2" style="min-width: 120px;">
                                <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" id="dataHistorico" name="data" placeholder="dd/mm/ano">
                             </div>
                         
                        <button type="button" class="btn btn-primary my-auto btn-filtrar">Filtrar</button>
                        <button type="button" class="btn btn-danger my-auto btn-limpar-filtros" style="display:none;">Limpar Filtros</button>
                        
                    </form>
                    <hr>
                    <!--LISTAS-->
                    <span class="tb-original">
                        <table class="display table table-striped table-bordered table-responsive-x">
                          <thead>
                            <tr>
                              <th scope="col">#</th>
                              <th scope="col">Nome</th>
                              <th scope="col">Email</th>
                              <th scope="col">Data de entrada</th>
                              <th scope="col">Último Atendimento</th>
                              <th scope="col">Origem</th>
                              <th scope="col">Status</th>
                              <th scope="col">Ações</th>
                            </tr>
                          </thead>
                          <tbody class="tb-result">
                            <?php foreach($historicos as $hist){ ?>    
                                <tr>
                                  <th scope="row"><?php e($hist->id_fila); ?></th>
                                  <td><?php e($hist->nome) ?></td>
                                  <td><?php e($hist->email) ?></td>
                                  <td><?php e(converte_datahora($hist->datetime_captura,1)) ?></td>
                                  <td><?php e(converte_datahora($hist->date_time,1)) ?></td>
                                  <td><?php e($hist->captura) ?></td>
                                  <td><?php e($hist->status_formatado) ?></td>
                                  <td><a class="btn btn-sm btn-primary mr-1" href="<?php e(base_url('atendimento/incorporadoras/atendimento/'.$hist->uri_atend)) ?>" target="_blank" data-original-title="Atendimento rápido"><i class="icon-plus"></i></a>
                                  </td>
                                </tr>
                            <?php } ?>
                          </tbody>
                        </table>
                    </span>
                    <span class="tb-paraguay" style="display:none;">
                        
                    </span>
                </div>
            </div>
        </div>        
    </div>
</div>
<!-- Modal -->
<div class="modal fade" id="modalAgendaGeral" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel"></h5>
        <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="form-group">
            <label for="exampleFormControlInput1">Nome:</label>
            <input type="text" name="nome" class="form-control" id="exampleFormControlInput1" readonly>
        </div>
        <div class="form-group">
            <label for="exampleFormControlInput1">Empreendimento:</label>
            <input type="text" name="origem_captura" class="form-control" id="exampleFormControlInput1" readonly>
        </div>
        <div class="form-group">
            <label for="exampleFormControlInput1">Tipo de Imovel:</label>
            <input type="text" name="tipo_imovel" class="form-control" id="exampleFormControlInput1" readonly>
        </div>
        <!--<div class="form-group">
            <label for="exampleFormControlInput1">Data e Hora da Visita:</label>
            <input type="dt_hr" class="form-control" id="exampleFormControlInput1" readonly>
        </div>-->
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar</button>
        <a type="button" class="btn btn-primary btn-calendar-continue-atend">Atendimento</a>
      </div>
    </div>
  </div>
</div>