2021-12-20 15:39:43 +01:00
/* Module par Seb. L. */
2021-12-18 02:30:47 +01:00
class releveBUT extends HTMLElement {
2022-01-10 12:00:02 +01:00
constructor ( ) {
2021-12-18 02:30:47 +01:00
super ( ) ;
2022-01-10 12:00:02 +01:00
this . shadow = this . attachShadow ( { mode : 'open' } ) ;
2021-12-18 02:30:47 +01:00
/* Config par defaut */
this . config = {
showURL : true
} ;
2022-01-10 12:00:02 +01:00
2021-12-18 02:30:47 +01:00
/* Template du module */
this . shadow . innerHTML = this . template ( ) ;
2022-01-10 12:00:02 +01:00
2021-12-18 02:30:47 +01:00
/* Style du module */
const styles = document . createElement ( 'link' ) ;
styles . setAttribute ( 'rel' , 'stylesheet' ) ;
2022-01-29 22:56:01 +01:00
if ( location . href . split ( "/" ) [ 3 ] == "ScoDoc" ) {
styles . setAttribute ( 'href' , '/ScoDoc/static/css/releve-but.css' ) ; // Scodoc
2022-01-11 23:16:59 +01:00
} else {
2022-01-29 22:56:01 +01:00
styles . setAttribute ( 'href' , '/assets/styles/releve-but.css' ) ; // Passerelle
2022-01-11 23:16:59 +01:00
}
2022-01-10 12:00:02 +01:00
this . shadow . appendChild ( styles ) ;
2021-12-18 02:30:47 +01:00
}
listeOnOff ( ) {
2021-12-20 15:39:43 +01:00
this . parentElement . parentElement . classList . toggle ( "listeOff" ) ;
2022-01-10 12:00:02 +01:00
this . parentElement . parentElement . querySelectorAll ( ".moduleOnOff" ) . forEach ( e => {
2021-12-20 15:39:43 +01:00
e . classList . remove ( "moduleOnOff" )
} )
}
2022-01-10 12:00:02 +01:00
moduleOnOff ( ) {
2021-12-20 15:39:43 +01:00
this . parentElement . classList . toggle ( "moduleOnOff" ) ;
2021-12-18 02:30:47 +01:00
}
2022-01-10 12:00:02 +01:00
goTo ( ) {
2021-12-21 22:22:55 +01:00
let module = this . dataset . module ;
this . parentElement . parentElement . parentElement . parentElement . querySelector ( "#Module_" + module ) . scrollIntoView ( ) ;
}
2021-12-18 02:30:47 +01:00
2022-01-10 12:00:02 +01:00
set setConfig ( config ) {
2021-12-18 02:30:47 +01:00
this . config . showURL = config . showURL ? ? this . config . showURL ;
}
2022-01-10 12:00:02 +01:00
set showData ( data ) {
2022-03-06 22:40:20 +01:00
// this.showInformations(data);
2021-12-18 02:30:47 +01:00
this . showSemestre ( data ) ;
this . showSynthese ( data ) ;
this . showEvaluations ( data ) ;
2022-01-29 22:56:01 +01:00
this . showCustom ( data ) ;
2021-12-18 02:30:47 +01:00
this . setOptions ( data . options ) ;
2021-12-20 15:39:43 +01:00
this . shadow . querySelectorAll ( ".CTA_Liste" ) . forEach ( e => {
e . addEventListener ( "click" , this . listeOnOff )
2022-01-10 12:00:02 +01:00
} )
2021-12-20 15:39:43 +01:00
this . shadow . querySelectorAll ( ".ue, .module" ) . forEach ( e => {
e . addEventListener ( "click" , this . moduleOnOff )
} )
2022-01-29 22:56:01 +01:00
this . shadow . querySelectorAll ( ":not(.ueBonus)+.syntheseModule" ) . forEach ( e => {
2021-12-21 22:22:55 +01:00
e . addEventListener ( "click" , this . goTo )
} )
2021-12-20 15:39:43 +01:00
2021-12-18 02:30:47 +01:00
this . shadow . children [ 0 ] . classList . add ( "ready" ) ;
}
2022-01-10 12:00:02 +01:00
template ( ) {
2021-12-18 02:30:47 +01:00
return `
< div >
< div class = "wait" > < / d i v >
< main class = "releve" >
2022-03-06 22:40:20 +01:00
2021-12-18 02:30:47 +01:00
2022-01-29 22:56:01 +01:00
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - >
<!-- Zone spéciale pour que les IUT puisse ajouter des infos locales sur la passerelle -- >
<!-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - >
< section class = custom > < / s e c t i o n >
2021-12-18 02:30:47 +01:00
<!-- -- -- -- -- -- -- -- -- -- -- -- -- - >
<!-- Semestre -- >
<!-- -- -- -- -- -- -- -- -- -- -- -- -- - >
< section >
2022-03-07 21:49:11 +01:00
< h2 id = "identite_etudiant" > < / h 2 >
< div >
2022-01-09 11:36:15 +01:00
< div class = infoSemestre > < / d i v >
< div >
2022-03-15 21:50:37 +01:00
< div > < span class = decision > < / s p a n > < s p a n c l a s s = " e c t s " i d = " e c t s _ t o t " > < / s p a n > < / d i v >
2022-01-09 11:36:15 +01:00
< div class = dateInscription > Inscrit le < / d i v >
2022-02-17 23:15:15 +01:00
< em > Les moyennes ci - dessus servent à situer l 'étudiant dans la promotion et ne correspondent pas à des validations de compétences ou d' UE . < / e m >
2022-01-09 11:36:15 +01:00
< / d i v >
< / d i v >
2021-12-18 02:30:47 +01:00
< / s e c t i o n >
<!-- -- -- -- -- -- -- -- -- -- -- -- -- - >
<!-- Synthèse -- >
<!-- -- -- -- -- -- -- -- -- -- -- -- -- - >
< section >
< div >
< div >
2022-03-07 21:49:11 +01:00
< h2 > Unités d ' enseignement < / h 2 >
2021-12-18 02:30:47 +01:00
< em > La moyenne des ressources dans une UE dépend des poids donnés aux évaluations . < / e m >
< / d i v >
< div class = CTA _Liste >
2022-01-09 11:36:15 +01:00
Liste < svg xmlns = "http://www.w3.org/2000/svg" width = "26" height = "26" viewBox = "0 0 24 24" fill = "none" stroke = "#ffffff" stroke - width = "2" stroke - linecap = "round" stroke - linejoin = "round" >
2021-12-18 02:30:47 +01:00
< path d = "M18 15l-6-6-6 6" / >
< / s v g >
< / d i v >
< / d i v >
< div class = synthese > < / d i v >
< / s e c t i o n >
<!-- -- -- -- -- -- -- -- -- -- -- -- -- - >
<!-- Evaluations -- >
<!-- -- -- -- -- -- -- -- -- -- -- -- -- - >
< section >
< div >
< h2 > Ressources < / h 2 >
< div class = CTA _Liste >
2022-01-09 11:36:15 +01:00
Liste < svg xmlns = "http://www.w3.org/2000/svg" width = "26" height = "26" viewBox = "0 0 24 24" fill = "none" stroke = "#ffffff" stroke - width = "2" stroke - linecap = "round" stroke - linejoin = "round" >
2021-12-18 02:30:47 +01:00
< path d = "M18 15l-6-6-6 6" / >
< / s v g >
< / d i v >
< / d i v >
< div class = evaluations > < / d i v >
< / s e c t i o n >
< section >
< div >
2022-03-07 21:49:11 +01:00
< h2 > Situations d 'apprentissage et d' évaluation ( SAÉ ) < / h 2 >
2021-12-18 02:30:47 +01:00
< div class = CTA _Liste >
2022-01-09 11:36:15 +01:00
Liste < svg xmlns = "http://www.w3.org/2000/svg" width = "26" height = "26" viewBox = "0 0 24 24" fill = "none" stroke = "#ffffff" stroke - width = "2" stroke - linecap = "round" stroke - linejoin = "round" >
2021-12-18 02:30:47 +01:00
< path d = "M18 15l-6-6-6 6" / >
< / s v g >
< / d i v >
< / d i v >
< div class = sae > < / d i v >
< / s e c t i o n >
< / m a i n >
< / d i v > ` ;
}
/********************************/
/* Informations sur l'étudiant */
/********************************/
showInformations ( data ) {
this . shadow . querySelector ( ".studentPic" ) . src = data . etudiant . photo _url || "default_Student.svg" ;
2021-12-21 22:22:55 +01:00
let output = '' ;
2022-01-10 12:00:02 +01:00
if ( this . config . showURL ) {
2021-12-21 22:22:55 +01:00
output += ` <a href=" ${ data . etudiant . fiche _url } " class=info_etudiant> ` ;
} else {
output += ` <div class=info_etudiant> ` ;
}
output += `
2021-12-18 02:30:47 +01:00
< div class = civilite >
$ { this . civilite ( data . etudiant . civilite ) }
$ { data . etudiant . nom }
$ { data . etudiant . prenom } ` ;
if ( data . etudiant . date _naissance ) {
2021-12-20 15:39:43 +01:00
output += ` <div class=dateNaissance>né ${ ( data . etudiant . civilite == "F" ) ? "e" : "" } le ${ this . ISOToDate ( data . etudiant . date _naissance ) } </div> ` ;
2021-12-18 02:30:47 +01:00
}
output += `
< / d i v >
< div class = numerosEtudiant >
2022-01-29 22:56:01 +01:00
Numéro étudiant : $ { data . etudiant . code _nip || "~" } -
Code INE : $ { data . etudiant . code _ine || "~" }
2021-12-18 02:30:47 +01:00
< / d i v >
< div > $ { data . formation . titre } < / d i v >
` ;
2022-01-10 12:00:02 +01:00
if ( this . config . showURL ) {
2021-12-21 22:22:55 +01:00
output += ` </a> ` ;
} else {
output += ` </div> ` ;
}
2021-12-18 02:30:47 +01:00
this . shadow . querySelector ( ".infoEtudiant" ) . innerHTML = output ;
}
2022-01-29 22:56:01 +01:00
/*******************************/
/* Affichage local */
/*******************************/
showCustom ( data ) {
this . shadow . querySelector ( ".custom" ) . innerHTML = data . custom || "" ;
}
2021-12-18 02:30:47 +01:00
/*******************************/
/* Information sur le semestre */
/*******************************/
showSemestre ( data ) {
2022-03-07 21:49:11 +01:00
2022-03-16 15:20:45 +01:00
this . shadow . querySelector ( "#identite_etudiant" ) . innerHTML = ` <a href=" ${ data . etudiant . fiche _url } "> ${ data . etudiant . nomprenom } </a> ` ;
2021-12-18 02:30:47 +01:00
this . shadow . querySelector ( ".dateInscription" ) . innerHTML += this . ISOToDate ( data . semestre . inscription ) ;
let output = `
< div >
< div class = enteteSemestre > Moyenne < / d i v > < d i v c l a s s = e n t e t e S e m e s t r e > $ { d a t a . s e m e s t r e . n o t e s . v a l u e } < / d i v >
< div class = rang > Rang : < /div><div class=rang>${data.semestre.rang.value} / $ { data . semestre . rang . total } < / d i v >
< div > Max . promo . : < / d i v > < d i v > $ { d a t a . s e m e s t r e . n o t e s . m a x } < / d i v >
< div > Moy . promo . : < / d i v > < d i v > $ { d a t a . s e m e s t r e . n o t e s . m o y } < / d i v >
< div > Min . promo . : < / d i v > < d i v > $ { d a t a . s e m e s t r e . n o t e s . m i n } < / d i v >
2022-01-29 22:56:01 +01:00
< / d i v >
< div class = absencesRecap >
2022-03-15 21:50:37 +01:00
< div class = enteteSemestre > Absences < / d i v > < d i v c l a s s = e n t e t e S e m e s t r e > 1 / 2 j o u r . < / d i v >
< div class = abs > Non justifiées < / d i v >
< div > $ { data . semestre . absences ? . injustifie ? ? "-" } < / d i v >
< div class = abs > Total < / d i v > < d i v > $ { d a t a . s e m e s t r e . a b s e n c e s ? . t o t a l ? ? " - " } < / d i v >
2022-03-07 21:49:11 +01:00
< / d i v >
< a class = photo href = "${data.etudiant.fiche_url}" > < img src = "${data.etudiant.photo_url || " default _Student . svg "}" alt = "photo de l'étudiant" title = "fiche de l'étudiant" height = "120" border = "0" > < / a >
` ;
2022-01-10 12:00:02 +01:00
/ * $ { d a t a . s e m e s t r e . g r o u p e s . m a p ( g r o u p e = > {
return `
< div >
< div class = enteteSemestre > Groupe < / d i v > < d i v c l a s s = e n t e t e S e m e s t r e > $ { g r o u p e . n o m } < / d i v >
< div class = rang > Rang : < /div><div class=rang>${groupe.rang.value} / $ { groupe . rang . total } < / d i v >
< div > Max . groupe : < / d i v > < d i v > $ { g r o u p e . n o t e s . m a x } < / d i v >
< div > Moy . groupe : < / d i v > < d i v > $ { g r o u p e . n o t e s . m i n } < / d i v >
< div > Min . groupe : < / d i v > < d i v > $ { g r o u p e . n o t e s . m i n } < / d i v >
< / d i v >
` ;
} ) . join ( "" )
} * /
2021-12-18 02:30:47 +01:00
this . shadow . querySelector ( ".infoSemestre" ) . innerHTML = output ;
2022-03-16 18:55:09 +01:00
if ( data . semestre . decision ? . code ) {
this . shadow . querySelector ( ".decision" ) . innerHTML = "Décision jury: " + ( data . semestre . decision ? . code || "" ) ;
}
2022-06-30 16:54:06 +02:00
this . shadow . querySelector ( "#ects_tot" ) . innerHTML = "ECTS : " + ( data . semestre . ECTS ? . acquis ? ? "-" ) + " / " + ( data . semestre . ECTS ? . total ? ? "-" ) ;
2021-12-18 02:30:47 +01:00
}
/*******************************/
/* Synthèse */
/*******************************/
showSynthese ( data ) {
let output = ` ` ;
Object . entries ( data . ues ) . forEach ( ( [ ue , dataUE ] ) => {
2022-01-29 22:56:01 +01:00
if ( dataUE . type == 1 ) { // UE Sport / Bonus
output += `
< div >
< div class = "ue ueBonus" >
< h3 > Bonus < / h 3 >
< div > $ { dataUE . bonus _description } < / d i v >
2021-12-20 15:39:43 +01:00
< / d i v >
2022-01-29 22:56:01 +01:00
$ { this . ueSport ( dataUE . modules ) }
< / d i v >
` ;
} else {
output += `
< div >
< div class = ue >
< h3 >
2022-01-30 09:29:51 +01:00
$ { ue } $ { ( dataUE . titre ) ? " - " + dataUE . titre : "" }
2022-01-29 22:56:01 +01:00
< / h 3 >
< div >
2022-06-30 16:54:06 +02:00
< div class = moyenne > Moyenne & nbsp ; : & nbsp ; $ { dataUE . moyenne ? . value ? ? "-" } < / d i v >
2022-02-15 11:45:56 +01:00
< div class = rang > Rang & nbsp ; : & nbsp ; $ { dataUE . moyenne ? . rang } & nbsp ; / & n b s p ; $ { d a t a U E . m o y e n n e ? . t o t a l } < / d i v >
2022-01-29 22:56:01 +01:00
< div class = info >
Bonus & nbsp ; : & nbsp ; $ { dataUE . bonus || 0 } & nbsp ; -
Malus & nbsp ; : & nbsp ; $ { dataUE . malus || 0 }
< span class = ects > & nbsp ; -
2022-06-30 16:54:06 +02:00
ECTS & nbsp ; : & nbsp ; $ { dataUE . ECTS ? . acquis ? ? "-" } & nbsp ; / & n b s p ; $ { d a t a U E . E C T S ? . t o t a l ? ? " - " }
2022-01-29 22:56:01 +01:00
< / s p a n >
< / d i v >
< / d i v > ` ;
/ * < d i v c l a s s = a b s e n c e s >
< div > Abs & nbsp ; N . J . < / d i v > < d i v > $ { d a t a U E . a b s e n c e s ? . i n j u s t i f i e | | 0 } < / d i v >
< div > Total < / d i v > < d i v > $ { d a t a U E . a b s e n c e s ? . t o t a l | | 0 } < / d i v >
< /div>*/
output += `
2021-12-18 02:30:47 +01:00
< / d i v >
2022-01-29 22:56:01 +01:00
$ { this . synthese ( data , dataUE . ressources ) }
$ { this . synthese ( data , dataUE . saes ) }
2021-12-18 02:30:47 +01:00
< / d i v >
2022-01-29 22:56:01 +01:00
` ;
}
2021-12-18 02:30:47 +01:00
} ) ;
this . shadow . querySelector ( ".synthese" ) . innerHTML = output ;
}
synthese ( data , modules ) {
let output = "" ;
Object . entries ( modules ) . forEach ( ( [ module , dataModule ] ) => {
let titre = data . ressources [ module ] ? . titre || data . saes [ module ] ? . titre ;
2022-01-29 22:56:01 +01:00
//let url = data.ressources[module]?.url || data.saes[module]?.url;
2021-12-18 02:30:47 +01:00
output += `
2021-12-21 22:22:55 +01:00
< div class = syntheseModule data - module = "${module.replace(/[^a-zA-Z0-9]/g, " ")}" >
< div > $ { module } & nbsp ; - $ { titre } < / d i v >
2021-12-18 02:30:47 +01:00
< div >
$ { dataModule . moyenne }
2021-12-20 15:39:43 +01:00
< em > Coef . & nbsp ; $ { dataModule . coef } < / e m >
2021-12-18 02:30:47 +01:00
< / d i v >
< / d i v >
` ;
} )
return output ;
}
2022-01-29 22:56:01 +01:00
ueSport ( modules ) {
let output = "" ;
Object . values ( modules ) . forEach ( ( module ) => {
Object . values ( module . evaluations ) . forEach ( ( evaluation ) => {
output += `
< div class = syntheseModule >
2022-02-14 10:42:28 +01:00
< div > $ { module . titre } - $ { evaluation . description || "Note" } < / d i v >
2022-01-29 22:56:01 +01:00
< div >
$ { evaluation . note . value ? ? "-" }
< em > Coef . & nbsp ; $ { evaluation . coef } < / e m >
< / d i v >
< / d i v >
` ;
} )
} )
return output ;
}
2022-01-10 12:00:02 +01:00
2021-12-18 02:30:47 +01:00
/*******************************/
/* Evaluations */
/*******************************/
showEvaluations ( data ) {
this . shadow . querySelector ( ".evaluations" ) . innerHTML = this . module ( data . ressources ) ;
this . shadow . querySelector ( ".sae" ) . innerHTML += this . module ( data . saes ) ;
}
module ( module ) {
let output = "" ;
Object . entries ( module ) . forEach ( ( [ numero , content ] ) => {
output += `
2021-12-21 22:22:55 +01:00
< div id = "Module_${numero.replace(/[^a-zA-Z0-9]/g, " ")}" >
2021-12-18 02:30:47 +01:00
< div class = module >
< h3 > $ { this . URL ( content . url , ` ${ numero } - ${ content . titre } ` ) } < / h 3 >
< div >
< div class = moyenne > Moyenne & nbsp ; indicative & nbsp ; : & nbsp ; $ { content . moyenne . value } < / d i v >
< div class = info >
Classe & nbsp ; : & nbsp ; $ { content . moyenne . moy } & nbsp ; -
Max & nbsp ; : & nbsp ; $ { content . moyenne . max } & nbsp ; -
Min & nbsp ; : & nbsp ; $ { content . moyenne . min }
< / d i v >
< / d i v >
< div class = absences >
< div > Abs & nbsp ; inj . < / d i v > < d i v > $ { c o n t e n t . a b s e n c e s ? . i n j u s t i f i e | | 0 } < / d i v >
< div > Total < / d i v > < d i v > $ { c o n t e n t . a b s e n c e s ? . t o t a l | | 0 } < / d i v >
< / d i v >
< / d i v >
$ { this . evaluation ( content . evaluations ) }
< / d i v >
` ;
} )
return output ;
}
evaluation ( evaluations ) {
let output = "" ;
evaluations . forEach ( ( evaluation ) => {
output += `
< div class = eval >
2022-01-29 22:56:01 +01:00
< div > $ { this . URL ( evaluation . url , evaluation . description || "Évaluation" ) } < / d i v >
2021-12-18 02:30:47 +01:00
< div >
$ { evaluation . note . value }
2021-12-20 15:39:43 +01:00
< em > Coef . & nbsp ; $ { evaluation . coef } < / e m >
2021-12-18 02:30:47 +01:00
< / d i v >
< div class = complement >
< div > Coef < / d i v > < d i v > $ { e v a l u a t i o n . c o e f } < / d i v >
< div > Max . promo . < / d i v > < d i v > $ { e v a l u a t i o n . n o t e . m a x } < / d i v >
< div > Moy . promo . < / d i v > < d i v > $ { e v a l u a t i o n . n o t e . m o y } < / d i v >
< div > Min . promo . < / d i v > < d i v > $ { e v a l u a t i o n . n o t e . m i n } < / d i v >
$ { Object . entries ( evaluation . poids ) . map ( ( [ UE , poids ] ) => {
return `
< div > Poids $ { UE } < / d i v >
< div > $ { poids } < / d i v >
` ;
} ) . join ( "" ) }
< / d i v >
< / d i v >
` ;
} )
return output ;
}
/********************/
/* Options */
/********************/
setOptions ( options ) {
Object . entries ( options ) . forEach ( ( [ option , value ] ) => {
if ( value === false ) {
2022-03-15 21:50:37 +01:00
this . shadow . children [ 0 ] . classList . add ( option . replace ( "show" , "hide" ) ) ;
2021-12-18 02:30:47 +01:00
}
2022-03-15 21:50:37 +01:00
} ) ;
2021-12-18 02:30:47 +01:00
}
/********************/
/* Fonctions d'aide */
/********************/
2022-01-10 12:00:02 +01:00
URL ( href , content ) {
if ( this . config . showURL ) {
2021-12-18 02:30:47 +01:00
return ` <a href= ${ href } > ${ content } </a> ` ;
} else {
return content ;
}
}
civilite ( txt ) {
switch ( txt ) {
case "M" : return "M." ;
case "F" : return "Mme" ;
default : return "" ;
}
}
ISOToDate ( ISO ) {
return ISO . split ( "-" ) . reverse ( ) . join ( "/" ) ;
}
}
2022-01-29 22:56:01 +01:00
customElements . define ( 'releve-but' , releveBUT ) ;