Rev 23506 | Rev 23539 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$("a.view-returns").live('click', function() {viewReturns("main-content");});$("a.pending-returns").live('click', function() {viewPendingReturns("main-content");});$("a.approved-returns").live('click', function() {viewApprovedReturns("main-content");});$("a.wh-display-name").live('click', function() {var whId = $(this).closest('tr').data('id');$("#approved-returns-container").find("tr.filter").hide().filter('[data-id="' + whId + '"]').show();$(this).closest('tr').removeClass('warning');$(this).closest('tr').addClass('warning');});$("a.request-return").live('click', function() {if(confirm("Are you sure?")) {createReturnRequest($(this).data("inventoryitemid"), $(this));}});$("a.approve-return").live('click', function() {if(confirm("Are you sure to Approve?")) {approveReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));}});$("a.deny-return").live('click', function() {if(confirm("Are you sure to Deny?")) {denyReturnRequest($(this).closest('td').data("inventoryitemid"), $(this).closest('td'));}});$("a.view-debit-note").live('click', function() {viewDebitNote($(this).closest('tr').data("id"));});/*$("a.generate-debit-note").live('click', function() {if(confirm("Are you sure?")) {generateDebitNote($(this).closest('tr').data("id"));}});*/});function viewReturns(domId){doAjaxRequestHandler(context+"/return/inventory", "GET", function(response){$('#' + domId).html(response);});}function viewPendingReturns(domId){doAjaxRequestHandler(context+"/return/pending", "GET", function(response){$('#' + domId).html(response);});}function viewApprovedReturns(domId){doAjaxRequestHandler(context+"/return/approved", "GET", function(response){$('#' + domId).html(response);$("#approved-returns").find('a:first').click();});}function createReturnRequest(inventoryItemId, container){doAjaxRequestHandler(context+"/return/inventory/" + inventoryItemId, "PUT", function(response){if(response=='true') {container.closest('td').html('Return requested');}});}function approveReturnRequest(inventoryItemId, container){doAjaxRequestHandler(context+"/return/inventory/approve/" + inventoryItemId, "PUT", function(response){if(response=='true') {container.closest('td').html('Return Approved');}});}function denyReturnRequest(inventoryItemId, container){doAjaxRequestHandler(context+"/return/inventory/deny/" + inventoryItemId, "PUT", function(response){if(response=='true') {container.closest('td').html('Return denied');}});}function viewDebitNote(warehouseId){doAjaxRequestHandler(context+"/return/debit-note/view/" + warehouseId, "GET", function(response){//Download PDF code});}function generateDebitNote(warehouseId){doAjaxRequestHandler(context+"/return/debit-note/generate/" + warehouseId, "PUT", function(response){if(response=='true') {//Download the pdf}});}function getDebitNote(debitNotedId) {doAjaxRequestHandler(context+"/return/debit-note/" + debitNotedId, "GET", function(response){});}