feat(frontend): verschillende groepen tonen binnen een assignment
This commit is contained in:
		
							parent
							
								
									16f8aa449e
								
							
						
					
					
						commit
						056b2d30fa
					
				
					 2 changed files with 77 additions and 11 deletions
				
			
		|  | @ -61,6 +61,7 @@ type Assignment = { | ||||||
|     description: string; |     description: string; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| export const assignments: Assignment[] = Array.from({length: 4}, (_, i) => ({ | export const assignments: Assignment[] = Array.from({length: 4}, (_, i) => ({ | ||||||
|     id: `assignment${i}`, |     id: `assignment${i}`, | ||||||
|     title: `Assignment ${i}`, |     title: `Assignment ${i}`, | ||||||
|  | @ -80,6 +81,23 @@ export const assignments: Assignment[] = Array.from({length: 4}, (_, i) => ({ | ||||||
|         "Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. " + |         "Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. " + | ||||||
|         "Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. " + |         "Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. " + | ||||||
|         "Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,", |         "Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,", | ||||||
|  |     groups: [ | ||||||
|  |         { | ||||||
|  |             id: 'group1', | ||||||
|  |             members: [ | ||||||
|  |                 student01, | ||||||
|  |                 student02 | ||||||
|  |             ] | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |             id: 'group2', | ||||||
|  |             members: [ | ||||||
|  |                 student01, | ||||||
|  |                 student03 | ||||||
|  |             ] | ||||||
|  |         } | ||||||
|  |     ] | ||||||
| })); | })); | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| export const classes: Array<Class> = [class01, class02, class03]; | export const classes: Array<Class> = [class01, class02, class03]; | ||||||
|  |  | ||||||
|  | @ -18,6 +18,18 @@ | ||||||
|         assignment.value = assignments[0]; |         assignment.value = assignments[0]; | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  |     const myUsername = "id01"; //TODO: replace by username of logged in user | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     // Display group members | ||||||
|  |     const myGroup = computed(() => { | ||||||
|  |         if (!assignment.value || !assignment.value.groups) return null; | ||||||
|  |         console.log(assignment.value.groups) | ||||||
|  |         return assignment.value.groups.find(group => | ||||||
|  |             group.members.some(m => m.username === myUsername) | ||||||
|  |         ); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|     const deleteAssignment = () => { |     const deleteAssignment = () => { | ||||||
|         console.log('Delete assignment:', assignmentId.value); |         console.log('Delete assignment:', assignmentId.value); | ||||||
|     }; |     }; | ||||||
|  | @ -50,12 +62,6 @@ | ||||||
|                 </v-btn> |                 </v-btn> | ||||||
|             </div> |             </div> | ||||||
|             <v-card-title class="text-h4">{{ assignment.title }}</v-card-title> |             <v-card-title class="text-h4">{{ assignment.title }}</v-card-title> | ||||||
|             <v-container class="assignment-class"> |  | ||||||
|                 {{ t('class') }}: |  | ||||||
|                 <span class="class-name"> |  | ||||||
|                     {{ assignment.class }} |  | ||||||
|                   </span> |  | ||||||
|             </v-container> |  | ||||||
|             <v-card-subtitle> |             <v-card-subtitle> | ||||||
|                 <v-btn |                 <v-btn | ||||||
|                     :to="`/learningPath/${assignment.learningPathHruid}`" |                     :to="`/learningPath/${assignment.learningPathHruid}`" | ||||||
|  | @ -69,6 +75,43 @@ | ||||||
|             <v-card-text class="description"> |             <v-card-text class="description"> | ||||||
|                 {{ assignment.description }} |                 {{ assignment.description }} | ||||||
|             </v-card-text> |             </v-card-text> | ||||||
|  | 
 | ||||||
|  |             <v-card-text class="group-section"> | ||||||
|  |                 <h3>{{ t("group") }}</h3> | ||||||
|  | 
 | ||||||
|  |                 <!-- Student view --> | ||||||
|  |                 <div v-if="!isTeacher"> | ||||||
|  |                     <div v-if="myGroup"> | ||||||
|  |                         <ul> | ||||||
|  |                             <li v-for="student in myGroup.members" :key="student.username"> | ||||||
|  |                                 {{ student.firstName + ' ' + student.lastName}} | ||||||
|  |                             </li> | ||||||
|  |                         </ul> | ||||||
|  |                     </div> | ||||||
|  |                 </div> | ||||||
|  | 
 | ||||||
|  |                 <!-- Teacher view --> | ||||||
|  |                 <div v-else> | ||||||
|  |                     <v-expansion-panels> | ||||||
|  |                         <v-expansion-panel | ||||||
|  |                             v-for="(group, index) in assignment.groups" | ||||||
|  |                             :key="group.id" | ||||||
|  |                         > | ||||||
|  |                             <v-expansion-panel-title> | ||||||
|  |                                 {{ t("group") }} {{ index + 1 }} | ||||||
|  |                             </v-expansion-panel-title> | ||||||
|  |                             <v-expansion-panel-text> | ||||||
|  |                                 <ul> | ||||||
|  |                                     <li v-for="student in group.members" :key="student.username"> | ||||||
|  |                                         {{ student.firstName + ' ' + student.lastName }} | ||||||
|  |                                     </li> | ||||||
|  |                                 </ul> | ||||||
|  |                             </v-expansion-panel-text> | ||||||
|  |                         </v-expansion-panel> | ||||||
|  |                     </v-expansion-panels> | ||||||
|  |                 </div> | ||||||
|  |             </v-card-text> | ||||||
|  | 
 | ||||||
|         </v-card> |         </v-card> | ||||||
|     </div> |     </div> | ||||||
| </template> | </template> | ||||||
|  | @ -100,14 +143,19 @@ | ||||||
|     color: red; |     color: red; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .assignment-class { | .group-section { | ||||||
|     color: #666; |     margin-top: 2rem; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .class-name { | .group-section h3 { | ||||||
|     font-weight: 500; |     margin-bottom: 0.5rem; | ||||||
|     color: #333; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .group-section ul { | ||||||
|  |     padding-left: 1.2rem; | ||||||
|  |     list-style-type: disc; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| </style> | </style> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Joyelle Ndagijimana
						Joyelle Ndagijimana