Skip to content

Commit

Permalink
feat(bo-ds): improve ds list
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminDNUM committed Oct 10, 2024
1 parent 18f85c9 commit 4062974
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 21 deletions.
76 changes: 58 additions & 18 deletions packages/frontend-bo/src/components/demandes-sejour/liste.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<template>
<div class="fr-container">
<h1 v-if="props.display === displayType.Organisme" class="header">
Liste des séjours déclarés
{{ props.organisme ? "" : `(${sejourStore.stats?.global})` }}
Déclarations à Traiter ({{
(sejourStore.stats?.transmis ?? 0) +
(sejourStore.stats?.enCours ?? 0) +
(sejourStore.stats?.transmis8J ?? 0)
}})
</h1>
<h1 v-else class="header">Liste des messages par déclaration</h1>
<div class="fr-grid-row">
Expand All @@ -11,16 +14,25 @@
v-if="!props.organisme && props.display === displayType.Organisme"
:values="[
{
title: 'Déclarations transmises à traiter',
title: 'Déclarations reçues à traiter',
value: sejourStore.stats?.transmis || 0,
onClick: () =>
onStatutSelect([demandesSejours.statuts.TRANSMISE]),
},
{
title: 'Déclarations en cours de traitement',
value: sejourStore.stats?.enCours || 0,
onClick: () =>
onStatutSelect([
demandesSejours.statuts.EN_COURS,
demandesSejours.statuts.EN_COURS_8J,
]),
},
{
title: 'Déclarations 8 jours à traiter',
value: sejourStore.stats?.transmis8J || 0,
onClick: () =>
onStatutSelect([demandesSejours.statuts.TRANSMISE_8J]),
},
]"
/>
Expand All @@ -47,6 +59,10 @@
/>
</div>
<div class="fr-col-12">
<h1 v-if="props.display === displayType.Organisme" class="header">
Liste des déclarations reçues
{{ props.organisme ? "" : `(${sejourStore.stats?.global})` }}
</h1>
<form>
<div class="fr-fieldset">
<div
Expand Down Expand Up @@ -123,11 +139,15 @@
>
<div class="fr-input-group">
<DsfrSelect
v-model="needAction"
label="Filtrer sur les séjours nécessitant une action"
label="Actions à faire"
name="action"
mode="tags"
:options="['Oui', 'Non']"
:options="[
{ value: 'ALL', text: 'Toutes les déclarations' },
{ value: 'A_TRAITER', text: 'Déclarations à traiter' },
{ value: 'EN_ATTENTE', text: 'Déclarations en attente' },
]"
@update:model-value="onSelectAction($event)"
/>
</div>
</div>
Expand All @@ -151,6 +171,9 @@
</form>
</div>
</div>
<span class="number-of-ds"
>{{ sejourStore.total }} déclarations affichées
</span>
<TableWithBackendPagination
:headers="headers"
:data="sejourStore.demandes"
Expand Down Expand Up @@ -181,11 +204,11 @@
<script setup>
import {
CardsNumber,
MessageEtat,
MessageHover,
MultiSelectOption,
TableWithBackendPagination,
ValidationModal,
MessageHover,
MessageEtat,
} from "@vao/shared";
import dayjs from "dayjs";
import DemandeStatusBadge from "~/components/demandes-sejour/DemandeStatusBadge.vue";
Expand Down Expand Up @@ -222,7 +245,6 @@ const limitState = ref(defaultLimit);
const route = useRoute();
const parseBoolean = (value) => value === "true";
const displayType = { Messagerie: "Messagerie", Organisme: "Organisme" };
const status = computed(() => [
Expand Down Expand Up @@ -251,7 +273,6 @@ const searchState = reactive({
.split(",")
.filter((statut) => Object.values(status.value).includes(statut))
: null,
action: parseBoolean(route.query.action),
message: props.display === displayType.Messagerie,
});
Expand All @@ -261,14 +282,27 @@ watch(
{ immediate: true },
);
const needAction = computed({
get() {
return searchState.action ? "Oui" : "Non";
},
set(value) {
searchState.action = value === "Oui" ? true : false;
},
});
const onSelectAction = (value) => {
switch (value) {
case "A_TRAITER":
onStatutSelect([
demandesSejours.statuts.TRANSMISE,
demandesSejours.statuts.TRANSMISE_8J,
demandesSejours.statuts.EN_COURS,
demandesSejours.statuts.EN_COURS_8J,
]);
break;
case "EN_ATTENTE":
onStatutSelect([
demandesSejours.statuts.A_MODIFIER,
demandesSejours.statuts.A_MODIFIER_8J,
demandesSejours.statuts.ATTENTE_8_JOUR,
]);
break;
default:
searchState.statuts = null;
}
};
const searchParams = computed(() =>
Object.entries(searchState).reduce((acc, [key, value]) => {
Expand Down Expand Up @@ -542,4 +576,10 @@ onMounted(async () => {
.header {
padding: 1em 0em;
}
.number-of-ds {
font-weight: bold;
font-style: italic;
font-size: 1.25rem;
}
</style>
2 changes: 1 addition & 1 deletion packages/frontend-bo/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const formatHtmlTitle = (elements) =>
const topCards = computed(() => [
{
title: "Déclarations transmises à traiter",
title: "Déclarations reçues à traiter",
value: stats.value?.transmis + stats.value?.enCours || 0,
redirect: `/sejours?statuts=${demandesSejours.statuts.TRANSMISE},${demandesSejours.statuts.EN_COURS}`,
htmlTitle: formatHtmlTitle([
Expand Down
17 changes: 15 additions & 2 deletions packages/shared/src/components/CardNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
:to="redirect"
class="card-number fr-p-2w"
:title="htmlTitle"
:class="{ 'card-number--has-hover-effect': redirect }"
:class="{
'card-number--has-hover-effect': redirect || onClick,
'has-cursor': onClick,
}"
@click="onClick"
>
<div class="card-number__title">
{{ title }}
Expand All @@ -17,16 +21,19 @@

<script setup lang="ts">
import { computed } from "vue";
const props = withDefaults(
defineProps<{
title: string;
value: number;
redirect?: string;
htmlTitle?: string;
onClick?: () => void;
}>(),
{
redirect: "",
htmlTitle: "",
onClick: null,
},
);
Expand All @@ -40,12 +47,14 @@ const wrapper = computed(() => (props.redirect ? "router-link" : "div"));
display: flex;
flex-direction: column;
justify-content: space-between;
height: 10rem;
height: 7rem;
flex: 1;
background-image: none;
&--has-hover-effect:hover {
background-color: var(--blue-france-sun-113-625-hover) !important;
}
&__title {
font-size: 1.5rem;
}
Expand All @@ -57,4 +66,8 @@ const wrapper = computed(() => (props.redirect ? "router-link" : "div"));
font-weight: 800;
}
}
.has-cursor {
cursor: pointer;
}
</style>
2 changes: 2 additions & 0 deletions packages/shared/src/components/CardsNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:value="v.value"
:redirect="v.redirect"
:html-title="v.htmlTitle"
:on-click="v.onClick"
/>
</div>
</template>
Expand All @@ -20,6 +21,7 @@ defineProps<{
value: number;
redirect?: string;
htmlTitle?: string;
onClick?: () => void;
}>;
}>();
</script>
Expand Down

0 comments on commit 4062974

Please sign in to comment.