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> <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<style> <style>
.bd-placeholder-img { .bd-placeholder-img {
font-size: 1.125rem; font-size: 1.125rem;

View File

@ -9,10 +9,7 @@
<title>Dashboard Template · Bootstrap v5.2</title> <title>Dashboard Template · Bootstrap v5.2</title>
<link rel="canonical" href="https://getbootstrap.com/docs/5.2/examples/dashboard/"> <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"> <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"> <link rel="icon" href="https://getbootstrap.com/docs/5.2/assets/img/favicons/favicon.ico">
<meta name="theme-color" content="#712cf9"> <meta name="theme-color" content="#712cf9">
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> <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> <style>
@ -193,7 +192,7 @@
<div class="input-group mb-3"> <div class="input-group mb-3">
<span class="input-group-text" id="placeUpdate">Lieu</span> <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>
<div class="input-group mb-3"> <div class="input-group mb-3">
@ -275,7 +274,7 @@
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
Voulez-vous désactiver l'utilisateur ? Voulez-vous désactiver l'évènement ?
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button> <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> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
Etes-vous sûr de supprimer l'utilisateur ? Etes-vous sûr de supprimer l'évènement ?
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Fermer</button> <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/config.js"></script>
<script src="../js/library.js"></script> <script src="../js/library.js"></script>
<script src="../js/geosearch.js"></script>
<script src="../js/item.js"></script> <script src="../js/item.js"></script>
</body></html> </body></html>

View File

@ -22,9 +22,13 @@ if(id.length > 0){
var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"]; var listTime = ["connected_at", "created_at", "updated_at", "deleted_at", "disabled_at"];
for (var i=0; i<listValue.length; i++){ for (var i=0; i<listValue.length; i++){
if(response.data[listValue[i]] != null){ if(response.data[listValue[i]] != null){
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]]; document.getElementById(listValue[i]+"UpdateInput").value=response.data[listValue[i]];
} }
} }
}
for (var i=0; i<listTime.length; i++){ for (var i=0; i<listTime.length; i++){
if(response.data[listTime[i]] != null){ if(response.data[listTime[i]] != null){
@ -128,7 +132,12 @@ if(id.length > 0){
} }
var updateOk = true; var updateOk = true;
for (var i=0; i<updateProfil.length; i++){ 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; updateOk = false;
document.getElementById(updateProfil[i]+"Alert").classList.remove("hidden"); document.getElementById(updateProfil[i]+"Alert").classList.remove("hidden");
} }
@ -161,14 +170,13 @@ if(id.length > 0){
"deleted_at": "", "deleted_at": "",
"disabled_at":"", "disabled_at":"",
"connected_at": "" "connected_at": ""
}; };
break; break;
case "event": case "event":
dataPut = { dataPut = {
"id": document.getElementById("idUpdateInput").value, "id": document.getElementById("idUpdateInput").value,
"name": document.getElementById("nameUpdateInput").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, "start_date": document.getElementById("start_dateUpdateInput").value,
"end_date": document.getElementById("end_dateUpdateInput").value, "end_date": document.getElementById("end_dateUpdateInput").value,
"status": selector["status"], "status": selector["status"],
@ -176,8 +184,6 @@ if(id.length > 0){
"updated_at": "", "updated_at": "",
"deleted_at": "", "deleted_at": "",
"disabled_at":"", "disabled_at":"",
"connected_at": ""
}; };
break; break;
default: default: