Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb2adc9fdc | ||
|
|
4775cbf184 | ||
|
|
8be96bce0c | ||
|
|
fb97b8d4e3 |
@@ -18,7 +18,12 @@ framework:
|
|||||||
failed: 'doctrine://default?queue_name=failed&auto_setup=0'
|
failed: 'doctrine://default?queue_name=failed&auto_setup=0'
|
||||||
|
|
||||||
routing:
|
routing:
|
||||||
'App\Message\MailSyncRequested': async
|
# Sync à la demande (bouton « rafraîchir ») : exécutée pendant la requête HTTP
|
||||||
|
# pour que le re-fetch du front voie immédiatement les nouveaux mails, sans worker
|
||||||
|
# messenger:consume à maintenir. La sync de fond reste assurée par le cron OS
|
||||||
|
# (app:mail:sync, synchrone, indépendant du bus). Repasser à `async` + worker si
|
||||||
|
# la boîte grossit au point que la sync à la demande approche le timeout PHP.
|
||||||
|
'App\Message\MailSyncRequested': sync
|
||||||
|
|
||||||
when@test:
|
when@test:
|
||||||
framework:
|
framework:
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
parameters:
|
parameters:
|
||||||
app.version: '0.4.1'
|
app.version: '0.4.3'
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
<MalioDrawer v-model="isOpen" :title="isEditing ? $t('projects.editProject') : $t('projects.addProject')">
|
<MalioDrawer v-model="isOpen" :title="isEditing ? $t('projects.editProject') : $t('projects.addProject')">
|
||||||
<form @submit.prevent="handleSubmit" class="flex flex-col gap-2">
|
<form @submit.prevent="handleSubmit" class="flex flex-col gap-2">
|
||||||
<MalioInputText
|
<MalioInputText
|
||||||
v-model="form.code"
|
v-model="codeProxy"
|
||||||
label="Code"
|
label="Code"
|
||||||
input-class="w-full uppercase"
|
input-class="w-full"
|
||||||
|
:max-length="10"
|
||||||
:disabled="isEditing"
|
:disabled="isEditing"
|
||||||
:error="touched.code && !form.code.trim() ? 'Le code est requis' : touched.code && !/^[A-Z]{2,10}$/.test(form.code.trim()) ? '2 à 10 lettres majuscules' : ''"
|
:error="touched.code && !form.code ? 'Le code est requis' : touched.code && !/^[A-Z]{2,10}$/.test(form.code) ? '2 à 10 lettres majuscules' : ''"
|
||||||
@blur="touched.code = true"
|
@blur="touched.code = true"
|
||||||
@input="form.code = form.code.toUpperCase().replace(/[^A-Z]/g, '')"
|
|
||||||
/>
|
/>
|
||||||
<MalioInputText
|
<MalioInputText
|
||||||
v-model="form.name"
|
v-model="form.name"
|
||||||
@@ -186,6 +186,17 @@ const touched = reactive({
|
|||||||
name: false,
|
name: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Source unique de vérité : on sanitise dans le setter (majuscules, lettres
|
||||||
|
// uniquement, max 10) plutôt que via @input — sinon course entre la mutation
|
||||||
|
// manuelle et l'émission update:modelValue de MalioInputText, qui laissait
|
||||||
|
// form.code en minuscules et bloquait la création.
|
||||||
|
const codeProxy = computed({
|
||||||
|
get: () => form.code,
|
||||||
|
set: (value: string) => {
|
||||||
|
form.code = (value ?? '').toUpperCase().replace(/[^A-Z]/g, '').slice(0, 10)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const clientOptions = computed(() =>
|
const clientOptions = computed(() =>
|
||||||
props.clients.map(c => ({ label: c.name, value: c.id }))
|
props.clients.map(c => ({ label: c.name, value: c.id }))
|
||||||
)
|
)
|
||||||
@@ -222,7 +233,7 @@ async function handleSubmit() {
|
|||||||
touched.name = true
|
touched.name = true
|
||||||
touched.code = true
|
touched.code = true
|
||||||
if (!form.name.trim()) return
|
if (!form.name.trim()) return
|
||||||
if (!isEditing.value && (!form.code.trim() || !/^[A-Z]{2,10}$/.test(form.code.trim()))) return
|
if (!isEditing.value && !/^[A-Z]{2,10}$/.test(form.code)) return
|
||||||
|
|
||||||
isSubmitting.value = true
|
isSubmitting.value = true
|
||||||
try {
|
try {
|
||||||
@@ -254,7 +265,7 @@ async function handleSubmit() {
|
|||||||
if (isEditing.value && props.project) {
|
if (isEditing.value && props.project) {
|
||||||
await update(props.project.id, payload)
|
await update(props.project.id, payload)
|
||||||
} else {
|
} else {
|
||||||
payload.code = form.code.trim()
|
payload.code = form.code
|
||||||
await create(payload)
|
await create(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,45 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<p class="mb-2 text-sm font-medium text-neutral-700">Couleur</p>
|
<p class="mb-2 text-sm font-medium text-neutral-700">Couleur</p>
|
||||||
<div class="flex flex-wrap gap-3">
|
<div class="flex flex-wrap items-center gap-3">
|
||||||
<button
|
<button
|
||||||
v-for="color in colors"
|
v-for="color in presets"
|
||||||
:key="color"
|
:key="color"
|
||||||
type="button"
|
type="button"
|
||||||
class="h-10 w-10 rounded-full border-2 transition-transform hover:scale-110"
|
class="h-10 w-10 rounded-full border-2 transition-transform hover:scale-110"
|
||||||
:class="modelValue === color ? 'border-neutral-900 scale-110' : 'border-transparent'"
|
:class="isSelected(color) ? 'border-neutral-900 scale-110' : 'border-transparent'"
|
||||||
:style="{ backgroundColor: color }"
|
:style="{ backgroundColor: color }"
|
||||||
@click="emit('update:modelValue', color)"
|
:aria-label="`Choisir la couleur ${color}`"
|
||||||
|
@click="select(color)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<!-- Couleur personnalisée : input natif déguisé en pastille -->
|
||||||
|
<label
|
||||||
|
class="relative flex h-10 w-10 cursor-pointer items-center justify-center rounded-full border-2 transition-transform hover:scale-110"
|
||||||
|
:class="isCustom ? 'border-neutral-900 scale-110' : 'border-dashed border-neutral-400'"
|
||||||
|
:style="isCustom ? { backgroundColor: modelValue } : {}"
|
||||||
|
title="Couleur personnalisée"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
class="absolute inset-0 h-full w-full cursor-pointer opacity-0"
|
||||||
|
:value="modelValue"
|
||||||
|
aria-label="Choisir une couleur personnalisée"
|
||||||
|
@input="select(($event.target as HTMLInputElement).value)"
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
v-if="!isCustom"
|
||||||
|
name="mdi:plus"
|
||||||
|
class="text-neutral-500"
|
||||||
|
size="20"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: string
|
modelValue: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
@@ -24,8 +47,26 @@ const emit = defineEmits<{
|
|||||||
(e: 'update:modelValue', value: string): void
|
(e: 'update:modelValue', value: string): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const colors = [
|
// Les 9 premières sont historiques (couleurs déjà en base) — ne pas réordonner
|
||||||
'#222783', '#26A69A', '#E91E63', '#4A90D9',
|
// pour que les projets/tags existants restent associés à une pastille.
|
||||||
'#7E57C2', '#8BC34A', '#FDD835', '#80DEEA', '#FF7043',
|
const presets = [
|
||||||
|
'#222783', '#26A69A', '#E91E63', '#4A90D9', '#7E57C2',
|
||||||
|
'#8BC34A', '#FDD835', '#80DEEA', '#FF7043', '#EF4444',
|
||||||
|
'#F97316', '#F59E0B', '#22C55E', '#10B981', '#06B6D4',
|
||||||
|
'#3B82F6', '#8B5CF6', '#64748B',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const norm = (value: string): string => (value ?? '').toUpperCase()
|
||||||
|
|
||||||
|
function isSelected(color: string): boolean {
|
||||||
|
return norm(props.modelValue) === norm(color)
|
||||||
|
}
|
||||||
|
|
||||||
|
const isCustom = computed(
|
||||||
|
() => !!props.modelValue && !presets.some((c) => norm(c) === norm(props.modelValue)),
|
||||||
|
)
|
||||||
|
|
||||||
|
function select(value: string): void {
|
||||||
|
emit('update:modelValue', norm(value))
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user