Skip to content

Commit eb6e84e

Browse files
committed
fix ui problems
1 parent 75184cb commit eb6e84e

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/views/playground/KYCDashboardCredit.vue

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ h5 span {
216216
<tbody>
217217
<tr v-for="eachRow in getSortedKYCCredits" v-bind:key="eachRow._id">
218218
<td>
219-
{{ formatDate(eachRow.createdAt) }}
220-
</td>
219+
220+
{{ formatDate(eachRow.createdAt) }}
221221

222222
<td>
223223
{{ numberFormat(eachRow.totalCredits) }}
@@ -231,29 +231,34 @@ h5 span {
231231

232232

233233
<td v-if="eachRow.used >= eachRow.totalCredits" class="greyFont">
234-
Expired
234+
Credit Limit Reached
235+
235236
</td>
236-
<td v-else-if="!eachRow.expiresAt" class="greyFont">
237-
Inactive
237+
<td v-else-if="Date.now() > new Date(eachRow.expiresAt)" class="greyFont">
238+
Expired
238239
</td>
239240
<td v-else>
240241
{{ formatTimeRemaining(eachRow.expiresAt) }}
241242
</td>
243+
242244

243245

244246
<td :title="`Credit left: ${eachRow.totalCredits - eachRow.used}`" >
245-
<b-progress :max="eachRow.totalCredits" class="mt-1">
247+
<b-progress :max="eachRow.totalCredits" class="mt-1" v-if="Date.now() > new Date(eachRow.expiresAt)" >
248+
<b-progress-bar :value="eachRow.used" variant="danger" ></b-progress-bar>
249+
</b-progress>
250+
<b-progress :max="eachRow.totalCredits" class="mt-1" v-else >
246251
<b-progress-bar :value="eachRow.used" variant="danger" ></b-progress-bar>
247252
</b-progress>
248253
</td>
249254

250-
<td v-if="eachRow.status == 'Active'">
255+
<td v-if="(eachRow.status == 'Active' && !(Date.now() > new Date(eachRow.expiresAt)) ) ">
251256
<hf-buttons iconClass="circle-fill" :bIcon="true" class="ml-auto " style="color:gray; "
252257
disabled animate="throb" :name="eachRow.status">
253258
</hf-buttons>
254259
</td>
255260
<td v-else>
256-
<hf-buttons v-if="eachRow.used < eachRow.totalCredits" name=" Activate"
261+
<hf-buttons v-if="eachRow.used < eachRow.totalCredits && !(Date.now() > new Date(eachRow.expiresAt)) " name=" Activate"
257262
iconClass="play-circle" :bIcon="true" class="ml-auto "
258263
@executeAction="activateThisCredit(eachRow)"></hf-buttons>
259264
</td>
@@ -291,6 +296,7 @@ export default {
291296
292297
getSortedKYCCredits() {
293298
const t = this.getKYCCredits
299+
294300
return t.sort((a, b) => new Date(b.expiresAt) - new Date(a.expiresAt))
295301
},
296302
myKYCCredits() {
@@ -431,6 +437,10 @@ export default {
431437
clearInterval(this.timer); // Stop the interval timer
432438
},
433439
renderChart() {
440+
const expired = this.getKYCCredits.every(element => Date.now() > new Date(element.expiresAt));
441+
442+
443+
const color=expired?['grey','#d0d0d0']:['grey','green']
434444
this.doughNutChart?.destroy()
435445
const ctx = document.getElementById('doughNutChat');
436446
this.doughNutChart = new Chart(ctx, {
@@ -441,11 +451,7 @@ export default {
441451
{
442452
label: 'Credit',
443453
data: this.getKYCCredits.length == 0 ? [1, 0] : [this.myKYCCredits.allUsedCredits, this.myKYCCredits.allRemainingCredits],
444-
backgroundColor: [
445-
'grey',
446-
'green',
447-
448-
],
454+
backgroundColor: color,
449455
hoverOffset: 4,
450456
cutout: '50%',
451457
circumference: 180,

0 commit comments

Comments
 (0)