Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f669733c29 | ||
|
|
62439c0e90 | ||
|
|
73b9b199fd | ||
| 3927e2f857 | |||
| c9579f6346 | |||
| c43e8d53f7 | |||
|
|
2dae04098d | ||
| 2097bbfaec |
BIN
app-release.apk
Normal file
BIN
app-release.apk
Normal file
Binary file not shown.
@@ -2,6 +2,7 @@
|
|||||||
float: left;
|
float: left;
|
||||||
display: inline;
|
display: inline;
|
||||||
width: 49%;
|
width: 49%;
|
||||||
|
margin-bottom: 5vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.picture_placeHolder {
|
.picture_placeHolder {
|
||||||
@@ -177,3 +178,11 @@
|
|||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.video {
|
||||||
|
margin-bottom: 2vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#content1 {
|
||||||
|
margin-bottom: 5vh;
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="body">
|
<body id="body">
|
||||||
<button class="default-button" id="download"><span>Télécharger l'App</span></button>
|
<a id="app" href="./app-release.apk"><button class="default-button" id="download" ><span>Télécharger l'App</span></button></a>
|
||||||
<button class="default-button" id="show-form-button"><span>Ajouter un projet</span></button>
|
<button class="default-button" id="show-form-button"><span>Ajouter un projet</span></button>
|
||||||
<div id="customAlert" class="modal">
|
<div id="customAlert" class="modal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Global variables
|
// Global variables
|
||||||
let global_project_list;
|
let global_project_list;
|
||||||
let current_project = "";
|
let current_project = "";
|
||||||
|
let active_camera_project = null; // ID du projet actuellement utilisé par la caméra
|
||||||
|
|
||||||
function formatDate(isoString) {
|
function formatDate(isoString) {
|
||||||
const date = new Date(isoString);
|
const date = new Date(isoString);
|
||||||
@@ -184,11 +185,27 @@ async function renderVideo(id){
|
|||||||
|
|
||||||
async function start_timelapse(id,frequency,nbimages){
|
async function start_timelapse(id,frequency,nbimages){
|
||||||
try {
|
try {
|
||||||
|
// Vérifier si un autre projet est déjà actif avec la caméra
|
||||||
|
if (active_camera_project !== null && active_camera_project !== id) {
|
||||||
|
const confirmation = confirm(`Un autre projet (ID: ${active_camera_project}) est déjà en cours avec la caméra. Voulez-vous arrêter ce projet et configurer la caméra pour le projet actuel?`);
|
||||||
|
if (!confirmation) {
|
||||||
|
alert("Configuration annulée. La caméra reste configurée pour le projet précédent.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Si l'utilisateur confirme, on continue et on va redéfinir active_camera_project
|
||||||
|
}
|
||||||
|
|
||||||
|
// Utilisation de plusieurs formats possibles pour garantir que le backend reçoit l'ID
|
||||||
const mydata = JSON.stringify({
|
const mydata = JSON.stringify({
|
||||||
projectId: id,
|
project_id: id, // Format avec underscore (convention standard REST)
|
||||||
|
projectId: id, // Format camelCase
|
||||||
|
id: id, // Format simple
|
||||||
interval: frequency,
|
interval: frequency,
|
||||||
nb_images: nbimages
|
nb_images: nbimages
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("Données envoyées à /procedure/start:", mydata); // Log pour débogage
|
||||||
|
|
||||||
const response = await $.ajax({
|
const response = await $.ajax({
|
||||||
url: api_url.concat(`/procedure/start`),
|
url: api_url.concat(`/procedure/start`),
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -197,9 +214,13 @@ async function start_timelapse(id,frequency,nbimages){
|
|||||||
data: mydata
|
data: mydata
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Définir ce projet comme le projet actif pour la caméra
|
||||||
|
active_camera_project = id;
|
||||||
|
|
||||||
alert("Configuration de la caméra réussie");
|
alert("Configuration de la caméra réussie");
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error("Erreur détaillée:", error); // Log plus détaillé de l'erreur
|
||||||
alert("Erreur lors de la configuration de la caméra: " + error);
|
alert("Erreur lors de la configuration de la caméra: " + error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
@@ -218,6 +239,9 @@ async function stopCamera(id){
|
|||||||
data: mydata
|
data: mydata
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Réinitialiser le statut du projet actif sur la caméra
|
||||||
|
active_camera_project = null;
|
||||||
|
|
||||||
alert("La caméra a été arrêtée avec succès");
|
alert("La caméra a été arrêtée avec succès");
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -228,6 +252,17 @@ async function stopCamera(id){
|
|||||||
|
|
||||||
async function manualUpload(imageFile, projectId, timestamp, temperature, humidity) {
|
async function manualUpload(imageFile, projectId, timestamp, temperature, humidity) {
|
||||||
try {
|
try {
|
||||||
|
// Vérifier que l'upload est fait pour le projet actif de la caméra
|
||||||
|
if (active_camera_project === null) {
|
||||||
|
alert("Aucun projet n'est actif avec la caméra. Veuillez configurer un projet avant d'effectuer un upload manuel.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (projectId !== active_camera_project) {
|
||||||
|
alert(`L'upload manuel n'est possible que pour le projet actif (ID: ${active_camera_project}). Vous essayez d'uploader pour le projet ${projectId}.`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Create FormData to send the file and metadata
|
// Create FormData to send the file and metadata
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append('image', imageFile);
|
formData.append('image', imageFile);
|
||||||
@@ -244,10 +279,10 @@ async function manualUpload(imageFile, projectId, timestamp, temperature, humidi
|
|||||||
contentType: false, // Lets browser set the content type with boundary
|
contentType: false, // Lets browser set the content type with boundary
|
||||||
});
|
});
|
||||||
|
|
||||||
alert("Image uploaded successfully");
|
alert("Image téléchargée avec succès");
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
alert("Error uploading image: " + error);
|
alert("Erreur lors du téléchargement de l'image : " + error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ function setupCarousel(global_project_list) {
|
|||||||
projectDiv.classList.add(letter[index]);
|
projectDiv.classList.add(letter[index]);
|
||||||
projectDiv.innerHTML = `
|
projectDiv.innerHTML = `
|
||||||
<h2>${project.name}</h2>
|
<h2>${project.name}</h2>
|
||||||
|
<p class="project-description" style="font-size: 0.8em; font-style: italic; margin-top: -5px; margin-bottom: 10px;">${project.description || 'Pas de description'}</p>
|
||||||
<p><strong>Date de début :</strong> ${formatDateToFrench(project.start_date)}</p>
|
<p><strong>Date de début :</strong> ${formatDateToFrench(project.start_date)}</p>
|
||||||
<p><strong>Statut :</strong> ${formatStatusWithColor(parseInt(project.status))}</p>
|
<p><strong>Statut :</strong> ${formatStatusWithColor(parseInt(project.status))}</p>
|
||||||
<div class="project_buttons">
|
<div class="project_buttons">
|
||||||
@@ -223,6 +224,7 @@ window.addEventListener('DOMContentLoaded', (event) => {
|
|||||||
child.style.display = 'none';
|
child.style.display = 'none';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
document.getElementById('app').style.display = 'block';
|
||||||
const newH1 = document.createElement('h1');
|
const newH1 = document.createElement('h1');
|
||||||
newH1.textContent = "Caméra Timelapse sur mobile, utilisez l'app !!!";
|
newH1.textContent = "Caméra Timelapse sur mobile, utilisez l'app !!!";
|
||||||
newH1.classList.add('global_title_h1');
|
newH1.classList.add('global_title_h1');
|
||||||
|
|||||||
Reference in New Issue
Block a user