<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">
    <div class="col-lg-4">
        <div class="card">
            <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">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>
                </div>
            </div>
        </div>
    </div>
    <div class="col-lg-4">
        <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_bug" name="id_bug" value="<?php e($id_bug); ?>">
                            <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); ?>">
                            <input type="hidden" class="data_hora" name="data_hora" value="<?php e($data_hora); ?>">
                            <div class="form-group">
                                <label class="control-label">Tipo de interesse</label>
                                <input type="text" name="tipo_interesse" value="<?php e($tipo_interesse); ?>" class="form-control tipo_interesse" readonly="readonly">
                                <!--<select name="tipo_interesse" class="tipo_interesse form-control form-control-sm" required="required">
                                    <option value="">Selecione</option>
                                    <option value="Outros" <?php e($tipo_interesse == 'outros' ? 'selected=""':""); ?>>Outros</option>
                                    <option value="Comprar" <?php e($tipo_interesse == 'comprar' ? 'selected=""':""); ?>>Comprar</option>
                                    <option value="Vender" <?php e($tipo_interesse == 'vender' ? 'selected=""':""); ?>>Vender</option>
                                    <option value="Avaliação" <?php e($tipo_interesse == 'avaliacao' ? 'selected=""':""); ?>>Avaliação</option>
                                    <option value="Elleven" <?php e($tipo_interesse == 'elleven' ? 'selected=""':""); ?>>Elleven</option>
                                    <option value="Liberty" <?php e($tipo_interesse == 'liberty' ? 'selected=""':""); ?>>Liberty</option>
                                    <option value="Signature" <?php e($tipo_interesse == 'signature' ? 'selected=""':""); ?>>Signature</option>
                                    <option value="Financiamento" <?php e($tipo_interesse == 'financiamento' ? 'selected=""':""); ?>>Financiamento</option>
                                    <option value="Contato" <?php e($tipo_interesse == 'contato' ? 'selected=""':""); ?>>Contato</option>
                                    <option value="Olx" <?php e($tipo_interesse == 'olx' ? 'selected=""':""); ?>>Olx</option>
                                    <?php foreach ($empreendimentos as $emp){ ?>
                                        <option value="<?php e($emp->uuid_empreendimento); ?>" <?php e($tipo_interesse == $emp->uuid_empreendimento ? 'selected=""':""); ?>><?php e($emp->emp_nome_fantasia); ?></option>
                                    <?php } ?>
                                    
                                    
                                </select>-->
                            </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 class="control-label">Motivo</label>
                                <input type="text" name="proximo_contato_motivo" value="" class="proximo_contato_motivo form-control">
                            </div>
                            
                            <div class="form-group">
                                <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>
    
    <?php if (in_array($state,['add'])){ ?>
    <div class="col-lg-4">
        <div class="card">
            <h5 class="card-header">Últimos atendimentos</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>
    <?php } ?>
    
</div>


<!--
<?php if (in_array($state,['add'])){ ?>
<div class="row mt-5">
    <div class="col-lg-12">
        <div class="card">
            <h5 class="card-header">Últimos atendimentos</h5>
            <div class="card-body">
                <?php if($atendimentos??false){ ?>
                <div class="row">
                    <div class="offset-lg-1 col-lg-10">
                        <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-4">
                                                <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="offset-lg-1 col-lg-10">
                        <p>Ainda não houve atendimento</p>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>
    </div>
</div>
<?php } ?>

<div class="row mt-5">
    <div class="col-lg-12">
        <div class="card">
            <h5 class="card-header">Adicionar Atendimento</h5>
            <div class="card-body">
                <div class="row">
                    <div class="offset-lg-1 col-lg-10">
                        <form class="formHistoricoAtendimento" name="formHistoricoAtendimento" action="" method="post">
                            <input type="hidden" class="id_bug" name="id_bug" value="<?php e($id_bug); ?>">
                            <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); ?>">
                            <input type="hidden" class="data_hora" name="data_hora" value="<?php e($data_hora); ?>">
                            <div class="row">
                                <div class="col-lg-4">
                                    <div class="form-group">
                                        <label class="control-label">Tipo de interesse</label>
                                        <select name="tipo_interesse" class="tipo_interesse form-control form-control-sm" required="required">
                                            <option value="">Selecione</option>
                                            <option value="Outros" <?php e($tipo_interesse == 'outros' ? 'selected=""':""); ?>>Outros</option>
                                            <option value="Comprar" <?php e($tipo_interesse == 'comprar' ? 'selected=""':""); ?>>Comprar</option>
                                            <option value="Vender" <?php e($tipo_interesse == 'vender' ? 'selected=""':""); ?>>Vender</option>
                                            <option value="Avaliação" <?php e($tipo_interesse == 'avaliacao' ? 'selected=""':""); ?>>Avaliação</option>
                                            <option value="Elleven" <?php e($tipo_interesse == 'elleven' ? 'selected=""':""); ?>>Elleven</option>
                                            <option value="Financiamento" <?php e($tipo_interesse == 'financiamento' ? 'selected=""':""); ?>>Financiamento</option>
                                        </select>
                                    </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">
                                        <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>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>-->