DONE: settle disable vote for voter with saham under 500, fix issue on...
This commit is contained in:
@@ -96,9 +96,19 @@
|
||||
{{ data.user.kehadiran == 1 ? 'FIZIKAL' : 'MAYA' }}
|
||||
</h5>
|
||||
|
||||
<router-link :to="{ name: 'Vote' }" class="btn btn-warning attendance-vote-button">
|
||||
Undi Sekarang
|
||||
</router-link>
|
||||
<template v-if="canVoteBySaham">
|
||||
<router-link :to="{ name: 'Vote' }" class="btn btn-warning attendance-vote-button">
|
||||
Undi Sekarang
|
||||
</router-link>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="alert alert-warning attendance-saham-block-alert" role="alert">
|
||||
{{ sahamVoteBlockedMessage }}
|
||||
</div>
|
||||
<button type="button" class="btn btn-warning attendance-vote-button" disabled>
|
||||
Undi Sekarang
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<div v-else-if="data.user.kehadiran != 0 && !canProceedToVote" class="attendance-pending-card">
|
||||
@@ -291,6 +301,15 @@
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.attendance-saham-block-alert {
|
||||
margin: 0 auto 16px;
|
||||
max-width: 520px;
|
||||
text-align: left;
|
||||
border-radius: 12px;
|
||||
font-size: 1.05rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.attendance-pending-card {
|
||||
padding: 24px;
|
||||
border-radius: 18px;
|
||||
@@ -410,6 +429,16 @@ export default {
|
||||
if (!u || Number(u.kehadiran) === 0) return false;
|
||||
if (Number(u.kehadiran) !== 1) return true;
|
||||
return Boolean(u.fizikal_registration_verified_at);
|
||||
},
|
||||
|
||||
/** Saham (RM) must be at least 500 to vote — same rule as home / vote pages. */
|
||||
canVoteBySaham: function () {
|
||||
var s = Number(this.data && this.data.user && this.data.user.saham);
|
||||
return !Number.isNaN(s) && s >= 500;
|
||||
},
|
||||
|
||||
sahamVoteBlockedMessage: function () {
|
||||
return 'Undian tidak tersedia: jumlah saham anda mestilah sekurang-kurangnya RM 500.';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -460,9 +489,10 @@ export default {
|
||||
vm.loading = false;
|
||||
|
||||
if (vm.util.showResult(response, 'success')) {
|
||||
// ✅ Redirect to vote page
|
||||
location.reload();
|
||||
vm.$router.push({ name: 'Vote' }); // OR use path: vm.$router.push('/vote');
|
||||
if (vm.canVoteBySaham) {
|
||||
vm.$router.push({ name: 'Vote' });
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user