Фильтр по дате ГЛ. Пока не работает
This commit is contained in:
@@ -227,6 +227,15 @@
|
||||
placeholder="До" value="{{ date_to|default:'' }}">
|
||||
</div>
|
||||
|
||||
<!-- Geo Timestamp Filter -->
|
||||
<div class="mb-2">
|
||||
<label class="form-label">Дата ГЛ:</label>
|
||||
<input type="date" name="geo_date_from" id="geo_date_from" class="form-control form-control-sm mb-1"
|
||||
placeholder="От" value="{{ geo_date_from|default:'' }}">
|
||||
<input type="date" name="geo_date_to" id="geo_date_to" class="form-control form-control-sm"
|
||||
placeholder="До" value="{{ geo_date_to|default:'' }}">
|
||||
</div>
|
||||
|
||||
<!-- Apply Filters and Reset Buttons -->
|
||||
<div class="d-grid gap-2 mt-2">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Применить</button>
|
||||
@@ -812,8 +821,25 @@ function showSourceDetails(sourceId) {
|
||||
const modal = new bootstrap.Modal(document.getElementById('sourceDetailsModal'));
|
||||
modal.show();
|
||||
|
||||
// Build URL with filter parameters
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const geoDateFrom = urlParams.get('geo_date_from');
|
||||
const geoDateTo = urlParams.get('geo_date_to');
|
||||
|
||||
let apiUrl = '/api/source/' + sourceId + '/objitems/';
|
||||
const params = new URLSearchParams();
|
||||
if (geoDateFrom) {
|
||||
params.append('geo_date_from', geoDateFrom);
|
||||
}
|
||||
if (geoDateTo) {
|
||||
params.append('geo_date_to', geoDateTo);
|
||||
}
|
||||
if (params.toString()) {
|
||||
apiUrl += '?' + params.toString();
|
||||
}
|
||||
|
||||
// Fetch data from API
|
||||
fetch('/api/source/' + sourceId + '/objitems/')
|
||||
fetch(apiUrl)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
if (response.status === 404) {
|
||||
|
||||
Reference in New Issue
Block a user