<?php
$output = '';
if(isset($_POST['submit'])){
	require 'class/lab-test.php';
	$lab_test = new LabTest();
	$department = $_POST['department'];
	$sub_department = $_POST['department'];
	$sample = $_POST['sample'];
	$test_name = $_POST['test_name'];
	$price = $_POST['price'];
	$json_response = $lab_test->createLabTest($department, $sub_department, $sample, $test_name, $price);
	$response = json_decode($json_response, true);
	if($response['error'] == false){
		$output =   '<div class="alert alert-success alert-dismissible fade in" role="alert">
							<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
							</button>
							<strong>Success. </strong> Lab test created successfully...
					</div>'; 
	}else{
		$output =   '<div class="alert alert-danger alert-dismissible fade in" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
						</button>
						<strong>Failed. </strong> ' . $response["status"] . '.
					</div>';
	}
}

?>
<?php include("side_nav.php"); ?>
<?php include("top_nav.php"); ?>


        <!-- page content -->
        <div class="right_col" role="main">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3></h3>
              </div>

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

            <div class="row">

              <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                  <div class="x_title">
                    <h2>Register test. <small>You can register a new test with the form below. </small></h2>
                    <ul class="nav navbar-right panel_toolbox">
                      <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                      </li>
                      <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                        <ul class="dropdown-menu" role="menu">
                          <li><a href="#">Settings 1</a>
                          </li>
                          <li><a href="#">Settings 2</a>
                          </li>
                        </ul>
                      </li>
                      <li><a class="close-link"><i class="fa fa-close"></i></a>
                      </li>
                    </ul>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
                    <p class="text-muted font-13 m-b-30">
                      
                    </p>

                    <!-- Smart Wizard -->
                    <form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" autocomplete="off" class="form-horizontal form-label-left">
					
					  <div class="form-group">
						<div class="col-md-8 col-sm-8 col-xs-12 col-md-offset-2">
							<?php echo $output; ?>
						</div>
					  </div>
					

                      <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Email">Department<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12 autocomplete" >
                          <input name="department" type="text" class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
					  
					  <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="Email">Sub-department<span class="required">*</span>
                        </label>
                        <div class="col-md-6 col-sm-6 col-xs-12">
                          <input name="sub_department" type="text" class="form-control col-md-7 col-xs-12">
                        </div>
                      </div>
					  
					  <div class="form-group">
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="amount"> Specimen/Sample<span class="required">*</span>
                        </label>
                        <div class="col-md-4 col-sm-4 col-xs-12">
                          <input name="sample" type="text" required="required" class="form-control col-md-7 col-xs-12" >
                        </div>
                      </div>
					  
					  <div class="form-group birthday" >
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="amount">Test name/ Service name<span class="required">*</span>
                        </label>
                        <div class="col-md-5 col-sm-4 col-xs-12">
                          <input name="test_name" type="text" class="form-control col-md-7 col-xs-12" ><br />
						</div>
                      </div>
					  
					  <div class="form-group birthday" >
                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="amount">Price<span class="required">*</span>
                        </label>
                        <div class="col-md-2 col-sm-2 col-xs-12">
                          <input name="price" type="number"  class="form-control col-md-7 col-xs-12" ><br />
						</div>
                      </div>
                      
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
                          <button name="submit" type="submit" class="btn btn-primary">Submit</button>
                        </div>
                      </div>

                    </form>
                    <!-- End SmartWizard Content -->
                   </div>
                </div>
              </div>
			</div>
          </div>
        </div>
        <!-- /page content -->
 <!-- /footer content -->
      </div>
    </div>
    <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>
    <!-- FastClick -->
    <!-- Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>
	<!-- SWEET ALERT -->
	<script src="../vendors/datatables.net/js/jquery.dataTables.min.js"></script>
    <script src="../vendors/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
    <script src="../vendors/datatables.net-buttons-bs/js/buttons.bootstrap.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.flash.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.html5.min.js"></script>
    <script src="../vendors/datatables.net-buttons/js/buttons.print.min.js"></script>
    <script src="../vendors/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"></script>
    <script src="../vendors/datatables.net-keytable/js/dataTables.keyTable.min.js"></script>
    <script src="../vendors/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
    <script src="../vendors/datatables.net-responsive-bs/js/responsive.bootstrap.js"></script>
    <script src="../vendors/datatables.net-scroller/js/dataTables.scroller.min.js"></script>
	</body>
</html>

<!---- Personal Dev -->
<script src="myscripts.js"></script>
