Subversion Repositories SmartDukaan

Rev

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

<section class="wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="icon_document_alt"></i>Details</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>Partner Franchise Detail</li>
            </ol>
        </div>
    </div>


    <div class="row">

        <div class="row col-lg-4">
            <canvas id="chart-partnerType" style="width:auto"></canvas>
        </div>


        <div class="row col-lg-6">

            <div class="form-group col-lg-3">
                <label>Exclude Partner Type</label>
                <select multiple class="criteria-partnertype chosen-select">
                    #foreach ($partnerType in $partnerTypes)
                        <option value="$partnerType">$partnerType.name()</option>
                    #end
                    <option value="GREY">GREY</option>

                </select>
            </div>

            <div class="form-group col-lg-2" style="margin-top:20px">

                <input type="button" class="btn btn-default fileterRowsOnPartnerType"
                       value="submit">
            </div>

        </div>
    </div>


    <div class="row">

        <div class="col-lg-12">
            <table id="authretailerstats" class="table table-striped table-advance table-hover" style="width:100%">
                <thead>
                <tr>
                    <th>Stores</th>
                    <th>RBMs</th>
                    <th>Activation Type</th>
                    <th>Code</th>
                    <th>Category</th>
                    <th>Sale Target</th>
                    <th>Purchase Target</th>
                    <th>Counter Potential</th>
                    <th>Manager</th>
                    <th>LMS</th>
                    <th>LMTD</th>
                    <th>MTD</th>
                    <th>Sale Diff</th>
                    <th>LM.S</th>
                    <th>LMTD.S</th>
                    <th>MTD.S</th>
                    <th>Unbilled Activated Stock</th>
                    <th>Wallet Amount</th>
                    <th>In Stock Invest</th>
                    <th>Total Invest</th>
                    <th>Short Invest</th>
                    <th>Unbilled Amount</th>
                    <th>Today Tertiary</th>
                    <th>Invest ok</th>
                    <th>Ticket</th>
                    <th>Escalation</th>
                    <th>Performance</th>
                </tr>
                </thead>
                <tbody>
                    #foreach($fofoId in $fofoIdAndallValues.keySet())
                        #if($fofoIdAndPartnerMap.get($fofoId))
                        <tr>
                            <td>$fofoIdAndPartnerMap.get($fofoId).getBusinessName()
                                ($fofoIdAndPartnerMap.get($fofoId).getAddress().getCity())
                            </td>
                            <td>$fofoIdAndallValues.get($fofoId).getRbms()</td>
                            <td>$fofoIdAndPartnerMap.get($fofoId).getActivationType()</td>
                            <td>$fofoIdAndPartnerMap.get($fofoId).getCode()</td>
                            <td>$fofoIdAndallValues.get($fofoId).getPartnerType()</td>
                            #if($monthlyTargetMap.get($fofoId).getSaleTarget() && $monthlyTargetMap.get($fofoId).getSaleTarget() > 0)
                                <td>$monthlyTargetMap.get($fofoId).getSaleTarget()</td>
                            #else
                                <td>-</td>

                            #end
                            #if($monthlyTargetMap.get($fofoId).getPurchaseTarget() && $monthlyTargetMap.get($fofoId).getPurchaseTarget() > 0)
                                <td>$monthlyTargetMap.get($fofoId).getPurchaseTarget()</td>
                            #else
                                <td>-</td>

                            #end
                            <td class="currency">$fofoIdAndPartnerMap.get($fofoId).getCounterPotential()</td>

                            <td>$fofoIdAndallValues.get($fofoId).getAuthUser()</td>
                            <td class="currency lmsSale" data-fofoid="$fofoId"
                                data-toggle="modal"
                                data-target="#brandLMSSale">$fofoIdAndallValues.get($fofoId).getLms()</td>
                            <td class="currency  lmtdSale"
                                data-fofoid="$fofoId"
                                data-toggle="modal"
                                data-target="#brandLMtdSale">$fofoIdAndallValues.get($fofoId).getLmtd()</td>

                            #if($fofoIdAndallValues.get($fofoId).getMtd() <= 0 )
                                <td class="currency mtdSale"
                                    data-fofoid="$fofoId"
                                    data-toggle="modal" data-target="#brandMtdSale"
                                    style="color:red">$fofoIdAndallValues.get($fofoId).getMtd()</td>
                            #else
                                <td class="currency mtdSale"
                                    data-fofoid="$fofoId"
                                    data-toggle="modal"
                                    data-target="#brandMtdSale">$fofoIdAndallValues.get($fofoId).getMtd()</td>
                            #end

                            #if($fofoIdAndallValues.get($fofoId).getSaleDiff() <= 0 )
                                <td class="currency"
                                    style="color:red">$fofoIdAndallValues.get($fofoId).getSaleDiff()</td>
                            #else
                                <td class="currency">$fofoIdAndallValues.get($fofoId).getSaleDiff()</td>
                            #end

                            <td class="currency lmsSecSale"
                                data-fofoid="$fofoId"
                                data-toggle="modal"
                                data-target="#brandSecSale">$fofoIdAndallValues.get($fofoId).getSecondarylms()</td>
                            <td class="currency  lmtdSecSale"
                                data-fofoid="$fofoId"
                                data-toggle="modal"
                                data-target="#brandSecSale">$fofoIdAndallValues.get($fofoId).getSecondarylmtd()</td>
                            #if($fofoIdAndallValues.get($fofoId).getSecondarymtd() <= 0)

                                <td class="currency mtdSecSale"
                                    data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()"
                                    data-toggle="modal" data-target="#brandSecSale"
                                    style="color:red">$fofoIdAndallValues.get($fofoId).getSecondarymtd()</td>
                            #else
                                <td class="currency mtdSecSale"
                                    data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()"
                                    data-toggle="modal"
                                    data-target="#brandSecSale">$fofoIdAndallValues.get($fofoId).getSecondarymtd()</td>
                            #end
                            #set($activatedStockAmount = $fofoIdAndallValues.get($fofoId).getInvestment().getActivatedStockAmount())
                            #if($activatedStockAmount > 20000)
                                <td class="currency" id="activatedStock"
                                    data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()" data-toggle="modal"
                                    data-target="#activateStock"
                                    style="color:red">-$activatedStockAmount</td>
                            #elseif($activatedStockAmount > 0)
                                <td class="currency" id="activatedStock"
                                    data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()" data-toggle="modal"
                                    data-target="#activateStock">-$activatedStockAmount</td>
                            #else
                                <td class="currency" id="activatedStock"
                                    data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()" data-toggle="modal"
                                    data-target="#activateStock">$activatedStockAmount</td>
                            #end
                            #if($fofoIdAndallValues.get($fofoId).getWalletAmount() > 50000)
                                <td class="currency"
                                    style="color:red">$fofoIdAndallValues.get($fofoId).getWalletAmount()</td>
                            #else
                                <td class="currency">$fofoIdAndallValues.get($fofoId).getWalletAmount()</td>
                            #end
                            <td class="currency instock" data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()"
                                data-toggle="modal"
                                data-target="#inStockItem">$fofoIdAndallValues.get($fofoId).getInvestment().getInStockAmount()</td>


                            <td class="currency" id="investment"
                                data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()" data-toggle="modal"
                                data-target="#partnerInvestment">$fofoIdAndallValues.get($fofoId).getInvestment().getTotalInvestment()</td>

                            #set($realInvestment = $fofoIdAndallValues.get($fofoId).getInvestment().getTotalInvestment() + $fofoIdAndallValues.get($fofoId).getInvestment().getShortInvestment() )


                            #set($realpercent = ($fofoIdAndallValues.get($fofoId).getInvestment().getTotalInvestment() / $realInvestment)*100)




                            #if($realpercent < 75)
                                <td class="currency"
                                    style="color:red">$fofoIdAndallValues.get($fofoId).getInvestment().getShortInvestment()</td>
                            #else
                                <td class="currency">$fofoIdAndallValues.get($fofoId).getInvestment().getShortInvestment()</td>

                            #end
                            <td class="currency" id="indent"
                                data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()"
                                data-toggle="modal"
                                data-target="#itemWiseIndent">$fofoIdAndallValues.get($fofoId).getInvestment().getUnbilledAmount()</td>
                            <td class="tertiary" data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()"
                                data-toggle="modal"
                                data-target="#itemWiseTertiary">$fofoIdAndallValues.get($fofoId).getTodayTertiary()</td>
                            <td>$fofoIdAndallValues.get($fofoId).getInvestment_ok()</td>
                            <td class="openticket" data-fofoid="$fofoIdAndPartnerMap.get($fofoId).getPartnerId()"
                                data-toggle="modal"
                                data-target="#openTicketModel">$fofoIdAndallValues.get($fofoId).getTicket()</td>
                            <td>
                                #if($escalationMap && $escalationMap.get($fofoId))
                                    #set($escLabel = $escalationMap.get($fofoId))
                                    #if($escLabel.contains("Sales"))
                                        <span style="color: red; font-weight: bold;">$escLabel</span>
                                    #elseif($escLabel.contains("L3"))
                                        <span style="color: #e67e22; font-weight: bold;">$escLabel</span>
                                    #else
                                        <span style="color: #f1c40f; font-weight: bold;">$escLabel</span>
                                    #end
                                #else
                                    -
                                #end
                            </td>
                                <td><a class="partner-performance-link" href="${rc.contextPath}/partnerPerformance?fofoId=$fofoId" target="_blank">View </a> </td>
                        </tr>
                        #end
                    #end
                </tbody>
            </table>
        </div>


    </div>


    <div id="itemWiseTertiary" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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


    <div id="itemWiseIndent" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

    <div id="inStockItem" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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


    <div id="partnerInvestment" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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


    <div id="activateStock" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

    <div id="brandMtdSale" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

    <div id="brandLMtdSale" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

    <div id="brandLMSSale" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

    <div id="openTicketModel" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

    <div id="brandSecSale" class="modal" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">

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

