Skip to content

Commit 6bea14e

Browse files
committed
feat: translate /admin/users
1 parent 25f2373 commit 6bea14e

File tree

16 files changed

+147
-84
lines changed

16 files changed

+147
-84
lines changed

frontend/src/features/admin/business-hours/BusinessHoursForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
{{
137137
holidayDate && !isNaN(new Date(holidayDate).getTime())
138138
? format(new Date(holidayDate), 'MMMM dd, yyyy')
139-
: t('form.field.pick_a_date')
139+
: t('form.field.pickDate')
140140
}}
141141
</Button>
142142
</PopoverTrigger>

frontend/src/features/admin/business-hours/dataTableDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<AlertDialogContent>
2121
<AlertDialogHeader>
2222
<AlertDialogTitle>
23-
{{ t('admin.business_hours.delete_confirmation_title') }}
23+
{{ t('globals.messages.areYouAbsolutelySure') }}
2424
</AlertDialogTitle>
2525
<AlertDialogDescription>
2626
{{ t('admin.business_hours.delete_confirmation') }}

frontend/src/features/admin/inbox/InboxDataTableDropDown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<AlertDialog :open="alertOpen" @update:open="alertOpen = $event">
2626
<AlertDialogContent>
2727
<AlertDialogHeader>
28-
<AlertDialogTitle>{{ $t('admin.inbox.delete_confirmation_title') }}</AlertDialogTitle>
28+
<AlertDialogTitle>{{ $t('globals.messages.areYouAbsolutelySure') }}</AlertDialogTitle>
2929
<AlertDialogDescription>
3030
{{ $t('admin.inbox.delete_confirmation') }}
3131
</AlertDialogDescription>

frontend/src/features/admin/macros/dataTableDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<AlertDialog :open="isDeleteOpen" @update:open="isDeleteOpen = $event">
1818
<AlertDialogContent>
1919
<AlertDialogHeader>
20-
<AlertDialogTitle>{{ $t('admin.macro.delete_confirmation_title') }}</AlertDialogTitle>
20+
<AlertDialogTitle>{{ $t('globals.messages.areYouAbsolutelySure') }}</AlertDialogTitle>
2121
<AlertDialogDescription>
2222
{{ $t('admin.macro.delete_confirmation') }}
2323
</AlertDialogDescription>

frontend/src/features/admin/sla/dataTableDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<AlertDialog :open="alertOpen" @update:open="alertOpen = $event">
1616
<AlertDialogContent>
1717
<AlertDialogHeader>
18-
<AlertDialogTitle>{{ t('admin.sla.delete_confirmation_title') }}</AlertDialogTitle>
18+
<AlertDialogTitle>{{ t('globals.messages.areYouAbsolutelySure') }}</AlertDialogTitle>
1919
<AlertDialogDescription>
2020
{{ t('admin.sla.delete_confirmation') }}
2121
</AlertDialogDescription>

frontend/src/features/admin/status/dataTableDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<AlertDialogContent>
4343
<AlertDialogHeader>
4444
<AlertDialogTitle>
45-
{{ $t('admin.conversation_status.delete_confirmation_title') }}</AlertDialogTitle
45+
{{ $t('globals.messages.areYouAbsolutelySure') }}</AlertDialogTitle
4646
>
4747
<AlertDialogDescription>
4848
{{ $t('admin.conversation_status.delete_confirmation') }}

frontend/src/features/admin/tags/dataTableDropdown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<AlertDialog :open="alertOpen" @update:open="alertOpen = $event">
3535
<AlertDialogContent>
3636
<AlertDialogHeader>
37-
<AlertDialogTitle>{{t('admin.conversation_tags.delete_confirmation_title')}}</AlertDialogTitle>
37+
<AlertDialogTitle>{{t('globals.messages.areYouAbsolutelySure')}}</AlertDialogTitle>
3838
<AlertDialogDescription>
3939
{{t('admin.conversation_tags.delete_confirmation')}}
4040
</AlertDialogDescription>

