1- <!-- sherlock-python/inventory/templates/inventory/student_detail.html -->
2-
31{% extends "inventory/base.html" %}
42
53{% block content %}
64 < p > < a href ="{% url 'inventory:student_list' %} "> < See all students </ a > </ p >
75 < h1 > {{ student.name }}</ h1 >
8-
9- < div class ="detail-container ">
10- < table class ="open-table ">
11- < thead >
12- < tr > < th > Parameter</ th > < th > Value</ th > </ tr >
13- </ thead >
14- < tbody >
15- < tr > < td > Name</ td > < td > {{ student.name }}</ td > </ tr >
16- < tr > < td > Admission Number</ td > < td > {{ student.admission_number }}</ td > </ tr >
17- < tr > < td > Class</ td > < td > {{ student.student_class }}</ td > </ tr >
18- < tr > < td > Section</ td > < td > {{ student.section }}</ td > </ tr >
19- </ tbody >
20- </ table >
21-
22- < div class ="action-area ">
23- < a href ="{% url 'inventory:student_update' student.id %} "> Edit Student Record</ a >
24- </ div >
6+ < div class ="item-detail-layout ">
257
26- <!-- === LOAN HISTORY SECTION === -->
27- < h2 > Items Currently on Loan</ h2 >
28- {% if items_on_loan %}
8+ <!-- === LEFT COLUMN: Primary Details & Current Loans === -->
9+ < div class ="item-detail-main-column ">
2910 < table class ="open-table ">
3011 < thead >
31- < tr > < th > Item </ th > < th > Quantity </ th > < th > Checked Out </ th > < th > Due Date </ th > </ tr >
12+ < tr > < th > Parameter </ th > < th > Value </ th > </ tr >
3213 </ thead >
3314 < tbody >
34- {% for log in items_on_loan %}
35- < tr >
36- < td > < a href ="{{ log.item.get_absolute_url }} "> {{ log.item.name }}</ a > </ td >
37- < td > {{ log.quantity }}</ td >
38- < td > {{ log.checkout_date }}</ td >
39- < td > {{ log.due_date }}</ td >
40- </ tr >
41- {% endfor %}
15+ < tr > < td > Name</ td > < td > {{ student.name }}</ td > </ tr >
16+ < tr > < td > Admission Number</ td > < td > {{ student.admission_number }}</ td > </ tr >
17+ < tr > < td > Class</ td > < td > {{ student.student_class }}</ td > </ tr >
18+ < tr > < td > Section</ td > < td > {{ student.section }}</ td > </ tr >
4219 </ tbody >
4320 </ table >
44- {% else %}
45- < p > This student has no items currently on loan.</ p >
46- {% endif %}
4721
48- < h2 style ="margin-top: 2em; "> Return History</ h2 >
49- {% if return_history %}
22+ < div class ="action-area ">
23+ {% if request.user.profile.role == 'ADMIN' %}
24+ < a href ="{% url 'inventory:student_update' student.id %} "> Edit Student Record</ a >
25+ {% endif %}
26+ </ div >
27+
28+ < hr >
29+
30+ < h2 style ="margin-top: 1.5em; "> Items Currently on Loan</ h2 >
31+ {% if items_on_loan %}
5032 < table class ="open-table ">
5133 < thead >
5234 < tr >
5335 < th > Item</ th >
54- < th > Quantity Returned </ th >
55- < th > Return Date </ th >
56- < th > Condition </ th >
36+ < th > Quantity</ th >
37+ < th > Checked Out </ th >
38+ < th > Due Date </ th >
5739 </ tr >
5840 </ thead >
5941 < tbody >
60- {% for log in return_history %}
42+ {% for log in items_on_loan %}
6143 < tr >
62- < td > < a href ="{{ log.checkout_log.item.get_absolute_url }} "> {{ log.checkout_log.item.name }}</ a > </ td >
63- < td > {{ log.quantity_returned }}</ td >
64- < td > {{ log.return_date }}</ td >
65- < td >
66- {% if log.condition == 'OK' %}
67- < span class ="badge bg-success "> {{ log.get_condition_display }}</ span >
68- {% else %}
69- < span class ="badge bg-danger "> {{ log.get_condition_display }}</ span >
70- {% endif %}
71- </ td >
44+ < td > < a href ="{{ log.item.get_absolute_url }} "> {{ log.item.name }}</ a > </ td >
45+ < td > {{ log.quantity_still_on_loan }}</ td >
46+ < td > {{ log.checkout_date|date:"d M Y" }}</ td >
47+ < td > {{ log.due_date|date:"d M Y" }}</ td >
7248 </ tr >
7349 {% endfor %}
7450 </ tbody >
7551 </ table >
7652 {% else %}
77- < p > This student has no return history.</ p >
53+ < p > This student has no items currently on loan.</ p >
54+ {% endif %}
55+
56+ {% if request.user.profile.role == 'ADMIN' %}
57+ < hr style ="margin-top: 2em; ">
58+ < h2 class ="destructive " style ="margin-top: 1.5em; "> Delete this student</ h2 >
59+ < form action ="{% url 'inventory:student_delete' student.id %} " method ="post ">
60+ {% csrf_token %}
61+ < button type ="submit " class ="destructive-background " onclick ="return confirm('Are you sure you want to delete this student record? This action is irreversible.'); ">
62+ I understand, delete this student
63+ </ button >
64+ </ form >
7865 {% endif %}
66+ </ div >
7967
80- {% if request.user.profile.role == 'ADMIN' %}
81- < h2 class ="destructive "> Delete this student</ h2 >
82- < form action ="{% url 'inventory:student_delete' student.id %} " method ="post ">
83- {% csrf_token %}
84- < button type ="submit " class ="destructive-background " onclick ="return confirm('Are you sure you want to delete this student record? This action is irreversible.'); ">
85- I understand, delete this student
86- </ button >
87- </ form >
88- {% endif %}
68+ <!-- === RIGHT COLUMN: Scrollable Return History === -->
69+ < div class ="item-detail-history-column ">
70+ < h2 > Return History</ h2 >
71+
72+ {% if not return_history %}
73+ < p > This student has no return history.</ p >
74+ {% else %}
75+ < div class ="log-container-4-rows ">
76+ < table class ="open-table ">
77+ < thead >
78+ < tr >
79+ < th > Item</ th >
80+ < th > Qty</ th >
81+ < th > Return Date</ th >
82+ < th > Condition</ th >
83+ < th > Reason for Checkout</ th >
84+ </ tr >
85+ </ thead >
86+ < tbody >
87+ {% for log in return_history %}
88+ < tr >
89+ < td > < a href ="{{ log.checkout_log.item.get_absolute_url }} "> {{ log.checkout_log.item.name }}</ a > </ td >
90+ < td > {{ log.quantity_returned }}</ td >
91+ < td > {{ log.return_date|date:"d M Y, g:i a" }}</ td >
92+ < td >
93+ {% if log.condition == 'OK' %}
94+ < span class ="badge bg-success "> {{ log.get_condition_display }}</ span >
95+ {% else %}
96+ < span class ="badge bg-danger "> {{ log.get_condition_display }}</ span >
97+ {% endif %}
98+ </ td >
99+ < td > {{ log.checkout_log.notes|default:"--" }}</ td >
100+ </ tr >
101+ {% endfor %}
102+ </ tbody >
103+ </ table >
104+ </ div >
105+ {% endif %}
106+ </ div >
107+
89108 </ div >
90109{% endblock %}
0 commit comments