From afeb08b2cefc886703f6805b46f121bc52585b77 Mon Sep 17 00:00:00 2001 From: Lucieo Date: Mon, 26 Feb 2024 15:02:42 +0000 Subject: [PATCH] =?UTF-8?q?Fix=20-=20Lieu=20Admin=20cr=C3=A9er=20un=20cr?= =?UTF-8?q?=C3=A9neau=20de=20campagne=20(#89)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/components/Account/Place/Schedule.tsx | 1 + web/components/Account/Place/ScheduleSlot.tsx | 12 ++++++++++-- .../Campaign/Places/Admin/CampaignSchedule.tsx | 6 ++++-- .../Campaign/Places/Admin/CampaignScheduleForm.tsx | 5 +++++ .../Campaign/Places/Admin/CampaignScheduleInfo.tsx | 8 ++++++-- web/public/locales/fr/place.json | 3 ++- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/web/components/Account/Place/Schedule.tsx b/web/components/Account/Place/Schedule.tsx index a07125ed..ffc117c1 100644 --- a/web/components/Account/Place/Schedule.tsx +++ b/web/components/Account/Place/Schedule.tsx @@ -28,6 +28,7 @@ export const StyleWrapper = styled.div` z-index: 11; border-radius: 8px; margin: 3px 2px 3px 2px; + mix-blend-mode: multiply; } ` diff --git a/web/components/Account/Place/ScheduleSlot.tsx b/web/components/Account/Place/ScheduleSlot.tsx index d0eae83c..95e1a8fa 100644 --- a/web/components/Account/Place/ScheduleSlot.tsx +++ b/web/components/Account/Place/ScheduleSlot.tsx @@ -4,6 +4,7 @@ import { ScheduleEventWhen } from '~@types/schedule-event.d' import isSameDay from 'date-fns/isSameDay' import ScheduleContext from '~components/Account/Place/ScheduleContext' import PeriodEvent from '~components/Place/PeriodEvent' +import useCampaignContext from '~components/Campaign/useCampaignContext' const styleSelected = { border: '1px dashed', @@ -58,6 +59,7 @@ const Event = ({ isCampaignMode = false, }) => { const { setToDelete, eventsIdToDelete, place } = useContext(ScheduleContext) + const { currentCampaign } = useCampaignContext() const isPeriod = useMemo(() => { if (!range) return null return !isSameDay(range.start, range.end) @@ -68,8 +70,14 @@ const Event = ({ id, ]) - const isDisabled = + const isFromOtherTab = (isCampaignMode && !isCampaignEvent) || (!isCampaignMode && isCampaignEvent) + const isClosedDispoMode = + isCampaignMode && + isCampaignEvent && + currentCampaign.mode !== 'disponibilities' + + const isDisabled = isFromOtherTab || isClosedDispoMode return ( {isPeriod && ( { - + + + {showForm ? ( diff --git a/web/components/Campaign/Places/Admin/CampaignScheduleForm.tsx b/web/components/Campaign/Places/Admin/CampaignScheduleForm.tsx index 50ce874e..bb77af43 100644 --- a/web/components/Campaign/Places/Admin/CampaignScheduleForm.tsx +++ b/web/components/Campaign/Places/Admin/CampaignScheduleForm.tsx @@ -23,6 +23,7 @@ import { client } from '~api/client-api' import { setHours } from 'date-fns' import useCampaignContext from '~components/Campaign/useCampaignContext' import { format } from '~utils/date' +import Schedule from '~components/Account/Place/Schedule' export const STAFF_VALUES = ['no', 'light', 'sound', 'video', 'scene'] @@ -132,6 +133,10 @@ const CampaignScheduleForm = ({ place, hideForm }: Props) => { + + + + { {currentCampaign?.mode === 'disponibilities' ? t( - `campaign.helpers.disponibilities.schedule.open_disponibilities`, + `campaign.helpers.disponibilities.schedule.${ + currentCampaign?.disponibilities_max === 1 + ? 'open_disponibility' + : 'open_disponibilities' + }`, { title: currentCampaign?.title }, ) : t( @@ -91,7 +95,7 @@ const CampaignScheduleInfo = ({ place, showForm }: Props) => { variant="outline" colorScheme="blue" as={Link} - href={`${ROUTE_ACCOUNT_APPLICATIONS}?espace=${place.id}&disponibility=${campaignDispos[0]?.id}`} + href={`${ROUTE_ACCOUNT_APPLICATIONS}?campaign=${currentCampaign?.id}&espace=${place.id}&disponibility=${campaignDispos[0]?.id}`} > {t('campaign.helpers.applications.schedule.see_applications')} diff --git a/web/public/locales/fr/place.json b/web/public/locales/fr/place.json index b1ba0a4d..6360d216 100644 --- a/web/public/locales/fr/place.json +++ b/web/public/locales/fr/place.json @@ -586,7 +586,8 @@ "schedule": { "title": "Ajoutez ou modifiez vos créneaux avant le {{disponibility_end}}. ", "description": "\n Vous pouvez ajouter jusqu’à {{disponibilities_max}} créneaux dédiés au dispositif {{title}} pour un même espace. Les créneaux doivent impérativement faire {{duration}} jours, et se dérouler entre le {{campaign_start}} et le {{campaign_end}}", - "open_disponibilities": "créneaux qui seront ouverts à candidatures {{title}}" + "open_disponibilities": "créneaux qui seront ouverts à candidatures {{title}}", + "open_disponibility": "créneau qui sera ouvert à candidatures {{title}}" } } }