This commit is contained in:
2025-06-04 04:52:09 -05:00
parent d0338a0849
commit 98c868113c
6 changed files with 202 additions and 101 deletions

View File

@ -0,0 +1,43 @@
{% extends "core_ui/base.html" %}
{% block title %}Review Scientific Names{% endblock %}
{% block content %}
<div class="container py-4">
<h2 class="mb-4">🔍 Review Suggested Matches</h2>
<form method="POST">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
{% if review_list %}
<div class="table-responsive">
<table class="table table-bordered align-middle">
<thead>
<tr>
<th>Common Name</th>
<th>Suggested Scientific Name</th>
<th>Confirm?</th>
</tr>
</thead>
<tbody>
{% for row in review_list %}
<tr>
<td>{{ row.common_name }}</td>
<td>{{ row.suggested_name }}</td>
<td>
<input class="form-check-input" type="checkbox" name="confirm_{{ row.uuid }}" value="1" checked>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p>No suggestions were made. You can safely continue.</p>
{% endif %}
<div class="mt-3">
<button type="submit" class="btn btn-primary">Confirm and Import</button>
</div>
</form>
</div>
{% endblock %}

View File

@ -1,32 +1,32 @@
{% extends 'core_ui/base.html' %}
{% extends "core_ui/base.html" %}
{% block title %}CSV Import{% endblock %}
{% block content %}
<div class="container mt-4">
<h2 class="mb-3">Import Plants from CSV</h2>
<div class="container py-4">
<h2 class="mb-4">📤 Import Plant Data</h2>
<div class="alert alert-info" role="alert">
<strong>Expected CSV headers (in this exact order):</strong>
<code>uuid,plant_type,name,scientific_name,mother_uuid</code>
</div>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ 'danger' if category == 'error' else category }} alert-dismissible fade show" role="alert">
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% endif %}
{% endwith %}
<form method="POST" enctype="multipart/form-data" class="needs-validation" novalidate>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label for="file" class="form-label">Select CSV file to upload</label>
<input type="file" class="form-control" id="file" name="file" accept=".csv" required>
</div>
<button type="submit" class="btn btn-primary">Upload &amp; Import</button>
</form>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
<div class="mt-4">
{% for category, message in messages %}
<div class="alert alert-{{ 'danger' if category == 'error' else category }}" role="alert">
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<form method="POST" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label for="file" class="form-label">Choose CSV File</label>
<input type="file" class="form-control" id="file" name="file" required>
<div class="form-text">
Must include: <code>uuid</code>, <code>plant_type</code>, <code>name</code><br>
Optional: <code>scientific_name</code>, <code>mother_uuid</code>
</div>
</div>
<button type="submit" class="btn btn-success">Upload</button>
</form>
</div>
{% endblock %}