fix(frontend) : ERP-26/27 - review fixes: shared types, accents i18n, escape key, self-edit refresh, row-clickable guard

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-04-16 10:45:21 +02:00
parent 580ea01941
commit d49c317c49
9 changed files with 70 additions and 103 deletions

View File

@@ -40,14 +40,9 @@
</template>
<script setup lang="ts">
const { t } = useI18n()
import type { EffectivePermission } from '~/shared/types/rbac'
interface EffectivePermission {
code: string
label: string
module: string
sources: string[]
}
const { t } = useI18n()
const props = defineProps<{
permissions: EffectivePermission[]

View File

@@ -30,13 +30,7 @@
</template>
<script setup lang="ts">
interface Permission {
id: number
code: string
label: string
module: string
orphan: boolean
}
import type { Permission } from '~/shared/types/rbac'
const props = defineProps<{
module: string

View File

@@ -55,6 +55,14 @@ function cancel() {
function confirm() {
emit('confirm')
}
// Fermer la modale avec la touche Escape
function onKeydown(e: KeyboardEvent) {
if (e.key === 'Escape') cancel()
}
onMounted(() => document.addEventListener('keydown', onKeydown))
onUnmounted(() => document.removeEventListener('keydown', onKeydown))
</script>
<style scoped>

View File

@@ -70,22 +70,7 @@
</template>
<script setup lang="ts">
interface Permission {
id: number
code: string
label: string
module: string
orphan: boolean
}
interface Role {
id: number
code: string
label: string
description: string | null
isSystem: boolean
permissions: (Permission | string)[]
}
import type { Permission, Role } from '~/shared/types/rbac'
interface PermissionModule {
module: string

View File

@@ -91,37 +91,7 @@
</template>
<script setup lang="ts">
interface Permission {
id: number
code: string
label: string
module: string
orphan: boolean
}
interface Role {
id: number
code: string
label: string
description: string | null
isSystem: boolean
permissions: (Permission | string)[]
}
interface UserListItem {
id: number
username: string
isAdmin: boolean
roles: string[]
directPermissions: string[]
}
interface EffectivePermission {
code: string
label: string
module: string
sources: string[]
}
import type { Permission, Role, UserListItem, EffectivePermission } from '~/shared/types/rbac'
interface PermissionModule {
module: string
@@ -276,6 +246,10 @@ async function handleSave() {
}, {
toastSuccessMessage: t('admin.users.toast.updated'),
})
// Rafraichir les donnees du user courant si auto-edition
if (isSelfEdit.value) {
await auth.refreshUser()
}
emit('saved')
emit('update:modelValue', false)
} finally {