<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Home extends MY_Controller {
    public function __construct(){
		parent::__construct();
		$this->load->model('kpi/admin/master/kepribadian/Home_m', 'model');
	}

    public function index(){
        $this->load->view('kpi/admin/master/kepribadian/home');
    }

    public function view_home(){
        $this->load->view('kpi/admin/master/kepribadian/view_home');
    }

    public function list_data(){
		$list = $this->model->get_datatables();

		$data = array();
		$no   = $_GET['start'];
		foreach ($list as $field) {
			$no++;
			$row   = array();
			$row[] = $no;
			$row[] = $field->nama_jabatan. '<BR><b>'. $field->nama_usergroup. '</b>';
			$row[] = empty($field->bobot_data) ? '-' :  $field->bobot_data. ' %';

            $row[] = '<a id="' . md5($field->id_jabatan) . '" href="javascript:void(0)" class="btn_detail btn btn-success js-menu__open" title="Detail" data-menu="#drawer" onclick="test_slide(this)"> 
						Detail
					</a>';

			$data[] = $row;
		}
	
		$output = array(
			"draw"            => $_GET['draw'],
			"recordsTotal"    => $this->model->count_all(),
			"recordsFiltered" => $this->model->count_filtered(),
			"data"            => $data
		);
	
		$output = __response($this->MY_response, $output);
	
		echo json_encode($output);
	}
}