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

// $html->check_user_type("ADMIN");
$stock = new input();
$stock->name("description");
$stock->id("description");
$stock->type("text");
$stock->placeholder("Descprition");
$stock->class("search_inputs");
$stock->onkeyup("search_stock()");

$categories = new select();
$categories->name("category_id");
$categories->id("category_id");
$categories->class("search_inputs");
$categories->add_option("", "Category");
$categories->fill_from_db("stock_categories", "record_id", "name");
$categories->onchange("search_stock()");

$suppliers = new select();
$suppliers->name("supplier_id");
$suppliers->id("supplier_id");
$suppliers->class("search_inputs");
$suppliers->add_option("", "Supplier");
$suppliers->fill_from_db("suppliers", "record_id", "name");
$suppliers->onchange("search_stock()");


?>

<div class="search_form">
    <?php
    $stock->add();
    $categories->add();
    $suppliers->add();
    ?>

</div>

<?php 
$ajax = new js_ajax();
$ajax->function_name("search_stock");
$ajax->select("stock");
$ajax->return_columns(['description']);
$ajax->run_on_load();
$ajax->redirect("single_stock_report.php");
 ?>