{"version":3,"sources":["Pages/Library.js"],"names":["xhr","Dialog","Form","Library","searchRefinePageIndexParameters","document","querySelectorAll","i","searchRefinePageSizeParameters","m","length","onchange","e","querySelector","value","getElementById","submit","onclick","target","dataset","pageindex","addEventListener","_scrollToTop","bind","_scrollToDown","halfHeight","scrollHeight","scrollTop","style","display","screenWidth","scrollWidth","bottomHeight","bottom","isAuthenticated","accessLevel","isExpired","isNotTeacher","appInsights","searchId","searchServiceName","_addToSpacesDialog","_addToSpacesForm","_maxCurriculumCountSpaceCanHave","_currentCurriculumId","_carouselData","Object","_carouselSlideIndex","_isAuthenticated","_accessLevel","_isExpired","_isNotTeacher","_appInsights","_searchId","_searchServiceName","_currentCurriculumName","_currentCurriculumScore","_initializeDialog","_initializeFeaturedCarousel","_initializeCustomCarousel","_initializeRecomendedCarousel","_initializeCategoryCarousel","_onAddToSpaceButtonClick","_onProductDetailsClick","allHeroSlider","_onHeroImgClick","Modal","el","options","self","list","id","x","preventDefault","hide","console","log","prototype","show","backdrop","createElement","className","body","appendChild","classList","add","paddingRight","remove","removeChild","allCardLink","_OnShowCustomCheckboxCheck","checked","_OnCustomCheckBoxChecked","allCustomCurriculumCardLink","_initializeCustomCurriculumAssociatedToSpaces","_onCustomProductDetailsClick","allCustomDeleteButtons","_customCurriculumToBeDeleted","_curriculumAssociatedToSpaces","_curriculumCanNotBeDeletedDialog","open","_deleteCustomConfirmDialog","allCustomToSpaceButtons","_onCustomAddToSpaceButtonClick","allAddToSpaceBtn","allCategoryCarouselNextButton","_onCategoryCarouselNextClick","url","URL","location","href","isCustomCurriculum","split","undefined","innerText","dataTarget","closest","getAttribute","container","category","_getLibraryByType","method","data","JSON","stringify","then","result","curriculumList","spaceCurriculumAssociated","window","type","filteredResult","concat","_buildAllCustomCarousel","pageSize","skip","filter","w","imageSrc","_buildAllCarousel","_buildAllRecomendedCarousel","_buildHeroCarousel","_buildCustomCarousel","_buildRecomendedCarousel","parentElement","name","slideIndex","parseInt","dataNeededForComingSlide","_getLibraryByCategoryType","curriculumAccessLevel","ol","carouselInner","li","setAttribute","carouselItem","accessLevelDiv","accessLevelSpan","textContent","img","src","carouselCaption","h2","heroHeading","h5","heroSubHeading","p","heroDescription","br","a","addToSpaceBtn","text","_getAccessLevel","totalSlides","Math","ceil","s","start","end","slice","cardCarousel","card","background","cardBody","dropUp","width","dropDownToggle","dropDownMenu","discription","h6","brandName","span","description","imgIcon","float","carousel","publisher","isCarousel","maxWidth","title","anchor","color","marginRight","editIcon","deleteIcon","_deleteCustomCurriculumDialog","height","_buildCarousel","navigateToSpace","origin","attributes","_premiumMessageDialog","curriculumId","curriculumData","publisherName","curriculum","disabled","addCurriculumToSpacesFormModel","spaces","tableBody","forEach","lessons","lesson","sort","lesson1","lesson2","number","totalLessons","tr","th","td","curriculumScore","trackEvent","SearchServiceName","SearchId","ClickedDocName","Rank","spaceLabel","detailsSpan","spaceNameSpan","curriculumCountSpan","checkboxWrapper","checkbox","checkboxSpan","_setupCurriculumDialog","onbeforeshow","dialog","customCurriculumList","deletedCard","getElementsByClassName","parentNode","close","filteredData","customCarouselContainer","firstChild","_refreshUrl","curriculumName","toString","indexOf","action","innerHTML","availableSpaces","spacesContainer","template","_buildSpaceNode","fragment","createDocumentFragment","checkboxData","item","cloneNode","label","event","_ifNoSpaceSelectedDisableAddToSpaceDialogButton","curriculumCount","pageYOffset","documentElement","idField","itemId","labelField","curriculumCountField","div","oncreated","done","_formSubmitted","onclosed","addToSpaceDialogButton","_form","noSpaceSelected","addedSpaces","_updateView","viewData","_updateAssociatedSpacesListing","_showAddedCurriculumFooter","associatedSpaces","availableSpacesCount","_addToSpacesButton","ids","push","spaceNavigationList","customizeCurriculumFor","opt","spaceCurriculumId","spaceName","_hideToTop","zIndex","_hideToDown"],"mappings":";;;;;;;;;;;;;;;AAASA,e,qBAAAA,G;;AACAC,kB,uBAAAA,M;;AACAC,gB,sBAAAA,I;;;;;;;;;;;;;;;;;;;;;+BAEHC,O;;;;;;;2CACK;;AAEH,4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;AACJ;AACJ,yBAtCL;AAuCH;;;iDAEY;AACThF,iCAASU,cAAT,CAAwB,gBAAxB,EAA0Ca,KAA1C,CAAgDC,OAAhD,GAA0D,OAA1D;AACAxB,iCAASU,cAAT,CAAwB,eAAxB,EAAyCa,KAAzC,CAA+CC,OAA/C,GAAyD,MAAzD;AACH;;;kDAEa;AACVxB,iCAASU,cAAT,CAAwB,gBAAxB,EAA0Ca,KAA1C,CAAgDC,OAAhD,GAA0D,MAA1D;AACAxB,iCAASU,cAAT,CAAwB,eAAxB,EAAyCa,KAAzC,CAA+CC,OAA/C,GAAyD,OAAzD;AACH;;;mDAEc;AACXxB,iCAASU,cAAT,CAAwB,sBAAxB,EAAgDY,SAAhD,GAA4D,CAA5D;AACA,6BAAKoR,UAAL;AACH;;;oDAEe;AACZ1S,iCAASU,cAAT,CAAwB,sBAAxB,EAAgDY,SAAhD,GAA4DtB,SAASU,cAAT,CAAwB,sBAAxB,EAAgDW,YAA5G;AACArB,iCAASU,cAAT,CAAwB,eAAxB,EAAyCa,KAAzC,CAA+CoR,MAA/C,GAAwD,EAAxD;AACA,6BAAKC,WAAL;AACH;;;;;;+BAII9S,O","file":"Library.js","sourcesContent":["import { xhr } from \"../Components/Ajax.js\";\r\nimport { Dialog } from \"../Components/Dialog.js\";\r\nimport { Form } from \"../Components/Forms.js\";\r\n\r\nclass Library {\r\n init() {\r\n\r\n let searchRefinePageIndexParameters = document.querySelectorAll(\".search-refine-pageIndex\"), i;\r\n let searchRefinePageSizeParameters = document.querySelectorAll(\".search-refine-pagesize\"), m;\r\n\r\n for (i = 0; i < searchRefinePageSizeParameters.length; ++i) {\r\n searchRefinePageSizeParameters[i].onchange = (e) => {\r\n document.querySelector('.pageindex').value = \"1\";\r\n document.getElementById(\"BrowseAllForm\").submit();\r\n };\r\n }\r\n\r\n for (m = 0; m < searchRefinePageIndexParameters.length; ++m) {\r\n searchRefinePageIndexParameters[m].onclick = (e) => {\r\n var value = e.target.dataset.pageindex;\r\n document.querySelector('.pageindex').value = value;\r\n document.getElementById(\"BrowseAllForm\").submit();\r\n };\r\n }\r\n\r\n document.getElementById(\"return-to-top\").addEventListener('click', this._scrollToTop.bind(this));\r\n document.getElementById(\"return-to-down\").addEventListener('click', this._scrollToDown.bind(this));\r\n document.getElementById(\"curriculum-container\").addEventListener('scroll', function () {\r\n var halfHeight = document.getElementById(\"curriculum-container\").scrollHeight / 2;\r\n if (this.scrollTop < halfHeight) {\r\n document.getElementById(\"return-to-down\").style.display = 'block';\r\n document.getElementById(\"return-to-top\").style.display = 'none';\r\n }\r\n\r\n if (this.scrollTop > halfHeight) {\r\n document.getElementById(\"return-to-down\").style.display = 'none';\r\n document.getElementById(\"return-to-top\").style.display = 'block';\r\n var screenWidth = document.getElementById(\"curriculum-container\").scrollWidth;\r\n var bottomHeight = document.getElementById(\"curriculum-container\").scrollHeight - 700;\r\n document.getElementById(\"return-to-top\").style.bottom = '20px';\r\n if (this.scrollTop > bottomHeight) {\r\n if (screenWidth < 480 && screenWidth >= 320) {\r\n document.getElementById(\"return-to-top\").style.bottom = '180px';\r\n }\r\n if (screenWidth < 1280 && screenWidth >= 480) {\r\n document.getElementById(\"return-to-top\").style.bottom = '120px';\r\n }\r\n }\r\n }\r\n });\r\n }\r\n\r\n initalize(isAuthenticated, accessLevel, isExpired, isNotTeacher, appInsights, searchId, searchServiceName) {\r\n this._addToSpacesDialog = null;\r\n this._addToSpacesForm = null;\r\n this._maxCurriculumCountSpaceCanHave = null;\r\n this._currentCurriculumId = null;\r\n this._carouselData = new Object();\r\n this._carouselSlideIndex = null;\r\n this._isAuthenticated = isAuthenticated;\r\n this._accessLevel = accessLevel;\r\n this._isExpired = isExpired;\r\n this._isNotTeacher = isNotTeacher == \"True\";\r\n this._appInsights = appInsights;\r\n this._searchId = searchId;\r\n this._searchServiceName = searchServiceName;\r\n this._currentCurriculumName = null;\r\n this._currentCurriculumScore = null;\r\n\r\n this._initializeDialog();\r\n //document.querySelector(\".heroCarousel\") != null ? this._initializeHeroCarousel(\".heroCarousel\", \"IsHero\") : \"\";\r\n document.querySelector(\".featuredCurriculum\") != null ? this._initializeFeaturedCarousel(\".featuredCurriculum\", \"IsFeatured\") : \"\";\r\n document.querySelector(\".CustomCurriculum\") != null ? this._initializeCustomCarousel(\".CustomCurriculum\", \"IsCustom\") : \"\";\r\n document.querySelector(\".recomendedCarousel\") != null ? this._initializeRecomendedCarousel(\".recomendedCarousel\", \"IsRecomended\") : \"\";\r\n\r\n document.querySelector(\".yearlyCurriculum\") != null ? this._initializeCategoryCarousel(\".yearlyCurriculum\", \"Yearly Curriculum\") : \"\";\r\n document.querySelector(\".unitThemeCategory\") != null ? this._initializeCategoryCarousel(\".unitThemeCategory\", \"Unit / Theme-Based\") : \"\";\r\n document.querySelector(\".musicMediaCategory\") != null ? this._initializeCategoryCarousel(\".musicMediaCategory\", \"Includes Music / Media\") : \"\";\r\n document.querySelector(\".worshipCategory\") != null ? this._initializeCategoryCarousel(\".worshipCategory\", \"Worship\") : \"\";\r\n document.querySelector(\".easyPrepCategory\") != null ? this._initializeCategoryCarousel(\".easyPrepCategory\", \"Easy Preparation\") : \"\";\r\n\r\n document.querySelector(\".toddler\") != null ? this._initializeCategoryCarousel(\".toddler\", \"Nursery - Toddlers\") : \"\";\r\n document.querySelector(\".preschool\") != null ? this._initializeCategoryCarousel(\".preschool\", \"Preschool - Kindergarten\") : \"\";\r\n document.querySelector(\".earlyElementary\") != null ? this._initializeCategoryCarousel(\".earlyElementary\", \"Early Elementary\") : \"\";\r\n document.querySelector(\".lateElementary\") != null ? this._initializeCategoryCarousel(\".lateElementary\", \"Late Elementary\") : \"\";\r\n document.querySelector(\".middleSchool\") != null ? this._initializeCategoryCarousel(\".middleSchool\", \"Middle School\") : \"\";\r\n document.querySelector(\".highSchool\") != null ? this._initializeCategoryCarousel(\".highSchool\", \"High School\") : \"\";\r\n document.querySelector(\".adults\") != null ? this._initializeCategoryCarousel(\".adults\", \"Adult\") : \"\";\r\n document.querySelector(\"#add-to-space-button\") != null ? document.querySelector(\"#add-to-space-button\").addEventListener('click', this._onAddToSpaceButtonClick.bind(this)) : \"\";\r\n document.querySelector(\".herocurriculumDetails\") != null ? document.querySelector(\".herocurriculumDetails\").addEventListener('click', this._onProductDetailsClick.bind(this)) : \"\";\r\n\r\n var allHeroSlider = document.querySelectorAll(\".heroSlider\");\r\n for (let i = 0; i < allHeroSlider.length; i++) {\r\n allHeroSlider[i].addEventListener('click', this._onHeroImgClick.bind(this));\r\n }\r\n\r\n this.Modal = function (el, options) {\r\n var self = this;\r\n\r\n this.el = document.querySelector(el);\r\n this.options = options;\r\n\r\n try {\r\n var list = document.querySelectorAll('#' + this.el.id + ' [data-dismiss=\"modal\"]');\r\n for (var x = 0; x < list.length; x++) {\r\n list[x].addEventListener('click', function (e) {\r\n if (e) e.preventDefault();\r\n self.hide();\r\n });\r\n }\r\n }\r\n catch (e) {\r\n console.log(e);\r\n }\r\n };\r\n\r\n this.Modal.prototype.show = function () {\r\n var self = this;\r\n // adding backdrop (transparent background) behind the modal\r\n if (self.options.backdrop) {\r\n var backdrop = document.getElementById('bs.backdrop');\r\n if (backdrop === null) {\r\n backdrop = document.createElement('div');\r\n backdrop.id = \"bs.backdrop\";\r\n backdrop.className = \"modal-backdrop fade in\";\r\n document.body.appendChild(backdrop);\r\n }\r\n }\r\n\r\n // show modal\r\n this.el.classList.add('show');\r\n this.el.style.display = 'block';\r\n document.body.style.paddingRight = '17px';\r\n document.body.classList.add('modal-open');\r\n };\r\n\r\n this.Modal.prototype.hide = function () {\r\n var self = this;\r\n // hide modal\r\n this.el.classList.remove('show');\r\n this.el.style.display = 'none';\r\n document.body.style = '';\r\n document.body.classList.remove('modal-open');\r\n\r\n // removing backdrop\r\n if (self.options.backdrop) {\r\n var backdrop = document.getElementById('bs.backdrop');\r\n if (backdrop !== null) document.body.removeChild(backdrop);\r\n }\r\n };\r\n\r\n var allCardLink = document.querySelectorAll(\".curriculumDetails\");\r\n for (let i = 0; i < allCardLink.length; i++) {\r\n allCardLink[i].addEventListener('click', this._onProductDetailsClick.bind(this));\r\n }\r\n\r\n document.querySelector(\"#ShowCustomCheckbox\") != null ? document.querySelector(\"#ShowCustomCheckbox\").addEventListener('click', this._OnShowCustomCheckboxCheck.bind(this)) : \"\";\r\n\r\n if (document.querySelector(\"#ShowCustomCheckbox\") != null) {\r\n if (document.querySelector(\"#ShowCustomCheckbox\").checked == true) {\r\n this._OnCustomCheckBoxChecked(true);\r\n }\r\n } \r\n\r\n var allCustomCurriculumCardLink = document.querySelectorAll(\".customCurriculumDetails\");\r\n if (allCustomCurriculumCardLink.length>0) {\r\n\r\n this._initializeCustomCurriculumAssociatedToSpaces();\r\n\r\n for (let i = 0; i < allCustomCurriculumCardLink.length; i++) {\r\n allCustomCurriculumCardLink[i].addEventListener('click', this._onCustomProductDetailsClick.bind(this));\r\n }\r\n }\r\n\r\n var allCustomDeleteButtons = document.querySelectorAll(\".customDelete\");\r\n if (allCustomDeleteButtons.length>0) {\r\n for (let i = 0; i < allCustomDeleteButtons.length; i++) {\r\n allCustomDeleteButtons[i].addEventListener(\"click\", (e) => {\r\n this._customCurriculumToBeDeleted = e.target.dataset.id;\r\n if (this._curriculumAssociatedToSpaces[this._customCurriculumToBeDeleted] > 0)\r\n this._curriculumCanNotBeDeletedDialog.open();\r\n else\r\n this._deleteCustomConfirmDialog.open();\r\n });\r\n }\r\n }\r\n\r\n var allCustomToSpaceButtons = document.querySelectorAll(\".addCustomToSpace\");\r\n if (allCustomToSpaceButtons.length>0) {\r\n for (let i = 0; i < allCustomToSpaceButtons.length; i++) {\r\n allCustomToSpaceButtons[i].addEventListener('click', this._onCustomAddToSpaceButtonClick.bind(this));\r\n }\r\n }\r\n\r\n var allAddToSpaceBtn = document.querySelectorAll(\".addToSpaceBtn\");\r\n for (let i = 0; i < allAddToSpaceBtn.length; i++) {\r\n allAddToSpaceBtn[i].addEventListener('click', this._onAddToSpaceButtonClick.bind(this));\r\n }\r\n\r\n var allCategoryCarouselNextButton = document.querySelectorAll(\".carousel-control-next\");\r\n for (let i = 0; i < allCategoryCarouselNextButton.length; i++) {\r\n allCategoryCarouselNextButton[i].addEventListener('click', this._onCategoryCarouselNextClick.bind(this));\r\n }\r\n\r\n var url = new URL(location.href).href;\r\n var isCustomCurriculum = url.split(\"#\")[1];\r\n if (isCustomCurriculum != \"\" && isCustomCurriculum != undefined && isCustomCurriculum == \"custom-curriculum-container\") {\r\n document.querySelector(\"#ShowCustomCheckbox\").checked = true;\r\n this._OnCustomCheckBoxChecked(true);\r\n }\r\n }\r\n\r\n _onHeroImgClick(e) {\r\n if (e.target.innerText == \"MORE INFO\")\r\n return;\r\n\r\n var dataTarget = e.target.closest(\".heroSlider\").getAttribute(\"data-target\");\r\n if (dataTarget != null) {\r\n let m = new this.Modal('' + dataTarget + '', {\r\n backdrop: true\r\n });\r\n m.show();\r\n }\r\n }\r\n\r\n _initializeHeroCarousel(container, category) {\r\n this._getLibraryByType(container, category, 5, 0);\r\n }\r\n\r\n _initializeFeaturedCarousel(container, category) {\r\n this._getLibraryByType(container, category, 8, 0);\r\n }\r\n\r\n _initializeRecomendedCarousel(container, category) {\r\n this._getLibraryByType(container, category, 8, 0);\r\n }\r\n\r\n _initializeCustomCurriculumAssociatedToSpaces() {\r\n const options = {\r\n method: \"POST\",\r\n data: JSON.stringify({ \"libraryFlag\": \"IsCustom\", \"pageSize\": 0, \"skip\": 0 })\r\n };\r\n\r\n xhr(\"/getcustomcurriculum\", options).then(result => {\r\n if (result.curriculumList.length) {\r\n this._curriculumAssociatedToSpaces = result.spaceCurriculumAssociated;\r\n }\r\n });\r\n }\r\n\r\n _OnShowCustomCheckboxCheck(e) {\r\n if (e.target.checked) {\r\n this._OnCustomCheckBoxChecked(true);\r\n\r\n } else {\r\n this._OnCustomCheckBoxChecked(false);\r\n }\r\n }\r\n\r\n _OnCustomCheckBoxChecked(data) {\r\n if (data) {\r\n document.querySelector(\".custom-curriculumList\").classList.remove(\"hide\");\r\n document.querySelector(\"#filters\").classList.add(\"hide\");\r\n document.querySelector(\".hideToMe\").classList.add(\"hide\");\r\n document.querySelector(\".top-pagination\").classList.add(\"hide\");\r\n document.querySelector(\".curriculumCardList\").classList.add(\"hide\");\r\n document.querySelector(\".bottomPagination\").classList.add(\"hide\");\r\n document.querySelector(\"#appliedFilterList\") != null ? document.querySelector(\"#appliedFilterList\").classList.add(\"hide\") : \"\";\r\n\r\n } else {\r\n document.querySelector(\".custom-curriculumList\").classList.add(\"hide\");\r\n document.querySelector(\"#filters\").classList.remove(\"hide\");\r\n document.querySelector(\".hideToMe\").classList.remove(\"hide\");\r\n document.querySelector(\".top-pagination\").classList.remove(\"hide\");\r\n document.querySelector(\".curriculumCardList\").classList.remove(\"hide\");\r\n document.querySelector(\".bottomPagination\").classList.remove(\"hide\");\r\n document.querySelector(\"#appliedFilterList\") != null ? document.querySelector(\"#appliedFilterList\").classList.remove(\"hide\") : \"\";\r\n var url = new URL(location.href).href;\r\n var isCustomCurriculum = url.split(\"#\")[1];\r\n if (isCustomCurriculum != \"\" && isCustomCurriculum != undefined && isCustomCurriculum == \"custom-curriculum-container\") {\r\n window.location = url.split(\"#\")[0];\r\n }\r\n }\r\n }\r\n\r\n _initializeCustomCarousel(container, type) {\r\n const options = {\r\n method: \"POST\",\r\n data: JSON.stringify({ \"libraryFlag\": type, \"pageSize\": 0, \"skip\": 0 })\r\n };\r\n\r\n xhr(\"/getcustomcurriculum\", options).then(result => {\r\n if (result.curriculumList.length) {\r\n var filteredResult = result.curriculumList;\r\n this._curriculumAssociatedToSpaces = result.spaceCurriculumAssociated;\r\n // result.filter(w => w.imageSrc ? true : false);\r\n if (this._carouselData && this._carouselData[type]) {\r\n this._carouselData[type] = this._carouselData[type].concat(filteredResult);\r\n }\r\n else {\r\n this._carouselData[type] = filteredResult;\r\n }\r\n this._buildAllCustomCarousel(container, filteredResult, \"IsCustom\");\r\n } else {\r\n document.getElementById(\"noCustomCurriculum\").classList.remove(\"hide\");\r\n }\r\n });\r\n }\r\n\r\n _getLibraryByType(container, type, pageSize, skip) {\r\n const options = {\r\n method: \"POST\",\r\n data: JSON.stringify({ \"libraryFlag\": type, \"pageSize\": pageSize, \"skip\": skip })\r\n };\r\n\r\n xhr(\"/getLibraryByFlagSet\", options).then(result => {\r\n if (result.length) {\r\n var filteredResult = result.filter(w => w.imageSrc ? true : false);\r\n if (this._carouselData && this._carouselData[type]) {\r\n this._carouselData[type] = this._carouselData[type].concat(filteredResult);\r\n }\r\n else {\r\n this._carouselData[type] = filteredResult;\r\n }\r\n\r\n if (type == \"IsFeatured\") {\r\n this._buildAllCarousel(container, filteredResult, type);\r\n }\r\n if (type == \"IsRecomended\") {\r\n this._buildAllRecomendedCarousel(container, filteredResult, type);\r\n }\r\n if (type == \"IsHero\") {\r\n this._buildHeroCarousel(container, filteredResult);\r\n }\r\n }\r\n })\r\n }\r\n\r\n _buildAllCustomCarousel(container, data, type) {\r\n if (data.length == 0) {\r\n document.getElementById(\"noCustomCurriculum\").classList.remove(\"hide\");\r\n return;\r\n }\r\n else {\r\n document.getElementById(\"noCustomCurriculum\").classList.add(\"hide\");\r\n }\r\n\r\n this._buildCustomCarousel(container, data, 4, type);\r\n this._buildCustomCarousel(container + \"-medium\", data, 3, type);\r\n this._buildCustomCarousel(container + \"-small\", data, 2, type);\r\n this._buildCustomCarousel(container + \"-xsmall\", data, 1, type);\r\n }\r\n\r\n _buildAllRecomendedCarousel(container, data, type) {\r\n this._buildRecomendedCarousel(container, data, 5, type);\r\n this._buildRecomendedCarousel(container + \"-medium\", data, 4, type);\r\n this._buildRecomendedCarousel(container + \"-small\", data, 3, type);\r\n this._buildRecomendedCarousel(container + \"-xsmall\", data, 1, type);\r\n }\r\n\r\n _onCategoryCarouselNextClick(e) {\r\n let container = \".\" + e.target.parentElement.name;\r\n let category = e.target.parentElement.getAttribute(\"category-name\");\r\n let slideIndex = document.querySelector(container + \" .carousel-item.active\").dataset.slideIndex;\r\n let pageSize = parseInt(e.target.parentElement.getAttribute(\"category-size\"));\r\n if (category == \"IsCustom\")\r\n return;\r\n let dataNeededForComingSlide = (parseInt(slideIndex) + 2) * pageSize;\r\n\r\n if (dataNeededForComingSlide >= this._carouselData[category].length) {\r\n let skip = this._carouselData[category] ? this._carouselData[category].length : 0;\r\n if (category == \"IsFeatured\" || category == \"IsRecomended\") {\r\n this._getLibraryByType(container, category, 4, skip);\r\n }\r\n else {\r\n this._getLibraryByCategoryType(container, category, 4, skip);\r\n }\r\n }\r\n }\r\n\r\n _initializeCategoryCarousel(container, category) {\r\n this._getLibraryByCategoryType(container, category, 8, 0);\r\n }\r\n\r\n _getLibraryByCategoryType(container, type, pageSize, skip) {\r\n const options = {\r\n method: \"POST\",\r\n data: JSON.stringify({ \"categoryFilter\": type, \"pageSize\": pageSize, \"skip\": skip })\r\n };\r\n xhr(\"/getCategoryLibraryByFllagSet\", options).then(result => {\r\n if (result.length) {\r\n var filteredResult = result.filter(w => w.imageSrc ? true : false);\r\n\r\n if (this._carouselData && this._carouselData[type]) {\r\n this._carouselData[type] = this._carouselData[type].concat(filteredResult);\r\n }\r\n else {\r\n this._carouselData[type] = filteredResult;\r\n }\r\n\r\n this._buildAllCarousel(container, filteredResult, type);\r\n }\r\n });\r\n }\r\n\r\n _getAccessLevel(curriculumAccessLevel) {\r\n\r\n if (this._accessLevel == \"T2\" && curriculumAccessLevel !== \"T2\")\r\n return false;\r\n else if (this._accessLevel == \"T2\" && (curriculumAccessLevel == undefined || curriculumAccessLevel == \"\"))\r\n return false;\r\n else if (this._accessLevel == \"T2\" && curriculumAccessLevel == \"T2\")\r\n return true;\r\n else if (curriculumAccessLevel == \"T2\" && !this._accessLevel == \"T2\")\r\n return false;\r\n\r\n //if (this._accessLevel == \"T1\" && (curriculumAccessLevel == \"L1\" || curriculumAccessLevel == undefined || curriculumAccessLevel == \"\"))\r\n // return true\r\n //else if (this._accessLevel == \"T1\")\r\n // return false;\r\n\r\n if ((curriculumAccessLevel == \"L1\" || curriculumAccessLevel == \"L2\" || curriculumAccessLevel == \"L3\") && (this._accessLevel !== \"T2\" && this._accessLevel !== \"T1\"))\r\n return (this._accessLevel >= curriculumAccessLevel);\r\n else\r\n return true;\r\n\r\n }\r\n\r\n _buildHeroCarousel(container, data) {\r\n let ol = document.querySelector(\"\" + container + \" .carousel-indicators\");\r\n let carouselInner = document.querySelector(\"\" + container + \" .carousel-inner\");\r\n for (var i = 0; i < data.length; i++) {\r\n let li = document.createElement(\"li\");\r\n if (i == 0) {\r\n li.className = \"active\";\r\n }\r\n li.setAttribute(\"data-target\", \"#heroCarouselIndicators\");\r\n li.setAttribute(\"data-slide-to\", \"\" + i + \"\");\r\n ol.appendChild(li);\r\n\r\n let carouselItem = document.createElement(\"div\");\r\n carouselItem.className = \"carousel-item object-fit_cover\";\r\n var slideIndex = document.querySelectorAll(\"\" + container + \" .carousel-item\").length;\r\n if (slideIndex == 0) {\r\n carouselItem.classList.add(\"active\");\r\n }\r\n let accessLevelDiv = document.createElement(\"div\");\r\n let accessLevelSpan = document.createElement(\"span\");\r\n if (data[i].accessLevel) {\r\n\r\n if (data[i].accessLevel == \"T2\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"LITE\";\r\n }\r\n else if (data[i].accessLevel == \"L1\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"ESSENTIALS\";\r\n }\r\n else if (data[i].accessLevel == \"L2\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"PLUS\";\r\n } else if (data[i].accessLevel == \"L3\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"PREMIUM\";\r\n }\r\n\r\n }\r\n else {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"ESSENTIALS\";\r\n }\r\n\r\n accessLevelDiv.appendChild(accessLevelSpan);\r\n carouselItem.appendChild(accessLevelDiv);\r\n\r\n let img = document.createElement(\"img\");\r\n img.className = \"object-fit_cover\";\r\n img.src = data[i].imageSrc;\r\n img.setAttribute(\"alt\", \"...\");\r\n carouselItem.appendChild(img);\r\n\r\n let carouselCaption = document.createElement(\"div\");\r\n carouselCaption.className = \"carousel-caption d-md-block text-left\";\r\n\r\n let h2 = document.createElement(\"h2\");\r\n h2.textContent = data[i].heroHeading;\r\n carouselCaption.appendChild(h2);\r\n\r\n let h5 = document.createElement(\"h5\");\r\n h5.textContent = data[i].heroSubHeading\r\n carouselCaption.appendChild(h5);\r\n\r\n let p = document.createElement(\"p\");\r\n p.textContent = data[i].heroDescription;\r\n\r\n let br = document.createElement(\"br\");\r\n p.appendChild(br);\r\n\r\n let a = document.createElement(\"a\");\r\n a.className = \"text-link curriculumDetails\";\r\n a.setAttribute(\"curriculum-id\", \"\" + data[i].id + \"\");\r\n a.innerText = \"More details.\"\r\n a.addEventListener('click', this._onProductDetailsClick.bind(this));\r\n p.appendChild(a);\r\n carouselCaption.appendChild(p);\r\n\r\n let addToSpaceBtn = document.createElement(\"a\");\r\n addToSpaceBtn.className = \"btn btn-primary addToSpaceBtn\";\r\n addToSpaceBtn.addEventListener('click', this._onAddToSpaceButtonClick.bind(this))\r\n addToSpaceBtn.setAttribute(\"data-curriculum-id\", \"\" + data[i].id + \"\");\r\n addToSpaceBtn.setAttribute(\"curriculumAccessLevel\", \"\" + data[i].accessLevel + \"\");\r\n addToSpaceBtn.text = \"Add to Space\";\r\n\r\n if (this._isAuthenticated && this._getAccessLevel(data[i].accessLevel) && this._isNotTeacher)\r\n carouselCaption.appendChild(addToSpaceBtn);\r\n\r\n carouselItem.appendChild(carouselCaption);\r\n carouselInner.appendChild(carouselItem);\r\n }\r\n }\r\n\r\n _buildRecomendedCarousel(container, result, pageSize, type) {\r\n var totalSlides = Math.ceil(result.length / pageSize);\r\n\r\n for (var s = 0; s < totalSlides; s = s + 1) {\r\n var start = (s * pageSize);\r\n var end = (start + pageSize);\r\n var data = result.slice(start, end);\r\n\r\n if (data.length < pageSize && pageSize != 1) {\r\n data = data.concat(this._carouselData[type].slice(0, pageSize - data.length));\r\n }\r\n\r\n let carouselItem = document.createElement(\"div\");\r\n carouselItem.className = \"carousel-item\";\r\n\r\n var slideIndex = document.querySelectorAll(\"\" + container + \" .carousel-item\").length;\r\n if (slideIndex == 0) {\r\n carouselItem.classList.add(\"active\");\r\n\r\n }\r\n carouselItem.dataset.slideIndex = slideIndex;\r\n\r\n let cardCarousel = document.createElement(\"div\");\r\n cardCarousel.id = \"recCardCarousel\";\r\n cardCarousel.className = \"row\";\r\n\r\n for (var i = 0; i < data.length; i++) {\r\n let card = document.createElement(\"div\");\r\n card.className = \"col card card-image\";\r\n card.style.background = \"url(\" + data[i].imageSrc + \") no-repeat\";\r\n\r\n //let img = document.createElement(\"img\");\r\n //img.className = \"curriculumDetails\";\r\n //img.setAttribute(\"curriculum-id\", \"\" + data[i].id + \"\");\r\n //img.src = data[i].imageSrc;\r\n //img.setAttribute(\"alt\", \"\" + data[i].publisher.name + \" curriculum cover\");\r\n //img.style.height = \"25rem\";\r\n //img.addEventListener('click', this._onProductDetailsClick.bind(this));\r\n //card.appendChild(img);\r\n\r\n let cardBody = document.createElement(\"div\");\r\n cardBody.className = \"card-body \";\r\n cardBody.setAttribute(\"curriculum-id\", \"\" + data[i].id + \"\");\r\n cardBody.addEventListener('click', this._onProductDetailsClick.bind(this));\r\n\r\n let accessLevelDiv = document.createElement(\"div\");\r\n let accessLevelSpan = document.createElement(\"span\");\r\n\r\n if (data[i].accessLevel) {\r\n\r\n if (data[i].accessLevel == \"T2\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"LITE\";\r\n }\r\n else if (data[i].accessLevel == \"L1\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"ESSENTIALS\";\r\n }\r\n else if (data[i].accessLevel == \"L2\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"PLUS\";\r\n } else if (data[i].accessLevel == \"L3\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"PREMIUM\";\r\n }\r\n\r\n }\r\n else {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"ESSENTIALS\";\r\n }\r\n\r\n accessLevelDiv.appendChild(accessLevelSpan);\r\n cardBody.appendChild(accessLevelDiv);\r\n\r\n let dropUp = document.createElement(\"div\")\r\n dropUp.className = \"btn-group dropup ml-auto\";\r\n dropUp.style.width = \"100%\";\r\n cardBody.appendChild(dropUp);\r\n\r\n let dropDownToggle = document.createElement(\"button\");\r\n dropDownToggle.className = \"btn dropdown-toggle\";\r\n dropDownToggle.setAttribute(\"data-toggle\", \"dropdown\");\r\n dropDownToggle.setAttribute(\"aria-haspopup\", \"true\");\r\n dropDownToggle.setAttribute(\"aria-expanded\", \"false\");\r\n dropDownToggle.textContent = \"Details\";\r\n dropUp.appendChild(dropDownToggle);\r\n\r\n let dropDownMenu = document.createElement(\"div\");\r\n dropDownMenu.className = \"dropdown-menu mb-0 ml-auto\";\r\n let discription = document.createElement(\"div\");\r\n discription.className = \"description\";\r\n let h6 = document.createElement(\"h6\");\r\n h6.className = \"desc text-white\";\r\n h6.textContent = data[i].name;\r\n let p = document.createElement(\"p\");\r\n p.className = \"text-white small\";\r\n p.textContent = data[i].brandName;\r\n let span = document.createElement(\"span\");\r\n span.className = \"desc text-white\";\r\n span.textContent = data[i].description;\r\n discription.appendChild(h6);\r\n discription.appendChild(p);\r\n discription.appendChild(span);\r\n dropDownMenu.appendChild(discription);\r\n\r\n let imgIcon = document.createElement(\"img\");\r\n imgIcon.src = \"images/disciplr-carousel/plus-icon-boxed.svg\";\r\n imgIcon.setAttribute(\"width\", \"24\");\r\n imgIcon.style.float = \"right\";\r\n imgIcon.setAttribute(\"alt\", \"add curriculum to space\");\r\n imgIcon.addEventListener('click', this._onAddToSpaceButtonClick.bind(this));\r\n imgIcon.setAttribute(\"data-curriculum-id\", \"\" + data[i].id + \"\");\r\n imgIcon.setAttribute(\"curriculumAccessLevel\", \"\" + data[i].accessLevel + \"\");\r\n if (this._isAuthenticated && this._getAccessLevel(data[i].accessLevel) && this._isNotTeacher)\r\n dropDownMenu.appendChild(imgIcon);\r\n\r\n dropUp.appendChild(dropDownMenu);\r\n\r\n card.appendChild(cardBody);\r\n cardCarousel.appendChild(card);\r\n }\r\n carouselItem.appendChild(cardCarousel);\r\n let carousel = document.querySelector(\"\" + container + \" .carousel-inner\");\r\n carousel.appendChild(carouselItem);\r\n }\r\n }\r\n\r\n _buildCarousel(container, result, pageSize, type) {\r\n var totalSlides = Math.ceil(result.length / pageSize);\r\n\r\n for (var s = 0; s < totalSlides; s = s + 1) {\r\n var start = (s * pageSize);\r\n var end = (start + pageSize);\r\n var data = result.slice(start, end);\r\n\r\n if (data.length < pageSize && pageSize != 1) {\r\n data = data.concat(this._carouselData[type].slice(0, pageSize - data.length));\r\n }\r\n\r\n let carouselItem = document.createElement(\"div\");\r\n carouselItem.className = \"carousel-item text-center\";\r\n var slideIndex = document.querySelectorAll(\"\" + container + \" .carousel-item\").length;\r\n\r\n if (slideIndex == 0) {\r\n carouselItem.classList.add(\"active\");\r\n }\r\n\r\n carouselItem.dataset.slideIndex = slideIndex;\r\n\r\n let cardCarousel = document.createElement(\"div\");\r\n cardCarousel.id = \"cardCarousel\";\r\n cardCarousel.className = \"row\";\r\n\r\n for (var i = 0; i < data.length; i++) {\r\n let card = document.createElement(\"div\");\r\n card.className = \"col-sm card\";\r\n\r\n let cardBody = document.createElement(\"div\");\r\n cardBody.className = \"card-body\";\r\n\r\n let accessLevelDiv = document.createElement(\"div\");\r\n let accessLevelSpan = document.createElement(\"span\");\r\n if (data[i].accessLevel) {\r\n\r\n if (data[i].accessLevel == \"T2\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"LITE\";\r\n }\r\n else if (data[i].accessLevel == \"L1\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"ESSENTIALS\";\r\n }\r\n else if (data[i].accessLevel == \"L2\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"PLUS\";\r\n } else if (data[i].accessLevel == \"L3\") {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"PREMIUM\";\r\n }\r\n\r\n }\r\n else {\r\n accessLevelDiv.className = \"label-tag\";\r\n accessLevelSpan.textContent = \"ESSENTIALS\";\r\n }\r\n\r\n accessLevelDiv.appendChild(accessLevelSpan);\r\n cardBody.appendChild(accessLevelDiv);\r\n\r\n let dropUp = document.createElement(\"div\")\r\n dropUp.className = \"btn-group dropup\";\r\n dropUp.style.width = \"100%\";\r\n cardBody.appendChild(dropUp);\r\n\r\n let dropDownToggle = document.createElement(\"button\");\r\n dropDownToggle.className = \"btn dropdown-toggle\";\r\n dropDownToggle.setAttribute(\"data-toggle\", \"dropdown\");\r\n dropDownToggle.setAttribute(\"aria-haspopup\", \"true\");\r\n dropDownToggle.setAttribute(\"aria-expanded\", \"false\");\r\n dropDownToggle.textContent = \"Details\";\r\n dropUp.appendChild(dropDownToggle);\r\n\r\n let dropDownMenu = document.createElement(\"div\");\r\n dropDownMenu.className = \"dropdown-menu mb-0 ml-auto\";\r\n let discription = document.createElement(\"div\");\r\n discription.className = \"description\";\r\n let h6 = document.createElement(\"h6\");\r\n h6.className = \"desc text-white\";\r\n h6.textContent = data[i].name;\r\n let p = document.createElement(\"p\");\r\n p.className = \"text-white small\";\r\n p.textContent = data[i].brandName;\r\n let span = document.createElement(\"span\");\r\n span.className = \"desc text-white\";\r\n span.textContent = data[i].description;\r\n discription.appendChild(h6);\r\n discription.appendChild(p);\r\n discription.appendChild(span);\r\n dropDownMenu.appendChild(discription);\r\n\r\n let imgIcon = document.createElement(\"img\");\r\n imgIcon.src = \"images/disciplr-carousel/plus-icon-boxed.svg\";\r\n imgIcon.setAttribute(\"width\", \"24\");\r\n imgIcon.style.float = \"right\";\r\n imgIcon.setAttribute(\"alt\", \"add curriculum to space\");\r\n imgIcon.setAttribute(\"data-curriculum-id\", \"\" + data[i].id + \"\");\r\n imgIcon.setAttribute(\"curriculumAccessLevel\", \"\" + data[i].accessLevel + \"\");\r\n if (this._isAuthenticated && this._getAccessLevel(data[i].accessLevel) && this._isNotTeacher)\r\n dropDownMenu.appendChild(imgIcon);\r\n imgIcon.addEventListener('click', this._onAddToSpaceButtonClick.bind(this));\r\n\r\n dropUp.appendChild(dropDownMenu);\r\n\r\n let img = document.createElement(\"img\");\r\n img.className = \"card-img-top curriculumDetails\";\r\n img.setAttribute(\"curriculum-id\", \"\" + data[i].id + \"\");\r\n img.src = data[i].imageSrc;\r\n img.setAttribute(\"alt\", \"\" + data[i].publisher.name + \" curriculum cover\");\r\n img.addEventListener('click', this._onProductDetailsClick.bind(this));\r\n cardBody.appendChild(img);\r\n\r\n card.appendChild(cardBody);\r\n cardCarousel.appendChild(card);\r\n }\r\n carouselItem.appendChild(cardCarousel);\r\n let carousel = document.querySelector(\"\" + container + \" .carousel-inner\");\r\n\r\n carousel.appendChild(carouselItem);\r\n }\r\n }\r\n\r\n _buildCustomCarousel(container, result, pageSize, type) {\r\n var totalSlides = Math.ceil(result.length / pageSize);\r\n var isCarousel = true;\r\n if (result.length < pageSize) {\r\n isCarousel = false;\r\n }\r\n\r\n for (var s = 0; s < totalSlides; s = s + 1) {\r\n var start = (s * pageSize);\r\n var end = (start + pageSize);\r\n var data = result.slice(start, end);\r\n\r\n let carouselItem = document.createElement(\"div\");\r\n carouselItem.className = \"carousel-item text-center\";\r\n var slideIndex = document.querySelectorAll(\"\" + container + \" .carousel-item\").length;\r\n\r\n if (slideIndex == 0) {\r\n carouselItem.classList.add(\"active\");\r\n }\r\n\r\n carouselItem.dataset.slideIndex = slideIndex;\r\n\r\n let cardCarousel = document.createElement(\"div\");\r\n cardCarousel.id = \"cardCarousel\";\r\n cardCarousel.className = \"row\";\r\n\r\n for (var i = 0; i < data.length; i++) {\r\n let card = document.createElement(\"div\");\r\n\r\n\r\n\r\n let cardBody = document.createElement(\"div\");\r\n cardBody.className = \"card-body\";\r\n\r\n let dropUp = document.createElement(\"div\");\r\n dropUp.className = \"btn-group dropup\";\r\n\r\n if (!isCarousel || data.length < pageSize) {\r\n dropUp.style.width = cardBody.style.maxWidth = \"19rem\";\r\n cardBody.style.float = \"left\";\r\n card.className = \"card\";\r\n }\r\n else {\r\n dropUp.style.width = \"100%\";\r\n card.className = \"col-sm card\";\r\n }\r\n cardBody.appendChild(dropUp);\r\n\r\n let dropDownToggle = document.createElement(\"button\");\r\n dropDownToggle.className = \"btn dropdown-toggle\";\r\n dropDownToggle.setAttribute(\"data-toggle\", \"dropdown\");\r\n dropDownToggle.setAttribute(\"aria-haspopup\", \"true\");\r\n dropDownToggle.setAttribute(\"aria-expanded\", \"false\");\r\n dropDownToggle.textContent = \"Details\";\r\n dropUp.appendChild(dropDownToggle);\r\n\r\n let dropDownMenu = document.createElement(\"div\");\r\n dropDownMenu.className = \"dropdown-menu mb-0 ml-auto\";\r\n let discription = document.createElement(\"div\");\r\n discription.className = \"description\";\r\n let h6 = document.createElement(\"h6\");\r\n h6.className = \"desc text-white\";\r\n if (this._curriculumAssociatedToSpaces[data[i].id] == 0) {\r\n h6.textContent = data[i].name + \" DRAFT\";\r\n h6.title = data[i].name + \" DRAFT\";\r\n } else {\r\n h6.textContent = data[i].name;\r\n h6.title = data[i].name;\r\n }\r\n let p = document.createElement(\"p\");\r\n p.className = \"text-white small\";\r\n p.textContent = data[i].brandName;\r\n let span = document.createElement(\"span\");\r\n span.className = \"desc text-white\";\r\n span.textContent = data[i].description;\r\n discription.appendChild(h6);\r\n discription.appendChild(p);\r\n discription.appendChild(span);\r\n dropDownMenu.appendChild(discription);\r\n\r\n let imgIcon = document.createElement(\"img\");\r\n imgIcon.src = \"images/disciplr-carousel/plus-icon-boxed.svg\";\r\n imgIcon.setAttribute(\"width\", \"24\");\r\n imgIcon.style.float = \"right\";\r\n imgIcon.setAttribute(\"alt\", \"add curriculum to space\");\r\n imgIcon.setAttribute(\"data-curriculum-id\", \"\" + data[i].id + \"\");\r\n imgIcon.setAttribute(\"curriculumAccessLevel\", \"\" + data[i].accessLevel + \"\");\r\n if (this._isNotTeacher && this._curriculumAssociatedToSpaces[data[i].id] > 0)\r\n dropDownMenu.appendChild(imgIcon);\r\n imgIcon.addEventListener('click', this._onCustomAddToSpaceButtonClick.bind(this));\r\n\r\n let anchor = document.createElement(\"a\");\r\n anchor.href = \"/customcurriculum/update/\" + data[i].id;\r\n\r\n anchor.style.color = \"white\";\r\n anchor.style.marginRight = \"0.2rem\";\r\n\r\n let editIcon = document.createElement(\"i\");\r\n editIcon.classList.add(\"fa\");\r\n editIcon.classList.add(\"fa-pencil\");\r\n editIcon.classList.add(\"fa-lg\");\r\n anchor.appendChild(editIcon);\r\n if (this._isNotTeacher)\r\n dropDownMenu.appendChild(anchor);\r\n\r\n let deleteIcon = document.createElement(\"i\");\r\n deleteIcon.classList.add(\"fa\");\r\n deleteIcon.classList.add(\"fa-trash\");\r\n deleteIcon.classList.add(\"fa-lg\");\r\n deleteIcon.dataset.id = data[i].id;\r\n deleteIcon.style.color = \"white\";\r\n deleteIcon.addEventListener(\"click\", (e) => {\r\n this._customCurriculumToBeDeleted = e.target.dataset.id;\r\n if (this._curriculumAssociatedToSpaces[this._customCurriculumToBeDeleted] > 0)\r\n this._curriculumCanNotBeDeletedDialog.open();\r\n else\r\n this._deleteCustomCurriculumDialog.open();\r\n });\r\n\r\n if (this._isNotTeacher)\r\n dropDownMenu.appendChild(deleteIcon);\r\n\r\n\r\n\r\n dropUp.appendChild(dropDownMenu);\r\n\r\n let img = document.createElement(\"img\");\r\n img.className = \"card-img-top curriculumDetails\";\r\n img.setAttribute(\"curriculum-id\", \"\" + data[i].id + \"\");\r\n if (data[i].imageSrc != null && data[i].imageSrc != \"\") {\r\n img.src = data[i].imageSrc;\r\n }\r\n else {\r\n img.src = \"/mstile-150x150.png\";\r\n }\r\n\r\n img.style.height = \"200px\";\r\n\r\n img.setAttribute(\"alt\", \"\" + data[i].name + \" curriculum cover\");\r\n img.addEventListener('click', this._onCustomProductDetailsClick.bind(this));\r\n cardBody.appendChild(img);\r\n\r\n card.appendChild(cardBody);\r\n cardCarousel.appendChild(card);\r\n }\r\n carouselItem.appendChild(cardCarousel);\r\n let carousel = document.querySelector(\"\" + container + \" .carousel-inner\");\r\n\r\n carousel.appendChild(carouselItem);\r\n }\r\n }\r\n\r\n _buildAllCarousel(container, data, type) {\r\n this._buildCarousel(container, data, 4, type);\r\n this._buildCarousel(container + \"-medium\", data, 3, type);\r\n this._buildCarousel(container + \"-small\", data, 2, type);\r\n this._buildCarousel(container + \"-xsmall\", data, 1, type);\r\n }\r\n\r\n _onCustomAddToSpaceButtonClick(e) {\r\n if (this._isExpired == \"True\") {\r\n let navigateToSpace = window.location.origin;\r\n window.location.href = navigateToSpace + \"/spaces\";\r\n return false;\r\n }\r\n this._currentCurriculumId = e.target.attributes[\"data-curriculum-id\"].value;\r\n\r\n this._addToSpacesDialog.open();\r\n }\r\n\r\n _onAddToSpaceButtonClick(e) {\r\n if (this._isExpired == \"True\") {\r\n let navigateToSpace = window.location.origin;\r\n window.location.href = navigateToSpace + \"/spaces\";\r\n return false;\r\n }\r\n this._currentCurriculumId = e.target.attributes[\"data-curriculum-id\"].value;\r\n this._currentCurriculumName = e.target.attributes[\"curriculum-name\"] != undefined ? e.target.attributes[\"curriculum-name\"].value : \"\";\r\n this._currentCurriculumScore = e.target.attributes[\"curriculum-score\"] != undefined ? e.target.attributes[\"curriculum-score\"].value : \"\";\r\n\r\n let curriculumAccessLevel = e.target.getAttribute(\"curriculumAccessLevel\") != null ? e.target.getAttribute(\"curriculumAccessLevel\") : \"L1\";\r\n if (this._accessLevel == \"T1\" && !(curriculumAccessLevel == \"L1\" || curriculumAccessLevel == \"T2\" || curriculumAccessLevel == undefined || curriculumAccessLevel == \"\" || curriculumAccessLevel == \"null\")) {\r\n this._premiumMessageDialog.open();\r\n let m = new this.Modal('#curriculumDetailsModal', {\r\n backdrop: true\r\n });\r\n m.hide();\r\n return;\r\n }\r\n this._addToSpacesDialog.open();\r\n }\r\n\r\n _onCustomProductDetailsClick(e) {\r\n if (this._isExpired == \"True\") {\r\n let navigateToSpace = window.location.origin;\r\n window.location.href = navigateToSpace + \"/spaces\";\r\n return false;\r\n }\r\n\r\n if (e.target.attributes[\"curriculum-id\"] == undefined) {\r\n return false;\r\n }\r\n\r\n let curriculumId = e.target.attributes[\"curriculum-id\"].value;\r\n\r\n xhr(\"/customcurriculum/getCurriculumDetails/\" + curriculumId, {}).then(curriculumData => {\r\n var container = document.querySelector(\"#curriculumDetailsModal\");\r\n container.querySelector(\"#curriculumTitle\").textContent = curriculumData.name;\r\n container.querySelector(\"#publisherName\").textContent = curriculumData.publisherName;\r\n container.querySelector(\"#curriculumDescription\").textContent = curriculumData.curriculum.description;\r\n if (container.querySelector(\"#add-to-space-button\") !== null) {\r\n container.querySelector(\"#add-to-space-button\").disabled = false\r\n container.querySelector(\"#add-to-space-button\").setAttribute(\"data-curriculum-id\", curriculumData.id);\r\n container.querySelector(\"#add-to-space-button\").setAttribute(\"curriculumAccessLevel\", curriculumData.curriculum.accessLevel);\r\n if (this._isAuthenticated && this._getAccessLevel(curriculumData.curriculum.accessLevel) && this._isNotTeacher && this._curriculumAssociatedToSpaces[curriculumData.id] > 0) {\r\n container.querySelector(\"#add-to-space-button\").classList.remove('hide');\r\n }\r\n else {\r\n container.querySelector(\"#add-to-space-button\").classList.add('hide');\r\n }\r\n\r\n if (curriculumData.addCurriculumToSpacesFormModel != null) {\r\n if (curriculumData.addCurriculumToSpacesFormModel.spaces.length == 0) {\r\n container.querySelector(\"#add-to-space-button\").disabled = true;\r\n }\r\n }\r\n }\r\n\r\n var tableBody = container.querySelector('tbody');\r\n container.querySelectorAll(\"table tbody tr\").forEach(function (e) { e.remove() })\r\n\r\n curriculumData.curriculum.lessons = curriculumData.curriculum.lessons.filter(function (lesson) { return lesson.id ? true : false; });\r\n curriculumData.curriculum.lessons = curriculumData.curriculum.lessons.sort(function (lesson1, lesson2) { return lesson1.number && lesson2.number ? lesson1.number - lesson2.number : 0; });\r\n if (curriculumData.curriculum.lessons.length > 0) {\r\n var totalLessons = curriculumData.curriculum.lessons.length > 5 ? 5 : curriculumData.curriculum.lessons.length;\r\n for (let i = 0; i < totalLessons; i++) {\r\n let tr = document.createElement('tr');\r\n let th = document.createElement('th');\r\n th.setAttribute('scope', 'row');\r\n if (curriculumData.curriculum.lessons[i])\r\n th.textContent = curriculumData.curriculum.lessons[i].number;\r\n tr.appendChild(th);\r\n\r\n let td = document.createElement('td');\r\n if (this._isAuthenticated) {\r\n let a = document.createElement('a');\r\n a.setAttribute('href', '/lesson/custom/' + curriculumData.curriculum.lessons[i].id);\r\n a.textContent = curriculumData.curriculum.lessons[i].name;\r\n td.appendChild(a);\r\n\r\n let img = document.createElement('img');\r\n img.className = 'ml-2';\r\n img.setAttribute('src', 'images/disciplr-carousel/leave-page.svg');\r\n img.setAttribute('width', '12');\r\n td.appendChild(img);\r\n }\r\n\r\n tr.appendChild(td);\r\n tableBody.appendChild(tr);\r\n }\r\n\r\n let tr = document.createElement('tr');\r\n let th = document.createElement('th');\r\n th.setAttribute('scope', 'row');\r\n\r\n\r\n let a = document.createElement('a');\r\n a.setAttribute('href', '/customcurriculum/' + curriculumData.id);\r\n a.textContent = 'Full Lesson List ❯';\r\n th.appendChild(a);\r\n\r\n\r\n let td = document.createElement('td');\r\n tr.appendChild(th);\r\n tr.appendChild(td);\r\n tableBody.appendChild(tr);\r\n }\r\n\r\n var m = new this.Modal('#curriculumDetailsModal', {\r\n backdrop: true\r\n });\r\n m.show();\r\n });\r\n }\r\n\r\n _onProductDetailsClick(e) {\r\n if (this._isExpired == \"True\") {\r\n let navigateToSpace = window.location.origin;\r\n window.location.href = navigateToSpace + \"/spaces\";\r\n return false;\r\n }\r\n\r\n if (e.target.attributes[\"curriculum-id\"] == undefined) {\r\n return false;\r\n }\r\n\r\n let curriculumId = e.target.attributes[\"curriculum-id\"].value;\r\n let curriculumScore = e.target.attributes[\"curriculum-score\"] != undefined ? e.target.attributes[\"curriculum-score\"].value : \"\";\r\n\r\n xhr(\"/curriculum/getCurriculumDetails/\" + curriculumId, {}).then(curriculumData => {\r\n var container = document.querySelector(\"#curriculumDetailsModal\");\r\n container.querySelector(\"#curriculumTitle\").textContent = curriculumData.name;\r\n container.querySelector(\"#publisherName\").textContent = curriculumData.publisherName;\r\n container.querySelector(\"#curriculumDescription\").textContent = curriculumData.curriculum.description;\r\n if (container.querySelector(\"#add-to-space-button\") !== null) {\r\n container.querySelector(\"#add-to-space-button\").disabled = false\r\n container.querySelector(\"#add-to-space-button\").setAttribute(\"data-curriculum-id\", curriculumData.id);\r\n container.querySelector(\"#add-to-space-button\").setAttribute(\"curriculumAccessLevel\", curriculumData.curriculum.accessLevel);\r\n if (curriculumScore != \"\") {\r\n container.querySelector(\"#add-to-space-button\").setAttribute(\"curriculum-name\", curriculumData.name);\r\n container.querySelector(\"#add-to-space-button\").setAttribute(\"curriculum-score\", curriculumScore);\r\n }\r\n\r\n if (this._isAuthenticated && this._getAccessLevel(curriculumData.curriculum.accessLevel) && this._isNotTeacher) {\r\n container.querySelector(\"#add-to-space-button\").classList.remove('hide');\r\n }\r\n else {\r\n container.querySelector(\"#add-to-space-button\").classList.add('hide');\r\n }\r\n\r\n if (curriculumData.addCurriculumToSpacesFormModel != null) {\r\n if (curriculumData.addCurriculumToSpacesFormModel.spaces.length == 0) {\r\n container.querySelector(\"#add-to-space-button\").disabled = true;\r\n }\r\n }\r\n }\r\n\r\n var tableBody = container.querySelector('tbody');\r\n container.querySelectorAll(\"table tbody tr\").forEach(function (e) { e.remove() })\r\n\r\n curriculumData.curriculum.lessons = curriculumData.curriculum.lessons.filter(function (lesson) { return lesson.id ? true : false; });\r\n\r\n if (curriculumData.curriculum.lessons.length > 0) {\r\n var totalLessons = curriculumData.curriculum.lessons.length > 5 ? 5 : curriculumData.curriculum.lessons.length;\r\n for (let i = 0; i < totalLessons; i++) {\r\n let tr = document.createElement('tr');\r\n let th = document.createElement('th');\r\n th.setAttribute('scope', 'row');\r\n if (curriculumData.curriculum.lessons[i])\r\n th.textContent = curriculumData.curriculum.lessons[i].number;\r\n tr.appendChild(th);\r\n\r\n let td = document.createElement('td');\r\n if (this._isAuthenticated && (this._getAccessLevel(curriculumData.curriculum.accessLevel) || this._accessLevel == \"T1\" || this._accessLevel == \"T2\")) {\r\n let a = document.createElement('a');\r\n a.setAttribute('href', '/lesson/' + curriculumData.curriculum.lessons[i].id);\r\n a.textContent = curriculumData.curriculum.lessons[i].name;\r\n td.appendChild(a);\r\n\r\n let img = document.createElement('img');\r\n img.className = 'ml-2';\r\n img.setAttribute('src', 'images/disciplr-carousel/leave-page.svg');\r\n img.setAttribute('width', '12');\r\n td.appendChild(img);\r\n } else {\r\n let span = document.createElement('span');\r\n span.textContent = curriculumData.curriculum.lessons[i].name;\r\n td.appendChild(span);\r\n }\r\n\r\n tr.appendChild(td);\r\n tableBody.appendChild(tr);\r\n if (i == 4) {\r\n let tr = document.createElement('tr');\r\n let th = document.createElement('th');\r\n th.setAttribute('scope', 'row');\r\n\r\n if (this._getAccessLevel(curriculumData.curriculum.accessLevel) || this._accessLevel == \"T1\" || this._accessLevel == \"T2\") {\r\n let a = document.createElement('a');\r\n a.setAttribute('href', '/curriculum/' + curriculumData.id);\r\n a.textContent = 'Full Lesson List ❯';\r\n\r\n th.appendChild(a);\r\n }\r\n\r\n let td = document.createElement('td');\r\n tr.appendChild(th);\r\n tr.appendChild(td);\r\n tableBody.appendChild(tr);\r\n }\r\n }\r\n }\r\n\r\n if (this._appInsights != undefined && this._searchId != undefined && this._searchServiceName != undefined) {\r\n this._appInsights.trackEvent('click', {\r\n SearchServiceName: this._searchServiceName,\r\n SearchId: this._searchId,\r\n ClickedDocName: curriculumData.name,\r\n Rank: curriculumScore\r\n });\r\n }\r\n\r\n var m = new this.Modal('#curriculumDetailsModal', {\r\n backdrop: true\r\n });\r\n m.show();\r\n });\r\n }\r\n\r\n _buildSpaceNode() {\r\n let spaceLabel = document.createElement(\"label\");\r\n spaceLabel.className = \"flex-row space\";\r\n\r\n let detailsSpan = document.createElement(\"span\");\r\n detailsSpan.className = \"flex-2-column\";\r\n spaceLabel.appendChild(detailsSpan);\r\n\r\n let spaceNameSpan = document.createElement(\"span\");\r\n spaceNameSpan.className = \"name space-label\";\r\n detailsSpan.appendChild(spaceNameSpan);\r\n\r\n let curriculumCountSpan = document.createElement(\"span\");\r\n curriculumCountSpan.className = \"curriculum-count space-label\";\r\n detailsSpan.appendChild(curriculumCountSpan);\r\n\r\n let checkboxWrapper = document.createElement(\"span\");\r\n checkboxWrapper.className = \"checkbox-wrapper\";\r\n spaceLabel.appendChild(checkboxWrapper);\r\n\r\n let checkbox = document.createElement(\"input\");\r\n checkbox.className = \"checkbox\";\r\n checkbox.setAttribute(\"type\", \"checkbox\");\r\n checkboxWrapper.appendChild(checkbox);\r\n\r\n let checkboxSpan = document.createElement(\"span\");\r\n checkboxSpan.className = \"pretty-checkbox\";\r\n checkboxWrapper.appendChild(checkboxSpan);\r\n\r\n return spaceLabel;\r\n }\r\n\r\n _initializeDialog() {\r\n this._setupCurriculumDialog = new Dialog('setup-curriculum-dialog');\r\n this._addToSpacesDialog = new Dialog('add-curriculum-to-spaces-dialog');\r\n this._premiumMessageDialog = new Dialog('premium-curriculum-message');\r\n this._deleteCustomCurriculumDialog = new Dialog(\"delete-custom-curriculum-confirmation\");\r\n this._deleteCustomConfirmDialog = new Dialog(\"delete-custom-confirmation\");\r\n this._curriculumCanNotBeDeletedDialog = new Dialog(\"delete-custom-curriculum-cannot-delete\");\r\n\r\n this._deleteCustomConfirmDialog.onbeforeshow = (dialog, container) => {\r\n container.querySelector(\"#customConfirmDeleteBtn\").addEventListener(\"click\", ((e) => {\r\n xhr(\"/customcurriculum/\" + this._customCurriculumToBeDeleted, { method: 'delete' })\r\n .then((data => {\r\n var customCurriculumList = document.querySelector(\".custom-curriculumList\");\r\n var deletedCard = customCurriculumList.getElementsByClassName(\"\" + this._customCurriculumToBeDeleted + \"\")[0];\r\n deletedCard.parentNode.removeChild(deletedCard);\r\n this._deleteCustomConfirmDialog.close();\r\n }).bind(this));\r\n }).bind(this));\r\n return true;\r\n };\r\n\r\n this._deleteCustomCurriculumDialog.onbeforeshow = (dialog, container) => {\r\n container.querySelector(\"#customCurriculumDeleteBtn\").addEventListener(\"click\", ((e) => {\r\n xhr(\"/customcurriculum/\" + this._customCurriculumToBeDeleted, { method: 'delete' })\r\n .then((data => {\r\n var filteredData = this._carouselData[\"IsCustom\"].filter(w => w.id != this._customCurriculumToBeDeleted ? true : false);\r\n var customCarouselContainer = document.querySelector(\".CustomCurriculum .carousel-inner\");\r\n while (customCarouselContainer.firstChild) {\r\n customCarouselContainer.removeChild(customCarouselContainer.firstChild);\r\n }\r\n this._buildAllCustomCarousel(\".CustomCurriculum\", filteredData, \"IsCustom\");\r\n this._deleteCustomCurriculumDialog.close();\r\n }).bind(this));\r\n\r\n }).bind(this));\r\n return true;\r\n };\r\n\r\n this._addToSpacesDialog.onbeforeshow = (dialog, container) => {\r\n this._refreshUrl = null;\r\n let curriculumId = this._currentCurriculumId;\r\n let curriculumName = this._currentCurriculumName;\r\n let curriculumScore = this._currentCurriculumScore;\r\n this._refreshUrl = \"/curriculum/spaces/\" + curriculumId;\r\n if (curriculumId.toString().indexOf(\"-\") > 0) {\r\n container.querySelector('form').action = \"/customcurriculum/spaces\";\r\n }\r\n else {\r\n container.querySelector('form').action = \"/curriculum/spaces\";\r\n }\r\n\r\n this._maxCurriculumCountSpaceCanHave = container.querySelector(\"#MaximumCurriculumCount\").value;\r\n container.querySelector(\"#CurriculumId\").value = curriculumId;\r\n container.querySelector(\"#added-spaces\").innerHTML = \"\";\r\n\r\n return xhr(this._refreshUrl).then(data => {\r\n let spaces = data.availableSpaces;\r\n let spacesContainer = container.querySelector(\"#add-curriculum-to-spaces-form .spaces\");\r\n spacesContainer.innerHTML = \"\";\r\n\r\n if (spaces.length > 0) {\r\n let template = this._buildSpaceNode();\r\n let fragment = document.createDocumentFragment();\r\n\r\n for (let i = 0; i < spaces.length; i++) {\r\n let checkboxData = spaces[i];\r\n\r\n let item = template.cloneNode(true);\r\n item.querySelector(\".name\").innerText = checkboxData.label;\r\n\r\n let checkbox = item.querySelector(\".checkbox\");\r\n checkbox.name = checkbox.id = `Spaces[${i}].Checked`;\r\n checkbox.checked = checkboxData.checked;\r\n checkbox.onclick = (event) => {\r\n this._ifNoSpaceSelectedDisableAddToSpaceDialogButton();\r\n }\r\n\r\n if (checkboxData.curriculumCount < this._maxCurriculumCountSpaceCanHave) {\r\n item.querySelector(\".curriculum-count\").innerText = `${checkboxData.curriculumCount} Curriculum`;\r\n }\r\n else {\r\n checkbox.disabled = true;\r\n checkbox.checked = false;\r\n\r\n if (window.pageYOffset || document.documentElement.scrollTop != 0) {\r\n document.documentElement.scrollTop = 0;\r\n document.body.scrollTop = 0\r\n }\r\n\r\n item.querySelector(\".curriculum-count\").style.color = \"orange\";\r\n item.querySelector(\".curriculum-count\").innerText = `Max curriculum limit(${this._maxCurriculumCountSpaceCanHave}) reached. `;\r\n }\r\n\r\n let idField = document.createElement(\"input\");\r\n idField.setAttribute(\"type\", \"hidden\");\r\n idField.name = idField.id = `Spaces[${i}].ItemId`;\r\n idField.value = checkboxData.itemId;\r\n item.appendChild(idField);\r\n\r\n let labelField = document.createElement(\"input\");\r\n labelField.setAttribute(\"type\", \"hidden\");\r\n labelField.name = labelField.id = `Spaces[${i}].Label`;\r\n labelField.value = checkboxData.label;\r\n item.appendChild(labelField);\r\n\r\n let curriculumCountField = document.createElement(\"input\");\r\n curriculumCountField.setAttribute(\"type\", \"hidden\");\r\n curriculumCountField.name = curriculumCountField.id = `Spaces[${i}].CurriculumCount`;\r\n curriculumCountField.value = checkboxData.curriculumCount;\r\n item.appendChild(curriculumCountField);\r\n\r\n fragment.appendChild(item);\r\n }\r\n\r\n if (this._appInsights != undefined && this._searchId != undefined && this._searchServiceName != undefined) {\r\n this._appInsights.trackEvent('Click', {\r\n SearchServiceName: this._searchServiceName,\r\n SearchId: this._searchId,\r\n ClickedDocName: curriculumName,\r\n Rank: curriculumScore\r\n });\r\n }\r\n\r\n spacesContainer.appendChild(fragment);\r\n this._ifNoSpaceSelectedDisableAddToSpaceDialogButton();\r\n\r\n let m = new this.Modal('#curriculumDetailsModal', {\r\n backdrop: true\r\n });\r\n m.hide();\r\n } else {\r\n let spaces = container.querySelector(\".spaces\")\r\n let div = document.createElement(\"div\")\r\n div.className = \"flex-coloum text-center\";\r\n let h5 = document.createElement(\"h5\");\r\n h5.textContent = \"No space to add this curriculum. Please add a space.\"\r\n div.appendChild(h5);\r\n\r\n let a = document.createElement(\"a\");\r\n a.className = \"button primary call-to-action small\";\r\n a.setAttribute(\"href\", \"/spaces?isnospace=true\");\r\n a.textContent = \"Create a Space\"\r\n div.appendChild(a)\r\n\r\n spaces.appendChild(div);\r\n container.querySelector(\"button[type='submit']\").disabled = true;\r\n }\r\n }, (xhr) => {\r\n window.location = \"/spaces\";\r\n })\r\n };\r\n\r\n this._addToSpacesDialog.oncreated = (dialog, container) => {\r\n this._addToSpacesForm = new Form(container.querySelector('form'), { done: this._formSubmitted.bind(this) });\r\n return true;\r\n };\r\n\r\n this._addToSpacesDialog.onclosed = (dialog, container) => {\r\n container.querySelector(\"#add-curriculum-to-spaces-form .spaces\").innerHTML = \"\";\r\n container.querySelector(\"#add-curriculum-to-spaces-form button[type='submit']\").classList.remove('hide');\r\n container.querySelector(\"#add-curriculum-to-spaces-form button[type='button']\").textContent = \"Cancel\";\r\n container.querySelector(\"#add-curriculum-to-spaces-form #customize-curriculum-for\").classList.add('hide');\r\n container.querySelector(\"#add-curriculum-to-spaces-form #customizecurriculum\").classList.add('hide');\r\n };\r\n }\r\n\r\n _ifNoSpaceSelectedDisableAddToSpaceDialogButton() {\r\n var addToSpaceDialogButton = this._addToSpacesForm._form.querySelector(\"button[type='submit']\");\r\n var noSpaceSelected = this._addToSpacesForm._form.querySelectorAll(\".spaces input:checked\").length == 0;\r\n addToSpaceDialogButton.disabled = noSpaceSelected;\r\n }\r\n\r\n _formSubmitted(addedSpaces) {\r\n xhr(this._refreshUrl)\r\n .then(viewData => this._updateView(addedSpaces, viewData));\r\n }\r\n\r\n _updateView(addedSpaces, viewData) {\r\n this._updateAssociatedSpacesListing(addedSpaces);\r\n this._showAddedCurriculumFooter(addedSpaces, viewData);\r\n }\r\n\r\n _updateAssociatedSpacesListing(spaces) {\r\n this._addToSpacesDialog.close();\r\n this._setupCurriculumDialog.open();\r\n var container = document.querySelector(\"#setupCurriculumContainer\");\r\n if (spaces.length > 0) {\r\n let url = \"/curriculum/getCurriculumDetails/\" + this._currentCurriculumId;\r\n xhr(url).then(data => {\r\n container.querySelector(\"#curriculumName\").textContent = data.name;\r\n container.querySelector(\"#curriculumBrandName\").textContent = data.curriculum.brandName;\r\n container.querySelector(\"#curriculumPublisherName\").textContent = data.publisherName;\r\n container.querySelector(\"#curriculumImgSrc\").src = data.imageSrc;\r\n });\r\n }\r\n let associatedSpaces = \"\";\r\n for (var i = 0; i < spaces.length; i++) {\r\n associatedSpaces += spaces[i].name;\r\n if (i != (spaces.length) - 1) {\r\n associatedSpaces += \", \";\r\n }\r\n }\r\n container.querySelector(\"#spaceName\").textContent = associatedSpaces;\r\n }\r\n\r\n _updateAddToSpacesButton(availableSpacesCount) {\r\n if (availableSpacesCount === 0) {\r\n this._addToSpacesButton.parentElement.removeChild(this._addToSpacesButton);\r\n }\r\n else {\r\n this._addToSpacesButton.classList.add(\"added\");\r\n this._addToSpacesButton.innerText = \"Added to space\";\r\n }\r\n }\r\n\r\n _showAddedCurriculumFooter(addedSpaces, viewData) {\r\n var ids = [];\r\n for (var i = 0; i < addedSpaces.length; i++)\r\n ids.push(addedSpaces[i].id);\r\n var url;\r\n\r\n if (this._currentCurriculumId.indexOf(\"-\") < 0) {\r\n url = `/curriculum/${this._currentCurriculumId}/spacecurriculumdetails`;\r\n }\r\n else {\r\n url = `/customcurriculum/${this._currentCurriculumId}/spacecurriculumdetails`;\r\n }\r\n\r\n xhr(url,\r\n {\r\n method: \"POST\",\r\n data: JSON.stringify({ ids })\r\n })\r\n .then(data => {\r\n if (data.spaceNavigationList.length > 1) {\r\n document.querySelector(\"#customizecurriculum\").classList.add('hide');\r\n let customizeCurriculumFor = document.querySelector(\"#customize-curriculum-for\");\r\n customizeCurriculumFor.classList.remove(\"hide\");\r\n\r\n var opt = document.createElement('option');\r\n opt.value = 1;\r\n opt.innerHTML = \" CUSTOMIZE CURRICULUM FOR\";\r\n customizeCurriculumFor.appendChild(opt);\r\n\r\n for (let i = 0; i < data.spaceNavigationList.length; i++) {\r\n var opt = document.createElement('option');\r\n opt.value = data.spaceNavigationList[i].spaceCurriculumId;\r\n opt.innerHTML = ` ${data.spaceNavigationList[i].spaceName}`;\r\n customizeCurriculumFor.appendChild(opt);\r\n }\r\n customizeCurriculumFor.addEventListener('change', (e) => {\r\n document.location = `/space-curriculum/${e.target.value}/settings`\r\n });\r\n document.querySelector(\"#notNow\").classList.remove(\"hide\");\r\n document.querySelector(\"#notNow\").parentElement.classList.add(\"buttons\");\r\n }\r\n else if (data.spaceNavigationList.length == 1) {\r\n document.querySelector(\"#customizecurriculum\").href = `/space-curriculum/${data.spaceNavigationList[0].spaceCurriculumId}/settings`;\r\n //document.querySelector(\"#add-curriculum-to-spaces-form #customizecurriculum\").classList.remove('hide');\r\n if (viewData.availableSpaces.length > 0) {\r\n document.querySelector(\"#notNow\").classList.remove(\"hide\");\r\n document.querySelector(\"#notNow\").parentElement.classList.add(\"buttons\");\r\n } else {\r\n document.querySelector(\"#setup-curriculum-dialog-dismiss\") != null ? document.querySelector(\"#setup-curriculum-dialog-dismiss\").classList.add(\"hide\") : \"\";\r\n }\r\n }\r\n });\r\n }\r\n\r\n _hideToTop() {\r\n document.getElementById(\"return-to-down\").style.display = 'block';\r\n document.getElementById(\"return-to-top\").style.display = 'none';\r\n }\r\n\r\n _hideToDown() {\r\n document.getElementById(\"return-to-down\").style.display = 'none';\r\n document.getElementById(\"return-to-top\").style.display = 'block';\r\n }\r\n\r\n _scrollToTop() {\r\n document.getElementById(\"curriculum-container\").scrollTop = 0;\r\n this._hideToTop();\r\n }\r\n\r\n _scrollToDown() {\r\n document.getElementById(\"curriculum-container\").scrollTop = document.getElementById(\"curriculum-container\").scrollHeight;\r\n document.getElementById(\"return-to-top\").style.zIndex = 10;\r\n this._hideToDown();\r\n }\r\n}\r\n\r\n\r\nexport { Library };\r\n"]}