pagination
This commit is contained in:
parent
b12e3fe1b3
commit
2464cd443a
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -332,4 +332,23 @@ def Contract(request):
|
||||
def Viewcontract(request):
|
||||
# Get all records from database
|
||||
pdf_records = resulation.objects.filter(pdftype='Contract').order_by('-m_date') # Latest first
|
||||
return render(request, 'resulation/viewcontract.html', {'pdf_records': pdf_records})
|
||||
return render(request, 'resulation/viewcontract.html', {'pdf_records': pdf_records})
|
||||
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
def contracts_list(request):
|
||||
records = resulation.objects.all() # Replace with your model
|
||||
paginator = Paginator(records, 10) # Show 10 records per page
|
||||
|
||||
try:
|
||||
page = int(request.GET.get('page', '1'))
|
||||
except ValueError:
|
||||
page = 1
|
||||
|
||||
try:
|
||||
pdf_records = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
pdf_records = paginator.page(1)
|
||||
except EmptyPage:
|
||||
pdf_records = paginator.page(paginator.num_pages)
|
||||
|
||||
return {'pdf_records': pdf_records, 'paginator': paginator}
|
@ -280,3 +280,29 @@ button[type="submit"]:hover, .submit-btn:hover, .form-table td strong center inp
|
||||
.records-table td a:hover {
|
||||
color: #45a049;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.page-links {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.prev, .next {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.prev:hover, .next:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.current-page {
|
||||
font-weight: bold;
|
||||
}
|
@ -17,10 +17,11 @@
|
||||
</div>
|
||||
<div class="menu-container">
|
||||
{% if user.is_authenticated %}
|
||||
<a href="http://localhost:8000/rcm/signup">Sign up</a>
|
||||
<!-- <a href="http://localhost:8000/rcm/signup">Sign up</a> -->
|
||||
<a href="http://localhost:8000/rcm">Home</a>
|
||||
<a href="http://localhost:8000/rcm/logout">Logout</a>
|
||||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-btn">Upload ▼</a>
|
||||
<a href="#" class="dropdown-btn">Upload</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="http://localhost:8000/rcm/resulation">Resulation</a>
|
||||
<a href="http://localhost:8000/rcm/deed">Contract</a>
|
||||
@ -28,7 +29,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<a href="#" class="dropdown-btn">View ▼</a>
|
||||
<a href="#" class="dropdown-btn">View</a>
|
||||
<div class="dropdown-content">
|
||||
<a href="http://localhost:8000/rcm/viewresulation">Resulations</a>
|
||||
<a href="http://localhost:8000/rcm/viewdeed">Contracts</a>
|
||||
@ -65,7 +66,7 @@
|
||||
{% endblock content %}
|
||||
</body>
|
||||
<footer>
|
||||
<div class="content">
|
||||
<div class="content" align="center">
|
||||
copyright@MIS-DGHS, Bangladesh
|
||||
</div>
|
||||
</footer>
|
@ -1,7 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<h2>Contracts</h2>
|
||||
@ -32,6 +31,7 @@
|
||||
<td>{{ record.second_party }}</td>
|
||||
<td>{{ record.contract_mou_date|date:"d M Y" }}</td>
|
||||
<td>{{ record.closing_date|date:"d M Y" }}</td>
|
||||
<td>{{ record.duration}}</td>
|
||||
<td>
|
||||
{% if record.res_con_mou_file %}
|
||||
<a href="{% url 'file-download' type="resolution" filename=record.res_con_mou_file %}">Download</a>
|
||||
@ -41,11 +41,26 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
|
||||
<!-- Pagination -->
|
||||
<div class="pagination">
|
||||
<div class="page-links">
|
||||
{% if pdf_records.has_previous %}
|
||||
<a href="?page={{ pdf_records.previous_page_number }}" class="prev">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="current-page">{{ pdf_records.number }}</span>
|
||||
<span class="total-pages">/ {{ pdf_records.paginator.num_pages }}</span>
|
||||
|
||||
{% if pdf_records.has_next %}
|
||||
<a href="?page={{ pdf_records.next_page_number }}" class="next">Next</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No records found.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('searchInput').addEventListener('input', function() {
|
||||
const searchTerm = this.value.toLowerCase();
|
||||
@ -56,7 +71,6 @@ document.getElementById('searchInput').addEventListener('input', function() {
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cells = row.cells;
|
||||
let match = false;
|
||||
|
||||
@ -71,5 +85,4 @@ document.getElementById('searchInput').addEventListener('input', function() {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
@ -1,7 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<h2>Mou</h2>
|
||||
@ -36,9 +35,25 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
|
||||
<!-- Pagination -->
|
||||
<div class="pagination">
|
||||
<div class="page-links">
|
||||
{% if pdf_records.has_previous %}
|
||||
<a href="?page={{ pdf_records.previous_page_number }}" class="prev">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="current-page">{{ pdf_records.number }}</span>
|
||||
<span class="total-pages">/{{ pdf_records.paginator.num_pages }}</span>
|
||||
|
||||
{% if pdf_records.has_next %}
|
||||
<a href="?page={{ pdf_records.next_page_number }}" class="next">Next</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No records found.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -51,7 +66,6 @@ document.getElementById('searchInput').addEventListener('input', function() {
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cells = row.cells;
|
||||
let match = false;
|
||||
|
||||
@ -66,5 +80,4 @@ document.getElementById('searchInput').addEventListener('input', function() {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
@ -1,7 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<h2>Resulation/Meeting Minutes</h2>
|
||||
@ -46,9 +45,25 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
|
||||
<!-- Pagination -->
|
||||
<div class="pagination">
|
||||
<div class="page-links">
|
||||
{% if pdf_records.has_previous %}
|
||||
<a href="?page={{ pdf_records.previous_page_number }}" class="prev">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="current-page">{{ pdf_records.number }}</span>
|
||||
<span class="total-pages">/ {{ pdf_records.paginator.num_pages }}</span>
|
||||
|
||||
{% if pdf_records.has_next %}
|
||||
<a href="?page={{ pdf_records.next_page_number }}" class="next">Next</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No records found.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -61,7 +76,6 @@ document.getElementById('searchInput').addEventListener('input', function() {
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cells = row.cells;
|
||||
let match = false;
|
||||
|
||||
@ -76,5 +90,4 @@ document.getElementById('searchInput').addEventListener('input', function() {
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
Loading…
Reference in New Issue
Block a user