-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mergingMerge branch 'main' of github.uconn.edu:zjf19002/Class_Registr…
…ation
- Loading branch information
Showing
8 changed files
with
210 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 100 additions & 31 deletions
131
class_registration_app/src/components/CourseSearch.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,136 @@ | ||
<script setup lang="ts"> | ||
import axios from 'axios'; | ||
//arn:aws:execute-api:us-east-1:671289147354:5prodolbi7/*/GET/courses | ||
const apiUrl = 'https://5prodolbi7.execute-api.us-east-1.amazonaws.com/Beta'; | ||
// Make a GET request | ||
axios.get(`${apiUrl}/courses`, { | ||
params: { | ||
// Query parameters, if any | ||
import { defineAsyncComponent } from 'vue'; | ||
const AsyncComponent = defineAsyncComponent(() => | ||
import('./CourseSearch.vue') | ||
); | ||
function handleSearch() { | ||
const elementsToRemove = document.querySelectorAll(`.${"course-list-item"}`); | ||
elementsToRemove.forEach(element => { | ||
element.remove(); | ||
}); | ||
console.log("button clicked"); | ||
//arn:aws:execute-api:us-east-1:671289147354:5prodolbi7/*/GET/courses | ||
const apiUrl = 'https://5prodolbi7.execute-api.us-east-1.amazonaws.com/Beta'; | ||
let courseJson = fetch(`${apiUrl}/courses`) | ||
.then(response => { | ||
if (response.ok) { | ||
return response.json() | ||
} else{ | ||
throw "Error" | ||
} | ||
}).then(response => { | ||
console.log(response.Items); | ||
let searchbar = document.getElementById("search"); | ||
let filteredCourses = response.Items.filter(function (str: string) { return str.CourseId.includes(searchbar.value.toUpperCase())} ); | ||
filteredCourses.forEach((Course: { CourseId: string; CourseLocation: string;}) => { | ||
let container = document.getElementById("container"); | ||
let div = document.createElement("div"); | ||
let course_name = document.createElement('h2'); | ||
let course_location = document.createElement('h2'); | ||
// Set class or any other attributes for the div | ||
div.className = "course-list-item"; // You can set class name here | ||
// Set content or any other properties for the div | ||
course_name.className = "course-name"; | ||
course_name.textContent = Course.CourseId + " -"; // You can set content here | ||
course_location.className = "course-location"; | ||
course_location.textContent = Course.CourseLocation; | ||
// Append the div to the container | ||
if (container != null){ | ||
container.appendChild(div); | ||
div.appendChild(course_name); | ||
div.appendChild(course_location); | ||
} | ||
return response; | ||
}) | ||
}) | ||
} | ||
document.addEventListener("click", function() { | ||
// Get the button element by its ID | ||
const button = document.getElementById("searchButton"); | ||
// Check if the button element exists | ||
if (button) { | ||
// Assign the handleClick function to the button's onclick property | ||
button.addEventListener("click", handleSearch); | ||
} | ||
}) | ||
.then(response => { | ||
// Handle the response | ||
console.log(response.data); | ||
}) | ||
.catch(error => { | ||
// Handle errors | ||
console.error(error); | ||
}); | ||
</script> | ||
// Your API Gateway endpoint URL | ||
</script> | ||
|
||
|
||
|
||
<template> | ||
<div class="container"> | ||
<h1>UConn Course Search</h1> | ||
<input type="text" class="search-bar" placeholder="Enter course name or code"> | ||
<div class="container" id="container"> | ||
<h1 class="title">UConn Course Search</h1> | ||
<div class="search"> | ||
<input type="text" id="search" class="search-bar" placeholder="Enter course name or code"> | ||
<button id="searchButton" class="btn-97">Search</button> | ||
</div> | ||
<ul class="course-list"> | ||
<li class="course-list-item">CSE 101 - Introduction to Computer Science</li> | ||
<li class="course-list-item">ENG 101 - English Composition</li> | ||
<li class="course-list-item">MAT 115 - Calculus I</li> | ||
<li class="course-list-item">CHEM 111 - General Chemistry</li> | ||
<li class="course-list-item">HIST 200 - U.S. History</li> | ||
|
||
</ul> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.container { | ||
max-width: 600px; | ||
margin: 0 auto; | ||
min-width: 80vw; | ||
left: 50%; | ||
top: 5%; | ||
position: absolute; | ||
transform: translate(-50%); | ||
padding: 20px; | ||
background-color: #ffffff; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
overflow-y: auto; | ||
} | ||
.title { | ||
position:relative; | ||
font-weight: 700; | ||
} | ||
.search { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
.search-bar { | ||
width: 100%; | ||
width: 30%; | ||
padding: 10px; | ||
margin-right: 1vw; | ||
margin-bottom: 20px; | ||
border: none; | ||
border-radius: 5px; | ||
font-size: 16px; | ||
border: solid 1px navy; | ||
} | ||
.course-list { | ||
list-style: none; | ||
padding: 0; | ||
} | ||
.course-list-item { | ||
margin-bottom: 10px; | ||
button { | ||
line-height: 0; | ||
height: 30px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
class_registration_app/src/components/EnrolledCourseList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script setup lang="ts"> | ||
</script> | ||
|
||
<template> | ||
<div class="container"> | ||
<h1>My Classes</h1> | ||
</div> | ||
|
||
</template> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters