Subversion Repositories SmartDukaan

Rev

Rev 28645 | Blame | Compare with Previous | 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>
                        #if(!$sortedBrandValue.isEmpty() || !$priceDropBrandSixMonthMap.isEmpty())
                                                            
                        <tbody>
                        
                        
                         
                         #foreach($brand in $brands)
                         
                <tr> 
                               <td class="brand_name"><b>$brand</b></td>
                                 #set($total = 0.0)  
                              #if($priceDropBrandSixMonthMap.get($brand))
                                <td><button type="button" class="btn btn-primary price-drop-six-month" data-id="$fofoId" data-toggle="modal" data-target="#priceDropDetailsContainer">$priceDropBrandSixMonthMap.get($brand)</button></td>
                                  #set($total = $total + $priceDropBrandSixMonthMap.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 my-price-drop" data-id="$fofoId" data-toggle="modal" data-target="#priceDropDetailsContainer">$sortedBrandValue</button></td>
                                   #else
                                     <td><b>-</b></td>
                               #end
                        #end
                       #else
                       #foreach($ym in $ym )
                       <td>-</td>
                       #end
                       #end
                        #if($total != 0.0)
                           <td><b>$total</b></td>
                           #else
                           <td><b>0</b></td>
                           #end
                         </tr>
                                  #end
                        </tbody>
         #else
                        <tbody>
                        
                <tr>
                <td colspan="9"><h3>You do not have any Pending price drop</h3></td>
                 </tr>
             </tbody>
          #end
<div class="price-drop-details-container">
        <div id="priceDropDetailsContainer" class="modal" role="dialog">
                  <div class="modal-dialog modal-md">
                        <!-- Modal content-->
                        <div class="modal-content"  style="width: 300px;"></div>

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

                </table>
                
</section>
                
        <script>
        $(document).ready(function() {
        
        $(document).on('click', ".my-price-drop", 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 + "/getPriceDropDetails?fofoId=" + fofoId  + "&brand=" + brand + "&yearMonth=" + yearMonth, function (response) {
                        $('.price-drop-details-container .modal-content').html(response);
                    });    
   
   
    });
    
    $(document).on('click', ".price-drop-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 + "/getPriceDropDetailSixMonths?fofoId=" + fofoId  + "&brand=" + brand, function (response) {
                        $('.price-drop-details-container .modal-content').html(response);
                    });    
   
   
    });
     
       });       
        </script>