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

class Unor extends CI_Controller {

    public function __construct() {
        parent::__construct();
        if (!$this->session->userdata('logged_in')) {
            redirect('auth');
        }
        $this->load->model('Unor_model');
    }

    public function index() {
        $search = $this->input->get('search');
        $unor_induk_id = $this->input->get('unor_induk_id');
        $unor_mandiri = $this->input->get('unor_mandiri');

        $data['unor'] = $this->Unor_model->get_all($search, $unor_induk_id, $unor_mandiri);
        $data['unor_induk_list'] = $this->Unor_model->get_unor_induk_list(); // ✅ Sudah diperbaiki

        $this->load->view('templates/header');
        $this->load->view('templates/sidebar');
        $this->load->view('unor/index', $data);
        $this->load->view('templates/footer');
    }
}