Rev 17428 | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$('input#add-lineitem').live('click', function() {addNewRowForLineItem($(this).parent().parent().children('table.lineitems'));});$('#remove-lineitem').live('click', function() {$(this).closest('tr').remove();updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));});$('input[name$=itemId]').live('change', function() {updateModelNameXferPrice($(this).closest('tr'), $(this).val(), $(this).attr('supplierId'));});$('input[name$=unitPrice]').live('change', function() {var quantity = $(this).closest('tr').find('input[name$=quantity]');var price = $(this).val();$(this).closest('tr').find('#amount').html(quantity * price);updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));});$('input[name$=quantity]').live('change', function() {var price = $(this).closest('tr').find('input[name$=unitPrice]');var quantity = $(this).val();if(quantity==0){alert('Quantity entered by is zero for this Item. It will not be considered in PO');}$(this).closest('tr').find('#amount').html(quantity * price);updateTotalAmount($(this).closest('div.lineitems').attr('supplierId'));});$('form.create-purchase-order').live('submit', function() {submitPurchaseOrderForm($(this));return false;});$('#editAndResendPOButton').live('click', function() {$(this).siblings('input[name$=resendPO]').val(1);submitEditPurchaseOrderForm($(this).closest('form'), $(this).siblings('input[name$=id]').val());});$('#editPOButton').live('click', function() {$(this).siblings('input[name$=resendPO]').val(0);submitEditPurchaseOrderForm($(this).closest('form'), $(this).siblings('input[name$=id]').val());});$('.show-details').live('click', function() {$(this).closest('tr').siblings().removeClass('bold');$(this).closest('tr').addClass('bold');$('div.lineitems').hide();$('#lineitems-' + $(this).attr('supplierId')).show();});$('.lineitems #cancel').live('click', function() {$('div.lineitems').hide();$('#suppliers').find('tr').removeClass('bold');});$('form.edit-purchase-order').live('submit', function() {return false;});$('#amendCancel').live('click', function() {document.location.href = '/inventory/purchase-order/' + $(this).attr('purchaseOrderId') + '/edit';});$('#close-po').live('click', function() {closePO($(this).attr('poId'));});$('#open-po-button').live('click', function() {openPO($(this).attr('poId'));});$('.change-po-warehouse').live('click', function() {$(this).hide();$(this).siblings('.change-po-warehouse-form').show();});$('.cancel-change-po-warehouse').live('click', function() {$(this).parent().siblings('.change-po-warehouse').show();$(this).parent().hide();});$('.cForm-class').change(function() {if ($(this).is(':checked')) {$(".cstCostTypeDiv-class").show();$('.cstCostType-class').val('ours');$('.extraCstInputs-class').hide();}else{$(".cstCostTypeDiv-class").hide();$('.cstCostType-class').val('ours');$('.extraCstInputs-class').hide();}});$('.cstCostType-class').change(function() {var cstCostType = $(this).val();if(cstCostType=="custom"){$('.extraCstInputs-class').show();$('.cstBorneByUs-class').val('0.00');}else{$('.extraCstInputs-class').hide();$('.cstBorneByUs-class').val('0.00');}});/*$('.adjustInventoryForm').hide();$('.adjustInventoryButton').attr('disabled',false);$('.adjustInventoryButton').live('click', function() {$(this).hide();$('.adjustInventoryButton').attr('disabled',true);$(this).siblings('.adjustInventoryForm').show();});$('.cancelButton').live('click', function() {$(this).parent().parent().siblings('.adjustInventoryButton').show();$('.adjustInventoryButton').attr('disabled',false);$('.quantityAdjust').val('');$(this).parent().parent().hide();});$('.setWeightForm').hide();$('.setWeightButton').attr('disabled',false);$('.setWeightButton').live('click', function() {$(this).hide();$('.setWeightButton').attr('disabled',true);$(this).siblings('.setWeightForm').show();});$('.cancelWeightButton').live('click', function() {$(this).parent().parent().siblings('.setWeightButton').show();$('.setWeightButton').attr('disabled',false);$('.weightVal').val('');$(this).parent().parent().hide();});$('.setWeightNew').live('click', function() {alert('Hi');var itemId = $(this).attr('itemId');var weight = $('.weightVal_'+itemId).val();var poId = $('.poId').val();console.log(typeof(weight));alert(weight);alert(poId);if(weight >15.0){//alert('Inside Condition');var didConfirm = confirm("Weight Entered is greater than 15 Kgs.\nAre you still want to Proceed");if(didConfirm==false){return false;}}submitSetWeightForm(itemId,weight,poId);return false;});$('.weightVal').keypress(function(e) {var a = [];var k = e.which;for (i = 46; i < 58; i++){if(i == 47){continue;}else{a.push(i);}}if (!(a.indexOf(k)>=0)){e.preventDefault();}});*/$('.link-requiring-itemid-for-productlabel').live('click', function(){var linkurl = $(this).attr('href');$('<form id = "tempForm" target=# onsubmit = "closeColorBox() "style = "text-align:center" method = "GET" action = "'+ linkurl +'">').appendTo('body');$('form#tempForm').append($('<span>Item Id: </span><input type = "text" name = "productLabelItemId" /><br>'));$('form#tempForm').append($('<span>Item No: </span><input type = "text" name = "productLabelItemNo" /><br>'));$('form#tempForm').append($('<input type = "submit" value = "Submit"/>'));$.colorbox({inline : true,width : "425px",height : "200px",opacity : "0.30",overlayClose : true,escKey : true,href : "#tempForm",onClosed : function() {$('#tempForm').remove();}});event.preventDefault();return false;});function closeColorBox(){$.colorbox.close();var productLabelItemId = $("input[name='productLabelItemId']").val();if(productLabelItemId==null || productLabelItemId==""){alert("Please enter Item Id");$('input[name=productLabelItemId]').focus();return false;}var productLabelItemNo = $("input[name='productLabelItemNo']").val();if(productLabelItemNo==null || productLabelItemNo==""){alert("Please enter Item Number");$('input[name=productLabelItemNo]').focus();return false;}}});