<label for="condition">Condition:</label>
<select id="condition" name="condition">
{% for cond in ['all','new','used','refurbished','opened'] %}
<option value="{{cond}}" {% if request.form.condition==cond %}selected{% endif %}>{{cond.title()}}</option>
{% endfor %}
</select>
<label>
<input type="checkbox" name="strict" {% if request.form.get('strict') %}checked{% endif %}>
Strict match (all query words must be in title)
</label>
<button type="submit">Find Value</button>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>eBay Value Finder</title>
<style>
/* General Styles */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 600px;
margin: 2em auto;
line-height: 1.6;
color: #333;
background-color: #f9f9f9;
padding: 1em;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #2c3e50;
margin-bottom: 1.5em;
}
label {
display: block;
margin-top: 1em;
font-weight: bold;
color: #34495e;
}
input, select, button {
padding: 0.75em;
margin-top: 0.5em;
width: 100%;
border: 1px solid #bdc3c7;
border-radius: 4px;
transition: border-color 0.3s ease;
}
input:focus, select:focus, button:focus {
outline: none;
border-color: #3498db;
box-shadow: 0 0 4px rgba(52, 152, 219, 0.5);
}
button {
background-color: #3498db;
color: white;
font-weight: bold;
cursor: pointer;
border: none;
}
button:hover {
background-color: #2980b9;
}
.error {
color: #e74c3c;
margin-top: 1em;
text-align: center;
}
.results {
margin-top: 2em;
background-color: #ecf0f1;
padding: 1em;
border-radius: 4px;
}
.results h2 {
margin-top: 0;
color: #2c3e50;
}
.results ul {
list-style: none;
padding: 0;
}
.results li {
margin-bottom: 0.5em;
font-size: 1em;
color: #34495e;
}
.results a {
color: #3498db;
text-decoration: none;
font-weight: bold;
}
.results a:hover {
text-decoration: underline;
}
/* Responsive Design */
@media (max-width: 600px) {
body {
padding: 0.5em;
}
input, select, button {
padding: 0.5em;
}
}
</style>
</head>
<body>
<h1>eBay Value Finder</h1>
<form method="post">
<label for="item">Item to search:</label>
<input type="text" id="item" name="item" required value="{{ request.form.item }}" placeholder="Enter item name">
<label for="condition">Condition:</label>
<select id="condition" name="condition">
{% for cond in ['all','new','used','refurbished','opened'] %}
<option value="{{cond}}" {% if request.form.condition==cond %}selected{% endif %}>{{cond.title()}}</option>
{% endfor %}
</select>
<label>
<input type="checkbox" name="strict" {% if request.form.get('strict') %}checked{% endif %}>
Strict match (all query words must be in title)
</label>
<button type="submit">Find Value</button>
</form>
{% if error %}
<p class="error">{{ error }}</p>
{% endif %}
{% if results %}
<div class="results">
<h2>Sold Listings (max 150):</h2>
<ul>
<li><strong>Average price:</strong> ${{ results.avg.price }}</li>
<li><strong>Average shipping:</strong> ${{ results.avg.shipping }}</li>
<li><strong>Total average:</strong> ${{ results.avg.total }}</li>
<li><strong>Count:</strong> {{ results.avg.count }}</li>
</ul>
<h2>Active Listings:</h2>
{% if results.listing %}
<p><strong>Cheapest active listing:</strong> ${{ results.listing.price }} + ${{ results.listing.shipping }} shipping</p>
<p><strong>Title:</strong> {{ results.listing.title }}</p>
<p><a href="{{ results.listing.url.split('?')[0] }}" target="_blank">View on eBay</a></p>
<p><strong>There are {{ results.same_count }} listings at this price.</strong></p>
{% else %}
<p>No active "Buy It Now" listings found.</p>
{% endif %}
</div>
{% endif %}
</body>
</html>