<script type="text/javascript">
var mydata = new Array();
var data = <?php echo $fields; ?>;
$(document).ready(function() {
    $("button").button();
    $("#fields").empty();        
        for (var k in data) {
                    if (data.hasOwnProperty(k)) {
                if(k=="pricesell")       
                fields= fields+"<tr><th align='right'>"+k+"</th><td style='vertical-align:middle'><input id='"+ k +"' name='"+ k +"' type='text' class='inp-form' value='"+ Encode(data[k])+"'/></td></tr>";
            else
                fields= fields+"<tr><th align='right'>"+k+"</th><td style='vertical-align:middle'><input id='"+ k +"' name='"+ k +"' type='text' class='inp-form' value='"+ data[k]+"'/></td></tr>";
                    }
                }
            $("#fields").append(fields);
});

</script>
<!--GET PRODUCT FROM PRODUCT'S TABLE-->
<style>
.ui-autocomplete-loading { background: white url('<?= site_url() ?>public/images/ui-anim_basic_16x16.gif') right center no-repeat; }
</style>
<script type="text/javascript">
    function Encode(message)
    {
        var alphabet, coded, i, ch, index;
        //012..9
        key = 'ABCDEFGHIJK';
        alphabet = "0123456789";

        coded = "";                                      
        for (i = 0; i < message.length; i++) {        
            ch = message.charAt(i);                   
            index = alphabet.indexOf(ch);             
            if (index == -1) {                        
                coded = coded + ch;                   
            }                                         
            else {                                    
                coded = coded + key.charAt(index);    
            }
        }
        return coded;
    }
</script>

<!-- Page Content -->
<div class="page-content">

    <!-- Page Header -->
    <div class="page-header position-relative">
        <div class="header-title">
            <h1>
             Product Label
         </h1>
     </div>
            
     <!--Header Buttons-->
     <div class="header-buttons">
        <a class="sidebar-toggler" href="#">
            <i class="fa fa-arrows-h"></i>
        </a>
        <a class="refresh" id="refresh-toggler" href="">
            <i class="glyphicon glyphicon-refresh"></i>
        </a>
        <a class="fullscreen" id="fullscreen-toggler" href="#">
            <i class="glyphicon glyphicon-fullscreen"></i>
        </a>
    </div>
    <!--Header Buttons End-->
</div>
<!-- /Page Header -->
<!-- Page Body -->
<div class="page-body" id="resources">
  <div class="well with-header">

<div class="table-scrollable">

    <?php
                    if (@$message) {
                        echo '
                              start message-green 
                            <div id="message-green">
                            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                            <tr>
                                    <td class="green-left">' . $message . ' <a href="' . site_url() . 'inventory/products/warehouses">Go to warehouse list.</a></td>
                                    <td class="green-right"><a class="close-green"><img src="' . site_url() . 'images/table/icon_close_green.gif"   alt="" /></a></td>
                            </tr>
                            </table>
                            </div>
                              end message-green 

    ';
                    }
                    ?>
                    <?= validation_errors('<div id="message-red"><table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td class="red-left">', '</td><td class="red-right"><a class="close-red"><img src="' . site_url() . '/images/table/icon_close_red.gif" alt="" /></a></td></tr></table></div>'); ?>


    
                                        <div class="myform">
                                        <form action="<?= site_url() . 'inventory/prodlabel/printlabel'; ?>" method="post" name="prodlabel" >
                                            <div class="myform-controls">
                                               <div class="row">
                                                <div class="col-md-12">
                                              
                                    <input id="productid" name="productid" value="<?= $productid ?>" type="hidden"/>
                                              
                                                 </div>  
                                                 </div>  
                                                 <div class="row">
                                                
                                                      <div class="col-md-12">
                                                         <div id="fields"></div>
                                                     </div>
                                                 </div>
                                                        
                                             <div class="row">
                                                 
                                                <div class="col-md-12">
                                              
                                                  
                                                    <button style="margin-left:60px;padding: 0px;" class="btn btn-success" type="submit" value="0" name="submit">Submit</button>
                                                      
                                                </div>

                                            </div>

                                        </form>
                                    </div>

</div>
</div>
</div>
<!-- /Page Body -->
</div>
<!-- /Page Content -->
</div>
<!-- /Page Container -->
<!-- Main Container -->
</div>

