Subversion Repositories SmartDukaan

Rev

Rev 29707 | Blame | Compare with Previous | Last modification | View Log | RSS feed

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

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

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

}
</style>
<section>
<table class="table table-striped upgradeTable"  >
        <thead>
                         <tr class="upgrade-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>
                
             <tr> 
                   <td class="brand_name"><b>$brand</b></td>
                         #set($total = 0.0)  
                         
                          
                        #if($pendingUpgradeOfferBeforeSixMonthMap.get($brand))
                        <td><button type="button" class="btn btn-primary offer-before-six-month" data-id="$fofoId" data-toggle="modal" data-target="#upgradeDetailsContainer">$pendingUpgradeOfferBeforeSixMonthMap.get($brand)</button></td>
                          #set($total = $total + $pendingUpgradeOfferBeforeSixMonthMap.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 upgrade-offer-yearmonth" data-id="$fofoId"Ract data-toggle="modal" data-target="#upgradeDetailsContainer">$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>
                

        </tbody>
     

<div class="upgrade-details-container">
        <div id="upgradeDetailsContainer" 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', ".upgrade-offer-yearmonth", function() {
          var fofoId= $(this).data('id');
                var brand = $(this).closest("tr").children('td:first').text();
        
          var yearMonth = $(this).closest('table').find('.upgrade-header input[type=hidden]').eq( $(this).closest("td").index()-2).val();
            console.log("id"+yearMonth+brand+fofoId);
           doGetAjaxRequestHandler(context + "/getMonthlyUpgradeOfferItemDetail?fofoId=" + fofoId  + "&brand=" + brand + "&yearMonth=" + yearMonth, function (response) {
                                $('.upgrade-details-container .modal-content').html(response);
                            });    
           
           
            });
    
    $(document).on('click', ".offer-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 + "/getUpgradeOfferBeforeSixMonthItemDetail?fofoId=" + fofoId  + "&brand=" + brand, function (response) {
                                        $('.upgrade-details-container .modal-content').html(response);
                });    
   
                   
   
    });
     
       });       
</script>
                
</section>