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

$batch_no = new input();
$batch_no->class("inputs");
$batch_no->type("text");
$batch_no->placeholder("BATCH NO");
$batch_no->name("batch_no");
$batch_no->id("batch_no");
$batch_no->onkeyup("search_batch()");

$name = new input();
$name->class("inputs");
$name->type("text");
$name->placeholder("NAME");
$name->name("name");
$name->id("name");
$name->onkeyup("search_batch()");

$silo_id = new select();
$silo_id->class("inputs");
$silo_id->name("silo_id");
$silo_id->id("silo_id");
$silo_id->add_option("", "SILO");
$silo_id->fill_from_db("silos", "record_id", "name");
$silo_id->onchange("search_batch()");

$amount = new input();
$amount->class("inputs");
$amount->type("number");
$amount->placeholder("AMOUNT");
$amount->name("amount");
$amount->id("amount");
$amount->onkeyup("search_batch()");

?>
<div class="column">
    <div class="banner">
        <div class="row">
            <?php echo $html->selectable_block("add_batch.php", "ADD"); ?>

            <div class="search_form">
                <div class="row">
                    <div class="row">
                        <?php $batch_no->add(); ?>
                        <?php $name->add(); ?>
                        <?php $silo_id->add(); ?>
                        <?php $amount->add(); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <?php
    $ajax = new js_ajax();
    $ajax->run_on_load();
    $ajax->function_name("search_jobcard");
    $ajax->select("batch_data");
    $ajax->return_columns(['batch_no', 'name', 'silo_id','amount']);
    $ajax->redirect("edit_batch.php");
    ?>