<script type="text/javascript" src="<?php echo base_url();?>assets/js/inv_item.js"></script>
<aside class="right-side">
    <section class="content-header">
        <div class="title_bar">
            <h1 class="major_txt_color">Item Edit</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="inv_item_form" enctype="multipart/form-data" method="post">    
                    <input type="hidden" name="hidden_id" value="<?php echo $inv_item->id;?>" />    
                    <div class="box box-danger">
                        <div class="box-body">
                            <ul class="error_container"></ul>
                            <div class="col-xs-12">
                                <div class="col-md-6">
                                	<div class="row">
                                    	<div class="col-md-12"> 
                                            <div class="form-group float-clear">
                                                <input type="text" class="form-control readonly" name="code" placeholder="Item Code" autofocus value="<?php echo $inv_item->code;?>" readonly style="min-width: 100%;" />
                                            </div>
                                            
                                            <div class="form-group float-clear">
                                                <?php if($used_item == 1) { ?> 
                                                    <input type="text" class="form-control" value="<?php echo $inv_item->name;?>" readonly style="min-width: 100%;"  />
                                                    <input type="hidden" class="form-control" name="category_id" value="<?php echo $inv_item->category_id;?>"  />
                                                <?php } else {?> 
                                                    <select name="category_id" class="form-control select2" style="min-width: 100%;">
                                                        <option value="">Select Category</option>
                                                        <?php foreach($categories as $key=>$category) {?>
                                                            <option value="<?php echo $category->id;?>" <?php echo ($category->id == $inv_item->category_id) ? 'selected' : '';?> ><?php echo $category->name;?></option>
                                                        <?php } ?>
                                                        
                                                    </select>
                                                <?php } ?>
                                            </div>
                                            
                                            <div class="form-group float-clear inv_item" >
                                                <input type="text" class="form-control" name="item_name" placeholder="Item Name" value="<?php echo $inv_item->item_name;?>" style="min-width: 100%;" />
                                            </div>
                                            
                                            <div class="form-group float-clear">
                                                <select name="unit_id" class="form-control select2" style="min-width: 100%;">
                                                    <option value="">Select Unit</option>
                                                    <?php foreach($units as $key=>$unit) {?>
                                                        <option value="<?php echo $unit->id;?>" <?php echo ($unit->id == $inv_item->uom) ? 'selected' : '';?>><?php echo $unit->unit_name;?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                       
                                             <div class="form-group float-clear">
                                                <input type="text" class="form-control integer_value" name="quantity" placeholder="0" value="<?php echo $inv_item->quantity;?>" style="min-width: 100%;" />
                                            </div>
                                            
                                             <div class="form-group float-clear">
                                                <div class="input-group" style="min-width: 100%;">
                                                    <div class="input-group-addon">$</div>
                                                    <input type="text" class="form-control float_value" name="price" placeholder="0.00" value="<?php echo $inv_item->selling_price;?>" style="min-width: 100%;" />
                                                </div>
                                            </div>
                                            
                                             <div class="form-group float-clear">
                                                <textarea class="form-control" name="desc" style="min-width: 100%;"><?php echo $inv_item->description;?></textarea>
                                            </div>
                                            
                                            <div class="form-actions float-clear">
                                                <input type="submit" name="submit" value="Update" class="btn btn-primary" style="padding: 5px 50px;"/>
                                                <input class="btn btn-primary reset" type="reset" value="Reset" style="padding: 5px 50px;"/>                            
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        
                        <div class="box-footer form-actions float-clear">&nbsp;</div>
                    </div><!-- /.box -->
                </form>
            </div><!-- /.col-xs-12 -->
        </div><!-- /.row -->
    </section><!-- /.content -->
</aside>