This commit is contained in:
arussac
2025-03-10 14:20:16 +01:00
parent bfd77bc843
commit f17e4d330c
2 changed files with 61 additions and 1 deletions

View File

@@ -32,6 +32,22 @@ document.addEventListener("DOMContentLoaded", async () => {
populateTimelapseLogic(start_timelapse, projectId).then( () => {
document.getElementById('show-form-button-camera').addEventListener('click', showFormCamera)
document.getElementById('close-form-button-camera').addEventListener('click', hideFormCamera)
if(document.getElementById('commencer') != null){
document.getElementById('commencer').addEventListener('click', async () => {
const days = document.getElementById('days').value;
const hours = document.getElementById('hours').value;
const minutes = document.getElementById('minutes').value;
const seconds = document.getElementById('seconds').value;
const frequency = days * 86400 + hours * 3600 + minutes * 60 + seconds;
console.log(frequency)
await start_timelapse(projectId, frequency)
})
}
if(document.getElementById('stop-camera') != null){
document.getElementById('stop-camera').addEventListener('click', async () => {
await stopCamera(projectId)
})
}
}
)
@@ -401,7 +417,11 @@ async function populateTimelapseLogic(placeholder,id) {
placeholder.innerHTML = `<button class="btn btn-primary" id="show-form-button-camera">
<span> Configurer la caméra </span>
</button>`
} else {
} else if (data.status == 1) {
placeholder.innerHTML = `<button class="btn btn-danger" id="stop-camera">
<span> Stopper la prise d'images </span>
</button>`}
else {
placeholder.innerHTML = ``
}
}