To support note deletion
This commit is contained in:
@ -302,7 +302,7 @@ function showSave() {
|
||||
/**
|
||||
* Function to discard the note by clearing all input fields and closing the menu.
|
||||
*/
|
||||
function discardNote() {
|
||||
function deleteNote(noteId, link) {
|
||||
document.querySelector('#noteTitle').value = '';
|
||||
document.querySelector('#speaker').value = 0;
|
||||
document.querySelector('#series').value = 0;
|
||||
@ -313,23 +313,26 @@ function discardNote() {
|
||||
document.querySelector('#noteDate').value = '';
|
||||
document.querySelector('#noteId').value = '';
|
||||
|
||||
fetch('/index.php/discard-note', {
|
||||
var row = link.parentElement.parentElement;
|
||||
|
||||
fetch('/index.php/delete-note', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
'id': document.querySelector('#noteId').value
|
||||
'id': noteId
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.msg == 'deleted') {
|
||||
alert('Note deleted.');
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.msg != 'deleted') {
|
||||
return;
|
||||
}
|
||||
|
||||
openRef();
|
||||
alert('Note deleted.');
|
||||
row.remove();
|
||||
});
|
||||
}
|
||||
|
||||
function newSpeaker() {
|
||||
|
2
public/js/script.min.js
vendored
2
public/js/script.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user