<?php include "../../root.class.php";
$html = new html();
$html->add_styles_page();
$db = new db_safeguard();
$html->check_user_type("ADMIN");

$approval_label = new label();
$approval_label->for("approval_label");
$approval_label->value("APPROVAL");

$approval = new select();
$approval->name("approval");
$approval->id("approval");
$approval->add_option("APPROVED", "APPROVED");
$approval->add_option("REJECTED", "REJECTED");

$reasons_label = new label();
$reasons_label->for("reasons_label");
$reasons_label->value("RERASON FOR DECISION");

$reason = new input();
$reason->type("text");
$reason->name("reason");
$reason->id("reason");
$reason->placeholder("REASON FOR DECISION");
$reason->style("width: 50%; text-align: center;");

$request_pdf_btn = new button();
$request_pdf_btn->value("DELIVERY REQUEST PDF");
$request_pdf_btn->onclick("request_pdf()");

$submit_btn = new button();
$submit_btn->value("SUBMIT");
$submit_btn->onclick("submit_request()");

?>

<div class="form_down">
    <h1>DELIVERY REQUEST APPROVAL</h1>
    <br><br>
    <?php
    
    $request_pdf_btn->add();
    
    $approval_label->add();
    $approval->add();
    $reasons_label->add();
    $reason->add();

    $submit_btn->add();

    ?>
</div>

<?php
$ajax = new js_ajax();
$ajax->function_name("submit_request");
$ajax->update("delivery_request");


$request_ajax = new js_ajax();
$request_ajax->function_name("request_pdf");
$request_ajax->on_success("LOADING...");
$request_ajax->redirect("delivery_request.pdf.php?supplier_batch_no={$_GET['supplier_batch_no']}");