Subversion Repositories SmartDukaan

Rev

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

<div class="col-lg-12">
    <table class="table table-border table-condensed table-bordered" id="commitment-table" style="width:100%">

        <thead class="row htable" style="background:#F5F5F5;">

        <tr style="color:black;">
            <th rowspan="2">Committed By</th>
            <th rowspan="2">Partner Name</th>
            <th colspan="2">Collection</th>
            <th colspan="2">Total Sale</th>
            <th colspan="2">Samsung</th>
            <th colspan="2">Oppo</th>
            <th colspan="2">Vivo</th>
            <th colspan="2">Itel</th>
            <th colspan="2">Almost New</th>
            <th colspan="2">Others</th>
        </tr>
        <tr>
            <th>Target (<span id="coltgt"> </span>)</th>
            <th>Ach (<span id="colach"> </span>)</th>
            <th>Tgt (<span id="saletgt"> </span>)</th>
            <th>Ach (<span id="saleach"> </span>)</th>
            <th>Tgt</th>
            <th>Ach</th>
            <th>Tgt</th>
            <th>Ach</th>
            <th>Tgt</th>
            <th>Ach</th>
            <th>Tgt</th>
            <th>Ach</th>
            <th>Tgt</th>
            <th>Ach</th>
            <th>Tgt</th>
            <th>Ach</th>
        </tr>
        </thead>
        <tbody>
            #foreach($commitment in $commitments )

            <tr>
                #parse("team-commitment-index.vm")

            </tr>

            #end

        </tbody>

    </table>
</div>

<script type="text/javascript">
    $(document).ready(function () {
        var table = $('#commitment-table').DataTable({
            "scrollX": true,
            "bPaginate": true,
            "bLengthChange": true,
            "bFilter": true,
            "bInfo": false,
            "bAutoWidth": false,
            "pageLength": 100,


        });

        datatableSum();
        table.on('search.dt', function () {
            console.log('Currently applied global search: ' + table.search());
            datatableSum();


        });
    });


    function datatableSum() {

        let col_tgt_sum = $('#commitment-table').DataTable().column(2, {page: 'current'}).data().sum();
        $('#coltgt').html(numberToComma(col_tgt_sum));


        let col_ach_sum = $('#commitment-table').DataTable().column(3, {page: 'current'}).data().sum();
        console.log(col_ach_sum)
        $('#colach').html(numberToComma(col_ach_sum));

        let sale_tgt_sum = $('#commitment-table').DataTable().column(4, {page: 'current'}).data().sum();
        let sale_ach_sum = $('#commitment-table').DataTable().column(5, {page: 'current'}).data().sum();
        $('#saletgt').html(numberToComma(sale_tgt_sum));
        $('#saleach').html(numberToComma(sale_ach_sum));

    }


</script>