flask_crud_app/templates/csv_preview.html

49 lines
1.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Preview CSV Data</title>
</head>
<body>
<h1>Preview CSV Data</h1>
<!-- Display flash messages -->
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<p style="color: {% if category == 'error' %}red{% else %}green{% endif %};">{{ message }}</p>
{% endfor %}
{% endif %}
{% endwith %}
<!-- Display CSV data in a table -->
<table border="1">
<thead>
<tr>
<th>Asset Tag</th>
<th>Hostname</th>
<th>Warranty From</th>
<th>Status</th>
<th>Staff Number</th>
</tr>
</thead>
<tbody>
{% for row in csv_data %}
<tr>
<td>{{ row.assettag }}</td>
<td>{{ row.hostname }}</td>
<td>{{ row.warrantyfrom }}</td>
<td>{{ row.status }}</td>
<td>{{ row.staffnum }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<!-- Confirmation form -->
<form method="POST">
<button type="submit">Confirm and Save to Database</button>
</form>
</body>
</html>