Skip to content

Commit

Permalink
all logic complete
Browse files Browse the repository at this point in the history
  • Loading branch information
u5ele55 committed Dec 11, 2024
1 parent 830469d commit 3f2e809
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
9 changes: 4 additions & 5 deletions frontend/admin_panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ <h1>Администрирование</h1>
downloadObjectAsJson(body, 'data');
}));
}

function showFiles(input) {
const file = input.files[0];
console.log(file);
Expand All @@ -72,16 +72,15 @@ <h1>Администрирование</h1>
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
data: e.target.result
})
body:
e.target.result
})
.then((resp) => resp.json().then((body) => {
console.log(body);
}));

};
reader.readAsDataURL(file);
reader.readAsText(file);
}
</script>
</body>
Expand Down
29 changes: 2 additions & 27 deletions frontend/statistics.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ <h2 class="mb-4">Статистика</h2>
</div>
</div>

<div class="form-row">
<div class="col doubled">
<input name="longitude_from" type="number" class="form-control" placeholder="Долгота, от">
<input name="longitude_to" type="number" class="form-control" placeholder="Долгота, до">
</div>
<div class="col doubled">
<input name="latitude_from" type="number" class="form-control" placeholder="Широта, от">
<input name="latitude_to" type="number" class="form-control" placeholder="Широта, до">
</div>
</div>

</form>

<div class="mt-4">
Expand Down Expand Up @@ -95,33 +84,19 @@ <h2 class="mb-4">Статистика</h2>
const visit_date_min = document.querySelector("input[name='visit_date_min']").value;
const visit_date_max = document.querySelector("input[name='visit_date_max']").value;

const longitude_from = document.querySelector("input[name='longitude_from']").value;
const longitude_to = document.querySelector("input[name='longitude_to']").value;

const latitude_from = document.querySelector("input[name='latitude_from']").value;
const latitude_to = document.querySelector("input[name='latitude_to']").value;

let params = {};
if (address)
params.address = address;
if (title)
params.title = title;
if (rating_from)
params.rating_from = rating_from;
params.courtyard_rating_from = rating_from;
if (rating_to)
params.rating_to = rating_to;
params.courtyard_rating_to = rating_to;
if (visit_date_min)
params.visited_from = visit_date_min;
if (visit_date_max)
params.visited_to = visit_date_max;
if (longitude_from)
params.longitude_from = longitude_from;
if (longitude_to)
params.longitude_to = longitude_to;
if (latitude_from)
params.latitude_from = latitude_from;
if (latitude_to)
params.latitude_to = latitude_to;

fetch(`http://localhost:8081/statistic/visits?` + new URLSearchParams(params).toString(), {
method: 'GET',
Expand Down

0 comments on commit 3f2e809

Please sign in to comment.