<?php

$galeriasDao = new \Dao\Galerias();

$galeriasDao->getGaleriaPorId($conecta, base64_decode(filter_input(INPUT_GET, 'id')));

?>

<div class="breadcrumb-holder">

    <div class="container-fluid">

        <ul class="breadcrumb">

            <li class="breadcrumb-item"><a href="./">Home</a></li>

            <li class="breadcrumb-item active">Ordenar Imagens | <?php echo $galeriasDao->nome; ?></li>

        </ul><!--/.breadcrumb -->

    </div><!---/.container-fluid -->

</div><!--/.breadcrumb-holder -->

<section class="dashboard-counts section-padding">

    <div class="container-fluid">

        <div class="row">

            <div class="col-lg-12">

                <div class="card">

                    <div class="card-header d-flex align-items-center">

                        <h2 class="h5 display">Ordenar Imagens</h2>

                    </div><!--/.card-header -->

                    <div class="card-footer">

                        <a href="?p=fotos-upload&id=<?php echo base64_encode($galeriasDao->id); ?>" class="btn btn-sm btn-success">

                            <i class="fa fa-plus"></i> Upload

                        </a>

                    </div>

                    <div class="card-body">

                        <table class="table table-striped">

                            <thead>

                                <tr>

                                    <th class="col-60">Nº</th>

                                    <th>Imagem</th>

                                    <th>Legenda</th>

                                </tr>

                            </thead>

                            <tbody class="sortable" data-table="galerias_images">

                                <?php

                                $imagesDao = new \Dao\GaleriasImages();

                                $lst_images = $imagesDao->getLista($conecta, $galeriasDao->id, 'ORDER BY ordem ASC');

                                foreach ($lst_images as $item) {

                                    echo '

                                        <tr id="foo_' . $item->id . '">

                                            <td>' . $item->ordem . '</td>

                                            <td><img src="' . $pasta . $item->image . '" width="50" alt="" /></td>

                                            <td>' . $item->legenda . '</td>

                                        </tr>

                                    ';

                                }

                                ?>

                            </tbody>

                            <tfoot>

                                <tr>

                                    <td colspan="3" align="right">

                                        <a href="?p=fotos&id=<?php echo base64_encode($galeriasDao->id); ?>" class="btn btn-sm btn-warning">

                                            <i class="fa fa-arrow-left"></i> Voltar

                                        </a>

                                    </td>

                                </tr>

                            </tfoot>

                        </table>

                    </div><!--/.card-body -->

                </div><!--/.card -->

            </div><!--/.col-lg-12 -->

        </div><!--/.row -->

    </div><!--/.container-fluid -->

</section><!--/.dashboard-counts -->