Subversion Repositories SmartDukaan

Rev

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

<style>
    .pointer {
        cursor: pointer;
    }

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

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

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

<script type="text/javascript">
    // $("#partnerFofoId").typeahead({
    //     source: retailers,
    //     autoSelect: true,
    //     displayText: function (item) {
    //         return item.businessName + "-" + item.address.city;
    //     },
    //     afterSelect: function (currentItem) {
    //         currentFofoId = currentItem.partnerId;
    //         fofoId = currentItem.partnerId;
    //         doAjaxRequestHandler(context + "/return/inventory/" + currentFofoId, "GET", function (response) {
    //             inventoryTable.rows().remove().rows.add($(response)).draw(false);
    //         });
    //     }
    // });

</script>

<section class="wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="icon_document_alt"></i>View/Request Return</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>View Returnables</li>
            </ol>
        </div>
    </div>

    <div>
        <div class="row">
            <div class="col-lg-2 form-group">
                <select class="form-control input-sm" id="fofo-users" name="fofo-users" placeholder="Partners">
                    <option value="" disabled selected>Partners</option>
                    #foreach($fofoId in $customRetailersMap.keySet())
                        <option value="$fofoId"
                                data-email="$customRetailersMap.get($fofoId).getEmail()">$customRetailersMap.get($fofoId).getBusinessName()
                            - $customRetailersMap.get($fofoId).getCode()</option>
                    #end
                </select>
            </div>


            <div class="col-lg-4" id="inventory-container">
                <table class="table table-striped table-condensed table-bordered">
                    <thead>
                    <tr>
                        <th>Item Id</th>
                        <th>Description</th>
                        <th>Qty</th>
                    </tr>
                    </thead>
                    <tbody id="inventory-body">
                    </tbody>
                </table>
            </div>
            <div class="col-lg-6" id="returnable-container">
                <table class="table table-striped table-condensed table-bordered">
                    <thead>
                    <tr>
                        <th>Serial Number</th>
                        <th>Unit Price</th>
                        <th>Scanned On</th>
                        <th>Status</th>
                    </tr>
                    </thead>
                    <tbody id="returnables-body">
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">

    $(document).on('change', 'select[name="fofo-users"]', function () {
        console.log("partner select");
        let fofoId = $('select[name="fofo-users"]').val();
        console.log("partner id -", fofoId);
        doAjaxRequestHandler(context + "/return/inventory/" + fofoId, "GET", function (response) {
            inventoryTable.rows().remove().rows.add($(response)).draw(false);
        });
    })
    /* Create an array with the values of all the input boxes in a column */
    $.fn.dataTable.ext.order['dom-text'] = function (settings, col) {
        return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
            return $('input', td).val();
        });
    }

    /* Create an array with the values of all the input boxes in a column, parsed as numbers */
    $.fn.dataTable.ext.order['dom-text-numeric'] = function (settings, col) {
        return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
            return $('input', td).val() * 1;
        });
    }

    /* Create an array with the values of all the select options in a column */
    $.fn.dataTable.ext.order['dom-select'] = function (settings, col) {
        return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
            return $('select', td).val();
        });
    }

    /* Create an array with the values of all the checkboxes in a column */
    $.fn.dataTable.ext.order['dom-checkbox'] = function (settings, col) {
        return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
            return $('input', td).prop('checked') ? '1' : '0';
        });
    }

    /* Initialise the table with the required column ordering data types */
    $(document).ready(function () {
        /*storesTable = $('#store-container').find('table').DataTable({"pageLength": 20});*/
        inventoryTable = $('#inventory-container').find('table').DataTable(
                {
                    "paging": true,
                    "searching": true
                }
        );
        returnsTable = $('#returnable-container').find('table').DataTable({
            "paging": true,
            "searching": true
        });
    });


    $(document).ready(function () {
        $('#fofo-users').multiselect({
            includeSelectAllOption: true,
            maxHeight: 200,
            multiple: true,
            buttonWidth: '180px',
            numberDisplayed: 1,
            nonSelectedText: 'Users',
            nSelectedText: ' - Users Selected',
            allSelectedText: 'All Users Selected',
            enableFiltering: true,
            enableCaseInsensitiveFiltering: true
        });


    });


</script>