demarches-normaliennes/app/javascript/new_design/instruction-button.js

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-10-09 11:43:51 +02:00
import { show, hide } from '@utils';
2018-08-09 11:53:59 +02:00
export function showMotivation(event, state) {
event.preventDefault();
motivationCancel();
2023-02-28 10:49:50 +01:00
const stateElement = document.querySelector(`.motivation.${state}`);
show(stateElement.parentElement);
show(stateElement);
2018-10-09 11:43:51 +02:00
hide(document.querySelector('.dropdown-items'));
}
export function motivationCancel() {
2018-10-09 11:43:51 +02:00
document.querySelectorAll('.motivation').forEach(hide);
2023-02-28 10:49:50 +01:00
document
.querySelectorAll('.motivation')
.forEach((el) => hide(el.parentElement));
2018-10-09 11:43:51 +02:00
show(document.querySelector('.dropdown-items'));
document.querySelectorAll('.js_delete_motivation').forEach(hide);
}
2023-03-29 10:26:03 +02:00
export function motivationCancelBatchDropdown() {
2023-03-27 17:26:53 +02:00
document.querySelector('#dropdown_batch').classList.remove('open');
hide(document.querySelector('.js_delete_motivation'));
}
export function showDeleteJustificatif(name) {
2023-03-27 17:26:53 +02:00
const justificatif = document.querySelector(
'#dossier_justificatif_motivation_' + name
);
2023-03-27 17:45:06 +02:00
if (justificatif.value != '') {
show(document.querySelector('#delete_motivation_import_' + name));
2023-03-27 17:45:06 +02:00
document.querySelector('#delete_motivation_import_' + name);
}
}
export function deleteJustificatif(name) {
2023-03-27 17:26:53 +02:00
const justificatif = document.querySelector(
'#dossier_justificatif_motivation_' + name
);
justificatif.value = '';
hide(document.querySelector('#delete_motivation_import_' + name));
}
export function showImportJustificatif(name) {
show(document.querySelector('#justificatif_motivation_import_' + name));
hide(document.querySelector('#justificatif_motivation_suggest_' + name));
}