42 lines
1.9 KiB
PHP
42 lines
1.9 KiB
PHP
<?php $this->load->view('template/header'); ?>
|
|
|
|
<div class="container">
|
|
<div class="card my-5 text-dark bg-light mb-3">
|
|
<div class="card-header">Data Produk</div>
|
|
<div class="card-body">
|
|
<?= $this->session->flashdata('pesan'); ?>
|
|
<div class="table-responsive">
|
|
<table class="table" id="datatable" data-ordering="false">
|
|
<thead>
|
|
<tr>
|
|
<th>No</th>
|
|
<th>Nama Produk</th>
|
|
<th>Foto</th>
|
|
<th>Harga</th>
|
|
<th>Rating</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php $no = 1;
|
|
foreach ($produk as $row) : ?>
|
|
<tr>
|
|
<td><?= $no++ ?></td>
|
|
<td><?= $row['nama_produk'] ?></td>
|
|
<td><img src="<?= base_url('assets/images/produk/' . $row['foto']) ?>" class="img-thumbnail" width="60"></td>
|
|
<td><?= number_format($row['harga'], 0, ',', '.') ?></td>
|
|
<td><?= isset($ratings[$row['id_produk']]['avg']) ? number_format($ratings[$row['id_produk']]['avg'], 1) : '0' ?></td>
|
|
<td>
|
|
<a href="#" data-href="<?= base_url('produk/hapus/' . $row['id_produk']); ?>" data-bs-toggle="modal" data-bs-target="#deleteModal" class="btn btn-danger btn-sm" title="Hapus">Hapus</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php $this->load->view('template/js'); ?>
|
|
<?php $this->load->view('template/footer'); ?>
|