Skip to content

Commit

Permalink
course search- no courses were returned
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Brown committed Nov 15, 2023
1 parent 094ec0d commit bb1b3e0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions class_registration_app/src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,4 @@ a,
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
overflow-y: auto;
}

23 changes: 22 additions & 1 deletion class_registration_app/src/components/CourseSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ function applySelectedFilters(courses: CourseInfo[]): CourseInfo[] {
}
function handleSearch() {
const elementsToRemove = document.querySelectorAll(`.${"course-list-item"}`);
const elementsToRemove = document.querySelectorAll(`.${"course-list-item"}` );
const test = document.getElementById('noCourses')
elementsToRemove.forEach(element => {
element.remove();
});
if(test!=null){
test.remove()
}
console.log("button clicked");
Expand All @@ -107,6 +111,12 @@ function handleSearch() {
throw "Error"
}
}).then(response => {
let test = document.getElementById("noCourses")
if(test!=null && test.parentNode!=null){
test.parentNode.removeChild(test);
}
console.log(response.Items);
let searchbar = <HTMLInputElement>document.getElementById("search");
Expand All @@ -117,7 +127,18 @@ function handleSearch() {
let newFilteredCourses = applySelectedFilters(filteredCourses);
console.log(filteredCourses);
if(newFilteredCourses.length == 0){
let container = document.getElementById("container");
let div = document.createElement('div');
div.id = ("noCourses");
div.innerHTML = "<h1>No courses were returned</h1>";
if(container!=null){
container.appendChild(div)
}
}
newFilteredCourses.forEach((Course: CourseInfo) => {
let container = document.getElementById("container");
let div = document.createElement("div");
Expand Down

0 comments on commit bb1b3e0

Please sign in to comment.