Files
Payment_Reconciliation/templates/add_district.html

99 lines
3.2 KiB
HTML
Raw Normal View History

2026-03-23 16:40:56 +05:30
{% extends 'base.html' %}
{% block content %}
<head>
<title>Add District</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/style.css') }}">
<script src="{{ url_for('static', filename='js/search_on_table.js') }}"></script>
</head>
<body>
<!-- Flash Messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="flash-container">
{% for category, message in messages %}
<div class="flash {{ category }}">{{ message }}</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<!-- Buttons -->
<div class="button-container">
<button id="addButton" class="action-button">Add</button>
<button id="displayButton" class="action-button">Display</button>
</div>
<!-- Add District Form -->
<div id="addForm" style="display: block;">
<h2>Add District</h2>
<form id="districtForm" method="POST" action="{{ url_for('district.add_district') }}">
<label for="state_Id">State :</label>
<select name="state_Id" id="state_Id" required>
<option value="" disabled selected>Select State</option>
{% for state in states %}
<option value="{{ state[0] }}">{{ state[1] }}</option>
{% endfor %}
</select>
<label>Enter District :</label>
<input type="text" id="district_Name" name="district_Name" placeholder="District Name" required>
<button type="submit" id="submitButton">Add District</button>
</form>
</div>
<!-- Display Table -->
<div id="addTable" style="display: none;">
<div class="search-container">
<h2>Districts</h2>
<input type="text" id="searchBar" placeholder="Search..." onkeyup="searchTable()">
</div>
<table id="sortableTable" border="1">
<thead>
<tr>
<th>District ID</th>
<th>District Name</th>
<th>State Name</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
{% for district in districtdata %}
<tr>
<td>{{ district[0] }}</td>
<td>{{ district[1] }}</td>
<td>{{ district[2] }}</td>
<td>
<a href="{{ url_for('district.edit_district', district_id=district[0]) }}">
Edit
</a>
</td>
<td>
<a href="{{ url_for('district.delete_district', district_id=district[0]) }}"
onclick="return confirm('Are you sure?')">
Delete
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<script>
// Toggle Add / Display
document.getElementById('addButton').addEventListener('click', () => {
document.getElementById('addForm').style.display = 'block';
document.getElementById('addTable').style.display = 'none';
});
document.getElementById('displayButton').addEventListener('click', () => {
document.getElementById('addForm').style.display = 'none';
document.getElementById('addTable').style.display = 'block';
});
</script>
</body>
{% endblock %}