Skip to content

Commit 580cbe8

Browse files
Whaooo!!! all code are refactor now.
1 parent 9146773 commit 580cbe8

File tree

6 files changed

+134
-146
lines changed

6 files changed

+134
-146
lines changed

html/dashboard.html

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ <h2>Dashboard</h2>
3030
<hr class="rgba-white-light" style="margin: 0 15%;">
3131
<br>
3232
<div class="heading-2">
33-
<h3>Overview</h3>
34-
<p>As of <span id="date"></span></p>
35-
</div>
33+
<h3>Overview</h3>
34+
<p>As of <span id="date"></span></p>
35+
</div>
3636
<!-- Nav tabs -->
3737
<div id="nav-style">
3838
<ul class="nav nav-tabs" role="tablist">
@@ -58,7 +58,7 @@ <h4>Records of All animals in the Database</h4><br>
5858
<main role="main">
5959
<div class="album py-5 bg-light">
6060
<div class="container">
61-
61+
6262
<div class="row" id="divAppendAdmin">
6363

6464
</div>
@@ -165,55 +165,55 @@ <h5 class="modal-title" id="exampleModalLabel">Product details</h5>
165165
</button>
166166
</div>
167167
<div class="modal-body">
168-
<h4 class="containerHeading">Input animal detail below</h4>
169-
<form id="postForm">
170-
<div class="col-sm-8">
171-
<label for="name">Animal Name
172-
</label> <input type="text" class="form-control" id="putName" placeholder="i.e Tiger">
173-
<br>
174-
</div>
175-
176-
<div class="col-sm-8">
177-
<label for="species">Species
178-
</label> <input type="text" class="form-control" id="putSpecies">
179-
<br>
180-
</div>
181-
<div class="col-sm-8">
182-
<label for="family">Family
183-
</label> <input type="text" class="form-control" id="putFamily">
184-
<br>
185-
</div>
186-
<div class="col-sm-8">
187-
<label for="class">Class
188-
</label> <input type="text" class="form-control" id="putClass">
189-
<br>
190-
</div>
191-
<div class="col-sm-8">
192-
<label for="external">External Link
193-
</label> <input type="text" class="form-control" id="putExternal">
194-
<br>
195-
</div>
196-
<div class="col-sm-8">
197-
<label for="image">Image Link
198-
</label> <input type="text" class="form-control" id="putImage">
199-
<br>
200-
</div>
201-
<div class="col-sm-8">
202-
<label for="category">Does the animals lives in the sea?</label>
203-
<select class="form-control" id="putCategory">
204-
<option>sea</option>
205-
<option>land</option>
206-
</select>
207-
<br>
208-
</div>
209-
210-
<div class="col-sm-8">
211-
<label for="info">Animal description and Info</label>
212-
<textarea class="form-control" id="putInfo" rows="3"></textarea>
213-
<br>
214-
</div>
215-
</form>
216-
</div>
168+
<h4 class="containerHeading">Input animal detail below</h4>
169+
<form id="postForm">
170+
<div class="col-sm-8">
171+
<label for="name">Animal Name
172+
</label> <input type="text" class="form-control" id="putName" placeholder="i.e Tiger">
173+
<br>
174+
</div>
175+
176+
<div class="col-sm-8">
177+
<label for="species">Species
178+
</label> <input type="text" class="form-control" id="putSpecies">
179+
<br>
180+
</div>
181+
<div class="col-sm-8">
182+
<label for="family">Family
183+
</label> <input type="text" class="form-control" id="putFamily">
184+
<br>
185+
</div>
186+
<div class="col-sm-8">
187+
<label for="class">Class
188+
</label> <input type="text" class="form-control" id="putClass">
189+
<br>
190+
</div>
191+
<div class="col-sm-8">
192+
<label for="external">External Link
193+
</label> <input type="text" class="form-control" id="putExternal">
194+
<br>
195+
</div>
196+
<div class="col-sm-8">
197+
<label for="image">Image Link
198+
</label> <input type="text" class="form-control" id="putImage">
199+
<br>
200+
</div>
201+
<div class="col-sm-8">
202+
<label for="category">Does the animals lives in the sea?</label>
203+
<select class="form-control" id="putCategory">
204+
<option>sea</option>
205+
<option>land</option>
206+
</select>
207+
<br>
208+
</div>
209+
210+
<div class="col-sm-8">
211+
<label for="info">Animal description and Info</label>
212+
<textarea class="form-control" id="putInfo" rows="3"></textarea>
213+
<br>
214+
</div>
215+
</form>
216+
</div>
217217
<div class="modal-footer">
218218
<button type="button" class="btn btn-secondary" data-dismiss="modal">
219219
Close

