Delete modal for delete object
This commit is contained in:
parent
f6f777662e
commit
68361ac92b
|
|
@ -382,7 +382,6 @@ class ZipSender(ArchiveSender):
|
||||||
|
|
||||||
current_byte += len(bytes)
|
current_byte += len(bytes)
|
||||||
yield bytes
|
yield bytes
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
central_directory_size = 0
|
central_directory_size = 0
|
||||||
centra_directory_offset = current_byte
|
centra_directory_offset = current_byte
|
||||||
|
|
|
||||||
1
db.py
1
db.py
|
|
@ -244,7 +244,6 @@ class Object:
|
||||||
def all_by_project(db: sqlite3.Connection) -> list[Project]:
|
def all_by_project(db: sqlite3.Connection) -> list[Project]:
|
||||||
objects = [x.full(db) for x in Object.all(db)]
|
objects = [x.full(db) for x in Object.all(db)]
|
||||||
objects_by_projects = itertools.groupby(objects, lambda x: x.project)
|
objects_by_projects = itertools.groupby(objects, lambda x: x.project)
|
||||||
# print(dict(objects_by_projects))
|
|
||||||
return list(map(lambda x: Project(x[0], list(x[1])), objects_by_projects))
|
return list(map(lambda x: Project(x[0], list(x[1])), objects_by_projects))
|
||||||
|
|
||||||
def add_acquisition(self, calibration_id: int, db: sqlite3.Connection) -> Acquisition:
|
def add_acquisition(self, calibration_id: int, db: sqlite3.Connection) -> Acquisition:
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<a href="/object/delete/{{ object.id }}" class="button is-danger">Supprimer cet objet</a>
|
<span id="delete-object" class="button is-danger">Supprimer cet objet</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -64,25 +64,49 @@
|
||||||
<button class="modal-close is-large" aria-label="close"></button>
|
<button class="modal-close is-large" aria-label="close"></button>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<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'objet ?</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 href="/object/delete/{{ object.id }}" class="button is-danger">Supprimer cet objet</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="modal-close is-large" aria-label="close"></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block extrajs %}{% if calibration.state < CalibrationState.IsValidated %}
|
{% block extrajs %}{% if calibration.state < CalibrationState.IsValidated %}
|
||||||
<script>
|
<script>
|
||||||
let modal = document.getElementById('calibration-modal');
|
|
||||||
document.getElementById('scan').addEventListener('click', () => {
|
document.getElementById('scan').addEventListener('click', () => {
|
||||||
|
let modal = document.getElementById('calibration-modal');
|
||||||
modal.classList.add('is-active');
|
modal.classList.add('is-active');
|
||||||
});
|
});
|
||||||
(document.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach((close) => {
|
|
||||||
close.addEventListener('click', () => {
|
document.getElementById('delete-object').addEventListener('click', () => {
|
||||||
modal.classList.remove('is-active');
|
let modal = document.getElementById('delete-modal');
|
||||||
});
|
modal.classList.add('is-active');
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('use-last-calibration-button').addEventListener('click', async () => {
|
document.getElementById('use-last-calibration-button').addEventListener('click', async () => {
|
||||||
let resp = await fetch('/api/use-last-calibration');
|
let resp = await fetch('/api/use-last-calibration');
|
||||||
await resp.text();
|
await resp.text();
|
||||||
window.location.href = '/scan/{{ object.id }}';
|
window.location.href = '/scan/{{ object.id }}';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(document.querySelectorAll('.modal-background, .modal-close, .custom-modal-close, .modal-card-head .delete, .modal-card-foot .button') || []).forEach((close) => {
|
||||||
|
close.addEventListener('click', () => {
|
||||||
|
for (let modal of document.querySelectorAll('#calibration-modal, #delete-modal')) {
|
||||||
|
modal.classList.remove('is-active');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endif %}{% endblock %}
|
{% endif %}{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue