<?php
class ApprovedController extends \BaseController {

	/**
	* Display a listing of the resource.
	*
	* @return Response
	*/
	//pending departmental requests
	public function pending()
	{

		$department = array('0' => 'Operations', '1' => 'Finance & Accounts', '2' => 'Data','3' => 'Sample Reception', '4' => 'Logistics/Stores', '5' => 'EID Lab', '6' => 'Viral Load', '7' => 'Microbiology','8' => 'Executive Director','9' => 'HLIMS', '10' =>'ICT', '11' => 'Bio-Repository', '12' => 'Sickle Cell Lab', '13' => 'Records', '14' => 'Operations/Logistics', '15' => 'Records QC', '16'=>'Bio Safety Bio Security', '17' => 'Monitoring & Evaluation', '18' => 'Cobas 8800', '19' => 'QA /QC');
		$pending = Inhouse::orderBy('created_at', 'DESC')->where('request_status_id', '=', '0')->paginate(150);
		return View::make('InhouseRequisition.pending')
		->with('pending', $pending)
		->with('department', $department);
	}


	//approved departmental requests
	public function approved()
	{

		$department = array('0' => 'Operations', '1' => 'Finance & Accounts', '2' => 'Data','3' => 'Sample Reception', '4' => 'Logistics/Stores', '5' => 'EID Lab', '6' => 'Viral Load', '7' => 'Microbiology','8' => 'Executive Director','9' => 'HLIMS', '10' =>'ICT', '11' => 'Bio-Repository', '12' => 'Sickle Cell Lab', '13' => 'Records', '14' => 'Operations/Logistics', '15' => 'Records QC', '16'=>'Bio Safety Bio Security', '17' => 'Monitoring & Evaluation', '18' => 'Cobas 8800', '19' => 'QA /QC');
		$approved = Inhouse::orderBy('created_at', 'DESC')->where('request_status_id', '=', '1')->paginate(150);

		return View::make('InhouseRequisition.approved')
		->with('approved', $approved)
		->with('department', $department);
	}

	//Rejected departmental requests
	public function rejected()
	{

		$metrics = Metric::lists('name', 'id');

	        $department = array('0' => 'Operations', '1' => 'Finance & Accounts', '2' => 'Data','3' => 'Sample Reception', '4' => 'Logistics/Stores', '5' => 'EID Lab', '6' => 'Viral Load', '7' => 'Microbiology','8' => 'Executive Director','9' => 'HLIMS', '10' =>'ICT', '11' => 'Bio-Repository', '12' => 'Sickle Cell Lab', '13' => 'Records', '14' => 'Operations/Logistics', '15' => 'Records QC', '16' => 'Bio Safety Bio Security','17' =>'Monitoring & Evaluation');
		$inhouse = Inhouse::where('request_status_id', '=', '2')->get	();
		return View::make('InhouseRequisition.index')
		->with('inhouse', $inhouse)
		->with('metrics', $metrics)
		->with('department', $department);
	}

	//Completed departmental requests
	public function complete()
	{

		$metrics = Metric::orderBy('name', 'ASC')->lists('name', 'id');
		$department = array('0' => 'Operations', '1' => 'Finance & Accounts', '2' => 'Data','3' => 'Sample Reception', '4' => 'Logistics/Stores', '5' => 'EID Lab', '6' => 'Viral Load', '7' => 'Microbiology','8' => 'Executive Director','9' => 'HLIMS', '10' =>'ICT', '11' => 'Bio-Repository', '12' => 'Sickle Cell Lab', '13' => 'Records', '14' => 'Operations/Logistics', '15' => 'Records QC', '16' => 'Bio Safety Bio Security','17' =>'Monitoring & Evaluation');
		$pending = Inhouse::where('request_status_id', '=', '3')->get	();
		return View::make('InhouseRequisition.approved')
		->with('pending', $pending)
		->with('metrics', $metrics)
		->with('department', $department);
	}

}
