|
@@ -52,6 +52,7 @@ export function createVariable () {
|
|
|
});
|
|
|
|
|
|
updateResume(variable.hash);
|
|
|
+ updateAllVariableSelect();
|
|
|
|
|
|
// Changing focus to the variable type after creation for screen readers
|
|
|
document.getElementById(`variable${variable.hash}Type`).focus();
|
|
@@ -99,6 +100,8 @@ export function deleteVariable (hash) {
|
|
|
|
|
|
deleteOperationByVariable(variable);
|
|
|
variables.splice(variables.indexOf(variable), 1);
|
|
|
+
|
|
|
+ updateAllVariableSelect();
|
|
|
}
|
|
|
|
|
|
// Deleting all variable
|
|
@@ -124,6 +127,26 @@ function generateResume (hash) {
|
|
|
return `${variable.type.name} ${variable.name} recebe ${variable.value}`;
|
|
|
}
|
|
|
|
|
|
+// ***********************************************************************
|
|
|
+// Update all variable select
|
|
|
+// **********************************************************************
|
|
|
+
|
|
|
+function updateAllVariableSelect () {
|
|
|
+ const variableSelects = document.getElementsByName('variableSelect');
|
|
|
+
|
|
|
+ let variablesSelect = variables.length === 0 ? `<option>N/A</option>` : ``;
|
|
|
+
|
|
|
+ for (let i = 0; i < variables.length; i++) {
|
|
|
+ variablesSelect += `<option value="${variables[i].hash}">${variables[i].name}</option>`
|
|
|
+ }
|
|
|
+
|
|
|
+ for (let i = 0; i < variableSelects.length; i++) {
|
|
|
+ const selectedOption = variableSelects[i].value;
|
|
|
+ variableSelects[i].innerHTML = variablesSelect;
|
|
|
+ variableSelects[i].value = selectedOption;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// *********************************************************************************
|
|
|
// Util
|
|
|
// *********************************************************************************
|