0% found this document useful (0 votes)
32 views17 pages

Listing Program

This document contains the code for a PHP controller class that handles various dashboard and order functions for a shoe and sandal production website. The controller class initializes session data, loads models, and renders views for different user levels. It includes functions for displaying dashboard metrics, placing and managing orders, and updating product stock levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views17 pages

Listing Program

This document contains the code for a PHP controller class that handles various dashboard and order functions for a shoe and sandal production website. The controller class initializes session data, loads models, and renders views for different user levels. It includes functions for displaying dashboard metrics, placing and managing orders, and updating product stock levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

LISTING PROGRAM

Controller :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Dashboard extends SCM_Controller {


public function __construct()
{
parent::__construct();
//Do your magic here
$this->load->helper('date');
$this->load->model('dashboard_model', 'dash', true);
}

public function index()


{
$level = $this->session->userdata('level');
$id_user = $this->session->userdata('id');
if($level == 1 or $level == 2 or $level == 3){
$this->load->view('header',['judul' => 'Dashboard Produksi Sepatu
dan Sendal <small>SISU</small>']);
$data['jumlah_bahanbaku'] = $this->dash-
>hitung('tb_bahanbaku');
$data['jumlah_pemasok'] = $this->dash-
>hitung('tb_supplier');
$data['jumlah_pelanggan'] = $this->dash-
>hitung('tb_pelanggan');
$data['jumlah_produk'] = $this->dash-
>hitung_stok_produk();

$data['penjualan'] = $this->dash->getDataPenjualan()-
>result();
$data['permintaan'] = $this->dash->getDataPermintaan()-
>result();
$data['stok'] = $this->crud->get('tb_bahanbaku')->result();

//pemberitahuan bahan baku


$data['info_stok'] = $this->dash->infoStokBahanBaku()-
>result();

//cek minimal produk


$cek_minimal = $this->crud->find('tb_pengaturan',
['kategori' => 'Produk'])->row();
if($cek_minimal){
$m_stok = $cek_minimal->minimal;
}else{
$m_stok = 0;
}

$stok_produk = $this->dash->get_stok_produk()->row();
if($stok_produk->stok < $m_stok){
$data['info_produk'] = "Stok Produk sudah menipis
Nih, stok yang ada hanya $stok_produk->stok Buah";
}else{
$data['info_produk'] = "";
}

}elseif($level ==4){
$this->load->view('header',['judul' => 'Dashboard Pemasok Bahan
Baku Kebutuhan Bahan Baku']);
$data['jml_permintaan'] = $this->dash-
>jumlahPermintaan($id_user);
$data['jml_proses'] = $this->dash-
>jumlahStsPermintaan($id_user, 'Proses');
$data['jml_kirim'] = $this->dash-
>jumlahStsPermintaan($id_user, 'Kirim');
$data['jml_selesai'] = $this->dash-
>jumlahStsPermintaan($id_user, 'Selesai');
$data['permintaan'] = $this->dash-
>getDataPermintaan($id_user)->result();
}else{
$this->load->view('header',['judul' => 'Aplikasi Pemesanan Pada
Bahan Baku']);
$data['produk'] = $this->dash->get_produk()->result();
$data['stok'] = $this->dash->get_stok_produk()->row();
$data['harga'] = $this->dash->get_harga_jual();
$data['pesanan'] = $this->dash->get_pesanan($id_user)-
>result();
}

$this->load->view('dashboard', $data);
$this->load->view('footer');
$this->load->view('dashboard-js');
}

public function pesan()


{
if(isset($_POST['pesan'])){
$id_pelanggan = $this->session->userdata('id');
$pelanggan = $this->crud->find('tb_pelanggan', ['id' =>
$id_pelanggan])->row();
$stok = $this->dash->get_stok_produk()->row();

//cek stok dulu gaes


if($stok < $jumlah){
$this->session->set_flashdata('pesan', 'Stok tidak
mencukupi');
redirect('dashboard');
}

$kode_penjualan = buat_kode('tb_penjualan', 'INV',


'kode_penjualan', 6);
$kode_pelanggan = $pelanggan->kode_pelanggan;
$jumlah = $this->input->post('jumlah');
$harga = $this->input->post('harga');

$data_input = [
'kode_penjualan' => $kode_penjualan,
'kode_pelanggan' => $kode_pelanggan,
'jumlah' => $jumlah,
'harga' => $harga,
'totalbayar' => $harga*$jumlah,
'status' => 'Menunggu Konfirmasi',
'tanggal' => date('Y-m-d')
];
$simpan = $this->crud->insert('tb_penjualan', $data_input);
if($simpan){
$this->session->set_flashdata('pesan', 'Pesanan
terkirim');
}else{
$this->session->set_flashdata('pesan', 'Tidak dapat
membuat pesanan');
}
redirect('dashboard');
}

public function order()


{
$kode_produk = $this->input->post('id');
$produk = $this->crud->find('tb_produk', ['kode_produk'
=>$kode_produk])->row();
if($produk){
echo "<input type='hidden' name='kode_produk' value='".
$produk->kode_produk."'>";
echo "
<div class='form-group'>
<label>Nama Produk</label>
<input type='text' name='nama_produk' value='".$produk-
>nama_produk."' class='form-control' readonly>
</div>";
echo "
<div class='form-group'>
<label>Jenis</label>
<input type='text' name='nama_produk' value='".$produk-
>jenis."' class='form-control' readonly>
</div>";
echo "
<div class='form-group'>
<label>Stok</label>
<input type='text' name='nama_produk' value='".$produk-
>sisa." Buah' class='form-control' readonly>
</div>";
echo "
<div class='form-group'>
<label>Jumlah Order</label>

<input type='number' name='jumlah' value='' class='form-


control' min='1' max='".$produk->sisa."' placeholder='Jumlah Order' required>

<p class='text-danger'>Jumlah order tidak lebih dari jumlah


stok yang ada</p>
</div>";
}else{
echo "Produk sudah habis";
}
}

public function act_order()


{
if(isset($_POST['simpan'])){
$kode_produk = $this->input->post('kode_produk', true);
$jumlah = $this->input->post('jumlah', true);
$produk = $this->crud->find('tb_produk', ['kode_produk'
=>$kode_produk])->row();
if($produk->sisa < 1){
echo "<script>alert('produk sudah habis')</script>";
echo
"<script>window.location.assign('".site_url('dashboard')."')</script>";
}else{
$data = array(
'id' => $produk->kode_produk,
'qty' => $jumlah,
'weight' => $jumlah,
'price' => $produk->harga*$jumlah,
'name' => $produk->nama_produk
);

$this->cart->insert($data);
redirect('dashboard');
}
}
}

public function keranjang()


{
$this->load->view('header',['judul' => 'Aplikasi Pemesanan ']);
$this->load->view('keranjang');
$this->load->view('footer');
$this->load->view('dashboard-js');
}

public function hapuskeranjang($rowid)


{
$data = array('rowid' => $rowid,
'qty' => 0 );
$this->cart->update($data);
redirect('keranjang');
}

public function action_pesan()


{
$kode_pelanggan = $this->input->post('kode_pelanggan');
$kode_produk = $this->input->post('kode_produk');
$jumlah = $this->input->post('jumlah');

$produk = $this->crud->find('tb_produk', ['kode_produk' =>


$kode_produk])->row();
if($produk->sisa < $jumlah){
$this->session->set_flashdata('pesan', 'Stok tidak
mencukupi');
redirect('dashboard');
}

$kode_penjualan = buat_kode('tb_penjualan', 'INV',


'kode_penjualan', 6);
$data_input = [
'kode_penjualan' => $kode_penjualan,
'kode_pelanggan' => $kode_pelanggan,
'kode_produk' => $kode_produk,
'jumlah' => $jumlah,
'harga' => $produk->harga,
'totalbayar' => $produk->harga*$jumlah,
'tanggal' => date('Y-m-d'),
'status' => 'Menunggu Konfirmasi'
];
//simpan pesanan
$simpan = $this->crud->insert('tb_penjualan', $data_input);
if($simpan){
$this->session->set_flashdata('pesan', 'Pesanan terkirim');
}else{
$this->session->set_flashdata('pesan', 'Tidak dapat
membuat pesanan');
}
redirect('dashboard');
}
}

MODEL :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Dashboard_model extends CI_Model {

public function hitung($table, $field ='*', $as='jumlah')


{
$this->db->select("count($field) as $as");
$data = $this->db->get($table)->row();
return $data->$as;
}

public function hitung_stok_produk()


{
$this->db->select('sum(sisa) as stok');
$data= $this->db->get('tb_produk')->row();
return $data->stok;
}

public function getDataPenjualan()


{
$this->db->select('plg.nama, pj.*');
$this->db->join('tb_pelanggan plg', 'plg.kode_pelanggan =
pj.kode_pelanggan', 'inner');
$this->db->order_by('pj.kode_penjualan', 'desc');
return $this->db->get('tb_penjualan pj', 5);
}

public function infoStokBahanBaku()


{
return $this->db->query("SELECT `bb`.`kode`, `bb`.`nama`,
`pg`.`minimal`, bb.stok as jumlah_stok FROM `tb_bahanbaku` `bb` INNER JOIN
`tb_stok` `st` ON `st`.`kode_bahanbaku` = `bb`.`kode` LEFT JOIN
`tb_pengaturan` `pg` ON `pg`.`kode` = `bb`.`kode`
GROUP BY `st`.`kode_bahanbaku`
HAVING jumlah_stok <= pg.minimal
ORDER BY `pg`.`minimal` DESC");
}

public function jumlahStsPermintaan($id_pemasok='', $sts='')


{
$this->db->select('count(*) as jumlah');
$this->db->join('tb_pemasok', 'tb_order_bahanbaku.kode_pemasok
= tb_pemasok.kode_pemasok', 'inner');
$this->db->where(['tb_pemasok.id'=> $id_pemasok,
'tb_order_bahanbaku.status_order' => $sts]);
$data = $this->db->get('tb_order_bahanbaku')->row();
if($data->jumlah > 0){
return $data->jumlah;
}else{
return 0;
}
}

public function jumlahPermintaan($id_pemasok='')


{
$this->db->select('count(*) as jumlah');
$this->db->join('tb_pemasok', 'tb_order_bahanbaku.kode_pemasok
= tb_pemasok.kode_pemasok', 'inner');
$this->db->where(['tb_pemasok.id'=> $id_pemasok]);
$data = $this->db->get('tb_order_bahanbaku')->row();
if($data->jumlah > 0){
return $data->jumlah;
}else{
return 0;
}
}

public function getProduk()


{
$this->db->where('sisa >', 0);
$this->db->order_by('kode_produk', 'asc');
return $this->db->get('tb_produk');
}

public function getPesanan($id_pelanggan)


{
$this->db->select('pj.*');
$this->db->join('tb_pelanggan plg', 'plg.kode_pelanggan =
pj.kode_pelanggan', 'inner');
$this->db->where('plg.id', $id_pelanggan);
$this->db->order_by('tanggal', 'desc');
return $this->db->get('tb_penjualan pj');
}

public function getDataPermintaan($kode_pemasok='')


{
if($this->session->userdata('level') == 4){
$this->db->select('bb.nama as nama_bahanbaku, bb.satuan,
pmsk.nama as pemasok, order.*');
$this->db->join('tb_bahanbaku bb', 'bb.kode =
order.kode_bahanbaku', 'inner');
$this->db->join('tb_pemasok pmsk', 'pmsk.kode_pemasok =
order.kode_pemasok', '');
$this->db->where('pmsk.id', $kode_pemasok);
$this->db->order_by('order.kode_order', 'desc');
return $this->db->get('tb_order_bahanbaku order', 10);

}else{
$this->db->select('bb.nama as nama_bahanbaku, bb.satuan,
pmsk.nama as pemasok, order.*');
$this->db->join('tb_bahanbaku bb', 'bb.kode =
order.kode_bahanbaku', 'inner');
$this->db->join('tb_pemasok pmsk', 'pmsk.kode_bahanbaku =
order.kode_bahanbaku', '');
$this->db->order_by('order.kode_order', 'desc');
return $this->db->get('tb_order_bahanbaku order', 5);
}
}

public function getPesananSama($kode_pelanggan, $kode_produk)


{
$this->db->select('tp.sisa, tp.kode_produk, tp.jumlah as
jumlah_stok, pj.kode_penjualan, pj.jumlah, pj.status');
$this->db->join('tb_produk tp', 'tp.kode_produk = pj.kode_produk',
'inner');
$this->db->join('tb_pelanggan plg', 'plg.kode_pelanggan =
pj.kode_pelanggan', 'inner');
$this->db->where(['tp.kode_produk' => $kode_produk,
'pj.kode_pelanggan' => $kode_pelanggan]);
return $this->db->get('tb_penjualan pj');
}

public function get_harga_jual()


{
$data = $this->db->query("select harga from tb_harga")->row();
if($data){
return $data->harga;
}else{
return 0;
}
}

public function get_pesanan($id_user)


{
$this->db->select('pj.*');
$this->db->join('tb_pelanggan plg', 'plg.kode_pelanggan =
pj.kode_pelanggan', 'inner');
$this->db->where('plg.id', $id_user);
$this->db->order_by('pj.tanggal', 'desc');
return $this->db->get('tb_penjualan pj', 10);
}

public function get_stok_produk()


{
$this->db->select('sum(sisa) as stok');
return $this->db->get('tb_produk');
}

public function get_produk()


{
$this->db->where('sisa !=', 0);
$this->db->order_by('tanggal', 'desc');
return $this->db->get('tb_produk');
}

View :
<?php
if($this->session->userdata('level') == 4){
//cek notifikasi pesanan
//ini hanya untuk pemasok
$id_pemasok = $this->session->userdata('id');
$notif = $this->db->select('tob.jumlah, bb.nama,tob.kode_order, bb.satuan')
->join('tb_bahanbaku bb', "bb.kode = tob.kode_bahanbaku")
->join('tb_pemasok pmsk', "pmsk.kode_pemasok = tob.kode_pemasok")
->where(['tob.notif_order'=> 'Y', 'pmsk.id' => $id_pemasok])
->order_by('tob.kode_order', 'desc')
->get('tb_order_bahanbaku tob', 5);
$jumlah_notif = $notif->num_rows();
}elseif($this->session->userdata('level') ==1){

//cek notifikasi pesan


$notif = $this->db->order_by('tanggal', 'desc')->where('baca', 'N')-
>get('tb_kontak', 5);
$jumlah_notif = $notif->num_rows();
}else{
$jumlah_notif = 0;
}
?>
<!doctype html>
<html class="no-js" lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Dashboard </title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="<?=
base_url();?>assets/img/favicon.ico">
<link href="https://fonts.googleapis.com/css?
family=Open+Sans:300,300i,400,400i,700,700i,800" rel="stylesheet">
<link rel="stylesheet" href="<?= base_url();?>assets/css/bootstrap.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/font-
awesome.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/adminpro-custon-
icon.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/meanmenu.min.css">
<link rel="stylesheet" href="<?=
base_url();?>assets/css/jquery.mCustomScrollbar.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/animate.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/data-table/bootstrap-
table.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/data-table/bootstrap-
editable.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/normalize.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/c3.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/form/all-type-
forms.css">
<link rel="stylesheet" href="<?= base_url();?>assets/style.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/responsive.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/alerts.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/modals.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/charts.css">
<link rel="stylesheet" href="<?=
base_url();?>assets/css/datapicker/datepicker3.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/Lobibox.min.css">
<link rel="stylesheet" href="<?= base_url();?>assets/css/notifications.css">
<script src="<?=
base_url();?>assets/js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body style="background-color: whitesmoke;">

<div class="wrapper-pro">
<div class="left-sidebar-pro">
<nav id="sidebar">
<div class="sidebar-header">
<?php
if($this->session->userdata('level') == 1 or $this->session->userdata('level')
== 2 or $this->session->userdata('level') == 3){ ?>
<a href="#"><img style="width: 70px" src="<?=
base_url();?>assets/admin.png">
</a>
<?php }elseif ($this->session->userdata('level') == 4) { ?>
<a href="#"><img style="width: 70px" src="<?= base_url();?>assets/CV.
Pelita Mas Jaya.png">
</a>
<?php } else { ?>
<a href="#"><img style="width: 70px" src="<?=
base_url();?>assets/pelanggan.png">
</a>
<?php } ?>
<h3><?= $this->session->userdata('nama'); ?></h3>
<p><?= $this->session->userdata('email'); ?></p>
<strong>AP+</strong>
</div>
<div class="left-custom-menu-adp-wrap">
<ul class="nav navbar-nav left-sidebar-menu-pro">
<li class="nav-item">
<a href="<?= site_url();?>" class="nav-link"><i class="fa big-icon fa-
home"></i> <span class="mini-dn">Beranda</span> </a>
</li>
<?php
if($this->session->userdata('level') == 1 or $this->session->userdata('level')
== 2 or $this->session->userdata('level') == 3){
$this->load->view('menu-admin');
}elseif($this->session->userdata('level') == 4){
$this->load->view('menu-pemasok');
}else{
$this->load->view('menu-pelanggan');

} ?>

</ul>
</div>
</nav>
</div>
</div>
<div class="content-inner-all">
<div class="header-top-area">
<div class="fixed-header-top">
<div class="container-fluid">
<div class="row">
<div class="col-lg-1 col-md-6 col-sm-6 col-xs-12">
<button type="button" id="sidebarCollapse" class="btn bar-button-pro
header-drl-controller-btn btn-info navbar-btn">
<i class="fa fa-bars"></i>
</button>
<div class="admin-logo logo-wrap-pro">
<a href="#"><img src="img/logo/log.png" alt="" />
</a>
</div>
</div>

<div class="col-lg-11 col-md-5 col-sm-6 col-xs-12">


<div class="header-right-info">
<ul class="nav navbar-nav mai-top-nav header-right-menu">
<?php
if($this->session->userdata('level') ==5){?>
<li class="nav-item"><a href="#" data-toggle="dropdown"
role="button" aria-expanded="false" class="nav-link dropdown-toggle"><i
class="fa fa-bell-o" aria-hidden="true"></i><span ></span><?= count($this-
>cart->contents()) ;?></a>

<div role="menu" class="notification-author dropdown-menu


animated flipInX">

<div class="notification-single-top">
<h1>Keranjang Anda</h1>
</div>
<?php if(!empty($this->cart->contents())){ ?>
<ul class="notification-menu">
<?php foreach ($this->cart->contents() as $items) : ?>
<li>
<a href="#">
<div class="notification-icon">
<span class="adminpro-icon
adminpro-checked-pro"></span>
</div>
<div class="notification-content">
<span class="notification-date"></span>
<h2>Jumlah Produk <?= $items['weight'];?></h2>
<p>Dengan Produk Yang Anda Pesan. <?= $items['name'];?
></p>
</div>
</a>
</li>
<?php endforeach;?>
</ul>
<div class="notification-view">
<a href="<?= site_url('keranjang');?>">View All Notification</a>
</div>
</div>
</li>
<?php } } ?>

<li class="nav-item">
<a href="<?= site_url('logout');?>" role="button" aria-
expanded="false" >
<span class="adminpro-icon adminpro-user-rounded header-riht-
inf"></span>
<span class="admin-name">Logout</span>
<span class="author-project-icon adminpro-icon adminpro-down-
arrow"></span>
</a>

</li>

</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Header top area end-->
<!-- Breadcome start-->
<div class="breadcome-area mg-b-30 small-dn">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">

</div>
</div>
</div>
</div>
<!-- Breadcome End-->
<!-- Mobile Menu start -->
<div class="mobile-menu-area">
<div class="container">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="mobile-menu">
<nav id="dropdown">
<ul class="mobile-menu-nav">
<li><a data-toggle="collapse" data-target="#Charts" href="#">Pilih
<span class="admin-project-icon adminpro-icon
adminpro-down-arrow"></span></a>
<li class="nav-item">
<a href="<?= site_url();?>" class="nav-link"><i class="fa big-icon fa-
home"></i> <span class="mini-dn">Beranda</span> </a>
</li>
<?php
if($this->session->userdata('level') == 1 or $this->session->userdata('level')
== 2 or $this->session->userdata('level') == 3){
$this->load->view('menu-admin');
}elseif($this->session->userdata('level') == 4){
$this->load->view('menu-pemasok');
}else{
$this->load->view('menu-pelanggan');

} ?>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
<!-- Mobile Menu end -->
<!-- Breadcome start-->
<div class="breadcome-area des-none">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="breadcome-list map-mg-t-40-gl shadow-reset">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<div class="breadcome-heading">
<form role="search" class="">
<input type="text" placeholder="Search..." class="form-control">
<a href=""><i class="fa fa-search"></i></a>
</form>
</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<ul class="breadcome-menu">
<li><a href="#">Home</a> <span class="bread-slash">/</span>
</li>
<li><span class="bread-blod">Dashboard</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

<br><br>
<div class="footer-copyright-area">
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<div class="footer-copy-right">
<p>Copyright &#169; 2023 UD ASTINA. Template by <a
href="https://colorlib.com">Colorlib</a>.</p>
</div>
</div>
</div>
</div>
</div>

<script src="<?=
base_url();?>assets/js/vendor/jquery-1.11.3.min.js"></script>
<script src="<?= base_url();?>assets/js/bootstrap.min.js"></script>
<script src="<?= base_url();?>assets/js/jquery.meanmenu.js"></script>
<script src="<?=
base_url();?>assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="<?= base_url();?>assets/js/jquery.sticky.js"></script>
<script src="<?= base_url();?>assets/js/jquery.scrollUp.min.js"></script>
<script src="<?=
base_url();?>assets/js/counterup/jquery.counterup.min.js"></script>
<script src="<?=
base_url();?>assets/js/counterup/waypoints.min.js"></script>
<script src="<?=
base_url();?>assets/js/counterup/counterup-active.js"></script>
<script src="<?= base_url();?>assets/js/peity/jquery.peity.min.js"></script>
<script src="<?= base_url();?>assets/js/peity/peity-active.js"></script>
<script src="<?=
base_url();?>assets/js/sparkline/jquery.sparkline.min.js"></script>
<script src="<?=
base_url();?>assets/js/sparkline/sparkline-active.js"></script>
<script src="<?= base_url();?>assets/js/flot/Chart.min.js"></script>
<script src="<?= base_url();?>assets/js/flot/flot-active.js"></script>
<script src="<?= base_url();?>assets/js/map/raphael.min.js"></script>
<script src="<?= base_url();?>assets/js/map/jquery.mapael.js"></script>
<script src="<?=
base_url();?>assets/js/data-table/bootstrap-table.js"></script>
<script src="<?= base_url();?>assets/js/data-table/tableExport.js"></script>
<script src="<?=
base_url();?>assets/js/data-table/data-table-active.js"></script>
<script src="<?= base_url();?>assets/js/data-table/bootstrap-table-
editable.js"></script>
<script src="<?=
base_url();?>assets/js/data-table/bootstrap-editable.js"></script>
<script src="<?= base_url();?>assets/js/data-table/bootstrap-table-
resizable.js"></script>
<script src="<?= base_url();?>assets/js/data-table/colResizable-
1.5.source.js"></script>
<script src="<?= base_url();?>assets/js/data-table/bootstrap-table-
export.js"></script>
<script src="<?= base_url();?>assets/js/Lobibox.js"></script>
<script src="<?= base_url();?>assets/js/modal-active.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.js"></script>
<script src="<?=
base_url();?>assets/js/flot/jquery.flot.tooltip.min.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.spline.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.resize.js"></script>
<script src="<?= base_url();?>assets/js/flot/jquery.flot.pie.js"></script>
<script src="<?= base_url();?>assets/js/flot/Chart.min.js"></script>
<script src="<?= base_url();?>assets/js/flot/flot-active.js"></script>
<script src="<?= base_url();?>assets/js/datapicker/bootstrap-
datepicker.js"></script>
<script src="<?= base_url();?>assets/js/notification-active.js"></script>

<!-- main JS
============================================ -->
<script src="<?= base_url();?>assets/js/main.js"></script>

<script>

$(document).ready(function () {
$('#edit_user').on('show.bs.modal', function (e) {
var idx = $(e.relatedTarget).data('id');
var link = $(e.relatedTarget).data('key');
//menggunakan fungsi ajax untuk pengambilan data
$.ajax({
type: 'post',
url: link,
data: 'id=' + idx,
success: function (data) {
$('.form-edit-user').html(data); //menampilkan data ke dalam modal
}
});
});
});
</script>
</body>

</html>

You might also like