Réorganisation formulaire ajout immobilisation
This commit is contained in:
parent
9f8660a51f
commit
1aa1e65b61
2 changed files with 42 additions and 15 deletions
25
scripts.js
25
scripts.js
|
|
@ -4,10 +4,22 @@ function toggleInputs(idcb, idfields) {
|
|||
for (let id of idfields) {
|
||||
const field = document.getElementById(id);
|
||||
if (noamort.checked) {
|
||||
field.setAttribute("disabled","disabled");
|
||||
field.removeAttribute("disabled");
|
||||
}
|
||||
else {
|
||||
field.removeAttribute("disabled");
|
||||
field.setAttribute("disabled","disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function toggleVisibility(idcheck, fields) {
|
||||
const amortcb = document.getElementById(idcheck);
|
||||
for (let id of fields) {
|
||||
const field = document.getElementById(id);
|
||||
if (amortcb.checked) {
|
||||
field.setAttribute('class', '');
|
||||
} else {
|
||||
field.setAttribute('class', 'hidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,7 +49,7 @@ function getDate(idelem) {
|
|||
return str2sec(document.getElementById(idelem).value);
|
||||
}
|
||||
|
||||
// désactiver les options du sélecteur qui ne sont pas dans un tableau de valeurs
|
||||
// (unused) désactiver les options du sélecteur qui ne sont pas dans un tableau de valeurs
|
||||
function disableOptions(idSelect, init, values) {
|
||||
for (let i = init; i < idSelect.options.length; ++i) {
|
||||
const choix = idSelect.options[i];
|
||||
|
|
@ -86,7 +98,9 @@ function computeAmort(montant_immo, duree_immo, somme_amort, date_debut, date_fi
|
|||
// calculer et afficher le montant de l'amortissement
|
||||
function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_montant, id_erreur, id_date=null)
|
||||
{
|
||||
document.getElementById(id_erreur).setAttribute('class', 'hidden');
|
||||
const div_erreur = document.getElementById(id_erreur);
|
||||
div_erreur.setAttribute('class', 'hidden');
|
||||
// document.getElementById(id_erreur).setAttribute('class', 'hidden');
|
||||
let case_montant = document.getElementById(id_montant);
|
||||
const selected_year = document.getElementById(id_exercices).value;
|
||||
if (selected_year == '') {
|
||||
|
|
@ -109,7 +123,8 @@ function displayAmort(id_immo, id_duree, id_amort, id_years, id_exercices, id_mo
|
|||
if (date_debut <= date_choisie && date_choisie <= date_fin) {
|
||||
date_fin = date_choisie;
|
||||
} else {
|
||||
document.getElementById(id_erreur).setAttribute('class', '');
|
||||
div_erreur.setAttribute('class', '');
|
||||
// document.getElementById(id_erreur).setAttribute('class', '');
|
||||
}
|
||||
}
|
||||
const montant_immo = Number(document.getElementById(id_immo).value);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue