Skip to content

Commit

Permalink
feat: affichage de la date de demarrage au lieu de la date d'engagement
Browse files Browse the repository at this point in the history
  • Loading branch information
GregoireDucharme committed Dec 18, 2024
1 parent 22a69d2 commit 4d69e93
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 3 deletions.
24 changes: 22 additions & 2 deletions src/pages/certification/exploitations/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ meta:
<span class="fr-hint-text">{{ operator.commune }}, {{ operator.codePostal }}</span>
</td>
<td class="fr-text--align-left">
<time :datetime="operator.dateEngagement" v-if="operator.dateEngagement">{{
jjmmyyyy(operator.dateEngagement)
<time :datetime="getDateDemarrage(operator)" v-if="getDateDemarrage(operator)">{{
jjmmyyyy(getDateDemarrage(operator))
}}</time>
<span aria-hidden v-else>-</span>
</td>
Expand Down Expand Up @@ -356,6 +356,26 @@ async function doSearch(input, page, sort, order) {
}
}
function getDateDemarrage(operator) {
const array = operator.certificats ?? operator.notifications ?? [];
array.sort((a, b) => new Date(b.dateSignatureContrat) - new Date(a.dateSignatureContrat));
let dateDemarrage;
for (const notif of array) {
const currentStatut = notif.etatCertification || notif.status;
if (notif.dateDemarrage) {
dateDemarrage = notif.dateDemarrage;
}
if (currentStatut != "BROUILLON") {
return dateDemarrage;
}
}
return dateDemarrage;
}
watch(
[searchInput, currentPage, sortOrder],
() => doSearch(searchInput.value, currentPage.value, sortOrder.value.sort, sortOrder.value.order),
Expand Down
26 changes: 25 additions & 1 deletion src/pages/exploitations/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ meta:
<li v-if="operator.siret"><b>SIRET</b> : {{ operator.siret }}</li>
<li v-if="operator.numeroPacage"><b>PACAGE</b> : {{ operator.numeroPacage }}</li>
<li><b>Numéro Bio</b> : {{ operator.numeroBio }}</li>
<li><b>Date de début de conversion</b> : {{ operator.dateEngagement }}</li>
<li v-if="getDateDemarrage(operator)">
<b>Date d'engagement</b> : {{ jjmmyyyy(getDateDemarrage(operator)) }}
</li>
</ul>
</div>
<div class="fr-card__start" v-if="!isLoading">
Expand Down Expand Up @@ -73,6 +75,7 @@ import Spinner from "@/components/widgets/Spinner.vue";
import Pagination from "@/components/widgets/Pagination.vue";
import NotificationState from "@/components/records/NotificationState.vue";
import { filterAndSortNotifications } from "@/utils/helper-notification.js";
import { jjmmyyyy } from "@/utils/dates";
const RESULTS_PER_PAGE = 12;
const router = useRouter();
Expand Down Expand Up @@ -106,6 +109,27 @@ async function loadOperators() {
});
isLoading.value = false;
}
//Date de début de conversion : 2024-12-10
function getDateDemarrage(operator) {
const array = operator.certificats ?? operator.notifications;
array.sort((a, b) => new Date(b.dateSignatureContrat) - new Date(a.dateSignatureContrat));
let dateDemarrage;
for (const notif of array) {
const currentStatut = notif.etatCertification || notif.status;
if (notif.dateDemarrage) {
dateDemarrage = notif.dateDemarrage;
}
if (currentStatut != "BROUILLON") {
return dateDemarrage;
}
}
return dateDemarrage;
}
</script>
<style scoped>
Expand Down

0 comments on commit 4d69e93

Please sign in to comment.