change place event

This commit is contained in:
Valentin CZERYBA 2023-11-12 21:34:07 +01:00
parent ce3c896947
commit 1fdc469cea
3 changed files with 21 additions and 14 deletions

View File

@ -27,6 +27,7 @@
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<style>
.bd-placeholder-img {
font-size: 1.125rem;

View File

@ -9,10 +9,7 @@
<title>Dashboard Template · Bootstrap v5.2</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/dashboard/">
<link rel="stylesheet" href="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.css" type="text/css">
<link href="../css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
@ -25,6 +22,8 @@
<link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon.ico">
<meta name="theme-color" content="#712cf9">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://api.mapbox.com/mapbox-gl-js/v2.14.1/mapbox-gl.js"></script>
<script src="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v5.0.0/mapbox-gl-geocoder.min.js"></script>
<style>
@ -193,7 +192,7 @@
<div class="input-group mb-3">
<span class="input-group-text" id="placeUpdate">Lieu</span>
<input id="placeUpdateInput" type="text" class="form-control" placeholder="Lieu" aria-label="Lieu" aria-describedby="placeUpdate">
<div id="placeUpdateInput"></div>
</div>
<div class="input-group mb-3">
@ -275,7 +274,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Voulez-vous désactiver l'utilisateur ?
Voulez-vous désactiver l'évènement ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
@ -293,7 +292,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
Etes-vous sûr de supprimer l'utilisateur ?
Etes-vous sûr de supprimer l'évènement ?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button>
@ -350,5 +349,6 @@
<script src="../js/config.js"></script>
<script src="../js/library.js"></script>
<script src="../js/geosearch.js"></script>
<script src="../js/item.js"></script>
</body></html>

View File

@ -22,7 +22,11 @@ if(id.length > 0){
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"];
for (var i=0; i<listValue.length; i++){
if(response.data[listValue[i]] != null){
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
if(listValue[i] == "place"){
document.getElementsByClassName("mapboxgl-ctrl-geocoder--input")[0].value = response.data[listValue[i]];
} else {
document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
}
}
}
@ -128,7 +132,12 @@ if(id.length > 0){
}
var updateOk = true;
for (var i=0; i<updateProfil.length; i++){
if(document.getElementById(updateProfil[i]+"UpdateInput").value.length == 0){
if (updateProfil[i] == "place"){
size = document.getElementsByClassName("mapboxgl-ctrl-geocoder--input")[0].value.length;
} else {
size = document.getElementById(updateProfil[i]+"UpdateInput").value.length;
}
if(size == 0){
updateOk = false;
document.getElementById(updateProfil[i]+"Alert").classList.remove("hidden");
}
@ -161,23 +170,20 @@ if(id.length > 0){
"deleted_at": "",
"disabled_at":"",
"connected_at": ""
};
break;
case "event":
dataPut = {
"id": document.getElementById("idUpdateInput").value,
"name": document.getElementById("nameUpdateInput").value,
"place": document.getElementById("placeUpdateInput").value,
"place": document.getElementsByClassName("mapboxgl-ctrl-geocoder--input")[0].value,
"start_date": document.getElementById("start_dateUpdateInput").value,
"end_date": document.getElementById("end_dateUpdateInput").value,
"status": selector["status"],
"created_at": "",
"updated_at": "",
"deleted_at": "",
"disabled_at":"",
"connected_at": ""
"disabled_at":"",
};
break;
default: