modif index

This commit is contained in:
HORVILLE 2023-03-26 23:20:16 +02:00
parent afba3c0abc
commit 94a2373749
2 changed files with 48 additions and 4 deletions

View File

@ -7,14 +7,13 @@
<script src="riot.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css">
<script src="loader.js" type="module"></script>
<script src="components/search.riot" type="riot"></script>
<!--<script src="components/search.riot" type="riot"></script>-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/7.1.0/riot+compiler.min.js" integrity="sha512-sSGKGR9MvL0bUx3CScaBb56crXwspwDkL/JnB0IrLFQfw3uvSUlITQtsTtDZctshhv5wdwIt+qZeN8zThRF4Dw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body>
<search></search>
<script src="javascript/school-info.js" type="javascript"></script>
<script>
<!--<script>
riot.compile().then(() => {
riot.mount('search', {
formation:'Formation',
@ -22,6 +21,6 @@
text: null
})
})
</script>
</script>-->
</body>
</html>

View File

@ -0,0 +1,45 @@
async function formation() {
let result = await fetch("https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-parcoursup&q=&sort=tri&facet=fili&timezone=Europe%2FBerlin");
let resultats = await result.json();
console.log(result);
console.log(resultats);
let table = resultats["facet_groups"][0]["facets"];
console.log(table);
const tableBody = document.querySelector("tbody1");
for (tes of table) {
const tableRow = document.createElement("tr");
const formationCell = document.createElement("td");
let texteformation = document.createTextNode(tes.name);
formationCell.appendChild(texteformation);
tableRow.appendChild(formationCell);
const nombredeplaceCell = document.createElement("td");
const nombredeplace = document.createTextNode(tes.count);
nombredeplaceCell.appendChild(nombredeplace);
tableRow.appendChild(nombredeplaceCell);
tableBody.appendChild(tableRow);
}
}
var testformation = {
css: null,
exports: {
onMounted() {
formation();
}
},
template: (template, expressionTypes, bindingTypes, getComponent) => template('<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.3/css/bulma.min.css"/><table class="table is-fullwidth is-hoverable"><tbody1 expr4="expr4"></tbody1></table>', [{
type: bindingTypes.TAG,
getComponent: getComponent,
evaluate: _scope => 'tbody1',
slots: [{
id: 'default',
html: '<tr><th></th><th></th></tr>',
bindings: []
}],
attributes: [],
redundantAttribute: 'expr4',
selector: '[expr4]'
}]),
name: 'formation'
};
export { testformation as default };