158 lines
4.1 KiB
PHP
158 lines
4.1 KiB
PHP
<style type="text/css">
|
|
table,
|
|
th,
|
|
tr,
|
|
td {
|
|
text-align: center;
|
|
}
|
|
|
|
.swal2-popup {
|
|
font-family: inherit;
|
|
font-size: 1.2rem;
|
|
}
|
|
|
|
.btn-group,
|
|
.btn-group-vertical {
|
|
position: relative;
|
|
display: initial;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
</style>
|
|
<?php if ($this->session->flashdata('message')) { ?>
|
|
<div class="col-lg-12 alerts">
|
|
<div class="alert alert-dismissible alert-success">
|
|
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
<h4> <i class="icon fa fa-check"></i>Berhasil</h4>
|
|
<p><?php echo $this->session->flashdata('message'); ?></p>
|
|
</div>
|
|
</div>
|
|
<?php } else { } ?>
|
|
<section class="content">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<div class="box box-info">
|
|
<div class='box-header with-border'>
|
|
<h3 class='box-title'>Data Barang</h3>
|
|
<div class="pull-right">
|
|
<?php
|
|
echo anchor('barang/post', 'Tambah data', array('class' => 'btn btn-success'))
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div class="box-body">
|
|
<table id="myTable" class="table table-bordered table-hover ">
|
|
<thead>
|
|
<tr>
|
|
<th>No.</th>
|
|
<th>Supllier</th>
|
|
<th>Nama Barang</th>
|
|
<th>Kategori Barang</th>
|
|
<th>Tingkat</th>
|
|
<th>Harga Beli</th>
|
|
<th>Harga Jual</th>
|
|
<th>Foto</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php $no = 0;
|
|
foreach ($record as $r) { ?>
|
|
<tr>
|
|
<td><?php echo ++$no; ?></td>
|
|
<td><?php echo $r->nama_perusahaan; ?></td>
|
|
<td><?php echo $r->nama_barang; ?></td>
|
|
<td><?php echo $r->nama_kategori; ?></td>
|
|
<td><?php echo $r->nama_ukuran; ?></td>
|
|
<td>Rp. <?php echo number_format($r->harga_beli); ?></td>
|
|
<td>Rp. <?php echo number_format($r->harga); ?></td>
|
|
<td>
|
|
<a href="<?php echo (site_url('uploads/' . $r->foto)); ?>" class="image-link">
|
|
<img src="<?php echo (site_url('uploads/' . $r->foto)); ?>" alt="" style="width:30px;height:30px">
|
|
</a>
|
|
</td>
|
|
<td><?php
|
|
echo anchor(site_url('barang/edit/' . $r->id_barang), '<i class="fa fa-pencil-square-o fa-lg"></i> Edit', array('title' => 'edit', 'class' => 'btn btn-sm btn-warning'));
|
|
echo ' ';
|
|
echo anchor(site_url('barang/hapus/' . $r->id_barang), '<i class="fa fa-trash fa-lg"></i> Hapus', 'title="delete" class="btn btn-sm btn-danger "');
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
<script src="<?php echo base_url() ?>assets/app/js/alert.js"></script>
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#myTable').DataTable({
|
|
|
|
"dom": '<"top row"<"col-md-4" l ><"col-md-4" B ><"col-md-4" and f>>rt<"bottom row"<"col-md-6" i> <"col-md-6" p>>',
|
|
|
|
buttons: [{
|
|
extend: 'csvHtml5',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6],
|
|
},
|
|
},
|
|
{
|
|
extend: 'excelHtml5',
|
|
title: 'DATA BARANG',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6],
|
|
},
|
|
},
|
|
{
|
|
extend: 'copyHtml5',
|
|
title: 'Data Barang',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6],
|
|
},
|
|
},
|
|
{
|
|
extend: 'pdfHtml5',
|
|
oriented: 'portrait',
|
|
pageSize: 'legal',
|
|
title: 'Data Barang',
|
|
download: 'open',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6],
|
|
},
|
|
customize: function(doc) {
|
|
doc.content[1].table.widths = Array(doc.content[1].table.body[0].length + 1).join('*').split('');
|
|
doc.styles.tableBodyEven.alignment = 'center';
|
|
doc.styles.tableBodyOdd.alignment = 'center';
|
|
},
|
|
},
|
|
{
|
|
extend: 'print',
|
|
oriented: 'portrait',
|
|
pageSize: 'A4',
|
|
title: 'Data Barang',
|
|
exportOptions: {
|
|
columns: [0, 1, 2, 3, 4, 5, 6],
|
|
},
|
|
},
|
|
],
|
|
"fnDrawCallback": function() {
|
|
$('.image-link').magnificPopup({
|
|
type: 'image',
|
|
closeOnContentClick: true,
|
|
closeBtnInside: false,
|
|
fixedContentPos: true,
|
|
image: {
|
|
verticalFit: true
|
|
},
|
|
zoom: {
|
|
enabled: true,
|
|
duration: 300 // don't foget to change the duration also in CSS
|
|
},
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|