Subversion Repositories SmartDukaan

Rev

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

$(function() {
    $('table#doa-items').dataTable({
        "lengthMenu": [[20, 50, 100, -1], [20, 50, 100, "All"]]
    });
    
    $(document).on('submit','.doaIn', function(){
        $.ajax({
            type    : "PUT",
            url     : "/inventory/doa-in/" + $(this).attr('inventoryItemId'),
            data    : $(this).serialize(),
            success : function(response) {
                document.location.href = "/inventory/doa-in";
            }
        });
        
        return false;
    });
    
    $(document).on('submit','.doaOut', function(){
        $.ajax({
            type    : "PUT",
            url     : "/inventory/doa-out/" + $(this).attr('inventoryItemId'),
            data    : $(this).serialize(),
            success : function(response) {
                document.location.href = "/inventory/doa-out";
            }
        });

        return false;
    });
    
    $(document).on('click','.orderIdInfo', function(){
                inventoryItemId = $(this).attr('id');
                $.ajax({
                type : "GET",
                url : "/inventory/doa-in!getOrderIdDOAInItem?id="+inventoryItemId,
                success : function(response) {
                        $.colorbox({
                                        inline : true,
                                width : "350px",
                                height : "150px",
                                opacity : "0.20",
                                overlayClose :  true,
                                escKey :        true,
                                href : $(response),
                                onClosed : function() {
                                        
                                }
                                });
                },
                error : function(response) {
                                alert("Error in fetching Order Id");
                        }                       
            });
        });
    
    /*$('.doa-close-credit-note').hide();
    
    $('.closeDOAButton').live('click', function() {
        $(this).hide();
        $(this).siblings('.doa-close-credit-note').show();
    });*/
    
});


/*var grid = $("#grid-command-buttons").bootgrid({
    ajax: true,
    post: function ()
    {
        return {
            id: "b0df282a-0d67-40e5-8558-c9e93b7befed"
        };
    },
    url: "/api/data/basic",
    formatters: {
        "commands": function(column, row)
        {
            return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-pencil\"></span></button> " + 
                "<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" data-row-id=\"" + row.id + "\"><span class=\"fa fa-trash-o\"></span></button>";
        }
    }
}).on("loaded.rs.jquery.bootgrid", function()
{
     Executes after data is loaded and rendered 
    grid.find(".command-edit").on("click", function(e)
    {
        alert("You pressed edit on row: " + $(this).data("row-id"));
    }).end().find(".command-delete").on("click", function(e)
    {
        alert("You pressed delete on row: " + $(this).data("row-id"));
    });
});*/