67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class ManageKomisi extends CI_Controller
|
|
{
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('ModelDashboard', 'Dashboard');
|
|
$this->load->library(['datatables', 'form_validation']);
|
|
$this->form_validation->set_error_delimiters('', '');
|
|
$this->Dashboard->ceklogin();
|
|
}
|
|
public function output_json($data, $encode = true)
|
|
{
|
|
if ($encode) $data = json_encode($data);
|
|
$this->output->set_content_type('application/json')->set_output($data);
|
|
}
|
|
|
|
public function index() {
|
|
$id_karyawan = $this->session->userdata('id_karyawan');
|
|
$datShm = $this->Dashboard->getData_SetHakMaster_byKARYAWAN($id_karyawan);
|
|
$datKomisi = $this->Dashboard->getData_Komisi();
|
|
|
|
if ($datShm[0]['KOMISI_SHM']==0) {
|
|
$akses = "Tidak Berhak";
|
|
$datKomisi = NULL;
|
|
} else if ($datShm[0]['KOMISI_SHM']==1) {
|
|
$akses = "Hanya Baca";
|
|
} else if ($datShm[0]['KOMISI_SHM']==2) {
|
|
$akses = "Akses Penuh";
|
|
}
|
|
|
|
$data = [
|
|
'sidebar' => "dashboard",
|
|
'navChild' => "",
|
|
'komisi' => $datKomisi,
|
|
'hak' => $datShm[0]['KOMISI_SHM'],
|
|
'akses' => $akses,
|
|
];
|
|
$this->load->view('master/Komisi', $data);
|
|
}
|
|
|
|
public function ubah() {
|
|
$method = $this->input->post('method');
|
|
$id_jenis = $this->input->post('id_jenised');
|
|
$komisi_dealer = $this->input->post('komisi_dealered');
|
|
$komisi_user = $this->input->post('komisi_usered');
|
|
|
|
$update = [
|
|
'KOMISI_DEALER' => $komisi_dealer,
|
|
'KOMISI_USER' => $komisi_user
|
|
];
|
|
$action = $this->Dashboard->update('jenis', $update, 'ID_JENIS', $id_jenis);
|
|
|
|
if ($action) {
|
|
$this->session->set_flashdata('success', 'diubah');
|
|
redirect('ManageKomisi');
|
|
} else {
|
|
$this->session->set_flashdata('failed', 'diubah');
|
|
redirect('ManageKomisi');
|
|
}
|
|
|
|
}
|
|
|
|
}
|