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

class ManagementSettings extends MY_Controller {

	public function __construct() {
		parent::__construct();

	}

	public function index()
	{
		$data['page'] = 'MANAGEMENTS';
		$data['title'] = 'MANAGEMENTS';

		$this->load->view('managements',$data);
	}


	public function getMemberDirectoryByGroup(){


		$groupName = $this->input->post('selectedValue');
		$filterYear = $this->input->post('selectedYear');


		$managementData =  json_decode(json_encode(getMemberDirectoryByGroup($groupName, $filterYear)), true); 
		

		// echo '<pre>';
		// print_r($managementData);

		$html = "";
		

		if (!empty($managementData['data'])) {
			

			foreach($managementData['data'] as $key => $item){ 

				$html  .= '<tr>';
				$html  .= '<td>'.$item['refDataName'].' '.@$item['refDataName3'].'</td>';
				$html  .= '<td>'.$item['designation'].'</td>';
				$html  .= '<td>'.base64_decode($item['email']).'</td>';
				$html  .= '<td>'.formatPhoneNumber(base64_decode($item['phone'])).'</td>';
				$html  .= '<td>'.$item['effDate'].'</td>';
				$html  .= '<td>'.$item['expiryDate'].'</td>';
				$html  .= '</tr>';
			} 
		}else{
			$html  .= '<tr><td colspan="7" class="text-center">No Management Data Available to show..<td></tr>';
		}
		

		echo json_encode($html);
	}




}
?>