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



$item_code = new input();
$item_code->id("item_code");
$item_code->name("item_code");
$item_code->class("inputs");
$item_code->type("text");
?>

<div class="form_down">
    <h1>ADD STOCK</h1>
    <label>TYPE</label>
    <select id="stock_type" name="stock_type" class="inputs">
        <option></option>
        <option value="0">STOCK</option>
        <option value="1">NON STOCK</option>
        <option value="2">UNITS</option>
    </select>
    <label>XERO ITEM CODE</label>
    <?php $item_code->add(); ?>
    <label>CATEGORY</label>
    <?php echo $html->select_html_from_db('stock_categories', 'record_id', 'name', "1", 'category_id', 'category_id'); ?>
    <label>SUPPLIER</label>
    <?php echo $html->select_html_from_db('suppliers', 'record_id', 'name', "1", 'supplier_id', 'supplier_id'); ?>
    <label>DESCRIPTION</label>
    <textarea name="description" id="description" class="inputs"></textarea>
    <?php echo $html->input_html("packaging size", "", "packaging_size", "packaging_size"); ?>

    <?php echo $html->input_html("Cost Price", "", "cost_price", "cost_price"); ?>

    <?php echo $html->input_html("Adjustment Type", "X", "adjustment_type", "adjustment_type"); ?>
    
    <?php echo $html->input_html("Amount", "1", "amount", "amount"); ?>

    <?php echo $html->input_html("MAX STOCK AMOUNT", "", "max", "max"); ?>

    <?php echo $html->input_html("MIN STOCK AMOUNT", "", "min", "min"); ?>

    <?php echo $html->input_html("Bar/QR-code", "", "barcode", "barcode"); ?>
    <?php echo $barcode->add_button("barcode"); ?>
    <?php echo $html->QRCodeScanner("barcode"); ?>
    <?php echo $html->submit_btn("submit", 'SAVE', 'stock()', 'select_button'); ?>

</div>

<?php
$html->html_form_ajax("stock", "INSERT", "stock", '', false, [], '', [], 'barcode-zoom-control-0,');
?>