flask_crud_app/templates/csv_preview.html

67 lines
2.1 KiB
HTML
Raw Normal View History

2025-01-30 07:37:21 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
2025-01-30 09:58:34 +00:00
<title>CSV Preview</title>
2025-02-07 21:56:07 +00:00
<script src="{{ url_for('static', filename='edited_csv.js') }}"></script>
2025-01-30 07:37:21 +00:00
</head>
<body>
2025-01-30 09:58:34 +00:00
<h1>CSV Preview</h1>
2025-01-30 07:37:21 +00:00
<!-- Display CSV data in a table -->
2025-02-05 08:26:37 +00:00
{% if new_assets %}
<p>New assets:</p>
2025-02-10 08:07:36 +00:00
<table border="1" class="table-new-assets">
2025-01-30 07:37:21 +00:00
<thead>
<tr>
2025-02-07 21:56:07 +00:00
{% for attrib, config in item_attributes.items() %}
<th data-attrib="{{ attrib }}">{{ config.display_name }}</th>
2025-02-07 21:56:07 +00:00
{% endfor %}
2025-01-30 07:37:21 +00:00
</tr>
</thead>
<tbody>
2025-02-05 08:26:37 +00:00
{% for asset in new_assets %}
2025-01-30 07:37:21 +00:00
<tr>
2025-02-07 21:56:07 +00:00
{% for attrib, config in item_attributes.items() %}
<td contenteditable="true">{{ asset[attrib] }}</td>
{% endfor %}
2025-01-30 07:37:21 +00:00
</tr>
{% endfor %}
</tbody>
</table>
2025-02-05 08:26:37 +00:00
{% endif %}
{% if existing %}
<p>These assets are already in the database:</p>
2025-02-10 08:07:36 +00:00
<table border="1" class="table-existing-assets">
2025-02-05 08:26:37 +00:00
<thead>
<tr>
2025-02-07 21:56:07 +00:00
{% for attrib, config in item_attributes.items() %}
<th >{{ config.display_name }}</th>
2025-02-07 21:56:07 +00:00
{% endfor %}
2025-02-05 08:26:37 +00:00
</tr>
</thead>
<tbody>
{% for asset in existing %}
<tr>
2025-02-07 21:56:07 +00:00
{% for attrib, config in item_attributes.items() %}
<td>{{ asset[attrib] }}</td>
{% endfor %}
2025-02-05 08:26:37 +00:00
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
2025-01-30 07:37:21 +00:00
2025-02-01 17:53:13 +00:00
<!-- Form button to confirm and save data -->
2025-02-05 08:26:37 +00:00
{% if new_assets %}
2025-02-07 21:56:07 +00:00
<form action="/confirm_save" method="POST" onsubmit="return collectEditedData(event)">
2025-01-30 07:37:21 +00:00
<button type="submit">Confirm and Save to Database</button>
</form>
2025-02-05 08:26:37 +00:00
{% endif %}
2025-02-07 21:56:07 +00:00
2025-02-05 08:26:37 +00:00
<!-- Cancel button that redirects to the home page -->
<button type="button" onclick="window.location.href='/'">Cancel</button>
2025-01-30 07:37:21 +00:00
</body>
</html>