<div class="animated fadeIn page-incorporadora">
    <div class="row">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    Histórico - Sql (Query)
                </div>
                <div class="card-body">
                    <div id="accordion" role="tablist">
                    <?php for($i=10;$i>0;$i--){ ?>
                    
                        <div class="card mb-1">
                            <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="false" aria-controls="collapseOne" class="collapsed">
                                        Versão - <?php e($i); ?>
                                    </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="form-group">
                                        <?php for($x=0;$x<=5;$x++){ ?>
                                        <div class="form-group">
                                            <p>SELECT * FROM `sys_users` ORDER BY `sys_users`.`id` ASC</p>
                                            <p class="m-0 text-primary">Robson Goleiro Frangueiro</p>
                                            <small>29/10/2020 17:44</small>
                                        </div>
                                        <hr>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    <?php } ?>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    Version <?php e($versao); ?> - Nova versão do migration
                </div>
                <div class="card-body">
                    <form action="" class="formAddSql">
                        <button class="btn btn-success collapsed" type="button" data-toggle="collapse" data-target="#divAddSql" aria-expanded="false" aria-controls="divAddSql">
                            <i class="fa fa-plus"></i> Adicionar SQL
                        </button>
                        
                        <div class="collapse mt-4" id="divAddSql">
                            <input type="hidden" name="version" value="<?php e($versao); ?>">
                            
                            <div class="form-group">
                                <label for="responsavel">Responsável</label>
                                <select name="id_cadastro" class="form-control" id="responsavel" required="required">
                                    <option value="<?php e($responsavel['id_cadastro']); ?>"><?php e($responsavel['nome']); ?></option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label for="str_sql">Inserir SQL</label>
                                <textarea name="str_sql" class="form-control" id="str_sql"rows="5" required="required"></textarea>
                            </div>
                            <div class="form-group text-right mt-4 mb-0">
                                <div class="msgAddSql"></div>
                                <button type="submit" class="btn btn-success btn-sm btnAddSql"><i class="fa fa-check"></i> Salvar</button>
                            </div>
                        </div>
                    </form>
                    <?php if(!empty($sqls)){ ?>
                    <div class="form-group mt-5 mb-4">
                        <a class="cursor-pointer" data-toggle="collapse" href="#divSqls" aria-expanded="true" aria-controls="divAddSql">
                            <h5>SQL's aguardando Build</h5>
                        </a>
                        <hr>
                    </div>
                    <div class="collapse show" id="divSqls">
                        <?php foreach(($sqls??[]) as $k=>$sql){ ?>
                        <form id="formAtualizaSql_<?php e($k); ?>" action="" class="formAtualizaSql">
                            <div class="cardSql">
                                <div class="form-group mb-0">
                                    <div class="form-group">
                                        <textarea name="str_sql" class="form-control" id="str_sql"rows="2" required="required"><?php e($sql->str_sql); ?></textarea>
                                        <input type="hidden" name="id_sql" value="<?php e($sql->id_sql); ?>">
                                        <input type="hidden" name="id_cadastro" value="<?php e($sql->id_cadastro); ?>">
                                        <input type="hidden" name="version" value="<?php e($sql->version); ?>">
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6">
                                        <p class="m-0 text-primary responsavel"><?php e($sql->nome); ?></p>
                                        <small class="data_hora"><?php e(date("d/m/Y H:i", strtotime($sql->data_hora))); ?></small>
                                    </div>
                                    <div class="col-md-6">
                                         <div class="form-group text-right mb-0">
                                            <button type="submit" class="btn btn-outline-success btn-sm btnUpdate btnActTipo" data-tipo="update"><i class="fa fa-rotate-right"></i> Atualizar</button>
                                            <a href="javascript:;" role="button" class="btn btn-outline-danger btn-sm btnDelete"><i class="fa fa-trash"></i> <span>Excluir</span></a>
                                            <span class="divButton d-none">
                                                <button type="submit" class="btn btn-outline-primary btn-sm btnActTipo" data-tipo="delete"><i class="fa fa-check"></i> <span>Sim</span></button>
                                                <a href="javascript:;" role="button" class="btn btn-outline-danger btn-sm btnDelNao"><i class="fa fa-close"></i> <span>Não</span></a>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="msgRetorno mt-2"></div>
                            <hr class="cardSql">
                        </form>
                        <?php } ?>
                    </div>
                    <?php } ?>
                </div>
            </div>
        </div>
    </div>
</div>