Skip to content

Commit

Permalink
(PC-34190)[PRO] feat: Remove the partners networks field in collectiv…
Browse files Browse the repository at this point in the history
…e venue page.
  • Loading branch information
gmeigniez-pass committed Jan 24, 2025
1 parent 1e473b5 commit 2e49720
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 75 deletions.
1 change: 0 additions & 1 deletion pro/src/commons/config/swrQueryKeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const GET_COLLECTIVE_OFFERS_FOR_INSTITUTION_QUERY_KEY =
export const GET_COLLECTIVE_OFFERS_QUERY_KEY = 'getCollectiveOffers'
export const GET_COLLECTIVE_REQUEST_INFORMATIONS_QUERY_KEY =
'getCollectiveOfferRequestInformations'
export const GET_CULTURAL_PARTNERS_QUERY_KEY = 'getEducationalPartners'
export const GET_EDUCATIONAL_DOMAINS_QUERY_KEY = 'listEducationalDomains'
export const GET_EDUCATIONAL_OFFERERS_QUERY_KEY = 'listEducationalOfferers'
export const GET_EDUCATIONAL_STATUSES_QUERY_KEY = 'getVenuesEducationalStatuses'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import cn from 'classnames'
import { useState } from 'react'

import { storageAvailable } from 'commons/utils/storageAvailable'
import fullClearIcon from 'icons/full-clear.svg'
import { SvgIcon } from 'ui-kit/SvgIcon/SvgIcon'

import styles from './HighlightBanner.module.scss'
import { storageAvailable } from 'commons/utils/storageAvailable'


interface HighlightBannerProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ import { adageSearchViewSelector } from 'commons/store/adageFilter/selectors'
import { LOGS_DATA } from 'commons/utils/config'
import fullGoTop from 'icons/full-go-top.svg'
import fullGrid from 'icons/full-grid.svg'
import fullLinkIcon from 'icons/full-link.svg'
import fullList from 'icons/full-list.svg'
import TFMAC2025 from 'pages/AdageIframe/app/components/HighlightBanner/assets/TFMAC-2025.png'
import { useAdageUser } from 'pages/AdageIframe/app/hooks/useAdageUser'
import { isCollectiveOfferTemplate } from 'pages/AdageIframe/app/types'
import { ButtonLink } from 'ui-kit/Button/ButtonLink'
import { ButtonVariant } from 'ui-kit/Button/types'
import { ShadowTipsHelpIcon } from 'ui-kit/Icons/SVGs/ShadowTipsHelpIcon'
import { SvgIcon } from 'ui-kit/SvgIcon/SvgIcon'

