Subversion Repositories SmartDukaan

Rev

Rev 23786 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<style>
        .btn:hover{
                color: grey;
                text-decoration: none;
        }
        .btn-primary:hover{
                color: grey;
                text-decoration: none;
        }
        .retailer-details{
                cursor:pointer;
        }
</style>

<section class="wrapper">            
        <div class="row">
                <div class="col-lg-12">
                        <h3 class="page-header"><i class="icon_document_alt"></i>Create/Edit Indent</h3>
                        <ol class="breadcrumb">
                                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
                                <li><i class="icon_document_alt"></i>Create/Edit Indent</li>
                        </ol>
                </div>
        </div>
        
    <div>
                 <div class="row">
                        <div class="col-lg-8" id="indent-container">
                                <table class="table table-striped table-condensed table-bordered" id="entire-catalog-table">
                                        <thead>
                                            <tr>
                                                                <th>Id</th>
                                                        <th>Description</th>
                                                        <th>Selling Price</th>
                                                        <th>MOP</th>
                                                        <th>Stock</th>
                                                        <th>30 days Sale</th>
                                                        <th>Required Quantity</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                #foreach( $tagListing in $tagListings )
                                                        #set($requestedQty=0)
                                                                #if($itemIndentMap.get($tagListing.getItemId()) and $itemIndentMap.get($tagListing.getItemId()).getRequestedQuantity() > 0 )
                                                                #set($requestedQty=$itemIndentMap.get($tagListing.getItemId()).getRequestedQuantity())
                                                                #end
                                                <tr>
                                                        <td>$tagListing.getItemId()</td>
                                                        <td>$tagListing.getItemDescription()</td>
                                                        <td>$tagListing.getSellingPrice()</td>
                                                        <td>$tagListing.getMop()</td>
                                                        <td>$tagListing.getStockInHand()</td>
                                                        <td>$tagListing.getLast30DaysSale()</td>
                                                        <td><input type="number" min="0" max="10" 
                                                        data-item-id="$tagListing.getItemId()"
                                                        data-selling-price="$tagListing.getSellingPrice()"
                                                        data-description="$tagListing.getItemDescription()" 
                                                        value="$requestedQty"/></td>
                                                </tr>
                                                #end
                                        </tbody>
                                </table>
                        </div>
                        <div class="col-lg-8" id="indent-container1" style="display:none"></div>
                        <div class="col-lg-3">
                                <div class="panel panel-default">
                          <div class="panel-heading">Indent Summary</div>
                          <div class="panel-content">
                                <ul class="list-group">
                                        <li class="list-group-item">Total Items - <span id="itemCount"></span></li>
                                        <li class="list-group-item">Total Qty - <span id="totalItemQty"></span> pcs</li>
                                        <li class="list-group-item">Total Amount - Rs.<span id="totalAmount"></span> </li>
                                </ul>
                                  <button class="btn btn-primary mk_submit_indent">Submit Indent</button>
                                  <button class="btn btn-primary bk_toedit_indent" style="display:none">Edit</button>
                                  <button class="btn btn-primary confirm_indent" style="display:none">Confirm Indent</button>
                          </div>
                        </div>
                        </div>
                </div>
        </div>
</section>
<script type="text/javascript">
/* Create an array with the values of all the input boxes in a column */
$.fn.dataTable.ext.order['dom-text'] = function  ( settings, col )
{
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
        return $('input', td).val();
    } );
}
 
/* Create an array with the values of all the input boxes in a column, parsed as numbers */
$.fn.dataTable.ext.order['dom-text-numeric'] = function  ( settings, col )
{
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
        return $('input', td).val() * 1;
    } );
}
 
/* Create an array with the values of all the select options in a column */
$.fn.dataTable.ext.order['dom-select'] = function  ( settings, col )
{
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
        return $('select', td).val();
    } );
}
 
/* Create an array with the values of all the checkboxes in a column */
$.fn.dataTable.ext.order['dom-checkbox'] = function  ( settings, col )
{
    return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) {
        return $('input', td).prop('checked') ? '1' : '0';
    } );
}
 
/* Initialise the table with the required column ordering data types */
$(document).ready(function() {
    indentTable = $('#entire-catalog-table').DataTable({
        "columns": [
            null,null, null, null, null, null,
            { "orderDataType": "dom-text-numeric" }
        ]
        });
        indentMap = {};
        indentTable.rows().data().each(function(arr){
                var $input = $(arr[6]);
                quantity = parseInt($input.val(), 10);
                if(quantity > 0){
                        indentMap[parseInt(arr[0])] = {"quantity": quantity, "sellingPrice":parseInt(arr[2]), "description": arr[1]}
            }
        });
        populateIndentSummary();
        
});

</script>