Subversion Repositories SmartDukaan

Rev

Rev 23405 | Rev 23796 | 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 Allocation</h3>
                        <ol class="breadcrumb">
                                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
                                #if($retailerName)
                                <script type="text/javascript">
                                        currentFofoId=${retailerId};
                                </script>
                                <li><i class="icon_document_alt"></i><b>Allocation for $retailerName (Counter Size - $counterSize)</b></li>
                                #else
                                <li><i class="icon_document_alt"></i><b>Standard Allocation (Counter Size - $counterSize)</b></li>
                                #end
                        </ol>
                </div>
        </div>
        
    <div>
        <div class="row">
                <!--<div class="col-lg-3">
                <div class="input-group">
                    <input type="text" class="form-control">
                    <div class="input-group-btn">
                        <button type="button" class="btn btn-default">Get Partner Allocation</span></button>
                    </div>
                </div>
            </div>-->
                <div class="col-lg-3">
                <div class="input-group">
                                <input id="partnerId" type="text" class="typeahead form-control form-control-sm" placeholder="Search Partner by Store" data-provide="typeahead" 
                                 #if(${retailerName}) value="${retailerName}" #end
                                 autocomplete="off"/>
                        <div class="input-group-btn">
                                        <button class="create_indent btn btn-primary">Get Partner Allocation</button>
                                </div>
                        </div>
                </div>
                    <div class="col-lg-3">
                            <div class="dropdown">
                                        <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">Change Counter Size
                                          <span class="caret"></span></button>
                                          <ul class="dropdown-menu">
                                          #foreach($counterSiz in $counterSizes)
                                            <li class="mk_counter_size #if(${counterSiz}==${counterSize}) active#end"><a href="javascript:void(0)">$counterSiz</a></li>
                                          #end
                                        </ul>
                                </div>
                </div>
        </div>
                 <div class="row">
                        <div class="col-lg-7" 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>Allocated Quantity</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                #foreach( $tagListing in $tagListings )
                                                <tr>
                                                        <td>$tagListing.getItemId()</td>
                                                        <td>$tagListing.getItemDescription()</td>
                                                        <td class="currency">$tagListing.getSellingPrice()</td>
                                                        <td class="currency">$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="$tagListing.getAllocatedQuantity()"/></td>
                                                </tr>
                                                #end
                                        </tbody>
                                </table>
                        </div>
                        <div class="col-lg-7" id="indent-container1" style="display:none"></div>
                        <div class="col-lg-4">
                                <div class="panel panel-default">
                          <div class="panel-heading">Allocation Update Summary #if($retailerName) (Counter Size - $counterSize) #end</div>
                          <div class="panel-content">
                                <table class="table table-sm" id="summary-table">
                                          <thead>
                                                            <tr>
                                                              <th class="col">#</th>
                                                              <th class="col">Items</th>
                                                              <th class="col">Quantity</th>
                                                              <th class="col">Amount</th>
                                                            </tr>
                                                          </thead>
                                                          <tbody>
                                                            <tr>
                                                              <th class="row">Initial</th>
                                                              <td></td>
                                                              <td></td>
                                                              <td></th>
                                                            </tr>
                                                            <tr>
                                                              <th class="row">Added</th>
                                                              <td></td>
                                                              <td></td>
                                                              <td></th>
                                                            </tr>
                                                            <tr>
                                                              <th class="row">Removed</th>
                                                              <td></td>
                                                              <td></td>
                                                              <td></th>
                                                            </tr>
                                                            <tr>
                                                              <th class="row">Final</th>
                                                              <td></td>
                                                              <td></td>
                                                              <td></th>
                                                            </tr>
                                                          <tbody>
                                </table>
                                  <button class="btn btn-primary mk_submit_indent">Update Allocation</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 Update</button>
                          </div>
                        </div>
                        <div class="panel panel-default">
                                <div class="panel-heading">Brandwise Target and Performance</div>
                                <div class="panel-content">
                                <ul class="nav nav-tabs">
                                                  <li role="presentation" class="active brandLi"><a href="javascript:void(0)">Mobiles</a></li>
                                                  <li role="presentation" class="brandLi"><a href="javascript:void(0)">Accessories</a></li>
                                                </ul>

                                                <table class="brandPerformance table table-striped table-condensed table-bordered">
                                                        <thead>
                                                                <tr>
                                                                        <th rowspan="2">Brand Name</th>
                                                                        <th rowspan="2" align="center">Target Value</th>
                                                                        <th colspan="2" align="center">Achieved</th>
                                                                        <th colspan="2">Brand Share(%)</th>
                                                                </tr>
                                                                <tr>
                                                                        <th>Value</th>
                                                                        <th>Percentage</th>
                                                                        <th>Target</th>
                                                                        <th>Achieved</th>
                                                                </tr>
                                                        </thead>
                                                        <tbody>
                                                        #foreach($brandPerformance in $brandPerformanceList)
                                                                <tr>
                                                                        <th>$brandPerformance.getBrandName()</th>
                                                                        <td class="currency">$brandPerformance.getTarget()</td>
                                                                        <td class="currency">$brandPerformance.getAchieved()</td>
                                                                        <td>$brandPerformance.getAchievedPercentage()%</td>
                                                                        <td>$brandPerformance.getBrandTargetShare()</td>
                                                                        <td>$brandPerformance.getBrandAchievedShare()</td>
                                                                </tr>
                                                        #end
                                                        <tbody>
                                                        </tbody>
                                                </table>
                                                <table style="display:none" class="table brandPerformance table-striped table-condensed table-bordered">
                                                        <thead>
                                                                <tr>
                                                                        <th rowspan="2">Brand Name</th>
                                                                        <th rowspan="2" align="center">Target Value</th>
                                                                        <th colspan="2" align="center">Achieved</th>
                                                                        <th colspan="2">Brand Share(%)</th>
                                                                </tr>
                                                                <tr>
                                                                        <th>Value</th>
                                                                        <th>Percentage</th>
                                                                        <th>Target</th>
                                                                        <th>Achieved</th>
                                                                </tr>
                                                        </thead>
                                                        <tbody>
                                                        #foreach($brandPerformance in $accsBrandPerformanceList)
                                                                <tr>
                                                                        <th>$brandPerformance.getBrandName()</th>
                                                                        <td>$brandPerformance.getTarget()</td>
                                                                        <td>$brandPerformance.getAchieved()</td>
                                                                        <td>$brandPerformance.getAchievedPercentage()%</td>
                                                                        <td>$brandPerformance.getBrandTargetShare()</td>
                                                                        <td>$brandPerformance.getBrandAchievedShare()</td>
                                                                </tr>
                                                        #end
                                                        <tbody>
                                                        </tbody>
                                                </table>
                                </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 */
var customRetailers = ${customRetailers};
$(document).ready(function() {
    indentTable = $('#entire-catalog-table').DataTable({
        "scrollY":"600px",
        "columns": [
            null,null, null, null, null, null,
            { "orderDataType": "dom-text-numeric" }
        ],
        "lengthMenu":[[25,50],[25,50]]
        });
        indentMap = {};
        indentTable.rows().data().each(function(arr){
                var $input = $(arr[6]);
                quantity = parseInt($input.val(), 10);
                if(quantity > 0){
                        indentMap[parseInt(arr[0])] = {"initialQuantity": quantity, "quantity": quantity, "sellingPrice":parseInt(arr[2]), "description": arr[1], "diff":0};
            }
        });
        $(".typeahead").typeahead({
          source: customRetailers,
          autoSelect: true,
          displayText:function(item){return item.businessName + "-" + item.address.city;},
          afterSelect:  function(currentItem){
                                                currentFofoId = currentItem.partnerId;
                                        }
        });
        populateIndentSummary();
});

</script>