<script type="text/javascript" src="<?php echo base_url();?>assets/js/purchase.js"></script>
<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color">Purchase Entry Add</h1>
            <div class="breadcrumb_container"><?php echo breadcrumb_links();?></div>
        </div>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <form action="<?php echo $form_action;?>" method="post" name="purchase_form" class="add_form" enctype="multipart/form-data" method="post">    
                    <input type="hidden" name="hidden_id" value="" />    
                    <div class="box box-danger">
                        <div class="box-body">
                            <div class="box-body table-responsive" style="display: none;">
                                <div class="alert alert-danger alert-dismissable">
                                    <i class="fa fa-thumbs-o-down"></i>
                                    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                                    <h4></h4>
                                </div>
                            </div>
                            <ul class="error_container"></ul>
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                    <div class="form-group float-clear">
                                        <label>Supplier Name<span class="required">*</span></label>
                                        <select name="supplier_id" class="form-control select2">
                                            <option value="">Select Supplier Name</option>
                                            <?php foreach($suppliers as $key=>$supplier) {?>
                                                <option value="<?php echo $supplier->id;?>"><?php echo $supplier->name;?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <div class="form-group float-clear">
                                        <label>Invoice No<span class="required">*</span></label>
                                        <input type="text" class="form-control" name="invoice_no" value="<?php echo $inv_no; ?>" />
                                    </div>
                                    
                                    <div class="form-group float-clear">
                                        <label>Invoice Date<span class="required">*</span></label>
                                        <div class="input-group">
                                            <input type="text" class="form-control datepicker" name="invoice_date" placeholder="DD-MM-YYYY" value="<?php echo date("d-m-Y"); ?>" />
                                            <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                    <h4 class="major_txt_color">Item Details<span class="required">*</span></h4>
                                </div>
                            </div> 
                            
                            <div class="col-xs-12 item_container">
                                <div class="item float-clear">
                                    <div class="item_details">
                                        <input type="hidden" name="poi_id[0]" class="poi_id" value="" />
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <select name="category_id[0]" class="form-control select2 category_id" onchange="get_item_by_cat_id(this);">
                                                    <option value="">Select Category Name</option>
                                                    <?php foreach($categories as $key=>$category) {?>
                                                        <option value="<?php echo $category->id;?>"><?php echo $category->name;?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                        </div> 
                                        
                                        <div class="col-md-3">
                                            <div class="form-group">
                                                <select name="item_id[0]" class="form-control select2 item_id" onchange="get_unit_by_item_id(this);">
                                                    <option value="">Select Item Name</option>
                                                </select>
                                            </div>
                                        </div>
                                        
                                        <div class="col-md-1">
                                            <div class="form-group">
                                                <input type="text" class="form-control cls-w-70 qty integer_value" name="qty[0]" placeholder="Qty" onkeyup="calculate_amount_by_qty(this)" />
                                                <span class="uom" style="color:#0B45B3;"></span>
                                                <input type="hidden" class="form-control hidden_uom" name="hidden_uom[]" />
                                            </div>
                                        </div>
                                        
                                        <div class="col-md-2">
                                            <div class="form-group">
                                                <div class="input-group cls-w-100">
                                                    <div class="input-group-addon">$</div>
                                                    <input type="text" class="form-control float_value cls-w-100 price" name="price[0]" placeholder="Price" onkeyup="calculate_amount_by_price(this);" />
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div class="col-md-2">
                                            <div class="form-group">
                                                <div class="input-group cls-w-100">
                                                    <div class="input-group-addon">$</div>
                                                    <input type="text" class="form-control cls-w-100 amount sub_total" name="amount[0]" placeholder="Amount" readonly />
                                                </div>
                                            </div>
                                        </div>
                                        
                                    </div>
                                    <div class="add_row_action">
                                        <label class="">
                                            <i class="fa fa-2x fa-plus-circle addButton add-row addRow_color"></i>
                                        </label>
                                    </div>
                                </div>
                            </div> <br/>
                            
                            <div class="col-xs-12" style="margin-top:2%;">    
                                <div class="col-md-6">
                                    <div class="form-group float-clear">
                                        <label>Total Amount</label>
                                        <div class="input-group cls-w-100">
                                            <div class="input-group-addon">$</div>
                                            <input type="text" class="form-control" name="total" readonly />
                                        </div>
                                    </div>
                                    <div class="form-group float-clear">
                                        <label>Payment Status<span class="required">*</span></label>
                                        <select name="payment" class="form-control select2">
                                            <option value="1">Unpaid</option>
                                            <option value="2">Paid</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer form-actions float-clear">
                            <input class="btn reset" type="reset" value="Reset" />
                            <input type="submit" name="submit" value="Save" class="btn btn-success btn-primary" />
                        </div>
                    </div><!-- /.box -->
                </form>
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->

    </section><!-- /.content -->
</aside>