html/log-in.html

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,57 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
34
<head>
4-
<meta charset="UTF-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7-
<link rel="stylesheet" href="../css/bootstrap.css">
8-
<link rel="stylesheet" href="../css/log-in.css">
9-
<title>Admin Sign in Page</title>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
8+
<link rel="stylesheet" href="../css/bootstrap.css">
9+
<link rel="stylesheet" href="../css/log-in.css">
10+
<title>Admin Sign in Page</title>
1011
</head>
12+
1113
<body>
12-
<div class="container-fluid">
13-
<div class="row no-gutter">
14-
<div class="d-none d-md-flex col-md-4 col-lg-6 bg-image"></div>
15-
<div class="col-md-8 col-lg-6">
16-
<div class="login d-flex align-items-center py-5">
17-
<div class="container">
18-
<div class="row">
19-
<div class="col-md-9 col-lg-8 mx-auto">
20-
<h3 class="login-heading mb-4">WELCOME TO <span>ZOOTOPIA!</span></h3>
21-
<form>
22-
<div class="form-label-group">
23-
<input type="text" id="inputEmail" class="form-control" placeholder="username" required autofocus>
24-
<label for="inputEmail">Username</label>
25-
</div>
26-
27-
<div class="form-label-group">
28-
<input type="password" id="inputPassword" class="form-control" placeholder="password" required>
29-
<label for="inputPassword">Password</label>
30-
</div>
31-
32-
33-
<button class="btn btn-lg btn-primary btn-block btn-login text-uppercase font-weight-bold mb-2" id="submit" type="submit">Sign in</button>
34-
<div class="text-center">
35-
<a class="small" href="http://127.0.0.1:5500/index.html">Not an Admin? Then Sign In an Guest</a></div>
36-
37-
</form>
14+
<div class="container-fluid">
15+
<div class="row no-gutter">
16+
<div class="d-none d-md-flex col-md-4 col-lg-6 bg-image"></div>
17+
<div class="col-md-8 col-lg-6">
18+
<div class="login d-flex align-items-center py-5">
19+
<div class="container">
20+
<div class="row">
21+
<div class="col-md-9 col-lg-8 mx-auto">
22+
<h3 class="login-heading mb-4">WELCOME TO <span>ZOOTOPIA!</span></h3>
23+
<form>
24+
<div class="form-label-group">
25+
<input type="text" id="inputEmail" class="form-control" placeholder="username" required autofocus>
26+
<label for="inputEmail">Username</label>
27+
</div>
28+
29+
<div class="form-label-group">
30+
<input type="password" id="inputPassword" class="form-control" placeholder="password" required>
31+
<label for="inputPassword">Password</label>
32+
</div>
33+
34+
35+
<button class="btn btn-lg btn-primary btn-block btn-login text-uppercase font-weight-bold mb-2"
36+
id="submit" type="submit">Sign in</button>
37+
<div class="text-center">
38+
<a class="small" href="http://127.0.0.1:5500/index.html">Not an Admin? Then Sign In an Guest</a>
3839
</div>
39-
</div>
40+
41+
</form>
4042
</div>
4143
</div>
4244
</div>
4345
</div>
4446
</div>
45-
47+
</div>
48+
</div>
49+
4650

4751

4852
<script src="../javascript/jquery.js"></script>
4953
<script src="../javascript/log-in.js"></script>
5054
<script src=".../main.js"></script>
5155
</body>
56+
5257
</html>

index.html

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,7 @@ <h3>What Would You Like to Learn About?</h3>
5555
<div class="container">
5656

