Allowance check
This commit is contained in:
@@ -47,31 +47,49 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group attendance-choice-box">
|
||||
<label for="kehadiran">Kehadiran</label>
|
||||
<select class="form-control attendance-select" id="kehadiran" name="kehadiran" required>
|
||||
<option value="0">Sila Pilih :</option>
|
||||
<option value="1">Fizikal</option>
|
||||
<option value="2">Maya</option>
|
||||
</select>
|
||||
<small class="form-text text-muted attendance-helper-text">
|
||||
Sila pilih kehadiran (Maya/Fizikal) kemudian klik “SAYA TERIMA”.
|
||||
</small>
|
||||
</div>
|
||||
<!-- Sembunyikan borang pendaftaran selepas kehadiran telah dihantar -->
|
||||
<template v-if="Number(data.user.kehadiran) === 0">
|
||||
<div class="form-group attendance-choice-box">
|
||||
<label for="kehadiran">Kehadiran</label>
|
||||
<select v-model="selectedKehadiran" class="form-control attendance-select" id="kehadiran"
|
||||
name="kehadiran" required>
|
||||
<option value="0">Sila Pilih :</option>
|
||||
<option value="1">Fizikal</option>
|
||||
<option value="2">Maya</option>
|
||||
</select>
|
||||
<small class="form-text text-muted attendance-helper-text">
|
||||
Sila pilih kehadiran (Maya/Fizikal) kemudian klik “SAYA TERIMA”.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info mt-4 small attendance-info-notice">
|
||||
<p><strong>*</strong> Pendaftaran akan dibuka dari <strong>jam 7.00 pagi hingga 10.00 pagi (25 April
|
||||
2025)</strong>.</p>
|
||||
<p>
|
||||
<strong>*</strong> Elaun kehadiran berjumlah <strong>RM300.00 (secara fizikal)</strong> akan
|
||||
diberikan secara TUNAI selepas mesyuarat. <br />
|
||||
Manakala <strong>RM150.00 (secara atas talian)</strong> akan dikreditkan ke akaun anggota yang
|
||||
hadir penuh.
|
||||
</p>
|
||||
</div>
|
||||
<div v-if="selectedKehadiran === '1'" class="form-group attendance-field">
|
||||
<label for="physical_gate_code">Kod skrin kaunter pendaftaran</label>
|
||||
<input type="text" name="physical_gate_code" id="physical_gate_code"
|
||||
class="form-control attendance-input" autocomplete="off" autocapitalize="characters"
|
||||
inputmode="text" placeholder="8 aksara, semak skrin di kaunter" maxlength="64"
|
||||
@input="onPhysicalGateCodeInput" />
|
||||
<small class="form-text text-muted attendance-helper-text">
|
||||
Kod berputar setiap minit — masukkan kod semasa yang dipaparkan di kaunter sebelum
|
||||
menghantar.
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info mt-4 small attendance-info-notice">
|
||||
<p><strong>*</strong> Pendaftaran akan dibuka dari <strong>jam 7.00 pagi hingga 10.00 pagi (25
|
||||
April
|
||||
2025)</strong>.</p>
|
||||
<p>
|
||||
<strong>*</strong> Elaun kehadiran berjumlah <strong>RM300.00 (secara fizikal)</strong> akan
|
||||
diberikan secara TUNAI selepas mesyuarat. <br />
|
||||
Manakala <strong>RM150.00 (secara atas talian)</strong> akan dikreditkan ke akaun anggota
|
||||
yang
|
||||
hadir penuh.
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="text-center mt-4 attendance-action-area">
|
||||
<div v-if="data.user.kehadiran != 0" class="attendance-success-card">
|
||||
<div v-if="data.user.kehadiran != 0 && canProceedToVote" class="attendance-success-card">
|
||||
<div class="attendance-success-kicker">Kehadiran Disahkan</div>
|
||||
<p class="attendance-success-text">Kehadiran anda telah disahkan secara</p>
|
||||
<h5 class="attendance-success-mode">
|
||||
@@ -83,10 +101,35 @@
|
||||
</router-link>
|
||||
</div>
|
||||
|
||||
<div v-else-if="data.user.kehadiran != 0 && !canProceedToVote" class="attendance-pending-card">
|
||||
<div class="attendance-pending-kicker">Menunggu pengesahan</div>
|
||||
<p class="attendance-pending-text">
|
||||
Kehadiran <strong>fizikal</strong> anda telah direkod. Sila pergi ke kaunter pendaftaran
|
||||
untuk
|
||||
mengesahkan pendaftaran sebelum anda boleh mengundi.
|
||||
</p>
|
||||
<p class="attendance-pending-hint">
|
||||
Selepas pengesahan, butang mengundi akan dipaparkan di sini. Semak semula halaman ini
|
||||
selepas beberapa ketika.
|
||||
</p>
|
||||
<button type="button" class="btn btn-default attendance-refresh-button"
|
||||
@click="reloadAttendanceState">
|
||||
Muat semula
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-lg btn-success attendance-submit-button"
|
||||
v-else-if="data.election.status == 2">
|
||||
SAYA TERIMA
|
||||
v-else-if="electionVotingActive">
|
||||
DAFTAR KEHADIRAN
|
||||
</button>
|
||||
<div v-else class="alert alert-info text-left attendance-voting-notice">
|
||||
<p class="attendance-voting-notice__title"><strong>Butang “DAFTAR KEHADIRAN” belum
|
||||
tersedia</strong>
|
||||
</p>
|
||||
<p class="attendance-voting-notice__body">
|
||||
Buat masa ini proses undian / mesyuarat <strong>belum bermula</strong>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
@@ -248,6 +291,43 @@
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.attendance-pending-card {
|
||||
padding: 24px;
|
||||
border-radius: 18px;
|
||||
background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
|
||||
border: 1px solid #fde68a;
|
||||
box-shadow: 0 14px 28px rgba(180, 83, 9, 0.1);
|
||||
}
|
||||
|
||||
.attendance-pending-kicker {
|
||||
margin-bottom: 10px;
|
||||
color: #b45309;
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.attendance-pending-text {
|
||||
margin-bottom: 10px;
|
||||
color: #43617a;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.attendance-pending-hint {
|
||||
margin-bottom: 18px;
|
||||
color: #6b7280;
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.attendance-refresh-button {
|
||||
min-width: 180px;
|
||||
padding: 10px 20px;
|
||||
border-radius: 999px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.attendance-submit-button,
|
||||
.attendance-vote-button {
|
||||
min-width: 220px;
|
||||
@@ -258,6 +338,21 @@
|
||||
box-shadow: 0 12px 24px rgba(35, 64, 97, 0.14);
|
||||
}
|
||||
|
||||
.attendance-voting-notice {
|
||||
max-width: 520px;
|
||||
margin: 0 auto;
|
||||
border-radius: 14px;
|
||||
}
|
||||
|
||||
.attendance-voting-notice__title {
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.attendance-voting-notice__body {
|
||||
margin: 0 0 10px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
.attendance-hero,
|
||||
@@ -271,7 +366,8 @@
|
||||
}
|
||||
|
||||
.attendance-submit-button,
|
||||
.attendance-vote-button {
|
||||
.attendance-vote-button,
|
||||
.attendance-refresh-button {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
@@ -284,11 +380,55 @@ export default {
|
||||
data: function () {
|
||||
return {
|
||||
loading: false,
|
||||
userSubmitted: false // Add a flag to track if the user has already submitted
|
||||
userSubmitted: false, // Add a flag to track if the user has already submitted
|
||||
selectedKehadiran: '0',
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {
|
||||
if (this.data && this.data.user && this.data.user.kehadiran == 0) {
|
||||
var el = document.getElementById('kehadiran');
|
||||
if (el) this.selectedKehadiran = el.value || '0';
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
/**
|
||||
* Status 2 = pilihan raya sedang berjalan (butang SAYA TERIMA dibuka).
|
||||
*/
|
||||
electionVotingActive: function () {
|
||||
var e = this.data && this.data.election;
|
||||
if (!e || e.status === undefined || e.status === null) return false;
|
||||
return Number(e.status) === 2;
|
||||
},
|
||||
|
||||
/**
|
||||
* Maya (2) can vote once attendance is set. Fizikal (1) needs admin verification timestamp.
|
||||
*/
|
||||
canProceedToVote: function () {
|
||||
var u = this.data && this.data.user;
|
||||
if (!u || Number(u.kehadiran) === 0) return false;
|
||||
if (Number(u.kehadiran) !== 1) return true;
|
||||
return Boolean(u.fizikal_registration_verified_at);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onPhysicalGateCodeInput: function (e) {
|
||||
var el = e.target;
|
||||
var upper = el.value.toUpperCase();
|
||||
if (el.value === upper) return;
|
||||
var start = el.selectionStart;
|
||||
var end = el.selectionEnd;
|
||||
el.value = upper;
|
||||
if (start != null && end != null) {
|
||||
el.setSelectionRange(start, end);
|
||||
}
|
||||
},
|
||||
|
||||
reloadAttendanceState: function () {
|
||||
location.reload();
|
||||
},
|
||||
// refreshUser: function () {
|
||||
|
||||
// var vm = this;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,475 @@
|
||||
<template>
|
||||
<div class="voter-nominees-page row col-md-10 col-md-offset-1">
|
||||
<div class="col-xs-12 page-column">
|
||||
<div class="page-section-heading">Maklumat Calon</div>
|
||||
<div class="nominee-page-intro">
|
||||
Tekan gambar atau baris calon untuk melihat maklumat penuh.
|
||||
</div>
|
||||
|
||||
<div class="panel panel-primary nominee-panel" v-for="position in data.positions" :key="position.id">
|
||||
<div class="panel-heading nominee-panel-heading">
|
||||
<span>{{ position.name }}</span>
|
||||
<span class="nominee-panel-badge">Senarai Calon</span>
|
||||
</div>
|
||||
<div class="panel-body table-responsive nominee-panel-body">
|
||||
<table class="table table-hover nominee-table" id="table-nominee">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Bil.</th>
|
||||
<th>Nama</th>
|
||||
<th>No. Anggota</th>
|
||||
<th>Unit</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(nominee, i) in data.nominees" :key="nominee.id" v-if="nominee.position_id == position.id"
|
||||
class="nominee-row" @click="viewNomineeDetails(nominee)">
|
||||
<td>
|
||||
<img :src="createBase64ImageUrl(nominee.photo)" class="thumbnail nominee-thumb">
|
||||
</td>
|
||||
<td>{{ nominee.no_calon }}</td>
|
||||
<td>{{ nominee.name }}</td>
|
||||
<td>{{ nominee.no_anggota }}</td>
|
||||
<td>{{ nominee.unit }}</td>
|
||||
</tr>
|
||||
<tr v-if="!data.nominees.some(nominee => nominee.position_id == position.id)">
|
||||
<td colspan="5" class="nominee-empty-state">Tiada calon untuk jawatan ini.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="showNomineeModal" class="modal-backdrop nominee-modal-backdrop" @click.self="closeNomineeModal">
|
||||
<div class="modal-dialog" id="view-nominee-modal">
|
||||
<div class="modal-content nominee-modal-content">
|
||||
<div class="modal-header">
|
||||
<div>
|
||||
<h5 class="modal-title">Maklumat Calon</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body nominee-modal-body">
|
||||
<div class="photo-section">
|
||||
<div class="nominee-photo-card">
|
||||
<img :src="nomineeViewed.photo" class="thumbnail nominee-viewed-photo" />
|
||||
<div class="nominee-photo-meta">
|
||||
<div class="nominee-name">{{ nomineeViewed.name }}</div>
|
||||
<div class="nominee-subtitle">
|
||||
Calon No. {{ nomineeViewed.no_calon || '-' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-section">
|
||||
<div class="nominee-summary-grid">
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Nama</span>
|
||||
<span class="summary-value">{{ nomineeViewed.name || '-' }}</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Unit</span>
|
||||
<span class="summary-value">{{ nomineeViewed.unit || '-' }}</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Umur</span>
|
||||
<span class="summary-value">{{ nomineeViewed.umur || '-' }}</span>
|
||||
</div>
|
||||
<div class="summary-item">
|
||||
<span class="summary-label">Jawatan Sekarang</span>
|
||||
<span class="summary-value">{{ nomineeViewed.jawatan_sekarang || '-' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nominee-section-card">
|
||||
<div class="section-title">Taraf Pendidikan</div>
|
||||
<ol v-if="nomineeViewed.education && nomineeViewed.education.length" class="detail-list">
|
||||
<li v-for="(item, index) in nomineeViewed.education" :key="index">{{ item }}</li>
|
||||
</ol>
|
||||
<p v-else class="detail-empty">Tiada maklumat pendidikan.</p>
|
||||
</div>
|
||||
|
||||
<div class="nominee-section-card">
|
||||
<div class="section-title">Pengalaman Kerja</div>
|
||||
<ol v-if="nomineeViewed.experience && nomineeViewed.experience.length" class="detail-list">
|
||||
<li v-for="(item, index) in nomineeViewed.experience" :key="index">{{ item }}</li>
|
||||
</ol>
|
||||
<p v-else class="detail-empty">Tiada maklumat pengalaman kerja.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-success" @click="closeNomineeModal">Tutup</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nomineeViewed: {},
|
||||
showNomineeModal: false
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
viewNomineeDetails(nominee) {
|
||||
this.nomineeViewed = { ...nominee };
|
||||
this.nomineeViewed.photo = this.createBase64ImageUrl(nominee.photo);
|
||||
this.showNomineeModal = true;
|
||||
},
|
||||
|
||||
closeNomineeModal() {
|
||||
this.showNomineeModal = false;
|
||||
},
|
||||
|
||||
createBase64ImageUrl(photo) {
|
||||
return `data:image/jpeg;base64,${photo}`;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.voter-nominees-page {
|
||||
margin-top: 24px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.page-column {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.page-section-heading {
|
||||
margin-bottom: 14px;
|
||||
padding: 14px 18px;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(135deg, #0d6efd, #2f80ed);
|
||||
color: #fff;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
box-shadow: 0 12px 28px rgba(13, 110, 253, 0.2);
|
||||
}
|
||||
|
||||
.nominee-page-intro {
|
||||
margin-bottom: 18px;
|
||||
padding: 12px 16px;
|
||||
border-radius: 12px;
|
||||
background: #eef5ff;
|
||||
border: 1px solid #dbe8ff;
|
||||
color: #36506b;
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
.nominee-panel {
|
||||
margin-bottom: 20px;
|
||||
border: 0;
|
||||
border-radius: 18px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 14px 28px rgba(35, 64, 97, 0.1);
|
||||
}
|
||||
|
||||
.nominee-panel-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 20px;
|
||||
background: linear-gradient(135deg, #1d4e89, #2563eb);
|
||||
color: #fff;
|
||||
font-size: 1.7rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.nominee-panel-badge {
|
||||
padding: 6px 10px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nominee-panel-body {
|
||||
padding: 0;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.nominee-table {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.nominee-table thead {
|
||||
background: #f4f8fd;
|
||||
}
|
||||
|
||||
.nominee-table thead th {
|
||||
border-bottom: 1px solid #dce7f5;
|
||||
color: #48627e;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
.nominee-table tbody td {
|
||||
vertical-align: middle;
|
||||
border-top: 1px solid #edf2f7;
|
||||
color: #22384f;
|
||||
}
|
||||
|
||||
.nominee-row {
|
||||
cursor: pointer;
|
||||
transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
|
||||
}
|
||||
|
||||
.nominee-row:hover {
|
||||
background: #f8fbff;
|
||||
box-shadow: inset 4px 0 0 #2f80ed;
|
||||
}
|
||||
|
||||
.nominee-thumb {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin-bottom: 0;
|
||||
border: 2px solid #dbe8ff;
|
||||
border-radius: 16px;
|
||||
object-fit: cover;
|
||||
box-shadow: 0 8px 18px rgba(47, 128, 237, 0.12);
|
||||
}
|
||||
|
||||
.nominee-empty-state {
|
||||
padding: 18px !important;
|
||||
text-align: center;
|
||||
color: #6f8193;
|
||||
}
|
||||
|
||||
.nominee-modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 1050;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px 16px;
|
||||
background: rgba(7, 25, 48, 0.72);
|
||||
backdrop-filter: blur(3px);
|
||||
}
|
||||
|
||||
#view-nominee-modal.modal-dialog {
|
||||
width: 100%;
|
||||
max-width: 960px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.nominee-modal-content {
|
||||
border: 0;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
|
||||
}
|
||||
|
||||
.nominee-modal-content .modal-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 20px 24px 16px;
|
||||
border-bottom: 1px solid #e7edf5;
|
||||
background: linear-gradient(135deg, #0d6efd, #2f80ed);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nominee-modal-content .modal-title {
|
||||
margin: 4px 0 0;
|
||||
font-size: 2.2rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.nominee-modal-content .modal-header .close {
|
||||
margin-top: -4px;
|
||||
color: #fff;
|
||||
opacity: 0.9;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.nominee-modal-kicker {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.nominee-modal-body {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
padding: 24px;
|
||||
background: #f5f8fc;
|
||||
}
|
||||
|
||||
.photo-section {
|
||||
flex: 0 0 300px;
|
||||
}
|
||||
|
||||
.nominee-photo-card {
|
||||
padding: 18px;
|
||||
border-radius: 18px;
|
||||
background: #fff;
|
||||
border: 1px solid #e5ebf3;
|
||||
box-shadow: 0 10px 24px rgba(35, 64, 97, 0.08);
|
||||
}
|
||||
|
||||
.nominee-viewed-photo {
|
||||
width: 100%;
|
||||
height: 320px;
|
||||
object-fit: cover;
|
||||
border: 0;
|
||||
border-radius: 14px;
|
||||
margin: 0 0 16px;
|
||||
background: #eef3f8;
|
||||
}
|
||||
|
||||
.nominee-photo-meta {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nominee-name {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: #17324d;
|
||||
}
|
||||
|
||||
.nominee-subtitle {
|
||||
margin-top: 4px;
|
||||
font-size: 1.4rem;
|
||||
color: #5f7388;
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.nominee-summary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 14px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.summary-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 14px 16px;
|
||||
border-radius: 14px;
|
||||
background: #fff;
|
||||
border: 1px solid #e5ebf3;
|
||||
box-shadow: 0 8px 22px rgba(35, 64, 97, 0.06);
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-size: 1.2rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: #6f8193;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
color: #17324d;
|
||||
}
|
||||
|
||||
.nominee-section-card {
|
||||
margin-bottom: 16px;
|
||||
padding: 18px 20px;
|
||||
border-radius: 16px;
|
||||
background: #fff;
|
||||
border: 1px solid #e5ebf3;
|
||||
box-shadow: 0 8px 22px rgba(35, 64, 97, 0.06);
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin-bottom: 12px;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: #17324d;
|
||||
}
|
||||
|
||||
.detail-list {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
color: #30475f;
|
||||
}
|
||||
|
||||
.detail-list li {
|
||||
margin-bottom: 8px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.detail-empty {
|
||||
margin: 0;
|
||||
color: #6f8193;
|
||||
}
|
||||
|
||||
.nominee-modal-content .modal-footer {
|
||||
padding: 16px 24px 22px;
|
||||
border-top: 1px solid #e7edf5;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.nominee-modal-backdrop {
|
||||
align-items: flex-start;
|
||||
overflow-y: auto;
|
||||
padding: 16px 10px;
|
||||
}
|
||||
|
||||
.nominee-modal-body {
|
||||
flex-direction: column;
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.photo-section {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.nominee-viewed-photo {
|
||||
height: 260px;
|
||||
}
|
||||
|
||||
.nominee-summary-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.page-section-heading {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.nominee-panel-heading {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.nominee-table thead th:nth-child(4),
|
||||
.nominee-table tbody td:nth-child(4),
|
||||
.nominee-table thead th:nth-child(5),
|
||||
.nominee-table tbody td:nth-child(5) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 991px) {
|
||||
.voter-nominees-page {
|
||||
margin-top: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -12,8 +12,8 @@
|
||||
<ul class="list-group vote-summary-list">
|
||||
<li class="list-group-item vote-summary-item">
|
||||
<div class="vote-position-name">Calon Dipilih</div>
|
||||
<div v-if="selected[0] && selected[0].nominee_id.length" class="vote-selected-list">
|
||||
<div class="vote-selected-item" v-for="nominee_id in selected[0].nominee_id" :key="nominee_id">
|
||||
<div v-if="allSelectedNomineeIds.length" class="vote-selected-list">
|
||||
<div class="vote-selected-item" v-for="nominee_id in allSelectedNomineeIds" :key="nominee_id">
|
||||
<span class="vote-selected-badge">#{{ getNomineeNo(nominee_id) }}</span>
|
||||
<span>{{ getSelectedNomineeName(nominee_id) }}</span>
|
||||
</div>
|
||||
@@ -73,7 +73,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal vote-confirm-modal" id="vote-modal" tabindex="-2" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
<div class="modal fade app-modal vote-confirm-modal" id="vote-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content vote-modal-content">
|
||||
@@ -88,9 +88,9 @@
|
||||
</div>
|
||||
<div class="modal-body vote-modal-body">
|
||||
<h5 class="vote-modal-note">Nota: Sila pastikan anda telah membuat undian dengan betul.</h5>
|
||||
<div class="vote-modal-selection" v-if="selected[0] && selected[0].nominee_id.length">
|
||||
<div class="vote-modal-selection" v-if="allSelectedNomineeIds.length">
|
||||
<div class="vote-modal-selection-title">Calon dipilih</div>
|
||||
<div class="vote-selected-item" v-for="nominee_id in selected[0].nominee_id" :key="nominee_id">
|
||||
<div class="vote-selected-item" v-for="nominee_id in allSelectedNomineeIds" :key="nominee_id">
|
||||
<span class="vote-selected-badge">#{{ getNomineeNo(nominee_id) }}</span>
|
||||
<span>{{ getSelectedNomineeName(nominee_id) }}</span>
|
||||
</div>
|
||||
@@ -130,8 +130,20 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
/** All nominee ids chosen across every position (sidebar + modal must use this, not selected[0]). */
|
||||
allSelectedNomineeIds() {
|
||||
var ids = [];
|
||||
for (var i = 0; i < this.selected.length; i++) {
|
||||
var arr = this.selected[i] && Array.isArray(this.selected[i].nominee_id)
|
||||
? this.selected[i].nominee_id
|
||||
: [];
|
||||
for (var j = 0; j < arr.length; j++) ids.push(arr[j]);
|
||||
}
|
||||
return ids;
|
||||
},
|
||||
|
||||
disabledCheckboxes() {
|
||||
const selectedNomineeIds = this.selected[0]['nominee_id'];
|
||||
const selectedNomineeIds = this.allSelectedNomineeIds;
|
||||
return this.data.nominees.map(nominee => {
|
||||
return selectedNomineeIds.includes(nominee.id) ? false : this.checkDisabled();
|
||||
});
|
||||
@@ -139,12 +151,23 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
totalSelectedCount: function () {
|
||||
return this.allSelectedNomineeIds.length;
|
||||
},
|
||||
|
||||
selectedEntryForPosition: function (position_id) {
|
||||
for (var i = 0; i < this.selected.length; i++) {
|
||||
if (String(this.selected[i].position_id) === String(position_id)) return this.selected[i];
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
test: function () {
|
||||
console.log('tab');
|
||||
this.util.showModal('#vote-modal')
|
||||
},
|
||||
submit: function () {
|
||||
if (this.selected[0]['nominee_id'].length !== this.max) {
|
||||
if (this.totalSelectedCount() !== this.max) {
|
||||
// No selections made
|
||||
this.util.notify(`Sila pastikan anda memilih (${this.max}) orang calon.`, 'error');
|
||||
return;
|
||||
@@ -152,7 +175,7 @@ export default {
|
||||
|
||||
var vm = this;
|
||||
this.util.notify('Submitting your vote, please wait...', 'loading');
|
||||
console.log(this.selected)
|
||||
console.log(this.selected);
|
||||
// Prepare data to send to the server
|
||||
let data = {
|
||||
vote: this.selected
|
||||
@@ -162,6 +185,10 @@ export default {
|
||||
axios.post(config.API + 'election/vote', data)
|
||||
.then(response => {
|
||||
$.notifyClose();
|
||||
// Some endpoints may not return a `message`; ensure we never notify "undefined".
|
||||
if (response && response.data && typeof response.data.message === 'string' && response.data.message) {
|
||||
vm.util.notify(response.data.message, 'success');
|
||||
}
|
||||
if (vm.util.showResult(response, 'success')) {
|
||||
vm.data.result = response.data.result;
|
||||
vm.$router.push({ name: 'Voter Home' });
|
||||
@@ -194,22 +221,19 @@ export default {
|
||||
},
|
||||
vote: function (position_id, nominee_id) {
|
||||
|
||||
if (!this.selected[0]['position_id']) {
|
||||
this.$set(this.selected[0], position_id, []);
|
||||
}
|
||||
const index = this.selected[0]['nominee_id'].indexOf(nominee_id);
|
||||
if (index === -1) {
|
||||
// Nominee not found, add it
|
||||
if (this.selected[0]['nominee_id'].length < this.max) {
|
||||
this.selected[0]['nominee_id'].push(nominee_id);
|
||||
} else {
|
||||
// Display warning message if more than 2 nominees are selected
|
||||
var entry = this.selectedEntryForPosition(position_id);
|
||||
if (!entry) return;
|
||||
|
||||
var idx = entry.nominee_id.indexOf(nominee_id);
|
||||
if (idx === -1) {
|
||||
// Enforce global max selection across all positions
|
||||
if (this.totalSelectedCount() >= this.max) {
|
||||
this.util.notify(`Boleh mengundi (${this.max}) calon sahaja!`, 'warning');
|
||||
return;
|
||||
}
|
||||
entry.nominee_id.push(nominee_id);
|
||||
} else {
|
||||
// Nominee found, remove it
|
||||
this.selected[0]['nominee_id'].splice(index, 1);
|
||||
entry.nominee_id.splice(idx, 1);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -264,7 +288,7 @@ export default {
|
||||
},
|
||||
|
||||
checkUndi: function () {
|
||||
if (this.selected[0]['nominee_id'].length <= 0) {
|
||||
if (this.totalSelectedCount() <= 0) {
|
||||
this.util.notify('Sila pastikan anda memilih (1) orang calon.', 'error');
|
||||
} else {
|
||||
this.util.showModal('#vote-modal');
|
||||
@@ -273,7 +297,7 @@ export default {
|
||||
},
|
||||
|
||||
checkDisabled: function () {
|
||||
if (this.selected[0]['nominee_id'].length >= this.max) {
|
||||
if (this.totalSelectedCount() >= this.max) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user