<?php
defined('BASEPATH') or exit('No direct script access allowed');

class ControllerDataSalery extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();
        check_not_login();
        if ($this->session->userdata('level') != 4) {
            redirect();
        }
        $this->load->library('encrypt');
        $this->load->library('mycustom');
        $this->load->library('form_validation');
        $this->load->model('notifikasi_arisan');
        $this->load->model('bagian_arisan/insert_model');
        $this->load->model('bagian_arisan/select_model');
        $this->load->model('bagian_arisan/update_model');
        $this->set_timezone();
    }
    public function set_timezone()
    {
        date_default_timezone_set("Asia/Jakarta");
    }
    public function index()
    {
        // Notifikasi
        $jml_pengajuan        = count($this->notifikasi_arisan->Notifikasi_pengajuan());
        // End_notifikasi 
        $data_login       = $this->userlogin->user_login();
        $data_id_login    = $this->session->userdata('isloggedin');
        // echo '<pre>';
        // var_dump($data_pengajuan_anggota);
        // die;
        $data_gaji = $this->db->get_where('k_gaji', ['login_id' => $data_id_login])->result();
        $data = array(
            // Untuk memanggil halaman sesuai menu
            'folder'            => 'gaji',
            'page'              => 'index',
            'judul'             => 'Histori Gaji Karyawan || Bagian Kabag Arisan',
            'data_id_login'     => $data_id_login,
            'data_login'        => $data_login,
            // Isi data konten
            'jml_pengajuan'     => $jml_pengajuan,
            'data_gaji'         => $data_gaji
        );
        $this->load->view('arisan/index', $data);
    }
    public function detail($id)
    {
        // Notifikasi
        $jml_pengajuan        = count($this->notifikasi_arisan->Notifikasi_pengajuan());
        // End_notifikasi 
        $data_login       = $this->userlogin->user_login();
        $data_id_login    = $this->session->userdata('isloggedin');
        // echo '<pre>';
        // var_dump($data_pengajuan_anggota);
        // die;
        // Data gaji
        $gaji_id = $this->encrypt->decode($id);
        $data_gaji = $this->db->get_where('k_gaji', ['id' => $gaji_id])->row_array();
        $detail_gaji = $this->db->get_where('k_dgaji', ['gaji_id' => $gaji_id])->result();
        $identitas_karyawan = $this->db->get_where('sistem_login', ['id' => $data_gaji['login_id']])->row_array();
        $detail_identitas = $this->db->get_where('sistem_identitas', ['login_id' => $data_gaji['login_id']])->row_array();
        $data = array(
            // Untuk memanggil halaman sesuai menu
            'folder'              => 'gaji/detail/',
            'page'              => 'index',
            'judul'               => 'Detail Gaji Karyawan || Bagian Kabag Arisan',
            'data_id_login'     => $data_id_login,
            'data_login'        => $data_login,
            // Isi data konten
            'jml_pengajuan'     => $jml_pengajuan,
            // Data isian konten
            'identitas'           => $identitas_karyawan,
            'gaji'                => $data_gaji,
            'detail_gaji'         => $detail_gaji,
            'detail_identitas'    => $detail_identitas
        );
        $this->load->view('arisan/index', $data);
    }
}

/* End of file ControllerDataSalery.php and path \application\controllers\arisan\keloladata\ControllerDataSalery.php */