<?php include 'tambah.php'; ?>

<style>
    .tiktok-container blockquote {
        margin: 0 auto !important;
        max-width: 325px !important; /* Batasi lebar maksimal di dalam tabel */
        min-width: 200px !important;
    }
</style>

<table class="table table-bordered" id="example1">
    <thead>
        <tr>
            <th width="5%">No</th>
            <th width="25%">Judul</th>
            <th width="40%">Video</th> 
            <th>Stat</th>
            <th>Tgl Post</th>
            <th>Aksi</th>
        </tr>
    </thead>
    <tbody>
        <?php $no = 1;
        foreach ($video as $row) { ?> <tr>
            <td><?= $no ?></td>
            <td><?= $row['judul_video'] ?></td>
            <td>
                <div class="tiktok-container">
                    <?= $row['embed_code'] ?>
                </div>
            </td>
            <td><?= ($row['status'] == 1) ? 'Aktif' : 'Non Aktif'; ?></td>
            <td><?= $row['created_at'] ?></td>
            <td>
                <a href="<?= base_url('admin/tiktok/edit/' . $row['id']) ?>" class="btn btn-success btn-sm"><i class="fa fa-edit"></i></a>
                <a href="<?= base_url('admin/tiktok/delete/' . $row['id']) ?>" class="btn btn-dark btn-sm" onclick="confirmation(event)"><i class="fa fa-trash"></i></a>
            </td>
        </tr>
        <?php $no++; } ?>
    </tbody>
</table>

<script async src="https://www.tiktok.com/embed.js"></script>