how to display data according to the checklist
how to display data according to the checklist
deni22
Posts: 1Questions: 1Answers: 0
#Controller
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Laporan extends CI_Controller {
//load model
public function __construct()
{
parent::__construct();
$this->load->model(array('cetak_model'));
$this->load->model('ttd_model');
$this->load->model('tampil_model');
}
public function index()
{
$dataUser = $this->cetak_model->get_by_role();
$ttd = $this->ttd_model->listing();
$data = array( 'title' => 'Cetak Suket Petugas Rekrut CTKI',
'dataUser' => $dataUser,
'ttd' => $ttd,
'isi' => 'admin/cetak/list'
);
$this->load->view('admin/dasbor/wrapper', $data, FALSE);
}
public function detail($id_dokumen)
{
$row = $this->cetak_model->detail($id_dokumen);
$data = array( 'title' => 'Data Tenaga Kerja Indonesia',
'row' => $row,
'isi' => 'admin/cetak/detail'
);
$this->load->view('admin/dasbor/wrapper', $data, FALSE);
}
public function tampil($id_dokumen)
{
$dataUser = $this->tampil_model->tampil($id_dokumen);
$data = array( 'dataUser' => $dataUser,
'isi' => 'admin/preview/tampil'
);
$this->load->view('admin/preview/tampil', $data, FALSE);
}
}
#Model
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Tampil_model extends CI_Model {
//load database
public function __construct()
{
parent::__construct();
$this->load->database();
}
public function tampil($id_dokumen)
{
$this->db->select(' perusahaan.id_perusahaan,perusahaan.nosippptki,perusahaan.tglpptkis,
perusahaan.namaprshn,perusahaan.alamat_prshn,perusahaan.telp_fax,
perusahaan.email_pptkis, perusahaan.nama_pjwb, perusahaan.alamat_pjwb,
perusahaan.hp_pptkis,
petugas.id_petugas,petugas.id_perusahaan,petugas.namaptgs,petugas.nik,
petugas.surtug,petugas.tgl_ptgs,petugas.statuskarywn,petugas.alamat,
petugas.hp_ptgs,petugas.email_ptgs,petugas.tmpt,petugas.tgllhr,
petugas.nopengangkatan,petugas.tglpengangkatan,petugas.foto,
dokumen.id_dokumen,dokumen.id_user,dokumen.id_petugas,dokumen.tgl_daftar,
dokumen.nomor_spr,dokumen.tanggal_spr,dokumen.agensi_spr,
dokumen.negara_spr,dokumen.nomorprov,dokumen.tgl_penerbitan,
dokumen.sektorpekerjaan,dokumen.jabatan,dokumen.laki_laki,
dokumen.perempuan,dokumen.nomor_siskotkln,dokumen.tglberlaku,
dokumen.jml_kuota_rkrt');
$this->db->from('perusahaan');
$this->db->join('petugas', 'perusahaan.id_perusahaan=petugas.id_perusahaan');
$this->db->join('dokumen', 'petugas.id_petugas=dokumen.id_petugas');
$query = $this->db->get();
return $query->result();
}
}
#view
<?php
// Notifikasi
if($this->session->flashdata('sukses'))
{
echo '<div class="alert alert-success">';
echo $this->session->flashdata('sukses');
echo '</div>';
}
<?php
>
function validate(){
var checked=false;
var elements = document.getElementsByName("id_dokumen[]");
for(var i=0; i < elements.length; i++){
if(elements[i].checked) {
checked = true;
}
}
if (!checked) {
alert('Pilih Salah Satu');
}
return checked;
}
?>
<?php foreach ($dataUser as $row) { ?>
<form action="<?php echo base_url('admin/laporan/tampil/'.$row->id_dokumen) ?>" onsubmit="return validate(this);"/>
<?php } ?>
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th width="5%">No</th>
<th>Nama Petugas</th>
<th>Status Karyawan</th>
<th>Nama Perusahaan</th>
<th>Alamat</th>
<th>Negara Tujuan</th>
<th>Jabatan</th>
<th>Action</th>
<th>Pilih</th>
</tr>
</thead>
<tbody>
<?php $i=1; foreach ($dataUser as $row) { ?>
<tr>
<td><?=$i?>
<td><?=$row->namaptgs?></td>
<td><?=$row->statuskarywn?></td>
<td><?=$row->namaprshn?></td>
<td><?=$row->alamat_prshn?></td>
<td><?=$row->negara_spr?></td>
<td><?=$row->jabatan?></td>
<td>
<?php
include('detail.php');
?>
</td>
<td>
<input type="checkbox" name="id_dokumen[]" value="<?php echo base_url('admin/laporan/tampil/'.$row->id_dokumen) ?>" />
</td>
</tr>
</tr>
<?php $i++; } ?>
</div>
</td>
</tr>
</tbody>
</table>
<div style="text-align: center">
<a href="<?php echo base_url('admin/laporan/tampil/'.$row->id_dokumen) ?>"><button type="submit" title="Cetak SUKET" data-placement="left" class="btn btn-success"><span class="fa fa-print"></span> CETAK SUKET</button></a>
This discussion has been closed.
Answers
Hi @deni22 ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin