<? include("header.php");

//session_start();
//error_reporting(0);

$id=$_REQUEST['id'];

include "checksession.php";

include ("include/db-connect.php");


if(isset($_REQUEST['submit']))
 {
	 
	 $adm_name=$_REQUEST['adm_name'];
	 $adm_pass=$_REQUEST['adm_pass'];
	 
	 $system=$_REQUEST['system'];
	 $customer=$_REQUEST['customer'];
	 $products=$_REQUEST['products'];
	 $sales=$_REQUEST['sales'];
	 $payment=$_REQUEST['payment'];
	 $reports=$_REQUEST['reports'];
	 $purchase=$_REQUEST['purchase'];

     $insert="update ".$ADMIN." set adm_name='$adm_name',adm_pass='$adm_pass',system='$system',customer='$customer',products='$products',purchase='$purchase',sales='$sales',payment='$payment',reports='$reports',code='1' where id='$id'" ;
     $exce=mysql_query($insert);
 
     ?>
     <script>
	 window.location='view_users.php?edit=success';
	 </script>
     <?
//header("location:view_user.php?edit=success"); 
}
 
 ?>

<div id="content">
  <div class="breadcrumb">
       <!-- <a href="http://amarasudhan.com/admin/index.php?route=common/home&amp;token=b735cc089ec2d51abb9a8e1901f501fb">Home</a>-->
      </div>
              <div class="box">
    <div class="heading">
      <h1><img src="view/image/home.png" alt="" />Add Users</h1>
    </div>
    <div class="content">
      <div class="overview" style="width:50%; margin-left:300px;">
        <div class="dashboard-heading"> Users Permission</div>
        <div class="dashboard-content">
        
 
  <?php 
$qur="SELECT * FROM ".$ADMIN." where id=$id"; 
$result = mysql_query($qur);
$fetch = mysql_fetch_array($result);
?>
 
 <?php if($_REQUEST['ed']=='su'){ echo "<div class='alert_succes'>Contact Edited Successfully</div>"; } else { echo "";}?>

 <form method="post" id="client" enctype="multipart/form-data">
  <!--<script type="text/javascript" src="../prototype.js"></script> 
  <script type="text/javascript" src="../validation.js"></script>-->
  
  
            <div class="mainrow" style="margin-left:100px;">

                <div class="maintext">User Name <font color="#FF0000"><b> *</b></font> </div>
                <div class="maintextbox"><input type="text" name="adm_name" size="36" class="required" value="<?php echo $fetch['adm_name']; ?>"></div>
            </div>

<br>

            <div class="mainrow" style="margin-left:100px;">

                <div class="maintext">Password<font color="#FF0000"><b> *</b></font> </div>

                <div class="maintextbox"><input type="text" name="adm_pass" size="36" class="required" value="<?php echo $fetch['adm_pass']; ?>"></div>
               

            </div>
            <br>
            
            <!----USER PERMISSION START----->
           <div style="width:830px; height:300px;">
            
            
            <div  style="width:230px; height:210px; border:ridge; float:left; margin-top:30px; margin-left:100px;">
            <div style="margin-top:10px; margin-left:10px;">MENUS</div>
            <div style="margin-left:10px; margin-top:20px;"><?php if($fetch['system']!=0) {?>
            <input type="checkbox" name="system" value="1" checked>System
            <?php } else { ?>
            <input type="checkbox" name="system" value="1">System
            <?php }?>
            </div>
            
            <div style="margin-left:10px; margin-top:5px;"><?php if($fetch['customer']!=0) {?>
            <input type="checkbox" name="customer" value="1" checked>Customer
            <?php } else { ?>
            <input type="checkbox" name="customer" value="1">Customer
            <?php } ?>
            </div>
            
            <div style="margin-left:10px; margin-top:5px;"><?php if($fetch['products']!=0) {?>
            <input type="checkbox" name="products" value="1" checked>Products
            <?php } else { ?>
            <input type="checkbox" name="products" value="1">Products
            <?php }?>
            </div>
            
            <div style="margin-left:10px; margin-top:5px;"><?php if($fetch['purchase']!=0) {?>
            <input type="checkbox" name="purchase" value="1" checked>Purchase
            <?php } else { ?>
            <input type="checkbox" name="purchase" value="1">Purchase
            <?php }?>
            </div>
            
            <div style="margin-left:10px; margin-top:5px;"><?php if($fetch['sales']!=0) {?>
            <input type="checkbox" name="sales" value="1" checked>Sales
            <?php } else { ?>
            <input type="checkbox" name="sales" value="1">Sales
            <?php }?>
            </div>
            <div style="margin-left:10px; margin-top:5px;"><?php if($fetch['payment']!=0) {?>
            <input type="checkbox" name="payment" value="1" checked>Payment
            <?php } else { ?>
            <input type="checkbox" name="payment" value="1">Payment
            <?php }?>
            </div>
            <div style="margin-left:10px; margin-top:5px;"><?php if($fetch['reports']!=0) {?>
            <input type="checkbox" name="reports" value="1" checked>Reports
            <?php } else { ?>
            <input type="checkbox" name="reports" value="1">Reports
            <?php }?>
            </div>
            </div>
            
           
         
            </div>
            <!----USER PERMISSION END----->
           
<br>
              <div style="margin-left:100px; margin-top:30px; "><input  id="Submit" type="submit" value="Submit" name="submit" /></div>


   </form>
        </div>
      </div>
      
      
    </div>
  </div>
</div>
<!--[if IE]>
<script type="text/javascript" src="view/javascript/jquery/flot/excanvas.js"></script>
<![endif]--> 
<script type="text/javascript" src="view/javascript/jquery/flot/jquery.flot.js"></script> 
<script type="text/javascript"><!--
function getSalesChart(range) {
	$.ajax({
		type: 'get',
		url: 'index.php?route=common/home/chart&token=b735cc089ec2d51abb9a8e1901f501fb&range=' + range,
		dataType: 'json',
		async: false,
		success: function(json) {
			var option = {	
				shadowSize: 0,
				lines: { 
					show: true,
					fill: true,
					lineWidth: 1
				},
				grid: {
					backgroundColor: '#FFFFFF'
				},	
				xaxis: {
            		ticks: json.xaxis
				}
			}

			$.plot($('#report'), [json.order, json.customer], option);
		}
	});
}

getSalesChart($('#range').val());
//--></script> 
</div>
<?php include("footer.php"); ?>