Delete acqusition confirm popup
This commit is contained in:
parent
68361ac92b
commit
809d11cb49
|
|
@ -41,9 +41,24 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<div class="control">
|
||||
<a id="delete-button" class="button is-danger" {% if acquisition %}href="/acquisition/delete/{{ acquisition.id }}"{% endif %}>Supprimer l'acquisition</a>
|
||||
<button id="delete-button" class="button is-danger">Supprimer l'acquisition</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="delete-modal" class="modal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-content">
|
||||
<div class="has-text-centered mb-3">Voulez-vous vraiment supprimer l'acquisition ?</div>
|
||||
<div class="field is-grouped is-grouped-centered">
|
||||
<div class="control">
|
||||
<button class="button custom-modal-close">Annuler</a>
|
||||
</div>
|
||||
<div class="control">
|
||||
<a id="delete-link" {% if acquisition %} href="/acquisition/delete/{{ acquisition.id }}"{% endif %} class="button is-danger">Supprimer cette acquisition</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button class="modal-close is-large" aria-label="close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
|
@ -62,6 +77,18 @@
|
|||
let calibrateDiv = document.getElementById('calibrate');
|
||||
let validateButton = document.getElementById('validate-button');
|
||||
let deleteButton = document.getElementById('delete-button');
|
||||
let deleteLink = document.getElementById('delete-link');
|
||||
|
||||
let modal = document.getElementById('delete-modal');
|
||||
document.getElementById('delete-button').addEventListener('click', () => {
|
||||
modal.classList.add('is-active');
|
||||
});
|
||||
|
||||
(document.querySelectorAll('.modal-background, .modal-close, .custom-modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach((close) => {
|
||||
close.addEventListener('click', () => {
|
||||
modal.classList.remove('is-active');
|
||||
});
|
||||
});
|
||||
|
||||
// If we already have calibration images, we show them right now
|
||||
if (acquisitionId !== null) {
|
||||
|
|
@ -108,7 +135,7 @@
|
|||
if (acquisitionId === null) {
|
||||
acquisitionId = parseInt(value, 10);
|
||||
validateButton.setAttribute('href', '/acquisition/validate/' + acquisitionId);
|
||||
deleteButton.setAttribute('href', '/acquisition/delete/' + acquisitionId);
|
||||
deleteLink.setAttribute('href', '/acquisition/delete/' + acquisitionId);
|
||||
window.history.pushState('', '', '/acquisition/rescan/' + acquisitionId);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue