<?php include "../../root.class.php";
$html = new html();
$html->add_styles_page();
$db = new db_safeguard();
// $html->check_user_type("ADMIN");


$upload_report_label = new label();
$upload_report_label->for("coa_delivery_request_label");
$upload_report_label->value("UPLOAD REPORT / CERTIFICATE OF ANALYSIS");

$upload_report = new file_upload();
$upload_report->class("inputs");
$upload_report->name("coa_delivery_request");
$upload_report->id("coa_delivery_request");
$upload_report->file_save_path("../supplier/coa_delivery_request/");
$upload_report->file_type("image/png");
$upload_report->style("width: 50%;");

$requirements_label = new label();
$requirements_label->for("requirements_label");
$requirements_label->value("ARE ALL REQUIREMENTS FROM THE COA WITHIN THE ACCEPTABLE LIMITS?");

$requirements = new select();
$requirements->name("requirements_within_limits");
$requirements->id("requirements_within_limits");
$requirements->add_option("", "Requirements Within Limits");
$requirements->add_option("YES", "YES");
$requirements->add_option("NO", "NO");

$comments_label = new label();
$comments_label->for("comments");
$comments_label->value("COMMENTS");

$comments = new input();
$comments->type("text");
$comments->name("comments");
$comments->id("comments");
$comments->placeholder("Comments");
$comments->style("width: 50%;");

$submit_btn = new button();
$submit_btn->class("submit_btn");
$submit_btn->id("submit");
$submit_btn->value("SUBMIT REQUEST");
$submit_btn->onclick("request()");

?>

<div class="form_down">
    <h1>CAPTURING COA DELIVERY REQUESTS</h1>
    <?php
    $upload_report_label->add();
    $upload_report->add();
    $requirements_label->add();
    $requirements->add();
    $comments_label->add();
    $comments->add();
    $submit_btn->add();
    ?>
</div>

<?php

$ajax = new js_ajax();
$ajax->function_name("request");
$ajax->submit_btn_id("submit");
$ajax->insert("delivery_request");
$ajax->on_success("REQUEST SUBMITTED SUCCESSFULLY");
$ajax->redirect("delivery_request.pdf.php?supplier_batch_no=$supplier_batch_id");