Add view nominee modal
This commit is contained in:
@@ -1,158 +1,242 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="row col-md-10 col-md-offset-1">
|
<div class="row col-md-10 col-md-offset-1">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<h4>Maklumat Anggota</h4>
|
<h4>Maklumat Anggota</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item"><b>Nama : </b>{{ data.user.name }}</li>
|
<li class="list-group-item"><b>Nama : </b>{{ data.user.name }}</li>
|
||||||
<li class="list-group-item"><b>No. Kad Pengenalan : </b>{{ data.user.no_kp }}</li>
|
<li class="list-group-item"><b>No. Kad Pengenalan : </b>{{ data.user.no_kp }}</li>
|
||||||
<li class="list-group-item"><b>No. Anggota : </b>{{ data.user.no_anggota }}
|
<li class="list-group-item"><b>No. Anggota : </b>{{ data.user.no_anggota }}
|
||||||
<li class="list-group-item"><b>Unit : </b>{{ data.user.unit }}</li>
|
<li class="list-group-item"><b>Unit : </b>{{ data.user.unit }}</li>
|
||||||
<li class="list-group-item"><b>Saham : </b>{{ data.user.saham }}</li>
|
<li class="list-group-item"><b>Saham : </b>{{ data.user.saham }}</li>
|
||||||
<li class="list-group-item"><b>Yuran : </b>{{ data.user.yuran }}</li>
|
<li class="list-group-item"><b>Yuran : </b>{{ data.user.yuran }}</li>
|
||||||
<li class="list-group-item" v-if="data.election.status == 1">
|
<li class="list-group-item" v-if="data.election.status == 1">
|
||||||
<center>Undian belum bermula</center>
|
<center>Undian belum bermula</center>
|
||||||
</li>
|
</li>
|
||||||
<li class="list-group-item" v-if="data.election.status == 2 && !hasVoted()">
|
<li class="list-group-item" v-if="data.election.status == 2 && !hasVoted()">
|
||||||
<center>
|
<center>
|
||||||
<router-link v-if="data.user.saham >= 500" :to="{ name: 'Vote' }"
|
<router-link v-if="data.user.saham >= 500" :to="{ name: 'Vote' }" class="btn btn-info">
|
||||||
class="btn btn-info">
|
Undi Sekarang
|
||||||
Undi Sekarang
|
</router-link>
|
||||||
</router-link>
|
<div v-else class="alert alert-danger" role="alert">
|
||||||
<div v-else class="alert alert-danger" role="alert">
|
Saham minima tidak mencukupi untuk pengundian
|
||||||
Saham minima tidak mencukupi untuk pengundian
|
</div>
|
||||||
</div>
|
</center>
|
||||||
</center>
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
</ul>
|
<div v-if="hasVoted()">
|
||||||
<div v-if="hasVoted()">
|
<hr />
|
||||||
<hr />
|
<h4>Maklumat Undian Anda</h4>
|
||||||
<h4>Maklumat Undian Anda</h4>
|
<hr />
|
||||||
<hr />
|
<ul class="list-group">
|
||||||
<ul class="list-group">
|
<li class="list-group-item" v-for="result in data.result">
|
||||||
<li class="list-group-item" v-for="result in data.result">
|
<b>{{ getPosition(result.position_id) }} : </b>{{ getNominee(result.nominee_id) }}
|
||||||
<b>{{ getPosition(result.position_id) }} : </b>{{ getNominee(result.nominee_id) }}
|
</li>
|
||||||
</li>
|
</ul>
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<h4>Maklumat Calon</h4>
|
<h4>Maklumat Calon</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<!-- <small>Click Picture to see details</small> -->
|
<!-- <small>Click Picture to see details</small> -->
|
||||||
<div class="panel panel-primary" v-for="position in data.positions">
|
<div class="panel panel-primary" v-for="position in data.positions">
|
||||||
<div class="panel-heading">{{ position.name }}</div>
|
<div class="panel-heading">{{ position.name }}</div>
|
||||||
<div class="panel-body table-responsive">
|
<div class="panel-body table-responsive">
|
||||||
<table class="table table-hover">
|
<table id="table-nominee" class="table table-hover">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th>Nama</th>
|
<th>Nama</th>
|
||||||
<th>No. Anggota</th>
|
<th>No. Anggota</th>
|
||||||
<th>Unit</th>
|
<th>Unit</th>
|
||||||
<th>Taraf Pendidikan</th>
|
<th>Taraf Pendidikan</th>
|
||||||
<th>Pengalaman Kerja </th>
|
<th>Pengalaman Kerja </th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="(nominee, i) in data.nominees" v-if="nominee.position_id == position.id">
|
<tr v-for="(nominee, i) in data.nominees" v-if="nominee.position_id == position.id"
|
||||||
<td><img @click="view(nominee, i)" :src="createBase64ImageUrl(nominee.photo)"
|
v-on:click="viewNomineeDetails(nominee)">
|
||||||
class="thumbnail" style="height: 60px;width: 60px;" />
|
<td><img @click="view(nominee, i)" :src="createBase64ImageUrl(nominee.photo)"
|
||||||
</td>
|
class="thumbnail" style="height: 60px;width: 60px;" />
|
||||||
<td>{{ nominee.name }}</td>
|
</td>
|
||||||
<td>{{ nominee.no_anggota }}</td>
|
<td>{{ nominee.name }}</td>
|
||||||
<td>{{ nominee.unit }}</td>
|
<td>{{ nominee.no_anggota }}</td>
|
||||||
<td>{{ nominee.education }}</td>
|
<td>{{ nominee.unit }}</td>
|
||||||
<td>{{ nominee.experience }}</td>
|
<td>{{ nominee.education }}</td>
|
||||||
</tr>
|
<td>{{ nominee.experience }}</td>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</tbody>
|
||||||
</div>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<modal id="nominee-information-modal" aClass="primary">
|
<modal id="nominee-information-modal" aClass="primary">
|
||||||
<modal-header>{{ header }}</modal-header>
|
<modal-header>{{ header }}</modal-header>
|
||||||
<modal-body>
|
<modal-body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<img :src="data.storageURL + x.image" style="height: 150px; width: 150px"
|
<img :src="data.storageURL + x.image" style="height: 150px; width: 150px"
|
||||||
class="thumbnail" />
|
class="thumbnail" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9" style="margin-left: 5px;">
|
<div class="col-md-9" style="margin-left: 5px;">
|
||||||
<h3><strong><em>"{{ x.motto }}"</em></strong></h3>
|
<h3><strong><em>"{{ x.motto }}"</em></strong></h3>
|
||||||
<b> Name : </b>{{ x.name }}<br />
|
<b> Name : </b>{{ x.name }}<br />
|
||||||
<b> Unit : </b>{{ x.unit }}<br />
|
<b> Unit : </b>{{ x.unit }}<br />
|
||||||
<b> education : </b>{{ getPartylist(x.education) }}<br />
|
<b> education : </b>{{ getPartylist(x.education) }}<br />
|
||||||
<hr />
|
<hr />
|
||||||
{{ x.experience }}
|
{{ x.experience }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</modal-body>
|
</modal-body>
|
||||||
<modal-footer>
|
<modal-footer>
|
||||||
<button data-dismiss="modal" class="btn btn-default">Close</button>
|
<button data-dismiss="modal" class="btn btn-default">Close</button>
|
||||||
</modal-footer>
|
</modal-footer>
|
||||||
</modal>
|
</modal>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="view-nominee-modal" class="modal" tabindex="-1">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" style="display: inline;">Maklumat Calon</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="content">
|
||||||
|
<div class="photo-section">
|
||||||
|
<img :src="nomineeViewed.photo" class="thumbnail nominee-viewed-photo" />
|
||||||
|
</div>
|
||||||
|
<div class="detail-section">
|
||||||
|
<span><b> Name : </b>{{ nomineeViewed.name }}</span>
|
||||||
|
<span><b> Unit : </b>{{ nomineeViewed.unit }}</span>
|
||||||
|
<span><b> Education : </b>{{ nomineeViewed.education }}</span>
|
||||||
|
<span><b> Experience : </b>{{ nomineeViewed.experience }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { R } from '@bachdgvn/vue-otp-input';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
created: function () {
|
created: function () {
|
||||||
//console.log(this)
|
//console.log(this)
|
||||||
},
|
},
|
||||||
|
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
x: {},
|
x: {},
|
||||||
selectedNomineeId: null
|
selectedNomineeId: null,
|
||||||
}
|
nomineeViewed: {},
|
||||||
},
|
}
|
||||||
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
hasVoted: function () {
|
hasVoted: function () {
|
||||||
return this.data.result.length > 0;
|
return this.data.result.length > 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
getPartylist: function (id) {
|
getPartylist: function (id) {
|
||||||
let partylists = this.data.partylists;
|
let partylists = this.data.partylists;
|
||||||
for (var i in partylists)
|
for (var i in partylists)
|
||||||
if (partylists[i]['id'] == id) return partylists[i]['name'];
|
if (partylists[i]['id'] == id) return partylists[i]['name'];
|
||||||
return 'No Partylist';
|
return 'No Partylist';
|
||||||
},
|
},
|
||||||
|
|
||||||
getPosition: function (id) {
|
getPosition: function (id) {
|
||||||
let positions = this.data.positions;
|
let positions = this.data.positions;
|
||||||
for (var i in positions)
|
for (var i in positions)
|
||||||
if (positions[i].id == id) return positions[i].name;
|
if (positions[i].id == id) return positions[i].name;
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
|
|
||||||
getNominee: function (id) {
|
getNominee: function (id) {
|
||||||
let nominees = this.data.nominees;
|
let nominees = this.data.nominees;
|
||||||
for (var i in nominees)
|
for (var i in nominees)
|
||||||
if (nominees[i]['id'] == id) return nominees[i].name;
|
if (nominees[i]['id'] == id) return nominees[i].name;
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
|
|
||||||
view: function (nominee, index) {
|
view: function (nominee, index) {
|
||||||
this.x = nominee;
|
this.x = nominee;
|
||||||
this.selectedNomineeId = index; // Assuming index is the ID
|
this.selectedNomineeId = index; // Assuming index is the ID
|
||||||
this.util.showModal('#nominee-information-modal');
|
this.util.showModal('#nominee-information-modal');
|
||||||
},
|
},
|
||||||
|
|
||||||
createBase64ImageUrl: function (base64ImageData) {
|
createBase64ImageUrl: function (base64ImageData) {
|
||||||
return "data:image/png;base64," + base64ImageData;
|
return "data:image/png;base64," + base64ImageData;
|
||||||
}
|
},
|
||||||
|
|
||||||
},
|
viewNomineeDetails: function (nominee) {
|
||||||
|
this.nomineeViewed = {...nominee};
|
||||||
|
this.nomineeViewed.photo = this.createBase64ImageUrl(nominee.photo);
|
||||||
|
$('#view-nominee-modal').modal();
|
||||||
|
}
|
||||||
|
|
||||||
computed: {
|
},
|
||||||
header: function () {
|
|
||||||
return this.x.name + ' for ' + this.getPosition(this.x.position_id);
|
computed: {
|
||||||
}
|
header: function () {
|
||||||
}
|
return this.x.name + ' for ' + this.getPosition(this.x.position_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
#view-nominee-modal .modal-dialog {
|
||||||
|
width: 850px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#view-nominee-modal .nominee-viewed-photo {
|
||||||
|
height:320px;
|
||||||
|
width:280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#view-nominee-modal .content {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
#view-nominee-modal .photo-section {
|
||||||
|
flex: 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
#view-nominee-modal .detail-section {
|
||||||
|
flex: 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
#view-nominee-modal span {
|
||||||
|
display: block;
|
||||||
|
padding-top: 5px;
|
||||||
|
padding-bottom: 5px;
|
||||||
|
padding-left: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#table-nominee tbody tr {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulseBackground {
|
||||||
|
0% { background-color: #FFFFBF; } /* Start color */
|
||||||
|
50% { background-color: #ffffff; } /* Middle color (white) */
|
||||||
|
100% { background-color: #FFFFBF; } /* End color (same as start) */
|
||||||
|
}
|
||||||
|
|
||||||
|
#table-nominee tbody tr:hover {
|
||||||
|
animation: pulseBackground 3s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate; /* Animation duration, timing function, and repetition */
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user