<?php include "../../root.class.php";
$html = new html();
$html->add_styles_page();
$db = new db_safeguard();

//current dat + 2 hours
$datetime = new DateTime();
$datetime->modify('+2 hours');
$current_datetime = $datetime->format('Y-m-d H:i');

$analysist_name = new input();
$analysist_name->type("text");
$analysist_name->name("analyst_name");
$analysist_name->id("analyst_name");
$analysist_name->style("width: 100%; margin: 1vw auto;");

$farm = new input();
$farm->type("text");
$farm->name("farm");
$farm->id("farm");
$farm->style("width: 100%; margin: 1vw auto;");

$date_harvested = new input();
$date_harvested->type("date");
$date_harvested->name("date_harvested");
$date_harvested->id("date_harvested");
$date_harvested->style("width: 100%; margin: 1vw auto;");

$date_received = new input();
$date_received->type("date");
$date_received->name("date_received");
$date_received->id("date_received");
$date_received->style("width: 100%; margin: 1vw auto;");

$date_time_created = new input();
$date_time_created->type("hidden");
$date_time_created->name("date_time_created");
$date_time_created->id("date_time_created");
$date_time_created->value($current_datetime);
$date_time_created->style("width: 100%; margin: 1vw auto;");

$blocks = new input();
$blocks->type("text");
$blocks->name("blocks");
$blocks->id("blocks");
$blocks->placeholder("Example: B55, J56, Z57");
$blocks->style("width: 100%; margin: 1vw auto;");

$receiving_batch_no = new input();
$receiving_batch_no->type("text");
$receiving_batch_no->name("receiving_batch_no");
$receiving_batch_no->id("receiving_batch_no");
$receiving_batch_no->style("width: 100%; margin: 1vw auto;");

$farm_delivery_note = new input();
$farm_delivery_note->type("text");
$farm_delivery_note->name("farm_delivery_note");
$farm_delivery_note->id("farm_delivery_note");
$farm_delivery_note->style("width: 100%; margin: 1vw auto;");

$submit_btn = new button();
$submit_btn->class("submit_btn");
$submit_btn->value("SUBMIT");
$submit_btn->onclick("nut_analysis()");

$test = new select();
$test->name("test");
$test->id("test");
$test->add_option("test","test");
$test->add_option("test","test");



?>

<div class="form_down">

    <h1>Pre Crack Analysis</h1><br>
    <style>
        table,
        th,
        td {
            border: 2px solid black;
            border-collapse: collapse;
            padding: 5px;
        }
    </style>


    <table style="width: 90%">
        <tr style="background-color: #004aad80;">
            <th colspan="4">NUT ANALYSIS REPORT FORM - Pre-Crack Sample</th>
        </tr>
        <tr>
            <td>
                Analyst Name
            </td>
            <td colspan="3">
                <?php
                $date_time_created->add();
                $analysist_name->add();
                ?>
            </td>
        </tr>
        <tr>
            <td>Farm</td>
            <td>
                <?php
                $farm->add();
                ?>
            </td>
            <td>Date Harvested</td>
            <td>
                <?php
                $date_harvested->add();
                ?>
            </td>
        </tr>
        <tr>
            <td>Date Received</td>
            <td>
                <?php
                $date_received->add();
                ?>
            </td>
            <td>Farm Delivery Note #</td>
            <td>
                <?php
                $farm_delivery_note->add();
                ?>
            </td>
        </tr>
        <tr>
            <td>Block/s (comma separated if multiple)</td>
            <td>
                <?php
                $blocks->add();
                ?>
            </td>
            <td>Receiving batch No</td>
            <td>
                <?php
                $receiving_batch_no->add();
                ?>
            </td>
        </tr>
    </table>

    <br>

    <?php
    $submit_btn->add();
    ?>
</div>

<?php

$ajax = new js_ajax();
$ajax->function_name("nut_analysis");
$ajax->insert("nut_analysis_report");
$ajax->add_column_and_value("status=DNIS INSPECTION");
$ajax->on_success("DATA CAPTURED SUCCESSFULLY");
$ajax->redirect("nut_analysis.php");