Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
oumeimaelisbihani committed Nov 18, 2024
1 parent 007d146 commit 8290154
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const profile = ref<RegisterDetails>({
},
activity: {
title: 'Activité',
description: "Quel est votre secteur d'activités ?",
description: "Quel est votre secteur d'activité ?",
icon: 'fr-icon-briefcase-line',
value: props.company?.secteur as Sector,
type: RegisterDetailType.Activity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,100 +130,3 @@ onClickOutside(localisationSearchBar, () => modifyLocalisation())
margin-bottom: 0;
}
</style>
<template>
<p
v-if="infos.value"
class="fr-tag fr-bg--blue-france--lightness"
>
<span class="fr-pr-4v">{{ infos.tagLabel || infos.value }}</span>
<span
v-if="manual"
class="fr-icon-close-line fr-radius-a--2v fr-btn-bg"
@click="modifyLocalisation"
/>
</p>
<DsfrInputGroup
v-else
:error-message="showError && !localisationInput ? errorMessage : ''"
>
<div
ref="localisationSearchBar"
class="fr-search-bar fr-search-bar--yellow"
role="search"
>
<DsfrInput
v-model="localisationInput"
name="manual-register-localisation"
class="fr-input--white"
type="search"
:placeholder="infos.description"
@update:model-value="searchLocalisation"
@keyup.enter="searchLocalisation"
/>
<DsfrButton
class="fr-bg--yellow search-button"
tertiary
no-outline
@click="searchLocalisation"
/>
</div>
</DsfrInputGroup>
<div
v-if="localisationResults.length && !infos.value"
id="region-response"
class="fr-bg--white fr-mt-n6v"
>
<div
v-for="region in localisationResults"
:key="`resp-input-${region}`"
class="fr-card fr-card-result fr-card--no-arrow fr-card--shadow"
tabindex="0"
@click="selectRegion(region)"
@keyup.enter="selectRegion(region)"
>
<div class="fr-card__body">
<div class="fr-card__content fr-py-1v fr-px-4v fr-text--blue-france">
<div class="fr-text--blue-france">{{ region }}</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { RegisterDetail } from '@/types'
import { Region } from '@/types'
import { onClickOutside } from '@vueuse/core'
interface Props {
infos: RegisterDetail
manual: boolean
showError: boolean
}
defineProps<Props>()
const selectedLocalisation = defineModel<Region>()
const localisationInput = ref<string | undefined>()
const localisationResults = ref<Region[]>([])
const errorMessage = 'La sélection de la localisation est nécessaire'
const localisationSearchBar = ref(null)
const searchLocalisation = () => {
localisationResults.value = Object.values(Region).filter((region) => region.toLowerCase().includes(localisationInput.value as string))
}
const selectRegion = (region: Region) => {
selectedLocalisation.value = region
}
const modifyLocalisation = () => {
selectedLocalisation.value = undefined
localisationInput.value = undefined
localisationResults.value = []
}
onClickOutside(localisationSearchBar, () => modifyLocalisation())
</script>
<style lang="scss" scoped>
#region-response {
text-align: left;
width: calc(100% - 40px);
max-height: 128px;
overflow: hidden auto;
}
</style>

0 comments on commit 8290154

Please sign in to comment.