Subversion Repositories SmartDukaan

Rev

Rev 35668 | Rev 35697 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<div class="modal-header">
    <button type="button" class="close" id="cancel-model" data-dismiss="modal">&times;</button>
    <h4 class="modal-title">Terms & Conditions</h4>
</div>

<div class="modal-body" style="height:500px;overflow:auto">
    <div style="margin-top: 15px;" class="offer-margin-table">

        ## Offer Description
        <div class="row">
            <div class="col-lg-12">
                <div style="font-size:20px; font-weight:bold" class="pull-left">
                    $vmUtils.html($offer.getDescription())
                </div>
            </div>
        </div>

        <div class="row">
            ## Base Criteria Section (if applicable)
            #if($offer.isBaseCriteria())
            <div class="col-lg-12">
                <h5 style="text-align: left">Base Criteria - </h5>
                <div style="text-align:left">$offer.getItemCriteriaString()</div>
            </div>
            #end

            ## Main Offer Table
            <div class="col-lg-12">
                <table class="table table-bordered table-sm">

                    ## ===== TABLE HEADER =====
                    <thead>
                        <tr>
                            <th rowspan="2">Models</th>
                            <th rowspan="2">Target</th>

                            ## Base Sale columns - only for retailers (not admin)
                            #if(!$isAdmin)
                                #if($offer.isActivation())
                                    <th colspan="2">Base Sale</th>
                                #else
                                    <th rowspan="2">Billed</th>
                                #end
                            #end

                            ## Model Sale columns - only for retailers when baseCriteria=true
                            #if(!$isAdmin && $offer.isBaseCriteria())
                                #if($offer.isActivation())
                                    <th colspan="2">Model Sale</th>
                                #else
                                    <th rowspan="2">Billed</th>
                                #end
                            #end

                            <th rowspan="2">Payout Rate</th>

                            ## Est. Payout column - only for retailers
                            #if(!$isAdmin)
                                <th rowspan="2">Est. Payout</th>
                            #end
                        </tr>

                        ## Sub-headers for Activation offers (Billed/Activated) - only for retailers
                        #if(!$isAdmin && $offer.isActivation())
                        <tr>
                            <th style="background-color: darkgray">Billed</th>
                            <th>Activated</th>
                            #if($offer.isBaseCriteria())
                            <th style="background-color: darkgray">Billed</th>
                            <th>Activated</th>
                            #end
                        </tr>
                        #end
                    </thead>

                    ## ===== TABLE BODY =====
                    <tbody>
                    #foreach($itemCriteriaPayout in $offer.getTargetSlabs().get(0).getItemCriteriaPayouts())

                        ## Set up model variables for this criteria (with null guard for admin view)
                        #if($offer.getCriteriaQtyAmountModel())
                            #set($criteriaItemQtyModel = $offer.getCriteriaQtyAmountModel().get($itemCriteriaPayout.getItemCriteria().getId()))
                            #if($offer.isBaseCriteria())
                                #set($baseItemCriteriaQtyAmountModel = $offer.getCriteriaQtyAmountModel().get(0))
                            #else
                                #set($baseItemCriteriaQtyAmountModel = $criteriaItemQtyModel)
                            #end
                        #end

                        ## Helper variables for readability
                        #set($isQuantityPayout = $offer.getPayoutType().name().equals("QUANTITY"))
                        #set($isSellinOrSellout = $offer.isSellin() || $offer.isSellout())
                        #set($isPercentage = $itemCriteriaPayout.getAmountType().name().equals("PERCENTAGE"))
                        #set($isFixed = $itemCriteriaPayout.getAmountType().name().equals("FIXED"))

                        #foreach($payoutSlab in $itemCriteriaPayout.getPayoutSlabs())
                            #set($rowspan = $itemCriteriaPayout.getPayoutSlabs().size())
                            #set($isFirstRow = $velocityCount == 1)
                            #set($selectedStyle = "")
                            #if($payoutSlab.isSelected())
                                #set($selectedStyle = "background-color: lightgreen")
                            #end

                        <tr>
                            ## Column 1: Models (only on first row with rowspan)
                            #if($isFirstRow)
                            <td style="text-align:left" rowspan="$rowspan">
                                $itemCriteriaPayout.getItemCriteriaString()<br>
                                #if($itemCriteriaPayout.getStartDate() || $itemCriteriaPayout.getEndDate())
                                <span style="font-weight: bold;">Payout Date - </span>
                                <span>$itemCriteriaPayout.getStartDate().format($dateFormatter) to $itemCriteriaPayout.getEndDate().format($dateFormatter)</span>
                                #end
                            </td>
                            #end

                            ## Column 2: Target
                            #if($isQuantityPayout)
                                <td style="$selectedStyle">$payoutSlab.getOnwardsAmount() pcs Onwards</td>
                            #else
                                <td style="$selectedStyle">Rs.<span class="currency">$payoutSlab.getOnwardsAmount()</span> Onwards</td>
                            #end

                            ## Column 3-4: Base Sale (Billed/Activated) - ONLY FOR RETAILERS
                            #if(!$isAdmin)
                                #if($isQuantityPayout)
                                    #if($isSellinOrSellout)
                                        <td>$baseItemCriteriaQtyAmountModel.getQty()</td>
                                    #else
                                        #if($isFirstRow)
                                        <td rowspan="$rowspan">$baseItemCriteriaQtyAmountModel.getQty()</td>
                                        <td rowspan="$rowspan">$baseItemCriteriaQtyAmountModel.getActivationQty()</td>
                                        #end
                                    #end
                                #else
                                    #if($isSellinOrSellout)
                                        <td><span class="currency">$baseItemCriteriaQtyAmountModel.getAmount()</span></td>
                                    #else
                                        #if($isFirstRow)
                                        <td rowspan="$rowspan"><span class="currency" style="color: darkgrey">$baseItemCriteriaQtyAmountModel.getAmount()</span></td>
                                        <td rowspan="$rowspan"><span class="currency">$baseItemCriteriaQtyAmountModel.getActivationAmount()</span></td>
                                        #end
                                    #end
                                #end
                            #end

                            ## Column 5-6: Model Sale (Billed/Activated) - ONLY FOR RETAILERS when baseCriteria=true
                            #if(!$isAdmin && $offer.isBaseCriteria() && $isFirstRow)
                                #if($isPercentage)
                                    #if($isSellinOrSellout)
                                        <td><span class="currency">$criteriaItemQtyModel.getAmount()</span></td>
                                    #else
                                        <td rowspan="$rowspan"><span class="currency">$criteriaItemQtyModel.getAmount()</span></td>
                                        <td rowspan="$rowspan"><span class="currency">$criteriaItemQtyModel.getActivationAmount()</span></td>
                                    #end
                                #elseif($isFixed)
                                    #if($isSellinOrSellout)
                                        <td>$criteriaItemQtyModel.getQty()</td>
                                    #else
                                        <td rowspan="$rowspan">$criteriaItemQtyModel.getQty()</td>
                                        <td rowspan="$rowspan">$criteriaItemQtyModel.getActivationQty()</td>
                                    #end
                                #else
                                    #if($isSellinOrSellout)
                                        <td rowspan="$rowspan">$criteriaItemQtyModel.getQty()</td>
                                    #else
                                        <td rowspan="$rowspan">$criteriaItemQtyModel.getQty()</td>
                                        <td rowspan="$rowspan">$criteriaItemQtyModel.getActivationQty()</td>
                                    #end
                                #end
                            #end

                            ## Column 7: Payout On
                            #if($isPercentage)
                                <td style="$selectedStyle">$payoutSlab.getPayoutAmount()%</td>
                            #elseif($isFixed)
                                <td style="$selectedStyle">Rs.<span class="currency">$payoutSlab.getPayoutAmount()</span> per pc</td>
                            #else
                                <td style="$selectedStyle">Rs.<span class="currency">$payoutSlab.getPayoutAmount()</span></td>
                            #end

                            ## Column 8: Est. Payout - ONLY FOR RETAILERS on first row
                            #if(!$isAdmin && $isFirstRow && $criteriaItemQtyModel)
                                <td rowspan="$rowspan">Rs.<span class="currency">$criteriaItemQtyModel.getFinalPayout()</span></td>
                            #end
                        </tr>
                        #end
                    #end
                    </tbody>
                </table>
                #if(!$isAdmin)
                <div style="margin-top:5px;">
                    #foreach($itemCriteriaPayout in $offer.getTargetSlabs().get(0).getItemCriteriaPayouts())
                        #if($itemCriteriaPayout.getNextSlab())
                            #set($isQtyTarget = $offer.getPayoutType().name().equals("QUANTITY"))
                            <p style="color:#e67e22; font-size:13px; margin:2px 0;">
                                #if($isQtyTarget)
                                    Just <strong>$itemCriteriaPayout.getShortValue() pcs</strong> away from next slab
                                    (<strong>$itemCriteriaPayout.getNextSlab().getOnwardsAmount() pcs</strong>)!
                                #else
                                    Just <strong>Rs.<span class="currency">$itemCriteriaPayout.getShortValue()</span></strong> away from next slab
                                    (<strong>Rs.<span class="currency">$itemCriteriaPayout.getNextSlab().getOnwardsAmount()</span></strong>)!
                                #end
                            </p>
                        #elseif($itemCriteriaPayout.getCurrentSlab())
                            <p style="color:#27ae60; font-size:13px; margin:2px 0;">
                                <strong>Max slab achieved!</strong> Earning highest payout rate.
                            </p>
                        #end
                    #end
                </div>
                #end
                <br>
            </div>
        </div>
    </div>

    ## Notes and Terms Section
    <div class="row">
        <div class="col-lg-12">
            <ul id="descriptionMenu" style="text-align:left">
                #if($offer.getOfferNotes() && !$offer.getOfferNotes().equals(""))
                <li>Note - $vmUtils.html($offer.getOfferNotes())</li>
                #end
            </ul>

            <div class="termContainer ck-content" style="text-align:left">
                $offer.getTerms()
            </div>
        </div>
    </div>
</div>

<div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-default cancel-description">Dismiss</button>
</div>