let storageObj = {}; storageObj.userId = 0; storageObj.roleCode = null; const keySizeBytes = 32; const expiryDays = 1; const encryptDecryptCommonKey = { Key: 'RadiologyPartner' }; const encryptDecryptCommonUserIDKey = { Key: 'RadiologyPartnerUserID' }; const encryptDecryptCommonUserRoleKey = { Key: 'RadiologyPartnerUserRole' }; const encryptDecryptCommonSInKey = { Key: 'RadiologyPartnerUserSignIn' }; const ParentStore = ".AspNet.ApplicationAccess"; const ChildStore = ".AspNet.ApplicationKey"; const IdentityStore = ".AspNet.ApplicationIdentity"; const UserRole = ".AspNet.ApplicationUserRole"; const UserDetails = ".AspNet.ApplicationUD"; storageObj.SetStore = function (storeName, values, expiryDays) { try { const date = new Date(); date.setTime(date.getTime() + (expiryDays * 24 * 60 * 60 * 1000)); const expires = "expires=" + date.toUTCString(); // document.cookie = storeName + "=" + encodeURIComponent(JSON.stringify(values)) + "; expires=" + expiryDays+ ";path=/"; document.cookie = storeName + "=" + encodeURIComponent(JSON.stringify(values)) + ";" + expires + ";path=/"; } catch (ex) { console.error("[storageObj.SetStore] Method: " + ex); } } storageObj.DestroyedStore = function (store) { try { document.cookie = store + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/'; } catch (ex) { console.error(storageObj); } } storageObj.RetriveStoreValues = function (store) { try { const cookieString = document.cookie; const cookies = cookieString.split(';'); for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].trim(); if (cookie.startsWith(store + '=')) { return cookie.substring(store.length + 1); } } return null; } catch (ex) { console.error("[storageObj.RetriveStoreValues] Method: " + ex); return null; } } storageObj.RetriveIdentityStoreValues = function () { try { // setTimeout(function(){ let isUserIdentify = false; // for(let j = 0; j < 3; j++){ const cookieString = document.cookie; const cookies = cookieString.split(';'); for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].trim(); if (cookie.startsWith(IdentityStore + '=')) { let idnetityObj = JSON.parse(decodeURIComponent(cookie.substring(IdentityStore.length + 1))); if (idnetityObj != null && idnetityObj != undefined) { let identityValueObj = storageObj.RestoreValues(idnetityObj, encryptDecryptCommonUserIDKey.Key); // let identityValueObj = storageObj.RestoreValues(idnetityObj,encryptDecryptCommonUserIDKey.Key); if (identityValueObj != null && identityValueObj != undefined && identityValueObj.id > 0) { isUserIdentify = true; return identityValueObj.id; } // else { // // return 0; // } } } } if (!isUserIdentify) { commonSiteObj.addLoader(); window.location.href = '/SignIn?ReturnUrl=' + encodeURIComponent(window.location.pathname + window.location.search); //window.location.href = '/No-Access'; } // } // },300); } catch (ex) { console.error("[storageObj.RetriveStoreValues] Method: " + ex); return null; } } storageObj.RetriveIdentityRole = function () { try { const cookieString = document.cookie; const cookies = cookieString.split(';'); let isUserRole = false; for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].trim(); if (cookie.startsWith(UserRole + '=')) { let idnetityObj = JSON.parse(decodeURIComponent(cookie.substring(UserRole.length + 1))); if (idnetityObj != null && idnetityObj != undefined) { let role = storageObj.RestoreValues(idnetityObj, encryptDecryptCommonUserRoleKey.Key); if (role != null && role != undefined) { isUserRole = true; return role.role; } } } } if (!isUserRole) { commonSiteObj.addLoader(); window.location.href = '/SignIn?ReturnUrl=' + encodeURIComponent(window.location.pathname + window.location.search); //window.location.href = '/No-Access'; } } catch (ex) { console.error("[storageObj.RetriveIdentityRole] Method: " + ex); return null; } } storageObj.RetriveUserDetails = function () { try { const cookieString = document.cookie; const cookies = cookieString.split(';'); let isUserDetails = false; for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].trim(); if (cookie.startsWith(UserRole + '=')) { let idnetityObj = JSON.parse(decodeURIComponent(cookie.substring(UserRole.length + 1))); if (idnetityObj != null && idnetityObj != undefined) { let role = storageObj.RestoreValues(idnetityObj, encryptDecryptCommonUserRoleKey.Key); if (role != null && role != undefined) { isUserDetails = true; $("#nav-footer-title").text(role.UName); } } } } if (!isUserDetails) { commonSiteObj.addLoader(); window.location.href = '/SignIn?ReturnUrl=' + encodeURIComponent(window.location.pathname + window.location.search); //window.location.href = '/No-Access'; } } catch (ex) { console.error("[storageObj.RetriveUserDetails] Method: " + ex); return null; } } storageObj.GenerateKey = function () { try { return CryptoJS.lib.WordArray.random(keySizeBytes).toString(); } catch (ex) { console.error("[storageObj.GenerateKey] Method: " + ex); } } storageObj.DestroyedValues = function (object, destroyedBy) { try { return CryptoJS.AES.encrypt(JSON.stringify(object), destroyedBy).toString();; } catch (ex) { console.error("[storageObj.DestroyedValues] Method: " + ex); } } storageObj.RestoreValues = function (desobject, restoreBy) { try { var decryptedBytes = CryptoJS.AES.decrypt(desobject, restoreBy); return JSON.parse(decryptedBytes.toString(CryptoJS.enc.Utf8)); } catch (ex) { console.error("[storageObj.RestoreValues] Method: " + ex); } } storageObj.GenerateApiToken = async function () { try { let retrievedIdentityStorageValue = localStorage.getItem('Identity'); if (!!!retrievedIdentityStorageValue || (!!retrievedIdentityStorageValue && retrievedIdentityStorageValue.toLocaleLowerCase() == 'false')) { let id = $("#hdnLoginUserEmailID").val(); let email = $("#hdnLoginUserEmail").val(); if(!!id && !!email) { commonSiteObj.addLoader(); const myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); const raw = JSON.stringify({ "Id": $("#hdnLoginUserEmailID").val(), "EmailAddress": $("#hdnLoginUserEmail").val(), "UserName": $("#nav-footer-title").text() }); const requestOptions = { method: "POST", headers: myHeaders, body: raw }; await fetch(RADPARTNER_DOMAINURL + "User/GetUserDataByADID", requestOptions) // await fetch("https://localhost:44371/api/User/GetUserDataByADID", requestOptions) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then((response) => { if (response.success && response.values.userDetailModel.UserId > 0) { if (!!response.values.userDetailModel.RoleCode) { localStorage.setItem('Identity', true); let tokenObj = { tkn: response.values.TKN, _dk: response.values.userDetailModel._DK, uniquekey: response.values.userDetailModel.UniqueKey } let userId = { id: response.values.userDetailModel.UserId }; let encryptedUserID = storageObj.DestroyedValues(userId, encryptDecryptCommonUserIDKey.Key); storageObj.SetStore(IdentityStore, encryptedUserID, expiryDays); let dynamicKeyForEncAndDec = storageObj.GenerateKey(); let dynamicKeyForEncAndDecObj = { _dynamickey: dynamicKeyForEncAndDec } let encryptedDynamicKey = storageObj.DestroyedValues(dynamicKeyForEncAndDecObj, encryptDecryptCommonKey.Key); storageObj.SetStore(ChildStore, encryptedDynamicKey, expiryDays); let encryptedTokenObj = storageObj.DestroyedValues(tokenObj, dynamicKeyForEncAndDecObj._dynamickey); storageObj.SetStore(ParentStore, encryptedTokenObj, expiryDays); let userRole = { role: response.values.userDetailModel.RoleCode, UName: response.values.userDetailModel.FullName, LoginType: 1 }; encryptedTokenObj = storageObj.DestroyedValues(userRole, encryptDecryptCommonUserRoleKey.Key); storageObj.SetStore(UserRole, encryptedTokenObj, expiryDays); storageObj.userId = storageObj.RetriveIdentityStoreValues(); storageObj.roleCode = storageObj.RetriveIdentityRole(); storageObj.updateCommonAppBasedOnUserRole(); updateAppBasedOnUserRole(); window.location.reload(); } else { window.location.href = '/No-Access'; } } else { if (response.errorMessage != "") { Swal.fire({ title: "Error!", text: response.errorMessage, icon: "error", timer: 5000 }); } window.location.href = '/SignIn?ReturnUrl=' + encodeURIComponent(window.location.pathname + window.location.search); } commonSiteObj.hideLoader(); }) .catch((error) => { console.error("[storageObj.GenerateApiToken Method: ]" + error); //Swal.fire({ // title: "Error!", // text: 'You dont have any access please enter valid credentials OR Contact to administrator.', // icon: "error", // timer: 5000 //}); //window.location.href = '/SignIn?ReturnUrl='+ encodeURIComponent(window.location.pathname + window.location.search); // window.location.href = '/404-Not-Found'; //if(error.message == "NetworkError when attempting to fetch resource.") window.location.href = '/Not-Connected'; //else // window.location.href = '/No-Access'; commonSiteObj.hideLoader(); }); } else{ Swal.fire({ title: "Error!", text: 'Not Able To Read Microsoft Entra ID & Email', icon: "error", confirmButtonText: "OK" }).then((result) => { if (result.isConfirmed) { window.location.href = "/SignIn"; } }); } } else { storageObj.userId = storageObj.RetriveIdentityStoreValues(); storageObj.roleCode = storageObj.RetriveIdentityRole(); if (storageObj.userId == 0 || !!!storageObj.roleCode) { //Swal.fire({ // title: "Error!", // text: 'You dont have any access please enter valid credentials OR Contact to administrator.', // icon: "error", // timer: 5000 //}); window.location.href = '/SignIn?ReturnUrl=' + encodeURIComponent(window.location.pathname + window.location.search); // window.location.href = '/404-Not-Found'; //window.location.href = '/No-Access'; } else { storageObj.updateCommonAppBasedOnUserRole(); updateAppBasedOnUserRole(); } } } catch (ex) { console.error("[storageObj.GenerateApiToken Method: ]" + ex); //Swal.fire({ // title: "Error!", // text: 'You dont have any access please enter valid credentials OR Contact to administrator.', // icon: "error", // timer: 5000 //}); //window.location.href = '/SignIn?ReturnUrl='+ encodeURIComponent(window.location.pathname + window.location.search); // window.location.href = '/404-Not-Found'; //if(error.message == "NetworkError when attempting to fetch resource.") window.location.href = '/Not-Connected'; // else // window.location.href = '/No-Access'; } } storageObj.SignInUser = async function () { try { let retrievedIdentityStorageValue = localStorage.getItem('Identity'); if (!!!retrievedIdentityStorageValue || (!!retrievedIdentityStorageValue && retrievedIdentityStorageValue.toLocaleLowerCase() == 'false')) { commonSiteObj.addLoader(); const myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); const raw = JSON.stringify({ "EmailAddress": $("#Username").val(), "Password": $("#PasswordValue").val() }); const requestOptions = { method: "POST", headers: myHeaders, body: raw }; await fetch(RADPARTNER_DOMAINURL + "SignIn/SignIn", requestOptions) .then(response => { if (!response.ok) { throw new Error('Network response was not ok'); } return response.json(); }) .then((response) => { if (response.success && response.values.userDetailModel.UserId > 0) { if (!!response.values.userDetailModel.RoleCode) { localStorage.setItem('Identity', true); let tokenObj = { tkn: response.values.TKN, _dk: response.values.userDetailModel._DK, uniquekey: response.values.userDetailModel.UniqueKey } let userId = { id: response.values.userDetailModel.UserId }; let encryptedUserID = storageObj.DestroyedValues(userId, encryptDecryptCommonUserIDKey.Key); storageObj.SetStore(IdentityStore, encryptedUserID, expiryDays); let dynamicKeyForEncAndDec = storageObj.GenerateKey(); let dynamicKeyForEncAndDecObj = { _dynamickey: dynamicKeyForEncAndDec } let encryptedDynamicKey = storageObj.DestroyedValues(dynamicKeyForEncAndDecObj, encryptDecryptCommonKey.Key); storageObj.SetStore(ChildStore, encryptedDynamicKey, expiryDays); let encryptedTokenObj = storageObj.DestroyedValues(tokenObj, dynamicKeyForEncAndDecObj._dynamickey); storageObj.SetStore(ParentStore, encryptedTokenObj, expiryDays); let userRole = { role: response.values.userDetailModel.RoleCode, UName: response.values.userDetailModel.FullName, LoginType: 2 }; encryptedTokenObj = storageObj.DestroyedValues(userRole, encryptDecryptCommonUserRoleKey.Key); storageObj.SetStore(UserRole, encryptedTokenObj, expiryDays); storageObj.userId = storageObj.RetriveIdentityStoreValues(); storageObj.roleCode = storageObj.RetriveIdentityRole(); var queryString = decodeURIComponent(window.location.search); // Parse the query string var urlParams = new URLSearchParams(queryString); window.location.href = urlParams.get('ReturnUrl'); storageObj.updateCommonAppBasedOnUserRole(); updateAppBasedOnUserRole(); } else { window.location.href = '/No-Access'; } } else { if (response.errorMessage != "") { Swal.fire({ title: "Error!", text: response.errorMessage, icon: "error", timer: 5000 }); } window.location.href = '/SignIn?ReturnUrl=' + encodeURIComponent(window.location.pathname + window.location.search); } commonSiteObj.hideLoader(); }) .catch((error) => { console.error("[storageObj.SignInUser Method: ]" + error); //Swal.fire({ // title: "Error!", // text: 'You dont have any access please enter valid credentials OR Contact to administrator.', // icon: "error", // timer: 5000 //}); //window.location.href = '/SignIn?ReturnUrl='+ encodeURIComponent(window.location.pathname + window.location.search); // window.location.href = '/404-Not-Found'; window.location.href = '/No-Access'; commonSiteObj.hideLoader(); }); } else { storageObj.userId = storageObj.RetriveIdentityStoreValues(); storageObj.roleCode = storageObj.RetriveIdentityRole(); if (storageObj.userId == 0) { //Swal.fire({ // title: "Error!", // text: 'You dont have any access please enter valid credentials OR Contact to administrator.', // icon: "error", // timer: 5000 //}); //window.location.href = '/SignIn?ReturnUrl='+ encodeURIComponent(window.location.pathname + window.location.search); // window.location.href = '/404-Not-Found'; window.location.href = '/No-Access'; } else { storageObj.updateCommonAppBasedOnUserRole(); updateAppBasedOnUserRole(); } } } catch (ex) { console.error("[storageObj.SignInUser Method: ]" + ex); //Swal.fire({ // title: "Error!", // text: 'You dont have any access please enter valid credentials OR Contact to administrator.', // icon: "error", // timer: 5000 //}); //window.location.href = '/SignIn?ReturnUrl='+ encodeURIComponent(window.location.pathname + window.location.search); // window.location.href = '/404-Not-Found'; window.location.href = '/No-Access'; } } storageObj.updateCommonAppBasedOnUserRole = function () { const PAGES = { RAD: { RAD_LIST: '/RadList/', RAD_PROFILE: '/RadProfile/', EDIT_RAD_PROFILE: '/EditRadProfile/', CAPACITY_INPUT: '/CapacityInput/', CUSTOM_VIEW: '/CustomView/', RAD_CUSTOM_VIEW: '/RadCustomView/', CONFIG_CUSTOM_VIEW: '/ConfigCustomView/', RAD_REPORT: '/RAD-Report/', RAD_SITE_ENTERPRISE: '/RadHourlyVolumeShare/' }, SITE: { SITELIST: '/SiteList/', EDIT_SITE_PROFILE: '/EditSiteProfile/', SITE_PROFILE: '/SiteProfile/', UNASSIGNED_SITES: '/UnassignedSites/', SITE_ALIAS_MANAGEMENT: '/SiteAliasManagement/' }, EXAM: { RAW_EXAM_DATA: '/Raw_Exam_Data/', EXAM_DATA: '/ExamsData/', MISCELLANEOUS_SITE_DATA: '/MiscellaneousSiteData/', READ: '/ReadData/', UNREAD: '/UnreadData/', TAT: '/TATData/', }, ADMIN: { REGION_MANAGEMENT: '/RegionManagement/', WORKLIST_MANAGEMENT: '/WorkListManagement/', PRACTICE_MANAGEMENT: "/PracticeManagement/", SUB_PRACTICE_MANAGEMENT: '/SubPracticeManagement/', USER_MANAGEMENT: '/UserManagement/', RAD_TYPE: '/RADType/', RAD_STATUS: '/RADStatus/', RAD_DEGREE: '/RadDegree/', RAD_COMMUNICATION_TYPE: '/RadCommunicationType/', SCHEDULE_TYPE: '/ScheduleType/', SUB_SPECIALITY: '/Subspeciality/', WEEK_ROTATION: '/WeekRotation/', RUV_RATE: '/RVURate/', PARTNETSHIP_RATE: '/PartnershipRate/', PARTNETSHIP_STATUS: '/PartnershipStatus/', TIME_TO_PARTNETSHIP: '/TimetoPartnership/', REQUEST_STATUS: '/RequestStatus/', COMMITTEES: '/Committees/', FUTURE_SECTION_CHANGE: '/FutureSectionChange/', RPCE: '/RPCE/', TRAUMA_FACILITY_LEVEL: '/TraumaFacilityLevel/', SITE_STATUS: '/SiteStatus/', SECTION: '/Section/', QGENDA_SECTION: '/Qgenda-Section/', TIMEZONE_MANAGEMENT: '/TimeZone-Management/', SITE_COVERAGE_MATRIX: '/SiteCoverageMatrix/', PRIORITY_SLA_MAPPING: '/PrioritySLAMapping/', WEEK_DAY_MAPPING: '/WeekdayMapping/', DLS_CONFIG: '/DLSConfig/', EMAIL_CONFIG: '/EmailConfig/', TASK_CONFIGURATION: '/Task-Configuration/', COVERAGE_GAP_COLOR_CONFIGURATION: '/Coverage-Gap-Color-Configuration/', SIMULATOR_COLOR_CONFIGURATION: '/Simulator-Color-Configuration/', WEEK_ROTATION_TEMPLATE:'/WeekRotationTemplate/', }, REPORTS: { MATRIX_DAILY_REPORT: '/MatrixDailyReport/', DASHBOARD: '/Dashboard/', SOUTH_WEST: '/Southwest/', SOUTH: '/South/', MID_WEST: '/Midwest/', WEST: '/West/', COVERAGEGAPTOOL: '/CoverageGapTool/', REPORTCONFIGURATION: '/Report-Configuration/' }, BLOCKPLANNINGREPORTS: { MATRIX_SITE_REQUEST: '/Matrix-Service-Request/', BLOCK_DEMAND: '/Block-Demand-Planning/', BLOCK_CAPACITY: '/Block-Capacity-Planning/', BLOCK_CAPS_VS_DEM: '/Block-caps-vs-demand-planning/' }, SCHEDULING_FORECAST_REPORT: '/SchedulingForecastReports/', DEMAND_TABLE: '/DemandTableReports/', CAPACITY_TABLE: '/CapacityTableReports/', CAPACITY_VS_DEMAND: '/CapacityVsDemandReports/', LIVE_AVAILABLE_SHIFT: '/Live-Available-Shift/', UNAUTHROZIED: '/Unauthorized/' }; // const roleCode = await storageObj.RetriveIdentityRole(); const roleCode = storageObj?.roleCode; console.log(roleCode); const { RAD_LIST, RAD_PROFILE, EDIT_RAD_PROFILE, CAPACITY_INPUT, CUSTOM_VIEW, RAD_CUSTOM_VIEW, CONFIG_CUSTOM_VIEW, RAD_REPORT, RAD_SITE_ENTERPRISE } = PAGES.RAD; const { SITELIST, EDIT_SITE_PROFILE, SITE_PROFILE, UNASSIGNED_SITES, SITE_ALIAS_MANAGEMENT } = PAGES.SITE; const { RAW_EXAM_DATA, EXAM_DATA, MISCELLANEOUS_SITE_DATA, READ, UNREAD, TAT } = PAGES.EXAM; const { REGION_MANAGEMENT, WORKLIST_MANAGEMENT, PRACTICE_MANAGEMENT, SUB_PRACTICE_MANAGEMENT, USER_MANAGEMENT , RAD_TYPE, RAD_STATUS, RAD_DEGREE, RAD_COMMUNICATION_TYPE, SCHEDULE_TYPE, SUB_SPECIALITY, WEEK_ROTATION, RUV_RATE, PARTNETSHIP_RATE, PARTNETSHIP_STATUS, TIME_TO_PARTNETSHIP, REQUEST_STATUS, COMMITTEES, FUTURE_SECTION_CHANGE, RPCE, TRAUMA_FACILITY_LEVEL, SITE_STATUS, SECTION, QGENDA_SECTION , SITE_COVERAGE_MATRIX, PRIORITY_SLA_MAPPING, WEEK_DAY_MAPPING, DLS_CONFIG, EMAIL_CONFIG, TASK_CONFIGURATION, COVERAGE_GAP_COLOR_CONFIGURATION, SIMULATOR_COLOR_CONFIGURATION, TIMEZONE_MANAGEMENT,WEEK_ROTATION_TEMPLATE } = PAGES.ADMIN; const { MATRIX_DAILY_REPORT, DASHBOARD, SOUTH_WEST, SOUTH, MID_WEST, WEST, COVERAGEGAPTOOL, REPORTCONFIGURATION } = PAGES.REPORTS; const { MATRIX_SITE_REQUEST, BLOCK_DEMAND, BLOCK_CAPACITY, BLOCK_CAPS_VS_DEM } = PAGES.BLOCKPLANNINGREPORTS; if (roleCode === ROLES.RAD) { $('#rad-module-nav').addClass('d-none'); $('#site-module-nav').addClass('d-none'); $('#exam-module-nav').addClass('d-none'); $('#admin-module-nav').addClass('d-none'); $('#report-nav').addClass('d-none'); $('#scheduling-nav').addClass('d-none'); $('#DemandTable-nav').addClass('d-none'); $('#CapacityTable-nav').addClass('d-none'); $('#CapacityVsDemand-nav').addClass('d-none'); $('#AvailableShift-nav').removeClass('d-none'); $('#profile-content').addClass('d-none'); $('#liSeparator').addClass('d-none'); $('#blockplanning-module-nav').addClass('d-none'); if ([ RAD_LIST, RAD_PROFILE, EDIT_RAD_PROFILE, CAPACITY_INPUT, CUSTOM_VIEW, RAD_CUSTOM_VIEW, CONFIG_CUSTOM_VIEW, RAD_REPORT, RAD_SITE_ENTERPRISE, SITELIST, EDIT_SITE_PROFILE, SITE_PROFILE, UNASSIGNED_SITES, SITE_ALIAS_MANAGEMENT, RAW_EXAM_DATA, EXAM_DATA, MISCELLANEOUS_SITE_DATA, READ, UNREAD, TAT, REGION_MANAGEMENT, WORKLIST_MANAGEMENT, PRACTICE_MANAGEMENT, SUB_PRACTICE_MANAGEMENT, USER_MANAGEMENT, RAD_TYPE, RAD_STATUS, RAD_DEGREE, RAD_COMMUNICATION_TYPE, SCHEDULE_TYPE, SUB_SPECIALITY, WEEK_ROTATION, RUV_RATE, PARTNETSHIP_RATE, PARTNETSHIP_STATUS, TIME_TO_PARTNETSHIP, REQUEST_STATUS, COMMITTEES, FUTURE_SECTION_CHANGE, RPCE, TRAUMA_FACILITY_LEVEL, SITE_STATUS, SECTION, QGENDA_SECTION, SITE_COVERAGE_MATRIX, PRIORITY_SLA_MAPPING, WEEK_DAY_MAPPING, DLS_CONFIG, EMAIL_CONFIG, TASK_CONFIGURATION, COVERAGE_GAP_COLOR_CONFIGURATION, SIMULATOR_COLOR_CONFIGURATION, TIMEZONE_MANAGEMENT,WEEK_ROTATION_TEMPLATE, MATRIX_SITE_REQUEST, BLOCK_DEMAND, BLOCK_CAPACITY, BLOCK_CAPS_VS_DEM, PAGES.SCHEDULING_FORECAST_REPORT, PAGES.DEMAND_TABLE, PAGES.CAPACITY_TABLE, PAGES.CAPACITY_VS_DEMAND, MATRIX_DAILY_REPORT, DASHBOARD, SOUTH_WEST, SOUTH, MID_WEST, WEST, COVERAGEGAPTOOL, REPORTCONFIGURATION, PAGES.BLOCKPLANNINGREPORTS ].includes(window.location.pathname) ) { window.location.href = PAGES.UNAUTHROZIED; } } if (roleCode === ROLES.STAKE_HOLDERS) { $('#rad-module-nav .no-access-stake').addClass('d-none'); $('#site-module-nav .no-access-stake').addClass('d-none'); $('#exam-module-nav').addClass('d-none'); $('#report-nav .no-access').addClass('d-none'); $('#admin-module-nav').addClass('d-none'); $('#scheduling-nav').addClass('d-none'); $('#DemandTable-nav').addClass('d-none'); $('#CapacityTable-nav').addClass('d-none'); $('#CapacityVsDemand-nav').addClass('d-none'); $('#AvailableShift-nav').removeClass('d-none'); $('#blockplanning-module-nav').addClass('d-none'); if ([ RAD_REPORT, RAD_SITE_ENTERPRISE, UNASSIGNED_SITES, SITE_ALIAS_MANAGEMENT, RAW_EXAM_DATA, EXAM_DATA, MISCELLANEOUS_SITE_DATA, READ, UNREAD, TAT, REGION_MANAGEMENT, WORKLIST_MANAGEMENT, PRACTICE_MANAGEMENT, SUB_PRACTICE_MANAGEMENT, USER_MANAGEMENT, RAD_TYPE, RAD_STATUS, RAD_DEGREE, RAD_COMMUNICATION_TYPE, SCHEDULE_TYPE, SUB_SPECIALITY, WEEK_ROTATION, RUV_RATE, PARTNETSHIP_RATE, PARTNETSHIP_STATUS, TIME_TO_PARTNETSHIP, REQUEST_STATUS, COMMITTEES, FUTURE_SECTION_CHANGE, RPCE, TRAUMA_FACILITY_LEVEL, SITE_STATUS, SECTION, QGENDA_SECTION, SITE_COVERAGE_MATRIX, PRIORITY_SLA_MAPPING, WEEK_DAY_MAPPING, DLS_CONFIG, EMAIL_CONFIG, TASK_CONFIGURATION, COVERAGE_GAP_COLOR_CONFIGURATION, SIMULATOR_COLOR_CONFIGURATION,WEEK_ROTATION_TEMPLATE, MATRIX_SITE_REQUEST, BLOCK_DEMAND, BLOCK_CAPACITY, BLOCK_CAPS_VS_DEM, SOUTH_WEST, SOUTH, MID_WEST, WEST, REPORTCONFIGURATION, PAGES.SCHEDULING_FORECAST_REPORT, PAGES.DEMAND_TABLE, PAGES.CAPACITY_TABLE, PAGES.BLOCKPLANNINGREPORTS, ].includes(window.location.pathname) ) { window.location.href = PAGES.UNAUTHROZIED; } } if (![ROLES.RAD, ROLES.STAKE_HOLDERS].includes(roleCode)) { if ([PAGES.LIVE_AVAILABLE_SHIFT].includes(window.location.pathname)) { window.location.href = PAGES.UNAUTHROZIED; } } } $(document).ready(function () { var pathArray = window.location.pathname.split('/'); var lastSegment = pathArray.filter(segment => segment.trim() !== "").pop(); if (!!!lastSegment) { lastSegment = "Test" } if ( (window.location.href.toLowerCase().indexOf("SignIn".toLowerCase()) < 0) && (window.location.href.toLowerCase().indexOf("No-Access".toLowerCase()) < 0) && (window.location.href.toLowerCase().indexOf("Not-Connected".toLowerCase()) < 0) && (window.location.href.toLowerCase().indexOf("404-Not-Found".toLowerCase()) < 0) && (lastSegment.toLowerCase() != "Profile".toLowerCase()) ) { //if ($("#hdnLoginType").val() == 2) { // // customLogin username/Password // storageObj.RetriveUserDetails(); // storageObj.SignInUser(); //} //else { // Azure login storageObj.GenerateApiToken(); //} } });