<style>
    canvas {
        -moz-user-select: none;
        -webkit-user-select: none;
        -ms-user-select: none;
    }
</style>

<script type="text/javascript">


    $(document).ready(function () {

        $("select.criteria-partnertype").chosen({no_results_text: "Oops, nothing found!"});


        $.fn.dataTable.ext.search.push(function (settings, data, dataIndex) {
            let partnerTypes = $("select.criteria-partnertype").val();
            if (typeof partnerTypes != "undefined") {
                var tablePartnerType = data[2];
                var lastMonthSale = data[7];

                console.log(lastMonthSale)
                lastMonthSale = lastMonthSale.replace(/,/g, "");

                console.log(lastMonthSale)
                if (partnerTypes.includes("GREY")) {
                    if (parseInt(lastMonthSale) < 200000)
                        return false;
                }


                if (partnerTypes.includes("BRONZE")) {
                    if (parseInt(lastMonthSale) > 200000)
                        return false;
                }
                if (!partnerTypes.includes(tablePartnerType)) {
                    return true;
                }
                return false;
            }
            return true;
        });
        $('#authretailerstats thead tr').clone(true).appendTo('#authretailerstats thead');
        $('#authretailerstats thead tr:eq(1) th').each(function (i) {
            var title = $(this).text();
            $(this).html('<input type="text" style = "width:60%;" placeholder="Search ' + title + '" />');

            $('input', this).on('keyup change', function () {
                if (table.column(i).search() !== this.value) {
                    table
                            .column(i)
                            .search(this.value)
                            .draw();
                }
            });
        })
        var table = $('#authretailerstats').DataTable({
            "lengthMenu": [10, 25, 50, 75, 100, 250, 1000],
            "scrollX": true,

            orderCellsTop: true,
            fixedHeader: true
        });

        $(document).on('click', ".fileterRowsOnPartnerType", function () {
            table.draw()
        });
    });
