<?= $this->extend('admin/layout/main') ?>
<?= $this->section('content') ?>
<div class="d-flex justify-content-between align-items-center mb-3">
    <h3>سلايدر الصفحة الرئيسية</h3>
    <a href="/admin/site-slides/create" class="btn btn-dark btn-sm"><?= lang('App.add_new') ?></a>
</div>
<div class="row">
<?php foreach ($slides as $s): ?>
    <div class="col-md-4 mb-3">
        <div class="card">
            <img src="<?= base_url('uploads/slides/' . $s['image']) ?>" class="card-img-top" style="height:150px;object-fit:cover;">
            <div class="card-body">
                <h6 class="card-title"><?= esc($s['title']) ?></h6>
                <p class="card-text small text-muted"><?= esc($s['subtitle']) ?></p>
                <a href="/admin/site-slides/<?= $s['id'] ?>/edit" class="btn btn-sm btn-outline-primary"><?= lang('App.edit') ?></a>
                <form method="post" action="/admin/site-slides/<?= $s['id'] ?>/delete" class="d-inline" onsubmit="return confirm('?')">
                    <?= csrf_field() ?><button class="btn btn-sm btn-outline-danger"><?= lang('App.delete') ?></button>
                </form>
            </div>
        </div>
    </div>
<?php endforeach; ?>
<?php if (empty($slides)): ?><p class="text-muted"><?= lang('App.no_data') ?></p><?php endif; ?>
</div>
<?= $this->endSection() ?>
