|
305 | 305 | :warning-text="getFirstWarning('tags')" |
306 | 306 | /> |
307 | 307 | <div class="flex items-center gap-4 mt-2 mb-3"> |
308 | | - <Tooltip v-if="!canGenerateTags && form.tags.length >= MAX_TAGS_NB"> |
| 308 | + <Tooltip v-if="!canGenerateTags && tagsSuggestionTooltip"> |
309 | 309 | <BrandedButton |
310 | 310 | type="button" |
311 | 311 | color="primary" |
|
316 | 316 | {{ $t('Suggérer des mots clés') }} |
317 | 317 | </BrandedButton> |
318 | 318 | <template #tooltip> |
319 | | - {{ $t('Vous avez déjà {count} mots-clés. Le maximum recommandé est de {max}.', { count: form.tags.length, max: MAX_TAGS_NB }) }} |
| 319 | + {{ tagsSuggestionTooltip }} |
320 | 320 | </template> |
321 | 321 | </Tooltip> |
322 | 322 | <BrandedButton |
@@ -481,6 +481,26 @@ const canGenerateTags = computed(() => { |
481 | 481 | return hasTitle && hasDescription && hasType && hasLessThanMaxTags |
482 | 482 | }) |
483 | 483 |
|
| 484 | +const tagsSuggestionTooltip = computed(() => { |
| 485 | + if (form.value.tags.length >= MAX_TAGS_NB) { |
| 486 | + return t('Vous avez déjà {count} mots-clés. Le maximum recommandé est de {max}.', { count: form.value.tags.length, max: MAX_TAGS_NB }) |
| 487 | + } |
| 488 | + const missing = [] |
| 489 | + if (!form.value.title || !form.value.title.trim().length) { |
| 490 | + missing.push(t('le titre')) |
| 491 | + } |
| 492 | + if (!form.value.description || !form.value.description.trim().length) { |
| 493 | + missing.push(t('la description')) |
| 494 | + } |
| 495 | + if (!form.value.type?.label || !form.value.type.label.trim().length) { |
| 496 | + missing.push(t('le type')) |
| 497 | + } |
| 498 | + if (missing.length > 0) { |
| 499 | + return t('Remplissez {fields} pour utiliser cette fonctionnalité.', { fields: missing.join(', ') }) |
| 500 | + } |
| 501 | + return '' |
| 502 | +}) |
| 503 | +
|
484 | 504 | const setFiles = (files: Array<File>) => { |
485 | 505 | reuseForm.value.image = files[0] |
486 | 506 | } |
|
0 commit comments