Skip to content

Commit

Permalink
fixed search for admin; fixed progression for students
Browse files Browse the repository at this point in the history
  • Loading branch information
nati-m-afw committed Mar 10, 2021
1 parent 9383d8e commit 7fe3f28
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
15 changes: 5 additions & 10 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,10 @@ if(currentDept == 'adm'){
let cursor = e.target.result;

if(cursor){
// studentToRequestMap[cursor.value.studentId].push()
studentToRequestMap[cursor.value.studentId][cursor.value.deptId] = cursor.value.status
// studentToRequestMap[cursor.value.studentId][studentToRequestMap[cursor.value.studentId].length - 1].push(cursor.value.status)
cursor.continue()
}
}
console.log(studentToRequestMap);
printStudentClearanceStatus(studentToRequestMap)

}
Expand All @@ -51,16 +48,14 @@ if(currentDept == 'adm'){
function searchAdmin(e){
let searchItem = search.value
let collection = document.querySelectorAll(".collection-item");

collection.forEach((item) =>{
if(item.textContent.indexOf(searchItem.toUpperCase())){
item.style.display = "none";


if(item.children[0].textContent.includes(searchItem.toUpperCase())){
console.log(item);
item.hidden = false
}
else{
item.style.display = "flex-inline"

item.hidden = true
}
});

Expand Down
9 changes: 5 additions & 4 deletions assets/js/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ switch (currentDept) {
}
if(confirm("Are you sure about the deletion?")){
let noteId = e.target.parentNode.parentNode.getAttribute('data-note-id');
console.log(e.target.parentNode.parentNode)
// console.log(e.target.parentNode.parentNode)
console.log(noteId);
objectStore.delete(noteId);
objectStore.delete(noteId);

// report deletion
transaction.oncomplete = function(){
Expand Down Expand Up @@ -422,7 +422,7 @@ function addClearanceRequest(e){
status : "",
description : ""
}

console.log(newRecord);
let transaction = db.transaction(['clearanceOS'], 'readwrite');
let objectStore = transaction.objectStore('clearanceOS');

Expand All @@ -445,6 +445,7 @@ function addClearanceRequest(e){

}

// ADD CLEARANCE REQUEST TO CLEARANCE DEPARTMENT
function addClearanceRequestCleareanceDept(e){
let newRecord = {
studentId : urlSearchParams.get('id'),
Expand All @@ -466,7 +467,7 @@ function addClearanceRequestCleareanceDept(e){
}
cursor.continue()
}
else if(allCleared.length != 4 || allCleared.includes('rejected')){
else if(allCleared.length != 4 || allCleared.includes('rejected') || allCleared.includes('')){
alert('You will have to get a successful clearance notice from all the other departments first!')
}
else{
Expand Down
2 changes: 1 addition & 1 deletion loan.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h5 class="modal-title" id="exampleModalLabel">Record a Loan</h5>
<input type="text" class="form-control" id="lastName" placeholder="Last Name" required>
</div>
<div class="form-group">
<input type="text" class="form-control" id="studentId" placeholder="ID" required>
<input type="text" class="form-control" id="studentId" placeholder="ID" pattern="[A-Z]{2}\/\d{2}\/\d{2}" required>
</div>
<div class="form-group">
<input type="text" class="form-control" id="phone" placeholder="Phone No." required>
Expand Down
30 changes: 15 additions & 15 deletions students.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,6 @@ <h3 class="heading my-5">AAIT Clearance System</h3>

<!-- for sidebar responsiveness -->
<script src="./assets/js/sidebar.js"></script>

<!-- DB -->
<script src="./assets/js/db.js"></script>

<!-- Add and display -->
<script src="./assets/js/transactions.js"></script>

<!-- <script src="./assets/js/personalize.js"></script> -->
<!-- personalize for each department -->


<!-- ApexCharts js -->
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script src="./assets/js/apexscript.js"></script>

<script>
var progress = document.querySelector('.progress-bar');

Expand All @@ -251,6 +236,21 @@ <h3 class="heading my-5">AAIT Clearance System</h3>
}
</script>

<!-- DB -->
<script src="./assets/js/db.js"></script>

<!-- Add and display -->
<script src="./assets/js/transactions.js"></script>

<!-- <script src="./assets/js/personalize.js"></script> -->
<!-- personalize for each department -->


<!-- ApexCharts js -->
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script src="./assets/js/apexscript.js"></script>


</body>

</html>

0 comments on commit 7fe3f28

Please sign in to comment.