<?= $this->extend('layouts/owner') ?>

<?= $this->section('content') ?>

<div class="container-fluid">

    <div class="row mb-3">

        <div class="col-md-6">

            <h3>

                <i class="fas fa-history"></i>

                History Produksi

            </h3>

        </div>

        <div class="col-md-6 text-end">

            <a href="<?= base_url('owner/production') ?>"

               class="btn btn-secondary">

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

                Kembali

            </a>

        </div>

    </div>

    <div class="card shadow">

        <div class="card-header bg-dark text-white">

            Riwayat Queue Produksi

        </div>

        <div class="card-body">

            <table class="table table-bordered table-striped">

                <thead class="table-dark">

                <tr>

                    <th width="60">No</th>

                    <th>ID Queue</th>

                    <th>Status Sebelum</th>

                    <th>Status Sesudah</th>

                    <th>Update</th>

                </tr>

                </thead>

                <tbody>

                <?php $no=1; ?>

                <?php foreach($history as $row): ?>

                <tr>

                    <td><?= $no++ ?></td>

                    <td><?= $row['id_queue'] ?></td>

                    <td>

                        <span class="badge bg-secondary">

                            <?= strtoupper($row['status_sebelum']) ?>

                        </span>

                    </td>

                    <td>

                        <?php

                        switch($row['status_sesudah']){

                            case 'waiting':

                                echo '<span class="badge bg-warning">WAITING</span>';

                            break;

                            case 'process':

                                echo '<span class="badge bg-primary">PROCESS</span>';

                            break;

                            case 'completed':

                                echo '<span class="badge bg-success">COMPLETED</span>';

                            break;

                            case 'cancel':

                                echo '<span class="badge bg-danger">CANCEL</span>';

                            break;

                            default:

                                echo $row['status_sesudah'];

                        }

                        ?>

                    </td>

                    <td>

                        <?= $row['updated_at'] ?>

                    </td>

                </tr>

                <?php endforeach; ?>

                </tbody>

            </table>

        </div>

    </div>

</div>

<?= $this->endSection() ?>