<?php include "../../root.class.php";
$html = new html();
$html->add_styles_page();
// $html->check_user_type("ADMIN");

// HTML FORM ELEMENTS
$name = new input();
$name->class("inputs");
$name->type("text");
$name->placeholder("CLIENT NAME");
$name->name("name");
$name->required();
$name->id("name");

$contact_number = new input();
$contact_number->class("inputs");
$contact_number->type("text");
$contact_number->placeholder("CONTACT NUMBER");
$contact_number->name("contact_number");
$contact_number->required();
$contact_number->id("contact_number");

$contact_number_label = new label();
$contact_number_label->for("CONTACT_NUMBER");
$contact_number_label->value("CONTACT NUMBER");

$status = new select();
$status->class("inputs");
$status->name("status");
$status->id("status");
$status->add_option("", "STATUS");
$status->fill_from_db("status", "name", "name");

$name_label = new label();
$name_label->for("NAME");
$name_label->value("NAME");

$status_label = new label();
$status_label->for("STATUS");
$status_label->value("STATUS");

$location = new input();
$location->class("inputs");
$location->type("text");
$location->placeholder("LOCATION");
$location->name("location");
$location->required();
$location->id("location");

$location_label = new label();
$location_label->for("LOCATION");
$location_label->value("LOCATION");

$co_ordinates = new input();
$co_ordinates->class("inputs");
$co_ordinates->type("text");
$co_ordinates->placeholder("CO_ORDINATES");
$co_ordinates->name("co_ordinates");
$co_ordinates->required();
$co_ordinates->id("co_ordinates");

$co_ordinates_label = new label();
$co_ordinates_label->for("CO_ORDINATES");
$co_ordinates_label->value("CO_ORDINATES");

$submit_btn = new button();
$submit_btn->value("SEARCH");
$submit_btn->onclick("add_clients()");

?>

<div class="form_down">
    <h1>ADD CLIENTS</h1>
    <?php
    $name_label->add();
    $name->add();
    $contact_number_label->add();
    $contact_number->add();

    $location_label->add();
    $location->add();
    $co_ordinates_label->add();
    $co_ordinates->add();
    $status_label->add();
    $status->add();

    $submit_btn->add();
    ?>
</div>

<?php
$ajax = new js_ajax();
$ajax->function_name("add_clients");
$ajax->submit_btn_id("submit");
$ajax->insert("clients");
$ajax->on_success("CLIENTS ADDED SUCCESSFULLY");

?>