Merge branch 'dev' into main
This commit is contained in:
@@ -41,6 +41,13 @@ async function handleGeolocClick() {
|
|||||||
/>
|
/>
|
||||||
<span>Géolocalisation</span>
|
<span>Géolocalisation</span>
|
||||||
</RepButton>
|
</RepButton>
|
||||||
|
<!-- <div
|
||||||
|
v-if="!lastError && coords.accuracy > 1000"
|
||||||
|
class="mt-4 max-w-lg mx-auto text-sm text-red-400"
|
||||||
|
>
|
||||||
|
Position peu précise ; votre député sera peut être différement de notre
|
||||||
|
résultat
|
||||||
|
</div> -->
|
||||||
<div v-if="lastError" class="mt-4 max-w-lg mx-auto text-sm text-red-400">
|
<div v-if="lastError" class="mt-4 max-w-lg mx-auto text-sm text-red-400">
|
||||||
{{ lastError }}
|
{{ lastError }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,28 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { Organisation } from "@/models/org";
|
||||||
import RepButton from "./RepButton.vue";
|
import RepButton from "./RepButton.vue";
|
||||||
|
|
||||||
import type { Depute } from "@/models/rep";
|
import type { Depute } from "@/models/rep";
|
||||||
import { computed } from "vue";
|
import { computed, onMounted, ref } from "vue";
|
||||||
|
|
||||||
|
const apiUrl = import.meta.env.VITE_API_URL;
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
rep: Depute;
|
rep: Depute;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const politicalPartyId = props.rep.acteur.mandats.mandat.find(
|
||||||
|
(m) => m.typeOrgane === "GP" && !m.dateFin
|
||||||
|
)?.organes.organeRef;
|
||||||
|
|
||||||
|
const repPoliticalParty = ref<Organisation | null>(null);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
repPoliticalParty.value = await fetch(
|
||||||
|
`${apiUrl}/org?id=${politicalPartyId}`
|
||||||
|
).then((t) => t.json());
|
||||||
|
});
|
||||||
|
|
||||||
const repImage = computed(() => {
|
const repImage = computed(() => {
|
||||||
const imageRef = props.rep.acteur.uid["#text"].replace("PA", "");
|
const imageRef = props.rep.acteur.uid["#text"].replace("PA", "");
|
||||||
return `https://www2.assemblee-nationale.fr/static/tribun/16/photos/carre/${imageRef}.jpg`;
|
return `https://www2.assemblee-nationale.fr/static/tribun/16/photos/carre/${imageRef}.jpg`;
|
||||||
@@ -88,7 +103,14 @@ const regionBgFile = computed(() => {
|
|||||||
<h1 class="mt-4 text-center font-bold text-3xl">
|
<h1 class="mt-4 text-center font-bold text-3xl">
|
||||||
{{ repFullName }}
|
{{ repFullName }}
|
||||||
</h1>
|
</h1>
|
||||||
<h2 class="text-center font-bold text-xl">
|
<div
|
||||||
|
v-if="repPoliticalParty"
|
||||||
|
class="text-center font-bold"
|
||||||
|
:style="`color: ${repPoliticalParty.organe.couleurAssociee}`"
|
||||||
|
>
|
||||||
|
{{ repPoliticalParty.organe.libelle }}
|
||||||
|
</div>
|
||||||
|
<h2 class="mt-2 text-center font-bold text-xl">
|
||||||
{{ repMandate?.election?.lieu.departement }} -
|
{{ repMandate?.election?.lieu.departement }} -
|
||||||
{{ repMandate?.election?.lieu.numCirco }}e circonscription
|
{{ repMandate?.election?.lieu.numCirco }}e circonscription
|
||||||
</h2>
|
</h2>
|
||||||
@@ -99,10 +121,6 @@ const regionBgFile = computed(() => {
|
|||||||
/>
|
/>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<h3 class="mt-2 text-center font-medium text-lg">
|
|
||||||
{{ rep.acteur.profession.libelleCourant }}
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<footer class="mt-8">
|
<footer class="mt-8">
|
||||||
<div class="mt-4 text-center">
|
<div class="mt-4 text-center">
|
||||||
<RepButton
|
<RepButton
|
||||||
|
|||||||
33
src/models/org.ts
Normal file
33
src/models/org.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
export interface Organisation {
|
||||||
|
organe: {
|
||||||
|
"@xmlns": string;
|
||||||
|
"@xmlns:xsi": string;
|
||||||
|
"@xsi:type": string;
|
||||||
|
uid: string;
|
||||||
|
codeType: string;
|
||||||
|
libelle: string;
|
||||||
|
libelleEdition: string;
|
||||||
|
libelleAbrege: string;
|
||||||
|
libelleAbrev: string;
|
||||||
|
viMoDe: ViMoDe;
|
||||||
|
organeParent: null;
|
||||||
|
chambre: null;
|
||||||
|
regime: string;
|
||||||
|
legislature: string;
|
||||||
|
secretariat: Secretariat;
|
||||||
|
positionPolitique: string;
|
||||||
|
preseance: string;
|
||||||
|
couleurAssociee: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Secretariat {
|
||||||
|
secretaire01: null;
|
||||||
|
secretaire02: null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ViMoDe {
|
||||||
|
dateDebut: Date;
|
||||||
|
dateAgrement: null;
|
||||||
|
dateFin: null;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user