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

// $html->check_user_type("ADMIN");
$name = new input();
$name->name("name");
$name->id("name");
$name->type("text");
$name->placeholder("NAME");
$name->class("search_inputs");
$name->onkeyup("search_orders()");

$jc_number = new input();
$jc_number->name("jc_number");
$jc_number->id("jc_number");
$jc_number->type("text");
$jc_number->placeholder("JC Number");
$jc_number->class("search_inputs");
$jc_number->onkeyup("search_orders()");

$jc_account = new select();
$jc_account->name("job_card_account_id");
$jc_account->id("job_card_account_id");
$jc_account->class("search_inputs");
$jc_account->add_option("", "JC Account");
$jc_account->fill_from_db("job_card_accounts", "record_id", "name");
$jc_account->class("search_inputs");
$jc_account->onchange("search_orders()");


?>

<div class="search_form">
    <?php
    // echo $html->input_html("PO NUMBER", "", "name", "name");
    // echo $html->input_html("JOBCARD NO", "", "jc_number", "jc_number");
    // echo $html->select_html_from_db("suppliers", "record_id", "name", "", "supplier_id", "supplier_id");
    // echo $html->submit_btn('submit', 'SEARCH', 'search_orders()'); ?>
    <?php
    $name->add();
    $jc_number->add();
    $jc_account->add();


    ?>
</div>

<?php
$ajax = new js_ajax();
$ajax->function_name("search_orders");
$ajax->select("costs");
$ajax->return_columns(['name', 'jc_number', 'job_card_account_id']);
$ajax->run_on_load();
$ajax->redirect("edit_cost.php");
?>