-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete-subject.js
More file actions
24 lines (23 loc) · 1.08 KB
/
Copy pathdelete-subject.js
File metadata and controls
24 lines (23 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// ══════════════════════════════════════════════════
// DELETE SUBJECT
// ══════════════════════════════════════════════════
function confirmDelete(stageId, id) {
const subj = state.subjects.find(s => s.id === id);
openModal('Delete Subject', `
<div class="confirm-box">
<div class="modal-title" style="text-align:center;border:none;margin-bottom:0.5rem;">Are you sure?</div>
<p class="confirm-msg">"${escHtml(subj?.name)}" will be permanently deleted from your vault.</p>
</div>
`);
setModalFooter([
{ label: 'Cancel', cls: 'btn-ghost', fn: 'closeModal()' },
{ label: 'Delete', cls: 'btn-danger', fn: `deleteSubject('${stageId}','${id}')` },
]);
}
async function deleteSubject(stageId, id) {
state.subjects = state.subjects.filter(s => s.id !== id);
await dbDelete('subjects', id);
closeModal();
toast('Subject deleted');
renderStageView(stageId);
}