/* Parcoursup API (PAPI) Comprend un set de wrapper afin d'accéder plus aisément aux informations de l'API parcoursup */ class PAPI { static dataset = "fr-esr-parcoursup"; static timezone = "Europe%2FBerlin"; static searchURL = `https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=${PAPI.dataset}&timezone=${PAPI.timezone}`; static async fetchFilieres() { let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fili`); let result = await request.json(); return result["facet_groups"][0]["facets"]; } static async fetchFiliere(filiere) { let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=form_lib_voe_acc&refine.fili=${filiere}`); let result = await request.json(); return result["facet_groups"][0]["facets"]; } static async fetchSpecialites(specialite) { let request = await fetch(`${PAPI.searchURL}&rows=0&sort=tri&facet=fil_lib_voe_acc&refine.form_lib_voe_acc=${specialite}`); let result = await request.json(); return result["facet_groups"][0]["facets"]; } static async fetchEtablissement(filiere, sousfiliere, soussousfiliere) { let request = await fetch(`${PAPI.searchURL}&refine.fil_lib_voe_acc=${soussousfiliere}&refine.form_lib_voe_acc=${sousfiliere}&refine.fili=${filiere}`); let result = await request.json(); return result["records"]; } } function filterSearch() {} var search = { css: null, exports: { onBeforeMount(props, state) { //Initial state this.state = { placeholder: "Formation", currentStep: 0, allItems: null, filter: null, items: null }; PAPI.fetchFilieres().then(response => { this.state.allItems = response; this.update({ items: filterSearch(this.state.allItems) }); }); } }, template: (template, expressionTypes, bindingTypes, getComponent) => template('
', [{ redundantAttribute: 'expr10', selector: '[expr10]', expressions: [{ type: expressionTypes.EVENT, name: 'onkeydown', evaluate: _scope => _scope.filterSearch }, { type: expressionTypes.EVENT, name: 'onfocusout', evaluate: _scope => _scope.filterSearch }, { type: expressionTypes.ATTRIBUTE, name: 'placeholder', evaluate: _scope => _scope.state.placeholder }] }, { redundantAttribute: 'expr11', selector: '[expr11]', expressions: [{ type: expressionTypes.ATTRIBUTE, name: 'disabled', evaluate: _scope => !_scope.state.currentStep }, { type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => _scope.cruiseBack }] }, { type: bindingTypes.EACH, getKey: null, condition: null, template: template('', [{ redundantAttribute: 'expr13', selector: '[expr13]', expressions: [{ type: expressionTypes.EVENT, name: 'onclick', evaluate: _scope => () => _scope.cruiseForward(_scope.item.name) }] }, { redundantAttribute: 'expr14', selector: '[expr14]', expressions: [{ type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => _scope.item.name }] }, { redundantAttribute: 'expr15', selector: '[expr15]', expressions: [{ type: expressionTypes.TEXT, childNodeIndex: 0, evaluate: _scope => _scope.item.count }] }]), redundantAttribute: 'expr12', selector: '[expr12]', itemName: 'item', indexName: null, evaluate: _scope => _scope.state.items }]), name: 'search' }; export { search as default };