You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/app/javascript/controllers/analyze_controller.js

22 lines
554 B

import { Controller } from "@hotwired/stimulus"
// Connects to data-controller="analyze"
export default class extends Controller {
connect() { }
refresh(event) {
let location = event.target.value+ "&academic_years=";
let year_checkboxes = document.getElementsByName("year-checkbox");
let selected_years = [];
let ending = "";
year_checkboxes.forEach((item)=>{
if(item.checked) {
selected_years.push(item.id)
}
})
console.log(location)
window.location = location + selected_years.join(",")
}
}