Subversion Repositories SmartDukaan

Rev

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

<style>
    .table-striped > tbody > tr:nth-child(odd) > td {
        background: white;
        background-color: white;
    }

    .table-striped > tbody > tr:nth-child(even) > td {
        background: white;
        background-color: white;
    }

    .table-striped > tbody > tr:hover > td,
    .table-striped > tbody > tr:hover {
        background-color: #e98c8f;
        color: white;
    }

    .btn:hover {
        color: grey;
        text-decoration: none;
    }

    .btn-primary:hover {
        color: grey;
        text-decoration: none;
    }

    .sale-details {
        cursor: pointer;
    }
</style>

<section class="wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="icon_document_alt"></i>OFFER HISTORY
                <button class="btn btn-success btn-sm" id="publish-all-btn" type="button" style="margin-left:15px;">Publish All</button>
            </h3>
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="${rc.contextPath}/dashboard">Home</a></li>
                <li><i class="icon_document_alt"></i>OFFERS</li>
            </ol>
        </div>
    </div>

    <table style="Width:100%">

        <td align="left" style="Width:20%">
        </td>

        <td style="Width:80%">
            <div id="offer-search">
                <div class="row">
                    <div class="col-lg-12">
                    <div class="col-md-3 col-sm-3 col-xs-12 form-group pull-right top_search">
                            <div class="input-group">
                                            <span class="input-group-btn">
                                         <button class="btn btn-primary submit" id="offer-file-submit" type="button">Add Offers Using Targets</button>
                                </span>
                                </div>
                       </div>
                        <div class="col-md-3 col-sm-3 col-xs-12 form-group pull-right top_search">
                            <div class="input-group">
                                <input type="file" class="form-control" id="offer-file"
                                       placeholder="Upload Target Offers"/>

                            </div>
                        </div>

                        <div class="col-md-3 col-sm-3 col-xs-12 form-group pull-right top_search">
                            <div class="input-group">
                                <input type="month" class="form-control" id="yearmonth"
                                       placeholder="YYYY-MM"/>
                                <span class="input-group-btn">
                                                <button class="btn btn-primary submit" id="yearmonth-submit"
                                            type="button">Go!</button>
                                        </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </td>
    </table>
    <div id="offer-listings-table">
        <div class="row">
            <div class="col-lg-12">
                <table class="table table-striped table-advance table-hover">
                    <tbody>
                    <tr>
                        <th>Id</th>
                        <th>Name</th>
                        <th>Reference</th>
                        <th>Payout Type</th>
                        <th>Scheme Type</th>
                        <th>Discount</th>
                        <th>Partner Criteria</th>
                        <th>Item Criteria</th>
                        <th>Start</th>
                        <th>End</th>
                        <th>Created</th>
                        <th>Processed</th>
                        <th>Actions</th>
                    </tr>
                        #if(!$offers.isEmpty())
                            #foreach( $offer in $offers )
                            <tr class="offer-details" data-offerid="$offer.getId()" data-offer-title="">
                                <td><a class="mk_offer_detail" href="javascript:void(0)">$offer.getId()</a></td>
                                <td><a class="mk_partner_view" href="javascript:void(0)">$offer.getName()</a></td>
                                <td>#if($offer.getReference())$offer.getReference()#else-#end</td>
                                <td>$offer.getPayoutType()</td>
                                <td>$offer.getSchemeType()</td>
                                <td>
                                    #if ($offer.isDiscount())
                                        Discount
                                    #else
                                        Non Discount
                                    #end
                                </td>
                                <td>$offer.getPartnerCriteriaString()</td>
                                <td>$offer.getItemCriteriaString()</td>
                                <td>$offer.getStartDate().format($dateFormatter)</td>
                                <td>$offer.getEndDate().format($dateFormatter)</td>
                                <td>$offer.getCreatedOn().format($dateTimeFormatter)</td>
                                #if($offer.getProcessTimestamp())
                                    <td class="processed-timestamp">$offer.getProcessTimestamp().format($dateTimeFormatter)</td>
                                #else
                                    <td class="processed-timestamp"> -</td>
                                #end
                                <td>
                                    <ul>
                                        <li>
                                            #if($offer.isActive())
                                                <a class="mk_offer_inactive" href="javascript:void(0)">Mark Inactive</a>
                                            #else
                                                <a class="mk_offer_active" href="javascript:void(0)">Mark Active</a>
                                            #end
                                        </li>
                                        <li><a href="/offerDownload?offerId=$offer.getId()">Download
                                            Report</a></li>
                                        <li><a class="process_offer" href="javascript:void(0)">Process Offer</a>
                                        </li>
                                        <li><a class="manage_offer_partners" href="javascript:void(0)">Manage Partners</a></li>
                                        #if(!$offer.isActive())
                                        <li><a class="delete_offer" href="javascript:void(0)" style="color:red;">Delete</a></li>
                                        #end
                                        #if(!$currentMonth)
                                        #end
                                    </ul>
                                </td>
                            </tr>
                            #end
                        #else
                        <tr>
                            <td colspan="13" style="text-align:center;">NO MATCHING DATA FOUND FOR CRITERIA</td>
                        </tr>
                        #end
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="modal" id="offerDescription">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
            </div>
        </div>
    </div>
</section>

<script type="text/javascript">
    $(function () {
        $("#offerDescription").modal('hide');
        $('#offerDescription').on('hide.bs.modal', function () {
            $(this).find(".modal-content").html("");
        });
        $("#offer-file-submit").on('click', function () {
            var fileSelector = $('#offer-file')[0];
            if (fileSelector != undefined && fileSelector.files[0] != undefined) {
                if (confirm("Confirm Upload?")) {
                    doAjaxUploadRequestHandler(context + "/offers/upload",
                            "POST", fileSelector.files[0], function (
                                    response) {
                                if (response) {
                                    alert("Offer added successfully");
                                    loadOfferHistory('#main-content', moment(new Date()).format("YYYY-MM"));
                                }
                            });
                }
            } else {
                alert("Please upload file");
            }
        });
    });
</script>