<?php session_start();?>

<?php
	if($_SESSION ["role"]=="Administrator")
	{
		
		$role = $_SESSION["role"];
		$email = $_SESSION["email"];
		
		// header('location:form.php');
	}
	else
	{
		header('location:expired.php');
		// $userName = $_SESSION["userName"]; $userRole = $_SESSION["userRole"];
		}
?>
<?
require ("_common/global.php");
require ("_common/conn.php");
//require ("_common/function.php");
require ("_common/check_session.php");
?><!DOCTYPE html>
<html lang="en">
    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
        <title>VAC-DOS | Vaccine Dossier Mapping Tool</title>
        <meta content="Admin Dashboard" name="description" />
        <meta content="ThemeDesign" name="author" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />

        <link rel="shortcut icon" href="assets/images/favicon.ico">

        <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css">
        <link href="assets/css/icons.css" rel="stylesheet" type="text/css">
        <link href="assets/css/style.css" rel="stylesheet" type="text/css">
		<link href="assets/plugins/sweet-alert2/sweetalert2.min.css" rel="stylesheet" type="text/css">

        

    </head>


    <body>

        <!-- Loader -->
        <div id="preloader"><div id="status"><div class="spinner"></div></div></div>

        <!-- Navigation Bar-->
        <header id="topnav">
            <div class="topbar-main">
                <div class="container-fluid">

                    <!-- Logo container-->
                    <div class="logo">
                        <!-- Image Logo -->
                        <a href="index.html" class="logo">
                            <img src="assets/images/logo-sm.png" alt="" height="32" class="logo-small">
                            <img src="assets/images/logo.png" alt="" height="20" class="logo-large">
                        </a>

                    </div>
                    <!-- End Logo container-->


                    <div class="menu-extras topbar-custom">

                        
                        <ul class="list-inline float-right mb-0">
                            <!-- Search -->
                            
                            <!-- Messages-->
                            
                            <!-- notification-->
                            
                            <!-- User-->
                            <li class="list-inline-item dropdown notification-list">
                                <a class="nav-link dropdown-toggle arrow-none waves-effect nav-user" data-toggle="dropdown" href="#" role="button"
                                    aria-haspopup="false" aria-expanded="false">
                                    <img src="assets/images/users/user-1.jpg" alt="user" class="rounded-circle">
                                </a>
                                <div class="dropdown-menu dropdown-menu-right dropdown-menu-animated profile-dropdown ">
                                    <a class="dropdown-item" href="#"><i class="mdi mdi-account-circle m-r-5 text-muted"></i> Profile</a>
                                    
                                    <a class="dropdown-item" href="logout.php"><i class="mdi mdi-logout m-r-5 text-muted"></i> Logout</a>
                                </div>

                            </li>
                            <li class="menu-item list-inline-item">
                                <!-- Mobile menu toggle-->
                                <a class="navbar-toggle nav-link">
                                    <div class="lines">
                                        <span></span>
                                        <span></span>
                                        <span></span>
                                    </div>
                                </a>
                                <!-- End mobile menu toggle-->
                            </li>

                        </ul>
                    </div>
                    <!-- end menu-extras -->

                    <div class="clearfix"></div>

                </div> <!-- end container -->
            </div>
            <!-- end topbar-main -->

            <!-- MENU Start -->
            <div class="navbar-custom">
                <div class="container-fluid">
                    <div id="navigation">
                        <!-- Navigation Menu-->
                        <ul class="navigation-menu">

                            <li class="has-submenu">
                                <a href="dashboard.php"><i class="dripicons-meter"></i>Dashboard</a>
                            </li>

                            <li class="has-submenu">
                                <a href="#"><i class="dripicons-briefcase"></i>User</a>
                                <ul class="submenu megamenu">
                                    <li>
                                        <ul>
                                            <li><a href="addnewuser.php">Add New</a></li>
											<li><a href="usermanage.php">Manage</a></li>											
                                        </ul>
                                    </li>
                                    
                                </ul>
                            </li>

                            <li class="has-submenu">
                                <a href="#"><i class="dripicons-broadcast"></i>Task</a>
                                <ul class="submenu">
									<li><a href="addnewtask.php">Add New</a></li>									
                                    <li><a href="assignevaluator.php">Assign Evaluator</a></li>
									<li><a href="assigned.php">Records</a></li>
									
									
                                    
                                </ul>
                            </li>

                            <li class="has-submenu">
                                <a href="#"><i class="dripicons-view-thumb"></i>Records</a>
                                <ul class="submenu">
                                    <li class="has-submenu">
                                        <a href="#">All</a>
                                        <ul class="submenu">
                                            <li><a href="viewall.php">View</a></li>
                                                                                        
                                        </ul>
                                    </li>
                                                                       
                                </ul>
                            </li>

                            <li class="has-submenu">
                                <a href="#"><i class="dripicons-graph-bar"></i>About</a>
                                <ul class="submenu">
                                    <li><a href="#">About VAC-DOS</a></li>
                                    <li><a href="#">User Manual</a></li>
                                    
                                </ul>
                            </li>

                            

                        </ul>
                        <!-- End navigation menu -->
                    </div> <!-- end #navigation -->
                </div> <!-- end container -->
            </div> <!-- end navbar-custom -->
        </header>
        <!-- End Navigation Bar-->


        <div class="wrapper">
            <div class="container-fluid">

                <!-- Page-Title -->
                <div class="row">
                    <div class="col-sm-12">
                        <div class="page-title-box">
                            <div class="btn-group float-right">
                                <ol class="breadcrumb hide-phone p-0 m-0">
                                    <li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
                                    <li class="breadcrumb-item"><a href="#">Task</a></li>
									
                                    <li class="breadcrumb-item active">Assign Evaluator</li>
                                </ol>
                            </div>
                            <h4 class="page-title">Assign Evaluator</h4>
                        </div>
                    </div>
                </div>
                <!-- end page title end breadcrumb -->
