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

class Crao_ctrl extends user_icd_index {
 
	
	public function __construct(){
		parent::__construct();   
		$data = array();
		$this->load->model('admin_model');
		$this->load->model('icd_model'); 		
	}
	 
	/*----------------- load container_release_approve_list page -----------------*/
	public function container_release_approve_list(){		
		$data['sdata'] 			= array();
		$data['subview'] 		= 'icd/crao/container_release_approve_list';		
		$data['active_cls'] 	= 'conedl_cls';	
		$data['url_list'] 		= $this->admin_model->get_result_array_with_one_where('user_role_list','url_status','1');			
		$data['sdata']['igetl_list'] 		= $this->icd_model->get_icdl_igetl_details_list('','','','','','','1','1','1','0');
		// echo $this->db->last_query();return;
		$this->load->view('icd/common/icd_sidepanel',$data); 
	}

	/*----------------- load container_release_approve_form page -----------------*/
	public function container_release_approve_form($igetl_id){		
		$data['sdata'] 					= array();
		$data['subview'] 				= 'icd/crao/container_release_approve_form';		
		$data['active_cls'] 			= 'dash';			
		$data['url_list'] 				= $this->admin_model->get_result_array_with_one_where('user_role_list','url_status','1');			
		
		$data['sdata']['igetl_data'] 		= $this->icd_model->get_icdl_igetl_details_list('','',$igetl_id,'','','','1','1','1','0');
		// echo $this->db->last_query();return;
		
		$data['sdata']['itncl_list'] 	= $this->icd_model->get_icdl_itncl_details_list('',$igetl_id,'','1','','1');
		$this->load->view('icd/common/icd_sidepanel',$data); 
	}

	/*----------------- update_container_release_details -----------------*/
	public function update_container_release_approve_details($igetl_id){					
		$data['igetl']['igetl_crao_id'] 		= $this->user['i_user_id'];
		$data['igetl']['igetl_crao_status'] 	= '1';
		$data['igetl']['igetl_crao_date'] 		= date("Y-m-d");
		
		$edit_igetl 							= $this->admin_model->update_data('icd_gate_entry_token_list','igetl_id',$igetl_id,$data['igetl']);

		
				
		if($edit_igetl!='0'){
			$this->session->set_flashdata('tos_success', 'Details updated');
			redirect('icd/icd_print_out_ctrl/container_release_approve_details_print_out/'.$igetl_id);
		}else {
			$this->session->set_flashdata('tos_warning', 'There is no changes!...');
			redirect('icd/crao_ctrl/container_release_approve_list');
		}			
				
	}
	

	
}
