<?php
$edit_id=$_GET['edit_id'];
include ("../../include/db.php");
 ?>

<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
<?php 
if($_GET['edit_id']!='')
{
$table_display_style1='style="display:none;"';
} 
else
{
$table_display_style='style="display:none;"';
}

    $sql="select * from  user_rights ";
    $rs=mysql_query($sql);
	$sno=0;
    while($rsdata=mysql_fetch_array($rs))
     {
        $sno=$sno+1;
        $user_id=$rsdata['user_id'];
  		$user_name=$rsdata['user_name'];
  		$user_screen=$rsdata['user_screen'];
		$user_form_name=$rsdata['user_form_name'];
	}
?>
<form name="user_rights_form" id="user_rights_form" method="GET" >
<div class="h_title" style="margin-bottom:10px;">User Rights Creation<div class="addicon2">

<?php if($_GET['edit_id']==''){?>
<img src="img/tick.png" name="add_button" id="add_button" title="ADD" onClick="setTable(this.title),setTable12(this.title);return false" align="top" width="35" height="35" border="0" tabindex="4" style="cursor:pointer;" >

<img src="img/wrong.png" name="cancel_button" id="cancel_button" title="CANCEL" onClick="setTable(this.title),setTable12(this.title);return false" align="top`" width="35" height="35" border="0" style="display:none; cursor:pointer;"  />

<?php } else{?>  
<img src="img/cross_delete.png" name="cancel_button" id="cancel_button" title="CANCEL" onClick="window.location.href='main_fram.php?file=user_creation'" align="top" width="40" height="40" border="0"/>

<?php } ?></div></div>

<div id="table1"  <?php echo $table_display_style; ?>>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="2" id="table_show"> 
<tr>
  <td height="51" colspan="2" align="right">User Name<span style="color:#FF0000;">*</span></td>
    <td width="4%" align="center" ><div align="left"></div></td>
    <td width="14%"  ><select name="user_name" id="user_name" tabindex="4"   onchange="user_right_clear_validate(this.value)"  style="width:200px; height:30px; border:1px solid #a1a1a1;">
    <option value="">Select</option>
      <?php
			  $sql="select * from user_creation ORDER BY user_id ASC";
			  $rs=mysql_query($sql);
			  $rscount=mysql_num_rows($rs);
			  if($rscount!=0)
			  {
			  while($rsdata=mysql_fetch_object($rs))
			  {
			  ?>
                       <option value="<?php echo $rsdata->user_name;?>"><?php echo $rsdata->user_name;?></option>
                       <?php  }} ?>
    </select>
    <div  id="user_name_err_design" style="color:#FF0000;" ></div></td>
    <td width="0%"></td>
    <td width="32%" align="right" ><div align="right" > Screens<span style="color:#FF0000;">*</span></div></td>
    <td width="3%"  align="left">&nbsp;</td>
   <td colspan="2"><select name="user_screen" id="user_screen" tabindex="4"   onchange="view_form(this.value),user_right_clear_validate(this.value);"  style="width:200px; height:30px;  border:1px solid #a1a1a1;">
     <option value="">Select</option>
     <option value="Admin">Admin</option>
                       <option value="Master Entry">Master Entry</option>
                      <option value="Sales Person">Sales Person</option>
                      <option value="Sales Manager">Sales Manager</option>
                      <option value="Factory">Factory</option>
                      <option value="Tastee Masala">Tastee Masala</option>
                      <option value="Invoice">Invoice</option>
                       <option value="Report">Report</option>
   </select>
     <div  id="screen_err_design" style="color:#FF0000;"></div>     </td><td width="0%"></td>
   <tr>
  <td height="51" colspan="9"><div align="left"></div>    <div id="user_form_div"><?php include("user_form.php");?>
    </div></td>
    </tr>
  <tr><input type="hidden" name="form_name" id="form_name" value="">
    <td width="0%">&nbsp;</td>
    <td width="20%" height="51">&nbsp;</td>
    <td align="left" >&nbsp;</td>
    <td>&nbsp;</td>
    <td style="color:#FF0000;">&nbsp;</td>
    <td><input type="button" name="action" id="action" tabindex="5" value="<?php echo "ADD";?>" class="button-primary" onclick="user_rights_add(user_name.value,user_screen.value,form_name.value,'<?php echo $id;?>',this.value,'<?php echo $_GET['form']; ?>')"/></td>
    <td align="center"  >&nbsp;</td>
    <td width="15%">&nbsp;</td>
    <td width="12%" align="left" style="color:#FF0000;">&nbsp;</td>
  </tr>

</table>
</div>

  <table width="100%" >
    <tr>
      <td width="100%" align="center"><div id="part1_div" <?php //echo $table_display_style1; ?>>
       <?php include("user_rights_list.php"); ?>
     </div> </td>
    </tr>
  </table>
</form>


