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

class Model_tnc extends CI_Model {
	function __construct() {
		parent::__construct();
    }

    function getTncs($filters = array())
    {
		$this->db->select('a.*, b.category as category, c.category as main_category')
		->join('hr__policyprocedure_category b', 'a.category_id = b.id', 'left')
		->join('hr__policyprocedure_category c', 'b.parent_id = c.id', 'left');

	if(!empty($filters)){
		foreach ($filters as $filter => $value) {
			$this->db->where($filter, $value);
		}
	}

	$this->db->where('a.status', 0)
			->where('a.is_delete', 0);

	$query = $this->db->get('hr__tnc a');

		return ($query->num_rows() > 0) ? $query->result_array() : null;
    }
}