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

class Unloading_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 for unloading window list page -----------------*/
	public function entry_allow_for_unloading_window(){	
		if($this->user['panel_type']=='1' && in_array("1", $this->u_roles)){				
			$data['sdata'] 				= array();
			$data['subview'] 			= 'unloading_entry_o/entry_allow_for_unloading_window';
			$data['active_cls'] 		= 'unloadaa_cls';		
			$data['sdata']['lul_list'] 			= $this->loading_model->get_loading_list('Unloading','','','0');
			// echo $this->db->last_query();return;		
			$this->load->view('common/sidepanel',$data);
		}else{
			redirect('login_ctrl/logout');
		}
	}
	
	/*----------------- entry Proceed -----------------*/
	public function entry_proceed_for_unloading($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('print_ctrl/print_autho_view_unloading/'.$lul_id);			
			// redirect('unloading_entry_o_ctrl/entry_allow_for_unloading_window');
		}else {
			$this->session->set_flashdata('tos_error', 'Try again !...');
			redirect('unloading_entry_o_ctrl/entry_allow_for_unloading_window');
		}			
			
	}



	
	

	
}