import { OfferCardComponent } from '../../../AdageDiscovery/OfferCard/OfferCard'
import { HighlightBanner } from '../../../HighlightBanner/HighlightBanner'
import { CustomPagination } from '../../../Pagination/Pagination'
import { AdageSkeleton } from '../../../Skeleton/AdageSkeleton'
import { SurveySatisfaction } from '../../../SurveySatisfaction/SurveySatisfaction'
import TFMAC2025 from 'pages/AdageIframe/app/components/HighlightBanner/assets/TFMAC-2025.png'
import fullLinkIcon from 'icons/full-link.svg'
import {
ToggleButtonGroup,
ToggleButton,
Expand All @@ -42,10 +46,9 @@ import { AdageOfferListCard } from './AdageOfferListCard/AdageOfferListCard'
import { NoResultsPage } from './NoResultsPage/NoResultsPage'
import styles from './Offers.module.scss'
import { offerIsBookable } from './utils/offerIsBookable'
import { ShadowTipsHelpIcon } from 'ui-kit/Icons/SVGs/ShadowTipsHelpIcon'
import { HighlightBanner } from '../../../HighlightBanner/HighlightBanner'
import { ButtonLink } from 'ui-kit/Button/ButtonLink'
import { ButtonVariant } from 'ui-kit/Button/types'




export interface OffersProps {
displayStats?: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import useSWR from 'swr'
import { api } from 'apiClient/api'
import { GetVenueResponseModel } from 'apiClient/v1'
import {
GET_CULTURAL_PARTNERS_QUERY_KEY,
GET_EDUCATIONAL_DOMAINS_QUERY_KEY,
GET_EDUCATIONAL_STATUSES_QUERY_KEY,
} from 'commons/config/swrQueryKeys'
Expand Down Expand Up @@ -40,9 +39,7 @@ export const CollectiveDataEdition = ({
[GET_EDUCATIONAL_STATUSES_QUERY_KEY],
() => api.getVenuesEducationalStatuses()
)
const culturalPartnersQuery = useSWR([GET_CULTURAL_PARTNERS_QUERY_KEY], () =>
api.getEducationalPartners()
)

const domains: SelectOption[] =
domainsQuery.data?.map((domain) => ({
value: domain.id.toString(),
Expand All @@ -53,11 +50,6 @@ export const CollectiveDataEdition = ({
value: status.id,
label: status.name,
})) ?? []
const culturalPartners: SelectOption[] =
culturalPartnersQuery.data?.partners.map((culturalPartner) => ({
value: culturalPartner.id.toString(),
label: culturalPartner.libelle,
})) ?? []

const canCreateCollectiveOffer = venue?.managingOfferer.allowedOnAdage

Expand All @@ -68,8 +60,7 @@ export const CollectiveDataEdition = ({
!offererId ||
!venue ||
domainsQuery.isLoading ||
educationalStatusesQuery.isLoading ||
culturalPartnersQuery.isLoading
educationalStatusesQuery.isLoading
) {
return <Spinner className={styles.spinner} />
}
Expand Down Expand Up @@ -123,14 +114,10 @@ export const CollectiveDataEdition = ({
<CollectiveDataForm
statuses={statuses}
domains={domains}
culturalPartners={culturalPartners}
venue={venue}
/>
) : (
<CollectiveDataEditionReadOnly
venue={venue}
culturalPartners={culturalPartners}
/>
<CollectiveDataEditionReadOnly venue={venue} />
)}
</>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

import { GetVenueResponseModel } from 'apiClient/v1'
import { SelectOption } from 'commons/custom_types/form'
import { useActiveFeature } from 'commons/hooks/useActiveFeature'
import { SummaryDescriptionList } from 'components/SummaryLayout/SummaryDescriptionList'
import { SummarySection } from 'components/SummaryLayout/SummarySection'
Expand All @@ -9,12 +7,10 @@ import { getInterventionAreaLabels } from 'pages/AdageIframe/app/components/Offe

interface CollectiveDataEditionReadOnlyProps {
venue: GetVenueResponseModel
culturalPartners: SelectOption[]
}

export const CollectiveDataEditionReadOnly = ({
venue,
culturalPartners,
}: CollectiveDataEditionReadOnlyProps) => {
const isOfferAddressEnabled = useActiveFeature('WIP_ENABLE_OFFER_ADDRESS')
return (
Expand Down Expand Up @@ -69,18 +65,6 @@ export const CollectiveDataEditionReadOnly = ({
title: 'Statut',
text: venue.collectiveLegalStatus?.name ?? 'Non renseigné',
},
{
title: 'Réseaux partenaires EAC',
text:
venue.collectiveNetwork
?.map(
(network) =>
culturalPartners.find(
(partner) => partner.value === network
)?.label
)
.join(', ') ?? 'Non renseigné',
},
]}
/>
</SummarySubSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { validationSchema } from './validationSchema'
type CollectiveDataFormProps = {
statuses: SelectOption[]
domains: SelectOption[]
culturalPartners: SelectOption[]
venue: GetVenueResponseModel
}

Expand All @@ -46,7 +45,6 @@ const studentLevels = Object.entries(StudentLevels).map(([, value]) => ({
export const CollectiveDataForm = ({
statuses,
domains,
culturalPartners,
venue,
}: CollectiveDataFormProps): JSX.Element | null => {
const notify = useNotification()
Expand Down Expand Up @@ -195,19 +193,6 @@ export const CollectiveDataForm = ({
isOptional
/>
</FormLayout.Row>

<FormLayout.Row>
<SelectAutocomplete
multi
options={culturalPartners}
name="collectiveNetwork"
label="Réseaux partenaires EAC"
placeholder="Sélectionner un ou plusieurs réseau(x) partenaire(s)"
isOptional
hideTags
maxDisplayedOptions={100}
/>
</FormLayout.Row>
</FormLayout.SubSection>

<FormLayout.SubSection title="Contact">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ export const COLLECTIVE_DATA_FORM_INITIAL_VALUES: CollectiveDataFormValues = {
collectiveEmail: '',
collectiveDomains: [],
collectiveLegalStatus: '',
collectiveNetwork: [],
collectiveInterventionArea: [],
'search-collectiveStudents': '',
'search-collectiveDomains': '',
'search-collectiveNetwork': '',
'search-collectiveInterventionArea': '',
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ export type CollectiveDataFormValues = {
collectiveEmail: string
collectiveDomains: string[]
collectiveLegalStatus: string
collectiveNetwork: string[]
collectiveInterventionArea: string[]
'search-collectiveStudents': string
'search-collectiveDomains': string
'search-collectiveNetwork': string
'search-collectiveInterventionArea': string
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ export const extractInitialValuesFromVenue = (
collectiveDomains: venue.collectiveDomains.map((domain) =>
domain.id.toString()
),
collectiveNetwork: venue.collectiveNetwork ?? [],
collectiveInterventionArea: venue.collectiveInterventionArea ?? [],
'search-collectiveStudents': '',
'search-collectiveDomains': '',
'search-collectiveNetwork': '',
'search-collectiveInterventionArea': '',
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ describe('CollectiveDataEdition', () => {
)
const interventionAreaField = screen.getByLabelText(/Zone de mobilité/)
const statusField = screen.getByLabelText(/Statut/)
const culturalPartnersField = screen.getByLabelText(
/Réseaux partenaires EAC/
)

expect(descriptionField).toBeInTheDocument()
expect(studentsField).toBeInTheDocument()
Expand All @@ -171,7 +168,6 @@ describe('CollectiveDataEdition', () => {
expect(domainsField).toBeInTheDocument()
expect(interventionAreaField).toBeInTheDocument()
expect(statusField).toBeInTheDocument()
expect(culturalPartnersField).toBeInTheDocument()
})

it('should display dms timeline if venue has dms application and ff active', async () => {
Expand Down Expand Up @@ -439,7 +435,6 @@ describe('CollectiveDataEdition', () => {
collectiveEmail: '[email protected]',
collectiveInterventionArea: [],
collectiveLegalStatus: { id: 1, name: 'statut 1' },
collectiveNetwork: [],
collectivePhone: '',
collectiveStudents: [],
collectiveWebsite: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ function renderCollectiveDataForm(options?: RenderWithProvidersOptions) {
{ value: 1, label: 'domain 1' },
{ value: 2, label: 'domain 2' },
]}
culturalPartners={[
{
value: 'culturalPartner',
label: 'Dans mon lieu',
},
]}
venue={defaultGetVenue}
/>,
options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ describe('extractInitialValuesFromVenue', () => {
collectiveEmail: null,
collectiveInterventionArea: null,
collectiveLegalStatus: { id: 2, name: 'Entreprise' },
collectiveNetwork: null,
collectivePhone: null,
collectiveStudents: [
StudentLevels.CAP_1RE_ANN_E,
Expand All @@ -33,12 +32,10 @@ describe('extractInitialValuesFromVenue', () => {
collectiveEmail: COLLECTIVE_DATA_FORM_INITIAL_VALUES.collectiveEmail,
collectiveLegalStatus: '2',
collectiveDomains: ['1'],
collectiveNetwork: [],
collectiveInterventionArea:
COLLECTIVE_DATA_FORM_INITIAL_VALUES.collectiveInterventionArea,
'search-collectiveDomains': '',
'search-collectiveInterventionArea': '',
'search-collectiveNetwork': '',
'search-collectiveStudents': '',
})
})
Expand Down

0 comments on commit 2e49720

Please sign in to comment.