auction-scrapper/resources/views/auctions/list.edge
Vakula Uladimir 12f005e335 init
2025-10-17 11:27:52 +03:00

176 lines
8.0 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Auctions - Last 3 Days</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
.table-container {
overflow-x: auto;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8">
<div class="bg-white rounded-lg shadow-md p-6">
<div class="mb-6">
<h1 class="text-3xl font-bold text-gray-800">Auctions - Last 3 Days</h1>
<p class="text-gray-600 mt-2">Total auctions: {{ auctions.length }}</p>
<p class="text-gray-500 text-sm">From: {{ fromDate }}</p>
</div>
{{-- Flash messages --}}
@if(flashMessages.has('success'))
<div class="mb-6 bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded-lg" role="alert">
<div class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
<span>{{ flashMessages.get('success') }}</span>
</div>
</div>
@end
@if(flashMessages.has('error'))
<div class="mb-6 bg-red-50 border border-red-200 text-red-800 px-4 py-3 rounded-lg" role="alert">
<div class="flex items-center">
<svg class="w-5 h-5 mr-2" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/>
</svg>
<span>{{ flashMessages.get('error') }}</span>
</div>
</div>
@end
{{-- Parsing form --}}
<div class="mb-8 bg-blue-50 border border-blue-200 rounded-lg p-6">
<h2 class="text-xl font-semibold text-gray-800 mb-4">Parse New Auctions</h2>
<form id="parseForm" method="POST" action="/trigger-parse" class="space-y-4">
{{ csrfField() }}
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="pages" class="block text-sm font-medium text-gray-700 mb-2">
Number of pages to parse
</label>
<input
type="number"
id="pages"
name="pages"
min="1"
max="10"
value="1"
required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
/>
<p class="mt-1 text-xs text-gray-500">Min: 1, Max: 10 pages</p>
</div>
<div class="flex items-center">
<div class="flex items-center h-full">
<input
type="checkbox"
id="notifySubscribers"
name="notifySubscribers"
checked
class="w-5 h-5 text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500"
/>
<label for="notifySubscribers" class="ml-3 text-sm font-medium text-gray-700">
Notify subscribers about new auctions
</label>
</div>
</div>
</div>
<div class="flex items-center gap-4">
<button
type="submit"
id="submitBtn"
class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors duration-150 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
>
Start Parsing
</button>
<div id="loadingIndicator" class="hidden flex items-center text-blue-600">
<svg class="animate-spin h-5 w-5 mr-2" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<span class="font-medium">Parsing in progress...</span>
</div>
</div>
</form>
</div>
<script>
document.getElementById('parseForm').addEventListener('submit', function() {
document.getElementById('submitBtn').disabled = true;
document.getElementById('loadingIndicator').classList.remove('hidden');
});
</script>
@if(auctions.length === 0)
<div class="text-center py-12">
<p class="text-gray-500 text-lg">No auctions found in the last 3 days.</p>
</div>
@else
<div class="table-container">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-100">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">
Auction Number
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">
Title
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">
Description
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">
Start Price
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-700 uppercase tracking-wider">
Created Date
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
@each(auction in auctions)
<tr class="hover:bg-gray-50 transition-colors duration-150">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-blue-600">
{{ auction.auctionNum }}
</td>
<td class="px-6 py-4 text-sm text-gray-900">
<div class="max-w-md">
{{ auction.title || 'N/A' }}
</div>
</td>
<td class="px-6 py-4 text-sm text-gray-700">
<div class="max-w-lg line-clamp-3">
{{ auction.description ? (auction.description.length > 150 ? auction.description.substring(0, 150) + '...' : auction.description) : 'N/A' }}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900 font-semibold">
@if(auction.startPrice)
{{ new Intl.NumberFormat('ru-BY', { style: 'currency', currency: 'BYN' }).format(auction.startPrice) }}
@else
<span class="text-gray-400">N/A</span>
@end
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">
{{ auction.createdAt.toFormat('dd.MM.yyyy HH:mm') }}
</td>
</tr>
@end
</tbody>
</table>
</div>
@end
</div>
</div>
</body>
</html>