anto
This commit is contained in:
@@ -5,9 +5,6 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
const data = await getAllProject();
|
const data = await getAllProject();
|
||||||
const DataMetrics = await getDataMetrics(projectId);
|
const DataMetrics = await getDataMetrics(projectId);
|
||||||
|
|
||||||
console.log(projectId);
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
const project = data.find(project => project.id == projectId);
|
const project = data.find(project => project.id == projectId);
|
||||||
if (project) {
|
if (project) {
|
||||||
document.getElementById("name_project").innerHTML = project.name;
|
document.getElementById("name_project").innerHTML = project.name;
|
||||||
@@ -41,9 +38,15 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
document.getElementById("projets").addEventListener("click", navigateToProjects);
|
document.getElementById("projets").addEventListener("click", navigateToProjects);
|
||||||
document.getElementById("toggle-view").addEventListener("click", toggleView);
|
document.getElementById("toggle-view").addEventListener("click", toggleView);
|
||||||
|
|
||||||
|
// Add event listeners for the "Début" and "Fin" input fields
|
||||||
|
const firstInput = document.getElementById('first');
|
||||||
|
const lastInput = document.getElementById('last');
|
||||||
|
|
||||||
|
firstInput.addEventListener('input', updateRange);
|
||||||
|
lastInput.addEventListener('input', updateRange);
|
||||||
|
|
||||||
generateViewMetric(projectId);
|
generateViewMetric(projectId);
|
||||||
PopulateSelect(videoSelector, projectId);
|
PopulateSelect(videoSelector, projectId);
|
||||||
populateImageTable(DataMetrics);
|
|
||||||
|
|
||||||
function toggleContainers() {
|
function toggleContainers() {
|
||||||
if (choiceSelect.value === 'oneByOne') {
|
if (choiceSelect.value === 'oneByOne') {
|
||||||
@@ -161,6 +164,21 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||||||
function highlightNumber(button) {
|
function highlightNumber(button) {
|
||||||
button.classList.toggle('highlight');
|
button.classList.toggle('highlight');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRange() {
|
||||||
|
const firstValue = parseInt(firstInput.value);
|
||||||
|
const lastValue = parseInt(lastInput.value);
|
||||||
|
|
||||||
|
if (firstValue > lastValue) {
|
||||||
|
lastInput.value = firstValue;
|
||||||
|
}
|
||||||
|
if (lastValue < firstValue) {
|
||||||
|
firstInput.value = lastValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstInput.max = lastValue;
|
||||||
|
lastInput.min = firstValue;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function populateImageTable(DataMetrics) {
|
function populateImageTable(DataMetrics) {
|
||||||
@@ -172,6 +190,7 @@ function populateImageTable(DataMetrics) {
|
|||||||
let i = 0;
|
let i = 0;
|
||||||
DataMetrics.forEach((measure) => {
|
DataMetrics.forEach((measure) => {
|
||||||
let imageTD = document.createElement("td");
|
let imageTD = document.createElement("td");
|
||||||
|
console.log(`${api_url}/images/${measure.project_id}/${measure.order_id}`)
|
||||||
imageTD.innerHTML = `<img id="${i}" src="${api_url}/images/${measure.project_id}/${measure.order_id}"/>`;
|
imageTD.innerHTML = `<img id="${i}" src="${api_url}/images/${measure.project_id}/${measure.order_id}"/>`;
|
||||||
row.appendChild(imageTD);
|
row.appendChild(imageTD);
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ function getDataMetrics(projectId){
|
|||||||
}).then((data) => {
|
}).then((data) => {
|
||||||
// If the request is successful, store the data in the cache and return it
|
// If the request is successful, store the data in the cache and return it
|
||||||
localStorage.setItem("project_list", JSON.stringify(data));
|
localStorage.setItem("project_list", JSON.stringify(data));
|
||||||
console.log(data);
|
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -73,6 +72,16 @@ async function getDataVideoFromApi(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function postNewVideo(project_id, measurements_id, name_video, resolution, duration, fps, status){
|
async function postNewVideo(project_id, measurements_id, name_video, resolution, duration){
|
||||||
|
try {
|
||||||
|
const response = await $.ajax({
|
||||||
|
url: api_url.concat(`/videos/`),
|
||||||
|
method: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
});
|
||||||
|
// If the request is successful, store the data in the cache and return it
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching data:", error);
|
||||||
|
throw error; // Re-throw the error to handle it outside the function if needed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user