Update: Fixed some vscode "Problems" that weren't really problems but it was complaining about jinja code.
This commit is contained in:
@@ -49,7 +49,13 @@
|
||||
<td>{{ field.excel_cell or '—' }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('cons_sheets.edit_field', process_id=process.id, field_id=field.id) }}" class="btn btn-secondary btn-sm">Edit</a>
|
||||
<button onclick="confirmDelete({{ field.id }}, '{{ field.field_label }}')" class="btn btn-sm" style="background: var(--color-danger); color: white;">Delete</button>
|
||||
<button onclick="confirmDelete(this)"
|
||||
data-id="{{ field.id }}"
|
||||
data-label="{{ field.field_label }}"
|
||||
class="btn btn-sm"
|
||||
style="background: var(--color-danger); color: white;">
|
||||
Delete
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -95,7 +101,13 @@
|
||||
<td>{{ field.excel_cell or '—' }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('cons_sheets.edit_field', process_id=process.id, field_id=field.id) }}" class="btn btn-secondary btn-sm">Edit</a>
|
||||
<button onclick="confirmDelete({{ field.id }}, '{{ field.field_label }}')" class="btn btn-sm" style="background: var(--color-danger); color: white;">Delete</button>
|
||||
<button onclick="confirmDelete(this)"
|
||||
data-id="{{ field.id }}"
|
||||
data-label="{{ field.field_label }}"
|
||||
class="btn btn-sm"
|
||||
style="background: var(--color-danger); color: white;">
|
||||
Delete
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -138,7 +150,11 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function confirmDelete(fieldId, fieldLabel) {
|
||||
function confirmDelete(btn) {
|
||||
// Read values from data attributes
|
||||
const fieldId = btn.dataset.id;
|
||||
const fieldLabel = btn.dataset.label;
|
||||
|
||||
if (confirm('Delete field "' + fieldLabel + '"?\n\nThis will soft-delete the field (data preserved but hidden).')) {
|
||||
fetch('{{ url_for("cons_sheets.delete_field", process_id=process.id, field_id=0) }}'.replace('0', fieldId), {
|
||||
method: 'POST'
|
||||
|
||||
@@ -101,9 +101,11 @@
|
||||
<div class="scans-header">
|
||||
<h3 class="scans-title">Scanned Items (<span id="scanListCount">{{ scans|length }}</span>)</h3>
|
||||
</div>
|
||||
<div id="scansList" class="scans-grid">
|
||||
<div id="scansList" class="scans-grid" style="--field-count: {{ detail_fields|length }};">
|
||||
{% for scan in scans %}
|
||||
<div class="scan-row scan-row-{{ scan.duplicate_status }}" data-detail-id="{{ scan.id }}" onclick="openScanDetail({{ scan.id }})">
|
||||
<div class="scan-row scan-row-{{ scan.duplicate_status }}"
|
||||
data-detail-id="{{ scan.id }}"
|
||||
onclick="openScanDetail(this.dataset.detailId)">
|
||||
{% for field in detail_fields %}
|
||||
<div class="scan-row-cell">{% if field.field_type == 'REAL' %}{{ '%.1f'|format(scan[field.field_name]|float) if scan[field.field_name] else '-' }}{% else %}{{ scan[field.field_name] or '-' }}{% endif %}</div>
|
||||
{% endfor %}
|
||||
@@ -139,7 +141,7 @@
|
||||
.header-values { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin: var(--space-sm) 0; }
|
||||
.header-pill { background: var(--color-surface-elevated); padding: var(--space-xs) var(--space-sm); border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--color-text-muted); }
|
||||
.header-pill strong { color: var(--color-text); }
|
||||
.scan-row { display: grid; grid-template-columns: repeat({{ detail_fields|length }}, 1fr) auto; gap: var(--space-sm); padding: var(--space-md); background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-sm); cursor: pointer; transition: var(--transition); }
|
||||
.scan-row { display: grid; grid-template-columns: repeat(var(--field-count), 1fr) auto; gap: var(--space-sm); padding: var(--space-md); background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: var(--space-sm); cursor: pointer; transition: var(--transition); }
|
||||
.scan-row:hover { border-color: var(--color-primary); }
|
||||
.scan-row-cell { font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.scan-row-dup_same_session { border-left: 4px solid var(--color-duplicate) !important; background: rgba(0, 163, 255, 0.1) !important; }
|
||||
@@ -151,11 +153,22 @@
|
||||
.duplicate-message { color: var(--color-text-muted); margin-bottom: var(--space-lg); }
|
||||
</style>
|
||||
|
||||
<script>
|
||||
const detailFields = {{ detail_fields|tojson|safe }};
|
||||
const dupKeyFieldName = {{ (dup_key_field.field_name if dup_key_field else '')|tojson|safe }};
|
||||
const sessionId = {{ session.id }};
|
||||
<script id="session-data" type="application/json">
|
||||
{
|
||||
"detailFields": {{ detail_fields|tojson|safe }},
|
||||
"dupKeyFieldName": {{ (dup_key_field.field_name if dup_key_field else '')|tojson|safe }},
|
||||
"sessionId": {{ session.id }}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// Read data from the JSON block above
|
||||
const sessionData = JSON.parse(document.getElementById('session-data').textContent);
|
||||
const detailFields = sessionData.detailFields;
|
||||
const dupKeyFieldName = sessionData.dupKeyFieldName;
|
||||
const sessionId = sessionData.sessionId;
|
||||
|
||||
// Standard variables
|
||||
let currentDupKeyValue = '';
|
||||
let currentDuplicateStatus = '';
|
||||
let isDuplicateConfirmed = false;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<span class="arrow-icon">→</span>
|
||||
</div>
|
||||
</a>
|
||||
<button class="btn-archive" onclick="archiveSession({{ s.id }}, '{{ s.process_name }}')" title="Archive this session">
|
||||
<button class="btn-archive" onclick="archiveSession(this)" data-id="{{ s.id }}" data-name="{{ s.process_name }}" title="Archive this session">
|
||||
🗑️
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user