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

class Loading_entry_o_ctrl extends user_index {
 
	
	public function __construct(){ 
		parent::__construct();
		$data = array();
		$this->load->model('admin_model');	
		$this->load->model('loading_model');	
	}
	
	/*----------------- load entry allow window list page -----------------*/
	public function entry_allow_window(){	
		if($this->user['panel_type']=='1' && in_array("1", $this->u_roles)){		
			$data['sdata'] 				= array();
			$data['subview'] 			= 'loading_entry_o/entry_allow_window';
			$data['active_cls'] 		= 'loadaa_lcs';		
			$data['sdata']['lul_list'] 			= $this->loading_model->get_loading_list('Loading','','','0');
			// echo $this->db->last_query();return;		
			$this->load->view('common/sidepanel',$data);
		}else{
			redirect('login_ctrl/logout');
		}
	}
	
	/*----------------- entry Proceed -----------------*/
	public function entry_proceed($lul_id,$lul_leo_status){		
		if(($this->user['panel_type']!='1') && (!in_array("1", $this->u_roles))){
			redirect('login_ctrl/logout');
		}			
		
		// $data['lul_details']['lul_leo_id'] 			    = $this->user['i_user_id'];
		$data['lul_details']['lul_leo_date_time'] 	= date("Y-m-d h:i a");
		$data['lul_details']['lul_leo_status'] 			= '1';
		
		$edit_lul = $this->admin_model->update_data('loading_unloading_list','lul_id',$lul_id,$data['lul_details']);

		 
			
		if($edit_lul!=false){
			$this->session->set_flashdata('tos_success', 'entry proceed');
			// redirect('loading_entry_o_ctrl/entry_allow_window');
			redirect('print_ctrl/print_autho_view_loading/'.$lul_id);
		}else {
			$this->session->set_flashdata('tos_error', 'Try again !...');
			redirect('loading_entry_o_ctrl/entry_allow_window');
		}			
			
	}



	
	

	
}
