Subversion Repositories SmartDukaan

Rev

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

<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">&times;</button>
    <h4 class="modal-title">Manage Partners - Offer #$offerId</h4>
</div>

<div class="modal-body" style="max-height:600px;overflow:auto">

    ## Current Partners
    <h5 style="margin-bottom:10px;"><strong>Current Partners</strong></h5>
    #if($partnerFofoIds && $partnerFofoIds.size() > 0)
    <table class="table table-bordered table-sm" id="offer-partners-table" data-offerid="$offerId">
        <thead>
            <tr>
                <th style="width:40px;"><input type="checkbox" id="select-all-partners"></th>
                <th>Partner ID</th>
                <th>Code</th>
                <th>Name</th>
            </tr>
        </thead>
        <tbody>
        #foreach($fofoId in $partnerFofoIds)
            #set($retailer = $customRetailerMap.get($fofoId))
            <tr data-fofoid="$fofoId">
                <td><input type="checkbox" class="partner-checkbox" value="$fofoId"></td>
                <td>$fofoId</td>
                <td>#if($retailer)$retailer.getPartnerCode()#else-#end</td>
                <td>#if($retailer)$retailer.getBusinessName()#else-#end</td>
            </tr>
        #end
        </tbody>
    </table>

    <div style="margin-top:10px;">
        <button class="btn btn-danger btn-sm remove-selected-partners" type="button">Remove Selected Partners</button>
    </div>

    ## Remove options (hidden by default, shown when remove is clicked)
    <div id="remove-options" style="display:none; margin-top:15px; padding:15px; border:1px solid #ddd; border-radius:4px; background:#f9f9f9;">
        <div class="checkbox">
            <label>
                <input type="checkbox" id="create-new-offer-checkbox"> Create a new offer for removed partners with custom targets
            </label>
        </div>

        <div id="custom-targets-section" style="display:none; margin-top:10px;">
            <h5><strong>Set Targets for New Offer</strong></h5>
            #if($offer.getTargetSlabs() && $offer.getTargetSlabs().size() > 0)
                #set($slabIndex = 0)
                #foreach($itemCriteriaPayout in $offer.getTargetSlabs().get(0).getItemCriteriaPayouts())
                    #foreach($payoutSlab in $itemCriteriaPayout.getPayoutSlabs())
                        #set($slabIndex = $slabIndex + 1)
                        <div class="form-group" style="margin-bottom:5px;">
                            <label>Target $slabIndex</label>
                            <input type="number" class="form-control new-offer-target" value="$payoutSlab.getOnwardsAmount()" style="width:200px;display:inline-block;">
                        </div>
                    #end
                #end
            #end
            <div class="alert alert-warning" style="margin-top:10px;">
                <strong>Note:</strong> New offer will be created as <strong>UNPUBLISHED</strong>. You must publish it manually from Offer History.
            </div>
        </div>

        <button class="btn btn-primary btn-sm confirm-remove-partners" type="button" style="margin-top:10px;">Confirm Remove</button>
        <button class="btn btn-default btn-sm cancel-remove-partners" type="button" style="margin-top:10px;">Cancel</button>
    </div>
    #else
    <p style="text-align:center; color:#999;">No partners assigned to this offer via partner criteria.</p>
    #end

    <hr>

    ## Add Partners Section
    <h5 style="margin-bottom:10px;"><strong>Add Partners</strong></h5>
    <div class="form-group">
        <select id="add-partner-select" class="form-control" multiple="multiple" style="width:100%;">
            #foreach($entry in $allRetailersMap.entrySet())
                <option value="$entry.getKey()">$entry.getValue().getPartnerCode() - $entry.getValue().getBusinessName()</option>
            #end
        </select>
    </div>
    <button class="btn btn-success btn-sm add-selected-partners" type="button">Add Selected Partners</button>
</div>

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

<script type="text/javascript">
    $(function () {
        $('#add-partner-select').chosen({
            no_results_text: "No partner found",
            placeholder_text_multiple: "Search and select partners..."
        });
    });
</script>