From a5f78b23eb43c0983aa4e62e72ad82c805f634d2 Mon Sep 17 00:00:00 2001
From: paidge <paidge_cs@hotmail.com>
Date: Sun, 26 Dec 2021 03:06:52 +0100
Subject: [PATCH] add warning symbol ofr ids that will lose certs

---
 assets/css/style.scss             |  4 ++++
 components/Graph.vue              |  6 +----
 components/badge/CertifStatus.vue | 28 ++++++++++++++++++++++
 components/badge/Quality.vue      |  6 +----
 components/badge/Status.vue       |  6 +----
 components/certif/List.vue        | 39 +++++++++++++++----------------
 pages/index.vue                   |  7 +-----
 pages/membres/_hash.vue           | 15 ++++--------
 pages/membres/index.vue           | 18 +++++++-------
 9 files changed, 69 insertions(+), 60 deletions(-)
 create mode 100644 components/badge/CertifStatus.vue

diff --git a/assets/css/style.scss b/assets/css/style.scss
index aeceb24..7ba1d0d 100644
--- a/assets/css/style.scss
+++ b/assets/css/style.scss
@@ -41,4 +41,8 @@ $close-font-weight: 500;
 .card-subtitle {
     font-style: italic;
     font-size: 90%;
+}
+
+.table-hover {
+    cursor: pointer;
 }
\ No newline at end of file
diff --git a/components/Graph.vue b/components/Graph.vue
index 8bf10f0..aa2f218 100644
--- a/components/Graph.vue
+++ b/components/Graph.vue
@@ -82,8 +82,4 @@ export default {
         }
     }
 }
-</script>
-
-<style>
-
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
diff --git a/components/badge/CertifStatus.vue b/components/badge/CertifStatus.vue
new file mode 100644
index 0000000..cee160b
--- /dev/null
+++ b/components/badge/CertifStatus.vue
@@ -0,0 +1,28 @@
+<template>
+    <span class="font-weight-normal" :class="classWarning" :title="textWarning" v-if="($options.filters.dateStatus(limitDate) != 'success') && (['MEMBER', 'MISSING'].includes(memberStatus))">âš 
+        <span class="sr-only">{{ textWarning }}</span>
+    </span>
+</template>
+
+<script>
+export default {
+    props: {
+        limitDate : {
+            type: Number,
+            default: 0
+        },
+        memberStatus : String
+    },
+    computed: {
+        classWarning: function() {
+            return {
+                'text-danger' : this.$options.filters.dateStatus(this.limitDate) == 'danger',
+                'text-warning' : this.$options.filters.dateStatus(this.limitDate) == 'warning'
+            }
+        },
+        textWarning: function() {
+            return (this.$options.filters.dateStatus(this.limitDate) == 'danger') ? 'En manque de certifications' : 'Bientôt en manque de certifications'
+        }
+    }
+}
+</script>
\ No newline at end of file
diff --git a/components/badge/Quality.vue b/components/badge/Quality.vue
index 37e4b49..261bb74 100644
--- a/components/badge/Quality.vue
+++ b/components/badge/Quality.vue
@@ -19,8 +19,4 @@ export default {
         }
     }
 }
-</script>
-
-<style>
-
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
diff --git a/components/badge/Status.vue b/components/badge/Status.vue
index c6fe45d..0301cf7 100644
--- a/components/badge/Status.vue
+++ b/components/badge/Status.vue
@@ -36,8 +36,4 @@ export default {
         }
     }
 }
-</script>
-
-<style>
-
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
diff --git a/components/certif/List.vue b/components/certif/List.vue
index f68d26a..a41453e 100644
--- a/components/certif/List.vue
+++ b/components/certif/List.vue
@@ -1,19 +1,22 @@
 <template>
