Subversion Repositories SmartDukaan

Rev

Rev 22382 | Rev 25031 | 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 = "7">Mahipalpur</input>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "12">Goregaon</input></br>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "13">Biwandi</input>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "16">Mum-Amazon</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "1765">Bangalore</input>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "1768">Bangalore-SR</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "1771">BAN-AMZ/Bangalore</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "2857">HR-SORPL/Gurgaon</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "2854">HR-FK/Gurgaon</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "4699">DL-FK/Mahipalpur-Delhi</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "5314">DL-SD/Samalkha-Delhi</input><br/>'));    
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "3931">HR-FK/Gurgaon-S</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "3298">TG-SORPL/Hyderabad</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "5623">DL-AMZ/Amazon-Delhi</input><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "3295">HR-AMZ/Mewat</input><br/><br/>'));*/
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7441">HR-AMPL/Gurgaon</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7480">DL-AMPL/Delhi</input><br/><br/>'));
        $('form#tempForm').append($('<input type = "radio" name = "physicalWarehouseId" value = "7573">DL-NSSL/Delhi</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>");
        }
}