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

// HTML FORM ELEMENTS
$username = new input();
$username->class("inputs");
$username->type("text");
$username->placeholder("username");
$username->name("username");
$username->id("username");
$username->onkeyup("search_user()");

$user_type = new select();
$user_type->class("inputs");
$user_type->name("user_type");
$user_type->id("user_type");
$user_type->add_option("", "USER TYPE");
$user_type->onchange("search_user()");
$user_type->fill_from_db("user_types", "name", "name");



$user_type_label = new label();
$user_type_label->for("user_type");
$user_type_label->value("User Type");



$submit_btn = new button();
$submit_btn->value("SEARCH");
$submit_btn->onclick("search_user()");



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

            <div class="search_form">
                <div class="row">

                    <div class="row">
                        <?php $username->add(); ?>
                        <?php $user_type->add(); ?>
                        <?php //$submit_btn->add(); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <?php
    $ajax = new js_ajax();
    $ajax->run_on_load();
    $ajax->function_name("search_user");
    // $ajax->submit_btn_id("submit");
    $ajax->select("users");
    $ajax->return_columns(['username', 'user_type','email']);
    $ajax->redirect("edit_user.php");
    ?>