|
| 1 | +<template> |
| 2 | + <div> |
| 3 | + <h3 class="font-size-16">Topics Used</h3> |
| 4 | + <div v-if="noteTopics.length"> |
| 5 | + <table class="mt-2 w-100"> |
| 6 | + <thead class="sr-only"> |
| 7 | + <tr> |
| 8 | + <th>Note Topic</th> |
| 9 | + <th>Note Topic Usage Count</th> |
| 10 | + </tr> |
| 11 | + </thead> |
| 12 | + <tbody> |
| 13 | + <tr |
| 14 | + v-for="(noteTopic, index) in noteTopics" |
| 15 | + :id="`tr-note-topic-${noteTopic.id}`" |
| 16 | + :key="noteTopic.id" |
| 17 | + :class="{ |
| 18 | + 'bg-surface-light': index % 2 !== 0, |
| 19 | + 'border-t-md': index === 0 |
| 20 | + }" |
| 21 | + > |
| 22 | + <td :class="{'pt-2': index === 0}" class="pl-3"> |
| 23 | + <span :id="`peer-advising-note-topic-${noteTopic.id}-title`">{{ noteTopic.topic }}</span> |
| 24 | + </td> |
| 25 | + <td class="font-weight-550 pr-3 text-right"> |
| 26 | + <span :id="`peer-advising-note-topic-${noteTopic.id}-usage-count`">{{ numFormat(noteTopic.usageCount) }}</span> |
| 27 | + </td> |
| 28 | + </tr> |
| 29 | + </tbody> |
| 30 | + </table> |
| 31 | + </div> |
| 32 | + <div v-if="!noteTopics.length" class="pa-3 text-medium-emphasis"> |
| 33 | + No peer advising topics are configured. |
| 34 | + </div> |
| 35 | + </div> |
| 36 | +</template> |
| 37 | + |
| 38 | +<script setup lang="ts"> |
| 39 | +import {get} from 'lodash' |
| 40 | +import type {PropType} from 'vue' |
| 41 | +import {numFormat} from '@/lib/utils' |
| 42 | +import type {PeerAdvisingManagerReport} from '@/lib/types-peer-advising' |
| 43 | +
|
| 44 | +const props = defineProps({ |
| 45 | + notesReport: { |
| 46 | + required: true, |
| 47 | + type: Object as PropType<PeerAdvisingManagerReport> |
| 48 | + } |
| 49 | +}) |
| 50 | +
|
| 51 | +const noteTopics = get(props.notesReport, 'noteTopics', []) |
| 52 | +</script> |
| 53 | + |
| 54 | +<style scoped> |
| 55 | +table { |
| 56 | + border-collapse: collapse; |
| 57 | +} |
| 58 | +td { |
| 59 | + padding: 4px 0 4px 0; |
| 60 | +} |
| 61 | +td:first-child { |
| 62 | + padding-left: 8px; |
| 63 | +} |
| 64 | +</style> |
0 commit comments