<?php
/*
///////////////////////////////////////////////////////////////////////
/  Project Name 	: HRMS-Asian Paints
/  File Name 		: manage_module_list.php  
/  Created on  		: 25/11/2014
/  Created by       : Trupti
/  Last Changed By 	: 
/  Updated On		: 
/  Purpose			: To view list of modules
/  ---------
/  
////////////////////////////////////////////////////////////////////////
*/
?>
	<form name="module_form" id="module_form" method="post">
	<table cellspacing="0" style="width:50%;" class="table table-bordered table-condensed">
	<td>
		<table border="1">
			<thead>
				<tr>
					<th width="4%">
						<?php
							$js="id='sel_module' onClick='check_uncheck_all()'";
							echo form_checkbox('sel_module','module','',$js);
							echo form_error('sel_module');
						?>
					</th>
					<th colspan="2" width="46%">Select All</th>
				</tr>	
			</thead>
		</table>
		<table border="1" >
			<tbody>
				<tr>
					<td width="4%">
						<?php
							echo form_checkbox('sel_module_1','module');
							echo form_error('sel_module_1');
						?>
					</td>
					<td width="48%" colspan="2">Dashboard</td>
					<!--<td width="10%">
						<a href="javascript:void(0);" id="module1">Expand</a>
					</td>-->
				</tr>
			</tbody>
		</table>
		<table border="1" >
			<tbody>	
				<tr>
					<td width="4%">
						<?php
							$emp = "id='sel_module_2' onClick='check_uncheck_emp();'";
							echo form_checkbox('sel_module_2','module','',$emp);
							echo form_error('sel_module_2');
						?>
					</td>
					<td width="38%">Masters</td>
					<td width="10%">
						<a href="javascript:void(0);" id="module2" onClick="show_module1()">Expand</a>
					</td>
				</tr>
			</tbody>
		</table>
		<table border="1" id="module_1" style="display:none;">
			<tbody>
				<div>
				
				<tr>
					<td width="4%">
						<?php
							$em1 = "id='sel_emp_module_[]'";
							echo form_checkbox('sel_emp_module[]','module','',$em1);
							echo form_error('sel_emp_module_[]');
						?>
					</td>
					<td width="48%" colspan="2">&nbsp; - Manage User</td>
				</tr>
				<tr>
					<td width="4%">
						<?php
							$em2 = "id='sel_emp_module_[]'";
							echo form_checkbox('sel_emp_module[]','module','',$em2);
							echo form_error('sel_emp_module_[]');
						?>
					</td>
					<td width="48%">&nbsp; - Manage Financial Year</td>
				</tr>
				
				<tr>
					<td width="4%">
						<?php
							$em3 = "id='sel_emp_module_[]'";
							echo form_checkbox('sel_emp_module[]','module','',$em3);
							echo form_error('sel_emp_module_[]');
						?>
					</td>
					<td width="44%" colspan="2">&nbsp; - Manage Dealer Company</td>
				</tr>
				<tr>
					<td width="4%">
						<?php
							$em4 = "id='sel_emp_module_[]'";
							echo form_checkbox('sel_emp_module[]','module','',$em4);
							echo form_error('sel_emp_module_[]');
						?>
					</td>
					<td width="44%" colspan="2">&nbsp; - Manage Client</td>
				</tr>	
				<tr>
					<td width="6%">
						<?php
							$em5 = "id='sel_emp_module_[]'";
							echo form_checkbox('sel_emp_module[]','module','',$em5);
							echo form_error('sel_emp_module_[]');
						?>
					</td>
					<td width="44%" colspan="2">&nbsp; - Manage Vessels</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$em6 = "id='sel_emp_module_[]'";
							echo form_checkbox('sel_emp_module[]','module','',$em6);
							echo form_error('sel_emp_module_[]');
						?>
					</td>
					<td width="44%" colspan="2">&nbsp; - Manage Agent</td>
				</tr>
			</tbody>
		</table>
		<table border="1">
			<tbody>
				<tr>
					<td width="4%">
						<?php
							$ats = "id='sel_module_3' onClick='check_uncheck_ats();'";
							echo form_checkbox('sel_module_3','module','',$ats);
							echo form_error('sel_module_3');
						?>
					</td>
					<td width="38%">Invoice</td>
					<td width="10%">
						<a href="javascript:void(0);" id="module3" onClick="show_module2()">Expand</a>
					</td>
				</tr>
			</tbody>
		</table>
		<table border="1" id="module_3" style="display:none;">
			<tbody>
				<tr>
					<td width="4%">
						<?php
							$at1 = "id='sel_ats_module_[]'";
							echo form_checkbox('sel_ats_module[]','module','',$at1);
							echo form_error('sel_ats_module_[]');
						?>
					</td>
					<td width="48%">&nbsp; - Add Invoice</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$at2 = "id='sel_ats_module_[]'";
							echo form_checkbox('sel_ats_module[]','module','',$at2);
							echo form_error('sel_ats_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Invoice List</td>
				</tr>
			</tbody>
		</table>
		<table border="1">
			<tbody>
				<tr>
					<td width="4%">
						<?php
							$pms = "id='sel_module_4' onClick='check_uncheck_pms();'";
							echo form_checkbox('sel_module_4','module','',$pms);
							echo form_error('sel_module_4');
						?>
					</td>
					<td width="38%">Receipt</td>
					<td width="10%">
						<a href="javascript:void(0);" id="module4" onClick="show_module3()">Expand</a>
					</td>
				</tr>
			</tbody>
		</table>
		<table border="1" id="module_4" style="display:none;">
			<tbody>
				<tr>
					<td width="4%">
						<?php
							$pm1 = "id='sel_pms_module_[]'";
							echo form_checkbox('sel_pms_module[]','module','',$pm1);
							echo form_error('sel_pms_module_[]');
						?>
					</td>
					<td width="48%">&nbsp; - Add Receipt</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$pm2 = "id='sel_pms_module_[]'";
							echo form_checkbox('sel_pms_module[]','module','',$pm2);
							echo form_error('sel_pms_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Receipts List</td>
				</tr>
			</tbody>
		</table>
		<table border="1">
			<tbody>
				<tr>
					<td width="4%">
						<?php
							$master = "id='sel_module_5' onClick='check_uncheck_master();'";
							echo form_checkbox('sel_module_5','module','',$master);
							echo form_error('sel_module_5');
						?>
					</td>
					<td width="38%">Reports</td>
					<td width="10%">
						<a href="javascript:void(0);" id="module5" onClick="show_module4()">Expand</a>
					</td>
				</tr>
			</tbody>
		</table>
		<table border="1" id="module_5" style="display:none;">
			<tbody>
				<tr>
					<td width="6%">
						<?php
							$ma1 = "id='sel_master_module_[]'";
							echo form_checkbox('sel_master_module[]','module','',$ma1);
							echo form_error('sel_master_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Client wise Sales Report</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$ma2 = "id='sel_master_module_[]'";
							echo form_checkbox('sel_master_module[]','module','',$ma2);
							echo form_error('sel_master_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Dealer Company wise Sales Report</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$ma3 = "id='sel_master_module_[]'";
							echo form_checkbox('sel_master_module[]','module','',$ma3);
							echo form_error('sel_master_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Agent wise Sales Report</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$ma4 = "id='sel_master_module_[]'";
							echo form_checkbox('sel_master_module[]','module','',$ma4);
							echo form_error('sel_master_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Location wise Sales Report</td>
				</tr>
				<tr>
					<td width="6%">
						<?php
							$ma5 = "id='sel_master_module_[]'";
							echo form_checkbox('sel_master_module[]','module','',$ma5);
							echo form_error('sel_master_module_[]');
						?>
					</td>
					<td width="44%">&nbsp; - Outstanding Payment Report</td>
				</tr>
			</tbody>
		</table>
	</td>
	</table>
	</br>
	<?php form_close();?>
<script>
	function check_uncheck_all()
	{	
		if(document.module_form.sel_module.checked==true)
		{
			for (var i=0;i<module_form.elements.length;i++) {
				var e = module_form.elements[i];
				if ((e.type=='checkbox') && (!e.disabled) ) {
					e.checked="true";
				}	
			}
		}
		else
		{
		 for (var i=0;i<module_form.elements.length;i++) {
			var e = module_form.elements[i];
				if ((e.type=='checkbox') && (!e.disabled) ) {
					e.checked=false;
				}
			}
		}
	}
	function check_uncheck_emp()
	{
		var objEmparray = document.getElementById('module_form')['sel_emp_module_[]'];
		if(document.module_form.sel_module_2.checked==true)
		{
			for (i = 0; i < objEmparray.length; i++) {
				objEmparray[i].checked=true;
			}
		}
		else
		{
			for (i = 0; i < objEmparray.length; i++) {
				objEmparray[i].checked=false;
			}
		}
	}
	function check_uncheck_ats()
	{
		var objAtsarray = document.getElementById('module_form')['sel_ats_module_[]'];
		if(document.module_form.sel_module_3.checked==true)
		{
			if(objAtsarray.length==undefined)
			{
				objAts=1;
				objAtsarray.checked=true;
			}
			else
			{
				objAts=objAtsarray.length;
				for (i = 0; i < objAts; i++) {
					objAtsarray[i].checked=true;
				}
			}
		}
		else
		{
			if(objAtsarray.length==undefined)
			{
				objAts=1;
				objAtsarray.checked=false;
			}
			else
			{
				objAts=objAtsarray.length;
				for (i = 0; i < objAts; i++) {
					objAtsarray[i].checked=false;
				}
			}
		}
	}
	function check_uncheck_pms()
	{
		var objPmsarray = document.getElementById('module_form')['sel_pms_module_[]'];
		if(document.module_form.sel_module_4.checked==true)
		{
			if(objPmsarray.length==undefined)
			{
				objPms=1;
				objPmsarray.checked=true;
			}
			else
			{
				objPms=objPmsarray.length;
				for (i = 0; i < objPms; i++) {
					objPmsarray[i].checked=true;
				}
			}
		}
		else
		{
			if(objPmsarray.length==undefined)
			{
				objPms=1;
				objPmsarray.checked=false;
			}
			else
			{
				objPms=objPmsarray.length;
				for (i = 0; i < objPms; i++) {
					objPmsarray[i].checked=false;
				}
			}
		}
	}
	function check_uncheck_master()
	{
		var objMasterarray = document.getElementById('module_form')['sel_master_module_[]'];
		if(document.module_form.sel_module_5.checked==true)
		{
			for (i = 0; i < objMasterarray.length; i++) {
				objMasterarray[i].checked=true;
			}
		}
		else
		{
			for (i = 0; i < objMasterarray.length; i++) {
				objMasterarray[i].checked=false;
			}
		}
	}
	function check_uncheck_doc()
	{
		var objDocarray = document.getElementById('module_form')['sel_doc_module_[]'];
		if(document.module_form.sel_module_7.checked==true)
		{
			for (i = 0; i < objDocarray.length; i++) {
				objDocarray[i].checked=true;
			}
		}
		else
		{
			for (i = 0; i < objDocarray.length; i++) {
				objDocarray[i].checked=false;
			}
		}
	}
	
	function show_module1()
	{
		if($('#module2').html()=='Expand')
			$('#module2').html('Collapse');
		else
			$('#module2').html('Expand');
		var doc1=document.getElementById('module_1').style.display;
		if(doc1=="none")
		{
			document.getElementById('module_1').style.display="";
		}
		else
		{
			document.getElementById('module_1').style.display="none";
		}
	}
	function show_module2()
	{
		if($('#module3').html()=='Expand')
			$('#module3').html('Collapse');
		else
			$('#module3').html('Expand');
		document.getElementById('module_3').style.display;
		var doc3=document.getElementById('module_3').style.display;
		if(doc3=="none")
		{
			document.getElementById('module_3').style.display="";
		}
		else
		{
			document.getElementById('module_3').style.display="none";
		}
	}
	function show_module3()
	{
		if($('#module4').html()=='Expand')
			$('#module4').html('Collapse');
		else
			$('#module4').html('Expand');
		var doc4=document.getElementById('module_4').style.display;
		if(doc4=="none")
		{
			document.getElementById('module_4').style.display="";
		}
		else
		{
			document.getElementById('module_4').style.display="none";
		}
	}
	function show_module4()
	{
		if($('#module5').html()=='Expand')
			$('#module5').html('Collapse');
		else
			$('#module5').html('Expand');
		var doc5=document.getElementById('module_5').style.display;
		if(doc5=="none")
		{
			document.getElementById('module_5').style.display="";
		}
		else
		{
			document.getElementById('module_5').style.display="none";
		}
	}
	function show_module5()
	{
		if($('#module6').html()=='Expand')
			$('#module6').html('Collapse');
		else
			$('#module6').html('Expand');
		var doc7=document.getElementById('module_7').style.display;
		if(doc7=="none")
		{
			document.getElementById('module_7').style.display="";
		}
		else
		{
			document.getElementById('module_7').style.display="none";
		}
	}
</script>