Subversion Repositories SmartDukaan

Rev

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

$(function() {
        $(function() {
                scanTable = $('#transfer-lots-table').dataTable({
                        "sPaginationType": "full_numbers",
            "aaSorting" : [ [ 4, 'asc' ] ],
            "bAutoWidth": true,
            "iDisplayLength" : 50,
            "sDom" : 'T<"clear">lfrtip',
            "oTableTools" : {
                "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
            },
        });
        });
        
        /*$('#transfer-lot-receive-button').live('click', function() {
                var transferLotId = $(this).attr('transferLotId');
                $('#transfer-lot-updation-box').show();
                $('#update-transfer-lot').attr('transferLotId',transferLotId);
                $.colorbox({
                        inline : true,
                width : "325px",
                height : "125px",
                opacity : "0.30",
                overlayClose :  true,
                escKey :        true,
                href : "#transfer-lot-updation-box",
                onClosed : function() {
                    $("#transfer-lot-updation-box").hide();
                    $('#update-transfer-lot').removeAttr('transferLotId');
                }
                });
        });*/
        
        $('#transfer-lot-receive-button').live('click', function() {
                var transferLotId = $(this).attr('transferLotId');
                $('#transfer-lot-updation-box').show();
                $('#update-transfer-lot').attr('transferLotId',transferLotId);
                $.colorbox({
                        inline : true,
                width : "325px",
                height : "125px",
                opacity : "0.30",
                overlayClose :  true,
                escKey :        true,
                href : "#transfer-lot-updation-box",
                onClosed : function() {
                    $("#transfer-lot-updation-box").hide();
                    $('#update-transfer-lot').removeAttr('transferLotId');
                }
                });
        });
        
        
        $('#update-transfer-lot').live('click', function () {
                $.ajax({
                        type : "POST",
                        url : "/inventory/transfer-lot!markTransferLotAsReceived",
                        data : "id="+$(this).attr('transferLotId')+"&remoteTransferRefNumber="+$('#transfer-lot-reference-number').val(),
                        success : function(response) {
                                alert("Successfully marked Transfer Lot as Recieved");
                        },
                        error : function(response) {
                                alert("Error in marking Transfer Lot as Recieved");
                        }
                        
                });
        });
        /*$.ajax({
                type : "POST",
        url : "/inventory/transfer-lot!markTransferred",
        param : "id="+id+"&remoteTransferRefNumber=dummy",
        success : function(response) {
                alert("Marked inventory lot as recieved");
        }
                error : function(response) {
                alert("Failed to mark inventory lot as received");
        } 
        });*/
        $('#show-transfer-lot-items').live('click', function() {
                $.ajax({
                        type : "GET",
                        url : "/inventory/transfer-lot!getTransferLotItems?id="+$(this).attr('transferLotId'),
                        success : function(response) {
                                $.colorbox({
                                        inline : true,
                                width : "400px",
                                height : "500px",
                                opacity : "0.30",
                                overlayClose :  true,
                                escKey :        true,
                                href : $(response),
                                onClosed : function() {
                                    //TODO
                                }
                                });
                        },
                        error : function(response) {
                                alert("Error in fetching Transfer Lot Items");
                        }
                });
        });
        $('#add-transfer-lineitem').live('click', function(){
                /*var transfer-lot-line-item = '<tr ><td ><input type="text" class="itemId" name="" onkeypress="return disableEnterKey(event)" /></td>'+
                        '<td ><input class="itemNumber" type="text" tabindex="$tabIndex" onkeypress="return disableEnterKey(event)"/></td>'+
            '<td ><input class="serialNumber" type="text" tabindex="$tabIndex" onkeypress="return disableEnterKey(event)"/></td>'+
            '<td ><input class="quantity" type="text" value="1" onkeypress="return disableEnterKey(event)"/></td></tr>';*/
//              $(transfer-lot-line-item).appendTo('#transfer-items-body')
                $('<tr ><td ><input type="text" class="itemId" name="" onkeypress="return disableEnterKey(event)" /></td>'+
                                '<td ><input class="itemNumber" type="text" tabindex="$tabIndex" onkeypress="return disableEnterKey(event)"/></td>'+
                    '<td ><input class="serialNumber" type="text" tabindex="$tabIndex" onkeypress="return disableEnterKey(event)"/></td>'+
                    '<td ><input class="quantity" type="text" value="1" onkeypress="return disableEnterKey(event)"/></td></tr>').appendTo('#transfer-items-body')
        });

        
});