JAVASCRIPT   70

vccCommon

Guest on 29th June 2022 02:00:52 PM

  1. function clearVCCErrors(){$("#messageErrors").hide();
  2. }function showVCCError(a){$("#messageErrors").show();
  3. $("#errorsList").html(a);
  4. }function validInteger(b){var a=parseInt(b.trim());
  5. if(a<0){return false;
  6. }if(/^[0-9]*$/.test(b.trim())==false){return false;
  7. }return true;
  8. }function randomString(d,c){var a="";
  9. for(var b=d;
  10. b>0;
  11. --b){a+=c[Math.round(Math.random()*(c.length-1))];
  12. }return a;
  13. }function printVCC(c,a,f,g){$("#printVCCBtn").prop("disabled","disabled");
  14. $("#printVCCBtn").attr("disabled","disabled");
  15. var i=$("#printWOSignature").val();
  16. if(i==1){i=true;
  17. }else{i=false;
  18. }show_printing();
  19. var e=$("#isPrintWithSignatureAllowed").val();
  20. if(i==1&&e==1){i=true;
  21. }else{i=false;
  22. }var h=randomString(32,"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
  23. var b=f+"/print/vcc/print.pdf?requestType="+g+"&requestId="+c+"&printFlag="+i+"&printRequest=true&randomVal="+h;
  24. $("<iframe />").addClass("printFrame").attr("src",b).css({width:0,height:0,display:"none"}).appendTo(document.body).on("load",hide_printing);
  25. var d=$(".printFrame")[0];
  26. d.onreadystatechange=function(){if(d.readyState=="complete"){hide_printing();
  27. }};
  28. }function changeSearchFields(){$("input[type=text]").each(function(a){if($(this).val()!=null&&$(this).val()!=""){$(this).val(null);
  29. }});
  30. if($("#searchTypeId").val()==2){$("#SBDec").show();
  31. $("#SBRequestNo").hide();
  32. $("#SBGenInfo").hide();
  33. $("#SBVCCNo").hide();
  34. $("#SBChassisNo").hide();
  35. $("#requestType").show();
  36. }else{if($("#searchTypeId").val()==1){$("#SBDec").hide();
  37. $("#SBGenInfo").hide();
  38. $("#SBRequestNo").show();
  39. $("#SBVCCNo").hide();
  40. $("#SBChassisNo").hide();
  41. $("#requestType").hide();
  42. }else{if($("#searchTypeId").val()==3){$("#SBDec").hide();
  43. $("#SBRequestNo").hide();
  44. $("#SBGenInfo").show();
  45. $("#SBVCCNo").hide();
  46. $("#SBChassisNo").hide();
  47. $("#endDate").val($("#curDate").val());
  48. $("#fromDate").val($("#curDate").val());
  49. }else{if($("#searchTypeId").val()==4){$("#SBDec").hide();
  50. $("#SBRequestNo").hide();
  51. $("#SBGenInfo").hide();
  52. $("#SBVCCNo").show();
  53. $("#SBChassisNo").hide();
  54. $("#requestType").show();
  55. }else{if($("#searchTypeId").val()==5){$("#SBDec").hide();
  56. $("#SBRequestNo").hide();
  57. $("#SBGenInfo").hide();
  58. $("#SBVCCNo").hide();
  59. $("#SBChassisNo").show();
  60. }else{if($("#searchTypeId").val()==-1){$("#SBDec").hide();
  61. $("#SBGenInfo").hide();
  62. $("#SBRequestNo").hide();
  63. $("#SBVCCNo").hide();
  64. $("#SBChassisNo").hide();
  65. }}}}}}}$("#searchTypeId").change(function(a){changeSearchFields();
  66. });
  67. function isSpecialCharacter(d,g){var a=true;
  68. var b=/^[a-zA-Z0-9]*$/;
  69. var f=/[+$&-//\\_,:;=?@#|ļæ½>!`<~%"^}{.]/;
  70. /;
  71. var c=$(d).val();
  72. if(f.test(c)){showVCCError("<ul><li>"+g+" cannot have special characters.</li>");
  73. a=false;
  74. }else{if(a-zA-Z0-9]*$/.te.test(d.val())==false){showVCCError("<ul><li>"+g+" cannot have special characters.</li>");
  75. a=false;
  76. }}return a;
  77. }function checkdate(b){var a=d{2}\-\d{2}\-\d{4}$/;
  78. v;
  79. var h=false;
  80. var c="";
  81. if(!a.test($(b).val())){c="<ul><li>Invalid Date Format</li><ul/>";
  82. }else{var g=$(b).val().split("-")[1];
  83. var d=$(b).val().split("-")[0];
  84. var e=$(b).val().split("-")[2];
  85. var f=new Date(e,g-1,d);
  86. if((f.getMonth()+1!=g)||(f.getDate()!=d)||(f.getFullYear()!=e)){c="<ul><li>Invalid Day, Month, or Year range detected. Please correct and submit again</li></ul>";
  87. }else{h=true;
  88. }}if(h==false){b.select();
  89. }return c;
  90. }function setDefaultSearch(){$("#searchTypeId").prop("selectedIndex",1);
  91. }function checkPrintDate(b){var a=d{2}\-\d{2}\-\d{4}$/;
  92. v;
  93. var h=false;
  94. var c="";
  95. if(!a.test($(b).val())){c="<li>Invalid Date Format</li>";
  96. }else{var g=$(b).val().split("-")[1];
  97. var d=$(b).val().split("-")[0];
  98. var e=$(b).val().split("-")[2];
  99. var f=new Date(e,g-1,d);
  100. if((f.getMonth()+1!=g)||(f.getDate()!=d)||(f.getFullYear()!=e)){c="<li>Invalid Date Format</li>";
  101. }else{h=true;
  102. }}if(h==false){b.select();
  103. }return c;
  104. }function removeEsteric(b){var a=$(b).val();
  105. if(a=="5"){$("#custCodeEsteric").css({display:"none"});
  106. }else{$("#custCodeEsteric").css({display:""});
  107. }}function restoreSearchFields(){if($("#searchTypeId").val()==2){$("#SBDec").show();
  108. $("#SBRequestNo").hide();
  109. $("#SBGenInfo").hide();
  110. $("#SBVCCNo").hide();
  111. $("#SBChassisNo").hide();
  112. $("#requestType").show();
  113. }else{if($("#searchTypeId").val()==1){$("#SBDec").hide();
  114. $("#SBGenInfo").hide();
  115. $("#SBRequestNo").show();
  116. $("#SBVCCNo").hide();
  117. $("#SBChassisNo").hide();
  118. $("#requestType").hide();
  119. }else{if($("#searchTypeId").val()==3){$("#SBDec").hide();
  120. $("#SBRequestNo").hide();
  121. $("#SBGenInfo").show();
  122. $("#SBVCCNo").hide();
  123. $("#SBChassisNo").hide();
  124. $("#endDate").val($("#curDate").val());
  125. $("#fromDate").val($("#curDate").val());
  126. }else{if($("#searchTypeId").val()==4){$("#SBDec").hide();
  127. $("#SBRequestNo").hide();
  128. $("#SBGenInfo").hide();
  129. $("#SBVCCNo").show();
  130. $("#SBChassisNo").hide();
  131. $("#requestType").show();
  132. }else{if($("#searchTypeId").val()==5){$("#SBDec").hide();
  133. $("#SBRequestNo").hide();
  134. $("#SBGenInfo").hide();
  135. $("#SBVCCNo").hide();
  136. $("#SBChassisNo").show();
  137. }else{if($("#searchTypeId").val()==-1){$("#SBDec").hide();
  138. $("#SBGenInfo").hide();
  139. $("#SBRequestNo").hide();
  140. $("#SBVCCNo").hide();
  141. $("#SBChassisNo").hide();
  142. }}}}}}}function isSpecialCharForCustCode(c,f){var a=true;
  143. var d=$&\\_/,:;,:;=?@#|ļæ½>!`<~%"^} *{.]/;
  144. var b=$(c).val();
  145. if(d.test(b)){showVCCError("<ul><li>"+f+" cannot have special characters.</li>");
  146. a=false;
  147. }retur

Raw Paste


Login or Register to edit or fork this paste. It's free.