1515 </div >
1616 </div >
1717 <div class =" mt-4 w-100" >
18- <table v-if =" notesReport.currentMonth.peerAdvisors.length" class =" border-sm w-100" >
19- <thead >
20- <tr >
21- <th
22- :aria-sort =" getPeerAdvisorAriaSort('name', sortOptions)"
23- class =" bg-grey-lighten-2 border-sm w-90"
24- scope =" col"
25- >
26- <v-btn
27- id =" sort-current-month-peer-advisors-by-name"
28- :append-icon =" sortOptions.sortBy === 'name' ? (sortOptions.sortDesc ? mdiMenuDown : mdiMenuUp) : undefined"
29- aria-label =" Sort by Peer Advisor"
30- block
31- class =" sort-col-btn font-weight-bold text-no-wrap v-table-sort-btn-override"
32- :class =" {'icon-visible': sortOptions.sortBy === 'name'}"
33- color =" body"
34- density =" compact"
35- size =" small"
36- text =" Peer Advisor"
37- variant =" plain"
38- @click =" onSortName"
39- />
40- </th >
41- <th
42- :aria-sort =" getPeerAdvisorAriaSort('noteCount', sortOptions)"
43- class =" bg-grey-lighten-2 border-sm text-right"
44- scope =" col"
45- >
46- <v-btn
47- id =" sort-current-month-peer-advisors-by-note-count"
48- :append-icon =" sortOptions.sortBy === 'noteCount' ? (sortOptions.sortDesc ? mdiMenuDown : mdiMenuUp) : undefined"
49- aria-label =" Sort by Notes"
50- block
51- class =" sort-col-btn font-weight-bold justify-end ml-auto text-no-wrap v-table-sort-btn-override"
52- :class =" {'icon-visible': sortOptions.sortBy === 'noteCount'}"
53- color =" body"
54- density =" compact"
55- size =" small"
56- text =" Notes"
57- variant =" plain"
58- @click =" onSortNoteCount"
59- />
60- </th >
61- </tr >
62- </thead >
63- <tbody >
64- <tr
65- v-for =" peerAdvisor in sortedPeerAdvisors"
66- :id =" `tr-current-month-peer-advisor-${peerAdvisor.uid}`"
67- :key =" peerAdvisor.uid"
68- >
69- <td
70- :id =" `td-current-month-peer-advisor-${peerAdvisor.uid}-name`"
71- :class =" {
72- 'demo-mode-blur': currentUser.inDemoMode,
73- 'font-weight-medium text-red': peerAdvisor.deletedAt && !currentUser.inDemoMode
74- }"
75- class =" border-sm w-90"
76- >
77- {{ peerAdvisor.name }}
78- <span v-if =" peerAdvisor.deletedAt" class =" text-medium-emphasis" >
79- (deleted on <Date :id =" ` peer-advisor-${peerAdvisor .uid }-deleted-at ` " :date =" peerAdvisor .deletedAt " />)
80- </span >
81- </td >
82- <td
83- :id =" `td-current-month-peer-advisor-${peerAdvisor.uid}-note-count`"
84- class =" border-sm text-no-wrap text-right"
85- >
86- <NotesCreatedByPeerAdvisor
87- v-if =" get (peerAdvisor , ' noteCount' )"
88- :header-text =" ` ${pluralize (' note' , toInt (get (peerAdvisor , ' noteCount' ) || 0 ), {1 : ' One' })} created by ${currentUser .inDemoMode ? ' ...' : peerAdvisor .name } ` "
89- :peer-advising-department =" notesReport .peerAdvisingDepartment "
90- :timeframe =" notesReport .currentMonth "
91- :user =" peerAdvisor "
92- />
93- <span v-if =" !get(peerAdvisor, 'noteCount')" :class =" {'font-weight-medium text-red': peerAdvisor.deletedAt}" >
94- 0<span class =" sr-only" > notes created in {{ notesReport.currentMonth.label }}</span >
95- </span >
96- </td >
97- </tr >
98- </tbody >
99- </table >
18+ <PeerAdvisorMonthlyNoteCountTable
19+ id-prefix="current-month-active"
20+ :peer-advisors =" partitionedPeerAdvisors .active "
21+ :peer-advising-department =" notesReport .peerAdvisingDepartment "
22+ section-label="Active Peer Advisors"
23+ :sort-options =" activeSortOptions "
24+ :timeframe =" notesReport .currentMonth "
25+ @sort-name =" onSortActiveName "
26+ @sort-note-count =" onSortActiveNoteCount "
27+ />
10028 <div
101- v-if =" !notesReport.currentMonth.peerAdvisors .length"
29+ v-if =" !partitionedPeerAdvisors.active .length"
10230 class =" font-weight-550 pa-3 text-medium-emphasis"
10331 >
10432 <span class =" font-weight-bold" >{{ notesReport.peerAdvisingDepartment.name }}</span >
10533 has had no active Peer Advisors in the current month.
10634 </div >
35+ <PeerAdvisorMonthlyNoteCountTable
36+ id-prefix="current-month-deleted"
37+ add-top-margin
38+ :is-deleted-section =" true "
39+ :peer-advisors =" partitionedPeerAdvisors .deleted "
40+ :peer-advising-department =" notesReport .peerAdvisingDepartment "
41+ section-label="Deleted Peer Advisors"
42+ :sort-options =" deletedSortOptions "
43+ :timeframe =" notesReport .currentMonth "
44+ @sort-name =" onSortDeletedName "
45+ @sort-note-count =" onSortDeletedNoteCount "
46+ />
10747 </div >
10848 </div >
10949</template >
11050
11151<script setup lang="ts">
11252import type {PropType } from ' vue'
11353import {computed , ref } from ' vue'
114- import {get } from ' lodash'
115- import {mdiMenuDown , mdiMenuUp } from ' @mdi/js'
11654import type {PeerAdvisingManagerReport } from ' @/lib/types-peer-advising'
117- import Date from ' @/components/util/Date.vue'
118- import NotesCreatedByPeerAdvisor from ' @/components/peer/note/NotesCreatedByPeerAdvisor.vue'
55+ import PeerAdvisorMonthlyNoteCountTable from ' @/components/peer/reports/PeerAdvisorMonthlyNoteCountTable.vue'
11956import PillCount from ' @/components/util/PillCount.vue'
12057import {
121- defaultPeerAdvisorSortOptions ,
122- getPeerAdvisorAriaSort ,
123- sortPeerAdvisors ,
58+ defaultPeerAdvisorNameSortOptions ,
59+ partitionPeerAdvisors ,
12460 togglePeerAdvisorSort
12561} from ' @/lib/peer-advisor-sort'
12662import type {PeerAdvisorSortOptions } from ' @/lib/peer-advisor-sort'
127- import {pluralize , toInt } from ' @/lib/utils'
128- import {useContextStore } from ' @/stores/context'
12963
13064const props = defineProps ({
13165 notesReport: {
@@ -134,61 +68,26 @@ const props = defineProps({
13468 }
13569})
13670
137- const currentUser = useContextStore (). currentUser
138- const sortOptions = ref <PeerAdvisorSortOptions >(defaultPeerAdvisorSortOptions ())
71+ const activeSortOptions = ref < PeerAdvisorSortOptions >( defaultPeerAdvisorNameSortOptions ())
72+ const deletedSortOptions = ref <PeerAdvisorSortOptions >(defaultPeerAdvisorNameSortOptions ())
13973
140- const sortedPeerAdvisors = computed (() => {
141- return sortPeerAdvisors (props .notesReport .currentMonth .peerAdvisors , sortOptions . value )
74+ const partitionedPeerAdvisors = computed (() => {
75+ return partitionPeerAdvisors (props .notesReport .currentMonth .peerAdvisors )
14276})
14377
144- const onSortName = () => {
145- sortOptions .value = togglePeerAdvisorSort (' name' , sortOptions .value )
78+ const onSortActiveName = () => {
79+ activeSortOptions .value = togglePeerAdvisorSort (' name' , activeSortOptions .value )
14680}
14781
148- const onSortNoteCount = () => {
149- sortOptions .value = togglePeerAdvisorSort (' noteCount' , sortOptions .value )
82+ const onSortActiveNoteCount = () => {
83+ activeSortOptions .value = togglePeerAdvisorSort (' noteCount' , activeSortOptions .value )
15084}
151- </script >
15285
153- <style scoped>
154- table {
155- border : 1px solid ;
156- border-collapse : collapse ;
157- }
158- th {
159- border : 1px solid ;
160- font-size : 14px ;
161- padding : 6px 12px ;
162- }
163- td {
164- border : 1px solid ;
165- padding : 6px 12px ;
86+ const onSortDeletedName = () => {
87+ deletedSortOptions .value = togglePeerAdvisorSort (' name' , deletedSortOptions .value )
16688}
167- .sort-col-btn {
168- height : 28px !important ;
169- letter-spacing : normal !important ;
170- margin : 0 4px 0 -.1em ;
171- min-width : 0px !important ;
172- padding : 0 2px 0 4px ;
173- }
174- </style >
17589
176- <style >
177- .v-table-sort-btn-override .v-btn__append {
178- margin-inline : 2px 1px !important ;
179- }
180- .v-table-sort-btn-override .v-btn__append .v-icon {
181- opacity : 0 ;
90+ const onSortDeletedNoteCount = () => {
91+ deletedSortOptions .value = togglePeerAdvisorSort (' noteCount' , deletedSortOptions .value )
18292}
183- .v-table-sort-btn-override .v-btn__content {
184- text-align : left ;
185- }
186- .v-table-sort-btn-override :active .v-btn__append .v-icon ,
187- .v-table-sort-btn-override :hover .v-btn__append .v-icon ,
188- .v-table-sort-btn-override :focus .v-btn__append .v-icon {
189- opacity : var (--v-medium-emphasis-opacity );
190- }
191- .v-table-sort-btn-override.icon-visible .v-btn__append .v-icon {
192- opacity : 1 ;
193- }
194- </style >
93+ </script >
0 commit comments