-
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.
* successfully created student object via html * added create button * successfully create instructors via html * successfully created parent object via html * prepping pull request
- Loading branch information
1 parent
1cf632b
commit 5306896
Showing
8 changed files
with
400 additions
and
0 deletions.
There are no files selected for viewing
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
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,97 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>EduSync</title> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" type="text/css" href="/assets/css/owl.carousel.css"> | ||
<link rel="stylesheet" type="text/css" href="/assets/css/inner-page-style.css"> | ||
<link rel="stylesheet" type="text/css" href="/assets/css/style.css"> | ||
<link href="https://fonts.googleapis.com/css?family=Raleway:400,500,600,700" rel="stylesheet"> | ||
<script> | ||
async function createInstructor() { | ||
const basePay = document.getElementById('basePay').value; | ||
|
||
if (basePay < 0) { | ||
alert('Base pay must be a positive number.'); | ||
return; | ||
} | ||
|
||
const newInstructor = { | ||
name: document.getElementById('name').value, | ||
email: document.getElementById('email').value, | ||
contact_number: document.getElementById('contactNumber').value, | ||
role: "Instructor", | ||
base_pay: parseFloat(basePay), | ||
number_of_students: parseInt(document.getElementById('numberOfStudents').value, 10) | ||
}; | ||
|
||
await fetch(`/admin/instructor/`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(newInstructor) | ||
}); | ||
|
||
alert('Instructor created successfully'); | ||
window.location.href = '/admin/search_instructor'; | ||
} | ||
|
||
function goBack() { | ||
window.history.back(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="page" class="site"> | ||
<header class="site-header"> | ||
<div class="main-header"> | ||
<div class="container"> | ||
<div class="logo-wrap"> | ||
<img src="/assets/images/site-logo.jpg" alt="Logo Image" style="width: 120px; height: auto;"> | ||
</div> | ||
<div class="nav-wrap"> | ||
<nav class="nav-desktop"> | ||
<ul class="menu-list"> | ||
<li><a href="/admin">Home</a></li> | ||
<li><a href="/admin/search_instructor">Instructors</a></li> | ||
<li><a href="/admin/search_student">Students</a></li> | ||
<li><a href="/admin/search_parent">Parents</a></li> | ||
<li><a href="/admin/search_announcement">Announcements</a></li> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
<div class="container content"> | ||
<h1>Create New Instructor</h1> | ||
<form onsubmit="event.preventDefault(); createInstructor();"> | ||
<div><label>Name: </label><input type="text" id="name" required></div> | ||
<br> | ||
<div><label>Email: </label><input type="email" id="email" required></div> | ||
<br> | ||
<div><label>Contact Number: </label><input type="text" id="contactNumber" required></div> | ||
<br> | ||
<div><label>Base Pay: </label><input type="number" id="basePay" step="0.01" required></div> | ||
<br> | ||
<div><label>Number of Students: </label><input type="number" id="numberOfStudents" min="0" required></div> | ||
<br> | ||
<div class="button-container"> | ||
<button type="submit">Create Instructor</button> | ||
<button type="button" onclick="goBack()">Back</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<script type="text/javascript" src="/assets/js/jquery-3.3.1.min.js"></script> | ||
<script type="text/javascript" src="/assets/js/all.js"></script> | ||
<script type="text/javascript" src="/assets/js/isotope.pkgd.min.js"></script> | ||
<script type="text/javascript" src="/assets/js/owl.carousel.js"></script> | ||
<script type="text/javascript" src="/assets/js/jquery.flexslider.js"></script> | ||
<script type="text/javascript" src="/assets/js/jquery.rateyo.js"></script> | ||
<script type="text/javascript" src="/assets/js/custom.js"></script> | ||
</body> | ||
</html> |
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,84 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>EduSync</title> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" type="text/css" href="/assets/css/owl.carousel.css"> | ||
<link rel="stylesheet" type="text/css" href="/assets/css/inner-page-style.css"> | ||
<link rel="stylesheet" type="text/css" href="/assets/css/style.css"> | ||
<link href="https://fonts.googleapis.com/css?family=Raleway:400,500,600,700" rel="stylesheet"> | ||
<script> | ||
async function createParent() { | ||
const newParent = { | ||
name: document.getElementById('name').value, | ||
email: document.getElementById('email').value, | ||
contact_number: document.getElementById('contactNumber').value, | ||
role: "Parent" | ||
}; | ||
|
||
await fetch(`/admin/parent/`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(newParent) | ||
}); | ||
|
||
alert('Parent created successfully'); | ||
window.location.href = '/admin/search_parent'; | ||
} | ||
|
||
function goBack() { | ||
window.history.back(); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<div id="page" class="site"> | ||
<header class="site-header"> | ||
<div class="main-header"> | ||
<div class="container"> | ||
<div class="logo-wrap"> | ||
<img src="/assets/images/site-logo.jpg" alt="Logo Image" style="width: 120px; height: auto;"> | ||
</div> | ||
<div class="nav-wrap"> | ||
<nav class="nav-desktop"> | ||
<ul class="menu-list"> | ||
<li><a href="/admin">Home</a></li> | ||
<li><a href="/admin/search_instructor">Instructors</a></li> | ||
<li><a href="/admin/search_student">Students</a></li> | ||
<li><a href="/admin/search_parent">Parents</a></li> | ||
<li><a href="/admin/search_announcement">Announcements</a></li> | ||
</ul> | ||
</nav> | ||
</div> | ||
</div> | ||
</div> | ||
</header> | ||
|
||
<div class="container content"> | ||
<h1>Create New Parent</h1> | ||
<form onsubmit="event.preventDefault(); createParent();"> | ||
<div><label>Name: </label><input type="text" id="name" required></div> | ||
<br> | ||
<div><label>Email: </label><input type="email" id="email" required></div> | ||
<br> | ||
<div><label>Contact Number: </label><input type="text" id="contactNumber" required></div> | ||
<br> | ||
<div class="button-container"> | ||
<button type="submit">Create Parent</button> | ||
<button type="button" onclick="goBack()">Back</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
<script type="text/javascript" src="/assets/js/jquery-3.3.1.min.js"></script> | ||
<script type="text/javascript" src="/assets/js/all.js"></script> | ||
<script type="text/javascript" src="/assets/js/isotope.pkgd.min.js"></script> | ||
<script type="text/javascript" src="/assets/js/owl.carousel.js"></script> | ||
<script type="text/javascript" src="/assets/js/jquery.flexslider.js"></script> | ||
<script type="text/javascript" src="/assets/js/jquery.rateyo.js"></script> | ||
<script type="text/javascript" src="/assets/js/custom.js"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.