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

class Bagan_organisasi extends MY_Controller {

	public function __construct(){
        parent::__construct();
        $this->load->model('Bagan_organisasi_m');
    }

	public function index(){
		$data['judul']   = "Bagan Organisasi";
        $data['aktif']   = 'karyawan';
        $this->load->view('bagan_organisasi/home', $data, false);
	}

    public function data(){
        $data_direksi = $this->Bagan_organisasi_m->data_direksi();
        $data_cabang  = $this->Bagan_organisasi_m->data_cabang();

        $data=[
                'name'     => $data_direksi['name'],
                'title'    => $data_direksi['title'],
                'children' => $data_cabang,
            ];

        echo json_encode($data);
    }
}
