Subversion Repositories SmartDukaan

Rev

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

<div class="row">


        #if(!$inStock.isEmpty())
        <div class="col-lg-6">
                <table
                        class="table table-striped table-advance table-hover partner-planning-details">
                        <thead>
                                <tr>
                                        <th>Warehouse</th>
                                        <th>Partner Name</th>
                                        <th>Stock</th>
                                        <th>Sale</th>

                                </tr>
                        </thead>
                        <tbody>
                                #foreach($keyvalue in $inStock.entrySet())
                                <tr>
                                        <td>$warehouseMap.get($keyvalue.getValue().getWarehouseId())</td>
                                        <td>$customRetailers.get($keyvalue.getKey()).getBusinessName()</td>
                                        <td class="instockItem"
                                                data-fofoid="$keyvalue.getValue().getFofoId()" data-toggle="modal"
                                                data-target="#inStockItemModel">$keyvalue.getValue().getQty()</td>
                                        #if($fofoSale.get($keyvalue.getKey()))
                                        <td class="inSaleItem"
                                                data-fofoid="$keyvalue.getValue().getFofoId()" data-toggle="modal"
                                                data-target="#inSaleItemModel">$fofoSale.get($keyvalue.getKey()).getQty()</td>
                                        #else
                                        <td>0</td> #end
                                </tr>
                                #end

                        </tbody>
                </table>
        </div>
        #else

        <div class="col-lg-6">
                <table
                        class="table table-striped table-advance table-hover partner-planning-details">
                        <thead>
                                <tr>
                                        <th>Warehouse</th>
                                        <th>Partner Name</th>
                                        <th>Item</th>
                                        <th>Stock</th>
                                        <th>Sale</th>

                                </tr>
                        </thead>
                        <tbody>
                                #foreach($keyvalue in $inStockItemMap.entrySet())
                                <tr>
                                        <td>$warehouseMap.get($keyvalue.getValue().getWarehouseId())</td>

                                        <td>$customRetailers.get($keyvalue.getKey().getFofoId()).getBusinessName()</td>
                                        <td>$keyvalue.getValue().getBrand()
                                                $keyvalue.getValue().getModelName()
                                                $keyvalue.getValue().getModelNumber()</td>
                                        <td>$keyvalue.getValue().getQty()</td>
                                        #if($fofoSaleItem.get($keyvalue.getKey()))
                                        <td>$fofoSaleItem.get($keyvalue.getKey()).getQty()</td> #else
                                        <td>0</td> #end
                                </tr>
                                #end

                        </tbody>
                </table>
        </div>

        #end
</div>


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


<div id="inSaleItemModel" class="modal" role="dialog">
        <div class="modal-dialog">
                <div class="modal-content"></div>
        </div>
</div>
<script type="text/javascript">
        $(document).ready(
                        function() {

                                $('.partner-planning-details thead tr').clone(true).appendTo(
                                                '.partner-planning-details thead');
                                $('.partner-planning-details 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 = $('.partner-planning-details').DataTable({

                                        "lengthMenu" : [ 10, 25, 50, 75, 100, 250 ],
                                        "pageLength" : 250,
                                });
                        });

        $('.partner-planning-details').on(
                        'click',
                        '.instockItem',
                        function() {
                                var fofoId = $(this).data('fofoid');
                                var catalogIds = $('.criteria-item-catalogids').val();
                                console.log(catalogIds);

                                doGetAjaxRequestHandler(context
                                                + "/getInStockItembyFofoId?fofoId=" + fofoId
                                                + "&catalogItemIds=" + catalogIds, function(response) {
                                        console.log(response)
                                        $('#inStockItemModel .modal-content').html(response);

                                });
                        });

        $('.partner-planning-details').on(
                        'click',
                        '.inSaleItem',
                        function() {
                                var fofoId = $(this).data('fofoid');
                                var catalogIds = $('.criteria-item-catalogids').val();
                                console.log(catalogIds);

                                doGetAjaxRequestHandler(context
                                                + "/getSaleItembyCatalogFofoId?fofoId=" + fofoId
                                                + "&catalogItemIds=" + catalogIds + "&date="
                                                + startDate, function(response) {
                                        console.log(response)
                                        $('#inSaleItemModel .modal-content').html(response);

                                });
                        });
</script>