Spanning courses in report view supported

This commit is contained in:
PMKuipers 2023-08-04 14:57:23 +02:00
parent d047037a8d
commit 97b929e240
2 changed files with 59 additions and 17 deletions

View file

@ -263,7 +263,7 @@ export default {
methods: { methods: {
countLineLayers(line){ countLineLayers(line){
let maxLayer = -1; let maxLayer = -1;
for(let i = 0; i <= this.value.slots; i++){ for(let i = 0; i <= this.page.periods; i++){
const slot = line.slots[i]; const slot = line.slots[i];
// Determine the amount of used layers in a studyline slit // Determine the amount of used layers in a studyline slit
for(const ix in line.slots[i].competencies){ for(const ix in line.slots[i].competencies){
@ -279,8 +279,36 @@ export default {
} }
} }
} }
return maxLayer+1; return (maxLayer >= 0)?(maxLayer+1):1;
}, },
showslot(line,index, layeridx, type){
// check if the slot should be hidden because a previous slot has an item with a span
// so big that it hides this slot
const forGradable = (type == 'gradable')?true:false;
const periods = this.page.periods;
let show = true;
for(let i = 0; i < periods; i++){
if(line.slots[index-i] && line.slots[index-i].competencies){
const list = line.slots[index-i].competencies;
for(const ix in list){ // Really wish that 'for of' would work with the minifier moodle uses
const item = list[ix];
if(item.layer == layeridx){
if(forGradable){
if(i > 0 && (item.span - i) > 0){
show = false;
}
} else {
if((item.span - i) > 1){
show = false;
}
}
}
}
}
}
return show;
}
}, },
template: ` template: `
<div class='r-studyplan-content'> <div class='r-studyplan-content'>
@ -311,13 +339,13 @@ export default {
<!-- Line by line add the items --> <!-- Line by line add the items -->
<!-- The grid layout handles putting it in rows and columns --> <!-- The grid layout handles putting it in rows and columns -->
<template v-for="(line,lineindex) in page.studylines" <template v-for="(line,lineindex) in page.studylines"
><template v-for="layeridx in countLineLayers(line)+1" ><template v-for="(layernr,layeridx) in countLineLayers(line)"
><template v-for="(n,index) in (page.periods+1)" ><template v-for="(n,index) in (page.periods+1)"
><r-studyline-slot ><r-studyline-slot
v-if="index > 0" v-if="index > 0 && showslot(line, index, layeridx, 'gradable')"
type='gradable' type='gradable'
v-model="line.slots[index].competencies" v-model="line.slots[index].competencies"
:key="'c-'+lineindex+'-'+index+'-'+layeridx" :key="'c-'+lineindex+'-'+index+'-'+layernr"
:slotindex="index" :slotindex="index"
:line="line" :line="line"
:plan="value" :plan="value"
@ -325,23 +353,24 @@ export default {
:period="page.perioddesc[index-1]" :period="page.perioddesc[index-1]"
:guestmode='guestmode' :guestmode='guestmode'
:teachermode='teachermode' :teachermode='teachermode'
:layer="layeridx-1" :layer="layeridx"
:class="'t-studyline ' + ((lineindex%2==0)?' odd ':' even ') :class="'t-studyline ' + ((lineindex%2==0)?' odd ':' even ')
+ ((lineindex==0 && layeridx==1)?' first ':' ') + ((lineindex==0 && layernr==1)?' first ':' ')
+ ((lineindex==page.studylines.length-1)?' last ':' ')" + ((lineindex==page.studylines.length-1)?' last ':' ')"
></r-studyline-slot ></r-studyline-slot
><r-studyline-slot ><r-studyline-slot
v-if="showslot(line, index, layeridx, 'gradable')"
type='filter' type='filter'
v-model="line.slots[index].filters" v-model="line.slots[index].filters"
:teachermode='teachermode' :teachermode='teachermode'
:key="'f-'+lineindex+'-'+index+'-'+layeridx" :key="'f-'+lineindex+'-'+index+'-'+layernr"
:slotindex="index" :slotindex="index"
:line="line" :line="line"
:plan="value" :plan="value"
:page="page" :page="page"
:layer="layeridx-1" :layer="layeridx"
:class="'t-studyline ' + ((lineindex%2==0)?' odd ':' even ') :class="'t-studyline ' + ((lineindex%2==0)?' odd ':' even ')
+ ((lineindex==0 && layeridx==1)?' first ':'') + ((lineindex==0 && layernr==1)?' first ':'')
+ ((lineindex==page.studylines.length-1)?' last ':' ') + ((lineindex==page.studylines.length-1)?' last ':' ')
+ ((index==page.periods)?' rightmost':'')" + ((index==page.periods)?' rightmost':'')"
> >
@ -484,6 +513,14 @@ export default {
else { else {
return false; return false;
} }
},
spanCss(){
if(this.item && this.item.span > 1){
const span = (2 * this.item.span) - 1;
return `width: 100%; grid-column: span ${span};`;
} else {
return "";
}
} }
}, },
data() { data() {
@ -498,8 +535,9 @@ export default {
+ 'r-studyline-slot-' + slotindex + ' ' + 'r-studyline-slot-' + slotindex + ' '
+ ((slotindex==0)?'r-studyline-firstcolumn ':' ')" + ((slotindex==0)?'r-studyline-firstcolumn ':' ')"
:data-studyline="line.id" ref="sizeElement" :data-studyline="line.id" ref="sizeElement"
><div class="t-slot-item" v-if="item" :style='spanCss'
><r-item ><div class="r-slot-item" v-if="item"
><r-item
v-model="item" v-model="item"
:plan="plan" :plan="plan"
:guestmode='guestmode' :guestmode='guestmode'

View file

@ -424,18 +424,22 @@ ul.t-competency-list li {
} }
.gradable .t-slot-item, .gradable .t-slot-item,
.gradable .r-slit-item { .gradable .r-slot-item {
width: 100%; width: 100%;
} }
.t-slot-item { .t-slot-item,
.r-slot-item {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
display: grid;
} }
.t-item-base { .t-item-base,
.r-item-base {
align-self: center;
position: relative; position: relative;
} }
@ -719,13 +723,13 @@ a.t-item-course-config {
.r-item-base { /*.r-item-base {
margin-top: 5px; margin-top: 5px;
margin-bottom: 5px; margin-bottom: 5px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
position: relative; position: relative;
} }*/
.gradable .r-item-base { .gradable .r-item-base {
width: 100%; width: 100%;