</script>


<script type="text/javascript">

    $('#authretailerstats').on('click', '.tertiary', function () {
        var fofoId = $(this).data('fofoid');


        doGetAjaxRequestHandler(context + "/getItemWiseTertiary?fofoId="
                + fofoId, function (response) {

            $('#itemWiseTertiary .modal-content').html(response);

        });
    });


    $('#authretailerstats').on('click', '#indent', function () {
        var fofoId = $(this).data('fofoid');


        doGetAjaxRequestHandler(context + "/getItemWiseIndent?fofoId="
                + fofoId, function (response) {

            $('#itemWiseIndent .modal-content').html(response);

        });
    });


    $('#authretailerstats').on('click', '#investment', function () {
        var fofoId = $(this).data('fofoid');
        doGetAjaxRequestHandler(context + "/getPartnerInvestment?fofoId="
                + fofoId, function (response) {

            $('#partnerInvestment .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '#activatedStock', function () {
        var fofoId = $(this).data('fofoid');
        doGetAjaxRequestHandler(context + "/getPatnerActivateStock?fofoId="
                + fofoId, function (response) {

            $('#activateStock .modal-content').html(response);

        });
    });


    $('#authretailerstats').on('click', '.mtdSale', function () {
        var fofoId = $(this).data('fofoid');
        doGetAjaxRequestHandler(context + "/getPatnerBrandWiseMTDSale?fofoId="
                + fofoId, function (response) {

            $('#brandMtdSale .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '.lmtdSale', function () {
        var fofoId = $(this).data('fofoid');
        doGetAjaxRequestHandler(context + "/getPatnerBrandWiseLMTDSale?fofoId="
                + fofoId, function (response) {

            $('#brandLMtdSale .modal-content').html(response);

        });
    });


    $('#authretailerstats').on('click', '.instock', function () {
        var fofoId = $(this).data('fofoid');
        doGetAjaxRequestHandler(context + "/getPatnerInStock?fofoId="
                + fofoId, function (response) {
            $('#inStockItem .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '.lmsSale', function () {
        var fofoId = $(this).data('fofoid');

        doGetAjaxRequestHandler(context + "/getPatnerBrandWiseLMSSale?fofoId="
                + fofoId, function (response) {
            $('#brandLMSSale .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '.lmsSecSale', function () {
        var fofoId = $(this).data('fofoid');
        $("#brand-secondary-model .modal-body").empty();
        doGetAjaxRequestHandler(context + "/getPartnerSecondarySale?fofoId="
                + fofoId + "&timeValue=lms", function (response) {
            $('#brandSecSale .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '.mtdSecSale', function () {
        var fofoId = $(this).data('fofoid');
        $("#brand-secondary-model .modal-body").empty();
        doGetAjaxRequestHandler(context + "/getPartnerSecondarySale?fofoId="
                + fofoId + "&timeValue=mtd", function (response) {
            $('#brandSecSale .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '.lmtdSecSale', function () {
        var fofoId = $(this).data('fofoid');
        $("#brand-secondary-model .modal-body").empty();
        doGetAjaxRequestHandler(context + "/getPartnerSecondarySale?fofoId="
                + fofoId + "&timeValue=lmtd", function (response) {
            $('#brandSecSale .modal-content').html(response);

        });
    });

    $('#authretailerstats').on('click', '.openticket', function () {
        var fofoId = $(this).data('fofoid');
        doGetAjaxRequestHandler(context + "/getOpenTicketByFofoId?fofoId="
                + fofoId, function (response) {
            $('#openTicketModel .modal-content').html(response);

        });
    });

</script>

<script type="text/javascript">

    var config = $chartPieMap;

    var ctx = document.getElementById('chart-partnerType').getContext('2d');
    var bar = new Chart1(ctx, config);
</script>