lots of things
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
{% extends "core_ui/base.html" %}
|
||||
{% block content %}
|
||||
<h2>Submissions</h2>
|
||||
<ul>
|
||||
{% for s in submissions %}
|
||||
<li>{{ s.common_name }} ({{ s.scientific_name or 'N/A' }}) - ${{ s.price }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
55
plugins/submission/templates/submission/list.html
Normal file
55
plugins/submission/templates/submission/list.html
Normal file
@ -0,0 +1,55 @@
|
||||
{% extends 'core_ui/base.html' %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h2>Your Submissions</h2>
|
||||
|
||||
<!-- Filter dropdown -->
|
||||
<form method="GET" class="row g-2 align-items-center mb-3">
|
||||
<div class="col-auto">
|
||||
<label for="filter_type" class="form-label">Filter by Type:</label>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<select id="filter_type" name="type" class="form-select" onchange="this.form.submit()">
|
||||
{% for val, label in all_types %}
|
||||
<option value="{{ val }}" {% if selected_type == val %}selected{% endif %}>
|
||||
{{ label }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<noscript><button type="submit" class="btn btn-primary">Apply</button></noscript>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if submissions %}
|
||||
<ul class="list-group">
|
||||
{% for sub in submissions %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<strong>{{ sub.submission_type.replace('_', ' ').title() }}</strong>
|
||||
— {{ sub.plant_name or '--' }}
|
||||
{% if sub.submission_type == 'market_price' and sub.price is not none %}
|
||||
· ${{ '%.2f' % sub.price }}
|
||||
{% elif sub.submission_type == 'vendor_rating' and sub.vendor_name %}
|
||||
· Rated “{{ sub.vendor_name }}” ({{ sub.rating }}/5)
|
||||
{% elif sub.submission_type == 'vendor_alias' and sub.old_vendor %}
|
||||
· Alias: “{{ sub.old_vendor }}” → “{{ sub.new_vendor }}”
|
||||
{% endif %}
|
||||
<br>
|
||||
<small class="text-muted">Submitted {{ sub.submitted_at.strftime('%Y-%m-%d %H:%M') }}</small>
|
||||
</div>
|
||||
<a href="{{ url_for('submission.view_submission', submission_id=sub.id) }}"
|
||||
class="btn btn-outline-primary btn-sm">View</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>You have no submissions that match this filter.</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-3">
|
||||
<a href="{{ url_for('submission.new_submission') }}" class="btn btn-primary">New Submission</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
166
plugins/submission/templates/submission/new.html
Normal file
166
plugins/submission/templates/submission/new.html
Normal file
@ -0,0 +1,166 @@
|
||||
{% extends 'core_ui/base.html' %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h2>New Submission</h2>
|
||||
<form method="POST" enctype="multipart/form-data" id="submission-form">
|
||||
{{ form.hidden_tag() }}
|
||||
|
||||
<!-- Submission Type selector -->
|
||||
<div class="mb-3">
|
||||
{{ form.submission_type.label(class="form-label") }}
|
||||
{{ form.submission_type(class="form-select", id="submission_type") }}
|
||||
</div>
|
||||
|
||||
<!-- Plant fields: only for plant‐related types -->
|
||||
<div class="mb-3" id="plant-name-group">
|
||||
{{ form.plant_name.label(class="form-label") }}
|
||||
{{ form.plant_name(class="form-control") }}
|
||||
<div class="form-text">Common name of the plant (required for plant‐related submissions).</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" id="scientific-name-group">
|
||||
{{ form.scientific_name.label(class="form-label") }}
|
||||
{{ form.scientific_name(class="form-control") }}
|
||||
<div class="form-text">Scientific name (optional for plant‐related submissions).</div>
|
||||
</div>
|
||||
|
||||
<!-- Market Price fields -->
|
||||
<div class="mb-3" id="price-group">
|
||||
{{ form.price.label(class="form-label") }}
|
||||
{{ form.price(class="form-control") }}
|
||||
<div class="form-text">Only for “Market Price” submissions.</div>
|
||||
</div>
|
||||
<div class="mb-3" id="source-group">
|
||||
{{ form.source.label(class="form-label") }}
|
||||
{{ form.source(class="form-control") }}
|
||||
<div class="form-text">Source/vendor (for market price).</div>
|
||||
</div>
|
||||
|
||||
<!-- Name Correction: no extra fields beyond notes -->
|
||||
|
||||
<!-- New Plant Suggestion helper text -->
|
||||
<div class="mb-3" id="new-plant-group">
|
||||
<p class="text-muted">
|
||||
For new plant suggestions, simply fill in common/scientific name and optional notes/images.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Mutation Discovery helper text -->
|
||||
<div class="mb-3" id="mutation-group">
|
||||
<p class="text-muted">
|
||||
For mutation discovery, fill in plant details and upload mutation images.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Vendor Rating / Review fields -->
|
||||
<div class="mb-3" id="vendor-name-group">
|
||||
{{ form.vendor_name.label(class="form-label") }}
|
||||
{{ form.vendor_name(class="form-control") }}
|
||||
<div class="form-text">Vendor name to rate/review (e.g., “Etsy Seller X”).</div>
|
||||
</div>
|
||||
<div class="mb-3" id="rating-group">
|
||||
{{ form.rating.label(class="form-label") }}
|
||||
{{ form.rating(class="form-select") }}
|
||||
<div class="form-text">1 = Poor, 5 = Excellent.</div>
|
||||
</div>
|
||||
|
||||
<!-- Vendor Alias Submission fields -->
|
||||
<div class="mb-3" id="old-vendor-group">
|
||||
{{ form.old_vendor.label(class="form-label") }}
|
||||
{{ form.old_vendor(class="form-control") }}
|
||||
<div class="form-text">Existing vendor name (to alias).</div>
|
||||
</div>
|
||||
<div class="mb-3" id="new-vendor-group">
|
||||
{{ form.new_vendor.label(class="form-label") }}
|
||||
{{ form.new_vendor(class="form-control") }}
|
||||
<div class="form-text">New alias name for vendor.</div>
|
||||
</div>
|
||||
<div class="mb-3" id="alias-reason-group">
|
||||
{{ form.alias_reason.label(class="form-label") }}
|
||||
{{ form.alias_reason(class="form-control", rows=3) }}
|
||||
<div class="form-text">Why this alias is needed (e.g., vendor changed name).</div>
|
||||
</div>
|
||||
|
||||
<!-- Notes & Images (always present) -->
|
||||
<div class="mb-3">
|
||||
{{ form.notes.label(class="form-label") }}
|
||||
{{ form.notes(class="form-control", rows=3) }}
|
||||
<div class="form-text">Additional notes or context.</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
{{ form.images.label(class="form-label") }}
|
||||
{{ form.images(class="form-control", multiple=True) }}
|
||||
<div class="form-text">Upload up to 10 images relevant to your submission.</div>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-success">{{ form.submit.label.text }}</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const typeField = document.getElementById('submission_type');
|
||||
|
||||
// Groups to show/hide
|
||||
const plantNameGroup = document.getElementById('plant-name-group');
|
||||
const scientificNameGroup = document.getElementById('scientific-name-group');
|
||||
const priceGroup = document.getElementById('price-group');
|
||||
const sourceGroup = document.getElementById('source-group');
|
||||
const newPlantGroup = document.getElementById('new-plant-group');
|
||||
const mutationGroup = document.getElementById('mutation-group');
|
||||
const vendorNameGroup = document.getElementById('vendor-name-group');
|
||||
const ratingGroup = document.getElementById('rating-group');
|
||||
const oldVendorGroup = document.getElementById('old-vendor-group');
|
||||
const newVendorGroup = document.getElementById('new-vendor-group');
|
||||
const aliasReasonGroup = document.getElementById('alias-reason-group');
|
||||
|
||||
function toggleFields() {
|
||||
const t = typeField.value;
|
||||
|
||||
// First hide everything
|
||||
[
|
||||
plantNameGroup, scientificNameGroup,
|
||||
priceGroup, sourceGroup,
|
||||
newPlantGroup, mutationGroup,
|
||||
vendorNameGroup, ratingGroup,
|
||||
oldVendorGroup, newVendorGroup, aliasReasonGroup
|
||||
].forEach(div => div.style.display = 'none');
|
||||
|
||||
// Show core plant fields for plant‐related types
|
||||
if (['market_price', 'name_correction', 'new_plant', 'mutation'].includes(t)) {
|
||||
plantNameGroup.style.display = 'block';
|
||||
scientificNameGroup.style.display = 'block';
|
||||
}
|
||||
|
||||
// Show Market Price fields
|
||||
if (t === 'market_price') {
|
||||
priceGroup.style.display = 'block';
|
||||
sourceGroup.style.display = 'block';
|
||||
}
|
||||
// Show New Plant helper
|
||||
else if (t === 'new_plant') {
|
||||
newPlantGroup.style.display = 'block';
|
||||
}
|
||||
// Show Mutation helper
|
||||
else if (t === 'mutation') {
|
||||
mutationGroup.style.display = 'block';
|
||||
}
|
||||
// Show Vendor Rating / Review fields
|
||||
else if (t === 'vendor_rating') {
|
||||
vendorNameGroup.style.display = 'block';
|
||||
ratingGroup.style.display = 'block';
|
||||
}
|
||||
// Show Vendor Alias fields
|
||||
else if (t === 'vendor_alias') {
|
||||
oldVendorGroup.style.display = 'block';
|
||||
newVendorGroup.style.display = 'block';
|
||||
aliasReasonGroup.style.display = 'block';
|
||||
}
|
||||
// For name_correction: only plant fields + notes/images
|
||||
}
|
||||
|
||||
typeField.addEventListener('change', toggleFields);
|
||||
toggleFields(); // initial call when page first loads
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
101
plugins/submission/templates/submission/view.html
Normal file
101
plugins/submission/templates/submission/view.html
Normal file
@ -0,0 +1,101 @@
|
||||
{% extends 'core_ui/base.html' %}
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<h2>Submission Details</h2>
|
||||
<dl class="row">
|
||||
<dt class="col-sm-3">Type:</dt>
|
||||
<dd class="col-sm-9">
|
||||
{{ submission.submission_type.replace('_', ' ').title() }}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-3">Common Name:</dt>
|
||||
<dd class="col-sm-9">
|
||||
{% if submission.plant_name %}
|
||||
{{ submission.plant_name }}
|
||||
{% else %}
|
||||
—
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-3">Scientific Name:</dt>
|
||||
<dd class="col-sm-9">
|
||||
{% if submission.scientific_name %}
|
||||
{{ submission.scientific_name }}
|
||||
{% else %}
|
||||
—
|
||||
{% endif %}
|
||||
</dd>
|
||||
|
||||
{% if submission.submission_type == 'market_price' %}
|
||||
<dt class="col-sm-3">Price:</dt>
|
||||
<dd class="col-sm-9">${{ '%.2f' % submission.price }}</dd>
|
||||
<dt class="col-sm-3">Source:</dt>
|
||||
<dd class="col-sm-9">{{ submission.source or '—' }}</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if submission.submission_type == 'vendor_rating' %}
|
||||
<dt class="col-sm-3">Vendor Name:</dt>
|
||||
<dd class="col-sm-9">{{ submission.vendor_name }}</dd>
|
||||
<dt class="col-sm-3">Rating:</dt>
|
||||
<dd class="col-sm-9">{{ submission.rating }} / 5</dd>
|
||||
{% endif %}
|
||||
|
||||
{% if submission.submission_type == 'vendor_alias' %}
|
||||
<dt class="col-sm-3">Old Vendor:</dt>
|
||||
<dd class="col-sm-9">{{ submission.old_vendor }}</dd>
|
||||
<dt class="col-sm-3">New Vendor Alias:</dt>
|
||||
<dd class="col-sm-9">{{ submission.new_vendor }}</dd>
|
||||
<dt class="col-sm-3">Alias Reason:</dt>
|
||||
<dd class="col-sm-9">{{ submission.alias_reason or '—' }}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt class="col-sm-3">Notes:</dt>
|
||||
<dd class="col-sm-9">{{ submission.notes or '—' }}</dd>
|
||||
|
||||
<dt class="col-sm-3">Submitted At:</dt>
|
||||
<dd class="col-sm-9">
|
||||
{{ submission.submitted_at.strftime('%Y-%m-%d %H:%M') }}
|
||||
</dd>
|
||||
|
||||
<dt class="col-sm-3">Status:</dt>
|
||||
<dd class="col-sm-9">
|
||||
{% if submission.approved is none %}
|
||||
<span class="badge bg-warning">Pending</span>
|
||||
{% elif submission.approved %}
|
||||
<span class="badge bg-success">Approved</span>
|
||||
{% else %}
|
||||
<span class="badge bg-danger">Rejected</span>
|
||||
{% endif %}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<h4>Images</h4>
|
||||
<div class="row">
|
||||
{% if images %}
|
||||
{% for img in images %}
|
||||
{# img.file_url == "YYYY/MM/DD/<uuid>.ext" #}
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="card shadow-sm">
|
||||
<a href="{{ url_for('media.media_file', filename=img.file_url) }}" target="_blank">
|
||||
<img src="{{ url_for('media.media_file', filename=img.file_url) }}"
|
||||
class="card-img-top"
|
||||
alt="Submission Image">
|
||||
</a>
|
||||
<div class="card-body p-2">
|
||||
<p class="card-text text-center">
|
||||
<small class="text-muted">{{ img.uploaded_at.strftime('%Y-%m-%d') }}</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>No images uploaded.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mt-3">
|
||||
<a href="{{ url_for('submission.list_submissions') }}" class="btn btn-secondary">Back to List</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user