-<div class="list-group">
-    <NuxtLink
-      :to="'/membres/'+getNeighbor(certif).hash"
-      class="list-group-item list-group-item-action d-lg-flex justify-content-between align-items-center"
-      :class="'list-group-item-'+ $options.filters.dateStatus(certif.expires_on)"
-      v-for="certif in certifsTriees"
-      :key="getNeighbor(certif).uid">
-      <div>
-        {{ getNeighbor(certif).uid }}
-        <BadgeStatus :membre="getNeighbor(certif)" />
-        <BadgeQuality :quality="getNeighbor(certif).quality.ratio" />
-      </div>
-    <small>Expire le {{ certif.expires_on | formatDate }}</small>
-    </NuxtLink>
-</div>
+    <div class="table-responsive">
+        <table class="table table-striped table-hover">
+            <tbody>
+                <tr v-for="certif in certifsTriees" :key="getNeighbor(certif).uid"
+                    @click="$router.push({ path: '/membres/' + getNeighbor(certif).hash })">
+                    <th scope="row">
+                        {{ getNeighbor(certif).uid }}
+                        <BadgeCertifStatus :limitDate="getNeighbor(certif).received_certifications.limit" :memberStatus="getNeighbor(certif).status" />
+                        <BadgeStatus :membre="getNeighbor(certif)" />
+                        <BadgeQuality :quality="getNeighbor(certif).quality.ratio" />
+                    </th>
+                    <td class="text-right">
+                        <small><span class="badge" :class="'badge-'+ $options.filters.dateStatus(certif.expires_on)">Expire le {{ certif.expires_on | formatDate }}</span></small>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+    </div>
 </template>
 
 <script>
@@ -43,8 +46,4 @@ export default {
         }
     }
 }
-</script>
-
-<style>
-
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
diff --git a/pages/index.vue b/pages/index.vue
index f38fe3c..99cad9f 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -36,9 +36,4 @@ export default {
     $nuxt.$emit('changeRoute',this.breadcrumb)
   }
 }
-</script>
-
-<style lang="sass" scoped>
-// CSS Lié au composant
-
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
diff --git a/pages/membres/_hash.vue b/pages/membres/_hash.vue
index 157f882..e40420d 100644
--- a/pages/membres/_hash.vue
+++ b/pages/membres/_hash.vue
@@ -10,10 +10,7 @@
       <div class="row mt-3" v-if="idFromHash.status != 'REVOKED'">
         <div class="col-12 col-md-6 mb-3">
           <h3>Certifications reçues 
-            <span :class="classWarning" v-if="(($options.filters.dateStatus(idFromHash.received_certifications.limit) == 'warning') || (!idFromHash.received_certifications.limit)) &&  idFromHash.status != 'NEWCOMER'">âš 
-              <span class="sr-only" v-if="$options.filters.dateStatus(idFromHash.received_certifications.limit) == 'danger'">En manque de certifications</span>
-              <span class="sr-only" v-else>Bientôt en manque de certifications</span>
-            </span>
+            <BadgeCertifStatus :limitDate="idFromHash.received_certifications.limit" :memberStatus="idFromHash.status" />
           </h3>
           <CertifList :certifs="idFromHash.received_certifications.certifications" type="recieved" />
         </div>
@@ -71,7 +68,6 @@ export default {
               dist_ok
             }
             received_certifications {
-              limit
               certifications {
                 from {
                   ...memberAttributes
@@ -94,6 +90,9 @@ export default {
           quality {
             ratio
           }
+          received_certifications {
+            limit
+          }
         }
       `,
       variables() {
@@ -121,8 +120,4 @@ export default {
     }
   }
 };
-</script>
-
-<style lang="sass">
-
-</style>
+</script>
\ No newline at end of file
diff --git a/pages/membres/index.vue b/pages/membres/index.vue
index 633b7e5..9fd6540 100644
--- a/pages/membres/index.vue
+++ b/pages/membres/index.vue
@@ -22,7 +22,11 @@
           <tbody>
             <tr v-for="member in idSearch.ids" :key="member.uid"
               @click="redirect('/membres/' + member.hash)">
-              <th scope="row">{{ member.uid }} <BadgeStatus :membre="member" /></th>
+              <th scope="row">
+                {{ member.uid }}
+                <BadgeCertifStatus :limitDate="member.received_certifications.limit" :memberStatus="member.status" />
+                <BadgeStatus :membre="member" />
+              </th>
               <td class="d-none d-xl-table-cell">{{ member.pubkey }}</td>
             </tr>
           </tbody>
@@ -73,6 +77,9 @@ export default {
             status
             hash
             limitDate
+            received_certifications {
+              limit
+            }
           }
         }
       } `,
@@ -89,11 +96,4 @@ export default {
     }
   }
 }
-</script>
-
-<style lang="sass" scoped>
-// CSS Lié au composant
-.table.table-striped tbody
-  tr
-    cursor: pointer
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
-- 
GitLab