Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/latest_staging' into ac-7-exam…
Browse files Browse the repository at this point in the history
…ination
  • Loading branch information
Lone24wolf committed Jan 20, 2025
2 parents e309dc8 + 16fd1a3 commit 677752a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 24 deletions.
2 changes: 1 addition & 1 deletion FusionIIIT/applications/academic_procedures/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ def get_currently_registered_course(id, sem_id, courseregobj=False):
if (type(sem_id) == int):
obj = course_registration.objects.all().filter(student_id = id, semester_id__semester_no=sem_id)
else:
obj = course_registration.objects.all().filter(student_id = id)
obj = course_registration.objects.all().filter(student_id = id).order_by('-semester_id_id')
courses = []
for i in obj:
if (courseregobj):
Expand Down
73 changes: 50 additions & 23 deletions FusionIIIT/templates/academic_procedures/studentCourses.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,42 @@
.modal('show')
;
});
});
function courseDropCalled(event) {
// Prevent the default action of the link
event.preventDefault();

// Get the URL from the link's href attribute
let url = event.target.href;

// Perform AJAX request
$.ajax({
url: url,
type: 'GET',
success: function(data) {
// Reload the page after successful deletion
location.reload();
},
error: function(xhr, status, error) {
// Handle errors if needed
console.error(error);
}
let url = "";
let rowToDelete;
$('.trigger-link-acad').on('click', function (event) {
event.preventDefault(); // Prevent the default behavior of the link
url = event.target.href
rowToDelete = $(this).closest('tr');
course_name = $(this).attr('course_name_stu')
course_code = $(this).attr('course_code_stu')
$('.course_details_stu').html('Are you sure you want to drop '+course_code+'-'+course_name +'?');
$('#confirmation-modal-acad').modal('show'); // Show the modal
});
}

// Handle Cancel button
$('#cancel-button-acad-course').on('click', function () {
$('#confirmation-modal-acad').modal('hide'); // Hide the modal
});

// Handle OK button
$('#confirm-button-acad').on('click', function () {
$('#confirmation-modal-acad').modal('hide'); // Hide the modal

// Perform AJAX API call
$.ajax({
url: url,
type: 'GET',
success: function(data) {
rowToDelete.remove();
alert('course dropped successfully')
},
error: function(xhr, status, error) {
// Handle errors if needed
console.error(error);
}
});
});
});
</script>


Expand Down Expand Up @@ -110,8 +124,8 @@
{{ items.registration_type }}
</td>
<td>
<A class="ui blue label"
href="/academic-procedures/acad_person/verifyCourse/drop/?id={{ items.reg_id|urlencode }}" onclick="courseDropCalled(event)" >
<A class="trigger-link-acad ui blue label"
href="/academic-procedures/acad_person/verifyCourse/drop/?id={{ items.reg_id|urlencode }}" course_code_stu="{{items.course_id}}" course_name_stu = "{{items.course_name}}" >
DROP </A>
</td>

Expand Down Expand Up @@ -190,5 +204,18 @@
</div>


</div>
</div>

<div class="ui warning modal" id="confirmation-modal-acad">
<div class="header">Confirmation Required</div>
<div class="ui warning content">
<ul>
<li class="course_details_stu"></li>
</ul>
</div>
<div class="actions">
<button class="ui red button" id="cancel-button-acad-course">Cancel</button>
<button class="ui green button" id="confirm-button-acad">OK</button>
</div>
</div>

0 comments on commit 677752a

Please sign in to comment.