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-04 19:11:03 +00:00
|
|
|
<script>
|
|
|
|
function collectEditedData() {
|
|
|
|
const rows = document.querySelectorAll('tbody tr');
|
|
|
|
const assets = [];
|
|
|
|
|
|
|
|
rows.forEach(row => {
|
|
|
|
const cells = row.querySelectorAll('td');
|
|
|
|
assets.push({
|
|
|
|
assettag: cells[0].innerText,
|
|
|
|
hostname: cells[1].innerText,
|
|
|
|
warrantyfrom: cells[2].innerText,
|
|
|
|
status: cells[3].innerText,
|
|
|
|
staffnum: cells[4].innerText
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Add edited data to a hidden input
|
|
|
|
const input = document.createElement('input');
|
|
|
|
input.type = 'hidden';
|
|
|
|
input.name = 'assets';
|
|
|
|
input.value = JSON.stringify(assets);
|
|
|
|
document.querySelector('form').appendChild(input);
|
|
|
|
}
|
|
|
|
</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 -->
|
|
|
|
<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>
|
2025-01-30 09:58:34 +00:00
|
|
|
{% for asset in assets %}
|
2025-01-30 07:37:21 +00:00
|
|
|
<tr>
|
2025-02-04 06:35:18 +00:00
|
|
|
<td contenteditable="true">{{ asset.assettag }}</td>
|
|
|
|
<td contenteditable="true">{{ asset.hostname }}</td>
|
|
|
|
<td contenteditable="true">{{ asset.warrantyfrom }}</td>
|
|
|
|
<td contenteditable="true">{{ asset.status }}</td>
|
|
|
|
<td contenteditable="true">{{ asset.staffnum }}</td>
|
2025-01-30 07:37:21 +00:00
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
2025-02-01 17:53:13 +00:00
|
|
|
<!-- Form button to confirm and save data -->
|
2025-02-04 19:11:03 +00:00
|
|
|
<form action="/confirm_save" method="POST" onsubmit="collectEditedData()">
|
2025-01-30 07:37:21 +00:00
|
|
|
<button type="submit">Confirm and Save to Database</button>
|
|
|
|
</form>
|
|
|
|
</body>
|
|
|
|
</html>
|