Skip to content

Commit

Permalink
Fix(actors): review button labels and new actor message in admin panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Ribiere committed Nov 6, 2024
1 parent db17b15 commit 4504bf1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions symfony/src/Entity/Trait/TimestampableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ trait TimestampableEntity
{
#[Gedmo\Timestampable(on: 'create')]
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
#[Groups([Actor::ACTOR_READ_ITEM, Actor::ACTOR_READ_COLLECTION])]
protected ?\DateTimeInterface $createdAt;

#[Gedmo\Timestampable(on: 'update')]
Expand Down
1 change: 1 addition & 0 deletions vue/src/assets/translations/fr/actors.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"form": {
"createTitle": "Ajouter un acteur",
"editTitle": "Modifier les informations",
"validateTitle": "Valider l'acteur",
"name": "Nom de l'acteur*",
"acronym": "Acronyme*",
"category": "Catégorie*",
Expand Down
34 changes: 31 additions & 3 deletions vue/src/views/actors/components/ActorEditionForm.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<template>
<Modal
:title="actorToEdit ? $t('actors.form.editTitle') : $t('actors.form.createTitle')"
:title="actorToEdit ?
userStore.userIsAdmin() && !actorToEdit.isValidated ?
$t('actors.form.validateTitle') :
$t('actors.form.editTitle') :
$t('actors.form.createTitle')"
:show="appStore.showEditContentDialog"
@close="actorsStore.actorEdition.active = false">
<template #content>
<div class="ContentForm__toValidate mt-3" v-if="actorToEdit && !actorToEdit.isValidated">
<img src="@/assets/images/actorToValidate.svg" alt="">
<span class="ml-2">Nouvelle soumission de Prénom NOM reçue le 31 janvier 2025 à 11h30.</span>
<span class="ml-2">Nouvelle soumission de {{ actorToEdit.name }} {{ actorToEdit.lastName }} reçue le
{{ createdDate }}.
</span>
</div>
<div class="ContentForm__ctn mt-4">
<v-form @submit.prevent="submitForm" id="actor-form">
Expand Down Expand Up @@ -95,7 +101,14 @@
<v-btn color="white" @click="actorsStore.actorEdition.active = false">{{ $t('forms.cancel') }}</v-btn>
</template>
<template #footer-right>
<v-btn type="submit" form="actor-form" color="main-red" :loading="isSubmitting">{{ actorToEdit ? $t('forms.modify') : $t('forms.create') }}</v-btn>
<v-btn type="submit" form="actor-form" color="main-red" :loading="isSubmitting">
{{ actorToEdit ?
userStore.userIsAdmin() && !actorToEdit.isValidated ?
$t('forms.submit') :
$t('forms.modify') :
$t('forms.create')
}}
</v-btn>
</template>
</Modal>
</template>
Expand All @@ -116,9 +129,11 @@ import Modal from '@/components/global/Modal.vue';
import type { MediaObject } from '@/models/interfaces/MediaObject';
import ImagesLoader from '@/components/forms/ImagesLoader.vue';
import { useThematicStore } from '@/stores/thematicStore';
import { useUserStore } from '@/stores/userStore';
const appStore = useApplicationStore();
const actorsStore = useActorsStore();
const thematicsStore = useThematicStore()
const userStore = useUserStore();
const actorToEdit: Actor | null = actorsStore.actorEdition.actor
const { form, handleSubmit, isSubmitting } = ActorsFormService.getActorsForm(actorToEdit);
Expand All @@ -127,6 +142,18 @@ const categoryItems = Object.values(ActorsCategories)
const expertisesItems = actorsStore.actorsExpertises
const thematicsItems = computed(() => thematicsStore.thematics)
const administrativeScopesItems = actorsStore.actorsAdministrativesScopes
const createdDate = computed(() => {
if (actorToEdit) {
return new Intl.DateTimeFormat('fr-FR', {
day: 'numeric',
month: 'long',
year: 'numeric',
hour: 'numeric',
minute: 'numeric'
}).format(new Date(actorToEdit.createdAt));
}
return null
})
const existingLogo = ref<(MediaObject | string)[]>([]);
const existingImages = ref<(MediaObject | string)[]>([])
Expand All @@ -135,6 +162,7 @@ let existingExternalImages: string[] = []
onMounted(async () => {
await thematicsStore.getAll()
if (actorToEdit) {
console.log(actorToEdit)
actorToEdit.logo ? existingLogo.value = [actorToEdit.logo] : existingLogo.value = []
existingImages.value = [...actorToEdit.images, ...actorToEdit.externalImages]
existingHostedImages = actorToEdit.images
Expand Down

0 comments on commit 4504bf1

Please sign in to comment.