Rev 1481 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function(){$('#communication_category').change(function(){$('#orderComponent, #awbComponent, #productComponent, #subjectComponent, #msgComponent').hide();$('#frmContactUs input[name="submit"]').removeAttr('disabled');switch(parseInt($(this).val())) {case 1:$('#orderComponent, #productComponent, #subjectComponent, #msgComponent').show();$('#lblSubject').html('Reason');$('#reason_to_return').attr('name', 'subject').show();$('#delivery_problem, #subject').removeAttr('name').hide();$('#product').attr('disabled', 'true');jQuery.ajax({type: "GET",url: "/contact-us/to_return",success: function(data) {$("#order_id").html(data);}});lastQueryType = 1;break;case 2:$('#orderComponent, #subjectComponent, #msgComponent').show();$('#lblSubject').html('Reason');$('#subject').attr('name', 'subject').show();$('#delivery_problem, #reason_to_return').removeAttr('name').hide();jQuery.ajax({type: "GET",url: "/contact-us/to_cancel",success: function(data) {$("#order_id").html(data);}});lastQueryType = 2;break;case 3:$('#orderComponent, #subjectComponent, #msgComponent').show();$('#lblSubject').html('Problem Type');$('#delivery_problem').attr('name', 'subject').show();$('#reason_to_return, #subject').removeAttr('name').hide();checkAndUpdateOrderSelector();lastQueryType = 3;break;case 4:$('#orderComponent, #msgComponent').show();checkAndUpdateOrderSelector();lastQueryType = 4;break;case 5:$('#orderComponent, #msgComponent').show();checkAndUpdateOrderSelector();lastQueryType = 5;break;case 6:$('#subjectComponent, #msgComponent').show();$('#lblSubject').html('Product Title');$('#subject').attr('name', 'subject').show();$('#delivery_problem, #reason_to_return').removeAttr('name').hide();checkAndUpdateOrderSelector();lastQueryType = 6;break;case 7:$('#subjectComponent, #msgComponent').show();$('#lblSubject').html('Subject');$('#subject').attr('name', 'subject').show();$('#delivery_problem, #reason_to_return').removeAttr('name').hide();checkAndUpdateOrderSelector();lastQueryType = 7;break;default:$('#orderComponent, #awbComponent, #productComponent, #subjectComponent, #msgComponent').hide();$('#submit').attr('disabled', 'disabled');break;}});function checkAndUpdateOrderSelector() {if (lastQueryType == 1 || lastQueryType == 2) {jQuery.ajax({type: "GET",url: "/contact-us/all_orders",success: function(data) {$("#order_id").html(data);}});}}$('#order_id').change(function(){var orderId = parseInt($(this).val());if(isNaN(orderId)) {alert("Order Id must be an integer");} else {jQuery.ajax({type: "GET",url: "/contact-us/" + orderId + "",success: function(data) {$("#product").removeAttr('disabled').html(data);}});}});$('form[name="frmContactUs"]').validate({rules: {email: {required: true,email: true},order_id: {required: true,digits: true}}});});