JAVASCRIPT   76

vccSearch

Guest on 29th June 2022 01:59:07 PM

  1. var showBusinessCode;
  2. var appPath;
  3. var declarationErrorString;
  4. var declarationErrorStringNo2;
  5. var vccrequestErrorString;
  6. var vccrequestErrorStringNo2;
  7. var generalDetailsErrorString;
  8. var generalDetailsErrorStringNo2;
  9. var generalDetailsDateErrorString;
  10. var generalDetailsDateErrorStringNo2;
  11. var vccNoErrorString;
  12. var vccNoErrorStringNo2;
  13. var chassisNoErrorSrting;
  14. var genericErrorString;
  15. function settingVariables(d,a,c,b){appPath=d;
  16. showBusinessCode=a;
  17. genericErrorString=c;
  18. currentDate=b;
  19. }function settingDeclarationErrorStrings(a,b){declarationErrorString=a;
  20. declarationErrorStringNo2=b;
  21. }function settingVCCRequestNoErrorStrings(a,b){vccrequestErrorString=a;
  22. vccrequestErrorStringNo2=b;
  23. }function settingGeneralDetailsErrorStrings(a,b){generalDetailsErrorString=a;
  24. generalDetailsErrorStringNo2=b;
  25. }function settingGeneralDetailsDateErrorStrings(a,b){generalDetailsDateErrorString=a;
  26. generalDetailsDateErrorStringNo2=b;
  27. }function settingVccNoErrorStrings(b,a){vccNoErrorString=b;
  28. vccNoErrorStringNo2=a;
  29. }function settingChassisNoErrorString(a){chassisNoErrorSrting=a;
  30. }function resetVCCSearch(){setDefaultVCCSearch();
  31. changeSearchFields();
  32. $("#customerUserType").prop("selectedIndex",0);
  33. $("#messageErrors").css({display:"none"});
  34. }function doSearch(){var a=validate();
  35. if(a){nonAngularCall("findDto",{url:document.forms[0].action,query:$(document.forms[0]).serialize()});
  36. return true;
  37. }else{return false;
  38. }}function resetDto(a){if(!a){a=getAngularScopeObject("[data-ng-controller='searchController']",0);
  39. }a.$apply(function(){a.dto={};
  40. });
  41. }$("#searchTypeId").change(function(a){$("#customerUserType").val("");
  42. changeSearchFields();
  43. });
  44. $(document).ready(dtoToJsonController);
  45. function validate(){var b=true;
  46. var c="";
  47. if($("#searchTypeId").val()!=-1){if($("#searchTypeId").val()==2){c=validateDeclarationNo(c);
  48. var a=isSpecialCharacter($("#declarationNum"),"Declaration No.");
  49. if(!a){return false;
  50. }}else{if($("#searchTypeId").val()==1){c=validateRequestNo(c);
  51. var a=isSpecialCharacter($("#requestNo"),"Request No.");
  52. if(!a){return false;
  53. }}else{if($("#searchTypeId").val()==3){c=validateGenInfo(c);
  54. var a=isSpecialCharForCustCode($("#businessCode"),"Customer Code");
  55. if(!a){return false;
  56. }}else{if($("#searchTypeId").val()==4){c=validateVCCNumber(c);
  57. var a=isSpecialCharacter($("#vccNo"),"VCC Number");
  58. if(!a){return false;
  59. }}else{if($("#searchTypeId").val()==5){c=validateChassisNo(c);
  60. var a=isSpecialCharacter($("#chassisNo"),"Chassis No.");
  61. if(!a){return false;
  62. }}}}}}}else{c="<ul><li>"+this.genericErrorString+"</li></ul>";
  63. }if(c!=""){showVCCError(c);
  64. }return(c=="");
  65. }function validateGenInfo(d){var c=true;
  66. var b=$("#customerUserType").val();
  67. if(this.showBusinessCode=="true"){if(b==""||b==null){d=d+"<ul><li>"+this.generalDetailsErrorString+"</li></ul>";
  68. c=false;
  69. }else{if(b!="5"){var a=$("#businessCode").val();
  70. if(a==null||a==""){d=d+"<ul><li>"+this.generalDetailsErrorStringNo2+"</li></ul>";
  71. c=false;
  72. }}}}if(d==""){d=validatedateRange(d);
  73. }return d;
  74. }function validateDeclarationNo(b){var a=$("#declarationNum").val();
  75. if(a==""){b=b+"<ul><li>"+this.declarationErrorString+"</li></ul>";
  76. }if(isNaN(a)){b=b+"<ul><li>"+this.declarationErrorStringNo2+"</li></ul>";
  77. }return b;
  78. }function validateRequestNo(b){var a=$("#requestNo").val();
  79. if(a==""){b+="<ul><li>"+this.vccrequestErrorString+"</li></ul>";
  80. }else{if(isNaN(a)){b+="<ul><li>"+this.vccrequestErrorStringNo2+"</li></ul>";
  81. }}return b;
  82. }function validateVCCNumber(b){var a=$("#vccNo").val();
  83. if(a==""){b=b+"<ul><li>"+this.vccNoErrorString+"</li></ul>";
  84. }else{if(isNaN(a)){b=b+"<ul><li>"+this.vccNoErrorStringNo2+"</li></ul>";
  85. }}return b;
  86. }function validateChassisNo(b){var a=$("#chassisNo").val();
  87. if(a==""){b=b+"<ul><li>"+this.chassisNoErrorSrting+"</li></ul>";
  88. }return b;
  89. }function validatedateRange(c){var b=$("#vccFromDate").val();
  90. var a=$("#vccToDate").val();
  91. if(b==null||b==""){c=c+"<ul><li>"+this.generalDetailsDateErrorString+"</li></ul>";
  92. }else{if(a==null||a==""){c=c+"<ul><li>"+this.generalDetailsDateErrorStringNo2+"</li></ul>";
  93. }}if(b!=null&&b!=""){c+=checkdate($("#vccFromDate"));
  94. }if(c==""&&a!=null&&a!=""){c+=checkdate($("#vccToDate"));
  95. }return c;
  96. }function showDeclarationPopUp(b){var c=$(b).data("request-id");
  97. var a=this.appPath+"/declaration/dc/setupViewCustomsDeclaration.do?value(declarationId)="+c;
  98. $(b).attr("data-toggle","modal");
  99. $(b).attr("data-iframe-url",a);
  100. }function showPopUp(b,a){$(b).attr("data-toggle","modal");
  101. var d=$(b).data("request-id");
  102. var c=a+"?value(requestId)="+d;
  103. $(b).attr("data-iframe-url",c);
  104. }function showVCCPopUp(b,a){$(b).attr("data-toggle","modal");
  105. var d=$(b).data("request-id");
  106. var c=a+"?value(vehicleDetailId)="+d;
  107. $(b).attr("data-iframe-url",c);
  108. }function isSpecialCharForCustCode(c,f){var a=true;
  109. var d=/[+$&\\_/,:;=?@#|ļæ½>!`<~%"^}*{.]/;
  110. var b=$(c).val();
  111. if(d.test(b)){showVCCError("<ul><li>"+f+" cannot have special characters.</li>");
  112. a=false;
  113. }return a;
  114. }function changeSearchFieldsOverriden(){changeSearchFields();
  115. if($("#searchTypeId").val()==3){$("#vccFromDate").val(currentDate);
  116. $("#vccToDate").val(currentDate);
  117. }}window.onload=function(){$("#searchTypeId").change(function(a){$("#customerUserType").val("");
  118. changeSearchFieldsOverriden();
  119. });
  120. };
  121. function setDefaultVCCSearch(){$("#searchTypeId").prop("selectedIndex",0)

Raw Paste


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