Rev 4207 | Rev 23989 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
function addNewRowForItem() {$('table#bulk-order-items tbody>tr:first').clone(true).insertAfter($('table#bulk-order-items tbody>tr:last'));var newRow = $('table#bulk-order-items tbody>tr:last');// Enabling the new record added$(newRow).find('input').removeAttr('disabled');// Making this row visible$(newRow).show();}function validateForm() {return true;}function updateTotalAmount() {var totalAmount = 0;$('table#bulk-order-items tbody>tr').each(function(index, element) {// Ignoring the first sample rowif (index == 0) {return;}var price = $(element).find('input[name="unit_price"]').val();var quantity = $(element).find('input[name="quantity"]').val();var amount = price * quantity;totalAmount += amount;var amountInput = $(element).find('div#item-amount');$(amountInput).html(amount);});$('#bulk-order-total-amount').val(totalAmount);}function hideShowTin() {if($('#orderType').val() == "B2Cbulk") {$('#tin').hide();}else {$('#tin').show();}}function submitBulkOrderForm() {if (validateForm()) {// index starts from zero, Also we need to ignore first sample row$('table#bulk-order-items tbody>tr').each(function(rowIndex, rowElement) {// Skipping first sample rowif (rowIndex != 0) {$(rowElement).find('input').each(function(inputIndex, inputElement) {if ($(inputElement).attr('name').indexOf('lineItems[') == -1) {$(inputElement).attr('name', 'lineItems[' + (rowIndex - 1) + '].' + $(inputElement).attr('name'));}});}});$('div#error').empty();$.ajax({type : 'POST',url : '/Support/bulk-order',data : $('form#bulk-order').serialize(),success : function(response) {if ($(response).attr('id') == 'error') {$('div#error').html(response);}else {document.write(response);}}});}}function updateModelName(trElement, itemId) {$.ajax({type : 'GET',url : '/Support/bulk-order!getModelName',data : 'itemId=' + itemId,success : function(response) {$(trElement).find('div#model_name').html(response);}});}