diff --git a/web/components/Account/Place/ListItem/PlaceListItem.tsx b/web/components/Account/Place/ListItem/PlaceListItem.tsx
index d77c8289..076d2050 100644
--- a/web/components/Account/Place/ListItem/PlaceListItem.tsx
+++ b/web/components/Account/Place/ListItem/PlaceListItem.tsx
@@ -22,7 +22,7 @@ interface Props {
const PlaceListItem = ({ place, setVisible, isFirst }: Props) => {
const isComplete = useIsComplete(place)
- const { currentCampaign } = useCampaignContext()
+ const { currentCampaign, isCampaignPlace } = useCampaignContext()
useEffect(() => {
if (!isComplete) {
@@ -32,7 +32,8 @@ const PlaceListItem = ({ place, setVisible, isFirst }: Props) => {
const { campaignDisposNum } = useCampaignDispo(place?.disponibilities)
const showCampaignDisponibilities =
- currentCampaign?.mode === 'disponibilities' || campaignDisposNum
+ (currentCampaign?.mode === 'disponibilities' || campaignDisposNum) &&
+ isCampaignPlace
return (
{
)
const currentCampaign = activeCampaigns?.[0]
+
const isCampaignPlace =
user?.type === 'place' &&
Boolean(
currentCampaign?.users_permissions_users.find((el) => el.id === user?.id),
)
+
const hasActiveCampaign =
(currentCampaign?.mode === 'disponibilities' && isCampaignPlace) ||
currentCampaign?.mode === 'applications'
diff --git a/web/components/Campaign/CampaignTag.tsx b/web/components/Campaign/CampaignTag.tsx
index b8a08505..036adac8 100644
--- a/web/components/Campaign/CampaignTag.tsx
+++ b/web/components/Campaign/CampaignTag.tsx
@@ -43,7 +43,7 @@ const CampaignTag = ({
)
}
- console.log(hasCampaignDispo && !isCampaignTab)
+
if (hasCampaignDispo && !isCampaignTab) {
return (
diff --git a/web/components/Campaign/Places/Application/ApplicationConfirmed.tsx b/web/components/Campaign/Places/Application/ApplicationConfirmed.tsx
index 546789a7..80dc5a0f 100644
--- a/web/components/Campaign/Places/Application/ApplicationConfirmed.tsx
+++ b/web/components/Campaign/Places/Application/ApplicationConfirmed.tsx
@@ -10,9 +10,12 @@ import {
import Link from '~components/Link'
import { useTranslation } from 'next-i18next'
import { ROUTE_ACCOUNT_MY_APPLICATIONS } from '~constants'
+import useCampaignContext from '~components/Campaign/useCampaignContext'
+import { format } from '~utils/date'
-const ApplicationConfirmed = ({ structureName }) => {
+const ApplicationConfirmed = () => {
const { t } = useTranslation('place')
+ const { currentCampaign } = useCampaignContext()
return (
@@ -21,7 +24,12 @@ const ApplicationConfirmed = ({ structureName }) => {
{t('campaignApplication.confirmed.text', {
- place: structureName,
+ campaign: currentCampaign?.title,
+ preselection_start: format(
+ currentCampaign?.preselection_start,
+ 'dd/MM',
+ ),
+ preselection_end: format(currentCampaign?.preselection_end, 'dd/MM'),
})}
diff --git a/web/components/Campaign/Places/Application/ApplicationCreation.tsx b/web/components/Campaign/Places/Application/ApplicationCreation.tsx
index c6d1cc7c..39f22130 100644
--- a/web/components/Campaign/Places/Application/ApplicationCreation.tsx
+++ b/web/components/Campaign/Places/Application/ApplicationCreation.tsx
@@ -32,6 +32,7 @@ const ApplicationCreation = () => {
helper={t('campaignApplication.creation.file_helper')}
acceptableTypes={['application/pdf']}
maxSize={5}
+ cta={t('campaignApplication.creation.file_cta')}
/>
{
return (
-
+ {currentCampaign?.eligibility && (
+ <>
+
- {currentCampaign?.chart_url && (
-
-
- {t('campaignApplication.eligibility.chart_front')}
-
-
-
- {t('campaignApplication.eligibility.chart_back')}
-
-
- )}
+ {currentCampaign?.chart_url && (
+
+
+ {t('campaignApplication.eligibility.chart_front')}
+
+
+
+ {t('campaignApplication.eligibility.chart_back')}
+
+
+ )}
- {currentCampaign?.eligibility}
+ {currentCampaign?.eligibility}
+ >
+ )}
+
+ {t(
+ currentCampaign?.eligibility
+ ? 'campaignApplication.eligibility.label_start'
+ : 'campaignApplication.eligibility.no_eligibility_label_start',
+ )}
+
+
+
+ {t('campaignApplication.eligibility.label_cgu')}
+
+
+ {t('campaignApplication.eligibility.label_end', {
+ title: currentCampaign?.title,
+ })}
+
+
+ }
/>
)
diff --git a/web/components/Campaign/Places/Application/ApplicationForm.tsx b/web/components/Campaign/Places/Application/ApplicationForm.tsx
index d5c7649f..077c8fdd 100644
--- a/web/components/Campaign/Places/Application/ApplicationForm.tsx
+++ b/web/components/Campaign/Places/Application/ApplicationForm.tsx
@@ -136,7 +136,7 @@ const ApplicationForm = ({
>
{t('campaignApplication.confirm', {
- place: currentCampaign?.title,
+ place: place?.users_permissions_user?.structureName,
})}
diff --git a/web/components/Campaign/Places/Application/ApplicationGeneral.tsx b/web/components/Campaign/Places/Application/ApplicationGeneral.tsx
index 199c3a6f..bccf560a 100644
--- a/web/components/Campaign/Places/Application/ApplicationGeneral.tsx
+++ b/web/components/Campaign/Places/Application/ApplicationGeneral.tsx
@@ -1,13 +1,11 @@
-import { VStack, Text, Box, Textarea } from '@chakra-ui/react'
+import { VStack } from '@chakra-ui/react'
import { useTranslation } from 'next-i18next'
import ApplicationFormTitle from '~components/Campaign/Places/Application/ApplicationFormTitle'
import BooleanField from '~components/Campaign/Places/Application/Inputs/BooleanField'
import TextAreaField from '~components/Campaign/Places/Application/Inputs/TextAreaField'
-import useCampaignContext from '~components/Campaign/useCampaignContext'
import { Espace } from '~typings/api'
const ApplicationGeneral = ({ place }: { place: Espace }) => {
- const { currentCampaign } = useCampaignContext()
const { t } = useTranslation('place')
return (
@@ -18,7 +16,7 @@ const ApplicationGeneral = ({ place }: { place: Espace }) => {
diff --git a/web/components/Campaign/Places/Application/CampaignApplicationPopin.tsx b/web/components/Campaign/Places/Application/CampaignApplicationPopin.tsx
index d15a6915..3073c0c1 100644
--- a/web/components/Campaign/Places/Application/CampaignApplicationPopin.tsx
+++ b/web/components/Campaign/Places/Application/CampaignApplicationPopin.tsx
@@ -20,12 +20,7 @@ const CampaignApplicationPopin = ({ events, place, back }: Props) => {
const [isConfirmed, setConfirmed] = useState(false)
const { t } = useTranslation('place')
- if (isConfirmed)
- return (
-
- )
+ if (isConfirmed) return
return (
))}
-
+
{
- console.log('click')
if (isSelected) {
setSelected(
//@ts-expect-error
diff --git a/web/components/Campaign/Places/Application/Inputs/CheckboxField.tsx b/web/components/Campaign/Places/Application/Inputs/CheckboxField.tsx
index 486d55d4..ce1a1d5a 100644
--- a/web/components/Campaign/Places/Application/Inputs/CheckboxField.tsx
+++ b/web/components/Campaign/Places/Application/Inputs/CheckboxField.tsx
@@ -1,4 +1,4 @@
-import { Checkbox, InputProps } from '@chakra-ui/react'
+import { Box, Checkbox, InputProps } from '@chakra-ui/react'
import { useController, useFormContext } from 'react-hook-form'
import { ReactNode } from 'react-markdown'
import FormField from '~components/FormField'
@@ -7,7 +7,7 @@ const CheckboxField = ({
label,
name,
...props
-}: { label: string; name: string } & InputProps) => {
+}: { label: string | ReactNode; name: string } & InputProps) => {
const { errors, control } = useFormContext()
const { field } = useController({
@@ -25,9 +25,14 @@ const CheckboxField = ({
onChange={onChange}
value={field?.value}
color={errors[name] ? 'red.500' : undefined}
+ display="flex"
+ alignItems={'flex-start'}
+ flexDir="row"
{...props}
>
- {label}
+
+ {label}
+
)
diff --git a/web/components/Campaign/Places/Application/Inputs/FileField.tsx b/web/components/Campaign/Places/Application/Inputs/FileField.tsx
index aebfa855..f31ff278 100644
--- a/web/components/Campaign/Places/Application/Inputs/FileField.tsx
+++ b/web/components/Campaign/Places/Application/Inputs/FileField.tsx
@@ -1,9 +1,8 @@
-import React, { useRef } from 'react'
+import React from 'react'
import {
Flex,
Text,
Button,
- Input,
Box,
HStack,
Stack,
@@ -12,6 +11,8 @@ import {
import Attachment from 'public/assets/img/attachment.svg'
import { useTranslation } from 'next-i18next'
import { useController, useFormContext } from 'react-hook-form'
+import ReactDropzone from 'react-dropzone'
+import useToast from '~hooks/useToast'
const FileInput = ({
name,
@@ -20,6 +21,7 @@ const FileInput = ({
acceptableTypes,
maxSize,
cta,
+ maxFiles = 1,
}: {
name: string
label: string
@@ -27,14 +29,12 @@ const FileInput = ({
acceptableTypes: string[]
maxSize: number
cta?: string
+ maxFiles?: number
}) => {
const { t } = useTranslation('place')
- const ref = useRef(null)
-
+ const { errorToast } = useToast()
const {
control,
- setError,
- clearErrors,
formState: { errors },
} = useFormContext()
@@ -44,24 +44,13 @@ const FileInput = ({
defaultValue: [],
})
- const onChange = (event) => {
- if (event.target.files) {
- const newFiles = (Array.from(
- event.target.files,
- ) as File[]).filter((file) => acceptableTypes.includes(file.type))
+ const onChange = (acceptedFiles) => {
+ if (acceptedFiles) {
+ const newFiles = (Array.from(acceptedFiles) as File[]).filter((file) =>
+ acceptableTypes.includes(file.type),
+ )
if (newFiles.length > 0) {
- const maxO = maxSize * (1000 * 1000)
- const filesOverzise = newFiles.filter((el) => el.size > maxO)
- field.onChange([
- ...field.value,
- ...newFiles.filter((el) => el.size <= maxO),
- ])
-
- if (filesOverzise.length > 0) {
- setError(name, { message: t('global.file.tooBig') })
- } else {
- clearErrors(name)
- }
+ field.onChange([...field.value, ...newFiles])
}
}
}
@@ -73,119 +62,116 @@ const FileInput = ({
}
return (
-
-
-
-
- {label}
-
- {helper && (
-
- {helper}
-
- )}
-
-
-
-
-
- {field.value.length > 0 ? (
+ {
+ const errors = files?.map((file) => file?.errors?.map((e) => e?.code))
+ console.log(files)
+ errors.map((e) => {
+ errorToast(t('global.file.' + e))
+ })
+ }}
+ maxSize={maxSize * (1000 * 1000)}
+ >
+ {({ getRootProps, getInputProps }) => (
- {field.value.map((file, index) => (
-
+
+
+ {label}
+
+ {helper && (
+
+ {helper}
+
+ )}
+
+
+
+
+
+ {field.value.length > 0 ? (
+
+ {field.value.map((file, index) => (
+
+
+
+
+
+
+
+
+ {file?.name}
+
+
+ {(file?.size / (1000 * 1000)).toFixed(1)}mo
+
+
+
+
+
+
+ ))}
+
+ ) : (
+
+ )}
+ {errors[name] && (
+
+
+ {errors[name].message}
+
+
+ )}
)}
-
+
)
}
diff --git a/web/components/Campaign/Places/Application/References/ReferenceItem.tsx b/web/components/Campaign/Places/Application/References/ReferenceItem.tsx
index 75fc2138..2625d5b5 100644
--- a/web/components/Campaign/Places/Application/References/ReferenceItem.tsx
+++ b/web/components/Campaign/Places/Application/References/ReferenceItem.tsx
@@ -18,6 +18,20 @@ const ReferenceItem = ({
}) => {
const { currentCampaign } = useCampaignContext()
const { t } = useTranslation('place')
+ const { coproducers, actors, other, title, year } = reference
+
+ const coproducersValues = Array.isArray(coproducers)
+ ? coproducers
+ : typeof coproducers === 'string'
+ ? coproducers.split(',')
+ : []
+
+ const partners = coproducersValues.map(
+ (coproducer) =>
+ currentCampaign.users_permissions_users.find(
+ (user) => user?.id?.toString() === coproducer?.toString(),
+ )?.structureName,
+ )
return (
- {reference.title}, {reference.year}
+ {title}, {year}
{t(
`campaignApplication.references.references_actor${
- reference?.actors > 1 ? 's' : ''
+ actors > 1 ? 's' : ''
}_display`,
{
- number: reference?.actors,
+ number: actors,
},
)}
- {[
- ...((Array.isArray(reference?.coproducers)
- ? reference.coproducers
- : reference.coproducers.split(',')
- ).map(
- (coproducer) =>
- currentCampaign.users_permissions_users.find(
- (user) => user?.id === coproducer,
- )?.structureName,
- ) || []),
- reference.other,
- ]?.join(', ')}
+ {(Boolean(other) ? [partners, other] : partners)?.join(', ')}
diff --git a/web/components/Place/Booking/BookingRecapInsert/BookingRecap.tsx b/web/components/Place/Booking/BookingRecapInsert/BookingRecap.tsx
index fa4eab28..d22f5511 100644
--- a/web/components/Place/Booking/BookingRecapInsert/BookingRecap.tsx
+++ b/web/components/Place/Booking/BookingRecapInsert/BookingRecap.tsx
@@ -8,16 +8,11 @@ import ConfirmBookingInsert from '~components/Place/Booking/BookingRecapInsert/C
import { is } from 'date-fns/locale'
import NotConfirmedBookingInsert from '~components/Place/Booking/BookingRecapInsert/NotConfirmedBookingInsert'
-const BookingRecap = () => {
+const BookingRecap = ({ isCampaignMode }: { isCampaignMode?: boolean }) => {
const { t } = useTranslation('place')
const { selected: fullSelected } = useContext(BookingScheduleContext)
const { data: user, isLoading } = useCurrentUser()
- const isCampaignMode = useMemo(
- () => fullSelected.some((e) => e.extendedProps.isCampaignEvent),
- [fullSelected],
- )
-
const selected = useMemo(
() =>
fullSelected.filter((s) =>
diff --git a/web/components/Place/Booking/BookingRecapInsert/ConfirmBookingInsert.tsx b/web/components/Place/Booking/BookingRecapInsert/ConfirmBookingInsert.tsx
index 1a5479c7..a5f25ea8 100644
--- a/web/components/Place/Booking/BookingRecapInsert/ConfirmBookingInsert.tsx
+++ b/web/components/Place/Booking/BookingRecapInsert/ConfirmBookingInsert.tsx
@@ -12,7 +12,9 @@ const ConfirmBookingInsert = ({
isCampaignMode?: boolean
selected: ScheduleEvent[]
}) => {
- const { setSelected, setApplicationView } = useContext(BookingScheduleContext)
+ const { setSelected, setApplicationView, setConfirmView } = useContext(
+ BookingScheduleContext,
+ )
const { t } = useTranslation('place')
@@ -46,7 +48,7 @@ const ConfirmBookingInsert = ({
size="lg"
onClick={() => {
window.scrollTo(0, 0)
- setApplicationView(true)
+ isCampaignMode ? setApplicationView(true) : setConfirmView(true)
}}
>
{t('detail.submit')}
diff --git a/web/components/Place/PlaceListCard.tsx b/web/components/Place/PlaceListCard.tsx
index d1231fc7..7b0ee2cd 100644
--- a/web/components/Place/PlaceListCard.tsx
+++ b/web/components/Place/PlaceListCard.tsx
@@ -28,7 +28,7 @@ const PlaceCard = ({ place, setFocus, isCampaignTab }: Props) => {
const { t } = useTranslation('place')
const { currentCampaign } = useCampaignContext()
const { campaignDispos } = useCampaignDispo(place?.disponibilities)
- console.log(place?.disponibilities, currentCampaign?.mode)
+
const hasCampaignDispo =
currentCampaign?.mode === 'applications' && !!campaignDispos?.length
return (
diff --git a/web/public/locales/fr/place.json b/web/public/locales/fr/place.json
index 0a608b6e..b1ba0a4d 100644
--- a/web/public/locales/fr/place.json
+++ b/web/public/locales/fr/place.json
@@ -2,7 +2,7 @@
"global": {
"file": {
"change": "Changer",
- "tooBig": "Le fichier est trop volumineux"
+ "file-too-large": "Le fichier est trop volumineux"
},
"yes": "Oui",
"no": "Non",
@@ -465,7 +465,7 @@
"dancers": "Nombre de danseurs·ses",
"file": "Dossier artistique",
"file_helper": "(5 Mo maximum)",
- "file_cta": "Uploadez votre dossier",
+ "file_cta": "Déposer mon fichier PDF",
"change": "Changer",
"summary": "Résumé du dossier",
"summary_helper": "(Optionnel – 1000 signes maximum)",
@@ -478,11 +478,14 @@
"no": "non"
},
"eligibility": {
- "title": "Éligibilité",
+ "title": "Rappel des règles d'éligibilité",
"chart_front": "Nous vous invitons à vous référer à ",
"chart": "la charte d'utilisation",
"chart_back": "si vous n’en avez pas encore pris connaissance.",
- "label": "Je confirme accepter les CGU du dispositif {{title}} et respecter les critères d'éligibilité."
+ "label_start": "Je confirme respecter les critères d'éligibilité et",
+ "no_eligibility_label_start": "Je confirme ",
+ "label_cgu": "accepter les CGU",
+ "label_end": "du dispositif {{title}}."
},
"back": "Retour",
"submit": "Poursuivre",
@@ -492,7 +495,7 @@
"confirm": "{{place}} sera notifié de votre demande. Vous recevrez un email vous informant de la confirmation de votre candidature.",
"confirmed": {
"title": "Votre candidature est déposée !",
- "text": "Vous recevrez sous peu un email de confirmation. Votre demande est actuellement en attente de validation par {{place}}. Vous recevrez un email lorsque votre réservation sera validée.",
+ "text": "Vous recevrez sous peu un email de confirmation. La période de présélection du côté des lieux partenaires au dispositif {{campaign}} est prévue du {{preselection_start}} au {{preselection_end}}. En cas de sélection, le lieu vous contactera directement par email.",
"back": "Retour à l’accueil",
"see_applications": "Mes candidatures"
}