<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title><?php echo @$title ?></title>
    <!-- Font Awesome -->
    <link rel="stylesheet" href="<?php echo base_url('assets/plugins/fontawesome-free/css/all.min.css') ?>">
    <link rel="stylesheet" href="<?php echo base_url('assets/dist/css/adminlte.min.css') ?>">
    <!-- DataTables -->
    <link rel="stylesheet" href="<?php echo base_url('assets/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css') ?>">
    <link rel="stylesheet" href="<?php echo base_url('assets/plugins/datatables-responsive/css/responsive.bootstrap4.min.css') ?>">
    <link rel="stylesheet" href="<?php echo base_url('assets/plugins/datatables-buttons/css/buttons.bootstrap4.min.css') ?>">
</head>
<body>
<main id="main" class="main">
    <div class="card">
        <div class="card-header">

        </div>
        <div class="card-body" style="overflow: scrol;">
            <table class="table table-hover table-bordered" id="tabelku" style="min-width: 100%">
            <thead>
            <tr>
                <th>Kode Barang</th>
                <th>Barcode</th>
                <th>Nama Barang</th>
                <th width="25">Kategori</th>
                <th>Satuan 1</th>
                <th>Harga Beli</th>
                <th>Harga Jual 1</th>
                <th>Harga Jual 2</th>
                <th>Harga Jual 3</th>
                <th>Stok Minimal</th>
                <th>Stok Maksimal</th>
                <th>Suplier</th>
            </thead>
            </table>
        </div>
    </div>
</main>
<!-- jQuery -->
<script src="<?php echo base_url('assets/plugins/jquery/jquery.min.js') ?>"></script>
<!-- Bootstrap 4 -->
<script src="<?php echo base_url('assets/plugins/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>
<!-- DataTables  & Plugins -->
<script src="<?php echo base_url('assets/plugins/datatables/jquery.dataTables.min.js') ?>"></script>
<script src="<?php echo base_url('assets/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js') ?>"></script>
<script src="<?php echo base_url('assets/plugins/datatables-responsive/js/dataTables.responsive.min.js') ?>"></script>
<script src="<?php echo base_url('assets/plugins/datatables-responsive/js/responsive.bootstrap4.min.js') ?>"></script>
<script src="<?php echo base_url('assets/plugins/datatables-buttons/js/dataTables.buttons.min.js') ?>"></script>
<script src="<?php echo base_url('assets/plugins/datatables-buttons/js/buttons.bootstrap4.min.js') ?>"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#tabelku").DataTable({
        "processing":true,
        "serverSide":true,
        //"responsive":true,
        "ajax":{
                url:"<?php echo base_url('master/dataeditbarang') ?>",
                type:"post",
        },
    });
});

function simpan(i) {
    var kode=$("#kode"+i).val();
    var kategori=$("#kategori"+i).val();
    var satuan=$("#satuan"+i).val();
    var beli=$("#beli"+i).val();
    var jual=$("#jual"+i).val();
    var jual2=$("#jual2"+i).val();
    var jual3=$("#jual3"+i).val();
    var minim=$("#minim"+i).val();
    var maksimal=$("#maksimal"+i).val();
    var suplier=$("#suplier"+i).val();
    $.ajax({
        url:"<?php echo base_url('master/simpan_editbarang') ?>",
        cache:false,
        type:"POST",
        data:{kode:kode,kategori:kategori,satuan:satuan,beli:beli,jual:jual,jual2:jual2,jual3:jual3,minim:minim,maksimal:maksimal,suplier:suplier},
        success:function(result){
            $("#peringatan").html(result);
        }
    });
}
</script>
</body>
</html>