Subversion Repositories SmartDukaan

Rev

Blame | Last modification | View Log | RSS feed

<style>
.priceTable tr th{
   
    padding-bottom:6px;
}

.priceTable tr td{
   
    padding-bottom:6px;
}

.modal {
     left: 1037px;
    top: 39px; 

}
</style>
<section>
<table class="table table-striped priceTable"  >
        <thead>
                         <tr class="price-drop-header">
                                <th>Brand</th>
                                <th>Before $yms.get(0).format($dateYearMonthFormatter)</th>
                                
                                #foreach($ym in $yms )
                                 <th> <input type="hidden" value="$ym.format($dateMonthYearFormatter)"/> $ym.format($dateYearMonthFormatter)</th>
                                 #end
                                 <th>Total</th> 
                        </tr>
        </thead>
        
        <tbody>
        
           #foreach($brand in $brands)
             <tr> 
                   <td class="brand_name"><b>$brand</b></td>
                         #set($total = 0.0)  
                         
                          
                        #if($pendingActivationBeforeSixMonthMap.get($brand))
                        <td><button type="button" class="btn btn-primary activation-before-six-month" data-id="$fofoId" data-toggle="modal" data-target="#activationDetailsContainer">$pendingActivationBeforeSixMonthMap.get($brand)</button></td>
                          #set($total = $total + $pendingActivationBeforeSixMonthMap.get($brand))
                     #else
                       <td>-</td>
                     #end
                      
                      
                 #if($sortedBrandValue.get($brand))
                 #foreach($sortedBrandValue in $sortedBrandValue.get($brand))
                    #set($total = $total + $sortedBrandValue)
                           #if($sortedBrandValue != 0.0)                                 
                     <td><button type="button" class="btn btn-primary activation-yearmonth" data-id="$fofoId" data-toggle="modal" data-target="#activationDetailsContainer">$sortedBrandValue</button></td>
                                   #else
                                     <td><b>-</b></td>
                               #end
                        #end
                  
                       #end
                        #if($total != 0.0)
                           <td><b>$total</b></td>
                           #else
                           <td><b>0</b></td>
                           #end
                </tr>
                  #end
        </tbody>
     

<div class="activation-details-container">
        <div id="activationDetailsContainer" class="modal" role="dialog">
                  <div class="modal-dialog modal-md">
                        <!-- Modal content-->
                        <div class="modal-content"  style="width: 500px;"></div>

                </div>
        </div>
</div>
</table>


<script>
        $(document).ready(function() {
        
        $(document).on('click', ".activation-yearmonth", function() {
          var fofoId= $(this).data('id');
                var brand = $(this).closest("tr").children('td:first').text();
        
          var yearMonth = $(this).closest('table').find('.price-drop-header input[type=hidden]').eq( $(this).closest("td").index()-2).val();
            console.log("id"+yearMonth+brand+fofoId);
           doGetAjaxRequestHandler(context + "/getMonthlyActivationItemDetail?fofoId=" + fofoId  + "&brand=" + brand + "&yearMonth=" + yearMonth, function (response) {
                                $('.activation-details-container .modal-content').html(response);
                            });    
           
           
            });
    
    $(document).on('click', ".activation-before-six-month", function() {
          var fofoId= $(this).data('id');
          var brand = $(this).closest("tr").children('td:first').text();
        
     console.log("id"+brand);
      console.log("fofoId"+fofoId);
      
      
                   doGetAjaxRequestHandler(context + "/getMonthlyActivationBeforeSixMonthsItemDetail?fofoId=" + fofoId  + "&brand=" + brand, function (response) {
                                        $('.activation-details-container .modal-content').html(response);
                });    
   
                   
   
    });
     
       });       
</script>
                
</section>