diff --git a/components/badge/Dispo.vue b/components/badge/Dispo.vue index 82581a67428cab47660970cf7403a03e2af18728..8fd52a27a0949bdc45b60fc2ba1e1544e756eeb1 100644 --- a/components/badge/Dispo.vue +++ b/components/badge/Dispo.vue @@ -9,9 +9,11 @@ {{ isDispo ? $t("membre.dispo") - : $t("membre.nodispo") + - " > " + - $d(new Date(dateDispo * 1000), "short") + : "â± " + + nbPendingCertifs + + " ( " + + $d(new Date(dateDispo * 1000), "short") + + ")" }} </span> </small> @@ -26,6 +28,16 @@ export default { }, dateDispo: { type: Number + }, + certifs: { + type: Array + } + }, + computed: { + nbPendingCertifs() { + return this.certifs.filter((el) => { + return el.pending == true + }).length } } } diff --git a/components/certif/List.vue b/components/certif/List.vue index 3d29bd8a1d9ee4a0566993000be8ef883133b337..42c01ac40da0fd2e1bf15bcd24b523ebb9111a84 100644 --- a/components/certif/List.vue +++ b/components/certif/List.vue @@ -30,6 +30,7 @@ <BadgeDispo :isDispo="certif.minDatePassed" :dateDispo="certif.minDate" + :certifs="certif.sent_certifications" v-if="certif.status == 'MEMBER'" /> </div> </th> @@ -90,6 +91,7 @@ <BadgeDispo :isDispo="certif.minDatePassed" :dateDispo="certif.minDate" + :certifs="certif.sent_certifications" v-if="certif.status == 'MEMBER'" /> </div> </th> diff --git a/graphql/queries.js b/graphql/queries.js index 41b4f1cf1196808ec4cb79e29a483f4ed3f1cbb9..23b18958db315c1189b5386306d02b18b2127452 100644 --- a/graphql/queries.js +++ b/graphql/queries.js @@ -164,6 +164,10 @@ export const SEARCH_MEMBER = gql` __typename limit } + sent_certifications { + __typename + pending + } } ` diff --git a/pages/membre.vue b/pages/membre.vue index 5ac2cfa22de6b1b9839d2167f83cab28e0f63d5f..9fcab21fbfaac5347085d33b6f628005d4725813 100644 --- a/pages/membre.vue +++ b/pages/membre.vue @@ -85,32 +85,6 @@ export default { error: null } }, - computed: { - nbCertifsSent() { - return this.idFromHash.sent_certifications.filter((el) => { - return el.pending == false - }).length - }, - nbCertifsReceived() { - return this.idFromHash.received_certifications.certifications.filter( - (el) => { - return el.pending == false - } - ).length - }, - nbCertifsPendingSent() { - return this.idFromHash.sent_certifications.filter((el) => { - return el.pending == true - }).length - }, - nbCertifsPendingReceived() { - return this.idFromHash.received_certifications.certifications.filter( - (el) => { - return el.pending == true - } - ).length - } - }, apollo: { idFromHash: { query: SEARCH_MEMBER, @@ -138,6 +112,30 @@ export default { this.idFromHash.received_certifications.limit ) == "warning" } + }, + nbCertifsSent() { + return this.idFromHash.sent_certifications.filter((el) => { + return el.pending == false + }).length + }, + nbCertifsReceived() { + return this.idFromHash.received_certifications.certifications.filter( + (el) => { + return el.pending == false + } + ).length + }, + nbCertifsPendingSent() { + return this.idFromHash.sent_certifications.filter((el) => { + return el.pending == true + }).length + }, + nbCertifsPendingReceived() { + return this.idFromHash.received_certifications.certifications.filter( + (el) => { + return el.pending == false + } + ).length } }, mounted() {