<?php  

include('includes/Class_www_users.php');

include('CRM/functions.php');

$targetpage="index.php?route=DealerDistrbutions/Setup/dealerusers&Application=".$_REQUEST['Application']."&modid=".$_REQUEST['modid']."";





		?>

<script language="javascript" >

 

function FProfileMaster()

{		myCheckboxArray = document.myform.elements["assigned_sites[]"];

	var t=myCheckboxArray.length;

	if(document.getElementById('assigned_site').checked==true)

	{	

	

		if(t==undefined)

	

		document.getElementById('assigned_sites_'+1).checked=true;		

			for (var i = 0; i <= t; i++)

	{

	document.getElementById('assigned_sites_'+i).checked=true;	

	}	

	}

	else

	{



	if(t==undefined)		

		document.getElementById('assigned_sites_'+1).checked=false;		

			

	for (var i = 0; i <= t; i++)

	{

	document.getElementById('assigned_sites_'+i).checked=false;	

	}

	}

	



	

}



function CompanyRoles(str,hiddiv, url)

{



	document.getElementById("txtfiles").style.display  = "none";;

  if (str=="")

  {

  document.getElementById(hiddiv).innerHTML="";

  return;

  }

if (window.XMLHttpRequest)

  {// code for IE7+, Firefox, Chrome, Opera, Safari

  xmlhttp=new XMLHttpRequest();

  }

else

  {// code for IE6, IE5

  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

xmlhttp.onreadystatechange=function()

  {

  if (xmlhttp.readyState==4 && xmlhttp.status==200)

    {

    document.getElementById(hiddiv).innerHTML=xmlhttp.responseText;

    }

  }

xmlhttp.open("GET",url+"?q="+str,true);

xmlhttp.send();

}



function getZones(str)

{

	var cnt=document.getElementById("cnt").value;

	var arr=Array();

	for(var i=0; i<cnt; i++)

	{

		if(document.getElementById("mst_site_"+i).checked==true)

		{

			arr.push(document.getElementById("mst_site_"+i).value);

		}

	}

//alert(arr);

	

	if(str=="")

  {

  document.getElementById('hid-zone-div').innerHTML="";

  return;

  }

if (window.XMLHttpRequest)

  {// code for IE7+, Firefox, Chrome, Opera, Safari

  xmlhttp=new XMLHttpRequest();

  }

else

  {// code for IE6, IE5

  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");

  }

xmlhttp.onreadystatechange=function()

  {

  if (xmlhttp.readyState==4 && xmlhttp.status==200)

    {

    	document.getElementById('hid-zone-div').innerHTML=xmlhttp.responseText;

    }

  }

xmlhttp.open("GET","ZonePrefix.php?arr="+arr,true);

xmlhttp.send();

	

}

</script> 

<link href="css/pagnation.css" rel="stylesheet" type="text/css">

<script language="javascript" src="js/function-ajax.js"></script>

<p align="center"><h2>Company Users  </h2></p><div align="left">

<a href="<?php echo $targetpage;?>&action=add"><input type="button" name="Add" value="Add Dealer User"  /> </a></div>

	



	<table width="100%" border="0" cellspacing="1" cellpadding="2" style="border:#999999 solid 1px">

    <tr>

    <th width="19%" scope="col"><strong>Company </strong></th>

    <th width="13%" scope="col"><strong>UserId</strong></th>

	<th width="10%" scope="col"><strong>Role</strong></th>

	<th width="12%" scope="col"><strong>Name</strong></th>

	<th width="11%" scope="col"><strong>Email</strong></th>

	<th width="23%" scope="col"><strong>Status</strong></th>

	<th colspan="2" scope="col"><strong>Action</strong></th>

  </tr>

 

 

   <?php 

   $GetRecord="select * from www_users where Type='Dealer'";

   $ResultData = DB_query($GetRecord,$db);

   $i=1;

   if(DB_num_rows($ResultData)==0)

   echo "<td colspan='3'>--No Record--</td>";

   

   while($RowData = DB_fetch_array($ResultData))

   {?> 

   <tr bgcolor="#FFFFFF">

   <td><?php  echo  $s->getField('companies','CompanyId',$RowData['companyid'],'CompanyName'); ?> </td>

   <td><?php echo $RowData['userid']; ?></td>

   <td><?php  echo  $s->getField('securityroles','secroleid',$RowData['rolepid'],'role_name');?></td>

   <td><?php echo $RowData['realname']; ?></td>

   <td><?php echo $RowData['email']; ?></td>

   <td><?php echo ($RowData['blocked']=='0'?'Active':'Inactive'); ?>	  </td>

   <td width="3%"><a href="<?php echo $targetpage;?>&action=Edit&Id=<?php echo $RowData['id']; ?>">

      <img src="images/icon-edit.png"  width="10" height="10"/></a></div></td>	

   <td width="9%"><?php

   echo $_SESSION['frmDelete'];

   

    if($_SESSION['frmDelete']==1 && $_SESSION['UserID']!=$RowData['id']) { ?>

     <a href="<?php echo $targetpage;?>&action=del&Id=<?php echo $RowData['id']; ?>" onclick="return confirm('Do You Want To Delete This Record')"><img src="images/Icon_Delete.png" width="10" height="10" /></a>

     <?php } else { echo "No Permissions"; }?></td>

   </tr>



	<?php $i++;}   

   ?> 

</table>

   

