Subversion Repositories SmartDukaan

Rev

Rev 26082 | Rev 26176 | 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">
                #if ($isAdmin)
                        <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>
                #else
                        <h3 class="page-header"><i class="icon_document_alt"></i>My Business Plan</h3>
                        <div style = "font-size:25px;font-weight:bold" >Monthly planning available for each month between 26 - 07</div>
                        #if($freezed&&$planningMonth)
                        <div style = "font-size:20px;font-weight:bold" >Monthly planning for $planningMonth Month Closed</div>
                        #else
                        <div style = "font-size:20px;font-weight:bold" >Monthly planning for $planningMonth Month</div>
                        #end
                        
                        
                #end
                </div>
                
                   <div class="col-lg-3" style="text-align:left;">
                
                                                <button type="button" class="btn btn-default previous-month" aria-label="Previous" >
                                                        $previousPlanningMonth</button> 
                                                <button type="button" class="btn btn-default current-month" aria-label="Current" >
                                                        $currentPlanningMonth</button> 
                </div>
        </div>
        
    <div>
        #if ($isAdmin)
        <div class="row">
                <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>
                                        <button class="download_indent btn btn-primary">Download</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>
        #end
                 <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 style="width:30%">Description</th>
                                                        <th style="width:12%">DP</th>
                                                        <th>MOP</th>
                                                        <th style="width:20%">Planned Qty</th>
                                                        #if($previousMonth)
                                                        <th style="width:6%">Sale</th>
                                                        #else           
                                                        <th style="width:6%">15 days sale</th>
                                                        #end
                                                        <th style="width:9%">In Stock</th>
                                                        <th style="width:9%">In Transit</th>
                                                        <th style="width:6%">Recommended</th>
                                                        <th style="width:6%">Minimum</th>
                                                        
                                            </tr>
                                        </thead>
                                        <tbody>
                                                #foreach( $modelListing in $catalogTagListings )
                                                <tr>
                                                        <td>$modelListing.getCatalogId()</td>
                                                        <td>$modelListing.getItemDescription()</td>
                                                        <td class="currency">$modelListing.getDp()</td>
                                                        <td class="currency">$modelListing.getMop()</td>
                                                        #if($freezed&&$previousMonth)
                                                        <td>
                                                        <input type="number" min="0" max="20" 
                                                        data-catalog-id="$modelListing.getCatalogId()"
                                                        data-selling-price="$modelListing.getDp()"
                                                        data-brand-name="$modelListing.getBrand()"
                                                        data-description="$modelListing.getItemDescription()" 
                                                        value="$modelListing.getAllocatedQuantity()" readonly/>
                                                        </td>
                                                        #elseif($freezed)
                                                        <td>
                                                        <input type="number" min="0" max="20" 
                                                        data-catalog-id="$modelListing.getCatalogId()"
                                                        data-selling-price="$modelListing.getDp()"
                                                        data-brand-name="$modelListing.getBrand()"
                                                        data-description="$modelListing.getItemDescription()" 
                                                        value="$modelListing.getAllocatedQuantity()" readonly/>
                                                        </td>
                                                        #else 
                                                        <td>
                                                        <input type="number" min="0" max="20" 
                                                        data-catalog-id="$modelListing.getCatalogId()"
                                                        data-selling-price="$modelListing.getDp()"
                                                        data-brand-name="$modelListing.getBrand()"
                                                        data-description="$modelListing.getItemDescription()" 
                                                        value="$modelListing.getAllocatedQuantity()"/>                                          
                                                        </td>
                                                        #end
                                                        #if($previousMonth)
                                                        <td>$modelListing.getLastMonthSaleMap()</td>
                                                        #else
                                                        <td>$modelListing.getLast15DaysSale()</td>
                                                        #end
                                                        <td>$modelListing.getStockInHand()</td>
                                                        <td>$modelListing.getInTransitQuantity()</td>
                                                        <td>$modelListing.getRecommendedQty()</td>
                                                        <td>$modelListing.getMinimumQty()</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">
                                #if(!$isAdmin)
                        <div class="panel-heading">Allocation Update Summary #if($retailerName) (Counter Size - $counterSize) #end</div>
                          <div class="panel-content">
                                  <div id="plansummary">
                                  </div>
                                  <div id="planbuttons">
                                               <!--  <button class="btn btn-primary mk_submit_indent">Update Allocation</button>
                                                  <button class="btn btn-primary bk_toedit_indent" style="display:none">Edit</button> -->
                                                  
                                                  #if($freezed&&$previousMonth)
                                                   <button class="btn btn-primary confirm_indent" disabled>Confirm Update</button>
                                                  #elseif($freezed)
                                                  <button class="btn btn-primary confirm_indent" disabled>Confirm Update</button>
                                                  #else
                                                   <button class="btn btn-primary confirm_indent" style="display:none">Confirm Update</button>
                                                  #end
                                          </div>
                          </div>
                        </div>
                        #else
                        #set($diff=$totalAmount - $walletAmount)
                        <div class="panel-heading">PO Summary(Total Amount in Wallet - <span class="currency">$walletAmount</span>)</div>
                          <div class="panel-content">
                                <table class="table table-sm" id="summary-table">
                                          <thead>
                                                            <tr>
                                                              <th class="col">#</th>
                                                              <th class="col">Total Pcs</th>
                                                              <th class="col">Amount to Pay</th>
                                                              <th class="col">Action</th>
                                                            </tr>
                                                          </thead>
                                                          <tbody>
                                                          #**
                                                            <tr>
                                                              <th class="row">Partial PO</th>
                                                              <td>$partialPcs</td>
                                                              <td>$partialAmount</td>
                                                              <td><button class="btn btn-sm btn-primary confirm_indent #if(${diff} > 0)disabled#end"
                                                              >Raise Partial PO</button></td>
                                                            </tr>
                                                           **#
                                                            <tr>
                                                              <th class="row">Complete PO</th>
                                                              <td>$totalPcs</td>
                                                              <td class="currency">$totalAmount</td>
                                                              #if($totalPcs)
                                                              <td><button class="btn btn-primary raise_po#if($diff > 0) disabled#end">Raise Complete PO</button></td>
                                                              #else
                                                              <td>Nothing to order!</td>
                                                              #end
                                                            </tr>
                                                          </tbody>      
                                </table>
                          #if($diff>0)
                                <div class="alert alert-warning">
                                                        <medium>Please add Rs.<span class="currency">$diff</span> to complete this transaction.</meduim>
                                                </div>
                                          #end
                          </div>
                        </div>
                        #end
                        
                
                        <div class="panel panel-default">
                                #if(!$isAdmin)
                        <div class="panel-heading">Brand Stock</div>
                          <div class="panel-content">
                                 <table class="table table-sm" id="stock-table">
                                          <thead>
                                                            <tr>
                                                              <th>Brand</th>
                                                              <th>Qty(pc)</th>
                                                              <th>Value</th>
                                                             
                                                            </tr>
                                                          </thead>
                                                          <tbody>
                                                        
                                                           #foreach( $brandStockPrice in $brandStockPrices )
                                                        <tr class="stockInfo" >
                                                                <td>$brandStockPrice.getBrand()</td>
                                                                <td>$brandStockPrice.getTotalQty()</td>
                                                                <td><span class="currency">$brandStockPrice.getTotalValue()</span></td>
                                                            </tr>
                                                            #end
                                                           </tbody>
                                                        </table>
                          </div>
                        </div>
                  #end
                </div>
           
                        #if($isAdmin)
                        <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>
                        #end
                        </div>
                </div>
        </div>
    
        
</section>
<script type="text/javascript">
totalAmount = $totalAmount;
/* 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": [
        
        
            { "visible": false }, null,null, null,
            { "orderDataType": "dom-text-numeric" }, null, null, null,null,null
        ],
        "lengthMenu":[[25,50],[25,50]],
        "order": []
        });
        indentMap = {};
        indentTable.rows().data().each(function(arr){
                var $input = $(arr[4]);
                quantity = parseInt($input.val(), 10);
                if(quantity > 0){
                         var brandName = arr[1].split(" ")[0];
                         if(indentMap[brandName] == undefined) {
                                 indentMap[brandName] = {};
                         }
                         indentMap[brandName][parseInt(arr[0])] 
                                                                = {"initialQuantity": quantity, "quantity": quantity, 
                                                                "sellingPrice":parseInt(arr[2]), "description": arr[1], "diff":0};
            }
        })
        $("#partnerId").typeahead({
          source: customRetailers,
          autoSelect: true,
          displayText:function(item){return item.businessName + "-" + item.address.city;},
          afterSelect:  function(currentItem){
                                                currentFofoId = currentItem.partnerId;
                                        }
        });
        populateIndentSummary();
});

</script>