diff --git a/amd/src/studyplan-editor-components.js b/amd/src/studyplan-editor-components.js index f7ebbdf..8eca54a 100644 --- a/amd/src/studyplan-editor-components.js +++ b/amd/src/studyplan-editor-components.js @@ -1118,6 +1118,17 @@ export default { ItemEventBus.$emit('redrawLines'); }, computed: { + columns() { + return 1+ (this.value.slots * 2); + }, + columns_stylerule() { + // Uses css variables, so width for slots and filters can be configured in css + let s = "grid-template-columns: var(--studyplan-filter-width)"; // use css variable here + for(let i=0; i -
- + - -
{{ text.editmode_modules_hidden}}
-
+ -
- +
+
+ +
@@ -1448,8 +1460,17 @@ export default { /* * T-STUDYLINE-HEADER */ - Vue.component('t-studyline-header', { - props: ['color','name','code', 'slots','sequence','numlines',], + Vue.component('t-studyline-heading', { + props: { + value : { + type: Object, + default: function(){ return {};}, + }, + numlines: { + type: Number, + default: 1, + }, + }, data() { return { }; @@ -1460,11 +1481,12 @@ export default { methods: { }, template: ` -
-
+
- {{ code }} + {{ value.shortname }}
`, @@ -1473,14 +1495,47 @@ export default { /* * T-STUDYLINE (Used only for study line edit mode) */ - Vue.component('t-studyline', { - props: ['color','name','code', 'slots','deletable','editable','sequence','numlines'], + Vue.component('t-studyline-edit', { + props: { + value : { + type: Object, + default: function(){ return {};}, + }, + numlines: { + type: Number, + default: 1, + }, + + /* + :color='value.color' + :name='value.name' + :code='value.shortname' + :sequence='value.sequence' + */ + }, data() { return { }; }, computed: { - + deletable() { + // Check if all the slots are empty + const slots = this.value.slots; + if(Array.isArray(slots)){ + let count = 0; + for(let i = 0; i < slots.length; i++) { + if(Array.isArray(slots[i].competencies)){ + count += slots[i].competencies.length; + } + if(Array.isArray(slots[i].filters)){ + count += slots[i].filters.length; + } + } + return (count == 0); + } else { + return false; + } + } }, methods: { onEdit() { @@ -1492,22 +1547,19 @@ export default { }, template: ` -
-
+
+
- - - {{ code }} + + {{ value.shortname }}
-
+
-
- + @@ -1528,9 +1580,9 @@ export default { type: Number, default: '', }, - lineid : { - type: Number, - default: '', + line : { + type: Object, + default(){ return null;}, }, value: { type: Array, @@ -1539,7 +1591,12 @@ export default { plan: { type: Object, default(){ return null;}, - } + }, + active: { + type: Boolean, + default: false, + }, + }, computed: { listtype() { @@ -1586,7 +1643,7 @@ export default { call([{ methodname: 'local_treestudyplan_add_studyitem', args: { - "line_id": self.lineid, + "line_id": self.line.id, "slot" : self.slotindex, "type": 'competency', "details": { @@ -1610,7 +1667,7 @@ export default { call([{ methodname: 'local_treestudyplan_add_studyitem', args: { - "line_id": self.lineid, + "line_id": self.line.id, "slot" : self.slotindex, "type": 'course', "details": { @@ -1634,7 +1691,7 @@ export default { call([{ methodname: 'local_treestudyplan_add_studyitem', args: { - "line_id": self.lineid, + "line_id": self.line.id, "slot" : self.slotindex, "type": event.data.type, "details":{ @@ -1678,7 +1735,7 @@ export default { for(let idx in self.value) { self.value[idx].layer = idx; - items.push({'id': self.value[idx].id,'layer': idx, 'slot': this.slotindex, 'line_id': this.lineid}); + items.push({'id': self.value[idx].id,'layer': idx, 'slot': this.slotindex, 'line_id': this.line.id}); } return call([{ methodname: 'local_treestudyplan_reorder_studyitems', @@ -1692,7 +1749,10 @@ export default { } }, template: ` -
+