Subversion Repositories SmartDukaan

Rev

Rev 34305 | 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>Requested Allocations</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>Requested Allocations</li>
            </ol>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <ul class="nav nav-tabs">
                <li class="active"><a data-toggle="tab" href="#pending">Pending</a></li>
                <li><a data-toggle="tab" href="#approved">Approved</a></li>
            </ul>
            <div class="tab-content">
                <div id="pending" class="tab-pane fade in active">
                    <table class="table table-bordered table-condensed pendingRequestedAllocationList"
                           style="width:100%">
                        <thead class="row htable" style="background:#F5F5F5;">
                        <tr style="color:black;">
                            <th>Partner Id</th>
                            <th>Partner Name</th>
                            <th>Catalog Id</th>
                            <th>Model Number</th>
                            <th>Brand</th>
                            <th>Requested Allocation</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                            #foreach($model in $pendingRequestedHidAllocations)
                            <tr>
                                <td> $model.getFofoId() </td>
                                <td> $userMap.get($model.getFofoId()).getName()
                                    - $fofoStoreMap.get($model.getFofoId()).getCode() </td>
                                <td> $model.getCatalogId() </td>
                                <td> $model.getModelNumber() </td>
                                <td> $model.getBrand() </td>
                                <td><input type="text" value="$model.getRequested_allocation()"
                                           class="reuested_allocation" disabled> <a role="button"> <i
                                        class="fa fa-edit edit-allocation"></i></a></td>
                                <td>
                                    <button class="btn btn-sm btn-success allocation-request-approve-reject"
                                            data-id="$model.getId()" data-status="true">Approve
                                    </button>
                                    /
                                    <button class="btn btn-sm btn-danger allocation-request-approve-reject"
                                            data-id="$model.getId()" data-status="false">Reject
                                    </button>
                                    /
                                    <button class="btn btn-sm btn-info allocation-request-edit"
                                            data-id="$model.getId()">Edit
                                    </button>
                                </td>
                            </tr>
                            #end
                        </tbody>
                    </table>
                </div>
                <div id="approved" class="tab-pane fade">
                    <table class="table table-bordered table-condensed approvedRequestedAllocationList"
                           style="width:100%">
                        <thead class="row htable" style="background:#F5F5F5;">
                        <tr style="color:black;">
                            <th>Partner Id</th>
                            <th>Partner Name</th>
                            <th>Catalog Id</th>
                            <th>Model Number</th>
                            <th>Brand</th>
                            <th>Requested Allocation</th>
                            <th>Action</th>
                        </tr>
                        </thead>
                        <tbody>
                            #foreach($model in $approvedRequestedHidAllocations)
                            <tr>
                                <td> $model.getFofoId() </td>
                                <td> $userMap.get($model.getFofoId()).getName()
                                    - $fofoStoreMap.get($model.getFofoId()).getCode() </td>
                                <td> $model.getCatalogId() </td>
                                <td> $model.getModelNumber() </td>
                                <td> $model.getBrand() </td>
                                <td><input type="text" value="$model.getRequested_allocation()"
                                           class="reuested_allocation" disabled> <a role="button"> <i
                                        class="fa fa-edit edit-allocation"></i></a></td>
                                <td>
                                    <button class="btn btn-sm btn-danger allocation-request-approve-reject"
                                            data-id="$model.getId()" data-status="false">Reject
                                    </button>
                                    <button class="btn btn-sm btn-info allocation-request-edit"
                                            data-id="$model.getId()">Edit
                                    </button>
                                </td>
                            </tr>
                            #end
                        </tbody>
                    </table>
                </div>

            </div>
        </div>

    </div>

</section>

<script>

    $(document).ready(function () {
        // Initialize first table
        var sanctionTable = $('.pendingRequestedAllocationList').DataTable({
            "scrollX": true,
            scrollCollapse: true,
            "fixedHeader": true,
            "order": [[0, "desc"]],
            dom: '<"top"lf>rt<"bottom"ip><"clear">' // Proper dom setup
        });

        // Initialize second table
        var sanctionTableApproved = $('.approvedRequestedAllocationList').DataTable({
            "scrollX": true,
            scrollCollapse: true,
            "fixedHeader": true,
            "order": [[0, "desc"]],
            dom: '<"top"lf>rt<"bottom"ip><"clear">' // Proper dom setup
        });

        // Adjust columns when tab changes
        $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
            // Wait for tab switch and then adjust columns
            setTimeout(function () {
                sanctionTable.columns.adjust().draw();
                sanctionTableApproved.columns.adjust().draw();
            }, 100); // Delay adjustment slightly to ensure tab switch is complete
        });
    });

</script>