Skip to content

Commit

Permalink
Display filled-in evaluation grids on participant detail
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobeltrame committed Jul 25, 2024
1 parent b42e8c8 commit 90de593
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
7 changes: 7 additions & 0 deletions app/Models/Participant.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ public function participant_groups()
return $this->belongsToMany('App\Models\ParticipantGroup', 'participant_groups_participants');
}

/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function evaluation_grids() {
return $this->belongsToMany(EvaluationGrid::class, 'evaluation_grids_participants');
}

public function getPositiveAttribute() {
return $this->observations()->where('impression', '=', '2');
}
Expand Down
5 changes: 4 additions & 1 deletion lang/de/t.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"block" => "Block",
"model_name" => "Beurteilungsraster",
"participants" => "TN",
"user" => "Beurteilt von",
"user" => "Erstellt von",
),
"evaluation_grid_row" => array(
"notes" => "Bemerkungen",
Expand Down Expand Up @@ -676,6 +676,9 @@
"num_observations" => "{0}Bisher keine Beobachtungen.|{1}Erst eine Beobachtung. Da geht noch mehr!|[2,*]:count Beobachtungen, davon :positive mit positivem, :neutral mit neutralem und :negative mit negativem Eindruck.",
"observations_without_category" => "Beobachtungen ohne Kategorie",
"observations_without_requirement" => "Beobachtungen ohne Anforderung",
"evaluation_grids" => array(
"title" => "Beurteilungsraster",
),
"feedbacks" => array(
"title" => "Rückmeldungen",
),
Expand Down
29 changes: 28 additions & 1 deletion resources/views/participant-detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@

</b-card>


@if ($participant->feedbacks()->count())

<b-card>
Expand Down Expand Up @@ -79,6 +78,34 @@

@endif

@if ($participant->evaluation_grids()->count())

<b-card>
<template #header>{{__('t.views.participant_details.evaluation_grids.title')}}</template>

<responsive-table
:data="{{ json_encode($participant->evaluation_grids()->with('evaluationGridTemplate.requirements', 'block', 'user')->get()) }}"
:fields="[
{ label: $t('t.models.evaluation_grid_template.name'), value: evaluationGrid => evaluationGrid.evaluation_grid_template.name, href: evaluationGrid => routeUri('evaluationGrid.edit', {course: {{ $course->id }}, evaluation_grid_template: evaluationGrid.evaluation_grid_template_id, evaluation_grid: evaluationGrid.id}) },
{ label: $t('t.models.evaluation_grid.block'), value: evaluationGrid => evaluationGrid.block.blockname_and_number },
{ label: $t('t.models.observation.requirements'), slot: 'requirements' },
{ label: $t('t.models.evaluation_grid.user'), value: evaluationGrid => evaluationGrid.user.name },
]"
:actions="{
edit: evaluationGrid => routeUri('evaluationGrid.edit', {course: {{ $course->id }}, evaluation_grid_template: evaluationGrid.evaluation_grid_template_id, evaluation_grid: evaluationGrid.id}),
}">

<template v-slot:requirements="{ row: evaluationGrid }">
<template v-for="requirement in evaluationGrid.evaluation_grid_template.requirements">
<span class="white-space-normal badge" :class="requirement.mandatory ? 'badge-warning' : 'badge-info'">@{{ requirement.content }}</span>
</template>
</template>
</responsive-table>

</b-card>

@endif

<b-card>
<template #header>{{__('t.views.participant_details.existing_observations')}}</template>

Expand Down

0 comments on commit 90de593

Please sign in to comment.