<?php 
// if ( ! defined('BASEPATH')) exit('No direct script access allowed');
defined('BASEPATH') OR exit('No direct script access allowed');
class Manage_claim extends CI_Controller {

	function __construct() {
		parent::__construct();
		$this->load->model('My_model');
		$this->load->model('Claim_model');
		$this->load->library('admin_layout');	
	}

	function index() {
		if(!$username=$this->session->userdata('logged_in')) redirect(base_url().'login');
		$user_id = $this->session->userdata('user_id');
			
		$header_data = array(
		  'username'  		=> $username,
		  'user_id'    		=> $user_id
		);
		
		$this->admin_layout->set_title("Manage Claim");
		$this->admin_layout->set_description("");
		$this->admin_layout->set_data($header_data);
		// $data = '';

		// $get_claims = $this->My_model->get_rows('claims',array('admin_id'=>$user_id));
		$get_claims = $this->Claim_model->getclaims($user_id);
		
		// echo $this->db->last_query();
		// $claims= array();
		// foreach($get_claims as $row){
		// 	$row_array['claim_id'] = $row->claim_id;
		// 	$row_array['name'] = $row->name;
		// 	array_push($claims,$row_array);
		// }

		// $data['claims'] = json_encode($get_claims);
		$data['claims'] = $get_claims;
		$data['err_claim'] = 'No Claims available'; 


		
		$content = "admin/view_manage_claim";
		$this->admin_layout->view($content,'',$data,true);
	
	}

}
