<?php

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

$name = new input();
$name->id("name");
$name->name("name");
$name->type("text");
$name->placeholder("Name");
$name->class();
$name->onkeyup("search_asset()");

$company_id = new input();
$company_id->class("inputs");
$company_id->type("hidden");
$company_id->placeholder("company id");
$company_id->name("company_id");
$company_id->required();
$company_id->id("company_id");
$company_id->value($_SESSION['company_id']);

$fleet_number = new input();
$fleet_number->id("fleet_number");
$fleet_number->name("fleet_number");
$fleet_number->type("text");
$fleet_number->placeholder("Fleet Number");
$fleet_number->class();
$fleet_number->onkeyup("search_asset()");

$barcode = new input();
$barcode->id("barcode");
$barcode->name("barcode");
$barcode->type("text");
$barcode->placeholder("Barcode");
$barcode->class();
$barcode->onkeyup("search_asset()");

$status = new select();
$status->id("status");
$status->name("status");
$status->onchange("search_asset()");
$status->add_option("1","Active");
$status->add_option("0","Inactive");
$status->class();

?>

<div class="row">
    <input type="submit" value="ADD" class="submit_btn" onclick="window.location.href='add_asset.php'">
    <div class="form_down">
        <?php
        $name->add();
        $fleet_number->add();
        $status->add();
        $company_id->add();
        ?>
    </div>
</div>

<?php

$ajax = new js_ajax();
$ajax->run_on_load();
$ajax->select("assets");
$ajax->function_name("search_asset");
$ajax->redirect("edit_asset.php");
$ajax->return_columns(["name","fleet_number","barcode"]);