diff --git a/Searchsk1.html b/Searchsk1.html index bc5dce1..c35afde 100644 --- a/Searchsk1.html +++ b/Searchsk1.html @@ -10,6 +10,8 @@ Search skeleton + + @@ -82,4 +84,6 @@

Skill level


+ + \ No newline at end of file diff --git a/coursedisp.js b/coursedisp.js new file mode 100644 index 0000000..4bc6e94 --- /dev/null +++ b/coursedisp.js @@ -0,0 +1,260 @@ + +const filterapiSource = "http://localhost:3000/Coursefeed1"; // replace with actual remote json source +const label=document.querySelector('label[for="apt"]') +const display =document.querySelector("#display-data"); +const qry= localStorage.getItem('query');//'advanced machine learning models using ibm spss modeler (v18.2)'//localStorage.getItem('query');//require('qr'); +const cIn=document.getElementById('cIn'); + +//get coursecode from click event + +const getrawData = async () => { + const res = await fetch(filterapiSource); //works on server but not on local file + const data = await res.json(); + return data +} +console.log(qry); +const Jsrc=getrawData(); +const tEl=Jsrc; +console.log(tEl) + +document.onclick = function(event) { + var target = event.target || event.srcElement; + + alert ( target.innerHTML ); +}; + + +var bindEvent = function(elem ,evt,cb) { + //see if the addEventListener function exists on the element + if ( elem.addEventListener ) { + elem.addEventListener(evt,cb,false); + //if addEventListener is not present, see if this is an IE browser + } else if ( elem.attachEvent ) { + //prefix the event type with "on" + elem.attachEvent('on' + evt, function(){ + /* use call to simulate addEventListener + * This will make sure the callback gets the element for "this" + * and will ensure the function's first argument is the event object + */ + cb.call(event.srcElement,event); + }); + } +} + +bindEvent(document,'click', function(event) { + var target = event.target || event.srcElement; + console.log(target) +}); + + + + + + + + + +const tS= async()=>{ + const h=qry; + const query = h;//input var + console.log("Query::",query); + //filter added between payload and etc because payload holds users list +const payload = await getrawData(); +//seperates arrays in json into seperate objects +let nuArr = payload.filter((eventData)=>{ + if (query==="") {return eventData} + else if (eventData.TITLE.toLowerCase().includes(query.toLowerCase())){return eventData} +}) +return nuArr +} + + +const tDisplay =async () => { + + //var temp=''; +const payload = await tS(); + if (payload.BADGE_ID="NONE"){ + temp=payload.map((object) => { + + const {TITLE, OVERVIEW,JOB_ROLE,COURSECODE,SKILLLEVEL,OBJECTIVES,DURATION,DURATION_UNIT} = object; + + return ` + + +
+ +
${TITLE}
+
+
+
Maximo Administators
+
Maximo Administators
+ + +
+
+
+
+
+
Request Quote
+
+ +
+
+
+
+
+
14-17
+
Select a date to enroll
+
+
Choose a session:
+
Objectives
+
+ ${OBJECTIVES} +
+
Course details
+
+ ${JOB_ROLE} +
+
Audience
+
+ ${OVERVIEW} +
+
Course Overview
+
+
Course Details
+
Overview
+
+
+
+
+
+
+
Request Quote
+
${SKILLLEVEL}
+
${DURATION} ${DURATION_UNIT}
+ +
Course Code:${COURSECODE}
+
+ + +
ILO
+
+ ${TITLE} +
+ +
+
+ + ` + +}).join(""); + + +}else{ + console.log(payload) + temp=payload.map((object) => { + + const {TITLE, OVERVIEW} = object; + + return ` + + +
+
+ + +
/
+
${TITLE}
+ +
/
+
+
+
View additional information
+ +
${TITLE}
+ +
Badge
+
+
+ + + +
+
+
+
Badge Overview
+
+ ${OVERVIEW} +
+
+
+
Application Development
+
+
+
Asset Management
+
+
+
Implementer
+
+
+
Internet Of Things
+
+
+
${TITLE}
+
+
+
PWID-B0147000
+
+
Skills
+
+
+
+ What it takes to earn this badge +
+ +
+ +
+ +
+
+ ` + + }).join(""); + + +} + + + + +cIn.innerHTML = temp; +} +tDisplay(); + + + + + + + + diff --git a/coursedisp2.html b/coursedisp2.html new file mode 100644 index 0000000..3e9f146 --- /dev/null +++ b/coursedisp2.html @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + Coursedisp + + + +
+ +
+ + +
+ +afdf + +
+ + + + + + + \ No newline at end of file diff --git a/searchsk1.js b/searchsk1.js index 8d3ebcc..9182b3e 100644 --- a/searchsk1.js +++ b/searchsk1.js @@ -79,13 +79,13 @@ function cbclick(e){ -m(au,"Automation",getrawData()); +/*m(au,"Automation",getrawData()); m(cl,"Cloud",getrawData()); m(dna,"Data and AI",getrawData()); m(fin,"Finance",getrawData()); m(sec,"Security",getrawData()); m(sus,"Sustainability",getrawData()); -m(sys,"Systems",getrawData()); +m(sys,"Systems",getrawData());*/ async function filter1(){ @@ -270,7 +270,7 @@ const displayUsers =async () => {
- Course -${TITLE} + Course -${TITLE}
(Code:ITS-${COURSECODE})${SHORT_SUMMARY}. @@ -306,7 +306,7 @@ input.addEventListener('keypress', function (e) { displayUsers(); } }); -//au.addEventListener("click",displayUsers); +/*au.addEventListener("click",displayUsers); //cl.addEventListener("click",displayUsers); //dna.addEventListener("click",displayUsers); //fin.addEventListener("click",displayUsers); @@ -316,14 +316,14 @@ input.addEventListener('keypress', function (e) { //adv.addEventListener("click",displayUsers); //int.addEventListener("click",displayUsers); -//bas.addEventListener("click",displayUsers); +//bas.addEventListener("click",displayUsers);*/ cBx.forEach(el => el.addEventListener('click', displayUsers)) -const fD=async ()=>{ +/*const fD=async ()=>{ async function mD(Key) { @@ -343,21 +343,14 @@ const fD=async ()=>{ sList=mD("Sustainability"); sList= mD("Systems"); - const fNum1=sList.length() - aul.innerHTML=`${Key}_${fNum1}` - const fNum2=sList.length() - cll.innerHTML=`${Key}_${fNum2}` - const fNum3=sList.length() - dnal.innerHTML=`${Key}_${fNum3}` - const fNum4=sList.length() - finl.innerHTML=`${Key}_${fNum4}` - const fNum5=sList.length() - secl.innerHTML=`${Key}_${fNum5}` - const fNum6=sList.length() - susl.innerHTML=`${Key}_${fNum6}` - const fNum7=sList.length() - sysl.innerHTML=`${Key}_${fNum7}` + const fNum1=sList.length(), fNum2=sList.length(), fNum3=sList.length(), fNum4=sList.length() + const fNum5=sList.length(), fNum6=sList.length(), fNum7=sList.length() + aul.innerHTML=`${Key}_${fNum1}`, cll.innerHTML=`${Key}_${fNum2}`,dnal.innerHTML=`${Key}_${fNum3}` + finl.innerHTML=`${Key}_${fNum4}`, secl.innerHTML=`${Key}_${fNum5}`, susl.innerHTML=`${Key}_${fNum6}` + sysl.innerHTML=`${Key}_${fNum7}` + + async function sD(Key) { let filterlist = await sUsers(); @@ -381,7 +374,24 @@ input.addEventListener('keypress', function (e) { if (e.key === 'Enter') { fD(); } -}); +});*/ + + + + + + + + + + + + + + + + + const Jsrc=getrawData(); const cIn=document.getElementById("cIn") @@ -432,3 +442,14 @@ const v=nuQ(); const qr=JSON.stringify(v) localStorage.setItem("query",JSON.stringify(nuQ)); console.log(localStorage) + + + + + + + + + + +