Skip to content

Commit

Permalink
feat: add sort button to colleagues list card view
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Trost <[email protected]>
  • Loading branch information
galexrt committed Dec 22, 2024
1 parent 0858265 commit be74163
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/components/citizens/info/CitizenActivityFeed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ watch(offset, async () => refresh());

<SortButton
v-model="sort"
:fields="[{ label: 'common.created_at', value: 'createdAt' }]"
:fields="[{ label: $t('common.created_at'), value: 'createdAt' }]"
class="flex-initial"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/components/documents/DocumentList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ defineShortcuts({
<SortButton
v-model="sort"
:fields="[
{ label: 'common.created_at', value: 'createdAt' },
{ label: 'common.title', value: 'title' },
{ label: $t('common.created_at'), value: 'createdAt' },
{ label: $t('common.title'), value: 'title' },
]"
/>
</UFormGroup>
Expand Down
11 changes: 11 additions & 0 deletions app/components/jobs/colleagues/ColleaguesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ProfilePictureImg from '~/components/partials/citizens/ProfilePictureImg.
import DataErrorBlock from '~/components/partials/data/DataErrorBlock.vue';
import GenericTime from '~/components/partials/elements/GenericTime.vue';
import Pagination from '~/components/partials/Pagination.vue';
import SortButton from '~/components/partials/SortButton.vue';
import { useSettingsStore } from '~/store/settings';
import type { Label } from '~~/gen/ts/resources/jobs/labels';
import type { Timestamp } from '~~/gen/ts/resources/timestamp/timestamp';
Expand Down Expand Up @@ -215,6 +216,16 @@ defineShortcuts({
</div>
</UFormGroup>

<UFormGroup v-if="jobsService.cardView" :label="$t('common.sort_by')">
<SortButton
v-model="sort"
:fields="[
{ label: $t('common.rank'), value: 'rank' },
{ label: $t('common.name'), value: 'name' },
]"
/>
</UFormGroup>

<UFormGroup label="&nbsp">
<UButtonGroup>
<UButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ watchDebounced(query, async () => refresh(), {
</UFormGroup>

<UFormGroup label="&nbsp;">
<SortButton v-model="sort" :fields="[{ label: 'common.created_at', value: 'createdAt' }]" />
<SortButton v-model="sort" :fields="[{ label: $t('common.created_at'), value: 'createdAt' }]" />
</UFormGroup>
</UForm>
</UDashboardToolbar>
Expand Down
6 changes: 4 additions & 2 deletions app/components/partials/SortButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ function changeColumn(col: string): void {
@update:model-value="changeColumn($event)"
>
<template #label>
{{ $t(fields.find((f) => f.value === sort.column)?.label ?? 'common.na') }}
{{ fields.find((f) => f.value === sort.column)?.label ?? $t('common.na') }}
</template>

<template #option="{ option: field }">
{{ $t(field.label) }}
{{ field.label }}
</template>

<template #empty> {{ $t('common.not_found', [$t('common.field', 2)]) }} </template>
</USelectMenu>
</ClientOnly>
Expand Down
2 changes: 1 addition & 1 deletion app/components/qualifications/QualificationsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ watch(offset, async () => refresh());
{{ $t('components.qualifications.all_qualifications') }}
</h3>

<SortButton v-model="sort" :fields="[{ label: 'common.id', value: 'id' }]" />
<SortButton v-model="sort" :fields="[{ label: $t('common.id'), value: 'id' }]" />
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ watch(offset, async () => refresh());
{{ $t('components.qualifications.user_requests') }}
</h3>

<SortButton v-model="sort" :fields="[{ label: 'common.id', value: 'id' }]" />
<SortButton v-model="sort" :fields="[{ label: $t('common.id'), value: 'id' }]" />
</div>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ watch(offset, async () => refresh());
{{ $t('common.qualification', 2) }}
</h3>

<SortButton v-model="sort" :fields="[{ label: 'common.id', value: 'id' }]" />
<SortButton v-model="sort" :fields="[{ label: $t('common.id'), value: 'id' }]" />
</div>
</template>

Expand Down

0 comments on commit be74163

Please sign in to comment.