Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
library-app-django
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ilham Maulana
library-app-django
Commits
528b8c64
Commit
528b8c64
authored
Jul 03, 2024
by
impfundev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: upcoming loans
parent
423b416f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
near_overdue_loan.html
dashboards/templates/dashboard/near_overdue_loan.html
+1
-1
overdue_loan.html
dashboards/templates/dashboard/overdue_loan.html
+3
-0
views.py
dashboards/views.py
+8
-7
No files found.
dashboards/templates/dashboard/near_overdue_loan.html
View file @
528b8c64
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
{% if
near_overdue_loans %} {% for loan in near_overdue
_loans %}
{% if
upcoming_loans %} {% for loan in upcoming
_loans %}
<tr>
<tr>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.due_date }}
</td>
<td>
{{ loan.due_date }}
</td>
...
...
dashboards/templates/dashboard/overdue_loan.html
View file @
528b8c64
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
<tr
class=
"table-primary"
>
<tr
class=
"table-primary"
>
<th
scope=
"col"
>
Book Title
</th>
<th
scope=
"col"
>
Book Title
</th>
<th
scope=
"col"
>
Due Date
</th>
<th
scope=
"col"
>
Due Date
</th>
<th
scope=
"col"
>
Loan Date
</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
<tbody>
...
@@ -14,9 +15,11 @@
...
@@ -14,9 +15,11 @@
<tr>
<tr>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.book.title }}
</td>
<td>
{{ loan.due_date }}
</td>
<td>
{{ loan.due_date }}
</td>
<td>
{{ loan.loan_date }}
</td>
</tr>
</tr>
{% endfor %} {% else %}
{% endfor %} {% else %}
<tr>
<tr>
<td></td>
<td>
No Data
</td>
<td>
No Data
</td>
<td></td>
<td></td>
</tr>
</tr>
...
...
dashboards/views.py
View file @
528b8c64
...
@@ -20,22 +20,23 @@ def index(request):
...
@@ -20,22 +20,23 @@ def index(request):
due_date__lte
=
now
,
return_date
=
None
due_date__lte
=
now
,
return_date
=
None
)
.
order_by
(
"created_at"
)
)
.
order_by
(
"created_at"
)
due_date_treshold
=
now
.
today
()
+
timedelta
(
days
=
3
)
upcoming_loans
=
BookLoans
.
objects
.
filter
(
due_date__lte
=
due_date_treshold
)
.
filter
(
due_date__gte
=
now
.
today
()
)
context
=
{
context
=
{
"login_histories"
:
latest_login_history
,
"login_histories"
:
latest_login_history
,
"total_book"
:
total_book
,
"total_book"
:
total_book
,
"total_member"
:
total_member
,
"total_member"
:
total_member
,
"total_book_loans"
:
total_book_loans
,
"total_book_loans"
:
total_book_loans
,
"total_overdue"
:
overdue_loans
.
count
(),
"total_overdue"
:
overdue_loans
.
count
(),
"overdue_loans"
:
overdue_loans
,
"upcoming_loans"
:
upcoming_loans
,
}
}
if
overdue_loans
.
exists
():
if
overdue_loans
.
exists
():
context
[
"overdue_loans"
]
=
overdue_loans
context
[
"overdue_loans"
]
=
overdue_loans
due_date_threshold
=
now
-
timedelta
(
days
=
3
)
upcoming_loan
=
(
BookLoans
.
objects
.
filter
(
due_date__gte
=
now
)
.
filter
(
due_date__gte
=
due_date_threshold
)
.
order_by
(
"-due_date"
)
)
context
[
"near_overdue_loans"
]
=
upcoming_loan
return
render
(
request
,
"dashboard/index.html"
,
context
)
return
render
(
request
,
"dashboard/index.html"
,
context
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment