Fixed delete button for habits in modal
This commit is contained in:
parent
390d437578
commit
0858930786
@ -104,7 +104,7 @@
|
||||
{{ habit.note }}
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn btn-xs btn-danger rounded-circle" data-bs-toggle="modal" data-bs-target="#exampleModal" style="width: 40px; height: 40px" onclick="() => { let habitId = {{habit.id}} }">
|
||||
<button type="button" class="btn btn-xs btn-danger rounded-circle" data-bs-toggle="modal" data-bs-target="#exampleModal" style="width: 40px; height: 40px" onclick="setSelectedHabitId({{habit.id}})">
|
||||
<i class="bi bi-trash3"></i>
|
||||
</button>
|
||||
<div class="col-12">
|
||||
@ -118,20 +118,27 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var selectedHabitId = null;
|
||||
|
||||
function setSelectedHabitId(habitId) {
|
||||
selectedHabitId = habitId;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
|
||||
<h1 class="modal-title fs-5" id="exampleModalLabel">Bestätige</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
...
|
||||
Möchtest du dieses Habit wirklich löschen?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary btn-danger" onclick="deleteHabit(habitId) ">Löschen</button>
|
||||
<button type="button" class="btn btn-primary btn-danger" data-bs-dismiss="modal" onclick="deleteHabit(selectedHabitId)">Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user