From 55f0a1a6285c59bcb0c24b22c5c0d47be015ddba Mon Sep 17 00:00:00 2001
From: Angelina Filippova <linakirsanova@gmail.com>
Date: Mon, 9 Sep 2019 19:03:29 +0300
Subject: [PATCH] Add Used tag and sorting in token table

---
 src/lang/en.js              |  3 ++-
 src/views/invites/index.vue | 13 ++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/lang/en.js b/src/lang/en.js
index 5b6a8ce8..829aa6f0 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -317,6 +317,7 @@ export default {
     create: 'Create',
     revoke: 'Revoke',
     id: 'ID',
-    actions: 'Actions'
+    actions: 'Actions',
+    active: 'Active'
   }
 }
diff --git a/src/views/invites/index.vue b/src/views/invites/index.vue
index c1f0c79c..308c39a4 100644
--- a/src/views/invites/index.vue
+++ b/src/views/invites/index.vue
@@ -41,10 +41,12 @@
     <el-table
       v-loading="loading"
       :data="tokens"
+      :default-sort = "{prop: 'used', order: 'ascending'}"
       class="invite-token-table">
       <el-table-column
         :label="$t('invites.id')"
         prop="id"
+        sortable
         min-width="60"/>
       <el-table-column
         :label="$t('invites.token')"
@@ -53,10 +55,12 @@
       <el-table-column
         :label="$t('invites.expiresAt')"
         prop="expires_at"
+        sortable
         min-width="110"/>
       <el-table-column
         :label="$t('invites.maxUse')"
         prop="max_use"
+        sortable
         min-width="60"/>
       <el-table-column
         :label="$t('invites.uses')"
@@ -65,7 +69,14 @@
       <el-table-column
         :label="$t('invites.used')"
         prop="used"
-        min-width="60"/>
+        sortable
+        min-width="60">
+        <template slot-scope="scope">
+          <el-tag
+            :type="scope.row.used ? 'danger' : 'success'"
+            disable-transitions>{{ scope.row.used ? $t('invites.used') : $t('invites.active') }}</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column
         :label="$t('invites.actions')"
         min-width="100">
-- 
GitLab