<?php
//$idvac =$_REQUEST['idvac'];
$email =$_SESSION['email'];
	$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
	 if (!$conn)
    {
	 die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("dvsvigov_vacdos", $conn);
$result = mysql_query("SELECT * FROM user WHERE email  = '$email'");
$test = mysql_fetch_array($result);
if (!$result)
		{
		die("Error: Data not found..");
		}
				$name=$test['name'] ;
				
				
				
mysql_close($conn);

?>
<?php
$idvac =$_REQUEST['idvac'];
$email =$_SESSION['email'];
	$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
	 if (!$conn)
    {
	 die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("dvsvigov_vacdos", $conn);
$result = mysql_query("SELECT * FROM vacc WHERE idvac  = '$idvac'");
$test = mysql_fetch_array($result);
if (!$result)
		{
		die("Error: Data not found..");
		}
				$idvac=$test['idvac'] ;
				$tradename=$test['tradename'] ;
				$manufacturername=$test['manufacturername'] ;
				$locagentadd=$test['locagentadd'] ;
				$loacagentphone=$test['loacagentphone'] ;
				$plantaff=$test['plantaff'] ;
				$mainplant=$test['mainplant'] ;
				$vacctype=$test['vacctype'] ;
				$dateaddtask=$test['dateaddtask'] ;
				$addedby=$test['addedby'] ;
				$AssessA=$test['AssessA'] ;
				$AssessB=$test['AssessB'] ;
				$AssessC=$test['AssessC'] ;
				$AssessC=$test['AssessC'] ;
				$assignby=$test['assignby'] ;
				
mysql_close($conn);

?>	               

			   <div class="row">
                    <div class="col-12">
                        <div class="card m-b-30">
                            <div class="card-body">

                                <h4 class="mt-0 header-title">Assign Evaluator</h4>
                               <form action="assignsql.php?id=<?php echo $idvac ?>" method="post">
                                <div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">ID</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $idvac ?>" name="idvac" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Trade Name</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $tradename ?>" name="tradename" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Manufacturer Name</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $manufacturername ?>" name="manufacturername" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Plant Affiliation</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $plantaff ?>" name="plantaff" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Main Plant Activity</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $mainplant ?>" name="mainplant" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Vaccine Type</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $vacctype ?>" name="vacctype" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Task Added by</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $addedby ?>" name="addedby" readonly/>
                                    </div>
                                </div>
								
								<div class="form-group row">
								<label for="example-text-input" class="col-sm-2 col-form-label">Accessor A</label>
								<div class="col-sm-10">
								<select class="form-control" name="AssessA">
								<?php 
								$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
								if (!$conn)
									{
									 die('Could not connect: ' . mysql_error());
									}
									mysql_select_db("dvsvigov_vacdos", $conn);
								$sql = mysql_query("SELECT name FROM user WHERE role='Evaluator' AND status='Active'");
								
								$AssessA=$test['AssessA'] ;
								echo "<option>".$AssessA."</option>";
								while ($row = mysql_fetch_array($sql)){
								echo "<option name=\"AssessA\">" . $row['name'] . "</option>";
								}
								?>
								</select>
								</div>
								</div>
								
								<div class="form-group row">
								<label for="example-text-input" class="col-sm-2 col-form-label">Accessor B</label>
								<div class="col-sm-10">
								<select class="form-control" name="AssessB">
								<?php 
								$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
								if (!$conn)
									{
									 die('Could not connect: ' . mysql_error());
									}
									mysql_select_db("dvsvigov_vacdos", $conn);
								$sql = mysql_query("SELECT name FROM user WHERE role='Evaluator' AND status='Active'");
								
								$AssessB=$test['AssessB'] ;
								echo "<option>".$AssessB."</option>";
								while ($row = mysql_fetch_array($sql)){
								echo "<option name=\"AssessB\">" . $row['name'] . "</option>";
								}
								?>
								</select>
								</div>
								</div>
								
								<div class="form-group row">
								<label for="example-text-input" class="col-sm-2 col-form-label">Accessor C</label>
								<div class="col-sm-10">
								<select class="form-control" name="AssessC">
								<?php 
								$conn = mysql_connect('localhost', 'dvsvigov_vacc', 'DVSvacdos123');
								if (!$conn)
									{
									 die('Could not connect: ' . mysql_error());
									}
									mysql_select_db("dvsvigov_vacdos", $conn);
								$sql = mysql_query("SELECT name FROM user WHERE role='Evaluator' AND status='Active'");
								
								$AssessC=$test['AssessC'] ;
								echo "<option>".$AssessC."</option>";
								while ($row = mysql_fetch_array($sql)){
								echo "<option name=\"AssessC\">" . $row['name'] . "</option>";
								}
								?>
								</select>
								</div>
								</div>
                                <div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Accessor Assigned by</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo $name ?>" name="assignby" readonly/>
                                    </div>
                                </div>
								<div class="form-group row">
                                    <label for="example-text-input" class="col-sm-2 col-form-label">Date Assigned</label>
                                    <div class="col-sm-10">
                                        <input class="form-control" type="text" value="<?php echo date("d/m/Y") ?>" name="dateassign" readonly/>
                                    </div>
                                </div>
								<button class="btn btn-primary btn-block waves-effect waves-light" type="submit">Assign Evaluator</button>
								
								</form>
                              
								 
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->

            </div> <!-- end container -->
        </div>
        <!-- end wrapper -->


        <!-- Footer -->
        <footer class="footer">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-12">
                        © 2020 <b>VAC-DOS </b>V1.0<br><span class="d-none d-sm-inline-block">Crafted by <b>Research and Innovation</b> Division, Department of Veterinary Services Malaysia</span>
                    </div>
                </div>
            </div>
        </footer>
        <!-- End Footer -->
    

        <!-- jQuery  -->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/bootstrap.bundle.min.js"></script>
        <script src="assets/js/modernizr.min.js"></script>
        <script src="assets/js/detect.js"></script>
        <script src="assets/js/fastclick.js"></script>
        <script src="assets/js/jquery.slimscroll.js"></script>
        <script src="assets/js/jquery.blockUI.js"></script>
        <script src="assets/js/waves.js"></script>
		
		<!-- Sweet-Alert  -->
        <script src="assets/plugins/sweet-alert2/sweetalert2.min.js"></script>
        <script src="assets/pages/sweet-alert.init.js"></script>

        <!-- App js -->
        <script src="assets/js/app.js"></script>

    </body>
</html>