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

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

$contact_person = new input();
$contact_person->class("inputs");
$contact_person->type("text");
$contact_person->placeholder("CONTACT PERSON");
$contact_person->name("contact_person");
$contact_person->id("contact_person");
$contact_person->onkeyup("search_client()");

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


$status = new select();
$status->class("inputs");
$status->name("status");
$status->id("status");
$status->add_option("", "STATUS");
$status->add_option("ACTIVE", "ACTIVE");
$status->add_option("INACTIVE", "INACTIVE");
$status->onchange("search_client()");
?>
<div class="column">
    <div class="banner">
        <div class="row">
            <?php echo $html->selectable_block("add_client.php", "ADD"); ?>

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

                    <div class="row">
                        <?php $client_name->add(); ?>
                        <?php $contact_person->add(); ?>
                        <?php $company_name->add(); ?>
                        <?php $status->add(); ?>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <?php
    $ajax = new js_ajax();
    $ajax->run_on_load();
    $ajax->function_name("search_client");
    $ajax->select("clients");
    $ajax->return_columns(['client_name', 'contact_person','company_name','status']);
    $ajax->redirect("edit_client.php");
    ?>