1 |
cd67c936
|
Anděl Ondřej
|
<div id="remove-modal" class="modal fade" role="dialog">
|
2 |
|
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
3 |
|
|
<div class="modal-content">
|
4 |
|
|
<div class="modal-header">
|
5 |
|
|
<h4 class="modal-title">Potvrdit odstranění</h4>
|
6 |
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
7 |
|
|
</div>
|
8 |
|
|
<div class="modal-body">
|
9 |
|
|
<div class="container">
|
10 |
|
|
<div class="row">
|
11 |
|
|
<p id="mesBody"></p>
|
12 |
|
|
</div>
|
13 |
|
|
</div>
|
14 |
|
|
</div>
|
15 |
|
|
<div class="modal-footer">
|
16 |
|
|
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="removeChange(document.getElementById('idToRemoveInput').value)">Ano</button>
|
17 |
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Ne</button>
|
18 |
|
|
<input type="hidden" id="idToRemoveInput" />
|
19 |
|
|
</div>
|
20 |
|
|
</div>
|
21 |
|
|
</div>
|
22 |
|
|
</div>
|
23 |
|
|
|
24 |
|
|
<script>
|
25 |
|
|
$('#remove-modal').on('show.bs.modal', function (event){ //wait for modal to show
|
26 |
|
|
const button = $(event.relatedTarget);
|
27 |
|
|
const pseudo_id = button.data('pseudo-id');//Extract info from data-* attributes
|
28 |
|
|
|
29 |
|
|
const data_obj = changes[pseudo_id];
|
30 |
|
|
let modal = $(this);
|
31 |
|
|
console.log(data_obj);
|
32 |
|
|
modal.find('#mesBody').text("Opravdu chcete odstranit návrh změny?");
|
33 |
|
|
modal.find('#idToRemoveInput').val(data_obj.changeid); //assign id to delete to hidden input
|
34 |
|
|
});
|
35 |
|
|
|
36 |
|
|
function removeChange(id){
|
37 |
|
|
const data = new FormData(); //to pass ids, which we want to delete from DB
|
38 |
|
|
data.append("requestId", ""+id); //id to delete from table dd_wordform
|
39 |
|
|
|
40 |
|
|
let xhr = new XMLHttpRequest();
|
41 |
|
|
xhr.open("POST", "./controller/RemoveChangeRequest.php");
|
42 |
|
|
xhr.send(data);
|
43 |
|
|
setTimeout(function(){
|
44 |
|
|
fetchChanges(); //reload data after item delete
|
45 |
|
|
}, 500);
|
46 |
|
|
}
|
47 |
|
|
</script>
|