<?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->required();
$username->id("username");

$password = new input();
$password->class("inputs");
$password->type("text");
$password->placeholder("password");
$password->name("user_password");
$password->required();
$password->id("user_password");

$user_type = new select();
$user_type->class("inputs");
$user_type->name("user_type");
$user_type->id("user_type");
$user_type->required();
$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("ADD");
$submit_btn->onclick("add_user()");

?>

<div class="form_down">
    <h1>ADD USER</h1>
    <?php
    $username->add();
    $password->add();
    $user_type_label->add();
    $user_type->add();
    $submit_btn->add();
    ?>
</div>

<?php
// $html->html_form_ajax("add_user", "INSERT", "users", '', false);
$ajax = new js_ajax();
$ajax->function_name("add_user");
$ajax->submit_btn_id("submit");
$ajax->insert("users");
$ajax->on_success("SUCCESSFULLY ADDED THE USER");

?>
