Subversion Repositories SmartDukaan

Rev

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



function closeColorBox(){
        $.colorbox.close();
}

$('.link-requiring-warehouse-selection').live('click', function(){
        var linkurl = $(this).attr('href');
        $('<form id = "tempForm" onsubmit = "closeColorBox() "style = "text-align:center" method = "GET" action = "'+ linkurl +'">').appendTo('body');
        
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7573">DL-NSSPL/Delhi</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7678">UP-NSSPL/Noida</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7681">HR-NSSPL/Faridabad</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "8468">UP-NSSPL/Lucknow</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7720">DL-NSSPL/Delhi-HR</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "8889">Punjab</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "8947">Rajasthan</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "submit"  value = "Submit"/>'));
        
        $.colorbox({
                inline : true,
        width : "325px",
        height : "500px",
        opacity : "0.30",
        overlayClose :  true,
        escKey :        true,
        href : "#tempForm",
        onClosed : function() {
            $('#tempForm').remove();
        }
        });
        event.preventDefault();
        return false;
        
});

$('a.warehousechangeprocess').live('click', function(){
        $('div#warehousechangeprocess').attr('style','color:blue;');
        $('div#warehousechangeprocess').show();
        setTimeout(function () {$('div#warehousechangeprocess').fadeOut('slow');}, 10000);
        $.ajax({
                type : "GET",
        url : "/inventory/inventory-reader!moveOrdersCorrectWarehouse",
        dataType  : 'json',
        success : function(response) {
                $.each(response, function(key,value) {
                        $('div#warehousechangeprocess').attr('style','color:blue;');
                        $('div#warehousechangeprocess').text(value);
                        $('div#warehousechangeprocess').show();
                        setTimeout(function () {$('div#warehousechangeprocess').fadeOut('slow');}, 10000);
                });
        },
        error : function() {
                $('div#warehousechangeprocess').attr('style','color:red;');
                $('div#warehousechangeprocess').text('Some Error Occured. Please Try After Some Time.');
                $('div#warehousechangeprocess').show();
                setTimeout(function () {$('div#warehousechangeprocess').fadeOut('slow');}, 10000);
        }
        });
        
});

$('a.pendingPoReport').live('click', function(){
        $('div#pendingPoReport').attr('style','color:blue;');
        $('div#pendingPoReport').show();
        setTimeout(function () {$('div#pendingPoReport').fadeOut('slow');}, 10000);
        $.ajax({
                type : "GET",
        url : "/inventory/inventory-reader!runPendingPurchaseOrderReport",
        dataType  : 'json',
        success : function(response) {
                $.each(response, function(key,value) {
                        $('div#pendingPoReport').attr('style','color:blue;');
                        $('div#pendingPoReport').text(value);
                        $('div#pendingPoReport').show();
                        setTimeout(function () {$('div#pendingPoReport').fadeOut('slow');}, 10000);
                });
        },
        error : function() {
                $('div#pendingPoReport').attr('style','color:red;');
                $('div#pendingPoReport').text('Some Error Occured. Please Try After Some Time.');
                $('div#pendingPoReport').show();
                setTimeout(function () {$('div#pendingPoReport').fadeOut('slow');}, 10000);
        }
        });
        
});

function selectWarehouseForPOCreation() {
        $('#warehouse-selector-po-creation').show();
        $.colorbox({
                inline : true,
        width : "325px",
        height : "500px",
        opacity : "0.30",
        overlayClose :  true,
        escKey :        true,
        href : "#warehouse-selector-po-creation",
        onClosed : function() {
            $("#warehouse-selector-po-creation").hide();
            $('#warehouse-selection-error').html("");
        }
        });
        event.preventDefault();
        return false;
}

function selectWarehouseForListingPO() {
        $('#warehouse-selector-po-recieve').show();
        $.colorbox({
                inline : true,
        width : "325px",
        height : "500px",
        opacity : "0.30",
        overlayClose :  true,
        escKey :        true,
        href : "#warehouse-selector-po-recieve",
        onClosed : function() {
            $("#warehouse-selector-po-recieve").hide();
            $('#warehouse-selection-error').html("");
        }
        });
        event.preventDefault();
        return false;
}

function openPOCreationPage() {
        $.colorbox.close();
        warehouseId = $("#warehouse-selector-po-creation input[name='warehouse']:checked").val();
        if(warehouseId != 'undefined') {
                this.location.href = "/inventory/purchase-order/new?warehouseId="+warehouseId;
        } else {
                $('#warehouse-selection-error').html("<span>Please select warehouse</span>");
        }
}

function showOpenPOpage() {
        $.colorbox.close();
        warehouseId = $("#warehouse-selector-po-recieve input[name='warehouse']:checked").val();
        if(warehouseId != 'undefined') {
                this.location.href = "/inventory/purchase-order?warehouseId="+warehouseId;
        } else {
                $('#warehouse-selection-error').html("<span>Please select warehouse</span>");
        }
}