all upload&view
This commit is contained in:
parent
a0ef3cff8d
commit
638fce7538
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -12,7 +12,9 @@ urlpatterns = [
|
||||
path('resulation/', resulation.views.Savepdf, name='resulation'),
|
||||
path('viewresulation/', resulation.views.Viewresulation, name='viewresulation'),
|
||||
path('deed/', resulation.views.Contract, name='deed'),
|
||||
path('viewdeed/', resulation.views.Viewcontract, name='viewdeed'),
|
||||
path('mou/', resulation.views.Mou, name='mou'),
|
||||
path('viewmou/', resulation.views.Viewmou, name='viewmou'),
|
||||
path('<str:type>/<str:filename>', resulation.views.file_download, name='file-download'),
|
||||
path('rcm/', resulation.views.file_download, name='download_file'),
|
||||
]
|
||||
|
@ -89,8 +89,102 @@ def file_download(request, type, filename):
|
||||
return FileResponse(open(file_path, 'rb'), content_type='application/pdf')
|
||||
|
||||
|
||||
def Contract(request):
|
||||
return render(request,'resulation/contract.html')
|
||||
|
||||
|
||||
def Mou(request):
|
||||
return render(request,'resulation/mou.html')
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
# Get text form fields
|
||||
pdftype= request.POST.get('pdftype')
|
||||
first_party = request.POST.get('first_party')
|
||||
second_party = request.POST.get('second_party')
|
||||
contract_mou_date = request.POST.get('contract_mou_date')
|
||||
# Get file uploads
|
||||
res_con_mou_file = request.FILES.get('res_con_mou_file')
|
||||
|
||||
if res_con_mou_file:
|
||||
new_filename2 = f"res_con_{uuid.uuid4()}.pdf"
|
||||
path2 = os.path.join('media', 'resolution_files', new_filename2)
|
||||
|
||||
print(path2)
|
||||
with open(path2, 'wb') as destination:
|
||||
for chunk in res_con_mou_file.chunks():
|
||||
destination.write(chunk)
|
||||
seminar = resulation(
|
||||
pdftype=pdftype,
|
||||
first_party = first_party,
|
||||
second_party = second_party,
|
||||
contract_mou_date = contract_mou_date,
|
||||
res_con_mou_file=new_filename2,
|
||||
)
|
||||
seminar.save()
|
||||
message = "Data Inserted successfully"
|
||||
# Redirect after a successful save
|
||||
return render(request, "resulation/home.html", {'message': message})
|
||||
|
||||
except Exception as e:
|
||||
# Handle any errors (e.g., invalid file types or sizes)
|
||||
print(f"Error processing form: {str(e)}")
|
||||
return render(request, 'resulation/mou.html', {'error': str(e)})
|
||||
|
||||
else:
|
||||
# Render the form template
|
||||
return render(request, 'resulation/mou.html')
|
||||
|
||||
def Viewmou(request):
|
||||
# Get all records from database
|
||||
pdf_records = resulation.objects.all().order_by('-m_date') # Latest first
|
||||
return render(request, 'resulation/viewmou.html', {'pdf_records': pdf_records})
|
||||
|
||||
|
||||
|
||||
def Contract(request):
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
# Get text form fields
|
||||
pdftype= request.POST.get('pdftype')
|
||||
contract_name= request.POST.get('topic')
|
||||
first_party = request.POST.get('first_party')
|
||||
second_party = request.POST.get('second_party')
|
||||
contract_mou_date = request.POST.get('contract_mou_date')
|
||||
contract_mou_closing_date = request.POST.get('closing_date')
|
||||
duration= request.POST.get('duration')
|
||||
# Get file uploads
|
||||
res_con_mou_file = request.FILES.get('res_con_mou_file')
|
||||
|
||||
if res_con_mou_file:
|
||||
new_filename2 = f"res_con_{uuid.uuid4()}.pdf"
|
||||
path2 = os.path.join('media', 'resolution_files', new_filename2)
|
||||
|
||||
print(path2)
|
||||
with open(path2, 'wb') as destination:
|
||||
for chunk in res_con_mou_file.chunks():
|
||||
destination.write(chunk)
|
||||
seminar = resulation(
|
||||
pdftype=pdftype,
|
||||
topic=contract_name,
|
||||
first_party = first_party,
|
||||
second_party = second_party,
|
||||
contract_mou_date = contract_mou_date,
|
||||
closing_date= contract_mou_closing_date,
|
||||
duration=duration,
|
||||
res_con_mou_file=new_filename2,
|
||||
)
|
||||
seminar.save()
|
||||
message = "Data Inserted successfully"
|
||||
# Redirect after a successful save
|
||||
return render(request, "resulation/home.html", {'message': message})
|
||||
|
||||
except Exception as e:
|
||||
# Handle any errors (e.g., invalid file types or sizes)
|
||||
print(f"Error processing form: {str(e)}")
|
||||
return render(request, 'resulation/contract.html', {'error': str(e)})
|
||||
|
||||
else:
|
||||
# Render the form template
|
||||
return render(request, 'resulation/contract.html')
|
||||
|
||||
def Viewcontract(request):
|
||||
# Get all records from database
|
||||
pdf_records = resulation.objects.all().order_by('-m_date') # Latest first
|
||||
return render(request, 'resulation/viewcontract.html', {'pdf_records': pdf_records})
|
@ -21,11 +21,11 @@
|
||||
<a href="http://localhost:8000/rcm">Home</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/deed">Contract</a>
|
||||
<a href="http://localhost:8000/">MoU</a>
|
||||
<a href="http://localhost:8000/rcm/deed">Contract</a>
|
||||
<a href="http://localhost:8000/rcm/mou">MoU</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
@ -33,7 +33,7 @@
|
||||
<div class="dropdown-content">
|
||||
<a href="http://localhost:8000/rcm/viewresulation">Resulations</a>
|
||||
<a href="#">Contracts</a>
|
||||
<a href="#">MoUs</a>
|
||||
<a href="http://localhost:8000/rcm/viewmou">MoU</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,53 +1,224 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<h3>Fillup the form and upload your Contract</h3>
|
||||
<form action "/saved.html">
|
||||
<table>
|
||||
<tr>
|
||||
<th align="left">Name of organization</th>
|
||||
<th><input type="text", name="org_unit"></th>
|
||||
</tr>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f4f6f9;
|
||||
}
|
||||
|
||||
<tr>
|
||||
<th align="left">Tropic</th>
|
||||
<th><input type="text", name="tropic"></th>
|
||||
</tr>
|
||||
.form-container {
|
||||
max-width: 800px;
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
background: #ffffff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #2c3e50;
|
||||
text-align: center;
|
||||
border-bottom: 3px solid #3498db;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: #2980b9;
|
||||
margin-top: 25px;
|
||||
border-left: 4px solid #3498db;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
list {
|
||||
display: block;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
list li {
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
list li::before {
|
||||
content: '•';
|
||||
color: #3498db;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
color: #2c3e50;
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 15px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
color: #34495e;
|
||||
font-weight: 600;
|
||||
width: 30%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.form-table input[type="text"],
|
||||
.form-table input[type="date"] {
|
||||
width: 90%;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
.form-table input[type="text"]:focus,
|
||||
.form-table input[type="date"]:focus {
|
||||
border-color: #3498db;
|
||||
outline: none;
|
||||
box-shadow: 0 0 5px rgba(52,152,219,0.3);
|
||||
}
|
||||
|
||||
.form-table input[type="file"] {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
background-color: #3498db;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.submit-btn:hover {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
.file-input-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.file-input-label {
|
||||
display: inline-block;
|
||||
background-color: #f8f9fa;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.alert {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
padding: 15px;
|
||||
margin: 10px 0;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #c3e6cb;
|
||||
animation: fadeOut 5s forwards;
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% { opacity: 1; }
|
||||
90% { opacity: 1; }
|
||||
100% { opacity: 0; }
|
||||
}
|
||||
|
||||
/* Responsive design */
|
||||
@media (max-width: 768px) {
|
||||
.form-container {
|
||||
margin: 10px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="form-container">
|
||||
<h3 class="form-title">Fill up the form and upload Contract</h3>
|
||||
<form action="{% url "deed" %}" method="POST" enctype="multipart/form-data">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th align="left">Type of Upload</th>
|
||||
<td><input type="text" name="pdftype" value="Contract" readonly></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">Contract Name</th>
|
||||
<th><input type="text", name="topic"></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="left">First Party</th>
|
||||
<th><input type="text", name="first_party"></th>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th align="left">Second Party</th>
|
||||
<th><input type="text", name="second_party"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align="left">Contract Date</th>
|
||||
<th><input type="text", name="contract_date"></th>
|
||||
<th align="left">Contract Signing Date</th>
|
||||
<th><input type="Date", name="contract_date"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align="left">End Date</th>
|
||||
<th align="left">Contract End Date</th>
|
||||
<th><input type="Date", name="closing_date"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align="left">Duration of Cotract</th>
|
||||
<th><input type="Date", name="duration"></th>
|
||||
<th><input type="text", name="duration"></th>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th align="left">Upload Resulation</th>
|
||||
<th><input type="file", name="contract_file"></th>
|
||||
<tr>
|
||||
<th align="left">Upload Contract</th>
|
||||
<th><input type="file", name="res_con_mou_file"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
{% csrf_token %}
|
||||
<th strong center><input Type="Submit">
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -1,42 +1,214 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<div>
|
||||
<h3>Fillup the form and upload MOU</h3>
|
||||
<form action "/saved.html">
|
||||
<table>
|
||||
<tr>
|
||||
<th align="left">Name of organization</th>
|
||||
<th><input type="text", name="org_unit"></th>
|
||||
</tr>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f4f6f9;
|
||||
}
|
||||
|
||||
<tr>
|
||||
<th align="left">Tropic/Subject</th>
|
||||
<th><input type="text", name="tropic"></th>
|
||||
</tr>
|
||||
.form-container {
|
||||
max-width: 800px;
|
||||
margin: 20px auto;
|
||||
padding: 20px;
|
||||
background: #ffffff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #2c3e50;
|
||||
text-align: center;
|
||||
border-bottom: 3px solid #3498db;
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: #2980b9;
|
||||
margin-top: 25px;
|
||||
border-left: 4px solid #3498db;
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
list {
|
||||
display: block;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
list li {
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
list li::before {
|
||||
content: '•';
|
||||
color: #3498db;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
left: -20px;
|
||||
}
|
||||
|
||||
.form-title {
|
||||
color: #2c3e50;
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.form-table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 15px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
text-align: left;
|
||||
padding: 8px;
|
||||
color: #34495e;
|
||||
font-weight: 600;
|
||||
width: 30%;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.form-table input[type="text"],
|
||||
.form-table input[type="date"] {
|
||||
width: 90%;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
transition: border-color 0.3s;
|
||||
}
|
||||
|
||||
.form-table input[type="text"]:focus,
|
||||
.form-table input[type="date"]:focus {
|
||||
border-color: #3498db;
|
||||
outline: none;
|
||||
box-shadow: 0 0 5px rgba(52,152,219,0.3);
|
||||
}
|
||||
|
||||
.form-table input[type="file"] {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
background-color: #3498db;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.submit-btn:hover {
|
||||
background-color: #2980b9;
|
||||
}
|
||||
|
||||
.file-input-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.file-input-label {
|
||||
display: inline-block;
|
||||
background-color: #f8f9fa;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.alert {
|
||||
background-color: #d4edda;
|
||||
color: #155724;
|
||||
padding: 15px;
|
||||
margin: 10px 0;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #c3e6cb;
|
||||
animation: fadeOut 5s forwards;
|
||||
}
|
||||
|
||||
@keyframes fadeOut {
|
||||
0% { opacity: 1; }
|
||||
90% { opacity: 1; }
|
||||
100% { opacity: 0; }
|
||||
}
|
||||
|
||||
/* Responsive design */
|
||||
@media (max-width: 768px) {
|
||||
.form-container {
|
||||
margin: 10px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form-table td {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="form-container">
|
||||
<h3 class="form-title">Fill up the form and upload your MoU</h3>
|
||||
<form action="{% url "mou" %}" method="POST" enctype="multipart/form-data">
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th align="left">Type of Upload</th>
|
||||
<td><input type="text" name="pdftype" value="MoU" readonly></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<th align="left">First Party</th>
|
||||
<th><input type="text", name="first_party"></th>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<th align="left">Second Party</th>
|
||||
<th><input type="text", name="second_party"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align="left">MoU Date</th>
|
||||
<th><input type="text", name="contract_date"></th>
|
||||
<th><input type="date", name="contract_mou_date"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th align="left">Upload MoU</th>
|
||||
<th><input type="file", name="mou_file"></th>
|
||||
<th><input type="file", name="res_con_mou_file"></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th></th>
|
||||
{% csrf_token %}
|
||||
<th strong center><input Type="Submit">
|
||||
</tr>
|
||||
</table>
|
||||
|
75
templates/resulation/viewcontract.html
Normal file
75
templates/resulation/viewcontract.html
Normal file
@ -0,0 +1,75 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<h2>Contracts</h2>
|
||||
<input type="text" id="searchInput" class="search-box" placeholder="Search records...">
|
||||
</div>
|
||||
{% if pdf_records %}
|
||||
<table class="records-table" aria-label="PDF Records">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Type</th>
|
||||
<th>Topic</th>
|
||||
<th>First Party</th>
|
||||
<th>Second Party</th>
|
||||
<th>Contract Signing Date</th>
|
||||
<th>Contract End Date</th>
|
||||
<th>Duration Of Contract</th>
|
||||
<th>Contract</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in pdf_records %}
|
||||
<tr>
|
||||
<td>{{ record.eid }}</td>
|
||||
<td>{{ record.pdftype=contract }}</td>
|
||||
<td>{{ record.topic }}</td>
|
||||
<td>{{ record.first_party }}</td>
|
||||
<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>
|
||||
{% if record.res_con_mou_file %}
|
||||
<a href="{% url 'file-download' type="resolution" filename=record.res_con_mou_file %}">Download</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No records found.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('searchInput').addEventListener('input', function() {
|
||||
const searchTerm = this.value.toLowerCase();
|
||||
const rows = document.querySelectorAll('tr');
|
||||
|
||||
rows.forEach((row, index) => {
|
||||
// Skip the header row
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cells = row.cells;
|
||||
let match = false;
|
||||
|
||||
for (let i = 0; i < cells.length; i++) {
|
||||
if (cells[i].textContent.toLowerCase().includes(searchTerm)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
row.style.display = match ? 'table-row' : 'none';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
70
templates/resulation/viewmou.html
Normal file
70
templates/resulation/viewmou.html
Normal file
@ -0,0 +1,70 @@
|
||||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<h2>PDF Records</h2>
|
||||
<input type="text" id="searchInput" class="search-box" placeholder="Search records...">
|
||||
</div>
|
||||
{% if pdf_records %}
|
||||
<table class="records-table" aria-label="PDF Records">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Type</th>
|
||||
<th>First Party</th>
|
||||
<th>Second Party</th>
|
||||
<th>MoU Date</th>
|
||||
<th>MoU</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in pdf_records %}
|
||||
<tr>
|
||||
<td>{{ record.eid }}</td>
|
||||
<td>{{ record.pdftype }}</td>
|
||||
<td>{{ record.first_party }}</td>
|
||||
<td>{{ record.second_party }}</td>
|
||||
<td>{{ record.contract_mou_date|date:"d M Y" }}</td>
|
||||
<td>
|
||||
{% if record.res_con_mou_file %}
|
||||
<a href="{% url 'file-download' type="resolution" filename=record.res_con_mou_file %}">Download</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No records found.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.getElementById('searchInput').addEventListener('input', function() {
|
||||
const searchTerm = this.value.toLowerCase();
|
||||
const rows = document.querySelectorAll('tr');
|
||||
|
||||
rows.forEach((row, index) => {
|
||||
// Skip the header row
|
||||
if (index === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cells = row.cells;
|
||||
let match = false;
|
||||
|
||||
for (let i = 0; i < cells.length; i++) {
|
||||
if (cells[i].textContent.toLowerCase().includes(searchTerm)) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
row.style.display = match ? 'table-row' : 'none';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock content %}
|
@ -4,7 +4,7 @@
|
||||
|
||||
<div class="table-container">
|
||||
<div class="table-header">
|
||||
<h2>PDF Records</h2>
|
||||
<h2>Resulation/Meeting Minutes</h2>
|
||||
<input type="text" id="searchInput" class="search-box" placeholder="Search records...">
|
||||
</div>
|
||||
{% if pdf_records %}
|
||||
|
Loading…
Reference in New Issue
Block a user