<?php

include "../../root.class.php";

$html = new html();
$html->add_styles_page();

$client_name = new input();
$client_name->id("client_name");
$client_name->name("client_name");
$client_name->type("text");
$client_name->placeholder("Client Name");
$client_name->class();
$client_name->required();

$client_email = new input();
$client_email->id("client_email");
$client_email->name("client_email");
$client_email->type("email");
$client_email->placeholder("Client Email");
$client_email->class();
// $client_email->required();

$client_address = new input();
$client_address->id("client_address");
$client_address->name("client_address");
$client_address->type("text");
$client_address->placeholder("Client Address");
$client_address->class();
// $client_address->required();

$price = new input();
$price->id("price");
$price->name("price");
$price->type("text");
$price->placeholder("Client Contact");
$price->class();
$price->required();


$client_contact = new input();
$client_contact->id("client_contact");
$client_contact->name("client_contact");
$client_contact->type("text");
$client_contact->placeholder("Client Contact");
$client_contact->class();
// $client_contact->required();

$client_status = new select();
$client_status->id("client_status");
$client_status->name("client_status");
$client_status->class();
$client_status->add_option("", "STATUS");
$client_status->add_option("1", "Active");
$client_status->add_option("0", "Inactive");
$client_status->required();

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


$add_client = new button();
$add_client->id("add_client");
$add_client->name("add_client");
$add_client->value("Add Client");
$add_client->class();
$add_client->onclick("add_client()");


?>

<div class="form_down">
    <?php
    echo "<label>Client Name</label>";
    $client_name->add();
    echo "<label>Client Email</label>";
    $client_email->add();
    echo "<label>Client Address</label>";
    $client_address->add();
    echo "<label>Client Contact</label>";
    $client_contact->add();
    echo "<label>Client Status</label>";
    $client_status->add();
    echo "<label>Rand Per Liter</label>";
    $price->add();
    $company_id->add();
    $add_client->add();
    ?>
</div>

<?php

$ajax = new js_ajax();
$ajax->function_name("add_client");
$ajax->insert("clients");
$ajax->on_success("CLIENT ADDED SUCCESSFULLY");
$ajax->redirect("home.php");