<?php
session_start();
include('includes/config.php');
include('defs.php');

if(strlen($_SESSION['aid'])==0)
  { header('location:index.php');
}

$usr=$_SESSION['uname'];



 ?>

 <!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>GLAKB  | Raw Purchases</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="../plugins/fontawesome-free/css/all.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="../dist/css/adminlte.min.css">
  <!--Function Email Availabilty---->

</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
<?php include_once("includes/navbar.php");?>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
 <?php include_once("includes/sidebar.php");?>

 
  <div class="content-wrapper">
<?
$result12 = mysqli_query($link, "select Role from user_details where Name='$usr' ");
$row12=  mysqli_fetch_object($result12);
$role = $row12->Role;
if($role=='Operator')
{
$result = mysqli_query($link, "select Role from user_priv where Name='$usr' and Form='Raw-Pur' ");
$row=  mysqli_fetch_object($result);
$role = $row->Role;
if($role=='0')
{
{
echo"<center>";
echo"<br><br><br><br><br>";
echo"<img src='users.png' width='160' height='160'><br>";
echo "<font size=6 color=red><b>ACCESS DENIED!</b><br>";
echo "<font size=4 color=darkblue><b>You Do Not Have Permission to View This Page.</b><br>";
goto a;
}
}
}




echo "                <form name='m_head' onsubmit='openForm(event)'>";



              ?>

<html>
  <script language="javascript" type="text/javascript">

   window.onload= function show()
                        {
                                if(document.m_head.formNumber.value =="")
                                        {

                                                document.m_head.formNumber.focus()
                                        }
                                        }
                                        

 function processkey(e)
                {
                        var kc = (window.Event?e.which:e.keyCode)
                        if (kc >=48 && kc<= 57 || kc ==8 || kc == 46)
                                return true
                        else
                                return false

     
           }

function openForm(event) {
            event.preventDefault(); // Prevent default form submission
            var number = document.getElementById("formNumber").value;
            
            if (!number || number>6) {
                alert("Please Enter a Valid Option Number.");
                document.m_head.formNumber.focus();
                return;
            }

            // You can customize this URL pattern
            var url = "inv" + number + ".php";
           
            window.open(url, "_self"); // Open in a new tab/window
           
        }


</script>

<head>
<style>

#customers {
  font-family: Times-Roman;
  border-collapse: collapse;
  width: 80%;
}

#customers td, #customers th {
  border: 1px solid #4444;
  padding: 8px;
}

#customers tr:nth-child(even){background-color:gainsboro ;}


#customers th {
  padding-top: 8px;
  padding-bottom: 8px;
  text-align: center;
background-color:dodgerblue;
    color: white;
}
</style>   


<table align="center" id="customers">
     
<tr>
     <th colspan="8"><FONT SIZE=5>OPTION SELECTION FORM</th>

  </tr>
       

  <td width="100" align="center" style="background-color: gainsboro; color: black;"><b>1. </td>
  <td width="600" style="background-color: gainsboro; color: black;"><font size="4">Carton Purchasing</td>
  
<tr>
  <td width="100" align="center" style="background-color: white; color: black;"><b>2. </td>
  <td width="600" style="background-color: white; color: black;"><font size="4">Bucket / Drum Purchasing</td>
<tr>
  <td width="100" align="center" style="background-color: gainsboro; color: black;"><b>3. </td>
  <td width="600" style="background-color: gainsboro; color: black;"><font size="4">Pack Purchasing</td>
<tr>
  <td width="100" align="center" style="background-color: white; color: black;"><b>4.</td>
  <td width="600" style="background-color: white; color: black;"><font size="4">Sticker / Label Purchasing</td>
<tr>

  <td width="100" align="center" style="background-color: gainsboro; color: black;"><b>5.</td>
  <td width="600" style="background-color: gainsboro; color: black;"><font size="4">Packing Tape Purchasing</td>
<tr>


  <td width="100" align="center" style="background-color: white; color: black;"><b>6.</td>
  <td width="600" style="background-color: white; color: black;"><font size="4">Seal Purchasing</td>
<tr>


<td width="150"><b><font size=3 color=black>Enter Option Number:</b></td>

<td ><input type="text" id="formNumber" name="formNumber" style="background-color: lightblue;" size="25" onfocus="this.select()" onkeypress="return processkey(event)" value="" />

<input type="submit" name="save" value="Open Selected Option Form" style="background: none; color:#007BFF; border:2px solid #007BFF; padding:2px 20px; border-radius:5px;">


    </form>


                   </form>
                                </table>
  <?                     
a:
            include "footer.php";
?>
</div>
<!-- ./wrapper -->

<!-- jQuery -->
<script src="../plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap 4 -->
<script src="../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- bs-custom-file-input -->
<script src="../plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
<!-- AdminLTE App -->
<script src="../dist/js/adminlte.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="../dist/js/demo.js"></script>
<!-- Page specific script -->
<script>
$(function () {
  bsCustomFileInput.init();
});
</script>
</body>
</html>
<?php  ?>