frontend/src/features/admin/users/UserForm.vue

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,69 @@
22
<form @submit.prevent="onSubmit" class="space-y-6">
33
<FormField v-slot="{ field }" name="first_name">
44
<FormItem v-auto-animate>
5-
<FormLabel>First name</FormLabel>
5+
<FormLabel>{{ $t('form.field.firstName') }}</FormLabel>
66
<FormControl>
7-
<Input type="text" placeholder="First name" v-bind="field" />
7+
<Input type="text" placeholder="" v-bind="field" />
88
</FormControl>
99
<FormMessage />
1010
</FormItem>
1111
</FormField>
1212

1313
<FormField v-slot="{ field }" name="last_name">
1414
<FormItem>
15-
<FormLabel>Last name</FormLabel>
15+
<FormLabel>{{ $t('form.field.lastName') }}</FormLabel>
1616
<FormControl>
17-
<Input type="text" placeholder="Last name" v-bind="field" />
17+
<Input type="text" placeholder="" v-bind="field" />
1818
</FormControl>
1919
<FormMessage />
2020
</FormItem>
2121
</FormField>
2222

2323
<FormField v-slot="{ field }" name="email">
2424
<FormItem v-auto-animate>
25-
<FormLabel>Email</FormLabel>
25+
<FormLabel>{{ $t('form.field.email') }}</FormLabel>
2626
<FormControl>
27-
<Input type="email" placeholder="Email" v-bind="field" />
27+
<Input type="email" placeholder="" v-bind="field" />
2828
</FormControl>
2929
<FormMessage />
3030
</FormItem>
3131
</FormField>
3232

33-
<FormField v-slot="{ componentField , handleChange }" name="teams">
33+
<FormField v-slot="{ componentField, handleChange }" name="teams">
3434
<FormItem v-auto-animate>
35-
<FormLabel>Teams</FormLabel>
35+
<FormLabel>{{ $t('form.field.teams') }}</FormLabel>
3636
<FormControl>
37-
<SelectTag :items="teamOptions" placeholder="Select teams" v-model="componentField.modelValue" @update:modelValue="handleChange"/>
37+
<SelectTag
38+
:items="teamOptions"
39+
:placeholder="t('form.field.selectTeams')"
40+
v-model="componentField.modelValue"
41+
@update:modelValue="handleChange"
42+
/>
3843
</FormControl>
3944
<FormMessage />
4045
</FormItem>
4146
</FormField>
4247

4348
<FormField v-slot="{ componentField, handleChange }" name="roles">
4449
<FormItem v-auto-animate>
45-
<FormLabel>Roles</FormLabel>
50+
<FormLabel>{{ $t('form.field.roles') }}</FormLabel>
4651
<FormControl>
47-
<SelectTag :items="roleOptions" placeholder="Select roles" v-model="componentField.modelValue" @update:modelValue="handleChange"/>
52+
<SelectTag
53+
:items="roleOptions"
54+
:placeholder="t('form.field.selectRoles')"
55+
v-model="componentField.modelValue"
56+
@update:modelValue="handleChange"
57+
/>
4858
</FormControl>
4959
<FormMessage />
5060
</FormItem>
5161
</FormField>
5262