5757
<div class="row" id="divAppend">
58-
<!--
59-
<div class="col-md-4">
60-
<div class="card mb-4 box-shadow">
61-
62-
63-
<img class="card-img-top" src="./img/01.jpg" alt="Card image cap">
64-
<div class="card-body">
65-
<p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
66-
<div class="d-flex justify-content-between align-items-center">
67-
<div class="btn-group">
68-
<button type="button" class="btn btn-sm btn-outline-secondary">View</button>
69-
//<button type="button" class="btn btn-sm btn-outline-secondary">Edit</button>
70-
</div>
71-
//<small class="text-muted">9 mins</small>
72-
</div>
73-
</div>
74-
75-
76-
</div>
77-
</div> -->
58+
<!-- Element from js are appended here -->
7859

7960
</div>
8061
</div>
@@ -84,7 +65,9 @@ <h3>What Would You Like to Learn About?</h3>
8465
<div class="new-collection">
8566
<h3 class="text">Explore hundreds of more popular Spices</h3>
8667
<h3 class="text">or</h3>
87-
<a href="./html/log-in.html"><p class="text-overlay new-col">Add New Collection</p></a>
68+
<a href="./html/log-in.html">
69+
<p class="text-overlay new-col">Add New Collection</p>
70+
</a>
8871
</div>
8972

9073

javascript/dashboard.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ $(document).ready(function () {
4646
</div>
4747
</div>
4848
</div>
49-
`);
49+
`);
5050
}
5151

5252
//To search for a specific animal with name
@@ -60,7 +60,7 @@ $(document).ready(function () {
6060
$.ajax({
6161
type: 'GET',
6262
url: 'http://localhost:3000/animals?q=' + $editSearch,
63-
success: function (animals) {
63+
success: function (animals) {
6464
$.each(animals, (i, animal) => {
6565
addAnimalAdmin(animal);
6666
})
@@ -88,7 +88,7 @@ $(document).ready(function () {
8888
})
8989

9090
//Edit animal detail
91-
$('#saveEdit').on("click",function (e) {
91+
$('#saveEdit').on("click", function (e) {
9292
e.preventDefault();
9393

9494
const animal = {
@@ -101,7 +101,7 @@ $(document).ready(function () {
101101
image: $image.val(),
102102
info: $info.val()
103103
};
104-
104+
105105
//$('#saveEdit').trigger("reset");
106106
$.ajax({
107107
type: 'PUT',

javascript/log-in.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
$(document).ready(() => {
22

3-
$('#submit').click(function (e) {
4-
e.preventDefault();
5-
let $inputPassword = $('#inputPassword');
6-
let $inputEmail = $('#inputEmail');
3+
$('#submit').click(function (e) {
4+
e.preventDefault();
5+
let $inputPassword = $('#inputPassword');
6+
let $inputEmail = $('#inputEmail');
77

8-
$inputPassword = $inputPassword.val();
9-
$inputEmail = $inputEmail.val();
8+
$inputPassword = $inputPassword.val();
9+
$inputEmail = $inputEmail.val();
1010

11-
localStorage.setItem('username', $inputEmail);
12-
localStorage.setItem('password', $inputPassword);
11+
localStorage.setItem('username', $inputEmail);
12+
localStorage.setItem('password', $inputPassword);
1313

14-
let password = localStorage.getItem('password');
15-
let username = localStorage.getItem('username')
14+
let password = localStorage.getItem('password');
15+
let username = localStorage.getItem('username')
1616

1717

18-
$.ajax({
19-
type: 'GET',
20-
url: 'http://localhost:3000/admin',
21-
success: function (admin) { //animals == booklists && book == animal
22-
if(admin.password == password && admin.username == username) {
23-
console.log('Good to go')
24-
window.location.replace('http://127.0.0.1:5500/html/dashboard.html#addNewAnimals')
25-
}else{
26-
console.log('check matching')
27-
}
28-
},
29-
error: function () {
30-
alert('error loading orders');
31-
}
32-
});
33-
});
34-
18+
$.ajax({
19+
type: 'GET',
20+
url: 'http://localhost:3000/admin',
21+
success: function (admin) { //animals == booklists && book == animal
22+
if (admin.password == password && admin.username == username) {
23+
console.log('Good to go')
24+
window.location.replace('http://127.0.0.1:5500/html/dashboard.html#addNewAnimals')
25+
} else {
26+
console.log('check matching')
27+
}
28+
},
29+
error: function () {
30+
alert('error loading orders');
31+
}
32+
});
33+
});
34+
3535
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy