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

$jc_number = new input();
$jc_number->name("jc_number");
$jc_number->id("jc_number");
$jc_number->class("inputs");
$jc_number->placeholder("JOB CARD NUMBER");
$jc_number->type("text");
$jc_number->onkeyup("search_jobcard()");

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

$client_issue = new input();
$client_issue->name("client_reported_issue");
$client_issue->id("client_reported_issue");
$client_issue->class("inputs");
$client_issue->placeholder("DESCRIPTION");
$client_issue->type("text");
$client_issue->onkeyup("search_jobcard()");

$status = new select();
$status->name("status");
$status->id("status");
$status->class("inputs");
$status->onchange("search_jobcard()");
$status->add_option("", "STATUS");
$status->add_option("0", "INACTIVE");
$status->add_option("1", "SEND BACK TO TECHNICIAN");
$status->add_option("2", "PJ TO APPROVE");
$status->add_option("3", "SENT FOR QUOTATION");
$status->add_option("4", "WAITING PO");
$status->add_option("5", "WAITING PARTS");
$status->add_option("6", "DECLINED");
$status->add_option("7", "SEND FOR ACTION");
$status->add_option("8", "SEND FOR INVOICING");
$status->add_option("9", "INVOICED");
$status->add_option("10", "PJ TO ASSIGN");
$status->add_option("11", "WARRENTY NO CHARGE");

$account_manager_id = new select();
$account_manager_id->name("user_to_do");
$account_manager_id->id("user_to_do");
$account_manager_id->class("inputs");
$account_manager_id->add_option("", "TECHNICIAN");
$account_manager_id->fill_from_db("users", "record_id", "username", "user_type = 'TECHNICIANS' OR record_id = 25");
$account_manager_id->onchange("search_jobcard()");

?>

<div class="search_form">
    <?php
    $jc_number->add();
    $company_name->add();
    $client_issue->add();
    $status->add();
    $account_manager_id->add();
    ?>
</div>

<?php
$ajax = new js_ajax();
$ajax->run_on_load();
$ajax->function_name("search_jobcard");
// $ajax->submit_btn_id("submit");
$ajax->select("job_cards_tech");
$ajax->return_columns(['date_time_created', 'jc_number', 'company_address', 'company_name']);
$ajax->redirect("edit_tech_jobcard.php");
?>