1jQuery(document).ready(function () { 2 window.onpopstate = function (event) { 3 window.history.state = event.state; 4 window.location.href = location.href; 5 }; 6 var baseUrl = window.location.origin; 7 var clientId = ""; 8 var ownerOrganizationName = []; 9 var memberOrganizationsName = []; 10 var userName = ""; 11 var approvalsId = ""; 12 var crfData = false; 13 14 15 switch (baseUrl) { 16 case "https://uat-nsws.investindia.gov.in": 17 keycloakUrl = "https://sso-uat-nsws.investindia.gov.in"; 18 clientId = "portal-stage"; 19 break; 20 case "https://dev-nsws.investindia.gov.in": 21 keycloakUrl = baseUrl; 22 clientId = "portal-dev"; 23 break; 24 case "https://qa-nsws.investindia.gov.in": 25 keycloakUrl = baseUrl; 26 clientId = "portal-qa"; 27 break; 28 case "https://www.ppe.nsws.gov.in": 29 keycloakUrl = baseUrl; 30 clientId = "portal-ppe"; 31 break; 32 case "https://www.nsws.gov.in": 33 keycloakUrl = baseUrl; 34 clientId = "portal-prod"; 35 break; 36 case "https://www.demo.nsws.gov.in": 37 keycloakUrl = baseUrl; 38 clientId = "portal-ppe-stage"; 39 break; 40 default: 41 keycloakUrl = "https://sso-uat-nsws.investindia.gov.in"; 42 baseUrl = "https://uat-nsws.investindia.gov.in"; 43 clientId = "portal-stage"; 44 break; 45 } 46 47 var keycloak = new Keycloak({ 48 realm: "madhyam", 49 url: keycloakUrl + "/auth/", 50 clientId: clientId, 51 }); 52 53 keycloak 54 .init({ 55 onLoad: "check-sso", 56 silentCheckSsoRedirectUri: 57 window.location.origin + "/silent-check-sso.html", 58 checkLoginIframe: true, 59 }) 60 .success(function (authenticated) { 61 if (authenticated) { 62 showMultiProjects(); 63 userProfileCentral(); 64 userDTO(); 65 if (localStorage.getItem("userDTO")) { 66 switchOrg(); 67 } 68 // if (!localStorage.getItem("userDTO")) { 69 // userDTO(); 70 // } 71 if (getCookie("userDTO") && localStorage.getItem("approvalID")) { 72 document.cookie = "userDTO=false"; 73 var redirection = localStorage.getItem("redirectionHomepage"); 74 setTimeout(function () { 75 if ( 76 !jQuery(".addapproval").hasClass("disabled") || 77 redirection == 0 78 ) { 79 updateTokenDrupal(localStorage.getItem("approvalID"), redirection); 80 localStorage.removeItem("approvalID"); 81 localStorage.removeItem("redirectionHomepage"); 82 } 83 }, 2000); 84 } 85 } 86 return false; 87 }) 88 .error(function () { 89 console.log("Failed to check sso"); 90 }); 91 92 jQuery(document).on("click", ".addapproval", function () { 93 // localStorage.setItem("redirectionHomepage", 1); 94 // localStorage.setItem("redirectHome", 1); 95 // jQuery("body").append( 96 // " <div class='loader-wrapper'><img src='themes/sws/images/loader.gif' alt='loader-img' /></div>" 97 // ); 98 var approvalsId = jQuery(this).attr("data-id"); 99 localStorage.setItem("approvalsId", approvalsId); 100 }); 101 102 103 104 function initKeycloak() { 105 keycloak 106 .init({ onLoad: "login-required" }) 107 .success(function (authenticated) { }) 108 .error(function () { 109 console.log("Failed to initialize init"); 110 }); 111 } 112 113 function updateTokenDrupal(approvalId, redirection = 1) { 114 keycloak 115 .updateToken(30) 116 .success(function () { 117 if (crfData) { 118 addApprovalToCart(approvalId, redirection); 119 } 120 else { 121 // showNotification( "Complete your organisation profile", "error"); 122 if (localStorage.getItem("redirectHome")) { 123 localStorage.removeItem("redirectHome"); 124 jQuery(".loader-wrapper").hide(); 125 jQuery("#modal-content,#modal-background") 126 .toggleClass("modal-active") 127 .css("display", "block"); 128 if ( 129 jQuery("#modal-content,#modal-background").hasClass("modal-active") 130 ) { 131 jQuery("body").css("overflow", "hidden"); 132 } else { 133 jQuery("body").css("overflow", "auto"); 134 } 135 } 136 } 137 }) 138 .error(function () { 139 console.log("Failed to refresh token"); 140 }); 141 } 142 143 // POST API to Add Users Permissions. 144 var userDTO = function () { 145 var url = baseUrl + "/gateway/user/user/getUserPermission"; 146 var req = new XMLHttpRequest(); 147 req.open("GET", url, true); 148 req.setRequestHeader("Content-Type", "application/json"); 149 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 150 req.onreadystatechange = function () { 151 if (req.readyState == 4) { 152 if (req.status == 200) { 153 var parseData = JSON.parse(req.response); 154 let data; 155 data = parseData.data; 156 data.user.permission = data.permission; 157 localStorage.setItem("userDTO", JSON.stringify(data.user)); 158 jQuery(".header_main_section #login-block").hide(); 159 jQuery(".header_main_section .dashboard-btn").show(); 160 jQuery(".header_main_section .cart-icon").show(); 161 jQuery(".user-info-header").show(); 162 switchOrg(); 163 let isAdmin = data.user.permission.includes( 164 "Admin_Dashboard_FE_View" 165 ); 166 if (isAdmin) { 167 jQuery(".btn-dashboard a").attr("href", "/portal/admin-dashboard"); 168 jQuery( 169 ".header_main_section .header_section .cart-icon a, .header_main_section .header_section .mobile-icon a.cart" 170 ).hide(); 171 } 172 let drupal_header = data.user.permission.includes( 173 "DRUPAL_HEADER_FE_View" 174 ); 175 if (!drupal_header) { 176 localStorage.removeItem("userDTO"); 177 localStorage.setItem("userSignout", true); 178 keycloak.logout(); 179 sessionStorage.clear(); 180 } 181 } else if (req.status == 403) { 182 console.log("Failed to get userDto"); 183 } 184 } 185 }; 186 req.send(); 187 document.cookie = "userDTO=true"; 188 return false;
189 }; 190 191 // POST API to Add Users to Cart. 192 var addApprovalToCart = function (approvalId, redirection = 1) { 193 var url = baseUrl + "/gateway/form-builder/marketplace/add-approval"; 194 var req = new XMLHttpRequest(); 195 req.open("POST", url, true); 196 req.setRequestHeader("Content-Type", "application/json"); 197 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 198 req.onreadystatechange = function () { 199 if (req.readyState == 4) { 200 if (req.status == 200) { 201 var parseData = JSON.parse(req.response); 202 var statusType = parseData.status ? "success" : "error"; 203 if (redirection === 1) { 204 showNotification(parseData.message, statusType); 205 } 206 else { 207 showNotification( 208 statusType == "success" 209 ? "Approval added to dashboard successfully" 210 : parseData.message, 211 statusType 212 ); 213 } 214 if (approvalId === null) { 215 jQuery(".loader-wrapper").hide(); 216 } 217 else if (crfData) { 218 jQuery(".loader-wrapper").hide(); 219 userCart(approvalId, redirection, parseData.status); 220 } 221 } else if (req.status == 403) { 222 console.log("Failed to add approval"); 223 } 224 } 225 }; 226 req.send( 227 JSON.stringify({ id: approvalId, username: keycloak.idTokenParsed.email }) 228 ); 229 return true; 230 }; 231 232 var staticCount = 0; 233 // POST API to get Users Data from cart. 234 var userCart = function (approvalId, redirection = 1, addedApprovalStatus) { 235 var url = baseUrl + "/gateway/form-builder/marketplace/user-cart"; 236 var req = new XMLHttpRequest(); 237 req.open("POST", url, true); 238 req.setRequestHeader("Content-Type", "application/json"); 239 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 240 req.onreadystatechange = function () { 241 if (req.readyState == 4) { 242 if (req.status == 200) { 243 var parseData = JSON.parse(req.response); 244 let data; 245 data = parseData.data; 246 if (redirection != 1 && addedApprovalStatus) { 247 localStorage.removeItem("homepageRedirection"); 248 staticCount += 1; 249 jQuery( 250 ".header-new .header_main_section .header_section .user_info.dashboard-btn.cart-count-animation .cart-count" 251 ).css("visibility", "visible"); 252 jQuery(".cart-count").html(`+${staticCount}`); 253 } else if (redirection == 1 && addedApprovalStatus) { 254 localStorage.removeItem("homepageRedirection"); 255 jQuery(".loader-wrapper").hide(); 256 // cafRedirection(approvalId, data); 257 } 258 } else if (req.status == 403) { 259 console.log("403 Forbidden to Add Approval to Cart"); 260 } 261 } 262 }; 263 req.send(JSON.stringify({ username: keycloak.idTokenParsed.email })); 264 }; 265 266 jQuery(".user_info .dashboard-button").click(function () { 267 staticCount = 0; 268 jQuery(".cart-count-animation .cart-count").css("visibility", "hidden"); 269 }); 270 271 function userProfileCentral(approvalID) { 272 var url = baseUrl + "/gateway/user/investor/org/fetchOrgProfile"; 273 var req = new XMLHttpRequest(); 274 req.open("GET", url, true); 275 req.setRequestHeader("Content-Type", "application/json"); 276 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 277 req.onreadystatechange = function () { 278 if (req.readyState == 4) { 279 if (req.status == 200) { 280 var parseData = JSON.parse(req.response); 281 let data; 282 data = parseData.data; 283 localStorage.setItem('fetchProfileData' , JSON.stringify(data)); 284 crfData = data.crfSubmittedOrNot ; 285 // userName = data.authorizedSignatory.firstName; 286 jQuery(".members-multiproject").parent().addClass("disable-member"); 287 if (data.crfSubmittedOrNot) { 288 jQuery(".loader-wrapper").hide(); 289 } else { 290 jQuery(".loader-wrapper").hide(); 291 jQuery(".addapproval").addClass("disabled"); 292 } 293 if (data.roleType === "OWNER") { 294 jQuery(".members-multiproject").parent().show(); 295 } 296 if (data.organization.incorporationFlow) { 297 jQuery(".incorporate-multiproject") 298 .parent() 299 .addClass("disable-list"); 300 jQuery(".ml-button a").addClass("disable-list"); 301 } 302 if(data.organization.orgVerifiedOrNot === false){ 303 jQuery(".ml-button").hide(); 304 } 305 else{ 306 jQuery(".ml-button").show(); 307 } 308 } 309 else if (req.status == 403) { 310 localStorage.removeItem('fetchProfileData'); 311 console.log("403 Forbidden User Profile Check"); 312 } 313 else{ 314 localStorage.removeItem('fetchProfileData'); 315 } 316 } 317 }; 318 req.send(); 319 return true; 320 } 321 322 // Get cookie by name. 323 function getCookie(cookieName) {
324 let cookie = {}; 325 document.cookie.split(";").forEach(function (el) { 326 let [key, value] = el.split("="); 327 cookie[key.trim()] = value; 328 }); 329 return cookie[cookieName]; 330 } 331 332 function getProfileData(){ 333 let data = localStorage.getItem('fetchProfileData'); 334 let jsonData; 335 try { 336 jsonData = JSON.parse(data); 337 } catch (error) { 338 console.log(error); 339 } 340 return jsonData; 341 } 342 343 // Remove login token if Signout link is clicked. 344 jQuery(".header-dashboard-dropdown .header-dashboard-menu li .sign-out").on( 345 "click", 346 function (e) { 347 localStorage.removeItem("userDTO"); 348 localStorage.removeItem("member"); 349 localStorage.removeItem("owner"); 350 localStorage.removeItem("fetchProfileData"); 351 localStorage.setItem("userSignout", true); 352 // localStorage.removeItem("anonymousInvestor"); 353 keycloak.logout({ redirectUri: `${window.location.origin}/` }); 354 sessionStorage.clear(); 355 sessionStorage.setItem("popupShown", true); 356 } 357 ); 358 359 // Show notification. 360 function showNotification(message, msgType) { 361 var notification = new Noty( 362 { text: message, type: msgType, layout: "topRight" }, 363 500 364 ); 365 notification.show(); 366 } 367 368 // Header changes google analytics 369 // jQuery(document).on( 370 // "click","#explore .h4outer h4" , 371 // function(e){ 372 // e.preventDefault(); 373 // dataLayer.push({ 374 // 'event': 'Central_View_Details', 375 // 'approvalName': jQuery(e.target).parents('.explore_single').find('> h4').text() 376 // }); 377 // window.location.href = jQuery(e.target).parents('.explore_single').find('a.button.addapproval').attr('href') 378 // } 379 // ) 380 381 // jQuery(document).on( 382 // "click","#explore a.button.addapproval" , 383 // function(e){ 384 // e.preventDefault(); 385 // dataLayer.push({ 386 // 'event': 'Central_View_Details', 387 // 'approvalName': jQuery(e.target).parents('.explore_single').find('> h4').text() 388 // }); 389 // window.location.href = jQuery(e.target).parents('.explore_single').find('a.button.addapproval').attr('href') 390 // } 391 // ) 392 jQuery(document).on( 393 "click","#state .h4outer h4" , 394 function(e){ 395 e.preventDefault(); 396 dataLayer.push({ 397 'event': 'State_View_Details', 398 'approvalName': jQuery(e.target).parents('.state_single').find('> h4').text() 399 }); 400 window.location.href = jQuery(e.target).parents('.state_single').find('.stateHover > a').attr('href') 401 } 402 ) 403 404 jQuery(document).on( 405 "click","#state .button" , 406 function(e){ 407 e.preventDefault(); 408 dataLayer.push({ 409 'event': 'State_Add_to_dashboard', 410 'approvalName': jQuery(e.target).parents('.state_single').find('> h4').text() 411 }); 412 } 413 ) 414 // jQuery(document).on( 415 // "click","#explore .button-outline" , 416 // function(e){ 417 // e.preventDefault(); 418 // dataLayer.push({ 419 // 'event': 'Add In Dashboard', 420 // 'approvalName': jQuery(e.target).parents('.explore_single').find('> h4').text() 421 // }); 422 // } 423 // ) 424 425 426// Header changes 427 jQuery(document).on( 428 "click", 429 ".explore_single .exploreHover .button-group .button-outline, .state_single .stateHover .button-group .button", 430 function () { 431 localStorage.setItem("redirectionHomepage", 0); 432 localStorage.setItem("redirectHome", 0); 433 jQuery(".user_info.dashboard-btn.btn-dashboard").addClass( 434 "buzz-out-on-hover" 435 ); 436 jQuery(".buzz-out-on-hover").removeClass("cart-count-animation"); 437 setTimeout(function () { 438 jQuery(".user_info.dashboard-btn.btn-dashboard").addClass( 439 "cart-count-animation" 440 ); 441 }, 300); 442 // jQuery(".user_info.dashboard-btn.btn-dashboard").addClass("cart-count-animation"); 443 setTimeout(function () { 444 jQuery(".user_info.dashboard-btn.btn-dashboard").removeClass( 445 "buzz-out-on-hover" 446 ); 447 }, 800); 448 449 if(getProfileData() && ((getProfileData().organization.investorJourneyFlow === "INCORPORATION_OF_COMPANY") || (getProfileData().organization.investorJourneyFlow ==="FOREIGN_INVESTOR"))){ 450 jQuery("#modal-content,#modal-background") 451 .toggleClass("modal-active") 452 .css("display", "block"); 453 if (jQuery("#modal-content,#modal-background").hasClass("modal-active")) { 454 jQuery("body").css("overflow", "hidden"); 455 } else { 456 jQuery("body").css("overflow", "auto"); 457 } 458 return 459 } 460 461 approvalsId = jQuery(this).attr("data-id"); 462 if (localStorage.getItem("userDTO")) { 463 updateTokenDrupal(approvalsId, 0); 464 } else { 465 // localStorage.setItem("anonymousInvestor", "true"); 466 localStorage.setItem("homepageRedirection", "true"); 467 localStorage.setItem("approvalID", approvalsId); 468 initKeycloak(); 469 } 470 471 472 473 if (localStorage.getItem("redirectHome")) { 474 if ( 475 localStorage.getItem("member") === "0" && 476 localStorage.getItem("owner") === "0" 477 ) { 478 localStorage.removeItem("redirectHome"); 479 jQuery("#modal-content,#modal-background") 480 .toggleClass("modal-active") 481 .css("display", "block"); 482 if ( 483 jQuery("#modal-content,#modal-background").hasClass("modal-active") 484 ) { 485 jQuery("body").css("overflow", "hidden"); 486 } else { 487 jQuery("body").css("overflow", "auto"); 488 } 489 } 490 } 491 } 492 ); 493 494 // Modal close when profile is incomplete of user 495 jQuery("#modal-close").click(function () { 496 jQuery("#modal-content,#modal-background").css("display", "none"); 497 jQuery("body").css("overflow", "auto"); 498 localStorage.removeItem("member"); 499 localStorage.removeItem("owner"); 500 localStorage.removeItem("redirectHome"); 501 502 }); 503 jQuery(".profile-popup").click(function () { 504 jQuery("#modal-content,#modal-background").css("display", "none"); 505 jQuery("body").css("overflow", "auto"); 506 507 }); 508 509 510 // Get Project list 511 var showMultiProjects = function () { 512 keycloak 513 .updateToken(30) 514 .success(function () { 515 var url = baseUrl + "/gateway/user/investor/project/dashboard"; 516 var req = new XMLHttpRequest(); 517 req.open("GET", url, true); 518 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 519 req.onreadystatechange = function () { 520 if (req.readyState == 4) { 521 if (req.status == 200) { 522 var parseData = JSON.parse(req.response); 523 let data; 524 data = parseData.data; 525 if (data.length) { 526 showMultiProjectHeader(data); 527 } else { 528 createDefaultProject(); 529 } 530 } else if (req.status == 403) { 531 console.log("Failed to show multi projects"); 532 } 533 } 534 }; 535 req.send(); 536 }) 537 .error(function () { 538 console.log("Failed to refresh token"); 539 }); 540 }; 541 542 // Get Active Project Data for user 543 function showActiveProject(projectId, defaultProjectData = null) { 544 keycloak 545 .updateToken(30) 546 .success(function () { 547 var url = baseUrl + "/gateway/user/investor/project/" + projectId; 548 var req = new XMLHttpRequest(); 549 req.open("POST", url, true); 550 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 551 req.onreadystatechange = function () { 552 if (req.readyState == 4) { 553 if (req.status == 200) { 554 if (defaultProjectData) { 555 showMultiProjectHeader(defaultProjectData); 556 } else { 557 window.location.reload(); 558 } 559 } else if (req.status == 403) { 560 console.log("Failed to show active project"); 561 } 562 } 563 }; 564 req.send(); 565 }) 566 .error(function () { 567 console.log("Failed to refresh token"); 568 }); 569 } 570 571 // Change Active Project on clicking project. 572 jQuery(document).on("click", ".multiproject-block", function () { 573 var projectId = jQuery(this).attr("data-id"); 574 showActiveProject(projectId); 575 }); 576 577 // Show hide multiproject dropdown if projects are available. 578 function showMultiProjectHeader(data) { 579 var multiprojects = ""; 580 var len = data.length; 581 var dashboardIcon = data[0].name 582 .match(/\b(\w)/g) 583 .join("") 584 .substring(0, 2); 585 jQuery(".dashboard-button").prepend( 586 `<div class="dashboard-svg">${dashboardIcon}</div>` 587 ); 588 jQuery(".dashboard-button .single-project-svg").hide(); 589 jQuery.each(data, function (key, valueObj) { 590 var activeBlockClass = key ? "" : "active"; 591 var profileStatus = valueObj.isProfileComplete ? "comp" : "pending"; 592 var icon = valueObj.name 593 .match(/\b(\w)/g) 594 .join("") 595 .substring(0, 2); 596 if (key == 5) { 597 multiprojects += ` 598 <a href="/portal/investor-dashboard/profile?profiletab=2" class="multiproject-block">
599 <span class="project">+${len - 5} </span> 600 <div class="multiproject-title"> 601 <h3 class="ml-heading"> View all projects</h3> 602 <p>${len - 5} more projects are there</p> 603 </div> 604 <div class="view-btn"> 605 <svg viewBox="64 64 896 896" focusable="false" data-icon="right" width="1em" height="1em" fill="#7b7b7b" aria-hidden="true"> 606 <path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"> 607 </path> 608 </svg> 609 </div> 610 </a> 611 `; 612 return false; 613 } 614 615 multiprojects += ` 616 617 <div class="multiproject-block ${activeBlockClass} ${profileStatus} " data-id=${valueObj.id}> 618 <span class="project"> ${icon} </span> 619 <div class="multiproject-title"> 620 <h3 class="ml-heading"> ${valueObj.name}</h3> 621 <p>Project No. - ${valueObj.displayId}</p> 622 </div> 623 </div> 624 625 `; 626 }); 627 jQuery(".multi-project-list").html(multiprojects); 628 jQuery( 629 ".header-dashboard-dropdown .header-dashboard-inner .multi-project" 630 ).css({ display: "block" }); 631 jQuery(".pending").prop('disabled', true); 632 jQuery(".pending").hover(function () { 633 var dynamicHeight = jQuery(this).offset().top; 634 jQuery('.incomplete-profile-popup .incomplete-profile-title').css("top",dynamicHeight); 635 jQuery('.incomplete-profile-popup').toggle(); 636 637 }); 638 } 639 640 // Post API to create default "Project 1" for newly created user. 641 function createDefaultProject() { 642 var url = baseUrl + "/gateway/user/investor/project/create"; 643 var req = new XMLHttpRequest(); 644 req.open("POST", url, true); 645 req.setRequestHeader("Content-Type", "application/json"); 646 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 647 req.onreadystatechange = function () { 648 if (req.readyState == 4) { 649 if (req.status == 200) { 650 var parseData = JSON.parse(req.response); 651 let data; 652 data = parseData.data; 653 showActiveProject(data[0].id, data); 654 } else if (req.status == 403) { 655 console.log("Failed to show active project"); 656 } 657 } 658 }; 659 req.send(JSON.stringify({ id: null, name: "Project 1" })); 660 } 661 662 // Refresh keycloak token manually calling this function. 663 function updateTokenLocal() { 664 keycloak 665 .updateToken(30) 666 .success(function () { 667 console.log("token refresh"); 668 }) 669 .error(function () { 670 console.log("Failed to refresh token"); 671 }); 672 } 673 674 // Switch Organizations 675 var switchOrg = function () { 676 const userDetails = localStorage.getItem("userDTO"); 677 const userDTO = JSON.parse(userDetails); 678 var url = 679 baseUrl + 680 `/gateway/user/org/fetchUsersOrganizations?userId=${userDTO.id}`; 681 var req = new XMLHttpRequest(); 682 req.open("GET", url, true); 683 req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 684 req.onreadystatechange = function () { 685 if (req.readyState == 4) { 686 if (req.status == 200) { 687 var parseData = JSON.parse(req.response); 688 let data; 689 data = parseData.data; 690 const organisationCount = 691 data?.memberOrganizations?.length + 692 (data?.ownerOrganization?.organizationId ? 1 : 0); 693 ownerOrganizationName = data?.ownerOrganization?.organizationName; 694 for ( 695 let member = 0; 696 member < data.memberOrganizations.length; 697 member++ 698 ) { 699 memberOrganizationsName[member] = 700 data.memberOrganizations[member].organizationName; 701 } 702 localStorage.setItem("member", data?.memberOrganizations?.length); 703 localStorage.setItem( 704 "owner", 705 data?.ownerOrganization?.organizationId ? 1 : 0 706 ); 707 if (localStorage.getItem("redirectHome")) { 708 709 if ( 710 localStorage.getItem("member") === "0" && 711 localStorage.getItem("owner") === "0" 712 ) { 713 714 localStorage.removeItem("redirectHome"); 715 jQuery("#modal-content,#modal-background") 716 .toggleClass("modal-active") 717 .css("display", "block"); 718 if ( 719 jQuery("#modal-content,#modal-background").hasClass( 720 "modal-active" 721 ) 722 ) { 723 jQuery("body").css("overflow", "hidden"); 724 } else { 725 jQuery("body").css("overflow", "auto"); 726 } 727 } 728 729 } 730 if (organisationCount <= 1) { 731 jQuery(".switch-organization").parent().hide(); 732 } else { 733 jQuery(".switch-organization").parent().show(); 734 } 735 } else if (req.status == 403) { 736 console.log("Failed to switch projects"); 737 } 738 } 739 }; 740 req.send(); 741 }; 742 743 744 // Redirect Sector to Investor KYA
745 function getMasterKYA(sectorId) { 746 var url = baseUrl + "/gateway/investor-kya/kya/getMasterKYA"; 747 var req = new XMLHttpRequest(); 748 req.open("POST", url, true); 749 req.setRequestHeader("Content-Type", "application/json"); 750 // req.setRequestHeader("Authorization", "Bearer " + keycloak.token); 751 req.onreadystatechange = function () { 752 if (req.readyState == 4) { 753 if (req.status == 200) { 754 localStorage.setItem("sectorRedirectionHomepage", JSON.stringify({organizationType:"SECTOR",sectorId: sectorId})) 755 window.location.href = "/portal/investorKya"; 756 } else if (req.status == 403) { 757 console.log("Failed to redirect to KYA"); 758 } 759 } 760 }; 761 762 req.send(JSON.stringify({ organizationType:"SECTOR",sectorId: sectorId })); 763 } 764 765 // Sector dropdown list redirection 766 jQuery('.no-ex-link,.sector-wrapper .sector-container .full-link' ).on('click', function () { 767 var sectorId = jQuery(this).attr('id'); 768 var sectorIdrel = jQuery(this).attr('rel'); 769 if((sectorId !== "0" && sectorId !== undefined)){ 770 getMasterKYA(sectorId); 771 } 772 else{ 773 localStorage.removeItem("sectorRedirectionHomepage"); 774 window.location.href = "/portal/investor-decision"; 775 } 776 }); 777 jQuery(".sector-list-li a").unbind("mouseup").bind("mouseup",function(e){ 778 e.preventDefault(); 779 var sectorIdrel = jQuery(this).attr('rel'); 780 if((sectorIdrel !== "0" && sectorIdrel !== undefined)){ 781 getMasterKYA(sectorIdrel); 782 } 783 else{ 784 localStorage.removeItem("sectorRedirectionHomepage"); 785 window.location.href = "/portal/investor-decision"; 786 } 787 }); 788});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.