5363
<FormField v-slot="{ field }" name="new_password" v-if="!isNewForm">
5464
<FormItem v-auto-animate>
55-
<FormLabel>Set password</FormLabel>
65+
<FormLabel>{{ t('form.field.setPassword') }}</FormLabel>
5666
<FormControl>
57-
<Input type="password" placeholder="Password" v-bind="field" />
67+
<Input type="password" placeholder="" v-bind="field" />
5868
</FormControl>
5969
<FormMessage />
6070
</FormItem>
@@ -65,7 +75,7 @@
6575
<FormControl>
6676
<div class="flex items-center space-x-2">
6777
<Checkbox :checked="value" @update:checked="handleChange" />
68-
<Label>Send welcome email?</Label>
78+
<Label>{{ $t('form.field.sendWelcomeEmail') }}</Label>
6979
</div>
7080
</FormControl>
7181
<FormMessage />
@@ -78,7 +88,7 @@
7888
<Checkbox :checked="value" @update:checked="handleChange" />
7989
</FormControl>
8090
<div class="space-y-1 leading-none">
81-
<FormLabel> Enabled </FormLabel>
91+
<FormLabel> {{ $t('form.field.enabled') }} </FormLabel>
8292
<FormMessage />
8393
</div>
8494
</FormItem>
@@ -93,13 +103,14 @@ import { watch, onMounted, ref, computed } from 'vue'
93103
import { Button } from '@/components/ui/button'
94104
import { useForm } from 'vee-validate'
95105
import { toTypedSchema } from '@vee-validate/zod'
96-
import { userFormSchema } from './formSchema.js'
106+
import { createFormSchema } from './formSchema.js'
97107
import { Checkbox } from '@/components/ui/checkbox'
98108
import { Label } from '@/components/ui/label'
99109
import { vAutoAnimate } from '@formkit/auto-animate/vue'
100110
import { FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'
101111
import { SelectTag } from '@/components/ui/select'
102112
import { Input } from '@/components/ui/input'
113+
import { useI18n } from 'vue-i18n'
103114
import api from '@/api'
104115
105116
const props = defineProps({
@@ -126,7 +137,7 @@ const props = defineProps({
126137
required: false
127138
}
128139
})
129-
140+
const { t } = useI18n()
130141
const teams = ref([])
131142
const roles = ref([])
132143
@@ -140,11 +151,15 @@ onMounted(async () => {
140151
}
141152
})
142153
143-
const teamOptions = computed(() => teams.value.map((team) => ({ label: team.name, value: team.name })))
144-
const roleOptions = computed(() => roles.value.map((role) => ({ label: role.name, value: role.name })))
154+
const teamOptions = computed(() =>
155+
teams.value.map((team) => ({ label: team.name, value: team.name }))
156+
)
157+
const roleOptions = computed(() =>
158+
roles.value.map((role) => ({ label: role.name, value: role.name }))
159+
)
145160
146161
const form = useForm({
147-
validationSchema: toTypedSchema(userFormSchema)
162+
validationSchema: toTypedSchema(createFormSchema(t))
148163
})
149164
150165
const onSubmit = form.handleSubmit((values) => {

frontend/src/features/admin/users/dataTableColumns.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { h } from 'vue'
22
import UserDataTableDropDown from '@/features/admin/users/dataTableDropdown.vue'
33
import { format } from 'date-fns'
44

5-
export const columns = [
5+
export const createColumns = (t) => [
66
{
77
accessorKey: 'first_name',
88
header: function () {
9-
return h('div', { class: 'text-center' }, 'First name')
9+
return h('div', { class: 'text-center' }, t('form.field.firstName'))
1010
},
1111
cell: function ({ row }) {
1212
return h('div', { class: 'text-center font-medium' }, row.getValue('first_name'))
@@ -15,7 +15,7 @@ export const columns = [
1515
{
1616
accessorKey: 'last_name',
1717
header: function () {
18-
return h('div', { class: 'text-center' }, 'Last name')
18+
return h('div', { class: 'text-center' }, t('form.field.lastName'))
1919
},
2020
cell: function ({ row }) {
2121
return h('div', { class: 'text-center font-medium' }, row.getValue('last_name'))
@@ -24,16 +24,16 @@ export const columns = [
2424
{
2525
accessorKey: 'enabled',
2626
header: function () {
27-
return h('div', { class: 'text-center' }, 'Enabled')
27+
return h('div', { class: 'text-center' }, t('form.field.enabled'))
2828
},
2929
cell: function ({ row }) {
30-
return h('div', { class: 'text-center font-medium' }, row.getValue('enabled') ? 'Yes' : 'No')
30+
return h('div', { class: 'text-center font-medium' }, row.getValue('enabled') ? t('globals.messages.yes') : t('globals.messages.no'))
3131
}
3232
},
3333
{
3434
accessorKey: 'email',
3535
header: function () {
36-
return h('div', { class: 'text-center' }, 'Email')
36+
return h('div', { class: 'text-center' }, t('form.field.email'))
3737
},
3838
cell: function ({ row }) {
3939
return h('div', { class: 'text-center font-medium' }, row.getValue('email'))
@@ -42,7 +42,7 @@ export const columns = [
4242
{
4343
accessorKey: 'created_at',
4444
header: function () {
45-
return h('div', { class: 'text-center' }, 'Created at')
45+
return h('div', { class: 'text-center' }, t('form.field.createdAt'))
4646
},
4747
cell: function ({ row }) {
4848
return h(
@@ -55,7 +55,7 @@ export const columns = [
5555
{
5656
accessorKey: 'updated_at',
5757
header: function () {
58-
return h('div', { class: 'text-center' }, 'Updated at')
58+
return h('div', { class: 'text-center' }, t('form.field.updatedAt'))
5959
},
6060
cell: function ({ row }) {
6161
return h(

frontend/src/features/admin/users/dataTableDropdown.vue

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@
22
<DropdownMenu>
33
<DropdownMenuTrigger as-child>
44
<Button variant="ghost" class="w-8 h-8 p-0">
5-
<span class="sr-only">Open menu</span>
5+
<span class="sr-only"></span>
66
<MoreHorizontal class="w-4 h-4" />
77
</Button>
88
</DropdownMenuTrigger>
99
<DropdownMenuContent>
10-
<DropdownMenuItem @click="editUser(props.user.id)">Edit</DropdownMenuItem>
11-
<DropdownMenuItem @click="() => (alertOpen = true)">Delete</DropdownMenuItem>
10+
<DropdownMenuItem @click="editUser(props.user.id)">{{
11+
$t('globals.buttons.edit')
12+
}}</DropdownMenuItem>
13+
<DropdownMenuItem @click="() => (alertOpen = true)">{{
14+
$t('globals.buttons.delete')
15+
}}</DropdownMenuItem>
1216
</DropdownMenuContent>
1317
</DropdownMenu>
1418

1519
<AlertDialog :open="alertOpen" @update:open="alertOpen = $event">
1620
<AlertDialogContent>
1721
<AlertDialogHeader>
18-
<AlertDialogTitle>Delete User</AlertDialogTitle>
19-
<AlertDialogDescription>
20-
This action cannot be undone. This will permanently delete the user.
21-
</AlertDialogDescription>
22+
<AlertDialogTitle>{{ $t('globals.messages.areYouAbsolutelySure') }}</AlertDialogTitle>
23+
<AlertDialogDescription>{{ $t('admin.user.deleteConfirmation') }}</AlertDialogDescription>
2224
</AlertDialogHeader>
2325
<AlertDialogFooter>
24-
<AlertDialogCancel>Cancel</AlertDialogCancel>
25-
<AlertDialogAction @click="handleDelete">Delete</AlertDialogAction>
26+
<AlertDialogCancel>{{ $t('globals.buttons.cancel') }}</AlertDialogCancel>
27+
<AlertDialogAction @click="handleDelete">{{
28+
$t('globals.buttons.delete')
29+
}}</AlertDialogAction>
2630
</AlertDialogFooter>
2731
</AlertDialogContent>
2832
</AlertDialog>
@@ -79,7 +83,6 @@ async function handleDelete() {
7983
emitRefreshUserList()
8084
} catch (error) {
8185
emit.emit(EMITTER_EVENTS.SHOW_TOAST, {
82-
title: 'Error',
8386
variant: 'destructive',
8487
description: handleHTTPError(error).message
8588
})

0 commit comments

Comments
 (0)